clock frequency measurement

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

clock frequency measurement

797 Views
mon3al
Contributor I

Hi,

I'm trying to find a way to measure the 80MHz instruction clock to determine if the crystal is drifting (as a kind of fail-safe).

 

I can add up the instruction cycles in an assembly loop and use the Periodic Interrupt Timer (PIT0) w/ microsecond resolution to determine the time it takes for those instruction cycles to run, but that seems kind of like measuring the clock with the clock.

 

Does anyone have any other ideas on how to accomplish this?

Labels (1)
0 Kudos
5 Replies

506 Views
mon3al
Contributor I

I was hoping to find a way to do this in software so we wouldn't have to change our circuit board.

0 Kudos

506 Views
FridgeFreezer
Senior Contributor I

Measuring the clock with the clock is, as you say, quite pointless.

 

The important question is WHY you want to do this and WHAT you are doing - if it is some timing-critical application then you need to look at proper timing references and high-stability clocks, high quality components, etc. and really think about where errors can come from and what you can do to detect and correct them.

 

Are you worried about keeping accurate time, a stable reference, or high precision measurement?

0 Kudos

506 Views
mon3al
Contributor I

I think what we are really worried about is drift in the clock circuitry, which could cause errors in out time-based calculations, timers, etc.

0 Kudos

506 Views
TomE
Specialist II

As has been asked, what accuracy do you need? How many PPM?

 

Crystals give a pretty good guarantee for most things.

 

Are you worried about faulty crystals, faulty caps on the crystal, manufacturing faults or what?

 

If you want to check the ongoing accuracy you need an independent time reference. A second oscillator or crystal, GPS input, anything. It does need HARDWARE somewhere. Is it on a network? Can it get the time from another source? Are there more than one of them on a network - they could keep tabs on each other.

 

Another way to check is to add the ability (you may need to change the board) to feed in a high quality reference signal from a signal generator into a capture/timer pin, say at 1.000000Hz. Then the software can measure (to the microsecond or better) how long it thinks the signal period took, and that gives the current clock accuracy, and with further measurement you can get drift and temperature sensitivity.

 

I worked on a product which had a clock display in it. On the production line it measured a 1Hz external signal (from a calibrated Agilent signal generator) and then saved the measured correction factor. It also measured the temperature and applied a known cubic correction factor to the timekeeping.

 

Tom

 

0 Kudos

506 Views
yibbidy
Contributor V

You could use a GPT timer or a PWM set up to output to a pin and set some known divisor.  Then use a CRO or a frequency counter to measure it.

 

Shaun

0 Kudos