Skip to main content
Visitor II
December 21, 2022
Question

I2C communication failure while reading data from VL53l0x

  • December 21, 2022
  • 3 replies
  • 2864 views

Hello,

I am currently working with STM32wl55jc. My application invlolves few I2C sensors.The application also invlolves VL53l0x. These sensors have been mounted on a single PCB.

I have tried explaining the problem below.

1. I am currently reading the sensor data every minute. And Transmitting it over to the LoRaWAN server.

2. All the sensors have different addresses.

3. The product works fine for some amount of time and then while reading data from VL53l0x the I2C-SCL line goes low. 

I have conducted two tests.

1. Reading all the sensors EXCEPT Vl53l0x. 

The application reuns fine for few hours without facing any issues on the I2C line.

2. Reading data from ONLY VL53l0x 

The application misbehaves after some time.

3. Connecting ALL the sensors to STM32G491RE.

The failure doesn't take place. 

The I2Cfailure is only seen when Vl53l0x is connected to STM32wl55jc and that too after hours.

The failure of I2C is uncertain. Sometimes it is observed within 2 hours, sometimes after 3 hours or even more than that.

Thank you.

    This topic has been closed for replies.

    3 replies

    ST Employee
    December 21, 2022

    Hi @Snatu​,

    check the error flags in the I2C status register. These may include some hint. It's a specific data read or it can happen during any data read? When there's a timeout on the I2C SCL being forced low, a flag is raised in the register. You can try to reinitialize the I2C or use GPIO to reset the sensor if that doesn't help.

    The STM32G4 and the STM32WL use virtually identical instance of the I2C interface, unless the second core of the WL is somehow involved, I see no reason for these two to differ in this case.

    BR,

    J

    SnatuAuthor
    Visitor II
    December 22, 2022

    Hello @JHOUD​ 

    Thank you for your reply.

    I will check the I2C status register.

    The problem doesn't occur during reading any specific register, can happen while reading any of them.

    I have implemented the solution suggested by you, by reinitializing the I2C peripheral and, resetting the sensor using XSHUT pin(in the current design I have pulled it up, so I toggled it once using a GPIO).

    I will test this for a few days, will post if I face any further problem. Thank you for the suggestion.

    Regards,

    Sumedh

    Visitor II
    December 21, 2022

    Data reading from VL53l0x fails over I2C

    Hi there,

    Currently, I am working with the STM32wl55jc microcontroller. There are few I2C sensors that I use in my application. The application also uses a VL53l0x that I use in the application. A single PCB has been used to mount all of these sensors.

    Below I have tried to explain the problem in as much detail as I can.

    Assume the following. As of right now, I am reading the sensor data every minute. And Transmitting it to LoRaWAN.

    The second point. There are different addresses for each of the sensors.

    The third point. For some time, the product works fine, and then it goes low on the I2C-SCL line during the reading of data from the VL53l0x. 

    Visitor II
    January 21, 2023

    Do you implement an I2C error recovery if SDA is low prior generating a Start bit ?

    Example of I2C bit banging with error recovery here