2013-08-14 08:47 AM
Hello,
I'm using the STM USB library version V2.1.0 with an host profile and I found a problem working with some usb keys: the library was going up to enumeration but after if was hanging. Debugging the problem I finally got that the problem was in usbh_core.c in function USBH_HandleControl at case CTRL_DATA_IN_WAIT. If after sending a request in the previous case, CTRL_DATA_IN, I got a Stall irq in HCINT the library was hanging without trying again with another request. I solved the problem adding a ''phost->Control.state = CTRL_STALLED;'' in the if (URB_Status == URB_STALL) case CTRL_DATA_IN_WAIT: URB_Status = HCD_GetURB_State(pdev , phost->Control.hc_num_in); /* check is DATA packet transfered successfully */ if (URB_Status == URB_DONE) { phost->Control.state = CTRL_STATUS_OUT; } /* manage error cases*/ if (URB_Status == URB_STALL) { /* In stall case, return to previous machine state*/ phost->gState = phost->gStateBkp; phost->Control.state = CTRL_STALLED; ///<<<<< MY MODIFICATION } else if (URB_Status == URB_ERROR) { /* Device error */ phost->Control.state = CTRL_ERROR; } else if ((HCD_GetCurrentFrame(pdev)- phost->Control.timer) > timeout) { /* timeout for IN transfer */ phost->Control.state = CTRL_ERROR; } break; Debugging the code I noticed in fact that it was going back to the previous state machine but not starting form its initial case but going directly in a case in the middle of the state machine. I would like to have your feedback if my modification has any sense for you and if yes I would suggest to add it in the next release of the library. With this modification now it works with all the usb key I found around in my collegues desks (10 different types). thanks michele #usb-msc-stm32-hang2013-08-23 11:42 PM
2014-01-25 06:28 PM
Hello Michele,
thanks a lot for your post! I can confirm that your modification worked for me too. I was trying with the USB Host Device demo (DRD) but I also got stuck in that state machine that hangs. I do not know USB very well so I couldn't find the cause of the hanging. I applied your modification and the demo worked. I was struggling with this for a week!Maybe is something related with the revision Z chip error as stated in this post:https://my.st.com/6e645738I am using a custom board based on a STM32F107VC (rev. Z) with Coocox IDE (ARM GCC compiler 4.7).Best regards!Miguel