Setting up LVGL+Micropython on ESP32-S3-Touch-LCD-4.3 from WaveShare #142
Replies: 32 comments 97 replies
-
I just recently made some changes that I am going to revert. I have to mess around with testing them locally to find out why they are not working properly. |
Beta Was this translation helpful? Give feedback.
-
Status update: i uncommented these lines: # data8=_DATA8,
# data9=_DATA9,
# data10=_DATA10,
# data11=_DATA11,
# data12=_DATA12,
# data13=_DATA13,
# data14=_DATA14,
# data15=_DATA15, Still can't access the REPL after flashing the code as well. |
Beta Was this translation helpful? Give feedback.
-
Plug your USB cable into the other USB port. That is the reason why you are not able to access the REPL. |
Beta Was this translation helpful? Give feedback.
-
This is the build command I use for that display...
and this is the code that I use to initialize the display... 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,
data0=_DATA0,
data1=_DATA1,
data2=_DATA2,
data3=_DATA3,
data4=_DATA4,
data5=_DATA5,
data6=_DATA6,
data7=_DATA7,
data8= _DATA8,
data9=_DATA9,
data10= _DATA10,
data11= _DATA11,
data12=_DATA12,
data13=_DATA13,
data14=_DATA14,
data15=_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,
)
buf1 = bus.allocate_framebuffer(_BUFFER_SIZE, lcd_bus.MEMORY_SPIRAM)
buf2 = bus.allocate_framebuffer(_BUFFER_SIZE, lcd_bus.MEMORY_SPIRAM)
display = rgb_display.RGBDisplay(
data_bus=bus,
display_width=_WIDTH,
display_height=_HEIGHT,
frame_buffer1=buf1,
frame_buffer2=buf2,
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)
if indev.hw_size != (_WIDTH, _HEIGHT):
fw_config = indev.firmware_config
fw_config.width = _WIDTH
fw_config.height = _HEIGHT
fw_config.save()
del fw_config
# 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() |
Beta Was this translation helpful? Give feedback.
-
The display is running successfully. I can now see a slider. Is there extra documentation for LVGL+MicroPython for V9.x? |
Beta Was this translation helpful? Give feedback.
-
I found a better way of generating the code that is used in the binding and at some point I will write the generator code over again. The way it has been done is not the most efficient... |
Beta Was this translation helpful? Give feedback.
-
How do I rotate the UI display from a horizontal display to a vertical display? |
Beta Was this translation helpful? Give feedback.
-
At least this is my workflow for now, which I know is not the best (but it's the only way I currently know) and am sure will change in the future. |
Beta Was this translation helpful? Give feedback.
-
Another annoying issue that has an annoying workaround:
Keep getting this when trying to flash my own program. Erasing the flash and reflashing the firmware does the job but I have to reflash the programs in again but only to be greeted with this after the first or second time of flashing my program on to the hardware. |
Beta Was this translation helpful? Give feedback.
-
One question: in what way is the main.py ran on the device (like runs when booting or loops after booting)? Is it running as a loop or something, or is it only just running one time? I've been trying to setup a realtime local time display but haven't succeeded yet. |
Beta Was this translation helpful? Give feedback.
-
I noticed something funny: with the
|
Beta Was this translation helpful? Give feedback.
-
OK so when dealing with the RGBBus and using RGB565 with a 16 lane connection if your colors are off it is going to be because the pins are not defined correctly. I have seen this more than once where for some crazy reason the pin order is goofed up. so what you are going to need to do is double check the pins to see if they align with what the data sheet says. You will have to compare that with what is in the examples for the display as well. I have found that the datasheet is not always correct but the examples are and the examples also will give you a hint as to what pin actually does what. |
Beta Was this translation helpful? Give feedback.
-
An update on the SD Card Slot thingy: i recently bought an MMC Micro card to see whether it'll work on the board and it does not fit lol. I now bought another micro SD card and am waiting for it to arrive. |
Beta Was this translation helpful? Give feedback.
-
Update on the SD Card thingy: I rechecked the wiki again and it says that:
...whatever the hell that means. |
Beta Was this translation helpful? Give feedback.
-
I successfully built a .bin for the ESP32-S3-Touch-LCD-4.3 from WaveShare on both MacOS and Linux. There's lots of helpful info from kdschlosser in the Closed Issues for this repo regarding getting a build to actually work on MacOS and Linux - there are lots of things that might not work at first. I built a native binary for MacOS then Linux , then for the WaveShare board. Here's the build command for the WaveShare board: At the end of the build, it displays the command to flash the .bin onto the WaveShare board. You have to figure out the name of the USB serial port that appears on your computer when you plug the Waveshare board in using a USB cable. Replace "(PORT)" with that devicename. On my Linux box the device is /dev/ttyACM0 I installed mpremote on my Linux box so I could manipulate (copy from PC to board, etc.) Python files on the WaveShare board. I got some demo LVGL python demo code running on the board. The touchscreen works too. Copy the demo.py file to the board using Type |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Here's those 3 buttons and more. This is with rgb565_byte_swap=FALSE
|
Beta Was this translation helpful? Give feedback.
-
SUCCESS! Replaced the code in pal.py.txt with your new pin definitions and Voila! |
Beta Was this translation helpful? Give feedback.
-
When I try to connect to a WiFi network using the commands that are displayed when I run help() in the REPL, Micropython crashes on an illegal instruction and does a crash dump. The specific Python statement that crashes it is sta_if.connect() |
Beta Was this translation helpful? Give feedback.
-
Hi all together! Thanx kdschlosser for the big work on lvgl. But: I use the 7" Waveshare ESP32-S3 Display with gt911 with the CH422G expander. Has anybody solved to get touch to work with lvgl_micropython? Could someone show me the code-sample for that? Thanx in advance and regards Hans |
Beta Was this translation helpful? Give feedback.
-
Hi! E (728) rmt(legacy): CONFLICT! driver_ng is not allowed to be us 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 MicroPython IDF version : v5.4 Machine : Generic ESP32S3 module with Octal-SPIRAM with ESP32S3 abort() was called at PC 0x4216e3e4 on core 0 Backtrace: 0x403756c5:0x3fceb1f0 0x403884e1:0x3fceb210 0x4038e6ba:0x3fceb230 0x4216e3e4:0x3fceb2a0 0x420bf0de:0x3fceb2c0 0x40375b25:0x3fceb2f0 0x403ccb3d:0x3fceb340 0x403ccef9:0x3fceb380 0x403c8919:0x3fceb4b0 0x40045c01:0x3fceb570 0x40043ab6:0x3fceb6f0 0x40034c45:0x3fceb710 Could this be due to the IDF version? How can I fix it? |
Beta Was this translation helpful? Give feedback.
-
Hello! This is a known issue and I think it is being worked on. I believe
you just have to clone an earlier version of this repository until it is
fixed.
|
Beta Was this translation helpful? Give feedback.
-
You need to use an earlier verson of idf. Try 5.2.2
…On Thu, Sep 25, 2025, 12:22 Nathanael Asher ***@***.***> wrote:
Hello! This is a known issue and I think it is being worked on. I believe
you just have to clone an earlier version of this repository until it is
fixed.
—
Reply to this email directly, view it on GitHub
<#142 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BGF5YL6KWW32F4AZR3BYSAT3UQJFHAVCNFSM6AAAAABPOD2422VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTINJRGM2DAMA>
.
You are receiving this because you commented.Message ID:
<lvgl-micropython/lvgl_micropython/repo-discussions/142/comments/14513400@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Hello
cd to the directory.
then
git checkout v5.2.2
i hope that helps.
…On Thu, Sep 25, 2025 at 1:50 PM cotesmanoc-byte ***@***.***> wrote:
HI! How do I force IDF version 5.2? Thanks!
—
Reply to this email directly, view it on GitHub
<#142 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BGF5YL3ZCDIODJGWLJBPHAD3UQTPTAVCNFSM6AAAAABPOD2422VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTINJRGQYTMMI>
.
You are receiving this because you commented.Message ID:
<lvgl-micropython/lvgl_micropython/repo-discussions/142/comments/14514161@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Cotesmanoc-byte
Please view Video35 (YouTube) (Applying Microcontroller Solutions) where
I first use Kevin Schlosser's approach to build.
Later, I build it again and then use it for Video 43 for the Waveshare
device.
I believe that I use Espressif/idf 5.2 or 5.2.2
k
…On Sat, Sep 27, 2025, 14:27 cotesmanoc-byte ***@***.***> wrote:
Thank you! What would be the best option?
—
Reply to this email directly, view it on GitHub
<#142 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BGF5YLZXQQP5RIP2ULC2JBT3U3JILAVCNFSM6AAAAABPOD2422VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTINJTGA2TOMY>
.
You are receiving this because you commented.Message ID:
<lvgl-micropython/lvgl_micropython/repo-discussions/142/comments/14530573@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Kevin
Thanks for the advice. I will try them.
K
…On Sun, Sep 28, 2025, 00:50 Kevin Schlosser ***@***.***> wrote:
Thanks for the plug in the video. Good pronunciation of my last name too.
If you flashed the firmware from a shell you can greatly speed up how fast
the firmware loads onto the ESP32. The speed that Thonny uses is 115200 but
speeds of 576000 or faster can be used without any problems.
Are you actually using a separate Windows PC or are you using WSL? If it
is the latter there is a nifty little tool that I use that handles
forwarding ESP ports to WSL. This allows access to be able to flash the
ESP32 from WSL. You can download the program from here
<https://gitlab.com/alelec/wsl-usb-gui/-/releases>
Another option is Virtual Here <https://www.virtualhere.com/> which is a
USB/IP driver.
—
Reply to this email directly, view it on GitHub
<#142 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BGF5YL2MN4YBXMPLSFKCJUD3U5SKFAVCNFSM6AAAAABPOD2422VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTINJTGIZDINI>
.
You are receiving this because you commented.Message ID:
<lvgl-micropython/lvgl_micropython/repo-discussions/142/comments/14532245@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
which build approach are you attempting? can you reply back with the
command ?
k
…On Thu, Sep 25, 2025 at 10:19 AM cotesmanoc-byte ***@***.***> wrote:
Hi!
When I compile I get this error on the waveshare ESP32-S3:
E (728) rmt(legacy): CONFLICT! driver_ng is not allowed to be us 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
MicroPython IDF version : v5.4 Machine : Generic ESP32S3 module with
Octal-SPIRAM with ESP32S3 abort() was called at PC 0x4216e3e4 on core 0
Backtrace: 0x403756c5:0x3fceb1f0 0x403884e1:0x3fceb210
0x4038e6ba:0x3fceb230 0x4216e3e4:0x3fceb2a0 0x420bf0de:0x3fceb2c0
0x40375b25:0x3fceb2f0 0x403ccb3d:0x3fceb340 0x403ccef9:0x3fceb380
0x403c8919:0x3fceb4b0 0x40045c01:0x3fceb570 0x40043ab6:0x3fceb6f0
0x40034c45:0x3fceb710
Could this be due to the IDF version? How can I fix it?
—
Reply to this email directly, view it on GitHub
<#142 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BGF5YLY23LV3QYDKFF2DJ733UP2X7AVCNFSM6AAAAABPOD2422VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTINJRGIYDANY>
.
You are receiving this because you commented.Message ID:
<lvgl-micropython/lvgl_micropython/repo-discussions/142/comments/14512007@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Hello,
There are two example programs. test_matrix2_lcdbus.py (only uses local
fonts). The test_button2_lcdbus.py
deliberately is using fonts on the sd card. You can drag a copy of the
font folder from the GitHub site.
I am glad you got the MicroPython installed.
let me know if you got it working with either demo program.
k
…On Tue, Sep 30, 2025 at 8:34 PM cotesmanoc-byte ***@***.***> wrote:
Hi @kwinter745321 <https://github.com/kwinter745321>
Thank you so much for your help! I downloaded the firmware, uploaded it to
the Waveshare, and it didn’t throw any errors.
The problem is that I can’t load the fonts from the filesystem! Do they
only work if they’re on the SD card?
I tried several different ways but had no success!
—
Reply to this email directly, view it on GitHub
<#142 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BGF5YL6QVZCXYEU4F5M3KC33VMOSZAVCNFSM6AAAAABPOD2422VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTINJVG43TSMA>
.
You are receiving this because you were mentioned.Message ID:
<lvgl-micropython/lvgl_micropython/repo-discussions/142/comments/14557790@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the error message.
I will try to see how you got it.
K
…On Thu, Oct 2, 2025, 02:31 Kevin Schlosser ***@***.***> wrote:
Here is an example of how to set it up...
import lvgl as lvimport fs_driverimport machineimport time
from micropython import const
_HOST= const(2)_MISO = const(...)_MOSI = const(...)_SCK = const(...)_SD_CS = const(...)
# add code for initilizing the display# if you have an SPI display and the display shares the same pins with the SDCard# then you share the use of the bus instance. Make sure you pass a CS pin to# both the display bus and also to the SDCard driver so it is able to switch# between devices properly.spi_bus = machine.SPI(host=_HOST, miso=_MISO, mosi=_MOSI, sck=_SCK)
while True:
try:
# sdcard once created will automatically be mounted to `./sdcard`
sd_card = machine.SDCard(spi_bus=spi_bus, cs=_SD_CS)
break
except OSError:
print('splease insert SD Card.. waiting 30 seconds')
time.sleep_ms(30000)
fs_drv = lv.fs_drv_t()fs_driver.fs_register(fs_drv, 'S')
scrn = lv.screen_active()image = lv.image(scrn)# notice the path. it is prefixed using the drive letter I assigned above when # the file system driver was created. Also notice the sdcard folder.. This is to# acces the sdcard. image.set_src('S:sdcard/some_image.png')
import task_handler
th = task_handler.TaskHandler()
—
Reply to this email directly, view it on GitHub
<#142 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BGF5YL2GOBYV46DKJN2LSR33VTBFHAVCNFSM6AAAAABPOD2422VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTINJXGAZTAOA>
.
You are receiving this because you were mentioned.Message ID:
<lvgl-micropython/lvgl_micropython/repo-discussions/142/comments/14570308@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Cotesmanoc-byte
Just an update. I retested Video43 (per the RECAP below). Then I
realized you must have built your own firmware. I rebuilt the firmware and
I noticed that it is certainly using ESP-IDF 5.4.0. This builds MP 1.25.0
with LVGL 9.3.0
I used this command
python3 make.py esp32 BOARD=ESP32_GENERIC_S3 VARIANT=SPIRAM_OCT
DISPLAY=ili9341 INDEV=xpt2046 INDEV=gt911
After flashing the firmware, I retested. Two changes are needed:
in [display_driver] change:
import rgb_display_framework as rgb_display
display = rgb_display.RGBDisplayDriver(
Now the two test programs work again. Please let me know if this helps you.
K
RECAP Video43
I retested the Video 43 code and found it still works. You must load three
files onto the flash of the ESP32. (1) display_driver.py, (2) ch422g.py,
and (3) sdcard_driver.py. Then, the test_matrix2_lcdbus.py works without
the sd card.
For the test_button2_lcdbus.py program you will need to get a micro
sdcard and create a folder called font on it. This folder should contain
the font files from Video43.
…On Thu, Oct 2, 2025 at 9:03 PM Kevin Winter ***@***.***> wrote:
Thanks for the error message.
I will try to see how you got it.
K
On Thu, Oct 2, 2025, 02:31 Kevin Schlosser ***@***.***>
wrote:
> Here is an example of how to set it up...
>
> import lvgl as lvimport fs_driverimport machineimport time
> from micropython import const
> _HOST= const(2)_MISO = const(...)_MOSI = const(...)_SCK = const(...)_SD_CS = const(...)
> # add code for initilizing the display# if you have an SPI display and the display shares the same pins with the SDCard# then you share the use of the bus instance. Make sure you pass a CS pin to# both the display bus and also to the SDCard driver so it is able to switch# between devices properly.spi_bus = machine.SPI(host=_HOST, miso=_MISO, mosi=_MOSI, sck=_SCK)
>
> while True:
> try:
> # sdcard once created will automatically be mounted to `./sdcard`
> sd_card = machine.SDCard(spi_bus=spi_bus, cs=_SD_CS)
> break
> except OSError:
> print('splease insert SD Card.. waiting 30 seconds')
> time.sleep_ms(30000)
>
> fs_drv = lv.fs_drv_t()fs_driver.fs_register(fs_drv, 'S')
>
> scrn = lv.screen_active()image = lv.image(scrn)# notice the path. it is prefixed using the drive letter I assigned above when # the file system driver was created. Also notice the sdcard folder.. This is to# acces the sdcard. image.set_src('S:sdcard/some_image.png')
> import task_handler
> th = task_handler.TaskHandler()
>
> —
> Reply to this email directly, view it on GitHub
> <#142 (reply in thread)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/BGF5YL2GOBYV46DKJN2LSR33VTBFHAVCNFSM6AAAAABPOD2422VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTINJXGAZTAOA>
> .
> You are receiving this because you were mentioned.Message ID:
> <lvgl-micropython/lvgl_micropython/repo-discussions/142/comments/14570308
> @github.com>
>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This here is the board I have and are referencing: ESP32-S3-Touch-LCD-4.3 from WaveShare
I modified the python code that @kdschlosser provided in #138 and flashed it into my board.
After flashing it, the board screen glows white (which is better than showing nothing since the last five days I've been trying to get it to show something other than nothing). But after flashing the python program on to it, I can't connect the REPL anymore, including flashing any other python code on to the board.
Am I doing something wrong here, or is there something weird with the code I modified...? I honestly am a complete amateur to this type of development and I would appreciate any help (scolding also works). I'd also appreciate if there's other resources I can reference off of.
Beta Was this translation helpful? Give feedback.
All reactions