Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Using Pololu AVR programmer to put bootloader on ATmega1284p


#1

I’m building a Sanguinololu for my 3D printer project using a PCB. But I’m stymied trying to burn an Arduino bootloader on the ATmega1284p as it fails when trying to set the fuses. I can use the same programmer to upload programs onto my 3Pi and Baby Orangutan, so I know it works and the drivers are installed.

I’m fairly good at soldering, and built a few Arduino boards by hand. So I’ve soldered the board, plugged it in, and checked the ground and 5 volt pins on the IC socket. I also checked for shorts, bridges, and that the correct pins were connected to the ISCP header, and the orientation of the programmer is correct. These steps usually yield results, but here no luck. Below are the commands I’m using on my Windows 7 PC.

set AVRROOT=C:\Users\Martin\Documents\arduino-1.6.4\hardware\tools\avr
set GEN7BOOT=C:\Users\Martin\Documents\arduino-1.6.4\hardware\Gen7\bootloaders\Gen7

# find the compatible programer
%AVRROOT%\bin\avrdude.exe -C %AVRROOT%\etc\avrdude.conf -c ?

# write fuses
%AVRROOT%\bin\avrdude.exe -C %AVRROOT%\etc\avrdude.conf -c avrispv2 -p atmega1284p -P COM9 -b 10 -U lfuse:w:0xF7:m -U hfuse:w:0xDC:m -U efuse:w:0xFC:m

Avrdude is a bit of a black box to me, so I added multiple -v switches to see if there’s any clue. While it definately finds and recognizs the programmer, I can’t tell if it sees the ATmege1284p chip. I’ve also heard some programmers have a problem with it because of the larger flash. So I don’t know if that might be it.

%AVRROOT%\bin\avrdude.exe -C %AVRROOT%\etc\avrdude.conf -c avrispv2 -p atmega1284p -P COM9 -b 10 -U lfuse:w:0xF7:m -U hfuse:w:0xDC:m -U efuse:w:0xFC:m -v -v -v -v

avrdude.exe: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2009 Joerg Wunsch

             System wide configuration file is "C:\Users\Martin\Documents\arduino-1.6.4\hardware\tools\avr\etc\avrdude.conf"

             Using Port                    : COM9
             Using Programmer              : avrispv2
             Overriding Baud Rate          : 10
avrdude.exe: serial_baud_lookup(): Using non-standard baud rate: 10avrdude.exe: Send: . [1b] . [01] . [00] . [01] . [0e] . [01] . [14] 
avrdude.exe: Recv: . [1b] 
avrdude.exe: Recv: . [01] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [0b] 
avrdude.exe: Recv: . [0e] 
avrdude.exe: Recv: . [01] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [08] 
avrdude.exe: Recv: S [53] 
avrdude.exe: Recv: T [54] 
avrdude.exe: Recv: K [4b] 
avrdude.exe: Recv: 5 [35] 
avrdude.exe: Recv: 0 [30] 
avrdude.exe: Recv: 0 [30] 
avrdude.exe: Recv: _ [5f] 
avrdude.exe: Recv: 2 [32] 
avrdude.exe: Recv: . [02] 
avrdude.exe: stk500v2_getsync(): found STK500 programmer
             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
                                      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 : STK500V2
             Description     : Atmel AVR ISP V2
             Programmer Model: STK500
avrdude.exe: Send: . [1b] . [02] . [00] . [02] . [0e] . [03] . [90] . [86] 
avrdude.exe: Recv: . [1b] 
avrdude.exe: Recv: . [02] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [0e] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [0f] 
avrdude.exe: Recv: . [18] 
avrdude.exe: Send: . [1b] . [03] . [00] . [02] . [0e] . [03] . [91] . [86] 
avrdude.exe: Recv: . [1b] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [0e] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [02] 
avrdude.exe: Recv: . [14] 
avrdude.exe: Send: . [1b] . [04] . [00] . [02] . [0e] . [03] . [92] . [82] 
avrdude.exe: Recv: . [1b] 
avrdude.exe: Recv: . [04] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [0e] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [0a] 
avrdude.exe: Recv: . [1b] 
             Hardware Version: 15
             Firmware Version Master : 2.10
avrdude.exe: Send: . [1b] . [05] . [00] . [02] . [0e] . [03] . [9a] . [8b] 
avrdude.exe: Recv: . [1b] 
avrdude.exe: Recv: . [05] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [0e] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [ff] 
avrdude.exe: Recv: . [ef] 
             Topcard         : Unknown
