Continuous measurement of frequency

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MiVa_4722436
Level 1
Level 1
First reply posted First question asked Welcome!

Hello there,

I am searching for precise frequency measurement MCU or IC which would have higher resolution than regular MCU (1.8 nanosecond resolution at 550 MHz with STM32H7 ).  

I need to measure:

frequency ranging 1-2 MHz of a square signal with averaging over the period of 50 usec.

time measurement resolution: <1ns 

period of one measurement: 50 usec 

I know that there are some time to digital convertors such as TDC7200 / TDC-GPX2. These may be connected in front of any MCU and perform the measurement. Unfortunately it can measure time between start and stop signal. I need to measure number of edges of input frequency signal during entire period (50 usec). 

Q1: Can any of your MCU/IC/PSoC meet this measurements?

Q2: Is there any recommended connection / additional IC which would help me to measure number of edges within a given 50 usec measurement period? I may use a traditional MCU but they do not run usually fast enough.

Maybe this task very easy to solve but I am grateful for any answer.

Thank you,

Michael 

0 Likes
1 Solution
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

MiVa,

One can use a combination of the basic microcontroller with an external high-speed timer, like TDC7200. The sampled frequency 1-2MHz is rather low, and the number of the elapsed cycles (~50) can be counted by the microcontroller, while the exact elapsed time between the first and the last pulses is measured by TDC7200. The uC can also generate a blanking (enable/disable) pulse to prevent early triggering of the STOP signal. The TDC7200 already has 'enable' pin for that.

As an example, you can refer to the design of this fractional counter, which uses same approach, counting the number of pulses during some pre-defined period, and an elapsed time between the First and the Last pulses in this period.

Frequency Meter Component 

/odissey1

Frequency meter_2x_5a.png

 

View solution in original post

0 Likes
2 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Michael,

In the "Code Examples" Forum I provide a PSoC5 tutorial with project examples about different methods of frequency measurement.   Each project gets progressively more advanced in technique and provides a more accurate result with significantly less aid by the CPU.    For example Project #1 starts with the simplest but not the most accurate or most CPU efficient method of CPU polling.  The final project (Project #8) uses frequency prescaling and DMA to improve the accuracy of the  high frequency input signals while only requiring less than 1% of the CPU.

Link: Multi-Input-Frequency-Measurement-Tutorial 

In the tutorial I provide project descriptions as well as design analysis to aid in decision making.   I include appendices to provide formulas for determining measurement range, accuracy and resolution of the design method being used.

The frequency range you are trying to measure is quite high.  If you to use the 1-2MHz directly, the PSoC5 has a maximum clocking frequency (using the internal PLL) of 80MHz.  If you use that as the input clock to the counter and using the most efficient method of capture (DMA) , you can achieve a measurement of an 2MHz input signal +/- 50KHz.   If this resolution is not sufficient, I would recommend an additional method called "input frequency pre-scaling" demonstrated in Project #8. 

By pre-scaling the 1-2 MHz input signal to 1-2 KHz (/1000 prescale), you can use the 80MHz PLL input clock for the frequency measurement counter with improved resolution.  For example a 2 MHz input frequency with a /1000 prescale will yield +/- 50Hz resolution.

The downside of the prescaling is it takes longer to acquire the first sample.   A 2MHz rising-edge to rising-edge period is 500ns.   A 2KHz rising-edge to rising-edge period is 500us.

If you are trying to target a single measurement within 50us, then I would suggest a pre-scale of /100.   This would lower the input frequency range to 10-20KHz and with an counter clock of 80MHz provide a +/- 500Hz resolution.

One last thing to note:  Your measurement accuracy is only as good as your reference clock.  Therefore I highly recommend using a crystal on the ECO circuit with sub-100 PPM tolerance.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

MiVa,

One can use a combination of the basic microcontroller with an external high-speed timer, like TDC7200. The sampled frequency 1-2MHz is rather low, and the number of the elapsed cycles (~50) can be counted by the microcontroller, while the exact elapsed time between the first and the last pulses is measured by TDC7200. The uC can also generate a blanking (enable/disable) pulse to prevent early triggering of the STOP signal. The TDC7200 already has 'enable' pin for that.

As an example, you can refer to the design of this fractional counter, which uses same approach, counting the number of pulses during some pre-defined period, and an elapsed time between the First and the Last pulses in this period.

Frequency Meter Component 

/odissey1

Frequency meter_2x_5a.png

 

0 Likes