Below is a copy of the overlay for SPI0 that we'll use to compile, and enable:
/dts-v1/; /plugin/; / { compatible = "ti,beaglebone", "ti,beaglebone-black"; /* identification */ part-number = "ADAFRUIT-SPI0"; /* version */ version = "00A0"; [email protected] { target = <&am33xx_pinmux>; __overlay__ { spi0_pins_s0: spi0_pins_s0 { pinctrl-single,pins = < 0x150 0x30 /* spi0_sclk, INPUT_PULLUP | MODE0 */ 0x154 0x30 /* spi0_d0, INPUT_PULLUP | MODE0 */ 0x158 0x10 /* spi0_d1, OUTPUT_PULLUP | MODE0 */ 0x15c 0x10 /* spi0_cs0, OUTPUT_PULLUP | MODE0 */ >; }; }; }; [email protected] { target = <&spi0>; __overlay__ { #address-cells = <1>; #size-cells = <0>; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&spi0_pins_s0>; [email protected] { spi-max-frequency = <24000000>; reg = <0>; compatible = "spidev"; }; [email protected] { spi-max-frequency = <24000000>; reg = <1>; compatible = "spidev"; }; }; }; };
Navigate to your home directory, and open nano to copy and paste the new file. You'll need to save it exactly as named below as well:
[email protected]:/tmp# cd ~ [email protected]:~# nano ADAFRUIT-SPI0-00A0.dts
dtc -O dtb -o ADAFRUIT-SPI0-00A0.dtbo -b 0 [email protected] ADAFRUIT-SPI0-00A0.dts
[email protected]:~# ls -ltr ... -rw-r--r-- 1 root root 1255 Jul 29 14:33 ADAFRUIT-SPI0-00A0.dts -rw-r--r-- 1 root root 1042 Jul 29 14:35 ADAFRUIT-SPI0-00A0.dtbo
To start with we're using the device tree compiler (dtc). Everything required to compile DT overlays are included with the latest Angstrom distribution.
-O dtb is the output format. We're outputting device tree binaries.
-o is the output filename.
-b 0 is setting the physical boot CPU. (a zero)
[email protected] generates a symbols node as part of the dynamic DT loading of the overlay
You'll know if you don't have a new enough version of dtc if the compiler complains about the missing [email protected] flag. You can attempt an upgrade of dtc by executing the following (this may need to be done on Ubuntu for now):
wget -c https://raw.githubusercontent.com/RobertCNelson/tools/master/pkgs/dtc.sh chmod +x dtc.sh ./dtc.sh