2021-03-04 11:52 PM
I'm working on a project that requires USB_OTG_FS and USB_DEVICE as MSC; I've managed to hook up the SD card to the USB_DEVICE layer and the HAL_SD_ReadBlocks works fine and I can even play back music from the SD Card via the MSC interface. However the HAL_SD_WriteBlocks gives me a buffer underrun error; and the HAL_SD_WriteBlocks_DMA would work, but it corrupts files; I assume that's cuz I would have to wait a little for the transfer to complete:
My question is: how would I go about doing that?
The SDIO is in 4 bit Wide Bus mode and the microcontroller is an STM32F405RG
Thanks!
Solved! Go to Solution.
2021-04-15 04:37 AM
Hello @Dávid Magyar and welcome to ST Community,
I advise you to consult the examples provided by ST which exist in the Firmware package. You can get inspiration from the existing examples in the following paths:
Firmware\Projects\STM32446E_EVAL\Applications\FatFs\FatFs_uSD
Firmware\Projects\STM324x9I_EVAL\Applications\USB_Device\MSC_Standalone
Regarding the issue of file corruption, you should certainly wait until the transfer is complete.
I hope this helps!
Best Regards,
Walid
2021-04-15 04:37 AM
Hello @Dávid Magyar and welcome to ST Community,
I advise you to consult the examples provided by ST which exist in the Firmware package. You can get inspiration from the existing examples in the following paths:
Firmware\Projects\STM32446E_EVAL\Applications\FatFs\FatFs_uSD
Firmware\Projects\STM324x9I_EVAL\Applications\USB_Device\MSC_Standalone
Regarding the issue of file corruption, you should certainly wait until the transfer is complete.
I hope this helps!
Best Regards,
Walid