The read/write driver sometimes passes an unaligned reference, which causes DMA to write data at an offset.
In FS_FAT_FileRd function if reading from other than the beginning of sector is required:
if (sec_cur_pos != 0u) {
FSVol_RdLockedEx
...
p_dest_08 += size_rd; //the pointer may not be aligned!
...
while (size_rem > 0u) //and if a whole sector should be read next
...
FSVol_RdLockedEx( p_file->VolPtr, /* Rd full sec's. */
(void *)p_dest_08 //then we transmit non-aligned address for reading
If we read/write sectors using DMA then data will be read at an offset.
I worked around it this way: in SD card driver I check if the address is aligned, if it is - pass it to DMA as is, otherwise - use a temporary buffer of one section size. then I just copy data from it to my non-aligned buffer
This may not be a file system problem but a driver problem.
And maybe you have a better solution