STM32F723x USB HS CoreReset Issue
Hello, for the last couple of days I've been trying to set up my STM32F723ZET6 project as a USB HS CDC device with internal PHY.
My code gets stuck in this loop
do
{
count++;
if (count > HAL_USB_TIMEOUT)
{
return HAL_TIMEOUT;
}
} while ((USBx->GRSTCTL & USB_OTG_GRSTCTL_CSRST) == USB_OTG_GRSTCTL_CSRST);
inside the function .staticHAL_StatusTypeDefUSB_CoreReset(USB_OTG_GlobalTypeDef *USBx) in the file stm32f7xx_ll_usb.c
I've been reading and it seems like a common issue. I've tried applying some solution that work for other people, although they were asking for other models of STM, Without success.
For what I read it seems to be some kind of timing or clock problem. I have no experience with USB and I don't really know much about how CUBEMX implementation works.
What I tried:
- Adding a 50ms delay before this loop
- Adding __HAL_RCC_SYSCFG_CLK_ENABLE(); to my HAL_MspInit function (Actually CUBEMX already did that)
-Adding __HAL_RCC_USB_OTG_HS_CLK_ENABLE(); to my HAL_MspInit function
- I also added both enables to the main.c file before MX_USB_DEVICE_Init(); just for trying
Some additional information:
I'll put some pictures here of various configuration and some info I think might be relevant:
Clock configuration:

Every other Mux not shown in the picture is greyed out
USB_OTG_HS config

USB_Device Config

Power management:
One of the things chatGPT suggested was about the VBUS detection. It says that it must be enabled (it may be talking about other STM32 model). I didn't find any PWR configuration in my pinout view, not under System Core neither in the categories list. I don't know if my version of STM manages that internally.
-VDD12OTGHS pin is bypassed with a 2.2uF ceramic capacitor
-OTG_HS_REXT pin is pulled down with a 3K 1% resistor
-Both VDDUSB and VDDSDMC are managed by an external TPS389033 power management IC to generate a small delay after powering VDD, as specified by the datasheet. (I also tried bypassing it). And both are bypassed with a 100nF and a 10uF ceramic capacitor.
Please ask if you need any extra information.
Thank you!
