adc channel config error in custom board and devicetree config

Hi,

I have a custom board, i enable the adc peripheral, and it generates:

	zephyr,user {

		io-channels = <&adc 4>;
	};

		adc: adc@40007000 {
			compatible = "nordic,nrf-saadc";
			reg = <0x40007000 0x1000>;
			interrupts = <7 NRF_DEFAULT_IRQ_PRIORITY>;
			status = "disabled";
			#io-channel-cells = <1>;
		};

then i connect the AIN4 channel and it generates:

&adc {
	status = "okay";
	channel@4 {
		reg = <4>;
		zephyr,gain = "ADC_GAIN_1_6";
		zephyr,reference = "ADC_REF_VDD_1";
		zephyr,acquisition-time = <0>;
	};
};

but when i build i get the following error:

devicetree error: 'reg' property in <Node /soc/adc@40007000/channel@4 in '/home/billy/ncs/v2.9.1/zephyr/misc/empty_file.c'> has length 4, which is not evenly divisible by 12 (= 4*(<#address-cells> (= 2) + <#size-cells> (= 1))). Note that #*-cells properties come either from the parent node or from the controller (in the case of 'interrupts').

What should this channel reg property be set to? 4 * <something>?

Parents
  • changing the &adc entry to the following allows the build to complete

    &adc {
    	status = "okay";
    	#address-cells = <1>;
    	#size-cells = <0>;
    	channel@4 {
    		reg = <4>;
    		zephyr,gain = "ADC_GAIN_1_6";
    		zephyr,reference = "ADC_REF_VDD_1";
    		zephyr,acquisition-time = <0>;
    	};
    
    	#io-channel-cells = <1>;
    };

    adding the address-cells and size-cells proerties, are these the correct values?

Reply
  • changing the &adc entry to the following allows the build to complete

    &adc {
    	status = "okay";
    	#address-cells = <1>;
    	#size-cells = <0>;
    	channel@4 {
    		reg = <4>;
    		zephyr,gain = "ADC_GAIN_1_6";
    		zephyr,reference = "ADC_REF_VDD_1";
    		zephyr,acquisition-time = <0>;
    	};
    
    	#io-channel-cells = <1>;
    };

    adding the address-cells and size-cells proerties, are these the correct values?

Children
Related