HOME  > >  ARDUINO MAIN PAGE  T.O.C.     ATtiny  T.O.C.    

Fuses in ATtinys- What are they? How do I configure them?

(filename: fuses.htmx)

This is a mildly esoteric ATtiny topic... you don't need to program fuses to do LOTS with ATtiny's.

(See my "Getting acquainted with ATtiny pages" if you are new to ATtinys, before delving into the depths of fuse programming.)

Before I start: Sorry: The text on this page is a mess. But we DO, eventually, get to an answer "how do you do that?"... a process that is quite easy to do!

What are these "fuse" things that people who talk about ATtiny's talk about?

They are "things" inside the ATtiny where "stuff" can be... recorded? stored? Don't think about either word to precisely.

("Fuses" aren't really so very "difficult", but there are terminology issues which complicate things.)

Imagine, if you will, "little switches" inside the ATtiny. Switches that you can put in either position, like an "on"/ "off" switch controlling the ceiling light in your kitchen.

The Nice People at Atmel call these things "fuses". They speak of them "being programmed", or not. ("Programmed" as an adjective, not as a verb.)

How the "switches" are determines various things about how the ATtiny behaves. For instance, you can have it work at 8 MHz or 1 MHz.

(I have been avoiding the word "set", as in "how the switches are set" because in some contexts, "set" means "made a "one"", where you are speaking of a digital entity having one and zero as its possible states. You might as well call them "red" and "green", really, but we often use one and zero, or on and off.... and now, with the fuses, we talk of "programmed" and "not programmed". Life simple? What fun would that be?)

ANYWAY... you can change how the chip behaves (more on this anon) by changing the fuses.

Changing the fuses is EASY. Ish. The good news is that you use the same set-up as we used for putting programs into the ATtiny! Hurrah.

As ever, there are multiple ways to do it.

Here begins an aside:

If you only want to change the clock frequency the AT tiny runs at, you can do it via the Arduino IDE, if you have set it up as described above for putting programs into the ATtiny.

From IDE menu: Tools, clock: Make it what you want. You DO NOT want EXTERNAL clock, unless you want to have to hook up a crystal (or maybe a simple resonator will do.) If you accidentally configure the ATtiny to use an external clock, it won't work, even to change the fuse setting back again, until you provide the external circuitry to provide the clock.)

SO... Carefully select the clock option you want. (The chips come, new, with the clock fuses set for 1 MHz internal clock operation.)

Aside within aside!... 1 MHz? 8 MHz?...

By default, ATtinys run at 1 MHz. You can configure them to run at 8 MHz instead, which is useful for faster baud rates with the SoftwareSerial library or for faster computation in general. To do so, that,, start as if you wanted to program the ATtiny. Select "8 MHz (Internal)" from the Tools > Clock menu. Warning: make sure you select "internal" not "external" or your microcontroller will stop working (until you connect an external clock to it). Then, run the "Burn Bootloader" command from the Tools menu. This configures the fuse bits of the microcontroller so it runs at 8 MHz. Note that the fuse bits keep their configuration until you explicitly change it, so you'll only need to do this once for each microcontroller. (Note: this doesn't actually burn a bootloader onto the board; you'll still need to upload new programs using an external programmer.) Using the higher clock frequency increases the power consumption of the chip.

("Aside within aside" ends. Thank you, whoever wrote what was the basis of that, and apologies for mislaying the details of who to credit!)

Then use, Still in the Arduino IDE "Tools" menu "Burn Bootloader". You won't burn a bootloader, but you will make the changes needed in the fuses.

Aside ENDS HERE.=============

There are three "fuse bytes" in the ATtiny85. As "byte" suggests, each has 8 bits. Sometimes one of the fuse controlled features is turned on or off depending on what's been done to one of the bits. Sometimes, a group of bits controls a feature. Each bit is basically one of the "little switches" I spoke of. And Atmel decided that if the bit in the byte that is associated with a particular fuse is "1", then we call that an "un-programmed fuse". ("Programmed" if zero.) (All so unnecessarily convoluted, unless I am missing something!!!)

Now... do you know about hex?

I could say that the fuse byte named "Extended" usually holds all 1's. You'd write that in binary as "11111111", or, to make it a bit more readable, if you knew we weren't meaning a "binary point", you could write "1111.1111". But it is SO much easier, once you get the hang of it, to write long binary numbers in hex. A bunch of 1's and 0's with a "B" after them is probably a number written in binary. (Or some people use a % in front of them.) And here's an example of how hex is nicer: 11111111B is the same as $FF. (The "$" meaning "this is in hex". Another common way to say that is to prefix the number with "0x". So 0xFF is the same as $FF... just like "12", "twelve" and "a dozen" all say the same thing. (Or "douze" in French, or %1100, or $C (!!))

The nice thing about hex is that you can, very quickly (with practice!), in your head, turn binary into hex and vice versa. So if you know you need the bits to be 0111.0110, you only need to type $76.

But! Enough of that! Anyway (hurrah!) You probably won't need quite all of this immediately! But you may well be working on an ATtiny85 project, and read that "you need to set the Fuse High Byte to 0x4D and the Fuse Low Byte to 0xA2. Fine! I'll show you how to do that! (There's another fuse byte, the "extended" fuse byte, that will normally want to stay $FF, which is the default value for that fuse byte, the settings that are in place in a newly purchased chip. Since "everyone knows" this, it can be a bit worrying for a novice, who's setting the OTHER fuses, trustingly, and is wondering what the "Extended" fuse byte needs setting to. Sigh.) (When you DO get to making your own fusing choices, there are "calculators" to help you, too.)

Much of the specifics in this fuse byte stuff highly specific to particular ATtinys, by the way.

If you are a REAL glutton for punishment, the following link... https://ww1.microchip.com/downloads/....Atmel-2586-AVR-8-bit-Microcontroller....pdf will cause a .pdf datasheet to download. In the edition I have, the Good Stuff is in section 20.2, "Fuse bytes". (And just before that is the stuff about the "Data Memory Lock Bits", which I THINK are similar, and I THINK you can also manage by the tool I am (eventually) going to tell you about.)

That's enough theory!

Fusing... the practice!

As with programming, I'm going to tell you how simple things are, once you're all set up. Then I will tell you how to get set up.

As with programming ATtinys, this is just one of several "answers". It has the distinct advantage, my view, of using the same hardware, and being inexpensive (the breadboard, and Arduino, which you can use for other things, when not programming or fusing ATtinys), and simple. Ish.

As before, you need the Arduino IDE set up on your big PC, although we won't be using it to do the fusing. (I.e. "program/ "un-program" the bits in the fuse bytes")

We need that, because when you install the basic- and free- Arduino IDE, you also install something- also free- called AVRdude, which our answer to fusing will be using, too. Again "transparently". Once things are set up, you won't even be aware of your AVRdude software.

You hook up the hardware, as before: Big PC to Arduino via USB, Arduino to ATtiny via the same 6 wires.

You fire up AVRdudeSS, a GUI front end for AVRdude. (I'll explain obtaining, installing it later.

You are then VERY CAREFUL! AVRdudeSS is a BIG "Swiss army knife" of a program, and can DO all sorts of things. Try not to disturb things other than....

Image of AVRdudeSS dialog should appear here.

You need to...

Over in the "Fuses and Lock Bits" section, before doing anything "clever", just try READING the PRESENT state of these things, by clicking the "Read" button, which I've marked "5". If that works, all well and good, even though "nothing happens". Until a simple read works, don't try fancier, potentially trouble-making things!

Values should appear in the "L", "H", "E" and "LB" windows. Those labels are for Fuse Byte **L**ow, Fuse Byte **H**igh, Fuse Byte **E**xtended, and Lock Bits.

For a "from the factory", still in default mode, ATtiny, you should see 0x62, 0xDF, 0xFF respectively.

Once you've got reading the fuses working...

Be careful: don't write "just any" value, to "see what happens".

On my first use of the system, setting up an ATtiny to generate a reset pulse, for other hardware, but setting it up, among other things, with brownout protection, I needed 0xE2 and 0xDD in the "L" and "H" Fuse Bytes.

Those numbers were "given" to me... as I suspect you will be "given" the right values, if you are new to this.) I entered the numbers with the "0x" hex indicator. I wasn't given a value for the "E" fuse byte, so, correctly, it seems, assumed it best to leave it at the 0xFF showing since my read of the fuse bytes. And as I didn't know what to do with it, I did nothing with the "LB" configuration, leaving the window blank, if my notes are correct. (Did the read not return a value here? (Probably not, given that LB has its own Read and Write buttons.

I left BOTH the "set fuses" and "set lock" tick boxes UN-ticked. (I suspect they are there to include these writes in a "bigger" write... something we are not doing here!)

Then I simply clicked the "Write" button next to Fuse "L"'s window, the button I've marked "6".

And lots of "stuff" in the window at the bottom of AVRdudeSS... A bit scary! But when I scanned it, everything seemed fine.

I was, I think, "done"... but I made a little check...

First, I carefully changed JUST what was in the windows for L and H to 0x00. I did this to see if the Read I am about to indicate made the numbers change back to 0xE2 and 0xDD. (If I hadn't changed what was in the windows, I couldn't be sure where the E2, DD came from. They'd remain if the "Read" did nothing.

I was careful not to click "Write" again at this stage!

When I clicked "Read"....

HURRAH! The windows filled with the hoped for 0xE2 and 0xDD!!!

I'd done the fusing I needed!

Two details...

Two details that may need attention "regularly"... sort of a "set up" thing, sort of an ongoing "do every time"....

What do you enter into the AVRdudeSS dialog for "Port" and "Baud". (The items I've numbered "3" and "4").

The simple answer? "The values you would use with the Arduino IDE, to program a "simple" Arduino, like the one through which you are connecting to the ATtiny."

Good news! You can "poke and hope"... i.e., put in your best guesses, try "READ" fuses, and if it works you're done, and if it isn't, have another guess.

Of course the "simple answer" assumes you can find the right values for your Arduino IDE! Finding the right port is just one of your "old skills" that you are likely to have, because to leap straight to ATtinys, before becoming at least vaguely proficient on a "simple" Arduino is an unlikely "career path". Search on "setting up Arduino IDE", if you need to. As I said... whatever's right for programming an Arduino will be right for AVRdudeSS's wants... which is hardly surprising, because AVRdudeSS and the Arduino IDE are both working through AVRdude. You just don't "see" AVRdude in either case!

NOT so obvious is the "right" baud rate. Try 19500... that may well be the one you want. But we need the baud rate AVRdude is being run at, which won't necessarily be the baud rate, say, of the Arduino IDE's communication for the Serial Monitor.

Here's what you do, if 19500, and poke and hope don't get you "there"...

Go into Arduino IDE/ File/ Prefs. Request "Show verbose output during... upload", and then send any simple something to the Arduino. In the message area at the bottom of the Arduino IDE's window, in the messages area, you'll get a slew of stuff. Somewhere near the top, something like...

avrdude: Version 6.3, compiled on...
    Copyright (c) 2000-2005 Brian Dean,
    Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is

"C:\Program Files (x86)\Arduino\hardware\tools\

    Using Port                    : COM18
    Using Programmer              : stk500v1
    Overriding Baud Rate          : 19200

... which tells us all sorts of Good Things!

Not least that you DO have AVRdude on your computer! Which can be reassuring, if things aren't going well! That ".conf" file may be worth a check, too. (Just open it with a text editor.)

On your PC, the port may be other than COM18. Yes, by the way, most users work through a "COM" port... even if it arises via some USB hardware!

And... as I said... don't be too fearful. Bad port? Bad baud? Unlikely, in ordinary situations, to do more than not work. And "not working" easy to recognize. I hope. Do write in, complain, if this matter needs more attention? (Please cite the page's URL.)

I hope "port" and "baud" don't turn out to be big hassles for you... let me know if this section needs work?

Setting up for fusing ATtinys

Setting up: First of all, a BIG THANK YOU, to... dntruong for his excellent blog, where I learned most of what I know about doing fuses!

From whence, I was lead to zakkemble's page with AVRdudeSS... where I learned about AVRdudeSS.

First you download the setup for AVRdudeSS. (I'll explain that in a moment.) It would be good to go to Zak's page, above... the link I offer in a moment may be stale. At 01 Dec 17, the download was easy to spot, being in a neat box with the following text.

But before you try the download, update your anti-malware package. There have been times when the legitimate, and nothing- wrong- with- it AVRdudeSS has garnered a false positive from some anti-malware suites. Have your latest and greatest protection in place, in case questions arise, during the download. When I downloaded it, and gave it an extra scan with my eSet anti-malware, there were no complaints at all, false or otherwise. (This was 27 Nov 17, on a Win7 machine.)

setup-AVRDUDESS-2.4.exe (914.73 kB)
AVRDUDESS (Windows installer)
Downloaded 108516 times
MD5: CF83912B3368D65FA9FCA80C7EC2CE5D

At one point, I was saying "beware malware laden fakes... this is a program many people will look for" about AVRdudeSS.

(Long before 2023, I said...) It's a very ordinary setup. You download it. You double click. A wizard takes you through the setup process.

What I found near miraculous was that it Just Worked with very little hassle. I hope you have the same experience. I call it "near miraculous", because this (AVRdudeSS) has to "play nicely" with something else on your computer (AVRdude), and AVRdude could be... anywhere! In my case, luck was with me, and AVRdudeSS found AVRdude without any trouble for me.

When you try the process explained above, starting with "Read current fusing", you should at least get a line of tildes (~~~) across the message area at the bottom of the AVRdudeSS window. (The mark the start of an attempt to execute a command. Following that line, in no more than about 20 seconds, you should either get "the answers" (in addition to them appearing in the appropriate places in the GUI part of AVRdudeSS), or at least messages which will, I hope, soon lead you to a WORKING set-up!

LadyAda offers a good article about fuses.

Search (only) this site...

index sitemap
What's New at the Site Advanced search

This search tool (free to me and to you) provided by FreeFind.com... whom I've used since 2002. I'm happy with them, obviously!

Unlike the clever Google search engine, freefind's merely looks for the words you type, so....
*    Spell them properly.
*    Don't bother with "How do I get rich?" That will merely return pages with "how", "do", "I"....

Disclosure: freefind tells me what people have searched for. It doesn't tell me your personal details. (If someone would "spy" on you, wouldn't they also feel free to lie in a "privacy statement"? Not to say I'm not lying... how can you tell?... but to say "What are privacy statements worth?".

The search engine is not intelligent. It merely seeks the words you specify. It will not do anything sensible with "What does the 'could not compile' error mean?" It will just return references to pages with "what", "does", "could", "not".... etc.

In addition to the material covered here, I have other pages with material you might find useful.....

Tutorials about the free database which is part of the free Open Office.

Sequenced set of tutorials on Pascal programming and electronics interfacing.

Some pages for programmers.

... and see also the links at the very top of the page!

Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!

Click here to visit editor's Sheepdog Software (tm) freeware, shareware pages.

And if you liked that, or want different things, here are some more pages from the editor of these tutorials....

My SheepdogSoftware.co.uk site.

My "wywtk.com" site...WhatYouWantToKnow

My Skywoof.com site.

Click here to visit editor's pages about using computers in Sensing and Control, e.g. weather logging.

My oldest-still-going site is at http://www.arunet.co.uk/tkboyd/index2.htm but that does not accept httpS access. An image of most of it is also available at https://skywoof.com/aru/index2.htm

To email this page's editor, Tom Boyd.... Editor's email address. Suggestions welcomed!

Test for valid HTML Page has been tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org. It passes in some important ways, but still needs work to fully meet HTML 5 expectations. (If your browser hides your history, you may have to put the page's URL into the validator by hand. Check what page the validator looked at before becoming alarmed by a "not found" or "wrong doctype".)

AND tested for  Test for valid CSS

Why does this page cause a script to run? Because of the Google panels, and the code for the search button. Why do I mention the script? Be sure you know all you need to about spyware.

....... P a g e . . . E n d s .....