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
deshipu
Posts: 939
Joined: Thu May 28, 2015 5:54 pm

Re: Unable to use SPI display. Help please.

Postby deshipu » Mon Jan 16, 2017 11:38 am

You will need at least the SDA and SCK, possibly also A0 (which is actually data/command).

If you feel like experimenting, you could also copy the initialization sequence for the black board from that Arduino library into the Python library, and see if that makes it work...

I have ordered a bunch of different ST7735-based displays now, and will do some experiments once they arrive, but it can take a month (the Chinese New Year is nearing).

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 7:28 pm

I captured the screen init and few commands, channels look at least active.
Here is the Sigrok file, maybe its useful to you ?

https://dl.dropboxusercontent.com/u/319 ... 5-Black.sr

I'm not really a programmer, I doubt I can copy that init sequence, will have a look tomorrow.

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

Re: Unable to use SPI display. Help please.

Postby thule » Tue Jan 17, 2017 4:38 pm

One of my screens has a green protection film. The other one doesn't have any protective film - not sure if it came with one and I removed it!

Thanks a lot for all your willingness everyone. Even if this does not work, it is heart warming to see lengths people go to, to help others. :-)

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

Re: Unable to use SPI display. Help please.

Postby deshipu » Tue Jan 17, 2017 6:12 pm

I have pushed to https://github.com/adafruit/micropython ... gb-display a new version of the st7735.py file that contains an additional class, ST7735R, which does the altenate initialization sequence needed by some modules. I have also found a module in my drawer that didn't work with the original class, but works with the new one. I got it to work with the following code:

Code: Select all

from machine import Pin, SPI
import st7735
display = st7735.ST7735R(SPI(1, baudrate=10000000), dc=Pin(12), cs=Pin(15), rst=Pin(16))


Note that I had to lower the SPI baudrate from the default 80000000 to make it work.

Please test. Note also, that I have hardcoded 127x127 resolution in the initialization sequence for now. That means that if your module is 128x144 or 128x160, you will have a fragment of the screen inaccessible. That will be fixed in subsequent updates, for now it's important to get the display to display anything.

UPDATE: I now fixed the resolution, and determined that the fastest baudrate with which it works for me is 40000000.

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

Re: Unable to use SPI display. Help please.

Postby Ketsa » Tue Jan 17, 2017 7:27 pm

I can confirm the new class works on my black pcb screen ! Thanks a lot !

Now, how can I display text on this thing ?

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

Re: Unable to use SPI display. Help please.

Postby deshipu » Tue Jan 17, 2017 9:33 pm

There is some discussion about a standard font format here: viewtopic.php?f=3&t=2667

Right now you would need to draw the letters pixel-by-pixel, which will probably be quite slow. I plan to add to this driver the ability to blit framebuffers to it, in order to have a fast way of drawing bitmaps such as letters, but the rgb framebuffer support was only merged recently, and I didn't have time to work on it yet.

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

Re: Unable to use SPI display. Help please.

Postby deshipu » Tue Jan 17, 2017 10:12 pm

I just added a "blit_buffer" and a "text" method to the library. It only uses the micropython's internal, built-in font, and you can't do things like rotating the text. You also have to handle wrapping yourself.

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

Re: Unable to use SPI display. Help please.

Postby Ketsa » Sat Jan 21, 2017 8:20 pm

It works ! Thanks !

Somewhat :-p I have a problem displaying text past ~x:100, the text gets strangely overlaid by bg color.


Return to “Drivers for External Components”

Who is online

Users browsing this forum: No registered users and 1 guest