cancel
Showing results for 
Search instead for 
Did you mean: 

Handling of LSM303 unused pins

AGI
Associate II

Hello,
have designed in an LSM303AGR to replace an obsolete NXP chip, it used in I2C mode at 3.3V, and there are two
pins that is not used, i.e. pin 7 - INT_MAG/DRDY and pin 12 - INT_1_XL.
Upon testing, when the complete system is in sleep mode, we have found that on some units,
the current consumption of the LSM303 may be up to 1.5 mA. By either warming or cooling the LSM303 current
goes down to almost zero.
Otherwise, everything works fine, and the LSM303 is waking up the instrument automatically when the user is
moving it, and also changes its state when moved close to a magnet...
It seems like one or both of these pins may go into floating state explaining the higher current draw, what is STs recommendation here?

I can't find anything in the datasheet (DS) on how the I/O of these pins are designed and how to handle
unrouted pins on this chip... 

(The layout is also extremely area constrained so there is not room for pullups for both unused pins)
Are there any register settings that may be used to counteract this behavior?
For example, I saw in the DS that CFG_REG_C_M register description, that bit zero  (INT_MAG) may set to 1
in order for the DRDY pin is configured as a digital output. Will this help in general for this pin?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @AGI ,

Can you confirm me you solved the issue modifying the code in that way?

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.

View solution in original post

6 REPLIES 6
Federica Bossi
ST Employee

Hi @AGI ,

Can you share a reg dump? In order to better help you it could be useful to check your writings.

Thanks

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.

Hi Federica,
I cannot produce a reg dump right now, but I can supply the code, which is based on STs own 2017-implementation, see below, two functions are supplied.

First the function LSM303AGR_InitActive() is used at startup to initiate and use the chip when the instrument is active to detect the presence of a magnet in the vicinity of the chip.
Then, there are two sleep modes used, I have included code below for the one called "transport", in which the LSM303, is configured to not wake up the system, as part of the system is always powered on and shall not be activated during transport or storage.
It is also this mode our production test script enables and were we see that some of the units are using
more current than they are supposed to. 
Transport mode is entered by calling  the function  LSM303AGR_InitTransport().

Note, I suspect that the devices that is having a higher current draw in sleep mode also do that in active mode,
but its hard to tell as there are many other circuits activated. (Other test statistics makes me believe that... )
This leads me also the idea that the two unused pins is causing it.

Kind regards, Anders

 

static status_t LSM303AGR_InitActive(void) {
uint8_t *handle = 0;

/* Init Magnetometer */
/* Output data rate selection. */
if (LSM303AGR_MAG_W_ODR((void *)handle, LSM303AGR_MAG_ODR_10Hz) == MEMS_ERROR) {
return kStatus_Fail;
}

/* Operating mode selection */
if (LSM303AGR_MAG_W_MD((void *)handle, LSM303AGR_MAG_MD_CONTINUOS_MODE) == MEMS_ERROR) {
return kStatus_Fail;
}

/* Init Accelerometer */
/* Output data rate selection. */
if (LSM303AGR_ACC_W_ODR((void *)handle, LSM303AGR_ACC_ODR_DO_25Hz) == MEMS_ERROR) {
return kStatus_Fail;
}

/* Disable low power. */
if (LSM303AGR_ACC_W_LOWPWR_EN((void *)handle, LSM303AGR_ACC_LPEN_DISABLED) == MEMS_ERROR) {
return kStatus_Fail;
}

/* Enable axes. */
if (LSM303AGR_ACC_W_XEN((void *)handle, LSM303AGR_ACC_XEN_ENABLED) == MEMS_ERROR) {
return kStatus_Fail;
}

if (LSM303AGR_ACC_W_YEN((void *)handle, LSM303AGR_ACC_YEN_ENABLED) == MEMS_ERROR) {
return kStatus_Fail;
}

if (LSM303AGR_ACC_W_ZEN((void *)handle, LSM303AGR_ACC_ZEN_ENABLED) == MEMS_ERROR) {
return kStatus_Fail;
}

/* Enable BDU */
// (0: continuous update; 1: output registers contains latest status, not updated until MSB and LSB have been read)
if (LSM303AGR_ACC_W_BlockDataUpdate((void *)handle, LSM303AGR_ACC_BDU_ENABLED) == MEMS_ERROR) {
return kStatus_Fail;
}

/* Interrupts */
// Threshold (1 LSb = 16 mg @ Full scale = ±2 g) 16mg/LSB => 315mg = 0x13
if (LSM303AGR_ACC_W_Int1_Threshold((void *)handle, 0x13) == MEMS_ERROR) {
return kStatus_Fail;
}

// Duration (N/ODR) 80ms => 0x02
if (LSM303AGR_ACC_W_Int1_Duration((void *)handle, 0x02) == MEMS_ERROR) {
return kStatus_Fail;
}

// Enable X interrupt
if (LSM303AGR_ACC_W_Int1EnXHi((void *)handle, LSM303AGR_ACC_XHIE_ENABLED) == MEMS_ERROR) {
return kStatus_Fail;
}

// Enable Y interrupt
if (LSM303AGR_ACC_W_Int1EnYHi((void *)handle, LSM303AGR_ACC_YHIE_ENABLED) == MEMS_ERROR) {
return kStatus_Fail;
}

// Enable Z interrupt
if (LSM303AGR_ACC_W_Int1EnZHi((void *)handle, LSM303AGR_ACC_ZHIE_ENABLED) == MEMS_ERROR) {
return kStatus_Fail;
}

// Latch interrupt on INT1
if (LSM303AGR_ACC_W_LatchInterrupt_on_INT1((void *)handle, LSM303AGR_ACC_LIR_INT1_ENABLED) == MEMS_ERROR) {
return kStatus_Fail;
}

// Enables interrupt 1 function on INT2 pin.
if (LSM303AGR_ACC_W_I2_on_INT1((void *)handle, LSM303AGR_ACC_I2_INT1_ENABLED) == MEMS_ERROR) {
return kStatus_Fail;
}

// Interrupt pin active low
if (LSM303AGR_ACC_W_IntActive((void *)handle, LSM303AGR_ACC_H_LACTIVE_ACTIVE_LO) == MEMS_ERROR) {
return kStatus_Fail;
}

// Enables high pass filter on interrupt
if (LSM303AGR_ACC_W_hpf_aoi_en_int1((void *)handle, LSM303AGR_ACC_HPIS1_ENABLED) == MEMS_ERROR) {
return kStatus_Fail;
}

// Autoreset high pass filter on interrupt event
if (LSM303AGR_ACC_W_hpf_mode((void *)handle, LSM303AGR_ACC_HPM_AUTORST_ON_INT) == MEMS_ERROR) {
return kStatus_Fail;
}

// Read data to reset filter
uint8_t data;
if (LSM303AGR_ACC_R_ReferenceVal((void *)handle, &data) == MEMS_ERROR) {
return kStatus_Fail;
}

LSM303AGR_ClearAccelInt();

return kStatus_Success;
}

 

 

