Fixing a bad frequency fuse bit on an AVR

ATtiny2313 This is a quick note on AVR programming with the AVRISP MkII programmer, with which it is possible to foul up your clock fuse bits. =)

(This might be plain as day to some out there, but *I* didn't know about it, so I thought I'd jot it down.)

Minor problem: I was programming some AVRs when I thought I might try to change the clock fuse bits to use one of the low-frequency internal oscillators. Apparently, it is possible to change the clock frequency low enough that the ISP interface can no longer program the flash-- at which point it *seems* as though the chip is lost. These are inexpensive chips, (around $2 each), but the cost can add up quickly if you don't fix the broken ones. Besides, they're made of plastic, so you can't even recycle them into a trivet.


Here's the trick, which is hinted at in the users guide: While the programmer can only write to flash above a certain speed, it can erase the chip almost at zero speed.

Previously, we discussed programming AVR microcontrollers with AVRdude, the cross-platform "AVR Downloader/UploaDEr." Our setup uses a Mac, the AVRISP MkII programmer, and an ATtiny2313 chip. However, the basic problem and solution that we are describing here are applicable to setups with other computer platforms and AVR microcontrollers. (Presumably, there are similar issues that can also occur with other programmers.)

So, let's assume that you've set your AVR clock source to a very slow internal signal, and you can no longer program the device by conventional means. It is still possible at that point to use avrdude in interactive mode by entering a command like the following:
avrdude -p t2313 -c avrispmkII -P usb -tuF
where "t2313," "usb," and "avrispmkII" should be changed as needed to reflect your device, interface/programmer location, and programmer.

Once it (finally) enters interactive mode (at its super-slow clock speed), enter "sck 1000" at the prompt. This slows down the serial communication greatly by setting the SCK signal period to 1000 microseconds. You can then erase the chip by entering "e" and then set the programmer back to normal by entering "sck 10" (for a 10 microsecond period). Finally, enter "quit" to exit interactive mode. Your chip should be back to normal at this point, which you can verify by programming it again-- hopefully without the same fuse bit settings.


MetaBlog links for this story: [del.icio.us | technorati ]
Technorati tags: , , , , , , , , ,

0 comments

The following comments are owned by whomever posted them. This site is not responsible for what they say.
Welcome to Evil Mad Scientist Laboratories. New projects are posted on most Wednesdays.


Bookmark EMSL

EMSL RSS Feed
Twitter: @EMSL
del.icio.us
feedburner
Feed on Google Reader
YouTube Channel

Subscribe to get new articles by E-mail:

E-mail address:


Preview | Powered by FeedBlitz

My Account





Sign up as a New User
Lost your password?

Who's Online

Guest Users: 20

DIY Hardware for Electronic Art


Interactive LED Panel kits


Meggy Jr RGB
LED matrix game
development kit.


Business-card sized
AVR target boards


Peggy 2
LED Pegboard kits

Forumposts

Order: New Views Posts
Latest 10 Forum Posts
 
Re: Killer Board
 By:  Windell
 Sunday, March 14 2010 @ 05:17 PM PDT
Killer Board
 By:  Flashofwhite
 Sunday, March 14 2010 @ 11:15 AM PDT
Re: Coffee table Vs. Dining ta..
 By:  Windell
 Saturday, March 13 2010 @ 12:56 AM PST
Re: Coffee table Vs. Dining ta..
 By:  Chris
 Friday, March 12 2010 @ 11:25 AM PST
Re: Coffee table Vs. Dining ta..
 By:  Windell
 Friday, March 12 2010 @ 10:15 AM PST
Coffee table Vs. Dining table ..
 By:  Chris
 Friday, March 12 2010 @ 06:13 AM PST
Re: 3D Routed Interactive Wall
 By:  wgarris
 Tuesday, March 09 2010 @ 11:31 AM PST
Re: 3D Routed Interactive Wall
 By:  Lenore
 Tuesday, March 09 2010 @ 10:39 AM PST
3D Routed Interactive Wall
 By:  wgarris
 Tuesday, March 09 2010 @ 10:12 AM PST
Re: 2nd Panel Problem Panel.
 By:  Windell
 Monday, March 08 2010 @ 01:49 PM PST