cancel
Showing results for 
Search instead for 
Did you mean: 

LSM303AGR INT1 / INT2 unable to make it work

David LR
Associate II
Posted on June 26, 2018 at 18:17

After properly setting up i2c with my choice MCU, INT1 is never fired. (I have tested with logic analyzer and INT1 pin is always low, and its configured as active high) 

lsm303agr_xl_block_data_update_set(&dev_ctx_xl, PROPERTY_ENABLE);

lsm303agr_xl_data_rate_set(&dev_ctx_xl, LSM303AGR_XL_ODR_10Hz);

lsm303agr_xl_full_scale_set(&dev_ctx_xl, LSM303AGR_2g);

lsm303agr_xl_operating_mode_set(&dev_ctx_xl, LSM303AGR_LP_8bit);

lsm303agr_write_reg(&dev_ctx_xl, LSM303AGR_CTRL_REG1_A, (uint8_t*) 0x97, 1);

lsm303agr_write_reg(&dev_ctx_xl, LSM303AGR_CTRL_REG3_A, (uint8_t*) 0x60, 1);

lsm303agr_write_reg(&dev_ctx_xl, LSM303AGR_CTRL_REG6_A, (uint8_t*) 0x02, 1);

lsm303agr_write_reg(&dev_ctx_xl, LSM303AGR_CTRL_REG5_A, (uint8_t*) 0x00, 1);

lsm303agr_write_reg(&dev_ctx_xl, LSM303AGR_INT1_CFG_A, (uint8_t*) 0x2A, 1);

lsm303agr_write_reg(&dev_ctx_xl, LSM303AGR_INT1_THS_A, (uint8_t*) 0x64, 1);

lsm303agr_write_reg(&dev_ctx_xl, LSM303AGR_INT1_DURATION_A, (uint8_t*) 0x01, 1);

lsm303agr_xl_high_pass_int_conf_set(&dev_ctx_xl, LSM303AGR_DISC_FROM_INT_GENERATOR);

With ST standard C drivers, I can set up registers and read back checking it have the correct values.

So my question is, There is any workflow diagram on how to properly set up INT1 after a threshold in movements?

I have tested all possible combinations on interrupt sources (AOI, X/Y/Z Higher than, X/Y/Z lower than...) and INT1 is always low. Interrupts are enabled and not latched. No filter, high frequency filter set, threshold set/ not set.... 

I am not reading the discrete values of XL or MAG axis, only trying to interrupt, so its possible the LSM303AGR is in some low power and not firing it up if I dont read the axis values? Can it be a wrong set up of high frequency filter to eliminate gravity and static accelerations??

I have tested at this point a A LOT of configurations without any result. At las instance, do you guys have any working piece of code with registers configuration that make INT1 interrupt fire, just to debug and trying to figure what I am doing wrong.

Thanks a lot!!

4 REPLIES 4
David LR
Associate II
Posted on June 26, 2018 at 18:48

lsm303agr_xl_block_data_update_set(&dev_ctx_xl, PROPERTY_ENABLE);

lsm303agr_xl_data_rate_set(&dev_ctx_xl, LSM303AGR_XL_ODR_10Hz);

lsm303agr_xl_full_scale_set(&dev_ctx_xl, LSM303AGR_2g);

lsm303agr_xl_operating_mode_set(&dev_ctx_xl, LSM303AGR_LP_8bit);

lsm303agr_write_reg(&dev_ctx_xl, LSM303AGR_CTRL_REG1_A, (uint8_t*) 0x97, 1);

lsm303agr_write_reg(&dev_ctx_xl, LSM303AGR_CTRL_REG3_A, (uint8_t*) 0x60, 1);

lsm303agr_write_reg(&dev_ctx_xl, LSM303AGR_CTRL_REG6_A, (uint8_t*) 0x02, 1);

lsm303agr_write_reg(&dev_ctx_xl, LSM303AGR_CTRL_REG5_A, (uint8_t*) 0x00, 1);

lsm303agr_write_reg(&dev_ctx_xl, LSM303AGR_INT1_CFG_A, (uint8_t*) 0x2A, 1);

lsm303agr_write_reg(&dev_ctx_xl, LSM303AGR_INT1_THS_A, (uint8_t*) 0x64, 1);

lsm303agr_write_reg(&dev_ctx_xl, LSM303AGR_INT1_DURATION_A, (uint8_t*) 0x01, 1);

lsm303agr_xl_high_pass_int_conf_set(&dev_ctx_xl, LSM303AGR_DISC_FROM_INT_GENERATOR);

For example the configuration above does not work

Posted on July 09, 2018 at 15:11

Even if I don't know why you mix the high level function with direct register access, you configuration seems OK to me.

I'm able to get the interrupt from the device with you configuration, if I share with the board.

0690X0000060LhdQAE.png

Is your INT pin connected to a MCU? If so is the GPIO configured as input? Are you sure that MCU or other device don't force the line low?

Posted on July 10, 2018 at 10:17

It is possible to use the Unico GUI with x-NUCLEO-IKS01A2??  that options seem very handy to debug the register configuration.

Thank you is working now, for some reason the high pass filter was disabled and the interrupt was triggered forever so the MCU was not counting interrupts.

Posted on July 13, 2018 at 11:17

Unfortunately not Unico GUI doesn't support X-NUCLEO-IKS01A2.

You can use

https://my.st.com/content/my_st_com/en/products/embedded-software/evaluation-tool-software/unicleo-gui.license=1531464846285.html

 with

https://my.st.com/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-mems1.html

software package but the so far the sensor configuration features are limited.