- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Solved! Go to Solution.
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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." ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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." ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The tolerance for the 10KHz-clock is set to 5%. To get more precise results, remove the checkbox for tolerance.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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? 😄
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dont you think, there should be something left foryou to do? (smile)
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 😉
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hm. Thanks for good advice. I will think over it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oh.
But you can use XTAL32768 (this one you call RTC?) for PWM clocking. And IMO for Counter clocking (inaccuracy won't affect result).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.