STM32WB55RG issue with the USB VCP during CPU2 operation
Hi...Community
Hope you all are doing well
Recently, I'm dealing with the STM32WB custom hardware
In my application, i need the USB VCP logs during the BLE operation
And that's how I'm using USB CDC for the communication with the serial terminal
For me, I'm getting the debug logs at the serial terminal until the code reaches to CPU2 boot
When CPU2 comes in to the picture then, suddenly CDC logs stops due to wireless stack initialisation
After some googling, I got to know that the CPU2 uses the RNG, and that's how it's stopping the USB clock
Unfortunately Peripherals code settings not seems to be working for me as per the application note AN5289
I have attached code snippets for the Peripheral clock settings here
However, the same code generating the debug logs with the Nucleo board because of the lower version of the wireless stack on a top of it!
My custom board is running with the cube SDK version 1.11.1
void PeriphClock_Config(void) {
#if (CFG_USB_INTERFACE_ENABLE != 0)
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = { 0 };
RCC_CRSInitTypeDef RCC_CRSInitStruct = { 0 };
/**
* This prevents the CPU2 to disable the HSI48 oscillator when
* it does not use anymore the RNG IP
*/
LL_HSEM_1StepLock( HSEM, 5);
LL_RCC_HSI48_Enable();
while (!LL_RCC_HSI48_IsReady())
;
/* Select HSI48 as USB clock source */
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USB;
PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
/*Configure the clock recovery system (CRS)***********/
/* Enable CRS Clock */
__HAL_RCC_CRS_CLK_ENABLE();
/* Default Synchro Signal division factor (not divided) */
RCC_CRSInitStruct.Prescaler = RCC_CRS_SYNC_DIV1;
/* Set the SYNCSRC[1:0] bits according to CRS_Source value */
RCC_CRSInitStruct.Source = RCC_CRS_SYNC_SOURCE_USB;
/* HSI48 is synchronized with USB SOF at 1KHz rate */
RCC_CRSInitStruct.ReloadValue = RCC_CRS_RELOADVALUE_DEFAULT;
RCC_CRSInitStruct.ErrorLimitValue = RCC_CRS_ERRORLIMIT_DEFAULT;
RCC_CRSInitStruct.Polarity = RCC_CRS_SYNC_POLARITY_RISING;
/* Set the TRIM[5:0] to the default value*/
RCC_CRSInitStruct.HSI48CalibrationValue = RCC_CRS_HSI48CALIBRATION_DEFAULT;
/* Start automatic synchronization */
HAL_RCCEx_CRSConfig(&RCC_CRSInitStruct);
#endif
return;
}All suggestions and recommendations welcome :)
Thanks
Mahendra
