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

adxl362 sample not compiling

Hi,

I am attempting to get the adxl362 sample working with the nrf9160 dk board. I am using the nordic SDK v1.2.0. I cannot get it to compile, compiling the code below fails with the error:

"DT_INST_0_ADI_ADXL362_LABEL undeclared".

I even tried downloading a fresh SDK install using the new toolchain manager. I have followed other adxl362 tickets on the forum without any success....the closest solution involved updating to the latest release which I have done.

Any help will be appreciated! 

Thanks in advance.

struct device *dev = device_get_binding(DT_INST_0_ADI_ADXL362_LABEL);
if (dev == NULL) {
printf("Device get binding device\n");
return;
}

overlay file:

&spi3 {
status = "ok";
sck-pin = <10>;
mosi-pin = <11>;
miso-pin = <12>;
ss-pin = <13>;
spi-max-frequency = <4000000>;

adxl362@0 {
compatible = "adi,adxl362";
label = "ADXL362";
spi-max-frequency = <4000000>;
reg = <0>;
int1-gpios = <&gpio0 9 0>;
};

config:

CONFIG_SENSOR=y
CONFIG_ADXL362=y
CONFIG_ADXL362_TRIGGER_GLOBAL_THREAD=y
CONFIG_ADXL362_INTERRUPT_MODE=1
CONFIG_ADXL362_ABS_REF_MODE=1

# SPI
CONFIG_SPI=y
CONFIG_SPI_3_NRF_SPIM=y
CONFIG_SPI_3=y 
CONFIG_SPI_NRFX=y

Parents
  • Have you tried the following?

    device_get_binding("ADXL362"); 
  • Thanks for your reply,

    That did clear that error, but now I have another error in adxl362.c

    "CONFIG_ADXL362_DEV_NAME undeclared":

    DEVICE_AND_API_INIT(adxl362, CONFIG_ADXL362_DEV_NAME, adxl362_init,
    &adxl362_data, NULL, POST_KERNEL,
    CONFIG_SENSOR_INIT_PRIORITY, &adxl362_api_funcs);

    If I replace CONFIG_ADXL362_DEV_NAME  with "SPI_3"  (a guess at this stage!) the error moves to "adxl362_config undeclared"

    What am I missing to set this up properly? 

  • Thanks,

    I am trying to add a adxl362 to the DK board as I am doing all my development on that, I will be transferring the code to the thingy for field testing though. 

  • But I will try that different formatting,

    Cheers

  • I tried the different formatting without success. 

    Thanks for you input though.

  • I tried this now (only compiling) on NCS 1.2.0. I put the following into a file called nrf9160_pca10090ns.overlay in the adxl362 sample folder. The .overlay file name is important it needs to match the board. This now compiles without error on my setup.

    &spi3 {
    compatible = "nordic,nrf-spim";
    status = "okay";
    sck-pin = <3>;
    mosi-pin = <4>;
    miso-pin = <5>;
    cs-gpios = <&gpio0 8 0>;

    adxl362@0 {
    compatible = "adi,adxl362";
    label = "ADXL362";
    spi-max-frequency = <8000000>;
    reg = <0>;
    int1-gpios = <&gpio0 9 0>;
    };
    };

  • Hi Jon,

    So I finally have the adxl362 working. I had downloaded the latest version of the SDK in a new directory for testing but even after loading the adxl362 sample project from the new directory SES was still compiling the project using the older drivers in the old directory...

    Even though my "old" version of the SDK was a clean install from February there has been some changes since then which prevented the setup below from working.

    So here are the files that work for the DK board using SPI3 (pins 10 through to 12 with pin 13 as the cs). I am not using the interrupt pin at the moment so needed to comment out the trigger code for the sample to output data.

    Thanks for your help.

    nrf9160_pca10090ns.overlay  file :

    &spi3 {
    compatible = "nordic,nrf-spim";
    status = "okay";
    sck-pin = <10>;
    mosi-pin = <11>;
    miso-pin = <12>;
    cs-gpios = <&gpio0 13 0>;

    adxl362@0 {
    compatible = "adi,adxl362";
    label = "ADXL362";
    spi-max-frequency = <8000000>;
    reg = <0>;
    int1-gpios = <&gpio0 9 0>;
    };
    };

    config file for DK using SPI 3

    CONFIG_SENSOR=y
    CONFIG_ADXL362=y
    CONFIG_ADXL362_TRIGGER_GLOBAL_THREAD=y
    CONFIG_ADXL362_INTERRUPT_MODE=1
    CONFIG_ADXL362_ABS_REF_MODE=1
    
    # SPI
    CONFIG_SPI=y
    CONFIG_SPI_3_NRF_SPIM=y
    CONFIG_SPI_3=y 
    CONFIG_SPI_NRFX=y

Reply
  • Hi Jon,

    So I finally have the adxl362 working. I had downloaded the latest version of the SDK in a new directory for testing but even after loading the adxl362 sample project from the new directory SES was still compiling the project using the older drivers in the old directory...

    Even though my "old" version of the SDK was a clean install from February there has been some changes since then which prevented the setup below from working.

    So here are the files that work for the DK board using SPI3 (pins 10 through to 12 with pin 13 as the cs). I am not using the interrupt pin at the moment so needed to comment out the trigger code for the sample to output data.

    Thanks for your help.

    nrf9160_pca10090ns.overlay  file :

    &spi3 {
    compatible = "nordic,nrf-spim";
    status = "okay";
    sck-pin = <10>;
    mosi-pin = <11>;
    miso-pin = <12>;
    cs-gpios = <&gpio0 13 0>;

    adxl362@0 {
    compatible = "adi,adxl362";
    label = "ADXL362";
    spi-max-frequency = <8000000>;
    reg = <0>;
    int1-gpios = <&gpio0 9 0>;
    };
    };

    config file for DK using SPI 3

    CONFIG_SENSOR=y
    CONFIG_ADXL362=y
    CONFIG_ADXL362_TRIGGER_GLOBAL_THREAD=y
    CONFIG_ADXL362_INTERRUPT_MODE=1
    CONFIG_ADXL362_ABS_REF_MODE=1
    
    # SPI
    CONFIG_SPI=y
    CONFIG_SPI_3_NRF_SPIM=y
    CONFIG_SPI_3=y 
    CONFIG_SPI_NRFX=y

Children
No Data
Related