static status_t LSM303AGR_InitTransport(void) {
    // Changes compared to Active mode
    uint8_t *handle = 0;
    /* Output data rate selection. */
    // Low-power mode (1Hz), Using "LSM303AGR_ACC_ODR_DO_PWR_DOWN" led to high current for some units.
    if (LSM303AGR_ACC_W_ODR((void *)handle, LSM303AGR_ACC_ODR_DO_1Hz) == MEMS_ERROR) {
        return kStatus_Fail;
    }
    /* Enable low power. */
    if (LSM303AGR_ACC_W_LOWPWR_EN((void *)handle, LSM303AGR_ACC_LPEN_ENABLED) == MEMS_ERROR) {
        return kStatus_Fail;
    }
    /* Set MAG operation to idle */
    if (LSM303AGR_MAG_W_MD((void *)handle, LSM303AGR_MAG_MD_IDLE1_MODE) == MEMS_ERROR) {
        return kStatus_Fail;
    }
    /* Interrupts */
    // Disable X interrupts
    if (LSM303AGR_ACC_W_Int1EnXHi((void *)handle, LSM303AGR_ACC_XHIE_DISABLED) == MEMS_ERROR) {
        return kStatus_Fail;
    }
    // Disable Y interrupts
    if (LSM303AGR_ACC_W_Int1EnYHi((void *)handle, LSM303AGR_ACC_YHIE_DISABLED) == MEMS_ERROR) {
        return kStatus_Fail;
    }
    // Disable Z interrupts
    if (LSM303AGR_ACC_W_Int1EnZHi((void *)handle, LSM303AGR_ACC_ZHIE_DISABLED) == MEMS_ERROR) {
        return kStatus_Fail;
    }
    LSM303AGR_ClearAccelInt();
    return kStatus_Success;
}

Use this button to properly post source code:

AndrewNeil_0-1707148276989.png

 

To get that extra row of icons, press this button:

AndrewNeil_1-1707148276982.png

Thanks for the tip Andrew,
is it OK for now? 

Kind regards, Anders

Hi again,
have probably solved the issue, by adding the code below, configuring DRDY pin is as a digital output:

// Set DRDY (pin 7) to output
    if (LSM303AGR_MAG_W_INT_MAG((void *)handle, LSM303AGR_MAG_INT_MAG_ENABLED) == MEMS_ERROR) {
        return kStatus_Fail;
    }

I have tested all the boards that had the issue, all have now practically zero current draw...

Kind regards, Anders

Hi @AGI ,

Can you confirm me you solved the issue modifying the code in that way?

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.