1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

microcontrollers: how to detect absolute clock frequency

Discussion in 'Embedded' started by Yvan BOURNE, Sep 22, 2003.

  1. Yvan BOURNE

    Yvan BOURNE Guest

    To do that, you need another frequency reference than your quartz...

    Yvan BOURNE, Sep 22, 2003
    1. Advertisements

  2. Yvan BOURNE

    onestone Guest

    Strange concept? can you explain why or what the system is to help give
    us a few pointers at possible solutions? generally, without another
    timing source the answer is NO, but there may be other timing sources
    you could use that may not be obvious.

    onestone, Sep 22, 2003
    1. Advertisements

  3. hi,

    I need to detect the absolute frequency of the quartz
    that feeds my micro. In words, the code must guess the clock
    frequency without knowing it.

    Is it possible?

    Enrico Migliore

    * Enrico Migliore - Co-founder and Senior Software Engineer
    * FATTI srl - The Service Gateway Company
    * Via Donatello 48 - 20020 - Solaro - Milano - Italy
    * Phone: +3902 9679 9655
    * Fax: +3902 9679 9373
    * e-mail:
    * http://www.fatti.com
    Enrico Migliore, Sep 22, 2003
  4. In a nutshell: no.

    The only "measurement" of clock frequency a micro can make without
    _another_ clock source to compare against, would be the 1-bit result
    of the "go/no-go" test: if code in the micro is currently running, and
    has been so for a couple of iterations of a big loop, that means the
    clock frequency must be somewhere within the allowed range, or close
    to it.

    I.e. you can verify that the clock is not zero, and it's not way too
    high for the micro. Beyond that, a random number would be as good as
    any other as any other result.
    Hans-Bernhard Broeker, Sep 22, 2003
  5. Yvan BOURNE

    Rinux Guest

    ti serve per la seriale o cosa??
    Rinux, Sep 22, 2003
  6. Yvan BOURNE

    Ian McBride Guest

    I need to detect the absolute frequency of the quartz
    If your part is powered by AC connection, then you can use this as a
    reference frequency to phase lock against your quartz. Of course, you'll
    have to make some assumptions here -- 50Hz vs 60Hz, and whether the system
    might be running off of a UPS etc..
    Ian McBride, Sep 22, 2003
  7. Yvan BOURNE

    Jan Homuth Guest

    you are using the M16C - right ?

    Connect the 32Khz XTAL to XCIN and XCOUT (pins 10/11) and you have got a
    Other than with a reference there is no way to determine the clock speed.

    If you have a derivative with a ring oscillator you can try some bad tricks
    switching clock modes, but then again...

    If you only need a ballpark figure you can also measure the current that the
    microcontroller (and only the controller) is using and correlate it to the
    power consumption table supplied in the M16C datasheet.

    Well, I'd vote for the 32KHz XTAL. Simplest way to go.

    Jan Homuth, Sep 22, 2003
  8. I need to detect the absolute frequency of the quartz
    You could connect a resister and cap to a port pin.
    Andre Labelle, Sep 22, 2003
  9. Why ?
    Answer depends on the precision you need to work to.
    ie sense 11MHz or 22MHz is clearly different from
    detect of 11.05921MHz vs 11.05920MHz.

    Jim Granville, Sep 23, 2003
  10. Yvan BOURNE

    Schwob Guest


    the (external) reference which is absolutely needed could be a serial
    interface that sends characters like 0xAA or 0x55 and you measure
    these known lenght charaters with a timer that runs off your
    microcontroller clock.
    Many 8-bit micros have internal oscillators know with specified
    frequency. This is an absolute, thought not highly accurate time
    reference. (E.g. microchip PICxx, Philips LPC9xx, Cygnal) just to name
    a few.

    Cheers, Schwob
    Schwob, Sep 24, 2003
  11. Yvan BOURNE

    Paul Burke Guest

    You clearly need a reference more accurate than the quartz crystal. The
    clock off GPS is supposed to be pretty good, as is the time from 60kHz
    time signals .. take it over a long period to smooth out decoding
    delays. Or a photosensor and leave it outside and measure over a period
    of days. Or get the MTBF from the manufacturer, and run it until it
    breaks down..

    Paul Burke
    Paul Burke, Sep 24, 2003
  12. Yvan BOURNE

    ZO Guest

    To what precision and how much time do we have to get the result? There
    could be a number of ways to do this, but all depend on your precision
    requirements and how quickly you need the result. Can you enlighten us more
    on your requirements?

    ZO, Sep 25, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.