Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    bme680 reads chip_id, but nothing else

    bme680 reads chip_id, but nothing else

    Salam
    New Poster

    Hi

    I built c library that works perfectly with BME280. It implements the I2C read, write and delay functions and then I use the Bosch api for the rest of the functions.

    Now, I am using BME680 for final product prototoype. I am using the same implementation for the I2C functions created for the BME280.

    I can read the chip_id, but I can't ready anything else. Self Test gives error 0xFB.

    Return values of configuration functions is zero which means no error, but when i read the configuration registers, they are reading zero values, not the values I wrote.

    So, if I am reading the chip_d, does this infer that the I2C implementation is still valid and correct ?

    I have 2 prototypes with the same behaviour.

    I2C @ 100kHz

    I attached the I2C implementation as text file.

    ============

    Code snippets::

    // Globals BME68x Variables
    struct bme68x_dev bme68X;
    struct bme68x_data bme68X_data;
    struct bme68x_conf bme68x_conf;
    struct bme68x_heatr_conf bme68x_heater_conf;

    // I use UART commands and switch-case to send commands to BME680:

    switch(serial_in)
    {
    case '1':
    I2C_scan();
    break;

    case '2': // Init
    status = BME_initialize(&bme68X);
    sprintf(uart_string, "BME280 initialized, status: 0x%x\n", status);
    UART_PutString(uart_string);
    sprintf(uart_string, "chip_id (0x61): 0x%x\n", bme68X.chip_id);
    UART_PutString(uart_string);
    break;

    case '4': // Config sensor
    // Oversampling
    bme68x_conf.os_hum = BME68X_OS_1X;
    bme68x_conf.os_temp = BME68X_OS_2X;
    bme68x_conf.os_pres = BME68X_OS_16X;
    // Standby time between sequential mode measurement profiles: BME68X_SEQUENTIAL_MODE
    bme68x_conf.odr = BME68X_ODR_1000_MS;
    // Filter coefficient
    bme68x_conf.filter = BME68X_FILTER_SIZE_3;
    status = bme68x_set_conf(&bme68x_conf, &bme68X);
    sprintf(uart_string, "Status: 0x%x\n", status);
    UART_PutString(uart_string);

    //bme68x_heater_conf.enable = 1;
    bme68x_heater_conf.heatr_dur = BME68X_ODR_250_MS;
    bme68x_heater_conf.heatr_temp = BME68X_MAX_TEMPERATURE;
    status = bme68x_set_heatr_conf(BME68X_FORCED_MODE, &bme68x_heater_conf, &bme68X);
    sprintf(uart_string, "Write Gas Mode: 0x%x\n", status);
    UART_PutString(uart_string);
    break;

    case '5': // Read sensor config
    status = bme68x_get_conf(&bme68x_conf, &bme68X);
    sprintf(uart_string, "Config os_hum: 0x%x\n", bme68x_conf.os_hum);
    UART_PutString(uart_string);
    sprintf(uart_string, "Config os_temp: 0x%x\n", bme68x_conf.os_temp);
    UART_PutString(uart_string);
    sprintf(uart_string, "Config os_pres: 0x%x\n", bme68x_conf.os_pres);
    UART_PutString(uart_string);
    sprintf(uart_string, "Config odr: 0x%x\n", bme68x_conf.odr);
    UART_PutString(uart_string);
    sprintf(uart_string, "Config filter: 0x%x\n", bme68x_conf.filter);
    UART_PutString(uart_string);
    break;

    case '6': // Read chip id
    status = BME_get_chipid(&bme68X);
    sprintf(uart_string, "Status: 0x%x\n", status);
    UART_PutString(uart_string);
    sprintf(uart_string, "Chip ID (0x61): 0x%x\n", bme68X.chip_id);
    UART_PutString(uart_string);
    break;

    case '7': // Set sensor mode: BME68X_SLEEP_MODE, BME68X_FORCED_MODE, BME68X_SEQUENTIAL_MODE
    status = bme68x_set_op_mode(BME68X_FORCED_MODE, &bme68X);
    sprintf(uart_string, "status: 0x%x\n", status);
    UART_PutString(uart_string);
    break;

    case '8': // Get sensor mode
    status = bme68x_get_op_mode(&temp, &bme68X);
    sprintf(uart_string, "Op Mode: 0x%x\n", temp);
    UART_PutString(uart_string);
    break;

    case '9': // Read T, P, H data in BME68X_FORCED_MODE
    //status = bme68X_get_sensor_data(sensor_comp, &comp_data, &bme68X);
    status = bme68x_get_data(BME68X_FORCED_MODE, &bme68X_data, &bme68x_n_data, &bme68X);
    sprintf(uart_string, "Status: 0x%x\n", status);
    UART_PutString(uart_string);
    sprintf(uart_string, "T: %.2f\n", bme68x_data.temperature);
    UART_PutString(uart_string);
    sprintf(uart_string, "P: %.2f\n", bme68x_data.pressure);
    UART_PutString(uart_string);
    sprintf(uart_string, "H: %.2f\n", bme68x_data.humidity);
    UART_PutString(uart_string);
    break;

    case 'a': // Self test
    status = bme68x_selftest_check(&bme68X);
    sprintf(uart_string, "Self test: 0x%x\n", status);
    UART_PutString(uart_string);
    break;

    case 'b':
    //bme68x_check_rslt("bme68x_interface_init", rslt);

    status = bme68x_init(&bme68X);
    bme68x_check_rslt("bme68x_init", status);

    status = bme68x_selftest_check(&bme68X);
    bme68x_check_rslt("bme68x_selftest_check", status);

    if (status == BME68X_OK)
    {
    printf("Self-test passed\n");
    }

    if (status == BME68X_E_SELF_TEST)
    {
    printf("Self-test failed\n");
    }
    printf("Status: 0x%x\n", status);
    break;
    }

     

     

    Thanks

    1 REPLY 1

    BSTRobin
    Community Moderator
    Community Moderator

    Hi Salam,

    Can you directly refer to and run the official example program to try it out? For example: https://github.com/boschsensortec/BME68x_SensorDriver/blob/master/examples/forced_mode/forced_mode.c

    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