zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.99k stars 6.69k forks source link

BME680 Sensor is not building #21607

Closed md-jamal closed 4 years ago

md-jamal commented 4 years ago

Describe the bug A clear and concise description of what the bug is. What have you tried to diagnose or workaround this issue?

To Reproduce Steps to reproduce the behavior: $ west build -b sam_e70_xplained samples/sensor/bme680

Expected behavior Build failed. From one of the issues, it says to update device tree . Can you please provide an sample device tree for bme680

Adding this, didn't work

bme680@77 { compatible = "bosch,bme680"; reg = <0x77>; };

Screenshots or console output /home/abc/zephyrproject/zephyr/samples/sensor/bme680/src/main.c:14:42: error: 'DT_INST_0_BOSCH_BME680_LABEL' undeclared (first use in this function); did you mean 'DT_INST_0_SOC_NV_FLASH_LABEL'? struct device *dev = device_get_binding(DT_INST_0_BOSCH_BME680_LABEL); ^~~~~~~~ DT_INST_0_SOC_NV_FLASH_LABEL

Environment (please complete the following information):

Additional context Add any other context about the problem here.

ulfalizer commented 4 years ago

CC @BoschSensortec

Not familiar with this device, but try making it

bme680@77 {
    compatible = "bosch,bme680";
    reg = <0x77>;
    label = "BME680";
};

Doing a git grep for some of the other compatible strings you'll find in the bindings in dts/bindings/sensor/ might be helpful too, e.g. bosch,bmg160.

md-jamal commented 4 years ago

Added the following to sam_e70_xplained.overlay

bme680@77 {
    compatible = "bosch,bme680";
    reg = <0x77>;
    label = "BME680";
};

I get the following error:

Error: sam_e70_xplained.dts.pre.tmp:403.1-10 syntax error
FATAL ERROR: Unable to parse input tree
CMake Error at /home/abc/zephyrproject/zephyr/cmake/dts.cmake:183 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  /home/abc/zephyrproject/zephyr/cmake/app/boilerplate.cmake:460 (include)
  CMakeLists.txt:8 (include)
pabigot commented 4 years ago

The node has to be a child of an I2C controller. E.g.:

&i2c0 {
  bme60@77 {
    label = "bme680";
    compatible = "bosch,bme680";
    reg = <0x77>;
  };
};
md-jamal commented 4 years ago

It worked...

carlescufi commented 4 years ago

I believe the issue is that you need to add a bme680 instance in your device tree file.

carlescufi commented 4 years ago

Try something like this:

&i2c1 {
    compatible = ...

    bme680@76 {
        compatible = "bosch,bme680";
        label = "BME680";
        reg = <0x76>;
    };
};
nashif commented 4 years ago

seems to be answered, closing.