Sleep#

These APIs help when putting the system to an EM2/EM3/EM4 sleep states where the high frequency clock is disabled.

The RAIL library has its own timebase and the ability to schedule operations into the future. When going to any power mode that disables the HF clock used for the radio (EM2/EM3/EM4), it is important that this timebase is synchronized to a running LFCLK and the chip is set to wake up before the next scheduled event. If RAIL has not been configured to use the power manager, RAIL_Sleep() and RAIL_Wake() must be called for performing this synchronization. If RAIL has been configured to use the power manager, RAIL_InitPowerManager(), it will automatically perform timer synchronization based on the selected RAIL_TimerSyncConfig_t. Calls to RAIL_Sleep() and RAIL_Wake() are unsupported in such a scenario.

Following example code snippets demonstrate synchronizing the timebase with and without timer synchronization:

Sleep with timer synchronization:

When sleeping with timer synchronization, you must first get the required LFCLK up and running and leave it running across sleep so that the high frequency clock that drives the RAIL time base can be synchronized to it. The RAIL_Sleep() API will also set up a wake event on the timer to wake up wakeupProcessTime before the next timer event so that it can run successfully. See the EFR32 sections on Low-Frequency Clocks and RAIL Timer Synchronization for more setup details.

This is useful when maintaining packet time stamps across sleep or use the scheduled RX/TX APIs while sleeping in between. It does take more time and code to do the synchronization. If your application does not need this, it should be avoided.

Example (without Power Manager):

#include "rail.h"

extern RAIL_Handle_t railHandle;
// Wakeup time for your crystal/board/chip combination
extern uint32_t wakeupProcessTime;

void main(void)
{
  RAIL_Status_t status;
  bool shouldSleep = false;

  // This function depends on your board/chip but it must enable the LFCLK
  // you intend to use for RTCC sync before we configure sleep as that function
  // will attempt to auto detect the clock.
  BoardSetupLFCLK()

  // Configure sleep for timer synchronization
  RAIL_TimerSyncConfig_t timerSyncConfig = RAIL_TIMER_SYNC_DEFAULT;
  status = RAIL_ConfigSleepAlt(railHandle, &timerSyncConfig);
  assert(status == RAIL_STATUS_NO_ERROR);

  // Application main loop
  while(1) {
    // ... do normal app stuff and set shouldSleep to true when we want to
    // sleep
    if (shouldSleep) {
      bool sleepAllowed = false;

      // Go critical to assess sleep decisions
      CORE_ENTER_CRITICAL();
      if (RAIL_Sleep(wakeupProcessTime, &sleepAllowed) != RAIL_STATUS_NO_ERROR) {
        printf("Error trying to go to sleep!");
        CORE_EXIT_CRITICAL();
        continue;
      }
      if (sleepAllowed) {
        // Go to sleep
      }
      // Wakeup and sync the RAIL timebase back up
      RAIL_Wake(0);
      CORE_EXIT_CRITICAL();
    }
  }
}

Example (with Power Manager):

#include "rail.h"
#include "sl_power_manager.h"

extern RAIL_Handle_t railHandle;

void main(void)
{
  RAIL_Status_t status;
  bool shouldSleep = false;

  // This function depends on your board/chip but it must enable the LFCLK
  // you intend to use for RTCC sync before we configure sleep as that function
  // will attempt to auto detect the clock.
  BoardSetupLFCLK();
  // Configure sleep for timer synchronization
  RAIL_TimerSyncConfig_t timerSyncConfig = RAIL_TIMER_SYNC_DEFAULT;
  status = RAIL_ConfigSleepAlt(railHandle, &timerSyncConfig);
  assert(status == RAIL_STATUS_NO_ERROR);
  // Initialize application-level power manager service
  sl_power_manager_init();
  // Initialize RAIL library's use of the power manager
  RAIL_InitPowerManager();

  // Application main loop
  while(1) {
    // ... do normal app stuff and set shouldSleep to true when we want to
    // sleep
    if (shouldSleep) {
      // Let the CPU go to sleep if the system allows it.
      sl_power_manager_sleep();
    }
  }
}

