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

How to configure the adc periheral in the Device Tree file *.dts

Hello,

I am trying to figure out a way to configure the adc node using the .dts Device Tree file in a similar way to what is done for other nodes such as &spi and &i2c.
Unfortunately, all the examples I have seen so far only set the status property for the adc node. I would like to add GPIO pin numbers, resolution, etc ...
Any suggestions?
&adc {
status = "okay";
};
&spi1 {
compatible = "nordic,nrf-spim";
status = "okay";
sck-pin = <13>;
mosi-pin = <09>;
miso-pin = <40>;
};
Thank you.
Parents Reply
  • Hi Martin,

    I give up. I tried few flavours of the overlay file and none worked. The project always fail to load.

    # Method 1:
    &adc {
    # compatible = "nordic,nrf-saadc";
     compatible = "voltage-divider";

     adc5:adc@... {
     label = "AIN_5";
     }

     adc7:adc@... {
     label = "AIN_5";
     }

     n: node {
     io-channels = <&adc5 26>, <&adc7 28>;
     io-channel-names = "FOIL", "STRAP";
     };
    };

    # Method 2:
    adc0: adc@4000E000 {
    compatible = "nordic,nrf-saadc";
    # compatible = "voltage-divider";
    label = "ADC_0";
    };

    n: node {
    io-channels = <&adc0 4>;
    io-channel-names = "AIN_0";
    };

    Kind regards

    Mohamed

Children
Related