Unable to use SPI display. Help please.

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
User avatar
marfis
Posts: 136
Joined: Fri Oct 31, 2014 10:29 am
Location: Zurich / Switzerland

Re: Unable to use SPI display. Help please.

Postby marfis » Thu Dec 29, 2016 7:36 pm

did you change your wiring of the control signal? What you write in the code does not match with your initial description.

Also you tied Reset to Vdd - shouldn't that be wired to the rst control pin of the nodemcu board? The meaning of A0 is not clear to me...

Other than that, the big advantage with micropython is the integrated interactive functionality of the repl... just add print statements in the code section that you are interested in. E.g. the init() function of the display. Check if there is something meaningful read from the registers.

thule
Posts: 10
Joined: Thu Dec 22, 2016 9:32 pm

Re: Unable to use SPI display. Help please.

Postby thule » Tue Jan 03, 2017 1:27 pm

Hi Marfis

I pulled out and will sit and retry all the cabling today again. I am following the naming convention below.

Pin Alternate Names Description
VCC Power supply
GND Ground
D0 SCL,CLK,SCK Clock
D1 SDA,MOSI Data
RES RST,RESET Rest
DC A0 Data/Command
CS Chip Select

Looks like I made a mess with the DC and the SCK!
I will retry today and post what happens.

Thanks

thule
Posts: 10
Joined: Thu Dec 22, 2016 9:32 pm

Re: Unable to use SPI display. Help please.

Postby thule » Tue Jan 03, 2017 2:29 pm

Here is some more trial on this display. [in fact two of the displays both claim st7735]. Sadly, no outcome, other than glowing white screen. When I try to loop and write pixels, I get a delay depending on how much data it seems to write. Still nothing shows up on screen when I do display.pixel > x,y, 0 or 1.

Any help appreciated.
Thanks



My current connections:
Display > MCU
SDA > D7 [GPIO 13]
CS > D2 [GPIO 4]
RST > D0 [GPIO 16]
A0[DC] > D1 [GPIO 5]
SCK > D5 [GPIO 14]
LED > 3V3
VCC > 3V3
GND > GND


#=======
from machine import Pin, SPI
import st7735
spi = SPI(mosi=Pin(13, Pin.OUT), sck=Pin(14, Pin.OUT))
display = st7735.ST7735(spi, cs=Pin(4), dc=Pin(5), rst=Pin(16))
display.fill(0x7521)
display.pixel(64, 64, 0)

for n in range(20):
for m in range(20):
display.pixel(n,m,1)


#=======
#just for trying, tried the ili9341 too.

import ili9341
from machine import Pin, SPI
spi = SPI(mosi=Pin(13, Pin.OUT), sck=Pin(14, Pin.OUT))
display = ili9341.ILI9341(spi, cs=Pin(4), dc=Pin(5), rst=Pin(16))
display.fill(ili9341.color565(0xff, 0x11, 0x22))
display.pixel(120, 160, 0)

#=======

User avatar
deshipu
Posts: 1034
Joined: Thu May 28, 2015 5:54 pm

Re: Unable to use SPI display. Help please.

Postby deshipu » Thu Jan 05, 2017 1:59 pm

I just found a similar screen in my drawer, and tested it with the Adafruit library. Here is the photo of connections:

IMG_20170105_145233.jpg
IMG_20170105_145233.jpg (67.73 KiB) Viewed 538 times


And here are the connections for the D1 Mini:

VCC → 5V
GND → GND
CS → GPIO15
RESET → GPIO4
A0 → GPIO5
SDA → GPIO13
SCK → GPIO14
LED → 3V3

Here's the code I used to test:

Code: Select all

>>> from machine import SPI, Pin
>>> spi = SPI(1)
>>> import st7735
>>> d = st7735.ST7735(spi, dc=Pin(5), cs=Pin(15), rst=Pin(4))
>>> d.fill(0x7521)


