Generate SSD1963 bindings in Micropython

Hello! I am trying to include the SSD1963 LVGL display driver in my build fo Micropython for the RP2040-W. I successfully build the firmware using the steps outlined here but I have no idea how to generate the driver from lv_drivers after this. I assume that I need to run gen_mpy.py on that library - but I’m not sure how to trigger it in the build process.

So far I’ve tried blindly adding USE_SSD1963=1 to all the make commands outlined in the build instructions but that didn’t seem to do anything…

Any help would be appreciated! Thanks!

I can rewrite the driver in Python for you if you would like.

That would be fantastic! Is there some way I could help with that? What kind of timeline would you need?

Well that’s odd. I never got a notification that there was a reply to this.

I am sorry about the delay.

I need to know who makes your display so I can lookup what the interface is. I know the IC is the SSD1963 but there are several ways the IC can be set up to communicate.

I see you are using the RP2040 and that might end up being in issue depending on how the display is broken out. If the display is set up for 24 bit you are not going to have enough GPIOs on the RP2040 to connect it.
If it is set up for 16 bit you will need a total of 16 data pins and then another 6-7 pins for control pins and backlight, power… that kind of stuff. I do not know if there are enough pins to do that. If it is set up for 8 bit mode you will need 8 data pins and again the same 6-7 additional pins. This you will have enough for.

The largest problem you are going to have is memory. The controller IC supports up to a display size of 864x480. I am not sure what size you are running. If the display is set up for 8 bit mode you can only write 24 bit data to it. LVGL does not support 24 bit color. It goes from 16 bit to 32 bit. If a frame buffer was made to hold a screens worth of data you are looking at 864 x 480 x 4 = 1,658,880 bytes of data. The RP2040 only has 264 K of RAM. and 16 of that will get used up by MicroPython and more of it is going to get used up by LVGL. You are going to be limited to about a 100k frame buffer size so in order to render a single frame (entire screen) it’s going to have to be done in 16 sections. This is going to be a lot of work for the RP2040 and I am not so sure it is going to be able to keep up with it. If the display is set up for 16 bit mode we can cut number of sections down to 8.

You really should consider using something that has more RAM to work with if you want to use a screen of that size.

That being said I am going by what the maximum screen size the IC supports.

I have used this class for PicoW. I have no any complaint - it works properly with my screen 800*480 & 8 bit interface.
I’d like to try to use this GUI with this display but I have the similar problem - I have no idea how to integrate and create the driver for my display (8bit interface and PicoW as a host and the Micropython language)
Is it possible to use this class as driver? Do I have to change something in source file?
Unfortunately I’m stuck on the last build step and can’t go ahead with LVGL now…

Unsurprisingly, our requirements changed and we’re going to have to upgrade to a Raspberry Pi 4B to do our data acquisition. I don’t think we’ve made a decision on whether to use LVGL or TK but either way I expect it to build fine. Thanks for the support!

@tm4c1294

I ported that library to work with LVGL. Dunno if it will work or not but it might

ssd1963.py.txt (27.1 KB)

The .txt extension needs to be removed

I’m a newbie with lv_micropython and I’m doing it the first time)
Can you provide please some details about where I need to place your driver (i mean what folder in the source files)? What is the next step after that?
If I understand correctly after integration this driver to the source files (“some folder”) I need rebuild it again (last step your working procedure)…

If you already have LVGL and MicroPython compiled and flashed to the PICO it is a matter of transferring the file I attached using something like ampy or the IDE Thonny (I think that is what it is called). Then write a script like any other script and import the driver.

It’s a lot to try and explain how to do if you have little to no experience using Python or even MicroPython. I do not personally own a PICO now have I ever used one so telling you anything specific to it I am not going to be able to help out in that area. Maybe someone else that has a PICO and one of these displays would be able to help out in that area.

