Skip to main content
Visitor II
April 26, 2021
Solved

LIS2DW12 Accelerometers I2C address and read data

  • April 26, 2021
  • 1 reply
  • 3204 views

Hi all,

I use Arduino to read the LIS2DW12 sensor. The circuit of sensor was as below.

According to the circuit, the I2C address was 0x18. But when I use Arduino to scan the address, sometimes it has no response. Has any connection I miss?

0693W00000AMXKrQAP.pngTo read the data, I use the multil2c example from github.

https://github.com/arraym/LIS2DW12-Arduino-Lib

But the value of raw data is always same value.

Was the lib incorrect?

    This topic has been closed for replies.
    Best answer by Eleon BORLINI

    Hi Kevin,

    >> About SA0 connection, what is functional difference for connected Vdd and GND?

    There is no functional difference, but in this way (i.e. choosing the SA0 polarity) you'll be able to place two sensors on the same I2C lines, since you'll have two different I2C addresses.

    >> Is it mean I2C address should be 0x30~33, instead of 0x18~19?

    Yes, the 0x30~33 is the slave address on 8-bit, i.e. with the additional R/W bit, while 0x18~19 is on 7 bit. In the resulting I2C pattern (on 8-bit) the 0x30~33 is the one to be considered, as shown in the picture I previously posted in my comment.

    -Eleon

    1 reply

    ST Employee
    April 27, 2021

    Hi @Kchue.2​ ,

    the address (on 7 bits) looks correct, according to the SA0 value (datasheet, p. 28):

    0693W00000AMcCJQA1.pngBut did you try all the #256 I2C possible addresses?

    What I would suggest you is to try to set the SA0 pin to Vdd, if possible, and re-dun the I2C scan. Also, you could try another LIS2DW12 if you have the possibility, just to exclude an issue specific of that device.

    Another suggestion is to open an issue report directly on Github for more help in case the issue is effectively related to the software routine.

    -Eleon

    Kchue.2Author
    Visitor II
    April 28, 2021

    Hi @Eleon BORLINI​ ,

    Thanks for advice.

    I had scan all 256 I2C, but still have same result.

    When I unplug and plug GND pin, the sensor I2C address will be alive again.

    If I set SA0 to Vdd, the address will be 0x19.

    Could you let us what difference compare with connect to GND?

    I will open an issue on Github.

    Best Regards,

    Kevin

    ST Employee
    April 28, 2021

    Hi Kevin,

    so you are able to communicate with the device (with the correct I2C address) unplug and plug GND pin, right?

    >> If I set SA0 to Vdd, the address will be 0x19.

    This is correct. And, in this case, since the SA0 pin is internally connected to a weak pull-up, you should experience a lower current consumption in this case that if the pin would be connected to GND (see datasheet, p.5). Especially for Vdd close to 3.6V, the resistor value is 20kOhm typ. Maybe it would be better to leave it floating.

    Are you facing issues also in the case the SA0 pin is connected to Vdd, or can you try if everything is working in this case?

    -Eleon