Flashing 1284P

I've been following these instructions (recommended by Arduino) to burn a bootloader and flash a sketch onto the 1284p,

I've successfully managed to burn its bootloader using the following library :

Using an Arduino Uno as an ISP.

I'm using Arduino 1.0.5 as Arduino 1.6 doesn't seem to be compatible with the library currently.

I used the board "Mighty 1284p 16Mhz using Optiboot" which worked great however when I attach my Arduino uno as an FTDI USB to serial programmer I get the following error while trying to upload.

Binary sketch size: 534 bytes (of a 130,048 byte maximum)
avrdude: stk500_initialize(): (a) protocol error, expect=0x14, resp=0x42
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

The chip is responding as I get a blink from both the RX and TX LED's for a few seconds then the error occurs.

Any help would be anonymously appreciated!! I'm tired and sick, and just want it to work,

Jack

I burn lots of 1284Ps, using the setup Jack Christenson is maintaining here

My preferred footprint layout is Bobuino:
http://www.crossroadsfencing.com/BobuinoRev17/

I believe Nick Gammon's bootload installer sketch also works

I use an Atmel AVR ISP MKii myself

CrossRoads:
I burn lots of 1284Ps, using the setup Jack Christenson is maintaining here
GitHub - JChristensen/mighty-1284p: Mighty 1284P Platform for Arduino

My preferred footprint layout is Bobuino:
Cross Roads Electronics

I believe Nick Gammon's bootload installer sketch also works
Gammon Forum : Electronics : Microprocessors : Atmega bootloader programmer

I use an Atmel AVR ISP MKii myself
Smart | Connected | Secure | Microchip Technology

What version of Arduino IDE do you use?

When I use 1.6 the board is found after changing the directly of the library in my sketchbook to hardware/AVR/mighty-1284p

However when I try to burn the bootloader I get null pointer exceptions and a long list of errors. While bootloaders for my other chips still work fine.

Did you have to change any config files/fuses with the JChristensen bootloader or did you just load it like it was?

I don't understand why I can't flash it, is there something I'm missing?

I've got the typical standalone Arduino set up, 16MHz crystal, 2 x 22nf caps, 10k pull up on reset, and then RX and TX connections (connected the right way).

I think I'm still on 1.0.5. I don't change all that often, preferring to let some of the bugs get worked out. Or am busy with hardware design projects, and don't get around to coding that much.

I just loaded the files into the /variants folder.

What are you using for a Programmer (which connects to SPI-MOSI-MISO-Reset-Power-Gnd) for installing the bootloader?

CrossRoads:
I think I'm still on 1.0.5. I don't change all that often, preferring to let some of the bugs get worked out. Or am busy with hardware design projects, and don't get around to coding that much.

I just loaded the files into the /variants folder.

What are you using for a Programmer (which connects to SPI-MOSI-MISO-Reset-Power-Gnd) for installing the bootloader?

I'll just stick to 1.05 for now too, it works perfectly fine and there seem to be a few issues with 1.6

I'm using the exact connections shown on this picture for my SPI

Imgur

I used my Arduino Uno as an SPI programmer, I've used this hundreds of times to burn bootloaders onto Atmega328's.

I follow this setup,

However I've successfully uploaded my bootloader, I just can't seem to flash it with a sketch without getting the error shown in my original post.

All I'm thinking is that I didn't upload the bootloader with the right configuration, I've heard talk about setting fuses, have you came across this?

CrossRoads:
What are you using for a Programmer (which connects to SPI-MOSI-MISO-Reset-Power-Gnd) for installing the bootloader?

I’ve followed Nick Gammons guide that allows me to check my bootloader and fuse status and his Arduino sketches allow you to burn the required fuses.

http://www.gammon.com.au/forum/?id=11635

I’ve used his arduino sketches as shown which checked my chip, changed the necessary fuses and burnt a new bootloader onto it.

This is the serial output :

