2025-05-28 9:24 AM
In my project STM32WB55 uC is used and FW is generated by STM32CubeMX.
Library (STM32Cube_FW_WB_V1.22.0) and BLE binary (stm32wb5x_BLE_Stack_full_fw.bin) are both version 1.20.
My goal is to reboot only BLE stack on CPU2 without reset of CPU1.
On community it is written in several places that aci_hal_stack_reset(or hci_reset?) can perform reset of the stack, but that it is necessary to do again full initialization of BLE stack: SHCI_C2_BLE_Init (or SHCI_C2_BLE_Reinit?), aci_gatt_init...
I tried several ways to do that, but I was not successful. For example in debug some combinations of this functions works, but as soon I utilize Low Power mode, BLE will not start!
Also I did not found any example code and/or exact procedure how to do that!
Does someone know how exactly BLE reset is done and later reinitialized (documentation or source code)?
Solved! Go to Solution.
2025-06-05 12:52 AM
Hello,
please have a look at BLE_HeartRate_PLL example which uses PLL.
Also, as I mentioned before, the switching algorithm between HSE and PLL is described in AN5289.
Best regards,
Filip Kremen
2025-05-29 12:04 AM
Hello,
can you please share more information about your project?
Also, please have a look at this topic from community.
Solved: Re: Turning BLE on and off in STM32WB55 - STMicroelectronics Community
Best regards,
Filip Kremen
2025-06-03 2:18 AM
Hello,
Thank you for the answer.
I have two use cases:
I already tried in case of startup the same thing which was written in your topic (later call of appe_Tl_Init function) and it works only if:
#define CFG_LPM_SUPPORTED 0
It looks for me that it is not possible to go into Low Power mode if BLE stack is not initialized? Is this true?
I also read some different description of reset procedure in other topic:
STM32WB BLE advertising stops after exiting standby mode
Unfortunately description is pretty vague, so I tried different combination, but it did not work...
Do you have some other ideas?
Kind regards
Strahinja
2025-06-03 4:43 AM
Hello,
you can enter low power mode, even though the BLE stack is not initialized.
Please have a look here. The sequencer automatically enters low power mode when there is no active task.
How to build wireless applications with STM32WB MCUs - Application note
Would it be possible to share your project or any code snippet?
Thank you.
Best regards,
ST support
2025-06-03 5:07 AM
Hello,
I already familiar with AN 5829.
I made 2 funcitions in app_entry.c
/* USER CODE BEGIN FD_WRAP_FUNCTIONS */
void APPE_HW_Init( void )
{
// System initialization - System_Init();
Init_Smps();
Init_Exti();
Init_Rtc();
// Configure the system Power Mode
SystemPower_Config();
// Initialize the TimerServer
HW_TS_Init( hw_ts_InitMode_Full, &hrtc );
// UART initialization for debug trace
APPD_Init();
UTIL_LPM_SetOffMode( 1U << CFG_LPM_APP, UTIL_LPM_DISABLE );
}
void APPE_BLE_Init( void )
{
appe_Tl_Init(); // Initialize all transport layers
}
/* USER CODE END FD_WRAP_FUNCTIONS */
APPE_HW_Init is called at the beginning instead of MX_APPE_Init and timer is generated for 20 seconds.
UTIL_LPM_SetOffMode is also added because I noticed that FW is not going into Low Power mode.
After 20 seconds, timer is starting the task where APPE_BLE_Init is called and in Custom_APP_Init (called in APP_BLE_Init from custom_app.c file) BLE advertisement is started.
I do not see the problem here, but nevertheless, this works only in Debug where no Low Power mode is enabled.
Kind regards
Strahinja
2025-06-03 6:38 AM
2025-06-04 4:22 AM
Hello,
I analyzed your example and compared to my project.
We are using the same principle (call only appe_Tl_Init function or call it with SHCI_C2_Reinit), but my FW is always stuck in hci_reset.
What I saw is that main difference between our projects are CLKs. Your project is using HSE (32 MHz) and I am using PLL (64 MHz).
My FW is working if I utilize HSE and ExitLowPower also uses HSE (in stm32_lpm_if.c) in after wake up, but I need PLL (higher frequency).
Can CLKs produce such a problem? I was using my current configuration and BLE was working without any problem (for example wake un on every advertisement event...)!
Is there any way to do proper wake up and initialization of PLLs.
Bellow you can find my example code:
/**
* @brief Restore the system to exit stop mode
* @PAram none
* @retval none
*/
static void ExitLowPower(void)
{
/* Release ENTRY_STOP_MODE semaphore */
LL_HSEM_ReleaseLock(HSEM, CFG_HW_ENTRY_STOP_MODE_SEMID, 0);
while(LL_HSEM_1StepLock(HSEM, CFG_HW_RCC_SEMID));
if(LL_RCC_GetSysClkSource() == LL_RCC_SYS_CLKSOURCE_STATUS_HSI)
{
/* Restore the clock configuration of the application in this user section */
/* USER CODE BEGIN ExitLowPower_1 */
Switch_On_PLL();
/* USER CODE END ExitLowPower_1 */
}
else
{
/* If the application is not running on HSE restore the clock configuration in this user section */
/* USER CODE BEGIN ExitLowPower_2 */
Switch_On_PLL();
/* USER CODE END ExitLowPower_2 */
}
/* Release RCC semaphore */
LL_HSEM_ReleaseLock(HSEM, CFG_HW_RCC_SEMID, 0);
return;
}
/* USER CODE BEGIN Private_Functions */
/**
* @brief Switch the system clock on PLL
* @PAram none
* @retval none
*
* @note HSE and PLL or only PLL will be activated depending on current system clock
*/
static void Switch_On_PLL( void )
{
switch( LL_RCC_GetSysClkSource() )
{
case LL_RCC_SYS_CLKSOURCE_STATUS_HSI: // Enable HSE
LL_RCC_HSE_Enable();
__HAL_FLASH_SET_LATENCY( FLASH_LATENCY_1 );
while( !LL_RCC_HSE_IsReady() );
LL_RCC_SetSMPSClockSource( LL_RCC_SMPS_CLKSOURCE_HSE );
// Continue PLL after HSE is ready
case LL_RCC_SYS_CLKSOURCE_STATUS_HSE: // Enable PLL
LL_RCC_PLL_Enable();
LL_RCC_PLL_EnableDomain_SYS();
while( !LL_RCC_PLL_IsReady() );
LL_RCC_SetSysClkSource( LL_RCC_SYS_CLKSOURCE_PLL );
while( LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL );
break;
default:
break;
}
}
/* USER CODE END Private_Functions */
Kind regards
Strahinja
2025-06-05 12:52 AM
Hello,
please have a look at BLE_HeartRate_PLL example which uses PLL.
Also, as I mentioned before, the switching algorithm between HSE and PLL is described in AN5289.
Best regards,
Filip Kremen