Mbed forum

Nucleo STM32F401RE fail when use the SDFileSystem.h and TFT with ILI9341


(Alberto Pardo) #1

i read a photo in .bmp from SD card and when I want to print on Display, the print is bad, it send the code of each pixel more one pixel without color, I think that the library SDFileSystem have to change somethings of SPI but I dont know, I am using the library SPI_TFT_ILI9341.h with funtion BMP_16(), this is my main code:

SDFileSystem sd(PC_12, PC_11, PC_10, A0, “sd”, NC, SDFileSystem :: SWITCH_NONE, 30000000); // mosi,miso,sck,cs
SPI_TFT_ILI9341 TFT(PB_5, PB_4, PA_5, PB_6, PA_10, PA_9,PC_8,“TFT”); // mosi, miso, sclk, cs, reset, dc, backlight

int main() {

TFT.claim(stdout);      // send stdout to the TFT display
TFT.background(Black);    // set background to black
TFT.foreground(White);    // set chars to white
TFT.cls();                // clear the screen

TFT.background(Orange);
TFT.cls();
	TFT.set_orientation(0);
 int err = TFT.BMP_16(0,0,"/sd/MENU2.bmp");  // load test.bmp from external SD-card

TFT.locate(10,120);
if (err != 1) TFT.printf(" - Err: %d",err);
wait(1);
TFT.Bitmap ( 0 , 0 , 240, 320, (unsigned char *)p4);
wait(1);

}