Skip to content
Display Engineer
Driver IC · Sitronix

ST7789V: datasheet & init code

The ST7789V is a single-chip TFT driver with on-chip GRAM for displays up to 240×320, widely used in 1.3″–2.4″ IPS modules driven over 4-wire SPI.

DEDisplay Engineer Applications Team · Display application engineersUpdated Oct 23, 2026
ManufacturerSitronix
TypeDisplay driver
InterfacesSPI / MCU (8080 parallel) / RGB (parallel)
Max resolution240×320

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

  1. 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.
  2. Sleep Out (11h). Wait 5 ms before the next command. The 120 ms rule applies to sending Sleep In again after Sleep Out.
  3. Pixel format and orientation. 3Ah (COLMOD) 55h selects 16-bit RGB565, and 36h (MADCTL) sets rotation and RGB/BGR order.
  4. Inversion. IPS panels usually need Inversion On (21h) and TN panels usually do not. Check this against your panel's init table.
  5. 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_spi and model: ST7789V
  • dc_pin (required), plus cs_pin and reset_pin if they are wired to GPIOs
  • invert_colors: true for most IPS panels (the default is false)
  • color_order: rgb if 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_240X240 for modules with a CS pin (SPI mode 0), and LCD_ST7789_240X240_7PIN for 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 21h/20h, invert_colors, or the IPS/NO_IPS setting.

Red and blue swapped

The RGB/BGR bit in MADCTL. In ESPHome, set color_order.

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

ST7789V minimal init (SPI, RGB565)c
// 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

LibraryDriver / classNotes
TFT_eSPI (Arduino)ST7789_DRIVER
LovyanGFX (Arduino / ESP-IDF)lgfx::Panel_ST7789
ESP-IDF esp_lcdesp_lcd_new_panel_st7789() (built in)
NoteMany ST7789 panels need colour inversion enabled.
Download ST7789V config templates

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

Guides & comparisons

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.

Sources

  1. Sitronix ST7789V datasheet v1.3 (hosted by Newhaven Display)
  2. ESPHome: MIPI SPI display driver
  3. ESPHome: ST7789V platform (deprecation notice)
  4. ESPHome source: st7789v/display.py (removal in 2027.5.0)
  5. xiaozhi-esp32: bread-compact-wifi-lcd/config.h
  6. xiaozhi-esp32: main/Kconfig.projbuild (default LCD type)

Not sure which display fits your design?

Send us your size, interface and host processor. A display engineer replies within 12 hours with 2–3 options, datasheets and init code. Samples from 1 pc.