Shop OBEX P1 Docs P2 Docs Learn Events
Resolator/Crystal question — Parallax Forums

Resolator/Crystal question

Chrisp_ozChrisp_oz Posts: 6
edited 2006-12-26 23:31 in General Discussion
Hi all,
I'm working on a project that requires a precise but slow clock (i.e. the SX has to perform a very easy task, but time precision is important), therefore I was thinking that 500khz/1Mhz would be enough.
Looking at the documentation I have (SX Key manual, Programming with the SX Microcontroller, SX datasheet) I can't find any information as far as getting the processor to run at any slower speed than 4Mhz. What are the values for C1/C2, what kind of crystal should I use, what's the value for Rp, etc., that kind of information.
I would appreciate it someone could shed some light in this subject.
Thanks
Christian

Comments

  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2006-12-17 13:51
    The specs say "DC" and up. They also make reference to the 1 Mhz resonators on page 80 of the SX Key manual under "device options" and the list the Capacitor requirements (C1 & C2) on page 177
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-12-17 14:39
    Do you have an actual number for precision?
    Crystals are only good to 10x6 or maybe 10x7. Better that you need an oven controlled crystal as temperature variation is involved.

    Crystals can be·a bit problematic as they can actually oscillate at two frequencies. Resonators on the otherhand are quite stable at one, easier to install, but in the past have been less accurate. These days, resonators are available with near crystal accuracy. Still, crystals have remaind the perferred device for timekeeping. You easiest choice is a 'clock crystal' at something like 32,760 cps. The slower the SX runs, the less power it consumes and it can run down to zero.

    Regarding the capacitors, one usually relies on manufacturers specs [noparse][[/noparse]Digikey lists crystals with their require capacitors and tolerance]. In their absence, a rule of thumb would probably indicate the 30pf will work at 1mhz or less. Alternatively, there is a testing machine that costs thousands of dollars. Some companies invest in such to assure that thier crystals are more accurate and that each batch of devices won't latch up.

    The secodn frequency [noparse][[/noparse]or overtone] usually occurs above 20Mhz and is based on how the crystal is cut. So I wouldn't worry to much about it.

    The published listings of crystals and capacitances from the SX PDFs are merely guide lines and should not be considered the absolute authority.
    Also, don't forget to properly include a parallel resistor [noparse][[/noparse]100k ohm to 1 meg ohm] as it helps.

    I have on SX board I built myself and if I let it run 24/7, it latches up every 3 or 4 days. On the other hand, I was more careful with my CANbus card design and it never has latched up. Provide space for the components, even if you don't use them. If latch up becomes a problem, values can be inserted and adjusted. Some people prefer to use to different value to capacitances to assure the assymetry required to start oscillation, but usually the normal variation of manufacture is enough. A good capacitance meter really will help you sort out trouble. And an oscilloscope is even better.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-12-17 14:46
    Why don't you just get an oscillator in a can and forget about all of that other junk?

    http://www.parallax.com/detail.asp?product_id=252-00005
  • Chrisp_ozChrisp_oz Posts: 6
    edited 2006-12-18 23:57
    I guess I'm not using an oscillator because I didn't see a 4mhz one that would use less power than a crystal or resonator.
    As far as frequency precision, what I meant is that I need something better than an RC circuit, otherwise I would have used the internal oscillator.
    Thanks Kramer for all the useful info.
    Cheers
    Christian

    ·
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2006-12-19 16:59
    The RC circuit is about 7%, older resonators about 3%, newer resontors down to 1%, and crystals even lower.
    Resonators are usually good enough for UART.

    Frankly, timekeeping more demanding than the UART and it is far better to be connected to a network that corrects the time automatically if the issue is important. Temperature controlled crystals [noparse][[/noparse]TXO] are expensive and require maintance to remain accurate. Also, extremely accurate timekeeping seems to be military or scientific hardware and begins to raise questions of justifying why you want such. It become a big headache both in cost and justification. If in doubt, you can buy timekeeping chips with backup battery that are more accurate than you can build. I believe Maxim has some.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "If you want more fiber, eat the package.· Not enough?· Eat the manual."········
    ···················· Tropical regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • Mr_NukeMr_Nuke Posts: 47
    edited 2006-12-22 15:47
    You could use the intenal 4Mhz clock source of the SX chip. Make sure you use
    IRC_CAL IRC_4MHZ
    to have the SX-Key automatically adsjust the on chip circuit as close as possible to 4 MHz. I believe the accuracy is +- 2%.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-12-26 12:41
    Mr_Nuke said...
    You could use the intenal 4Mhz clock source of the SX chip. Make sure you use IRC_CAL IRC_4MHZ
    OK, I'm glad somebody (else) brought this up.·

    The internal oscillator trimming, in Assembly,·results by setting [noparse][[/noparse]the/those] 3 bits in the FUSEX register.·

    Mr_Nuke's post leads me to believe this is all done, I guess, by the SX-Key/Blitz & the IDE.· Enquiring minds what to know.

    How could/can you tell (can I see it on OSC1/OSC2)?·
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2006-12-26 23:31
    Please let me bail in here...

    There are three options for the IRC_CAL SASM directive:

    IRC_SLOW
    IRC_4MHZ
    IRC_FAST

    When your code contains any OSC directive other than OSCxMHZ to activate the internal RC clock generator, either include the

    IRC_CAL IRC_SLOW, or IRC_CAL IRC_FAST directive to avoid that the SX-Key IDE (unnececessarily) detemines the SX-internal RC clock speed. As the SX-Key IDE does not perform the speed-adjustment in this case, chip programming will be faster. As you are going to use an external clock-generating component anyway, there is no need to calibrate the SX-internal RC clock in such cases.

    In case you are going to use the internal RC oscillator, i.e. when your code contains a DEVICE OSCxMHZ directive, add an

    IRC_CAL IRC_4MHZ

    directive if you want to let the SX-Key IDE trim the internal RC clock as close as possible to 4 MHz. When the precision of the internal RC clock is not an issue for your application, you may either include the IRC_SLOW, or IRC_FAST directive instead. Again, the SX-Key will not perform an internal RC calibration in this case, so the device-programming process will be a bit faster.

    Finally: The internal RC clock (and an external RC clock either) are not very precise at all. Even with an IRC_CAL IRC_4MHZ, the internal RC oscillator may not be stable enough over a longer time period to control time-critical operations, like serial transmitters/receivers, timers, etc.

    Therefore, make your SX happy, and add an external clock device, like a resonator, and xtal, or a solid-state clock device. See the SX data sheets for more details.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
Sign In or Register to comment.