cancel
Showing results for 
Search instead for 
Did you mean: 

LPS331AP reference software

crwper
Senior
Posted on November 06, 2014 at 05:43

I have been having some trouble getting up and running with the LPS331AP. Using a logic analyzer, I've verified that the sequence of commands given in AN4159 section 5.1.1 (one shot mode measurement sequence) is being sent to the device. However, when I retrieve a measurement from the sensor, the 2-byte temperature measurement is always CC CC and the 3-byte pressure measurement is always 6D 6D 6D. The sensor takes about 40 ms to return this answer, so it seems that the update rate is correct at least.

AN4159 section 6.2.2 also mentions the existence of ''a list of C source files that provide the baseline in initializing, configuring and performing measurements with the pressure sensor.'' However, I have not been able to find these files. If anyone knows where I can find these, I think the might be a big help in eliminating potential errors.

Alternatively, if the problem I've described above sounds familiar, any other information would be very much appreciated.

Thanks!
1 REPLY 1
jansen
Associate II
Posted on January 27, 2015 at 17:50

Documentation on this device is really bad with numerous technical errors.  I've not attempted one-shot mode yet, but I just got auto-mode working and I'm using multi-byte I2C reads.

Things to watch out for:

1. Always clear the Power-Down control bit in CTRL_REG1 before changing config and control registers.  Then set it again when you are done setting up the device and before actually making measurements.

2. If making multi-byte reads starting at a specific address using I2C, since the address pointer on the device auto-increments, you must do an I2C write of the preceding address before doing I2C reads.  In my case, I wanted to read the status register through the last temperature out byte for a 6 byte read.  I had to do an I2C write of the status register address minus one to get the correct reads.

3. The pressure output is NOT in 2's complement format.  It is a straight up, unsigned integer.  The example in the App Note confirms this.

4.  The scaling factor for temperature is 480 in the datasheet, but in the app note its shown as (120*4), but in the example 120 is used.  However, 480 seems to be working for me.  I still need to validate this.

5.  At least in auto-mode, possibly in one-shot mode, the number of internal averages may not be compatible with the output data rate causing erroneous output data.  A point of clarity being the Output Data Rate is really the rate at which the output registers are updated, not the serial bus clock rate.

6.  There is a note saying that a spurious I2C bus can cause the device to possibly hang or cause the data output to hang.  This can be cleared by consecutively yelling STOP nine or more times on the I2C bus.  I've not had to do this as yet and fear what the other devices on my bus will think of this...

7.  The datasheet register map shows AMP_CTRL at address 0x30, but the description of this register shows address 0x2d.  Which is correct?

8.  Similarly, the reg map does not even include the Delta_Press_.. registers....

9.  There is zero info on the RFU bit in the RES_CONF register, except that it defaults to zero.

10. The DIFF_EN bit in CTRL_REG1 has two different descriptions ''Interrupt circuit enable'' and ''used to enable the circuitry for the computing of differential pressure output.''

I'm fairly sure the second one is correct, but ....

And I've only looked at these documents for 2 days....