2021-04-03 08:37 AM
Hi!
I wrote a program to write a .bmp file to SD card using FATFS. I am using STM32CubeIDE and its generated code. I converted my .bmp file to a byte array online and then copied the array to my program.
If i write the whole data at once, everything is ok. The image appears on SD card and is not distorted.
res = f_write(&SDFile, bmp , 8864, (void *)&byteswritten);
If I write data in two parts, the image appears on SD, but its upper rows get shifted right a little.
res = f_write(&SDFile, header , 62, (void *)&byteswritten);
res = f_write(&SDFile, pixeldata , 8802, (void *)&byteswritten);
What could be the problem? Thank you!
2021-04-20 04:59 AM
Hello Andrei,
We have no known issue where a file, when written in chunks, a data corruption occurs. Could you please provide the bitmap file (in its binary and header form)?
Letting us know which FATFs version, cube IDE version, device ID, cube firmware version, etc... would be helpful.
BeST regards,
Walid
2022-02-23 08:02 AM
Hello Andrei,
I think you can open two files with hex editor and compare the headers.