cancel
Showing results for 
Search instead for 
Did you mean: 

LIS2DW12 activity/inactivity power consumption too high when inactive

FDepr.1
Associate II

Hello,

I am using the LIS2DW12 accelerometer using Zephyr OS.

Driver code is https://github.com/zephyrproject-rtos/zephyr/tree/master/drivers/sensor/lis2dw12

I configured the chip as follow: ODR is 12_5Hz

lis2dw12_reset_set(ctx, PROPERTY_ENABLE);
lis2dw12_reset_get(ctx, &rst);
lis2dw12_block_data_update_set(ctx, PROPERTY_ENABLE);
lis2dw12_full_scale_set(ctx, LIS2DW12_2g);
lis2dw12_power_mode_set(ctx, LIS2DW12_CONT_LOW_PWR_12bit);
lis2dw12_data_rate_set(ctx, LIS2DW12_XL_ODR_12Hz5);
lis2dw12_all_on_int1_set(ctx, 1);
 
 
lis2dw12_act_mode_set(pLis2dw12->ctx, LIS2DW12_DETECT_ACT_INACT);

Where the act_mode_set is

lis2dw12_read_reg(ctx, LIS2DW12_WAKE_UP_THS,(uint8_t*) &wake_up_ths, 1);
lis2dw12_read_reg(ctx, LIS2DW12_WAKE_UP_DUR,(uint8_t*) &wake_up_dur, 1);
wake_up_ths.sleep_on = (uint8_t) val & 0x01U;
lis2dw12_write_reg(ctx, LIS2DW12_WAKE_UP_THS,(uint8_t*) &wake_up_ths, 1);
wake_up_dur.stationary = ((uint8_t)val & 0x02U) >> 1;
lis2dw12_write_reg(ctx, LIS2DW12_WAKE_UP_DUR,(uint8_t*) &wake_up_dur, 1);

I can successfully detect ACTIVITY and INACTIVITY with the following configuration

lis2dw12_filter_path_set(ctx, LIS2DW12_LPF_ON_OUT);
 lis2dw12_filter_bandwidth_set(ctx, LIS2DW12_ODR_DIV_4);
 
lis2dw12_wkup_dur_set(ctx, duration);
lis2dw12_act_sleep_dur_set(ctx, sleep);
lis2dw12_wkup_threshold_set(ctx, wakeup);
lis2dw12_wkup_feed_data_set(ctx, LIS2DW12_HP_FEED);
 
lis2dw12_registerCb(handler, trigger);

However, when the device enters in the INACTIVITY mode, I see power consumption rising from 600uA to 800uA, giving an increase of ~200uA. It should take the It looks like the LP_MODE and MODE of the CTRL1 register are not taken into account. However, when the device is moving (ACTIVITY), the power consumption is going down again.

0693W000007ZGcTQAW.pngI guess something is wrong in the configuration but I cannot find what. Documentation says that if the STATIONARY field is set, the Inactivity and Activity timer are using the values configured by default, but I don't think it is the case, the device seems to be consuming like it is in High Performance.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Hello Eleon,

I now use lis2dw12_int_notification_set(ctx, LIS2DW12_INT_PULSED);

To make sure the interrupt is not latched by setting LIR of CTRL3 to 0.

It did not help the power consumption increase when we are in activity to inactivity state. I do not understand why the pin is always set to 1 in motion (activity). In any case, as the device will be mostly inactive, I prefer to overconsume when it is in motion 🙂

I now use the HP as it seems better 🙂

I just checked and STATUS indicates the correct ODR.

Florian

View solution in original post

13 REPLIES 13
Eleon BORLINI
ST Employee

Hi @FDepr.1​ ,

in the Stationary/Motion recognition case you don't change the ODR and the function mode, so the device will have a similar consumption before and after the interrupt.

It should be different in the case of the Activity/Inactivity recognition... Did you referred to the standard C drivers for ST sensors on Github for your code (for example lis2dw12_activity.c), or to the application note AN5038 p.31?

Since however the consumption is a little high, I would also check the correctness of the board schematic. In particular, how is the SA0 pin connected? By default it is an input with internal pull-up, so if you tied it to GND there could be over-consumption coming from this configuration. As stated in the same app note p.2, unfortunately internal pull-up on SDO/SA0 pin cannot be disabled: do not connect this pin to GND in low-power applications

Can you please check if this is your case?

-Eleon

FDepr.1
Associate II

Hello Eleon,

Thanks for your prompt reply!

I used the references you gave for the code but mostly had a look at the Github.

I just checked and the SDO/SA0 and it is unconnected on the board. I missed that in the documentation. Would it be the root cause of this 200uA difference?

0693W000007ZOF3QAO.pngWhy does this generates only an increase when the accelerometer is not moving (Inactive state)?

Florian

Eleon BORLINI
ST Employee

Hi Florian @FDepr.1​ ,

it should not be the case, since if it is left unconnected it should be pulled high by internal pull-ups.

Which current consumption are you experiencing just after the power on of the LIS2DW12, just to check whether it is a matter of hardware connection or device configuration? Just after the boot the device is in power down and should consume less than 1uA.

