Shop OBEX P1 Docs P2 Docs Learn Events
Hooking up another Xtal to the propeller — Parallax Forums

Hooking up another Xtal to the propeller

Zap-oZap-o Posts: 452
edited 2009-05-16 12:05 in Propeller 1
If I were to hook up a xtal to 2 pins on the prop say pin0-pin1 would I need to insert a resistor to limit the current (I know - sounds stupid)? I looked over the data sheet and it mentioned nothing regarding current.

Second thing - According to wiki if a voltage is applied to the xtal it will resonate. Do i need to pulse one of the pins or leave it on high?

My idea is to make a quartz clock using the propeller and a xtal.

Thanks in advance,

Post Edited (Zap-o) : 5/15/2009 11:34:43 PM GMT

Comments

  • mctriviamctrivia Posts: 3,772
    edited 2009-05-16 00:28
    you can make a clock just using the prop. for more accuracy an RTC ic would be better as they have battery backup.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My new unsecure propmod both 1x1 and full size arriving soon.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-05-16 00:29
    It takes more than a DC voltage to make a crystal oscillate. Typically the crystal is hooked to the input and output of an inverter, along with some series and parallel resistance and a couple load capacitors to ground.

    I once tried what you're attempting using a counter with negative feedback and a 32KHz crystal. I got it to oscillate, and the fundamental frequency was correct, but there were high-frequency glitches on the transitions, which rendered the output useless as the input to an edge counter. I eventually ended up with so many external components trying to add hysteresis and other tricks to clean it up, that I gave up. It would've been easier just to build an external oscillator from scratch.

    Beau Schwab is the real expert in these matters. Maybe if he's is lurking nearby, he can offer some suggestions.

    -Phil
  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-16 00:36
    1) A crystal is an insulator as far as DC current is concerned. No current will flow

    2) Not quite true. If a voltage is applied, the crystal will bend slightly with the direction dependent on the polarity of the voltage. If you turn off the voltage, the crystal will come back to center. The crystal will actually vibrate slightly for a brief period as the mechanical motion damps down. If you put the voltage back on the crystal as it's moving back off center, then it will continue moving. If you apply an alternating voltage to the crystal so that the frequency of the voltage changes matches the mechanical resonance of the crystal, then you'll get a steady vibration at the resonant frequency of the crystal.

    3) Although it would be possible to make a crystal oscillator using two Propeller pins, one input and one output, you'd be better off using a cheap, simple CMOS IC like a hex buffer as an oscillator. You can find plenty of circuit diagrams for this on the internet. The output of the oscillator would be fed to a single Propeller I/O pin for counting.
  • RaymanRayman Posts: 14,827
    edited 2009-05-16 00:37
    Yeah, you're prop probably already has a quartz crystal... Why add another?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
  • mctriviamctrivia Posts: 3,772
    edited 2009-05-16 01:15
    mctrivia___clock-sch.PNG

    here is my clock circuit for the propgalore brain board. The ic is a standard hex inverter pack. I did not design it and have not goten my pcb back to test it yet.

    mctrivia___clock-pcb.PNG

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My new unsecure propmod both 1x1 and full size arriving soon.

    Need to upload large images or movies for use in the forum. you can do so at propmodule.com/upload.html for free.

    Post Edited (mctrivia) : 5/16/2009 8:37:57 AM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-05-16 01:36
    Rayman said...
    Yeah, you're prop probably already has a quartz crystal... Why add another?
    One very good reason is to maintain constant timing when the system clock is throttled back to save power. That was the original reaon for my experiments, at least.

    -Phil
  • Zap-oZap-o Posts: 452
    edited 2009-05-16 02:45
    Wow Gents, thanks for the advice!

    Some of you mentioned getting a dedicated clock ic, using the existing xtal on the prop etc. Sorry my hard head wont sleep well using that approach. I am really interested in learning more about the way xtals are used. I have read many data sheets for "clock" ics and most require a Xtal running a frequency at 32768
  • mctriviamctrivia Posts: 3,772
    edited 2009-05-16 02:54
    i suspect the prop generating the signal to run an xtal will not be any more accurate then just using the clock object. Using the clock schematic I provided to a pin to count would be more accurate.

    i have a temperature compensated rtc some where that has a built in xtal. much more accurate then most.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My new unsecure propmod both 1x1 and full size arriving soon.

    Need to upload large images or movies for use in the forum. you can do so at propmodule.com/upload.html for free.
  • RaymanRayman Posts: 14,827
    edited 2009-05-16 03:20
    If you really want to add a RTC, I've found a simple and great way to add one is with the DS1307 chip.· You can put it on the exisiting I2C bus even though it's a 5V device, so as not to use any free pins...· Of course, the DS1307 needs that crystal you mentioned.

    I've got some sample code for it here:
    http://www.rayslogic.com/propeller/Programming/Programming.htm



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
  • mctriviamctrivia Posts: 3,772
    edited 2009-05-16 03:46
    1340 is 3.3v and has built in battery charger

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My new unsecure propmod both 1x1 and full size arriving soon.

    Need to upload large images or movies for use in the forum. you can do so at propmodule.com/upload.html for free.
  • mctriviamctrivia Posts: 3,772
    edited 2009-05-16 03:50
    DS3231 is the really accurate one i was talking about.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My new unsecure propmod both 1x1 and full size arriving soon.

    Need to upload large images or movies for use in the forum. you can do so at propmodule.com/upload.html for free.
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2009-05-16 12:05
    If you end up pumping too much power into the xtal from full pin high/lows then it will damage it. The battery backed dedicated chips are great as it leaves you free to do other software things and not have to account for that time in any calcs.

    Xtals are suposed to be extremely selective feedback components, not mecanical actuators. I tried many decades ago to use some 32KHz slabs as ultrasonic sender/receivers, the tx one would shatter before any useful range could be got.
Sign In or Register to comment.