Please note that User Registration has been temporarily disabled due to a recent increase in automated registrations. If anyone needs an account, please request one here: RequestAccount. Thanks for your patience!--Wmat (talk)
Please email User:Wmat if you experience any issues with the Request Account form.

Difference between revisions of "BeagleBone Black Enable SPIDEV"

From eLinux.org
Jump to: navigation, search
(For SPI1)
(SPI0)
Line 153: Line 153:
 
  echo BB-SPI0-01 > /sys/devices/bone_capemgr.*/slots
 
  echo BB-SPI0-01 > /sys/devices/bone_capemgr.*/slots
 
</pre>
 
</pre>
 +
 +
<pre>
 +
optargs=quiet drm.debug=7 capemgr.enable_partno=BB-SPI0-01
 +
</pre>
 +
after you save the changes, reboot your beaglebone black
 +
<br>
  
 
Make sure it is enabled
 
Make sure it is enabled

Revision as of 02:46, 16 July 2013

For SPI1

Start nano

nano BB-SPI1-01-00A0.dts


Copy-paste this into the file:

/dts-v1/;
/plugin/;

/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black";

    /* identification */
    part-number = "spi1mux";

    fragment@0 {
        target = <&am33xx_pinmux>;
        __overlay__ {
            spi1_pins_s0: spi1_pins_s0 {
                        pinctrl-single,pins = <
                                0x190 0x33      /* mcasp0_aclkx.spi1_sclk, INPUT_PULLUP | MODE3 */
                                0x194 0x33      /* mcasp0_fsx.spi1_d0, INPUT_PULLUP | MODE3 */
                                0x198 0x13      /* mcasp0_axr0.spi1_d1, OUTPUT_PULLUP | MODE3 */
                                0x19c 0x13      /* mcasp0_ahclkr.spi1_cs0, OUTPUT_PULLUP | MODE3 */
                >;
            };
        };
    };

    fragment@1 {
        target = <&spi1>;
        __overlay__ {

             #address-cells = <1>;
             #size-cells = <0>;
             status = "okay";
             pinctrl-names = "default";
             pinctrl-0 = <&spi1_pins_s0>;

             spidev@1 {
                 spi-max-frequency = <24000000>;
                 reg = <1>;
                 compatible = "linux,spidev";
            };
        };
    };
};

Close the file (Ctrl-o, Ctrl-x) and compile using dtc:

dtc -O dtb -o BB-SPI1-01-00A0.dtbo -b 0 -@ BB-SPI1-01-00A0.dts

Then, copy the file into /lib/firmware/:

 cp BB-SPI1-01-00A0.dtbo /lib/firmware/

Then enable the device tree overlay:

 echo BB-SPI1-01 > /sys/devices/bone_capemgr.*/slots

Plug in your BBB to a host computer using the mini usb data cable.

Go to My Computer>BeagleBone Getting Started> and open uEnv.txt Copy and paste this command into the .txt file. Make sure to save your changes. (Ctrl+s)

optargs=quiet drm.debug=7 capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN
capemgr.enable_partno=BB-SPI1-01

after you save the changes, reboot your beaglebone black
Make sure it is enabled You should now have two spidev-files in the folder /dev/

ls -al /dev/spidev1.*

You should also be able to see the pingroups:

cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pingroups

SPI0

Start nano

nano BB-SPI0-01-00A0.dts


Copy-paste this into the file:

/dts-v1/;
/plugin/;

/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black";

    /* identification */
    part-number = "spi0pinmux";

    fragment@0 {
        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 */
                >;
            };
        };
    };

    fragment@1 {
        target = <&spi0>;
        __overlay__ {
             #address-cells = <1>;
             #size-cells = <0>;

             status = "okay";
             pinctrl-names = "default";
             pinctrl-0 = <&spi0_pins_s0>;

             spidev@0 {
                 spi-max-frequency = <24000000>;
                 reg = <0>;
                 compatible = "linux,spidev";
            };
        };
    };
};

Close the file (Ctrl-o, Ctrl-x) and compile using dtc:

dtc -O dtb -o BB-SPI0-01-00A0.dtbo -b 0 -@ BB-SPI0-01-00A0.dts

Then, copy the file into /lib/firmware/:

 cp BB-SPI0-01-00A0.dtbo /lib/firmware/

Then enable the device tree overlay:

 echo BB-SPI0-01 > /sys/devices/bone_capemgr.*/slots
optargs=quiet drm.debug=7 capemgr.enable_partno=BB-SPI0-01

after you save the changes, reboot your beaglebone black

Make sure it is enabled You should now have two spidev-files in the folder /dev/

ls -al /dev/spidev0.*

You should also be able to see the pingroups:

cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pingroups