lvgl-micropython / lvgl_micropython

LVGL module for MicroPython
MIT License
87 stars 29 forks source link

Building for ESP32 S3 Fails #138

Closed Type-32 closed 1 month ago

Type-32 commented 1 month ago

Full Output of Terminal on MacOS Sequoia 15.1 Dev Beta and logs as well

idf_py_stderr_output_50151.log idf_py_stderr_output_50618.log idf_py_stdout_output_50151.log idf_py_stdout_output_50618.log terminal.log

kdschlosser commented 1 month ago

There is no display driver for ili9433. I will have to add it.

Type-32 commented 1 month ago

I thought I was using DISPLAY=ili9341 ? I ran python3 make.py esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT DISPLAY=ili9341 INDEV=gt911 and it gives me the similar "failure with exit code from ninja."

Here's log for running that line of command idf_py_stdout_output_1155.log idf_py_stderr_output_1155.log the stderr output file log seems to have nothing in it.

kdschlosser commented 1 month ago

line 477 in the terminal.log file.

RuntimeError: Display not found "ili9433"

Type-32 commented 1 month ago

apologies for that, that was my fault. that was the output for the command when I ran it the first time, which I corrected in the subsequent times running the command, eventually coming down to python3 make.py esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT DISPLAY=ili9341 INDEV=gt911.

I thought I was using DISPLAY=ili9341 ? I ran python3 make.py esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT DISPLAY=ili9341 INDEV=gt911 and it gives me the similar "failure with exit code from ninja."

Here's log for running that line of command idf_py_stdout_output_1155.log idf_py_stderr_output_1155.log the stderr output file log seems to have nothing in it.

The line of command basically did not work and I tried setting INDEV to xpt2046 as well but also didn't work and didn't find a firmware.bin or bootloader.bin in the output folders. By this point I'm pretty sure I'm looking somewhere wrong...

kdschlosser commented 1 month ago

lets start out from square one.

Run the build command adding > output.txt to the end of it and when it is done/fails then attach that file to a post here. That will help me the most in determining what is going on.

Type-32 commented 1 month ago

output.txt

I hope this helps. I'm running the command with same board parameters from before

python3 make.py esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT DISPLAY=ili9341 INDEV=gt911 > output.txt

kdschlosser commented 1 month ago

do me a favor. in the build directory there is a file called manifest.py could you attach that file?? to do that you need to add a .txt onto the end of the file name.

kdschlosser commented 1 month ago

scratch that.

I found the problem and I fixed it.

Type-32 commented 1 month ago

manifest.py.txt

(I'm still going to upload the file anyways) is the issue fixed? If it's fixed then I can close this issue :)

kdschlosser commented 1 month ago

it is fixed.

spienz commented 1 month ago

Hy, my Build for the S3 is also not working, i think the bin file is to small (2,40 MB (2.523.136 Bytes)). There is also a partion Warning in the log. I need the bin for this device. Maybe you can help. My Git clone is up to date

THX

Sebastian

https://www.elecrow.com/esp32-display-5-inch-hmi-display-rgb-tft-lcd-touch-screen-support-lvgl.html output.txt

Type-32 commented 1 month ago

Hy, my Build for the S3 is also not working, i think the bin file is to small (2,40 MB (2.523.136 Bytes)). There is also a partion Warning in the log. I need the bin for this device. Maybe you can help. My Git clone is up to date

THX

Sebastian

https://www.elecrow.com/esp32-display-5-inch-hmi-display-rgb-tft-lcd-touch-screen-support-lvgl.html output.txt

The build process ran smoothly. However, I am getting the same issues on the built firmware as @spienz . Flashing the firmware on to my board (using the command from the final output of the make.py command) and restarting & resetting the board doesn't switch it out of bootloader mode; it stays in the bootloader mode, so the built firmware is probably messed up or sth.

I'm not sure whether this is still related to this repo or not. My guess is it's probably something on micropython or lv_bindings library's side of stuff but I am not in a position to make this conjecture.

output.txt

kdschlosser commented 1 month ago

after you flash it you need to press the reset button on the display. that will take it out of boot loader mode.

Type-32 commented 1 month ago

I did press it after flashing it multiple times (with the given command at the end of the output from the make.py command). It just stays in bootloader mode (idk why). I also checked that the firmware is flashed on to the thing correctly.

