cancel
Showing results for 
Search instead for 
Did you mean: 

VL53L1CB Communication not working.

GJohn.4
Associate II

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

5 REPLIES 5
GJohn.4
Associate II

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.

GJohn.4
Associate II

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


_legacyfs_online_stmicro_images_0693W00000bipmDQAQ.png
_legacyfs_online_stmicro_images_0693W00000bipocQAA.png

Zhiyuan.Han
ST Employee

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?


_legacyfs_online_stmicro_images_0693W00000biqYfQAI.png 

Br

Zhiyuan.Han


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
GJohn.4
Associate II

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.


_legacyfs_online_stmicro_images_0693W00000bitsYQAQ.png

Zhiyuan.Han
ST Employee

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


In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.