Skip to main content
Visitor II
February 20, 2017
Question

LIS2DH Accelerometer Interrupts

  • February 20, 2017
  • 5 replies
  • 4342 views
Posted on February 20, 2017 at 17:55

Hi,

I have a problem to make interrupts (INT1 exactly) work with my LIS2DH12 Accelerometer.

What I am trying to do is to make the int1 trigger when there is a Y-axis high event (or low event).

I have setted all the required Registers for INT1 but it seems it is not working and I have even tried to look with an oscilloscope to see if it is doing something, but the results are still negative.

I have read some posts before making this one but the answers weren't helpful for me.

Can someone write down how they setted theirs interrupt registers to make them work correctly?

Some additional information:

1- I don't need the HPCF so I have deactivated it (I think it is deactivated by default, if I remember correctly)

2- The REGs I have changed are: CTRL_REG3, CTRL_REG4, INT1_CFG, INT1_THS, INT1_DUR

3- The temp and XYZ-axis are working correctly

Thank you for the help

#lis2dh

Note: this post was migrated and contained many threaded conversations, some content may be missing.
    This topic has been closed for replies.

    5 replies

    ST Employee
    February 20, 2017
    Posted on February 20, 2017 at 22:10

    Can you please provide your complete sensor settings? I can check it.

    Cesco GarAuthor
    Visitor II
    February 21, 2017
    Posted on February 21, 2017 at 08:24

    The actual settings are like this in my Initialization:

    REG_1     0x7F

    REG_2     0x00

    REG_3     0x40

    REG_4     0x80    (BDU activated for the temperature data)

    REG_5     0x00    

    REG_6     0x00

    REFERENCE     0x00

    INT1_THS     0x0F

    INT1_DUR    0x01

    INT1_CFG    0x04

    And I activate the temperature device, but I think it doesn't influence interrupts. I will write it down in case it is necessary

    ST Employee
    February 21, 2017
    Posted on February 21, 2017 at 10:15

    I don't see any issue in your settings, I replicated it and the interrupt is working fine.

    Can you please check your interrupt connection. I suppose the INT1 pin is connected to some MCU. Can you please check the MCUs pin is configured as input, so there is no collision.

    Cesco GarAuthor
    Visitor II
    February 28, 2017
    Posted on February 28, 2017 at 11:45

    Now I have another problem, the temperature device stopped working without advice, when I ask to it the temeprature data it gives me back 0x00 as H and 0xFF as L. I haven't re-soldered the PCB and i haven't done any modification to the PCB/hardware. I am starting to lose hope....

    Cesco GarAuthor
    Visitor II
    February 22, 2017
    Posted on February 22, 2017 at 09:16

    I have soldered a wire on the MCU (to make sure I don't miss the signal) and the interrupt pin of the PIC is setted as input correctly. I am pretty confused.

    Anyway, thank you in advance for the help

    Cesco GarAuthor
    Visitor II
    March 9, 2017
    Posted on March 09, 2017 at 10:13

    Since we had problems with the INT1 pin, we decided to use the INT2 pin to send interrupts to the PIC. Can you please tell me an INT2 registers configuration of the accelerometer that you are sure it's going to work?

    We need that when we move a little the board where it is soldered the accelerometer, it will trigger the interrupt on the INT2 Pin.

    P.S.: I tested the interrupt routine on the PIC to make sure that it is working when triggered, so now it is only an accelerometer settings problem.

    Thank you very much for the help, I hope that this thread isn't going to be ignored

    ST Employee
    March 10, 2017
    Posted on March 10, 2017 at 10:30

    Please see below configuration of LIS2DH. The registers related to INT2 and Interrupt generator are highlighted.

    Please adjust the threshold and duration parameters according to you needs.

    0690X00000606WqQAI.png

    Here is an example, showing functional interrupts.

    0690X00000606XPQAY.png
    Cesco GarAuthor
    Visitor II
    March 10, 2017
    Posted on March 10, 2017 at 16:32

    Thank you very much, I will try it the sooner I can 

    Visitor II
    May 5, 2017
    Posted on May 05, 2017 at 20:15

    Hi, I have a problem to make interrupts too.

    I tried to write in the registers but my library don't do that. Do you have a program in C that I can copy for to write in the registers?