Clearing 'Divide clock by 8' fuse bit.
Fixing low fuse setting ...
Attempting to enter programming mode ...
Entered programming mode OK.
Erasing chip ...
Writing bootloader ...
Committing page starting at 0x1FC00
Committing page starting at 0x1FD00
Written.
Verifying ...
No errors found.
Writing fuses ...
LFuse = 0xFF 
HFuse = 0xDE 
EFuse = 0xFD 
Lock byte = 0xEF 
Clock calibration = 0x89 
Done.
Programming mode off.
Type 'C' when ready to continue with another chip

However when I try to flash it with a sketch using my Arduino Uno as a FTDI programmer or a FTDI breakout board I get the following error :

Binary sketch size: 534 bytes (of a 130,048 byte maximum)

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: stk500_cmd(): programmer is out of sync

The chip responds as both the RX and TX LED’s flash for a few seconds then the error comes a long.

Any chance the Rx & Tx lines are swapped?

Do you have DTR from FTDI connected 1284's Reset thru a 0.1uF cap? If not, you will need to press reset when the IDE shows "compiled xxx of 130xxx bytes"

Is this a hand-made 1284? Can you post a photo?

when I try to flash it with a sketch using my Arduino Uno as a FTDI programmer

Exactly how are you trying to flash the sketch? After you've loaded the bootloader, you should be able to set the board type to "Mighty 1284p 16Mhz using Optiboot" and just use the "Upload" button. No "FTDI Programmer" or "Uno as ISP" or anything else involved...

I've successfully uploaded the bootloader using my Arduino as an ISP.

Pin configuration shown here,

https://s3.amazonaws.com/pushbullet-uploads/ujCU4oRdtym-DlBDjwpELR8ZLwhpBSyfpB6r5RKlr1YV/IMG_20150228_020711407_HDR.jpg

My two Arduino boards can be seen here,

https://s3.amazonaws.com/pushbullet-uploads/ujCU4oRdtym-kXGYlX3OaCYqTi7kombu5Dz7UtG4PjO6/IMG_20150228_014501221_HDR.jpg

I'm uploading "ArduinoISP" sketch into the uno which is connected to my 1284P through those connections as shown above.

Then I choose "Mighty 1284p 16MHz using Optiboot" as shown here,

https://s3.amazonaws.com/pushbullet-uploads/ujCU4oRdtym-gAe1YDvhYZp3g3IpFzvSv0qroaOLzW6L/IMG_20150228_013234486_HDR.jpg

The Uno's RX and TX goes crazy for about a minute and then my IDE says the bootloader has been successfully uploaded.

Then after the bootloader has been loaded I take the ISP connections out as well as the chip as I need to prepare the Arduino to flash the 1284P through serial with the "BareMinium" sketch.

This can be shown here,

https://s3.amazonaws.com/pushbullet-uploads/ujCU4oRdtym-jN5b0H4ktwvj8qfbnhnP5a4ReVLajsX3/IMG_20150228_015518634_HDR.jpg

https://s3.amazonaws.com/pushbullet-uploads/ujCU4oRdtym-bktmP79oBAoqOayXXStejskupyZ32ZQa/IMG_20150228_020156739_HDR.jpg

When I attempt to upload the sketch the RX and TX blink intensively for a few seconds then then IDE says "uploading" for around 30 seconds and then I get the following error :

Binary sketch size: 534 bytes (of a 130,048 byte maximum)
avrdude: stk500_loadaddr(): (a) protocol error, expect=0x14, resp=0x55

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: stk500_cmd(): programmer is out of sync

I've tried swapping the RX and TX pins around but then I just get no response.

As I said I've used your sketches in the same fashion to upload the bootloader and burn the fuses however I get the exact same problem when I got to upload a sketch.

Can you turn on "verbose" uploading, and copy and paste what output you get please?

westfw:
Exactly how are you trying to flash the sketch? After you've loaded the bootloader, you should be able to set the board type to "Mighty 1284p 16Mhz using Optiboot" and just use the "Upload" button. No "FTDI Programmer" or "Uno as ISP" or anything else involved...

To burn a bootloader you use ISP and to send/flash a sketch you use serial.

I'm using my Arduino Uno as serial programmer.

