Skip to main content
Visitor II
June 13, 2017
Question

IIS2DH (DM00171283) Single click detection?

  • June 13, 2017
  • 2 replies
  • 1300 views
Posted on June 13, 2017 at 14:08

I am working with IIS2DH accelorometer an I would like to configure single/double click tap detection. For that, I have done following configuration:

I2C_WriteByte(&ctrl_1,1,0x5F); 

I2C_WriteByte(&ctrl_3,1,0x80);

I2C_WriteByte(&ctrl_6,1,0x82);

I2C_WriteByte(&ctrl_4,1,0x00);

I2C_WriteByte(&int1_config,1,0x00); 

I2C_WriteByte(&ctrl_5,1,0x40);

I2C_WriteByte(&click_config,1,0x15);

I read click source register for single click detection but values are different every time. Also,interrupt flag not set for microcontoller.

Is there any thing need to be wrong in my configuration?

Is any application note for IIS2DH(DM00171283)?

    This topic has been closed for replies.

    2 replies

    ST Employee
    June 29, 2017
    Posted on June 29, 2017 at 10:59

    You configuration is correct, but you have to set also two configuration registers for single click detection (CLICK_THS, TIME_LIMIT).

    If the device is configured for single-click event detection, an interrupt is generated when the input acceleration on the selected channel exceeds the programmed threshold CLICK_THS, and returns below it within a time window defined by the TIME_LIMIT register.

    Visitor II
    June 30, 2017
    Posted on June 30, 2017 at 05:56

    I2C_WriteByte(&ctrl_1,1,0x5F);

    I2C_WriteByte(&ctrl_3,1,0x80);

    I2C_WriteByte(&ctrl_6,1,0x82);

    I2C_WriteByte(&ctrl_4,1,0x00);

    I2C_WriteByte(&int1_config,1,0x00);

    I2C_WriteByte(&ctrl_5,1,0x40);

    I2C_WriteByte(&click_config,1,0x01);//only x axis click enable

    I2C_WriteByte(&time_limit,1,0x05);

    I2C_WriteByte(&click_ths,1,0x0D);

    I have configured above registers and I read click source register continuously but when I click the accelerometer  interrupt is generated and click source values is getting from sensor is  0x09,0x01,0x51 from that value I thought only 0x51 is correct to match with the only X axis enable detection whereas, form the other two values, I had got the interrupt as well. Am I done correct configuration? and I have one more query that in above configuration time_limit and

    click_ths 

    register,I have load with 0x05 and 0x0d that means after how much time and after how much acceleration it generate the interrupt?

    So, could help me on that issue. Thank you for your support.

    ST Employee
    July 18, 2017
    Posted on July 18, 2017 at 12:19

    CLICK_THS ... 1 LSB = full scale/128 (in you case FS = 2g, CLICK_TSH = 0x05 ... 5 * 2g / 128 = 0.078g)

    TIME_LIMIT ... 1 LSB = 1/ODR (in you case ODR = 100Hz, 

    TIME_LIMIT = 0x0D ... 13 * 1 / 100 = 0.13s)

    Concerning the behavior you described, I think the X and Sign bits (values 0x09 or 0x01) in CLICK_SRC register are set immediately when the CLICK_THS is reached and the IA bit (value 0x51 or 0x59) is set if the value returns below it within a time window defined by the TIME_LIMIT register. So the IA bit has latency of TIM_LIMIT time.

    0690X00000607UfQAI.png

    Basically

     you can you can mask other bits in you program and the CLICK using only the IA bit in CLICK_SRC register or use the hardware interrupt signals.

    June 30, 2017
    Posted on June 30, 2017 at 16:40

    Hello,

    I only found this in

    http://www.st.com/content/st_com/en/resource-selector.html

    (can't search for older documents than September 7th, 2015) :

    http://www.st.com/content/ccc/resource/technical/document/application_note/17/c9/44/8d/ff/25/4e/1f/CD001635pdf/files/CD001635pdf/jcr:content/translations/en.CD001635pdf

    And one more discovered by Google

    http://www.st.com/content/ccc/resource/technical/document/application_note/b4/d6/a1/42/8a/d1/4e/05/CD00196pdf/files/CD00196pdf/jcr:content/translations/en.CD00196pdf

    Since the documents seem pretty similar, I would try to read the theory of operation in them.

    Batek.Miroslav

    ‌, is there a similar application note for newer devices?

    David