This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF_POWER->GPREGRET

Hi Folks,

I am trying to get some data to persist past a reboot.  I noticed the ram_retention_pca1004 example  and it showed a simple assignment of:

NRF_POWER->GPREGRET = X

but when I do the following assignment (even before the reboot):

temp = NRF_POWER->GPREGRET;

temp is always 0.  (Needless to say the value is also zero after the power reset via watchdog timeout.)

I noticed in the example the following code:

#if defined(NRF52832_XXAA) || defined(NRF51422) || defined(NRF51822)
NRF_POWER->RAMON |= (POWER_RAMON_OFFRAM0_RAM0On << POWER_RAMON_OFFRAM0_Pos) |
(POWER_RAMON_OFFRAM1_RAM1On << POWER_RAMON_OFFRAM1_Pos);

Adding that didn't help, but I didn't expect it to as long as my assignment above keeps failing.

Is there a flag that needs to be set to use NRF_POWER->GPREGRET?

(I looked at using sd_power_gpregret_set but couldn't find the correct library to include, is that the correct solution?)

thanks, 
Bob

(Sorry for the basic question, just need some data to persist after a WDT reset.)

Related