Re: Adafruit Feature nRF52 bit bang i2c


Benjamin Lindqvist
 

It's not easy to comment on what caused the usage fault without knowing what code is actually running on the device.


On Wed, Aug 7, 2019 at 3:02 PM Tomas McGuinness <tomasmcguinness@...> wrote:

Benjamin,

 

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:

 

CONFIG_I2C=y

CONFIG_I2C_0=y

 

CONFIG_SENSOR=y

CONFIG_BME280=y

 

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:

Hello,

 

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:

 

CONFIG_I2C=y

CONFIG_I2C_GPIO=y

 

CONFIG_SENSOR=y

CONFIG_BME280=y

 

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 devel@lists.zephyrproject.org to automatically receive all group messages.