Saturday, November 24, 2012

How to program ATTINY2313 with USBASP? or/and Upload Arduino firmware with USB ASP


You trying upload firmware with USBASP on attiny2313 and have errors like:
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: programm enable: target doesn't answer. 1 
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.
 
The problem is that the 2313's default clock (internal oscillator, CKDIV8 enabled) is way to slow for the SCK used by the USBasp by default. From this error message it seems like the current version of avrdude already adresses this problem and tries to reduce the SCK clock rate, but your USBasp's firmware doesn't support that. (thank to noah1989
fix this issue in two steps:
 
avrdude -p 2313 -P com13 -b 19200 -c avrisp -U flash:w:usbasp.hex
usbasp.hex download (v2009-02-28) yes, it's most recent

Also new firmware version allow you to use USBASP with Arduino 1.0.2 and 1.5 to upload Arduino bootloader.
  • manually reduce the SCK frequency by setting the "Slow SCK" jumper on the board. This schematic helps you to find it: http://www.fischl.de/usbasp/bilder/usbasp_circuit.png. In USBASP from China (eBay) you will not find this jumper. You need manually solder piece of wire. Like I did, see my pic for details:
 
 

2 comments:

Shashank K R said...

thanks :) it helped me

felipe valdivia said...

thanks, helped a LOT!, also i discovered that the r8 labeled solder marks are the self program en/dis jumper
cheers!