Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BMP388 -- Value in PWR_CTRL register changes by itself

    BMP388 -- Value in PWR_CTRL register changes by itself

    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: 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: 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

    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.));

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

    times_to_read = times_to_read + 1;

    BMP380 test result.png