Expected data for LSM303DLHC?

I’m getting a lot of zeros in the raw data off my accelerometer. Is this the sort of thing I should expect to see?

The magnetometer is working OK. I2C seems to be working. The accelerometer is producing data, but it seems not right. The configured accelerometer interrupts are not wiggling (checked on an oscope).

Decimal raw data result and binary equivalent listed below for each of the six register reads.

acc[0] X high byte
192 1100 0000
192 1100 0000
192 1100 0000

acc[2] Y high byte
0 0000 0000
0 0000 0000
0 0000 0000

acc[4] Z high byte
192 1100 0000
192 1100 0000
192 1100 0000

acc[1] X low byte
32 0010 0000
0 0000 0000
160 1010 0000

acc[3] Y low byte
224 1110 0000
160 1010 0000
32 0010 0000

acc[5] Z low byte
128 1000 0000
64 0100 0000
128 1000 0000

Surely, the lowest six and five bits of the higher and lower bytes for each axis shouldn’t be zero? Busted part maybe?

Hello.

We have that part on a couple different products. Could you please tell me which Pololu product you are using?

Your low bytes look reasonable, because the least-significant four bits in the low byte are not supposed to carry real data and we throw them away in our example code. However, I can’t explain the values you are getting for the high bytes.

If you haven’t already, I recommend looking at our Arduino library for the LSM303DLHC and trying to make your code behave the same way:
github.com/pololu/LSM303/blob/m … LSM303.cpp

If you continue to have trouble, please tell us more details about your system and post the simplest possible code that should work but doesn’t.

–David

Hi David,

I am using the lsm303dlhc 3d compass and accelerometer carrier, Pololu item number 2124.

I have the arduino code in hand. This particular installation is interfaced to an mbed. As you probably know, the mbed library is for the lsm303dlh, and requires minor modification to the register map for the magnetometer output and to the acceleromter i2c slave address. Those edits were done.

I don’t see any obvious way where the high byte (i am assuming the high four bits of the high byte) of the raw data could get clobbered, but will comb through the arduino code next and model the mbed code after it.

Something I noticed about the data was that the lowest five bits of the low byte and the six lowest bits of the high byte are always zero, even when waving the accelerometer around as energetically as possible.

More soon - I should be back in front of the bench today.

Thank you very much for the advice and assistance.

Did you figure out what the problem is or get things to work properly?

–David