nspsck / RM67162_Micropython_QSPI

This is a C driver as a user module for the T-AMOLED-S3 using QSPI-protocol.
MIT License
7 stars 4 forks source link

No display... ? #2

Closed dobodu closed 6 months ago

dobodu commented 7 months ago

Hi,

I've been trying your library on an LilyGo-S3-Amoled-Touch display that seems to share the same hardware with the non touch version.

I trier the firmware you provide, but also a firmware (1.23...) compiled by myself.

But whatever I do, I don't have any display so I tried, without success, to modify the tft_config.py

From LILYGO WEBSITE

TFT_SD0 = Pin(08,Pin.OUT) #SERIAL OUTPUT SIGNAL TFT_TE = Pin(09,Pin.OUT) #TEARING EFFET TFT_CS = Pin(06,Pin.OUT) TFT_SCK = Pin(47,Pin.OUT) TFT_RST = Pin(17,Pin.OUT) #RESET PIN TFT_D0 = Pin(18,Pin.OUT) TFT_D1 = Pin(07,Pin.OUT) TFT_D2 = Pin(48,Pin.OUT) TFT_D3 = Pin(05,Pin.OUT)

def config(): hspi = SPI(2, sck=TFT_SCK, mosi=None, miso=None, polarity=0, phase=0) panel = rm67162.QSPIPanel( spi=hspi, data=(TFT_D0, TFT_D1, TFT_D2, TFT_D3), dc=TFT_D1, cs=TFT_CS, pclk=80 1000 1000, width=240, height=536 ) return rm67162.RM67162(panel, reset=TFT_RST, bpp=16)

I wonder if the dc=TFT_DA (pin 07 in your library) is something normal as it also in the data parameters.

However, the unmodified library doesn' do better.

nspsck commented 7 months ago

Hi,

The prebuilt firmware should work. I just have tested it again.

Please try some examples in the example folder to see if they work. With the limited information you have provided, which all LGTM, I can only assume that you have not initialized the display correctly.

The whole initialization process should look something like this:

tft = tft_config.config() # must have
tft.reset() # must have
tft.init() # must have
tft.rotation(0) # optional

Also, there is a preconfigured tft_config.py in the example folder here.

dobodu commented 6 months ago

Hi, Thank you for the answer.

I've tried again, comming back to the factory firmware for Lilygo T3 amoled touch display (H705 version on the Lilygo website) in order to check that the hardware is working fine. Everything is working !

Then I burned your firmware and uploaded your repository file. Result is nothing on the screen. I tried also the 1.23 firmware I've compiled (with the display driver you're providing) withouth suceds too..

I've added some print commands with in your code to check that the loop routine is working. The code is working but the display remains Black.

Thus I wonder if the version I bought (5cm long) might be slighly different from the old one (6cm long). Lilygo website doesn' t provide many informations... Especilly ont the small setup resitors for this version. On the normal version (larger cms resistor) it is explained that the defaut resistors setup is QSPI (and not SPI) On the touch amoled version, setup resistors implantation is different but i'm not sure if it's a QSPI setup (it should).

So i think this issue is not related to software, but more to hardware variations.

Let me know if you have other ideas...

nspsck commented 6 months ago

If yours happen to be this one:

https://www.lilygo.cc/products/t-display-amoled-lite

You need to redefine the Pins according to the pin diagram.

dobodu commented 6 months ago

Well, I gave a try but not working...

Mine is https://www.lilygo.cc/products/t-display-s3-amoled?variant=43271614267573

Touch version seems to share same pin diagrams than the non touch version.

nspsck commented 6 months ago

Can you please post your code? Including tft_config.py and main.py.

dobodu commented 6 months ago

Of course 👍

tft_config.py

import rm67162 from machine import Pin, SPI

From LILYGO WEBSITE

TFT_SD0 = Pin(08,Pin.OUT) #GPIO08 SERIAL OUTPUT SIGNAL TFT_TE = Pin(09,Pin.OUT) #GPIO09 TEARING EFFET CONTROL TFT_CS = Pin(06,Pin.OUT) #GPIO06 TFT_SCK = Pin(47,Pin.OUT) #GPIO47 = SPICLK_P TFT_RST = Pin(17,Pin.OUT) #GPIO17 RESET TFT_D0 = Pin(18,Pin.OUT) #GPIO18 TFT_D1 = Pin(07,Pin.OUT) #GPIO07 TFT_D2 = Pin(48,Pin.OUT) #GPIO48 = SPICLK_N TFT_D3 = Pin(05,Pin.OUT) #GPIO05

