2023-02-16 04:49 AM
Dear Community Member, I am working on the data acquisition and logging is SD card. In this project i am using stm32l452RET6 uC to interface SD card in SDIO mode with fatfs. It is working file when we are logging for the shorter time. I am creating only two file in the sd card.
Issue 1: Some times create garbage file in the sd card other than 2 files.
Issue 2: Some times our data file corrupt and not open on the pc.
What are the reason of these issue??
2023-02-16 05:25 AM
The most common errors are writing data beyond the boundaries of the buffer or field. This can cause absolutely weird errors.
2023-02-16 09:57 PM
Dear Community member, Thanks for your reply.
I have checked every buffer size and data type which are responsible to write are ok. I am using function to write sd card as per bellow.
See as per bellow.
2023-02-16 09:59 PM
Are there any other reason to weird behavior of the sd card writing in sdio mode???
2023-02-22 04:24 AM
I don't see any action when writing to the file fails.
2023-02-22 05:14 AM
There are a wealth of reasons why things fail, or corrupt the file system.
You should chkdsk or fsck media that might have broken file system structures.
I'd perhaps focus on making sure DISKIO layer performs flawlessly, as there's no data loss at a block level.
Constantly opening and closing a file, and writing small amounts of data will cause significant stress on the card. Ideally you write large aligned blocks, and periodically flush or sync the file system data.
2024-02-12 01:29 AM
Dear ST community member,
Very good afternoon to all.
PFA image file name "Issue file created in the SD card" of the created weired file in sd card.
What will be the reason of these weired file creation??
In attache image - DATA1.TXT and DATA2.TXT, SETUP.TXT and TEST.TXT files are created by me.
DATA2.TXT created as per required and it is ok. DATA1.TXT file should be 64292KB but its size is only 40240KB with name DATA1.TXT and its rest of the file size (24052KB) created by the name - "!|" and its size is the rest of DATA1.TXT size. If we combine 40240KB and 24052KB the its size will be 64292KB. File size 40240KB is not corrupted and it will be open. But file size 24052KB is corrupted.
What will be the reason of this issue??
Please reply to us ASAP.
Regards
Kameshwar Prasad
2024-02-12 02:48 AM - edited 2024-02-12 02:49 AM
Would make sure to use a current version. of FATFS and that the DISKIO layer is throughly tested.
Do not ignore errors reported
Output diagnostic and telemetry data so you can understand and identify the source of the failure.
2024-02-12 11:17 PM
Dear Tesla DeLorean,
1. Im my procject version of FAT fs is R0.12c (March 04, 2017).
2. There is no any error reported otherwise my code was hanged in while(1) but file writing were done after weird file creation.
3. a) When i was starting data logging, i am not format sd card and just
unlink available file content earlier --- This gives sometimes weird file creation??
b) After completion of data logging, i am transferring data to computer from the card reader. Format as FAT32 in my device before every new data logging is necessary or not???
4. Any other reason to create weird file???
Regards
Kameshwar Prasad