FRDM-KL25Z Frequency Counter Problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FRDM-KL25Z Frequency Counter Problem

Jump to solution
1,645 Views
jaminschaefer
Contributor I

I'm working on a project that requires frequency measurement of a square-wave signal. I've set up two timers using Processor Expert Software, the LPTMR running at 32.768 kHz and interrupting every 100 ms.

In the ISR I'm reading the counter register of the second Timer (TPM0_CNT), counting the rising edges of the external square-wave signal.

 

The counter value multiplied by 10 gives the frequency of the input signal.

With the help von Erichs LCDHTA component I'm "printing" the frequency on an LCD screen. At frequencies up to 300 kHz everything is working as expected, but at higher frequencies the system stop's working:

 

53382_53382.giffrequency_counter.gif

(working as expected)

 

53383_53383.gifezgif.com-optimize.gif

(stops working at higher frequencies)

 

I've no idea why this is happening. Am I doing something wrong? Or is there a better way to count higher frequencies?

I've attached my source files, so you may have a look. Thank you for your help!

 

Jamin

Original Attachment has been moved to: FRDM-KL25Z_LCD_Test.zip

0 Kudos
1 Solution
941 Views
jaminschaefer
Contributor I

Thanks for your help!

I just found my mistake. It wasn't a software, but  a hardware issue. The ground pin of my function generator wasn't connected properly to the FRDM board. Ground was floating and the MCU couldn't detect the signal properly.

Sorry for wasting your time.

You too,

Jamin

View solution in original post

0 Kudos
2 Replies
942 Views
jaminschaefer
Contributor I

Thanks for your help!

I just found my mistake. It wasn't a software, but  a hardware issue. The ground pin of my function generator wasn't connected properly to the FRDM board. Ground was floating and the MCU couldn't detect the signal properly.

Sorry for wasting your time.

You too,

Jamin

0 Kudos
941 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Jamin,

Before answer your question, I'd like to confirm with you about the exactly value of edges when you put a break point on the line as Fig 1 illustrates during debugging the project.

I'm looking forward to your reply.

2015-07-22_14-47-09.jpg

                                                                            Fig 1
Have a great day,
Ping

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos