ESP32 TFT_espi TFT 3.5"

Hey,
I have bought this TFT Screen some time ago, and used it with an Arduino Uno with the MCUFRIEND library.
Now I want to use the screen with an ESP32.
With the MCUFRIEND Library displaying information works fine. But i want to use the TFT_espi library now, but TFT_print_test example doesn't work.

The wiring is:

TFT_CS 33
TFT_DC 15
TFT_RST 32
TFT_WR 4
TFT_RD 2
TFT_D0 12
TFT_D1 13
TFT_D2 26
TFT_D3 25
TFT_D4 17
TFT_D5 16
TFT_D6 27
TFT_D7 14

and here the config file: User_Setup.h (15.7 KB)

Please post a complete sketch that shows the problem

Here's the sketch:

/*  
 Test the tft.print() viz the libraries embedded write() function

 This sketch used font 2, 4, 7
 
 Make sure all the required fonts are loaded by editing the
 User_Setup.h file in the TFT_eSPI library folder.

  #########################################################################
  ###### DON'T FORGET TO UPDATE THE User_Setup.h FILE IN THE LIBRARY ######
  #########################################################################
 */

#include <SPI.h>

#include <TFT_eSPI.h> // Hardware-specific library

TFT_eSPI tft = TFT_eSPI();       // Invoke custom library

#define TFT_GREY 0x5AEB // New colour


void setup(void) {
  tft.init();
  tft.setRotation(2);
}

void loop() {
  
  // Fill screen with random colour so we can see the effect of printing with and without 
  // a background colour defined
  tft.fillScreen(random(0xFFFF));
  
  // Set "cursor" at top left corner of display (0,0) and select font 2
  // (cursor will move to next line automatically during printing with 'tft.println'
  //  or stay on the line is there is room for the text with tft.print)
  tft.setCursor(0, 0, 2);
  // Set the font colour to be white with a black background, set text size multiplier to 1
  tft.setTextColor(TFT_WHITE,TFT_BLACK);  tft.setTextSize(1);
  // We can now plot text on screen using the "print" class
  tft.println("Hello World!");
  
  // Set the font colour to be yellow with no background, set to font 7
  tft.setTextColor(TFT_YELLOW); tft.setTextFont(7);
  tft.println(1234.56);
  
  // Set the font colour to be red with black background, set to font 4
  tft.setTextColor(TFT_RED,TFT_BLACK);    tft.setTextFont(4);
  tft.println((long)3735928559, HEX); // Should print DEADBEEF

  // Set the font colour to be green with black background, set to font 4
  tft.setTextColor(TFT_GREEN,TFT_BLACK);
  tft.setTextFont(4);
  tft.println("Groop");
  tft.println("I implore thee,");

  // Change to font 2
  tft.setTextFont(2);
  tft.println(F("my foonting turlingdromes.")); // Can store strings in FLASH to save RAM
  tft.println("And hooptiously drangle me");
  tft.println("with crinkly bindlewurdles,");
  // This next line is deliberately made too long for the display width to test
  // automatic text wrapping onto the next line
  tft.println("Or I will rend thee in the gobberwarts with my blurglecruncheon, see if I don't!");
  
  // Test some print formatting functions
  float fnumber = 123.45;
   // Set the font colour to be blue with no background, set to font 4
  tft.setTextColor(TFT_BLUE);    tft.setTextFont(4);
  tft.print("Float = "); tft.println(fnumber);           // Print floating point number
  tft.print("Binary = "); tft.println((int)fnumber, BIN); // Print as integer value in binary
  tft.print("Hexadecimal = "); tft.println((int)fnumber, HEX); // Print as integer number in Hexadecimal
  delay(10000);
}



What exactly does that mean ?
More details please

Which controller ID is reported by MCUFRIEND_kbv ?

TFT_eSPI should work just fine (if not better than MCUFRIEND_kbv).
However it does not support as many controllers.

Your User_Setup.h looks ok. I would comment all of the ESP8266 defines.
You are matching the MCUFRIEND_kbv wiring correctly.

I strongly advise using the library example sketches. Just quote the sketch by its name.
This applies to MCUFRIEND_kbv examples and to TFT_eSPI examples.
And is pretty good advice for any "library" problem.

There is no point in writing "your own" sketches until you have verified the hardware with the library examples.

David.

I get a grey screen which is white at the right side.
The ID is 0x9486
Now it's working, it was the wrong controller

Thank you for help!

Now i wanted to try Touch, but with the "Touch_Controller_Demo" i get this error:

'class TFT_eSPI' has no member named 'setTouch'

Can anyone tell me what am i doing wrong?

Mcufriend shields have a bare resistive panel. There is no dedicated Touch controller chip.

MCUFRIEND_kbv programs work on ESP32.

I have not tried Bodmer's Touch examples with Mcufriend shields. Have you ?

David.

I wanted to, but i get to error from above

But the Adafruit TouchScreen library works for this screen, doesn't?

In the Adafruit Touch library example "touchscreendemoshield" i have to set the pins:

// These are the pins for the shield!
#define YP A1  // must be an analog pin, use "An" notation!
#define XM A2  // must be an analog pin, use "An" notation!
#define YM 7   // can be a digital pin
#define XP 6   // can be a digital pin

Which pins do I have to specify with my wiring?

Edit: @david_prentice ?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.