Ili9341 LCD screen & W5500 Ethernet issue

Hi, I’m trying to setup both ili9341 screen (exactly waveshare 18366) and W5500 to work simultaneously, although I’m facing some issue, so would love some community help in understanding where I’m making a mistake.

My device is ESP32S3 n16r8 devkit. Interestingly both devices set-up separately work perfectly fine. So either LCD screen with Wifi config or W5500 connected via cable but w/o the screen.
On top of that when both devices are set-up ESP seems to boot correctly and operate fine, but w/o Ethernet connectivity and screen being blank.

My config:

esphome:
  name: wallpanel-prototype-v01
  friendly_name: WallPanel_prototype_v0.1
  platformio_options: 
    board_build.flash_mode: dio
  
esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino
  
logger:
  level: VERBOSE

api:

ota:

ethernet:
  type: W5500
  clk_pin: GPIO10
  mosi_pin: GPIO12
  miso_pin: GPIO11
  cs_pin: GPIO9
  interrupt_pin: GPIO13
  reset_pin: GPIO14

spi:
  mosi_pin: GPIO38
  clk_pin: GPIO39
  id: screen_spi

color:
  - id: my_red
    red: 100%
    green: 3%
    blue: 5%

font:
  - file: "gfonts://Roboto"
    id: roboto_20
    size: 20

display:
  - platform: ili9xxx
    model: ILI9341
    dc_pin: GPIO40
    reset_pin: GPIO41
    spi_id: screen_spi
    auto_clear_enabled: False
    lambda: |-
      it.fill(Color::BLACK);
      it.print(0, 0, id(roboto_20), id(my_red), TextAlign::TOP_LEFT, "Hello World!");

Do you have any idea where I’m making a mistake?

Doesn’t seem to be power issue as well as I have external power source for this setup that should easily handle this.

P.S. By them working correctly when connected separately, I meant that both are still physically connected, but disabled in config, so seems like software related issue

At a guess I’d say you are running out of memory and should enable PSRAM. But examining the serial port logs should give some clue.

As Clyde said try fiddling with PSRAM. This post may help: ESP32 S3 DevKitC-1 N16R8 - using PSRAM - howto

Thanks for the tips! I was able to successfully setup PSRAM, but the issue remains.
So both modules work fine when configured separately, but when both are enabled in config they both fail to boot.
I cannot even access logs via usb (logger is stuck at init).
What’s interesting is that I have switch that switches on board LED and this part of program is working correctly…

My guess is that it’s something wrong with SPI config, but trying different options doesn’t really help. I guess that I’m lacking something very basic in how SPI and W5500 SPI are configured by ESPHOME

Update:
Changing screen’s SPI bus interface to software did help a bit, ESP is booting up with both devices operational, but… performance is terrible, so poor that ESPHOME API is unusable

That’s proof’s issue has something to do with how SPI gets init in this situation, but how to configure that to use to separate hardware SPIs, no idea… Software SPI is not an option long-term

Oh, you might find the W5500 is claiming a specific SPI interface, and not playing nicely with other SPI devices - I’d guess it’s not using the SPI hub component. Try specifying the hardware SPI interface for the display to be SPI3.

Ok, so changing interface to SPI3 did help, but with some additional changes. I had to change framework to esp-idf as well and everything started to work correctly.

Seems like there is a bug somewhere with initialisation of SPI buses with Ethernet component when using arduino framework.

Pasting my final config for reference if anyone faces similar issue in the future:

esphome:
  name: wallpanel-prototype-v01
  friendly_name: WallPanel_prototype_v0.1
  platformio_options:
    board_build.flash_mode: dio
  
esp32:
  board: esp32-s3-devkitc-1
  variant: esp32s3
  flash_size: 16MB
  framework:
    type: esp-idf
    version: recommended
    sdkconfig_options: 
      CONFIG_ESP32_S3_BOX_BOARD: "y"

psram:
  mode: octal
  speed: 80MHz
  
logger:
  
api:

ota:

ethernet:
  type: W5500
  clk_pin: GPIO10
  mosi_pin: GPIO12
  miso_pin: GPIO11
  cs_pin: GPIO9
  interrupt_pin: GPIO13
  reset_pin: GPIO14

spi:
  - id: screen_spi
    mosi_pin: GPIO42
    clk_pin: GPIO41
    interface: SPI3

color:
  - id: my_red
    red: 100%
    green: 3%
    blue: 5%

font:
  - file: "gfonts://Roboto"
    id: roboto_20
    size: 20

display:
  - platform: ili9xxx
    model: ILI9341
    dc_pin: GPIO40
    reset_pin: GPIO39
    spi_id: screen_spi
    auto_clear_enabled: False
    setup_priority: -100
    lambda: |-
      it.fill(Color::BLACK);
      it.print(0, 0, id(roboto_20), id(my_red), TextAlign::TOP_LEFT, "Hello World!");```
1 Like