Go Down

Topic: arduino share crystal? (Read 4404 times) previous topic - next topic

winner10920

Can a regular arduino share its crystal with another arduino? More accuratly can I put two atmega328p on the same board and share the crystal? Also if it wouldn't matter if I shared the same reset button right?

retrolefty


Can a regular arduino share its crystal with another arduino? More accuratly can I put two atmega328p on the same board and share the crystal? Also if it wouldn't matter if I shared the same reset button right?


There is a way to have one crystal control the clock speed for two AVR chips, however it might result in needing different fuse settings for one of the two AVR chips, which would be a bit of a problem to implement correctly. I believe I've seen AVR application note document covering this subject, you might look around the AVR site.

Sharing a reset button implies wiring to the two reset pins together, which in theory should work ok, however it would make uploading sketches from the IDE to the assembly rather problematic as I doubt you would want the same sketch loaded to both chips and even if you did I doubt it would work very well.

Lefty

CrossRoads

I believe Yes and Yes.
ATMega328 datasheet says that output of one crystal pin can be used as input to another device. Fuses, I don't know about that part. Good question.

If sharing reset for downloading code, I don't see a problem as long as the parts have independent RX/TX and MISO/MOSI/SCL lines.
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.

GoForSmoke

UNO FAQ tells that the ATmega and USB chips could share a crystal but not get FCC certification due to noise.

One thing you want with external crystal is very short path to the clock pin. It's more stable. so perhaps if you arranged the chips with all clock pins close, vertical mini-boards arranged with edges in a circle like a micro-cray....


1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.

winner10920

I don't need to have them programmed at the same time, and I probably will program them before insertion into the project, and since I am buying them with the bootloader I will just use an uno board to program then insert into a socket
my plan would be to have the chips as close to each other as possible and have the crystal in parrallel to each, basically just to save space since they will be on a mega shield
If the datasheet says it can be used by another device then I guess no fuses need to be changed?
The reset line really is not needed in my particular use but I will have them wired to the reset line of the host mega just in case,

CrossRoads

Here's a dual '1284 I designed to use 1 crystal between 2 chips. '328 works the same way.
I have not built it, but you could breadboard the '328s, xtal, 22 pf caps, reset pullup resistor, 100nF caps on Vcc, and connect LED/resistor to D13 and see if Blink sketch runs on both.
One chip connects to both sides of the crystal.
2nd chip only connects to Xtal1.
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.

winner10920

So it is okay to leave xtal 2 of the second chip floating?

CrossRoads

It is not floating - it acts as output to excite the crystal, only the other chip is taking care of that instead.
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.

winner10920


Go Up