MCUFRIEND_kbv ESP32 ILI9486 Touch not working

Hi, David Sir
i am not getting how to configure Touchscreen
Display is ILI9486 8bit Shield
MCU is NODEMCU-32
Libraries are MCUFRIEND_kbv & Touchscreen.h
Display works fine but touch not working when i tried with Arduino mega all things are ok, touch display.
Mega Settings are :

const int XP = 8, XM = A2, YP = A3, YM = 9;
const int TS_LEFT = 134, TS_RT = 887, TS_TOP = 945, TS_BOT = 87; 
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

ESP32 settings are:

#define LCD_RD  2
#define LCD_WR  4
#define LCD_RS 15
#define LCD_CS 33
#define LCD_RST 32

#define LCD_D0 12
#define LCD_D1 13
#define LCD_D2 26
#define LCD_D3 25
#define LCD_D4 17
#define LCD_D5 16
#define LCD_D6 27
#define LCD_D7 14

& Serial Monitor print while wiring with ESP32

Read Registers on MCUFRIEND UNO shield
controllers either read as single 16-bit
e.g. the ID is at readReg(0)
or as a sequence of 8-bit values
in special locations (first is dummy)

reg(0x0000) 00 00	ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 54 80 66	Manufacturer ID
reg(0x0009) 00 00 61 00 00	Status Register
reg(0x000A) 00 08	Get Power Mode
reg(0x000C) 00 66	Get Pixel Format
reg(0x0061) 00 00	RDID1 HX8347-G
reg(0x0062) 00 00	RDID2 HX8347-G
reg(0x0063) 00 00	RDID3 HX8347-G
reg(0x0064) 00 00	RDID1 HX8347-A
reg(0x0065) 00 00	RDID2 HX8347-A
reg(0x0066) 00 00	RDID3 HX8347-A
reg(0x0067) 00 00	RDID Himax HX8347-A
reg(0x0070) 00 00	Panel Himax HX8347-A
reg(0x00A1) 00 93 30 93 30	RD_DDB SSD1963
reg(0x00B0) 00 00	RGB Interface Signal Control
reg(0x00B4) 00 00	Inversion Control
reg(0x00B6) 00 02 02 3B 3B	Display Control
reg(0x00B7) 00 06	Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00	ILI9481, HX8357-B
reg(0x00C0) 00 0E 0E 0E 0E 0E 0E 0E 0E	Panel Control
reg(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00	GAMMA
reg(0x00CC) 00 04	Panel Control
reg(0x00D0) 00 00 00	Power Control
reg(0x00D2) 00 00 00 00 00	NVM Read
reg(0x00D3) 00 00 94 86	ILI9341, ILI9488
reg(0x00D4) 00 00 00 00	Novatek ID
reg(0x00DA) 00 54	RDID1
reg(0x00DB) 00 80	RDID2
reg(0x00DC) 00 66	RDID3
reg(0x00E0) 00 0F 21 1C 0B 0E 08 49 98 38 09 11 03 14 10 00	GAMMA-P
reg(0x00E1) 00 0F 2F 2B 0C 0E 06 47 76 37 07 11 04 23 1E 00	GAMMA-N
reg(0x00EF) 00 80 00 10 60 40	ILI9327
reg(0x00F2) 00 18 A3 12 02 B2 12 FF 10 00 00 00	Adjust Control 2
reg(0x00F6) 00 54 80 66	Interface Control

so it is pretty simple to write down the ESP32 equivalent pins e.g.

const int XP = 8, XM = A2, YP = A3, YM = 9; //Uno pins
const int XP = 12, XM = 15, YP = 33, YM = 13; //ESP32 pins

If you have read recent threads you see that Adafruit's TouchScreen.h expects 10-bit ADC e.g.

#if defined(__arm__) || defined(ESP32) //default to 12-bit ADC
    analogReadResolution(10); //Adafruit TouchScreen.h expects 10-bit
#endif

1 Like

do i have to mention this in Adafruit's TouchScreen.h

No. Just put it in the sketch setup()

You could put it in TouchScreen.cpp if you want.
Likewise you could restore pinMode(XM) etc or map ADC to pixel coordinates in TouchScreen.cpp if you want.
But any subsequent new version of TouchScreen.cpp would need it too.

No improvement, touch not working

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