ATmega1284P: End to End using 1.0 IDE

I believe so:

Extended - 0xFD
High - 0xDE
Low - 0xFF

I may have a connection tweaked, Ill re-check them tomorrow. But I was able to load an Arduino IDE compiled .hex in fine using AVR studio. Huh?

Hey CR thanks again that did save me time.

Glad to help.
I bootloaded 50 cards tonight.
Can't seem to download a sketch tho.

I have received PCBs, and have one mostly assembled. Alas, I don't seem to have any suitable 40pin sockets, so I need a shopping trip :frowning:

Wonderful thread :smiley: Thanx to maniacbug and all other members for putting this great thread thorough.. :smiley:
I had to try for some 2 days to get it to bootload my Atmega1284p Finally it worked... phew!!! :smiley:

Tip for others using Arduino 1.0 I couldnt get it to bootload without this though.

Note for Arduino 1.0: you need to make one small change to the ArduinoISP code. Find the line in the heartbeat() function that says "delay(40);" and change it to "delay(20);"

Did someone edit the wiki page of AVR ISP today? because I was pretty sure I didnt find it yesterday(Or probably didnt notice). Today I made the change and Voila it worked... (Dont know why though... :slight_smile: )

Sorry @Crossroads for the late reply. couldnt buy your PCB. I needed a complete assembled board. and I found a dealer in India selling similar boards (Not bootloaded to work with arduino though) http://www.ebay.in/itm/ATMEL-ATMEGA1284P-PCB-ATMEGA644P-ATMEGA32-ATMEGA16-components-/140621576563?pt=LH_DefaultDomain_203&hash=item20bdb2f973 (See attachment for schematics of the board)

So far so good. but the problem starts now. I cant burn programs into it. I used maniacbugs blog to burn the bootloader and it worked fine. Now I am trying to burn blinky program into it but I dont have FTDI breakout boards though to program it. I am trying to program it directly with a Serial cable as shown below.(No interfacing ICs used though. I am guessing the board has RS232 interface from schematics though.)

I am connecting only the pins Rx,Tx, RTS and GND pins of DB9 connector to the board. Is this enough to get it to program the Atmega1284p? (Apparently I cant. seem to be getting avrdude: stk500_getsync(): not in sync: resp=0x00 errors ). Is DTR pin required? because I saw a mention of that in maniacbug's blog. Any help regarding how to upload programs directly via serial cable?

The serial signals that you get from an actual rs232 port are inverted and at higher voltage levels than the signals you'd get from an FTDI breakout board or similar. It won't work, and it might fry your chip.

The serial signals that you get from an actual rs232 port are inverted and at higher voltage levels than the signals you'd get from an FTDI breakout board or similar. It won't work, and it might fry your chip.

BIt more clarity on the above would be nice. :slight_smile: Isnt that why the RS232 interface is there (given in the schematic). Any work around for this?

Isnt that why the RS232 interface is there (given in the schematic).

