Hi everyone,
I’m debugging a strange I2C issue and would like to understand the underlying reason.
Setup:
I have a Teensy communicating over I2C with:
- an MLX90394 Hall sensor at address
0x10 - an AD569x DAC at address
0x4C
The Hall sensor is on a small flex PCB connected to my main PCB through about 3 m of wire. The main PCB has I2C pull-up resistors to 3.3 V. Some flex PCBs also have an additional set of pull-ups close to the Hall sensor; others do not.
Observed behavior:
With a fresh Hall sensor / flex PCB without local pull-ups, everything works initially. The I2C scan finds:
I2C device found at 0x10
I2C device found at 0x4C
But if I unplug and replug the USB cable powering the Teensy, the Hall sensor stops responding. The DAC still appears, but the scan gives strange results such as a fake device at 0x01 and many “unknown error” messages at odd addresses:
I2C device found at 0x01
Unknown error at address 0x03
Unknown error at address 0x05
...
I2C device found at 0x4C
...
The Hall sensor configuration then fails.
Additional observations:
- Measuring with a multimeter during one failure showed SDA stuck low in some cases.
- In other cases, a bus recovery function reports that SDA/SCL are already high before
Wire.begin(), but the sensor still does not communicate correctly. - If I disconnect the “unusable” sensor/flex PCB and short all its pins briefly, then reconnect it, it works again — but again only for one USB unplug/replug cycle.
- If I use a flex PCB with additional 1k pull-ups close to the Hall sensor, the setup survives repeated USB unplug/replug cycles and works reliably.
- The main PCB pull-ups are still present in all cases.
- The wire resistance is only about 5 Ω, so I assume resistance is not the main issue.
- I2C is at 400 kHz, lower rates did not solve the problem.
My current guess:
The 3 m cable capacitance / signal integrity is the real problem, and the pull-ups on the main PCB are too far away. Local pull-ups near the Hall sensor probably improve the rise time and make the power-up state more defined. Shorting the pins may just discharge residual charge or clear a bad state.
My questions:
- Does this explanation make sense?
- Why would the sensor work once after reconnecting, but fail after the next USB power cycle? Working once would indicate that for "operation" the additional pull ups are not needed.
- Can long I2C wiring with remote pull-ups leave a sensor in a semi-stuck or undefined state like this?
- Are local pull-ups near the sensor the correct fix, or should I be using an I2C buffer/extender for a 3 m cable?
- What pull-up values would you recommend for 3.3 V I2C over this length?
Thanks!