Problem to enable DCAN1 at BBB

Hi out there,

hope someone can help me to activate the CAN Bus interface at Beaglebone Black. I describe shortly what I
have done so far…

Debain linux
cat /etc/debian_version
8.2

uname -a
Linux beaglebone 4.1.10-ti-r23 #1 SMP PREEMPT Fri Oct 16 23:55:32 UTC 2015 armv7l GNU/Linux

I downloaded the Device Tree Overlay from RobertCNelson
https://github.com/RobertCNelson/bb.org-overlays
followed instruction and installed it

I added the BB-CAN1 device (P9-24/26)
sh -c “echo ‘BB-CAN1’> /sys/devices/platform/bone_capemgr/slots”

root@beaglebone:~# cat /sys/devices/platform/bone_capemgr/slots
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
4: P-O-L- 0 Override Board Name,00A0,Override Manuf,BB-CAN1

dmesg
[ 1266.197246] bone_capemgr bone_capemgr: part_number ‘BB-CAN1’, version ‘N/A’
[ 1266.197290] bone_capemgr bone_capemgr: slot #4: override
[ 1266.197308] bone_capemgr bone_capemgr: Using override eeprom data at slot 4
[ 1266.197326] bone_capemgr bone_capemgr: slot #4: ‘Override Board Name,00A0,Override Manuf,BB-CAN1’
[ 1266.208737] bone_capemgr bone_capemgr: slot #4: dtbo ‘BB-CAN1-00A0.dtbo’ loaded; overlay id #0
[ 1266.226715] CAN device driver interface
[ 1266.245068] c_can_platform 481d0000.can: c_can_platform device registered (regs=fa1d0000, irq=191)

Installed can-utils

git clone git://gitorious.org/linux-can/can-utils.git

and load modules

modprobe can
modprobe can-dev
modprobe can-raw

now setting up interface
ip link set can0 up type can bitrate 125000 triple-sampling
ifconfig can0 up

show the interace
ifconfig can0

can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP NOARP MTU:16 Metric:1
RX packets:3 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:24 (24.0 B) TX bytes:0 (0.0 B)
Interrupt:191

root@beaglebone:~# ip -d -s link show can0
3: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 100
bitrate 125000 sample-point 0.875
tq 500 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
c_can: tseg1 2…16 tseg2 1…8 sjw 1…4 brp 1…1024 brp-inc 1
clock 24000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
0 0 0 1 2 1
RX: bytes packets errors dropped overrun mcast
4 0 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 8 0 0

I attached to my canbus an embedded controller, sending constantly some bytes at a rate of 125kBit
on the BBB I start candump to monitor this traffic. No frames received

candump can0

At the same time I connected a raspberry Pi to the same canbus and received frames from the embedded
controller

pi@raspberrypi ~ $ candump can0
can0 539 [1] 5A
can0 539 [1] 5B
can0 539 [1] 5C
can0 539 [1] 5D

if I try to send some frames from the BBB it will fail es well

root@beaglebone:~# ip -d -s link show can0
3: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0
can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 100
bitrate 125000 sample-point 0.875
tq 500 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
c_can: tseg1 2…16 tseg2 1…8 sjw 1…4 brp 1…1024 brp-inc 1
clock 24000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
5 0 0 6 10 6
RX: bytes packets errors dropped overrun mcast
216 27 0 0 0 0
TX: bytes packets errors dropped carrier collsns
0 0 0 13 0 0

written packages are dropped and the error-pass, bus-off counter increase since the CANBus gets
restarted. During startup the CANBus receives some frames.

cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pinmux-pins | grep can
pin 96 (44e10980.0): 481d0000.can (GPIO UNCLAIMED) function pinmux_dcan1_pins group pinmux_dcan1_pins
pin 97 (44e10984.0): 481d0000.can (GPIO UNCLAIMED) function pinmux_dcan1_pins group pinmux_dcan1_pins

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

group: pinmux_dcan1_pins
pin 97 (44e10984.0)
pin 96 (44e10980.0)

CANBus drive I used SN65HVD230D. Correct signal is connected to DCAN1_RX P9_26. If is send CANFrames
I cannot measure anything at P9_24.
Has anyone further ideas to get to the bottom of the problem. Anyone has such a config running
successfully?

Thanks for your hints

markus

Hi there,

I am in exactle the same position as you. I triesd with 4.1.5-ti-r10 with my own dto as well as the one from the debian image, and tried again last night with the latest release (with the universal-io dtbo) and couldn’t get any thing to work.

I have tried on 3 different boards (2 revC and 1 revA). One of my problem is that I don’t have any known working canbus device to test against.

even if I don’t use a transceiver chip, I should be able to see a signal on the scope comming from the p9.26 pin right?

The loopback mode and vcan drivers are all working perfectly.

I’am back again…

I have to give a update…
I was digging for quite a while into the issue and didn’t had any solution. Therefor I moved to official cape which worked out of the box. I bought the BeagleBone Serial Cape CBB-Serial form http://www.logicsupply.com/cbb-serial/#specs
After having a working board it was easy to debug my setup. It was a simple cable issue.

Here the correct cabling between CAN driver and BBB

BBB SN65HVD230D
DCAN1-Rx (P9.24) → R(4)
DCAN1-Tx(R9-25) → D(1)
GND → GND(2)
VCC 3.3V → Vcc(3)
NC → (5)
→ CANL(6)
→ CANH(7)
GND → RS(8)

Hope it helps someone getting CAN Bus up an running at the BBB with less pain

markus