I grabbed the calibration data and uncompensated values from my code, whilst it was running and fed them into the spreadsheet. The temp of 22.1 matches, so the values it's reading do tally up. All calls to the bme280 library return a success result. I get a value of 524288 from the uncompensated temperature registers I get calibration values of 28462 26902 50 for T1, T2, T3 The library then reports 2210 as the temperature, which corresponds to the spreadsheet you recommended. The BME280_I2C_bus_write and BME280_I2C_bus_read function pointers are invoked as expected (from my understanding of the I2C protocol. What am I missing? My code is like this: esp_err_t i2c_init() { i2c_config_t conf; conf.mode = I2C_MODE_MASTER; conf.sda_io_num = GPIO_NUM_21; conf.sda_pullup_en = GPIO_PULLUP_ENABLE; conf.scl_io_num = GPIO_NUM_22; conf.scl_pullup_en = GPIO_PULLUP_ENABLE; conf.master.clk_speed = 100000; i2c_param_config(I2C_NUM_0, &conf); return i2c_driver_install(I2C_NUM_0, I2C_MODE_MASTER, 0, 0, 0); } void app_main() { esp_err_t i2c_init_result = i2c_init(); if(i2c_init_result != ESP_OK) { printf("Failed to initialize i2c"); } struct bme280_dev bme280 = { .intf = BME280_SPI_INTF, .write = BME280_I2C_bus_write, .read = BME280_I2C_bus_read, .dev_id = BME280_I2C_ADDR_PRIM, .delay_ms = BME280_delay_msek }; int8_t init_result = bme280_init(&bme280); if(init_result != BME280_OK) { printf("Init failed"); } printf("Temperature Calibration (T1, T2, T3) %d %d %d\n", bme280.calib_data.dig_T1, bme280.calib_data.dig_T2, bme280.calib_data.dig_T3); bme280.settings.osr_h = BME280_OVERSAMPLING_1X; bme280.settings.osr_p = BME280_OVERSAMPLING_1X; bme280.settings.osr_t = BME280_OVERSAMPLING_1X; bme280.settings.filter = BME280_FILTER_COEFF_OFF; uint8_t settings_sel = BME280_OSR_PRESS_SEL | BME280_OSR_TEMP_SEL | BME280_OSR_HUM_SEL | BME280_FILTER_SEL; int8_t settings_result = bme280_set_sensor_settings(settings_sel, &bme280); if(settings_result != BME280_OK) { printf("Settings failed"); } while(1) { int8_t sensor_mode_result = bme280_set_sensor_mode(BME280_FORCED_MODE, &bme280); if(sensor_mode_result != BME280_OK) { printf("Something went wrong"); } bme280.delay_ms(1000); struct bme280_data comp_data; int8_t data_result = bme280_get_sensor_data(BME280_ALL, &comp_data, &bme280); if(data_result != BME280_OK) { printf("Something went wrong"); } #ifdef BME280_FLOAT_ENABLE printf("%0.2f C, %0.2f hPa, %0.2f%%\r\n", comp_data.temperature, comp_data.pressure, comp_data.humidity); #else printf("%d, %d, %d\r\n", comp_data.temperature, comp_data.pressure, comp_data.humidity); #endif } }
... View more