russhughes / s3lcd

ESP_LCD based MicroPython driver for ESP32-S3 Devices with ST7789 or compatible displays.
Other
60 stars 10 forks source link

modifications for idf v5.0.2 #13

Closed c-logic closed 8 months ago

c-logic commented 10 months ago

only testet on LilyGo S3 Dongle

russhughes commented 10 months ago

Sorry I've been busy and have not had time to look at this.

c-logic commented 10 months ago

no hurry. I'll test it with a parallel TFT this week. "WT32 SC01 Plus"

c-logic commented 10 months ago

Not yet usable with with i80. the use with i80 runs in a error+reset.

russhughes commented 9 months ago

Found the i80 error. The clock source must be set.

E (66580) lcd_panel.io.i80: lcd_i80_select_periph_clock(504): unsupported clock source: 0
E (66580) lcd_panel.io.i80: esp_lcd_new_i80_bus(154): select periph clock 0 failed

Here is the fix:

diff --git a/src/s3lcd.c b/src/s3lcd.c
index f29b6c6..32cb8c0 100644
--- a/src/s3lcd.c
+++ b/src/s3lcd.c
@@ -1384,6 +1384,7 @@ STATIC mp_obj_t s3lcd_init(mp_obj_t self_in) {
         esp_lcd_i80_bus_config_t bus_config = {
             .dc_gpio_num = config->dc_gpio_num,
             .wr_gpio_num = config->wr_gpio_num,
+            .clk_src = LCD_CLK_SRC_DEFAULT,
             .data_gpio_nums = {
                 config->data_gpio_nums[0],
                 config->data_gpio_nums[1],
c-logic commented 9 months ago

Please give a hint how to get the error message.

c-logic commented 9 months ago

the current micropython version does not use the SPIRAM and so the memory is not enough for the frame buffer. (SC01 PLUS)

russhughes commented 9 months ago

Error Messages

The error messages are printed to the serial console. This is a problem if you use the native ESP32-S3 USB serial port since the USB is reset whenever there is an error, making it impossible to see the error messages. I use a 3.3-volt USB serial adapter connected to the ESP32-S3's serial TXD0 & RXD0 pins. These pins are available on the WT32-SC01 Plus' Debug Interface connector.

SPIRAM

SPIRAM should be supported but may require using a BOARD_VARIANT like this:

make BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_SX

I have yet to test this. I will later tonight.

russhughes commented 9 months ago

This worked for my WT32-SC01 Plus.

make BOARD=ESP32_GENERIC_S3 PORT=/dev/ttyACM0 USER_C_MODULES=../../../../s3lcd/src/micropython.cmake
MicroPython v1.20.0-457-gdc99840b3 on 2023-09-13; Generic ESP32S3 module with ESP32S3
Type "help()" for more information.
>>> import gc
>>> a = bytearray(1024 * 1024)
>>> b = bytearray(1024 * 512) 
>>> gc.mem_free()
468592
c-logic commented 9 months ago

IDF_PATH=/home/dennis/esp-idf5.0.2 ESP_IDF_VERSION=5.0

make BOARD=ESP32_GENERIC_S3 USER_C_MODULES=~/s3lcd/src/micropython.cmake

MicroPython v1.20.0-396-g1dedb65e6-dirty on 2023-09-14; Generic ESP32S3 module with ESP32S3

Type "help()" for more information.

import gc a = bytearray(1024 * 1024) Traceback (most recent call last): File "", line 1, in MemoryError: memory allocation failed, allocating 1048576 bytes

Wind-stormger commented 8 months ago

Hope to support micropython 1.21.