Raspberry Pi 4 - I2C Lockup With Multiple Multiplexers
 John.Koenig  2023-12-27 18:54:15 510 Views0 Replies
 John.Koenig  2023-12-27 18:54:15 510 Views0 Replies Hey, folks. We have a small tree of Gravity: Digital 1-to-8 I2C Multiplexers branching out to 40 OLED screens. See the following hastily put together diagram:

I am attempting to write a small Python app (included below) capable of scanning all the various channels in this tree and running into i2c lockups part way through the application loop. Am I doing something wrong? If not me, how can I troubleshoot further?
# PiExploder.py
import sys
import os
import time
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))
import DFRobot_I2C_Multiplexer
I2CMultiAddr = 0x70       #I2C Multiplexer addr
I2CMultiAddr2 = 0x71      #I2C Multiplexer address for "second tier" multiplexers
I2CMulti = DFRobot_I2C_Multiplexer.DFRobot_I2C_Multiplexer(I2CMultiAddr)
I2CMulti2 = DFRobot_I2C_Multiplexer.DFRobot_I2C_Multiplexer(I2CMultiAddr2)
for Port1 in range(0,4):   #Scan i2C devices of each port
 print("Tier 1 Port:%s" %Port1)
 for Port in range(0, 8):
   I2CMulti.select_port(Port1)
   addr = I2CMulti2.scan(Port)
   if(len(addr)):
     print("  Tier 2 i2c addr:%s" %addr)
   I2CMulti.select_port(8)

