[SOLVED] SSD1306 with SPI?
-
Hi,
It appears the ssd1306 driver (https://github.com/micropython/micropython/blob/master/drivers/display/ssd1306.py) isn't working for WiPy. I've had to modify the driver to change pin.high() -> pin.value(1) and pin.low() -> pin.value(0) but clearly there is something else going on.
I have an Adafruit 128x32 OLED SSD1306 display wired to my WiPy 2.0 (via Expansion Board) as follows:
WiPy->SSD1306
P5->D/C
P6->RST
P7->CS
P10->CLK
P11->DATA
3V3->VIN
GND->GNDThis is the code I am using to test. I get nothing - no errors, nothing on the screen. Is it wired correctly? Something else messed up?
from machine import SPI, Pin
from ssd1306 import SSD1306_SPI as ssd
spi = SPI(0, SPI.MASTER, baudrate=100000, polarity=0, phase=0)
o = ssd(128,32,spi,Pin('P5'),Pin('P6'),Pin('P7'))
o.fill(1)
o.show()The OLED is good as I've used it with the Pyboard and it works. Just not with the WiPy.
I may be able to figure out what is wrong with the driver if I had a working SPI driver to compare. Anyone know of an SPI that actually works with the WiPy? Of any kind?
-
-
Yep, tried that too. Still doesn't work. Have verified it (still) works with Pyboard.
-
@Olias
It does work for me but I use different pins than yours as I don't own any WiPy and on the SiPy/LoPy the signalling pins you use are reserved.I setup mine as
disp = ssd(128,32,spi,Pin('P9'),Pin('P8'),Pin('P22'))
-
Hi,
Thanks for the tip and confirming it works! I have fixed the problem by upgrading the firmware to 1.9.1 and it fixed the problem. Aaahhh...better. :)
Chuck
-
@jmarcelino is it totally out of the question to use pin 5, 6 and 7 for any I/O purpose at all?
-
@jmarcelino i was thinking more generally, using P5, 6 and 7 on a LoPy - if it is OK to use these pins? On the official pinout sheet, they have exclamation marks and no pin names like the rest.. but it seems to work when I control an LED with one of them, I just had some strange behaviour while trying to use a color sensor
-
@soren
Those pins are connected to the LoRa chip (SX1272) using SPI so you may see unexpected behaviour
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login