AnsweredAssumed Answered

LIS3DH click and double click configuration

Question asked by sri on Jul 5, 2012
Latest reply on Nov 7, 2012 by nazuhin
LIS3DH click/tap detection
Hi,
    I have a problem with configuration and stuff of LIS3DH nano accelerometer.
I am trying to configure LIS3DH for tap (also double tap) detection.In the process
I have configured as below
//-------------------------------------------------------------------------------
    // Enable the LIS3DH by writing to CTRL_REG1.
    // * Settings for CTRL_REG1
    // ODR = 10Hz ; LPEn = 0; Zen = Yen = Xen = 1
    Buffer[0] = CTRL_REG1;
    Buffer[1] = 0x27;
    I2CWrite( LIS3DH_ADDR , Buffer, 2 );

    // Settings for CTRL_REG2:
    // defaults

    // Settings for CTRL_REG3
    // CLICK interrupt on INT1
    Buffer[0] = CTRL_REG3;
    Buffer[1] = 0x80;
    I2CWrite( LIS3DH_ADDR , Buffer, 2 );

    // Settings for CTRL_REG4:
    //            ----------------------------------------------------------------------------------------
    //CTRL_REG4|  7            6            5            4            3            2            1            0  |
    //         |  BDU       BLE          FS1            FS2            HR          ST1         ST0            SIM|
    //          ----------------------------------------------------------------------------------------
    // FS1:FS2 -->g'range selection 00-->2g;01-->4g;10-->8g;11-->16g:
    // HR = 1  --> high resolution
    // SIM     -->if ==1 serial interface mode is selected(SPI)
    Buffer[0] = CTRL_REG4;
    Buffer[1] = 0x18;
    I2CWrite( LIS3DH_ADDR , Buffer, 2 );

    // Settings for CTRL_REG5:
    //            ----------------------------------------------------------------------------------------
    //CTRL_REG5|  7            6            5            4            3            2            1            0  |
    //         |  BOOT      FIFO_EN      --            --            LIR_INT1    D4D_INT1    0            0  |
    //          ----------------------------------------------------------------------------------------
    Buffer[0] = CTRL_REG5;                    //NOTES: Setting LIR_INT1 bit will make interruppt bit high
    Buffer[1] = 0x08;                        //       Till CLICK_SRC is read.
    I2CWrite( LIS3DH_ADDR , Buffer, 2 );

//---TESTING CLICK WITH CTRL_REG_6:
    // Settings for CTRL_REG6:
    //           ---------------------------------------------------------------------------------------------
    //CTRL_REG6|  7            | 6            | 5            | 4            | 3            | 2            | 1              | 0  |
    //         | I2_CLICKen | I2_INT1      | 0            | BOOT_I1   | 0            |           | H_L-ACTIVE  |    -- |
    //         ---------------------------------------------------------------------------------------------
    Buffer[0] = CTRL_REG6;                    //NOTES: Setting LIR_INT1 bit will make interruppt bit high
    Buffer[1] = 0xC0;                        //       Till CLICK_SRC is read.
    I2CWrite( LIS3DH_ADDR , Buffer, 2 );


    // Settings for INT1_CFG
    // defaults

    // Settings for INT1_THS
    // defaults

    // Settings for INT1_DUR
    // Defaults

    //            ----------------------------------------------------------------------------------------
    //CLICK_CFG|  7            6            5            4            3            2            1            0  |
    //         |  --        --            ZD(DOUB)    ZS(SING)    YD            YS            XD            XS |
    //          ----------------------------------------------------------------------------------------
    Buffer[0] = CLICK_CFG;
    Buffer[1] = 0x01;
    I2CWrite( LIS3DH_ADDR , Buffer, 2 );

    //CLICK_THS
    //Threshold for click detection (arbitary value)  1LSb = fullscale/128
    Buffer[0] = CLICK_THS;
    Buffer[1] = 0x03;
    I2CWrite( LIS3DH_ADDR , Buffer, 2 );

    //TIME_LIMIT
    //Time limit a short time frame where in which click is recognised when
    //                1.corresponding value in that axis exceeds threshold
    //and            2.comes below threshold.
    // To get detected both should happen in this time limit.
    Buffer[0] = TIME_LIMIT;
    Buffer[1] = 0x33;
    I2CWrite( LIS3DH_ADDR , Buffer, 2 );

    Buffer[0] = TIME_LATENCY;
    Buffer[1] = 0xFF;
    I2CWrite( LIS3DH_ADDR , Buffer, 2 );
//-------------------------------------------------------------------------------
The problem, there were no interrupts generated and when I checked CLICK_SRC register it is always giving me 0x00111001.I can understand bit 6 is 0 as there are no interruppts [bit6-->IA]  but why double click and signe click interruppts aloung with low edge detection sign bits were set.
It looks like there is a problem with some configuration bits I made.Please help me in this issue.
   Thanksl in advance.
--Sri.

Outcomes