https://elinux.org/api.php?action=feedcontributions&user=Rkollataj&feedformat=atomeLinux.org - User contributions [en]2024-03-29T05:31:07ZUser contributionsMediaWiki 1.31.0https://elinux.org/index.php?title=CAN_Bus&diff=471481CAN Bus2018-07-20T06:11:12Z<p>Rkollataj: </p>
<hr />
<div>=== Overview ===<br />
<br />
The CAN bus is an ISO standard bus originally developed for vehicles. It manages the Chassis Electrical System Control<br />
and is responsible for critical activities like engine electrical, and skid control. This system is also used<br />
to provide vehicle diagnostic information for maintenance. A multi-star configuration seems typical of<br />
this bus with a primary bus line that branches into sub bus lines at its extremities then attaches to<br />
multiple device nodes. Differential voltage is applied over twisted pair at 1.5 to 2.5V and 2.5 to 3.5V<br />
for noise resistant signaling. Bit rates up to 1 Mbit/s are possible at network lengths below 40 m.<br />
Decreasing the bit rate allows longer network distances (e.g., 500 m at 125 kbit/s).<br />
(Jeremiah J. Flerchinger [[media:avc-lan.pdf|Source]])<br />
Controllers supporting CAN FD, an enhanced CAN version with frames up to 64 byte and bit rates up to 4 Mbit/s,<br />
will be available in the second half of 2014. A can4linux version supportig CAN FD on a [http://www.ifi-pld.de/IP/CANFD/canfd.html IFI CAN] is ready to be used.<br />
<br />
Although developed as car communication network CAN is used in many other areas, industrial, medical, maritime laboratory and more.<br />
Most often with a CAN based higher layer protocol like [http://en.wikipedia.org/wiki/CANopen CANopen] on top of it.<br />
<br />
<br />
Additional information can be found at:<br />
:<br />
:http://en.wikipedia.org/wiki/CAN_bus<br />
:<br />
:[https://plus.google.com/u/0/117660856159215855502 SocketCAN News]<br />
:<br />
:CiA [http://www.can-cia.org CAN in Automation] CAN user association<br />
:[http://www.can-wiki.info CAN Wiki]<br />
:[http://www.bosch-semiconductors.de/media/pdf_1/canliteratur/can_fd_spec.pdf CAN FD Specification Version 1.0]<br />
=== CAN Support in Linux ===<br />
<br />
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.<br />
<br />
* [http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plain;f=Documentation/networking/can.txt SocketCAN Documentation]<br />
* [http://vger.kernel.org/vger-lists.html#linux-can mailing list for Linux Kernel CAN development]<br />
* [https://git.kernel.org/cgit/linux/kernel/git/mkl/linux-can.git linux-can git repository]<br />
* [https://git.kernel.org/cgit/linux/kernel/git/mkl/linux-can-next.git linux-can-next git repository]<br />
* [http://developer.berlios.de/projects/socketcan/ Berlios Project Page (obsolete)]<br />
<br />
One of the character based drivers is can4linux.<br />
<br />
* [http://www.can-wiki.info/can4linux/man/ can4linux documentation]<br />
* [http://sourceforge.net/projects/can4linux/ SourceForge project page]<br />
* [http://de.wikipedia.org/wiki/Can4linux German Wikipedia article]<br />
* [http://en.wikipedia.org/wiki/Can4linux English Wikipedia article]<br />
<br />
==== SocketCAN Supported Protocols ====<br />
* RAW: send & receive raw CAN frames<br />
* BCM: Broadcast manager, offload repetitive work to the Linux kernel<br />
* ISOTP ...<br />
* SAE [[J1939]]<br />
<br />
==== SocketCAN Supported Controllers ====<br />
* Microchip MCP251x<br />
* Atmel AT91 SoCs<br />
* ESD 331 CAN Cards<br />
* NXP (Philips) SJA1000<br />
* Freescale MPC52xx SoCs<br />
* Bosch CC770<br />
* Intel AN82527<br />
* TIs SoCs<br />
* Serial/network devices utilizing ASCII protocol (slcan driver)<br />
<br />
{| class="wikitable sortable"<br />
|-<br />
!Vendor !! Device Name !! Driver Module Name !! Controller !! Kconfig Option !! Linux Mainline !! Remarks<br />
|-<br />
|[http://vscom.de VScom] || [http://www.vscom.de/ethernet-to-can.htm NetCAN Plus 110] || slcan || (unknown) || CONFIG_CAN_SLCAN || 2.6.38 || needs slcand and socat<br />
|-<br />
|[http://vscom.de VScom] || [http://www.vscom.de/usb-to-can.htm USB-CAN Plus] || slcan || SJA1000T || CONFIG_CAN_SLCAN || 2.6.38 || needs slcand<br />
|-<br />
|[http://www.lawicel-shop.se LAWICEL] || [http://www.can232.com/?page_id=14 CAN232] || slcan || (unknown) || CONFIG_CAN_SLCAN || 2.6.38 || needs slcand<br />
|-<br />
|[http://www.lawicel-shop.se LAWICEL] || [http://www.can232.com/?page_id=16 CANUSB] || slcan || (unknown) || CONFIG_CAN_SLCAN || 2.6.38 || needs slcand<br />
|-<br />
|[http://www.peak-system.com PEAK] || [http://www.peak-system.com/PCAN-PCI.207.0.html PCAN-PCI] || peak_pci || sja1000 || CONFIG_CAN_PEAK_PCI || 3.2 || supports all PCAN-[mini]PCI[e][104] variants<br />
|-<br />
|[http://www.peak-system.com PEAK] || [http://www.peak-system.com/PCAN-USB.199.0.html PCAN-USB] || peak_usb || (unknown) || CONFIG_CAN_PEAK_USB || 3.4 || supports PCAN-USB[pro][hub] (no LIN support)<br />
|-<br />
|[http://www.kvaser.com/ Kvaser] || [http://www.kvaser.com/products-services/our-products/#?interfaces=mini-pci-express,pci104,pci,pci-express PCIcanx] || kvaser_pci || sja1000 || CONFIG_CAN_KVASER_PCI || 2.6.31 || supports all PCI-[mini]PCI[e][104] variants<br />
|-<br />
|[http://www.kvaser.com/ Kvaser] || [http://www.kvaser.com/products-services/our-products/#?interfaces=usb Leaf] || kvaser_usb || (unknown) || CONFIG_CAN_KVASER_USB || 3.8 || supports USB Leaf / Memorator / Blackbird / R (see detailed USB device IDs in kvaser_usb.c)<br />
|-<br />
|[http://www.kvaser.com/ Kvaser] || [http://www.kvaser.com/products-services/our-products/#?interfaces=usb USBCan-II] || kvaser_usb || (unknown) || CONFIG_CAN_KVASER_USB || [http://thread.gmane.org/gmane.linux.can/7570 commits pulled-in for the 3.20 release] || supports:<br />
* Kvaser USBCan-II HS/LS<br />
* Kvaser USBCan-II HS/HS<br />
* Kvaser USBcan Rugged ("USBcan Rev B")<br />
* Kvaser Memorator HS/LS<br />
* Kvaser Memorator HS/HS<br />
* Scania VCI2 (if you have the Kvaser logo on top)<br />
|-<br />
|[http://www.ems-wuensche.com EMS Wünsche] || [http://www.ems-wuensche.com/product/datasheet/html/can-pccard-laptop-notebook-adapter-cpccard.html CPC-Card] || ems_pcmcia || sja1000 || CONFIG_CAN_EMS_PCMCIA || 3.2 || discontinued<br />
<br />
|-<br />
|[http://www.ems-wuensche.com EMS Wünsche] || [http://www.ems-wuensche.com/product/datasheet/html/can-usb-adapter-converter-interface-cpcusb.html CPC-USB/ARM7] || ems_usb || (unknown) || CONFIG_CAN_EMS_USB || 3.2 || <br />
<br />
|-<br />
|[http://www.ems-wuensche.com EMS Wünsche] || [http://www.ems-wuensche.com/product/datasheet/html/can-pci-plugincard-multiple-channels-cpcpci.html CPC-PCI/PCIe] || ems_pci || sja1000 || CONFIG_CAN_EMS_PCI || 3.2 || up to four channel<br />
<br />
|-<br />
|[http://www.ems-wuensche.com EMS Wünsche] || [http://www.ems-wuensche.com/product/datasheet/html/can-pci-104-passive-plugincard-cpc104p.html CPC-PC104P] || ems_pci || sja1000 || CONFIG_CAN_EMS_PCI || 3.2 || up to four channel on a PC104+ board<br />
<br />
|-<br />
|[http://8devices.com 8devices] || [http://8devices.com/usb2can USB2CAN] || usb_8dev || (STR750FV2) || CONFIG_CAN_8DEV_USB || 3.9 || [https://github.com/krumboeck/usb2can STR750FV2 Firmware]<br />
<br />
|-<br />
|[http://www.softing.com Softing] || [http://automotive.softing.com/en/products/communication-interfaces-can.html CANcard2] || softing_cs || sja1000 or NEC-005(?) || CONFIG_CAN_SOFTING_CS || 2.6.38 || Supports {CAN,EDIC}card{,SJA,2} PCMCIA cards<br />
Needs firmware [http://www.gitorious.org/linux-can/can-misc softing-fw-4.6-binaries.tar.gz]<br />
<br />
|-<br />
|[http://www.microchip.com Microchip] || [http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=APGDT002 CAN BUS Analyzer Tool] || mcba_usb || PIC18F2680 || CONFIG_CAN_MCBA_USB || 4.12 || [https://github.com/rkollataj/mcba_usb SocketCAN driver]<br />
[https://github.com/rkollataj/mcba_firmware Improved firmware]<br />
|}<br />
<br />
==== SocketCAN Support in Programming Languages/Environments ====<br />
* [[Android]]<br />
* [[Java]]<br />
* [[Python_Can | Python]]<br />
* [https://github.com/rscada/libcanopen/ Python library for CAN]<br />
* [http://lintarget.sourceforge.net/can_bus/index.html Matlab/Simulink blocks to send and receive CAN messages]<br />
* [[TTCN | TTCN]]<br />
<br />
==== can4linux Supported Controllers ====<br />
<br />
* [http://linux-sunxi.org/A20 Allwinner A20] with integrated CAN (on the popular [http://www.lemaker.org/ BananaPi] single-board computer.)<br />
* Analog Devices BlackFin BF537<br />
* Atmel AT91 SoCs<br />
* [http://www.freescale.com/ Freescale] FlexCAN (ColdFire 5282, i.MX25, i.MX28, i.MX35)<br />
* Intel 82527 (the replacement Bosch CC770 should work)<br />
* Microchip Stand Alone CAN MCP2515<br />
* NXP Stand Alone CAN [http://www.nxp.com/documents/data_sheet/SJA1000.pdf SJA1000] (on different ISA or PCI/PCIe boards)<br />
* [http://www.xilinx.com/products/intellectual-property/DO-DI-CAN.htm Xilinx] Zynq with XCAN<br />
* 'virtual' CAN mode without CAN hardware<br />
* 'virtual' CAN mode supporting [http://www.can-wiki.info/doku.php?id=can_fd CAN FD]<br />
* [http://www.ifi-pld.de/IP/CANFD/canfd.html IFI CAN] FPGA IP, in classic CAN mode and CAN FD mode<br />
<br />
==== can4linux Support in Programming Languages/Environments ====<br />
* C - many examples and useful applications are provided with the package, check can4linux-examples/<br />
* [[Tcl/Tk]] also in can4linux-examples/<br />
* [[Python]] also in can4linux-examples/<br />
<br />
==== CAN Controllers Emulation ====<br />
* SJA1000 CAN controller based PCI board emulation for QEMU<br />
** Cards models provided:<br />
*** Kvaser PCIcan-S single I/O mapped SJA1000 model compatible with kvaser_pci Linux driver on guest side<br />
*** Advantech PCM-3680i PCI CAN (dual SJA1000 channel)<br />
*** MIOe-3680 PCI CAN (dual SJA1000 channel)<br />
** The emulated CAN buses can be connected to virtual or physical SocketCAN interface if Linux is used as host system<br />
** The work has been integrated into QEMU mainline and will be included in QEMU 3.0 release<br />
** Documentation of CAN Bus emulation is included in QEMU [https://git.qemu.org/?p=qemu.git;a=blob;f=docs/can.txt docs/can.txt] file<br />
** Original project repository: [https://github.com/CTU-IIG/qemu https://github.com/CTU-IIG/qemu] branch [https://github.com/CTU-IIG/qemu/tree/can-pci can-pci]<br />
** Work started by 2013 GSoC project when RTEMS project donated its slot to work on QEMU CAN support - see [https://devel.rtems.org/wiki/Developer/Simulators/QEMU/CANEmulation RTEMS related page] for more info and use instructions<br />
** Some instructions and RTLWS article can be found at https://rtime.felk.cvut.cz/can/can-qemu/<br />
<br />
==== SocketCAN Bechmarking ====<br />
* [http://rtime.felk.cvut.cz/can/benchmark/3.0/ CAN gateway timing analysis] and [http://rtime.felk.cvut.cz/gitweb/can-benchmark.git repository with benchmark infrastructure]<br />
<br />
==== SocketCAN Tutorials ====<br />
* [[Bringing CAN interface up]]<br />
* [[can-utils]]<br />
* [[libsocketcan]]<br />
* [[libnl]]<br />
<br />
=== CAN tools ===<br />
* [https://github.com/GENIVI/CANdevStudio 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.<br />
<br />
[[Category:Networking]]<br />
[[Category:Automotive]]</div>Rkollatajhttps://elinux.org/index.php?title=CAN_Bus&diff=443201CAN Bus2017-05-23T11:35:55Z<p>Rkollataj: </p>
<hr />
<div>=== Overview ===<br />
<br />
The CAN bus is an ISO standard bus originally developed for vehicles. It manages the Chassis Electrical System Control<br />
and is responsible for critical activities like engine electrical, and skid control. This system is also used<br />
to provide vehicle diagnostic information for maintenance. A multi-star configuration seems typical of<br />
this bus with a primary bus line that branches into sub bus lines at its extremities then attaches to<br />
multiple device nodes. Differential voltage is applied over twisted pair at 1.5 to 2.5V and 2.5 to 3.5V<br />
for noise resistant signaling. Bit rates up to 1 Mbit/s are possible at network lengths below 40 m.<br />
Decreasing the bit rate allows longer network distances (e.g., 500 m at 125 kbit/s).<br />
(Jeremiah J. Flerchinger [[media:avc-lan.pdf|Source]])<br />
Controllers supporting CAN FD, an enhanced CAN version with frames up to 64 byte and bit rates up to 4 Mbit/s,<br />
will be available in the second half of 2014. A can4linux version supportig CAN FD on a [http://www.ifi-pld.de/IP/CANFD/canfd.html IFI CAN] is ready to be used.<br />
<br />
Although developed as car communication network CAN is used in many other areas, industrial, medical, maritime laboratory and more.<br />
Most often with a CAN based higher layer protocol like [http://en.wikipedia.org/wiki/CANopen CANopen] on top of it.<br />
<br />
<br />
Additional information can be found at:<br />
:<br />
:http://en.wikipedia.org/wiki/CAN_bus<br />
:<br />
:[https://plus.google.com/u/0/117660856159215855502 SocketCAN News]<br />
:<br />
:CiA [http://www.can-cia.org CAN in Automation] CAN user association<br />
:[http://www.can-wiki.info CAN Wiki]<br />
:[http://www.bosch-semiconductors.de/media/pdf_1/canliteratur/can_fd_spec.pdf CAN FD Specification Version 1.0]<br />
=== CAN Support in Linux ===<br />
<br />
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.<br />
<br />
* [http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plain;f=Documentation/networking/can.txt SocketCAN Documentation]<br />
* [http://vger.kernel.org/vger-lists.html#linux-can mailing list for Linux Kernel CAN development]<br />
* [https://git.kernel.org/cgit/linux/kernel/git/mkl/linux-can.git linux-can git repository]<br />
* [https://git.kernel.org/cgit/linux/kernel/git/mkl/linux-can-next.git linux-can-next git repository]<br />
* [http://developer.berlios.de/projects/socketcan/ Berlios Project Page (obsolete)]<br />
<br />
One of the character based drivers is can4linux.<br />
<br />
* [http://www.can-wiki.info/can4linux/man/ can4linux documentation]<br />
* [http://sourceforge.net/projects/can4linux/ SourceForge project page]<br />
* [http://de.wikipedia.org/wiki/Can4linux German Wikipedia article]<br />
* [http://en.wikipedia.org/wiki/Can4linux English Wikipedia article]<br />
<br />
==== SocketCAN Supported Protocols ====<br />
* RAW: send & receive raw CAN frames<br />
* BCM: Broadcast manager, offload repetitive work to the Linux kernel<br />
* ISOTP ...<br />
* SAE [[J1939]]<br />
<br />
==== SocketCAN Supported Controllers ====<br />
* Microchip MCP251x<br />
* Atmel AT91 SoCs<br />
* ESD 331 CAN Cards<br />
* NXP (Philips) SJA1000<br />
* Freescale MPC52xx SoCs<br />
* Bosch CC770<br />
* Intel AN82527<br />
* TIs SoCs<br />
* Serial/network devices utilizing ASCII protocol (slcan driver)<br />
<br />
{| class="wikitable sortable"<br />
|-<br />
!Vendor !! Device Name !! Driver Module Name !! Controller !! Kconfig Option !! Linux Mainline !! Remarks<br />
|-<br />
|[http://vscom.de VScom] || [http://www.vscom.de/ethernet-to-can.htm NetCAN Plus 110] || slcan || (unknown) || CONFIG_CAN_SLCAN || 2.6.38 || needs slcand and socat<br />
|-<br />
|[http://vscom.de VScom] || [http://www.vscom.de/usb-to-can.htm USB-CAN Plus] || slcan || SJA1000T || CONFIG_CAN_SLCAN || 2.6.38 || needs slcand<br />
|-<br />
|[http://www.lawicel-shop.se LAWICEL] || [http://www.can232.com/?page_id=14 CAN232] || slcan || (unknown) || CONFIG_CAN_SLCAN || 2.6.38 || needs slcand<br />
|-<br />
|[http://www.lawicel-shop.se LAWICEL] || [http://www.can232.com/?page_id=16 CANUSB] || slcan || (unknown) || CONFIG_CAN_SLCAN || 2.6.38 || needs slcand<br />
|-<br />
|[http://www.peak-system.com PEAK] || [http://www.peak-system.com/PCAN-PCI.207.0.html PCAN-PCI] || peak_pci || sja1000 || CONFIG_CAN_PEAK_PCI || 3.2 || supports all PCAN-[mini]PCI[e][104] variants<br />
|-<br />
|[http://www.peak-system.com PEAK] || [http://www.peak-system.com/PCAN-USB.199.0.html PCAN-USB] || peak_usb || (unknown) || CONFIG_CAN_PEAK_USB || 3.4 || supports PCAN-USB[pro][hub] (no LIN support)<br />
|-<br />
|[http://www.kvaser.com/ Kvaser] || [http://www.kvaser.com/products-services/our-products/#?interfaces=mini-pci-express,pci104,pci,pci-express PCIcanx] || kvaser_pci || sja1000 || CONFIG_CAN_KVASER_PCI || 2.6.31 || supports all PCI-[mini]PCI[e][104] variants<br />
|-<br />
|[http://www.kvaser.com/ Kvaser] || [http://www.kvaser.com/products-services/our-products/#?interfaces=usb Leaf] || kvaser_usb || (unknown) || CONFIG_CAN_KVASER_USB || 3.8 || supports USB Leaf / Memorator / Blackbird / R (see detailed USB device IDs in kvaser_usb.c)<br />
|-<br />
|[http://www.kvaser.com/ Kvaser] || [http://www.kvaser.com/products-services/our-products/#?interfaces=usb USBCan-II] || kvaser_usb || (unknown) || CONFIG_CAN_KVASER_USB || [http://thread.gmane.org/gmane.linux.can/7570 commits pulled-in for the 3.20 release] || supports:<br />
* Kvaser USBCan-II HS/LS<br />
* Kvaser USBCan-II HS/HS<br />
* Kvaser USBcan Rugged ("USBcan Rev B")<br />
* Kvaser Memorator HS/LS<br />
* Kvaser Memorator HS/HS<br />
* Scania VCI2 (if you have the Kvaser logo on top)<br />
|-<br />
|[http://www.ems-wuensche.com EMS Wünsche] || [http://www.ems-wuensche.com/product/datasheet/html/can-pccard-laptop-notebook-adapter-cpccard.html CPC-Card] || ems_pcmcia || sja1000 || CONFIG_CAN_EMS_PCMCIA || 3.2 || discontinued<br />
<br />
|-<br />
|[http://www.ems-wuensche.com EMS Wünsche] || [http://www.ems-wuensche.com/product/datasheet/html/can-usb-adapter-converter-interface-cpcusb.html CPC-USB/ARM7] || ems_usb || (unknown) || CONFIG_CAN_EMS_USB || 3.2 || <br />
<br />
|-<br />
|[http://www.ems-wuensche.com EMS Wünsche] || [http://www.ems-wuensche.com/product/datasheet/html/can-pci-plugincard-multiple-channels-cpcpci.html CPC-PCI/PCIe] || ems_pci || sja1000 || CONFIG_CAN_EMS_PCI || 3.2 || up to four channel<br />
<br />
|-<br />
|[http://www.ems-wuensche.com EMS Wünsche] || [http://www.ems-wuensche.com/product/datasheet/html/can-pci-104-passive-plugincard-cpc104p.html CPC-PC104P] || ems_pci || sja1000 || CONFIG_CAN_EMS_PCI || 3.2 || up to four channel on a PC104+ board<br />
<br />
|-<br />
|[http://8devices.com 8devices] || [http://8devices.com/usb2can USB2CAN] || usb_8dev || (STR750FV2) || CONFIG_CAN_8DEV_USB || 3.9 || [https://github.com/krumboeck/usb2can STR750FV2 Firmware]<br />
<br />
|-<br />
|[http://www.softing.com Softing] || [http://automotive.softing.com/en/products/communication-interfaces-can.html CANcard2] || softing_cs || sja1000 or NEC-005(?) || CONFIG_CAN_SOFTING_CS || 2.6.38 || Supports {CAN,EDIC}card{,SJA,2} PCMCIA cards<br />
Needs firmware [http://www.gitorious.org/linux-can/can-misc softing-fw-4.6-binaries.tar.gz]<br />
<br />
|-<br />
|[http://www.microchip.com Microchip] || [http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=APGDT002 CAN BUS Analyzer Tool] || mcba_usb || PIC18F2680 || CONFIG_CAN_MCBA_USB || 4.12 || [https://github.com/rkollataj/mcba_usb SocketCAN driver]<br />
[https://github.com/rkollataj/mcba_firmware Improved firmware]<br />
|}<br />
<br />
==== SocketCAN Support in Programming Languages/Environments ====<br />
* [[Android]]<br />
* [[Java]]<br />
* [[Python_Can | Python]]<br />
* [https://github.com/rscada/libcanopen/ Python library for CAN]<br />
* [http://lintarget.sourceforge.net/can_bus/index.html Matlab/Simulink blocks to send and receive CAN messages]<br />
* [[TTCN | TTCN]]<br />
<br />
==== can4linux Supported Controllers ====<br />
<br />
* [http://linux-sunxi.org/A20 Allwinner A20] with integrated CAN (on the popular [http://www.lemaker.org/ BananaPi] single-board computer.)<br />
* Analog Devices BlackFin BF537<br />
* Atmel AT91 SoCs<br />
* [http://www.freescale.com/ Freescale] FlexCAN (ColdFire 5282, i.MX25, i.MX28, i.MX35)<br />
* Intel 82527 (the replacement Bosch CC770 should work)<br />
* Microchip Stand Alone CAN MCP2515<br />
* NXP Stand Alone CAN [http://www.nxp.com/documents/data_sheet/SJA1000.pdf SJA1000] (on different ISA or PCI/PCIe boards)<br />
* [http://www.xilinx.com/products/intellectual-property/DO-DI-CAN.htm Xilinx] Zynq with XCAN<br />
* 'virtual' CAN mode without CAN hardware<br />
* 'virtual' CAN mode supporting [http://www.can-wiki.info/doku.php?id=can_fd CAN FD]<br />
* [http://www.ifi-pld.de/IP/CANFD/canfd.html IFI CAN] FPGA IP, in classic CAN mode and CAN FD mode<br />
<br />
==== can4linux Support in Programming Languages/Environments ====<br />
* C - many examples and useful applications are provided with the package, check can4linux-examples/<br />
* [[Tcl/Tk]] also in can4linux-examples/<br />
* [[Python]] also in can4linux-examples/<br />
<br />
==== CAN Controllers Emulation (WIP/experimental) ====<br />
* SJA1000 CAN controller based PCI board emulation for QEMU<br />
** Cards models provided:<br />
*** Simple memory mapped SJA1000 in the first PCI BAR with ad-hoc PCI ID<br />
*** Kvaser PCIcan-S single I/O mapped SJA1000 model compatible with kvaser_pci Linux driver on guest side<br />
*** Advantech PCM-3680i PCI CAN (dual SJA1000 channel)<br />
** The emulated CAN buses can be connected to virtual or physical SocketCAN interface if Linux is used as host system<br />
** Project repository: [https://github.com/CTU-IIG/qemu https://github.com/CTU-IIG/qemu] branch [https://github.com/CTU-IIG/qemu/tree/can-pci can-pci]<br />
** Work started by 2013 GSoC project when RTEMS project donated its slot to work on QEMU CAN support - see [https://devel.rtems.org/wiki/Developer/Simulators/QEMU/CANEmulation RTEMS related page] for more info and use instructions<br />
** Some instructions and RTLWS article can be found at https://rtime.felk.cvut.cz/can/can-qemu/<br />
<br />
==== SocketCAN Bechmarking ====<br />
* [http://rtime.felk.cvut.cz/can/benchmark/3.0/ CAN gateway timing analysis] and [http://rtime.felk.cvut.cz/gitweb/can-benchmark.git repository with benchmark infrastructure]<br />
<br />
==== SocketCAN Tutorials ====<br />
* [[Bringing CAN interface up]]<br />
* [[can-utils]]<br />
* [[libsocketcan]]<br />
* [[libnl]]<br />
<br />
[[Category:Networking]]<br />
[[Category:Automotive]]</div>Rkollatajhttps://elinux.org/index.php?title=CAN_Bus&diff=430796CAN Bus2017-01-17T14:39:05Z<p>Rkollataj: </p>
<hr />
<div>=== Overview ===<br />
<br />
The CAN bus is an ISO standard bus originally developed for vehicles. It manages the Chassis Electrical System Control<br />
and is responsible for critical activities like engine electrical, and skid control. This system is also used<br />
to provide vehicle diagnostic information for maintenance. A multi-star configuration seems typical of<br />
this bus with a primary bus line that branches into sub bus lines at its extremities then attaches to<br />
multiple device nodes. Differential voltage is applied over twisted pair at 1.5 to 2.5V and 2.5 to 3.5V<br />
for noise resistant signaling. Bit rates up to 1 Mbit/s are possible at network lengths below 40 m.<br />
Decreasing the bit rate allows longer network distances (e.g., 500 m at 125 kbit/s).<br />
(Jeremiah J. Flerchinger [[media:avc-lan.pdf|Source]])<br />
Controllers supporting CAN FD, an enhanced CAN version with frames up to 64 byte and bit rates up to 4 Mbit/s,<br />
will be available in the second half of 2014. A can4linux version supportig CAN FD on a [http://www.ifi-pld.de/IP/CANFD/canfd.html IFI CAN] is ready to be used.<br />
<br />
Although developed as car communication network CAN is used in many other areas, industrial, medical, maritime laboratory and more.<br />
Most often with a CAN based higher layer protocol like [http://en.wikipedia.org/wiki/CANopen CANopen] on top of it.<br />
<br />
<br />
Additional information can be found at:<br />
:<br />
:http://en.wikipedia.org/wiki/CAN_bus<br />
:<br />
:[https://plus.google.com/u/0/117660856159215855502 SocketCAN News]<br />
:<br />
:CiA [http://www.can-cia.org CAN in Automation] CAN user association<br />
:[http://www.can-wiki.info CAN Wiki]<br />
:[http://www.bosch-semiconductors.de/media/pdf_1/canliteratur/can_fd_spec.pdf CAN FD Specification Version 1.0]<br />
=== CAN Support in Linux ===<br />
<br />
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.<br />
<br />
* [http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plain;f=Documentation/networking/can.txt SocketCAN Documentation]<br />
* [http://vger.kernel.org/vger-lists.html#linux-can mailing list for Linux Kernel CAN development]<br />
* [https://git.kernel.org/cgit/linux/kernel/git/mkl/linux-can.git linux-can git repository]<br />
* [https://git.kernel.org/cgit/linux/kernel/git/mkl/linux-can-next.git linux-can-next git repository]<br />
* [http://developer.berlios.de/projects/socketcan/ Berlios Project Page (obsolete)]<br />
<br />
One of the character based drivers is can4linux.<br />
<br />
* [http://www.can-wiki.info/can4linux/man/ can4linux documentation]<br />
* [http://sourceforge.net/projects/can4linux/ SourceForge project page]<br />
* [http://de.wikipedia.org/wiki/Can4linux German Wikipedia article]<br />
* [http://en.wikipedia.org/wiki/Can4linux English Wikipedia article]<br />
<br />
==== SocketCAN Supported Protocols ====<br />
* RAW: send & receive raw CAN frames<br />
* BCM: Broadcast manager, offload repetitive work to the Linux kernel<br />
* ISOTP ...<br />
* SAE [[J1939]]<br />
<br />
==== SocketCAN Supported Controllers ====<br />
* Microchip MCP251x<br />
* Atmel AT91 SoCs<br />
* ESD 331 CAN Cards<br />
* NXP (Philips) SJA1000<br />
* Freescale MPC52xx SoCs<br />
* Bosch CC770<br />
* Intel AN82527<br />
* TIs SoCs<br />
* Serial/network devices utilizing ASCII protocol (slcan driver)<br />
<br />
{| class="wikitable sortable"<br />
|-<br />
!Vendor !! Device Name !! Driver Module Name !! Controller !! Kconfig Option !! Linux Mainline !! Remarks<br />
|-<br />
|[http://vscom.de VScom] || [http://www.vscom.de/ethernet-to-can.htm NetCAN Plus 110] || slcan || (unknown) || CONFIG_CAN_SLCAN || 2.6.38 || needs slcand and socat<br />
|-<br />
|[http://vscom.de VScom] || [http://www.vscom.de/usb-to-can.htm USB-CAN Plus] || slcan || SJA1000T || CONFIG_CAN_SLCAN || 2.6.38 || needs slcand<br />
|-<br />
|[http://www.lawicel-shop.se LAWICEL] || [http://www.can232.com/?page_id=14 CAN232] || slcan || (unknown) || CONFIG_CAN_SLCAN || 2.6.38 || needs slcand<br />
|-<br />
|[http://www.lawicel-shop.se LAWICEL] || [http://www.can232.com/?page_id=16 CANUSB] || slcan || (unknown) || CONFIG_CAN_SLCAN || 2.6.38 || needs slcand<br />
|-<br />
|[http://www.peak-system.com PEAK] || [http://www.peak-system.com/PCAN-PCI.207.0.html PCAN-PCI] || peak_pci || sja1000 || CONFIG_CAN_PEAK_PCI || 3.2 || supports all PCAN-[mini]PCI[e][104] variants<br />
|-<br />
|[http://www.peak-system.com PEAK] || [http://www.peak-system.com/PCAN-USB.199.0.html PCAN-USB] || peak_usb || (unknown) || CONFIG_CAN_PEAK_USB || 3.4 || supports PCAN-USB[pro][hub] (no LIN support)<br />
|-<br />
|[http://www.kvaser.com/ Kvaser] || [http://www.kvaser.com/products-services/our-products/#?interfaces=mini-pci-express,pci104,pci,pci-express PCIcanx] || kvaser_pci || sja1000 || CONFIG_CAN_KVASER_PCI || 2.6.31 || supports all PCI-[mini]PCI[e][104] variants<br />
|-<br />
|[http://www.kvaser.com/ Kvaser] || [http://www.kvaser.com/products-services/our-products/#?interfaces=usb Leaf] || kvaser_usb || (unknown) || CONFIG_CAN_KVASER_USB || 3.8 || supports USB Leaf / Memorator / Blackbird / R (see detailed USB device IDs in kvaser_usb.c)<br />
|-<br />
|[http://www.kvaser.com/ Kvaser] || [http://www.kvaser.com/products-services/our-products/#?interfaces=usb USBCan-II] || kvaser_usb || (unknown) || CONFIG_CAN_KVASER_USB || [http://thread.gmane.org/gmane.linux.can/7570 commits pulled-in for the 3.20 release] || supports:<br />
* Kvaser USBCan-II HS/LS<br />
* Kvaser USBCan-II HS/HS<br />
* Kvaser USBcan Rugged ("USBcan Rev B")<br />
* Kvaser Memorator HS/LS<br />
* Kvaser Memorator HS/HS<br />
* Scania VCI2 (if you have the Kvaser logo on top)<br />
|-<br />
|[http://www.ems-wuensche.com EMS Wünsche] || [http://www.ems-wuensche.com/product/datasheet/html/can-pccard-laptop-notebook-adapter-cpccard.html CPC-Card] || ems_pcmcia || sja1000 || CONFIG_CAN_EMS_PCMCIA || 3.2 || discontinued<br />
<br />
|-<br />
|[http://www.ems-wuensche.com EMS Wünsche] || [http://www.ems-wuensche.com/product/datasheet/html/can-usb-adapter-converter-interface-cpcusb.html CPC-USB/ARM7] || ems_usb || (unknown) || CONFIG_CAN_EMS_USB || 3.2 || <br />
<br />
|-<br />
|[http://www.ems-wuensche.com EMS Wünsche] || [http://www.ems-wuensche.com/product/datasheet/html/can-pci-plugincard-multiple-channels-cpcpci.html CPC-PCI/PCIe] || ems_pci || sja1000 || CONFIG_CAN_EMS_PCI || 3.2 || up to four channel<br />
<br />
|-<br />
|[http://www.ems-wuensche.com EMS Wünsche] || [http://www.ems-wuensche.com/product/datasheet/html/can-pci-104-passive-plugincard-cpc104p.html CPC-PC104P] || ems_pci || sja1000 || CONFIG_CAN_EMS_PCI || 3.2 || up to four channel on a PC104+ board<br />
<br />
|-<br />
|[http://8devices.com 8devices] || [http://8devices.com/usb2can USB2CAN] || usb_8dev || (STR750FV2) || CONFIG_CAN_8DEV_USB || 3.9 || [https://github.com/krumboeck/usb2can STR750FV2 Firmware]<br />
<br />
|-<br />
|[http://www.softing.com Softing] || [http://automotive.softing.com/en/products/communication-interfaces-can.html CANcard2] || softing_cs || sja1000 or NEC-005(?) || CONFIG_CAN_SOFTING_CS || 2.6.38 || Supports {CAN,EDIC}card{,SJA,2} PCMCIA cards<br />
Needs firmware [http://www.gitorious.org/linux-can/can-misc softing-fw-4.6-binaries.tar.gz]<br />
<br />
|-<br />
|[http://www.microchip.com Microchip] || [http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=APGDT002 CAN BUS Analyzer Tool] || mcba_usb || PIC18F2680 || CONFIG_CAN_MCBA_USB || <ongoing> || [https://github.com/rkollataj/mcba_usb SocketCAN driver]<br />
[https://github.com/rkollataj/mcba_firmware Improved firmware]<br />
|}<br />
<br />
==== SocketCAN Support in Programming Languages/Environments ====<br />
* [[Android]]<br />
* [[Java]]<br />
* [[Python_Can | Python]]<br />
* [https://github.com/rscada/libcanopen/ Python library for CAN]<br />
* [http://lintarget.sourceforge.net/can_bus/index.html Matlab/Simulink blocks to send and receive CAN messages]<br />
* [[TTCN | TTCN]]<br />
<br />
==== can4linux Supported Controllers ====<br />
<br />
* [http://linux-sunxi.org/A20 Allwinner A20] with integrated CAN (on the popular [http://www.lemaker.org/ BananaPi] single-board computer.)<br />
* Analog Devices BlackFin BF537<br />
* Atmel AT91 SoCs<br />
* [http://www.freescale.com/ Freescale] FlexCAN (ColdFire 5282, i.MX25, i.MX28, i.MX35)<br />
* Intel 82527 (the replacement Bosch CC770 should work)<br />
* Microchip Stand Alone CAN MCP2515<br />
* NXP Stand Alone CAN [http://www.nxp.com/documents/data_sheet/SJA1000.pdf SJA1000] (on different ISA or PCI/PCIe boards)<br />
* [http://www.xilinx.com/products/intellectual-property/DO-DI-CAN.htm Xilinx] Zynq with XCAN<br />
* 'virtual' CAN mode without CAN hardware<br />
* 'virtual' CAN mode supporting [http://www.can-wiki.info/doku.php?id=can_fd CAN FD]<br />
* [http://www.ifi-pld.de/IP/CANFD/canfd.html IFI CAN] FPGA IP, in classic CAN mode and CAN FD mode<br />
<br />
==== can4linux Support in Programming Languages/Environments ====<br />
* C - many examples and useful applications are provided with the package, check can4linux-examples/<br />
* [[Tcl/Tk]] also in can4linux-examples/<br />
* [[Python]] also in can4linux-examples/<br />
<br />
==== CAN Controllers Emulation (WIP/experimental) ====<br />
* SJA1000 CAN controller based PCI board emulation for QEMU<br />
** Cards models provided:<br />
*** Simple memory mapped SJA1000 in the first PCI BAR with ad-hoc PCI ID<br />
*** Kvaser PCIcan-S single I/O mapped SJA1000 model compatible with kvaser_pci Linux driver on guest side<br />
*** Advantech PCM-3680i PCI CAN (dual SJA1000 channel)<br />
** The emulated CAN buses can be connected to virtual or physical SocketCAN interface if Linux is used as host system<br />
** Project repository: [https://github.com/CTU-IIG/qemu https://github.com/CTU-IIG/qemu] branch [https://github.com/CTU-IIG/qemu/tree/can-pci can-pci]<br />
** Work started by 2013 GSoC project when RTEMS project donated its slot to work on QEMU CAN support - see [https://devel.rtems.org/wiki/Developer/Simulators/QEMU/CANEmulation RTEMS related page] for more info and use instructions<br />
** Some instructions and RTLWS article can be found at https://rtime.felk.cvut.cz/can/can-qemu/<br />
<br />
==== SocketCAN Bechmarking ====<br />
* [http://rtime.felk.cvut.cz/can/benchmark/3.0/ CAN gateway timing analysis] and [http://rtime.felk.cvut.cz/gitweb/can-benchmark.git repository with benchmark infrastructure]<br />
<br />
==== SocketCAN Tutorials ====<br />
* [[Bringing CAN interface up]]<br />
* [[can-utils]]<br />
* [[libsocketcan]]<br />
* [[libnl]]<br />
<br />
[[Category:Networking]]<br />
[[Category:Automotive]]</div>Rkollataj