Edit: My goodness the ST is user friendly as always, paste this article into a text editor or something to view. It ate my first submission and I have to write allover in MS word again. Now it had ate all my line feeds. My goodness ST, can you be a bit more thoughtful and user friendly?
Hello, my custom made dev board can not enumerate a device properly. I’m running a USB HOST program, trying to enumerate an HID device, more specifically, a keyboard.
Before I getting into the “skipping function” problem, allow me to clarify a little bit my problem with the program, which I hope to give you a better picture of what’s really going on.
My program got stuck at the HOST_CTRL_XFER state, more specifically, when it goes into the USBH_HandleControl function which dictates the USB control transfer state machine, it always goes into the CTRL_SETUP_WAIT state then break out.
Now it seems it’s stuck in HOST_CTRL_XFER state forever, unable to get out.
And yes, the keyboard can be properly detected.
Then it comes the very peculiar part: a function gets skipped consistently.
The function is USBH_ParseDevDesc function. The program runs right into this function, then it does not execute this func at all, just skip it. This function is inside the USBH_Get_DevDesc function, which is a part of the enumeration process.
The whole process goes like this:
main process ->
device detected ->
begin enumeration ->
enter the enumeration state machine process ->
execute USBH_Get_DevDesc function which intends to get the device description ->
judge if descriptions were correctly received using USBH_GetDescriptor function and several lines of “if” codes -> if successful*, execute USBH_ParseDevDesc command which parse device information. And this is the part where the program runs right into this line, but does not execute this very function at all.
This is all very odd. I mean if the whole program doesn’t reach that line at all then it’s perfectly normal the fucntion isn’t being executed. But this?
I’m out of ideas. Can anyone give me any suggestions or at least, which direction to look?
*Also, based on the comment in the program, I made the guess that when the program reaches USBH_ParseDevDesc function, STM32 must have already received descriptors from the keyboard, it isn’t something that I’m sure off, I didn’t use any equipment to verify whether such transaction was successful or had taken place at all, but the comment made by ST’s programmers said it must have been.