14 GPIOs are required to drive the 8-bit parallel display. Another 3 GPIOs are needed for the I²C touch sensor. Including the Vcc, Gnd an Rst pins, a total of 23 connections need to be made to the MCU: ## Pin Configuration Pin |Function |ESP32 Pin |Config Name|Display Pin | ------|--------------------|-----------|-----------|------------| 1 |Chip select control pin|GPIO33 |TFT_CS |CS 2 |Data Command control pin|GPIO15 |TFT_DC |RS 3 |Write control pin |GPIO04 |TFT_WR |WR 4 |Read control pin |GPIO02 |TFT_RD |RD 5 |LCD Reset pin |GPIO32 |TFT_RST |RST 6 | |GPIO12 |TFT_D0 |D0 7 | |GPIO13 |TFT_D1 |D1 8 | |GPIO26 |TFT_D2 |D2 9 |8-bit parallel data |GPIO25 |TFT_D3 |D3 10 | |GPIO17 |TFT_D4 |D4 11 | |GPIO16 |TFT_D5 |D5 12 | |GPIO27 |TFT_D6 |D6 13 | |GPIO14 |TFT_D7 |D7 14-21 |Not used, don't connect| NC | |D8-15 22 |Module Ground |GND | |GND 23 |LED Backlight PWM |GPIO5 |TFT_BCKL |BL 24-25 |Module Power |- | |VDD 26-27 |Module Ground |GND | |GND 28-29 | Not connected | | |NC 30 |IO, I²C SDA |GPIO21 |TOUCH_SDA |SDA 31 |Touch Chip Interrupt|GPIO34 |TOUCH_IRQ |INT 32 | Not connected | | |NC 33 |Touch IC Reset |3.3V | |CRST 34 |IO, I²C SCL |GPIO22 |TOUCH_SCL |SCL You need to desolder the 0R resistor on the back side of the panel from the 16-bit position. Then resolder the 0R resistor in the 8-bit position. There are no pins shared between the touch controller and the lcd controller. ## LCD Configuration The `lcd_config.ini` file specifies the different properties of the display, except for the actual pin configuration: ```ini mrb3511 = -D ESP32_PARALLEL=1 -D ILI9488_DRIVER=1 -D TFT_WIDTH=320 -D TFT_HEIGHT=480 -D TFT_ROTATION=0 ; 0=0, 1=90, 2=180 or 3=270 degree -D USER_SETUP_LOADED=1 -D TOUCH_DRIVER=911 ; GT911 Capacitive touch panel driver -D SUPPORT_TRANSACTIONS ``` ## HASP build_flags Specify the LCD Configuration to use and define the 17 GPIOs in the environment build flags: ``` build_flags = ${flags.esp32_flags} ; -- TFT_eSPI build options ------------------------ ${lcd.mrb3511} -D TFT_BCKL=5 ;None, configurable via web UI (e.g. 2 for D4) -D TFT_CS=33 ; Chip select control pin -D TFT_DC=15 ; =RS; Data Command control pin - must use a pin in the range 0-31 -D TFT_RST=32 ; Reset pin -D TFT_WR=4 ; Write strobe control pin - must use a pin in the range 0-31 -D TFT_RD=2 -D TFT_D0=12 ; Must use pins in the range 0-31 for the data bus -D TFT_D1=13 ; so a single register write sets/clears all bits -D TFT_D2=26 -D TFT_D3=25 -D TFT_D4=17 -D TFT_D5=16 -D TFT_D6=27 -D TFT_D7=14 -D TOUCH_SDA=21 -D TOUCH_SCL=22 -D TOUCH_IRQ=34 ; use 34-39 as these are input only pins -D TOUCH_RST=-1 ; not used, connected to 3.3V ```