cancel
Showing results for 
Search instead for 
Did you mean: 

STM3241G-EVAL - STM32Cube_FW_F4_V1.1.0 - USB HOST MSC

jeucojeuco
Associate II
Posted on April 30, 2014 at 00:26

I have a issue when use USB Host MSC in HS mode with FreeRTOS, i have tryed different examples from STM32Cube package

USB_Host -> MSC_Standalone -> FS === OK

USB_Host -> MSC_Standalone -> HS === OK

USB_Host -> MSC_RTOS -> FS === SUCCES

USB_Host -> MSC_RTOS -> HS === ERROR ''Cannot Write on the  'USBHost.txt''

FatFs -> FatFs_USBDisk_RTOS -> FS === OK

FatFs -> FatFs_USBDisk_RTOS -> HS === Error_Handler ( f_open or f_write) Line 310

I sure there aren't hardware problem because with MSC_Standalone[HS] it work,  i have used the example downloaded from ST, no change, there are some known issues on that examples?  some bug on USB HOST lib, MSC class, FreeRTOS integration?

Need others infos for understand and solve the problem?

#stm32f4 #rtos #stm32cubef4 #hs #usb-host-msc #usbhs
5 REPLIES 5
jeucojeuco
Associate II
Posted on May 01, 2014 at 09:50

Test withproject:FatFs_USBDisk_RTOS fromSTM32Cube_FW_F4_V1.1.0

f_write() function return FR_NOT_READY the error occurs in usbh_msc.c

case MSC_REQUEST_SENSE:
scsi_status = USBH_MSC_SCSI_RequestSense(phost, lun, &MSC_Handle->unit[lun].sense);
if( scsi_status == USBH_OK)
{
USBH_UsrLog (''Sense Key : %x'', MSC_Handle->unit[lun].sense.key);
USBH_UsrLog (''Additional Sense Code : %x'', MSC_Handle->unit[lun].sense.asc);
USBH_UsrLog (''Additional Sense Code Qualifier: %x'', MSC_Handle->unit[lun].sense.ascq);
MSC_Handle->unit[lun].state = MSC_IDLE;
MSC_Handle->unit[lun].error = MSC_ERROR;
error = USBH_FAIL;
}

in log terminal:

USB Device Attached
PID: 173ch
VID: dd8h
Address (#1) assigned.
Manufacturer : USB
Product : Flash Drive
Serial Number : ff01ECBA1400FFFF0133
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:
Inquiry Vendor : USB
Inquiry Product : Flash Drive
Inquiry Version : PMAP
Mass Storage Device ready
Mass Storage Device capacity : 1852 MB
Block number : 3793631
Block Size : 512
Sense Key : 0
Additional Sense Code : 0
Additional Sense Code Qualifier: 0

I don't know why example/library downloaded from ST not work. please, some one test it with the same evaluation board and the same firmware, report if work on your side, so we understand if the problem is only mine or there are some bug in example/library.
jeucojeuco
Associate II
Posted on May 03, 2014 at 16:57

No one has answer to my problem.

I have found that there is the same problem also into ''stm32cubef4\STM32Cube_FW_F4_V1.0.0\Projects\STM324xG_EVAL\Applications\FatFs\FatFs_USBDisk'' Downloaded from here http://www.st.com/web/en/catalog/tools/PF259243 The example work well only with compiler optimization set to High-Speed (IAR-EWARM 7.3), with lower optimization the example not work (previously explained), so i think the problem is related to OTG_HS_IRQHandler timing. For test it, i had introduced interrupt latency with some ''nop''( ~100 CycleCounter ) inside OTG_HS_IRQHandler before HAL_HCD_IRQHandler(), with this ''delay'' the code hang-up also with high optimization.

void OTG_HS_IRQHandler(void)
{
asm( ''nop'' );
.....
asm( ''nop'' );
HAL_HCD_IRQHandler(&hhcd);
}

I have try to add LED output for check the timing with logic analyzer but this is enough fordestabilize the usb stack.

void OTG_HS_IRQHandler(void)
{
BSP_LED_On(LED4);
HAL_HCD_IRQHandler(&hhcd);
BSP_LED_Off(LED4);
}

It is normal that USB Host HS have a timing so critical? I need use it with FreeRTOS and many other peripherals, if only < 1 uS of latency on interrupt ISR is enough for destabilize all usb stack, the STM32F4 IC and/or STM32cube library isn't right choice for our project.
jeucojeuco
Associate II
Posted on May 07, 2014 at 18:50

no one has the same problem? has anyone tried if the firmware has bugs?

Posted on May 07, 2014 at 18:59

no one has the same problem? has anyone tried if the firmware has bugs?

Look this is a forum, that's how these things work, your participation here consists of the four posts in this thread above me, assume most other people have the same level of participation, and come here when they have problems.

I'm not using Cube, and the forum for discussing it is [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/AllItems.aspx]this other one.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on June 02, 2014 at 10:01

Hi,

We have already the limitation in the STM32CubeF4 FW bugs list, and it will be fixed in next release of F4 (early July). This limitation concerns the USBH library, and impacts only: USBH HS mode applications.

Thanks for the report.

With regards.