RAIL APIs such as, RAIL_StartScheduledTx(), RAIL_ScheduleRx(), RAIL_SetTimer(), RAIL_SetMultiTimer() can be used to schedule periodic wakeups to perform a scheduled operation. The call to sl_power_manager_sleep() in the main loop ensures that the device sleeps until the scheduled operation is due. Upon completion, each instantaneous or scheduled RX/TX operation will indicate radio busy to the power manager to allow the application to service the RAIL event and perform subsequent operations before going to sleep. Therefore, it is important that the application idle the radio by either calling RAIL_Idle() or RAIL_YieldRadio(). If the radio transitions to RX after an RX or TX operation, always call RAIL_Idle() in order transition to a lower sleep state. If the radio transitions to idle after an RX or TX operation, RAIL_YieldRadio() should suffice in indicating to the power manager that the radio is no longer busy and the device can sleep.

The following example shows scheduling periodic TX on getting a TX completion event:

void RAILCb_Event(RAIL_Handle_t railHandle, RAIL_Events_t events)
{
  // Omitting other event handlers
  if (events & RAIL_EVENTS_TX_COMPLETION) {
    // Schedule the next TX.
    RAIL_ScheduleTxConfig_t config = {
      .when = (RAIL_Time_t)parameters->startTime,
      .mode = (RAIL_TimeMode_t)parameters->startTimeMode
    };
    (void)RAIL_StartScheduledTx(railHandle, channel, 0, &config, NULL);
  }
}

Note

  • The above code assumes that RAIL automatic state transitions after TX are idle. Use RAIL_SetTxTransitions() to ensure the right state transitions are used. Radio must be idle for the device to enter EM2 or lower energy mode.

  • When using the power manager, usage of RAIL_YieldRadio() in single protocol RAIL is similar to its usage in multiprotocol RAIL. See Yielding the Radio for more details.

  • Back to back scheduled operations do not require an explicit call to RAIL_YieldRadio() if the radio transitions to idle.

Sleep without timer synchronization:

When sleeping without timer synchronization, you are free to enable only the LFCLKs and wake sources required by the application. RAIL will not attempt to configure any wake events and may miss anything that occurs over sleep.

This is useful when your application does not care about packet time stamps or scheduling operations accurately over sleep.

Example (without Power Manager):

#include "rail.h"

extern RAIL_Handle_t railHandle;

void main(void)
{
  RAIL_Status_t status;
  bool shouldSleep = false;

  // Configure sleep for no timer synchronization
  RAIL_TimerSyncConfig_t timerSyncConfig = {
    .sleep = RAIL_SLEEP_CONFIG_TIMERSYNC_DISABLED,
  };
  status = RAIL_ConfigSleepAlt(railHandle, &timerSyncConfig);
  assert(status == RAIL_STATUS_NO_ERROR);

  // Application main loop
  while(1) {
    // ... do normal app stuff and set shouldSleep to true when we want to
    // sleep
    if (shouldSleep) {
      bool sleepAllowed = false;
      uint32_t sleepTime = 0;

      // Go critical to assess sleep decisions
      CORE_ENTER_CRITICAL();
      if (RAIL_Sleep(0, &sleepAllowed) != RAIL_STATUS_NO_ERROR) {
        printf("Error trying to go to sleep!");
        CORE_EXIT_CRITICAL();
        continue;
      }
      if (sleepAllowed) {
        // Go to sleep and optionally update sleepTime to the correct value
        // in microseconds
      }
      // Wakeup and sync the RAIL timebase back up
      RAIL_Wake(sleepTime);
      CORE_EXIT_CRITICAL();
    }
  }
}

Example (with Power Manager):

#include "rail.h"
#include "sl_power_manager.h"

extern RAIL_Handle_t railHandle;

void main(void)
{
  RAIL_Status_t status;
  bool shouldSleep = false;

  // This function depends on your board/chip but it must enable the LFCLK
  // you intend to use for RTCC sync before we configure sleep as that function
  // will attempt to auto detect the clock.
  BoardSetupLFCLK();
  // Configure sleep for no timer synchronization
  RAIL_TimerSyncConfig_t timerSyncConfig = {
    .sleep = RAIL_SLEEP_CONFIG_TIMERSYNC_DISABLED,
  };
  status = RAIL_ConfigSleepAlt(railHandle, &timerSyncConfig);
  assert(status == RAIL_STATUS_NO_ERROR);
  // Initialize application-level power manager service
  sl_power_manager_init();
  // Initialize RAIL library's use of the power manager
  RAIL_InitPowerManager();

  // Application main loop
  while(1) {
    // ... do normal app stuff and set shouldSleep to true when we want to
    // sleep
    if (shouldSleep) {
      // Let the CPU go to sleep if the system allows it.
      sl_power_manager_sleep();
    }
  }
}

