Go Down

Topic: Using Oscillator as a Crystal (Read 512 times) previous topic - next topic

cubemike99

I'm trying to get my ATMega328 off the Arduino board and onto a breadboard. I know I need a quartz crystal (the small oval with 2 leads) between two of the pins. However, all I have is an oscillator (a large rectangle with 4 leads). Is it possible to use the oscillator as a crystal?

retrolefty


I'm trying to get my ATMega328 off the Arduino board and onto a breadboard. I know I need a quartz crystal (the small oval with 2 leads) between two of the pins. However, all I have is an oscillator (a large rectangle with 4 leads). Is it possible to use the oscillator as a crystal?


Yes, but it requires changing one of the fuse byte bits that control clock type/source.


RuggedCircuits

Yes, just run the oscillator output to the XTAL1 pin and leave the XTAL2 pin unconnected. The oscillator will need +5V and GND, and a decoupling capacitor between the two will help. You will also need to use the ISP connection to reprogram the fuses to use an external oscillator instead of a crystal.

--
The Basic Motor Driver: simple, inexpensive motor driver for 1 stepper motor or 2 DC motors

cubemike99

Hmm, thanks. But does that mean there's no way to do it in the Arduino's default AVR mode?

RuggedCircuits

By "default AVR mode" do you mean the default fuse settings? Good question...officially, you're supposed to change the fuses depending on the clock source, but I'm wondering if it just might work to leave the fuses the way they are. I think it's worth an experiment. The worst that could happen is you damage the clock circuitry on the Arduino and a) it fails to work at all, or b) it will never work again using a crystal. Either way, with a DIP microcontroller that can be swapped out it's a pretty inexpensive experiment.

Personally, I'd buy a $30 AVR-ISP and have something that is known to work :)  I use my AVR-ISP so often that the $30 has paid for itself many times over.

--
The Flexible MIDI Shield: MIDI IN/OUT, stacking headers, your choice of I/O pins

CrossRoads

Prices have crept up some - AVR ISP MKii now $33 at Mouser (just bought one).
Does work nice for looking at fuses tho.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

cubemike99


By "default AVR mode" do you mean the default fuse settings? Good question...officially, you're supposed to change the fuses depending on the clock source, but I'm wondering if it just might work to leave the fuses the way they are. I think it's worth an experiment. The worst that could happen is you damage the clock circuitry on the Arduino and a) it fails to work at all, or b) it will never work again using a crystal. Either way, with a DIP microcontroller that can be swapped out it's a pretty inexpensive experiment.

Personally, I'd buy a $30 AVR-ISP and have something that is known to work :)  I use my AVR-ISP so often that the $30 has paid for itself many times over.

--
The Flexible MIDI Shield: MIDI IN/OUT, stacking headers, your choice of I/O pins



Is this something I could also use to upload sketches and burn the bootloader?

RuggedCircuits

Absolutely, that's what makes it so useful.

--
The Rugged Motor Driver: two H-bridges, more power than an L298, fully protected

MarkT

Quote from:  link=topic=94734.msg711461#msg711461 date=1330720657

Yes, just run the oscillator output to the XTAL1 pin and leave the XTAL2 pin unconnected. The oscillator will need +5V and GND, and a decoupling capacitor between the two will help. You will also need to use the ISP connection to reprogram the fuses to use an external oscillator instead of a crystal.

--
The Basic Motor Driver: simple, inexpensive motor driver for 1 stepper motor or 2 DC motors



I've done something like this before, but put a 1k resistor in series to be safe ( a superstitious precaution perhaps )
[ I won't respond to messages, use the forum please ]

Go Up