Associate III
April 16, 2026
Question
STM32H7RS USB USB_OTG_HS PCD_SPEED_FULL as CDC Device: Enumeration Fails, Trace shows Stalls
- April 16, 2026
- 3 replies
- 237 views
Hello,
On a STM32H7RS are using the USB_OTG_HS peripheral in PCD_SPEED_FULL mode using internal clock.
After I was able to configure the clock so that the MCU is responding on enumeration requests. The responses however seem to be partially incorrect; the trace tool shows stalls.
I did not found an example in current https://github.com/STMicroelectronics/STM32CubeH7RS
The following changes are applied to a CubeMX generated project
main.c SystemClock_Config:
LL3.PLLN was set to output 24 MHz
RCC_OscInitStruct.PLL3.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL3.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL3.PLLM = 4;
RCC_OscInitStruct.PLL3.PLLN = 60;
RCC_OscInitStruct.PLL3.PLLP = 2;
RCC_OscInitStruct.PLL3.PLLQ = 40;
RCC_OscInitStruct.PLL3.PLLR = 16;
RCC_OscInitStruct.PLL3.PLLS = 2;
RCC_OscInitStruct.PLL3.PLLT = 2;Configure CRS
__HAL_RCC_CRS_CLK_ENABLE();
RCC_CRSInitTypeDef RCC_CRSInitStruct = {0};
RCC_CRSInitStruct.Prescaler = RCC_CRS_SYNC_DIV1; // default
RCC_CRSInitStruct.Source = RCC_CRS_SYNC_SOURCE_USB_OTG_HS; //RCC_CRS_SYNC_SOURCE_USB_OTG_FS;
RCC_CRSInitStruct.Polarity = RCC_CRS_SYNC_POLARITY_RISING;
RCC_CRSInitStruct.ReloadValue = __HAL_RCC_CRS_RELOADVALUE_CALCULATE(48000000,1000); // RCC_CRS_RELOADVALUE_DEFAULT = 0x0000BB7FU
RCC_CRSInitStruct.ErrorLimitValue = 34; // = RCC_CRS_ERRORLIMIT_DEFAULT
RCC_CRSInitStruct.HSI48CalibrationValue = 32; // = RCC_CRS_HSI48CALIBRATION_DEFAULT
HAL_RCCEx_CRSConfig(&RCC_CRSInitStruct);usbd_conf.c
void HAL_PCD_MspInit(PCD_HandleTypeDef* pcdHandle)
{
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
if(pcdHandle->Instance==USB_OTG_HS)
{
/* USER CODE BEGIN USB_OTG_FS_MspInit 0 */
/* USER CODE END USB_OTG_FS_MspInit 0 */
/** Initializes the peripherals clock
*/
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USBPHYC;
PeriphClkInit.UsbPhycClockSelection = RCC_USBPHYCCLKSOURCE_PLL3Q;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{
Error_Handler();
}
/** Enable USB Voltage detector
*/
if(HAL_PWREx_EnableUSBVoltageDetector() != HAL_OK)
Error_Handler();
HAL_PWREx_EnableUSBHSregulator();
/* Peripheral clock enable */
__HAL_RCC_USB_OTG_HS_CLK_ENABLE();
__HAL_RCC_USBPHYC_CLK_ENABLE();
/* Peripheral interrupt init */
HAL_NVIC_SetPriority(OTG_HS_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(OTG_HS_IRQn);
/* USER CODE BEGIN USB_OTG_FS_MspInit 1 */
/* USER CODE END USB_OTG_FS_MspInit 1 */
}
}I checked the following related posts
STM32H7R3 USB FS device enumeration problem | Community
What is missing/wrong in my configuration?
Many thanks for any help.