The RAIL library has its own timebase and the ability to schedule operations into the future. When going to any power mode that disables the HF clock used for the radio (EM2/EM3/EM4), it is important that this timebase is synchronized to a running LFCLK and the chip is set to wake up before the next scheduled event. If RAIL has not been configured to use the power manager, sl_rail_sleep() and sl_rail_wake() must be called for performing this synchronization. If RAIL has been configured to use the power manager, sl_rail_init_power_manager(), it will automatically perform timer synchronization based on the selected sl_rail_timer_sync_config_t. Calls to sl_rail_sleep() and sl_rail_wake() are unsupported in such a scenario.

Following example code snippets demonstrate synchronizing the timebase with and without timer synchronization:

Sleep with timer synchronization:

When sleeping with timer synchronization, you must first get the required LFCLK up and running and leave it running across sleep so that the high frequency clock that drives the RAIL time base can be synchronized to it. The sl_rail_sleep() API will also set up a wake event on the timer to wake up wakeup_process_time_us before the next timer event so that it can run successfully. See the EFR32 sections on Low-Frequency Clocks and RAIL Timer Synchronization for more setup details.

This is useful when maintaining packet time stamps across sleep or use the scheduled RX/TX APIs while sleeping in between. It does take more time and code to do the synchronization. If your application does not need this, it should be avoided.

Example (without Power Manager):

#include "sl_rail.h"

extern sl_rail_handle_t rail_handle;
// Wakeup time for your crystal/board/chip combination
extern uint32_t wakeup_process_time_us;

void main(void)
{
  sl_rail_status_t status;
  bool should_sleep = false;

  // This function depends on your board/chip but it must enable the LFCLK
  // you intend to use for RTCC sync before we configure sleep as that function
  // will attempt to auto detect the clock.
  Board_Setup_LFCLK();

  // Configure sleep for timer synchronization
  sl_rail_timer_sync_config_t timer_sync_config = SL_RAIL_TIMER_SYNC_DEFAULT;
  status = sl_rail_config_sleep(rail_handle, &timer_sync_config);
  assert(status == SL_RAIL_STATUS_NO_ERROR);

  // Application main loop
  while(1) {
    // ... do normal app stuff and set should_sleep to true when we want to
    // sleep
    if (should_sleep) {
      bool sleep_allowed = false;

      // Go critical to assess sleep decisions
      CORE_ENTER_CRITICAL();
      if (sl_rail_sleep(wakeup_process_time_us, &sleep_allowed) != SL_RAIL_STATUS_NO_ERROR) {
        printf("Error trying to go to sleep!");
        CORE_EXIT_CRITICAL();
        continue;
      }
      if (sleep_allowed) {
        // Go to sleep
      }
      // Wakeup and sync the RAIL timebase back up
      sl_rail_wake(0);
      CORE_EXIT_CRITICAL();
    }
  }
}

Example (with Power Manager):

#include "sl_rail.h"
#include "sl_power_manager.h"

extern sl_rail_handle_t rail_handle;

void main(void)
{
  sl_rail_status_t status;
  bool should_sleep = false;

  // This function depends on your board/chip but it must enable the LFCLK
  // you intend to use for RTCC sync before we configure sleep as that function
  // will attempt to auto detect the clock.
  Board_Setup_LFCLK();
  // Configure sleep for timer synchronization
  sl_rail_timer_sync_config_t timer_sync_config = SL_RAIL_TIMER_SYNC_DEFAULT;
  status = sl_rail_config_sleep(rail_handle, &timer_sync_config);
  assert(status == SL_RAIL_STATUS_NO_ERROR);
  // Initialize application-level power manager service
  sl_power_manager_init();
  // Initialize RAIL library's use of the power manager
  sl_rail_init_power_manager();

  // Application main loop
  while (1) {
    // ... do normal app stuff and set should_sleep to true when we want to
    // sleep
    if (should_sleep) {
      // Let the CPU go to sleep if the system allows it.
      sl_power_manager_sleep();
    }
  }
}

