NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Support Forum » TTL/CMOS Output Crystal Oscillator

August 10, 2010
by Rick_S
Rick_S's Avatar

I got a few 18.432MHz oscillators (not crystals, full 5v powered crystal oscillators) and I wonder if anyone has had any experience with them. I was thinking about modifying the bootloader to support the new frequency since like the 14.7456 it is a multiple of standard baud rates so should present virtually no problem with serial communications.

I understand to use it I'll have to change the fuse settings to get an external clock source.

Before I take the plunge however, I thought I'd see if anyone has any pro's/con's successes/failures etc...

Rick

August 10, 2010
by Ralphxyz
Ralphxyz's Avatar

Rick would you please explain the fuse settings and how one goes about setting them.

I assume (since I know absolutely nothing about the fuses) that different projects need different fuse settings.

I have seen a reference to a Mike.txt file that outlines the default fuse settings but I do not know where to find that file.

It is not in my standard download, maybe it was on the original Nerdkit CD.

I think it would be great to have a outline of the what, where and why of the fuse settings.

You are also a great candidate to do this as your post are usually so easy to read and understand.

I have a ISP and have loaded the bootloader onto new 168 and 328 MCUs but never had to touch the fuses.

Ralph

August 10, 2010
by Rick_S
Rick_S's Avatar

Sure,

The file you are looking for is in the bootloader folder and is called fuses_mike.txt

There is one of those files in both the bootloader and bootloader328P folders. It contains a list of all the fuses for a chip with the NK bootloader.

The reason I mentioned that I would have to change my fuse settings if I used this crystal oscillator is because with the chip configured for use with a crystal it is setup differently than with an oscillator. The crystal connects between pins 9 & 10 where the oscillator only connects to pin 9. Pin 10 is left open. The fuses are kind of like a bios setting, when the chip starts, they determine how it goes about doing it.

The fuses that effect the clock source are CKSEL3..0 (The lower 4 bits of the Low fuse byte)and can be found on the datasheet in the system clock and clock options section.

Below is the fuses_mike.txt file for the 328P.

(modified for ATmega328P!)

EFUSE = 0x05
0   -
0   -
0   -
0   -
0   -
1   BODLEVEL2   (sets V_BOT=2.7)
0   BODLEVEL1       ""
1   BODLEVEL0       ""

HFUSE = 0xd2
1   RSTDISBL
1   DWEN
0   SPIEN
1   WDTON
0   EESAVE
0   BOOTSZ1 (1024 word boot size)
1   BOOTSZ0     ""
0   BOOTRST (jump to bootloader)

LFUSE = 0xf7
1   CKDIV8
1   CKOUT
1   SUT1    (65ms start-up delay)
1   SUT0        ""
0   CKSEL3  (full swing crystal oscillator)
1   CKSEL2      ""
1   CKSEL1      ""
1   CKSEL0      ""

LOCK = 0x2f
0   -
0   -
1   BLB12   (can't self-program over bootloader)
0   BLB11       ""
1   BLB02   (no restrictions on programming application code area)
1   BLB01       ""
1   LB2 (no memory lock)
1   LB1     ""

You can see the low fuse byte sets the mcu clock settings. Their default is set for a full swing crystal oscillator.

I would have to change CKSEL3..0 to 0000 for an external oscillator.

Hope that gives a bit of insight.

Also, near the end of the data sheet, it gives a full list of all the fuse and lock bit settings. It's in teh Memory Programming section.

Rick

August 10, 2010
by Ralphxyz
Ralphxyz's Avatar

Thanks, I can see why you would need to make the changes.

Now how does one change their fuses?

Ralph

August 11, 2010
by Rick_S
Rick_S's Avatar

You use an ISP programmer. They can be set with AVRDude and in the bootloader folder there is a separate makefile for doing just that.

Rick

August 11, 2010
by Ralphxyz
Ralphxyz's Avatar

Thank you, I got the ISP to see if I could recover a MCU that went bad after I tried to instal a reset switch on pin one. Maybe I'll try reseting the fuses, all I had tried was reinstalling the boot loader.

Other than that I really have not had a need for a ISP, but since I had one I purchased a few 168 and 328 MCU's from Mouser and loaded the bootloader (sorry Nerdkit guys but I am cheap and on unemployment :-). I have been wondering what else I could do with a ISP. Is it possible to put the bootloader on other ATmega MCU's? That would be something I could see being of interest.

Ralph

August 11, 2010
by Rick_S
Rick_S's Avatar

You can also program the chip with the ISP programmer. If you program with that, you don't even need a bootloader on the chip and can use all available flash for your application. The bootloaders come in handy when you want to program a chip without the need for special external hardware.

As for putting the bootloader on other chips, it can definatly be done. I'm pretty sure I remember on of the other common members here doing it... Maybe Ted (Phrank916). Anyway, it requires modifying some of the bootlader code to make that work properly with different chips.

Rick

August 11, 2010
by Ralphxyz
Ralphxyz's Avatar

I "tried" loading programs without the bootloader using the ISP, but they did not work.

Maybe I'll try again. Other ATmega MCU's could be really interesting.

Ralph

August 12, 2010
by Rick_S
Rick_S's Avatar

It will definately work, I've done it often on other atmel chips such as the ATMega128, ATTiny2313, ATMega8, ATTiny45, and on occasion the 168 and 328Ps. There may be a fuse setting that prevented things from working on the chips you tried??

Rick

Post a Reply

Please log in to post a reply.

Did you know that you can make a huge, multi-panel LED display? Learn more...