Nugroho's blog.: Reset clock fuse bit on AVR

Sunday, May 17, 2015

Reset clock fuse bit on AVR

My ATTiny13A LED’s still blinking, but I can’t program it anymore.



Here's the message

Nugrohos-MacBook-Air:~ nugroho$ avrdude -p t13 -c usbasp -P usb -n

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.


avrdude done. Thank you.

Nugrohos-MacBook-Air:~ nugroho$ avrdude -p t13 -c usbasp -P usb -n -F

avrdude: error: programm enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x000000 (retrying)
avrdude: Device signature = 0x000000 (retrying)
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATtiny13 is 1E 90 07

avrdude done. Thank you.

Nugrohos-MacBook-Air:~ nugroho$

It can still be programmed using -B4 option however

Nugrohos-MacBook-Air:~ nugroho$ avrdude -p t13 -c usbasp -P usb -B4 -n  

avrdude: set SCK frequency to 187500 Hz
avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9007

avrdude: safemode: Fuses OK (H:FF, E:FF, L:6A)

avrdude done. Thank you.

Nugrohos-MacBook-Air:~ nugroho$


From evilmadscientist.com, it apparently my ATTiny clock is slower than my USBASP. We have to erase the chip and reset the clock.

Nugrohos-MacBook-Air:~ nugroho$ avrdude -p t13 -c usbasp -P usb -tuF   

avrdude: error: programm enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x000000 (retrying)
avrdude: Device signature = 0x000000 (retrying)
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATtiny13 is 1E 90 07
avrdude> sck 1000
>>> sck 1000
avrdude: set SCK frequency to 1000 Hz
avrdude> e
>>> e
avrdude: erasing chip
avrdude: error: programm enable: target doesn't answer. 1
avrdude> sck 10
>>> sck 10
avrdude: set SCK frequency to 93750 Hz
avrdude> quit
>>> quit

avrdude done. Thank you.

Nugrohos-MacBook-Air:~ nugroho$ avrdude -p t13 -c usbasp -P usb -n

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.


avrdude done. Thank you.

Nugrohos-MacBook-Air:~ nugroho$ avrdude -p t13 -c usbasp -P usb -B4 -n

avrdude: set SCK frequency to 187500 Hz
avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9007

avrdude: safemode: Fuses OK (H:FF, E:FF, L:6A)

avrdude done. Thank you.

Nugrohos-MacBook-Air:~ nugroho$ avrdude -p t13 -c usbasp -P usb -B4 -tuF

avrdude: set SCK frequency to 187500 Hz
avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9007
avrdude> sck 1000
>>> sck 1000
avrdude: set SCK frequency to 1000 Hz
avrdude> e
>>> e
avrdude: erasing chip
avrdude: set SCK frequency to 187500 Hz
avrdude> quit
>>> quit

avrdude done. Thank you.

Nugrohos-MacBook-Air:~ nugroho$

Nugrohos-MacBook-Air:~ nugroho$ avrdude -p t13 -c usbasp -P usb -U lfuse:w:0x6A:m -U hfuse:w:0xFF:m -B250



avrdude: set SCK frequency to 4000 Hz

avrdude: AVR device initialized and ready to accept instructions



Reading | ################################################## | 100% 0.03s



avrdude: Device signature = 0x1e9007

avrdude: reading input file "0x6A"

avrdude: writing lfuse (1 bytes):



Writing | ################################################## | 100% 0.01s



avrdude: 1 bytes of lfuse written

avrdude: verifying lfuse memory against 0x6A:

avrdude: load data lfuse data from input file 0x6A:

avrdude: input file 0x6A contains 1 bytes

avrdude: reading on-chip lfuse data:



Reading | ################################################## | 100% 0.01s



avrdude: verifying ...

avrdude: 1 bytes of lfuse verified

avrdude: reading input file "0xFF"

avrdude: writing hfuse (1 bytes):



Writing | ################################################## | 100% 0.01s



avrdude: 1 bytes of hfuse written

avrdude: verifying hfuse memory against 0xFF:

avrdude: load data hfuse data from input file 0xFF:

avrdude: input file 0xFF contains 1 bytes

avrdude: reading on-chip hfuse data:



Reading | ################################################## | 100% 0.01s



avrdude: verifying ...

avrdude: 1 bytes of hfuse verified



avrdude: safemode: Fuses OK (H:FF, E:FF, L:6A)



avrdude done. Thank you.



Nugrohos-MacBook-Air:~ nugroho$

...

It’s bit different than on http://www.evilmadscientist.com/2007/fixing-a-bad-frequency-fuse-bit-on-an-avr/ because the Attiny13A clock automatically back to 187500 without manual set.



########


Untuk “menghidupkan” lagi AVR yang bermasalah dengan fuse-bit (mungkin kita tidak sengaja mensetting clock terlalu lambat, lebih lambat dari clock USBASP atau ISP kita sehingga program tidak dapat diupload), kita harus menghapus program yang terupload di AVR.

Gunakan avrdude dalam mode interaktif seperti di atas

No comments:

323f (5) amp (1) android (12) apple (7) arduino (18) art (1) assembler (21) astina (4) ATTiny (23) blackberry (4) camera (3) canon (2) cerita (2) computer (106) crazyness (11) debian (1) delphi (39) diary (286) flash (8) fortran (6) freebsd (6) google apps script (8) guitar (2) HTML5 (10) IFTTT (7) Instagram (7) internet (12) iOS (5) iPad (6) iPhone (5) java (1) javascript (1) keynote (2) LaTeX (6) lazarus (1) linux (29) lion (15) mac (28) macbook air (8) macbook pro (3) macOS (1) Math (3) mathematica (1) maverick (6) mazda (4) microcontroler (35) mountain lion (2) music (37) netbook (1) nugnux (6) os x (36) php (1) Physicist (29) Picture (3) programming (189) Python (109) S2 (13) software (7) Soliloquy (125) Ubuntu (5) unix (4) Video (8) wayang (3) yosemite (3)