Consider also that the CS pin is internally pulled up (datasheet, p.6), so if you are lowering it for the SPI communication you could experience an over-current consumption.

-Eleon

FDepr.1
Associate II

Hello @Eleon BORLINI​ ,

I forgot to add that we are using the I2C mode, not the SPI. The CS is connected to VCC_3V0 so it should always be on.

When we boot the device, consumption is low for 41 seconds (600uA), then the accelerometer enters in INACTIVITY mode and we see this power raise. When I move the device, the power goes back to the expected value.

Florian

Hi Florian,

then you might experience an extra consumption from the pull-up resistors on the I2C lines (that I cannot see in your schematic but that they are mandatory if you use the I2C interface). These resistors have to be connected to the VddIO line (a common value is 10kOhm).

In particular, if your Vdd and VddIO are tied together and you measure the current consumption on the Vdd node, during the I2C commutations you'll see also the current flowing from the VddIO through the pull-up resistors.

Do you experience the overconsumption just after the device startup?

-Eleon

Hello Eleon,

We have 2 pullup resistors of 10kOhm, one on both lines of the I2C which are connected to the VCC_3V0.

When we start, we do not have overconsumption, it seems that the accelerometer is in the ACTIVITY state and after the 41 seconds of INACTIVITY we go back into the INACTIVITY mode and we overconsume.

Florian

Hi Florian,

sorry for my late feedback.

Let me please check if I understood your procedure: you start the device (Vdd ON), you configure the inactivity detection setting the chip in normal mode (i.e. ODR and FS), and ready to receive an inactivity event notification (no stationary configured). The code can be simplified as follows:

1. Write 50h in CTRL1 // Turn on the accelerometer
// ODR = 200 Hz, FS = ±2 g
2. Write 42h in WAKE_UP_DUR // Set duration for inactivity detection
// Set duration for wake-up detection
3. Write 42h in WAKE_UP_THS // Set activity/inactivity threshold
// Enable activity/inactivity detection
4. Write 20h in CTRL4_INT1_PAD_CTRL // Activity (wakeup) interrupt driven to INT1 pin
5. Write 20h in CTRL7 // Enable interrupts

When the inactivity time is over (and you are experiencing overconsumption during this phase), the device gets back to normal mode.

Did you try with enabling the HP filter? Cna you check if you are receiving data at ODR = 12.5Hz during the inactivity phase, to check if you are actually in low power mode?

-Eleon

Hello Eleon,

You can find the content of the register once everything is configured:

ctrl1: 0x30

ctrl2: 0xc

ctrl3: 0x0

ctrl4: 0xe0

ctrl5: 0x20035ac0

ctrl6: 0x40

ctrl7: 0x60

int_dur: 0x0

free_fall: 0x20029c00

Let me know if you need other registers.

Also, we updated ODR from 12.5Hz to 25Hz. But result is the same, consumption is too high in inactivity.

The code is:

    lis2dw12_filter_path_set(ctx, LIS2DW12_LPF_ON_OUT);
    lis2dw12_filter_bandwidth_set(ctx, LIS2DW12_ODR_DIV_4);
 
    /* wake-up duration */
    lis2dw12_wkup_dur_set(ctx, 1);
 
    /* sleep duration */
    lis2dw12_act_sleep_dur_set(ctx, 1);
 
    /* Activity wake-up threshold */
    lis2dw12_wkup_threshold_set(ctx, 6);
 
    /* Data sent to wake-up interrupt function */
    lis2dw12_wkup_feed_data_set(ctx, LIS2DW12_HP_FEED);

I now have only the accelerometer set and have the behavior I described. When the accelerometer detects inactivity,

[00:00:30.082,794] <inf> LIS2DW12: activity handler (Inactivity)
 
<Overconsumption>
 
<Device is moving>
[00:11:27.765,808] <inf> LIS2DW12: activity handler (Wakeup interrupt)
[00:11:28.128,112] <inf> LIS2DW12: activity handler (Wakeup interrupt)
[00:11:28.691,711] <inf> LIS2DW12: activity handler (Wakeup interrupt)
[00:11:29.456,573] <inf> LIS2DW12: activity handler (Activity)
 
<Normal Consumption >
 
[00:11:50.146,209] <inf> LIS2DW12: activity handler (Inactivity)
 
<Overconsumption>

The HP filter is not enabled. Should it be enabled?

I do not get the question: " Cna you check if you are receiving data at ODR = 12.5Hz during the inactivity phase, to check if you are actually in low power mode?". How can I check that? Should I read the registers in the inactivity state ?

Florian

Hello Eleon,

I found part of the issue. It seems that there is a pin set to 1 when the device is inactive and which goes back to 0 when it is in activity.

I updated the pin polarity using   lis2dw12_pin_polarity_set(ctx, 1); which writes into the h_lactive of CTRL3. And now, the inactivity state is not consuming, whereas the activity state is overconsuming the 200ua.

Is there any way to acknowledge the activity state so that it goes back to 0 ?