I am developing an input signal period monitor using the SCTimer on the LPC812. I have configured a simple state machine with two states.
The initial state (0) waits for an event to signal the first rising edge transition of the input signal. When this event occurs, we store the value captured in the capture register and transition to the running state (1). Once in the running state, we continue to monitor the input signal for rising edges. Each time a rising edge is detected, we use the value in the capture register to determine the number of ticks that have occurred since the last event and report this to the application to calculate the frequency of the input signal.
This works most of the time, however, I frequently see frequencies reported at half of the actual frequency. The LPC812 is running at 24 MHz and I'm attempting to record frequencies on the order of 10 Hz.
I have implemented this using an LPCXpresso812MAX development board and a function generator connected to P0_14 (SCT_IN0).
Looking at frequencies near 10 Hz, I see about 5% of my readings reporting double the period I expect. It appears that transitions on the input pin are being missed. Changing the frequency of the input signal shows similar behavior.
Another curious note is that I see the event that triggers the transition from the initial state to the active state occurs more than once. I expected the SCTimer to begin in the initial state waiting for a transition on the input pin and then transition to and remain in the active state permanently. I cannot explain why I see this transition occur more than once. It is possible that I've misconfigured the SCTimer causing it to reset during runtime?
Any feedback on my use of the SDK calls is appreciated.
Thanks in advance,