luma.oled icon indicating copy to clipboard operation
luma.oled copied to clipboard

SSD1306 not working via SPI

Open ski7777 opened this issue 7 years ago • 6 comments

Type of Raspberry Pi

tested on both RPi 1 B+ and RPi 3 B+

Linux Kernel version

Linux raspberrypi 4.14.70+ #1144 Tue Sep 18 17:20:50 BST 2018 armv6l GNU/Linux

Expected behaviour

I expect an image on the display

Actual behaviour

Nothing is happening

This is my wiring: img_20181009_145636 Please ignore the paper thing. The alignment is a bit wrong... img_20181009_145740

Display---RPI GND---GND VCC---3V3 DO---SPI0 SCLK D1---SPI0 MOSI RES---GPIO BCM 25 DC---GPIO BCM 24 CS---SPI0 CE0

my test code:

from luma.core.interface.serial import i2c, spi
from luma.core.render import canvas
from luma.oled.device import ssd1306, ssd1325, ssd1331, sh1106
from RPi import GPIO
GPIO.setmode(GPIO.BCM)
serial = spi(device=0, port=0, gpio=GPIO)
device = ssd1306(serial)
with canvas(device) as draw:
    draw.rectangle(device.bounding_box, outline="white", fill="black")
    draw.text((30, 40), "Hello World", fill="white")

input()
GPIO.cleanup()

My SSD1306 I²C displays are working with similar code. Why is this not working?

ski7777 avatar Oct 09 '18 13:10 ski7777

You should let the luma code manage the GPIO to get a working baseline. I highly suspect that it is down to setting the GPIO mode

rm-hull avatar Oct 09 '18 14:10 rm-hull

I also tried without initializing the GPIO and not setting the gpio parameter. It didn't work, too.

Raphael

Richard Hull [email protected] schrieb am Di., 9. Okt. 2018, 16:19:

You should let the luma code manage the GPIO to get a working baseline. I highly suspect that it is down to setting the GPIO mode

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub https://github.com/rm-hull/luma.oled/issues/223#issuecomment-428210748, or mute the thread https://github.com/notifications/unsubscribe-auth/AQa6kUeevryJgeWooyZlu5yoaEWb3r0_ks5ujLB7gaJpZM4XTO3W .

ski7777 avatar Oct 09 '18 14:10 ski7777

Bump!

ski7777 avatar Nov 07 '18 20:11 ski7777

did this ever get resolved..

thijstriemstra avatar Jan 13 '21 21:01 thijstriemstra

Looks like I have the exact same display and wiring. (I have the same code minus managing GPIO)

Sometimes it flashes white for a millisecond, but most of the time it's a black screen.

khwajay avatar Apr 30 '21 15:04 khwajay

If you are using SPI, you should use the gpio_RST and gpio_DC funktions to make it work Something like this: serial = spi(device=0, port=0, gpio_DC=16, gpio_RST=18)

where GPIO 16 and 18 on your PI are connected to your display DC and RST or RES

DJ-Dingo avatar Jul 30 '21 14:07 DJ-Dingo