RAIL APIs such as, sl_rail_start_scheduled_tx(), sl_rail_start_scheduled_rx(), sl_rail_set_timer(), sl_rail_set_multi_timer() can be used to schedule periodic wakeups to perform a scheduled operation. The call to sl_power_manager_sleep() in the main loop ensures that the device sleeps until the scheduled operation is due. Upon completion, each instantaneous or scheduled RX/TX operation will indicate radio busy to the power manager to allow the application to service the RAIL event and perform subsequent operations before going to sleep. Therefore, it is important that the application idle the radio by either calling sl_rail_idle() or sl_rail_yield_radio(). If the radio transitions to RX after an RX or TX operation, always call sl_rail_idle() in order transition to a lower sleep state. If the radio transitions to idle after an RX or TX operation, sl_rail_yield_radio() should suffice in indicating to the power manager that the radio is no longer busy and the device can sleep.

The following example shows scheduling periodic TX on getting a TX completion event:

void rail_events_callback(sl_rail_handle_t rail_handle, sl_rail_events_t events)
{
  // Omitting other event handlers
  if (events & SL_RAIL_EVENTS_TX_COMPLETION) {
    // Schedule the next TX.
    sl_rail_scheduled_tx_config_t config = {
      .when = (sl_rail_time_t)parameters->start_time,
      .mode = (sl_rail_time_mode_t)parameters->start_time_mode
    };
    (void)sl_rail_start_scheduled_tx(rail_handle, channel, 0, &config, NULL);
  }
}

Note

  • The above code assumes that RAIL automatic state transitions after TX are idle. Use sl_rail_set_tx_transitions() to ensure the right state transitions are used. Radio must be idle for the device to enter EM2 or lower energy mode.

  • When using the power manager, usage of sl_rail_yield_radio() in single protocol RAIL is similar to its usage in multiprotocol RAIL. See Yielding the Radio for more details.

  • Back to back scheduled operations do not require an explicit call to sl_rail_yield_radio() if the radio transitions to idle.

Sleep without timer synchronization:

When sleeping without timer synchronization, you are free to enable only the LFCLKs and wake sources required by the application. RAIL will not attempt to configure any wake events and may miss anything that occurs over sleep.

This is useful when your application does not care about packet time stamps or scheduling operations accurately over sleep.

Example (without Power Manager):

#include "sl_rail.h"

extern sl_rail_handle_t rail_handle;

void main(void)
{
  sl_rail_status_t status;
  bool should_sleep = false;

  // Configure sleep for no timer synchronization
  sl_rail_timer_sync_config_t timer_sync_config = {
    .sleep = SL_RAIL_SLEEP_CONFIG_TIMERSYNC_DISABLED,
  };
  status = sl_rail_config_sleep(rail_handle, &timer_sync_config);
  assert(status == SL_RAIL_STATUS_NO_ERROR);

  // Application main loop
  while(1) {
    // ... do normal app stuff and set should_sleep to true when we want to
    // sleep
    if (should_sleep) {
      bool sleep_allowed = false;
      uint32_t sleep_time = 0;

      // Go critical to assess sleep decisions
      CORE_ENTER_CRITICAL();
      if (sl_rail_sleep(0, &sleep_allowed) != SL_RAIL_STATUS_NO_ERROR) {
        printf("Error trying to go to sleep!");
        CORE_EXIT_CRITICAL();
        continue;
      }
      if (sleep_allowed) {
        // Go to sleep and optionally update sleep_time to the correct value
        // in microseconds
      }
      // Wakeup and sync the RAIL timebase back up
      sl_rail_wake(sleep_time);
      CORE_EXIT_CRITICAL();
    }
  }
}

Example (with Power Manager):

#include "sl_rail.h"
#include "sl_power_manager.h"

extern sl_rail_handle_t rail_handle;

void main(void)
{
  sl_rail_status_t status;
  bool should_sleep = false;

  // This function depends on your board/chip but it must enable the LFCLK
  // you intend to use for RTCC sync before we configure sleep as that function
  // will attempt to auto detect the clock.
  Board_Setup_LFCLK();
  // Configure sleep for no timer synchronization
  sl_rail_timer_sync_config_t timer_sync_config = {
    .sleep = SL_RAIL_SLEEP_CONFIG_TIMERSYNC_DISABLED,
  };
  status = sl_rail_config_sleep(rail_handle, &timer_sync_config);
  assert(status == SL_RAIL_STATUS_NO_ERROR);
  // Initialize application-level power manager service
  sl_power_manager_init();
  // Initialize RAIL library's use of the power manager
  sl_rail_init_power_manager();

  // Application main loop
  while(1) {
    // ... do normal app stuff and set should_sleep to true when we want to
    // sleep
    if (should_sleep) {
      // Let the CPU go to sleep if the system allows it.
      sl_power_manager_sleep();
    }
  }
}

