Enabling CAN CAPE on BeagleBone Black

I was just reading the following thread about enabling CAN on BeagleBone Green:

However I have BeagleBone Black with Comms [https://github.com/beagleboard/capes/tree/master/beaglebone/Comms]. I tried those solutions by configuring the following env variables:

BALENA_HOST_CONFIG_enable_uboot_overlays
1

BALENA_HOST_CONFIG_uboot_overlay_addr0
/boot/overlays/BB-CAN0-00A0.dtbo

BALENA_HOST_CONFIG_uboot_overlay_addr1
/boot/overlays/BB-CAN1-00A0.dtbo

However it did not work. A simple dmesg | grep -i CAN on the main OS produces the following output:

root@917896c:~# dmesg | grep CAN -A 10
[    1.406805] CAN device driver interface
[    1.463432] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6, bus freq 1000000
[    1.471506] davinci_mdio 4a101000.mdio: detected phy mask fffffffe
[    1.478364] MDIO: davinci_mdio: dt: updated phy_id[0] from phy_mask[fffffffe]
[    1.498101] libphy: 4a101000.mdio: probed
[    1.502535] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver SMSC LAN8710/LAN8720

I was unable to find any further information on enabling CAN on BeagleBoneBlack using Balena OS. I’d appreciate any information here. Is there any way to make this work on BeagleBone Black?

Thanks.

Hi,

Can you try the same steps with the updated Beaglebone Black image at version 2.58.3+rev1 from the staging dashboard? It is available for testing at https://dashboard.balena-staging.com

Hi @acostach,

I tried the newly published 2.5.3+rev4 from production dashboard and after setting the following values in uEnv.txt_internal it worked!

enable_uboot_overlays=1
uboot_overlay_addr0=/boot/overlays/BB-I2C2N-00A0.dtbo
uboot_overlay_addr1=/boot/overlays/BB-CAN0-00A0.dtbo

However, setting the same values via the following balena environment variables did not work:

BALENA_HOST_CONFIG_enable_uboot_overlays=1
BALENA_HOST_CONFIG_uboot_overlay_addr0=/boot/overlays/BB-CAN0-00A0.dtbo
BALENA_HOST_CONFIG_uboot_overlay_addr1=/boot/overlays/BB-CAN1-00A0.dtbo
RESIN_HOST_CONFIG_enable_uboot_overlays=1

Thanks!

Hello, BALENA_HOST_CONFIG_xxxx variable go to the config.txt file used by Raspberry Pi devices.

They will not update the uEnv.txt_internal file.

Thanks for the quick update! BTW, I was celebrating too early. The can0 devices appears but I haven’t been able to read anything out of it so far.

Keep us posted, thanks!

The examples from some posts (and the one linked above) suggest that there should be a bone_capemgr entry unter /sys/devices/platform. Apparently this entry neither exists in the host OS not inside the beagle bone image balenalib/beaglebone-black-ubuntu-python:3.7.4 which I’m using. Am I missing some configuration step here?

Hi,

Capemgr is only supported in balena BBB devices with a 4.1 linux kernel (see this link), you can check the current kernel version with uname -a.

There’s a new 2.58.3+rev4 release in the dashboard, it includes the updated overlays for the kernel 5.4 - these were updated starting with 2.56.0+rev1.

Please try with new version and, as you already did, with the overlays loaded from u-boot. I could run a loopback test successfully on the beaglebone green running 2.56.0, might work on the beagle black too.

Thanks @acostach for the quick reply.

I’m indeed using the latest 2.58.3+rev4 release from the dashboard. The kernel is at 5.4.70+ version:

root@834841c:~# uname -a
Linux 834841c 5.4.70+ #1 SMP PREEMPT Tue Nov 10 19:38:36 UTC 2020 armv7l armv7l armv7l GNU/Linux

root@834841c:~# ls /sys/devices/platform/
4b000000.pmu      cpufreq-dt       ocp        power          soc         uevent
Fixed MDIO bus.0  fixedregulator0  opp-table  reg-dummy      sound
clk_mcasp0        leds             pm33xx     snd-soc-dummy  ti-cpufreq
root@834841c:~# 

And I have can0 link:

3: can0: <NOARP,UP,LOWER_UP40000> mtu 16 qdisc pfifo_fast qlen 10
    link/[280] 

However I can’t find capemgr or similar commands. I’m using the official Comms cape:

Thanks.

Hi,

We don’t have this particular cape to test, but looking at the available overlays I think you might need to use this one for it BBORG_COMMS-00A2.dts:

enable_uboot_overlays=1
uboot_overlay_addr0=/boot/overlays/BBORG_COMMS-00A2.dtbo

That was it! Now it is working and can frames are coming in. Thanks!