ESP32S3 LVGL not displaying on Screen

Description

Got an ESP32-8048S050 with a ESP32S3 Wroom-1 chip from work for a new project, it came with an example running on it and was working normally but after i flashed my first code that i made on SquareLine Studio it stopped displaying anything. The build and flash works normally but nothing is displayed on the LCD screen. The monitoring part is acting a little weird by rebooting and aborting for some reasons that i can’t understand.

I am using esp-idf 5.1.2 and SquareLine 1.3.3, not sure about the LVGL version, but i got it from the LVGL site.

Below i will paste the text that keep showing on loop when i go into monitoring.

Its my first time using esp-idf and LVGL so honestly i don’t understand much of what i am doing here, just trying to follow what i learn online, took a few hours to make the build sucesfully so now just trying to understand what is happening so i can fix it.

Executing action: monitor
Serial port COM8
Connecting....
Detecting chip type... ESP32-S3
Running idf_monitor in directory C:\Users\welli\fvglTeste1
Executing "C:\Users\welli\.espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe C:\Users\welli\esp\esp-idf\tools/idf_monitor.py -p COM8 -b 115200 --toolchain-prefix xtensa-esp32s3-elf- --target esp32s3 --revision 0 C:\Users\welli\fvglTeste1\build\SquareLine_Project.elf --force-color -m 'C:\Users\welli\.espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe' 'C:\Users\welli\esp\esp-idf\tools\idf.py'"...
--- WARNING: GDB cannot open serial ports accessed as COMx
--- Using \\.\COM8 instead...
--- esp-idf-monitor 1.3.3 on \\.\COM8 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x19b0
load:0x403c9700,len:0x4
load:0x403c9704,len:0xe44
load:0x403cc700,len:0x33a4
entry 0x403c99b0
I (27) boot: ESP-IDF v5.1.2 2nd stage bootloader
I (27) boot: compile time Nov 21 2023 10:11:19
I (27) boot: Multicore bootloader
I (30) boot: chip revision: v0.1
I (34) qio_mode: Enabling default flash chip QIO
I (39) boot.esp32s3: Boot SPI Speed : 80MHz
I (44) boot.esp32s3: SPI Mode       : QIO
I (48) boot.esp32s3: SPI Flash Size : 16MB
I (53) boot: Enabling RNG early entropy source...
I (59) boot: Partition Table:
I (62) boot: ## Label            Usage          Type ST Offset   Length
None
Waiting for the device to reconnectI 
I (736) esp_psram: SPI SRAM memory test OK
I (744) cpu_start: Pro cpu start user code
I (744) cpu_start: cpu freq: 240000000 Hz
I (745) cpu_start: Application information:
I (748) cpu_start: Project name:     SquareLine_Project
I (753) cpu_start: App version:      1
I (758) cpu_start: Compile time:     Nov 21 2023 10:10:51
I (764) cpu_start: ELF file SHA256:  3b5bbbaf777ec9e5...
I (770) cpu_start: ESP-IDF:          v5.1.2
I (775) cpu_start: Min chip rev:     v0.0
I (779) cpu_start: Max chip rev:     v0.99
I (784) cpu_start: Chip rev:         v0.1
I (789) heap_init: Initializing. RAM available for dynamic allocation:
I (796) heap_init: At 3FC97A88 len 00051C88 (327 KiB): DRAM
I (802) heap_init: At 3FCE9710 len 00005724 (21 KiB): STACK/DRAM
I (809) heap_init: At 600FE010 len 00001FD8 (7 KiB): RTCRAM
I (815) esp_psram: Adding pool of 7744K of PSRAM memory to heap allocator
I (823) spi_flash: detected chip: gd
I (827) spi_flash: flash io: qio
I (831) sleep: Configure to isolate all GPIO pins in sleep state
I (838) sleep: Enable automatic switching of GPIO sleep configuration
I (845) app_start: Starting scheduler on CPU0
I (850) app_start: Starting scheduler on CPU1
I (850) main_task: Started on CPU0
I (860) esp_psram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (868) main_task: Calling app_main()
E (872) lcd_panel: esp_lcd_panel_init(21): invalid panel handle
ESP_ERROR_CHECK failed: esp_err_t 0x102 (ESP_ERR_INVALID_ARG) at 0x42009ac1
0x42009ac1: bsp_display_new at C:/Users/welli/fvglTeste1/managed_components/espressif__esp32_s3_lcd_ev_board/src/bsp_sub_board.c:212 (discriminator 1)

