Problem with lvgl

Hi I have started a small lvgl project using esp32-wrover (8MB PSRAM) and il9488 and xpt2046. But when I run the program, the screen turns black and does not respond.
The project without lvgl has no problems and the display and xpt2046 work properly.


spi:
  clk_pin: 41  ##display SCK and T_CLK
  mosi_pin: 42 ##display SDI(MOSI)/touch T_DIN
  miso_pin: 40 ##display SDO(MISO)/touch T_DO    


display:
  - platform: ili9xxx
    model: ILI9488_A
    cs_pin: 1
    dc_pin: 2
    reset_pin: 5
    invert_colors: false
    auto_clear_enabled: false
    update_interval: never
    id: my_display

touchscreen:
  platform: xpt2046
  id: touch
  cs_pin: 7
  interrupt_pin: 15
  update_interval: 50ms
  threshold: 400
  calibration:
    x_min: 289
    x_max: 3752
    y_min: 211
    y_max: 3868
  transform:
    mirror_x: true
    mirror_y: true
    swap_xy: true
  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
              );
lvgl:
  displays:
    - my_display
  pages:
    - id: main_page
      widgets:
        - label:
            align: CENTER
            text: 'Hello World!'

Please help

Any errors in the logs? Can we see the rest of your code?

Can you make sure the text is white?

text_color: 0x000000
1 Like

I tested the text with different colors. And there is no error in the log

esphome:
  name: 15-biglcd-lvgl
  on_boot:
    then:
      

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

# Enable logging
logger:
    logs:
     component: none
     sensor: none
     http_request: none
     text_sensor: none

# Enable Home Assistant API
api:
 reboot_timeout: 0s
  
ota:
- platform: esphome
  password: !secret ota_password
 

wifi:
   ssid: !secret wifi_ssid
   password: !secret wifi_password
   reboot_timeout: 0s
  #  manual_ip:
  #    static_ip: 192.168.1.115
  #    gateway: 192.168.1.1
  #    subnet: 255.255.255.0
  #    dns1: 8.8.8.8
  #    dns2: 4.4.4.4
  # Enable fallback hotspot (captive portal) in case wifi connection fails
   ap:
    ssid: "15-biglcd-lvgl"
    password: !secret web_server_password

web_server:
  port: 80
  auth:
    username: admin
    password: !secret web_server_password

psram:
    mode: octal
    speed: 80MHz

binary_sensor:
  - platform: status
    name: "Node Status"
    id: system_status


debug:
  update_interval: 15s

text_sensor:
  - platform: debug
    device:
      name: "Device Info"
    reset_reason:
      name: "Reset Reason"

sensor:
  - platform: debug
    free:
      name: "Heap Free"
    block:
      name: "Heap Max Block"
    loop_time:
      name: "Loop Time"
    psram:
      name: "Free PSRAM"

spi:
  clk_pin: 41  ##display SCK and T_CLK
  mosi_pin: 42 ##display SDI(MOSI)/touch T_DIN
  miso_pin: 40 ##display SDO(MISO)/touch T_DO    


display:
  - platform: ili9xxx
    model: ILI9488_A
    cs_pin: 1
    dc_pin: 2
    reset_pin: 5
    invert_colors: false
    auto_clear_enabled: false
    update_interval: never
    id: my_display

touchscreen:
  platform: xpt2046
  id: touch
  cs_pin: 7
  interrupt_pin: 15
  update_interval: 50ms
  threshold: 400
  calibration:
    x_min: 289
    x_max: 3752
    y_min: 211
    y_max: 3868
  transform:
    mirror_x: true
    mirror_y: true
    swap_xy: true
  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
              );
lvgl:
  displays:
    - my_display
  pages:
    - id: main_page
      widgets:
        - label:
            align: CENTER
            text: 'Hello World!'



Do you need to add your touchscreen id to lvgl?

You have this.

Should it be like this?

I cant really see that being the cause for your black screen but, it didnt look right.

1 Like

Hello, using touch had no effect on the blank screen

Make sure you are updated to 2024.8.1 there are LVGL bug fixes in this release

Are you turning on the backlight for the screen?

Rename your touchscreen to my_touchscreen then use the code below. my_touchscreen is the name in a lot of examples and it’s good to keep consistency. The new format is to use - display_id: name instead of just - name

lvgl:
  displays:
    - display_id: my_display
  touchscreens:
    - touchscreen_id: my_touchscreen
1 Like

Ya, i didnt think it was the primary issue, just thought id throw the suggestion out there to try.

If I were you, id go ask in the Esphome Discord channel. Thats where all the developers and really smart people hang out. Youll shouldnt have a problem getting help in there.

1 Like

Hi, I am using the latest version 2024.8.3
And there is no problem with my backlight and I display any text and image on the LCD with lambda

I even tested with a st7789v LCD and a new esp32-s3 board and had exactly the same problem.

I changed the name of the touch screen to my_touchscreen, but the problem is still not solved

Thanks for your suggestion
Can you give me the address of the discord channel?

Today I tested with ssd1306 and esp32 and I had the same problem

Does anyone really know where the problem comes from??

First confirm your display is working - remove the LVGL stuff and add show_test_card: true and remove update_interval: never in the display config. That should show a test pattern.

Then restore the LVGL config, get rid of the “none” settings for logs (component at least) and copy the complete serial log and post it here.

Are you sure your chip has octal PSRAM? You should see lines like this in the log:

[20:52:10]I (287) MSPI Timing: PSRAM timing tuning index: 10
[20:52:10]I (288) esp_psram: Found 8MB PSRAM device
[20:52:10]I (288) esp_psram: Speed: 80MHz
[20:52:10]I (321) mmu_psram: Read only data copied and mapped to SPIRAM
[20:52:10]I (408) mmu_psram: Instructions copied and mapped to SPIRAM
[20:52:10]I (408) cpu_start: Multicore app

Then at some point you should see:

[21:02:11][C][lvgl:284]: LVGL Setup starts
[21:02:11][C][lvgl:335]: LVGL Setup complete

When the log does the config dump (magenta color) there should be a line like this:

[20:52:15][C][lvgl:086]: LVGL:

You should not see:

[20:58:31][E][component:082]:   Component lvgl is marked FAILED

But with your current config you won’t anyway, since you are filtering out all component logs.

You could try setting buffer_size: 25% in the LVGL config - that should enable it to work even without PSRAM.

Posting the complete log here will help diagnosis.

1 Like

Hello, I tested with this method and there was no problem with the LCD

[20:02:12][C][psram:020]: PSRAM:
[20:02:12][C][psram:021]:   Available: NO
[20:02:12][C][status:034]: Status Binary Sensor 'Node Status'
[20:02:12][C][status:034]:   Device Class: 'connectivity'
[20:02:12][C][lvgl:032]: LVGL:
[20:02:12][E][component:082]:   Component lvgl is marked FAILED

The model I have is ESP32-S3-DevKitC-1 , M0N16R8, but I don’t know what is the cause of this error.

My problem was solved by adding these few lines,
thanks to everyone who helped me

esphome:
  name: "15-disp-lvgl"
  platformio_options:
      build_flags: "-DBOARD_HAS_PSRAM"
      board_build.arduino.memory_type: qio_opi
[11:04:42][C][psram:020]: PSRAM:
[11:04:42][C][psram:021]:   Available: YES
[11:04:42][C][psram:024]:   Size: 8191 KB