Skip to content

Power on delay - potential enhancement #15

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
peter-l5 opened this issue Sep 19, 2022 · 2 comments · Fixed by #28
Closed

Power on delay - potential enhancement #15

peter-l5 opened this issue Sep 19, 2022 · 2 comments · Fixed by #28

Comments

@peter-l5
Copy link

The SH1107 datasheet recommends a 100ms delay after the power on command is issued. (See pages 43-44.) This driver doesn't appear to implement this or mention that it might be needed in the documentation.

I have experienced EIO errors with a different MicroPython driver for the Adafruit 1.12 inch SH1107 128x128 OLED and a raspberrypi Pico. Adding a delay after issuing the display on command (AF hex) seemed to solve the problem.

I'm not familiar with the details of the Circuit Python system, and perhaps this is handled elsewhere, but as a possibly helpful thought, might it make this driver more robust to include a 100ms delay/sleep in the constructor initialisation and wake methods?

@RetiredWizard
Copy link
Contributor

RetiredWizard commented Apr 10, 2025

I suspect this is the cause of an issue I'm seeing. Using a Feather RP2350 with the FeatherWing OLED - 128x64 OLED and CircuitPython 10.0.0-alpha.2 this code.py file does not activate the OLED during power-up (ctrl-D works fine), however import code.py after the board boots the display works fine. The same issue occurs if you boot without a code.py and simply paste the code into the REPL. First paste doesn't activate the OLED, subsequent pastes, work fine.

import time
import board
import displayio

from i2cdisplaybus import I2CDisplayBus
import adafruit_displayio_sh1107

displayio.release_displays()

i2c = board.STEMMA_I2C()  # uses board.SCL and board.SDA
i2cdisplay_bus = I2CDisplayBus(i2c, device_address=0x3C)

# SH1107 is vertically oriented 64x128
WIDTH = 128
HEIGHT = 64
BORDER = 2

dispi2c = adafruit_displayio_sh1107.SH1107(i2cdisplay_bus, width=WIDTH, height=HEIGHT)

# Make the display context
splash = displayio.Group()
dispi2c.root_group = splash

color_bitmap = displayio.Bitmap(WIDTH, HEIGHT, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0xFFFFFF  # White
inner_palette = displayio.Palette(1)
inner_palette[0] = 0x000000  # Black

bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
splash.append(bg_sprite)

# Draw some squares
lrg_bitmap = displayio.Bitmap(32, 32, 1)
lrg_square = displayio.TileGrid(lrg_bitmap, pixel_shader=inner_palette, x=91, y=28)
splash.append(lrg_square)

time.sleep(5)
print('code.py Done!')

@RetiredWizard
Copy link
Contributor

I added a delay (100 through 150 ms) to the init sequence b"\xaf\x80\x98" # DISPLAY_ON + 150ms delay and it didn't help my issue at all but after looking more closely at the datasheet and Adafruit's primary guide for the display it appears the "reset" signal is important for the display power-up initialization. I was using a feather doubler which unlike stacking headers doesn't connect the reset pins. Once I manually connected the reset pins the i2c display properly activated during power-up

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.

2 participants