STM32U595 timeout in USB_CoreReset()
I am working on a project using USB HS with:
STM32U595VJT
STM32CubeIDE 1.14.0
STM32Cube_FW_U5_V1.4.0
Using the init code, as generated by CubeMX, I was getting HAL_TIMEOUT returned by USB_CoreReset():
MX_USB_OTG_HS_PCD_Init() -> HAL_PCD_Init() -> USB_CoreInit() -> USB_CoreReset()
After looking into example applications, e.g.:
STM32Cube_FW_U5_V1.4.0/Projects/NUCLEO-U5A5ZJ-Q/Applications/USBX/Ux_Device_CDC_ACM/Core/Src/stm32u5xx_hal_msp.c
the problem turns out to be a missing call to:
__HAL_RCC_SYSCFG_CLK_ENABLE();
CubeMX code does not generate it.
The application example has it in the "USER CODE" section:
void HAL_PCD_MspInit(PCD_HandleTypeDef* hpcd)
{
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
if(hpcd->Instance==USB_OTG_HS)
{
/* USER CODE BEGIN USB_OTG_HS_MspInit 0 */
__HAL_RCC_SYSCFG_CLK_ENABLE();
/* USER CODE END USB_OTG_HS_MspInit 0 */
This seems to be specific to chips with USB HS (U595, U599, U5A5, U5A9).
As the USB is not usable without it, can this missing call be added to output code generated by CubeMX?
Thank you.
