russhughes / s3lcd

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

Issue with firmware #6

Closed CyberSpiderPrime closed 1 year ago

CyberSpiderPrime commented 1 year ago

Hello.

First, a thank you; I have previously used your driver/firmware with a Lilygo ESP32 T-Display. It works wonderfully.

I have recently purchased some Lilygo ESP32S3 T-HMI units (240x320, Flash and PSRAM is 16MB per demo) and wanted to use your driver/firmware again. I have downloaded the firmware and tried Thonny, esptool, and the Flash Download tool to flash the firmware to said device - all failed (device keeps repeatedly connecting/disconnecting). Please note that I have downloaded and flashed the generic ESP32S3 version of Micropython 1.20.0 multiple times with no failure.

I was wondering if you have py/mpy driver(s) and config.py files that can be dropped onto the device and used with the generic ESP32S3 Micropython instead of a full firmware flash?

Also, how would one go about creating new fonts like the old 5x7 monospace/fixedsys font (I know that is telling my age) for use by the driver?

Thank you for any assistance you may render.

Wind-stormger commented 1 year ago

It seems that the FLASH or PSRAM size configuration does not match.

russhughes commented 1 year ago

Are you using the firmware from the S3LCD_OCT_16M folder?

CyberSpiderPrime commented 1 year ago

Yes, I did try the S3LCD_OCT_16M version since it is the only version listed for the T-HMI.

According to AliExpress description, the listed memories are PSRAM 8MB, and FLASH 16MB. The demo program that was running on it reports 16 each (PSRAM upgraded before shipping, inaccurate listing, or programming? Unknown).

Only the Flash tool reported success, the other methods reported errors - Thonny said header error, and I don't have the esptool logs. On reset after Flash tool, the device started it's (dis)connect looping which continued until I put it back into boot mode or removed it from the computer.

After several attempts, I finally gave up and searched for the Espressif generic Micropython, which flashed the first time. Since I finally had a success, I retried yours but still no luck.

Device currently has the generic version flashed. If the driver itself was available, I would just drop it and a few fonts onto the device and go from there.

