Hi,
Tried to program ATTINY85 using USBasp, and i got error...
Sketch uses 248 bytes (3%) of program storage space. Maximum is 8192 bytes.
Global variables use 9 bytes (1%) of dynamic memory, leaving 503 bytes for local variables. Maximum is 512 bytes.
avrdude: set SCK frequency to 187500 Hz
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: program enable: target doesn't answer. 0
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
Failed programming: uploading error: exit status 1
I don't think it's a bug.
It looks like your direct avrdude command does not change the clock frequency of the upload but your IDE upload attempts to change the clock first, which the old firmware in your USBASP adapter does not support.
If you turn on "verbose output" in the settings of your IDE, you can see which commands it sends to your USBASP adapter. I expect you will see -b 187500 somewhere in the command string.
If you have a USBASP adapter like this, you see two holes in the top left corner JP3
solder two pinheaders and put a jumper there and it should go in slow transfer mode, so you can program a 1MHz clocked part or set it to 8 MHz and after that program it in fast mode by removing the jumper.
At last I was able to reproduce your error with a USBASP adapter with fischl firmware
Only when I install a libusb0 driver for the USBASP I get your error
I am using Zadig for swapping drivers
on the left side you see my active driver, which then results in this error
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 "E:\Arduino\arduino-1.8.13-attinycore\portable\sketchbook\hardware\ATTinyCore\avr/avrdude.conf"
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: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: program enable: target doesn't answer. 0
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
When I change back to the WinUSB driver or the LibusbK driver (select "replace driver") the error dissapears.
resulting in:
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 "E:\Arduino\arduino-1.8.13-attinycore\portable\sketchbook\hardware\ATTinyCore\avr/avrdude.conf"
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.02s
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 "C:\Users\Hans\AppData\Local\Temp\arduino_build_476519/Attiny85_and_45_BMP180_integrated_solenoid_driver_V2.0.ino.hex"
avrdude: writing flash (3462 bytes):
Writing | ################################################## | 100% 1.75s
avrdude: 3462 bytes of flash written
avrdude: verifying flash memory against C:\Users\Hans\AppData\Local\Temp\arduino_build_476519/Attiny85_and_45_BMP180_integrated_solenoid_driver_V2.0.ino.hex:
avrdude: load data flash data from input file C:\Users\Hans\AppData\Local\Temp\arduino_build_476519/Attiny85_and_45_BMP180_integrated_solenoid_driver_V2.0.ino.hex:
avrdude: input file C:\Users\Hans\AppData\Local\Temp\arduino_build_476519/Attiny85_and_45_BMP180_integrated_solenoid_driver_V2.0.ino.hex contains 3462 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 1.42s
avrdude: verifying ...
avrdude: 3462 bytes of flash verified
avrdude done. Thank you.
So I recommend you check with Zadig, which driver you have and change if needed.
When using Zadig, make sure to select "List all devices" from the options menu. Or you won't see your USBASP.