Getting toch on waveshare ESP32-S3 Development Board, with 1.28inch Round Touch LCD to work

I am using a Esp32s3 dev board with 1.28 round screen attached (from waveshare). i am able to export and upload the code to the board but when i remove the false for touched and uncomment the " tft.getTouch( &touchX, &touchY, 600 ):" the error message received is “class TFT_eSPI’ has no member named ‘getTouch’; did you mean ‘getColor’?” Now there are claims online to have the TOUCH_CS pin defined, but this particular module does not have a TOUCH_CS pin as stated by the manufacturer of the board. This is their statement: “The touch LCD communicate the ESP32 via i2c inteface instead of the SPI, in this case, it doesn’t have Touch_CS pin” i am able to get the module to display as a normal LCD but i am unable to get it to register touch. please provide a solution to this. Kind regards

TFT_eSPI library doesn’t seem to support I2C touch by default, just SPI (not sure about this I2C version: GitHub - kostuch/TFT_eSPI_I2C: Arduino and PlatformIO IDE compatible TFT library optimised for the STM32, ESP8266 and ESP32 that supports different driver chips (with pins connected via PCF857x port expander)), and only for certain touch-controllers like XPT2046. You might have a different touch-screen chip. I guess you’ll need to use a custom library to use that touch-screen, independently from the SPI-based working TFT driver.

I am having issues myself being able to use the TFT library with the development board, but mine does not even have a touch screen option. I can make it work with the other type of display that they have where you connect to an external microcontroller instead of using the embedded ESP32-S3R2.
So I am concerned that the TFT library is just not compatible with the development board. Have you seen proof of it being used with this particular board?

Are you able to flash anything on the screen and actually display something using the TFT library?

I was able to get mine to work. I was able to tweek the the solution provided by Hermit to get the touch to work. i was already able to get the display to work and that link that Hermit shared helped me sort out the touch issue. which waveshared device are you using. go ahead and shared the link to the device

@raj Are you using the Waveshare ESP32-S3 Development Board with 1.28 inch Round Touch Display? How did you get your touch to work? I can’t figure it out :frowning:

dont worry, someone scratched by back and i will scratch yours. let me explain. trying to relocate the link that helped me as to not make any mistake in my explanation

1 Like

Now for background, squareline studio only supports SPI interface (a single pin) for the touch to work. In the case of the board provided by waveshare, the touch chip used is CST816S which only supports i2c interface (4 pins)

The UI.ino code only checks for touch using different functions not supported by the CST816S touch chip. what you need to do is to simply make the configuration so it registers with that particular touch chip.

