AnsweredAssumed Answered

USB host stall

Question asked by epifania.vito on Apr 29, 2015
Latest reply on May 16, 2017 by srinivas reddy
I'm trying to interface an USB barcode with discovery board F407. I'm using CubeMX 4.7 and keyboard example as starting point from Cube USB HOST library.

With some keyboards and usb wireless presenters (logitech) everything works, but with other keyboards and with barcode readers the USB library recognizes the device but then enter in stall. In particular in the case CTRL_DATA_IN_WAIT of function USBH_HandleControl in file usbh_ctlreq.c:

    URB_Status = USBH_LL_GetURBState(phost , phost->Control.pipe_in);
    /* check is DATA packet transferred successfully */
    if  (URB_Status == USBH_URB_DONE)
      phost->Control.state = CTRL_STATUS_OUT;
    /* manage error cases*/
    if  (URB_Status == USBH_URB_STALL)
      /* In stall case, return to previous machine state*/
      status = USBH_NOT_SUPPORTED;


    else if (URB_Status == USBH_URB_ERROR)
      /* Device error */
      phost->Control.state = CTRL_ERROR;  

Seems that the code, in case of stall, does not return to previous machine state as stated in the above comment (and so skip the URB packet not recognized) but remains in this loop forever.

This is the same situation from this old post:

but the suggested modification does not work for me.

I'm open to advice to move on
Thanks in advance