2016-07-07 04:26 AM
I've encountered a problem with LPS25HB. I'm trying to get maximum precision from this barometer sensor
without taking into account power consumption.
I've setted up registers in this way and in this order: CTRL_REG1 0x20 => 0b11000110; // Power on, 25Hz, BDU, reset zeroRES_CONF 0x10 => 0b00001111; // AVG-P 512, AVG-T 64
After reading documentation I've tried to enable also FIFO in mean mode to get a more precise reading, in this wayand in this order
: FIFO_CTRL 0x2E => 0b11000011; // FIFO Mean mode, 4 moving average CTRL_REG2 0x21 => 0b01000000; // FIFO EnableConversion that I do from readings are:
Pressure = ReadedPressure / 4096UL;
Temperature = 42.5 + (ReadedTemperature / 480UL); Reading are ok if I just initialize CTRL_REG1 and RES_CONF, correct temperature and reasonable pressure readings. But if I try to activate FIFO_CTRL and CTRL_REG2 (in this order, first FIFO_CTRL and after CTRL_REG2 registers), with above bit setup, Isuddenly have very wrong readings from Temperature and less precise values output from pressure. Temperature readings are not only wrong but they act like pressure readings, like if I move my PCB board up and down Temperature increase/decrease and when steady I've an AVG reading of 42�C.
Since I'm applying this formula that require temperature:2017-07-18 07:56 AM
Hi,
I get exactly the same behavior. Is there some compatibilty bugs using at same time oversampling and movering average ?
Thanks,
Nicolas
2017-08-15 07:54 AM
Probably you are reading pressure and temperature data with one single autoincrementing I2C sequence. Doing so also gave strange temperature data for me. Reading pressure in one i2c sequence and temperature in another seqence gave sensible data.
2017-09-14 08:49 AM
Hi,
I am now reading the Pressure and temperature with 2 différents sequences, Pressure is good but temperature is always much much higher than expected.
Here is my config file:
uint8_t pres_lps25h_config( void )
{ uint8_t who = 0; uint8_t tmp = 0; uint16_t offset = 0;/* Check Who Am I */
who = baro_sensor_read_reg(LPS25H_WHO_AM_I);/* Rest and Boot */
// Reset chip and wait 1 ms (4usec from datasheet) tmp = LPS25HB_SWRESET; baro_sensor_write_reg( LPS25H_CTRL_REG2, tmp ); DelayMs(1);// Boot Enable and wait 4 ms (2.2 from datasheet)
tmp = LPS25HB_BOOT; baro_sensor_write_reg( LPS25H_CTRL_REG2, tmp ); DelayMs(4);/* Configuration */
// LPS25H_RES_CONF (10h) : Config resolution (max average) tmp = LPS25HB_P_RES_AVG_512 | LPS25HB_T_RES_AVG_64 ; baro_sensor_write_reg( LPS25H_RES_CONF, tmp );// LPS25H_CTRL_REG1 (20h) : Power ON and ODR 25 Hz
tmp = LPS25HB_MODE_ACTIVE | LPS25HB_ODR_25Hz | LPS25HB_DIFF_DISABLE | LPS25HB_BDU_CONT; baro_sensor_write_reg( LPS25H_CTRL_REG1, tmp );// LPS25H_CTRL_REG2 (21h) : FIFO Enable
tmp = LPS25HB_FIFO_ENABLE ; baro_sensor_write_reg( LPS25H_CTRL_REG2, tmp );// LPS25H_CTRL_REG3 (22h) : No interruption
// LPS25H_CTRL_REG4 (23h) : No configuration for interruption
// INTERRUPT_CFG (24h) : No configuration for interruption
// INT_SOURCE (25h) : No source for interruption
// LPS25H_FIFO_CTRL (2Eh) : FIFO Config
tmp = LPS25HB_FIFO_FIFO_MEAN | LPS25HB_FIFO_WTM_32; //tmp = LPS25HB_FIFO_BYPASS; baro_sensor_write_reg( LPS25H_FIFO_CTRL, tmp ); ♯ if 0 // The pressure offset value is a 16-bit data that can be used to implement One-Point // Calibration (OPC) after soldering, This value is composed of RPDS_H (3Ah) and RPDS_L // (39h). The value is expressed as 2’s complement. tmp = (uint8_t) (offset && 0xFF00) >> 8; baro_sensor_write_reg( LPS25H_RPDS_L, tmp ); tmp = (uint8_t) (offset && 0x00FF); baro_sensor_write_reg( LPS25H_RPDS_H, tmp ); ♯ endifreturn who;
}And fucntion used to get pressure and temperature :
/**
* @name get Pressure reg in 1 I2C access * @brief pbuf : LPS25HB pressure 3 regs 8-bits values in one buffer */void pres_lps25h_get_regs_pres(uint8_t *pbuf){ baro_sensor_read_regs(LPS25H_PRESS_OUT_XL | LPS25HB_I2C_MULTIPLEBYTE_CMD , 3, pbuf ); // LPS25HB_I2C_MULTIPLEBYTE_CMD to get multibyte}/**
* @name get Pressure reg in 1 I2C access * @brief pbuf : LPS25HB temperature 2 regs 8-bits values in one buffer */void pres_lps25h_get_regs_temp(uint8_t *pbuf){ baro_sensor_read_regs(LPS25H_TEMP_OUT_L | LPS25HB_I2C_MULTIPLEBYTE_CMD , 2, pbuf ); // LPS25HB_I2C_MULTIPLEBYTE_CMD to get multibyte}in the config setup :
if LPS25HB_FIFO_CTRL is in bypass, both temp and pressure are good
if LPS25HB_FIFO_CTRL is in LPS25HB_FIFO_FIFO_MEAN | LPS25HB_FIFO_WTM_32, only pressure is okay and temperature is too high.
Further more, I am not sure that the pressure is really filtered in FIFO_MEAN mode compared to BYPASS mode according to dump value analysis.
Any idea please ?
Thanks,