2019-06-25 02:45 AM
Hello,
I am using STM32F746 MCU and trying to use SDCard in DMA mode using FatFS.
This MCU has Cache also so for any conflict between DMA and the cache, I have disabled the cache.
I am just trying to create files in an infinitive loop at startup. (Create, Write, Close, Increase File Name).
But after a while I am not able to create file and f_open() returns DISK_ERROR; It always returns error for the same file number.
If I create files with short file names, it take long time to have the error.
(For example; If file names length is 15, I am starting to have error after 1500th file, but the file names length is 150, having error after the 600th file ).
The format is FAT32 so I would expect to have 65K files in a directory.
What I see, if the file name is aroung 150, after the 600th file, I dont get DMA_Complete Callback(and timeouts) and when I ask the SDCard state using HAL_SD_GetCardState(), it returns HAL_SD_CARD_SENDING.
Any suggestion?
Thank you.
2019-11-26 02:10 AM
Yes, but FAT doesn't carry around a file count, or optimize a directory content. A directory can contain empty records or voids when files are deleted. The only practical way is to walk the content and count files, folders, sizes, etc.
The content is also unsorted, so you'd need to build a file list and sort it manually on the MCU.