cancel
Showing results for 
Search instead for 
Did you mean: 

LIS2DW12 Accelerometers I2C address and read data

Kchue.2
Associate II

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

7 REPLIES 7
Eleon BORLINI
ST Employee

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

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

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

Hi @Eleon BORLINI​ ,

After unplug and plug GND, I just can get 0x18 address, but still can't read the data.

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

I need to check how to make a jumper to connect to Vdd, because current GND connection was under IC. I need to cut it off first, and make a jumper with Vdd.

On datasheet 6.1.1, the Slave Address (SAD) associated to the LIS2DW12 is 001100xb. And "x" was depend on SA0/SDO connect with Vdd or GND.

But it also mention "The slave address is completed with a Read/Write bit". Is it mean I2C address should be 0x30~33, instead of 0x18~19?

Best Regards,

Kevin

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

Hi @Eleon BORLINI​ ,

Got it and thanks for your information.

We use one LIS2DW12 sensor and use 0x18 address, but we can't get the response from it.

We are thinking if we use 8-bit to read the sensor. Was it a solution?

Best Regards,

Kevin

Hi Kevin.

yes, you should finally use the address on 8 bits, when you build up the I2C pattern.

-Eleon