AnsweredAssumed Answered

LPC54005 CTIMER0 PIO1_1 as counter

Question asked by David Kaplan on Jul 22, 2019
Latest reply on Jul 24, 2019 by jeremyzhou

On my custom LPC54005 board, I am trying to use CTimer0 as a counter with PIO1_1 as the clock input.

(CT0_CAP3 — Capture 3 input to Timer 0). I have a 1Hz square wave connected to the pin. This signal is clean and recognized by the MCU. When using the interrupt as we do for counting slow signals, I see an exact count so I think the hardware is OK. When I try using the hardware CTIMER0 as a counter for higher frequency signals, retrieving the TC every minute and then immediately clearing the count, I get extremely large TC values ~ TC:10269 that are also not stable. I also tried reading the TC and using the difference from the last reading with same problem.

 It looks like the timer is not routing PIO1_1 as its clock. I just want to use CTIMER0 as a hardware counter.

I added the FSL_FEATURE_CTIMER_HAS_CCR_CAP3=1 in my Symbols.

In the debugger using MCUXpresso I can not read the TC value but other registers are available:

 

 

I also attached my code snippets that initialize CTIMER0 and read it periodically.

Thanks

Attachments

Outcomes