I'm driving a SSD1306 board using I2C from several MIMXRT boards (Teensy 4.0 & 4.1, MIMXRT1010 & 1020). This works just fine if I use SoftI2C but fails using the Hardware I2C module. The MIMXRT1020 includes pin definitions for the I2C ports and SoftI2C can use these pins.
Code: Select all
from machine import Pin, I2C, SoftI2C
i2cS= SoftI2C(scl = 'I2C_SCL',sda = 'I2C_SDA')
print(i2cS.scan())
i2cS.start()
i2cS.stop()
i2cH= I2C(0)
print(i2cH.scan())
i2cH.start()
i2cS.stop()
This is run on a MIMXRT-1020 with the SSD1306 connected. The output is:
Code: Select all
[60]
[60]
Traceback (most recent call last):
File "<stdin>", line 9, in <module>
OSError: I2C operation not supported
So the scan reports the same value with both I2C and SoftI2C but 'start' fails with I2C. It's no different if all the SoftI2C code is commented out and the board restarted. The program driving the screen results in the same ' OSError: I2C operation not supported ' error with I2C. Practically this isn't a problem as SoftI2C works just fine but it would be nice to know if this is a bug or I'm missing something.
This is the same on all the MIMXRT boards I've tested though I have only tested it with SSD1306 screens and not other I2C devices.