cancel
Showing results for 
Search instead for 
Did you mean: 

USB host process gets stuck during write (read okay)

RBent.2
Associate

Within USBH_MSC_Write() the USBH_MSC_RdWrProcess(phost, lun) loops. Loop runs into the 10s timeout (see screenshot). USBH_MSC_RdWrProcess(phost, lun) still returns BUSY for this 10s period.

Status:

MSC_Handle->unit[lun].state is MSC_WRITE

MSC_Handle->hbot.cmd_state is BOT_CMD_WAIT

MSC_Handle->hbot.state is BOT_RECEIVE_CSW_WAIT

 unclear:

URB_Status = USBH_LL_GetURBState(phost, MSC_Handle->OutPipe) is USBH_URB_IDLE

Only reconnecting Thumbdrive releases system

Environment: STM32G0B0 MSC middleware 

0693W00000Stfm3QAB.png

8 REPLIES 8
NAgha.1
Associate II

Hello

I am having similar problem in MSC_Read

I have usb host application

I use different usb sticks

Most of them will get stuck in USBH_MSC_Read for atleat 300 milliseconds but some may get stuck in this loop for more than 3 or 5 seconds which is ALOT

URB state is not read = URB_NOTREADY

and it will get stuck in while loop

This blocking function would really decrease the performance of my application

JSimp.2
Associate II

Did anyone make any progress with this, as I have the same issue with an STM32F429. It doesn't always happen, but it periodically ends up hanging our system that never recovers.

Many thanks in advance.

Hello,

thanks for the follow up, I checked with my development since they somehow got rid of the problem. However, this might not be much of a help:

"Wir haben die lib teilweise neu geschrieben so das die IPC effizienter + schneller funktioniert. INT-Handler hat auch zweithöchste Prio. Problem trat immer dann auf, wenn auf Ereignisse nicht in quasi-Echzeit reagiert wurde. Ist leider andere Peripherie wie beim L4"

Any comments are appreciated.

BR Reinhard

JSimp.2
Associate II

Thank you, this at least triggers an investigation around interrupt priorities.

Regards, Jimi

rtvd
Associate II

Same here. I tried using a USB thumb drive via FATFS over USB Host on Nucleo-F722ZE's UBS FS OTG.

It spins in USBH_MSC_Process at MSC_READ_INQUIRY state. That, in turn, fails as USBH_MSC_SCSI_Inquiry always returns USBH_Busy, and that seems to happen because in USBH_MSC_BOT_Process USBH_LL_GetURBState always return USBH_URB_IDLE instead of USBH_URB_DONE when waiting for a response.

So access to FATFS via USB doesn't work and for a novice like me it is not clear what to do.

On a separate note, while USBH_MSC_Process is running, it does not let other threads progress (I am using it with FreeRTOS). Surely while interrupts must be serviced with the highest priority, the overall state machine issuing requests and waiting for their completion must not be pushing everyone aside.

If you know solution for please share here 

 

 

 

Sreekanth
Associate II

Using stm32f767zi microcontroller and sd interfaced with spi and interfacing usb_host_msc code below tutorial following its working only when i sperately using but interface with sd card with pi below issue is getting 

https://embetronicx.com/tutorials/microcontrollers/stm32/stm32-usb-host-msc-connect-pendrive-to-stm32/

Below output getting like this and stucks in MSC_Read_Inquiry

USB Device Connected.USB Device Reset Completed.PID: 5607h.VID: 3f0h.Address (#1) assigned..Manufacturer : HP.Product : v210w.Serial Number : AA00000000005026.Enumeration done..This device has only 1 configuration..Default configuration set..Switching to Interface (#0).Class : 8h.SubClass : 6h.Protocol : 50h.MSC class started..Number of supported LUN: 1.LUN #0: .  

#usb #sdcard #MSC

I have a similar issue on a STM32H7 Platform, but not stable. Sometimes the device is detected correctly and sometimes not.
If not detected USBH_LL_GetURBState returns NOTREADY or IDLE.
Is there a Solution?