for additional information I'm using the USB port instead of the UART port all along. Is that why or is it because of something else? Should I attach the firmware file here?

kdschlosser commented 1 month ago

if you are using the USB port then you need to add --usb-otg to the build command. This will enable the REPL output to the USB CDC on the ESP32.

spienz commented 1 month ago

Hy Reset button won't help, i can flash it with the esp windows tool. But i will get some error regarding the partion table How can i solve this

ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0x3 (RTC_SW_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT) Saved PC:0x403cdd3d SPIWP:0xee mode:DIO, clock div:1 load:0x3fce3820,len:0x105c load:0x403c9700,len:0x4 load:0x403c9704,len:0xbd8 load:0x403cc700,len:0x2e30 SHA-256 comparison failed: Calculated: e0725c018106b73308f8850f643e235629842a1db92caf46b93d064afc8dd5fa Expected: f1a4a014e8fdd3480f4645b0ef5c8d91c9dfc54b46f452c5f9184f449e1583ed Attempting to boot anyway... entry 0x403c989c E (50) flash_parts: partition 3 invalid - offset 0x268000 size 0x598000 exceeds flash chip size 0x400000 E (50) boot: Failed to verify partition table E (54) boot: load partition table error!

Greetings

Sebastian

kdschlosser commented 1 month ago

your flash chip isn't the size that you passed in the build command, your chip size is 4mb. so you need to pass --flash-size=4 to the build program

Type-32 commented 1 month ago

I think I encountered another issue that's also probably unrelated to this repo, but I'll still post it here -

>>> import lvgl as lv
>>> import ili9341
>>> import gt911
>>> lv.init()
>>> scr = lv.obj()
>>> btn = lv.button(scr)
>>> lv.screen_load(scr)

running these lines in the REPL after flashing it(flashing it is successful) just shows nothing. Not even a white screen. No changes on the screen.

Should I report it here or at the official lv_bindings_micropython repo?


Additional Info: I'm using ESP32-S3-Touch-LCD-4.3 from WaveShare as my hardware. Now I'm regretting buying it.

Also built another firmware without SPRIAM OCTAL option, flashed it, ran same commands, didn't work, same reaction

I also do not know what and how to develop it locally so I'm using the online lvgl + micropython simulator to write code for this.

spienz commented 1 month ago

ok, thats was a little bit stupid from my side. Works now. But i'm getting another error:

entry 0x403c989c E (422) quad_psram: PSRAM ID read error: 0x00ffffff, PSRAM chip not found or not supported, or wrong PSRAM line mode E (423) esp_psram: PSRAM enabled but initialization failed. Bailing out.

tried to play with BOARD_VARIANT=SPIRAM_OCT, BOARD_VARIANT=SPIRAM but wont help

my board should have 8mb PSRAM

any suggestions?

THX

kdschlosser commented 1 month ago

I have that exact same display sitting right here in front of me.

this is the build command...

and this is the proper way to use the driver...

python3 make.py esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT --flash-size=8 DISPLAY=rgb_display INDEV=gt911
from micropython import const  # NOQA
from i2c import I2C
import gt911
import lcd_bus
import task_handler
import lvgl as lv  # NOQA
import rgb_display

_WIDTH = const(800)
_HEIGHT = const(480)

_BUFFER_SIZE = const(76800)

_CTP_SCL = const(9)
_CTP_SDA = const(8)
_CTP_IRQ = const(4)

_SD_MOSI = const(11)
_SD_SCK = const(12)
_SD_MISO = const(13)

_LCD_FREQ = const(13000000)
_PCLK_ACTIVE_NEG = const(0)

_HSYNC_PULSE_WIDTH = const(10)
_HSYNC_BACK_PORCH = const(10)
_HSYNC_FRONT_PORCH = const(10)

_VSYNC_PULSE_WIDTH = const(10)
_VSYNC_BACK_PORCH = const(10)
_VSYNC_FRONT_PORCH = const(20)

_PCLK = const(7)
_HSYNC = const(46)
_VSYNC = const(3)
_DE = const(5)
_DISP = None
_BCKL = None
_DRST = None

I2C_BUS = I2C.Bus(
    host=1,
    scl=_CTP_SCL,
    sda=_CTP_SDA,
    freq=400000,
    use_locks=False
)

