Bosch Sensortec Community

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

    BMP388 -- Value in PWR_CTRL register changes by itself

    BMP388 -- Value in PWR_CTRL register changes by itself

    collier
    New Poster

    Hello, I'm working on a BMP388 application using the Zephyr RTOS. In my code for the application, I set the PWR_CTRL (0x1B) register value to 0x33 (in binary: 00110011), because I need to set the mode from sleep mode to normal mode. (in the datasheet, this is described on pages 12 and 35: https://www.mouser.com/pdfdocs/BST-BMP388-DS001-01.pdf) However, I discovered that the value in this register changes by itself to 0x03 (in binary: 00000011) after a very brief time, which sets the mode back from normal mode to sleep mode. In particular, I tried doing the following series of operations:

    -- write the value 0x33 to PWR_CTRL register

    -- read the value stored in the PWR_CTRL register

    -- read the value stored in the PWR_CTRL register again

    Then, the first read returned value 0x33 and the second read returned value 0x03. So it seems to me that the value is getting reset a very short time after writing to the register, which is long enough for the first read but not the second. 

    I also discovered that if I write 0x33 to the register, then wait for one microsecond (by calling a thread sleep function), and then read out the register value once, then it returns the value 0x03. But if I write 0x33 to the register and immediately read the stored value (without waiting for one microsecond), then it returns the value 0x33.

    I'm using I2C to communicate with the device, and also, the bmp388 that I'm using is on this adafruit breakout board: https://media.digikey.com/pdf/Data%20Sheets/Adafruit%20PDFs/3966_Web.pdf. I'm using only four pins connected to the breakout board: PWR, GND, SDA and SCL. 

    Does anyone know why the BMP388 would be reverting from normal mode to sleep mode like this? The only thing that I think could cause it would be temporarily cutting the power or resetting the bmp388, but there isn't anything I'm doing that would cause either of those things to happen.

    1 REPLY 1

    BSTRobin
    Community Moderator
    Community Moderator

    Hi collier,

    I run BMP3 COINES example code "read_sensor_data", it works well and couldn't reproduce your issue. 0x1B register remained 0x33 value.
    Suggest you also run this example code and see it again.

    static void read_sensor_data(void)
    {
    int times_to_read = 0;
    uint8_t reg_value = 0;

    while (times_to_read < 200)
    {

    bmp3_get_sensor_data(BMP3_ALL, &bmp3_comp_data, &bmp3Dev);

    printf("T: %.2f, P: %.2f \n", (bmp3_comp_data.temperature / 100.), (bmp3_comp_data.pressure / 100.));
    fflush(stdout);

    bmp3_get_regs(0x1B, & reg_value, 1, &bmp3Dev);
    printf("0x1B reg value=0x%02x\r\n", reg_value);
    reg_value = 0;
    coines_delay_msec(10);

    times_to_read = times_to_read + 1;
    }
    }

    BMP380 test result.png

    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