Frequency Counter/Meter on CY8CKIT-030

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

cross mob
Anonymous
Not applicable

I can not collect from examples a frequency meter. Can be at someone there is a ready project, with an exact frequency meter (from 0 to 20 MHz, if it possible)?

   

Try it on the CY8CKIT-030.

0 Likes
1 Solution
Anonymous
Not applicable

Hi hexus,

   

 

   

As I notice that you have selected the PWM window period of 1 second, the captured value itself represents the frequency of the external input signal.

   

This technique is used in the measurement of high frequency signals. The accuracy of the measurement is dependent upon the tolerance of the clock source used. If the tolerance of the Bus clock is high, then the result will be less accurate.

   

For measurement of very low frequencies, another technique in which the Window and counter is reversed would be ideal. That is, the external input signal whose frequency is to be measured will act as a window and the counter will run pulse of clock to measure the time period of the signal.

   

 

   

Can you please elaborate more on this statement "But in lower clocks (ref 32768) it shows 32709 Hz. It's clock quarz, in my msp430lp freqmeter it looks correctly." ?

View solution in original post

0 Likes
19 Replies
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hm. Now project is working. In upper limits (12 MHz) it show good result - 12000000 at display. Use generator base on atmega48@12MHz quarz, CKOUT fuse give clock out to PB0.

   

But in lower clocks (ref 32768) it shows 32709 Hz. It's clock quarz, in my msp430lp freqmeter it looks correctly.

   

Who's right? How I can improve precision of freqmeter?

0 Likes
Anonymous
Not applicable

Hi hexus,

   

 

   

As I notice that you have selected the PWM window period of 1 second, the captured value itself represents the frequency of the external input signal.

   

This technique is used in the measurement of high frequency signals. The accuracy of the measurement is dependent upon the tolerance of the clock source used. If the tolerance of the Bus clock is high, then the result will be less accurate.

   

For measurement of very low frequencies, another technique in which the Window and counter is reversed would be ideal. That is, the external input signal whose frequency is to be measured will act as a window and the counter will run pulse of clock to measure the time period of the signal.

   

 

   

Can you please elaborate more on this statement "But in lower clocks (ref 32768) it shows 32709 Hz. It's clock quarz, in my msp430lp freqmeter it looks correctly." ?

0 Likes
Anonymous
Not applicable

I have a dozen of MSP430 LauchPad 🙂

   

 

   

One of them have installed clock quarz (32768 Hz). And one of output configured as an output of this LF-Quarz directly (with 2 changeable by button dividers: /1 and /8).

   

 

   

My another LP is used by me as a FreqMeter (like as PSoC): use WDT in interval mode (1 sec), and after interval it throw input count on to the UART. Count the outer clocks. It very precise at low clocks. Measured 32768 without any pervert (32767 if outer clock get on working instruction tick).

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

The tolerance for the 10KHz-clock is set to 5%. To get more precise results, remove the checkbox for tolerance.

   

 

   

Bob

Anonymous
Not applicable

Thanks. But it's not help too much.

   

 

   

Change all clocks in the project to XTALs (32768 and 24MHz). Get good resuls on LOW-freqs = 32770 (really above as input 32768).

   

 

   

But high-freqs (like 12mhz) now shows as 11mhz +-. Surprised.

   

 

   

Also have strange deviations in counts, randomly can be higher, or lower than I expect (for example it can stay in 10mhz +-, or 40KHz in low-freq source).

   

 

   

I don't have oscilloscope at now, then I can't really measure my home-brew generator, may only guess.

   

 

   

Can anybody test my project with really precision measurements? 😄

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Omg, has forgotten to put new source codes

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Try to change the synchronization-clock from 24 to 48 MHz

   

You are using a very simple approach for an instrument. Think more complex: what is a measurement cycle, how is it started, how is it ended. What is with signal-conditioning? Did you have a look at the Timer-module? 

   

Are there possibilities to switch measurement ranges (manual/auto)

   

Bob

lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Yes, thanks.

   

 

   

Before thought that XTAL will be more exact, than IMO. If was fair counter input it wouldn't be a problem. Don't know there is such binding to counter clocking.

   

 

   

I use such types of freqmeter for DCO (like IMO) calibration on my MSP430 project 🙂

   

 

   

