Waveshare 4.3 inch ESP32 with RPI_DPI_RGB driver no display

I cannot seem to get the Waveshare 4.3 ESP32 touch display to display anything. I am using the RPI_DPI_RGB driver using the provided settings for Waveshare. I have this display working fine under VS Code and have double checked the pin configuration for that and they are identical as that in ESPHome YAML.

I originally had LVGL and the touch configured but for diagnostics stripped it down to bare minimum. So the code above the “display” section is vanilla config with the exception I changed the platform type from arduino to esp-idf. It uploads, i can visit the device’s web page. It just doesn’t seem to do anything with the display.

I assume the Lambda function would display something after display setup. I’m really new to ESPHome so I could be doing something silly. I’ve attached the YAML I used.

Help ?

substitutions:
  name: esphome-web-97f488
  friendly_name: Control Panel

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  min_version: 2024.6.0
  name_add_mac_suffix: false
  platformio_options:
    board_build.flash_mode: dio
  project:
    name: esphome.web
    version: dev

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
- platform: esphome

# Allow provisioning Wi-Fi via serial
improv_serial:

wifi:
  # Set up a wifi access point
  ap: {}

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/firmware/esphome-web/esp32s3.yaml@main
  import_full_config: true

# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
  authorizer: none

# To have a "next url" for improv serial
web_server:

display:
  - platform: rpi_dpi_rgb
    auto_clear_enabled: false
    color_order: RGB
    pclk_frequency: 16MHz
    dimensions:
      width: 800
      height: 480
    de_pin:
      number: 5
    hsync_pin:
      number: 46
      ignore_strapping_warning: true
    vsync_pin:
      number: 3
      ignore_strapping_warning: true
    pclk_pin: 7
    hsync_back_porch: 30
    hsync_front_porch: 210
    hsync_pulse_width: 30
    vsync_back_porch: 4
    vsync_front_porch: 4
    vsync_pulse_width: 4
    data_pins:
      red:
        - 1         #r3
        - 2         #r4
        - 42        #r5
        - 41        #r6
        - 40        #r7
      blue:
        - 14        #b3
        - 38        #b4
        - 18        #b5
        - 17        #b6
        - 10        #b7
      green:
        - 39        #g2
        - 0         #g3
        - 45        #g4
        - 48        #g5
        - 47        #g6
        - 21        #g7
    lambda: |-
      auto black = Color(0, 0, 0);
      auto red = Color(255, 0, 0);
      auto green = Color(0, 255, 0);
      auto blue = Color(0, 0, 255);
      auto white = Color(255, 255, 255);
      it.filled_circle(20, 32, 15, black);
      it.filled_circle(40, 32, 15, red);
      it.filled_circle(60, 32, 15, green);
      it.filled_circle(80, 32, 15, blue);
      it.filled_circle(100, 32, 15, white);

Ok, I found an example on this thread from @Jon_2232 :

I couldn’t get it to compile initially. The item that seem to give a display was:

psram:
  mode: octal
  speed: 80MHz

But I had a lot of corruption and the synch didnt seem to be quite right. I think the corruption was probably due to where ever memory was being used wasnt a great place.

I used my timing settings and then folded in Jon’s code and got it to compile and it is displaying his clock demo.

This is what my code looks like now:

substitutions:
  name: esphome-web-97f488
  friendly_name: Control Panel

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  min_version: 2024.6.0
  name_add_mac_suffix: false
  platformio_options:
    build_flags: "-DBOARD_HAS_PSRAM"
    board_build.arduino.memory_type: qio_opi
    board_build.flash_mode: dio
    board_upload.maximum_ram_size: 524288
  project:
    name: esphome.web
    version: dev

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf
    sdkconfig_options:
      CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: y
      CONFIG_ESP32S3_DATA_CACHE_64KB: y
      CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
      CONFIG_SPIRAM_RODATA: y

psram:
  mode: octal
  speed: 80MHz

# Enable logging
logger:

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
- platform: esphome

# Allow provisioning Wi-Fi via serial
improv_serial:

wifi:
  # Set up a wifi access point
  ap: {}

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/firmware/esphome-web/esp32s3.yaml@main
  import_full_config: true

# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
  authorizer: none

# To have a "next url" for improv serial
web_server:
  
i2c:
  sda: GPIO08
  scl: GPIO09
  scan: True
  id: bus_a

