SYSTEM ON:NO RAM,RTX wake up, Power Management: 4 μA at 3 V ,why?

nRF5_SDK_17.0.2_d674dde\examples\peripheral\rtc:

int main(void)
{
//leds_config();


lfclk_config();

rtc_config();

//func_ram_power_off();

NRF_POWER->RAMON |= (POWER_RAMON_OFFRAM0_RAM0Off << POWER_RAMON_OFFRAM0_Pos) |
(POWER_RAMON_OFFRAM1_RAM1Off << POWER_RAMON_OFFRAM1_Pos);
__DSB();
__NOP();

while (true)
{
__WFE();

}
}

the code of SRAM retention is OK? 

thanks you!

Parents Reply Children
  • thanks you Jørgen,now the code is this:but the RTC  cannot wake up,led do not glint。the system is not work。why?thansk you。

    void func_ram_power_off(void)
    {

    NRF_POWER->RAM[0].POWER = 0x01;
    NRF_POWER->RAM[1].POWER = 0x01;
    NRF_POWER->RAM[2].POWER = 0x01;
    NRF_POWER->RAM[3].POWER = 0x01;
    NRF_POWER->RAM[4].POWER = 0x01;
    NRF_POWER->RAM[5].POWER = 0x01;
    NRF_POWER->RAM[6].POWER = 0x01;
    NRF_POWER->RAM[7].POWER = 0x01;

    }

    /**
    * @brief Function for application main entry.
    */
    int main(void)
    {
    leds_config();
    lfclk_config();
    rtc_config();

    func_ram_power_off();
    __DSB();
    __NOP();

    while (true)
    {
    __WFE();

    }
    }

  • Turning off all RAM power leaves the stack (which is in RAM) corrupted so the return address will be lost and there will be a hard fault so nothing will work. How fast is the RAM lost (and hence stack corrupted)? Who knows but this is unsafe code. No RTC interrupts will work if there is no stack.

    Solution do not turn off the power to the RAM segment which holds the stack. The .map file will show the stack location.

Related