FRDM-KL25Z Frequency Counter Problem

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

FRDM-KL25Z Frequency Counter Problem

ソリューションへジャンプ
1,868件の閲覧回数
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

ラベル(2)
0 件の賞賛
返信
1 解決策
1,164件の閲覧回数
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 件の賞賛
返信
2 返答(返信)
1,165件の閲覧回数
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 件の賞賛
返信
1,164件の閲覧回数
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 件の賞賛
返信