Hello -
We are developing a product for the nRF52840 using SDK v17.0.2 and FreeRTOS. Our application uses the RTC configured by FreeRTOS to implement a System ON sleep wake on timer feature. The SoftDevice is not enabled. The feature works well, though I have a question related to RAM power. Here is the code:
// Power off all ram sections except for retention memory (slave 2, section 0)
NRF_POWER->RAM[0].POWERCLR = 0x03;
NRF_POWER->RAM[1].POWERCLR = 0x03;
NRF_POWER->RAM[2].POWERCLR = 0x02;
NRF_POWER->RAM[3].POWERCLR = 0x03;
NRF_POWER->RAM[4].POWERCLR = 0x03;
NRF_POWER->RAM[5].POWERCLR = 0x03;
NRF_POWER->RAM[6].POWERCLR = 0x03;
NRF_POWER->RAM[7].POWERCLR = 0x03;
NRF_POWER->RAM[8].POWERCLR = 0x3F;
// Wait for RTC compare interrupt event
do {
__WFE();
} while (!nrf_rtc_event_pending(portNRF_RTC_REG, NRF_RTC_EVENT_COMPARE_0));
// Power on all RAM (seems to be required in order for reset to work)
NRF_POWER->RAM[0].POWERSET = 0x03;
NRF_POWER->RAM[1].POWERSET = 0x03;
NRF_POWER->RAM[2].POWERSET = 0x02;
NRF_POWER->RAM[3].POWERSET = 0x03;
NRF_POWER->RAM[4].POWERSET = 0x03;
NRF_POWER->RAM[5].POWERSET = 0x03;
NRF_POWER->RAM[6].POWERSET = 0x03;
NRF_POWER->RAM[7].POWERSET = 0x03;
NRF_POWER->RAM[8].POWERSET = 0x3F;
// Reset device
NVIC_SystemReset();
We power off all RAM except for one section before waiting for the RTC event. After the RTC event we power RAM back on and perform a soft reset. We have found that our application does not successfully re-launch after the soft reset unless we power the RAM back before the soft reset. I haven't found any documentation on whether or not the RAM power state (on or off) is maintained across soft reset after exiting System ON sleep mode. Our theory is that we must power RAM back on in order for the boot loader to function properly after the reset. Is this true and is the current RAM power state maintained across soft reset?
Regards,
Brian