Difference between revisions of "CAN Bus"

From eLinux.org
Jump to: navigation, search
Line 133: Line 133:
|[http://www.fel.cvut.cz/en FEE CTU] || [http://canbus.pages.fel.cvut.cz/ctucanfd_ip_core/Progdokum.pdf CTU CAN FD Core] || ctucanfd || [https://gitlab.fel.cvut.cz/canbus/ctucanfd_ip_core CTU CAN FD Core] || CONFIG_CTUCANFD || [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/can/ctucanfd/Kconfig 5.19] || Open Source VHDL CAN FD IP Core - tested on
|[http://www.fel.cvut.cz/en FEE CTU] || [http://canbus.pages.fel.cvut.cz/ctucanfd_ip_core/doc/Datasheet.pdf CTU CAN FD Core] || ctucanfd || [https://gitlab.fel.cvut.cz/canbus/ctucanfd_ip_core CTU CAN FD Core] || CONFIG_CTUCANFD || [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/can/ctucanfd/Kconfig 5.19] || Open Source VHDL CAN FD IP Core - tested on
* [https://gitlab.fel.cvut.cz/canbus/zynq/zynq-can-sja1000-top Xilinx Zynq-7000]
* [https://gitlab.fel.cvut.cz/canbus/zynq/zynq-can-sja1000-top Xilinx Zynq-7000]
* [https://gitlab.fel.cvut.cz/canbus/intel-soc-ctucanfd Intel Cyclone V DE0-Nano-SoC]
* [https://gitlab.fel.cvut.cz/canbus/intel-soc-ctucanfd Intel Cyclone V DE0-Nano-SoC]

Revision as of 14:11, 12 June 2022


The CAN bus is an ISO standard bus originally developed for vehicles. It manages the Chassis Electrical System Control and is responsible for critical activities like engine electrical, and skid control. This system is also used to provide vehicle diagnostic information for maintenance. A multi-star configuration seems typical of this bus with a primary bus line that branches into sub bus lines at its extremities then attaches to multiple device nodes. Differential voltage is applied over twisted pair at 1.5 to 2.5V and 2.5 to 3.5V for noise resistant signaling. Bit rates up to 1 Mbit/s are possible at network lengths below 40 m. Decreasing the bit rate allows longer network distances (e.g., 500 m at 125 kbit/s). (Jeremiah J. Flerchinger Source) Controllers supporting CAN FD, an enhanced CAN version with frames up to 64 byte and bit rates up to 4 Mbit/s, will be available in the second half of 2014. A can4linux version supportig CAN FD on a IFI CAN is ready to be used.

Although developed as car communication network CAN is used in many other areas, industrial, medical, maritime laboratory and more. Most often with a CAN based higher layer protocol like CANopen on top of it.

Additional information can be found at:

CiA CAN in Automation CAN user association
CAN Wiki

CAN Support in Linux

CAN is supported by Linux device drivers. Mainly two types exist. Character device based drivers and network socket based drivers. The Linux kernel supports CAN with the SocketCAN framework.

One of the character based drivers is can4linux.

SocketCAN Supported Protocols

  • RAW: send & receive raw CAN frames
  • BCM: Broadcast manager, offload repetitive work to the Linux kernel
  • ISOTP ...
  • SAE J1939

SocketCAN Supported Controllers

  • Microchip MCP251x
  • Atmel AT91 SoCs
  • ESD 331 CAN Cards
  • NXP (Philips) SJA1000
  • Freescale MPC52xx SoCs
  • Bosch CC770
  • Intel AN82527
  • TIs SoCs
  • Serial/network devices utilizing ASCII protocol (slcan driver)
Vendor Device Name Driver Module Name Controller Kconfig Option Linux Mainline Remarks
VScom NetCAN Plus 110 slcan (unknown) CONFIG_CAN_SLCAN 2.6.38 needs slcand and socat
VScom USB-CAN Plus slcan SJA1000T CONFIG_CAN_SLCAN 2.6.38 needs slcand
LAWICEL CAN232 slcan (unknown) CONFIG_CAN_SLCAN 2.6.38 needs slcand
LAWICEL CANUSB slcan (unknown) CONFIG_CAN_SLCAN 2.6.38 needs slcand
TITAN USB-CAN slcan (unknown) CONFIG_CAN_SLCAN 2.6.38 needs slcand
PEAK PCAN-PCI peak_pci sja1000 CONFIG_CAN_PEAK_PCI 3.2 supports all PCAN-[mini]PCI[e][104] variants
PEAK PCAN-USB peak_usb (unknown) CONFIG_CAN_PEAK_USB 3.4 supports PCAN-USB[pro][hub] (no LIN support)
Kvaser PCIcanx kvaser_pci sja1000 CONFIG_CAN_KVASER_PCI 2.6.31 supports all PCI-[mini]PCI[e][104] variants
Kvaser PCIe products kvaser_pciefd Kvaser kcan CAN_KVASER_PCIEFD 5.4 PCIEcan 4xHS
PCIEcan 2xHS v2
PCIEcan HS v2
Mini PCI Express HS v2
Mini PCI Express 2xHS v2
Kvaser USB products kvaser_usb (unknown) CONFIG_CAN_KVASER_USB 3.8








Leaf Ligth
Leaf Professional {HS,LS,SWC,LIN}
Leaf SemiPro {HS,LS,SWC}
USBcan {Professional,R}
Memorator {II, Professional} HS/HS

Leaf Light v2
Memorator HS/{HS,LS}
Mini PCI Express HS

USBcan R

Mini PCI Express 2xHS
USBcan Light 2xHS

Leaf Pro HS v2
Hybrid {,Pro} 2xCAN/LIN
Memorator 2xHS v2
Memorator Pro {2,5}xHS v2
USBcan Light 4xHS
USBcan Pro {2,5}xHS v2

USBcan R v2
Leaf Light R v2

USBcan Pro 4xHS

Hybrid {,Pro} CAN/LIN

EMS Wünsche CPC-Card ems_pcmcia sja1000 CONFIG_CAN_EMS_PCMCIA 3.2 discontinued
EMS Wünsche CPC-USB/ARM7 ems_usb (unknown) CONFIG_CAN_EMS_USB 3.2
EMS Wünsche CPC-PCI/PCIe ems_pci sja1000 CONFIG_CAN_EMS_PCI 3.2 up to four channel
EMS Wünsche CPC-PC104P ems_pci sja1000 CONFIG_CAN_EMS_PCI 3.2 up to four channel on a PC104+ board
8devices USB2CAN usb_8dev (STR750FV2) CONFIG_CAN_8DEV_USB 3.9 STR750FV2 Firmware
Softing CANcard2 softing_cs sja1000 or NEC-005(?) CONFIG_CAN_SOFTING_CS 2.6.38 Supports {CAN,EDIC}card{,SJA,2} PCMCIA cards

Needs firmware softing-fw-4.6-binaries.tar.gz

Microchip CAN BUS Analyzer Tool mcba_usb PIC18F2680 CONFIG_CAN_MCBA_USB 4.12 SocketCAN driver

Improved firmware

FEE CTU CTU CAN FD Core ctucanfd CTU CAN FD Core CONFIG_CTUCANFD 5.19 Open Source VHDL CAN FD IP Core - tested on
Linux Automation GmbH
et al.
candleLight gs_usb STM32F07 CONFIG_CAN_GS_USB 3.16 Open Hardware project by Hubert Denkmair (LXA variant), with open source firmware

SocketCAN Support in Programming Languages/Environments

can4linux Supported Controllers

  • Allwinner A20 with integrated CAN (on the popular BananaPi single-board computer, BananaPi-Pro, Banana-Mberry, Olimex Olinux-A20)
  • Analog Devices BlackFin BF537
  • Atmel AT91 SoCs
  • Freescale FlexCAN (ColdFire 5282, i.MX25, i.MX28, i.MX35)
  • Intel 82527 (the replacement Bosch CC770 should work)
  • Microchip Stand Alone CAN MCP2515
  • NXP Stand Alone CAN SJA1000 (on different ISA or PCI/PCIe boards)
  • Xilinx Zynq with XCAN
  • 'virtual' CAN mode without CAN hardware
  • 'virtual' CAN mode supporting CAN FD
  • IFI CAN FPGA IP, in classic CAN mode and CAN FD mode
  • KVASER PCICan-4HS with up to four classic CAN mode and CAN FD mode

can4linux Support in Programming Languages/Environments

  • C - many examples and useful applications are provided with the package, check can4linux-examples/
  • Tcl/Tk also in can4linux-examples/
  • Python also in can4linux-examples/

CAN Controllers Emulation

  • SJA1000 CAN controller based PCI board emulation for QEMU
    • Cards models provided:
      • Kvaser PCIcan-S single I/O mapped SJA1000 model compatible with kvaser_pci Linux driver on guest side
      • Advantech PCM-3680i PCI CAN (dual SJA1000 channel)
      • MIOe-3680 PCI CAN (dual SJA1000 channel)
    • The emulated CAN buses can be connected to virtual or physical SocketCAN interface if Linux is used as host system
    • The work has been integrated into QEMU mainline and will be included in QEMU 3.0 release
    • Documentation of CAN Bus emulation is included in the QEMU manual CAN Bus Emulation Support chapter
    • Original project repository: https://gitlab.fel.cvut.cz/canbus/qemu-canbus branch can-pci
    • Work started by 2013 GSoC project when RTEMS project donated its slot to work on QEMU CAN support - see RTEMS related page for more info and use instructions
    • RTLWS 17 article introducing QEMU CAN emulation
    • LinuxDays 2017 presentation GNU/Linux, CAN and CANopen in Real-time Control Applications includes description how to emulate PCI GPIO cards and PCI CAN interface in QEMU system and interconnect that all through COMEDI and OrtCAN compoanents to implement complete virtual CANopen node
  • CTU CAN FD core emulation and CAN FD host SoketCAN support

SocketCAN Bechmarking

SocketCAN Tutorials

CAN tools

  • CANdevStudio is a Qt based tool that aims to provide easy to use and comprehensive CAN bus simulation environment. Supports variety of different CAN controllers. Works on Linux, Windows and macOS.