Problems with CANBus at BBB

1,466 views
Skip to first unread message

m.sch...@gmail.com

unread,
Oct 26, 2015, 8:55:55 AM10/26/15
to BeagleBoard
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 on restart-ms 100
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 <TRIPLE-SAMPLING> 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
At 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 <TRIPLE-SAMPLING> 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 maybe face frames. Do not get anything with candump


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)

From my point of view everything looks fine, cable connections etc. I checked by oscilloscope, as
CANBus drive I used SN65HVD230D. Receiver signal from Port4 of the CANDriver 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

Robert Nelson

unread,
Oct 26, 2015, 9:05:21 AM10/26/15
to Beagle Board, m.sch...@gmail.com
On Sun, Oct 25, 2015 at 7:49 AM, <m.sch...@gmail.com> wrote:
> 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

The can interface works fine, what did you use to interface the bbb's
pins to your can network?

Regards,

--
Robert Nelson
https://rcn-ee.com/

William Hermans

unread,
Oct 26, 2015, 9:21:55 AM10/26/15
to beagl...@googlegroups.com
You need to use a can transceiver, and properly terminate the can interface. Otherwise, the can interface will not work. in our case we're using the Logic supply serial / canbus cape. http://www.logicsupply.com/cbb-serial/

$ sudo ifconfig
[sudo] password for william:

can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          UP RUNNING NOARP  MTU:16  Metric:1
          RX packets:38317627 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:282730298 (269.6 MiB)  TX bytes:0 (0.0 B)
          Interrupt:182

$ candump -n 10 can0
  can0  19F00302   [8]  40 44 03 13 01 01 00 00
  can0  19F00302   [8]  41 00 00 00 00 00 00 00
  can0  19F00302   [8]  42 00 B8 0B 00 00 00 00
  can0  19F00302   [8]  43 00 00 00 00 02 01 00
  can0  19F00302   [8]  44 00 00 00 00 00 00 00
  can0  19F00302   [8]  45 00 00 B8 0B 00 00 00
  can0  19F00302   [8]  46 00 00 00 00 00 03 01
  can0  19F00302   [8]  47 00 00 00 00 00 00 00
  can0  19F00302   [8]  48 00 00 00 B8 0B 00 00
  can0  19F00302   [8]  49 00 00 00 00 00 00 FF



--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Markus Schiesser

unread,
Oct 27, 2015, 3:53:53 PM10/27/15
to Robert Nelson, Beagle Board
On 26.10.2015 14:04, Robert Nelson wrote:
> On Sun, Oct 25, 2015 at 7:49 AM, <m.sch...@gmail.com> wrote:
>> 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
> The can interface works fine, what did you use to interface the bbb's
> pins to your can network?
>
> Regards,
>
Hi Robert,
I use a simple breakout board,

https://www.pi-shop.ch/adafruit-proto-cape-kit-for-beagle-bone

soldered CAN Transceiver SN65HVD230D on it and connected Pin


P9_26 -> 4
P9_24 -> 1
GND -> 2
+3.3 -> 3
CANL -> 6
CANH -> 7
GND -> 8

I verified the signals by oscilloscope and receive a good signal at pin
P9_26 but the socket interface does not show any frame. The same signal
connected to raspberry and it receives valid frames at a bitrate of
125kBit.

If I try to send frames from bbb I don't can measure any signal at pin
P9_24. And the interface goes straight into BUS-OFF mode, if I don't
give "restart-ms 100" option during interface creation.

Do I give the "loopback" option

ip link set can0 type can bitrate 125000 triple-sampling on loopback on

everything is fine and I can receive my own frames.

could it be a bitrate issue / frequency problem?
Do you have a tool handy, reading register values form the arm. Maybe
this would help to understand the issue better

Regards

markus

mojtaba moghimi

unread,
Nov 6, 2015, 4:04:18 AM11/6/15
to BeagleBoard
Hello William
I have the same problem as Markus has. I've done the same as Markus and I'm using Logic supply canbus cape. I don't see any message using candump and can't send any message.
I use Microchip can analyzer to send can signals to my BBB.
When I try to enable both "BB-CAN1" and "cape-CBB-Serial:r01", BBB doesn't let me to have them both activated at the same time and mentions P9.24 conflict.

How should I solve this issue?
Thanks in advance.
Cheers
Mojtaba

William Hermans

unread,
Nov 6, 2015, 9:41:40 PM11/6/15
to beagl...@googlegroups.com
When I try to enable both "BB-CAN1" and "cape-CBB-Serial:r01", BBB doesn't let me to have them both activated at the same time and mentions P9.24 conflict.

How should I solve this issue?
Thanks in advance.
Cheers
Mojtaba


The logic supply serial / can cape should automatically be detected at boot. If you're using any of the official debian images. This means you do not have to do anything, as far as loading the cape goes.

mojtaba moghimi

unread,
Nov 18, 2015, 6:02:56 PM11/18/15
to BeagleBoard
Hello William
Sorry for late reply. I ordered and bought a new Cape to make sure that problem is not from CAN transceiver but it is still not detected automatically. I have installed the latest debian image and gone through all the steps which is mentioned here.
BBB does not detect the Cape.
Do you have any suggestion with this?
Cheers
Mojtaba

William Hermans

unread,
Nov 18, 2015, 7:12:42 PM11/18/15
to beagl...@googlegroups.com
These are the exact steps I took to get CAN working with the logic supply serial / can cape. http://www.embeddedhobbyist.com/2015/09/linux-can-development/

As far as the physical connection, wiring etc. I did not deal with that personally. But it's fairly simple as I recall.

Nick

unread,
May 10, 2019, 7:29:42 PM5/10/19
to BeagleBoard
Hello Markus, hello Mojtaba

I know this is an old thread, but I have identical symptoms with my very similar setup, so I  just wanted to as  what you did to fix the issue.
Thanks a lot,
Nick
Reply all
Reply to author
Forward
0 new messages