Bosch Sensortec Community

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

    BME280 driver 3.5.0 fixes

    BME280 driver 3.5.0 fixes

    kuschel
    New Poster

    BME280_driver 3.5.0

    I have found some bugs mainly in the description README.md file and want to describe each of them here:

    First, I have tested the code and implemented my code with the following devices:

    * STM32WL55 nucleo board connected with I2C bus, a LoRaWAN thing, which I could share as FOSS when it is released with a new hardware.

    * Beagle Board Black with Debian 10.7 and connected to i2c-1 (/dev/i2c-1) and i2c-2 too.

    I have tested the library with defined BME280_FLOAT_ENABLE, also tested with BME280_64BIT_ENABLE and BME280_32BIT_ENABLE.

    1. Very obviously the description on README.md is no longer up to date, also the inclusion of the write and read functions for the respective bus is faulty.

    1.1 The user_delay_ms should be user_delay_us in microseconds due to the new delay function.

    1.2 The default implementation of the compensation function is double precision floating point, i.e. BME280_FLOAT_ENABLE is set (former BME280_64BIT_ENABLE).

    1.3 The function user_spi_write() and the function user_spi_read() has a parameter which is of type const uint8_t *reg_data (former it was only type of uint8_t *reg_data).

     

    2. bme280.c

    The function bme280_cal_meas_delay() should deliver also a value in us (microseconds) instead of ms (milliseconds), that makes it more easier and overall consistent.

    2.1 The change of the user function user_delay_ms to user_delay_us() which gets a period amount of wait in microseconds. So the function bme280_cal_meas_delay() becomes smaller, we get rid off the division through 1000 (constant BME280_MEAS_SCALING_FACTOR).

    2.2 I deleted this constant BME280_MEAS_SCALING_FACTOR in the bme280_defs.h file.

    As a positive side effect, the two examples (linux_userspace.c and bsd_userspace.c) do not need to be adjusted with microseconds either.

    3. Example linux_userspace.c

    3.1 I had trouble to compile this example on another machine, like the beagle bone black board. I updated the code, which needs the ioctl procedure, unfortunately I do not own a Raspbi.

    3.2 In the code, the id.dev_addr selection must be before and not after the call of the line ioctl() which already uses the device address (0x76 or 0x77) - former it was not defined, so I struggled with the distributed code.

    3.3 Added an error handling for malloc function, which IMHO is necessary. Added error handling for read and write functions.

    I published a pull request at github (#88)

    https://github.com/boschsensortec/BME280_driver/pull/88#issue-1580396021

    BR

    Thomas Kuschel

    3 REPLIES 3

    BSTRobin
    Community Moderator
    Community Moderator

    Hi kuschel,

    Thank for your feedback, we will check and give you feedback.

    BSTRobin
    Community Moderator
    Community Moderator

    Hi kuschel,

    We plan to update reademe file and sensor API at end of March, sorry for the inconvience.

    BSTRobin
    Community Moderator
    Community Moderator

    Hi kuschel,

    Thanks for your feedback. We had updated BME280 github code.

    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