CAN4Linux



This page provides details related to can4linux stack with a home page here http://sourceforge.net/projects/can4linux/ and documentation available here
http://www.can-wiki.info/can4linux/man/index.html Zynq support has been added recently by the can4linux project leader Heinz-Jürgen Oertel, expert for CAN and CANopen.

can4linux Overview

Always up to date can4inux sources can be found at the code section of the project at http://sourceforge.net/p/can4linux/code

Below, to ease initial investigation, we have duplicated content associated with the can4linux 4.2 release.
The can4linux-v.r.tgz archive on SourceForge is always a stable snapshot. The Zynq port is still in the maturing phase
so expect new version first in the current svn trunk.

README (can4linux 4.2)

This README covers the Linux character device driver for the XCANPS Xilinx CAN controller as it is implemented in the XILINX Zynq SoC device used on the Avnet ZedBoard. CAN Signals are routed to the FMC ISM Board using EMIO Signals via PL.

Restrictions (Features)

  • The CAN TX-FIFO is not used. instead the software FIFO is used, and only one CAN frame a time is fed into the CAN controllers hardware FIFO
  • The high priority TX buffer of the CAN controller is not used
  • Listen only mode not yet supported
  • The driver can be (and is) compiled with -DCANFD defined. For data transfer between application an driver long CAN frames with 64 byte date are used. Don't forget to specify it with all user code as well and the can4linux-examples. Using the CANFD flag the driver can be used in virtual CAN mode to simulate CAN-FD locally in a virtual CAN network and CAN controller hardware is not used.
  • Acceptance filter not used yet, All frames pass to the RX-FIFO
  • Both CAN0 and CAN1 can be used (CAN1 not tested yet because of limited hardware)
  • Error handling needs to be improved.

Compiling:

Get the sources
svn co http://svn.code.sf.net/p/can4linux/code/trunk can4linux
cd can4linux/can4linux

Edit the file cross-zedboard according to your environment (kernel sources, cross-compiler and other tools location,..)
Select the target by calling
./target zedboard
Source the cross-zedboard environment before calling make.

Take care to set the -DCAN_SYSCLK according the settings in XPS with the CAN module input frequency. Bit-timing tables are provided already for some input frequencies. It is suggested to use 20MHz. Other values can be calculated using the Bit Timing Calculator

Copy the canflinux.ko kernel module to the ZedBoard Linux /lib/modules/`uname -r`/
call
# modprobe can4linux
It will result in a loaded kernel module and two device entries /dev/can[01]

/ # ls -l /dev/can*
crw-rw---- 1 root 0 91, 0 Jan 1 00:16 /dev/can0
crw-rw---- 1 root 0 91, 1 Jan 1 00:16 /dev/can1

Other entries are only available if a CAN device is open:

/ # cat /proc/iomem
00000000-1fffffff : System RAM
00008000-0040b71b : Kernel code
00434000-00482253 : Kernel data
....
e0008000-e0008fff : CAN-IO
e0009000-e0009fff : CAN-IO
....

Examples are as usual in the directory can4linux/can4linux-examples.
e.g. can_send, receive, receive-select and others,

more information are available in the source code documentation at http://www.can-wiki.info/can4linux/man/index.html


Related Links

© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy