fuse bits This tutorial is taken from the book
MY EXPERIENCE IN PROGRAMMING AVR MICROCONTROLLER
IN C USING WINAVR/AVRGCC.
you can download it free from the files
section(FILE-AVRBOOK.RAR) of yahoo group-booksbybibinhttp://groups.yahoo.com/group/booksbybibin/
comments about this book on
www.booksbybibin.blogspot.comFUSE BITS
You have to do fuse bits to disable JTAG,lock the
microcontroller, change the clock frequency of the microcontroller. So let's study
AVRDUDE in terminal mode. First enter in the terminal mode and see the fuses.See
page 255 of atmega32 datasheet, then you will get some ideas about fuse bits.First
you setup the programmer and type the following. Remember here I am using bsd programmer
Use 'part' command to display details about the microcontroller
SETTINGS FOR EXTERNAL CRYSTAL AND JTAG DISABLE
See below how I had done fuse settings for external crystal. You can see some error
occurred, this is due to the lack of crystal. The connection in the crysal side should be
proper with proper use of crystal and capacitors. Here I set the microcontroller for
3-8Mhz crystal. Compare what i had done with that of in datasheet.
Before Doing the following
1. You should require a crystal in the range of 3 to 8Mhz and two 22pF capacitors
2. Once you do the following setting, you won't be able to program the chip or run the program
inside the chip without a proper crystal(3-8Mhz).
3. Here you can see that I have got error. This can be due to lack of crystal,lack of capacitor
lack of proper connection. If you get the same error don't belive that you microcontroller has
gone, do see the breadboard problems and shortcircuits in the crystal and capacitor
IMPORTANT NOTES ON FUSE BITS:
1. Always keep a screenshot fuse bits settings you do for future reference.
2. Do Fuse Bit's at your own risk. See the link below
http://www.roboticsindia.com/modules.php?name=Forums&file=viewtopic&t=1412&p=7120
3. Do remember the fuse settings.
4. The crystal you use should be proper to produce the clock to the crystal.
5. Use proper capacitors. I used 22pF,33pF even 150pF. But better to use the
prescribed values in the datasheet.
6. Mostly you will get problem after fuse bit settings, so be thorough with fuse bits
before you are doing.
7. If you are doing fuse bits for external crystal, remember that after doing fuse
bits you can't even program chip without a proper crystal and capacitors.
8. Don't program the lock bits.
9.Don't remove the programmer before you leave the terminal mode of
AVRDUDE
DISABLING JTAG
After disabling JTAG you can use PORTC properly. Pins C2,C3,C4,C5 are properly
used for other applications. i.e, we got one port for other applications. When I brought
my new microcontroller for the first time I thought that the microcontroller was not
good because PORTC pins are not working, then I later came to know that it is due to
JTAG only.
See what happened when I removed the RESET pin of the microcontroller . Here I
downloaded blinking program to see whether PORTC is working and I removed the
RESET pin connection with parallel port, that is why the fuse read as 0xff
DISABLING JTAG AND USING INTERNAL 8Mhz CLOCK
You can see that serial port baud rate depends on
the clock. So if you use 1Mhz clock then the maximum speed possible with less errors
is 4800bps (.2% error). But for high baud rate cannot be used with 1Mhz internal clock,
so we have to use 8Mhz internal clock, then you can use all baud rates with less error.
In the first case after changing the fuse bits I removed the RESET pin to see whether I
got 8Mhz. It worked according to the previous program: blink.c, I got fast blinking.
Don't remove the programmer before you leave the terminal mode of
AVRDUDE.That is what happened in the first case.
Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.