+ Reply to Thread
Results 1 to 14 of 14

Thread: Sharing a crystal between 2 ICs

  1. #1
    Magister Newbie
    Join Date
    Nov 2008
    Location
    Montréal, QC, Canada
    Posts
    8

    Question Sharing a crystal between 2 ICs

    Hi,

    In my project I have two ICs (one AVR ATMEGA and one MCP2515) that communicate via SPI.

    They both use a 16MHz crystal so for the moment on my dev board I have 2 crystal and 4 capacitors.

    To reduce footprint, can I use the same crystal to drive both chips? Will it cause a problem to share it?

    Thanks in advance!


  2. #2
    Help us help you blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent
    Join Date
    Jan 2007
    Location
    Toronto, Canada
    Posts
    10,711
    Blog Entries
    5

    Default

    With PICs this is doable, probably same goes for the AVR or MCP
    Bill
    Smart Kits build Smart People

    http://www.blueroomelectronics.com/

  3. #3
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,797

    Default

    You need to know which pins are the input and output for the oscillator circuit, one PIC would have the oscillator components as normal, the other is set to extrernal oscillator, and has it's INPUT pin connected to the OUTPUT pin of the oscillating PIC.

    The AVR/MCP would need to have similar facilities.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

  4. #4
    alphacat Okay
    Join Date
    Apr 2009
    Location
    France
    Posts
    739

    Default

    Facilites like what please?
    (sorry for joinig the thread without an invitation )

  5. #5
    Magister Newbie
    Join Date
    Nov 2008
    Location
    Montréal, QC, Canada
    Posts
    8

    Default

    On my MCP there is a CLKOUT pin but it need to be programmed as it, and if my AVR (an ATMEGA168) does not run I can not tell the MCP to output the clock on its pin to drive the AVR. So this solution can not work.

    Nigel, in the MCP2515 PDF it's written that OSC1 is input and OSC2 is output, on the AVR it's XTAL1 as input and XTAL2 as output. With only one crystal, how do I have to connect it? Both AVR and MCP are set to use external crystal.

  6. #6
    Help us help you blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent
    Join Date
    Jan 2007
    Location
    Toronto, Canada
    Posts
    10,711
    Blog Entries
    5

    Default

    Set one to use an EXT clock.
    Bill
    Smart Kits build Smart People

    http://www.blueroomelectronics.com/

  7. #7
    Sceadwian Excellent Sceadwian Excellent Sceadwian Excellent Sceadwian Excellent Sceadwian Excellent Sceadwian Excellent Sceadwian Excellent
    Join Date
    Oct 2006
    Location
    Rochester, NY U.S.
    Posts
    9,826
    Blog Entries
    1

    Default

    You can share the crystal directly if you keep the leads short and the chips close together, you may have to alter your normal capacitor values for the crystal though.
    "Because I be what I be. I would tell you what you want to know if I
    could, mum, but I be a cat, and no cat anywhere ever gave anyone a
    straight answer, har har."

  8. #8
    mneary Excellent mneary Excellent mneary Excellent mneary Excellent mneary Excellent mneary Excellent mneary Excellent mneary Excellent mneary Excellent
    Join Date
    Feb 2007
    Location
    California USA
    Posts
    3,835

    Default

    Normally this doesn't work. The outputs fight one another, and neither input is at the correct threshold.

    We just had a thread similar to this a few weeks ago.
    de KI6RWX

  9. #9
    Magister Newbie
    Join Date
    Nov 2008
    Location
    Montréal, QC, Canada
    Posts
    8

    Default

    Quote Originally Posted by mneary View Post
    Normally this doesn't work. The outputs fight one another, and neither input is at the correct threshold.

    We just had a thread similar to this a few weeks ago.
    Ah ok, I will look for it, thanks!

    Without re-doing the full PCB re-design but with just moving some parts around, the 2 ICs would be about 1 inch apart so the crystal would be in the middle, I guess distance would be ok. Anyway if it's just trouble and not working 100%, and for $1, I can keep both crystals.

  10. #10
    Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent
    Join Date
    May 2008
    Location
    San Diego, Ca
    Posts
    3,927
    Blog Entries
    2

    Default

    Instead of using a crystal and two caps, consider a pre-made oscillator in small package. Many of these units can drive multiple loads reliably and take no more space than one crystal and a couple caps. Check this website.
    Crystal Oscillators | Oscillators | Tcxo Oscillators | Frequency Control | Oscillators Manufacturers | Fox Oscillator | Buy Oscillator-Fox Electronics
    Pay it forward.
    www.geoepicenter.com

  11. #11
    MrAl Excellent MrAl Excellent MrAl Excellent MrAl Excellent MrAl Excellent MrAl Excellent MrAl Excellent MrAl Excellent
    Join Date
    Sep 2008
    Location
    NJ
    Posts
    1,294

    Default

    Hi,


    Another solution that might work is the same used with CMOS oscillators.
    Some CMOS oscillators use one gate with the crystal around it and and others use two
    or more gates in series with the crystal around the entire series connection.
    To do this with two IC packages that have internal gates, you would do the
    same...connect the two gates in series and put the crystal around the two
    gates rather than either one by itself.
    I've never actually tried this so i cant guarantee it will work. If it does work,
    that's one crystal and two caps and maybe a resistor or two.

  12. #12
    Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent Mikebits Excellent
    Join Date
    May 2008
    Location
    San Diego, Ca
    Posts
    3,927
    Blog Entries
    2

    Default

    that's one crystal and two caps and maybe a resistor or two.
    Plus the gate.
    Pay it forward.
    www.geoepicenter.com

  13. #13
    Mr RB Excellent Mr RB Excellent Mr RB Excellent Mr RB Excellent Mr RB Excellent Mr RB Excellent Mr RB Excellent
    Join Date
    Jul 2008
    Location
    Out there
    Posts
    1,761

    Default

    Like Bill said you can set one to external clock. Or use HS mode and just connect the clock signal to the OSC in pin (OSC1), the PIC xtal osc will work fine with a signal connected to the OSC1 pin even in XT and HS modes.

  14. #14
    MrAl Excellent MrAl Excellent MrAl Excellent MrAl Excellent MrAl Excellent MrAl Excellent MrAl Excellent MrAl Excellent
    Join Date
    Sep 2008
    Location
    NJ
    Posts
    1,294

    Default

    Quote Originally Posted by Mikebits View Post
    Plus the gate.
    Well actually if you want to get funny about it that would be
    plus two gates. The two gates already exist however inside
    the two already existing IC packages, so there is no real
    addition of any extra gates.
    Last edited by MrAl; 19th October 2009 at 04:01 PM.

+ Reply to Thread

Similar Threads

  1. Sharing a clock between ICs
    By 2camjohn in forum General Electronics Chat
    Replies: 6
    Latest: 30th September 2009, 08:49 AM
  2. Sharing experience about PIC configurarion bits
    By MrNobody in forum Micro Controllers
    Replies: 10
    Latest: 30th August 2008, 05:07 AM
  3. sharing my new favorite numbers!
    By justDIY in forum Chit-Chat
    Replies: 19
    Latest: 6th May 2007, 08:22 PM
  4. Data sharing through one wire
    By Electronics4you in forum General Electronics Chat
    Replies: 5
    Latest: 9th September 2005, 05:52 AM
  5. Sharing a crystal between 3 ICs
    By DaKandEKid in forum Electronic Projects Design/Ideas/Reviews
    Replies: 3
    Latest: 12th May 2004, 02:18 AM

Tags for this Thread