ah. Yes, I didn't see that. That should do the inversion and voltage conversion for you, and it should work ok (assuming nothing wrong in the circuitry.)
Your photo show the jumper for autoreset removed; did you have it in there when you were trying to upload sketches?
(It's sorta nice to see circuits with a 'real' rs232 converter chip on there...)

Have you tested it at the various "obvious" loopback spots?
loop rx to tx on the db9 connection. You should get things that you type echoed back. *(analog loopback)"
loop tx to tx on the other side of the conversion circuit, preferably without the chip prsent. (digital loopnback)
You should still be geting back echoed data. The CPU is still not involved.

Thanx Westfw tried the loopback test and it failed then got know it must be something wrong with the serial cable. Checked it out and apparently had got the pin numbers wrong. (Counted it in the opposite direction.. XD )Corrected it and the board with Atmega1284p worked :smiley: Yay!!! Thanx for all your support. :smiley:

Heh. When working with "real" serial, it's almost ALWAYS the stupid cable being wrong. USB is SO much nicer...

I have two boards, one a wirewrap DIP 1284 that runs at 5V, 16 MHz,
the other a PCB SMD 1284 that runs at 3.3V, 16MHz.

Both show the same results when a maniacbug 1284 bootloader is installed using an ATMega8A based programmer.
See attached.
The DIP board successfully downloads a sketch using an FTDI Basic USB/Serial adapter.
See attached.
The SMD board does not.
See attached.

I am at my wits end trying to figure out why.
The SMD board has 16 MHz resonator. 5V goes thru battery charge control chip, 3.3V regulator, to the '1284.
The bootloader loads okay, so I don't think its a power issue.

Any thoughts/suggestions would be appreciated!
Thanks
Robert/CrossRoads

Working bootload with MDFly.docx (16.3 KB)

Working download on DIP.docx (20.9 KB)

Failed Download with SMD.docx (17.5 KB)

Can you confirm that the serial port is working by loading some serial test sketch using the programmer?

[oops. never mind; I looked at the log, and you're getting "pretty far" in the upload. Weird.]
It looks similar to the timeout-related problem caused by Arduino-1 and ArduinoISP, though I can't explain why it would work with one board and not the other...

Tried a loop-back test too, to make sure the pins weren't conflicted somehow.

Will try downloading a sketch via "upload using programmer" tomorrow, missed your suggestion on that.
Guess I have only confirmed the FTDI is working so far.

@westfw,
Do suppose its due to having 5V signlals on the FTDI Basic vs the uC having 3.3?
I could try changing the FTDI Basic solder jumper for 3.3, or bypass the 3.3V regulator and power the uC with 5V.

Just got back from fencing class, think I'll try those after I've cooled down a little.

0

CrossRoads:
Ok, here's the fuse settings I have for a 1284P.
Note the MKii does Not provide power to the ICSP header.
I am powering via the FTDI interface.

Tools: AVR Programming

Interface settings: 125 KHz for first time bootloading

Memories:
C:\Arduino-1.0\hardware\mighty-1284p\bootloaders\optiboot\optiboot_atmega1284p.hex
Erase before programming- checked
Verify after programmimg - checked

Fuses:
BODLEVEL 2.7V (or as you select)
SPIEN - check
BOOTSZ - 512W_FE00
BOOTRST - check
SUT_CKSEL - EXTX0SC_8MHZ_xx_16KCK_65MS

Fuse Register
Extended - 0xFD
High - 0xDE
Low - 0xFF

Lock Bits
I think I had to Erase Chip under memories a couple times to get the Lock Bits to all show No Lock and get the Lock Bit Register to show 0xFF

Thanks CrossRoads! I got my AVRISP mkII in the mail yesterday! I am now ready to burn the arduino bootloader to my atmega1284p.

I have a few questions for you about programming using the mkII within AVRStudio 5.x:

  1. Should I program the Fuses before the 'Memories' (the bootloader hex file)? Or can I program the memory first and then the fuses?
  2. The JTAGEN fuse is checked by default for me. You didn't list it in your message (quoted above). Did you un-check this? I.e. are the fuses you mention as 'checked' the ONLY fuses you have checked?
  3. Have you tried to burn the arduino bootloader via the ArduinoIDE using the mkII? I tried on one of my atmega1284p's and I can no longer communicate with it. Right now I do not have a crystal hooked up to the chip, I only have the Vin, Ground, MISO, MOSI, Reset, and SCK pins hooked up accordingly to the mkII and my power source. If I hook up a crystal and associated caps, do you think I will be able to communicate with this chip again? I have a spare that I am going to program after you get a chance to respond to my first questions above.

I really appreciate all the help. Thanks again!

FWIW,

You can bypass the need for a bootloader if you just use the AVRMSKii as a programmer. Saves a little memory to boot.

Just change the preferences.txt file to indicate that you want to use that device instead of the serial connection and even new chips are good to go. I've used the brewtroller IDE without any issues to burn the bootloader as well as as development platform for my TQFP 1284P micros. Yes, it means two cables to the device (i.e. the FTDI to provide power and serial communications) and the AVR programmer but I can live with that.

@Blaker0111 ,
What I've been doing is programming fuses, programming lockbits, then programming memory.
Did 50 boards that way, all accepted the bootloader.

Only the fuses indicated were checked.

I only have completed boards - I have not tried with crystal. Looking to do some more testing tonight.

@Constantin ,
Going to try that tonight as well.

Ok,
Seeing some odd results.
No solar panel connected, No LiPo battery connected, just an FTDI Basic connected.
I opened the power switch S2 and jumpered 3.3V to 5V.

I can load this simple sketch and see an LED flash as expected.

byte outputPin = 4;
void setup() {
pinMode (outputPin, OUTPUT);
}
void loop() {
  digitalWrite (outputPin, HIGH);
  delay (500);
  digitalWrite (outputPin, LOW);
  delay (500);
}

With the jumper removed and power switch S2 closed, the 5V from the FTDI goes thru D1, the charge control chip, D3, and I see 4V at the regulator input and 3.27V at its output. The LED flashes really quick.

The board uses this 16 MHz resonator.

Any ideas?