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