Fuses ATmega128

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,
I'm going to program my ATmega128 by first time, but I read something about "Be careful with the Atmega128's fuses", and I don't know what it's, I didn't see anything in the manual about them. Can anybody say me what I must do with them?, where can I obtein information about these fuses?.
Besides, I'm using the Starterkit of Bergmann electronic, and this board has many jumpers that I will not use, how can I put these jumpers?, is the same if I don't use them?
Thank.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ATmega128 fuses live in three bytes in a special segment of EEPROM that is not normally accessible to a running application. They contain nonvolatile configuration bits which affect the way in which the AVR operates. (Think of it sort of like the CMOS configuration settings on a PC.)

Fuses can be programmed, erased, and re-programmed.

With the fuses, it is possible to select which clock source the ATmega will operate with, which programming or OCD interfaces it will respond to, enable special compatibility modes with obsoleted MCU's, and more.

You'll find a detailed discussion of each fuse bit in the section of the datasheet pretaining to the subsystem which is affected by that fuse. For example, the CKSEL, SUT, and CKOPT fuses are discussed in section "System Clock and Clock Options" on pages 34 to 41 of the datasheet.

All fuse bits are grouped together with a brief summary of their function in the "Memory Programming" section of the datasheet, on pages 289 to 291.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you, yesterday I was reading the datasheet, and if I am not wrong, I think that I have to think in the fuses if I want to select other clock source, or other special function, that it isn't my case.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One fuse that every ATmega128 user will become familiar with very early on is the ATmega103 Compatibility Mode fuse.

All '128's come from the factory with this fuse pre-programmed. In that state, the chip will behave almost exactly as if it were actually an ATmega103 instead of an ATmega128.

Any software you write with the ATmega128 in in mind is 99% guaranteed to fail if you attempt to run it while the chip is in M103 compatibility mode... you'll have to at least modify that fuse.

In AVR Studio, it is easy to modify a single fuse without affecting any others... the fuse selection panel of the STK500/JTAGICE programming window automatically fetches the current fuse configuration as the window is being drawn, so that you can just click on the fuses that need to be modified and click Program.

With other programming software, things may not be as "safe". The problem is, in a "write" cycle, it is impossible to just modify a single fuse... the programming software has to specify the state of all of the High and Low fuse bits simultaneously, and all of the Extended fuse bits simultaneously. If the software you're using doesn't have foreknowledge of exactly what value should go into each individual bit (not just the one you've told it to modify), then you could accidentally render your AVR inoperable by doing something as apparently inoccuous as turning on the EEPSAVE fuse.

You'll be safer if you study the fuse bits carefully, and specifically decide on what fuse settings to use for each project you start, even if it turns out that you end up selecting the default set each time.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Look at the fuses dialog box in avrstudio... one picture is worth a lot of emails

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Really, the fuses' subject is being very confused for me. I have a ATmega128, working to 8MHz and with external crystal (I think!, because I have the Let at work II, but it's possible that it's a external clock in the fuses' options). I'm programing with PonyPorg, and I only want to use my microcontroller with the Timer/Counter0, several ADC channels and the USART to transmit. The default configuration in my mirocontroller is the fuses by default.jpg picture.
I chose the alternative configuraton imagen nueva.jpg, this new fuses' configuration is:
- CKSEL3..1=111 because I have a external crystal to 8MHz.
- CKSEL0=1 and SUT1..0=11 because I have a crystal oscillator and the delay from reset isn't important for me.
- CKOPT=0 because the microcontroller will work in a noisy environment and with vibrations.
- M103C=1 because I want tu use the ATmega128 without ATmega103 simulation mode.
- I left The others bits by default, I think that they are well, besides I'm not sure about their functions (BOD?,JTAGEN?, do I need a JTAG interface?).

Other question, can I break my microcontroller if I configure wrong the fuses?
If somebody can help me, I would be very thanked.
Thank very much.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Jtag needs to be unprogrammed unless using a jtag, and the 103 compatability fuse needs to be unprogrammed, these are great for catching people out.
The bootsize ones should also not be programmed unless you are using the boot function. The code will run even if they are programmed, by default the PC will start up at the reset vector address, unless the BOOTRST is programmed then the reset on power up or watchdog operation will go to the start of the boot area. If there is no code in that area the PC will just inc up untill it rolls round to 0 and the normal reset vector will be used. SUT0 should be programmed if external Xtal is used.

You will not break the device but you may end up needing to drive the osc from an external source.
So if using external 1 meg xtal only the SUT0 is needed if greater than 1 meg then think about setting the CKOPT fuse as well.

Keep it simple it will not bite as hard

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You cannot destroy your ATmega128 by setting the wrong fuses.

However, unless you're using an STK500/STK501, with the ATmega128 installed in the ATmega501's ZIF socket, it may be difficult to resurrect it from certain invalid states (eg. accidentally disabling SPI (which should be impossible when actually using the SPI interface)... or selecting a clock source that you cannot actually provide to the device...). Most of these states are recoverable regardless of the programming method used (for example, by driving an external clock into the XTAL line to correct for an invalid clock setting).

The STK501 can parallel-program the ATmega128, which is a process that can repair any invalid combination of fuses without extraordinary measures.