ATMEGA328P-PU avrdude verification error

Hi,

After a day trying to upload a bootloader on an ATMEGA328P-PU using an USBAsp v2.0 programmer, it seems that I need help ...

My boards.txt includes :

atmega328bb.name=ATmega328 on a breadboard (8 MHz internal clock)
atmega328bb.upload.protocol=stk500
atmega328bb.upload.maximum_size=30720
atmega328bb.upload.speed=57600
atmega328bb.bootloader.low_fuses=0xE2
atmega328bb.bootloader.high_fuses=0xDA
atmega328bb.bootloader.extended_fuses=0x05
atmega328bb.bootloader.path=arduino:atmega
atmega328bb.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
atmega328bb.bootloader.unlock_bits=0x3F
atmega328bb.bootloader.lock_bits=0x0F
atmega328bb.build.mcu=atmega328p
atmega328bb.build.f_cpu=8000000L
atmega328bb.build.core=arduino:arduino
atmega328bb.build.variant=arduino:standard

but when I use the "burn bootloader" feature of Arduino IDE, I have the following error :

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cusbasp -Pusb -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xE2:m 

[...]

avrdude: 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:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : usb
         Using Programmer              : usbasp
         AVR Part                      : ATmega328P
         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    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e950f
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: reading input file "C:\Users\Fabien\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.9/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex"
avrdude: writing flash (32652 bytes):

Writing | ################################################## | 100% -0.00s

avrdude: 32652 bytes of flash written
avrdude: verifying flash memory against C:\Users\Fabien\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.9/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex:
avrdude: load data flash data from input file C:\Users\Fabien\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.9/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex:
avrdude: input file C:\Users\Fabien\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.9/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex contains 32652 bytes
avrdude: reading on-chip flash data:

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

aError while burning bootloader.
vrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x7800
         0x00 != 0x0c
avrdude: verification error; content mismatch

avrdude done.  Thank you.

Thanks !

Fabien

The voltage jumber on my USBasp was 3.3V.
When I set the jumper to 5V, the upload works ! Why ?!

If the fuses are set on your ATmega328P to run at 16MHz it's actually out of spec at 3.3V. This forum thread includes a graph that's in the datasheet showing the max clock speed versus operating voltage.

Is it possible the fuse are set to run at 16MHz in your ATmega?
Geoff

Thank you very much for your answer !

I have made several tests, this is my final configuration with a 8Mhz external quartz :

If I burn the bootloader using USBasp 5V, it works.
If I burn the bootloader using USBasp 3.3V, I have a verification error : "avrdude: verification error, first mismatch at byte 0x7800 0x00 != 0x0c"

If I upload my program using USBasp 5V and then I run the program without USBasp but with VCC=3.3V, the program works !

The USBasp programmer is working well.

Here you will find the final configuration :

atmega328p_8mhz_external_quartz.name=ATmega328P standalone (8 MHz external quartz)
atmega328p_8mhz_external_quartz.upload.protocol=stk500
atmega328p_8mhz_external_quartz.upload.maximum_size=30720
atmega328p_8mhz_external_quartz.upload.speed=57600
atmega328p_8mhz_external_quartz.upload.tool=avrdude
atmega328p_8mhz_external_quartz.bootloader.tool=avrdude
atmega328p_8mhz_external_quartz.bootloader.low_fuses=0xF7
atmega328p_8mhz_external_quartz.bootloader.high_fuses=0xD8
atmega328p_8mhz_external_quartz.bootloader.extended_fuses=0x06
atmega328p_8mhz_external_quartz.bootloader.path=arduino:atmega
atmega328p_8mhz_external_quartz.bootloader.file=atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex
atmega328p_8mhz_external_quartz.bootloader.unlock_bits=0x3F
atmega328p_8mhz_external_quartz.bootloader.lock_bits=0x0F
atmega328p_8mhz_external_quartz.build.mcu=atmega328p
atmega328p_8mhz_external_quartz.build.f_cpu=8000000L
atmega328p_8mhz_external_quartz.build.core=arduino:arduino
atmega328p_8mhz_external_quartz.build.variant=arduino:standard

Thanks for your help.