I recently inherited some firmware with weird problems in regards to the duration of reading sensor values. The board is based on the ESP32 Wrover MCU and has multiple sensors connected via the I2C bus. The firmware makes use of the port of the FreeRTOS task library and uses the main loop to read two sensors as well as an extra task on the same core to read some more sensor via a DS2482 I2C to OneWire bridge. Usually I would expect the reading of the sensors to take at most one second (assuming the 'worst' case under normal conditions) via the bridge, but it takes a multitude of that, usually around 30 or more seconds for one sensor. Not only the reading but any communication over the bridge takes a very long time. One more detail: The sensors behind the bridge are connected one per channel of the bridge and the one wire channel is reset each time before a sensor is read.
My current suspicion is that using multiple tasks on the same I2C bus may screw up the timings of the communication and thus cause communication errors leading to the increased read times.
Does that suspicion sound reasonable at all or what would you suggest to investigate on the described system (knowing well, that I didn't provide too many details)?
Any ideas are welcome.
Thanks!