BME280 with STM32l432kc ... Needing help!

I am using the Adafruit BME280 with an STM32l432KC and have asked for help on another occasion. At this point, I am just trying to confirm communication between the sensor and the microprocessor using sensor address 0x76 << 1, id register 0xD0 which should return 0x60 value to Tera Term software. I have attached the BME28 pins to STM32l as follows: SDI to D4, SCK to D5, GRD to GRD, 3.3V to 3.3V. I am not using a pull-up resistor on SDI or SCK pins account BME280 shows to have 10K pull-up incorporated into the sensor.

Please review the attached files which contain my code and TeraTerm output. Any suggestions to get this code to work would be greatly appreciated.

Thanks in advance,
Robert

Hello Robert,

There is a BME280 library available here. You can import it to your program by clicking on the “Import into Compiler” button (top-right) on that page. There is a sample program code (in comments) in the “BME280.h” file. Replace your code in the"main.cpp" by that one (copy &paste). As I can see it uses “0xEC” to address the BME280:

BME sensor(D0,D1, 0xEC); // sda, clk, 8bit address

So before trying the sample program you can use that one in your code. Mybe it will work.

Best regards, Zoltan

Zoltan,

Thank you for your suggestion. I uploaded the attached BME280 library and copied it to my main.ccp file, but code throws up errors. I then deleted all the files except for the temperature request and code compiled. However, the tera term output shows only 0.00 for temp. I have enclosed an updated code and tera term output page for you to check out and make suggestions.

Thanks again for you help!!
Robert

Maybe floating point printing is disabled by default.
Add a mbed_app.json file with the following content to your project (right-click on the project name and select New File ...):

{
    "target_overrides": {
        "*": {
            "target.printf_lib": "minimal-printf",
            "platform.minimal-printf-enable-floating-point": true,
            "platform.minimal-printf-set-floating-point-max-decimals": 2
        }
    }
}