I will try to estimate later accuracy of frequency meters on PSoC3 and on MSP430. In both cases work approximately equally - consider quantity of signals for 1 sec, defined Low-freq clock quarz.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Rewrote project. Make high all clocks (up to 64MHz) for counter, PWM is sits on the 32768 Hz.

   

Just add USBUART, it automatically checked, if there USB CDC present, or not (and works then, or not, with LCD message displayed). And if we connected, current count throws to UART too - I use it for gathering statistic information for calibration outer silicons.

   

 

   

Is there anybody who can talk me - it gather precision freqs? And how higher input clocks can be (at 24MHz we have rested to 11MHz input). Plz meter for me by your precision instruments (calibrated generator/industrial freq meter).

   

 

   

Because I suspect, that there not true 1 sec measured interval (for addition tacts for reload PWM after interrupt, etc.).

   

 

   

Thanks a lot!

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Dont you think, there should be something left foryou to do? (smile)

   

Bob

Anonymous
Not applicable

Certainly better for self think. 😄 But need fresh look from aside.

Simply now it is a little limited in possibilities of exact measurements (have the same inexact devices). One head well - and two is even better 😉

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Use the same clock (24 or 48MHz) divide it by yourself down to the 10KHz, so you get a stable clock source. So you trust into your board-x-tal to run precisely at 24MHz. (There's always something you have to depend on).

   

Have in mind, the counter's reset is NOT asynchroneous if you'd like to reset the counter.

   

 

   

Bob

Anonymous
Not applicable

Hm. Thanks for good advice. I will think over it.

0 Likes
Anonymous
Not applicable

At last I found, that PWM_period must be 32767 (and not 32768, as I used before 🙂 ). At now it correctly freq measure in theorical (project attached).

   

 

   

By the way. Throw BUS_CLK and another clocks (PLL, IMO) to Digital Output pins and have measured it. At 67MHz counter clock I get:

   

XTAL 24MHz measured is not absolutely correctly measured, but true somewhere nearby. It seems that on a limit of measurements.

   

XTAL/2 = 12MHz measured by error of +- 2E-5 %. It's very, very good for such device (but absolutely average frequency =11999622, deviation at lower side = -0.003152%).

                                                    
 
                                    
 
   

IMO not so bad. Really.

   

 

   

XTAL 32768 has easy stand on one value.

   

 

   

But with such types of home-brew generators I get troubles with LCD. It have errors on screen, or looks as off since a some time.

0 Likes
lock attach
Attachments are accessible only for community members.
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

What's about this...

   

 

   

Have fun

   

Bob

Anonymous
Not applicable

Hm. Thanks.

   

 

   

Written by another level of programming, but make the same. PWM generate 1 sec intervals, in which Counter counts input signal.

   

 

   

But why you use such unstable thing like IMO for PWM count? It has insufficiently precise. You must see it on yourself running demo. There is XTAL 24MHz too has insufficiently precise (more than 5ppm as I see). I reconfigure your project to use XTAL24Mhz, it have absolute error (you can see it to by measuring internal XTAL32768). My cristall is slighly less than 24Mhz, then total result is higher than must be.

   

 

   

XTAL32768 has more precise. Especially if we use PWM counts up to 32767, not 9999. There is less error in divide.

   

 

   

Thanks for sample of inputs switch. Nice. Don't have used before.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

On the board I use, there is no xtal except for the RTC , so I can  only use the IMO. I've got a Kit001 with a PSoC3 processor module installed.

   

 

   

Bob

Anonymous
Not applicable

Oh.

   

 

   

But you can use XTAL32768 (this one you call RTC?) for PWM clocking. And IMO for Counter clocking (inaccuracy won't affect result).

0 Likes
Anonymous
Not applicable

I am  measuring the change in a 300pF capacator. I have taked precautions to drive the shild with the feedback from my voltage follower. The capacator will change a maximum of 80pF for temperature and fumidity. For test pruproses I am using a 500hz clock through a series resistor(10m) through the 300 pF capacator. I am able to get very good RC curves. I have tried the camparator with and without clock sync.

   

After my comparator what is the best way to measure the pulse width time? I am trying to achieve 200 to 800 Hertz.

   

 

   

Thank You.

0 Likes