2021-01-08 11:52 PM
When reading from an SD card using SPI and FAT32 using either f_read() or f_gets() the data returned does not match the actual file contents.
I am using an STM32F103C8.
fresult = f_open(&fil, "0:test.txt", FA_OPEN_EXISTING | FA_READ | FA_WRITE);
unsigned int bytesWritten = 0;
bufclear(buffer, 1024);
sprintf(buffer, "test TEST test 123");
fresult = f_write(&fil, buffer, bufsize(buffer), &bytesWritten);
char fileBuf[10];
bufclear(fileBuf, 10);
f_gets(fileBuf, 10, &fil);
Solved! Go to Solution.
2021-01-09 12:40 AM
It was actually the "correct" output, just the file was corrupted.
2021-01-09 12:40 AM
It was actually the "correct" output, just the file was corrupted.