Skip to main content
DS.4
Senior
March 17, 2024
Question

Reconfigure clocks on STM32WB55 BleHeartFreeRTOS

  • March 17, 2024
  • 1 reply
  • 962 views

 

Hello,

Curious regarding clock reconfiguration and MX_XXX_Init on wake up with STM32WB family.

I see that in the example BLE_HeartRateRTOS the clock configuration on wake up is blank!

Why is that? Doesn't in necessary to do the clock init again? this is I believe stop mode 2.

Same about MX_XXX_Init. ( UART, etc..)

 

 

Ref:

 

 

/* If the application is not running on HSE restore the clock configuration in this user section */
/* USER CODE BEGIN ExitLowPower_2 */

/* USER CODE END ExitLowPower_2 */

 

  

1 reply

STM_Thirty2
ST Employee
March 18, 2024

What version of WB firmware package are you using?
If we look at the function in its entirety below, and knowing the fact that after waking from STOP modes

the device is running on HSI the if statement handles the proper reinitialization of the clocks. The else branch could be just an extra safety procedure. None of the code puts the device in STOP Mode 2. The comments are misleading.

 

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 */
 LL_RCC_HSE_Enable( );
 __HAL_FLASH_SET_LATENCY(FLASH_LATENCY_1);
 while(!LL_RCC_HSE_IsReady( ));
 LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_HSE);
 while (LL_RCC_GetSysClkSource( ) != LL_RCC_SYS_CLKSOURCE_STATUS_HSE);
/* 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 */

/* USER CODE END ExitLowPower_2 */
 }

 /* Release RCC semaphore */
 LL_HSEM_ReleaseLock(HSEM, CFG_HW_RCC_SEMID, 0);

 return;
}
"If you feel a post has answered your question, please click ""Accept as Solution"""
DS.4
DS.4Author
Senior
March 18, 2024

I am on WB firmware commit: Release v1.16.0

So, I do understand none of above code puts the device in stop mode 2.

I basically want I to know if I need to repeat any of the init procedure on exit of sleep , 

On init procedure I mean  this part of code taken from the example main.c: 

 /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
 HAL_Init();
 /* Config code for STM32_WPAN (HSE Tuning must be done before system clock configuration) */
 MX_APPE_Config();

 /* Configure the system clock */
 SystemClock_Config();

/* Configure the peripherals common clocks */
 PeriphCommonClock_Config();

 /* IPCC initialisation */
 MX_IPCC_Init();

 /* Initialize all configured peripherals */
 MX_GPIO_Init();
 MX_DMA_Init();
 MX_RTC_Init();
 MX_RNG_Init();
 MX_RF_Init();

 /* Init code for STM32_WPAN */
 MX_APPE_Init();




 

Thanks!