BUG - Race condition in the FATFS SD DMA template (BSPv1)
Hello,
there is a race condition in the function SD_read() in the template file used by CubeMX when using FATFS with DMA template (sd_diskio_dma_template_bspv1.c).
if(BSP_SD_ReadBlocks_DMA((uint32_t*)buff,
(uint32_t) (sector),
count) == MSD_OK)
{
ReadStatus = 0;The variable ReadStatus should be set to zero BEFORE the call to BSP_SD_ReadBlocks_DMA(), as it is already the case in the BSP V2 template (sd_diskio_dma_template_bspv2.c) and in the examples using FATFS and SD DMA (e.g. Projects\STM32F412G-Discovery\Applications\USB_Host\AUDIO_Standalone\Src\sd_diskio_dma.c).
