Skip to content

Initially fetching data from ccs811 fails #16

Description

@nmpluta

First 3 fetching of ccs811 data fails:

*** Booting My Application v1.0.0-c088546a5393 ***
*** Using nRF Connect SDK v3.1.0-6c6e5b32496e ***
*** Using Zephyr OS v4.1.99-1612683d4010 ***
[00:00:00.286,224] <inf> main: Zephyr Fire Detection System 1.0.0
[00:00:00.286,224] <inf> main: Blink LED initialized successfully
[00:00:00.286,254] <inf> controller_module: Initializing controller module
[00:00:00.286,254] <inf> controller_module: Controller state machine initialized
[00:00:00.286,285] <inf> controller_module: Controller SM: Initializing
[00:00:00.286,285] <inf> sensor_module: Sensor state machine initialized
[00:00:00.286,315] <inf> sensor_module: Sensor SM: Initializing sensors
[00:00:00.286,346] <inf> sensor_module: BME280 sensor initialized successfully
[00:00:00.286,346] <inf> sensor_module: CCS811 sensor initialized successfully
[00:00:00.286,376] <inf> sensor_module: HM3301 sensor initialized successfully
[00:00:00.286,376] <inf> sensor_module: Sensor initialization complete: 3/3 sensors ready
[00:00:00.286,407] <inf> sensor_module: Sensor SM: Initialization complete
[00:00:00.286,437] <inf> sensor_module: Sensor module initialized successfully - sensor thread running
[00:00:00.286,437] <inf> controller_module: Controller SM: Initialization complete
[00:00:00.286,468] <inf> controller_module: Controller module initialized successfully
[00:00:00.286,468] <inf> controller_module: Controller: Starting data sampling
[00:00:00.286,468] <inf> main: System initialized successfully
[00:00:00.286,529] <inf> controller_module: Controller thread started
[00:00:00.286,590] <inf> sensor_module: Sensor thread started - processing ZBUS requests directly
[00:00:01.389,282] <err> sensor_module: Could not fetch CCS811 sample (-11)
[00:00:01.389,312] <wrn> sensor_module: Sensor SM: CCS811 read failed (-11)
[00:00:01.390,777] <wrn> sensor_module: Sensor SM: Partial sensor failure (2/3 successful), but publishing available data
[00:00:01.390,808] <inf> controller_module: BME280: Temp: 21.640000 C, Press: 99.170566 kPa, Hum: 56.452148 %
[00:00:01.390,808] <inf> controller_module: CCS811: CO2: 0 ppm, VOC: 0 ppb
[00:00:01.390,838] <inf> controller_module: HM3301: PM1.0: 3 ug/m3, PM2.5: 4 ug/m3, PM10: 4 ug/m3
[00:00:01.390,838] <inf> controller_module: Sensor data timestamp: 1387 ms
[00:00:02.389,892] <err> sensor_module: Could not fetch CCS811 sample (-11)
[00:00:02.389,923] <wrn> sensor_module: Sensor SM: CCS811 read failed (-11)
[00:00:02.391,387] <wrn> sensor_module: Sensor SM: Partial sensor failure (2/3 successful), but publishing available data
[00:00:02.391,418] <inf> controller_module: BME280: Temp: 21.640000 C, Press: 99.170226 kPa, Hum: 56.440429 %
[00:00:02.391,418] <inf> controller_module: CCS811: CO2: 0 ppm, VOC: 0 ppb
[00:00:02.391,418] <inf> controller_module: HM3301: PM1.0: 3 ug/m3, PM2.5: 4 ug/m3, PM10: 4 ug/m3
[00:00:02.391,448] <inf> controller_module: Sensor data timestamp: 2388 ms
[00:00:03.390,777] <err> sensor_module: Could not fetch CCS811 sample (-11)
[00:00:03.390,838] <wrn> sensor_module: Sensor SM: CCS811 read failed (-11)
[00:00:03.392,303] <wrn> sensor_module: Sensor SM: Partial sensor failure (2/3 successful), but publishing available data
[00:00:03.392,333] <inf> controller_module: BME280: Temp: 21.640000 C, Press: 99.169812 kPa, Hum: 56.429687 %

it's due to the fact that this sensors needs to stabilize before fetching, previously it was implemented in the main as:

	/* Wait for sensors to stabilize */
	k_sleep(K_MSEC(SENSORS_WARMUP_DELAY_MS));

with warmup delay equal to 5 seconds, after which sensors where initialized.

Warmup was removed in PR: #15 causing described bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions