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

HardFault when setting RAM rentention

Hi All,

I have this strange problem with setting the RAM rentention. This code used to work fine on my old PCB but I have made a new PCB which is almost identical to the last one. Aslo writing the NRF_POWER->GPREGRET register creates a HardFauld what could be the source of this problem? Both programms are running on the same nr51822-QFACA10 chip.

void turn_off(void){
uint32_t err_code;
if (m_is_timeout)
{
	// enable buttons to wake-up from power off
	err_code = bsp_buttons_enable( (1 << WAKEUP_BUTTON_ID));
	APP_ERROR_CHECK(err_code);
	
	// Check if Hibernate is enabeld 
	if(m_hibernate_enable)
	{
		if(!m_wear_timer_running)
		{
			// Switch on both RAM banks when in System OFF mode.
			NRF_POWER->RAMON |= (POWER_RAMON_OFFRAM0_RAM0On << POWER_RAMON_OFFRAM0_Pos) | 
													(POWER_RAMON_OFFRAM1_RAM1On << POWER_RAMON_OFFRAM1_Pos);
						
			// Go to system-off mode (this function will not return; wakeup will cause a reset).
			err_code = sd_power_system_off();
			APP_ERROR_CHECK(err_code);
		}
	}
}

}

Related