2024-05-23 10:14 PM
Hello,
I am writing a firmware with nrf52832 microcontroller and I have interfaced ST's LSM6DSL module. I am facing some issues regarding power consumption of LSM6DSL module. I have used 10K resistors with sda, scl, sdO and cs pins is this correct.
I am initializing my module below are the commands : using the wake up interrupt with inactivity function enabled to power down gyroscope.
uint32_t app_mpu_int_enable(void)
{
uint32_t err_code;
err_code = nrf_drv_mpu_write_single_register(LSM6DSL_ACC_GYRO_TAP_CFG1, 0xF0);
if(err_code != NRF_SUCCESS) return err_code;
err_code = nrf_drv_mpu_write_single_register(LSM6DSL_ACC_GYRO_WAKE_UP_DUR, 0x00);
if(err_code != NRF_SUCCESS) return err_code;
err_code = nrf_drv_mpu_write_single_register(LSM6DSL_ACC_GYRO_WAKE_UP_THS, 0x30);
if(err_code != NRF_SUCCESS) return err_code;
err_code = nrf_drv_mpu_write_single_register(LSM6DSL_ACC_GYRO_MD1_CFG, 0x20);
if(err_code != NRF_SUCCESS) return err_code;
return NRF_SUCCESS;
}
uint32_t app_mpu_init(void)
{
uint32_t err_code;
uint8_t data;
// Initate TWI or SPI driver dependent on what is defined from the project
err_code = nrf_drv_mpu_init();
if(err_code != NRF_SUCCESS) return err_code;
data = readRegister(LSM6DSL_ACC_GYRO_WHO_AM_I_REG);
NRF_LOG_INFO("0X%02X ", data);
err_code = nrf_drv_mpu_write_single_register(LSM6DSL_ACC_GYRO_CTRL1_XL, 0x30);
if(err_code != NRF_SUCCESS) return err_code;
err_code = nrf_drv_mpu_write_single_register(LSM6DSL_ACC_GYRO_CTRL2_G, 0x30);
if(err_code != NRF_SUCCESS) return err_code;
err_code = nrf_drv_mpu_write_single_register(LSM6DSL_ACC_GYRO_CTRL6_G, 0x10);
if(err_code != NRF_SUCCESS) return err_code;
err_code = nrf_drv_mpu_write_single_register(LSM6DSL_ACC_GYRO_CTRL7_G, 0x80);
if(err_code != NRF_SUCCESS) return err_code;
return NRF_SUCCESS;
}
I am getting a power consumption of 2.2 mA when both accelerometer and gyro are active and when accelerometer is active with ODR 26Hz and gyro power down I am getting a power consumption of 900uA which is very high.
Without LSM6DSL my setup only consumes 3uA in idle condition. But when I connect LSM6DSL to my setup my current consumption raises to 900uA in idle condition. What can be the problem here. please let me know the solution. I choose this product because of its low power consumption when both gryo and accel are power down which is around 3uA. But after using it if the power consumption doesn't go down to 7-12uA in idle, I might reconsider.
Hope to get a quick resolution.
2024-06-04 04:14 AM
@Federica Bossi Need help here. I have tried only accelerometer mode as well the consumption was around 900 uA to 1 mA.
Need your help. How should I take this power consumption to go down.
2024-09-10 01:54 PM - edited 2024-09-11 05:31 AM
I think I have the same problem except I'm using a STM32WB10CC with SPI connection to LSM6DSL. The current consumption seem to be approximately the same. I sent the commands to put it in power mode but the current is still higher than expected.
I tried removing the LSM6DSL from my card and the current values without it seem completely normal.
2024-09-24 07:23 AM
ST helped me solve my problem by telling me that I had to put the SPI pins in pull-up when the STM32WB is in shutdown.
I used the following functions:
- LL_PWR_EnableGPIOPullUp
- LL_PWR_EnablePUPDCfg()
Thank you for the PCB layout. Please note, that it is strongly recommended NOT to place any structure on the top metal layer underneath the sensor.
Did you check if there is defined level on MCU GPIOs connected to sensor inputs when the shutdown mode is entered? In order to avoid an unexpected increase in current consumption of the sensor, the input pins that are not pulled-up/pulled-down must be polarized by the host. As per the documentation for MCU, it looks like SPI is disabled in shutdown mode of MCU. Are the inputs (13, 14) of the sensor floating in the shutdown mode? When CS is at level 1, I2C is enabled and if the pins are floating the sensor might also read unexpected commands from the pins.
It should be possible to set pull-ups on pins for MCU in shutdown mode using following functions (please note, that as per information I was able to find in MCU datasheet, the configuration is
lost when exiting the Shutdown mode):
HAL_PWREx_EnablePullUpPullDownConfig
HAL_PWREx_EnableGPIOPullUp
I hope it will help someone.