01-13-2021 09:12 AM
Hi,
I just received a a patch of custom PCBs with BMP280 in them. 1 out of the 5 boards I have tested so far is giving wrong pressure values. I am using drivers from zephyr project and using I2C communication. It looks like the sensor follows the same curve as the other ones, but it just reports ~10hPa too low values
This lead me to wonder about BMP280 self test. I can see that Bosch drivers used to have some non-datasheet-documented code for self testing the sensor, but it has been removed
Removed the self-test API as it was no longer valid
So I have two questions:
Any idea why the one sensor is reporting wrong values and is there a way to fix the in-board calibration data so that I get correct results from this sensor?
Is there a way to execute self-test for the sensor so that we can detect such faulty sensors in production tests?
Solved! Go to Solution.
01-14-2021 05:25 PM
Hi,
Thanks for your inquiry.
Since you have got 4 out of 5 BMP280 working properly, it means that your FW has no problem. The typical (1-sigma) absolute accuracy of BMP280 is +/-1hPa from 300 ~ 1100hPa under the temperature 0 ~ 65C. The min/max is +/-3hPa because of 3-sigma. 1 out of 5 BMP280 has about ~10hPa offset which means that this part is a failure part. We need to get it back for failure analysis to find out the root cause.
Regarding BMP280 self test, you can find the example on the Github at https://github.com/BoschSensortec/BMP280_driver/commit/e1979b5715d772be3f79413f1ab8c986bdd912c1#diff....
Thanks.
01-14-2021 06:28 PM
Hi,
Thanks for reply. One of the working sensors also started to report 10mBar too low values. -> I made a test where I power cycle the sensor many times and read the result. This is what it looks like:
00> [00:00:01.032,104] <dbg> bmp280.late_bmp280_measurement: BMP280 temperature: 20.690000
00> [00:00:01.032,135] <dbg> bmp280.late_bmp280_measurement: Return pressure (kPa): 99.335550
00> [00:00:01.031,829] <dbg> bmp280.late_bmp280_measurement: BMP280 temperature: 20.610000
00> [00:00:01.031,860] <dbg> bmp280.late_bmp280_measurement: Return pressure (kPa): 99.339195
00> [00:00:01.031,951] <dbg> bmp280.late_bmp280_measurement: BMP280 temperature: 20.710000
00> [00:00:01.031,982] <dbg> bmp280.late_bmp280_measurement: Return pressure (kPa): 99.332992
00> [00:00:01.031,982] <dbg> bmp280.late_bmp280_measurement: BMP280 temperature: -60.-630000
00> [00:00:01.032,012] <wrn> bmp280: BMP280 temp: -60.-630000, HDC2080 temp: 20.98
00> [00:00:01.032,012] <wrn> bmp280: Maybe invalid pressure. new: 86.615367, old: 0.000000
00> [00:00:01.084,655] <dbg> bmp280.late_bmp280_measurement: Return pressure (kPa): 99.335949
00> [00:00:01.031,982] <dbg> bmp280.late_bmp280_measurement: BMP280 temperature: 21.230000
00> [00:00:01.032,012] <dbg> bmp280.late_bmp280_measurement: Return pressure (kPa): 100.54249
If we believe the other sensors in the room 1005mBar is the correct pressure. So first we get 4 times the wrong pressure and after fifth boot we get a bit higher temperature and correct pressure. Results remains correct as long as BMP is not power cycled.
The invalid 4th reading is this case: https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/BMP280-MSB-temperature-is-sometimes-corr... and because I have never found how to get rid of that, I just worked around it by reading the BMP again if temperature is rubbish.
In this case it is not possible though because difference is so small that it is hard to interpret as invalid.
Maybe this is somekind of weird electrical interference during sensor bootup or something. Does not feel like SW bug to me. But this sensor is anyway driving me nuts.
And ok, so in practice there is no self test in BMP280, you have to build that externally.
01-15-2021 12:17 AM
Hello Jucci,
Could you please share your register configuration with me?
I mean BMP280 setting for your test.
Thank you.
01-18-2021 08:38 AM
Hi. Here is a SW trace from I2C communication. I have tried to decode the configuration
// First at sensor init
00> [00:00:00.046,813] <wrn> BME280: Read 1 bytes from 0xd0
00> [00:00:00.046,844] <wrn> BME280: Result
00> 58 |X
00> [00:00:00.049,468] <wrn> BME280: Read 24 bytes from 0x88
00> [00:00:00.049,499] <wrn> BME280: Result
00> 43 6b 8d 64 32 00 20 95 11 d6 d0 0b a7 1b d7 ff |Ck.d2. . ........
00> f9 ff 8c 3c f8 c6 70 17 |...<..p.
00> [00:00:00.049,499] <wrn> BME280: Write 0x55 to 0xf4
// 0x55
// 0101 0101
// 010- ---- temp oversampling - 2X
// ---1 01-- press oversampling - 16X
// ---- --01 power mode - Forced mode
// 00> [00:00:00.049,896] <wrn> BME280: Write 0xa8 to 0xf5
// 0xA8
// 1010 1000
// 101- ---- inactive time, not used in force mode
// ---0 10-- filter 2
// ---- --00 SPI disabled
// Then when measurement is made
00> [00:00:18.111,206] <wrn> BME280: Write 0x55 to 0xf4
00> [00:00:18.115,264] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.115,264] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.118,927] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.118,927] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.122,589] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.122,589] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.126,251] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.126,281] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.129,974] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.129,974] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.134,338] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.134,338] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.138,000] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.138,031] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.141,662] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.141,662] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.145,324] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.145,324] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.148,986] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.148,986] <wrn> BME280: Result
00> 04 |.
00> [00:00:18.149,993] <wrn> BME280: Read 6 bytes from 0xf7
00> [00:00:18.150,024] <wrn> BME280: Result
00> 4d 07 70 79 fe 80 |M.py..
00> [00:00:18.150,054] <dbg> bmp280.late_bmp280_measurement: BMP280 temperature: 18.520000
00> [00:00:18.150,115] <dbg> bmp280.late_bmp280_measurement: Return pressure (kPa): 100.340863
// The sequence and values above were identical through 5 boots, after 6th boot:
00> [00:00:00.047,119] <wrn> BME280: Read 1 bytes from 0xd0
00> [00:00:00.047,180] <wrn> BME280: Result
00> 58 |X
00> [00:00:00.049,835] <wrn> BME280: Read 24 bytes from 0x88
00> [00:00:00.049,835] <wrn> BME280: Result
00> 43 6b 8d 64 32 00 20 95 11 d6 d0 0b a7 1b d7 ff |Ck.d2. . ........
00> f9 ff 8c 3c f8 c6 70 07 |...<..p.
00> [00:00:00.049,865] <wrn> BME280: Write 0x55 to 0xf4
00> [00:00:00.050,262] <wrn> BME280: Write 0xa8 to 0xf5
// Measurement starts
00> [00:00:18.190,093] <wrn> BME280: Write 0x55 to 0xf4
00> [00:00:18.194,122] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.194,122] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.197,784] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.197,784] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.201,446] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.201,446] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.205,108] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.205,108] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.208,801] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.208,831] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.213,134] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.213,134] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.216,796] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.216,827] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.220,489] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.220,489] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.224,151] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.224,151] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.227,813] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.227,813] <wrn> BME280: Result
00> 04 |.
00> [00:00:18.228,820] <wrn> BME280: Read 6 bytes from 0xf7
00> [00:00:18.228,851] <wrn> BME280: Result
00> 4d 1e 40 3a 46 80 |M.@:F.
00> [00:00:18.228,881] <dbg> bmp280.late_bmp280_measurement: BMP280 temperature: -61.-550000
// Code notices that result is rubbish, and tries to read it again
00> [00:00:18.228,912] <wrn> bmp280: BMP280 temp: -61.-550000, HDC2080 temp: 17.81
00> [00:00:18.228,912] <wrn> bmp280: Maybe invalid pressure. new: 86.693117, old: 0.000000
00> [00:00:18.239,013] <wrn> BME280: Write 0x55 to 0xf4
00> [00:00:18.245,574] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.245,574] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.249,237] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.249,237] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.252,899] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.252,899] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.256,561] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.256,561] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.260,223] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.260,253] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.263,916] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.263,916] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.267,578] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.267,608] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.271,270] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.271,270] <wrn> BME280: Result
00> 0c |.
00> [00:00:18.278,015] <wrn> BME280: Read 1 bytes from 0xf3
00> [00:00:18.278,045] <wrn> BME280: Result
00> 04 |.
00> [00:00:18.279,052] <wrn> BME280: Read 6 bytes from 0xf7
00> [00:00:18.279,052] <wrn> BME280: Result
00> 4d 21 50 7a 55 80 |M!PzU.
// Too low pressure
00> [00:00:18.279,113] <dbg> bmp280.late_bmp280_measurement: Return pressure (kPa): 99.141820
It is also interesting that calibration parameters are different when pressure drops 10mBar
43 6b 8d 64 32 00 20 95 11 d6 d0 0b a7 1b d7 ff f9 ff 8c 3c f8 c6 70 17
43 6b 8d 64 32 00 20 95 11 d6 d0 0b a7 1b d7 ff f9 ff 8c 3c f8 c6 70 07
I understood from datasheet that these should be constant