Modules#

RAIL_TimerSyncConfig_t

sl_rail_timer_sync_config_t

EFR32xG2x

SIxx3xx

Enumerations#

enum
RAIL_SLEEP_CONFIG_TIMERSYNC_DISABLED = 0
RAIL_SLEEP_CONFIG_TIMERSYNC_ENABLED = 1
}

The configuration.

enum
SL_RAIL_SLEEP_CONFIG_TIMERSYNC_DISABLED = 0u
SL_RAIL_SLEEP_CONFIG_TIMERSYNC_ENABLED = 1u
}

The configuration.

Functions#

void
RAILCb_ConfigSleepTimerSync(RAIL_TimerSyncConfig_t *timerSyncConfig)

Configure RAIL timer synchronization.

RAIL_ConfigSleep(RAIL_Handle_t railHandle, RAIL_SleepConfig_t sleepConfig)

Initialize RAIL timer synchronization.

RAIL_ConfigSleepAlt(RAIL_Handle_t railHandle, const RAIL_TimerSyncConfig_t *syncConfig)

Initialize RAIL timer synchronization.

RAIL_Sleep(uint16_t wakeupProcessTime, bool *deepSleepAllowed)

Stop the RAIL timer(s) and prepare RAIL for sleep.

RAIL_Wake(RAIL_Time_t elapsedTime)

Wake RAIL from sleep and restart the RAIL timer(s).

Initialize RAIL Power Manager.

Stop the RAIL Power Manager.

sl_rail_config_sleep(sl_rail_handle_t rail_handle, const sl_rail_timer_sync_config_t *p_timer_sync_config)

Initialize RAIL timer synchronization.

sl_rail_sleep(uint16_t wakeup_process_time_us, bool *p_deep_sleep_allowed)

Stop the RAIL timer(s) and prepare RAIL for sleep.

sl_rail_wake(sl_rail_time_t elapsed_time_us)

Wake RAIL from sleep and restart the RAIL timer(s).

Initialize RAIL Power Manager.

Stop the RAIL Power Manager.

Macros#

#define
RAIL_TIMER_SYNC_PRS_CHANNEL_DEFAULT (255U)

Platform-agnostic value to use default PRS channel when configuring sleep.

#define
RAIL_TIMER_SYNC_RTCC_CHANNEL_DEFAULT (255U)

Platform-agnostic vlaue to use default RTCC channel when configuring sleep.

#define
RAIL_TIMER_SYNC_DEFAULT undefined

Default timer synchronization configuration.

#define
SL_RAIL_TIMER_SYNC_PRS_CHANNEL_DEFAULT (255U)

Platform-agnostic value to use default PRS channel when configuring sleep.

#define
SL_RAIL_TIMER_SYNC_RTCC_CHANNEL_DEFAULT (255U)

Platform-agnostic vlaue to use default RTCC channel when configuring sleep.

#define
SL_RAIL_TIMER_SYNC_DEFAULT undefined

Default timer synchronization configuration.

Enumeration Documentation#

RAIL_SleepConfig_t#

RAIL_SleepConfig_t

The configuration.

DeprecatedRAIL 2.x synonym of sl_rail_sleep_config_t.

Enumerator
RAIL_SLEEP_CONFIG_TIMERSYNC_DISABLED

Disable timer sync before and after sleep.

RAIL_SLEEP_CONFIG_TIMERSYNC_ENABLED

Enable timer sync before and after sleep.


sl_rail_sleep_config_t#

sl_rail_sleep_config_t

The configuration.

Enumerator
SL_RAIL_SLEEP_CONFIG_TIMERSYNC_DISABLED

Disable timer sync before and after sleep.

SL_RAIL_SLEEP_CONFIG_TIMERSYNC_ENABLED

Enable timer sync before and after sleep.


Function Documentation#

RAILCb_ConfigSleepTimerSync#

void RAILCb_ConfigSleepTimerSync (RAIL_TimerSyncConfig_t * timerSyncConfig)