And here's the display displaying garbage right after the initialization:
IMG_20170105_145244.jpg
IMG_20170105_145244.jpg (79.96 KiB) Viewed 538 times

thule
Posts: 10
Joined: Thu Dec 22, 2016 9:32 pm

Re: Unable to use SPI display. Help please.

Postby thule » Thu Jan 05, 2017 8:20 pm

Hi Deshipu

Does that mean I am out of luck with this particular display? Sorry to bug you but any suggestions on a working SPI display - links will be greatly appreciated. If you know of a SPI display that works, I can order that from ebay.

My knowledge of electronics does not extend to the level of writing drivers for displays. So I am quite dependent on what is out there that already works.

Thanks for your help.

EDIT:
May be I misunderstood. Does your post suggest that the display is working with the connections and settings? It does look quite similar to how my display looks when I run it. However none of the display.pixel show any change in the screen. I am confused I guess :oops:

User avatar
deshipu
Posts: 1034
Joined: Thu May 28, 2015 5:54 pm

Re: Unable to use SPI display. Help please.

Postby deshipu » Thu Jan 05, 2017 10:24 pm

To be honest I just wanted to make sure that the drivers are not faulty. The display I used looks a lot like yours, so you might want to try the same connections and the same code. I didn't try your code yet, I will in a moment, maybe we can pin-point the problem then.

User avatar
deshipu
Posts: 1034
Joined: Thu May 28, 2015 5:54 pm

Re: Unable to use SPI display. Help please.

Postby deshipu » Thu Jan 05, 2017 10:31 pm

I just tried your code and your connections, and it worked too. Perhaps your display is not an ST7735 after all, or it is faulty?

Did you get it to work with any other board, like, say, Arduino?

Ketsa
Posts: 6
Joined: Sun Jan 15, 2017 2:50 pm

Re: Unable to use SPI display. Help please.

Postby Ketsa » Sun Jan 15, 2017 2:58 pm

[quote="deshipu"]
Did you get it to work with any other board, like, say, Arduino?[/quote]


I have the same problem as OP I think.
Nothing except a blank (white) screen.
Checked connections to be exactly as your recent post, used your code to test.
No errors, but the screen stays blank... tested with another screen : same problem.

Then I tested my screens on a Pro-Mini : no problems, works first try. :-(

ESP8266 : http://i.imgur.com/f4kB1sk.jpg
Pro Mini : http://i.imgur.com/54hGZzx.jpg

I'm probably doing something wrong...

User avatar
deshipu
Posts: 1034
Joined: Thu May 28, 2015 5:54 pm

Re: Unable to use SPI display. Help please.

Postby deshipu » Sun Jan 15, 2017 10:52 pm

Do you happen to have a logic analyzer that you could use to record the signals and compare them?

Do you remember where you got that display? If I could get one myself, I could test it and update the library to work with it.
Are you using this library? https://github.com/adafruit/Adafruit-ST7735-Library/
Some of the comments in it are a bit concerning... https://github.com/adafruit/Adafruit-ST ... #L179-L188

UPDATE: reading through that Arduino library I noticed that there seem to be two versions of that display, referred to as "blue tab" and "green tab". The display I have has a green tab on the protective foil on the screen. What color is yours?

Ketsa
Posts: 6
Joined: Sun Jan 15, 2017 2:50 pm

Re: Unable to use SPI display. Help please.

Postby Ketsa » Mon Jan 16, 2017 8:35 am

Mine is black, I think they talk about the PCB color, (the protection film tab is green).
I got it from Aliexpress, it looks exactly like this one :
https://www.aliexpress.com/item/J34-F85 ... 57275.html

Yes, I used the adafruit library on the mini and I see they refer to "black tab" also in that library - so there's at least 3 different versions.

I have a logic analyzer, I might be able to use it... what shall I record ? clk sda a0 ?


Return to “Drivers for External Components”

Who is online

Users browsing this forum: No registered users and 1 guest