Skip to main content
RPinh
Associate
Aug 27, 2019 11:15 AM UTC
Solved

LSM6DSL AWT latency problem

Hi,

I'm trying to configure the AWT function in the LSM6DSL. All works fine minus the latency. I change the latency to 0x01(40ms) but the interrupts keep with a delay of 600ms(default) between each one. Any idea what I'm doing wrong?

Accelerometer band width : 100Hz

Accelerometer range : 2g

Accelerometer sample rate : 26Hz

Gyro Disabled

Configuration Reference: https://www.st.com/content/ccc/resource/technical/document/application_note/group0/26/07/3f/bf/12/55/47/62/DM00402563/files/DM00402563.pdf/jcr:content/translations/en.DM00402563.pdf - page 56

Configuration code:

// Enable access to embedded registers (bank B)
 // Write A0h to FUNC_CFG_ACCESS
 ret = writeRegister(LSM6DSL_ACC_GYRO_FUNC_CFG_ACCESS, LSM6DS3_ACC_GYRO_FUNC_CFG_ENABLED_B);
 if (ret != IMU_SUCCESS)
 return ret;
 
 // Set latency
 ret = writeRegister(LSM6DS3_ACC_GYRO_A_WRIST_TILT_LAT, lat);
 if (ret != IMU_SUCCESS)
 return ret;
 
 // Set threshold
 ret = writeRegister(LSM6DS3_ACC_GYRO_A_WRIST_TILT_THS, ths);
 if (ret != IMU_SUCCESS)
 return ret;
 
 // Set mask
 ret = writeRegister(LSM6DS3_ACC_GYRO_A_WRIST_TILT_MASK, mask);
 if (ret != IMU_SUCCESS)
 return ret;
 
 // Disable access to embedded registers (bank B)
 ret = writeRegister(LSM6DSL_ACC_GYRO_FUNC_CFG_ACCESS, LSM6DS3_ACC_GYRO_FUNC_CFG_DISABLED);
 if (ret != IMU_SUCCESS)
 return ret;
 
 // Enable embedded functions
 // Enable AWT detection
 // Write 84h to CTRL10_C
 //writeRegister(LSM6DS3_ACC_GYRO_CTRL10_C, LSM6DS3_ACC_GYRO_WRIST_TILT_EN_ENABLED);
 ret = writeRegister(LSM6DS3_ACC_GYRO_CTRL10_C, 0x84);
 if (ret != IMU_SUCCESS)
 return ret;
 
 // AWT interrupt driven to the INT2 pin
 // Write 01h to DRDY_PULSE_CFG
 ret = writeRegister(LSM6DS3_ACC_GYRO_DRDY_PULSE_CFG, 0x01);
 if (ret != IMU_SUCCESS)
 return ret;
 
 // Enable latched mode
 readRegister(LSM6DS3_ACC_GYRO_TAP_CFG1, &buf);
 if (ret != IMU_SUCCESS)
 return ret;
 ret = writeRegister(LSM6DS3_ACC_GYRO_TAP_CFG1, (buf | LSM6DS3_ACC_GYRO_LIR_ENABLED));
#define LSM6DSL_ACC_GYRO_FUNC_CFG_ACCESS 0x01
#define LSM6DS3_ACC_GYRO_DRDY_PULSE_CFG 0x0B
#define LSM6DS3_ACC_GYRO_CTRL10_C 0x19
#define LSM6DS3_ACC_GYRO_TAP_CFG1 0x58
 
 
 
/**** Embedded functions register mapping - Bank B *******/
#define LSM6DS3_ACC_GYRO_A_WRIST_TILT_LAT 0x50
#define LSM6DS3_ACC_GYRO_A_WRIST_TILT_THS 0x54
#define LSM6DS3_ACC_GYRO_A_WRIST_TILT_MASK 0x59
 
#define LSM6DS3_ACC_GYRO_FUNC_CFG_ENABLED_B 0xA0
#define LSM6DS3_ACC_GYRO_FUNC_CFG_DISABLED 0x00
 
#define LSM6DS3_ACC_GYRO_LIR_ENABLED 0x01

Best regards.

This topic has been closed for replies.
RPinh
RPinhBest answer
Associate
Aug 29, 2019 1:01 PM UTC

Hi,

Found the problem. The problem was that the pin of the INT2 in the MCU have debounce timeout.

Best regards.

2 replies

RPinh
RPinhAuthor
Associate
Aug 28, 2019 4:56 PM UTC

What registers do I have to change to decrease the reaction time of the INT2? With this configuration, I have a reaction time of approximately 600ms(When I receive an interrupt in the MCU I read the FUNC_SRC2 to clean the interrupt). I need a reaction time of approximately 100ms. Is possible?

RPinh
RPinhAuthorBest answer
Associate
Aug 29, 2019 1:01 PM UTC

Hi,

Found the problem. The problem was that the pin of the INT2 in the MCU have debounce timeout.

Best regards.