Learning about sleep/deep sleep/wake-up mode

Please include the following information, in order for us to help you as effectively as possible.

  • What product do you wish to discuss? RAK4631

  • What firmware are you using? Arduino BSP VSCode Platformio

  • What firmware version? no RUI3

  • Computer OS? Windows

  • What Computer OS version? Windows 11

  • How often does the problem happen? It is not a problem

  • How can we replicate the problem? It is not a problem

  • Provide source code if custom firmware is used or link to example if RAKwireless example code is used.

Good morning,

I am studying to try understand better how to control operations mode: sleep, deep sleep and wake-up.

Take a look in the comparinson between microcontrollers modes: Compare IP

We can see that Cortex-M4 (RAK4631) is a good option about power management. Reading in the Cortex-M4 Devices - Generic User Guide in topic “4.3.6 System Control Register”, I found where to control the modes:

  • SLEEPDEEP: 0 = sleep and 1 = deep sleep

  • SLEEPONEXIT Indicates sleep-on-exit when returning from Handler mode to Thread mode:
    0 = do not sleep when returning to Thread mode.
    1 = enter sleep, or deep sleep, on return from an ISR.
    Setting this bit to 1 enables an interrupt driven application to avoid returning to an empty
    main application.

@beegee , in your bootloader development for WisCore_RAK4631_Bootloader , I found the sleep control in the file nrf_power.h.

I would like to know how to control the sleep/wake modes from my codes for RAK4631.

Regards,

Claudio

I don’t think you can control this from your application code. The Arduino BSP has FreeRTOS under the hood and sleep/wake modes and other deep-level settings of the nRF52 are controlled from FreeRTOS (my guessing, I never digged into the FreeRTOS sources, besides I think they are pre-combiled object files in the BSP)

Thank you by your support.

Claudio