BME680 bme68x_init(&bme) "wrong dev->chip_id" failing with -3

Hi,

I have a board which has bme680 already attached, I am running a linux for embedded devices i.e. compiled with buildroot.

:/root# i2cdetect -y 1

0 1 2 3 4 5 6 7 8 9 a b c d e f

00: -- -- -- -- -- -- -- -- -- -- -- -- --

10: UU -- -- -- -- -- -- -- -- -- -- -- -- UU -- --

20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

30: -- -- -- -- -- -- -- -- 38 -- -- -- -- -- -- --

40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

50: -- 51 -- -- -- -- -- 57 -- -- 5a -- -- -- -- --

60: -- -- -- -- 64 -- -- -- 68 -- -- -- -- -- -- UU

70: UU -- -- -- -- -- UU --

The bold UU is the place where the bme680 is connected to, this is what I have been told and I run some micropython code to get the reading from the sensor as follows,

TEMP:30.94C

HUMIDITY:7.207%

PRESSURE:1027.23hPa

GAS:235016.0

The micropython uses /sys/bus/i2c/drivers/bme680_i2c/1-0076/iio:device*/name" in the python code.

But when I try to use the Bosch Sensortec Environmental Cluster (BSEC) Software instead of my micropython code with my main-custom.c file using bme68x.c, bme68x.c and bme68x_defs and compile all together using the libalgobsec.a file provided for the RaspberryPi/PiFour_Armv8 using command

/toolchain/bin/aarch64-linux-gcc main-custom.c \
-o main -L ./algo/bsec_IAQ/bin/RaspberryPi/PiFour_Armv8 \
-lalgobsec -lm -I./algo/bsec_IAQ/bin/RaspberryPi/PiFour_Armv8 \
-I ./algo/bsec_IAQ/bin/RaspberryPi/PiFour_Armv8  \
-I ./bme68x/ \
-Wall ./mycode.c \
-Wall ./bme68x/bme68x.c

, I get the following error,

I get "API name [bme68x_init] Error [-3] : Device not found" on bme68x_init(&bme),

when I tried debugging I found that following is never true in the following code because dev->chip_id is always equal to 241 i.e. 0xf1,

dev->chip_id == BME68X_CHIP_ID

I then changed the following in the bme68x_defs.h file and assigned it 0x0f1 value, afterwards I didn't get that error but I don't get any reading from the sensor too.

BME68X_CHIP_ID UINT8_C(0x61)

what I don't understand is that why I get the wrong chip_id, for bme680 shouldn't it be unique across the globe i.e. 0x61 ?

9 replies