Hi, I have three different ESP32 boards, but none of them seem to have all the required pins available for the case where we’d like to use the external TFT 240×320. I understand that the module you use is the DOIT esp32 devkit, but it seems (to me) a very limited scope to keep other modules away as options to use in the examples.
Is there a possibility that you could manage to use alternative pins for other modules? I know that there are many, but sticking only to one is very limited, as there are others more advanced and with more capabilities, but without the pins available exactly for your book projects. Thanks.
Hi.
Yes. You can use other ESP32 modules as long as you have enough pins to make the connections.
Then, edit the User_Setup file with the right pins that you’re using.
Let me know if this is clear or if you need further help.
Regards,
Sara
Yes it’s clear, thank you. I will see into the file and make modifications to the pins declarations. Thanks again for your fast reply.
Great.
If you’re using the touchscreen, you’ll need to set the touchscreen pins on the sketches.
Then, let me know if you succeed.
Regards,
Sara
Hi again.
Looking into the UserSetup.h file, I see the LCD pin definitions alright, but I only see the TOUCH_CS defined. What about the other pins dedicated to the touchscreen (T_IRQ, T_DIN, etc)? Are they used in the first book example? Shall they be defined here or are they defined somewhere else?
Thanks again.
Hi.
Scroll down on the User_Setup file until you see this to define the pins
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP32 SETUP ###### // For ESP32 Dev board (only tested with ILI9341 display) // The hardware SPI can be mapped to any pins #define TFT_MISO 12 #define TFT_MOSI 13 #define TFT_SCLK 14 #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_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST #define TOUCH_CS 33 // Chip select pin (T_CS) of touch screen
The rest of the other touch pins are defined in the code when touch is being used.
Regards,
Sara
For example, in unit 1.9: the tochscreen pins are defined at the beginning of the code:
// Touchscreen pins
#define XPT2046_IRQ 36 // T_IRQ
#define XPT2046_MOSI 32 // T_DIN
#define XPT2046_MISO 39 // T_OUT
#define XPT2046_CLK 25 // T_CLK
#define XPT2046_CS 33 // T_CS
Still I am struggling to make this hardware work. I have several questions, but first I will mention what I am using:
ESP32S3 Dev Module with 44 pins and two USBC connectors.
The LCD Display suggested in the book with the IL9341 driver.
As this Dev Module does not have a GPIO pin 33, I am using the pin 16 instead, and so I made the change in the UserSetup.h file.
There are no compiling and downloading issues.
I know that the program is running as I placed several prints and it is reaching the loop and remains running there.
I see that the LCD background lights up a little bit, but nothing is displayed.
Of course I double checked the connections and they are fine.
Now the questions:
I did not connect the T_DIN and the T_CLT_CLK as this module does not have pin 32 nor pin 25, and as I did not find a place in the UserSetup.h to re-define them (this one was one of my past questions), I left them without a connection. I’d say that this is the problem, but how can I be sure?
I used the GPIO pin 16 instead of pin 33. Could this change be a part of the problem?
Thanks.
Hi,
You define those touchscreen pins on your sketch and not on the User_setup file.
You need to choose other available pins on your board. Don’t let them unconnected.
Regards,
Sara
Hi again.
I already defined the unconnected pins in the sketch and it looks like this (showing only the fragment I added):
—-
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define T_IRQ 36
#define T_OUT 39
#define T_DIN 17
#define T_CLT_CLK 18
#define LED 21
#define DRAW_BUF_SIZE (SCREEN_WIDTH * SCREEN_HEIGHT / 10 * (LV_COLOR_DEPTH / 8))
uint32_t draw_buf[DRAW_BUF_SIZE / 4];
—-
Also, in the UserSetup.h I modified the Chip Select pin as my ESP32S3 module does not have the pin 33 exposed, and it look like this:
—-
#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
#define TOUCH_CS 16 // Chip select pin (T_CS) of touch screen
// #define TOUCH_CS 33 // Chip select pin (T_CS) of touch screen
—-
It compiles and downloads without a problem, but the display shows nothing but a softly illuminated screen.
Any hints or tips?
Thanks.
The display and the ESP32 work fine with other test sketch, so I would conclude that the way I am defining the alternative pins is not right and for sure it is not working.
My goal here is to learn LVGL, and I understand that the hardware may be different and still work almost the same way. This set up (ESP32 and LCD), does not have to be hard, but as I have a little knowledge on the Arduino IDE ( I am a Keil and STMCubeIDE guy) I really cannot find my way out, so I decided to buy the CYD module, and then continue with my learning using your book. This does not mean that I am not willing to be proficient with the Arduino IDE, buy it will come as a secondary goal.
Thanks again.