cancel
Showing results for 
Search instead for 
Did you mean: 

Low throughput reading multiple VL53L1X

HPerr.2
Associate

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:

  1. Call VL53L1_GetMeasurementDataReady, is sensor is not ready then return last valid reading;
  2. Otherwise, call VL53L1_GetRangingMeasurementData to get the sensor reading, then VL53L1_ClearInterruptAndStartMeasurement to prepare for the next cycle.

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:

  • If I query just one sensor, I can get readings at a frequency of over 20 Hz;
  • With four sensors, I get around 11 Hz;
  • Six sensors give me 7.6 Hz;
  • And querying all twelve sensors result in a paltry 3.8 Hz.

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?

1 REPLY 1
HPerr.2
Associate

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.