Thank you, now I got it working:
Code: Select all
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
fragment@0 {
target = <&gpio>;
__overlay__ {
spi1_pins: spi1_pins {
brcm,pins = <19 20 21>;
brcm,function = <3>; /* alt4 */
};
spi1_cs_pins: spi1_cs_pins {
brcm,pins = <16>;
brcm,function = <1>; /* output */
};
};
};
fragment@1 {
target = <&spi1>;
frag1: __overlay__ {
/* needed to avoid dtc warning */
#address-cells = <1>;
#size-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&spi1_pins &spi1_cs_pins>;
cs-gpios = <&gpio 16 1>;
status = "okay";
spidev1_0: spidev@0 {
compatible = "spidev";
reg = <0>; /* CE0 */
#address-cells = <1>;
#size-cells = <0>;
spi-max-frequency = <125000000>;
status = "okay";
};
};
};
fragment@2 {
target = <&aux>;
__overlay__ {
status = "okay";
};
};
__overrides__ {
cs0_pin = <&spi1_cs_pins>,"brcm,pins:0",
<&frag1>,"cs-gpios:4";
cs0_spidev = <&spidev1_0>,"status";
};
I only replaced the two entrys of the CS-Pin from 18 to 16.
If the the device tree compiler is not installed it has to be installed:
Code: Select all
sudo apt-get install device-tree-compiler
After that I compiled my dts:
Code: Select all
dtc -@ -I dts -O dtb -o spi1-1cs36.dtbo spi1-1cs36.dts
spi1-1cs36.dtbo: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property
spi1-1cs36.dtbo: Warning (unit_address_vs_reg): Node /fragment@1 has a unit name, but no reg property
spi1-1cs36.dtbo: Warning (unit_address_vs_reg): Node /fragment@2 has a unit name, but no reg property
I got that warnings but I ignored it.
Now the dtbo has to be copied:
Code: Select all
sudo cp spi1-1cs36.dtbo /boot/overlays
The last step is to add it to the boot.cfg:
And here I added a new entry as last line: