Skip to main content
DVu.4
Associate
January 4, 2022
Question

I have a project that use both LIS2DH12 and IIS2DH. How can I discriminate them in code?

  • January 4, 2022
  • 3 replies
  • 1120 views

..

This topic has been closed for replies.

3 replies

Eleon BORLINI
ST Employee
January 4, 2022

Hi @DVu.4​ ,

Since the WHO_AM_I register content is the same for both devices, in order to discriminate them in code I suggest you to poll -for example- the CTRL_REG0 (1Eh) register. It exists and is 00010000bin for the LIS2DH12, while it doesn't exist for the IIS2DH. See LIS2DH12 datasheet, p.33.

0693W00000HqXblQAF.png 

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

DVu.4
DVu.4Author
Associate
January 5, 2022

Dear @Eleon BORLINI​ ,

I tried this way. Although Register 1Eh is "Reserved" for the IIS2DH It has a default value is 00010000bin too.

-DVu

Eleon BORLINI
ST Employee
January 12, 2022

Hi @DVu.4​ ,

ok, that was unexpected. It had changed in time. You might then try reading the FIFO_SRC_REG (2Fh), that should be 0010000b for the IIS2DH, and 0000000b for the LIS2DH12.

Otherwise, the only way to distinguish between them is from the top package marking.

-Eleon