file: "./managed_components/espressif__esp32_s3_lcd_ev_board/src/bsp_sub_board.c" line 212
func: bsp_display_new
expression: esp_lcd_panel_init(panel_handle)

abort() was called at PC 0x4037c0db on core 0
0x4037c0db: _esp_error_check_failed at C:/Users/welli/esp/esp-idf/components/esp_system/esp_err.c:50



Backtrace: 0x40375a76:0x3fc9b470 0x4037c0e5:0x3fc9b490 0x40381ae2:0x3fc9b4b0 0x4037c0db:0x3fc9b520 0x42009ac1:0x3fc9b550 0x420095ef:0x3fc9b570 0x4200964d:0x3fc9b5a0 0x420093d6:0x3fc9b5c0 0x42044d97:0x3fc9b5e0 0x4037e699:0x3fc9b610
0x40375a76: panic_abort at C:/Users/welli/esp/esp-idf/components/esp_system/panic.c:452

0x4037c0e5: esp_system_abort at C:/Users/welli/esp/esp-idf/components/esp_system/port/esp_system_chip.c:84

0x40381ae2: abort at C:/Users/welli/esp/esp-idf/components/newlib/abort.c:38

0x4037c0db: _esp_error_check_failed at C:/Users/welli/esp/esp-idf/components/esp_system/esp_err.c:50

0x42009ac1: bsp_display_new at C:/Users/welli/fvglTeste1/managed_components/espressif__esp32_s3_lcd_ev_board/src/bsp_sub_board.c:212 (discriminator 1)

0x420095ef: bsp_display_start_with_config at C:/Users/welli/fvglTeste1/managed_components/espressif__esp32_s3_lcd_ev_board/src/esp32_s3_lcd_ev_board.c:320

0x4200964d: bsp_display_start at C:/Users/welli/fvglTeste1/managed_components/espressif__esp32_s3_lcd_ev_board/src/esp32_s3_lcd_ev_board.c:309

0x420093d6: app_main at C:/Users/welli/fvglTeste1/main/main.c:37

0x42044d97: main_task at C:/Users/welli/esp/esp-idf/components/freertos/app_startup.c:208 (discriminator 13)

0x4037e699: vPortTaskWrapper at C:/Users/welli/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162





ELF file SHA256: 3b5bbbaf777ec9e5

Rebooting...
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x403758f8
0x403758f8: esp_restart_noos_dig at C:/Users/welli/esp/esp-idf/components/esp_system/port/esp_system_chip.c:57 (discriminator 1)

SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x19b0
load:0x403c9700,len:0x4
load:0x403c9704,len:0xe44
load:0x403cc700,len:0x33a4
entry 0x403c99b0

Also my first time posting here, if any other information is necessary just ask and i will try to answer as fast as i can.

Thanks.

Hello, judging by the output you posted, something seems to be going wrong in the following sequence of functions:

main_task() → app_main() → bsp_display_start() → bsp_display_start_with_confg() → bsp_display_new(), here some kind of esp error check fails? Are you sure everything is inialized correctly?

Yeah, no error or warning shows up on the building part. Gonna post the output for the build, the flash and the code that is showing error too.

Build output

