PlatformIO Community

USBasp pro16MHzatmega328 upload error


#1

I try to upload Blink using USBasp to Arduino Pro Mini clone 16MHz 5V atmega328 . Upload Using Programmer USBasp with Arduino IDE works perfectly. This is my env:

[env:pro16MHzatmega328]
platform = atmelavr
board = pro16MHzatmega328
framework = arduino
upload_protocol = usbasp

I’ve got this message:

0x14 != 0x16

avrdude: verifying …
avrdude: verification error, first mismatch at byte 0x0042
avrdude: verification error; content mismatch
avrdude done. Thank you.

*** [upload] Error 1

please help

macos PlatformIO IDE Atom


#2

Can you give the part of the verbose output (pio run -v -t upload) where avrdude is invoked? Can you enable verbosity in the Arduino IDE and post how it invokes avrdude?


#3

I do not know what you’re saying to me, I’m very new to programming. :slight_smile:


#4

use http://www.sharetechnote.com/html/Arduino_Programming.html#Build_Verbose

Execute this command a terminal while being within your project’s folder.

Also how did you wire up your USBasp programmer to your Pro Mini clone? Do you have a link where you bought the Arduino?


#5

I’m sorry, I could not answer for a moment, account on hold. Pro mini:

My blog on this topic. USBasp connections. In Polish, but everything is clear;)
http://yarogniew.net/arduino/index.php/programowanie-przez-usbasp/


#6

Hm… I just tried myself as I’ll be doing some ISP programming with a pro mini soon… and hit a verification mismatch error myself in PlatformIO, but not in the Arduino IDE. But I can’t get a log dump for platformio as after I double checked in the Arduino IDE that it was uploading fine, when I went back and did a verbose upload in platformio it worked just fine! :-/ Anyway, here are the logs for my uploads for reference, which may be helpful if the OP can give logs of it not working still.

Arduino verbose upload output:

Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
/opt/arduino-1.8.8/hardware/tools/avr/bin/avrdude -C/opt/arduino-1.8.8/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -cusbasp -Pusb -Uflash:w:/tmp/arduino_build_740020/sketch_jan23a.ino.hex:i 

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

         System wide configuration file is "/opt/arduino-1.8.8/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/home/pfeerick/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         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: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e950f (probably m328p)
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: reading input file "/tmp/arduino_build_740020/sketch_jan23a.ino.hex"
avrdude: writing flash (1004 bytes):

Writing | ################################################## | 100% 0.66s

avrdude: 1004 bytes of flash written
avrdude: verifying flash memory against /tmp/arduino_build_740020/sketch_jan23a.ino.hex:
avrdude: load data flash data from input file /tmp/arduino_build_740020/sketch_jan23a.ino.hex:
avrdude: input file /tmp/arduino_build_740020/sketch_jan23a.ino.hex contains 1004 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.38s

avrdude: verifying ...
avrdude: 1004 bytes of flash verified

avrdude done.  Thank you.

PlatformIO upload verbose output:

