I recently got a Adafruit TFT screen and an ESP-32 development kit. I was trying to interface these two the pin connections I used areas follows:

TFT   |   ESP-32
3V3   |   Vcc
Gnd   |   Gnd
MOSI  |   GPIO19
SCK   |   GPIO18
CS    |   GPIO5
D/C   |   GPIO16
RST   |   GPIO 17

I used this library: https://github.com/MartyMacGyver/ESP32_Adafruit_ILI9341

The SPI library used was the one that comes while installing Arduino support for ESP-32.

The code compiles and uploads without any error/ warning but the TFT screen does not show any response (except powering up).

This is the code I used for testing:

//#include <Adafruit_ST7735.h>

#include <Adafruit_GFX.h>
#include "SPI.h"

#define TFT_CS     5
#define TFT_RST    17
#define TFT_DC     16

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS ,TFT_DC, 23, 18, TFT_RST);

void setup() {
    // put your setup code here, to run once:
    Serial.println("In the setup.");
    unsigned long t=micros();

void loop() {
    // put your main code here, to run repeatedly:


The code compiles and uploads without any error/warning but the TFT screen does not show any response (except powering up).

NOTE: The library works fine with Arduino Mega and TFT display.

  • 2
    MOSI and SCK both on GPIO19...? – Majenko Apr 15 '17 at 20:32
  • I have now corrected the discription of connections sck is at pin 18 not 19. – Harsh Chittora Apr 16 '17 at 6:00
  • Why have you commented out the TFT initialisation function? – Majenko Apr 16 '17 at 7:59
  • 1
    That instantiates the object, it doesn't initialise the TFT. I repeat: why have you commented out the initialisation function? – Majenko Apr 16 '17 at 8:26
  • 3
    Also why tell the library MOSI is on 23 when it is on 19? – Majenko Apr 16 '17 at 8:29

Ok, sorry for the delay, I had my exams. But I have finally solved the issue. There were several issues:

  1. MOSI should be connected to pin 23 not 19.
  2. tft.begin() function should be in the setup to initialize the TFT. (for ILI9341)
  3. The SPI library used should be the one that comes with ESP-32 support. The general SPI library for Arduino does not work with ESP-32.

Note: the ST7735 library currently does not work with ESP-32. It can be made to work by adding the following definitions given bellow to the Adafruit_ST7735.h header file.

    #elif defined(ESP32)
    volatile uint32_t *dataport, *clkport, *csport, *rsport;
    uint32_t  _cs, _rs, _rst, _sid, _sclk,
    datapinmask, clkpinmask, cspinmask, rspinmask,
    colstart, rowstart; 

(add this just after the ESP8266 definitions).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.