peter-l5/SH1107

Pico OLED 1.3 + Raspberry Pi Pico W - Nothing is displayed

Closed this issue · 7 comments

iCach0 commented

Hi,

I've uploaded the sh1107.py and framebuf2.py module codes to the Raspberry Pi Pico W as instructed and I'm trying to run sh1107 demo v319 spi 128x64.py but nothing is displayed on my OLED (Waveshare Pico OLED 1.3). Basically, the display never turns on.

I've also tried the demo from the waveshare site and it worked, so I know my OLED + Raspberry Pi Pico W are working correctly hardware-wise.

I also don't have a regular Raspberry Pi Pico (non W) to test, only the W version.

Using the latest micropython for RPi Pico W (v1.21.0 (2023-10-05))

Here's Thonny's output when I try to run the demo script:

MPY: soft reboot
starting test
SH1107: framebuf is extended
dir sh1107: ['class', 'name', 'const', 'dict', 'file', 'framebuf', 'time', 'version', 'SH1107_SPI', 'SH1107', '_fb_variant', 'repo', 'SH1107_I2C']
version (name='micropython', version=(1, 21, 0), _machine='Raspberry Pi Pico W with RP2040', _mpy=4358)
Initial free: 149504 allocated: 27776
SPI created: 149376 allocated: 27904
display created: 145328 allocated: 31952
framebuf2 framebuffer extension tests: triangles and circles
bilt test
letter dir ['class', 'blit', 'ellipse', 'fill', 'fill_rect', 'hline', 'line', 'pixel', 'poly', 'rect', 'scroll', 'text', 'vline']
large text test
contrast demo
free memory 125328
scroll test (start line)
free memory 19120
free memory 10896
invert test
large text test 3
large text test 4
large text test 16
array('h', [0, 0, 0, 40, 40, 40])

Hi @iCach0,
Thanks for raising this issue.
I've not tested the code with MicroPython version 1.21.1, although it seems unlikely that this is the cause.
Can I ask you to check one thing? - the output mentions a soft reboot, can I check if you have done a hard reboot by disconnecting the power and then reconnecting/ re-starting it?
best
Peter

Can I also also check whch version of the Waveshare OLED 1.3 you have?
there are three:
1.3inch OLED (A)
1.3inch OLED (B)
1.3inch OLED Module (C)
Versions (A) and (B) use the SH1106 driver IC. This driver only works with version (C) which uses the SH1107.
If you have the A or B versions, I would recommend the SH1106 linked in the readme SH1106. (You should be still able to use the extended framebuffer module framebuf2.py with that driver, if required, although I think the fill rectangle method could be broken.)
Let me know how you get on.

iCach0 commented

Hi Peter,

I've tried hard rebooting a couple of times but I get the same behavior.

As for the OLED version, I think it's version C, although the exact one is this one https://www.waveshare.com/wiki/Pico-OLED-1.3

Hi @iCach0,

Thanks for the info. I've not tested that display - it appears to be a further version, specially made for the PICO: to use it you would need to edit the code to reflect the pins that the display uses - if not done already.
This line:
spi1 = SPI(1, baudrate=1_000_000, sck=Pin(14), mosi=Pin(15), miso=Pin(12))
I think it would need to be, for example:
spi1 = SPI(1, baudrate=1_000_000, sck=Pin(10), mosi=Pin(11), miso=Pin(14))
miso (data out) doesn't appear on the diagram - so I have suggested a pin the display doesn't seem to use (or it might work if you omit it - not sure without checking).

The constructor line as follows also needs amending, for the chip select, and reset lines etc..
Instead of:
display = sh1107.SH1107_SPI(128, 64, spi1, Pin(21), Pin(20), Pin(13), rotate=0)
you could try, the following:
display = sh1107.SH1107_SPI(128, 64, spi1, dc=Pin(8), res=Pin(12), cs=Pin(9), rotate=0, external_vcc=False, delay_ms=100)
Does this help?

To be aware: I have edited the previous comment - not sure if you will get an email notification of that

iCach0 commented

It works! Although it seems it might be running in 128x128 mode because some things don't seem to fit properly, like the big numbers or the circles, for example (I can only see a half circle)

@iCach0: thanks for the reply.
Excellent news! Glad to hear that got it working.
The demo was written for 128x128 displays and is only partially adapted, unfortunately. But the driver should still function fine. (The SH1107 always has a 128x128 memory, but for 128*64 (or smaller) displays only some of the memory displays on the panel. ) If I get time one day I might improve the demos.
I'll close the issue then.