2021-03-08 12:25 PM
I'm programming a sensor array composed of 12 VL53L1X ToF sensors, connected to an STM32F427 chip through a single I²C bus. Measurement and inter-measurement times are set to 30 and 40 milliseconds respectively across all sensors. Sensors are queried in a loop and data is sent to a host PC through a USART connection.
Sensors are queried in the following manner:
At each loop cycle, all sensors are queried in the manner above, then the data collected from the sensors is encoded in a string and sent to the host.
I noticed that data throughput decreases dramatically as the number of queried sensors increase:
I have confirmed that the bottleneck is neither in the microcontroller nor the data connection — if I bypass the sensors and just send random data I can easily get over 30 Hz throughput. This leads me to believe the problem lies in the I²C bus.
Other than distributing the sensors among the controller's I²C buses, is there anything I can do to increase data throughput?
2021-03-09 10:01 AM
To answer my own question, reworking my code to use the VL53L1X ULD API produced a 6-fold speed improvement: polling all 12 sensors now works at a frequency of over 25 Hz, which is plenty fast enough for my purposes.