2020-11-11 02:17 AM
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?
2020-11-12 04:38 AM
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
2020-11-12 11:30 PM
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
2020-11-27 03:56 AM
Regarding this matter, I can report the following additional elements:
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.