nRF52840 and LSM303AGR accelerometer (SPI) #nrf52840

Arkadiusz Cichocki


I'm trying to read data from the LSM303AGR accelerometer using SPI. The microcontroller which I use is nRF52840. I want to use the LIS2DH driver which is implemented in Zephyr.

I added the following device description to the board's device tree:

&spi1 {
    status = "ok";
    sck-pin = <5>;
    mosi-pin = <4>;
    miso-pin = <6>;
    cs-gpios = <&gpio0 22 0>, <&gpio0 25 0>;

    lsm303agr_acc0: lis2dh@0 {
        compatible = "st,lis2dh";
        reg = <0>;
        spi-max-frequency = <1000000>;
        irq-gpios = <&gpio0 2 GPIO_INT_ACTIVE_LOW>, <&gpio0 3 GPIO_INT_ACTIVE_LOW>;
        label = "LSM303AGR_ACC_0";

It corresponds to the connections of the real device.

I check the correctness of the operation using the example code from 

I have removed magnetometer related part of the code and changed config from SPI to I2C in prj.conf file too.

Unfortunately, measurements fail.


Does anyone have any experience with the presented configuration? Thanks in advance for any suggestions.


Best regards,



Join to automatically receive all group messages.