Hi,
the system we are using includes the nrf52832 SoC with an external ADC and en external crystal for HFCLK. running SoftDevice s132 v2 (based on SDK 11)
in our system we turn on the hfclk and ppi and TIMER2 to sample an external ADC in a cyclic manner. after sampling is done we go to sleep most of the time until next sampling cycle.
what I noticed is that sometimes randomly the CPU doesn't go to sleep after a sampling event and after the next sampling event it does go to sleep.
I checked which interrupt is pending that denies the WFE from entering sleep by checking for all interrupts using sd_nvic_GetPendingIRQ and I found that TIMER2 interrupt is pending when this issue happens.
when we start the sampling process we do the following:
when we finish sampling the following is done:
if I change the uninit of all the peripherals as follows it solves the problem:
can somebody explain why this happens? should the timer be uninit after sd_clock_hfclk_release? and what is the proper way to uninit the timer?