1 2 Previous Next 19 Replies Latest reply on Jan 10, 2013 9:06 AM by philip.nielsen

    Frequency Counter/Meter on CY8CKIT-030

    anton.bashkirov

      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.

        • 1. Re: Frequency Counter/Meter on CY8CKIT-030
          anton.bashkirov

          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?

          • 2. Re: Frequency Counter/Meter on CY8CKIT-030
            gautam.das.g

            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." ?

            • 3. Re: Frequency Counter/Meter on CY8CKIT-030
              anton.bashkirov

              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).

              • 4. Re: Frequency Counter/Meter on CY8CKIT-030
                user_1377889

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

                   

                 

                   

                Bob

                1 of 1 people found this helpful
                • 5. Re: Frequency Counter/Meter on CY8CKIT-030
                  anton.bashkirov

                  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? :D

                  • 6. Re: Frequency Counter/Meter on CY8CKIT-030
                    anton.bashkirov

                    Omg, has forgotten to put new source codes

                    • 7. Re: Frequency Counter/Meter on CY8CKIT-030
                      user_1377889

                      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

                      1 of 1 people found this helpful
                      • 8. Re: Frequency Counter/Meter on CY8CKIT-030
                        anton.bashkirov

                        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.

                        • 9. Re: Frequency Counter/Meter on CY8CKIT-030
                          anton.bashkirov

                          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!

                          • 10. Re: Frequency Counter/Meter on CY8CKIT-030
                            user_1377889

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

                               

                            Bob

                            1 of 1 people found this helpful
                            • 11. Re: Frequency Counter/Meter on CY8CKIT-030
                              anton.bashkirov

                              Certainly better for self think. :D 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 ;)

                              • 12. Re: Frequency Counter/Meter on CY8CKIT-030
                                user_1377889

                                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

                                1 of 1 people found this helpful
                                • 13. Re: Frequency Counter/Meter on CY8CKIT-030
                                  anton.bashkirov

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

                                  • 14. Re: Frequency Counter/Meter on CY8CKIT-030
                                    anton.bashkirov

                                    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.

                                    1 2 Previous Next