This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2652R7 : I2C communication, use 8-bit address mode


I am trying to interface VL53L1X sensor from STM. The sensor uses 8-bit address mode. I need to use the address 0x52 to write and 0x53 to read. So, I need to write address 0b01010010 to write something to the sensor. However, on checking, the address written is 0b1010010.

How can I change the address format to 8-bit? Is there any way to achieve the read and write with this sensor?

I also want to implement an I2C scanner on the controller. What is the general flow for that?

  • The first byte of an I²C transactions consists of the 7-bit address and of the R/W bit. This byte is often called the "address byte", but strictly speaking, this would be wrong.

    The I²C address always has 7 bits. There is no 8-bit address mode. 0x52 and 0x53 are the values of the first byte, but calling them the adress (as the VL53L1X datasheet does) is misleading.

    The address of that sensor is 0101001 = 0x29.

    (There are some hardware modules or libraries that combine the address and the R/W bit in their software interface, so you would have to use 0x52/0x53 for those. But this is apparently not the case for you.)

    To implement an I²C scanner, run a write transaction with zero data bytes after the first (address+R/W) byte, and do this for all valid addresses. (Addresses 0…7 and 120…127 are invalid.)

  • Understood, thank you.

    One more question, in the I2C API where we mention the address

    i2cTransaction_l.slaveAddress = address;

    The value of 'address' should be 0x29 then? And the underlying software will take care of the read/write bit by itself?

  • Hi Vivek,

    Your understanding is correct.  You can also refer to the I2C.h reference of the TI Drivers Runtime APIs and TI Driver I2C examples.