2021-07-29 08:11 AM
I have an application running on an STM32H745 MCU on a custom board. I'm initializing both USB ports (FS and HS) but I'm not using a HS PHY, I'm using both ports as FS.
I have an intermittent issue where either or both ports fail to initialize because the USB_CoreReset() function call times out waiting for GRSTCTL.CRST to clear.
I've seen that there have already been a couple of similar questions posted. In both cases, the issue turned out to be a misconfigured clock.
In this case (https://community.st.com/s/question/0D50X00009yH4Yc/stm32h743-usbotgfs-not-responding-to-core-reset?t=1627568262222) the issue was that the ULPI clock was being enabled when it shouldn't be. I've confirmed that I'm not enabling the ULPI clock.
In this case (https://electronics.stackexchange.com/questions/224174/stm32-usb-host-will-not-return-from-reset-request), the external oscillator was not functioning. I've confirmed that my external oscillator is producing the frequency that I expect.
I've modified both my code and the STM32H7 Eval Board CDC example to make the boot up code as similar as possible, but I don't see the same issue on the Eval Board.
One the one hand, this suggests a hardware issue. On the other hand, this initialization seems pretty strictly confined to the MCU itself. Other than the external oscillator, I'm at a loss as to how the hardware might matter.
Any ideas for things to check are appreciated.
Thanks,
Richard
2021-07-30 10:16 AM
The issue I was facing was the time between selecting the Full-Speed Embedded PHY and attempting the core reset.
My solution was to add a do-while loop that makes sure USB_OTG_GUSBCFG_PHYSEL is set before proceeding. I have no particular reason to believe that the bit being set indicates that whatever changes need to happen have propagated through the system, but it does seem to add enough of a delay to fix my issue.
2021-07-31 03:47 AM
Hi Richard,
Thanks for coming back with the solution. This is an interesting piece of information.
@Amel NASRI , can ST please comment on this?
JW