Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    BMP388 stalls forever when trying to read pressure

    collier
    New Poster

    BMP388 stalls forever when trying to read pressure

    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?

    1 REPLY 1
    FAE_CA1
    Community Moderator

    Re: BMP388 stalls forever when trying to read pressure

    Hi,

    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.

    Thanks.

     

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist