Hi :) ,
My project continues quiet well, and now come the time to create final assembli of all my small block.
I'm using nrf52833, with s113.
I want my device most of the time in deep sleep mode. When the external accelerometre detect movement, it set a pin to 1 to wake up the nrf52833.
A second source of wake up will be the internal rtc . It will periodically wake up the device , get spi information and wake up or not after evaluating the data.
I first used nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF); with success. I ere able to go into deepest sleep mode, and wake up by moving my accelerometer.
But then, i realize it was not possible to have rtc working in this mode ! So i tried to use in place of it : sd_app_evt_wait();
But it doesn't go to sleep anymore, it just overpass the function like it doens't exist. I red that if some event or interupt happens, this behavior can happen. So i tried to put this function directly after my main( entry point. But still same issue ! I'have checked that no interupt were enable in peripherals.
I also tried to use just before sd_app_evt_wait , this to clean potential interupt already on : sd_nvic_ClearPendingIRQ(Reset_IRQn); but without effect.
To sum up, i think i have to use POwer On mode ( i would like to activate ram retention too with this piece of code i found in example peripheral/ram retention ). Once i get the wake up on event with gpio or rtc timer, the program will continue after the function. As i am using spi and some gpio , should i re configure pins and pripheral or is it still keep in memory ? I already to started this with a state machine in my main.
NRF_POWER->RAM[0].POWERSET = (POWER_RAM_POWER_S0POWER_On << POWER_RAM_POWER_S0POWER_Pos) |
etc...
(POWER_RAM_POWER_S0RETENTION_On << POWER_RAM_POWER_S0RETENTION_Pos) |
(POWER_RAM_POWER_S1RETENTION_On << POWER_RAM_POWER_S1RETENTION_Pos) |
(POWER_RAM_POWER_S2RETENTION_On << POWER_RAM_POWER_S2RETENTION_Pos) |
Thank you !