HAL BUG : sd_diskio_dma_template in STM32Cube_FW_F4__V1.24.1?
I've found a bug in the ENABLE_SCRATCH_BUFFER implementation for sd_disk_io when using fatfs.
When this option is enabled, the code initially checks to see if the buffer is 4 byte aligned, and if it isn't aligned (quite often the case with fatfs) then the code is supposed to copy the buffer to align it to a 4 byte boundary.
The scratch buffer does not appear to be initially set up anywhere, and the indentation for DMAing the scratch buffer is also incorrect.
The complete SD_write function is a mess and needs to be reworked. At least 2 bugs that I can see.
1) Indentation for using the scratch buffer is wrong, it's current executed when BSP_SD_WriteBlocks_DMA does not return MSD_OK
2) Initial scratch buffer is not setup when buffer is not aligned
Can anyone confirm this?
Cheers
Glen.
