TMF8821 Multi-Sensor Performance Issues with Qwiic Mux - Need Working 8-Sensor Example

Hardware Setup:

  • 8× SparkFun Qwiic Mini dToF Imager (TMF8821)
  • 1× SparkFun Qwiic Mux Breakout (TCA9548A) at address 0x70
  • Testing on two platforms:
    • Renesas RA6M5 (with micro-ROS/FreeRTOS)
    • Arduino Seeeduino XIAO SAMD21

Goal:
Get 8 TMF8821 sensors working simultaneously at 10Hz measurement rate each through the Qwiic Mux.


Current Status & Problems:

On Renesas RA6M5:

  • Successfully ported the TMF882X SDK with proper I2C shim layer
  • Performance degrades significantly as sensors are added:
    • 2 sensors: ~13Hz ✓
    • 6 sensors: 4-6Hz (barely usable)
    • 8 sensors: System freezes or <3Hz
  • We’ve implemented proper I2C bus mutex (with FreeRTOS) for thread safety, mux settling delays (10ms), and staggered sensor polling
  • I2C configured at 400kHz with proper timeout handling
  • Note: We publish the readings through micro-ROS topic

On Arduino SAMD21:

  • Single sensor works perfectly through multiplexer
  • Cannot initialize 8 sensors - RAM overflow (region overflowed by ~54KB)
  • Each SparkFun_TMF882X object consumes ~7KB RAM
  • 8 sensors × 7KB = 56KB, but SAMD21 only has 32KB RAM

What We’ve Tried:

:white_check_mark: Verified hardware: Each sensor works individually
:white_check_mark: Proper mux channel switching with delays
:white_check_mark: I2C bus mutex (with FreeRTOS) for thread safety (Renesas)
:white_check_mark: Increased I2C timeouts (50ms → 500ms)
:white_check_mark: Reduced measurement rate (33ms → 100ms)
:white_check_mark: Added delays between sensor reads (5-10ms)
:white_check_mark: Checked power supply (USB 5V/2A - adequate for 8×57mA sensors)

:cross_mark: Performance still degrades with >5 sensors on Renesas
:cross_mark: Cannot test 8 sensors on Arduino due to RAM limitations


Questions:

  1. Is there a working Arduino example for multiple TMF8821 sensors through a mux? The current library design seems incompatible with multi-sensor setups on RAM-constrained boards.

  2. What’s the expected I2C bus load for 8 sensors? The TMF882X SDK makes ~15-20 I2C transactions per measurement per sensor. At 10Hz × 8 sensors, that’s ~1600 I2C transactions/second. Is this realistic on a shared I2C bus?

  3. Are there recommended timing parameters for high-density TMF8821 deployments? (mux delays, I2C clock speed, polling intervals, etc.)

  4. Has anyone successfully run 8+ TMF882X sensors simultaneously? If so, what platform and what configuration?

Any guidance would be greatly appreciated!


Additional Technical Details:

  • I2C bus speed: 400kHz (tried 100kHz - worse performance)
  • Mux settling delay: 10ms after channel switch
  • Sensor measurement period: 100ms (10Hz target)
  • All sensors configured for 3×3 zone mode (SPAD map 6)

If you disable the micro-RTOS writes, how much does the Hz change with 4?

I’m impressed that 4 still runs above 10 Hz, as you noted those sensors output a tons of data…can you just use a 2nd Renesas and have 2 x 4 sensors on 2 separate muxes, then pass their buffer to the SAMD21 which then publishes to micro-RTOS? In my head this seems the most viable…having a more powerful MCU like a Jetson or RPi5 would help a bit but I believe the i2c bus would be constrained, however an AI thinks you can with the following tweaks:

Implement INT-driven reads
Enable 1MHz i2c on the Renesas
Use 0.5ms for mux-settle timing (10ms is a lot)
Keep the round-robin under 15ms

Those 4 tweaks above should give you 8x on one mux according to the AI overlords, give 'em a shot