Changing VL53L5CX i2c address?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-20 2:03 PM
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!
- Labels:
-
Time of flight
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-20 11:45 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-21 7:51 AM
<deleted>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-21 7:51 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-21 8:19 AM
Sorry, I made a wrong statement. Now it is time to check why you are getting an error.
Regards
/Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-21 8:20 AM
Did you follow the guidelines in UM2884, section 2.3?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-21 8:26 AM
Yes, right now I have only connected 1 VL53L5CX device to my i2c bus, and have LPn pulled high. The WrByte(&(p_dev->platform), 0x7fff, 0x02); in set_i2c_address still fails (returns 254), but I'm not sure exactly what it's doing. After the code fails I can't connect to the VL53L5CX again until I cycle power.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-21 11:30 AM
Should set_i2c_address be called before or after VL53L5CX_init()? Currently I am doing it after.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-21 12:09 PM
After I get the comms error status from the set_i2c_address function, using i2cdetect on my raspberry pi I can indeed see that the i2c address of the VL53L5CX has changed to my intended value, I just am not able to communicate with it at that address.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-09-25 1:44 PM
Hi Peter, do you have any more ideas as to how to set the i2c address? Has anyone else been able to do so successfully yet?
