cancel
Showing results for 
Search instead for 
Did you mean: 

LIS2DTW12 I²C/SPI mode selection

Aishwarya
Associate III

I want to read LIS2DTW12 data using SPI which is also shared with another device, can I use the LIS2DTW12 CS pin as chip select and operate devices one by one.

because according to the LIS2DTW12 datasheet:

State of CS

1: SPI idle mode / I²C communication enabled;

0: SPI communication mode / I²C disabled

i.e if cs = 1 --> I2C Enabled, read/write operation on another device will disturb the LIS2DTW12 device.

1 ACCEPTED SOLUTION

Accepted Solutions
Eleon BORLINI
ST Employee

Hi @Aishwarya​ ,

yes you can do it, since the SPI and I2C protocol are different, and you should not arise crosstalk effects.

However, to be sure you have no issues, in order to disable the I²C block you can set the CTRL2 (21h) (I2C_DISABLE) = 1 bit before you start your acquisition (see also p.37 of the datasheet for more info).

If my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster. 

-Eleon

View solution in original post

2 REPLIES 2
Eleon BORLINI
ST Employee

Hi @Aishwarya​ ,

yes you can do it, since the SPI and I2C protocol are different, and you should not arise crosstalk effects.

However, to be sure you have no issues, in order to disable the I²C block you can set the CTRL2 (21h) (I2C_DISABLE) = 1 bit before you start your acquisition (see also p.37 of the datasheet for more info).

If my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster. 

-Eleon

Aishwarya
Associate III

thanks @Eleon BORLINI