2023-04-21 04:58 PM
Hi,
I am having an issue with the VL53L1CB TOF sensor where I cannot communicate with the sensor via I2C. I have everything configured correctly as far as I can tell but the API is returning status error -13. I am testing with a L476 nucleo and the SATEL sensor dev board, with some modified example code from the driver, and my code is attached below. Any help is much appreciated.
Thanks, Gray
2023-04-24 11:20 AM
After some more testing I have some more results. The sensor is working in autonomous mode, and reporting good ranging data in that mode. However, if I try to switch to ranging mode or multizone scanning mode the API reports error -20.
2023-04-25 08:34 PM - edited 2023-11-20 07:26 AM
I have been looking at the I2C traces with logic analyzer and noticed some different behavior depending on which mode the device is in. It looks like in autonomous mode when the device is working the delay between the mcu receiving data and replying to reset the interrupt is minimal, while in the normal ranging mode there is a considerable delay, several milliseconds, between the data reaching the mcu and the reply to start the next ranging. The images below show the traces from the two modes, autonomous first, D2 is the interrupt signal.
Does anyone have any ideas what could be causing this behavior? I've spent a while on this now to no avail.
Thanks, Gray
2023-04-26 01:26 AM - edited 2023-11-20 07:26 AM
Hi Gray
First can you do a quick test to verify the I2C link is working properly follow the attached I2C text guide?
I have reviewed your main test code, all is following our example, should be no problem.
one strange thing finds inside I2C init function, seems the I2C speed is not a normal value, can you confirm that?
Br
Zhiyuan.Han
2023-04-26 11:16 AM - edited 2023-11-20 07:26 AM
OK here is the report from that test:
VL53L1 Model_ID: EA
VL53L1 Module_Type: CC
VL53L1: EACC
Write 0x5AA5, read value: 5AA5
Write 0x5AA5AA55, read value: 5AA5AA55
WriteMulti 4 byte: 0x5AA5AA55
ReadMulti 0: 5A
ReadMulti 1: A5
ReadMulti 2: AA
ReadMulti 3: 55
The I2C config is what was generated by cubeMX, I've switched to fast mode plus now and my current I2C_Init is below.
2023-04-26 06:46 PM
Hi Gary,
Please share HW connection and more detail log, which API have passed, and which API return such error? the error come from initialize or ranging stage?
br
Zhiyuan.Han