cancel
Showing results for 
Search instead for 
Did you mean: 

lsm6dsl int1

Ephraim Oved
Associate

Dear Sir.

I work with LSM6DSL with SPI bus ,

The wiring are OK , I can read the register who_am_i.

I can't makie the INT1 to work.

Attached a code

int32_t lsm6dsl_orienation_config(void)

{

  int32_t ret = true;

  unsigned char z;

//  lsm6dsl_gy_full_scale_set(LSM6DSL_2g);

  z = 0x60;

  lsm6dsl_write_reg(LSM6DSL_CTRL1_XL, (uint8_t*)&z, 2);

   /* Enable Interrupts TAP_CFG */

  z = 0x80;

  lsm6dsl_write_reg(LSM6DSL_TAP_CFG , (uint8_t*)&z, 2);

//  /* Enable 6D threshold. TAP_THS_6D */

  z = 0x50; //50 deg.

  lsm6dsl_write_reg(LSM6DSL_TAP_THS_6D , (uint8_t*)&z, 2);

//  /* Enable LP2F filter. CTRL8_XL */

  z = 0x01;

  lsm6dsl_write_reg(LSM6DSL_CTRL8_XL , (uint8_t*)&z, 2);

//  /* 6D interrupt driver on Int1 */

  z = 0x04;

  lsm6dsl_write_reg(LSM6DSL_MD1_CFG , (uint8_t*)&z, 2);

  return ret;

}

Please Advise

1 REPLY 1
Eleon BORLINI
ST Employee

Hi @Community member​ ,

The procedure looks overall ok, according to the AN5040 application note p.40...

Please note however that this line:

/* Enable 6D threshold. TAP_THS_6D */
  z = 0x50; //50 deg.
  lsm6dsl_write_reg(LSM6DSL_TAP_THS_6D , (uint8_t*)&z, 2);

is writing a value out of range, since you should write 0x60 to have the 50deg threshold (b01100000).

Check also D6D_SRC (1Dh) register (datasheet p. 71) if you are still facing issues.

I suggest you to also check the lsm6dsm_orientation.c sample C code for the interrupt management.

Please note also that the name of your function is "orienation", in case you are facing misspelling issues.

-Eleon