cancel
Showing results for 
Search instead for 
Did you mean: 

1. If we are logging data for the long period (48hour or 96 hour) Sometimes garbage file create in sd card other than our create file. 2. Some times file corrupt and not open on the computer. What is the reason of this issue??

KPras.2
Associate III

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??

8 REPLIES 8
ONadr.1
Senior III

The most common errors are writing data beyond the boundaries of the buffer or field. This can cause absolutely weird errors.

KPras.2
Associate III

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.

  1. Mount sd card once.
  2. Create DATA.txt file to write once and write data in the file.
  3. After that open and append data only.

See as per bellow.

  1. This function call once - void sd_card_mount_card_capacity (void).
  2. This function call for the writing file - void sd_card_write_read (void).

KPras.2
Associate III

Are there any other reason to weird behavior of the sd card writing in sdio mode???

ONadr.1
Senior III

I don't see any action when writing to the file fails.

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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