Now follow the steps exactly has stated under this link (follow the steps made by [cdchristian] at the top of the page. only change you would make are as follows:

where it says:
“CST816S myTouch(18, 17, 21, 16); //Add this line”

for the board waveshare provides you will add this instead:
“CST816S myTouch(6, 7, 13, 5); //Added this line”

Note that this only resolves the touch issue. You would follow the steps to setup the TFT/LCD (display) as stated by squareline studio. for that part best to use the TFT_espi and LVGL folders generated by squareline studio instead of the one provided by waveshare.

Only change you would have to make then is to the “User_Setup.h” file found in the TFT_espi folder. Copy whats inside the setup file provided by waveshared (TFT_eSPI_Setups > Setup207_GC9A01.h) then paste it inside the User_Setup.h exported from squareline.

Also its important to note that higher versions of LVGL and ESPI has been noticed to cause issues. I am using
LVGL - 8.3.6
TFT_espi - 2.5.43

comment if you have any further questions


Thank you so much!!! it works now :slight_smile:

glad to hear it

this is the one I am using. I cannot get anything to work using the TFT library or the adafruit_GFX for that matter. Only thing I can think of is that I have the wrong set up files and pin definitions. But I have a working demo file and I matched the pins exactly and I still cannot display anything.
Does it matter that I have a USB-C connection?
Is there some sort of set up I need to establish in the code regarding that?

There are a lot of ingredients to it, some measurements might come handy. Just for a tip, maybe adjusting SPI frequency or SPI signal phases/polarities to match what is given in the display chip’s datasheet?

So I have the same exact display but without the built in microcontroller, and I was able to send and display things on that one. and they both have the same display driver, and both the external and built in microcontrollers are ESP32. So I do not think the SPI frequency is the issue. I just cannot establish a connection to the LCD display at all. I connected an oscilloscope to the clock terminal to see if any signals are being sent from the built in microcontroller to the LCD display. And I am getting nothing.

That could mean the controller doesn’t send the data out. Cause might be inadequate hardware-setup code for the controller (so SPI interface is not activated), or lack of pixel-data sending. I’d build up gradually in your case, trying with setting up the most basic SPI communication first, i.e. continuously sending some data (e.g in the main loop or flush-callback), and then check the difference why the driver code and config doesn’t do the same. Some printf/debug in certain places could reveal if the flush and callback SPI writing code is running or not. A Spinner widget might be enough to stimulate change and see if data is sent out (the flush/driver code might optimize bandwidth by sending only changes.) Systematic checking of the ‘signal’ chain from LVGL to the display is what could help here, if no other tips are coming from experience.

@SaraMirza, what kinf of micro controller are using and describe the pin setup. Also, please comment on the display driver of the screen you are using.

Okay I will start from the top.
So I am working on two displays from Waveshare. Both use GC9A01 as the display driver.
One is:
This one I connect to an ESP32 Feather board. I am able to get this one to work with the TFT_eSPI library. and I will refer to this as Display A. All I needed to do was uncomment the correct User_setups file in User_Setup_Select.h, make sure that the pins are configured correctly, and also make sure that the correct driver is enables in User_Setup.h

The other display is:

This display, which I will refer to as Display B, has an embedded ESP32-S3. And I cannot get this one to work with the TFT_eSPI library. However I can get it to work with a demo file provided by Waveshare called esp32-s3-lcd-1.28-demo.ino.

The demo script does not use any external library (does not use TFT_eSPI), everything needed is encompassed within the script folder in different .h or .cpp files. And in the DEV_Config.h file, the following pin declarations are made:

#define LCD_DC_PIN (8)
#define LCD_CS_PIN (9)
#define LCD_CLK_PIN (10)
#define LCD_MOSI_PIN (11)
#define LCD_MISO_PIN (-1)
#define LCD_RST_PIN (12)
#define LCD_BL_PIN (40)

This script works and the Display B shows exactly what is expected. I believe SDA and SCL were declared as there is an embedded sensor in the display that was used and so data needed to be outputted.

Now, waveshare also provided the TFT_eSPI files to use. So I have the User_setup.j and User_Setup_Select.h files that are written by Waveshare to make the display work. And I double checked the pin configurations and they match the configuration file from the demo that works. I also checked that the right line was uncommented to include the correct User_Setups file, and that the right driver was decalred. Picture attached.

But when try to use the Color_test script from test and diagnostics. I get nothing on the display, and I connect my oscilliscope to the CLK pin and I get no signal. Unlike when I get the demo file working.
I tried running the Read_User_Setup.ino and I get this error in the Serial Monitor.

Guru Meditation Error: Core 1 panic’ed (StoreProhibited). Exception was unhandled.

I tried running an ESPExceptionDecoder that was suggested online but did not get anywhere.

So I cannot figure out what I am missing. For Display B, I have one script that doesn’t use TFT_eSPI that works, and the one that does use TFT_eSPI that doesn’t, and they both have the same PIN configurations. And I know how to make TFT_eSPI to work because I can get it to on Display A that uses the external microcontroller.

So what can I possibly be missing that I can look into?

I really appreciate your time.

I replied to Raj below that might give you more insight of what I am facing. I really appreciate your time. I do have a script that works and outputs data, but that script has so many embedded files that I need to look into to see what it is doing different that it is able to establish the SPI connection. I was under the impression that I needed to configure the LCD pins so that the ESP32-S3 can communicate properly with the display, but I do think you are right, I am missing something else that established that SPI communication. I just can’t figure out what it is. This is the first time I use an embedded microcontroller.

Ensure that you use the LVGL and TFT library provided by the squareline software when you do the export

then you should have already downloaded waveshares recommended library folder.
inside that folder go to TFT_eSPI_Setups > Setup207_GC9A01.h, then copy everything inside this file. then paste it inside the squareline setup folder

That is circuit UI folder > library folder > TFT_espi folder > User_Setup.h
take what you got from Setup207_GC9A01.h and paste it in User_Setup.h

On arduino IDE, ensure that you go to file > preference > then ensure that the sketch location is set to where it can see the library folder that holds all the squareline studio exports

ensure that you already have the necessary boards installed

here is the additional board manager URL link, paste it where it applies in preference settings of arduino IDE :

Then you should be good to go. if you are having issues. please sent pictures showing the configuration of the folders from squareline and the arduino sketch location. Also comment on error message if any

kind regards

1 Like