A little help with ST7789V running on octal spi

Hey, so I’m trying to get ESPHOME to drive an ESP32-2432S022 development board made by GUITION. Which is an ESP32-WROOM-32 with a ST7789V connected to it driving a 240x320 display with the following pin maps

DB0-DB7 = GND
CS = IO17
RS = IO16
WR = IO4
RD = IO2
IM0 is tied to 3.3v (I can't find configuration for IM1,2,3)
Backlight = IO0
DB8 = IO15
DB9 = IO13
DB10 = IO12
DB11 = IO14
DB12 = IO27
DB13 = IO25
DB14 = IO33
DB15 = IO32

The factory demo code initialises two objects

    lgfx::Panel_ST7789 _panel_instance; // ST7789UI
    lgfx::Bus_Parallel8 _bus_instance;  // MCU8080 8B

With this configuration

            auto cfg = _bus_instance.config();
            cfg.freq_write = 25000000;
            cfg.pin_wr = 4;
            cfg.pin_rd = 2;
            cfg.pin_rs = 16;

            cfg.pin_d0 = 15;
            cfg.pin_d1 = 13;
            cfg.pin_d2 = 12;
            cfg.pin_d3 = 14;
            cfg.pin_d4 = 27;
            cfg.pin_d5 = 25;
            cfg.pin_d6 = 33;
            cfg.pin_d7 = 32;

            _bus_instance.config(cfg);
            _panel_instance.setBus(&_bus_instance);

The fact that IM0 is tied to 3.3v and I can’t find any references to the other 3 IM pins, I’m going to assumed they’re tied to ground…

I did some hunting, a lot of googling, all the major AI bots, and crawling through github…

It seems i8080 (aka: i80) is implemented as spi by this pull request

After a bit of trawling, it also seems that it’s only available on the esp-idf framework…

So, I have this comfig

esphome:
  name: testdisplay
  friendly_name: TestDisplay

esp32:
  board: esp32dev
  framework:
    type: esp-idf

spi:
  - id: octal_spi
    type: octal
    interface: hardware
    clk_pin: GPIO4
    data_pins: [GPIO15, GPIO13, GPIO12, GPIO14, GPIO27, GPIO25, GPIO33, GPIO32]
  
display:
  - platform: mipi_spi
    model: ST7789V
    spi_id: octal_spi
    cs_pin: GPIO17
    dc_pin: GPIO16
    reset_pin: GPIO2
    dimensions: 240x320
    rotation: 0
    color_depth: 8
    update_interval: 1s
    show_test_card: true

Problem is that it’s now mad about

ID ‘octal_spi’ of type spi::OctalSPIComponent doesn’t inherit from spi::SPIComponent. Please double check your ID is pointing to the correct value.

Looks basically like all the test cases in the repo…

I even tried with spi_mode: mode3 on the display…

Any assistance would be greatly appreciated…

You’re missing the bus_mode in the display config. See MIPI SPI Display Driver - ESPHome - Smart Home Made Simple

Thanks for that, I was sure I tried that at some point and backed out but it compiles and installs now.

I also got backlight control working… but still nothing actually on the display…

It’s unfortunately telling me Component Display marked as Failed

Config is now

esphome:
  name: testdisplay
  friendly_name: TestDisplay

esp32:
  board: esp32dev
  framework:
    type: esp-idf

spi:
  - id: octal_spi
    type: octal
    interface: hardware
    clk_pin: GPIO4
    data_pins: [GPIO15, GPIO13, GPIO12, GPIO14, GPIO27, GPIO25, GPIO33, GPIO32]
  
display:
  - platform: mipi_spi
    model: ST7789V
    spi_id: octal_spi
    spi_mode: mode0  # mode3?
    bus_mode: octal
    cs_pin: GPIO17
    dc_pin: GPIO16
    reset_pin: GPIO2
    dimensions: 240x320
    rotation: 0
    # color_depth: 8
    update_interval: 1s
    show_test_card: true

light:
  - platform: monochromatic
    name: "Backlight"
    output: backlight_output

output:
  - platform: ledc
    pin: GPIO0
    id: backlight_output

Logging output seems to indicate nothing too major is wrong…

[19:37:32][C][spi:068]: SPI bus:
[19:37:32][C][spi:069]:   CLK Pin: GPIO4
[19:37:32][C][spi:070]:   SDI Pin: 
[19:37:32][C][spi:071]:   SDO Pin: 
[19:37:32][C][spi:073]:   Data pin 0: GPIO15
[19:37:32][C][spi:073]:   Data pin 1: GPIO13
[19:37:32][C][spi:073]:   Data pin 2: GPIO12
[19:37:32][C][spi:073]:   Data pin 3: GPIO14
[19:37:32][C][spi:073]:   Data pin 4: GPIO27
[19:37:32][C][spi:073]:   Data pin 5: GPIO25
[19:37:32][C][spi:073]:   Data pin 6: GPIO33
[19:37:32][C][spi:073]:   Data pin 7: GPIO32
[19:37:32][C][spi:076]:   Using HW SPI: SPI2_HOST
[19:37:32][C][ledc.output:180]: LEDC Output:
[19:37:32][C][ledc.output:181]:   Pin GPIO0
[19:37:32][C][ledc.output:182]:   LEDC Channel: 0
[19:37:32][C][ledc.output:183]:   PWM Frequency: 1000.0 Hz
[19:37:32][C][ledc.output:184]:   Phase angle: 0.0°
[19:37:32][C][ledc.output:185]:   Bit depth: 16
[19:37:32][C][light:092]: Light 'Backlight'
[19:37:32][C][light:094]:   Default Transition Length: 1.0s
[19:37:32][C][light:095]:   Gamma Correct: 2.80
[19:37:32][C][display.mipi_spi:450]: MIPI_SPI Display
[19:37:32][C][display.mipi_spi:451]:   Model: ST7789V
[19:37:32][C][display.mipi_spi:452]:   Width: 240
[19:37:32][C][display.mipi_spi:453]:   Height: 320
[19:37:32][C][display.mipi_spi:458]:   Swap X/Y: NO
[19:37:32][C][display.mipi_spi:459]:   Mirror X: NO
[19:37:32][C][display.mipi_spi:460]:   Mirror Y: NO
[19:37:32][C][display.mipi_spi:461]:   Color depth: 16 bits
[19:37:32][C][display.mipi_spi:462]:   Invert colors: NO
[19:37:32][C][display.mipi_spi:463]:   Color order: BGR
[19:37:32][C][display.mipi_spi:464]:   Pixel mode: 16bit
[19:37:32][C][display.mipi_spi:474]:   DC Pin: GPIO16
[19:37:32][C][display.mipi_spi:475]:   SPI Mode: 0
[19:37:32][C][display.mipi_spi:476]:   SPI Data rate: 10MHz
[19:37:32][C][display.mipi_spi:477]:   SPI Bus width: 8
[19:37:32][E][component:085]:   Component display is marked FAILED: 

You’re running out of RAM; if you have PSRAM you will want to enable that, otherwise you will need to use 8 bit color mode, or use LVGL with buffer_size: 25% or less.

Yeah, I figured, it has no psram that I can see, their docs don’t mention any, it does run the full lvgl demo suite tho…

    rotation: 0
    color_depth: 8
    update_interval: 1s

results in a

  Unknown value '8', valid options are '16', '16bit'.

Which is weird cos I am fairly sure I read the docs right (not being facetious, it’s not the first time I’ve read the wrong part of the docs or misunderstood the point)

  • color_depth (Optional): The color depth of the display buffer, expressed in bits. Options are 16 (default) and 8. 8 bit depth will result in only 256 possible colors and should be used only if the microcontroller has limited memory. The driver will convert the 8 bit color to the display chip’s required format.

ah, 8 bit mode isn’t currently supported on the octal bus (mainly because it never occurred to me that anyone would bother using an 8 bit display bus on an ESP32 without PSRAM.)

So your best bet is to use LVGL and set the buffer_size to a low percentage.

In your defense, I also didn’t expect to be in this situation, I got this panel for a different task and was like “this looks like fun” who would have thought that $5 in price would make such a big difference lol.

I will go do some LVGL research and give it a shot, thanks for your help so far tho.

So, this is going well…

[01:59:25][C][wifi:451]:   DNS2: 0.0.0.0
[01:59:25][W][spi-esp-idf:041]: spi_setup called before initialisation
[01:59:25][E][spi-esp-idf:152]: Transmit failed - err 102
[01:59:25][W][spi-esp-idf:041]: spi_setup called before initialisation
[01:59:25][E][spi-esp-idf:152]: Transmit failed - err 102
[01:59:25][W][spi-esp-idf:041]: spi_setup called before initialisation
[01:59:25][E][spi-esp-idf:152]: Transmit failed - err 102
[01:59:25][W][spi-esp-idf:041]: spi_setup called before initialisation
[01:59:25][E][spi-esp-idf:152]: Transmit failed - err 102
[01:59:25][W][spi-esp-idf:041]: spi_setup called before initialisation
[01:59:25][E][spi-esp-idf:152]: Transmit failed - err 102
[01:59:25][W][spi-esp-idf:041]: spi_setup called before initialisation
[01:59:25][E][spi-esp-idf:152]: Transmit failed - err 102
[01:59:25][W][spi-esp-idf:041]: spi_setup called before initialisation
[01:59:25][E][spi-esp-idf:152]: Transmit failed - err 102
[01:59:25][W][spi-esp-idf:041]: spi_setup called before initialisation
[01:59:25][E][spi-esp-idf:152]: Transmit failed - err 102
[01:59:25][W][spi-esp-idf:041]: spi_setup called before initialisation
[01:59:25][E][spi-esp-idf:152]: Transmit failed - err 102
[01:59:25][W][spi-esp-idf:041]: spi_setup called before initialisation
[01:59:25][E][spi-esp-idf:152]: Transmit failed - err 102
[01:59:25][W][spi-esp-idf:041]: spi_setup called before initialisation
[01:59:25][E][spi-esp-idf:152]: Transmit failed - err 102
[01:59:25][W][spi-esp-idf:041]: spi_setup called before initialisation
[01:59:25][E][spi-esp-idf:152]: Transmit failed - err 102

prints faster than edge can render it (wow, I’ll never get used to saying edge)

esphome:
  name: testdisplay
  friendly_name: TestDisplay

esp32:
  board: esp32dev
  framework:
    type: esp-idf

spi:
  - id: octal_spi
    type: octal
    interface: hardware
    clk_pin: GPIO4
    data_pins: [GPIO15, GPIO13, GPIO12, GPIO14, GPIO27, GPIO25, GPIO33, GPIO32]

display:
  - id: my_display
    platform: mipi_spi
    model: ST7789V
    spi_id: octal_spi
    spi_mode: mode0
    bus_mode: octal
    cs_pin: GPIO17
    dc_pin: GPIO16
    reset_pin: GPIO2
    dimensions: 240x320
    rotation: 0
    auto_clear_enabled: false
    update_interval: never

light:
  - platform: monochromatic
    name: "Backlight"
    output: backlight_output

output:
  - platform: ledc
    pin: GPIO0
    id: backlight_output

lvgl:
  buffer_size: 20%
  displays: [my_display]

Might just resort to hand coding up something…

Ah, the ESP32 doesn’t support octal SPI, only the -S3. So that driver is not going to work for you.

You could try [ili9xxx] Use io_bus for communication by clydebarrow · Pull Request #8230 · esphome/esphome · GitHub

Yeh I 100% gave up on this entirely, probably could have got it eventually but meh, I’ll code something up manually that uses the display.

I ordered the two GUITION displays (round and rectangle) that the docs say are basically supported out of the box, copy pasta’d someone’s git repo into the JC3248W535 and it’s just working with a spinning circle with lvgl.

Now to figure out my own config :smiley:

Thanks for trying tho.

1 Like

While, yep, so much easier, I think the model is typoed?

display:
  - platform: qspi_dbi
    model: JC4832W535

The docs mention and link to the JC3248W535 but the driver is inside out? The docs match the model number on my board too.

Where did you get that from? Just use the correct model - JC3248W535. And what does it have to do with this thread?

I missed that you are using qspi_dbi - in the latest ESPHome - qspi_dbi has been superseded by mipi_spi.