Having troubles burning bootloader to standalone ATMEGA1284P

Hi Arduino-fellows,

I've ordered a PCB with an ATMEGA1284P that was designed using EAGLE. I have problems burning bootloader to the MCU and I've tried the following:

  1. First tried bootloading onto a standalone ATMEGA328P using SPI to check whether the Arduino UNO is setup fine and I'm using it correctly -> worked.
  2. Checked all the connections of our board for shorts and also for good connections (MOSI, MISO, SCK, Crystal, CAP) -> fine.
  3. Tested with Reset connected from PIN10 of Arduino UNO straight to the board and with a 10k pullup resistor to VCC -> didn't work.
  4. Was able or write something to the MCU with configuration 3, please see console output below, btw.: the output was different for disconnecting reset or SPI connections.
C:\Users\bobin\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\bobin\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega1284p -cstk500v1 -PCOM14 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xfd:m -Uhfuse:w:0xde:m -Ulfuse:w:0xf7:m 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\bobin\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : COM14
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         AVR Part                      : ATmega1284P
         Chip Erase delay              : 55000 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
           flash         65    10   256    0 yes    131072  256    512  4500  4500 0xff 0xff
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9705 (probably m1284p)
avrdude: erasing chip
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xfd"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xfd:
avrdude: load data efuse data from input file 0xfd:
avrdude: input file 0xfd contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0xde"
avrdude: writing hfuse (1 bytes):

Writing |  ***failed;  
################################################## | 100% 0.10s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xde:
avrdude: load data hfuse data from input file 0xde:
avrdude: input file 0xde contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x00 != 0xde
avrdude: verification error; content mismatch

avrdude done.  Thank you.

Error while burning bootloader.

Once it stepped into programming and you have obtained signature, the reset signal is isn't important.
Everything looks good prior to failure. Floating wire?
Try to run command with more -vvvv instead of -v. It will produce detailed log per bytes.
Maybe schematics would help.

Budvar10:
Once it stepped into programming and you have obtained signature, the reset signal is isn’t important.
Everything looks good prior to failure. Floating wire?
Try to run command with more -vvvv instead of -v. It will produce detailed log per bytes.
Maybe schematics would help.

Thank you a lot for your response. I’ve checked the connnections, floating wires are definitely not the problem, reset is also pulled up to VCC using a 10kOhm resistor. Arduino UNO and the board I fabricated have the same Ground connection. I read in some other threads that eventually the large memory of the 1284p could be a problem, I am currently stick with this error:

C:\Users\bobin\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\bobin\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega1284p -cstk500v1 -PCOM14 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xfd:m -Uhfuse:w:0xde:m -Ulfuse:w:0xf7:m 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\bobin\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : COM14
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         AVR Part                      : ATmega1284P
         Chip Erase delay              : 55000 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
           flash         65    10   256    0 yes    131072  256    512  4500  4500 0xff 0xff
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9705 (probably m1284p)
avrdude: erasing chip
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xfd"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xfd:
avrdude: load data efuse data from input file 0xfd:
avrdude: input file 0xfd contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0xde"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xde:
avrdude: load data hfuse data from input file 0xde:
avrdude: input file 0xde contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.02s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xf7"
avrdude: writing lfuse (1 bytes):

C:\Users\bobin\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\bobin\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega1284p -cstk500v1 -PCOM14 -b19200 -Uflash:w:C:\Users\bobin\OneDrive\Dokumente\Arduino\hardware\mighty-1284p\avr/bootloaders/optiboot/optiboot_atmega1284p.hex:i -Ulock:w:0x0F:m 
Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xf7:
avrdude: load data lfuse data from input file 0xf7:
avrdude: input file 0xf7 contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude done.  Thank you.


avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

mbobinger:
Thank you a lot for your response. I've checked the connnections, floating wires are definitely not the problem, reset is also pulled up to VCC using a 10kOhm resistor. Arduino UNO and the board I fabricated have the same Ground connection. I read in some other threads that eventually the large memory of the 1284p could be a problem, I am currently stick with this error:

C:\Users\bobin\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\bobin\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega1284p -cstk500v1 -PCOM14 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xfd:m -Uhfuse:w:0xde:m -Ulfuse:w:0xf7:m 

avrdude: Version 6.3-20190619
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "C:\Users\bobin\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

Using Port                    : COM14
        Using Programmer              : stk500v1
        Overriding Baud Rate          : 19200
        AVR Part                      : ATmega1284P
        Chip Erase delay              : 55000 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
          flash        65    10  256    0 yes    131072  256    512  4500  4500 0xff 0xff
          lock          0    0    0    0 no          1    0      0  9000  9000 0x00 0x00
          lfuse          0    0    0    0 no          1    0      0  9000  9000 0x00 0x00
          hfuse          0    0    0    0 no          1    0      0  9000  9000 0x00 0x00
          efuse          0    0    0    0 no          1    0      0  9000  9000 0x00 0x00
          signature      0    0    0    0 no          3    0      0    0    0 0x00 0x00
          calibration    0    0    0    0 no          1    0      0    0    0 0x00 0x00

Programmer Type : STK500
        Description    : Atmel STK500 Version 1.x firmware
        Hardware Version: 2
        Firmware Version: 1.18
        Topcard        : Unknown
        Vtarget        : 0.0 V
        Varef          : 0.0 V
        Oscillator      : Off
        SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9705 (probably m1284p)
avrdude: erasing chip
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xfd"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xfd:
avrdude: load data efuse data from input file 0xfd:
avrdude: input file 0xfd contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0xde"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xde:
avrdude: load data hfuse data from input file 0xde:
avrdude: input file 0xde contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.02s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xf7"
avrdude: writing lfuse (1 bytes):

C:\Users\bobin\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\bobin\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega1284p -cstk500v1 -PCOM14 -b19200 -Uflash:w:C:\Users\bobin\OneDrive\Dokumente\Arduino\hardware\mighty-1284p\avr/bootloaders/optiboot/optiboot_atmega1284p.hex:i -Ulock:w:0x0F:m
Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xf7:
avrdude: load data lfuse data from input file 0xf7:
avrdude: input file 0xf7 contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude done.  Thank you.

avrdude: Version 6.3-20190619
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2014 Joerg Wunsch

That output does not show an error - it shows success. The fuses are now set as you specified. Note that your command did not include writing a bootloader (that would have included a command line argument specifying -Uflash pointing to the bootloader hex file) - possibly you had a board def selected that does not use a bootloader? (If that's MightyCore, there's a tools -> bootloader menu; select the desired option there and do burn bootloader if you want the bootloader).

If you plan to upload code using the Arduino as ISP programmer, you're all set; if you want to upload code via a serial port with an external TTL serial adapter, you will need to write the bootloader.

I thought the issue with using ArduinoAsISP to write flash above 64K was fixed in ArduinoAsISP a while ago - I'm almost positive you can use it to burn a bootloader to a mega2560, and since the bootloader goes at the end of the flash, that means it can write past 64K.

So am I. There is no problem for me to upload a bootloader to the 1284p with Arduino as ISP.

Hello guys. Thank you for your comments. I was able to burn bootloader using an Arduino Uno and Arduino as ISP onto a standalone ATMEGA328P and a standalone ATMEGA1284P with two caps, one 16MHz and the reset pulled to VCC.

Today, I was also able to program my atmega1284p board that I designed using EAGLE with following board selected:
Mighty Mini 1284p @8MHz

However, I’d like to get the 16MHz version. By accident, it has so far worked a single time to burn bootloader onto the preassambled PCB board by changing nothing…

burning_bootloader.png