Lolin D32 Pro with an ST7735S 1.4 128x128 SPI TFT display

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
ldaponte
Posts: 4
Joined: Sun Dec 16, 2018 10:06 pm

Lolin D32 Pro with an ST7735S 1.4 128x128 SPI TFT display

Post by ldaponte » Sun Dec 16, 2018 10:16 pm

I've been unable to get the ST7735S TFT display to work with the D32 Pro board. I've found a few ST7735 python drivers but none of them seem to work. Last driver I've tried is https://bitbucket.org/thesheep/micropyt ... /st7735.py.

from machine import Pin, SPI
import st7735
display = st7735.ST7735(128, 128, SPI(2, baudrate=20000000, sck=Pin(18), mosi=Pin(23), miso=Pin(19)), rs=Pin(27), cs=Pin(14), rst=Pin(33))
display.fill(0x7521)
display.pixel(64, 64, 0)

Display remains white. I'm using a WEMOS TFT cable between the D32 and the TFT.

The driver chip in the TFT is the ST7735S. I've found ST7735 and ST7735R drivers but neither work. Have not tried getting this to work with Arduino yet, would rather use MicroPython.

I've tried slower and faster baud rates.

Thanks

Larry

echoshack
Posts: 2
Joined: Mon Dec 31, 2018 6:30 am

Re: Lolin D32 Pro with an ST7735S 1.4 128x128 SPI TFT display

Post by echoshack » Mon Dec 31, 2018 7:02 am

I have modified the Adafruit Arduino code, tried to direct msg you but did not get a link. It works well may be easiest to test to make sure your devices & wiring are OK. Can send to you if we can connect.

Regards Tony

fdufnews
Posts: 29
Joined: Mon Jul 25, 2016 11:31 am

Re: Lolin D32 Pro with an ST7735S 1.4 128x128 SPI TFT display

Post by fdufnews » Mon Dec 31, 2018 9:15 am

ldaponte wrote:
Sun Dec 16, 2018 10:16 pm
baudrate=20000000,
I've tried slower and faster baud rates.
You surely shall slower the baudrate. ST7735 datasheet gives a serial clock not shorter than 66ns (that's 15MHz).
While testing (maybe on breadboard) you'd better slow down to 4MHz just to be sure.

OutoftheBOTS_
Posts: 641
Joined: Mon Nov 20, 2017 10:18 am

Re: Lolin D32 Pro with an ST7735S 1.4 128x128 SPI TFT display

Post by OutoftheBOTS_ » Mon Dec 31, 2018 12:05 pm

I use a ST7735 160x128 spi screen on Lobo port with his display module. see https://github.com/loboris/MicroPython_ ... ki/display

Although his display module does have a st7735 driver it didn't work with my screen so I uses dis custom setup and it work great

here's my custom setup code but you might have to make so small mods for your screen.

Code: Select all

from ustruct import pack
import time, display

#constants used for accessing registers on screen
_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
_PASET = const(0x2B) # Page Address Set

def tft_setup(disp):
 disp.tft_writecmd(_SWRESET)  #Software Rest
 time.sleep(0.2)
 disp.tft_writecmd(_SLPOUT)  #sleep out
 time.sleep(0.2)
 disp.tft_writecmddata(_COLMOD, bytearray([0x05])) #set 16 bit color
 disp.tft_writecmd(_DISPON)  #Display on
 disp.tft_writecmddata(_MADCTL, bytearray([0b10110000])) #this is orienation for my screen
 disp.tft_writecmddata(_CASET, pack(">HH", 0, 159)) #set width from 0 to 159
 disp.tft_writecmddata(_PASET, pack(">HH", 0, 127)) #set height from  0 to 127
 
#setup screen
tft = display.TFT()
tft.init(tft.GENERIC, width=160, height=128, miso=19, mosi=21, clk=18, cs=5, dc=22, color_bits=16)
tft_setup(tft)
#adjust value of duty to change backlight
backlight = PWM(23, freq=200, duty=25) 

Post Reply