ATmega1284P: End to End using 1.0 IDE

Getting mini 1284's up & running okay on this thread

I bootloaded mine using AVR ISP MKii from the IDE with this bootlloader and this boards.txt entry.

##############################################################

bobuino.name=Bobuino
bobuino.upload.protocol=arduino
bobuino.upload.maximum_size=130048
bobuino.upload.speed=115200
bobuino.bootloader.low_fuses=0xff
bobuino.bootloader.high_fuses=0xde
bobuino.bootloader.extended_fuses=0xfd
bobuino.bootloader.path=optiboot
bobuino.bootloader.file=optiboot_atmega1284p.hex
bobuino.bootloader.unlock_bits=0x3F
bobuino.bootloader.lock_bits=0x0F
bobuino.build.mcu=atmega1284p
bobuino.build.f_cpu=16000000L
#bobuino.build.core=arduino:arduino
bobuino.build.core=standard
bobuino.build.variant=bobuino

optiboot_atmega1284p.hex (1.47 KB)

I bootloaded mine using AVR ISP MKii from the IDE with this bootlloader and this boards.txt entry.

We understand the MkII and all the others of that flavor work wonderfully. Some of us are perplex as to why the Arduino hooked up ICSP will upload bootloaders to 168, 328, 1280, 2560 just fine, but not the 1284p.

Check Nick Gammon's site on this.

Scroll about 2/3 down the page. He shows bootloading a '1284 from Uno as ISP.

CrossRoads:
Check Nick Gammon's site on this.
http://www.gammon.com.au/forum/?id=11637
Scroll about 2/3 down the page. He shows bootloading a '1284 from Uno as ISP.

I've already tried that. And tried everything everyone else suggested here. I even changed from burning the bootloader with my Mega ADK R3 to my home made UNO. The burning is always successful and the bootloader MD5 sum is the same as for Nick. So everything went well. But I always get the same error when trying to upload any sketch. I'm beginning to give up on this.

I'll give it another try tonight after work. If it dosen't work then i'll integrate a ISP programmer in the circuit so it in the end is programmable and debug-gable through FTDI.

I wonder if there is some issue with the ftdi and (perhaps) your host software. HW flowcontrol being enabled, or something.
Which FTDI board are you using? I doesn't seem to match any of the Arduino, Sparkfun, or Adafruit boards.

fyi - http://arduino.cc/forum/index.php/topic,115032.0.html

westfw:
I wonder if there is some issue with the ftdi and (perhaps) your host software. HW flowcontrol being enabled, or something.
Which FTDI board are you using? I doesn't seem to match any of the Arduino, Sparkfun, or Adafruit boards.

