ILI9341 TFT Panel~
Models:
The "red" 240x320 TFT displays with an ILI9341 controller and XPT2046 touch controller are very common.
Make sure to select the touch version when ordering these screens online. The U2 touch chip needs to be populated on the board.
Gallery~
Pin Configuration~
Pin | Function | ESP32 Pin | Config Name | Display Pin |
---|---|---|---|---|
1 | 5V/3.3V power input | 5V/3.3V | VCC | |
2 | Module Ground | GND | GND | |
3 | Chip Select | GPIO26 | TFT_CS | CS |
4 | LCD Reset line | GPIO15 | TFT_RST | RESET |
5 | Data Command control | GPIO5 | TFT_DC | DC |
6 | Data Input | GPIO23 | TFT_MOSI | SDI(MOSI) |
7 | SPI Clock | GPIO18 | TFT_SCLK | SCK |
8 | Backlight | GPIO21 | TFT_BCKL | LED |
9 | Data Output (not used) | GPIO19 or N/C | TFT_MISO | SDO(MISO) |
10 | Touch SPI Clock | GPIO18 | TFT_SCLK | T_CLK |
11 | Touch Select | GPIO17 | TOUCH_CS | T_CS |
12 | Touch Data Input | GPIO23 | TFT_MOSI | T_DIN |
13 | Touch Data Output | GPIO19 | TFT_MISO | T_DO |
14 | Touch Interrupt | N/C | T_IRQ |
SPI MISO, MOSI and SCLK are shared between the touch controller and the LCD controller.
In some cases the pin 9 MISO of the LCD can prevent proper display initialization. This pin is not used by openHASP, so it can be left disconnected in case of issues.
LCD Configuration~
The lcd_config.ini
file specifies the different properties of the display, except for the actual pin configuration:
1 2 3 4 5 6 7 8 9 10 11 |
|
HASP build_flags~
Specify the LCD Configuration to use and define the GPIOs in the environment build flags:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|