Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

STM32F405 Feather and SH1107 OLED Featherwing
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

STM32F405 Feather and SH1107 OLED Featherwing

by mdroberts1243 on Thu Sep 17, 2020 6:39 pm

I thought I would try to get a simple framebuffer driver going on the SH1107 OLED 128x64 Featherwing. I'm using the STM32F405 Feather and the latest 5.x CircuitPython.

I can't seem to successfully write a single byte to the SH1107 controller though!

I've boiled it down to this simple code example:
Code: Select all | TOGGLE FULL SIZE
import busio
import digitalio
import board
from adafruit_bus_device.i2c_device import I2CDevice
import time

init = bytearray([
            0xae,       # display off, sleep mode
            0xaf,       # display on
        ])

with busio.I2C(board.SCL, board.SDA) as i2c:

    while not i2c.try_lock():
        pass
    print("Found these I2C devices:", i2c.scan())
    i2c.unlock()
   
    device = I2CDevice(i2c, 0x3C)
    with device:
        device.write(init)
        print("Wrote initialization string!")


The output I'm getting:
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Found these I2C devices: [57, 60]
Traceback (most recent call last):
File "code.py", line 24, in <module>
File "code.py", line 24, in <module>
File "code.py", line 23, in <module>
File "adafruit_bus_device/i2c_device.py", line 102, in write
OSError: [Errno 5] Input/output error


Press any key to enter the REPL. Use CTRL-D to reload.


Clearly both my SH1107 and the AS7341 are being detected. I have been able to get the AS7341 simpletest working but can't figure out how to get past the Input/output error when trying to write the SH1107.

Thanks in advance for any suggestions!

mdroberts1243
 
Posts: 9
Joined: Tue May 16, 2017 11:35 am

Re: STM32F405 Feather and SH1107 OLED Featherwing

by mdroberts1243 on Thu Sep 17, 2020 10:15 pm

O.k. Very stupid mistake.

With the SH1107 the first byte you write has to be either 0x80 (for a command) or 0x40 (for data).

Once I always started my writes with those everything started working.

[CLOSED]

mdroberts1243
 
Posts: 9
Joined: Tue May 16, 2017 11:35 am

Please be positive and constructive with your questions and comments.