I have a TFT 2,8" TOUCH SCREEN connected to a ESP32 development board, like this:
TFT_MISO 19
TFT_MOSI 23
TFT_SCLK 18
TFT_CS 15 // Chip select control pin
TFT_DC 2 // Data Command control pin
TFT_RST 4 // Reset pin
TOUCH_CS 21 // Chip select pin (T_CS) of touch screen
I am using TFT_eSPI.h library by Bodmer with the following lines in "User_Setup.h" file, uncommented:
#define ILI9341_2_DRIVER // Alternative ILI9341 driver #define TFT_SDA_READ // This option is for ESP32 ONLY, tested with ST7789
I am able to upload the example named "On_Off_Button" , but when trying to perform the initial calibration, I touch the corner but nothing happens, could somebody tell me what's wrong ? Please check the attached pictures for more details.
You have T_DO and SDI(MOSI) connected, and T_DIN and SDO(MISO) connected together. It should be T_DO and SDO(MISO) together, and T_DIN and SDI(MOSI) together.
Even after you correct that though, you may still have problems.
It's not an uncommon problem with those boards for the ILI9341 not to tristate SDO(MISO) when it's not selected. That will cause the touchscreen not to work.
If you don't need to read data back from the screen, simply remove the connection to the SDI(MOSI) pin.
If you do need to read data back from the screen, you'll have to add a tri-state buffer like 1/4 of a 74AHC125 between the SDO(MOSI) pin and the T_DO pin. Connect the enable pin to CS.
One other thing that does crop up with other controller chips like the ILI9486 and ILI9488 (though not, as far as I'm aware, with the ILI9341) is that the library
configures the controller during setup not to use the SDO(MOSI) pin. If that's possible with the ILI9341, and the library was written that way, you won't get anything out of MISO and the tri-state buffer won't help you unless you edit the library.
Thanks a lot for the Hint. I have made the corrections in connections and User_Setup.h file, but I ended up with a blank screen. It seems that this library have a lot of problems with ILI9341. Have you ever tried another Library that could recommend ? I really need to use the touch function
I think you need to use 5V for the ILI's "VCC". If you want to use 3V for that then you need to blob J1 (and make sure that you don't connect it to 5V when that is so).
#1: Solder J1 pins together to use 3.3V #2: Connect again the same pins between ESP32 and TFT #3: Upload the example "On_Off_Button" in ESP32 #4: If this don't work, proceed to modify the wiring as van_der_decken said previously
I really hope solder J1 together make this work , if not, probably I should use another library. Do you have ever tried another library with this touch screen ?
Hi !
Only by soldering together pads on J1 didn't work for me. However, it is important to do this if you are going to power the screen with 3.3V directly.
For everyone that is using a ESP32 DevKit development board please see this video. VIDEO SOLUTION . In only 3 steps he achieves to make work the TFT TOUCHSCREEN. I had to wire my screen just like the video.
IMPORTANT: Here I share with you the content of my file Setup42_ILI9341_ESP32.h :
// See SetupX_Template.h for all options available
#define USER_SETUP_ID 42
//#define ILI9341_DRIVER
#define ILI9341_2_DRIVER
#define TFT_MISO 19 // (leave TFT SDO disconnected if other SPI devices share MISO)
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS 15 // Chip select control pin
#define TFT_DC 2 // Data Command control pin
#define TFT_RST 4 // Reset pin (could connect to RST pin)
#define TFT_INVERSION_ON
// Optional touch screen chip select
#define TOUCH_CS 5 // Chip select pin (T_CS) of touch screen
#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
// TFT SPI clock frequency
// #define SPI_FREQUENCY 20000000
// #define SPI_FREQUENCY 27000000
#define SPI_FREQUENCY 40000000
// #define SPI_FREQUENCY 80000000
// Optional reduced SPI frequency for reading TFT
#define SPI_READ_FREQUENCY 16000000
// SPI clock frequency for touch controller
#define SPI_TOUCH_FREQUENCY 2500000
Then you must comment all parts referents to ESP32 in file User_Setup.h. After this, look for the following lines in file User_Setup.h
// USER DEFINED SETTINGS
// Set driver type, fonts to be loaded, pins used and SPI control method etc.
//
// See the User_Setup_Select.h file if you wish to be able to define multiple
// setups and then easily select which setup file is used by the compiler.
//
// If this file is edited correctly then all the library example sketches should
// run without the need to make any more changes for a particular hardware setup!
// Note that some sketches are designed for a particular TFT pixel width/height
// User defined information reported by "Read_User_Setup" test & diagnostics example
#define USER_SETUP_INFO "Setup42_ILI9341_ESP32" //Add this line
//#define USER_SETUP_INFO "User_Setup.h" //Comment this line
I really, really hope this help you ! And finally we can give a DEFINETELY SOLUTION to use ILI9341 TFT 2.8" TOUCHSCREEN with ESP32 and ArduinoIDE and TFT_eSPI.h library from Bodmer