BORA SOM/BELK-L/Pheripherals/CAN

From DAVE Developer's Wiki
Jump to: navigation, search


CAN[edit | edit source]

See CAN Pinout page and BXELK Vivado project for more details.

Physical device Processor's resource Connector Type Notes
CAN BUS can0 J24 differential CAN bus

The following commands can be issued from command line in order to send and receive CAN frames:

root@bora:~# dmesg | grep -i can
[    0.643798] CAN device driver interface
[    0.997787] can: controller area network core (rev 20120528 abi 9)
[    1.008392] can: raw protocol (rev 20120528)
[    1.012661] can: broadcast manager protocol (rev 20120528 t)
[    1.018294] can: netlink gateway (rev 20130117) max_hops=1
root@bora:~# canconfig can0 stop
can0 state: STOPPED
root@bora:~# canconfig can0 bitrate 500000
can0 bitrate: 500000, sample-point: 0.875
root@bora:~# canconfig can0 start
can0 state: ERROR-ACTIVE
root@bora:~# cansend can0 -i 0x77 0x33 0x88 0x33 0x88 0x33 0x88 0x33
interface = can0, family = 29, type = 3, proto = 1
root@bora:~# cansend can0 -i 0x77 0x33 0x88 0x33 0x88 0x33 0x88 0x33
interface = can0, family = 29, type = 3, proto = 1
root@bora:~# cansend can0 -i 0x77 0x33 0x88 0x33 0x88 0x33 0x88 0x33
interface = can0, family = 29, type = 3, proto = 1
root@bora:~# candump can0
interface = can0, family = 29, type = 3, proto = 1
<0x100> [8] 12 34 56 78 9a bc de ff
<0x100> [8] 12 34 56 78 9a bc de ff
<0x100> [8] 12 34 56 78 9a bc de ff
<0x100> [8] 12 34 56 78 9a bc de ff
<0x100> [8] 12 34 56 78 9a bc de ff
^C
root@bora:~#

In case canutils package is missing, user can install it directly from DAVE's BORA package server using smart update && smart install canutils commands:

root@bora:~# smart update
Updating cache...               ######################################## [100%]

Fetching information for 'all'...
-> https://yocto.dave.eu/belk-3.0.1/all/repodata/repomd.xml
repomd.xml                      ######################################## [ 50%]
[snip]
Channels have 393 new packages.
Saving cache...

root@bora:~# smart install canutils
Loading cache...
Updating cache...               ######################################## [100%]

Computing transaction...

Installing packages (2):
  canutils-4.0.6-r0@armv7a_vfp_neon
  libsocketcan2-0.0.9-r0@armv7a_vfp_neon

27.8kB of package files are needed. 46.8kB will be used.

Confirm changes? (Y/n): y

[..snip..]

See Advanced use of Yocto build system for more information about using Yocto packages and smart