display:
  - platform: rpi_dpi_rgb
    id: my_display
    auto_clear_enabled: false
    color_order: RGB
    update_interval: never
    pclk_frequency: 16MHz
    dimensions:
      width: 800
      height: 480
    de_pin:
      number: 5
    hsync_pin:
      number: 46
      ignore_strapping_warning: true
    vsync_pin:
      number: 3
      ignore_strapping_warning: true
    pclk_pin: 7
    pclk_inverted: true
    hsync_back_porch: 40 #30
    hsync_front_porch: 20 #210 
    hsync_pulse_width: 1 #30
    vsync_back_porch: 8 #4
    vsync_front_porch: 4 #4
    vsync_pulse_width: 1 #4
    data_pins:
      red:
        - 1         #r3
        - 2         #r4
        - 42        #r5
        - 41        #r6
        - 40        #r7
      blue:
        - 14        #b3
        - 38        #b4
        - 18        #b5
        - 17        #b6
        - 10        #b7
      green:
        - 39        #g2
        - 0         #g3
        - 45        #g4
        - 48        #g5
        - 47        #g6
        - 21        #g7


font:
  - file: "gfonts://Roboto"
    id: chu_nano
    size: 12

touchscreen:
  platform: gt911
  id: my_touch
  interrupt_pin: GPIO4
  on_touch:
    - lambda: |-
          ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
              touch.x,
              touch.y,
              touch.x_raw,
              touch.y_raw
              );


external_components:
  - source: github://pr#6363
    refresh: 0min
    components: [lvgl]


lvgl:
  displays:
    - display_id: my_display
  buffer_size: 25%
  pages:
    - id: clock_page
      widgets:
        - obj: # Clock container
            height: size_content
            width: 800 #240
            align: CENTER
            pad_all: 0
            border_width: 0
            bg_color: 0xFFFFFF
            widgets:
              - meter: # Clock face
                  height: 400 #220
                  width: 400 #220
                  align: center
                  bg_opa: TRANSP
                  text_color: 0x000000
                  scales:
                    - ticks: # minutes scale
                        width: 1
                        count: 61
                        length: 10
                        color: 0x000000
                      range_from: 0
                      range_to: 60
                      angle_range: 360
                      rotation: 270
                      indicators:
                        - line:
                            id: minute_hand
                            width: 3
                            color: 0xa6a6a6
                            r_mod: -4
                            value: 0
                    - ticks: # hours scale
                        width: 1
                        count: 12
                        length: 1
                        major:
                          stride: 1
                          width: 4
                          length: 8
                          color: 0xC0C0C0
                          label_gap: 12
                      angle_range: 330
                      rotation: 300
                      range_from: 1
                      range_to: 12
                    - indicators:
                        - line:
                            id: hour_hand
                            width: 5
                            color: 0xa6a6a6
                            r_mod: -30
                            value: 0
                      angle_range: 360
                      rotation: 270
                      range_from: 0
                      range_to: 720

time:
  - platform: homeassistant
    id: time_comp

interval:
  - interval: 30s
    then:
      if:
        condition:
          time.has_time:
        then:
          - script.execute: time_update

script:
  - id: time_update
    then:
      - lvgl.indicator.update:
          id: minute_hand
          value: !lambda |-
            return id(time_comp).now().minute;
      - lvgl.indicator.update:
          id: hour_hand
          value: !lambda |-
            auto now = id(time_comp).now();
            return std::fmod(now.hour, 12) * 60 + now.minute;

It’s basically Jon’s code, I dont know if I return the timings to his it would be any different. Anyhow, I consider this solved.

Here are a few other compiler options you can try to speed up the psram

esp32:
  board: esp32-s3-devkitc-1
  variant: esp32s3
  flash_size: 16MB
  framework:
    type: esp-idf
    sdkconfig_options:
      COMPILER_OPTIMIZATION_SIZE: y
      CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
      CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
      CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
      CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
      CONFIG_SPIRAM_RODATA: y

psram:
  mode: octal
  speed: 80MHz
1 Like

Thanks Andrew, I’ve added those settings in.

Out of interest do you have issues with doing wifi updates? It seems really slow, so slow that it disconnects, or its really fast. I often have to do reboot it just before I’m about to upload.

I’ve even had to resort to putting the board back to initial settings. It’s as if when running it cant process the connection.

I don’t have one of those screens. But I do have the a similar screen (sunton-esp32-8048s070) and I don’t have issues with upgrades.

Hi @fabkins
Thank you for your post. I have the very same screen and I’ve been struggling to make it show something for a few months now. Your code make it work!
I am having the same issue where wifi updates are really slow and fail due to time out. Did you find out a solution to that problem? If not, what is exactly that you mean by “putting the board back to initial settings”?

I have heard of some of these screens sharing the Wi-Fi pin with other hardware. This causes lot’s of issues with Wi-Fi updates. In this case you may have to update via USB.

