What the ST7789V is
The Sitronix ST7789V datasheet (v1.3) describes a single-chip driver for 240RGB×320 a-Si TFT panels with 262K colours. The key figures:
- Frame memory: 240 × 320 × 18 bits on chip, which is 172,800 bytes. The image lives in the driver, so the host only writes the pixels that change.
- Interfaces: 8080 MCU bus (8/9/16/18-bit), RGB (6/16/18-bit with VSYNC, HSYNC, DOTCLK and ENABLE), and 3-line or 4-line SPI.
- Supplies: VDDI (I/O) 1.65 V to 3.3 V and VDD (analog) 2.4 V to 3.3 V.
- Operating temperature: −30 °C to +85 °C.
Most small modules use 4-line SPI (SCL, SDA, CS, D/C, plus RESET) in RGB565.
SPI clock: datasheet limit vs practice
The datasheet's 4-line serial timing table gives a minimum write clock cycle of 66 ns and a minimum read cycle of 150 ns. That is about 15 MHz for writes and 6.6 MHz for reads.
Firmware commonly runs faster than the datasheet figure. Xiaozhi-esp32 sets its ST7789 panels to 40 MHz, and ESPHome's mipi_spi driver defaults to 10 MHz unless you set data_rate. A clock above 15 MHz is outside the datasheet, so whether it works depends on the module and the wiring. Test at the clock you plan to ship, with the cable you plan to ship.
Bring-up sequence
- Hardware reset. The datasheet asks for a 5 ms wait after RESX goes high before sending commands, and no Sleep Out for 120 ms after a reset.
- Sleep Out (
11h). Wait 5 ms before the next command. The 120 ms rule applies to sending Sleep In again after Sleep Out. - Pixel format and orientation.
3Ah(COLMOD)55hselects 16-bit RGB565, and36h(MADCTL) sets rotation and RGB/BGR order. - Inversion. IPS panels usually need Inversion On (
21h) and TN panels usually do not. Check this against your panel's init table. - Display On (
29h), then turn on the backlight.
ESPHome: move to mipi_spi
ESPHome's st7789v platform is deprecated. Its source says it will be removed in ESPHome 2027.5.0, and the documentation points to the mipi_spi driver, which lists an ST7789V model (240×320). For a new project, use:
platform: mipi_spiandmodel: ST7789Vdc_pin(required), pluscs_pinandreset_pinif they are wired to GPIOsinvert_colors: truefor most IPS panels (the default is false)color_order: rgbif red and blue are swapped (the default is bgr)data_rate: set it explicitly, because the default is 10 MHz
With no CS pin, mipi_spi defaults to SPI mode 3. That matches the 7-pin 240×240 modules, which tie CS low on the board.
Using it with xiaozhi-esp32
The breadboard LCD build of xiaozhi-esp32 (bread-compact-wifi-lcd) defaults to the LCD_ST7789_240X320 display type. The choices that matter for an ST7789 panel are:
- 240×320 IPS:
LCD_ST7789_240X320, with colour inversion on. - 240×320 TN:
LCD_ST7789_240X320_NO_IPS, with inversion off. If you choose the IPS setting for a TN panel, the colours come out as a negative. - 240×240:
LCD_ST7789_240X240for modules with a CS pin (SPI mode 0), andLCD_ST7789_240X240_7PINfor 7-pin modules without CS (SPI mode 3). - Wiring in that board file: backlight GPIO42, MOSI GPIO47, CLK GPIO21, DC GPIO40, RST GPIO45, CS GPIO41, at 40 MHz.
Our PJ2003L02 (2.0″ 240×320) is a TN panel, so it needs the _NO_IPS setting. The PJ2401H25 (2.4″ 240×320) is IPS and works with the default. Both connect through an FPC, not a pin header, so a breadboard build needs an FPC adapter.
Symptoms and fixes
Symptom | Check |
|---|---|
Colours look like a photo negative | Inversion does not match the panel. Toggle |
Red and blue swapped | The RGB/BGR bit in MADCTL. In ESPHome, set |
Image shifted on a 240×240 panel | The frame memory is 240×320, so some rotations need a row or column offset. Set the offset in your library. |
Garbage or no image at high SPI clock | Lower the clock towards the datasheet's 15 MHz and shorten the wiring, then raise it again while testing. |
See the TFT white screen guide and how to tell an ILI9341 from an ST7789.
ST7789V init code
// Reference init sequence. Adjust MADCTL, inversion and offsets per panel.
write_cmd(0x01); // SWRESET
delay_ms(150);
write_cmd(0x11); // SLPOUT
delay_ms(120);
write_cmd(0x3A); write_data(0x55); // COLMOD: 16-bit RGB565
write_cmd(0x36); write_data(0x00); // MADCTL: rotation / RGB order
write_cmd(0x21); // INVON: most IPS panels need inversion
write_cmd(0x13); // NORON
write_cmd(0x29); // DISPON
delay_ms(20);ST7789V library support
| Library | Driver / class | Notes |
|---|---|---|
| TFT_eSPI (Arduino) | ST7789_DRIVER | |
| LovyanGFX (Arduino / ESP-IDF) | lgfx::Panel_ST7789 | |
| ESP-IDF esp_lcd | esp_lcd_new_panel_st7789() (built in) | |
| Note | Many ST7789 panels need colour inversion enabled. |
User_Setup_ST7789V.h · LGFX_ST7789V.hpp. Pins are placeholders; we email updates when we add tested configurations.
Dev boards using ST7789V
Display modules using ST7789V

