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
  • Hi,

    The RAMON register is deprecated in nRF52, you should not use it. Instead, you should use the RAM[n].POWER registers. 

    It seems that the max current in your measurement is over 5 mA, which indicates to me that the CPU or radio have been running during the period. If 4uA is the average current including wakeup event, it does not seem too high. Have you tried measuring the base idle current only?

    Best regards,
    Jørgen

  • 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();

    }
    }

Reply
  • 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();

    }
    }

Children
  • 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