cancel
Showing results for 
Search instead for 
Did you mean: 

Simple procedures to sleep and wake-up lsm6dso

LClad.1
Associate II

Hi, I'm trying to implement sleep and wake-up function in my project. I read the AN5192 Interrupt generation, but doesn't work.

My project use nrf52832 with I2C and init my gyroscope/accelerometer following the procedure below:

 write_register(LSM6DS0_CTRL1_XL, 0x60);      // Turn on the accelerometer 

 write_register(LSM6DS0_CTRL2_G, 0x4C);       // Turn on the gyroscope   

 write_register(LSM6DS0_CTRL8_XL, 0x09);       // Enable slope filter

My function to sleep:

void imu_power_down()

{

 write_register(LSM6DS0_CTRL2_G, 0x00);

 write_register(LSM6DS0_CTRL1_XL, 0x00);

}

My function to wake-up

void imu_wake_up_interrupt()

 write_register(LSM6DS0_WAKE_UP_DUR, 0x00);

 write_register(LSM6DS0_WAKE_UP_THS, 0x02);

 write_register(LSM6DS0_TAP_CFG0, 0x51);

 write_register(LSM6DS0_TAP_CFG2, 0x80);

 write_register(LSM6DS0_CTRL1_XL, 0x70);

 nrf_delay_ms(4);

 write_register(LSM6DS0_CTRL1_XL, 0x10);

 write_register(LSM6DS0_MD1_CFG, 0x20);

}

Could someone help me with these functions

Regards

Laerte

1 REPLY 1
Federica Bossi
ST Employee

Hi @LClad.1​ ,

Sorry for late reply. Your functions are correct, in the meanwhile did you figure out where the problem is?

Have you been able to read the XL and Gyro data after switching on the device?

If not the problem might be the communication with the device itself and not in the procedure.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.