Hi ,
I am trying to integrate LSM6DSL to BL5340 module(laird connectivity) through SPI but I am getting failed on initialization. I am noob to NRF so could someone please help to resolve it.
Thanks in advance
/{
alaises{
imusensor = &imu_sensor;
};
};
&spi4 {
compatible = "nordic,nrf-spim";
status = "okay";
pinctrl-0 = <&spi4_default>;
pinctrl-1 = <&spi4_sleep>;
pinctrl-names = "default","sleep";
cs-gpios = <&gpio0 11 0>;
/* IMU Sensor 6 Axis: ST LSM6DSL */
imu_sensor: lsm6dsl@0 {
compatible = "st,lsm6dsl";
status = "okay";
reg = <0>;
irq-gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
spi-max-frequency = <10000000>;
};
};
/* The devicetree node identifier for the "imusensor" alias. */
#define IMU_SENSOR DT_ALIAS(imusensor)
static const struct device *const imu_dev = DEVICE_DT_GET(IMU_SENSOR);
void imu_init(void) {
LOG_DBG("%s ", imu_dev->name);
/* Check if device is initialized correctly. */
if (!device_is_ready(imu_dev)) {
/* Not ready, do not use */
LOG_DBG("IMU device init fail.");
return;
}
LOG_DBG("%s IMU Sensor found", imu_dev->name);
}