MicroPython Display Drivers part 2

Hi,

thanks for the link.

I tried to build the esp32 port, but the build fails with the following error:

Including User C Module(s) from /data/mp-1.21/lv_binding_micropython/make_build
CMake Error at /data/mp-1.21/lv_binding_micropython/micropython/py/usermod.cmake:42 (include):
include requested file is a directory:

/data/mp-1.21/lv_binding_micropython/make_build

Call Stack (most recent call first):
esp32_common.cmake:22 (include)
main_esp32/CMakeLists.txt:11 (include)

My build command is:

python3 make.py esp32 submodules mpy_cross clean BOARD=ESP32_GENERIC

Any help would be appreciated,
Martin

i am in the process of fixing that error.

When i use command python3 make.py esp32 mpy_cross, i get the error message:

lv_binding_micropython/make.py", line 231, in read
    sys.stdout.write(o_char.decode('utf-8'))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe8 in position 0: unexpected end of data

my git commit id is dc391bd4328578bc3092eab0a61a9ad54802d98d

@kdschlosser RGBBus is now getting this error in .init():

ValueError: 258(esp_lcd_new_rgb_panel)

I didn’t dig into it, but there are some naming issues with bounce_buffer_size_px / bb_size_px and hsync_back_porch / hsync_pulse_width.

First, I’m brand new to lvgl, micropython, and MCUs… but was looking for a “recovery from bypass surgery project” and I got this board as it seemed like a decent platform to learn on: https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-4.3

I have been unable to get lv_micropython to compile at all:

  • OSX xcode command line tools
  • esp-idf v 4.4
  • lv_micropython @ master

I tried to follow the steps that I found:
git submodule update --init --recursive lib/lv_bindings
cd mpy-cross; make
cd …/ports/esp32; make BOARD=GENERIC_S3 submodules; make BOARD=GENERIC_S3

Currently the build fails in espidf.h about implicit declarations of functions. So, I don’t even know how I can get a current version of lv_micropython to see if any of the good works y’all are doing will work with this random board I got. This does appear to be an RGB board (it took me lots of research to even understand that… like I said, new to this whole world, and recovering from heart surgery.)

Thanks for all the awesome work y’all do, and hopefully one day I’ll end up with a board to play with micropython on, and some awesome graphics libs.

Thanks for everyone’s hard work, I’ve certainly been trying to understand lots of threads and git repos from @kdschlosser to try and get this to work.

@kdschlosser is this link no longer available?

look : GitHub - kdschlosser/lvgl_micropython: LVGL module for MicroPython

Thanks!!!

Hi there,

I am trying to use ESP32-S3 with SPI LCD based on the ST7789 driver. Unfortunately, the source branch MicroPython_1.21.0_Update from @kdschlosser is no longer available. Is the repo GitHub - kdschlosser/lvgl_micropython: LVGL module for MicroPython its “replacement”? Has anyone had any success with similar hardware?

I successfully built an ESP32 SPIRAM image from GitHub - kdschlosser/lvgl_micropython: LVGL module for MicroPython but am having trouble with display initialization. I’m running an ILI9341 display. I have been able to use another driver for the display on the same hardware and firmware image, so the hardware itself checks out. If anyone could point me toward a simple example of how to implement that I’d appreciate it.

Now that you have the firmware built and flashed to your board, look at mpdisplay at https://github.com/bdbarnett/mpdisplay to get the drivers for ILI9341 and your touch driver. Let me know if you have any trouble.

I actually downloaded your drivers earlier today at someone else’s suggestion. I used the board_config for the esp32 s3 and ili9341. I changed out the pin assignments and commented out the touchscreen part as I don’t have one. I’m getting an error when trying to run display_simpletest.py. The error is

Traceback (most recent call last):
File “”, line 42, in
File “ili9341.py”, line 79, in init
File “busdisplay.py”, line 131, in init
TypeError: function missing 1 required positional arguments

It sounds like something is missing or out of order in your board_config.py. Please look at ili9341_eyespi_qtpy_esp32s3 and m5stack-cores3 in the board_configs directory for examples. If you still have trouble, post your board_config.py here and I’ll take a look at it. It may help me to know which ili9341 display and/or which esp32 board you have if you want to include links to those as well.