2.8" 240×320 TFT LCD, SPI (PJ2801H22-23H10P200)

2.4" 240×320 TFT LCD, SPI (PJ2401I24-22H30P250)

2.4" 240×320 TFT LCD, MCU (PJ2401I02-22H38P300)

2.4" 240×320 IPS TFT LCD, SPI / MCU / RGB (PJ2401H28-22H45P200)

2.4" 240×320 IPS TFT LCD, SPI / MCU / RGB (PJ2401H25-22H45P200)

2" 240×320 TFT LCD, SPI / MCU (PJ2003L02-22H22P300)
Guides & comparisons
ILI9341 vs ST7789: How to Tell Which Controller Your Display Has
Boards sold under the same name ship with ILI9341 or ST7789 controllers. Identify yours in minutes by symptoms or by reading the ID register, then apply the settings that fix white screens and wrong colours.
GuideHow to Choose a Display for ESP32-S3 (SPI, QSPI, RGB)
Pick the interface and resolution from two numbers: how many bits per second the bus can move and how much memory the frame needs. With worked figures and reference builds.
TroubleshootingTFT Display White Screen: 9 Causes and How to Fix Them
Backlight on, nothing drawn. A fault tree for the most common bring-up failure, with what to measure at each step and the datasheet limits that matter.
ST7789V troubleshooting & FAQ
Why are the colors inverted on my ST7789 display?
Inversion does not match the panel. IPS panels usually need Inversion On (21h) and TN panels usually do not. In ESPHome set invert_colors; in xiaozhi-esp32 pick the IPS or _NO_IPS display type that matches your panel. If red and blue are swapped instead, change the RGB/BGR bit in MADCTL (36h) or ESPHome's color_order.
What SPI clock can ST7789V handle?
The Sitronix datasheet gives a minimum write clock cycle of 66 ns (about 15 MHz) and a read cycle of 150 ns (about 6.6 MHz). Many firmware projects run faster, for example xiaozhi-esp32 at 40 MHz, but that is outside the datasheet, so test at your final clock and cable length. ESPHome's mipi_spi driver defaults to 10 MHz unless you set data_rate.
Why is my 240×240 image shifted by 80 pixels?
The ST7789V frame memory is 240×320. On 240×240 panels some rotations need a row or column offset (often 80) in CASET/RASET; most libraries expose this as a rowstart/colstart or offset setting.
Is the ESPHome st7789v component being removed?
Yes. ESPHome marks the st7789v platform as deprecated and its source says it will be removed in ESPHome 2027.5.0. New configurations should use platform: mipi_spi with model: ST7789V, and set data_rate explicitly because the default is 10 MHz.