Maker Pro
Maker Pro

Two atmegas from the same oscillator?

Rattanee

Aug 6, 2013
45
Joined
Aug 6, 2013
Messages
45
I've got a design here that uses two separate atmega8 microcontrollers for two separate USB controllers. These will be mounted on the same circuit board with a common power rail. Would I still need two separate crystals, or would a single crystal with the two microcontrollers connecting to it in parallel work ?

Thanks folks.
 

Solidus

Jun 19, 2011
349
Joined
Jun 19, 2011
Messages
349
You can (as far as I know) bridge an identical clock source between two different micros without any issues. It would probably be safer to use a CMOS clock source, because these are powered and have a powered output.

What I though of right as I was about to post this is that a crystal is inert. That is, it is a passive device. Power has to be applied across it to make it oscillate. I think it is unlikely, but what could possibly happen is if you fully bridge the crystal to both, it could cause one to see a DC signal, or have conflicting operations because the microcontroller is actually pumping a small, but measurable amount of power into the crystal to sustain its oscillations.

Might be worth a try on a breadboard first. I don't think that is very likely, and a single crystal should do. Namely because even if one sees DC temporarily, the common crystal will begin to resonate and prime both with the frequency AC signal.

The only thing this means is that the two ATmegas will operate synchronously, although rarely is this a bad thing.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
I guess you could also look at running the chips from the internal RC oscillator too. Not sure if this will work with USB though.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Personally I would use an external oscillator driving the inputs of the oscillator gates on both devices, although this could be an EMC issue.

You could probably get away with using a crystal on the first device and connecting the output of the oscillator gate on the first device to the input of the oscillator gate on the second, with no connection from the output of the oscillator gate on the second, especially if the devices are close together.

You should probably reduce the value of the capacitor from this signal to ground, to compensate for the extra capacitance of the track run and the other gate input, and keep the track away from other signals; normally the connections to the crystal are supposed to be kept as short as possible.

The best option would be to configure a timer-capable pin as a clock output on the first device, driven from the crystal clock with no prescaling, and use that to clock the second device, if that feature is available on the first device.
 

davenn

Moderator
Sep 5, 2009
14,254
Joined
Sep 5, 2009
Messages
14,254
From experience with shared oscillators in RF work
I would expect that the osc output should buffered with separate feeds to each uPC
This would minimise loading down effects on the oscillator
The buffers can be as simple as a couple inverter gates
The result is isolation between the circuits of the 2 uPC's and either uPC and the osc.

cheers
Dave
 

davenn

Moderator
Sep 5, 2009
14,254
Joined
Sep 5, 2009
Messages
14,254
found what I was looking for.....

attachment.php


Now this is a 10 MHz source ... just change the osc for whatever freq you need
and of course the unused inverter pins would be tied to ground for chip stability

cheers
Dave
 

Attachments

  • 10MHz Source.GIF
    10MHz Source.GIF
    7 KB · Views: 331

Rattanee

Aug 6, 2013
45
Joined
Aug 6, 2013
Messages
45
found what I was looking for.....

attachment.php


Now this is a 10 MHz source ... just change the osc for whatever freq you need
and of course the unused inverter pins would be tied to ground for chip stability

cheers
Dave

This looks like the perfect (as in most stable) solution to me, however I have a few questions. For this, I would need to use a four legged oscillator right? (Never used them, always use two pin crystals) Would a 74HC04 be okay for this purpose? My design already has one of these and I could probably muster up three spare gates on it with a few extra discrete components. The entire idea is for cost-savings only, so if this is more expensive I'll just stick to using two separate crystal oscillators.

Thanks for the info guys.

PS: I tried with a single oscillator, and I think it will work that way as well, however due to other design issues (prototype board after all) only one of the atmegas was recognized by windows. Am I right in thinking that since the one working was the one further away from the crystal, once I have a proper board running both should work? (I used two smaller sockets as one for the atmega, and due to it beign a prototype dual layer board, thus requiring soldering on both sides, I ended up having one socket slanted compared to the other so connections are shakey)
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
That design shows an oscillator module, yes, but you can make a Pierce crystal oscillator with a single gate, two resistors, two capacitors and a crystal. You can then buffer that oscillator with another gate, feeding two gates as shown. So you can do it all with one IC.

But the IC can't be a 74xx14. That's a Schmitt trigger IC and it cannot be used in a Pierce oscillator. You need to use a 74xx04.

I'm not sure whether the 74ACxx family is suitable for a Pierce oscillator. It probably is. Normally 74HC is used.

Google 74HC Pierce crystal oscillator. The design is very standard, and so are the typical component values. There are some good app notes around as well, which cover component value selection and performance issues.
 
Top