Configure RAIL timer synchronization.

Parameters
TypeDirectionArgument NameDescription
RAIL_TimerSyncConfig_t *[inout]timerSyncConfig

A pointer to the RAIL_TimerSyncConfig_t structure containing the configuration parameters for timer sync. The RAIL_TimerSyncConfig_t::sleep field is ignored in this call.

This function is optional to implement.

This function is called during RAIL_ConfigSleep() to allow an application to configure the PRS and RTCC channels used for timer sync to values other than their defaults. The default channels are populated in timerSyncConfig and can be overwritten by the application. If this function is not implemented by the application, a default implementation from within the RAIL library will be used that simply maintains the default channel values in timerSyncConfig. For example:

void RAILCb_ConfigSleepTimerSync(RAIL_TimerSyncConfig_t *timerSyncConfig)
{
  timerSyncConfig->prsChannel = MY_TIMERSYNC_PRS_CHANNEL;
  timerSyncConfig->rtccChannel = MY_TIMERSYNC_RTCC_CHANNEL;
}

If an unsupported channel is selected by the application, RAIL_ConfigSleep() will return RAIL_STATUS_INVALID_PARAMETER.

DeprecatedThis RAIL 2.x callback has been eliminated in RAIL 3. Use sl_rail_config_sleep() to specify use of default or specific PRS and RTCC channels.


RAIL_ConfigSleep#

RAIL_Status_t RAIL_ConfigSleep (RAIL_Handle_t railHandle, RAIL_SleepConfig_t sleepConfig)

Initialize RAIL timer synchronization.

Parameters
TypeDirectionArgument NameDescription
RAIL_Handle_t[in]railHandle

A RAIL instance handle.

RAIL_SleepConfig_t[in]sleepConfig

A sleep configuration.

Returns

  • Status code indicating success of the function call.

Warnings

DeprecatedThis RAIL 2.x function has been replaced in RAIL 3 by sl_rail_config_sleep() with a different parameter type.


RAIL_ConfigSleepAlt#

RAIL_Status_t RAIL_ConfigSleepAlt (RAIL_Handle_t railHandle, const RAIL_TimerSyncConfig_t * syncConfig)

Initialize RAIL timer synchronization.

Parameters
TypeDirectionArgument NameDescription
RAIL_Handle_t[in]railHandle

A RAIL instance handle.

const RAIL_TimerSyncConfig_t *[in]syncConfig

A non-NULL pointer to the timer synchronization configuration.

Returns

  • Status code indicating success of the function call.

The default structure used to enable timer synchronization across sleep is RAIL_TIMER_SYNC_DEFAULT.

Warnings

DeprecatedRAIL 2.x synonym of sl_rail_config_sleep().


RAIL_Sleep#

RAIL_Status_t RAIL_Sleep (uint16_t wakeupProcessTime, bool * deepSleepAllowed)

Stop the RAIL timer(s) and prepare RAIL for sleep.

Parameters
TypeDirectionArgument NameDescription
uint16_t[in]wakeupProcessTime

Time in microseconds that the application and hardware need to recover from sleep state.

bool *[out]deepSleepAllowed

A pointer to boolean that will be set true if system can go to deep sleep or false if system must not go to deep sleep (EM2 or lower energy modes).

Returns

  • Status code indicating success of the function call.

Warnings

  • The active RAIL configuration must be idle to enable sleep.

Note

  • This API must not be called if RAIL Power Manager is initialized.

DeprecatedRAIL 2.x synonym of sl_rail_sleep().


RAIL_Wake#

RAIL_Status_t RAIL_Wake (RAIL_Time_t elapsedTime)

Wake RAIL from sleep and restart the RAIL timer(s).

Parameters
TypeDirectionArgument NameDescription
RAIL_Time_t[in]elapsedTime

Add this sleep duration in microseconds to the RAIL timer(s) before restarting it(them).

Returns

  • Status code indicating success of the function call.

If the timer sync was enabled by RAIL_ConfigSleep(), synchronize the RAIL timer(s) using an alternate timer. Otherwise, add elapsedTime to the RAIL timer(s).

Note

  • This API must not be called if RAIL Power Manager is initialized.

DeprecatedRAIL 2.x synonym of sl_rail_wake().


RAIL_InitPowerManager#

RAIL_Status_t RAIL_InitPowerManager (void )

