Hi
I’m trying to upload basic blink code to attiny85 using a cheap USBasp programmer (from China).
Here is my platfomio.ini config :
[env:attiny85]
platform = atmelavr
board = attiny85
framework = arduino
board_build.f_cpu = 1000000L
upload_protocol = usbasp
upload_flags =
-Pusb
-v
It does not work. Error messages is :
avrdude: error: program enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
If I use ‘-F’ option, avrdude complains about bad signature of the chip ?!
I’ve tried Arduino IDE to program attiny85 (using ATtinyCore) and I was able to succesfully program it several time (to change delays for example).
Any help appreciated.
Rgds
José
With the exact same programmer and wireup?
Also, can you show a screenshot of your Arduino IDE configuration (board, programmer, …).
Yes : no change to wiring of usbasp and attiny85 on breadboard
Hm I don’t really see much difference between the Arduino IDE invocation and the PlatformIO invocation for that platformio.ini
.
For Arduino IDE:
avrdude -CC:\Users\Maxi\AppData\Local\Arduino15\packages\ATTinyCore\hardware\avr\1.4.1/avrdude.conf -v -pattiny85 -cusbasp -Uflash:w:C:\Users\Maxi\AppData\Local\Temp\arduino_build_698574/Blink.ino.hex:i
For PlatformIO:
avrdude -Pusb -v -v -p attiny85 -C C:\Users\Maxi\.platformio\packages\tool-avrdude\avrdude.conf -c usbasp -e -D -U flash:w:.pio\build\attiny85\firmware.hex:i
Can you change the upload_flags
value to not include -P
and retry?
Also upload full “Verbose Upload” log from PlatformIO and Arduino IDE (activatable in File -> Settings -> Tick box for “Upload” )
Hi (and thanks for the support !)
Let me mentioned that I’m using Arduino IDE 1.8.13.
This is Arduino verbose output :
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 "/home/marcosjl/.arduino15/packages/ATTinyCore/hardware/avr/1.4.1/avrdude.conf"
User configuration file is "/home/marcosjl/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : usb
Using Programmer : usbasp
Setting bit clk period : 5.0
AVR Part : ATtiny85
Chip Erase delay : 400000 us
PAGEL : P00
BS2 : P00
RESET disposition : possible i/o
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 12 4 0 no 512 4 0 4000 4500 0xff 0xff
flash 65 12 32 0 yes 8192 64 128 30000 30000 0xff 0xff
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
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
calibration 0 0 0 0 no 2 0 0 0 0 0x00 0x00
Programmer Type : usbasp
Description : USBasp, http://www.fischl.de/usbasp/
avrdude: set SCK frequency to 187500 Hz
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e930b (probably t85)
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: set SCK frequency to 187500 Hz
avrdude: reading input file "/tmp/arduino_build_626466/Blink.ino.hex"
avrdude: writing flash (636 bytes):
Writing | ################################################## | 100% 0.49s
avrdude: 636 bytes of flash written
avrdude: verifying flash memory against /tmp/arduino_build_626466/Blink.ino.hex:
avrdude: load data flash data from input file /tmp/arduino_build_626466/Blink.ino.hex:
avrdude: input file /tmp/arduino_build_626466/Blink.ino.hex contains 636 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.26s
avrdude: verifying ...
avrdude: 636 bytes of flash verified
avrdude done. Thank you.
And here’s PlaformIO output :
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/attiny85.html
PLATFORM: Atmel AVR (2.2.0) > Generic ATtiny85
HARDWARE: ATTINY85 8MHz, 512B RAM, 8KB Flash
DEBUG: Current (simavr) On-board (simavr)
PACKAGES:
- framework-arduino-avr-attiny 1.3.2
- tool-avrdude 1.60300.200527 (6.3.0)
- toolchain-atmelavr 1.50400.190710 (5.4.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 9 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Checking size .pio/build/attiny85/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 1.8% (used 9 bytes from 512 bytes)
Flash: [= ] 8.3% (used 676 bytes from 8192 bytes)
Configuring upload protocol...
AVAILABLE: usbasp
CURRENT: upload_protocol = usbasp
Looking for upload port...
Uploading .pio/build/attiny85/firmware.hex
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/marcosjl/.platformio/packages/tool-avrdude/avrdude.conf"
User configuration file is "/home/marcosjl/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : usb
Using Programmer : usbasp
avrdude: seen device from vendor ->www.fischl.de<-
avrdude: seen product ->USBasp<-
AVR Part : ATtiny85
Chip Erase delay : 400000 us
PAGEL : P00
BS2 : P00
RESET disposition : possible i/o
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 12 4 0 no 512 4 0 4000 4500 0xff 0xff
flash 65 6 32 0 yes 8192 64 128 30000 30000 0xff 0xff
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
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
calibration 0 0 0 0 no 1 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: error: program enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
*** [upload] Error 1
====================================================================== [FAILED] Took 1.32 seconds ====================================================
==================
Environment Status Duration
------------- -------- ------------
attiny85 FAILED 00:00:01.320
================================================================= 1 failed, 0 succeeded in 00:00:01.320 ==============================================
===================
The terminal process "platformio 'run', '--target', 'upload'" terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
Interesting, some delay settings and SCLK configs are missing.
I’ll have a look. Maybe it comes down to the different avrdude.conf
being used.
marcosjl31:
PlaformIO output
The AVRdude output is verbose, but PIO’s output is not – have you ran the Verbose Upload for sure in PlatformIO? Also the AVRDude invocation line is missing in the Arduino IDE output.
WIll do.
For sure, avrdude versions in Arduino and PIO aren’t the same
Arduino : avrdude: Version 6.3-20190619
PIO : avrdude: Version 6.3, compiled on Sep 12 2016 at 15:21:49 (!older!)
By the way : how do you run a “Verbose Upload” in PIO ?
I’v managed to upload the blink application to attiny85, by copying avrdude.conf from arduino to PIO.
Files are really differents :
Arduino avrdude.conf is 177692 bytes long,
PIO avrdude.conf is 518870 bytes
pio run -v -t upload
or “Verbose Upload” task (docs , under “Advanced”)
So it seems that the avrdude.conf of this core has a slightly different config for the ATTiny85 than the standard one. Please open a bug at Issues · platformio/platform-atmelavr · GitHub to get this fixed in the tool-avrdude
package or the platform code.
Ok…
That’s a follow up message on this topic.
One of the differences in Compilation/Upload between the Arduino and PlatformIO IDE is this line (in verbose mode !) :
Setting bit clk period : 5.0
This seems to be atuomagically added in Arduino IDE…
When you set upload_flags to “-Pusb -B5” in platformIO: it solves the problem as well (no need to modify the avrdude.conf file)
I’ll update the issue as well.