Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BME680: Gas sensor heater unstable

    Vincent
    Community Moderator

    Re: BME680: Gas sensor heater unstable

    I'm talking about the Scope_Odroid_error_close.jpg.  i saw there is no ACK in the end of communication.  that is the reason i asked you in previous ticket.  

    I will wait for your test result with only one BME680 on the platform. 

    If it works,  then maybe you can try with 3 sensors again with bit longer delay time in your sleep function. 

    GArndt_vacos
    Member

    Re: BME680: Gas sensor heater unstable

    I have continued to test the setup with 3 BME680, and later also with all other devices activated, and could for now not reproduce the problem. Longer sleep times were not required.

    I have also analyzed the I²C messages decoded by the scope and found that there must have been a more severe issue, as multiple message were strange. E.g., ones that should have been the same during each cycle were incremented, which is a hint to a software bug (which I could not find, though).

    However, I improved my driver code to fully evaluate BME680's error messages:

     

                Average<celsius_t> averageTemperature;
    			Average<hectopascal_t> averagePressure;
    			Average<double> averageHumidity;
    			for (size_t i{0}; i < gasResistance.size(); ++i) {
    				if (_measurementEnd) {
    					std::this_thread::sleep_until(*_measurementEnd);
    					struct bme680_field_data data;
    					/* Read register 0x1D. */
    					if (bme680_get_sensor_data(&data) == BME680_OK) {
    						if (data.status & BME680_NEW_DATA_MSK) {
    							averageTemperature += celsius_t{data.temperature / 100.0f};
    							averagePressure += hectopascal_t{data.pressure / 100.0f};
    							averageHumidity += data.humidity / 1000.0f;
    							/* Avoid using measurements from an unstable heating setup */
    							if (data.status & BME680_GASM_VALID_MSK) {
    								if (data.status & BME680_HEAT_STAB_MSK) {
    									gasResistance[data.gas_index]->notifyObservers(ohm_t(data.gas_resistance));
    								} else {
    									ErrorObservable::notifyObservers("Measurement from unstable heating setup rejected."s);
    								}
    							} else {
    								ErrorObservable::notifyObservers("Invalid gas measurement received."s);
    							}
    							/* Select the next gas sensor heater profile - read and write register 0x71. */
    							this->gas_sett.nb_conv = overflowingNext<uint8_t, BME680_HEATER_SET_COUNT-1>(data.gas_index);
    							if (bme680_set_sensor_settings(BME680_NBCONV_SEL) != BME680_OK) {
    								ErrorObservable::notifyObservers("Next heater profile could not be selected."s);
    							}
    						} else {
    							ErrorObservable::notifyObservers("No new data available."s);
    						}
    					} else {
    						ErrorObservable::notifyObservers("Data could not be acquired from device."s);
    					}
    				} else {
    					ErrorObservable::notifyObservers("Measurement had not been started."s);
    				}
    				/* Trigger the next measurement if you would like to read data out continuously */
    				/* Read and write register 0x74. */
    				if (bme680_set_sensor_mode() == BME680_OK) {
    					auto const measurementStart(std::chrono::steady_clock::now());
    					/* Calculate the total measurement duration (which takes time). */
    					uint16_t meas_period;
    					bme680_get_profile_dur(&meas_period);
    					_measurementEnd = measurementStart + std::chrono::milliseconds{meas_period};
    				} else {
    					_measurementEnd.reset();
    					ErrorObservable::notifyObservers("Could not set sensor to forced mode."s);
    				}
    			}

     

     

    Vincent
    Community Moderator

    Re: BME680: Gas sensor heater unstable

    OK, this means 3 sensors are working properly now on your platform, right?  

     

    GArndt_vacos
    Member

    Re: BME680: Gas sensor heater unstable

    I indeed thought so, but once I started to use the setup productively, the same problems occured, and have been occurring since...

    More bughunting for me...

    Vincent
    Community Moderator

    Re: BME680: Gas sensor heater unstable

    Sounds for me like multi instance support issue.  

    So the heat index was inreased automatically and programmed into the sensor which cause the error message.  

    Maybe you can check the globe variables like sensor structure to see if you use them properly in your 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