PS C:\Users\welli\fvglTeste1> idf.py build  
Executing action: all (aliases: build)
Running ninja in directory C:\Users\welli\fvglTeste1\build
Executing "ninja all"...
[1/1] cmd.exe /C "cd /D C:\Users\welli\fvglTeste1\build\bootloader\esp-idf\esptool_py && C... --offset 0x8000 bootloader 0x0 C:/Users/welli/fvglTeste1/build/bootloader/bootloader.bin"Bootloader binary size 0x5c00 bytes. 0x2400 bytes (28%) free.
[6/7] Generating binary image from built executableesptool.py v4.7.dev3
Creating esp32s3 image...
Merged 2 ELF sections
Successfully created esp32s3 image.
Generated C:/Users/welli/fvglTeste1/build/SquareLine_Project.bin
[7/7] cmd.exe /C "cd /D C:\Users\welli\fvglTeste1\build\esp-idf\esptool_py && C:\Users\wel...artition_table/partition-table.bin C:/Users/welli/fvglTeste1/build/SquareLine_Project.bin"SquareLine_Project.bin binary size 0x686d0 bytes. Smallest app partition is 0x36b000 bytes. 0x302930 bytes (88%) free.

Project build complete. To flash, run this command:
C:\Users\welli\.espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe ..\esp\esp-idf\components\esptool_py\esptool\esptool.py -p (PORT) -b 460800 --before default_reset --after hard_reset --chip esp32s3  write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 build\bootloader\bootloader.bin 0x8000 build\partition_table\partition-table.bin 0x10000 build\SquareLine_Project.bin
or run 'idf.py -p (PORT) flash'

Flash output