I have two FTDI boards. One is the "official" Arduino USB Light adapter (http://arduino.cc/en/Main/USBSerial) and Sparkfuns ftdi basic break out board (SparkFun USB to Serial Breakout - FT232RL - BOB-12731 - SparkFun Electronics).. It should work, i've tried everything (I think). And both boards give the same error. Sparkfuns FTDI give the same error at the same place in avrdude. But the arduino usb light gives of random errors.

Edit: The CTS on my FTDI board wasn't connected. I guess because I thought that it isn't important. I tried connecting it to ground and that resulted with an getsync error. But if I put a capacitor (100nF) between CTS and ground then the upload goes further to eventually go to some error again. I'm using DTR to reset the board. Do I have to do something with the RTS and CTS line. Because putting a capacitor on CTS made the upload go further but it eventually ended with an error! Can I do something about this?

Try connecting CTS and DSR to DTR ("before" the cap that goes to the arduino reset pin.)

I can't quite tell whether your sparkfun board (the one in your picture) is (un)jumpered for 3.3V or not? If it is set for 5V, did you remember to connect vccio to +5 instead?

Progress everyone =P!!! I tried grounding the RTS line with a 100nF capacitor in between! And guess what?? the process went as far as beginning to flash the blink sketch!! But stopped in the middle of the sending with the programmer is out of sync error:

avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
         AVR Part                      : ATMEGA1284P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    10   128    0 no       4096    8      0  9000  9000 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65    10   256    0 yes    131072  256    512  4500  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
avrdude: Send: A [41] . [80]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [03] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [81]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [04] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [82]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [05] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [98]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [03] 
avrdude: Recv: . [10] 
         Hardware Version: 3
         Firmware Version: 4.5
avrdude: Send: A [41] . [84]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [03] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [85]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [03] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [86]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [03] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [87]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [03] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [89]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [03] 
avrdude: Recv: . [10] 
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us

avrdude: Send: A [41] . [81]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [04] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [82]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [05] 
avrdude: Recv: . [10] 
avrdude: Send: B [42] . [82] . [00] . [00] . [01] . [01] . [01] . [01] . [03] . [ff] . [ff] . [ff] . [ff] . [01] . [00] . [10] . [00] . [00] . [02] . [00] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: Send: E [45] . [05] . [08] . [d7] . [a0] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: Send: P [50]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: AVR device initialized and ready to accept instructions

Reading | avrdude: Send: u [75]   [20] 
avrdude: Recv: . [14] . [1e] . [97] . [05] . [10] 
################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9705
avrdude: Send: V [56] . [a0] . [0f] . [fc] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: V [56] . [a0] . [0f] . [fd] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: V [56] . [a0] . [0f] . [fe] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: V [56] . [a0] . [0f] . [ff] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: reading input file "C:\Users\Basel\AppData\Local\Temp\build7393332655608101916.tmp\Blink.cpp.hex"
avrdude: writing flash (1196 bytes):

Writing | avrdude: Send: U [55] . [00] . [00]   [20] 
avrdude: Recv: 
avrdude: stk500_loadaddr(): (a) protocol error, expect=0x14, resp=0x55
avrdude: Send: d [64] . [01] . [00] F [46] . [0c] . [94] . [85] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [c4] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [0c] . [94] . [a5] . [00] . [00] . [00] ! [21] . [00] $ [24] . [00] ' [27] . [00] * [2a] . [00] . [00] . [00] " [22] . [00] % [25] . [00] ( [28] . [00] + [2b] . [00] . [00] . [00]   [20] . [00] # [23] . [00] & [26] . [00] ) [29] . [00] . [02] . [02] . [02] . [02] . [02] . [02] . [02] . [02] . [04] . [04] . [04] . [04] . [04] . [04] . [04] . [04] . [03] . [03] . [03] . [03] . [03] . [03] . [03] . [03] . [01] . [01] . [01] . [01] . [01] . [01] . [01] . [01] . [01] . [02] . [04] . [08] . [10]   [20] @ [40] . [80] . [01] . [02] . [04] . [08] . [10]   [20] @ [40] . [80] . [01] . [02] . [04] . [08] . [10]   [20] @ [40] . [80] . [01] . [02] . [04] . [08] . [10]   [20] @ [40] . [80] . [00] . [00] . [00] . [01] . [02] . [00] . [08] . [09] . [00] . [00] . [00] . [00] . [04] . [03] . [07] . [06] . [00] . [00] . [00] . [00] . [00] . [00]   [20] 
avrdude: Recv: 

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: Send: V [56] @ [40] . [00] . [00] . [0c]   [20] 
avrdude: Recv: 
avrdude: stk500_cmd(): programmer is out of sync

westfw:
Try connecting CTS and DSR to DTR ("before" the cap that goes to the arduino reset pin.)

I can't quite tell whether your sparkfun board (the one in your picture) is (un)jumpered for 3.3V or not? If it is set for 5V, did you remember to connect vccio to +5 instead?

While you were writing this message I was holding in the soldering iron and de-soldering that jumper Looll =P!! Ya, 5V is connected to VCCIO! I'll come back with the results of ur suggestion =P Thx

westfw:
Try connecting CTS and DSR to DTR ("before" the cap that goes to the arduino reset pin.)

I can't quite tell whether your sparkfun board (the one in your picture) is (un)jumpered for 3.3V or not? If it is set for 5V, did you remember to connect vccio to +5 instead?

Well, I tried coupling CTS and DSR to DTR before the cap ;)! The sketch got uploaded/written to the flash! But I got the programmer is out of sync error when avrdude tried to verify the written data. See the output: https://dl.dropbox.com/u/74389175/avrdude_1.txt

