cancel
Showing results for 
Search instead for 
Did you mean: 

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

DVu.4
Associate
 
3 REPLIES 3
Eleon BORLINI
ST Employee

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
Associate

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

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