PS C:\Users\welli\fvglTeste1> idf.py flash
Executing action: flash
Serial port COM7
Connecting....
Detecting chip type... ESP32-S3
Running ninja in directory C:\Users\welli\fvglTeste1\build
Executing "ninja flash"...
[1/5] cmd.exe /C "cd /D C:\Users\welli\fvglTeste1\build\esp-idf\esptool_py && C:\Users\welli\.espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe C:/Users/welli/esp/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 partition --type app C:/Users/welli/fvglTeste1/build/partition_table/partition-table.bin C:/Users/welli/fvglTeste1/build/SquareLine_Project.bin"
SquareLine_Project.bin binary size 0x686d0 bytes. Smallest app partition is 0x36b000 bytes. 0x302930 bytes (88%) free.
[2/5] Performing build step for 'bootloader'
[1/1] cmd.exe /C "cd /D C:\Users\welli\fvglTeste1\build\bootloader\esp-idf\esptool_py && C:\Users\welli\.espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe C:/Users/welli/esp/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x0 C:/Users/welli/fvglTeste1/build/bootloader/bootloader.bin"
Bootloader binary size 0x5c00 bytes. 0x2400 bytes (28%) free.
[2/3] cmd.exe /C "cd /D C:\Users\welli\esp\esp-idf\components\esptool_py && C:\Users\welli\.espressif\tools\cmake\3.24.0\bin\cmake.exe -D IDF_PATH=C:/Users/welli/esp/esp-idf -D SERIAL_TOOL=C:/Users/welli/.espressif/python_env/idf5.1_py3.11_env/Scripts/python.exe;;C:/Users/welli/esp/esp-idf/components/esptool_py/esptool/esptool.py;--chip;esp32s3 -D SERIAL_TOOL_ARGS=--before=default_reset;--after=hard_reset;write_flash;@flash_args -D WORKING_DIRECTORY=C:/Users/welli/fvglTeste1/build -P C:/Users/welli/esp/esp-idf/components/esptool_py/run_serial_tool.cmake"
esptool.py --chip esp32s3 -p COM7 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 16MB 0x0 bootloader/bootloader.bin 0x10000 SquareLine_Project.bin 0x8000 partition_table/partition-table.bin
esptool.py v4.7.dev3
Serial port COM7
Connecting...
Chip is ESP32-S3 (QFN56) (revision v0.1)
Features: WiFi, BLE, Embedded PSRAM 8MB (AP_3v3)
Crystal is 40MHz
MAC: f4:12:fa:fe:44:fc
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00005fff...
Flash will be erased from 0x00010000 to 0x00078fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Compressed 23552 bytes to 14857...
Writing at 0x00000000... (100 %)
Wrote 23552 bytes (14857 compressed) at 0x00000000 in 0.6 seconds (effective 303.6 kbit/s)...
Hash of data verified.
Compressed 427728 bytes to 261529...
Writing at 0x00010000... (6 %)
Writing at 0x00019f39... (12 %)
Writing at 0x00024810... (18 %)
Writing at 0x0002a32f... (25 %)
Writing at 0x00030261... (31 %)
Writing at 0x0003650b... (37 %)
Writing at 0x0003c123... (43 %)
Writing at 0x00041ec7... (50 %)
Writing at 0x000478a8... (56 %)
Writing at 0x0004d1ee... (62 %)
Writing at 0x00052afe... (68 %)
Writing at 0x00058379... (75 %)
Writing at 0x0005ddf5... (81 %)
Writing at 0x00064051... (87 %)
Writing at 0x0006a3df... (93 %)
Writing at 0x0007271b... (100 %)
Wrote 427728 bytes (261529 compressed) at 0x00010000 in 6.0 seconds (effective 569.8 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 122...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (122 compressed) at 0x00008000 in 0.0 seconds (effective 495.6 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
Done

Code that fails the error check

BSP_ERROR_CHECK_RETURN_ERR(esp_lcd_panel_init(panel_handle));

need to see the code for setting up the display using the esp_lcd component to be able to help you.

are you calling esp_lcd_panel_reset before calling esp_lcd_panel_init? You should be.
The panel handle you are supposed to be passing needs to be of the type esp_lcd_panel_handle_t. You would have needed to pass this as a pointer when creating the display so the natural thing would have been to initialize it as a NULL pointer. the esp_lcd_panel_init function does not take a pointer. If you did initialize it as a NULL pointer then you need to make the call like so BSP_ERROR_CHECK_RETURN_ERR(esp_lcd_panel_init(*panel_handle));

Don’t know, searched for the “esp_lcd_panel_reset” but can’t find anything on it, so i guess its not. I didn’t code it myself but used SquareStudio Line so can’t say for ure.

It is, will put the code below.

esp_lcd_panel_handle_t panel_handle = NULL;

Not sure if will help,or make things even more confusing, but another error check was also giving problems, will also put it below.

BSP_ERROR_CHECK_RETURN_ERR(detect_sub_board_type());

can you post the driver portion of the code? I do not believe that Squarline Studio is designed to write code that is compatible with the ESP-IDF > 4.4

I can do that, but can you be a little more specific on the “driver portion of the code” ? I don’t know which one is that part so can’t find it, i will post a image with my directory to see if it helps with anything.

image

zip the entire thing up and send it to me. That will be easier. I don’t need the .devcontainer and the .vscode directories everything else is OK

Here it is, and thanks for the help and patience man.

https://1drv.ms/u/s!Am5DZXbEc7ak3m7m1qw43Mlu_3S2?e=oT8Vvl

The file is too big to upload here, so i upload it to onedrive.

no worries m8. give me a bit to look over the code. I will make any changes that are needed and if it is an API issue because of using ESP-IDF >= 5.0 I will let the guys that handle that end of things know that it needs to be updated so it checks what IDF version is being used.

Who makes the board you are using?
What is the model?
What display are you using?
Do you know what the bus type is that the display is using? If so what is it?

Its an ESP32-8048S050, i will let a let a link with more information about it (mine its the one with a 5’0 display).

there is firmware already available for those displays. The firmware is designed to be used with OpenHAB. Is that what you are using it for?

From what i saw OpenHAB is for home automation right, but that’s not that i want to use it for. The company i work for do some automation for agriculture, all the boards we use are without displays and we send the information we collect to an android app (which is the part that i work for, never did anything with esp32 or arduino). And now they are planning on using a board with displays and they told me to try and see what i can do (and, as you can see, i don’t know much about working with boards)

So for now what i wanted to do is pretty simple, just want to be able to design my own pages on SquareLine Studion and then display it on the screen o my board, then after can try some other stuff (like connecting with the wi-fi for example).

Seems you self reply, you start drive without driver license…
Plus combine latest under dev 5.1.2 1.3.3 and maybe dev lvgl is next nonsense.
Start from simple thinks. 1. maybe Arduino is simpler to learn as idf 2. place into project only lcd init support then touch usw… 3. add LVGL 8.3.x when all works 4.add Squareline generated gui…

OK so the board you are using is not a board that is made by espressif so the code you sent me cannot be used because the code you sent me is ONLY for use with espressif boards. You have a Sunton board.

I can get it to work no worries there. I have to either write or locate a driver for the display that will work with the ESP-IDF… Once that is done you will need to add the new driver to the exported code from Squareline studio.

The issue with how the code export is in Squareline studio is that it is locked to only specific boards. It would be nice if an export could be done without supplying a specific board. So now what needs to be done is the driver needs to be removed form the exported code and a new driver added. I am hoping that the driver isn’t that nested into the LVGL code that is generated. I will dig into it deeper and see what and how things can be done.

I see, at least now i understand the logical reason of why its not working. Again, thanks for the help man.

I am going to read up on how to add boards to Squarline a little later today. I got some info on it so I will see if it can be done how we ned it to be done that way we can add the correct code needed for your MCU and display.

I have not tested this yet to see if it actually compiles or works. I do not have one of those displays to test with.

if you have Squareline Studio open then you will need to close it.
You need to uncompress the attached zip file into the following directory

  • Windows: C:\Users\USERNAME\Documents\SquareLine\boards
  • Linux:~/SquareLine/boards
  • MacOS: Users\USERNAME\SquareLine\boards

Then launch Squareline Studio. You will see a new group you can select boards from and your board will be in there.

Sunton.zip (149.9 KB)

Adding the board to Squareline Studio worked well, but the code is not compiling. Tried building and it says that it can not locate the file lvgl.h. VSCode shows a few more erros too (most of them are undefined identifier) but i guess they are probably related to not being able to locate lvgl.

Will paste the build output code and a print of my file structure too. And i would totally understand if you can’t help anymore man haha, you already helped a lot.

And i am using esp-idf 5.1 and lvgl 8.3.6 (also tried with lvgl 8.3.10 but it made no difference).

The build output is too long to paste here, so will just paste the errors i saw and upload a file with the full output.

build output.txt (40.9 KB)


[2/11] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/ui/screens/ui_Screen1.c.objFAILED: esp-idf/main/CMakeFiles/__idf_main.dir/ui/screens/ui_Screen1.c.obj 

In file included from C:/Users/welli/sunton-teste-2/main/ui/screens/ui_Screen1.c:6:
c:\users\welli\sunton-teste-2\main\ui\ui.h:13:14: fatal error: lvgl.h: No such file or directory
   13 |     #include "lvgl.h"
      |              ^~~~~~~~
compilation terminated.
[3/11] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/ui/ui.c.objFAILED: esp-idf/main/CMakeFiles/__idf_main.dir/ui/ui.c.obj

In file included from C:/Users/welli/sunton-teste-2/main/ui/ui.c:6:
C:/Users/welli/sunton-teste-2/main/ui/ui.h:13:14: fatal error: lvgl.h: No such file or directory
   13 |     #include "lvgl.h"
      |              ^~~~~~~~
compilation terminated.

C:/Users/welli/sunton-teste-2/main/ui/ui_helpers.c
In file included from C:/Users/welli/sunton-teste-2/main/ui/ui_helpers.h:13,
                 from C:/Users/welli/sunton-teste-2/main/ui/ui_helpers.c:6:
C:/Users/welli/sunton-teste-2/main/ui/ui.h:13:14: fatal error: lvgl.h: No such file or directory
   13 |     #include "lvgl.h"
      |              ^~~~~~~~

C:/Users/welli/sunton-teste-2/main/main.c:15:10: fatal error: lvgl.h: No such file or directory
   15 | #include "lvgl.h"
      |          ^~~~~~~~