cancel
Showing results for 
Search instead for 
Did you mean: 

Detect whether LSM6DS3 is in low-power mode or not, and enable gyro sleep accordingly.

BZaai.1
Associate II

Hi,

I have an LSM6DS3 connected to an ESP32. I can see the INT1_INACT_STATE and INT1_WU interrupts attached to INT1 coming through, and I can read WU_IA and SLEEP_STATE_IA in WAKE_UP_SRC after the interrupts.

However, the SLEEP_STATE_IA interrupt comes whenever the status changes, but I would like to know whether the LSM6DS3 is now inactive or not.

One reason for this is to only recalibrate the Gyro when the LSM6DS3  is inactive.

Another important reason is to toggle the Gyro to sleep mode after inactive state is achieved, and to wake it up again when active.

Is there any way to detect the active/inactive state after the interrupt?

3 REPLIES 3
Eleon BORLINI
ST Employee

Hi @BZaai.1​ ,

you could latch the interrupt by enabling the LIR bit of the TAP_CFG (58h) register, so that when the sleep state event occurs, the interrupt will stay high until the state change is over. The interrupt must be reset by reading the WAKE_UP_SRC register. You can for example check the AN4650 application note at p. 49 for a description of the operation of this bit.

In general, if you can measure it, a good parameter to detect if the LSM6DS3 is in sleep state is to monitor the current consumption.

-Eleon

BZaai.1
Associate II

Hi Eleon,

Thanks for the reply!

As I understand it, the SLEEP_STATE_IA bit is not capable of being latched; only the WU_IA state bit can be latched. Either way, I already detect SLEEP_STATE_IA from the interrupt within an ODR cycle.

The bigger problem is that SLEEP_STATE_IA bit comes on when the IMU goes into sleep state as well as when it comes out of sleep state. Therefore, I do not know when to set the SLEEP_G bit in CTLR4_C. Since the Gyro uses the most power, I would like to set it to sleep when the device is inactive.

Maybe setting the SLEEP_G bit automates this? That is, it might automatically set the Gyro to sleep mode when the IMU goes into sleep state and deactivates it when it becomes active again. That would be great, but it is unclear in the Application Note and Data Sheet. I could test this on a dev board.

Measuring current in an operational device is not ideal, I would say.

Best,

Ben

BZaai.1
Associate II

Regarding this matter, I can report the following additional elements:

  1. I differentiate between a SLEEP_STATE_IA event that means the device has gone to sleep (vs a SLEEP_STATE_IA event that means the device has become active again) by looking at the timing between the SLEEP_STATE_IA event and any surrounding WU_IA events. E.g. if SLEEP_STATE_IA is soon followed by WU_IA, then I assume it is not inactive. Further, if the SLEEP_STATE_IA event is a certain time (the sleep threshold/duration time) after a WU_IA event, this also indicates that the device is now inactive rather than active.
  2. In some of the threads I read that the power consumption of Gyro Sleep mode is almost the same as Power Off. (This might have been for a later device.) I remember that this didn't seem right to me about the LSM6DS3/33. Measuring the current draw (including the current of the Pololu module), I found that XL and Gyro both off drew 22uA. XL at 208Hz measured 45uA (Low Power) and 172uA (Normal), with Gyro off. With Xl off, Gyro at 208Hz drew 500uA (Sleep) vs 930uA (Normal).
  3. In my experiments, XL never went from High Power to Low Power mode. It only ever automatically transitioned from Normal Power (208Hz) to Low Power (12.5Hz).

I hope this helps others struggling with the same stuff. Hopefully, I'm doing things wrong and ST can advise me, but for the moment I am working around these limitations.