avrdude.exe: Send: . [1b] . [06] . [00] . [02] . [0e] . [03] . [94] . [86] 
avrdude.exe: Recv: . [1b] 
avrdude.exe: Recv: . [06] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [0e] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [13] 
             Vtarget         : 0.0 V
avrdude.exe: Send: . [1b] . [07] . [00] . [02] . [0e] . [03] . [98] . [8b] 
avrdude.exe: Recv: . [1b] 
avrdude.exe: Recv: . [07] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [0e] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [02] 
avrdude.exe: Recv: . [10] 
avrdude.exe: Send: . [1b] . [08] . [00] . [02] . [0e] . [03] . [95] . [89] 
avrdude.exe: Recv: . [1b] 
avrdude.exe: Recv: . [08] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [0e] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [1d] 
avrdude.exe: Send: . [1b] . [09] . [00] . [02] . [0e] . [03] . [96] . [8b] 
avrdude.exe: Recv: . [1b] 
avrdude.exe: Recv: . [09] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [0e] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [01] 
avrdude.exe: Recv: . [1d] 
avrdude.exe: Send: . [1b] . [0a] . [00] . [02] . [0e] . [03] . [97] . [89] 
avrdude.exe: Recv: . [1b] 
avrdude.exe: Recv: . [0a] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [0e] 
avrdude.exe: Recv: . [03] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [1f] 
             SCK period      : 8.7 us
             Varef           : 0.0 V
             Oscillator      : 3.686 MHz

avrdude.exe: Send: . [1b] . [0b] . [00] . [03] . [0e] . [02] . [9e] . [01] . [80] 
avrdude.exe: Recv: . [1b] 
avrdude.exe: Recv: . [0b] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [02] 
avrdude.exe: Recv: . [0e] 
avrdude.exe: Recv: . [02] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [1e] 
avrdude.exe: Send: . [1b] . [0c] . [00] . [0c] . [0e] . [10] . [c8] d [64] . [19]   [20] . [00] S [53] . [03] . [ac] S [53] . [00] . [00] ? [3f] 
avrdude.exe: Recv: . [1b] 
avrdude.exe: Recv: . [0c] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [02] 
avrdude.exe: Recv: . [0e] 
avrdude.exe: Recv: . [10] 
avrdude.exe: Recv: . [c0] 
avrdude.exe: Recv: . [cb] 
avrdude.exe: stk500v2_command(): command failed
avrdude.exe: initialization failed, rc=-1
             Double check connections and try again, or use -F to override
             this check.

avrdude.exe: Send: . [1b] . [0d] . [00] . [03] . [0e] . [11] . [01] . [01] . [0a] 
avrdude.exe: Recv: . [1b] 
avrdude.exe: Recv: . [0d] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [02] 
avrdude.exe: Recv: . [0e] 
avrdude.exe: Recv: . [11] 
avrdude.exe: Recv: . [00] 
avrdude.exe: Recv: . [0b] 

avrdude.exe done.  Thank you.

#2

Hi.

It looks like your programmer failed to enter programming mode. There should be a more detailed error in the programmer’s configuration utility. Could you open the utility after a failed programming attempt and post a screenshot of it here?

By the way, there should not be any problems with memory size until you exceed 65535 words of flash, so that is not the issue. In addition, an earlier firmware update to our AVR programmers made them able to handle it.

-Claire


#3

Thanks for replying.

I found out that until the fuses are burned the ATmega is running on its internal clock, and at a slower clock speed which might confuse the programmer. So I used the upper case -B switch to slow programmer to ATmega communication speed. This resulted in a much better error. It turns out it didn’t like the device signature for my ATmega1284p. It expected 0x1e9705 but found 0x1e9706. This sounds like I have an older copy of avrdude and perhaps a later version of the ATmege1284p. So I used the -F switch to override and it burned the fuses.

Thanks again.


#4

I am glad you were able to program your AVR. Thank you for letting us know what you did.

By the way, from the signature you got it seems like you actually have an ATmega1284 (without the P). Removing the “p” from your AVRDUDE command should make it work, and it’s safer than just ignoring the signature.

-Claire


#5

A post was split to a new topic: Using Pololu USB AVR Programmer v2 to load bootloader on to Adafruit Pro Trinket 3V