Page 1 of 2

module for 1.44 inch TFT LCD with SDI, RS pins?

Posted: Sat Mar 06, 2021 4:28 pm
by oyster
I have gotten a 1.44 inch TFT LCD of 128*128 pixels, which is actually from another product, so there is no specification for it.

This LCD has 11 pins, whose names are listed on the PCB. I try to search and find that they are maybe
1. VCC,
2. GND, 3. GND,
4. NC, 5. NC,
6. LED ( for background light),
7. CLK( clock of SPI),
8. SDI( data of SPI),
9. RS( 0 means command, 1 means selection),
10. RST(reset)
11. CS( chip-selection)

I think it is real SPI, so I do some search
1. https://github.com/boochow/MicroPython-ST7735, there are SDA SCK. So I think it is not the corrected one

2. I tested https://github.com/cheungbx/st7735-esp8266-micropython. However, I don't know how to handle both MOSI and MISO, so there is no output on my LCD

so, what is actually the module can drive my 1.44 inch TFT LCD with SDI, RS pins?

Thanks

Re: module for 1.44 inch TFT LCD with SDI, RS pins?

Posted: Sat Mar 06, 2021 7:54 pm
by doublevee
Hi.

I’m not sure what the module controller is you’re using or the operating voltage but you will need the following pins:

SPI clock - pin 7
SPI data (MOSI) - pin 8
Data/command (RS) - pin 9
Module reset - pin 10
Chip select - pin 11

SPI clock and data will be handled by your SPI object (either hardware or software).

RS, Reset and Chip Select will be GPIO output pins that you are free to choose.

Hope this helps

Re: module for 1.44 inch TFT LCD with SDI, RS pins?

Posted: Sun Mar 07, 2021 1:14 am
by oyster
I have burned the latest firmware from https://micropython.org/download/esp32/

however, this code make upy reboot, any hints?

Code: Select all

spi = SPI(
    1,
    baudrate=100000,
    polarity=1,
    phase=1,
    sck=Pin(7, Pin.OUT),
    mosi=Pin(8, Pin.OUT))


this is the message after I run the above code

ets Jun 8 2016 00:22:57

rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4
load:0x3fff0034,len:5636
load:0x40078000,len:12696
load:0x40080400,len:4292
entry 0x400806b0
W (58) boot.esp32: PRO CPU has been reset by WDT.
W (58) boot.esp32: WDT reset info: PRO CPU PC=0x400613b1
W (60) boot.esp32: WDT reset info: APP CPU PC=0x401c19be (waiti mode)
MicroPython v1.14 on 2021-03-06; ESP32 module with ESP32
Type "help()" for more information.

Re: module for 1.44 inch TFT LCD with SDI, RS pins?

Posted: Sun Mar 07, 2021 9:31 am
by doublevee
You haven’t posted all your SPI setup code but I think you’re trying to use hardware SPI but specifying invalid pins.

If you’re using hardware SPI you need to adhere to the hardware specs of the ESP32 regarding selection of pins for clock and data.

Or you can use software SPI which allows you specify any valid GPIO pins for clock and data.

Please see this link:

http://docs.micropython.org/en/latest/e ... ckref.html

Re: module for 1.44 inch TFT LCD with SDI, RS pins?

Posted: Sun Mar 07, 2021 2:45 pm
by oyster
so bad there is no success yet :evil:

this time I use https://github.com/adafruit/micropython ... gb-display which seems like what I said before

1. first of all, the 1.4" 128*128 LCD can display logo image on it own's gadget. In other word, the LCD screen is ok. And at the same time I measure that the VCC is 3.3V, CS is 3.3V

2. Then I connect the LCD with my ESP32 as following

Code: Select all

1. VCC,                                                           -> 3.3V
2. GND, 3. GND,                                              -> GND
4. NC, 5. NC,                                                   -> No connection 
6. LED ( for background light),                          -> No connection
7. CLK( clock of SPI),                                       -> GPIO 0
8. SDI( data of SPI),                                        -> GPIO 2
9. RS( 0 means command, 1 means selection),   -> GPIO 21
10. RST(reset)                                                 -> No connection 
11. CS( chip-selection)                                       -> No connection 
why I choose GIPO0, 2? Because official Software SPI Bus use them as an example.

3. Then the code part

Code: Select all

from st7735 import ST7735
from machine import SPI, Pin, SoftSPI
import time
import math

spi = SoftSPI(
    baudrate=100000,
    polarity=1,
    phase=0,
    sck=Pin(0),
    mosi=Pin(2),
    miso=Pin(4)           # in fact, GPIO is not connected to any pin of LCD
)

dc = Pin(21, Pin.OUT)
cs = Pin(17, Pin.OUT)   
display = ST7735(spi, dc, cs)

display.fill()

for i in range(128):
    display.pixel(i, i, 100)
    
display.hline(1, 1, 100, 0xff)
shows nothing

Re: module for 1.44 inch TFT LCD with SDI, RS pins?

Posted: Sun Mar 07, 2021 7:23 pm
by doublevee
Your code looks ok but I will check the library for that lcd controller

Re: module for 1.44 inch TFT LCD with SDI, RS pins?

Posted: Sun Mar 07, 2021 7:29 pm
by doublevee
Looking at the link you sent, you don’t appear to have initialised the screen object correctly:

class st7735.ST7735(spi, dc, cs, rst=None, width=128, height=128)

Unless you have modified the library.

Re: module for 1.44 inch TFT LCD with SDI, RS pins?

Posted: Mon Mar 08, 2021 2:10 am
by oyster
I did not modify the lib
I am confused. My LCD is 128*128, and I did not connect the optional RESET pin of LCD, so what should be the proper initialization?

Re: module for 1.44 inch TFT LCD with SDI, RS pins?

Posted: Mon Mar 08, 2021 11:16 pm
by doublevee
I’m not sure about the reset line - the code would seem to indicate it’s not needed. Maybe the screen module has its own reset circuitry.

You need to use the ST7735 library exactly as shown - you have not passed the width and height values to the class instance. This is what is used to create the framebuffer for sending data to the screen.

Re: module for 1.44 inch TFT LCD with SDI, RS pins?

Posted: Tue Mar 09, 2021 2:39 pm
by oyster
finally, the driver ST7735R in st7735.py makes my LCD work

During my search, I have met ST7735, ST7735S and ST7735R, which should be similar to each other.

One more question, is there ST7735R module for micropython which supplies more functions like adafruit-circuitpython-st7735r does? I am using ESP32 for which I can't find the proper circuitpython firmware