This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf9160 dk and adxl362 building but not running Error; ADXL362: Unable to get GPIO SPI CS device

Hello,

I am using an Adxl362 accelerometer on nrf9160 dk board.

I followed the tutorial a to add the overlay file and even configure the pins i want to use by flashing an appropiate firmware to the nrf52 SoC.

After all the setUp,configuration and wiring i end up the the error;

[00:00:00.000,061] <err> ADXL362: Unable to get GPIO SPI CS device.

I have been trying to make this work for throughout the entire weekend but i have not been successful.

Please find below the content of my files,

nrf9160_pca10090ns.overlay;

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
&spi3 {
compatible = "nordic,nrf-spim";
status = "okay";
sck-pin = <3>;
mosi-pin = <4>;
miso-pin = <5>;
cs-gpios = <&gpio0 8 0>, <&gpio0 7 0>;
adxl362@0 {
compatible = "adi,adxl362";
label = "ADXL362";
spi-max-frequency = <8000000>;
reg = <0x00>;
int1-gpios = <&gpio0 9 0>;
};
};
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

 prj.conf;

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
CONFIG_STDOUT_CONSOLE=y
CONFIG_SPI=y
CONFIG_SENSOR=y
CONFIG_ADXL362=y
CONFIG_ADXL362_TRIGGER_GLOBAL_THREAD=y
CONFIG_ADXL362_INTERRUPT_MODE=1
CONFIG_ADXL362_ABS_REF_MODE=1
#required
CONFIG_SPI_3=y
CONFIG_SPI_3_NRF_SPIM=y
CONFIG_SPI_NRFX=y
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_LOG=y
CONFIG_LOG_DEFAULT_LEVEL=4
CONFIG_TRUSTED_EXECUTION_NONSECURE=y
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Im using the adxl362 sample code found in zephyr;

https://github.com/zephyrproject-rtos/zephyr/tree/master/samples/sensor/adxl362

Please let me know what i am doing wrong

Thanks and regards

  • I don't have the adxl362 sensor at hand at the moment, so I don't have the chance to test this. However, I tested it with a Thingy:91 (which has an adxl362 built-in), and it compiled and run without any errors. Do you have a Thingy:91 to test with? I see your overlay file looks exactly like the spi3 node for the Thingy:91 (except for the adxl372 node), so I am not sure at first sight what may cause the error.

    What version of NCS are you using? Make sure to checkout v1.2.0 and run west update.

    I can see that device_get_binding() tries to get the device structure of the device with the name "GPIO_0" (config->gpio_cs_port=DT_INST_0_ADI_ADXL362_CS_GPIOS_CONTROLLER="GPIO_0"). The GPIO_0 device structure is created here.

    • Could you check if  DT_NORDIC_NRF_GPIO_40842500_LABEL  "GPIO_0" is present in  ..\adxl362\build\zephyr\include\generated\devicetree_unfixed.h
    • Just for a test, could you try to set CONFIG_SENSOR_INIT_PRIORITY to a lower priority than CONFIG_KERNEL_INIT_PRIORITY_DEFAULT in prj.conf, and see if the adxl362 sample still fails?

    Best regards,

    Simon