Skip to content

SH1107 OLED FeatherWing Display Issue with Feather RP2040 #4498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SAK917 opened this issue Mar 19, 2021 · 5 comments · Fixed by #4499
Closed

SH1107 OLED FeatherWing Display Issue with Feather RP2040 #4498

SAK917 opened this issue Mar 19, 2021 · 5 comments · Fixed by #4499
Milestone

Comments

@SAK917
Copy link

SAK917 commented Mar 19, 2021

When connecting an SH1107 128x64 OLED FeatherWing to a Feather RP2040 via STEMMA QT I2C, the display does not blank on initialization and displays pixelated "noise" when updated.

image

This does not occur when using an SSD1306 1.3" 128x64 OLED Display connected via STEMMA QT I2C to the same Feather RP2040. I have also tested the same OLED FeatherWing on a second RP2040 with the same result. I then tested the same FeatherWing connected to a Feather STM32F405 Express via STEMMA QT I2C and the FeatherWing displayed correctly. Lastly, I tried two other OLED FeatherWing displays and they both had the same issue with the RP2040.

I am able to reproduce the issue with the following code:

import displayio
import terminalio

from adafruit_display_text import label
import adafruit_displayio_sh1107

displayio.release_displays()
i2c = board.I2C()
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)
display = adafruit_displayio_sh1107.SH1107(display_bus, width=128, height=64)

WHITE = 0xFFFFFF
INIT_STRING = " " * 21
display_group = displayio.Group(max_size=5)
Line1 = label.Label(terminalio.FONT, text=INIT_STRING, color=WHITE, x=0, y=8)
display_group.append(Line1)
Line2 = label.Label(terminalio.FONT, text=INIT_STRING, color=WHITE, x=0, y=20)
display_group.append(Line2)
Line3 = label.Label(terminalio.FONT, text=INIT_STRING, color=WHITE, x=0, y=32)
display_group.append(Line3)
Line4 = label.Label(terminalio.FONT, text=INIT_STRING, color=WHITE, x=0, y=44)
display_group.append(Line4)
Line5 = label.Label(terminalio.FONT, text=INIT_STRING, color=WHITE, x=0, y=56)
display_group.append(Line5)
display.show(display_group)

Line1.text = f"{'1' * 21}"
Line2.text = f"{'2' * 21}"
Line3.text = f"{'3' * 21}"
Line4.text = f"{'4' * 21}"
Line5.text = f"{'5' * 21}"

while True:
    pass

I have also tried initializing the I2C bus using i2c = busio.I2C(board.SCL, board.SDA) instead of i2c = board.I2C(), but it did not make any difference. I have tested this using several versions of CP 6.2.0-beta.3 released over the past week, as well as the CircuitPython 6.2.0-beta.4 on 2021-03-18 release. While the noise seems to be better (fewer noise pixels) with the beta.4 release, the problem is still occurring:

image

Please let me know if there is any additional information or testing I can provide and thanks for your help.

@SAK917
Copy link
Author

SAK917 commented Mar 19, 2021

A quick update: I took a look at the SH1107 Datasheet to see if I could find anything that stuck out pertaining to the I2C interface and noticed it lists the maximum SCL Clock Frequency as 400 kHz (page 54).

I believe the board.I2C() statement returns a default busio.I2C(board.SCL, board.SDA, frequency=100000) object, so I tried using busio.I2C to initialize the bus directly instead of board.I2C and dropped the frequency thinking information was being somehow corrupted at 100 kHz... and the noise actually got worse. I then increased the frequency to 200 kHz and there was less noise, so I bumped the frequency up to 400 kHz and the display updates cleanly!

I am not sure why this seems to only be happening with the Feather RP2040 and not the Feather STM32F405. I then tried this using a QT Py Haxpress to see if an M0 chip behaves like the RP2040 and it does not with board.I2C working fine on the M0 as well.

So while I have found a viable workaround for making my SH1107 OLED FeatherWing work with the RP2040, there is still the question of why this is happening with the RP2040 but not the M0 or STM32 chips, as well as the issue that the sample code for the SH1107 driver uses board.I2C to initialize the bus so anyone trying this with an RP2040 chip will likely have the same 'noise' issues.

@caternuson
Copy link

Another one. Just adding for tracking:
https://forums.adafruit.com/viewtopic.php?f=57&t=177219

@dhalbert
Copy link
Collaborator

This appears to be fixed by raspberrypi/pico-sdk#273, which we are adding to CircuitPython as a PR to our fork of the pico-sdk. Thanks to @caternuson for testing.

@SAK917
Copy link
Author

SAK917 commented Mar 26, 2021

This appears to be fixed by raspberrypi/pico-sdk#273, which we are adding to CircuitPython as a PR to our fork of the pico-sdk. Thanks to @caternuson for testing.

@dhalbert, I just tested the sda-hold-time-fix.uf2 firmware on my setup described above and it seems to work as well now using i2c = board.I2C() instead of having to use i2c = busio.I2C(board.SCL, board.SDA, frequency=400000). Thank you!

@dhalbert dhalbert transferred this issue from adafruit/Adafruit_CircuitPython_DisplayIO_SH1107 Mar 26, 2021
@dhalbert
Copy link
Collaborator

This is a core circuitpython issue, so transferring to https://github.com/adafruit/circuitpython

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants