Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BMP384 return meaningless value.

    BMP384 return meaningless value.

    Occasional Visitor


    I have bmp384 sensor and I did the starting configuration. Ex: configure press and temp oversampling ,  datarate , int pinout type, int pin  enable ,data ready int ,enable pressure and tempreture reading and choose normal mode. I read the 3 bytes value for temp => xlsb , lsb , msb and I collect that byte to 1 int for ex.: xlsb= 0 lsb = 61 , msb = 130 convert to binary =>

    xlsb = 0000 0000 

    lsb  = 0011 1101

    msb  = 1000 0010

    when I collect that bytes like that (msb<<16) | (lsb<<8) | xlsb => 1000 0010 0011 1101 0000 0000 whis is 8535296(dec). this is my raw data and I compensate that value . my compensated value is around 8.5 million or something like that. my point is compensating process doesn't change value a lot. I try 2 diffirent sensor and I get around 8.5 million value for compensated temp. Do I miss something ? Can you help me ASAP?


    3 REPLIES 3

    Community Moderator
    Community Moderator

    Is there documentation some where that describes the format of the pressure registers. The source code is ~2500 lines long,  it can't take that much to interpret the pressure data.  I don't need compensation, I just to read the pressure values in a known unit of pressure.  The data sheet only describes it as PRESS_MSB_23_16, PRESS_MSB_15_8 and PRESS_MSB_7_0. 

    Community Moderator
    Community Moderator

    Hello oxolotol,

    It is 24Bit pressure data, split and storeed in three consecutive registers. You could see it from data sheet.

    Reg04 pressure data.png

    In Github code, there was example code that convert register value to pressure value.
    * @brief This internal API is used to parse the pressure or temperature or
    * both the data and store it in the bmp3_uncomp_data structure instance.
    static void parse_sensor_data(const uint8_t *reg_data, struct bmp3_uncomp_data *uncomp_data)
    /* Temporary variables to store the sensor data */
    uint32_t data_xlsb;
    uint32_t data_lsb;
    uint32_t data_msb;

    /* Store the parsed register values for pressure data */
    data_xlsb = (uint32_t)reg_data[0];
    data_lsb = (uint32_t)reg_data[1] << 8;
    data_msb = (uint32_t)reg_data[2] << 16;
    uncomp_data->pressure = data_msb | data_lsb | data_xlsb;