2014-04-29 03:26 PM
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 === OKUSB_Host -> MSC_Standalone -> HS === OKUSB_Host -> MSC_RTOS -> FS === SUCCESUSB_Host -> MSC_RTOS -> HS === ERROR ''Cannot Write on the 'USBHost.txt''FatFs -> FatFs_USBDisk_RTOS -> FS === OKFatFs -> FatFs_USBDisk_RTOS -> HS === Error_Handler ( f_open or f_write) Line 310I 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 #usbhs2014-05-01 12:50 AM
Test withproject:FatFs_USBDisk_RTOS fromSTM32Cube_FW_F4_V1.1.0
f_write() function return FR_NOT_READY the error occurs in usbh_msc.ccase 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.
2014-05-03 07:57 AM
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.
2014-05-07 09:50 AM
2014-05-07 09:59 AM
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.2014-06-02 01:01 AM
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.