Reset Reason not indicating WDT Reset

My project is running on an nRF52832 with the soft device enabled. At the start of my project I have the following

uint32_t reset_reason;
sd_power_reset_reason_get(&reset_reason);
sd_power_reset_reason_clr(0xFFFFFFFF); 

printf("reset reason %X \n ", reset_reason);

nrfx_wdt_config_t config;
config.behaviour = NRF_WDT_BEHAVIOUR_RUN_HALT; // wdt will pause during SLEEP mode (typically when nrf_pwr_mgmt_run is called)
config.reload_value = WDT_DURATION_MS; 
config.interrupt_priority = 2; // highest priority. If the wdt expires it will override whatever is happening

err_code = nrfx_wdt_init(&config, wdt_handler);
APP_ERROR_CHECK(err_code);
err_code = nrfx_wdt_channel_alloc(&m_channel_id);
APP_ERROR_CHECK(err_code);
nrfx_wdt_enable();

When I reset the system our normal way (calling nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_STAY_IN_SYSOFF) with a gpio interrupt configured, then triggering the gpio) I get 0x35831 which includes reset reasons RESETPIN, OFF, DIF, and NFC. When I force the wdt to expire (by never feeding it) my reset reason is still 0x35831. When triggering the reset via GPIO the RESETPIN and OFF flags make sense, but DIF and NFC do not. The lack of DOG reason when triggering reset via wdt is also confusing.

My questions are as follows:

1. Am I retrieving, and more importantly clearing the RESETREAS register correctly?

2. Why does DOG not appear in RESETREAS when forcing the wdt timer to expire?

3. Why do the DIF and NFC flags appear in RESETREAS? I do have the device connected to an nrf52832 devkit serving as a debugger, but am not in debug mode, and we are not doing anything to configure NFC field detection.

Parents
  • Hi,

    The value of reset_reason is clearly invalid here. That is expected if you call sd_power_reset_reason_get() and sd_power_reset_reason_clr() before the SoftDevice is enabled. Is that the case? If not, can you show more about how/where this is called?

    You will either have to wait until the SoftDevice is enabled when using this API, alternatively, you could also use nrf_power_resetreas_get() and nrf_power_resetreas_clear(), but note that in this case, you must make sure to only call nrf_power_resetreas_clear() before the SoftDevice is enabled.

  • Calling sd_power_reset_reason_get() prior to initializing the soft device was indeed my issue. Using nrf_power_resetreas_get() returns the values I expected, thank you for the help.

Reply Children
No Data
Related