cancel
Showing results for 
Search instead for 
Did you mean: 

HS in FS Unclear Functionality While Troubleshooting Issues

ZThat
Senior

All,

I am using an STM32F769 chip as a USB MSC Host. The device is fully functional with certain USB sticks, but not with others (typically works with 2.0 but has a range of issues with 3.0). Specifically, I am seeing that if I control the VBUS line via FET, and I plug in a USB 3.0 before enabling VBUS, then enable VBUS, I will get repeated USB interrupts, which lead to an attempt to connect to a device, but get no response from the USB device. However, if I have the FET providing power before I plug in the USB stick, the connection happens no problem. These repeated interrupts are very interesting, because they will continue even if I disconnect the USB stick. They will continue until I reconfigure the USB peripheral entirely, at which point previously functional USB sticks fail to function as well, until I cycle power. I can see that the DP input goes low when I cut power to VBUS_USB, so these interrupts are not because it detects a device.

My leads:

I am using the CubeMX example code for how to use the HS lines in FS mode, and I can see that it uses a few pins in alternate functions that don't exist as far as the datasheet is concerned. This can be seen in the following block of code.

  /* Configure GPIO for HS in FS mode */

  GPIO_InitStruct.Pin = GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 |GPIO_PIN_15;

  GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

  GPIO_InitStruct.Pull = GPIO_NOPULL;

  GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;

  GPIO_InitStruct.Alternate = GPIO_AF12_OTG_HS_FS;

  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

Pin 12 has the alternate function of the ID pin, but I am setting myself as always being the host, so that doesn't matter to me. Pin 13 is strange, because the datasheet says that it has the "additional function" of hooking up to USB_VBUS_HS, but does not say that this function is utilized with alternate function 12, or how it is utilized at all. Either way, I have it hooked up to VBUS_USB, so there shouldn't be any issue. BUT, when I don't configure it as alternate function 12, I somehow get all of the same functionality (can use USB 2.0 and sometimes 3.0). So clearly I am not using that line as was originally intended, because it makes no difference. So it would be great to know what it was originally intended for.

My other lead is the fact that I have external pull downs on the DP and DN lines. I know that these are unnecessary and I will be testing without them later today.

Does anyone else have experience with HS in FS mode and understand the functionality of PB13? Also, has anyone else experienced these issues with USB 3.0 when controlling the power FET? To clarify, other USB 3.0 devices fail to work altogether, and others always work. And I know that whenever they are not working, it is because they are not responding to the host's attempts to communicate.

Thanks

2 REPLIES 2
Pavel A.
Evangelist III

About functionality of PB13 - please see here:

https://community.st.com/s/article/FAQ-Management-of-VBUS-sensing-for-USB-device-design

If your device is bus powered, VBUS sense is optional and can be disabled (set the pin as floating input, not as AF).

-- pa

​Thanks Pavel,

Good to know. I did not have vbus sensing enabled, so I disabled that pin.

I configure the hhcd structure as follows

 /* Set the LL driver parameters */

 hhcd.Instance = USB_OTG_HS;

 hhcd.Init.Host_channels = 11;

 hhcd.Init.dma_enable = 0;

 hhcd.Init.low_power_enable = 0;

 hhcd.Init.phy_itface = HCD_PHY_EMBEDDED;

 hhcd.Init.Sof_enable = 0;

 hhcd.Init.speed = HCD_SPEED_HIGH;

 hhcd.Init.vbus_sensing_enable = 0;

 hhcd.Init.use_external_vbus = 0;

 hhcd.Init.lpm_enable = 0;

I have since removed the pull down resistors and see no difference in performance.

This leaves me believing that you simply cannot host certain USB 3.0 MSC devices with this chip.