Re: Adafruit Feature nRF52 bit bang i2c

Tomas McGuinness <tomasmcguinness@...>

After some reading, I settled on these settings:














With your DTS configuration of


&i2c0 {

    bme280@76 {

        compatible = "bosch,bme280";

        label = "BME280";

        reg = <0x76>;




I get this trace!


Everything seems to be working now.


***** Booting Zephyr OS build zephyr-v1.14.0-2748-g4eb85176e325 *****

Simple Light

Dev 0x20004350 name BME280

nt: 8

[temp: 22.950000; press: 100.875410; humidity: 51.296875

0:00:00.000,000] <dbg> mpu.region_init: [0] 0x00000000 0x07020024

[00:00:00.000,000] <dbg> mpu.region_init: [1] 0x20000000 0x110b001e

[00:00:00.000,000] <dbg> bt_hci_core.bt_hci_driver_register: Registered Controller

[00:00:00.000,000] <dbg> BME280.bme280_chip_init: BME280 chip detected

[00:00:00.005,126] <dbg> temp_nrf5.temp_nrf5_init:

temp: 22.950000; press: 100.875074; humidity: 51.296875

temp: 22.950000; press: 100.874640; humidity: 51.296875

temp: 22.950000; press: 100.874640; humidity: 51.286132

temp: 22.950000; press: 100.874980; humidity: 51.296875


Thanks for pointing me in the right direction, Benjamin!




Sent from Mail for Windows 10


From: Tomas McGuinness
Sent: 07 August 2019 13:41
To: devel@...
Subject: RE: [Zephyr-devel] Adafruit Feature nRF52 bit bang i2c




I added that entry to a file called nrf52_adafruit_feather.overlay


I had to add CONFIG_I2C_0=y to my proj file also, so it includes these settings now:








However, when I flash the adafruit, I get a serious looking error message:


***** Booting Zephyr OS build zephyr-v1.14.0-2748-g4eb85176e325 *****

Simple Light

[00:00:00.012,939] <err> os: ***** USAGE FAULT *****

[00:00:00.012,939] <err> os:   Attempt to execute undefined instruction

[00:00:00.012,969] <err> os: r0/a1:  0x20004324  r1/a2:  0x0000000a  r2/a3:  0x0000d4e6

[00:00:00.013,000] <err> os: r3/a4:  0x20001d28 r12/ip:  0x20001c94 r14/lr:  0x00000aab

[00:00:00.013,000] <err> os:  xpsr:  0x61000000

[00:00:00.013,031] <err> os: Faulting instruction address (r15/pc): 0x00000aba

[00:00:00.013,031] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception

[00:00:00.013,031] <err> os: Current thread: 0x20000f54 (unknown)

[00:00:00.072,937] <err> os: Halting system


Sent from Mail for Windows 10


From: Benjamin Lindqvist <benjamin.lindqvist@...>
Sent: Monday, August 5, 2019 2:13:04 PM
To: Tomas McGuinness <tomasmcguinness@...>
Subject: Re: [Zephyr-devel] Adafruit Feature nRF52 bit bang i2c


You need to add the bme280 to your device tree file. Something like:


&i2c0 {
        bme280@76 {
                compatible = "bosch,bme280";
                label = "BME280";
                reg = <0x76>;



On Mon, Aug 5, 2019 at 3:04 PM Tomas McGuinness <tomasmcguinness@...> wrote:



I’m quite new to Zephyr and I’m trying to connect a BME280 to an Adafruit Feature nRF52832. As the I2C device driver isn’t available on the Adafruit Feature nRF52832, I want to try and use the Big Bang approach. I’m using the latest build of Zephyr.


My prj.config includes these settings:








When I try and build the project using west, I get


west build -b nrf52_adafruit_feather


In file included from C:/Development/zephyrproject/zephyr/drivers/sensor/bme280/bme280.c:24:

C:/Development/zephyrproject/zephyr/drivers/sensor/bme280/bme280.h:111:2: error: #error "BME280 device type not specified"

#error "BME280 device type not specified"


C:/Development/zephyrproject/zephyr/drivers/sensor/bme280/bme280.c: In function 'bme280_init':

C:/Development/zephyrproject/zephyr/drivers/sensor/bme280/bme280.c:357:22: warning: unused variable 'data' [-Wunused-variable]

  struct bme280_data *data = dev->driver_data;


In file included from C:/Development/zephyrproject/zephyr/include/drivers/sensor.h:23,

                 from C:/Development/zephyrproject/zephyr/drivers/sensor/bme280/bme280.c:11:

C:/Development/zephyrproject/zephyr/drivers/sensor/bme280/bme280.c: At top level:

C:/Development/zephyrproject/zephyr/drivers/sensor/bme280/bme280.c:385:29: error: 'DT_INST_0_BOSCH_BME280_LABEL' undeclared here (not in a function); did you mean 'DT_INST_0_SOC_NV_FLASH_LABEL'?

DEVICE_AND_API_INIT(bme280, DT_INST_0_BOSCH_BME280_LABEL, bme280_init, &bme280_data,


C:/Development/zephyrproject/zephyr/include/device.h:107:11: note: in definition of macro 'DEVICE_AND_API_INIT'

   .name = drv_name, .init = (init_fn),     \


[79/177] Building C object zephyr/drivers/i2c/CMakeFiles/drivers__i2c.dir/i2c_gpio.c.obj

C:/Development/zephyrproject/zephyr/drivers/i2c/i2c_gpio.c:94:12: warning: 'i2c_gpio_init' defined but not used [-Wunused-function]

static int i2c_gpio_init(struct device *dev)


C:/Development/zephyrproject/zephyr/drivers/i2c/i2c_gpio.c:89:30: warning: 'api' defined but not used [-Wunused-variable]

static struct i2c_driver_api api = {



I know the Adafruit supports I2c (since it marks two pins for it). I also look at a look at the dts file for this board and can see an etry:


&i2c0 {

                sda-pin = <25>;

                scl-pin = <26>;



Is support for the i2c device a work in progress?


Any help would be appreciated.


Sent from Mail for Windows 10



Join to automatically receive all group messages.