ISP Bootloader onto ATMEGA328-AU + AVR Pocket Programmer

Hey All
I have a question about using the AVR Pocket Programmer from SparkFun and Bootloading an ATMEGA328-AU (digikey ATMEGA328-AU-ND)

I have a schema here

here is the board (you can see the ISP header in the lower right), there is an FTDI header for uploading sketches later

I set the board type to Arduino Mini (have tried FIO and Lily as well)
i am having an issue that when attempting to burn the bootloader is get an expecting error

for my sanity, can you guys take a look at the schema and tell me what i am doing wrong.
i am able to upload / make files using AVRDUDE but not burn the bootloader.

any suggestions / recommendations would be helpful

"when attempting to burn the bootloader is get an expecting error"

Do you mean that you are getting an error saying that device signature was not correct?

Each model of AVR processor has a different signature. The expected value is in the boards.txt file under the device name you select. If you want to program a new device you should create a "hardware" directory in the same directory as your Arduino sketches and inside that "hardware" directory, create a file called "boards.txt" that has the description of your board. When you re-start the Arduino IDE your board(s) will show up in the Board menu.

Look in the datasheet for the correct signature bytes for your device.

Thanks for the notification.

this is the error i get

avrdude: Expected signature for ATMEGA328P is 1E 95 0F
Double check chip, or use -F to override this check.

bump!

anyone know how to fix the error.
i have attempted to edit the programmers.txt as well as the boards.txt with no success.

googled the bejeezus out of this, no luck

Did you look in the datasheet for your processor and find the signature bytes for that processor?

Did you put those signature bytes into the boards.txt entry?

Try those two things.

i checked the datasheet for the ATMEGA328AU

this is what it has on page 302 of this doc http://www.atmel.com/dyn/resources/prod_documents/doc8271.pdf
ATmega328P 0x1E 0x95 0x0F

maybe i am looking at it wrong

additionally i have changed the programmers text for usbtinyasp and added the force boolean

usbtinyasp.force=true

Try using the signature bytes for the ATmega328 (i.e., 0x1E 0x95 0x14) instead of the signature bytes for ATmega328P.

thanks, will try.
now to confirm, the order you have there is low, high, extended?

The signature bytes identifies the device You are trying to program - they shouldn't be confused with the fuse bytes. BTW I got the values from the data sheet You linked to (the row above the one You refered to). I guess You need a new entry in Your config file for AVRDude where You input the correct signature bytes.

hmm, interesting, i am making some progress but now getting a whole new error

Arduino IDE

avrdude: initialization failed, rc=-1
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA328 is 1E 95 14
 ***failed;  
avrdude: verification error, first mismatch at byte 0x0000
         0x3f != 0x00
avrdude: verification error; content mismatch

in the avrdude.conf file i added a new board (copied the m328p one)

    id              = "m328";
    desc            = "ATMEGA328";
     has_debugwire = yes;
     flash_instr   = 0xB6, 0x01, 0x11;
     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
	             0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
	             0x99, 0xF9, 0xBB, 0xAF;
    stk500_devcode  = 0x86;
    # avr910_devcode = 0x;
    signature       = 0x1e 0x95 0x14;
...

in boards.txt i created a new board copied from 'pro5v328'

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

sparky.name=Sparky Jr + SparkyISP

sparky.upload.protocol=stk500
sparky.upload.maximum_size=30720
sparky.upload.speed=57600

sparky.bootloader.low_fuses=0xFF
sparky.bootloader.high_fuses=0xDA
sparky.bootloader.extended_fuses=0x05
sparky.bootloader.path=atmega
sparky.bootloader.file=ATmegaBOOT_168_atmega328.hex
sparky.bootloader.unlock_bits=0x3F
sparky.bootloader.lock_bits=0x0F

sparky.build.mcu=atmega328
sparky.build.f_cpu=16000000L
sparky.build.core=arduino

and in programmers.txt i added a new copy of USBtinyISP
note that i am forcing -F

sparkyisp.name=SparkyISP
sparkyisp.protocol=usbtiny
sparkyisp.force=true

now i am at a loss.

Try adding this to your Arduino IDE preference.txt:

upload.verbose=true

This will turn on the debugging messages in avrdude. From that you should be able to see what signature is being read. You should also be able to tell what part of memory is not verifying.

When I got an error like this it was because I was using ArduinoISP without disabling auto-reset. Avrdude was talking to the Arduino bootloader which responds to the STK500v1 "Write lock byte" command by saying "OK" but when you read the "lock byte" back it always returns 0x00. If you are using a USBtiny (or equivalent) this should not be your problem.

Try doing the upload without the ISP programmer connected to the target board. If you get the same results It's probably a problem in the programmer.

bah.

this is what verbose gives me

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -cusbtiny -F -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m 

