baal86
Posts: 1
Joined: Mon Dec 18, 2017 4:08 pm

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

Mon Dec 18, 2017 4:11 pm

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.

scorpion_08
Posts: 2
Joined: Thu Mar 08, 2018 6:43 am

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

Fri Mar 09, 2018 9:30 am

i tried by replacing crystal with 12Mhz. i updated config.txt. but still i get same error..
RTNETLINK answers: Numerical argument out of domain

trieup
Posts: 7
Joined: Wed Mar 14, 2018 5:27 am

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

Wed Mar 14, 2018 6:16 am

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.

RichardGemmell
Posts: 1
Joined: Thu Dec 20, 2018 6:02 pm

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

Thu Dec 20, 2018 6:08 pm

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

Return to “Interfacing (DSI, CSI, I2C, etc.)”