ESPHome with ili9341/4" TFT display - Help!

I’m having nothing but trouble trying to get these displays working. This isn’t rocket science but it sure feels like it.

I get a lit up but completely blank screen, no test card.

My config:

spi:
  clk_pin: GPIO25 
  mosi_pin: GPIO26 
  miso_pin: GPIO4 
  
display:
  - platform: ili9xxx
    id: mydisplay
    model: ILI9341 # I've tried every available option here.  
    cs_pin: GPIO32
    dc_pin: GPIO22
    reset_pin: GPIO27
    rotation: 0
    invert_colors: false
    show_test_card: false
   lambda: |-
       it.print(1, 175, id(font20), id(status_msg).state.c_str());         
       it.print(1, 2, id(font30), "Power");
       it.print(105, 2, id(font30), "Smoke");

       if (id(go).state) {
         //it.print(20, 75, id(font30),  "ON");
         it.filled_rectangle(40, 40, 30, 42);  
       } else {
         //it.print(20, 75, id(font30), "OFF");
         it.rectangle(40, 40, 30, 42);  
       }

       if (id(smoke_mode).state) {
         //it.print(115, 75, id(font30), "ON");
         it.filled_rectangle(140, 40, 30, 42);  
       } else {
         //it.print(115, 75, id(font30), "OFF");
         it.rectangle(140, 40, 30, 42);  
       }

       //smoker_set_temp on left
       it.print(1, 90, id(font20), "Set Temp");
       it.printf(0, 110, id(font45),  "%.0f°", id(smoker_set_temp).state);

       //smoker_rtd_temperature on right
       it.print(105, 90, id(font20), "RTD Temp");
       it.printf(107, 110, id(font45), "%.0f°", id(smoker_rtd_temperature).state);

font:
  - file: "gfonts://Roboto"
    id: font45
    size: 45
  - file: "gfonts://Roboto"
    id: font50
    size: 50
  - file: "gfonts://Roboto"
    id: font40
    size: 40
  - file: "gfonts://Roboto"
    id: font30
    size: 30
  - file: "gfonts://Roboto"
    id: font20
    size: 20    

the log output

18:49:49][C][spi:064]: SPI bus:
[18:49:49][C][spi:065]:   CLK Pin: GPIO25
[18:49:49][C][spi:066]:   SDI Pin: GPIO4
[18:49:49][C][spi:067]:   SDO Pin: GPIO26
[18:49:49][C][spi:072]:   Using HW SPI: SPI
[18:49:49][C][i2c.arduino:071]: I2C Bus:
[18:49:49][C][i2c.arduino:072]:   SDA Pin: GPIO10
[18:49:49][C][i2c.arduino:073]:   SCL Pin: GPIO5
[18:49:49][C][i2c.arduino:074]:   Frequency: 50000 Hz
[18:49:49][C][i2c.arduino:086]:   Recovery: bus successfully recovered
[18:49:49][I][i2c.arduino:096]: Results from i2c bus scan:
[18:49:49][I][i2c.arduino:098]: Found no i2c devices!
[18:49:49][C][ili9xxx:094]: ili9xxx
[18:49:49][C][ili9xxx:094]:   Rotations: 0 °
[18:49:49][C][ili9xxx:094]:   Dimensions: 240px x 320px
[18:49:49][C][ili9xxx:095]:   Width Offset: 0
[18:49:49][C][ili9xxx:096]:   Height Offset: 0
[18:49:49][C][ili9xxx:105]:   Color mode: 8bit 332 mode
[18:49:49][C][ili9xxx:111]:   Data rate: 40MHz
[18:49:49][C][ili9xxx:113]:   Reset Pin: GPIO27
[18:49:49][C][ili9xxx:114]:   CS Pin: GPIO32
[18:49:49][C][ili9xxx:115]:   DC Pin: GPIO22
[18:49:49][C][ili9xxx:117]:   Color order: BGR
[18:49:49][C][ili9xxx:118]:   Swap_xy: NO
[18:49:49][C][ili9xxx:119]:   Mirror_x: YES
[18:49:49][C][ili9xxx:120]:   Mirror_y: NO
[18:49:49][C][ili9xxx:121]:   Invert colors: NO
[18:49:49][C][ili9xxx:126]:   Update Interval: 1.0s
... other messages, then this endlessly repeating msg
19:12:22][W][component:237]: Component display took a long time for an operation (89 ms).
[19:12:22][W][component:238]: Components should block for at most 30 ms.
[19:12:23][W][component:237]: Component display took a long time for an operation (89 ms).
[19:12:23][W][component:238]: Components should block for at most 30 ms.
[19:12:24][W][component:237]: Component display took a long time for an operation (89 ms).
[19:12:24][W][component:238]: Components should block for at most 30 ms.
[19:12:25][W][component:237]: Component display took a long time for an operation (89 ms).
[19:12:25][W][component:238]: Components should block for at most 30 ms.
[19:12:26][W][component:237]: Component display took a long time for an o

I’ve tried various other model: types, all giving only these 3 lines in the ili9xxx section of the log:

[18:58:16][D][ili9xxx:034]: Setting up ILI9xxx
[18:58:16][D][spi_device:362]: mode 0, data_rate 40000kHz
[18:58:17][D][ili9xxx:030]: Wrote MADCTL 0x48

The only model that gives full info is model: ILI9341

Is there a trick to getting this display working? I must be missing something really basic here. Hours of wasted time! I have 4 of these displays and they all are blank.
I have an e-paper display working right out of the gate, but it’s not going to work for my application. I used the same basic pins for it, so the ESP32 is working just fine.

Is the backlight on? I see nothing in your YAML that would be driving it.

Yes, sorry, left that out of my post… figured that was unnecessary.

image

  - platform: gpio
    pin: GPIO2
    name: "Display on/off"
    inverted: no
    restore_mode: RESTORE_DEFAULT_ON
    id: display_on_off

display turns on & off toggling that SW, its just completely blank.

Reduce the data rate, start with something like 5MHz. Try SPI mode 3. But make one change at a time and test!

I’ve tried SPI modes 0,1,2,3. All blank displays…
trying different data rates now.

data rate from 1-80MHZ. Same result - blank screen.

Got it… FINALLY. What a PITA.

    model: ILI9341 
    spi_mode: 3
    data_rate: 1MHz

AND I disconnected MISO. From the docs:

Note: The maximum achievable data rate will depend on the chip type (e.g. ESP32 vs ESP32-S3) the pins used (on ESP32 using the default SPI pins allows higher rates) and the connection type (on-board connections will support higher rates than long cables or DuPont wires.) If in doubt, start with a low speed and test higher rates to find what works. A MISO pin should preferably not be specified, as this will limit the maximum rate in some circumstances, and is not required if the SPI bus is used only for the display.

Anyone know of a WYSIWYG Editor that spits out YAML?