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

FreeRTOS power consumption spikes when in System ON sleep mode

Hello -

We are developing on the nRF52840-DK, using SDK 15.3.0 and FreeRTOS with tickless idle. The SoftDevice is disabled. Using the PPK v2.3.1 when our app is in System ON sleep mode, we are seeing power consumption spikes at regular ~1s intervals:

During this period our app is waiting on messages from a FreeRTOS message queue. At this time there are no other pending tasks:

xQueueReceive(msgQueue, &msg, maxDelayMS);

After maxDelayMS we enter System OFF sleep mode and the current drops for the duration:

NRF_POWER->SYSTEMOFF = 1;

I toggle an onboard LED in the vPortSuppressTicksAndSleep() function before and after System ON sleep. The LED toggles only once after the specified delay, which leads me to believe that the sleep logic is working as expected. After some experimentation, I found that the RTC wakeup interrupt configuration leads to the spikes. If I comment out this code, the spikes no longer occur, but of course the app never exits System ON sleep:

/* Configure CTC interrupt */
nrf_rtc_cc_set(portNRF_RTC_REG, 0, wakeupTime);
nrf_rtc_event_clear(portNRF_RTC_REG, NRF_RTC_EVENT_COMPARE_0);
nrf_rtc_int_enable(portNRF_RTC_REG, NRF_RTC_INT_COMPARE0_MASK);

Is there anything we can do in our app or FreeRTOS configuration to eliminate these spikes?

Regards,

Brian

Parents Reply Children
Related