cancel
Showing results for 
Search instead for 
Did you mean: 

STMF327-DISCO and ''MSC_Standalone'' example don't work (Bug in USBH MSC lib v3.2.1)?

crt
Associate II
Posted on July 15, 2015 at 14:22

Hello,

during the last two days I am trying to run the ''MSC_Standalone'' example application from Cube F7 1.1 HAL packege on STM32F7-Discovery using latest IAR compiler (7.40.3). The application is is quite simple (read/write and list files from USB Flash drive), but I didn't manage to get it working.

Based on the information on the display it seems that the enumeration and MSC part pass fine (Serial number detected, number of supported LUNs = 1, vendor = Generic, class = 0x08, ...). However, the example fails later on during first occurrence of f_write or f_read with FR_INVALID_OBJECTS error code. During debugging I have found out that MSC_Handle is left cycling in in MSC_IDLE state with error MSC_NOT_READY. If I change the error state into MSC_OK the FatFS starts working (reading, writting, listing files) just fine. Could this be a bug somewhere in USBH_MSC_Process function?

I have also tried the FreeRTOS flavor of the same example from the same HAL release, but the problem is the same. I have also tried several different USB Flash drives, but with no luck. The problem seems similar to

/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM3241G-EVAL%20-%20STM32Cube_FW_F4_V1.1.0%20-%20USB%20HOST%20MSC&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=585

, but this should be solved long time ago. I have also tried various optimization parameters (like described in previous post) but the result is the same. 

Has somebody tried the MSC host examples for STM32F7-DISCO?

Thanks, ÄŒrt

null
2 REPLIES 2
crt
Associate II
Posted on July 24, 2015 at 13:36

I believe I have found the bug in the latest USBH (v2.3.1) library which was causing the problems described in the previous post. The problem lies in usbh_msc.c line 446 which has been changed.

WRONG (v2.3.1)

if((phost->Timer - MSC_Handle->timer) > 10000)

CORRECT

if((phost->Timer - MSC_Handle->timer) < 10000)

Amel NASRI
ST Employee
Posted on July 29, 2015 at 15:59

Hi gorup.crt,

Thanks for highlighting this issue.

It is a known bug, but the fix has not yet been released on the web. 

It will be available in next packages of STM32CubeF4 (V1.8.0) and STM32CubeF7 (V1.2.0).

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.