This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

LPCOMP occasionally missing interrupt

Hi, 

I"m using SDK 15.3.0 with an NRF52840 dev board. I'm trying to record the timings from an incoming IR signal. In doing so I'm using LPCOMP with an analog input pin to record IR signals which will toggle at frequencies ranging from 1.2 ms to 2.4 ms. I'm using LPCOMP because the amplitude of the IR signal often doesn't reach the reference voltage (3.3V). I've attached an interrupt to LPComp that will toggle both an indicator light (LED4) and a gpio connected to the oscilloscope (OUT_PIN). LPCOMP is configured to a Prescaler of 4/8ths and meant to fire an interrupt on all Cross events. 

After hooking up the entire system on the oscilloscope, the interrupt occasionally fails to trigger. The yellow line is the OUT_PIN while the blue line is the incoming IR signal in the pictures below. Most of the time, OUT_PIN toggles properly thus emulates the incoming IR signal. However, occasionally the OUT_PIN will toggle for no reason or miss toggles (reference the oscilloscope readings pic below). In addition, I'm facing another bug where if I turn the LPCOMP Prescaler to anything other than 4/8 the indicator light (LED4) will continue toggle but the OUT_PIN will not give any readings on the oscilloscope and stay flat.

Is there perhaps a way to increase the frequency of LPCOMP? Or any other way to ensure that an interrupt is not skipped? 

Oscilloscope Readings: 


In this picture below, the LPCOMP interrupt misses a few edges and also toggles quite a bit extra following the end of a pulse.

LPComp Init:

Related