Skip to main content
Visitor II
December 5, 2017
Question

LIS2DH not driving INT2 pin

  • December 5, 2017
  • 2 replies
  • 1240 views
Posted on December 05, 2017 at 13:15

hi,

I'm trying to program a LIS2DH via I2C, with a stm32l151rb. I'm interested in the activity mode, in order to wake up the stm32l1 using the INT2 pin connected to one micro's wake-up pin.

my configuration is:

/*CTRL_REG1*/ 0x29, //0b0010 1001 ODR@10Hz, LowPower mode enabled, Z disabled, Y disabled, X enabled, should drain 3uA

/*CTRL_REG2*/ 0x00, 

/*CTRL_REG3*/ 0x00, //disable all INT1 interrupts

/*CTRL_REG4*/ 0x10, //0b0001 0000 FS = +/- 4G, self test disabled

/*CTRL_REG5*/ 0x00, //do not latch

/*CTRL_REG6*/ 0x08, //0b0000 1000 enable activity interrupt on INT2

/*REFERENCE*/ 0x00, //was 0x1e

/*INT2_CFG*/ 0x02, //0b0000 0010 enable INT2 interrupt generation on X high events

/*INT2_THS*/ 0x20,

/*INT2_DUR*/ 0x10,

/*ACT_THS*/ 0x21, //0x1e = 1000mG (9.81 m/s^2)@4G FS refer to table 84 (pg.48) of datasheet

/*ACT_DUR*/ 0x14}; //0x01 = ~1 sec (900msec) refer to table 86 (pg.48) of datasheet

INT2_THS and INT2_DUR are set as ACT regs just for debug.

I'm reading (for debug) the OUT_X/Y/Z_H regs and they behave meaningfully, just as INT2_SRC as I get a 0x16 whenever the X-axis exceeds the threshold. However, the IA, as the INT2 pin, is always low.

what configuration am I missing?

#lis2dh #activity #int2
    This topic has been closed for replies.

    2 replies

    ST Employee
    December 5, 2017
    Posted on December 05, 2017 at 15:01

    I think, you are mixing two features:

    - interrupt generator 2 which is configured by INT2_CFG, INT2_THS, INT2_DUR registers

    - activity/inactivity detection, configured by ACT_THS, ACT_DUR registers

    Activity/Inactivity detection is able to detect if the device is still and automatically reduce the ODR to 10 Hz and so reduce power consumption. But because you are using ODR 10Hz as default configuration the activity/inactivity feature is useless for you in this case. The status of acitivity/inactivity feature is linked to INT2 by settings CTRL_REG6 = 0x08, and it is functional (I have validated it).

    You configuration of interrupt generator 2 set the threshold to 1000mg and duration 1.6s so to trigger the interrupt you need to generate acceleration higher than 1g in X axis for more than 1.6s. 1g can be a problem, maybe you should reduce it to 0.8g for example. Than you should see that the IA bit in INT1_SRC is set. To link the status of interrupt generator 2 to INT2 pin you should set the CTRL_REG6 to 0x20.

    Visitor II
    December 5, 2017
    Posted on December 05, 2017 at 16:23

    thanks Miroslav for your quick response,

    as I said, many of the configurations are kept for debug, but I sense from your reply that these conflict with each other, don't they actually?

    For what concerns che interrupt generations, are you sure that the interrupt is triggered after 1.6 secs? as per 

    http://www.st.com/content/ccc/resource/technical/document/application_note/group0/55/ef/e4/9f/d1/e9/46/2c/DM00365457/files/DM00365457.pdf/jcr:content/translations/en.DM00365457.pdf

    , page 53, the interrupt should be triggered instantly after passing the threshold and not after the duration, which instead happens on return-to-sleep.

    I shall make some tests in the direction you pointed out and get back to you. Thank you very much in the meantime.

    Visitor II
    December 11, 2017
    Posted on December 11, 2017 at 17:39

    turned out that Gravity LIS2DH kit has wrong labels on it. they just inverted INT1 & INT2!!

    I got to it by seeing that INT2_SRC was moving correctly while the pin didn't.

    thanks ​ for the big help on the topic, toby exlaining the correct use of INT2.