Lib for the new LCD Display with ILI9341 controller

Dependents:   TFT_Test_ILI9341 touch_piirto TFT_banggood TFT_Test_ILI9341-a-fish ... more

Issue: Doesn't work with Adafruit ILI9341

Problem

White screen without any signs of interaction with microcontroller board

Components

Wiring

  • Screen SPI side -> STM32 devboard
  • Gnd -> GND
  • Vin -> 3.3V
  • SCL -> PA_5
  • MISO ->PA_6
  • MOSI ->PA_7
  • CS -> PB_14
  • D/C -> PB_12
  • Rst -> PB_13
  • Lite -> 3.3V backlite control
  • IM3 -> 3.3V to activate SPI on screen
  • IM2 -> 3.3V to activate SPI on screen
  • IM1 -> 3.3V to activate SPI on screen
  • IM0 -> GND to activate SPI on screen

Code:

#include "mbed.h"

#include "stdio.h"
#include "string"

#include "SPI_TFT_ILI9341.h"    

#include "Arial12x12.h"         

// Pins for SPI1 on BluePill devboard
SPI_TFT_ILI9341 TFT(PA_7, PA_6, PA_5, PB_14, PB_13, PB_12,"TFT"); // mosi, miso, sclk, cs, reset, dc
 
int main()
{
    while (1){
        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(Black);
        TFT.cls();
    
        TFT.set_orientation(1);
        TFT.set_font((unsigned char*) &Arial12x12);
        TFT.locate(50,100);
        TFT.printf("TFT orientation");    

        //TFT.set_font((unsigned char*) &Arial12x12);

        for (int orientation = 0; orientation < 4 ; orientation++){
            TFT.set_orientation(orientation);
            TFT.locate(0,0);
            TFT.printf("   Hello Mbed %d", orientation);
        };
        
        wait(1.0);
    };    
}