Failed to detect CCS811 at I2C 0x5a

If you are asking a question, please follow this template:

  1. My goal is: to run the code and get the sensor data of ccs811
  2. My actions are: I’m using esp32 board. I cloned the repo from https://github.com/mongoose-os apps/empty app2 and I copy the code from ccs811 library and also included the library in ccs811 then I build and flash the code.
    this is my src/main.c code which I copied from the driver:

    this my mos.yml config:
  3. The result I see is:
  4. My expectation & question is: Why I’m I getting this error? even though I added the library and config.

The log says that the device with address 0x5a is not a CCS811 or it is not found.

According to the datasheet it may have either 0x5a or 0x5b.

You can also add the rpc-service-i2c library

  - origin: https://github.com/mongoose-os-libs/rpc-service-i2c

and after rebuilding and reflashing run

mos call I2C.Scan

which will give you a list of I2C (in decimal) addresses discovered on the bus.

1 Like

When I scan the I2c bus, the address is indeed 0x5B. But I am still receiving the same error message: “mgos_ccs811.c:86 Failed to detect CCS811 at I2C 0x5b”… Below my mos.yml and my main.c…Any suggestion ?