Page 1 of 1

ST7789 IPS 240x240 SPI display

Posted: Mon Feb 18, 2019 8:50 pm
by devbis
Recently I received a tiny IPS display from AliExpress based on st7789 chip 240x240 pixels on SPI bus.
I had some problems to connect it to my esp8266, so I had to write a library to run this screen

It is greatly inspired by Arduino-ST7789-Library for Arduino and AdaFriut libraries. The performance of the library is quite low but it allows to draw some primitives on the screen. To increase the performance, it should be rewritten in pure C.

Re: ST7789 IPS 240x240 SPI display

Posted: Sat Mar 02, 2019 1:32 pm
by gmli
I try to use your lib to drive a ST7789 with a esp32, but it doesn't work.

I have used the exact same code (except I changed the .on() and .off() for .value(1) and .value(0)). No error but the screen stay black (with the backlight on).

Have you ever tried it with an esp32 ?

Edit: I tried with a freshly flashed esp8266 with uPy 1.10, and the code you provided on the repo untouched : same result. Could you provide me with the wiring you used ?

My module :

Edit 2 : I've… just… plugged my wire in the wrong hole of the breadboard for the +3v. New breadboard kind, not used to…

So, it's works on the esp8266, nice. Thanks for your work ! Now I try on the esp32.

Re: ST7789 IPS 240x240 SPI display

Posted: Sat Mar 02, 2019 7:54 pm
by gmli
This is quite weird to me.

Hardware SPI doesn't work, but software does (on the same Pins). Bus 1 or bus 2.
Said with code (miso isn't wired):

spi = machine.SPI(baudrate=40000000, polarity=1, phase=0, sck=Pin(14), mosi=Pin(13), miso=Pin(12)) # works
spi = machine.SPI(1, baudrate=40000000, polarity=1, phase=0, sck=Pin(14), mosi=Pin(13)) # doesn't work

Any idea ?

Re: ST7789 IPS 240x240 SPI display

Posted: Sun Mar 03, 2019 11:12 am
by nickzoic
Software SPI is limited to MICROPY_HW_SOFTSPI_MAX_BAUDRATE which in this case is 800kHz.
So your hardware SPI is trying to run way quicker! I'd try slowing it down to 800kHz as well and see if it starts working.

Re: ST7789 IPS 240x240 SPI display

Posted: Mon Mar 04, 2019 3:17 am
by OutoftheBOTS_
I do have 1 of these little screens as they are quite cheap yet very high performance. It is just sitting on my desk as I have been super busy with other projects atm. I was going to use it like I have all my other screen by using Lobo port for ESP32 but with just a custom init(). Lobo port has a very high performance display module that allows custom setup for any screens not all ready supported in the module.

Re: ST7789 IPS 240x240 SPI display

Posted: Mon Mar 25, 2019 6:59 pm
by gmli
If I initialize the SPI object like this :

Code: Select all

spi = machine.SPI(1, baudrate=60000000, polarity=1, phase=1, sck=Pin(14), mosi=Pin(13), miso=Pin(12))
It works at planned. Setting phase=1 seems to do the trick. But it's quite strange that with software spi and phase=0 it works also.

Re: ST7789 IPS 240x240 SPI display

Posted: Sun Apr 21, 2019 9:16 pm
by devbis
I re-wrote a driver for this screen in pure-C, and the performance of the screen increased significantly.

See viewtopic.php?f=14&t=6318 for details.

But you have to compile firmware by your own for it.
Also, I've changed the signature of methods for the current driver to fit new convention (as in framebuf.FrameBuffer class)

Re: ST7789 IPS 240x240 SPI display

Posted: Sat Jun 22, 2019 8:29 pm
by Pasindu1
I am new to esp32 programming. i have ST7789 IPS and i don't know how to program it using esp32. can you provide me the wiring diagram to esp32 and the code the to test the display
Thank you :)