I have hands-on experience with programming on C ( many-many years ) and little with MicroPython ( started to use just several month ago ). I have no problem with MicroPython after C ( it looks like a Basic in 80th;-) - just for my ). I’m done with a couple projects for PicoW and MQTT and sensors - just like a hobby ). Used the Visual Studio Code IDE, Microsoft Visual Studio and Thonny IDE.
When I asked you about details I mean just to get some guide in general how to use the drivers for displays and LVGL GUI together.
Like I said before without LVGL both display work properly with PicoW (by using classes on MicroPython).
Anyway I’ll try to make a simple test program with compiled LVGL_MicroPython and your driver.
I have already spent for that many days and I’d like to see result of this one)))

Just to let you know I am going to update the readme for the pico build instructions on micropython and I will submit a PR for it… If you want to add the script I wrote here to the build if you drop it into lib/lv_bindings/driver/rp2 folder it should get compiled into the firmware Then all you would have to do is do an import and create a display instance like this.

YOU MUST HAVE THE CONNECTIONS TO THE DISPLAY AS FOLLOWS

d0 = GP2
d1 = GP3
d2 = GP4
d3 = GP5
d4 = GP6
d5 = GP7
d6 = GP8
d7 = GP9
dc = GP10
rd = GP11
wr = GP12
cs = tied to ground
reset = any other gpio
backlight = any other gpio
power = any other gpio

There are 3 screens that are supported The screen is the actual screen and not the IC. There are differences between the screens that are used so there are 3 classes to handle the screen. The classes are as follows.

LB04301 - 480 x 272 resolution

AT070TN92 - 800 x 480 resolution

AT090TN10 - 800 x 480 resolution

When you compile you need to change the last make command to

make LV_CFLAGS="-DLV_COLOR_DEPTH=32" BOARD=PICO USER_C_MODULES="../../lib/lv_bindings/bindings.cmake"

This is because in 8bit mode the IC only supports 24bit color and LVGL doesn’t have support for 24 bit color. it jumps from 16 bit to 32 bit. So in the flush method the alpha channel is removed.


import ssd1963
from micropython import const

RESET_PIN = const(14)
POWER_PIN = const(15)
BACKLIGHT_PIN= const(16)


display = ssd1963.AT090TN10(
        RESET_PIN,
        power=POWER_PIN,
        backlight=BACKLIGHT_PIN,
        backlight_on=1,
        power_on=1,
        rot=ssd1963.LANDSCAPE,
        factor=8,
        double_buffer=False,
        initialize=True
)

# code for making the GUI

One more time - thank you so much! Your post above is exactly what I needed. Now I just need to build and test everything on my screen.

I did this one but after compilation and flashing to PicoW I have the following error:

Traceback (most recent call last):
File “”, line 1, in
ImportError: no module named ‘ssd1963’

After that I uploaded to PicoW your file “ssd1963.py” and I got another error:

import ssd1963
Traceback (most recent call last):
File “”, line 1, in
File “ssd1963.py”, line 730, in _flush
ViperTypeError: comparison of int and uint

What I did wrong with “ssd1963.py” file.

You didn’t do anything wrong. It appears that lv_binding is not set up to build the python files into the firmware for the Pico like it is set up for the ESP32. Curious as to why that is. I would have to ask.

You can upload it as well like you did and the error is because of a bug in my code that I have to sort out.

Ohhh(( That means I still can’t make next step ahead for starting to use the set “LVGL_MicroPython_PicoW”.

I’d like to ask you some questions.

Can I use “drivers” for displays without embedding to the firmware for PicoW - just use a coping to the flash memory of PicoW as a regular way for the uPython scripts?
I just try to understand how it works in the LVGL( an academic question ). I mean if I’ll compile the most updated revision of “LV_MicroPython” for PicoW and after that I’ll upload to the internal flash memory some driver which it will be needed in the future?

Can I compile LV_MicroPython revision which will support the Wi-Fi module located on the board PicoW?
If yes what do I need to change in the parameters of make command?

I have the NUCLEO-H743ZI kit (based on MCU STM32H743ZI).
I connected the regular LCD RGB display (without controller) by using 24bit RGB interface and by using the low level support on the register level and C programming( I don’t like to use the original STM32Cube from STM )
Is it possible to get the “LV_MicroPython” firmware for that MCU (I didn’t find on the webside offically support)?

Thanks so much for providing information!