def config(): hspi = SPI(2, sck=TFT_SCK, mosi=None, miso=None, polarity=0, phase=0) panel = rm67162.QSPIPanel( spi=hspi, data=(TFT_D0, TFT_D1, TFT_D2, TFT_D3), dc=TFT_D1, cs=TFT_CS, pclk=80 1000 1000, width=240, height=536 ) return rm67162.RM67162(panel, reset=TFT_RST, bpp=16)

def color565(r, g, b): c = ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3) return (c >> 8) | (c << 8)

color_loop.py

import tft_config

def hsv2rgb(hue, sat, val): '''The conversion algorithm comes from https://blog.csdn.net/lly_3485390095/article/details/104570885''' C = 0.0 X = 0.0 Y = 0.0 Z = 0.0 i = 0 H = float(hue) S = sat / 100.0 V = val / 100.0 if int(S) == 0: return int(V255), int(V255), int(V*255) else: H = H / 60 i = int(H) C = H - i

    X = V * (1 - S)
    Y = V * (1 - S * C)
    Z = V * (1 -S * (1 - C))
    if i == 0:
        return int(V * 255), int(Z * 255), int(X * 255)
    elif i == 1:
        return int(Y * 255), int(V * 255), int(X * 255)
    elif i == 2:
        return int(X * 255), int(V * 255), int(Z * 255)
    elif i == 3:
        return int(X * 255), int(Y * 255), int(V * 255)
    elif i == 4:
        return int(Z * 255), int(X * 255), int(V * 255)
    elif i == 5:
        return int(V * 255), int(X * 255), int(Y * 255)

def hsv_wheel(): while True: for i in range(0, 360): yield hsv2rgb(i, 255, 100)

""" The delay is required to achieve the animation effect, since the new driver is way too fast at drawing.

"""

def main(): print("hello") tft = tft_config.config() tft.reset() tft.init() tft.rotation(0) x = tft.width() y = tft.height() speed = 5 color = hsv_wheel() while True: r, g, b = next(color) c = tft.colorRGB(r, g, b) print("color",c) for j in range(0, y, speed): tft.fill_rect(0, j, x, j + speed, c) if y % speed != 0: tft.fill_rect( 0, y - y % speed, x, y, c )

main()

Output Gives

MPY: soft reboot hello color 44795 color 3836 color 20220 color 44796

This is driving me crazy...

nspsck commented 6 months ago

IMG_20240429_232855.jpg

Well, this is super weird... I tired... It works... Using the firmware in this repo... Sorry, but this is beyond my imagination how this could ever happen...

nspsck commented 6 months ago

Also tried the 1.23 version, worked as well. Besides that already mentioned the re-run issue.

dobodu commented 6 months ago

Well, Thank you for advicing me, I tired too,

I believe it's not related to the firmware (both give the same results to me).

I gave a look to Xinyuan-Lilygo github repo. He made slight evolution to the initialisation sequence and I was looking on your code here to check if I can adjust in order to make it work.

Init sequence on Xinyuang seems to be Sleep Out Adjust OVSS voltage (what for ?) Mad Ctrl Set Pixel format Brightness

But C is not my favorite langage ;-)

dobodu commented 6 months ago

20240429_235141.JPG

nspsck commented 6 months ago

Ye, indeed that's what I am also looking at, that is probably your last bet.

You can hardcode that sequence in here.

The only effective change to me was the brightness part... Maybe try to set tft.brightness(50) and see if you have any luck.

Init sequence on Xinyuang seems to be Sleep Out Adjust OVSS voltage (what for ?) Mad Ctrl Set Pixel format Brightness

These do not ring any bells to me, seems to be pretty much the default set-up by the rm67162.

Adjust OVSS voltage

Maybe they used another power supply, hence the voltage needs to be adjusted... maybe, but why would they... [Edit]: That would render the older one useless, since they do not provide separate firmware for both.

lewisxhe commented 6 months ago

IO38 must be set to HIGH before initializing the screen https://github.com/Xinyuan-LilyGO/LilyGo-AMOLED-Series/issues/9

nspsck commented 6 months ago

Oh, thanks!

dobodu commented 6 months ago

Thank you !

I'll try this evening as it can be done straight from Micropython without library mods.

dobodu commented 6 months ago

Confirmed I got it working adding in your code headers

from machine import Pin TFTCDE = Pin(38,Pin.OUT) #GPIO38

and in the main loop

TFTCDE.value(1) tft.reset() etc.

Nice collective job, however, i consider this should be explained in the Lilygo wiki/repo. The schematic does not explain the slightest thing about this GPIO38, assuming it's an ESP32S3 fonctionnality (datasheet talks about FSPIWP I believe).