Open DeeFuse opened 2 years ago
Hi @DeeFuse,
Thank you for this report. I see you are using version 1.26.2 of the firmware. Newer version 1.27.0 is already available. Have given it a try?
Thanks,
1.27.0 produces the same file (the template hasn't been changed since 2020) sd_diskio_dma_rtos_template_bspv1.c This problem is related to #2
SD_write is not using the scratch buffer when trying to write a non aligned buffer using the DMA template. SD_read has the correct brace placement to branch to the scratch buffer implementaion when using unaligned buffers.
The
true
codepath of the alignment check in L413 should end in L465 but ends at L563 Thus skipping any unaligned writes when having the scratchbuffer enabled. Note: with the scratchbuffer disabled, the write will be performed (with garbage at the beginning if unaligned)Describe the set-up Clean Project using CubeMX and STM32Cube_FW_F4_V1.26.2
Describe the bug When enabling
ENABLE_SCRATCH_BUFFER
inFATFS/Target/sd_diskio.c
the function SD_write will return immideately when a unaligned pointer to a buffer is supplied. It should instead call the memcpy scratchbuffer path.How To Reproduce Create a CubeMX Project with SDIO + FATFS using DMA and FreeRTOS
Example Project demonstrating the wrong generation: SDIO_DMA_Test.zip