Skip to content

Conversation

@emiln95
Copy link

@emiln95 emiln95 commented Sep 29, 2025

Issue

When a I2C buss is not functioning correctly the i2cdetect tool takes a long time(several minutes) to go through all addresses and locks the UI until it finishes. Similar with the smbus.SMBus.write_quick(). Since nothing is displayed during the process and no message is shown in the end it's hard to troubleshoot.

Fix

  • Added timeout arg for subprocesses calls to i2cdetect
  • Added timeout to smbus calling loop.
  • Added message displaying a timeout occurred in I2C Adressess
  • Added message displaying a timeout occurred in AddI2c

Notes

The timeout value is set to 1 second (hard-coded) for both the calls, smbus locks for longer anyhow tho. Feel free to change this if necessary.
But this should be plenty of margin, assuming:
127 Addresses, 100 kbit/s, total frame of 3 bytes should take 3 milliseconds, not accounting for delays between the transfers.

Replicate

Issue can be replicated by shorting SCL and SDA pins on the I2C bus when using the MacArthur Hat and ICM-20948 module.

Tested

Tested on:
RPi-4B installed with OpenPlotter
OS: Debian 12 (bookworm)
Kernel: 6.12.47+rpt-rpi-v8
Arch: arm64

Idk if this is of interest.

Noticed this due to a faulty sensor board that had a solder bridge between the SCL and SDA pins on the component.

Added simple timout check for smbus calls.
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 this pull request may close these issues.

1 participant