Page 6 of 6

Re: STICKY: Optional interfaces (I2C, I2S, SPI) and Device Tree

Posted: Mon Dec 18, 2017 4:11 pm
by baal86
Regarding the

Code: Select all

RTNETLINK answers: Numerical argument out of domain
error:

This is actually a hardware problem. Your oscillator on the CAN baor dis not fast enough. (Let me guess: You've got an 8MHz crystal?) If you replace it with a 16MHz crystal and update your config it works.

Re: STICKY: Optional interfaces (I2C, I2S, SPI) and Device Tree

Posted: Fri Mar 09, 2018 9:30 am
by scorpion_08
i tried by replacing crystal with 12Mhz. i updated config.txt. but still i get same error..
RTNETLINK answers: Numerical argument out of domain

Re: STICKY: Optional interfaces (I2C, I2S, SPI) and Device Tree

Posted: Wed Mar 14, 2018 6:16 am
by trieup
I am running CentOS.
I added the line :

dtparam=i2c_arm=on

to the end on the config.txt then reboot. After reboot I ran the test program and still get the error:
Unable to open I2C device: No file or directory.
You have mentioned manual load the I2C-dev. can you give more details. I am running CentOS.

Re: STICKY: Optional interfaces (I2C, I2S, SPI) and Device Tree

Posted: Thu Dec 20, 2018 6:08 pm
by RichardGemmell
I'm using a Raspberry Pi 3 B+ and I need to use 4 SPI devices so I followed PhilE's viewtopic.php?t=98318&start=25#p821666 suggestion to create a Device Tree overlay. This didn't work. It broke the existing chip select pins. I eventually got it working with a few tweaks. I thought I'd post it here for anyone who ends up in the same boat.

I happen to be using pins 24 and 25 but I don't believe that's significant.

Code: Select all

/dts-v1/;
/plugin/;

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

	[email protected] {
		target = <&spi0>;
		frag0: __overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			pinctrl-0 = <&spi0_pins &spi0_cs_pins>;
			status = "okay";
			cs-gpios = <&gpio 8 1>, <&gpio 7 1>, <&gpio 24 1>, <&gpio 25 1>;

			[email protected]{
				compatible = "spidev";
				reg = <2>;	/* CE2 */
				#address-cells = <1>;
				#size-cells = <0>;
				spi-tx-bus-width = <2>;
				spi-rx-bus-width = <2>;
				spi-max-frequency = <125000000>;
			};

			[email protected]{
				compatible = "spidev";
				reg = <3>;	/* CE3 */
				#address-cells = <1>;
				#size-cells = <0>;
				spi-tx-bus-width = <2>;
				spi-rx-bus-width = <2>;
				spi-max-frequency = <125000000>;
			};
		};
	};

	[email protected] {
		target = <&gpio>;
		__overlay__ {
			spi0_cs_pins: spi0_cs_pins {
				brcm,pins = <8 7 24 25>;
				brcm,function = <1>; /* out */
			};
		};
	};

	__overrides__ {
		cs2_pin = <&frag0>,"cs-gpios:12", <&spi0_cs_pins>,"brcm,pins:0";
		cs3_pin = <&frag0>,"cs-gpios:24", <&spi0_cs_pins>,"brcm,pins:4";
	};
};
cheers,
Richard

Re: STICKY: Optional interfaces (I2C, I2S, SPI) and Device Tree

Posted: Mon Dec 23, 2019 8:38 pm
by BobKruse
How do we enable the additional SPI ports 3-6 in the Raspberry PI 4?

Re: STICKY: Optional interfaces (I2C, I2S, SPI) and Device Tree

Posted: Mon Dec 23, 2019 9:42 pm
by PhilE
Using the overlays spi3-1cs, spi3-2cs, spi4-1cs, etc. Run "dtoverlay -h spi3-1cs" for usage information.

Re: STICKY: Optional interfaces (I2C, I2S, SPI) and Device Tree

Posted: Thu Jan 09, 2020 10:14 pm
by BobKruse
Thanks PhilE

Re: STICKY: Optional interfaces (I2C, I2S, SPI) and Device Tree

Posted: Thu Jan 09, 2020 10:24 pm
by BobKruse
We never got SPI1 and SPI2 to support DMA in the CM3, only SPI0. We believe that SPI0 is built into the Broadcom logic, and that SPI1 & 2 came along with the ARM core. Maybe we're wrong about that.

In the PI 4, do SPI3-SPI6 support DMA?

Thanks,
Bob