I just got it working with the lcd_bus.py from your repository. With that in the lib folder and the reference to lcd_bus in board_config changed to lib.lcd_bus, the display_simpletest.py runs. My understanding is this shouldn’t be necessary, but it is at the moment for some reason. Any thoughts on why that is?

For reference, I’m using an ODROID GO, which is a handheld gaming system based on the ESP32 with an integrated ILI9341 screen.

https://wiki.odroid.com/odroid_go/odroid_go

You are correct – you shouldn’t need to use lcd_bus.py since you are on ESP32 and have the lcd_bus C drivers from @kdschlosser already compiled in. It will be somewhat faster if you use those C drivers. I still think something is out of order in your board_config.py. Since lcd_bus and lcd_bus.py are written by different people and in different languages, they don’t behave exactly the same regarding the order of their arguments. I tried to keep lcd_bus.py as close to lcd_bus as possible, but it is also a bit more flexible than lcd_bus. If you want, please post your board_config.py and I’ll try to figure out what is happening. If you do post it, I’ll add it to mpdisplay/bus_configs as odroid_go for others to use in the future.

Here’s the file. It still is set to use lib.lcd_bus.

""" ODROID GO with ILI9341 2.4" display """

from lib.lcd_bus import SPIBus
from ili9341 import ILI9341

display_bus = SPIBus(
    dc=21,
    host=2,
    mosi=23,
    miso=19,
    sclk=18,
    cs=5,
    freq=60_000_000,
    wp=-1,
    hd=-1,
    quad_spi=False,
    tx_only=True,
    cmd_bits=8,
    param_bits=8,
    dc_low_on_data=False,
    sio_mode=False,
    lsb_first=False,
    cs_high_active=False,
    spi_mode=0,
)

display_drv = ILI9341(
    display_bus,
    width=240,
    height=320,
    colstart=0,
    rowstart=0,
    rotation=0,
    mirrored=False,
    color_depth=16,
    bgr=True,
    reverse_bytes_in_word=True,
    invert=False,
    brightness=1.0,
    backlight_pin=14,
    backlight_on_high=True,
    reset_pin=None,
    reset_high=True,
    power_pin=None,
    power_on_high=True,
)

Thanks @kb1ujs. I don’t see anything that should be causing TypeError: function missing 1 required positional arguments on line 42. @kdschlosser may be able to help.

I haven’t updated, recompiled and flashed lvgl_micropython in a week or more. I’ll be able to do that Sunday and will get back to you if you don’t have a solution by then.

Awesome, I appreciate it. I’ll keep plugging away to see if I can figure it out.

I think it has something to do with the buffer_size parameter in modlcd_bus.c. The following definition states that buffer_size is required

mp_obj_t mp_lcd_bus_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args)
{
    enum { ARG_self, ARG_width, ARG_height, ARG_bpp, ARG_buffer_size, ARG_rgb565_byte_swap };
    static const mp_arg_t allowed_args[] = {
        { MP_QSTR_self,             MP_ARG_OBJ  | MP_ARG_REQUIRED  },
        { MP_QSTR_width,            MP_ARG_INT  | MP_ARG_REQUIRED  },
        { MP_QSTR_height,           MP_ARG_INT  | MP_ARG_REQUIRED  },
        { MP_QSTR_bpp,              MP_ARG_INT  | MP_ARG_REQUIRED  },
        { MP_QSTR_buffer_size,      MP_ARG_INT  | MP_ARG_REQUIRED  },
        { MP_QSTR_rgb565_byte_swap, MP_ARG_BOOL | MP_ARG_REQUIRED  },
    };

But in lcd_bus.py it says this parameter is ignored:

def init(
        self,
        width: int,  # Not Used
        height: int,  # Not Used
        bpp: int,
        buffer_size: int,  # Not Used
        rgb565_byte_swap: bool,
    ) -> None:

Scratch the above, I think it’s doing exactly what it’s supposed to. What I’m now suspecting is the call to display_bus.init in busdisplay.py. It appears that is the function call missing the positional argument.

The error looks like this at the moment:

Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
  File "board_config.py", line 39, in <module>
  File "ili9341.py", line 79, in __init__
  File "busdisplay.py", line 131, in __init__
TypeError: function missing 1 required positional arguments