Page 1 of 1

Need help on ATMega32A fuses

Posted: Tue Mar 06, 2012 10:24 pm
by Herath
After waiting few months for the smoke from the last development board I fried to vanish in to the thin air, I bought another board. It is a ATMega32 board. But I have a problem with it. It does not have an external oscillator!. The hfuse bits seems to be at its defaults.

Code: Select all

lfuse
avrdude: writing output file "con"
:01000000E11E
:00000001FF

hfuse

avrdude: writing output file "con"
:010000009966
:00000001FF
So, the lfuse is 0xE1 and hfuse is 0x99. I need to use an external crystal (which I am yet to find) with this one. I have not programmed fuse bits before and I am a little bit worried that I am going to kill this one too. So, I need some help and verification on this thing.
I am going to use an 8MHz crystal (might later switch to 16MHz if 8MHz is not enough). I have calculalted the fuses and I need some experienced people to have a look at them.

Code: Select all

for 8MHz,
Leaving hfuse untouched.

lfuse
0b11111111

Using the longest startuptime.No BOD
As I understand the things in the datasheet, it seems like I should set CKOPT to "0" when using a higher clock. Is it correct?.

Code: Select all

avrdude -P com9 -p m32 -c avrisp2 -U lfuse:w:0xff:m
Thanks!.

Re: Need help on ATMega32A fuses

Posted: Tue Mar 06, 2012 11:43 pm
by SevenZero
I use a very good site to calculate these values for the Atmel.
Have a look at http://www.engbedded.com/fusecalc/

Looks like lfuse must be set to F8 according to that. Also note that, it gives the required AVRDUDE command line parameters.

Re: Need help on ATMega32A fuses

Posted: Wed Mar 07, 2012 9:45 am
by Herath
Thank you for the reply. But When I applied 0xf8, it seems that you have calculated fuses for an external 8MHz-12MHz RC oscillator. I am going to use a crystal. I am just worried that I will need an external clock since I am going to need the USART on the chip. Otherwise I would use the internal RC oscillator.

Anyway, I should try to use USART at 4800bps before switching to an external oscillator.

Re: Need help on ATMega32A fuses

Posted: Wed Mar 07, 2012 12:15 pm
by SevenZero
But When I applied 0xf8, it seems that you have calculated fuses for an external 8MHz-12MHz RC oscillator. I am going to use a crystal.
I see. I missed that. So you need to use 0xFF, you are correct.
I am just worried that I will need an external clock since I am going to need the USART on the chip
You can use the baud rate divisor to tune it to the target baud rate you need, isn't it?

Re: Need help on ATMega32A fuses

Posted: Wed Mar 07, 2012 4:19 pm
by Herath
SevenZero wrote: You can use the baud rate divisor to tune it to the target baud rate you need, isn't it?
Yes. It is possible to do with the internal oscillator. But it is said that working with the internal oscillator is not reliable enough for USART (clock signal varying with temperature and voltage etc). I am not needing superior accuracy, but just worried about the problems that might arise. And, I think that I will be able to find a crystal for cheap.

Re: Need help on ATMega32A fuses

Posted: Tue Jun 12, 2012 7:44 pm
by Herath
I got the fuse bits programmed. I was scared, how ever went ahead with it. Now the chip is running with an external 7.3728MHz crystal that I salvaged from an old circuit. Tested my 16x4 LCD driver codes. It works faster than the internal clock. :D