This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BME680 Zephyr example not working with the nRF52840-DK

I am keep trying to get the BME680 example to work with the nRF52840-DK using Zephyr.

I check and successfully find the node for the BME680, but "device_get_binding()" for the BME680 device returns NULL

What do I need to do to get the BME680 to work with the nRF52840-DK via I2C?

I get the following output via the serial monitor.

Hello! I'm running Zephyr 2.3.0 on nrf52840dk_nrf52840, a arm board.

No device "BME680" found; did initialization fail?

Following is are my files.

nrf52840dk_nrf52840.overlay

Fullscreen
1
2
3
4
5
6
7
&i2c0 {
bme680@77 {
compatible = "bosch,bme680";
reg = <0x77>;
label = "BME680";
};
};
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

prj.conf

Fullscreen
1
2
3
4
5
6
7
CONFIG_PRINTK=y
CONFIG_STDOUT_CONSOLE=y
CONFIG_PWM=y
CONFIG_LOG=y
CONFIG_PWM_LOG_LEVEL_DBG=y
CONFIG_I2C=y
CONFIG_BME680=y
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

main.c

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <zephyr.h>
#include <device.h>
#include <devicetree.h>
#include <drivers/gpio.h>
#include <sys/printk.h>
#include <sys/util.h>
#include <version.h>
#include <stdio.h>
#include <drivers/sensor.h>
// The devicetree node identifier for the "led0" alias.
#define LED0_NODE DT_ALIAS(led0)
#if DT_NODE_HAS_STATUS(LED0_NODE, okay)
#define LED0 DT_GPIO_LABEL(LED0_NODE, gpios)
#define PIN DT_GPIO_PIN(LED0_NODE, gpios)
#if DT_PHA_HAS_CELL(LED0_NODE, gpios, flags)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX