Hello!
I'm trying to use ESP32 with a 3.5" TFT screen. So far, I have managed to make the screen display graphics using TFT_eSPI library.
However, I can't get touch working. I have tried this TFT on Arduino MEGA with MCU_FRIEND_kbv library and works perfectly (including touch). MCU_FRIEND_kbv detects the screen (on Arduino MEGA) as ILI9486.
This is the User Setup I'm using:
// See SetupX_Template.h for all options available
#define ESP32_PARALLEL
#define ILI9486_DRIVER
////////////////////////////////////////////
// ESP32 pins used for UNO format board
#define TFT_CS 33 // Chip select control pin (library pulls permanently low
#define TFT_DC 18 //21--- Data Command control pin - must use a pin in the range 0-31
#define TFT_RST 32 // Reset pin, toggles on startup
#define TFT_WR 19 //22--- Write strobe control pin - must use a pin in the range 0-31
#define TFT_RD 23 // Read strobe control pin
#define TFT_D0 13 // Must use pins in the range 0-31 for the data bus
#define TFT_D1 12 // so a single register write sets/clears all bits.
#define TFT_D2 14 // Pins can be randomly assigned, this does not affect
#define TFT_D3 27 // TFT screen update performance.
#define TFT_D4 26
#define TFT_D5 15 //25----
#define TFT_D6 2
#define TFT_D7 4
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
#define SMOOTH_FONT
I have connected the pins as declared above. With this setup, all TFT_eSPI library's examples do work, with screen displaying graphics properly, except for projects including touch, such as Touch_Controller_Demo. The latter do not compile, with this error message:
'class TFT_eSPI' has no member named 'setTouch'
After a search on the Internet, many people recommended adding this line to the setup file in order to fix this compile error:
#define TOUCH_CS PIN_D2
After adding this line, projects that include touch functions do compile, but screen insists on not detecting touch.
I tried changing D2 to D33 at the line above so as to match the #define TFT_CS 33
line, but this returns this error message:
exit status 1
Error compiling for board DOIT ESP32 DEVKIT V1.
I would be grateful if you could provide some advice on how to make this work.
Thank you in advance