2019-11-15 07:13 AM
I am using STM32L1 MCU with SPI communication to SD card
I am using the FATFS library
f_mount, f_mkfs and f_getfree are going fine
but f_open returns an FR_INT_ERR
Did anyone face this issue before, or have an idea on how to fix it?
2019-11-15 08:36 AM
Make sure you *thoroughly* test your diskio layer, the file system will fail if the block device returns different or random stuff vs what was actually written before, and should be on the media. This means do some testing of the read/write, *outside* of the FatFs context.
Instrument the read/write, and perhaps track blocks vs checksums, so you can pin down why it has an internal failure. If you've followed point#1 you'd be able to audit what's going on with respect to data on the media.
The FatFs ST ships is not the most current, it has some issues with very large media (200-400 GB, EXFAT), but for the most part is pretty solid.
Make sure you SPI library manages multi-sector reads/writes properly, recall reporting issues with that a long time ago
2020-01-10 07:20 AM
The problem was wih FATFS configuration I had a 1024 Block-sized sd card so I only had to change the max sector size to 1024.
Thank you for your answer !