Writing .BMP to SD card using FATFS. Distorted image.
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!
