Pages: [1]   Go Down
Author Topic: Using Oscillator as a Crystal  (Read 443 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 19
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17293
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 19
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley  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
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 533
Posts: 26951
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Prices have crept up some - AVR ISP MKii now $33 at Mouser (just bought one).
Does work nice for looking at fuses tho.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 19
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley  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?
Logged

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Absolutely, that's what makes it so useful.

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

0
Offline Offline
Shannon Member
****
Karma: 206
Posts: 12062
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 )
Logged

[ I won't respond to messages, use the forum please ]

Pages: [1]   Go Up
Jump to: