2025-04-22 9:18 PM - last edited on 2025-04-23 1:20 AM by Andrew Neil
Originally posted in TouchGFX Forum - moved & merged with duplicate.
Hi,
I am working on the STM32F439 development board. I am creating a test.csv file and logging data using FATFS on an SDIO SD card. I can view the data through USB MSC on a Windows PC. However, when I open the file in .csv format or edit some data from the PC, and then reconnect the board to the PC, the data gets corrupted or changes.
Does anyone know about this problem? If so, please help me.
Thank you!
Best regards,
Pankaj
2025-04-22 12:07 AM - last edited on 2025-04-22 4:55 AM by Andrew Neil
Hi,
I am working on the STM32F439 development board. I am creating a test.csv file and logging data using FATFS on an SDIO SD card. I can view the data through USB MSC on a Windows PC. However, when I open the file in .csv format or edit some data from the PC, and then reconnect the board to the PC, the data gets corrupted or changes.
Does anyone know about this problem? If so, please help me.
Thank you!
Best regards,
Pankaj
2025-04-22 4:57 AM - edited 2025-04-23 1:21 AM
You've posted in the TouchGFX forum, and tagged this as TouchGFX - but it doesn't seem to have anything to do with TouchGFX?
Thread now moved.
2025-04-23 12:02 AM
I'm pretty sure the problem is within your STM32 application code.
I would suggest the call the fflush() - equivalent after every write operation.
If I remember correctly, this is f_sync() in the FatFS context.
And of course you need to be careful when to remove the SD card or turn off power to the board.
Write acces can take some time, if you interrupt it, you get file corruption as well.