STM32WB BLE advertising stops after exiting standby mode.
Hello,
I am currently on the (official) example application of BLE_p2pServer from STM32Cube_FW_WB_V1.0.0. I am trying to make it work with standby mode and I disabled the advertising timeout for this particular test.
BLE is still advertising when in standby mode (before waking up). But it stops after waking up.
EDIT: BLE actually stops advertising as soon as it enter standby mode.
if( (__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)
&& (__HAL_PWR_GET_FLAG(PWR_FLAG_C2SB) != RESET)
)
{
/* Clear Standby flag */
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_C2SB);
}
else {
MX_RTC_Init();
APPE_Init();
}From the code, i didnt reinitialize RTC and BLE after exiting standby mode as i thought the microcontroller starts from RESET after exiting standby mode.
The microcontroller will enter standby mode when the SCH_Idle() function is called.
void SCH_Idle( void )
{
#if ( CFG_LPM_SUPPORTED == 1)
LL_C2_PWR_SetPowerMode(LL_PWR_MODE_STANDBY);
HAL_PWREx_EnableSRAMRetention();
HAL_PWR_EnterSTANDBYMode();
Error_Handler();
#endif
return;
}Where do you think I went wrong? Thanks for the reply and help.
P/s: For now, I just use the NRST pin to wake up from standby. It is because when I use the RTC wakeup, I got some weird event where the microcontroller didnt enter standby mode again after exiting standby mode for the first time and went to the while loop in Error_Handler(). I didnt look deeper for this event yet. will post a question when I think I know where the error come from.
