Bosch Sensortec Community

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

    Got warning code 100

    Got warning code 100

    Mark-Walen
    Member

    here is my output: {"IAQ Accuracy": "0", "IAQ":"50.00", "Static IAQ": "50.00", "CO2 equivalent": "500.00", "Breath VOC equivalent": "0.50", "Raw Temperature": "15.61", "Temperature": "15.58", "Raw Humidity": "51.92", "Humidity": "51.88","Pressure": "102629.20", "Raw Gas": "130553", "Gas Percentage":"0.00", "Stabilization status": 1,"Run in status": 0,"Status": "0", "timestamp": "115"}
    cost 10028 ms
    time stamp: 125251869000 ns next call: 118221856000 ns

    I am using esp32s3 with lib version 2.4.0.0. my code is similar with stm32f411.

    I viewed bst bme integration guide found this: but I do not know how to fix this: 

    MarkWalen_0-1703407293114.png

     

    4 REPLIES 4

    BSTRobin
    Community Moderator
    Community Moderator

    Hi Mark-Walen,

    Where did you get warning code 100 when you run your software code?
    Previous reference code run on STM32 for C language, you need to migrate it your ESP32S3 platform.

    Yes, I already migrate to esp32s3 use libalgobsec.a of esp32s3 and esp32s3 hal api. I use c language.

    I get warning code after call `bsec_sensor_control(time_stamp, &sensor_settings);` in bsec_iot_loop();there is no delay function in my code.

    void bsec_iot_loop(sleep_fct sleep_n, get_timestamp_us_fct get_timestamp_us, output_ready_fct_t output_ready,
        state_save_fct state_save, uint32_t save_intvl)
    {
        /* Timestamp variables */
        int64_t time_stamp = 0;
        uint32_t tick_before, tick_after;
       
        /* BSEC sensor settings struct */
        bsec_bme_settings_t sensor_settings;
        memset(&sensor_settings, 0, sizeof(sensor_settings));
       
        /* BSEC sensor data */
        struct bme68x_data data;
       
        uint8_t nFieldsLeft = 0;
        uint32_t bsec_state_len = 0;
        uint32_t n_samples = 0;
        int8_t ret_val;
       
        opMode = sensor_settings.op_mode;
       
        bsec_library_return_t bsec_status = BSEC_OK;
        sensor_settings.next_call = 0;
       
        while (1)
        {
            tick_before = get_timestamp();
            /* get the timestamp in nanoseconds before calling bsec_sensor_control() */
            // time_stamp = get_timestamp_us() * 1000;
            time_stamp = get_timestamp_us() * 1000;
            if (time_stamp >= sensor_settings.next_call)
            {
                printf("time stamp: %" PRId64 " next call: %" PRId64 "\r\n", time_stamp, sensor_settings.next_call);
                /* Retrieve sensor settings to be used in this time instant by calling bsec_sensor_control */
                bsec_status = bsec_sensor_control(time_stamp, &sensor_settings);
                if (bsec_status != BSEC_OK)
                {
                    if (bsec_status < BSEC_OK)
                    {
                        printf("ERROR: bsec_sensor_control: %d\n", bsec_status);
                        break;
                    }
                    else
                    {
                        printf("WARNING: bsec_sensor_control: %d\n", bsec_status);
                    }
                }
                switch (sensor_settings.op_mode)
                {
                case BME68X_FORCED_MODE:
                    setBme68xConfigForced(&sensor_settings);
                    break;
                case BME68X_PARALLEL_MODE:
                    if (opMode != sensor_settings.op_mode)
                    {
                        setBme68xConfigParallel(&sensor_settings);
                    }
                    break;
                case BME68X_SLEEP_MODE:
                    if (opMode != sensor_settings.op_mode)
                    {
                        ret_val = bme68x_set_op_mode(BME68X_SLEEP_MODE, &bme68x_g);
                        if ((ret_val == BME68X_OK) && (opMode != BME68X_SLEEP_MODE))
                        {
                            opMode = BME68X_SLEEP_MODE;
                        }
                    }
                    break;
                }
               
                if (sensor_settings.trigger_measurement && sensor_settings.op_mode != BME68X_SLEEP_MODE)
                {
                    nFields = 0;
                    bme68x_get_data(lastOpMode, &sensor_data[0], &nFields, &bme68x_g);
                    iFields = 0;
                    if(nFields)
                    {
                        do
                        {
                            nFieldsLeft = getData(&data);
                            /* check for valid gas data */
                            if (data.status & BME68X_GASM_VALID_MSK)
                            {
                                if (!processData(time_stamp, data, sensor_settings.process_data, output_ready))
                                {
                                    return;
                                }
                            }
                        }while(nFieldsLeft);
                    }
                }
               
                /* Increment sample counter */
                n_samples++;
               
                /* Retrieve and store state if the passed save_intvl */
                if (n_samples >= save_intvl)
                {
                    bsec_status = bsec_get_state(0, bsec_state, sizeof(bsec_state), work_buffer, sizeof(work_buffer), &bsec_state_len);
                    if (bsec_status == BSEC_OK)
                    {
                        state_save(bsec_state, bsec_state_len);
                    }
                    n_samples = 0;
                }
            }
            tick_after = get_timestamp();
            printf("cost %u ms\r\n", (tick_after - tick_before)/1000);
        }
    }

    Hi BSTRobin,

    I get warning code when i call `bsec_sensor_control(time_stamp, &sensor_settings);` in bsec_iot_loop();

    My program language is c. I already migrate my platform: using esp32 hal api and BSEC API for esp32s3. There is no delay function in bsec_iot_loop:

    void bsec_iot_loop(sleep_fct sleep_n, get_timestamp_us_fct get_timestamp_us, output_ready_fct_t output_ready,
        state_save_fct state_save, uint32_t save_intvl)
    {
        /* Timestamp variables */
        int64_t time_stamp = 0;
    	uint32_t tick_before, tick_after;
        
        /* BSEC sensor settings struct */
        bsec_bme_settings_t sensor_settings;
    	memset(&sensor_settings, 0, sizeof(sensor_settings));
    	
    	/* BSEC sensor data */
    	struct bme68x_data data;
        
    	uint8_t nFieldsLeft = 0;
        uint32_t bsec_state_len = 0;
        uint32_t n_samples = 0;
    	int8_t ret_val;
    	
        opMode = sensor_settings.op_mode;
    	
        bsec_library_return_t bsec_status = BSEC_OK;
    	sensor_settings.next_call = 0;
    	
        while (1)
        {
        	tick_before = get_timestamp();
            /* get the timestamp in nanoseconds before calling bsec_sensor_control() */
            // time_stamp = get_timestamp_us() * 1000;
            time_stamp = get_timestamp_us() * 1000;
    		if (time_stamp >= sensor_settings.next_call)
    		{
                printf("time stamp: %" PRId64 " next call: %" PRId64 "\r\n", time_stamp, sensor_settings.next_call);
    			/* Retrieve sensor settings to be used in this time instant by calling bsec_sensor_control */
    			bsec_status = bsec_sensor_control(time_stamp, &sensor_settings);
    			if (bsec_status != BSEC_OK)
    			{
    				if (bsec_status < BSEC_OK)
    				{
    					printf("ERROR: bsec_sensor_control: %d\n", bsec_status);
    					break;
    				}
    				else
    				{
    					printf("WARNING: bsec_sensor_control: %d\n", bsec_status);
    				}
    			}
    			switch (sensor_settings.op_mode)
    			{
    			case BME68X_FORCED_MODE:
    				setBme68xConfigForced(&sensor_settings);
    				break;
    			case BME68X_PARALLEL_MODE:
    				if (opMode != sensor_settings.op_mode)
    				{
    					setBme68xConfigParallel(&sensor_settings);
    				}
    				break;
    			case BME68X_SLEEP_MODE:
    				if (opMode != sensor_settings.op_mode)
    				{
    					ret_val = bme68x_set_op_mode(BME68X_SLEEP_MODE, &bme68x_g);
    					if ((ret_val == BME68X_OK) && (opMode != BME68X_SLEEP_MODE))
    					{
    						opMode = BME68X_SLEEP_MODE;
    					}
    				}
    				break;
    			}
    			
    			if (sensor_settings.trigger_measurement && sensor_settings.op_mode != BME68X_SLEEP_MODE)
    			{
    				nFields = 0;
    				bme68x_get_data(lastOpMode, &sensor_data[0], &nFields, &bme68x_g);
    				iFields = 0;
    				if(nFields)
    				{
    					do
    					{
    						nFieldsLeft = getData(&data);
    						/* check for valid gas data */
    						if (data.status & BME68X_GASM_VALID_MSK)
    						{
    							if (!processData(time_stamp, data, sensor_settings.process_data, output_ready))
    							{
    								return;
    							}
    						}
    					}while(nFieldsLeft);
    				}
    			}
    			
    			/* Increment sample counter */
    			n_samples++;
    			
    			/* Retrieve and store state if the passed save_intvl */
    			if (n_samples >= save_intvl)
    			{
    				bsec_status = bsec_get_state(0, bsec_state, sizeof(bsec_state), work_buffer, sizeof(work_buffer), &bsec_state_len);
    				if (bsec_status == BSEC_OK)
    				{
    					state_save(bsec_state, bsec_state_len);
    				}
    				n_samples = 0;
    			}
    		}
    		tick_after = get_timestamp();
    		printf("cost %u ms\r\n", (tick_after - tick_before)/1000);
    	}
    }

    BSTRobin
    Community Moderator
    Community Moderator

    Hi Mark-Walen,

    Return value 100(BSEC_W_SC_CALL_TIMING_VIOLATION) means "Difference between actual and defined sampling intervals of bsec_sensor_control() greater than allowed", you need to strictly refer to previous example 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