Skip to main content
Visitor II
August 7, 2022
Solved

LSM303AGR INT pin not firing

  • August 7, 2022
  • 4 replies
  • 1417 views

Hi,

I am using nordic MCU to operate LSM303AGR magnetometer device. 

My goal is to get a Z-axis interrupt upon crossing the pre-calibrated threshold.

The i2c write and reads are working fine.

INT bit of register 64h (INT_SOURCE_REG_M) is responding when getting a magnet nearby (when polling this register), yet the interrupt pin stays low all the time (verified with a logic analyzer).

MCU pin is configured as input without pullup.

The following register writes are being performed by the firmware:

1. Write 00h in CFG_REG_A_M // Turn on the magnetometer // ODR = 10 Hz 

2. Write 40h in CFG_REG_C_M // Interrupt driven on INT_MAG/DRDY pin 

3. Write 80h in INT_THS_L_REG_M // Set a threshold equal to 128 (expressed in LSB) 

  Write 00h in INT_THS_H_REG_M 

4. Write E7h in INT_CTRL_REG_M // Enable a latched active-high interrupt on the three axes

We tried to set the INT_CTRL_REG_M to 0x25 and the CFG_REG_C_M to 0x41 and still no change in the pin reading.

Can you please help me understand what am i doing wrong?

Regards,

Gil

    This topic has been closed for replies.
    Best answer by GFone

    Hi Eleon,

    The INT pin is now working perfectly. It was a badly soldered hardware pin.

    Thank you for your assistance

    Gil

    4 replies

    ST Employee
    August 12, 2022

    Hi Gil @GFone​ ,

    so, basically the device is recognizing the threshold crossing, but the interrupt is not correctly driven on the INT pin, right? The sequence looks good indeed... You might try to set the interrupt to pulse (E5h in INT_CTRL_REG_M), or to enable also the accelerometer interrupt (in the INT1_SRC_A (31h) register).

    -Eleon

    GFoneAuthor
    Visitor II
    August 14, 2022

    Hi Eleon,

    In order to eliminate out the cause of faulty hardware (in our customized board) we moved back to Nordic's nRF52840 DK and LSM303AGR adafruit breakout board.

    It seems that the INT pin is now working fine with the following ב�?מכןעורש�?ן�?מ:

    CFG_REG_A_M - 0x00

    CFG_REG_C_M - 0x41

    INT_THS_L_REG_M -0xff

    INT_THS_H_REG_M -0x00

    INT_CTRL_REG_M -0x25

    We are still investigating it, i\ll keep you posted

    Regards,

    Gil

    ST Employee
    August 16, 2022

    Hi Gil @GFone​ ,

    thank you for the update and for sharing the investigation so far.

    -Eleon

    GFoneAuthorAnswer
    Visitor II
    August 16, 2022

    Hi Eleon,

    The INT pin is now working perfectly. It was a badly soldered hardware pin.

    Thank you for your assistance

    Gil