cancel
Showing results for 
Search instead for 
Did you mean: 

I would like help setting up interrupts on ISM330DLC or LSM6DSM - details below, Thank you!

CHarr.1
Associate II

I am trying to set up interrupt driven reading of X Y Z accelerations and X,Y and Z Gyro data on an ISM330DLCLSM6DSM.  The plan is to generate an active high signal on INT2 when data becomes available as signalled by INT2_DRDY_XL (BIT0) of INT2_CTRL going high. The subsequent low to high voltage transition on the INT2 pad should then wake up an external microprocessor to process the sensor data.

Unfortunately my microprocessor never sees the interrupt so it never wakes up.

I am reasonably confident the microprocessor hardware is OK – I got your polling example (p26 of AN5125) to work fine.

I suspect there may be something missing from my register workflow. - see below

Would you have a look at my attempt which I have set out below, please?

REGISTER SET UP

System power up – wait 1 second

//Set up accelerometer ODR = 26Hz, low power and accel full scale

CTRL1_XL = 0x24

CTRL6_C = 0x10

//Set up gyro ODR = 26Hz, low power and gyro full scale

CTRL2_G = 0x24

CTRL7_G = 0x80

//Set up accelerometer data ready signal to appear on INT2 pad

INT2_CTRL = 0x01

//set up DRDY signal latched mode

DRDY_PULSE_CFG = 0x00

//set up BOOT normal, Block Data Update ON, H_LACTIVE active high, PUSH PULL, SIM 4wire //spi, IF INC on, BLE-LSB @lower address.

CTRL3_C = 0x44

//enable TIMESTAMP COUNT

CTRL10_C = 0x20

1 REPLY 1
Eleon BORLINI
ST Employee

Hi @CHarr.1​ ,

I would suggest you to consider the examples on Github for the LSM6DSM device, that show the configuration of the device for different applications.

  /* Enable Block Data Update */
  lsm6dsm_block_data_update_set(&dev_ctx, PROPERTY_ENABLE);
 
  /* Set full scale */
  lsm6dsm_xl_full_scale_set(&dev_ctx, LSM6DSM_2g);
  lsm6dsm_gy_full_scale_set(&dev_ctx, LSM6DSM_2000dps);
 
  /* Set Output Data Rate */
  lsm6dsm_xl_data_rate_set(&dev_ctx, LSM6DSM_XL_ODR_12Hz5);
  lsm6dsm_gy_data_rate_set(&dev_ctx, LSM6DSM_GY_ODR_12Hz5);
 
  /* Enable drdy 75 μs pulse: uncomment if interrupt must be pulsed */
  //lsm6dsm_data_ready_mode_set(&dev_ctx, LSM6DSM_DRDY_PULSED);
 
  /* Enable interrupt generation on DRDY INT2 pin */
  lsm6dsm_pin_int2_route_get(&dev_ctx, &int_2_reg);
  int_2_reg.int2_drdy_g = PROPERTY_ENABLE;
  int_2_reg.int2_drdy_xl = PROPERTY_ENABLE;
  lsm6dsm_pin_int2_route_set(&dev_ctx, int_2_reg);
  • You could also consider to using the wake-up embedded function to start your MCU operation (app note AN4987, p.21): for this interrupt management, you can check the lsm6dsm_wake_up.c

Please let me know if it can be of your help.

-Eleon