cancel
Showing results for 
Search instead for 
Did you mean: 

LPS25H wrong pressure value

zlajoan
Associate II
Posted on July 27, 2015 at 18:07

Hi ST Community!

I am working with LPS25H pressure sensor and STM32F1 uC. I am able to read out temperature and pressure but the pressure value is too low (temperature is fine). It should be 15 mbar and the sensor outputs 94 mbar. I have tried adding pressure offset value after soldering, but the pressure is then 12 mbar. Does anyone have any clue what should I be carefull about? Initialization and read routines: INITIALIZATION

// RES_CONF 0x05
I2C1_numData = 1;
I2C1_buffer[0] = 0x05;
I2C1_Send_Data(I2C1_buffer, PRESSURE_ADDRESS, 0x10 | 0x80, &I2C1_numData);
// CTRL_REG1 0xC0
// CTRL_REG2 0x00
// CTRL_REG3 0x00
// CTRL_REG4 0x00
I2C1_numData = 4;
I2C1_buffer[0] = 0xC0;
I2C1_buffer[1] = 0x00;
I2C1_buffer[2] = 0x00;
I2C1_buffer[3] = 0x00;
I2C1_Send_Data(I2C1_buffer, PRESSURE_ADDRESS, 0x20 | 0x80, &I2C1_numData);
// FIFO_CTRL 0x00
I2C1_numData = 1;
I2C1_buffer[0] = 0x00;
I2C1_Send_Data(I2C1_buffer, PRESSURE_ADDRESS, 0x2E | 0x80, &I2C1_numData);

READOUT

I2C1_numData = 5;
I2C1_Read_Data(I2C1_buffer, PRESSURE_ADDRESS, 0x28 | 0x80, &I2C1_numData);
pressure = (I2C1_buffer[2] << 16 ) | (I2C1_buffer[1] << 8 ) | (I2C1_buffer[0] << 0 ); 
temperature = (I2C1_buffer[4] << 8 ) | (I2C1_buffer[3] << 0 ); 
pressureFloat = pressure / 40;
temperatureFloat = temperature / 40 + 5;

8 REPLIES 8
licciardello.anto
Associate II
Posted on July 28, 2015 at 13:13

Hi,

I have some suggestion regarding both the Initialization phase and the readout phase.

Regarding the Initialization phase, the values of configuration for all registers are correct, but:

1. the setting of the registers CTRL_REG2, CTRL_REG3, CTRL_REG4  and FIFO_CTRL could be avoided because 0x00 is the default value for all these registers.

2. However, if you want write these registers,the CTRL_REG1 (0x20h) register has to be set only after setting of these registers. The PD (power down) bit of  the CTRL_REG1 has to be set to 1 only after all registers are configurated.

3. Keep in mind that the slave address is completed with a Read/Write bit (1 for Read, o for Write).

Regarding the readout phase:

1. Keep in mind that the full reference pressure value is composed by PRESS_OUT_H/_L/_XL and is represented as 2’s complement.

2. Before you read the pressure value, check if P_DA bit of STATUS_REG (27h) is set to 1 ( a new pressure sample is available).

Regards

Antonella

zlajoan
Associate II
Posted on July 28, 2015 at 17:10

Antonella, thak you for the suggestions.

I have tried setting only RES_CONF and CTRL_REG1 registers, nothing have changed. I have also tried different setup order. Read/Write address bit is issued inside of I2C1_Read_Data and I2C1_Send_Data routines. I have also added P_DA and T_DA bits checkout before reading pressure and temperature. For the reference, I am posting sensor values:

I2C1_buffer[0] (P_XL) = 0x9E
I2C1_buffer[1] (P_L) = 0x36
I2C1_buffer[2] (P_H) = 0x3D
pressure = 0x3D369E = 4011678
pressureFloat = 4011678 / 40 = 94 (should be around 1010)
RPDS_L = 0x38
RPDS_H = 0x00
REF_P_XL = REF_P_L = REF_P_H = 0x00

Cheers, Zlatko
licciardello.anto
Associate II
Posted on July 29, 2015 at 12:15

Hi Zlatko,

all operations performed and the value of the registers  look like correct.

Have you tried with an other sample?

What is the value of supply voltage for the sensor?

Regards

Antonella

zlajoan
Associate II
Posted on July 29, 2015 at 13:05

Hi!

Both VDD_IO and VDD voltages are 3.3V. This is 4th sample that I have tried, same issue with each one.

I was also experimenting with different integer casting of buffer values, as in other libraries, but nothing worked for me.

We have also heated it up as much as possible with fan and pressure has not changed significantly (at least temperature compensation is working :)...

Best regards,

Zlatko
licciardello.anto
Associate II
Posted on July 30, 2015 at 11:05

Hi Zlatko,

If I have well understood, you read always the same pressure value for all samples.

Can you try to read only the registers 28h-2Ch, without write the CTRL_REG1 register and without check the P_DA and T_DA status bits?

1. You have to provide supply the sensor and read the pressure and temperature values without write no registers and without check the status bits.

2. Then you have to remove power supply .

3. Repeat the step 1.

Could you send me the read value of pressure and temperature?

Could you try all 4 samples?

Regards

Antonella

zlajoan
Associate II
Posted on July 30, 2015 at 15:25

Antonella,

After normal initialization routine I am reading different pressure values (now is around 96, should be around 1016). Without initialization (writing to any of registers) on power on, I always receive same values:

PRESS_OUT_XL (0x28) = 0x00
PRESS_OUT_L (0x29) = 0x48
PRESS_OUT_H (0x2A) = 0x2F
TEMP_OUT_L (0x2B) = 0x00
TEMP_OUT_H (0x2A) = 0x00
RPDS_L (0x39) = 0x38
RPDS_H (0x3A) = 0x00
pressure = 0x2F4800 = 3098624
pressureFloat = 75 hPa
temperature = 0x0000 = 0
temperatureFloat = 5 °C

Regards, Zlatko
licciardello.anto
Associate II
Posted on July 31, 2015 at 10:23

Zlatko,

I need other information.

Are you using a LPS25H adapter board for a standard DIL 24 socket (see attached file) or did you soldered a sample of LPS25H on your board?

Are using a specific platform ST or a custom platform?

Can you repeat the procedure of initialization and reading with check of the flags of STATUS_REG (0x27h) for all samples and send me the dump of all registers and the read values for pressure and temperature ?

Regarding the T_DA bit and P_DA bits of STATUS_REG, can you check the logical AND? If both are 1 you can read the pressure and temperature output registers.

It is not clear for me, if when you read a value for a sample the read value is always the same for all time even if you heated it up as much as possible with fan or if the value of pressure has changed even if no significantly.

Can you explain pls?

Regards

Antonella

________________

Attachments :

LPS25H_Adpter_Board_DM00100992.pdf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzK8&d=%2Fa%2F0X0000000bJs%2FzOkUoXduw0wbyLlvDbM7PDHPdNZblr98S8sNk29DABk&asPdf=false
Posted on March 21, 2017 at 13:59

Hi!

Any news on this issue?

I’m reading a wrong (too low) pressure on several prototypes too. In my case it seems to be related to temperature. At 23°C temperature the LPS25HB returns a temperature of -21°C and a pressure of 968hPa:

PRESS_OUT_XL (0x28) = 0xFC
PRESS_OUT_L (0x29) = 0x8D
PRESS_OUT_H (0x2A) = 0x3C
TEMP_OUT_L (0x2B) = 0x34
TEMP_OUT_H (0x2A) = 0xD8

At 35°C temperature (nothing else changed) I’m reading:

PRESS_OUT_XL (0x28) = 0xBF
PRESS_OUT_L (0x29) = 0x50
PRESS_OUT_H (0x2A) = 0x40
TEMP_OUT_L (0x2B) = 0xE0
TEMP_OUT_H (0x2A) = 0xF3

Which converts to a temperature of -6°C and a pressure of 1029hPa (which is almost correct).

At 42°C I’m reading 2°C and 1076hPa.

I’m almost tempted to measure a few more points and implement my own temperature correction

The LPS25HB is soldered to a custom PCB with a closely placed 100nF 0402 SMD capacitor and a stable 2.1V power supply. Unfortunately I had neglected to connect Pin 3 (Reserved) to Ground but correcting that issue had no effect.

Regards,

Michael

EDIT: Just discovered that the LPS25H(not HB) datasheet mentions a 5°C temperature offset (T(°C) = 5 + (TEMP_OUT / 480)). With the offset the temperature is correct now (which at least indicates that my I2C communication and calculation is correct). However, the pressure is still too low and highly temperature dependent.