lvgl-micropython / lvgl_micropython

LVGL module for MicroPython
MIT License
86 stars 27 forks source link

about ili9488 SPI #163

Open sasakihin opened 3 weeks ago

sasakihin commented 3 weeks ago

I used the lvgl_micropython project to update my esp32n16r8-ili9488-ft6x36. It originally had a usable LVGL MicroPython, but it's quite outdated (MicroPython 1.19). After compiling the firmware, I couldn't get the screen to light up. Below are my code and the error messages.

` import lvgl as lv import time import lcd_bus from machine import Pin, I2C, SPI import ili9488 import ft6x36 spi_bus = SPI.Bus(host=1,mosi=11,miso=13,sck=12) display_bus = lcd_bus.SPIBus(spi_bus=spi_bus,dc=17,cs=15,freq=40000000) display = ili9488.ILI9488(data_bus=spi_bus,display_width=240,display_height=320,reset_pin=18,reset_state=ili9488.STATE_LOW,backlight_pin=16, color_space=lv.COLOR_FORMAT.RGB565,color_byte_order=ili9488.BYTE_ORDER_BGR,rgb565_byte_swap=True) p16 = Pin(16, Pin.OUT) ## backlight p16.value(1) display.init()

scr = lv.scr_act() scr.clean()`

REPL:

MPY: soft reboot

A fatal error occurred. The crash dump printed below may be used to help determine what caused it. If you are not already running the most recent version of MicroPython, consider upgrading. New versions often fix bugs.

To learn more about how to debug and/or report this crash visit the wiki page at: https://github.com/micropython/micropython/wiki/ESP32-debugging

LVGL MPY version : 1.23.0 on 2024-10-27 IDF version : v5.2 Machine : Generic ESP32S3 module with Octal-SPIRAM with ESP32S3

Guru Meditation Error: Core 1 panic'ed (InstrFetchProhibited). Exception was unhandled.

Core 1 register dump: PC : 0x000000f0 PS : 0x00060e30 A0 : 0x82031e8c A1 : 0x3fcbc9c0
A2 : 0x3c253830 A3 : 0x00000324 A4 : 0x00000002 A5 : 0x3c253628
A6 : 0x00000265 A7 : 0x3fcbc9c0 A8 : 0x82087eca A9 : 0x3c253580
A10 : 0x3c253830 A11 : 0x0000004c A12 : 0x00000324 A13 : 0x00000000
A14 : 0x000000a0 A15 : 0x3fcbc980 SAR : 0x0000001a EXCCAUSE: 0x00000014
EXCVADDR: 0x000000f0 LBEG : 0x400570e8 LEND : 0x400570f3 LCOUNT : 0x00000000

Backtrace: 0x000000ed:0x3fcbc9c0 0x42031e89:0x3fcbc9f0 0x4202126e:0x3fcbca30 0x42004e59:0x3fcbca70 0x420be7e5:0x3fcbcab0 0x420be8ad:0x3fcbcad0 0x403798da:0x3fcbcaf0 0x420b60ff:0x3fcbcb90 0x420be7e5:0x3fcbcbc0 0x420be8ad:0x3fcbcbe0 0x420bb9a4:0x3fcbcc00 0x420bb7d9:0x3fcbcc60 0x420be7e5:0x3fcbcc80 0x420be8ad:0x3fcbcca0 0x403798da:0x3fcbccc0 0x420b60ff:0x3fcbcd60 0x420be7e5:0x3fcbcd90 0x420be7fa:0x3fcbcdb0 0x420cac4b:0x3fcbcdd0 0x420cad8e:0x3fcbce60 0x420d2426:0x3fcbceb0

ELF file SHA256: 2407fc500

Rebooting... ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT) Saved PC:0x40382b26 SPIWP:0xee mode:DIO, clock div:1 load:0x3fce3820,len:0x105c load:0x403c9700,len:0x4 load:0x403c9704,len:0xbd8 load:0x403cc700,len:0x2e30 entry 0x403c989c LVGL MicroPython 1.23.0 on 2024-10-27; Generic ESP32S3 module with Octal-SPIRAM with ESP32S3 Type "help()" for more information.

kdschlosser commented 2 weeks ago

can you add some print statements to your code to find out exactly when it is causing an issue. You can also add the --debug parameter to your build command. this will enable debug logging which might help out.

Here is some code you can also try to see if it works properly

import lcd_bus
import machine  # NOQA
from micropython import const  # NOQA

# you nmeed to change these to the pins the touch panel is connected to
_SCL = const(0)
_SDA = const(0)

spi_bus = machine.SPI.Bus(
    host=1,
    mosi=11,
    miso=13,
    sck=12
)

display_bus = lcd_bus.SPIBus(
    spi_bus=spi_bus,
    dc=17,
    cs=15,
    freq=40000000
)

import ili9488  # NOQA
import lvgl as lv  # NOQA

display = ili9488.ILI9488(
    data_bus=spi_bus,
    display_width=240,
    display_height=320,
    reset_pin=18,
    reset_state=ili9488.STATE_LOW,
    backlight_pin=16,
    color_space=lv.COLOR_FORMAT.RGB565,  # NOQA
    color_byte_order=ili9488.BYTE_ORDER_BGR,
    rgb565_byte_swap=True
)

# p16 = Pin(16, Pin.OUT) ## backlight
# p16.value(1)
display.set_power(True)
display.init()
display.set_backlight(100)

import task_handler  # NOQA

th = task_handler.TaskHandler()

import ft6x36  # NOQA
import i2c  # NOQA

i2c_bus = i2c.I2C.Bus(
    host=1,
    scl=_SCL,
    sda=_SDA
)

touch_i2c = i2c.I2C.Device(
    bus=i2c_bus,
    dev_id=ft6x36.I2C_ADDR,
    reg_bits=ft6x36.BITS
)

indev = ft6x36.FT6x36(device=touch_i2c)

scrn = lv.screen_active()  # NOQA
scrn.set_style_bg_color(lv.color_hex(0x000000), 0)

slider = lv.slider(scrn)  # NOQA
slider.center()