Skip to main content
Graduate II
January 12, 2025
Question

USB read failing in standard 32H743 USB MSC with 16GB pen drive

  • January 12, 2025
  • 2 replies
  • 999 views

A BOT protocol read fail error is occurring in usbh_msc.bot.c:- See "*** MY MOD-" below

USBH_StatusTypeDef USBH_MSC_BOT_Process (USBH_HandleTypeDef *phost, uint8_t lun)
{
...

else if (URB_Status == USBH_URB_STALL)

{

/* This is Data IN Stage STALL Condition */

MSC_Handle->hbot.state = BOT_ERROR_IN;



/* Refer to USB Mass-Storage Class : BOT (www.usb.org)

6.7.2 Host expects to receive data from the device

3. On a STALL condition receiving data, then:

The host shall accept the data received.

The host shall clear the Bulk-In pipe.

4. The host shall attempt to receive a CSW.*/



#if (USBH_USE_OS == 1)

osMessagePut ( phost->os_event, USBH_URB_EVENT, 0);

#endif

}

else if (URB_Status == USBH_URB_ERROR) // *** MY MOD- *** added as getting error here!

{

/* This is Data IN Stage ERROR Condition */

MSC_Handle->hbot.state = BOT_ERROR_IN; // tried this but no change

}

break;



case BOT_DATA_OUT:
...

 

    This topic has been closed for replies.

    2 replies

    Technical Moderator
    January 15, 2025

    Hi @Robmar 

    Would you share an example to reproduce the read failure? After all, thank you for highlighting this error handling.  An internal ticket 200414 is submitted to the dedicated team. 

    Technical Moderator
    September 30, 2025

    Hi @Robmar 

    Reviewing the code the actual implementation is correct as the part you are highlighting is managed in BOT_ERROR_IN case

     case BOT_ERROR_IN:
     error = USBH_MSC_BOT_Abort(phost, lun, BOT_DIR_IN);
    
     if (error == USBH_OK)
     {
     MSC_Handle->hbot.state = BOT_RECEIVE_CSW;
     }
     else if (error == USBH_UNRECOVERED_ERROR)
     {
     /* This means that there is a STALL Error limit, Do Reset Recovery */
     MSC_Handle->hbot.state = BOT_UNRECOVERED_ERROR;