Hi,
My application goes to system off by using nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF). In the handler, I configure a sense to be woken up by a GPIO, as follows:
static bool app_shutdown_handler(nrf_pwr_mgmt_evt_t event) { switch (event) { case NRF_PWR_MGMT_EVT_PREPARE_WAKEUP: NRF_LOG_INFO("NRF_PWR_MGMT_EVT_PREPARE_WAKEUP"); nrf_gpio_cfg_sense_input(INT_BTN_USB, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW); return true; break; default: return true; } NRF_LOG_FLUSH(); return true; }
On reset, in the main, I want to read the reset reason to act differently when I come from a system off. For that, I thought to read the register RESETREAS, unfortunately, this one is set to 0.
Now, if I use the register NRF_POWER->SYSTEMOFF instead of nrf_pwr_mgmt_shutdown(), the RESETREAS is correctly set. I've seen this register must not be used when the SD is enabled, so I would prefer to use the pwr mgmt that deals with all cases.
Can you explain me why the RESETREAS does not contain any reason when using nrf_pwr_mgmt_shutdown() ?
Thanks in advance.