Is it possible to write GPREGRET when S210 is running? Writing directly to register causing HardFault.
Is it possible to write GPREGRET when S210 is running? Writing directly to register causing HardFault.
Hi,
Due to the RESETREAS register is PAN'ed in the current revision of the device, you must workaround this by powering on the RAM (since GPREGRET is unavailable in S210).
Use the sd_power_ramon_set API call:
/**@brief Sets bits in the NRF_POWER->RAMON register.
*
* @param[in] ramon Contains the bits needed to be set in the NRF_POWER->RAMON register.
*
* @return ::NRF_SUCCESS
*/
uint32_t SVCALL(SD_POWER_RAMON_SET) sd_power_ramon_set(uint32_t ramon);
This call is directly mapped 1:1 on how you would set the RAMON register. If you set one variable declared within the area of RAM block 1, you can use this for checking wakeup source: static uint8_t reset_reason_from_systemoff attribute((at(0x20001000)));
Set this before going into systemoff, and do a check when waking up again.
Best regards Håkon
Hi,
Due to the RESETREAS register is PAN'ed in the current revision of the device, you must workaround this by powering on the RAM (since GPREGRET is unavailable in S210).
Use the sd_power_ramon_set API call:
/**@brief Sets bits in the NRF_POWER->RAMON register.
*
* @param[in] ramon Contains the bits needed to be set in the NRF_POWER->RAMON register.
*
* @return ::NRF_SUCCESS
*/
uint32_t SVCALL(SD_POWER_RAMON_SET) sd_power_ramon_set(uint32_t ramon);
This call is directly mapped 1:1 on how you would set the RAMON register. If you set one variable declared within the area of RAM block 1, you can use this for checking wakeup source: static uint8_t reset_reason_from_systemoff attribute((at(0x20001000)));
Set this before going into systemoff, and do a check when waking up again.
Best regards Håkon