Skip to main content
VBhat.1
Associate II
September 20, 2021
Question

Changing VL53L5CX i2c address?

  • September 20, 2021
  • 4 replies
  • 4467 views

Hi, I am trying to use the vl53l5cx_set_i2c_address() function in order to change the i2c address, but it keeps returning -2, or VL53L5CX_COMMS_ERROR from the following line in vl53l5cx_set_i2c_address():

status |= WrByte(&(p_dev->platform), 0x7fff, 0x02);

The WrByte seems to fail. I would like to change the i2c address, in order to use multiple modules, but currently I can only use one. Any suggestions or advice would be appreciated. Thanks!

This topic has been closed for replies.

4 replies

Peter BENSCH
Technical Moderator
September 21, 2021

Sorry, that was a wrong statement, because 0x52 is just the default address that can of course be changed: The I2C address of the VL53L5CX is permanently preset in the sensor and cannot be changed. If you want to address several sensors, you have to separate them logically, e.g. with an I2C bus switch.

Good luck!

If the problem is resolved, please mark this topic as answered by selecting Select as best. This will help other users find that answer faster.

/Peter

VBhat.1
VBhat.1Author
Associate II
September 21, 2021

Hi Peter, thanks for replying! If the VL53L5CX can't have it's i2c address changed, what does the vl53l5cx_set_i2c_address() function mentioned in the documentation and vl53l5cx_api.c file do?

It refers to pulling down LPn pins of all other devices not having their i2c address changed, and using set_i2c_address, then pulling LPn of other devices back high, and so forth until all devices have different addresses set.

Peter BENSCH
Technical Moderator
September 21, 2021

Sorry, I made a wrong statement. Now it is time to check why you are getting an error.

Regards

/Peter

VBhat.1
VBhat.1Author
Associate II
September 21, 2021

<deleted>

KWine
Senior
September 27, 2021

This works in the Arduino implementation:

/* (Optional) Set a new I2C address if the wanted address is different

 * from the default one (filled with 0x20 for this example).

 */

 status = vl53l5cx_set_i2c_address(&Dev, 0x20);

SAure.1
Visitor II
December 10, 2021

Is it possible to use more VL53L5CX-SATEL sensors simultaneously on the same i2c bus, without connecting each of those with seperate GPIO of the i2c master?

I followed the documentation section 2.3 and successfully changed the i2c address of one sensor, but on each power down the sensors looses its new address, right?

I'm using a Arduino Nano 33 BLE and want to connect up to 14 VL53L5CX sensor at the same time. Do I need to get an i2c multiplexer to so, or is it possible to change the i2c address by modyfing the firmware which is loaded on startup of each VL53L5CX?