cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407 USB FS (MSC). Write hangs on USB flash drive

djantoxa
Associate
Posted on December 07, 2012 at 20:29

Hello! I am develop data aquisition system project on STM32F407. USB flash drive connected to USB host (OTG FS). Project based on sample from stm32_f105-07_f2_f4_usb-host-device_lib.zip. Ide is CooCox 1.6.0.

Data writes to drive by blocks 32kB each 300 ms.

After 3-11 writes to drives program hangs on next code:

file: usbh_msc_bot.c

void USBH_MSC_HandleBOTXfer (USB_OTG_CORE_HANDLE *pdev ,USBH_HOST *phost)

{

....

 case USBH_MSC_DECODE_CSW:

      URB_Status = HCD_GetURB_State(pdev , MSC_Machine.hc_num_in);

      /* Decode CSW */

      if(URB_Status == URB_DONE)

      {

        BOTStallErrorCount = 0;

        USBH_MSC_BOTXferParam.BOTStateBkp = USBH_MSC_RECEIVE_CSW_STATE;

        

        USBH_MSC_BOTXferParam.MSCState = USBH_MSC_BOTXferParam.MSCStateCurrent ;

        

        USBH_MSC_BOTXferParam.BOTXferStatus = USBH_MSC_DecodeCSW(pdev , phost);

      }

      else if(URB_Status == URB_STALL)     

      {

        error_direction = USBH_MSC_DIR_IN;

        USBH_MSC_BOTXferParam.BOTState  = USBH_MSC_BOT_ERROR_IN;

      }

HCD_GetURB_State(...) return URB_Status = URB_IDLE, which is not processed.

Is it USB Flash drive error? How can I solve the problem?

#stm32-usb-msc
1 REPLY 1
djantoxa
Associate
Posted on December 10, 2012 at 13:52

I tried USB HS with embedded PHY on STM32F4. Also I tried 3 types of USB flash drives.

Program still hangs on after 3-11 writes on drive.