I am not very familiar with C and variants nor have any environments (except Arduino, and I don't like it) to try compiling it myself. I'm an old BASIC programmer (mainly self taught - GWBASIC, QBASIC, BetterBASIC, QB64, and others) and am learning (micro)Python through these microcontrollers. I also create personal (offline) webpages incorporating vanilla JavaScript (and used to use VBScript) to store/organise/display information.

On my T-display, which is running your older version, I am running a modified version of codemee's ESPWebserver (set up in SoftAP/private network mode, displayed running information using your driver) - not pretty but it works. I did try the Lobo firmware but like yours better; which is why I would really like your driver on the T-HMI. My plans for the T-HMI may be bigger than my current ability but that's what trial and error (and plenty of backups) is for.

On Thu, May 25, 2023, 2:59 AM Russ Hughes @.***> wrote:

Are you using the firmware from the S3LCD_OCT_16M folder?

— Reply to this email directly, view it on GitHub https://github.com/russhughes/s3lcd/issues/6#issuecomment-1562380901, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD5SF5EXESTI6IT4YP37SWTXH37O5ANCNFSM6AAAAAAYND6ZSM . You are receiving this because you authored the thread.Message ID: @.***>

russhughes commented 1 year ago

The driver is written in C and compiled into the firmware while building the MicroPython firmware. The source for the driver is in the repo.

The Python driver from https://github.com/russhughes/st7789s3_mpy should be able to drive the T-HMI display, but you will have to modify the tft_config.py code for the pins used on the T-HMI. Also, it will be much slower.

Your device may have a different memory configuration (Quad SPI needing S3LCD_QUAD_16M firmware?). Can you post a link to the generic version of firmware that is working?

CyberSpiderPrime commented 1 year ago

https://micropython.org/download/GENERIC_S3/

Links at bottom of page v1.20.0 (2023-04-26) bin file

Speed, right now, is not much of an issue. I am just wanting to get things started.

Opened your link for st7789s3_mpy. I see the st7789.pyi and the two tft files in the examples folder (probably won't need the button file ... yet). I think I am reasonable sure I can modify the tft_config.py, the data is pretty clear on the T-HMI product/pin assignment image for the dev board. I looked up pyi files, and read that that file is basically an info or reference file (no functional code, which explains all the "...")

Looking in all folders, I can't find the st7789s3.mpy file anywhere. bigbuckbunny-320x240.jpg bird seems familiar, and vga1_8x8 appears to be the font I will be using once this is up and running (should give me a nice 40x30 text layout).

On Thu, May 25, 2023, 3:20 PM Russ Hughes @.***> wrote:

The driver is written in C and compiled into the firmware while building the MicroPython firmware. The source for the driver is in the repo.

The Python driver from https://github.com/russhughes/st7789s3_mpy should be able to drive the T-HMI display, but you will have to modify the tft_config.py code for the pins used on the T-HMI. Also, it will be much slower.

Your device may have a different memory configuration (Quad SPI needing S3LCD_QUAD_16M firmware?). Can you post a link to the generic version of firmware that is working?

— Reply to this email directly, view it on GitHub https://github.com/russhughes/s3lcd/issues/6#issuecomment-1563396532, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD5SF5B3ZOX3NANAXYVLXCTXH6WINANCNFSM6AAAAAAYND6ZSM . You are receiving this because you authored the thread. Message ID: @.***>

russhughes commented 1 year ago

Sorry that link should have been https://github.com/russhughes/t-display-s3.

CyberSpiderPrime commented 1 year ago

from that link, and subfolders, I downloaded: st7789s3.py, tft_config.py, hello.py, and vga1_8x8.py.

Using the image from https://github.com/Xinyuan-LilyGO/T-HMI image folder, I modified tft_config.sys. But 3 values were missing: the strobe signals (rd, wr) and the reset pins. Using the schematic, I found and traced the rd and wr lines to pins gpio7 and 8 respectively, but no link could be found for RESET (there is a reset for the display, but I couldn't find a GPIO for it). Note that GPIO8 is listed as the LCD_PCLK in the image.

GPIO5 is used in the original tft_config.py for RESET, but this is labelled for the Bat ADC I changed it to 9, which is the only pin I couldn't trace.

I modified hello.py, changing only the font.

Big Test: the running of hello.py: something is happening but no display activity or error returned..

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free.www.avg.com http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Fri, May 26, 2023 at 5:11 AM Russ Hughes @.***> wrote:

Sorry that link should have been https://github.com/russhughes/t-display-s3.

— Reply to this email directly, view it on GitHub https://github.com/russhughes/s3lcd/issues/6#issuecomment-1564072297, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD5SF5FHPN4OYDIHFICASS3XIBXUXANCNFSM6AAAAAAYND6ZSM . You are receiving this because you authored the thread.Message ID: @.***>

russhughes commented 1 year ago

Reset is tied to the processors reset line and not to an IO pin, so you can ignore it. LCD_PCLK is the WR pin(8). Pin 10 controls power to the LCD and must be set high to turn on the display. This needs to be done before you configure the display.

russhughes commented 1 year ago

Here is a pure python driver customized for the T-HMI display. It is faster than the other driver, but not as fast as the s3lcd C driver.

Edit: forgot the link to https://github.com/russhughes/thmi_py

CyberSpiderPrime commented 1 year ago

First up: happy to say I finally got the st7789s3.py driver to work.

Here is my tft_config.py changes:

def config(rotation=0): return st7789.ST7789( Pin(46, Pin.OUT), Pin(45, Pin.OUT), Pin(42, Pin.OUT), Pin(41, Pin.OUT), Pin(40, Pin.OUT), Pin(39, Pin.OUT), Pin(47, Pin.OUT), Pin(48, Pin.OUT), Pin(8, Pin.OUT), Pin(36, Pin.OUT), 320, 240, reset=Pin(37, Pin.OUT), cs=Pin(6, Pin.OUT), dc=Pin(7, Pin.OUT), backlight=Pin(38, Pin.OUT), rotation=rotation)

For the RD and RESET, I used unused GPIOs (36 and 37 in this case) since it refused to let me blank those out.

In hello.py I added: from machine import Pin tft_power = Pin(10, Pin.OUT) tft_power.value(1)

I also commented out the default font and uncommented vga1_8x8

No other changes were made to any of the other files used.

Now its hello!-ing all over the place.

Next up, I will also be testing out the new THMI pure python driver you wrote. I see the link is on the gethub response page.

I am really happy for the help you have given, its made my day (which has been pretty crappy so far - lots of rain, minor traffic accident, no one hurt, almost no damage to vehicles)

On Sat, May 27, 2023 at 4:56 PM Russ Hughes @.***> wrote:

Here is a pure python driver customized for the T-HMI display. It is faster than the other driver, but not as fast as the s3lcd C driver.

— Reply to this email directly, view it on GitHub https://github.com/russhughes/s3lcd/issues/6#issuecomment-1565678303, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD5SF5GNAHLSX5PACGTTL3TXIJS7VANCNFSM6AAAAAAYND6ZSM . You are receiving this because you authored the thread.Message ID: @.***>

CyberSpiderPrime commented 1 year ago

T-HMI driver worked perfectly. Only changes anywhere were to the used font in hello.py (changed to vga1_8x8).

On Sun, May 28, 2023, 1:58 AM James V. Fields @.***> wrote:

First up: happy to say I finally got the st7789s3.py driver to work.

Here is my tft_config.py changes:

def config(rotation=0): return st7789.ST7789( Pin(46, Pin.OUT), Pin(45, Pin.OUT), Pin(42, Pin.OUT), Pin(41, Pin.OUT), Pin(40, Pin.OUT), Pin(39, Pin.OUT), Pin(47, Pin.OUT), Pin(48, Pin.OUT), Pin(8, Pin.OUT), Pin(36, Pin.OUT), 320, 240, reset=Pin(37, Pin.OUT), cs=Pin(6, Pin.OUT), dc=Pin(7, Pin.OUT), backlight=Pin(38, Pin.OUT), rotation=rotation)

For the RD and RESET, I used unused GPIOs (36 and 37 in this case) since it refused to let me blank those out.

In hello.py I added: from machine import Pin tft_power = Pin(10, Pin.OUT) tft_power.value(1)

I also commented out the default font and uncommented vga1_8x8

No other changes were made to any of the other files used.

Now its hello!-ing all over the place.

Next up, I will also be testing out the new THMI pure python driver you wrote. I see the link is on the gethub response page.

I am really happy for the help you have given, its made my day (which has been pretty crappy so far - lots of rain, minor traffic accident, no one hurt, almost no damage to vehicles)

On Sat, May 27, 2023 at 4:56 PM Russ Hughes @.***> wrote:

Here is a pure python driver customized for the T-HMI display. It is faster than the other driver, but not as fast as the s3lcd C driver.

— Reply to this email directly, view it on GitHub https://github.com/russhughes/s3lcd/issues/6#issuecomment-1565678303, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD5SF5GNAHLSX5PACGTTL3TXIJS7VANCNFSM6AAAAAAYND6ZSM . You are receiving this because you authored the thread.Message ID: @.***>