And ya, the bootloader isn't responding anymore.. I think it got corrupted or something. Am gonna try burning the bootloader again. But meenwhile, do you got any more ideas regarding the FTDI =P? Do I need to connect the RTS to something or????

Do you have an Uno with a removable chip? If so, after you reload your bootloader to the 1284, remove the Uno chip and use its serial to load your sketch to the 1284p.

rx to rx, tx to tx, 5v to 5v, gnd to gnd, reset to reset. It works well for me and it will also give you another way to test for serial issues.

cyclegadget:
Do you have an Uno with a removable chip? If so, after you reload your bootloader to the 1284, remove the Uno chip and use its serial to load your sketch to the 1284p.

rx to rx, tx to tx, 5v to 5v, gnd to gnd, reset to reset. It works well for me and it will also give you another way to test for serial issues.

Already tried that.. Doesn't work!

SOLVED THE PROBLEM!!!! OHHHH!!!! SOLVED SOLVED SOLVED!!!

There is apparently nothing wrong with the FTDI nor the chip. Something is fishy about the bootloader. However I tried an experimental version of the bootloader that uses the other UART (UART1 instead of the default UART0). Connected the serial wires from the FTDI to pin 16; 17. Click on upload and DONE!! =P Works every time. But the thing is if I use the serial library then it'll use the first UART (UART0). So I have to reconnect the wires to UART0 after uploading a sketch inorder to recieve and send information through the serial connection. But I think this is simply fixed by rewriting the serial library. Or maybe there is an option for that?? I'll get into it right away =P!!

Ya, for others with the same problem try the following bootloader: Google Code Archive - Long-term storage for Google Code Project Hosting.

Just use the default boards.txt that comes with the Mighty 1284p optiboot bootloader. All you have to do is replace the optiboot_atmega1284p.hex with the one you downloaded!

EDIT: Use the second serial by using the Serial1 function instead of Serial. Example:

void setup()  { 
  Serial1.begin(9600);
} 

void loop()  { 
Serial1.println("Hi");
delay(100);
}

Did you try the previous bootloader on more than one 1284P processor? (If you only tried a single one, I am thinking it may be faulty.)

florinc:
Did you try the previous bootloader on more than one 1284P processor? (If you only tried a single one, I am thinking it may be faulty.)

I had the same thought and already bought another one. The same results there! Maybe a faulty shipment =P?? No kidding, (about the shipment) but ya the same results. I wrote a sketch that sends and receives data on the first UART (UART0) and it's sending and receiving fine! So I highly doubt that it's faulty (or both are faulty)!

That's odd. There is "infrastructure" in the source code that changed to permit other serial ports, but the .hex file produced by the current source is exactly the same as the download on google code, except for the misplaced version number (which really, really, shouldn't affect anything.)

Still, here is a uart0 version from the same source as the experimental uart1 code:

optiboot_atmega1284p.hex (1.46 KB)

westfw:
That's odd. There is "infrastructure" in the source code that changed to permit other serial ports, but the .hex file produced by the current source is exactly the same as the download on google code, except for the misplaced version number (which really, really, shouldn't affect anything.)

Still, here is a uart0 version from the same source as the experimental uart1 code:

did you modify it yourself or just download the one on the resp. ? Because I already tried the one that uses UART0 on the google code resp. and that doesn't work!

It's freshly compiled and doesn't quite match the .hex file on the google download page; it has the version number in the right place. It's vaguely possible that there is some strange interaction between the hex file and whole avrdude/arduinoisp/etc chain.

westfw:
It's freshly compiled and doesn't quite match the .hex file on the google download page; it has the version number in the right place. It's vaguely possible that there is some strange interaction between the hex file and whole avrdude/arduinoisp/etc chain.

I've already made a PCB and soldered the thing =P! But i'll try it out with the other one I've got! I'll report back as soon as possible! Thx!