cancel
Showing results for 
Search instead for 
Did you mean: 

Unexpected current consumption from LSM303D

looeyc
Associate II
Posted on February 04, 2017 at 03:36

Hi,

   We are developing a ultra low power sensor module with the LSM303D. The LSM303D was periodically waken up to take a  magnetic and temperature measure (no acceleration measurment). The total excepted average current is <100uA, but the acture current is >300uA which was unacceptable.

   The following picture was snapped from the oscilloscope measuring the module's current. The narrow pulse current were caused by the module's periodically magnetic and temperature measuring activity. But the ramp shape pulses were unexpected. Sicne these ramp-pulse lasts for hundreds of miniseconds each, the total current was dramatically increased.

   The questions is:

   Are these ramp-pules current normal for the LSM303D?

0690X00000603MmQAI.jpg

   The following source code is for the periodically measuring:

int8 fLSM_TakeOneMeasure(int16 *pAccXYZ, int16 *pMagXYZ, int16 *pTemp)

{

  int8 rt;

  uint8 RegVal;

 

   //Unsupported, no acc measurment

  if(pAccXYZ!=NULL){

    return -1;

  }

  if((pMagXYZ!=NULL)||(pTemp!=NULL)){

    //Config

    //CTRL1

    RegVal=0x08;

      //AODR: 0000    (Acceleration data-rate selection: 0000: Power-down mode)

      //BDU: 1        (Block data update for acceleration and magnetic data: 0: continuous update; 1: output registers not updated until MSB and LSB have been read)

      //AZEN: 0       (Acceleration Z-axis enable: 0: disabled; 1: enabled)

      //AYEN: 0       (Acceleration Y-axis enable: 0: disabled; 1: enabled)

      //AXEN: 0       (Acceleration X-axis enable: 0: disabled; 1: enabled)

    rt=fLSM_WriteReg(LSM_CTRL1,RegVal);

    if(rt!=0){return 2;}

    

    //CTRL5

    RegVal=0xE0;

      //TEMP_EN: 1  (Temperature sensor enabled.)

      //M_RES: 11   (Magnetic resolution: 00: low resolution, 11: high resolution)

      //M_ODR: 000  (Magnetic data rate: 000-3.125 Hz�?110-Do not use)

      //LIR2: 0     (Latch interrupt request on INT2_SRC register: not latched)

      //LIR1: 0     (Latch interrupt request on INT1_SRC register: not latched)

    rt=fLSM_WriteReg(LSM_CTRL5,RegVal);

    if(rt!=0){return 2;}

    //CTRL7

    RegVal=0x00;

      //AHPM: 00    (High-pass filter mode selection for acceleration data: Normal mode)

      //AFDS: 0     (Filtered acceleration data selection: internal filter bypassed)

      //T_ONLY: 0   (Temperature sensor only mode: OFF  )

      //Rsv: 0

      //MLP: 0      (Magnetic data low-power mode: 0-OFF�?1-ON)

      //MD: 01      (Magnetic sensor mode: 00-Continuous�?01-Single�?10-Powerdown�?11-Powerdown)

    rt=fLSM_WriteReg(LSM_CTRL7,RegVal);

    if(rt!=0){return 2;}

    

    //Read

    if(pMagXYZ!=NULL){

      //Readout

      while(1){

        RegVal=fLSM_ReadReg(LSM_STATUS_M);

        if((RegVal&0x0F)==((uint8)0x0F)){

          break;

        }

        SLEEP(1);

      }

      //x

      RegVal=fLSM_ReadReg(LSM_OUT_X_H_M);

      pMagXYZ[0]=RegVal;pMagXYZ[0]<<=8;

      RegVal=fLSM_ReadReg(LSM_OUT_X_L_M);

      pMagXYZ[0]|=RegVal;

      //y

      RegVal=fLSM_ReadReg(LSM_OUT_Y_H_M);

      pMagXYZ[1]=RegVal;pMagXYZ[1]<<=8;

      RegVal=fLSM_ReadReg(LSM_OUT_Y_L_M);

      pMagXYZ[1]|=RegVal;

      //z

      RegVal=fLSM_ReadReg(LSM_OUT_Z_H_M);

      pMagXYZ[2]=RegVal;pMagXYZ[2]<<=8;

      RegVal=fLSM_ReadReg(LSM_OUT_Z_L_M);

      pMagXYZ[2]|=RegVal;

    }

    

    if(pTemp!=NULL){

      RegVal=fLSM_ReadReg(LSM_TEMP_OUT_H);

      *pTemp=RegVal;*pTemp=(*pTemp)<<8;

      RegVal=fLSM_ReadReg(LSM_TEMP_OUT_L);

      *pTemp=(*pTemp)|RegVal;

    }

    

    //Shutdown

    //CTRL7

    RegVal=0x02;

      //AHPM: 00    (High-pass filter mode selection for acceleration data: Normal mode)

      //AFDS: 0     (Filtered acceleration data selection: internal filter bypassed)

      //T_ONLY: 0   (Temperature sensor only mode: OFF  )

      //Rsv: 0

      //MLP: 0      (Magnetic data low-power mode: OFF)

      //MD: 10      (Magnetic sensor mode: 00-Continuous�?01-Single�?10-Powerdown�?11-Powerdown)

    rt=fLSM_WriteReg(LSM_CTRL7,RegVal);

    if(rt!=0){return 2;}

    

    //CTRL5

    RegVal=0x60;

      //TEMP_EN: 0  (Temperature sensor enabled.)

      //M_RES: 11   (Magnetic resolution: 00: low resolution, 11: high resolution)

      //M_ODR: 000  (Magnetic data rate: 000-3.125 Hz�?110-Do not use)

      //LIR2: 0     (Latch interrupt request on INT2_SRC register: not latched)

      //LIR1: 0     (Latch interrupt request on INT1_SRC register: not latched)

    rt=fLSM_WriteReg(LSM_CTRL5,RegVal);

    if(rt!=0){return 2;}

  }

 

  return 0;

}
1 REPLY 1
Miroslav BATEK
ST Employee
Posted on February 06, 2017 at 11:20

According to the datasheet the 300uA is typical current consumption.

See Table 5. below.

0690X00000606FVQAY.png

How did you get your estimation 100uA ?

I suppose the ramp-pulses are caused by demagnetization of the magnetic sensor for each measurement to improve the accuracy.