AVR CONFIG. BITS / FUSES

For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.

Moderators: Benj, Mods

Post Reply
armagon29
Posts: 56
Joined: Thu May 07, 2009 4:40 pm
Been thanked: 2 times
Contact:

AVR CONFIG. BITS / FUSES

Post by armagon29 »

Dear All:

I’m a PIC user for 2 years, now, I m testing FLOWCODE for AVR (demo) and it work excellent, but I have 2 questions:


Question A: configurations bits are structured in 3 pars (ATMega32) High, Low and Extended Fuses (showed in HEX format) I read the datasheet for this Chip from ATMEL, but It is not clear for me, if I’m am correct, the fuses are formed whit this parameters, when they are joined then become a binary number when is converted to a Hex number, it is the configuration right?
HIGH FUSE
OCDEN, JTAGEN, SPIEN, CKOPT, EESAVE, BOOTSZ1, BOOTSZ0, BOOTRST
LOW FUSE
BODLEVEL, BODEN, SUT1, SUT0, CKSEL3, CKSEL2, CKSEL1, CKSEL0
EXTENDES FUSE
7,6, BOOTLOCK12, BOOTLOCK11, BOOTLOCK02. BOOTLOCK01, LOCK2, LOCK1

I suppose that the CKOPT must to be selection (0) for Clock configuration and CLSEL3,2,1,0 in (1) for Cristal operation (19.66MHz), but I not sure, What is the right configuration for XT, and Watchdog off for a reliable operation, (I used to use this configuration for PIC), the test that I like to use is a simple ADC reader and it show into a LCD

Question B:
For accident I locked 2 AVR, when I try to erase them, the programmer show an error, and They are not erased, Do you know how can I make a Hard reset, to clear al fuses and registers to be able to re-reset ant erase chips


Thanks

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: AVR CONFIG. BITS / FUSES

Post by Sean »

Our recommended configuration fuse settings for ATMEGA devices are shown below:

[img]C:\Documents%20and%20Settings\S\My%20Documents\My%20Pictures\m32fuse.jpg[/img]

For the ATmega32 these settings:
Disable OCD
Disable JTAG
Enable SPI programming
Select the high frequency external crystal clock option
Clear the data EEPROM during programming
Reserve the minimum boot memory (256 words)
Select the default reset vector
Disable brown-out detection
Select the longest start-up time

These settings provide reliable operation for ATmega devices using an external crystal from 8MHz to 20MHz

The ATmega32 does not contain an Extended Fuse byte. ATmega devices that do contain an Extended Fuse byte (ATmega324 etc.) can have this register programmed using the address 0x2. The default setting is 0xff.

0x2,0xff

The AVR devices require their main oscillators to be running during programming, and at a frequency greater than 4 times the programmer clock frequency.

There seem to be two main ways to prevent an AVR device from running and being re-programmed:
1. Select a clock option that is not available to the device (e.g. select external RC when an external Xtal is being used).
2. Run the device at a clock frequency that is lower that 4 x programmer frequency (accidental selection of the 1MHz internal RC oscillator).

Recovery from the lock-up will depend on the target circuit and the fuse settings that caused the problem.

armagon29
Posts: 56
Joined: Thu May 07, 2009 4:40 pm
Been thanked: 2 times
Contact:

Re: AVR CONFIG. BITS / FUSES

Post by armagon29 »

Dear Sir:

I just re program 2 chips ATMEGA 32 using a low clock (250Khz) and the original fuses ware reset, but I still have problems with ATMEGA48 (3CHPS) I not sure the fuses programmed, what Can I do to recovery from the lock-up

Thanks

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: AVR CONFIG. BITS / FUSES

Post by Sean »

Have the fuses in these devices alrready been programmed with non-default values?

The solution to the problem will depend on the current fuse settings.

If an alternative clock source has been selected, this source will need to be provided to allow the device to be re-programmed (correct type of crystal or external clock signal).

Examples:
If the Fuse Low Byte has been programmed with the value 0x00, the device will be expecting an externally generated clock signal, which it will divide by 8.
If the internal 128KHz RC clock has been selected, the programmer clock frequency will need to be set to an extremely low value.

If you know the last values that were successfully programmed into the device fuses, and can post them on the forum, I will try to work out the required device configuration and programming speed.

Post Reply