Shop OBEX P1 Docs P2 Docs Learn Events
External Crystal Input - Suggestions? — Parallax Forums

External Crystal Input - Suggestions?

DroneDrone Posts: 433
edited 2007-06-27 10:45 in Propeller 1
Hello-All...

How to replace the 5MHz XTAL with an external 5V TTL compatible 5MHz input with good/safe isolation?

I have a GPS disciplined reference clock/oscillator with a 10MHz output at 5V TTL compatible signal levels. I want to use this stable 10MHz reference to replace the crystal input on a propeller via XI. Has anyone done this before? I would like to isolate the GPS reference output with a capacitor and voltage divider perhaps, but maybe I need to use a ferrite transformer instead (worried about possible negative swings appearing on XI, but I think XI is capacitively coupled after deep-searching the forum on this topic)?

I wish the Propeller data sheet had more info about exactly what's expected and produced on the XO and XI pins.

The eventual application is to use the powerful Propeller timer/counters to compare two GPS references. The Propeller would be clocked by a "reference" 10MHz output (through a flip-flop to divide by two to 5MHz in-place of the XTAL) then count between 1 pulse per second inputs tp a Propeller pin from the GPS receiver under test to compare "drift" against the reference. Absolute frequency measurement is not the target, only comparison between the two.

Thanks for any suggestions - David

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-25 18:11
    1) You can use a 10MHz input clock (or a crystal for that matter) as long as you don't try to use the phased lock loop (PLL) at 16x since the highest system clock that is supported is 80MHz. You'd leave the XO pin unconnected. In your _CLKFREQ statement, you'd need "_CLKFREQ = 10_000_000" and you'd need "_CLKMODE = XINPUT". If you want to multiply this using the PLL, you could use "_CLKMODE = XINPUT + PLL8X" to get an 80MHz system clock.

    2) In this case, the XI pin is just a logic input with logic low = 0V and logic high = 3.3V. It has protective diodes on it to ground and Vdd which would limit negative excursions as long as the current is limited. There's a whole thread on attaching 5V logic devices to the Propeller ... have a look through it. Probably the easiest would be a simple voltage divider (forget the capacitor) with a 3.3K resistor between the XI pin and ground and a 1.8K resistor between the XI pin and the TTL compatible output of the clock/oscillator.

    3) Running the system clock at 80MHz would give you better resolution.
  • deSilvadeSilva Posts: 2,967
    edited 2007-06-25 18:50
    Don't forget that 10 MHz clock signals travelling a long way from your GPS chip to the propellor might "loose their shape" smile.gif
    I should recommend a Schmitt-Trigger near the Propeller input, which - when powered with 3.3, V - also provides an additional protection for the Propeller for the more paranoic... A simple serial 470 Ohms resistor should suffice for the adaption of a 5 V clock; note btw that this resistor forms a low pass with internal input pin capacity!
  • DroneDrone Posts: 433
    edited 2007-06-27 01:14
    Thank you Mr. Green and deSilva for your excellent suggestions. Looks like the 10MHz TTL clock input is going to be no problem. The device when finished will allow the user to switch between the 10MHz internal GPS referenced clock, an external 10MHz clock, and a regular internal 5 MHz crystal. I thnk I'll use both a Schmitt-trigger to condition the 10 MHz as well as a flip-flop divide by two divider to bring the 10 MHz GPS and external options back down to 5 MHz like the crystal - that will also remove any consideration by the user to modify clock statements in software depending on which clock source is selected. It adds a little more hardware, but cost and footprint is negligible in comparison with the rest of the box.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-27 01:27
    Drone,
    When you switch clocks, I'd suggest you switch first to the internal RCFAST clock, then change the external clock source, then switch back to the external 5MHz clock after a few milliseconds for the PLL to stabilize. This is a good process for any clock changes. You might not need this because the PLL will tend to smooth out short glitches. I'd check with Paul or Chris since they know much more about the clock generator and PLL than I would.
  • BeanBean Posts: 8,129
    edited 2007-06-27 01:30
    Drone,
    I have used a similar system at my work. We take our 10MHz rubidium standard and divide it by 2 with a simple flip-flop. Then use that as the input to the propeller.

    Using the PLL we run the propeller @ 80MHz. Then we measure 4 100KHz signals (10MHz OCXOs mixed with a 9,900,000 Hz synth, then low pass filtered).

    We use a reciprocal counter method to get very good resolution in a small measurement time by counting the system clock for "x" input clocks ("x" depends on the required gate time).

    Some preliminary tests yielded excellent results.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    “The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.hittconsulting.com
    ·
  • DroneDrone Posts: 433
    edited 2007-06-27 02:13
    Hello Mr. Green,

    THank you for the suggestion regarding the switch to internal clock first. I was wrestling with this, knowing that if I just simply switch the clock, even if doing make before break, it would probably cause problems on a running system. Then I though about running all the clock input options through a PLL as a holdover circuit, but that adds another PLL in the system, and I'm trying to do accurate time and frequency measurement - so I tend to shy away from that approach. Maybe I'll just have to live with having the switching arrangement hold the Propeller's reset down while the clock selection is being made. It is acceptable to reboot Propeller during a manual change of the clock input.

    Regards,

    David
  • DroneDrone Posts: 433
    edited 2007-06-27 02:16
    Bean,

    I read your comments about your measurement system with great interest. As stated, my goals are same/similar. This thread is about injecting an alternative clock. I'd like to continue this discussion about your measurement techniques. What do you suggest, a new thread? A new thread might be inappropriate because I don't feel I've thought about the next steps yet. Maybe offline?

    David

    BTW - I'm in Jakarta
  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-27 04:04
    Drone,
    You don't have to reboot the Propeller to change the clock. It has a perfectly usable internal clock (though a bit inaccurate ... RCFAST is somewhere between 8-20MHz and is temperature sensitive ... ok where accurate timing isn't necessary). Read the section of the Propeller Manual on the CLKSET statement. It describes how to switch the clock from internal to external. The process includes a 10ms delay when you're using an external crystal to allow the oscillator to stabilize. That should not be needed for an external oscillator. The Propeller only needs 75ns to actually switch the clock source.

    Why not let the Propeller switch the clock? You can use a 1:4 multiplexor like the 74HC153 and two I/O pins.
  • DroneDrone Posts: 433
    edited 2007-06-27 10:45
    Mike, I followed your suggestions and yes, letting the propeller switch the clock is absolutely the way to go. Thanks for your support - David
Sign In or Register to comment.