Configure CAN BeagleBone AI, Kernel v4.19

67 views
Skip to first unread message

Douglas Conover

unread,
Oct 14, 2020, 6:45:01 AM10/14/20
to BeagleBoard

Hi all, I have been working on updating some of my device tree files to the newer image found at:


using the device tree files at:


I would like to use pins P9.26 and P9.24 for can bus communication. In the previous version of the image (the latest IOT image found at https://beagleboard.org/latest-images), I was able to configure them using a modified version of a sample dts. Looking at the 4.19.x-ti-overlays branch of the device tree overlay repo, I found the BONE-CAN1.dts file, which seemed to do almost exactly the same thing. I built the dtbo and copied it to /boot/dtbs. This is my uEnv.txt:

uname_r=4.19.94-ti-r50
#uuid=
#dtb=

###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
uboot_overlay_addr0=/boot/dtbs/BONE-CAN1.dtbo
#uboot_overlay_addr2=<file2>.dtbo
#uboot_overlay_addr3=<file3>.dtbo
###
###Additional custom capes
#uboot_overlay_addr4=<file4>.dtbo
#uboot_overlay_addr5=<file5>.dtbo
#uboot_overlay_addr6=<file6>.dtbo
#uboot_overlay_addr7=<file7>.dtbo
###
###Custom Cape
#dtb_overlay=<file8>.dtbo
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks... (60000 = 384KB)
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###

cmdline=coherent_pool=1M net.ifnames=0 rng_core.default_quality=100 quiet

#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 rng_core.default_quality=100 quiet video=HDMI-A-1:1024x768@60e

##enable x15: eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync

On reboot, the show-pins utility (https://github.com/mvduin/bbb-pin-utils) shows that the pins are in the correct mux modes:

debian@beaglebone:/var/lib/cloud9$ show-pins | grep can
Caution: Uses peripheral names from <https://goo.gl/jiazTL>. See README there for details.
P9.26b                                81 fast         15 unused           ocp@44000000/P9_26_pinmux (pinmux_P9_26_can_pin)
P9.26a                               162 fast     up   2 can 1 tx         ocp@44000000/P9_26_pinmux (pinmux_P9_26_can_pin)
P9.24                                163 fast rx  up   2 can 1 rx         ocp@44000000/P9_24_pinmux (pinmux_P9_24_can_pin)

                                        
but ifconfig does not reveal a can interface:

SoftAp0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.8.1  netmask 255.255.255.0  broadcast 192.168.8.255
        inet6 fe80::200:ff:fe00:0  prefixlen 64  scopeid 0x20<link>
        ether 00:00:00:00:00:00  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 35  bytes 6868 (6.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC>  mtu 1500
        inet 169.254.25.128  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::2aec:9aff:feeb:54d6  prefixlen 64  scopeid 0x20<link>
        ether 28:ec:9a:eb:54:d6  txqueuelen 1000  (Ethernet)
        RX packets 72  bytes 16296 (15.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 114  bytes 31416 (30.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 128

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 1040  bytes 70800 (69.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1040  bytes 70800 (69.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.7.2  netmask 255.255.255.0  broadcast 192.168.7.255
        inet6 fe80::1eba:8cff:fea2:ed6b  prefixlen 64  scopeid 0x20<link>
        ether 1c:ba:8c:a2:ed:6b  txqueuelen 1000  (Ethernet)
        RX packets 418  bytes 63986 (62.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 355  bytes 84899 (82.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

usb1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.6.2  netmask 255.255.255.0  broadcast 192.168.6.255
        inet6 fe80::1eba:8cff:fea2:ed6d  prefixlen 64  scopeid 0x20<link>
        ether 1c:ba:8c:a2:ed:6d  txqueuelen 1000  (Ethernet)
        RX packets 45  bytes 5611 (5.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 43  bytes 9016 (8.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=-28669<UP,BROADCAST,MULTICAST,DYNAMIC>  mtu 1500
        ether 80:91:33:4a:49:11  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Am I missing a step somewhere?
                    

jose...@gmail.com

unread,
Oct 14, 2020, 7:07:46 AM10/14/20
to BeagleBoard
CAN interfaces are down by default. If you type "ifconfig -a" you should see them...

Douglas Conover

unread,
Oct 14, 2020, 9:38:27 AM10/14/20
to BeagleBoard
Thanks, that did the trick. "ifconfig -a" showed the can0 interface and the following two lines brought it up:

  sudo ip link set can0 type can bitrate 125000
  sudo ip link set up can0
Reply all
Reply to author
Forward
0 new messages