esp32spi

ESP32-S3 connecting to SPI Module ILI9488 failing on memory issues


I'm building a project that display data to LCD, for that, I've connected ESP32S3 with 3.5inch SPI Module ILI9488 (SKU:MSP3520).

I'm using 2 libraries to achieve that:

  1. drivers library: GitHub link latest
  2. LVGL: GitHub link v8.3

So far, I have succeeded to compile my project, installed both libraries in my components directory but when it start it fails on "I (471) ILI9488: ILI9488 initialization."

With the following back-trace:

I (286) app_init: ESP-IDF:          v5.3.2
I (291) efuse_init: Min chip rev:     v0.0
I (296) efuse_init: Max chip rev:     v0.99 
I (301) efuse_init: Chip rev:         v0.2
I (306) heap_init: Initializing. RAM available for dynamic allocation:
I (313) heap_init: At 3FCB1038 len 000386D8 (225 KiB): RAM
I (319) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM
I (325) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (331) heap_init: At 600FE100 len 00001EE8 (7 KiB): RTCRAM
I (338) spi_flash: detected chip: gd
I (342) spi_flash: flash io: dio
W (346) spi_flash: Detected size(16384k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
GW-Creation The GW mac address is64:E8:33:47:E1:18
I (388) sleep: Configure to isolate all GPIO pins in sleep state
I (388) sleep: Enable automatic switching of GPIO sleep configuration
I (391) coexist: coex firmware version: cbb41d7
I (396) coexist: coexist rom version e7ae62f
I (401) main_task: Started on CPU0
I (411) main_task: Calling app_main()
I (431) lvgl_helpers: Display buffer size: 12800
I (431) lvgl_helpers: Initializing SPI master for display
I (431) lvgl_helpers: Configuring SPI host SPI2_HOST
I (431) lvgl_helpers: MISO pin: -1, MOSI pin: 11, SCLK pin: 12, IO2/WP pin: -1, IO3/HD pin: -1
I (441) lvgl_helpers: Max transfer size: 38400 (bytes)
I (451) lvgl_helpers: Initializing SPI bus...
I (461) disp_spi: Adding SPI device
I (461) disp_spi: Clock speed: 40000000Hz, mode: 0, CS pin: 10
I (471) gpio: GPIO[3]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 
I (471) ILI9488: ILI9488 initialization.
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x40056fc0  PS      : 0x00060530  A0      : 0x80379cda  A1      : 0x3fcb4890
--- 0x40056fc0: memcpy in ROM

A2      : 0x3fcb7e98  A3      : 0x00000010  A4      : 0x00000001  A5      : 0x3fcb7e98
A6      : 0x00000008  A7      : 0x00000000  A8      : 0x40000000  A9      : 0x3fcb4850
--- 0x40000000: _WindowOverflow4 in ROM

A10     : 0x3fcb7e98  A11     : 0x00000001  A12     : 0x00000008  A13     : 0x3c08b2d8
A14     : 0x00000000  A15     : 0x3fcb13e8  SAR     : 0x00000008  EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000010  LBEG    : 0x400570e8  LEND    : 0x400570f3  LCOUNT  : 0x00000000
--- 0x400570e8: memset in ROM
0x400570f3: memset in ROM



Backtrace: 0x40056fbd:0x3fcb4890 0x40379cd7:0x3fcb48a0 0x40379dd5:0x3fcb48e0 0x40379f0a:0x3fcb4920 0x4200b57e:0x3fcb4940 0x4200b065:0x3fcb49b0 0x4200b081:0x3fcb49e0 0x4200b17d:0x3fcb4a10 0x4200ae3b:0x3fcb4b80 0x4200ae33:0x3fcb4bb0 0x4200a274:0x3fcb4be0 0x42078be3:0x3fcb4c70 0x4037c7c1:0x3fcb4ca0
--- 0x40056fbd: memcpy in ROM
0x40379cd7: setup_priv_desc at C:/Users/saeed/esp/v5.3.2/esp-idf/components/esp_driver_spi/src/gpspi/spi_master.c:1143
0x40379dd5: spi_device_polling_start at C:/Users/saeed/esp/v5.3.2/esp-idf/components/esp_driver_spi/src/gpspi/spi_master.c:1353
0x40379f0a: spi_device_polling_transmit at C:/Users/saeed/esp/v5.3.2/esp-idf/components/esp_driver_spi/src/gpspi/spi_master.c:1438
0x4200b57e: disp_spi_transaction at C:/src/device/projects/gateway/components/lvgl_esp32_drivers/lvgl_tft/disp_spi.c:253
0x4200b065: disp_spi_send_data at C:/src/device/projects/gateway/components/lvgl_esp32_drivers/lvgl_tft/disp_spi.h:68
0x4200b081: ili9488_send_cmd at C:/src/device/projects/gateway/components/lvgl_esp32_drivers/lvgl_tft/ili9488.c:181
0x4200b17d: ili9488_init at C:/src/device/projects/gateway/components/lvgl_esp32_drivers/lvgl_tft/ili9488.c:97
0x4200ae3b: disp_driver_init at C:/src/device/projects/gateway/components/lvgl_esp32_drivers/lvgl_tft/disp_driver.c:17
0x4200ae33: lvgl_driver_init at C:/src/device/projects/gateway/components/lvgl_esp32_drivers/lvgl_helpers.c:109
0x4200a274: app_main at C:/src/device/projects/gateway/main/main.cpp:290
0x42078be3: main_task at C:/Users/saeed/esp/v5.3.2/esp-idf/components/freertos/app_startup.c:208
0x4037c7c1: vPortTaskWrapper at C:/Users/saeed/esp/v5.3.2/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139

It basically fails on the first send command to SPI

Original code in "ili9488_init" function:

ili9488_send_cmd(0x01); /* Software reset */

I've tried many ways to fix it, by adding delay or changing the command as following:

// Exit sleep
vTaskDelay(pdMS_TO_TICKS(1000));
ili9488_send_cmd(0x11);  // Sleep Out
vTaskDelay(pdMS_TO_TICKS(1000));
ili9488_send_cmd(0x01); /* Software reset */
vTaskDelay(pdMS_TO_TICKS(1000));

I've also validated my connectivity and GPOI set. sdkconfig.defaults looks like:


CONFIG_LV_TFT_DISPLAY_CONTROLLER_ILI9488=y
CONFIG_LV_DISP_SPI_MOSI=11
CONFIG_LV_DISP_SPI_CLK=12
CONFIG_LV_DISP_SPI_CS=10
CONFIG_LV_DISP_SPI_DC=3
CONFIG_LV_DISP_SPI_RST=16
CONFIG_LV_DISP_BACKLIGHT_GPIO=15
CONFIG_LV_DISP_SPI_HOST=SPI2_HOST
CONFIG_LV_DISP_SPI_HALF_DUPLEX=y

CONFIG_LV_COLOR_DEPTH=16
CONFIG_LVGL_TICK_CUSTOM=y
CONFIG_LV_TICK_CUSTOM_US=1000

My schematic looks as following: LCD schematic ESP32S3 schematic

What am I doing wrong?


Solution

  • The problem is incompatibility between LVGL, LVGL driver and ESP-IDF version I have.

    I had ESP-IDF v5.3.2 and seems like the basic code of LVGL driver is compatible with v4.*

    For that, I had to port part of the code to match the new version of esp-idf.

    That solved my issue above, however, still failing on different sizes issue :)