You may want to look into using a different screen.

Using ESP-IDF 5.3 will fix that. There is new code in ESPHome to take advantage of a better display driver - it’s in the dev branch, not sure if it made it into the latest release.

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf
    platform_version: 6.8.1
    version: 5.3.0
    sdkconfig_options:
      CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
      CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
      CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
      CONFIG_SPIRAM_RODATA: y

Just updated to 2024.12.0. and the same config now shows as too big for the board. this what I’m seeing during the build.

Here is the resulting error.

Here’s My device config.


esphome:
  name: ${device_id}
  friendly_name: ${device_name}
  area: ${device_area}
  platformio_options:
    build_flags: "-DBOARD_HAS_PSRAM"
    board_build.arduino.memory_type: qio_opi
    board_build.flash_mode: dio
    board_upload.maximum_ram_size: 524288
    # board_upload.maximum_size: 8388608
  on_boot:
    then:
      - delay: 5s
      - lvgl.widget.hide: boot_screen

esp32:
  board: esp32-s3-devkitc-1
  variant: esp32s3
  framework:
    type: esp-idf
    sdkconfig_options:
      CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
      CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
      CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
      COMPILER_OPTIMIZATION_SIZE: "y"
      CONFIG_SPIRAM_FETCH_INSTRUCTIONS: "y"
      # CONFIG_IDF_EXPERIMENTAL_FEATURES: y
      CONFIG_SPIRAM_RODATA: "y"
# Enable Home Assistant API

# captive_portal:
psram:
  mode: octal
  speed: 80MHz

# Enable logging
logger:
  level: INFO

i2c:
  sda: GPIO08
  scl: GPIO09
  scan: True
  id: bus_a

ch422g:
  id: io_ex

# Toggles backlight of Waveshare ESP32-S3-Touch-LCD-4.3
switch:
  - platform: gpio
    name: "Backlight Toggle"
    pin: 
      ch422g: io_ex
      number: 2
      mode:
        output: true
      inverted: False
    restore_mode: ALWAYS_ON

display:
  - platform: rpi_dpi_rgb
    id: my_display
    auto_clear_enabled: false
    update_interval: never
    color_order: RGB
    pclk_frequency: 16MHz
    dimensions:
      width: 800
      height: 480
    de_pin:
      number: 5
    hsync_pin:
      number: 46
      ignore_strapping_warning: true
    vsync_pin:
      number: 3
      ignore_strapping_warning: true
    pclk_pin: 
      number: 7
    pclk_inverted: false
    hsync_back_porch: 10 #30
    hsync_front_porch: 20 #210 
    hsync_pulse_width: 10 #30
    vsync_back_porch: 10 #4
    vsync_front_porch: 10 #4
    vsync_pulse_width: 10 #4
    data_pins:
      red:
        - 1         #r3
        - 2         #r4
        - 42        #r5
        - 41        #r6
        - 40        #r7
      blue:
        - 14        #b3
        - 38        #b4
        - 18        #b5
        - 17        #b6
        - 10        #b7
      green:
        - 39        #g2
        - 0         #g3
        - 45        #g4
        - 48        #g5
        - 47        #g6
        - 21        #g7

touchscreen:
  platform: gt911
  id: my_touchscreen
  display: my_display
  interrupt_pin: GPIO4
  reset_pin:
    ch422g: io_ex
    number: 1
    mode: output
  on_touch:
    - lambda: |-
          ESP_LOGD("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
              touch.x,
              touch.y,
              touch.x_raw,
              touch.y_raw
              );
  on_release:
      - if:
          condition: lvgl.is_paused
          then:
            - logger.log: "LVGL resuming"
            - lvgl.resume:
            - lvgl.widget.redraw:
            # - light.turn_on: display_backlight

Any help is appreciated.

Update:
I changed the code to:

esphome:
  name: ${device_id}
  friendly_name: ${device_name}
  area: ${device_area}
  platformio_options:
    build_flags: "-DBOARD_HAS_PSRAM"
    board_build.arduino.memory_type: qio_opi
    board_build.flash_mode: dio
    # board_upload.flash_size: "8MB"
    board_upload.maximum_ram_size: 524288
    board_upload.maximum_size: 8388608
  on_boot:
    then:
      - delay: 5s
      - lvgl.widget.hide: boot_screen

esp32:
  board: esp32-s3-devkitc-1
  variant: esp32s3
  framework:
    type: esp-idf
    version: latest
    sdkconfig_options:
      CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
      CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
      CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
      COMPILER_OPTIMIZATION_SIZE: "y"
      CONFIG_SPIRAM_FETCH_INSTRUCTIONS: "y"
      CONFIG_ESPTOOLPY_FLASHSIZE_8MB: "y"
      CONFIG_ESPTOOLPY_FLASHSIZE: "8MB"
      # CONFIG_IDF_EXPERIMENTAL_FEATURES: y
      CONFIG_SPIRAM_RODATA: "y"
