Re: Adafruit Feature nRF52 bit bang i2c


Benjamin Lindqvist
 

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.