LPC1549 Pulse counting

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

LPC1549 Pulse counting

1,382 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Carl-CircuitWorx on Wed Apr 29 09:41:05 MST 2015
Hi,

Have a 0 to 2khz input I need the monitor the frequency of, Have tried the frequency perhperial using the 32khz clock but it gives me four results then gets stuck and doesnt return with a result ( Clearing the bit in FREQMECTRL )

So I am thinking of using interrupt on change and pulse counting. Or would the SCT timer be a better option can it be configured to count pulses and give me a total each second?
Labels (1)
0 Kudos
Reply
7 Replies

1,266 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Carl-CircuitWorx on Sat May 02 03:19:23 MST 2015
Okay I needed load caps on the RTC crystal, after adding those it appears to be working now
0 Kudos
Reply

1,266 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed Apr 29 17:39:03 MST 2015
Although RTC is running (and generating RTC interrupts), using RTC as reference clock isn't working reliable here  :((

So probably a simple SCT timer to capture rising edges is a better solution  :bigsmile:
0 Kudos
Reply

1,266 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed Apr 29 17:39:00 MST 2015
Although RTC is running (and generating RTC interrupts), using RTC as reference clock isn't working reliable here  :((

So probably a simple SCT timer to capture rising edges is a better solution  :bigsmile:
0 Kudos
Reply

1,266 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Carl-CircuitWorx on Wed Apr 29 14:12:18 MST 2015
Yes used the sample as a reference. The example shows that the 32KHz osc is either awfully inaccurate or has an issue on my board.

I've switched from the 32KHz osc to the WDT Osc and the frequency measurement is working and doesn't hang up. Unfortunately the WDT osc is supposed to be very inaccurate (+/-40%) and also only provides 30.7hz resolution. 32.768KHz Osc should provide 0.5Hz resolution

I may have an issue with the boards RTC crystal causing the frequency measurement to stop I guess, will have to check it out tomorrow.
0 Kudos
Reply

1,266 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed Apr 29 12:17:59 MST 2015

Quote: Carl-CircuitByte
There's not a lot of detail in the User manual about how it operates either.



What about periph_freqmeas sample?
0 Kudos
Reply

1,266 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Carl-CircuitWorx on Wed Apr 29 12:12:16 MST 2015
Yep I've tried the frequency measurement peripheral first. It's control is seemingly very straight forward but for some reason it's failing to operate for me. It gives me four incorrect results then fails gets stuck and never clears the FREQMECTRL bit to say it's finished.

There's not a lot of detail in the User manual about how it operates either.
0 Kudos
Reply

1,266 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed Apr 29 11:50:54 MST 2015

Quote: Carl-CircuitByte
So I am thinking of using interrupt on change and pulse counting.



You are kidding, right  :)



Quote: Carl-CircuitByte
...SCT timer be a better option...



SCT can do a lot of useful things  :)  Measuring a pulse length isn't too difficult....

But of course the easiest option is the Frequency measure function  :O

0 Kudos
Reply