2021-08-08 05:40 AM
Hello.
I am in the process of power on my custom board.
Right now I'm trying to get the USB to work but I'm stuck and don't know what to do next.
I use USB midleware from CubeMX 6.1.2
The moment I have everything configured and run the interrupts I get the one interrupt with flags:
USB_OTG_GINTSTS_USBRST and USB_OTG_GINTSTS_USBSUSP.
While handling the suspend handler my micro controller is restarting
(The restart is caused by operation: __HAL_PCD_GATE_PHYCLOCK(hpcd) in usb suspend handler)
I checked the voltages and waveforms of crystal lines and ulpi clk line and everything seems to be ok.
Here is the USB3300 wiring diagram:
Thanks
Piotr
Solved! Go to Solution.
2021-08-18 12:19 PM
Someone already stated on this forum that if something went wrong with USB330 it was HW's fault . I tested 4 USB3300 controllers and only the 4th one worked.
Solved!
2021-08-08 07:42 AM
What do the RCC_CSR flags say is the source of the reset? Note that you need to clear them after reading them during startup as they will persist.
2021-08-08 08:51 AM
[For code below], after reset caused by suspend handler, only flag RCC_FLAG_PINRST is set.
if (__HAL_PWR_GET_FLAG(PWR_FLAG_SB))
pr_debug("System resumed from STANDBY mode");
if (__HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST))
pr_debug("Software Reset");
if (__HAL_RCC_GET_FLAG(RCC_FLAG_PORRST))
pr_debug("Power - On - Reset");
if (__HAL_RCC_GET_FLAG(RCC_FLAG_PINRST))
pr_debug("External Pin Reset");
if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDG1RST) != RESET)
pr_debug("Watchdog Reset");
if (__HAL_RCC_GET_FLAG(RCC_FLAG_WWDG1RST) != RESET)
pr_debug("Window Watchdog Reset");
if (__HAL_RCC_GET_FLAG(RCC_FLAG_LPWR1RST) != RESET)
pr_debug("Low Power Reset");
if (__HAL_RCC_GET_FLAG(RCC_FLAG_BORRST) != RESET)
pr_debug("Brown - Out Reset");
__HAL_RCC_CLEAR_RESET_FLAGS();
2021-08-08 09:13 AM
The code in question stops the clock being sent to the USB chip.
I don't see how stopping the clock would end up resetting your chip.
How is your NRST wired? Do you have a 0.1uF cap on it? Maybe using a scope on the NRST signal would prove insightful. Not really sure what it could be.
2021-08-08 09:44 AM
This is what the NRST line looks like
Keep in mind that the uC restarts in a loop. Those longer pauses were when I pressed the reset button.
I have a 10nF capacitor there:
2021-08-08 10:41 AM
I changed the condenser at reset to 0.1uF - no change seen.
As for the interrupt: While I understand the reset flag, is this suspend flag normal ?
2021-08-09 12:52 AM
One more thing wonders me. How can I check if everything is ok with ext phy USB3300?
As far as I know that the uC is ok because I can communicate with it, how can I check it for USB3300. Can I use the uC to try to read some USB3300 registers or something?
2021-08-18 12:19 PM
Someone already stated on this forum that if something went wrong with USB330 it was HW's fault . I tested 4 USB3300 controllers and only the 4th one worked.
Solved!