Skip to main content
Visitor II
January 4, 2023
Question

Simple procedures to sleep and wake-up lsm6dso

  • January 4, 2023
  • 1 reply
  • 1510 views

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

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    April 6, 2023

    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.