Can no longer drive ST7789V SPI TFT w/ firmware 3.8.0 (works for <= 3.6.7)

Update: I was able to get the ST7789 running with the new LCD driver. Most of the effort went into debugging the final stage of the initialization sequence. Turns out a chunk of the code I was using previously (pure python driver) was conflicting with the X & Y Window configuration. I’ve posted the working example below. The batch of SPI writes and DC/CS toggles is a bit ugly, but it works. Now I will work to integrate this into my “real” application, which should be rather simple. Again @OpenMV I really appreciated the LCD driver setup guidance.

BTW, these IPS TFT’s are great displays, definitely worth trying out!

#Demo for 2.0" 240x320 ST7789 IPS TFT & OpenMV LCD Driver
#Author: Cameron R. MANN (12/2020)
#Portions of TFT Command Sequence credited to Shane Gingell (Out of the BOTS)
#MIT License (MIT)

#Note: TFT is setup for "landscape" mode in this example (320x240)

import sensor, image, time, lcd
from pyb import SPI, Pin
from micropython import const
from ustruct import pack

_SWRESET = const(0x01) # Software Reset
_SLPOUT = const(0x11) # Sleep Out
_COLMOD = const(0x3A) # Colour Mode
_DISPON = const(0x29) # Display On
_MADCTL = const(0x36) # Memory Data Access
_CASET = const(0x2A) # Column Address Set
_RASET = const(0x2B) # Row Address set
_RAMWR = const(0x2C) # Write to screen memory
_INVON = const(0x21) # Inversion On

cs = Pin('P3', Pin.OUT)
dc = Pin('P8', Pin.OUT)

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames()

clock = time.clock()

#create spi object first
spi = SPI(2, SPI.MASTER, baudrate=54000000) #Create SPI bus


#init screen using lcd.init
lcd.init(type=lcd.LCD_SHIELD, width=320, height=240,
framesize=lcd.QVGA,refresh=60, triple_buffer=False, bgr=False)


#custom LCD setup FOR ST7789
#Note DC is pin 8, CS is pin 3

dc.value(False) #set data/command pin
cs.value(0)
spi.send(bytearray([_SWRESET]))#software reset
cs.value(1)

time.sleep_ms(200)

dc.value(False) #set data/command pin
cs.value(0)
spi.send(bytearray([_SLPOUT]))#sleep out
cs.value(1)

time.sleep_ms(200)

dc.value(False) #set data/command pin
cs.value(0)
spi.send(bytearray([_COLMOD]))#set 16 bit color
cs.value(1)

dc.value(True) #set data/command pin
cs.value(0)
spi.send(bytearray([0x55]))#spi send
cs.value(1)

dc.value(False) #set data/command pin
cs.value(0)
spi.send(bytearray([_DISPON]))#display on
cs.value(1)

dc.value(False) #set data/command pin
cs.value(0)
spi.send(bytearray([_MADCTL]))#set mode for writing to screen
cs.value(1)

dc.value(True) #set data/command pin
cs.value(0)
spi.send(bytearray([0b10110000]))#this was the mode that I used for ST7789
cs.value(1)

dc.value(False) #set data/command pin
cs.value(0)
spi.send(bytearray([_CASET]))#set x writng window
cs.value(1)

dc.value(True) #set data/command pin
cs.value(0)
spi.send(pack(">HH", 0, 320))#spi send
cs.value(1)

dc.value(False) #set data/command pin
cs.value(0)
spi.send(bytearray([_RASET]))#set y writing window
cs.value(1)

dc.value(True) #set data/command pin
cs.value(0)
spi.send(pack(">HH", 0, 240))#spi send
cs.value(1)

dc.value(False) #set data/command pin
cs.value(0)
spi.send(bytearray([_INVON]))#inversion on
cs.value(1)

while(True):
    clock.tick()

    #show camera image on LCD
    lcd.display(sensor.snapshot())