Hello I am working on BME680 sensor for my enviromental project, As per suggestion I am using BSEC Library, I have intedgrated with my MCU and it works fine , while reading continuously , This was my fist phase of the project which is completed, But now I want to my MCU to be in low power mode , My MCU will goes into sleep mode for 5 mins and wake up collect data from the BME680 and then goes to sleep. But the provlem occurs here , when the MCU runs in continous mode IAQ accuracy works fine ( 0 , 1 ,2 and 3) , Like for example when the IAQ accuracy is set to 1 or 2 , and then I active the sleep mode , after five minutes when the MCU wakes up , I notice that IAQ accuracy is reset to zero (0). I am working from last one week yet the problem still exists. Any help regarding this will much be appreciated. Thanks This is the initialization IoT endless loop while (1)
{
if ( onoffflag == 1 )
{
/* get the timestamp in nanoseconds before calling bsec_sensor_control() */
time_stamp = get_timestamp_us() * 1000;
/* Retrieve sensor settings to be used in this time instant by calling bsec_sensor_control */
bsec_sensor_control(time_stamp, &sensor_settings);
/* Trigger a measurement if necessary */
bme680_bsec_trigger_measurement(&sensor_settings, sleep);
/* Read data from last measurement */
num_bsec_inputs = 0;
bme680_bsec_read_data(time_stamp, bsec_inputs, &num_bsec_inputs, sensor_settings.process_data);
/* Time to invoke BSEC to perform the actual processing */
bme680_bsec_process_data(bsec_inputs, num_bsec_inputs, output_ready);
/* 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_loop, sizeof(bsec_state_loop), work_buffer, sizeof(work_buffer), &bsec_state_len_loop);
if (bsec_status == BSEC_OK)
{
state_save(bsec_state_loop, bsec_state_len_loop);
}
n_samples = 0;
}
/* Compute how long we can sleep until we need to call bsec_sensor_control() next */
/* Time_stamp is converted from microseconds to nanoseconds first and then the difference to milliseconds */
time_stamp_interval_ms = (sensor_settings.next_call - get_timestamp_us() * 1000) / 1000000;
if (time_stamp_interval_ms > 0)
{
sleep((uint32_t)time_stamp_interval_ms);
}
}
... View more