2024-05-27 03:20 AM
Regarding the standby mode of the STM32WB5MMG, I have enabled only the RTC wake-up as trigger to wake up every second.
However, occasionally it freezes in standby mode, and after a watchdog reset, it doesn't even perform initialization processes.
Finally, it does not work until I manually turn the power off and on again.
Do you know any workaround for this freezing issue?
2024-05-27 03:42 AM
Hello,
can you also attach the code, where RTC is set and where MCU enters into standby mode?
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-05-27 08:16 PM
Hl_st, thank you for your reply.
First, calls the following functions as initialization of RTC
・MX_RTC_Init
・Init_Rtc
・HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, RTC_WUT_TIME, (uint32_t)CFG_RTC_WUCKSEL_DIVIDER);
The code is given below.
===============================
static void MX_RTC_Init(void)
{
/** Initialize RTC Only
*/
hrtc.Instance = RTC;
hrtc.Init.HourFormat = RTC_HOURFORMAT_24;
hrtc.Init.AsynchPrediv = CFG_RTC_ASYNCH_PRESCALER;
hrtc.Init.SynchPrediv = CFG_RTC_SYNCH_PRESCALER;
hrtc.Init.OutPut = RTC_OUTPUT_DISABLE;
hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
hrtc.Init.OutPutRemap = RTC_OUTPUT_REMAP_NONE;
if (HAL_RTC_Init(&hrtc) != HAL_OK)
{
Error_Handler();
}
/** Enable the WakeUp
*/
if (HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 0xFFFF, RTC_WAKEUPCLOCK_RTCCLK_DIV16) != HAL_OK)
{
Error_Handler();
}
}
static void Init_Rtc( void )
{
/* Disable RTC registers write protection */
LL_RTC_DisableWriteProtection(RTC);
LL_RTC_WAKEUP_SetClock(RTC, CFG_RTC_WUCKSEL_DIVIDER);
/* Enable RTC registers write protection */
LL_RTC_EnableWriteProtection(RTC);
return;
}
/* RTC_WUT_TIME is 16386U. CFG_RTC_WUCKSEL_DIVIDER is 3. */
HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, RTC_WUT_TIME, (uint32_t)CFG_RTC_WUCKSEL_DIVIDER);
===============================
Here is the code just before entering standby:
===============================
LL_PWR_EnableBkUpAccess();
/* Reset Internal Wake up flag */
LL_RTC_ClearFlag_WUT(RTC);
/* Check that PWR Internal Wake-up is enabled */
if (LL_PWR_IsEnabledInternWU() == 0U)
{
/* Need to enable the Internal Wake-up line */
LL_PWR_EnableInternWU();
}
/* Set Standby mode */
LL_PWR_SetPowerMode(LL_PWR_MODE_STANDBY);
/* Set Standby mode of CPU2 */
/* Note: On STM32WB, both CPU1 and CPU2 must be in Standby mode to set the entire system in Standby mode */
LL_C2_PWR_SetPowerMode(LL_PWR_MODE_STANDBY);
/* Retain SRAM2a */
LL_PWR_EnableSRAM2Retention();
/* Set SLEEPDEEP bit of Cortex System Control Register */
LL_LPM_EnableDeepSleep();
/* Request Wait For Interrupt */
__WFI();
===============================
2024-06-07 11:25 AM
Hi TH5
This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.
Kind Regards
Joe WILLIAMS
STMicro Support