russhughes / st7789_mpy

Fast MicroPython driver for ST7789 display module written in C
Other
533 stars 108 forks source link

T-Display RP2040 display not working #60

Closed erongd closed 2 years ago

erongd commented 2 years ago

I got my hands on the lilygo t-display rp2040 board. The firmware I built that works on pico does not work on t-display, after display initialization the backlight turned on. Appreciate any points on troubleshooting the issue.

russhughes commented 2 years ago

I have not had any luck getting the RP2040 T-Display to work with anything other than the python based driver.

russhughes commented 2 years ago

This should initialize the display:

from machine import Pin, SPI
import st7789

Pin(22, Pin.OUT, value=1)

spi = SPI(
    0,
    baudrate=40000000,
    polarity=1,
    phase=0,
    sck=Pin(2, Pin.OUT),
    mosi=Pin(3, Pin.OUT),
    miso=None)

tft = st7789.ST7789(
      spi,
      135,
      240,
      cs=Pin(5, Pin.OUT),
      dc=Pin(1, Pin.OUT),
      backlight=Pin(4, Pin.OUT))

tft.init()
erongd commented 2 years ago

I will pull the latest code and try it out. Thanks for the quick update.

erongd commented 2 years ago

I can confirm it work. It is surprise the only thing changed is remove the reset pin. :)

russhughes commented 2 years ago

You can use baudrate=62500000 to give it a little more speed. Not sure why using Pin 0 for reset causes issues.