---------------------------------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/pro16MHzatmega328.html
PLATFORM: Atmel AVR > Arduino Pro or Pro Mini ATmega328 (5V, 16 MHz)
HARDWARE: ATMEGA328P 16MHz 2KB RAM (30KB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 24 compatible libraries
Scanning dependencies...
No dependencies
MethodWrapper(["checkprogsize"], [".pioenvs/pro16MHzatmega328/firmware.elf"])
Memory Usage -> http://bit.ly/pio-memory-usage
DATA:    [          ]   0.4% (used 9 bytes from 2048 bytes)
PROGRAM: [          ]   3.3% (used 1004 bytes from 30720 bytes)
.pioenvs/pro16MHzatmega328/firmware.elf  :
section                    size      addr
.data                         0   8388864
.text                      1004         0
.bss                          9   8388864
.comment                     17         0
.note.gnu.avr.deviceinfo     64         0
.debug_aranges               64         0
.debug_info                1866         0
.debug_abbrev              1482         0
.debug_line                 258         0
.debug_str                  520         0
Total                      5284
<lambda>(["upload"], [".pioenvs/pro16MHzatmega328/firmware.hex"])
AVAILABLE: usbasp
CURRENT: upload_protocol = usbasp
BeforeUpload(["upload"], [".pioenvs/pro16MHzatmega328/firmware.hex"])
avrdude -v -p atmega328p -C /home/pfeerick/.platformio/packages/tool-avrdude/avrdude.conf -c usbasp -D -U flash:w:.pioenvs/pro16MHzatmega328/firmware.hex:i

avrdude: Version 6.3, compiled on Sep 12 2016 at 15:21:49
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "/home/pfeerick/.platformio/packages/tool-avrdude/avrdude.conf"
User configuration file is "/home/pfeerick/.avrduderc"
User configuration file does not exist or is not a regular file, skipping

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: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD
avrdude: reading input file ".pioenvs/pro16MHzatmega328/firmware.hex"
avrdude: writing flash (1004 bytes):

Writing | ################################################## | 100% 0.67s

avrdude: 1004 bytes of flash written
avrdude: verifying flash memory against .pioenvs/pro16MHzatmega328/firmware.hex:
avrdude: load data flash data from input file .pioenvs/pro16MHzatmega328/firmware.hex:
avrdude: input file .pioenvs/pro16MHzatmega328/firmware.hex contains 1004 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.39s

avrdude: verifying ...
avrdude: 1004 bytes of flash verified

avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD
avrdude: safemode: Fuses OK (E:FD, H:DA, L:FF)

avrdude done.  Thank you.

=========================================================== [SUCCESS] Took 1.83 seconds ===========================================================

#7

My Arduino verbose upload output:

/Applications/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/yarogniew/Library/Arduino15/packages -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/yarogniew/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/yarogniew/Documents/Arduino/libraries -fqbn=arduino:avr:pro:cpu=16MHzatmega328 -ide-version=10808 -build-path /var/folders/70/gvyqh6314qj1yz273pz8w79w0000gn/T/arduino_build_497332 -warnings=none -build-cache /var/folders/70/gvyqh6314qj1yz273pz8w79w0000gn/T/arduino_cache_990181 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=/Users/yarogniew/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2 -prefs=runtime.tools.avr-gcc-4.9.2-atmel3.5.4-arduino2.path=/Users/yarogniew/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2 -prefs=runtime.tools.avrdude.path=/Users/yarogniew/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9 -prefs=runtime.tools.avrdude-6.3.0-arduino9.path=/Users/yarogniew/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9 -prefs=runtime.tools.arduinoOTA.path=/Users/yarogniew/Library/Arduino15/packages/arduino/tools/arduinoOTA/1.1.1 -prefs=runtime.tools.arduinoOTA-1.1.1.path=/Users/yarogniew/Library/Arduino15/packages/arduino/tools/arduinoOTA/1.1.1 -verbose /Users/yarogniew/Documents/Arduino/arduino moje skecze/PODSTAWY/Blink_pro_mini/Blink_pro_mini.ino
/Applications/Arduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/yarogniew/Library/Arduino15/packages -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/yarogniew/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/yarogniew/Documents/Arduino/libraries -fqbn=arduino:avr:pro:cpu=16MHzatmega328 -ide-version=10808 -build-path /var/folders/70/gvyqh6314qj1yz273pz8w79w0000gn/T/arduino_build_497332 -warnings=none -build-cache /var/folders/70/gvyqh6314qj1yz273pz8w79w0000gn/T/arduino_cache_990181 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=/Users/yarogniew/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2 -prefs=runtime.tools.avr-gcc-4.9.2-atmel3.5.4-arduino2.path=/Users/yarogniew/Library/Arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2 -prefs=runtime.tools.avrdude.path=/Users/yarogniew/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9 -prefs=runtime.tools.avrdude-6.3.0-arduino9.path=/Users/yarogniew/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9 -prefs=runtime.tools.arduinoOTA.path=/Users/yarogniew/Library/Arduino15/packages/arduino/tools/arduinoOTA/1.1.1 -prefs=runtime.tools.arduinoOTA-1.1.1.path=/Users/yarogniew/Library/Arduino15/packages/arduino/tools/arduinoOTA/1.1.1 -verbose /Users/yarogniew/Documents/Arduino/arduino moje skecze/PODSTAWY/Blink_pro_mini/Blink_pro_mini.ino
Using board 'pro' from platform in folder: /Users/yarogniew/Library/Arduino15/packages/arduino/hardware/avr/1.6.21
Using core 'arduino' from platform in folder: /Users/yarogniew/Library/Arduino15/packages/arduino/hardware/avr/1.6.21
Detecting libraries used...


Sketch uses 926 bytes (3%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
/Users/yarogniew/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/bin/avrdude -C/Users/yarogniew/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/etc/avrdude.conf -v -patmega328p -cusbasp -Pusb -Uflash:w:/var/folders/70/gvyqh6314qj1yz273pz8w79w0000gn/T/arduino_build_497332/Blink_pro_mini.ino.hex:i

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:01:35
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/Users/yarogniew/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/etc/avrdude.conf"
         User configuration file is "/Users/yarogniew/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         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 (probably m328p)
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 "/var/folders/70/gvyqh6314qj1yz273pz8w79w0000gn/T/arduino_build_497332/Blink_pro_mini.ino.hex"
avrdude: writing flash (926 bytes):

Writing | ################################################## | 100% 0.65s

avrdude: 926 bytes of flash written
avrdude: verifying flash memory against /var/folders/70/gvyqh6314qj1yz273pz8w79w0000gn/T/arduino_build_497332/Blink_pro_mini.ino.hex:
avrdude: load data flash data from input file /var/folders/70/gvyqh6314qj1yz273pz8w79w0000gn/T/arduino_build_497332/Blink_pro_mini.ino.hex:
avrdude: input file /var/folders/70/gvyqh6314qj1yz273pz8w79w0000gn/T/arduino_build_497332/Blink_pro_mini.ino.hex contains 926 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.48s

avrdude: verifying ...
avrdude: 926 bytes of flash verified

avrdude done.  Thank you.

#8

Does it work with pio run -t program?