cancel
Showing results for 
Search instead for 
Did you mean: 

LIS2DH12

Antonio Boix
Associate
Posted on February 14, 2017 at 13:03

Hi all,

I have got a technical question, if is possible to get some helpful feedback, I would really appreciate it, please.

I have recently purchased a LIS2DH12 accelerometer and I am plugin it within a Teensy module in order to check the right behaviour. I have only enabled �Z�axis by 0x20 and 0x30 registers.  However, my Arduino console also shows me that �X�and `Y` axis are enabled throughout the 0x31 register. So, my question is: Which registers should I configurate and keep in mind for just activate �Z�axis?

Well, my Register configuration is the following one;

while(i2cWrite(0x20, 0x34, true));

while(i2cRead(0xA0,i2cData,1));

Serial.println(i2cData[0],HEX);

while(i2cWrite(0x22, 0x40, true));

while(i2cRead(0xA2,i2cData,1));

Serial.println(i2cData[0],HEX);

while(i2cWrite(0x23, 0x08, true));

while(i2cRead(0xA3,i2cData,1));

Serial.println(i2cData[0],HEX);

while(i2cWrite(0x32, 0x3F, true)); //INT1 Threshold --> 0x3F (63 dec) * 16mg = 1g //  

while(i2cRead(0xB2 ,i2cData,1));

Serial.println(i2cData[0],HEX);

while(i2cWrite(0x33, 0x02, true)); //INT1_DURATION

while(i2cRead(0xB3,i2cData,1));

Serial.println(i2cData[0],HEX);

while(i2cWrite(0x30, 0x20, true)); //INT1_CONFG --> Enable interrupt generation on Z high event or on direction recognition

while(i2cRead(0xB0,i2cData,1));

Serial.println(i2cData[0],HEX);

Thank you very much for your help before hand,

Toni

#lis2dh12
3 REPLIES 3
Miroslav BATEK
ST Employee
Posted on February 14, 2017 at 13:58

What exactly do you mean by '

my Arduino console also shows me that ´X´and `Y` axis are enabled throughout the 0x31 register'? What value do you read?

I don't see anything wrong in your sensor configuration.

Antonio Boix
Associate
Posted on February 14, 2017 at 14:37

Regarding my Arduino Console I meant the UART values through Cool Term for example.

With this configuration when I receive an interrupt (We only receive it when the Z axis is over 1g, so it works perfectly) and therefore by reading the register 0x31 the values I get are the following ones:

01100101

So we have at one the bits:

-Interrupt Active

-Zh

-Yl

-Xl

We were wondering if it is normal that after disabling X and Y for reading and activating only interruption on Zh, the values for Yl and Xl in the register 0x31 are 1. It is just only that, the system is working fine.

Thank you!

Regards,

Toni

Posted on February 14, 2017 at 16:01

The sensor is working fine. The whole INT1_SRC register is updated even if some axis are disabled.