06-02-2022 02:09 AM
I'm working on an embedded system with a BMP388 and I'm trying to write a simple application to communicate with it through I2C and read out the recorded pressure value. I'm using this adafruit BMP388 development board: https://www.amazon.com/Adafruit-BMP388-Precision-Barometric-Altimeter/dp/B07JXYK9ZB/ref=sr_1_4?crid=...
I'm sucesfully able to communicate over I2C and read/write values to the BMP388. However, when I try to read out the recorded pressure, the BMP388 stalls indefinitely. I've probed the wires and discovered that the values in the BMP388's registers aren't what I expect to be there. According to the datasheet (https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmp388-ds001.pdf), on page 32, the microcontroller needs to check the status register (0x3) before reading out the pressure, and wait until the value in the status register updates to a 1. My microcontroller is doing this correctly, but the issue is that the BMP388 never updates the status register's value to 1.
In the error register (described on page 31), it perpetually stores the value 0x0, so there doesn't seem to be any error coming up. In the data registers for both pressure and temperature (described on page 32), they only store the default values (described on page 31). There doesn't seem to be anything I can do to make any of these values update, even after I wait for a while and have the microcontroller constantly querying the BMP388. Does anyone know what I should do?
Also, in general, what conditions need to be met in order for the status register in the BMP388 to update to a 1?
Solved! Go to Solution.
06-02-2022 04:44 PM
Thanks for your inquiry.
Please note that BMP388 has been discontinued. You need to switch to BMP390 which is pin-to-pin compatible with BMP388 and share the same API source code at https://github.com/BoschSensortec/BMP3-Sensor-API.
After BMP388 is powered on, it will stay in sleep mode. You need to enable pressure sensor and temperature sensor in register 0x1B. You also need to select oversampling for pressure sensor osr_p and temperature sensor osr_t in register 0x1C. The higher the osr_p and osr_t, the cleaner the data will be. But the conversion time and current consumption will be higher as trade-off. Then you need to select ODR for example 25Hz in register 0x1D if you want to use normal mode. Now you go back to register 0x1B and select normal mode. You should be able to see status register 0x03 drdy_temp bit and drdy_press bit set to 1. If not, then you need to set drdy_en bit in register 0x19. After you read pressure and tempeature data registers the status bits will be cleared.
BMP388 forced mode is actually on demand or single-shot measurement. Your MCU can write value to register 0x1B to enable forced mode at any time. Then BMP388 will wake up from sleep mode and take a measurement and then go back to sleep mode automatically. You can check the status register 0x03 before reading the data registers.
Because BMP388 and BMP390 need to run formula to get the final pressure value and temperature value from raw data and calibration data in NVM, it is recommended to use our API soruce code. You can click "Examples" on the Github to see how to get sensor data.