avrdude: Version 5.4-arduino, compiled on Oct  9 2007 at 11:20:31
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/Users/eugene/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port            : unknown
         Using Programmer      : usbtiny
         AVR Part              : ATMEGA328P
avrdude: Using SCK period of 10 usec
         Chip Erase delay      : 9000 us
         PAGEL                 : PD7
         BS2                   : PC2
         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     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
                                  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  4500  4500 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  4500  4500 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  4500  4500 0x00 0x00
                                  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  4500  4500 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
                                  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

         Programmer Type : USBTINY
         Description     : USBtiny simple USB programmer

CMD: [ac 53 00 00] [ae 53 00 00]
CMD: [ac 53 00 00] [ac 53 80 00]
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions

CMD: [30 00 00 00] [30 00 00 00]
CMD: [30 00 01 00] [30 00 01 00]
CMD: [30 00 02 00] [30 00 02 00]
Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA328P is 1E 95 0F
avrdude: current erase-rewrite cycle count is 8388736 (if being tracked)
avrdude: erasing chip
CMD: [ac 80 00 00] [be 80 00 00]
avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [ac 53 80 00]
CMD: [ac 53 00 00] [ae 53 80 00]
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):

CMD: [58 00 00 00] [1c 00 00 00]
CMD: [ac e0 00 ff] [ac 70 00 ff]
CMD: [58 00 00 00] [5c 00 00 00]
CMD: [58 00 00 00] [5c 00 00 00]
CMD: [58 00 00 00] [58 00 00 00]
CMD: [58 00 00 00] [58 00 00 00]
CMD: [58 00 00 00] [58 00 00 00]
CMD: [58 00 00 00] [58 00 00 00]
CMD: [58 00 00 00] [5c 00 00 00]
CMD: [58 00 00 00] [5c 00 00 00]
CMD: [58 00 00 00] [58 00 00 00]
CMD: [58 00 00 00] [58 00 00 00]
CMD: [58 00 00 00] [58 00 00 00]
CMD: [58 00 00 00] [58 00 00 00]
CMD: [58 00 00 00] [5c 00 00 00]
CMD: [58 00 00 00] [5c 00 00 00]
CMD: [58 00 00 00] [08 00 00 00]
CMD: [58 00 00 00] [58 00 00 00]
CMD: [58 00 00 00] [58 00 00 00]
CMD: [58 00 00 00] [48 00 00 00]
Writing |  ***failed;  
################################################## | 100% 0.04s

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:

CMD: [58 00 00 00] [58 00 00 00]
Reading | ################################################## | 100% 0.00s

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

avrdude done.  Thank you.

Try lowering the bitclock with e.g. "-B 100" or greater values.

CMD: [30 00 00 00] [30 00 00 00]
CMD: [30 00 01 00] [30 00 01 00]
CMD: [30 00 02 00] [30 00 02 00]
Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATMEGA328P is 1E 95 0F

The device signature of your chip is reading as 00 00 00 ??? THAT can't be good.

Are you sure the programmer is even connected to the chip? Getting all 0's might mean that one or more of the SPI lines is disconnected or shorted to ground. For example if power wasn't getting to the chip, or the clock signal was not getting to the chip, or the data line from the chip to the ISP (MISO?) was not connected...

Has this programmer worked on other AVR chips in the past?

Hi,

I was searching the same question as above, forget all the above!!!

You can use any arduino as an ISP to bootload the smd 328p-au at 5volt and 16mhz. (I used the arduino uno)

  1. Upload the sketch Arduino as ISP.
  2. Get the right connections of mosi, miso, sck, reset
  3. Choose in the board menu: Arduino Mini w/ ATmega328

If you get an error, your connections are bad.

Have Fun!!!

@Campagne: maybe you should learn to read first. He is (like me) not using an ATMEGA328P but an ATMEGA328-AU. It is a painful problem. The only solution seem to be: use AVR studio instead of Arduino if you buy an ATMEGA328 instead of an ATMEGA328P uC.

From the datasheet:
ATmega48A 0x1E 0x92 0x05
ATmega48PA 0x1E 0x92 0x0A
ATmega88A 0x1E 0x93 0x0A
ATmega88PA 0x1E 0x93 0x0F
ATmega168A 0x1E 0x94 0x06
ATmega168PA 0x1E 0x94 0x0B
ATmega328 0x1E 0x95 0x14
ATmega328P 0x1E 0x95 0x0F

Table 28-10 in Atmel-8271-8-bit-AVR-Microcontroller...pdf.

I experience the same problems. My dedicated arduino has an AU version that is causing troubles. I also had some P variants, programming those with the same programmer (AVR Pocket Programmer) works very well.
My MKII was left at work, so I can't right now test it with that one.