DESK-XZ7-L/Peripherals/CAN

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes

2024/01/23

DESK-XZ7-L-1.x.x release

2024/11/26

Add CAN message usage information
2024/11/26 Add PCAN-USB example use case


Peripheral CAN[edit | edit source]

CAN is routed through the PL using the TCL scripts for the Vivado project example here below:

  • recreate_prj_bora_BASE.tcl
  • recreate_prj_boralite_BASE.tcl
  • recreate_prj_boralite_NAND.tcl
  • recreate_prj_borax_BASE.tcl

Accessing the peripheral[edit | edit source]

Linux messages at boot time[edit | edit source]

root@bora:~# dmesg | grep -i can
[    0.545770] CAN device driver interface
[    0.752012] can: controller area network core
[    0.761010] can: raw protocol
[    0.763989] can: broadcast manager protocol
[    0.768236] can: netlink gateway - max_hops=1

Enable the interface and check status[edit | edit source]

The following commands can be issued from the command line to enable the CAN interface on BORA:

root@bora:~# ip link set can0 type can bitrate 500000
root@bora:~# ifconfig can0 up

To test the CAN interface it is possible to use a PCAN-USB device connected to the DESK-XZ7-L-MVM. The following commands can be issued from the command line to enable the CAN interface on the MVM:

dvdk@vagrant:~# sudo ip link set can0 type can bitrate 500000
dvdk@vagrant:~# sudo ifconfig can0 up

Usage with can-utils[edit | edit source]

cansend[edit | edit source]

This is an example of using a BORA Evaluation Kit to send data connected to a PCAN-USB device (that receives the data).

  • the following commands can be issued from the command line on BORA to send data to PCAN-USB
root@bora:~# cansend can0 -i 0x7ff 00 01 02 03 04 05 06 07
interface = can0, family = 29, type = 3, proto = 1
<0x7ff> [8] 00 01 02 03 04 05 06 07
  • the following commands can be issued from the command line on MVM to receive data from BORA with PCAN-USB
dvdk@vagrant:~# candump can0
  can0  7FF   [8]  00 01 02 03 04 05 06 0
candump[edit | edit source]

This is an example of using a PCAN-USB device to send data to a connected BORA Evaluation Kit (that receives the data).

  • the following commands can be issued from the command line on MVM to send data with PCAN-USB
dvdk@vagrant:~# cansend can0 7ff#0001020304050607
  can0  7FF   [8]  00 01 02 03 04 05 06 07
  • the following commands can be issued from the command line on BORA to receive data from PCAN-USB
root@bora:~# candump can0
interface = can0, family = 29, type = 3, proto = 1
<0x7ff> [8] 00 01 02 03 04 05 06 07