Problem BSEC 2.4.0.0 with BSEC_SAMPLE_RATE_LP

Hi,

I have a problem with the library BSEC 2.4.0.0 initialized with "BSEC_SAMPLE_RATE_LP".

I'm using IAR with a BME688 connected via I2C to a nucleo-l432kc board.

If I use BSEC_SAMPLE_RATE_SCAN with these subscribes {
BSEC_OUTPUT_RAW_GAS_INDEX,
BSEC_OUTPUT_RAW_TEMPERATURE,
BSEC_OUTPUT_RAW_PRESSURE,
BSEC_OUTPUT_RAW_HUMIDITY,
BSEC_OUTPUT_RAW_GAS,
BSEC_OUTPUT_GAS_ESTIMATE_1,
BSEC_OUTPUT_GAS_ESTIMATE_2,
BSEC_OUTPUT_GAS_ESTIMATE_3,
BSEC_OUTPUT_GAS_ESTIMATE_4

it works correctly.

 

But when I use BSEC_SAMPLE_RATE_LP with these subscribes {
BSEC_OUTPUT_IAQ,
BSEC_OUTPUT_RAW_TEMPERATURE,
BSEC_OUTPUT_RAW_PRESSURE,
BSEC_OUTPUT_RAW_HUMIDITY,
BSEC_OUTPUT_RAW_GAS,
}

I have this warning in "bsec_sensor_control": BSEC_W_SC_CALL_TIMING_VIOLATION and all output (T, H, P, IAQ) is zero.

 

 

I attach two screens:

- 1: initialization is with BSEC_SAMPLE_RATE_SCAN

- 2: initialization is with BSEC_SAMPLE_RATE_LP

 

Thanks,

Edo

 

 

2.jpg
243.88KB
1.jpg
238.98KB
Best reply by Prop4et

Hi Edo,

from the BSEC documentation it is stated that the  BSEC_W_SC_CALL_TIMING_VIOLATION error is returned when "The timestamp at which bsec_sensor_control(timestamp) is called differs from the target timestamp which was returned during the previous call in the .next_call struct member by more than 6.25%".

The BSEC_SAMPLE_RATE_SCAN is defined as 0.055556f, so the frequency is 1/18Hz, so basically it samples every 18 seconds while the BSEC_SAMPLE_RATE_LP is  0.33333f and the frequency is 1/3Hz, so the samples are every 3 seconds. I'm afraid that by calling the tick function and saving the value to a variable that is then passed to the bsec_sensor_control() function wastes enough time in case of LP to get you outside of the 6.25% margin, while it keeps you in the margin for the 18 seconds interval. 
Try to call the tick function inside bsec_sensor_control and let me know if this was the problem or if i got it wrong.

Francesco

View original
2 replies
Resolved