Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 6 months ago.
QVGA TFT with ILI9341 driver not displaying with FRDM-k64F
I have a QVGA TFT module with a ILI9341 driver that I got on ebay, and I'm trying to get it to work on the frdm-K64F. I tried using the TFT_Test_ILI9341 program, but all it does is clear the screen from white to black, with a single red pixel at 0, 0. I have tried it with success on an Arduino, so it is not a hardware problem. I had to change the SPI format from (8, 3) to (8, 0), but except for that, I haven't made any changes to the library or the program. Can anyone give me some ideas?
SPI_TFT_ILI9341
// example to test the TFT Display // Thanks to the GraphicsDisplay and TextDisplay classes // test2.bmp has to be on the mbed file system //#define NO_DMA #include "stdio.h" #include "mbed.h" #include "SPI_TFT_ILI9341.h" #include "string" #include "Arial12x12.h" #include "Arial24x23.h" #include "Arial28x28.h" #include "font_big.h" extern unsigned char p1[]; // the mbed logo // the TFT is connected to SPI pin 11-14 SPI_TFT_ILI9341 TFT(D11, D12, D13, D8, D10, D9,"TFT"); // mosi, miso, sclk, cs, reset, dc int main() { int i; //unsigned int y; TFT.claim(stdout); // send stdout to the TFT display //TFT.claim(stderr); // send stderr to the TFT display TFT.set_orientation(1); TFT.background(Black); // set background to black TFT.foreground(White); // set chars to white TFT.cls(); // clear the screen //y= 0; TFT.background(Black); TFT.cls(); TFT.set_font((unsigned char*) Arial12x12); TFT.locate(0,0); printf(" Hello Mbed "); wait(5); // wait five seconds // draw some graphics TFT.cls(); TFT.set_font((unsigned char*) Arial24x23); TFT.locate(100,100); TFT.printf("Graphic"); TFT.line(0,0,100,0,Green); TFT.line(0,0,0,200,Green); TFT.line(0,0,100,200,Green); TFT.rect(100,50,150,100,Red); TFT.fillrect(180,25,220,70,Blue); TFT.circle(80,150,33,White); TFT.fillcircle(160,190,20,Yellow); double s; for (i=0; i<320; i++) { s =20 * sin((long double) i / 10 ); TFT.pixel(i,100 + (int)s ,Red); } wait(5); // wait five seconds // bigger text TFT.foreground(White); TFT.background(Blue); TFT.cls(); TFT.set_font((unsigned char*) Arial24x23); TFT.locate(0,0); TFT.printf("Different Fonts :"); TFT.set_font((unsigned char*) Neu42x35); TFT.locate(0,30); TFT.printf("Hello Mbed 1"); TFT.set_font((unsigned char*) Arial24x23); TFT.locate(20,80); TFT.printf("Hello Mbed 2"); TFT.set_font((unsigned char*) Arial12x12); TFT.locate(35,120); TFT.printf("Hello Mbed 3"); wait(5); // mbed logo TFT.background(Black); TFT.cls(); TFT.locate(10,10); TFT.printf("Graphic from Flash"); TFT.Bitmap(90,90,172,55,p1); wait(5); TFT.cls(); TFT.locate(10,10); TFT.printf("Graphic from File System"); TFT.locate(10,20); TFT.printf("open test.bmp"); int err = TFT.BMP_16(20,50,"test.bmp"); if (err != 1) TFT.printf(" - Err: %d",err); }