2020-09-22 02:57 AM
Hi,
I'm using a LSM6DSM to detect periods of inactivity and put a MCU to sleep. Similarly, it uses the activity interrupt to wake the MCU. I observed an average current consumption of ~0.7 mA when configured to check for inactivity(Gyro enabled and ODR is 52Hz for accel and gyro). The average current consumption of the LSM6DSM is ~0.38mA after the inactivity interrupt is triggered, even though I've set the Gyro to be powered down.
I've used the STMems Standard C drivers and below is the code snippet I've used to configure the inactivity interrupt:
/* Reset IMU */
lsm6dsm_reset_set(&dev_ctx, PROPERTY_ENABLE);
do
{
lsm6dsm_reset_get(&dev_ctx, &I2C_Response);
}
while (I2C_Response);
/* 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_52Hz);
lsm6dsm_gy_data_rate_set(&dev_ctx, LSM6DSM_GY_ODR_52Hz);
lsm6dsm_xl_power_mode_set(&dev_ctx, LSM6DSM_XL_NORMAL);
lsm6dsm_gy_power_mode_set(&dev_ctx, LSM6DSM_GY_NORMAL);
lsm6dsm_int_notification_set(&dev_ctx, LSM6DSM_INT_LATCHED);
lsm6dsm_wkup_threshold_set(&dev_ctx, 2);
lsm6dsm_act_mode_set(&dev_ctx, 3);
lsm6dsm_act_sleep_dur_set(&dev_ctx, 2);
/* Set Accelerometer Data-Ready Interrupt */
lsm6dsm_pin_int2_route_get(&dev_ctx, &int_2_reg);
int_2_reg.int2_inact_state = PROPERTY_ENABLE;
lsm6dsm_pin_int2_route_set(&dev_ctx, int_2_reg);
I have measured the average current consumption of my circuit with and without the LSM6DSM, so I believe these values to not be caused by the MCU. Is there anything wrong with this code or is there something I'm missing here??
Thanks in advance
2020-09-22 04:06 AM
Hi @GTS.1 ,
I'm not sure you are facing an issue, at least in normal mode. The Table 7 of the AN4987 application note shows the typical values of power consumption for the different operating modes. in the 52 Hz (High Perf.) case, Combo [Acc + Gyro] (at Vdd = 1.8 V), the average current consumption is 650uA, so it is in line with your tested 0.7mA.
So, did you set the INACT_EN bits of the TAP_CFG according to the last configuration?
If so, you may try to leave the interrupt pulsed, I'm wondering if the device is consuming from a parasitic path on INT pin (is your Vdd 1.8V?)
-Eleon
2020-09-22 04:44 AM
Hi @Eleon BORLINI ,
The datasheet mentions that the current consumption for the Accelerometer in Low power mode is 9.5 uA. I believe this should the be the average current consumption when INACT_EN is 3 and the LSM6DSM is checking for activity.
I took a look at the implementation in the STMems Standard C Library and the lsm6dsm_act_mode_set function should set the INACT_EN bits
Also, I commented out the code to set the interrupt to latched and I'm still seeing the same current consumption values.
Thanks
2020-09-24 03:52 AM
Hi @Eleon BORLINI ,
Sorry to ping you again but I'm stuck because of this issue. Any help would be appreciated.
Also, I missed to answer this in my last comment. I did set TAP_CFG to the last configuration. And the VDD is 3V.
Thanks
2020-09-24 04:07 AM
Hi @GTS.1 ,
the device should consume little more when powered at 3V instead of 1.8V, on average. You have to include additional current consumption due to SPI or I2C communication in case you are running data acquisitions, especially if the Vdd and Vdd_IO are tied together. Reducing the SPI / I2C speed, you will reduce the average current consumption. Are you keeping on the data acquisition during the power down?
-Eleon
2020-09-24 04:14 AM
Hi @Eleon BORLINI ,
By data acquisition, I believe you are asking if I'm reading the Accelerometer or Gyroscope output registers. Once the inactivity interrupt is detected, the MCU is put to sleep, so there are no I2C transactions occurring between the MCU and the LSM6DSM once it's powered down.
Are there any official figures on the average current consumption when VDD is 3V?
Thanks
2020-09-24 05:12 AM
Also, does the gyroscope need to be switched on for inactivity interrupt? Does the gyro ODR affect the duration of the inactivity interrupt is set?
I also noticed that I did not receive an inactivity interrupt when I turned off the gyro. I did notice a drastic change in the average current consumption(0.06 mA).
2020-09-24 06:43 AM
Hi @GTS.1 ,
>> Are there any official figures on the average current consumption when VDD is 3V?
From characterization data, I can tell you that the difference is 10/20uA max in Combo mode, so maybe this is not the issue.
>> Also, does the gyroscope need to be switched on for inactivity interrupt?
Unfortunately yes, the gyro ON is needed for the Activity/Inactivity pattern recognition.
>> Does the gyro ODR affect the duration of the inactivity interrupt is set?
When the Inactivity status is detected, the interrupt is set high for 1/ODR_XL[s] period then it is automatically deasserted. So no, only the accelerometer ODR is impacting the interrupt duration.
I would ask you the HW connection of the SDA/SCL I2C lines (and the not-used SPI ones) and their logic values when the MCU is put to sleep: if they are connected to Vdd_IO via pull-up resistors and the MCU's GPIOs are forced to GND, you will have an extra current consumption due to the resulting resistance path. Moreover, if the Vdd /Vdd_IO are managed by the MCU, they may change when the MCU itself is put in sleep condition.
You can also try to set the SLEEP bit of CTRL4_C (13h) register just after the interrupt is detected to check if the power consumption is reducing. This should be the same of setting the Gyro in Sleep mode configuration in the TAP_CFG register.
-Eleon
2020-09-24 10:21 PM
Hi Eleon,
I'm a bit confused with your reply. You mentioned that "Unfortunately yes, the gyro ON is needed for the Activity/Inactivity pattern recognition.". If the gyro is required for Activity/Inactivity, then why does the INACT_EN[1:0] bits provide an option to power down the Gyro? Is the gyro required for detecting the Activity portion of the interrupt, Inactivity portion or does it need to be turned on for the duration that the Activity/Inactivity interrupt is used?
Also, the following line is from the App notes for the LSM6DSM
When the Activity/Inactivity recognition function is activated, the LSM6DSM device is able to automatically
decrease the accelerometer sampling rate to 12.5 Hz, increasing the accelerometer ODR and bandwidth as soon
as the wake-up interrupt event has been detected.
What role does the Wake up interrupt play in Activity/Inactivity interrupt? Does the wake up interrupt need to be configured for the Activity/Inactivity interrupt to work?
Thanks
2020-09-25 06:53 AM
Hi @GTS.1 ,
regarding your first question, the gyro part of the sensor is involved in the Activity to Inactivity pattern detection, and then can be put into sleep mode.
Regarding your second question, the Wake up interrupt is basically the "dual" action of the Activity/Inactivity interrupt: the device is inactive (except from the accelerometer) and configuring the wake up settings (enabling, threshold, duration, etc...) it can be recovered into normal mode.
-Eleon