On Kernel version x.x, kernel overlays went away, in favor of u-boot overlays. 

Testing pins

Pins can be tested and set with the config-pin utility:

config-pin -q P9.24
config-pin -q P9.26
config-pin P9.24 can
config-pin P9.26 can

DTB are placed in /boot/dtbs/<kernel-version> and compiled versions (DTBO)  in /lib/firmware

DTS for CAN1 is:

/*
 * Copyright (C) 2015 Robert Nelson <robertcnelson@gmail.com>
 *
 * Virtual cape for CAN1 on connector pins P9.24 P9.26
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
/dts-v1/;
/plugin/;


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

        /* identification */
        part-number = "BB-CAN1";
        version = "00A0";

        /* state the resources this cape uses */
        exclusive-use =
                /* the pin header uses */
                "P9.24",        /* can1_rx */
                "P9.26",        /* can1_tx */
                /* the hardware ip uses */
                "dcan1";

        fragment@0 {
                target = <&am33xx_pinmux>;
                __overlay__ {
                        bb_dcan1_pins: pinmux_dcan1_pins {
                                pinctrl-single,pins = <
                                        BONE_P9_24 (PIN_INPUT_PULLUP | MUX_MODE2) /* uart1_txd.d_can1_rx */
                                        BONE_P9_26 (PIN_OUTPUT_PULLUP | MUX_MODE2) /* uart1_rxd.d_can1_tx */
                                >;
                        };
                };
        };

        fragment@1 {
                target = <&dcan1>;
                __overlay__ {
                        status = "okay";
                        pinctrl-names = "default";
                        pinctrl-0 = <&bb_dcan1_pins>;
                };
        };
};

To load the DTBO, add it to /boot/uEnv.txt:

uboot_overlay_addr4=/lib/firmware/BB-CAN1-00A0.dtbo

To dump the device tree:

dtc -I fs /sys/firmware/devicetree/base

Once can pin is setup, parameters are set via:

modprobe can
modprobe can-dev
modprobe can-raw
ip link set can0 up type can bitrate 250000
ifconfig can0 down
ip link set can0 type can restart-ms 100

Checking pin claiming is done via

cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins

root@beaglebone:~# cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins
Pinmux settings per pin
Format: pin (name): mux_owner gpio_owner hog?
pin 0 (PIN0): 481d8000.mmc (GPIO UNCLAIMED) function pinmux_emmc_pins group pinmux_emmc_pins
pin 1 (PIN1): 481d8000.mmc (GPIO UNCLAIMED) function pinmux_emmc_pins group pinmux_emmc_pins
pin 2 (PIN2): 481d8000.mmc (GPIO UNCLAIMED) function pinmux_emmc_pins group pinmux_emmc_pins
pin 3 (PIN3): 481d8000.mmc (GPIO UNCLAIMED) function pinmux_emmc_pins group pinmux_emmc_pins
pin 4 (PIN4): 481d8000.mmc (GPIO UNCLAIMED) function pinmux_emmc_pins group pinmux_emmc_pins
pin 5 (PIN5): 481d8000.mmc (GPIO UNCLAIMED) function pinmux_emmc_pins group pinmux_emmc_pins
pin 6 (PIN6): 481d8000.mmc (GPIO UNCLAIMED) function pinmux_emmc_pins group pinmux_emmc_pins
pin 7 (PIN7): 481d8000.mmc (GPIO UNCLAIMED) function pinmux_emmc_pins group pinmux_emmc_pins
pin 8 (PIN8): ocp:P8_19_pinmux (GPIO UNCLAIMED) function pinmux_P8_19_default_pin group pinmux_P8_19_default_pin
pin 9 (PIN9): ocp:P8_13_pinmux (GPIO UNCLAIMED) function pinmux_P8_13_default_pin group pinmux_P8_13_default_pin
Share on Facebook
Categories: Flight sim

Leave a Reply

Your email address will not be published. Required fields are marked *

*