Hi,
I have problem to use bmi160 library with nrf5340 in spi connection.
I use the example application zephyr/samples/sensor/adxl372 and change the sensor to bmi160 ( with zephyr driver).
my nrf5340dk_nrf5340_cpuapp.overlay config
&spi2 {
cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
bmi160@76 {
compatible = "bosch,bmi160";
reg = <0x76>;
spi-max-frequency = <8000000>;
label = "BMI160";
int-gpios = <&gpio0 20 0>;
};
};
prj.conf
CONFIG_STDOUT_CONSOLE=y CONFIG_LOG=y CONFIG_SPI=y CONFIG_SENSOR=y CONFIG_BMI160=y CONFIG_BMI160_TRIGGER_OWN_THREAD=y CONFIG_SENSOR_LOG_LEVEL_WRN=y CONFIG_CBPRINTF_FP_SUPPORT=y
snippet in main.c
void main(void)
{
struct sensor_value accel[3];
double mag;
int i;
char meter[200];
const struct device *dev = DEVICE_DT_GET_ANY(bosch_bmi160);//
if (!device_is_ready(dev)) {
printf("Device %s is not ready\n", dev->name);
return;
}
In zephyr/drivers/sensor/bmi160/bmi160.c line 985
#define BMI160_DEVICE_INIT(inst) \ DEVICE_DT_INST_DEFINE(inst, bmi160_init, NULL, \ &bmi160_data_##inst, &bmi160_cfg_##inst, \ POST_KERNEL, CONFIG_SENSOR_INIT_PRIORITY, \ &bmi160_api);
The device is registered. This is by far I can look into zephyr, however I don't have proper way to debug the zephyr system where a lots of function were formulated in macro.