2025-05-09 5:14 AM - edited 2025-05-09 5:20 AM
Hello Developers, Hello ST-Team,
unfortunately we are stuck in implementing VL53L5CX on our PIC18. We see a strange clock stretching behaviour of the sensor and problem downloading the firmware.
We implemented Ultra Lite Driver 2.0.0 in an application on a Microchip PIC18F57Q43 (CURIOSITY NANO Evaluation Kit) using Example_1_ranging_basic.c from the examples folder.
After the adjustments of platform.c and modification of the download routine to download the 86 KB firmware in chunks, we got the following odd behaviour:
- The function vl53l5cx_is_alive(&Dev, &isAlive); returns SUCCESS = No error!
- The function vl53l5cx_init(&Dev); fails.
Sending the first package of data seem to be successfull. When trying to start sending the second chunk of data the sensor refuses to communicate with the MCU by returning NACK for any further byte.
Has anybody an idea why the sensor behaves like that and why the sensor stretches the clock line?
Even while stretchin SCL for each byte transmitted, it seems the sensor communicates at first until the FW download got started. Trying to send more data chunk than the first one always fails, not matter what size is used:
chunks sizes of 2 byte register index +
126 bytes or
128 bytes or
192 bytes or
255 bytes or
256 bytes of data failed.
Our HW design person said, there is a level shifter included on the sensor PCB to run conform sensor voltage. There is also an LDO voltage regulator which brings doown the supply voltage of 5V to the required 3.3V.
Please see the oscilloscope measurements:
Why the ACK from the sensor comes so late for each data byte transmitted from MCU to sensor?
Why sensor accepts the first chunk of firmware data but refuses any further data by replying with NACK on I2C?
We spend days to understand what went wrong here, but we cant find an explanation. The sensor on our custom PCB works fine when its connected to a ST MCU (using NUCLEO-F401RE Evaluation Kit).
Thanks for help!