Question
LIS3DH Accelerometer interrupt to STM32L151
Posted on August 30, 2013 at 00:22
I am trying to interface LIS3DH Accelerometer over I2C to STM32l151rx series microcontroller , I am able to Read X,Y,Z register content , but i want to use the inbuilt motion detection interrupt feature of LIS3DH ,using INT1 output , here is an example of doing this
http://www.ecnmag.com/articles/2013/04/one-accelerometer-interrupt-pin-both-wakeup-and-non-motion-detection Write 27h into CTRL_REG1; // Turn on the sensor with ODR = 10Hz normal mode. Write 01h into CTRL_REG2; // High-pass filter (HPF) enabled with 0.2Hz cut-off frequency for INT1 (AOI1) interrupt generation only. Write 40h into CTRL_REG3; // ACC AOI1 interrupt signal is routed to INT1 pin. Write 88h into CTRL_REG4; // Full Scale = +/-2 g with BDU and HR bits enabled. Write 00h into CTRL_REG5; // Default value. Interrupt signals on INT1 pin is not latched. Users don’t need to read the INT1_SRC register to clear the interrupt signal. // configurations for wakeup and motionless detection Write 08h into INT1_THS; // Threshold (THS) = 8LSBs * 15.625mg/LSB = 125mg. Write 32h into INT1_DURATION; // Duration = 50LSBs * (1/10Hz) = 5s. Write 95h into INT1_CFG; // Enable XLIE, YLIE and ZLIE interrupt generation, When i do this initialization it does not works , the Interrupt pin from Accelerometer signals at nearly 1hz par second , and not based on motion , but this interrupt even comes when no Initialization is done for Accelerometer , why is it interrupting at 1 Hz by default , while searching on this forum i found this thread ''iNEMO MEMS/STM32 Board
'' where author says '' I have found the solution for this.In the application note CTRL_REG3 is metioned as the register to configure interruppt on INT1 pin but the correct configuration is use CTRL_REG6 bit 7 and bit 6(I2_CLICKen and I2_INT1) will enable tap and double tap interruppts on INT2 pin.(Tip:for tuning increase sampling rate (CTRL-REG1) increase time-limit value).'' Is there really an error in datasheet , and the example given above is wrong ? the above st forum thread talks about Tap Detection , while i want settings for Motion detection interrupt .