LSM6DSL is failing on custom board with NRF5340soc

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);
}

Parents Reply
  • Hi,

    I suggest to connect a logic analyzer to the spi pins and irq, to see what data is actually sent/received. Just to check if it looks okey (clock toggle as expected, chip select go low, data on miso/mosi etc). Maybe some of the pins are not connected or setup correctly, maybe the sensor is not working/powered as expected.

    sorry that provisions are not available in our board

    I notice you are using gpio port0 pin2, which overlap with nfc, so make sure you do the following in the overlay file:

    &uicr {
        nfct-pins-as-gpios;
    };

    Thanks for the input I tried but facing same error

    Also, it's spelled aliases, in case that can be part of the problem.

    Sorry that's my typo mistake in overlay it was fine

    Thanks

    S.M

Children
Related