Skip to content

firmware crashes on Waveshare "ESP32-S3-Touch-LCD-4.3" #514

@Rai-Sp

Description

@Rai-Sp

Describe the bug
I tried to build lvgl-micropython firmware using https://github.com/lvgl-micropython/lvgl_micropython for a Waveshare "ESP32-S3-Touch-LCD-4.3" device.

With the currently newest commit d7f69f3 a simple test script (see below) crashes with "Guru Meditation Error: Core 0 panic'ed (StoreProhibited). Exception was unhandled." I also tried several commits in between, but none worked. Commenting out the line with "task_handler = task_handler.TaskHandler()" avoids the crash, but of course, the display does not show anything.

Expected behavior
When I use commit 561cf5a for building, the same test script works as expected. This should also be the case with the newest commit.

Build Command

python3 \
make.py \
esp32 \
clean \
BOARD=ESP32_GENERIC_S3 \
BOARD_VARIANT=SPIRAM_OCT \
--flash-size=8 \
DISPLAY=ili9341 \
DISPLAY=rgb_display \
INDEV=xpt2046 \
INDEV=gt911 \
CONFIG_FREERTOS_HZ=100 \
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y \
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y \
CONFIG_ESPTOOLPY_FLASHFREQ_120M=y \
CONFIG_SPIRAM_MODE_OCT=y \
CONFIG_IDF_EXPERIMENTAL_FEATURES=y \
CONFIG_SPIRAM_SPEED_120M=y \
CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y \
CONFIG_SPIRAM_RODATA=y \
CONFIG_ESP32S3_DATA_CACHE_LINE_64B=y \
CONFIG_COMPILER_OPTIMIZATION_PERF=y

Test-Script

#-----------------------------------------------------------------------------
# The following is based on:
# https://github.com/kwinter745321/ESP32LVGL/blob/main/Videos/video58/Flash/display_driver.py
#
# Device used: Waveshare "ESP32-S3-Touch-LCD-4.3"
#
# Firmware built using https://github.com/lvgl-micropython/lvgl_micropython
#
# Works as expected when built from commit 561cf5a3979db021b3394a1aaf7bb0e3550d4c97
# (based on micropython 1.25.0, LVGL 9.3.0 and esp-idf 5.4.0)
#
# Crashes when built from currently newest commit d7f69f3954df87352c9e42612544323a319441da
# with "Guru Meditation Error: Core  0 panic'ed (StoreProhibited). Exception was unhandled."
# (based on micropython 1.27.0, LVGL 9.4.0 and esp-idf 5.5.1)
# I also tried several commits in between, but none worked.
# Commenting out the line with "task_handler = task_handler.TaskHandler()"
# avoids the crash, but of course, the display does not show anything
#-----------------------------------------------------------------------------
# Setting up IO-Expander and resetting touch and display is missing in the above-mentioned:
import io_exp

io_exp.init()
io_exp.reset()
#-----------------------------------------------------------------------------
import lcd_bus
import rgb_display_framework as rgb_display
import lvgl as lv
import task_handler
import i2c
import gt911

rgb_bus = lcd_bus.RGBBus(
    hsync=46,
    vsync=3,
    de=5,
    pclk=7,
    data0=14, data1=38, data2=18, data3=17, data4=10,
    data5=39, data6=0, data7=45, data8=48, data9=47, data10=21,
    data11=1, data12=2, data13=42, data14=41, data15=40,
    freq=13_000_000,
    hsync_front_porch=8,
    hsync_back_porch=8,
    hsync_pulse_width=4,
    vsync_front_porch=16,
    vsync_back_porch=16,
    vsync_pulse_width=4,
    vsync_idle_low=True,
    pclk_active_low=True
)
print("RGBBus", rgb_bus)

_WIDTH, _HEIGHT = 800, 480
_BUF1 = rgb_bus.allocate_framebuffer(_WIDTH * _HEIGHT * 2, lcd_bus.MEMORY_SPIRAM)
_BUF2 = rgb_bus.allocate_framebuffer(_WIDTH * _HEIGHT * 2, lcd_bus.MEMORY_SPIRAM)

display = rgb_display.RGBDisplayDriver(
    data_bus=rgb_bus,
    display_width=_WIDTH,
    display_height=_HEIGHT,
    frame_buffer1=_BUF1,
    frame_buffer2=_BUF2,
    color_space=lv.COLOR_FORMAT.RGB565
)
print("display", display)
display.set_power(True)
display.init()

i2c_bus = i2c.I2C.Bus(host=0, scl=9, sda=8, freq=100_000)
touch_i2c = i2c.I2C.Device(i2c_bus, gt911.I2C_ADDR, gt911.BITS)
indev = gt911.GT911(touch_i2c, reset_pin=None, startup_rotation=0)
if indev.hw_size != (_WIDTH, _HEIGHT):
    fw_config = indev.firmware_config
    fw_config.width = _WIDTH
    fw_config.height = _HEIGHT
    fw_config.save()

task_handler = task_handler.TaskHandler()
#-----------------------------------------------------------------------------
scr = lv.screen_active()
scr.set_style_bg_color(lv.color_hex(0x000000), 0)

slider = lv.slider(scr)
slider.set_size(600, 25)
slider.center()

label = lv.label(scr)
label.set_text('HELLO LVGL_MICROPYTHON!')
label.align(lv.ALIGN.CENTER, 0, -100)
#-----------------------------------------------------------------------------
# The module io_exp.py looks like:
# #-----------------------------------------------------------------------------
# from i2c import I2C
# import ch422g
# import time
#
# class Vars:
#     tprst_pin  = None
#     lcdbl_pin  = None
#     lcdrst_pin = None
#     sd_cs_pin  = None
#     usel_pin   = None
#
# def init():
#     i2c_bus = I2C.Bus(host=0, scl=9, sda=8, freq=100_000, use_locks=False)
#
#     io_expander_device = I2C.Device(i2c_bus, dev_id=ch422g.I2C_ADDR,
#                                     reg_bits=ch422g.BITS)
#     ch422g.Pin.set_device(io_expander_device)
#
#     Vars.tprst_pin  = ch422g.Pin(ch422g.EXIO1, mode=ch422g.Pin.OUT, value=0)
#     Vars.lcdbl_pin  = ch422g.Pin(ch422g.EXIO2, mode=ch422g.Pin.OUT, value=0)
#     Vars.lcdrst_pin = ch422g.Pin(ch422g.EXIO3, mode=ch422g.Pin.OUT, value=0)
#     Vars.sd_cs_pin  = ch422g.Pin(ch422g.EXIO4, mode=ch422g.Pin.OUT, value=0)
#     Vars.usel_pin   = ch422g.Pin(ch422g.EXIO5, mode=ch422g.Pin.OUT, value=1)
#
# def reset():
#     time.sleep_ms(500)
#     Vars.tprst_pin.high()
#     time.sleep_ms(100)
#     Vars.tprst_pin.low()
#
#     Vars.lcdrst_pin.high()
#     time.sleep_ms(100)
#     Vars.lcdrst_pin.low()
# #-----------------------------------------------------------------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions