I am running BMP with I2C using nrf9160 as MCU and zephyr RTOS and zephyrs BME280 drivers as my SW. Using forced mode and recording pressure approximately once/10min(or every 5 seconds for testing purposes)
My problem is that I sometimes(maybe 2% of readings) get really strange pressure values. I've tried to debug the issue and found out that pressure registers are actually probably ok, but temperature is sometimes somehow corrupted and that causes the compensated pressure to be quite off the limits too. This is the piece of code in zephyr drivers that read the result registers in one burst read: https://github.com/zephyrproject-rtos/zephyr/blob/d431b56587a9afbee091180d3511257a148a359f/drivers/s...
// If I print out the register values after they are read is see this:
// Valid registers(F7-FC): 53 00 d0 7e 8d 00
// And when we hit the problem: 52 fd c0 3e 85 00
// It looks like this one bit 3->7 causes temperature to be interpreted as something like
// -50C instead of +20C and pressure to be 870hPa instead of 980hPa
I've been eyeballing the drivers and tried to sniff the traffic with scope but my conclusion is always the same. Everything looks to be correct, sensor just sends a wrong value. Any ideas what could be causing this?
Hi and thanks for suggestions.
I've tried to read the section 5.2 from here https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BME280-DS002.pdf (Register compatibility with BMP) and compare it with zephyr drivers and I think it should work with both BME and BMP. But then again, I have habit of being incorrect. Did you spot any particular difference?
By saying "log more temperature register raw data" do you mean that get the temperature register dumps from several measurements or soemthing else? I can definitely do that. I think I will also try to ditch the zephyr drivers and try the once you linked directly.
I took the drivers from bosch repository(no effect to the problem) and used them to get some logs(attached). Logs show the raw values read from the registers by the drivers and the compensated result also.
I also managed to get scope capture from the offending byte. To me it seems like BME is really sending that 0x7D instead of 0x3D, so it is not any disturbance in the I2C line.
Feeling kind of cluesless at the moment...
Sorry, I couldn't download your file, please upload a right format. I'll feedback your issue to my colleague.
If you confirm the raw data(0xf7-0xfc) is change, suggest solder a new sensor to check. From my experience, temp raw data shouldn't jump from 20℃ to -50℃.