I have been using a USBasp board and AVRDUDE to successfully program ATtiny13 chips. I thought I'd have a look at the chip from my Arduino (ATmega328P), but AVRDUDE can't seem to read the chip.
$ ./avrdude -p m328p -c usbasp
avrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.
avrdude.exe: error: programm enable: target doesn't answer. 1
avrdude.exe: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude.exe done. Thank you.
I have checked the connections on the breadboard several times (I took the chip off the Uno and connected the pinout of the USBasp to the chip directly). Does the ATmega328P need an external oscillator to be programmed (there is one on the USBasp board)?
-
\$\begingroup\$ Take a look at USBasp: Why can I program ATtiny13A but not Atmega8A? \$\endgroup\$Amit Hasan– Amit Hasan2014年08月17日 07:52:07 +00:00Commented Aug 17, 2014 at 7:52
1 Answer 1
The ATmega on an Uno is clocked by an external crystal, in contrast to an off the shelf AVR which is configured for its internal RC resonator. This means that for reading the ATmega you either need to apply an external clock, say 1 ~ 20MHz, or use the ICSP header that is on the Uno board to communicate with the controller. This 6 pin ICSP header is actually meant for programming the AVR in circuit, hence 'In Cicruit Serial Programmer'.