Bosch Sensortec Community

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

    BMP38x API self-test issues

    BMP38x API self-test issues

    sebmadgwick
    Established Member

    BMP38x self-test v1.1.3 appears to suffer from multiple bugs.

    Bug 1 - Inappropriate plausible temperature range

    The maximum plausible temperature is defined as 40 degC on line 54 of bmp38x_selftest.c.  The BMP388 datasheet specifies an operating temperature up to 85 degC.  In practise, operating temperatures will often exceed 40 degC due to warm climates and/or heat generated by electronics.

    Bug 2 - Scaling errors for BMP3_DOUBLE_PRECISION_COMPENSATION

    If using BMP3_DOUBLE_PRECISION_COMPENSATION then the self-test will always fail with BMP3_IMPLAUSIBLE_PRESSURE due to scaling errors. This is because the API will provide measurements in units of degC and 100*hPa but the API defines the plausible ranges in units of 100*degC and 100*100*hPa (scaled once in definition and then again within if statement).  I suggest the issue is fixed by defining different plausible limits when BMP3_DOUBLE_PRECISION_COMPENSATION is defined.

    Bug 3 - Corrupted variables when not using BMP3_DOUBLE_PRECISION_COMPENSATION

    This issue can be demonstrated by printing the measurement values inside the internal function, analyze_sensor_data, on line 185 of bmp38x_selftest.c as shown below.

     

    static int8_t analyze_sensor_data(const struct bmp3_data *sens_data)
    {
        int8_t rslt = BMP3_SENSOR_OK;
        
    // **************** START OF DEBUG CODE ****************
    #ifdef BMP3_DOUBLE_PRECISION_COMPENSATION
        printf("t=%f, p=%f\r\n", sens_data->temperature, sens_data->pressure);
    #else
        printf("t=%ld, p=%lu\r\n", (long int)sens_data->temperature, (long unsigned int)sens_data->pressure);
    #endif
    // **************** END OF DEBUG CODE ****************
    
        if ((sens_data->temperature < BMP3_MIN_TEMPERATURE) || (sens_data->temperature > BMP3_MAX_TEMPERATURE))
        {
            rslt = BMP3_IMPLAUSIBLE_TEMPERATURE;
        }
        if (rslt == BMP3_SENSOR_OK)
        {
            if ((sens_data->pressure / 100 < BMP3_MIN_PRESSURE) || (sens_data->pressure / 100 > BMP3_MAX_PRESSURE))
            {
                rslt = BMP3_IMPLAUSIBLE_PRESSURE;
            }
        }
    
        return rslt;
    }

     

    If using BMP3_DOUBLE_PRECISION_COMPENSATION then the above modification will result in the following typical output:

    t=58.103809, p=101310.782827

    If not using BMP3_DOUBLE_PRECISION_COMPENSATION then the above modification will result in the following typical output:

    t=1, p=5752

    It appears that the pressure value is the temperature measurement (100*degC), and the temperature value is always 1.  This corruption only occurs within the function, analyze_sensor_data. There are no issues with values obtained using the function, bmp3_get_sensor_data.

    5 REPLIES 5

    To be clear, a temperature during the production line higher than 40 may be acceptable depending on end customer requirements. This is as stated by Community Moderator, o_o, and the Bosch BMP38x Self-Test application note (page 7).  Consider that the sensor temperature may be significantly higher than ambient due to heat generated by electronics, especially during testing when electronics may be deliberately stressed.

    You are also incorrect to state that the reason for bug3 is the printf line. There is no is issue with this line. The cause of bug 3 is unknown and the issue can no longer be replicated.  I have already suggested that the bug report is ignored.

    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