Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMP280 always reporting BMP2_MAX_PRES_DOUBLE

    BMP280 always reporting BMP2_MAX_PRES_DOUBLE

    opobla
    New Poster

    Hello.

    I have a PCB with a BMP280 connected via SPI to a ESP32. I am using also the API in https://github.com/BoschSensortec/BMP2-Sensor-API.

    I have managed to read the temperature correctly, but I didn't get it with the pressure:

     

    Data[0]:    Temperature: 22.1783 deg C  Pressure: 110000.0000 Pa

     Apparently I am able to read the registers 0x7F and the 5 next with the following results:

    I (9107571) BMP280: bmp2_get_sensor_data result: 4 
    Data[0]:    Temperature: 22.1783 deg C  Pressure: 110000.0000 Pa
    ----- BEGIN READ ----- 
    READ -- length = 6
    READ -- reg_addr = f7
    READ -- rx_buffer[0] = 77 4d
    READ -- rx_buffer[1] = 86 56
    READ -- rx_buffer[2] = 160 a0
    READ -- rx_buffer[3] = 125 7d
    READ -- rx_buffer[4] = 220 dc
    READ -- rx_buffer[5] = 129 81

     From this point I don't know what am I doing wrong. The values 4d 56 a0 are parsed to the compensate_pressure API function, that has some intimidating maths. The output from this function is this BMP2_MAX_PRES_DOUBLE.

    Can you help me to find what am I doing wrong?

    Thanks!

    3 REPLIES 3

    BSTRobin
    Community Moderator
    Community Moderator

    Hi opobla,

    Did you strictly refer to BMP280 example code on Github?

    Hi BSTRobin.

    I am not sure to understand your question. I am using the API for your github repository. According to this, I have to fill a `bmp2_dev` structure with a function to read from SPI, to write, to delay.  Then I can use `bmp2_get_sensor_data` to read the pressure and the temperature.

    The problem that I have is that call `bmp2_get_sensor_data`, the function returns with an error code BMP2_MAX_PRES_DOUBLE.

    In my previous message I showed the values that the SPI read function is returning while reading the F7 register and the sucessive +6, in case that might help to diagnose the problem.

    Just to give more information, here is the dump of the calibration data that I am getting from the device: 

    READ -- length = 25
    READ -- reg_addr = 88
    READ -- rx_buffer[0] = 218 da
    READ -- rx_buffer[1] = 105 69
    READ -- rx_buffer[2] = 9 9
    READ -- rx_buffer[3] = 101 65
    READ -- rx_buffer[4] = 220 dc
    READ -- rx_buffer[5] = 129 81
    READ -- rx_buffer[6] = 251 fb
    READ -- rx_buffer[7] = 63 3f
    READ -- rx_buffer[8] = 12 c
    READ -- rx_buffer[9] = 107 6b
    READ -- rx_buffer[10] = 252 fc
    READ -- rx_buffer[11] = 63 3f
    READ -- rx_buffer[12] = 203 cb
    READ -- rx_buffer[13] = 148 94
    READ -- rx_buffer[14] = 1 1
    READ -- rx_buffer[15] = 0 0
    READ -- rx_buffer[16] = 220 dc
    READ -- rx_buffer[17] = 129 81
    READ -- rx_buffer[18] = 251 fb
    READ -- rx_buffer[19] = 63 3f
    READ -- rx_buffer[20] = 220 dc
    READ -- rx_buffer[21] = 129 81
    READ -- rx_buffer[22] = 251 fb
    READ -- rx_buffer[23] = 63 3f
    READ -- rx_buffer[24] = 28 1c

    Do they make sense? I am comparing these values with the one given as an example in the datasheet (page 23) and they are significantly different.

    On the other hand, the value that I am getting as uncompensated pressure reading is 347984, and it changes when pressure changes, so I guess that the problem is with the compensating algorithm. 

     

    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