Trouble enabling DCAN1 on BeagleBone, think I'm close but missing something.

Hi Folks,

I am easily able to receive CAN traffic with my Peak USB-CAN interface on my linux workstation. I know our device is producing regular updates at 250000 and it dumps find using candump.

For a couple days I have been trying (without success) to duplicate the behavior on my Element Rev B6 Beaglebone. I’ve read many posts and have worked bast a bunch of issues but still get no can traffic.

The results are the same with a WaveShare CAN Cape or a discrete NXP TJA1051 High-speed CAN transceiver that I have connected on a breadboard. If I hook a scope to the input RX signal I can see the external CAN traffic but nothing gets through.

I did modify ~/bb.org-overlays/src/arm/cape-universaln-00A0.dts to remove references to pins P9_24 and P9_26 (UART1 RX/TX)

For clarity’s sake here is the script that I run after rebooting the Beaglbone.

`
set -x
echo “# make sure, I’m running as root, unmolested bone-debian-8.3-lxqt-4gb-armhf-2016-01-24-4gb.img image”
id
uname -a

echo “# look, can pin muxing for P9_24 and P9_26 are at default (GPIO, mode 7)”
devmem2 0x44E10980 w
devmem2 0x44E10984 w

echo “# cat my overlay File, has been built/installed/rebooted successfully”
cat /hone/debian/bb.org-overlays/src/arm/BB-CAN1-00A0.dts

echo “# install my overlay to setup the CAN pins”
sh -c “echo ‘BB-CAN1’ > /sys/devices/platform/bone_capemgr/slots”

echo “# see that the overlay was installed and make sure pins went to mode 2”
cat /sys/devices/platform/bone_capemgr/slots
devmem2 0x44E10980 w
devmem2 0x44E10984 w

echo “#load the can drivers”
modprobe can
modprobe can-dev
modprobe can-raw

echo “# show what’s loaded”
lsmod

echo “# fire up the interface”
ip link set can0 type can bitrate 250000 triple-sampling on
ip link set can0 up

echo “# see that we’re up”
ifconfig can0

echo “#Shoud receive can data, same as my linux workstation…”
candump can0

`

Here is the output from the script…

`
debian@beaglebone:~$ sudo ./canSetup.sh

  • echo # make sure, I’m running as root, unmolested bone-debian-8.3-lxqt-4gb-armhf-2016-01-24-4gb.img image

make sure, I’m running as root, unmolested bone-debian-8.3-lxqt-4gb-armhf-2016-01-24-4gb.img image

  • id
    uid=0(root) gid=0(root) groups=0(root)
  • uname -a
    Linux beaglebone 4.1.15-ti-rt-r43 #1 SMP PREEMPT RT Thu Jan 21 20:13:58 UTC 2016 armv7l GNU/Linux
  • echo # look, can pins P9_24 and P9_26 are at default (GPIO, mode 7)

look, can pins P9_24 and P9_26 are at default (GPIO, mode 7)

  • devmem2 0x44E10980 w
    /dev/mem opened.
    Memory mapped at address 0xb6f93000.
    Value at address 0x44E10980 (0xb6f93980): 0x37
  • devmem2 0x44E10984 w
    /dev/mem opened.
    Memory mapped at address 0xb6f9b000.
    Value at address 0x44E10984 (0xb6f9b984): 0x37
  • echo # cat my overlay File, has been built/installed/rebooted successfully

cat my overlay File, has been built/installed/rebooted successfully

  • cat /home/debian/bb.org-overlays/src/arm/BB-CAN1-00A0.dts
    /*

You’re providing far too much information, and not enough of the right information. It would be good to know the output of the following commands.

cat /sys/devices/platform/bone_capemgr/slots
ifconfig can0

Additionally, I know nothing of the cape you mention, and knowing your circuit layout would be good too, but not really necessary. Many seem to have had this same, or similar issues, which I’ll assume is related to improper CANBUS termination. But since no one has bothered to come back on and follow up . . . who really knows ? I do know that using the Logicsupply CAN cape works. We have one, and I’ve dumped loads of data off a “local” industrial CAN network.

Not sure if you solved this yet…

Try this, it worked for me:

  1. disable the default overlay on slot 4:
    sudo sh -c “echo ‘-4’ > /sys/devices/platform/bone_capemgr/slots”

  2. add the CAN cape device
    sudo sh -c “echo ‘BB-CAN1’ > /sys/devices/platform/bone_capemgr/slots”

otherwise, you may get the following error:
root@beaglebone:/# sudo sh -c “echo ‘BB-CAN1’ > /sys/devices/platform/bone_capemgr/slots”
[ 494.986203] bone_capemgr bone_capemgr: slot #6: BB-CAN1 conflict P9.24 (#4:cape-universaln)
[ 494.995099] bone_capemgr bone_capemgr: slot #6: Failed verification
sh: echo: I/O error

Not sure if you solved this yet...

Try this, it worked for me:

1. disable the default overlay on slot 4:
    sudo sh -c "echo '-4' > /sys/devices/platform/bone_capemgr/slots"

you can just remove cape_universal=enable from /boot/uEnv.txt

2. add the CAN cape device
    sudo sh -c "echo 'BB-CAN1' > /sys/devices/platform/bone_capemgr/slots"

otherwise, you may get the following error:
    root@beaglebone:/# sudo sh -c "echo 'BB-CAN1' >
/sys/devices/platform/bone_capemgr/slots"
    [ 494.986203] bone_capemgr bone_capemgr: slot #6: BB-CAN1 conflict
P9.24 (#4:cape-universaln)
    [ 494.995099] bone_capemgr bone_capemgr: slot #6: Failed verification
    sh: echo: I/O error

Regards,

Also for Logisupply CAN / Serial cape, you do not load the overlay file manually. It’s done automatically at boot. The same goes for many premade capes, I’m sure.