2020-05-25 01:18 PM
Hello,
I am trying to use the USB HS interface of the STM32F730Z8 but I can't get it to work. I am doing this on a PCB I designed.
I am using the latest version of STM32CubeIDE and I configured the interface with the CubeMX integrated in the IDE. I selected the Device_Only option and in the Middleware I tried to set the USB_DEVICE class for HS to HID and CDC. Nothing was working. I have the external 24 MHz crystal enabled. The windows device manager doesn't show anything (not even a non functional device).
I didn't change any of the generated code and I only added blinking of the LEDs (using HAL functions) to help with debugging.
I also have the USB FS interface connected (to a different connector of course) and the HID interface seems to be working (it does enumerate) but the CDC interface is not working (I think a driver problem as there are no drivers for windows 10).
The MCU is functional (currently only blinking LEDs) the problem is only with the USB HS interface.
I don't have a debugger connected to it but with the help of LEDs I managed to hopefully narrow the problematic part.
The following function seems to be the problem:
static HAL_StatusTypeDef USB_HS_PHYCInit(USB_OTG_GlobalTypeDef *USBx)
{
UNUSED(USBx);
uint32_t count = 0U;
/* Enable LDO */
USB_HS_PHYC->USB_HS_PHYC_LDO |= USB_HS_PHYC_LDO_ENABLE;
/* wait for LDO Ready */
while ((USB_HS_PHYC->USB_HS_PHYC_LDO & USB_HS_PHYC_LDO_STATUS) == 0U)
{
if (++count > 200000U)
{
HAL_GPIO_WritePin(STATUS_LED_4_GPIO_Port, STATUS_LED_4_Pin, GPIO_PIN_SET);
return HAL_TIMEOUT;
}
}
From the status of LEDs it seems to me like this function returns HAL_TIMEOUT. This will make it jump to error handler. However the LEDs I have blinking in the main loop are still blinking so the MCU is functioning as expected only the USB HS interface is not working (it isn't even detected in windows).
I am only missing an additional 1 uF capacitor on the VDDUSB (I only have one 100 nF on that pin). I have the 3k 1% resistor on pin 75. And since the FS interface is working I think the missing capacitor shouldn't be a problem. Also the FS and HS interfaces are almost identical except the USB connector so the connection part should also be ok.
How can I solve this problem. From the function it seems to me that there is a problem with the LDO but I don't know how to solve this.
Kind regards,
Jure
2020-06-16 04:28 AM
I will answer this in case anyone will have the same problem. The USB HS PHY (APB2 bit 31) clock was not enabled. I resolved this with the help of ST and hopefully this will be fixed in one of the next updates.