AnsweredAssumed Answered

Problem mounting FAT filesystem using BOARD_SDRAM

Question asked by Jon Welch on Jun 11, 2020
Latest reply on Jun 16, 2020 by Jon Welch

I am using the RT1020 evaluation board and I am trying to get an SD Card to mount using the following example code from the sdcard_fatfs_freertos SDK demo :


if (f_mount(&g_fileSystem, driverNumberBuffer, 1U))
    PRINTF("Mount volume failed.\r\n");
    return kStatus_Fail;


If g_fileSystem resides in BOARD_SDRAM, the f_mount fails but if it is in SRAM_DTC, the function works.


Delving into the f_mount code, it calls find_volume, which calls check_fs which ends up reading sector 0 of the SD card using a call to disk_read(fs->pdrv, fs->win, sector, 1).


It would appear that reading a disc sector to a buffer (part of the g_fileSystem structure) which is in BOARD_SDRAM fails but if the buffer is in SRAM_DTC, it works. Some of the sector is read to BOARD_SDRAM but not the full 512 bytes. I don't know the technical reason for the failure but probably a timing issue due to the slower BOARD_SDRAM. 


Does anyone have any ideas for solving this problem ?