2020-01-08 05:51 AM
I use STM32746G-Discovery to learn usb msc.
I copied STM32Cube_FW_F7_V1.15.0\Projects\STM32746G-Discovery\Applications\USB_Device\MSC_Standalone and it works fine.
but when i use Freertos to drive msc, the PC popup a dialog that the device can't be recognized.
the attachment is the files my project use.
I almost changed nothing,just use a thread to call line below:
I think the interrupter priority may be the cause.
USBD_Init(&usbd_device,&MSC_Desc,0);
USBD_RegisterClass(&usbd_device,USBD_MSC_CLASS);
USBD_MSC_RegisterStorage(&usbd_device,&USBD_DISK_fops);
USBD_Start(&usbd_device);
2020-01-08 06:11 AM
Definitely situations where you can't yield to other threads. Would check interrupt, SDMMC transfers and malloc/free
Instrument code so you can understand the realtime interactions
2020-01-08 07:35 AM
I check the STM32Cube_FW_F4_V1.24.2\Projects\STM324x9I_EVAL\Demonstrations\STemWin\MB1046 demo, but not find anything useful.
i think i must missing something, but i really don't know.
2020-01-08 11:05 AM
The STM32 USB driver has lots of hardcoded delays that might confuse RTOS.
2020-01-08 02:43 PM
To be fair, it's the other way around - ST's USB driver ir the one, which is "confused" (i.e. incorrect) with RTOS.
2020-01-08 03:59 PM
yes,but actually,official board like F412 discovery or 4x9i_eval use the lib。so it should be able to transplant to any st mcus。
2020-01-08 04:02 PM
i think the matter should be there is no any docs to guide how to transplant the lib。
2020-01-08 11:59 PM
Hi. I think you have problem with interrupt priorities. All USB actions perform in interrupt handler HAL_PCD_IRQHandler. First, ST USB driver call HAL_Delay, so interrupt priority of delay timer must be higher then USBs. Second, if you use BSP_SD_ReadBlocks_DMA/BSP_SD_WriteBlocks_DMA, DMA and SDMMC interrupt priorities must be higher. Try to use functions with simple polling (like BSP_SD_ReadBlocks).
2020-01-09 05:00 PM
yes, you are right,i have set SD dma priority to 0xf and using simple polliing,meanwhile i changed delay priority to 0x0.
but delay priority was 0xf in conf file,is it ok to set to 0x0? and how can i use dma in sd?