Hi Atmel community,
I am trying to experiment with reading and writing data from the eval board's SD card slot (end goal being to try and stream .wav audio out to the codec).
However the project refused to get past the f_open call, which returned 13 (No file system). I know for a fact that this SD card has a valid file system on here as I formatted it as Fat32 for this endeavour.
I followed through the debugger to check_fs in ff.c, which failed at the following line:
if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55)
The debugger showed the values at offset 510 in fs->win to be 0x55AA, which given that the LD_WORD macro flips the bytes round, is correct. However by separating out this check to:
WORD sig = LD_WORD(&fs->win[BS_55AA]); if (sig != 0xAA55)
sig was evaluated as 0x00.
This pointed toward some odd memory behaviour, and sure enough after disabling the I-Cache and D-Cache, the example ran as expected. I tried adding a SCB_CleanInvalidateDCache_By_Addr() call for the fs structure with the cache enabled (and aligning it to 32 bytes), but this did not work.
I find it very hard to believe that this example was not tested with the cache enabled, as it seems madness to not take advantage of the Arm core's cache for performance.
Is there possibly a newer version of this example that has been modified for cache coherency? If not, could anyone point me int he direction of where to start / how to go about debugging what is failing in terms of cache coherency to that it can be fixed?
Any help would be greatly appreciated.