After I've uploaded the bootloader (using my Arduino Uno as ISP programmer) I need to undo the ISP connections and take the chip out, then add the serial connections in order for my Uno to act as a serial programmer.

My bootloader uploads fine.

However I get problems as shown in my posts when I attempt to upload a sketch.

I got the following (Part 1 due to 9000 character limit):

Binary sketch size: 534 bytes (of a 130,048 byte maximum)
C:\Program Files (x86)\Arduino\hardware/tools/avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega1284p -carduino -P\\.\COM7 -b115200 -D -Uflash:w:C:\Users\Jack\AppData\Local\Temp\build1544088464839680152.tmp\BareMinimum.cpp.hex:i 

avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2009 Joerg Wunsch

        System wide configuration file is "C:\Program Files (x86)\Arduino\hardware/tools/avr/etc/avrdude.conf"

        Using Port                    : \\.\COM7
        Using Programmer              : arduino
        Overriding Baud Rate          : 115200
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: . [05] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [82]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [98]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [03] 
avrdude: Recv: . [10] 
        Hardware Version: 3
        Firmware Version: 5.0
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: . [05] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [82]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
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.00s

Part 2 :

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\Jack\AppData\Local\Temp\build1544088464839680152.tmp\BareMinimum.cpp.hex"
avrdude: writing flash (534 bytes):

Writing | avrdude: Send: U [55] . [00] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: Send: d [64] . [01] . [00] F [46] . [0c] . [94] F [46] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] y [79] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [0c] . [94] f [66] . [00] . [11] $ [24] . [1f] . [be] . [cf] . [ef] . [d0] . [e4] . [de] . [bf] . [cd] . [bf] . [11] . [e0] . [a0] . [e0] . [b1] . [e0] . [e6] . [e1] . [f2] . [e0] . [00] . [e0] . [0b] . [bf] . [02] . [c0] . [07] . [90] . [0d] . [92] . [a0] 0 [30] . [b1] . [07] . [d9] . [f7] . [1b] . [be] . [11] . [e0] . [a0] . [e0] . [b1] . [e0] . [01] . [c0] . [1d] . [92] . [a9] 0 [30] . [b1] . [07] . [e1] . [f7] . [0e] . [94] j [6a] . [00] . [0c] . [94] . [09] . [01] . [0c] . [94] . [00] . [00] . [08] . [95] . [08] . [95] . [cf] . [93] . [df] . [93] . [0e] . [94] . [c1] . [00] . [0e] . [94] h [68] . [00] . [c0] . [e0] . [d0] . [e0] . [0e] . [94] i [69] . [00]   [20] . [97] . [e1] . [f3] . [0e] . [94] . [00] . [00] . [f9] . [cf] . [1f] . [92] . [0f] . [92] . [0f] . [b6] . [0f] . [92] . [11] $ [24] / [2f] . [93] ? [3f] . [93]   [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

Clearly some communication is taking place.

I don't see any decoupling capacitors.

The crystal and its associated capacitors are supposed to be short wire runs. That looks a bit of a mess, frankly.

Compare to my breadboard:

It's no good saying "I'll make it neat once it's working". It may never work in that state.

Where did it say to connect the reset lines together?

This sounds vaguely like the "1284 resets while bootloading" problem that various people have reported.

LFuse = 0xFF 
HFuse = 0xDE 
EFuse = 0xFD

Try LFUSE = 0xF7 instead.

For serial communication you need to have a reset with my RX and TX?

So I attached my Uno's (programmers) reset to my 1284p reset pin

I originally had mine like yours but it was hard to see the connection in the photo so I extended it which was maybe not the best idea.

I've added the capacitors and shortened the wires but still get the same problem.

CrossRoads:
Any chance the Rx & Tx lines are swapped?

Do you have DTR from FTDI connected 1284's Reset thru a 0.1uF cap? If not, you will need to press reset when the IDE shows "compiled xxx of 130xxx bytes"

When I swap them around I get no response so there are defiantly connected the right way.

I forgot to add one at first but my computer didn't recognize the FTDI so I decided to try it with the capacitor I just remembered about and my computer recognized it.

However I still get the same error after a few seconds of uploading.