I am attempting to get the BMI270 sample working on an nRF5340DK, using nRF Connect SDK v1.6.0, but all attempts at device_get_binding("BMI270"), device_get_binding(DT_LABEL(DT_INST(0, bosch_bmi270))), and similar return null. I am using the following config and overlay files
#prj.conf CONFIG_UART_CONSOLE=n CONFIG_USE_SEGGER_RTT=y CONFIG_RTT_CONSOLE=y CONFIG_I2C=y CONFIG_SENSOR=y CONFIG_BMI270=y
/* nrf5340dk_nrf5340_cpuapp.overlay - no shield */ &arduino_i2c { status = "okay"; bmi270@68 { compatible = "bosch,bmi270"; reg = <0x68>; label = "BMI270"; }; };
On the hardware side I'm using a BMI270 breakout connecting SDA to P1.02 and SCL to P1.03.
I have also used a shield that sends SDA to P0.25 and SCL to P0.26, with the following overlay
/* nrf5340dk_nrf5340_cpuapp.overlay - with shield */ &i2c1 { sda-pin = <25>; scl-pin = <26>; }; &arduino_i2c { status = "okay"; bmi270@68 { compatible = "bosch,bmi270"; reg = <0x68>; label = "BMI270"; }; };
In all attempted cases
#include <zephyr.h> #include <device.h> #include <drivers/sensor.h> #include <stdio.h> void main(void) { const struct device *dev; dev = device_get_binding("BMI270"); if (dev == NULL) { printf("Could not get %s device\n", DT_LABEL(DT_INST(0, bosch_bmi270))); return; } ... }
gives the output
00> *** Booting Zephyr OS build v2.6.0-rc1-ncs1 *** 00> Could not get BMI270 device
in J-Link RTT Viewer.
Any help would be greatly appreciated.