# Cypress Developer CommunityTM

## Frequency measurement

Summary: 11 Replies, Latest post by danaaknight on 04 Jul 2014 03:37 PM PDT
User
69 posts

Hello,

I need to accurately measure the frequency of a sinusoïde with a tolerance of 0.01 Hz. The master oscillator is set to 24Mhz by an external crystal (low ppm & temp coef.).

Apart from the numerous topics & documentation available on the site, does anybody  have a clue or a track for such an accurate measurement?

Regards,

Michel

User
69 posts

I should add that the frequency of the signal is around 340Hz.

Michel

User
9301 posts

Not too complicated:

Maxf = 350Hz * 100 = 35kHz measurement frequency, When we double that (Nyquist) we get something like 100kHz.

Signal conditioning and a comparator give a trigger signal for a counter's capture. Counter is counting up, reloaded at capture, interrupt at capture, so there is time enough to get the captured value and do something with it.

Bob

User
9301 posts

Pitfall can be the sinus input going below 0V, then a resistor ladder is needed to shift the voltage.

Bob

User
7646 posts

All things frequency and period measurments, attached -

Regards, Dana.

Attachments:
User
7646 posts

Offsetting signals, simple method, attached.

Regards, Dana.

Attachments:
User
1362 posts

You want RESOLUTION to 0.01Hz or ACCURACY to 0.01Hz. These requirment is not the same

User
7646 posts

Original post stated "I need to accurately measure the frequency of a sinusoïde with a tolerance of 0.01 Hz."

And of course one can have a spec where resolution = accuracy. Although I

think, in general, resolution > accuracy to effect a real solution.

Regards, Dana.

User
69 posts

Hello,

I've succeded in getting a 0.3 Hz accuracy around the central frequency with the help of an active band-pass filter (thx to the OpAmp) , but still need to go down to +/-0.01Hz.

I'd like to digitally filter the output from the counter using DMA between the counter fifo & the DFB input in order to have a full harware path.

How/where can I retrieve the address of the counter fifo (UDB) to fill in the source-address fields in the  DmaInitialize() & CyDmaTdSetAddress() APIs? AN52705 mentions HI16(CYDEV_PERIPH_BASE), but even in the Counter.h file, I can't find anything related to the LO16 souce address.

By the way, sorry to have posted in this rubric, it's not the most appropriate one.

Michel

User
9301 posts

In the Counter.h near line 180 start the definitions of the component's registers. The output FIFO is F0 register and you need the pointer to it for the DMA definition. Remember that only a hardware capture pushes a value into the FIFO.

Bob

User
69 posts

Bob,

In Counter.h:

#elif(CTRFrequence_Resolution <= 16u) /* 16-bit Counter */
#if(CY_PSOC3) /* 8-bit address space */
#define CTRFrequence_STATICCOUNT_LSB     (*(reg16 *) \
CTRFrequence_CounterUDB_sC16_counterdp_u0__F0_REG )

Difficult to guess that CTRFrequence_STATICCOUNT_LSB is related to the FIFO (even if @F0/F1 are mentionned as the FIFO registers belonging to the UDB in the TRM).

No matter, thanks a lot.