cancel
Showing results for 
Search instead for 
Did you mean: 

USBH_GetDescriptor Failure. Incompatible USB?

ZThat
Senior

Hello,

I am having an issue connecting to specific USB mass storage devices with my STM32F769 USB host using the BSP. It seems like the USBH_GetDescriptor function never returns for USB flash sticks with a specific HID PID combination. I am considering just putting a limit on the number of retries for this call and presenting the user with a message to try a different USB. If I do go that route, it would be good to know what # of USBs are use-able with STM32F7 with the USBH BSP.

Has anyone else experienced this, and if so, how frequently?

Thanks,

Zach

1 ACCEPTED SOLUTION

Accepted Solutions

The root of all of this intermittency was that the 48MHz clock used for USB was actually running at 50MHz. Be careful when using the CubeMX example code as a starting point for an application that uses the 48 MHz clock for multiple purposes that the 48MHz clock isn't being set to 50MHz. 48 should work for both the SD card and the USB. 50 only works for the SD card.

View solution in original post

2 REPLIES 2
ZThat
Senior

I can report back that the issue is sometimes likely that the BSP masks the disconnect interrupt when handling the connection interrupt. Because of this, you can land in an endless loop in the host processing state machine where you leave off in the  HOST_DEV_WAIT_FOR_ATTACHMENT state, and then on reconnect immediately enter the enumeration state without having sent a reset command to the USB device, thereby getting no response. With no response I inserted a timeout that would reset the state machine, however, I did not know that I also needed to indicate that there was a disconnect before resetting the state machine. I thought that this would be handled by shutting off power to the USB, but I think that this combination of events leads to a mask of the disconnect interrupt. Therefore, the state machine would run right back into the waiting for attachment state in an endless loop. Simply calling the disconnect ISR callback in between re-connection attempts solves this issue.

That is the first issue I solved, the following two are less nuanced.

Some USB sticks required a long initial wait period before starting to send communication to them. These devices fall far outside of the USB specification when it comes to enumeration timing, or at least they do when connected to my host device. I ended up having to wait almost a full second before starting the enumeration sequence. After waiting a full second these devices work with no issue.

Specific USB 3.0 sticks tend to not work with my device at all and it does not seem resolve-able through software. I will sometimes receive the device descriptor back when I request it, and then later on the control request endpoint zero will stall. Other times I don't even get the device descriptor. It seems like a random breakdown of communication that likely happens because of noise. If anyone has working 3.0, please let me know if it was a struggle and how you handle noise/repeated stalls.

The root of all of this intermittency was that the 48MHz clock used for USB was actually running at 50MHz. Be careful when using the CubeMX example code as a starting point for an application that uses the 48 MHz clock for multiple purposes that the 48MHz clock isn't being set to 50MHz. 48 should work for both the SD card and the USB. 50 only works for the SD card.