OLED 128x64 SPI mode Can't display simple pixel ?

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
User avatar
Ef!
Posts: 1
Joined: Sun Nov 11, 2018 8:52 pm

OLED 128x64 SPI mode Can't display simple pixel ?

Post by Ef! » Sun Nov 11, 2018 9:10 pm

Hi I'm new on micropython, I come from arduino, and I know a little bit python.
Sorry for my bad english

I try to use on OLED SSD1306 128x64 SPI on micro python.
I 've use this oled on arduino and it work, but i cant use it on micropython

I use lib SSD1306

Here is my code:
#################
import machine
import ssd1306

spi = machine.SPI(1, baudrate=8000000, polarity=0, phase=0)
oled = ssd1306.SSD1306_SPI(128, 64, spi, machine.Pin('Y3'), machine.Pin('Y4'), machine.Pin('Y5'))
oled.pixel(0,0,1)
oled.show()
#################

And these are my connections : oled > board
GND > GND
VCC > 3V3
D0 > Y6
D1 > Y8 (and i've try Y7)
RES > Y4
DC > Y3
CS > Y5
(I would like to use SPI 2)

Nothing appear on the oled screen
What's wrong ?

Thx a lot

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: OLED 128x64 SPI mode Can't display simple pixel ?

Post by pythoncoder » Mon Nov 12, 2018 7:40 am

Your connections are for SPI(2) but your code specifies SPI(1). You need to connect MOSI (Y8) and SCK (Y6) and ignore MISO (Y7).

To get started I would run without optional SPI arguments:

Code: Select all

spi = machine.SPI(2)
In my usage this worked correctly.
Peter Hinch
Index to my micropython libraries.

Post Reply