Waking up from power sleep mode

I am trying to put the RSL10 processor in the lowest possible consumption mode and then wake it up using the WakeUp PAD. I have the following problems:

The watchdog is not disabled in sleep mode and after 8 seconds (4 seconds tor watchdog interupt and another 4 to reset) the part is reset by the watchdog.
I’ve tried to set the DebugEn bit (because while you debug the Cortex-M3 the watchdog is disabled)

CoreDebug->DHCSR = ( 0xA05FU << CoreDebug_DHCSR_DBGKEY_Pos ) | CoreDebug_DHCSR_C_DEBUGEN_Msk;

but this instruction has no effect because the core cannot modify that bit. I don’t see any way to disable the watchdog.

For the lowest consumption I’ve tried

ACS->VDDRET_CTRL = 0;
SYSCTRL->MEM_POWER_CFG = 0;

because I don’t want any memory retention, I simply want the CPU to reset when I assert the WakeUp PAD. Is this possible or you always need some memory powered during sleep?

There is no enable for the WakeUp PAD as there is for the other DIOx pads so if I put

ACS->WAKEUP_CFG = WAKEUP_DELAY_128 | WAKEUP_WAKEUP_PAD_RISING;
ACS->WAKEUP_CTRL = PADS_RETENTION_ENABLE |
BOOT_FLASH_APP_REBOOT_ENABLE |
BOOT_FLASH_XTAL_DEFAULT_TRIM |
WAKEUP_DCDC_OVERLOAD_CLEAR |
WAKEUP_PAD_EVENT_CLEAR |
WAKEUP_RTC_ALARM_CLEAR |
WAKEUP_BB_TIMER_CLEAR |
WAKEUP_DIO3_EVENT_CLEAR |
WAKEUP_DIO2_EVENT_CLEAR |
WAKEUP_DIO1_EVENT_CLEAR |
WAKEUP_DIO0_EVENT_CLEAR;

should be enough to activate it. Unfortunately this doesn’t seem to work and I cannot wake up the CPU.

After reading some other entries on this forum I’ve figure out that my CPU was not entering sleep mode.

ACS->PWR_MODES_CTRL = PWR_SLEEP_MODE;
SYS_WAIT_FOR_INTERRUPT;
is not enough to enter sleep mode.

If your processor is reset after 8s you have not correctly entered sleep mode.

The watchdog has only 2 registers (CTRL for refresh and CFG for period setting). There is no way to disable the watchdog in software but watchdog is disabled while you are debugging your program (while the CoreDebug_DHCSR_C_DEBUGEN bit is set). The watchdog is stopped in sleep modes!

In the end I’ve started from the peripheral_server_sleep_ext example as others have suggested and now my deep sleep mode works fine and I’m down to 17uA consumption (I have other components on my board). When I want to wake it up from reset I use the wake-up pad.

I haven’t been able to start the code after wake-up directly from flash as I wanted. I cannot make the Sys_PowerModes_Sleep_WakeupFromFlash function work. Instead I use the Sys_PowerModes_Wakeup in retention RAM and then I use the

SCB->AIRCR = ( ( 0x5FA << SCB_AIRCR_VECTKEY_Pos ) | SCB_AIRCR_SYSRESETREQ_Msk );
to issue a reset.

In the end I’ve managed to wake-up directly from flash and I initially wanted.
To enter any standby or sleep modes it is essential to have the RTC enabled:

ACS_RTC_CTRL->ENABLE_ALIAS = RTC_ENABLE_BITBAND;

You don’t need any function in RAM but you need the sleep_mode_env_tag in RAM.
I’ve chosen to place that (just 8 bytes long) at the end of the DSP RAM where I also have the stack.
In this case the memory retention is:

sleep_mode_env->mem_power_cfg = FLASH_POWER_ENABLE | DSP_DRAM5_POWER_ENABLE;

Then at the end of your Sleep_Mode_Configure() function you need:

 SYSCTRL->WAKEUP_ADDR = 0;
 ACS->WAKEUP_GP_DATA = 0x3fffff; // power all memories after reset

The WAKEUP_GP_DATA contains the WAKEUP_ADDR_PACKED_BYTE field and if that is 0
the device will reboot on wakeup because it is trying to restore from an invalid address.

2 Likes

Hi @Emil,

If your goal is to simply wakeup from the start of your code in Flash, then it should not be necessary to Enable the RTC or to configure the Wakeup Area in a RAM instance.

For you reference, if you import the ‘sleep_RAM_retention’ sample firmware from our RSL10 Software CMSIS Pack, and set the ‘WAKEUP_RTC_ENABLE’ variable as ‘0’ within the ‘app.h’ file, the device will be in the lowest power sleep state, and on triggering the Wakeup Pad will restart execution at the start of the ‘main()’ function.

Please let us know if you have any issues setting up this sample firmware or achieving the behavior descried above and we can provide further assistance.

1 Like