cancel
Showing results for 
Search instead for 
Did you mean: 

Achieving Low-Power Modes (Standby/Shutdown) with STM32WB Zigbee Application

Keyur_panchal
Visitor

Hello STM Community,

I’ve successfully implemented a Zigbee application on the STM32WB series MCU that leverages the Low Power Manager to enter Standby or Shutdown modes, as detailed in AN5289 section 4.6. The application note highlights the Low Power Manager’s ability to support up to 32 users, select the optimal low-power mode (Stop, Standby, or Shutdown), and execute callbacks during mode transitions.

In my implementation, I focused on enabling Shutdown mode to minimize power consumption after performing a Zigbee On/Off toggle command. Key points from the code:

  • Low-Power Mode Configuration: The application disables Stop mode and enables Shutdown mode using UTIL_LPM_SetOffMode(1U << CFG_LPM_APP, UTIL_LPM_ENABLE) and LL_C2_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN).

  • CPU2 Handling: As noted in AN5289, CPU2’s low-power mode is managed by the wireless firmware. I ensured the low-power mode selection is set to SHUTDOWN before starting CPU2 to allow the device to enter low-power modes even if CPU2 doesn’t start.

  • RTC Wakeup: A 30-second wakeup timer is configured using HAL_RTCEx_SetWakeUpTimer_IT to exit Shutdown mode, calculated with a 32768 Hz LSE clock divided by 16 (61440 ticks for 30 seconds).

  • Zigbee Stack Shutdown: The Zigbee stack is properly shut down using ZbShutdown before entering low-power mode to ensure a clean transition.

void APP_ZIGBEE_Shutdown(void)
{
if (zigbee_app_info.zb != NULL) {
ZbShutdown(zigbee_app_info.zb);
zigbee_app_info.zb = NULL;
APP_DBG("Zigbee stack shutdown successfully");
}

SHCI_CmdStatus_t status = SHCI_C2_RADIO_AllowLowPower(ZIGBEE_IP, 1);
if (status != SHCI_Success) {
APP_DBG("Failed to set CPU2 low power mode");
}

LL_C2_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN);
UTIL_LPM_SetStopMode(1U << CFG_LPM_APP, UTIL_LPM_DISABLE);
UTIL_LPM_SetOffMode(1U << CFG_LPM_APP, UTIL_LPM_ENABLE);

__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);

HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 61440, RTC_WAKEUPCLOCK_RTCCLK_DIV16);

HAL_PWREx_EnterSHUTDOWNMode();
}

This implementation ensures the system enters Shutdown mode efficiently, waking up every 30 seconds to resume operation. I’ve tested this setup, and it works seamlessly with the STM32WB’s Zigbee stack, achieving significant power savings.

Has anyone else implemented similar low-power strategies with the STM32WB? I’d love to hear about your experiences or any optimizations you’ve applied!

Best regards, Keyur Panchal



 

0 REPLIES 0