This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ADAR1000 device tree for Raspberry Pi

I'm using the PYADI-IIO interface for the ADAR1000.  But I need to control 4 ADAR1000s, each with its own SPI CS line.  And all using a Raspberry Pi 4.  I've looked at other examples, and tried to make my own device tree, see attached.  The first three ADAR1000s work great.  Each has its own CS line and I can communicate via SPI.  But when I try to talk to the fourth ADAR1000, I get a "connection timed out" error:

Can anyone take a look at my device tree and see what I'm setting wrong?  

Thanks,

 - Jon

rpi-xmw_adar1000-overlay.dts.txt
// SPDX-License-Identifier: GPL-2.0
/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2836", "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

	/* We have 4 CS pins */
	fragment@0 {
		target = <&spi0_cs_pins>;
		frag0: __overlay__ {
				brcm,pins = <8 7 27 22>;
				brcm,function = <1>; //output
		};
	};


	fragment@1 {
		target = <&spi0>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			cs-gpios = <&gpio 8 1>, <&gpio 7 1>, <&gpio 27 1>, <&gpio 22 1>;
			status = "okay";

			adar1000@0 {
				compatible = "adi,adar1000";
				reg = <0>;
				spi-max-frequency = <1000000>;

				#address-cells = <1>;
				#size-cells = <0>;

				adar1000_0@0 {
					reg = <0>;
					label = "BEAM0";
					adi,phasetable-name = "adar1000_std_phasetable";
				};
			};

			adar1000@1 {
				compatible = "adi,adar1000";
				reg = <1>;
				spi-max-frequency = <1000000>;

				#address-cells = <1>;
				#size-cells = <0>;

				adar1000_1@0 {
					reg = <0>;
					label = "BEAM1";
					adi,phasetable-name = "adar1000_std_phasetable";
				};
			};

			adar1000@2 {
				compatible = "adi,adar1000";
				reg = <2>;
				spi-max-frequency = <1000000>;

				#address-cells = <1>;
				#size-cells = <0>;

				adar1000_2@0 {
					reg = <0>;
					label = "BEAM2";
					adi,phasetable-name = "adar1000_std_phasetable";
				};
			};

			adar1000@3 {
				compatible = "adi,adar1000";
				reg = <3>;
				spi-max-frequency = <1000000>;

				#address-cells = <1>;
				#size-cells = <0>;

				adar1000_3@0 {
					reg = <0>;
					label = "BEAM3";
					adi,phasetable-name = "adar1000_std_phasetable";
				};
			};

		};
	};


	fragment@2 {
		target = <&spidev0>;
		__overlay__ {
			status = "disabled";
		};
	};

	fragment@3 {
		target = <&spidev1>;
		__overlay__ {
			status = "disabled";
		};
	};


};



added dts file
[edited by: Jon.Kraft at 7:01 PM (GMT -4) on 25 Sep 2021]
[locked by: buha at 7:03 AM (GMT -4) on 25 Oct 2021]
  • +1
    •  Analog Employees 
    on Sep 29, 2021 8:39 AM

    Hello,

    Into a private discussion, we concluded that the behavior is strange and it seems like a Broadcom SPI driver bug.

    Jon, has found a workaround, by creating an extra CS GPIO:

    "So I create 5 cs-gpio pins.  But the 4th one, I never use.  So BEAM0 gets GPIO8, BEAM1 gets GPIO7, BEAM2 gets GPIO27, and BEAM3 gets GPIO22.  So we skip GPIO6.   But then somehow…. it all works!  And it doesn’t matter what GPIO pin I put in that 4th slot. As long as I skip the 4th one, and use the 5th one instead, it seems to always work.  Very odd…..  But I guess I’ll just do this and move on.  It’s just not very clean… "

  • 0
    •  Analog Employees 
    on Sep 29, 2021 5:28 PM in reply to CristianPop

    FYI, for anyone else needing this, I've attached the device tree I'm using to control 4 ADAR1000s, each with its own CS and all set to ADDR 00.  I'm using an Raspberry Pi 4, and the CS pins are GPIO8,7,27,22

    1488.rpi-xmw_adar1000-overlay.dts.txt
    // SPDX-License-Identifier: GPL-2.0
    /dts-v1/;
    /plugin/;
    
    / {
    	compatible = "brcm,bcm2836", "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
    
    	/* We have 4 CS pins */
    	fragment@0 {
    		target = <&spi0_cs_pins>;
    		frag0: __overlay__ {
    				brcm,pins = <8 7 27 22 6>;
    				brcm,function = <1>; //output
    		};
    	};
    
    
    	fragment@1 {
    		target = <&spi0>;
    		__overlay__ {
    			#address-cells = <1>;
    			#size-cells = <0>;
    			cs-gpios = <&gpio 8 1>, <&gpio 7 1>, <&gpio 27 1>, <&gpio 6 1>, <&gpio 22 1>;
    			status = "okay";
    
    			adar1000@0 {
    				compatible = "adi,adar1000";
    				reg = <0>;
    				spi-max-frequency = <1000000>;
    
    				#address-cells = <1>;
    				#size-cells = <0>;
    
    				adar1000_0@0 {
    					reg = <0>;
    					label = "BEAM0";
    					adi,phasetable-name = "adar1000_std_phasetable";
    				};
    			};
    
    			adar1000@1 {
    				compatible = "adi,adar1000";
    				reg = <1>;
    				spi-max-frequency = <1000000>;
    
    				#address-cells = <1>;
    				#size-cells = <0>;
    
    				adar1000_1@0 {
    					reg = <0>;
    					label = "BEAM1";
    					adi,phasetable-name = "adar1000_std_phasetable";
    				};
    			};
    
    			adar1000@2 {
    				compatible = "adi,adar1000";
    				reg = <2>;
    				spi-max-frequency = <1000000>;
    
    				#address-cells = <1>;
    				#size-cells = <0>;
    
    				adar1000_2@0 {
    					reg = <0>;
    					label = "BEAM2";
    					adi,phasetable-name = "adar1000_std_phasetable";
    				};
    			};
    
    			adar1000@3 {
    				compatible = "adi,adar1000";
    				reg = <4>;
    				spi-max-frequency = <1000000>;
    
    				#address-cells = <1>;
    				#size-cells = <0>;
    
    				adar1000_3@0 {
    					reg = <0>;
    					label = "BEAM3";
    					adi,phasetable-name = "adar1000_std_phasetable";
    				};
    			};
    
    		};
    	};
    
    
    	fragment@2 {
    		target = <&spidev0>;
    		__overlay__ {
    			status = "disabled";
    		};
    	};
    
    	fragment@3 {
    		target = <&spidev1>;
    		__overlay__ {
    			status = "disabled";
    		};
    	};
    
    
    };
    

  • im rrally interested in the performance as this may be exactly what im looking for  for my 5g wireless network with CBRS

    any videos?

    or can someone contact me to discuss please.

    john

  • 0
    •  Analog Employees 
    on Oct 23, 2021 7:30 PM in reply to funf

    Hello,

    Please open a new thread for your request.

    Sergiu