Initialize RAIL Power Manager.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Returns

  • Status code indicating success of the function call.

Note

  • This function must be called only when the application is built and initialized with Power Manager plugin and when the radio is idle. RAIL will perform timer synchronization, upon transitioning from EM2 or lower to EM1 or higher energy mode or vice-versa, in the Power Manager EM transition callback.

Warnings

  • Since EM transition callbacks are not called in a deterministic order, it is suggested to not call any RAIL time dependent APIs in an EM transition callback.

  • As this function relies on EMU access and RAIL is meant to run in TrustZone non-secure world, it is not supported if EMU is configured as secure peripheral and it will return RAIL_STATUS_INVALID_CALL.

DeprecatedRAIL 2.x synonym of sl_rail_init_power_manager().


RAIL_DeinitPowerManager#

RAIL_Status_t RAIL_DeinitPowerManager (void )

Stop the RAIL Power Manager.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Returns

  • Status code indicating success of the function call.

Note

  • The active RAIL configuration must be idle to disable radio power manager and there should be no outstanding requirements by radio power manager.

DeprecatedRAIL 2.x synonym of sl_rail_deinit_power_manager().


sl_rail_config_sleep#

sl_rail_status_t sl_rail_config_sleep (sl_rail_handle_t rail_handle, const sl_rail_timer_sync_config_t * p_timer_sync_config)

Initialize RAIL timer synchronization.

Parameters
TypeDirectionArgument NameDescription
sl_rail_handle_t[in]rail_handle

A real RAIL instance handle.

const sl_rail_timer_sync_config_t *[in]p_timer_sync_config

A non-NULL pointer to the timer synchronization configuration.

Returns

  • Status code indicating success of the function call.

The default structure used to enable timer synchronization across sleep is SL_RAIL_TIMER_SYNC_DEFAULT.

Warnings


sl_rail_sleep#

sl_rail_status_t sl_rail_sleep (uint16_t wakeup_process_time_us, bool * p_deep_sleep_allowed)

Stop the RAIL timer(s) and prepare RAIL for sleep.

Parameters
TypeDirectionArgument NameDescription
uint16_t[in]wakeup_process_time_us

Time in microseconds that the application and hardware need to recover from sleep state.

bool *[out]p_deep_sleep_allowed

A pointer to boolean that will be set true if system can go to deep sleep or false if system must not go to deep sleep (EM2 or lower energy modes).

Returns

  • Status code indicating success of the function call.

Warnings

  • The active RAIL configuration must be idle to enable sleep.

Note

  • This API must not be called if RAIL Power Manager is initialized.


sl_rail_wake#

sl_rail_status_t sl_rail_wake (sl_rail_time_t elapsed_time_us)

Wake RAIL from sleep and restart the RAIL timer(s).

Parameters
TypeDirectionArgument NameDescription
sl_rail_time_t[in]elapsed_time_us

Add this sleep duration in microseconds to the RAIL timer(s) before restarting it(them).

Returns

  • Status code indicating success of the function call.

If the timer sync was enabled by sl_rail_config_sleep(), synchronize the RAIL timer(s) using an alternate timer. Otherwise, add elapsed_time_us to the RAIL timer(s).

Note

  • This API must not be called if RAIL Power Manager is initialized.


sl_rail_init_power_manager#

sl_rail_status_t sl_rail_init_power_manager (void )

Initialize RAIL Power Manager.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Returns

  • Status code indicating success of the function call.

Note

  • This function must be called only when the application is built and initialized with Power Manager plugin and when the radio is idle. RAIL will perform timer synchronization, upon transitioning from EM2 or lower to EM1 or higher energy mode or vice-versa, in the Power Manager EM transition callback.

Warnings

  • Since EM transition callbacks are not called in a deterministic order, it is suggested to not call any RAIL time dependent APIs in an EM transition callback.

  • As this function relies on EMU access and RAIL is meant to run in TrustZone non-secure world, it is not supported if EMU is configured as secure peripheral and it will return SL_RAIL_STATUS_INVALID_CALL.


sl_rail_deinit_power_manager#

sl_rail_status_t sl_rail_deinit_power_manager (void )

Stop the RAIL Power Manager.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Returns

  • Status code indicating success of the function call.

Note

  • The active RAIL configuration must be idle to disable radio power manager and there should be no outstanding requirements by radio power manager.