TOUCH_DEVICE = I2C.Device(
    I2C_BUS,
    dev_id=gt911.I2C_ADDR,
    reg_bits=gt911.BITS
)

_DATA15 = const(10)  # B7
_DATA14 = const(17)  # B6
_DATA13 = const(18)  # B5
_DATA12 = const(38)  # B4
_DATA11 = const(14)  # B3
_DATA10 = const(21)  # G7
_DATA9 = const(47)  # G6
_DATA8 = const(48)  # G5
_DATA7 = const(45)  # G4
_DATA6 = const(0)  # G3
_DATA5 = const(39)  # G2
_DATA4 = const(40)  # R7
_DATA3 = const(41)  # R6
_DATA2 = const(42)  # R5
_DATA1 = const(2)  # R4
_DATA0 = const(1)  # R3

bus = lcd_bus.RGBBus(
    hsync=_HSYNC,
    vsync=_VSYNC,
    de=_DE,
    pclk=_PCLK,
    data_pins=(
        _DATA0,
        _DATA1,
        _DATA2,
        _DATA3,
        _DATA4,
        _DATA5,
        _DATA6,
        _DATA7,
        _DATA8,
        _DATA9,
        _DATA10,
        _DATA11,
        _DATA12,
        _DATA13,
        _DATA14,
        _DATA15
    ),
    freq=_LCD_FREQ,
    hsync_front_porch=_HSYNC_FRONT_PORCH,
    hsync_back_porch=_HSYNC_BACK_PORCH,
    hsync_pulse_width=_HSYNC_PULSE_WIDTH,
    hsync_idle_low=False,
    vsync_front_porch=_VSYNC_FRONT_PORCH,
    vsync_back_porch=_VSYNC_BACK_PORCH,
    vsync_pulse_width=_VSYNC_PULSE_WIDTH,
    vsync_idle_low=False,
    de_idle_high=False,
    pclk_idle_high=False,
    pclk_active_low=_PCLK_ACTIVE_NEG,
)

buf = bus.allocate_framebuffer(_BUFFER_SIZE, lcd_bus.MEMORY_SPIRAM)

display = rgb_display.RGBDisplay(
    data_bus=bus,
    display_width=_WIDTH,
    display_height=_HEIGHT,
    frame_buffer1=buf,
    frame_buffer2=None,
    color_space=lv.COLOR_FORMAT.RGB565,
    rgb565_byte_swap=True
)

display.set_power(True)
display.init()
display.set_backlight(100)
indev = gt911.GT911(TOUCH_DEVICE)

# display.set_rotation(lv.DISPLAY_ROTATION._90)  # NOQA

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

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

task_handler.TaskHandler()
kdschlosser commented 1 month ago

don't use the USB CDC port. use the other USB when flashing and connecting to the repl

spienz commented 1 month ago

Nope, this was my fist try without board variant

Build:Mar 27 2021 rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT) 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 E (422) quad_psram: PSRAM ID read error: 0x00ffffff, PSRAM chip not found or not supported, or wrong PSRAM line mode E (423) esp_psram: PSRAM enabled but initialization failed. Bailing out. LVGL MicroPython 1.23.0 on 2024-10-05; Generic ESP32S3 module with ESP32S3 Type "help()" for more information.

kdschlosser commented 1 month ago

did you try the build command I posted?

kdschlosser commented 1 month ago

I am compiling it now to test on my display to see if it is working.

spienz commented 1 month ago

Yes, almost same build command, flash Size 4. with 8 i become the Partition Table error https://www.elecrow.com/esp32-display-5-inch-hmi-display-rgb-tft-lcd-touch-screen-support-lvgl.html

kdschlosser commented 1 month ago

then the display you are referencing is not the same display. the display you are referencing has 8mb of flash. Maybe you got a bad display?

kdschlosser commented 1 month ago

OK, I see what is happening. You need to open your own issue instead of hijacking one that was not made by you. You are getting me all kinds of confused.

spienz commented 1 month ago

But from the same family, no problem, i open a seperate issue

kdschlosser commented 1 month ago

2 different discussions at this point. I am getting mixed up between the 2 people.

Type-32 commented 1 month ago

I'm going to close this issue since the issue that the title suggests is fixed. I'm going to open a discussion because I need some help with setting up my board.

Type-32 commented 1 month ago

I opened the discussion at #142 specifically for talking about setting up the 4.3 touch board.