0

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_ILI9341.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.begin(115200); Serial.println("In the setup."); //tft.initR(INITR_BLACKTAB); unsigned long t=micros(); tft.fillScreen(ILI9341_RED); Serial.println(micros()-t); } 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.

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

1 Answer 1

0

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).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.