Good Morning, according to the correct documentation (https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32d_esp32-wroom-32u_datasheet_en.pdf ), I’ve now wired the pins correct:
#define DISP_SPI_MOSI 13
#define DISP_SPI_CLK 14
#define DISP_SPI_CS 15
#define ILI9341_DC 17
#define ILI9341_RST 25
#define ILI9341_BCKL 26
#define TP_SPI_MOSI 23
#define TP_SPI_MISO 19
#define TP_SPI_CLK 18
#define TP_SPI_CS 5
#define XPT2046_IRQ 27
I’ve also defined these values:
#define XPT2046_X_MIN 0
#define XPT2046_Y_MIN 0
#define XPT2046_X_MAX 4095
#define XPT2046_Y_MAX 4095
Now it’s working and i get these values shown on my display with tpcal:
left upper: x=274 y=196
right upper: x=51 y=195
right lower: x=47 y=35
left lower: x=275 y=35
For your Information: I’ve an ESP32 DevKit v4 with ESP32-WROOM-32d.
1 Like
Sorry, my mistake: In my last post
xpt2046_x_inv and xpt2046_y_inv
were commented out. I’ve changed it back to “1”, now I get correct values and the example application (LV_USE_DEMO) works correctly:
left upper: x = 41 y = 43
right upper: x = 265 y = 42
right lower: x = 266 y = 202
left lower: x = 41: y = 202
2 Likes
Hi,
I am having raw values that dont calibrate the tp.
#define XPT2046_X_MIN 722
#define XPT2046_Y_MIN 636
#define XPT2046_X_MAX 3602
#define XPT2046_Y_MAX 3417
I already decreases the spi touch frequency to 1 Mhz.
I need add a delay in “xpt2046_read” function ?
Thank’s.
What do you experience? Is there a small or a big error?
You can verify the calculations here .
In really, after i decrease de touch spi frequency to 1 MHz, the initial values 0 to 4095, in both x and y, behave much better than the calibrated values.
Are these calibrated values reasonable?
#define XPT2046_X_MIN 722
#define XPT2046_Y_MIN 636
#define XPT2046_X_MAX 3602
#define XPT2046_Y_MAX 3417
kitarp
September 19, 2019, 5:36am
47
@Baldhead hey so after running adding a delay in xpt touch function and adding following values
#define XPT2046_X_MIN 0
#define XPT2046_Y_MIN 0
#define XPT2046_X_MAX 4095
#define XPT2046_Y_MAX 4095
it works perfectly for me.
hello, I also had problems with the touch, I changed the speed of the SPI to
.clock_speed_hz=2x1000x1000, in tp_spi.c
and everything was solved, for example my configuration was
#define XPT2046_X_MIN 346
#define XPT2046_Y_MIN 197
#define XPT2046_X_MAX 3912
#define XPT2046_Y_MAX 3843
#define XPT2046_X_INV 1
#define XPT2046_Y_INV 1
thanks
1 Like
@JocPlusPlus
Thank you for the feedback.
I’ve updated the project to use 2 MHz clock on Touchpad SPI.
1 Like