Skip to main content
Aishwarya
Associate III
Apr 22, 2021 10:10 AM UTC
Solved

LIS2DTW12 I²C/SPI mode selection

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.

This topic has been closed for replies.
Eleon BORLINI
Eleon BORLINIBest answer
ST Employee
Apr 22, 2021 12:40 PM UTC

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

2 replies

Eleon BORLINI
Eleon BORLINIBest answer
ST Employee
Apr 22, 2021 12:40 PM UTC

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
AishwaryaAuthor
Associate III
Apr 22, 2021 1:08 PM UTC

thanks @Eleon BORLINI