# Enable Home Assistant API
...

So it now sees the Flash as 8MB.

But, I still get the same error.

I’m wondering if this is related to this: How to increase partition size (to use 16MB of flash instead of 4MB)

Set flash_size.

Thanks! Flashed no problem (other than plugging it in to a USB port)

For everyone else. Here is the config I have


esphome:
  name: ${device_id}
  friendly_name: ${device_name}
  area: ${device_area}
  platformio_options:
    build_flags: "-DBOARD_HAS_PSRAM"
    board_build.arduino.memory_type: qio_opi
    board_build.flash_mode: dio
    # board_upload.flash_size: "8MB"
    board_upload.maximum_ram_size: 524288
    board_upload.maximum_size: 8388608
  on_boot:
    then:
      - delay: 5s
      - lvgl.widget.hide: boot_screen

esp32:
  board: esp32-s3-devkitc-1
  variant: esp32s3
  flash_size: 8MB
  framework:
    type: esp-idf
    version: latest
    sdkconfig_options:
      CONFIG_IDF_TARGET: "esp32s3"
      CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240: y
      CONFIG_ESPTOOLPY_FLASHMODE_QIO: y
      CONFIG_ESPTOOLPY_FLASHFREQ_80M: y
      CONFIG_ESPTOOLPY_FLASHSIZE_8MB: y
      CONFIG_IDF_EXPERIMENTAL_FEATURES: y
      CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y
      CONFIG_SPIRAM: y
      CONFIG_SPIRAM_MODE_OCT: y
      CONFIG_SPIRAM_RODATA: y
      CONFIG_SPIRAM_SPEED_80M: y
      CONFIG_FREERTOS_HZ: "1000"
      CONFIG_ESP32S3_DATA_CACHE_LINE_64B: y
      COMPILER_OPTIMIZATION_SIZE: y
# Enable Home Assistant API

# captive_portal:
psram:
  mode: octal
  speed: 80MHz

# Enable logging
logger:
  level: INFO

i2c:
  sda: GPIO08
  scl: GPIO09
  scan: True
  id: bus_a

ch422g:
  id: io_ex

# Toggles backlight of Waveshare ESP32-S3-Touch-LCD-4.3
switch:
  - platform: gpio
    name: "Backlight Toggle"
    pin: 
      ch422g: io_ex
      number: 2
      mode:
        output: true
      inverted: False
    restore_mode: ALWAYS_ON

display:
  - platform: rpi_dpi_rgb
    id: my_display
    auto_clear_enabled: false
    update_interval: never
    color_order: RGB
    pclk_frequency: 16MHz
    dimensions:
      width: 800
      height: 480
    de_pin:
      number: 5
    hsync_pin:
      number: 46
      ignore_strapping_warning: true
    vsync_pin:
      number: 3
      ignore_strapping_warning: true
    pclk_pin: 
      number: 7
    pclk_inverted: false
    hsync_back_porch: 10 #30
    hsync_front_porch: 20 #210 
    hsync_pulse_width: 10 #30
    vsync_back_porch: 10 #4
    vsync_front_porch: 10 #4
    vsync_pulse_width: 10 #4
    data_pins:
      red:
        - 1         #r3
        - 2         #r4
        - 42        #r5
        - 41        #r6
        - 40        #r7
      blue:
        - 14        #b3
        - 38        #b4
        - 18        #b5
        - 17        #b6
        - 10        #b7
      green:
        - 39        #g2
        - 0         #g3
        - 45        #g4
        - 48        #g5
        - 47        #g6
        - 21        #g7

touchscreen:
  platform: gt911
  id: my_touchscreen
  display: my_display
  interrupt_pin: GPIO4
  reset_pin:
    ch422g: io_ex
    number: 1
    mode: output
  on_touch:
    - lambda: |-
          ESP_LOGD("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
              touch.x,
              touch.y,
              touch.x_raw,
              touch.y_raw
              );
  on_release:
      - if:
          condition: lvgl.is_paused
          then:
            - logger.log: "LVGL resuming"
            - lvgl.resume:
            - lvgl.widget.redraw:
            # - light.turn_on: display_backlight

Any idea why my ESPHome gets the error :

“String value cannot be dictionary or list”

image

That’s not the correct syntax (refer to the docs) but unless you have multiple displays, you don’t need the displays: key at all.

1 Like