Difference between revisions of "CAN Bus"
(Reorganize into layers to make more sense) |
m (begin adding frame format tables) |
||
| Line 6: | Line 6: | ||
* the data link layer, which specifies bit timing, message framing, error detection, etc. | * the data link layer, which specifies bit timing, message framing, error detection, etc. | ||
* the application layer, which specifies things like which identifier to use for what data. | * the application layer, which specifies things like which identifier to use for what data. | ||
| + | |||
==CAN bus physical layer== | ==CAN bus physical layer== | ||
At the physical layer, there are two types of CAN networks: low–speed CAN and high–speed CAN. | At the physical layer, there are two types of CAN networks: low–speed CAN and high–speed CAN. | ||
| Line 20: | Line 21: | ||
===CAN 2.0A=== | ===CAN 2.0A=== | ||
CAN 2.0A is effectively the same as CAN 1.0 and 1.2. It uses 11 bit identifiers, so a maximum of 2048 devices can transmit on a network. If a device says it supports CAN, it supports this. | CAN 2.0A is effectively the same as CAN 1.0 and 1.2. It uses 11 bit identifiers, so a maximum of 2048 devices can transmit on a network. If a device says it supports CAN, it supports this. | ||
| − | < | + | {| class="wikitable" |
| + | |- | ||
| + | |Field name<br /> | ||
| + | |Length (bits)<br /> | ||
| + | |Purpose<br /> | ||
| + | |- | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |- | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |- | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |- | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |- | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |- | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |- | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |- | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |- | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |} | ||
| + | |||
| + | |||
===CAN 2.0B=== | ===CAN 2.0B=== | ||
CAN 2.0B builds on CAN 2.0A by allowing 29 bit identifiers. | CAN 2.0B builds on CAN 2.0A by allowing 29 bit identifiers. | ||
| − | < | + | {| class="wikitable" |
| + | |- | ||
| + | |Field name<br /> | ||
| + | |Length (bits)<br /> | ||
| + | |Purpose<br /> | ||
| + | |- | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |- | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |- | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |- | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |- | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |- | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |- | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |- | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |- | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |<br /> | ||
| + | |} | ||
| + | |||
| + | |||
===CAN FD=== | ===CAN FD=== | ||
CAN FD (Flexible Data-rate) is an extension of the CAN 2.0 protocol. It can dynamically switch between different data rates and longer or shorter messages, resulting in faster data speeds and higher data capacity.<ref>Falch, Martin. "CAN FD Explained - A Simple Intro [2022] - CSS Electronics". Retrieved 2023-01-21. https://www.csselectronics.com/pages/can-fd-flexible-data-rate-intro.</ref> | CAN FD (Flexible Data-rate) is an extension of the CAN 2.0 protocol. It can dynamically switch between different data rates and longer or shorter messages, resulting in faster data speeds and higher data capacity.<ref>Falch, Martin. "CAN FD Explained - A Simple Intro [2022] - CSS Electronics". Retrieved 2023-01-21. https://www.csselectronics.com/pages/can-fd-flexible-data-rate-intro.</ref> | ||
| Line 29: | Line 116: | ||
===J1939=== | ===J1939=== | ||
===CANopen=== | ===CANopen=== | ||
| − | |||
==References== | ==References== | ||
Revision as of 20:58, 21 June 2023
CAN bus is a Communication Protocol and networking standard designed for communicating between devices in vehicles. Because of its versatility and relatively low complexity, it is used in the vast majority of vehicles manufactured today. By letting multiple devices communicate with each-other through a common interface, wiring harness complexity can be reduced.
Computer networks can be thought of as having layers. CAN bus has 3 main layers:
- the physical layer, which contains electrical specifications (cable impedance, voltage levels, etc.)
- the data link layer, which specifies bit timing, message framing, error detection, etc.
- the application layer, which specifies things like which identifier to use for what data.
Contents
CAN bus physical layer
At the physical layer, there are two types of CAN networks: low–speed CAN and high–speed CAN.
High–Speed CAN
High–speed CAN (ISO 11898-2) is probably the most common version of CAN. It can support speeds up to 1 Mb/s, and uses a linear bus. High–speed CAN does not work when hooked up as a star network, as star networks can lead to strange behavior at higher frequencies. The stubs coming off of the linear bus should be kept as short as possible. If you are designing a custom PCB that uses CAN, you can do this branching on the PCB instead of in the wiring harness. A 120 ohm termination resistor is required at either end of the bus, i.e. the DC resistance measurement between the 2 CAN wires should be 60 ohms when hooked up properly. The cable should theoretically have an impedance between 108 and 132 Ohms at the bus frequency, but in practice this isn't necessary and most cable will work just fine.[1]
Low–Speed CAN
Low-speed CAN (ISO 11898-3) is limited to a speed of 125 Kb/s, but it is more flexible in its routing. It can be connected as a star bus with no issues, and each device on the network has two termination resistors. Their value can be calculated based on the method described on page 4-10 of this document from National Instruments: [1].
Because of its low speed it is not often used in the automotive world, but if you don't have a lot of data to send it could be useful.
CAN bus data link layer
The CAN 2.0 protocol is specified in ISO 11898-1. It is split into CAN 2.0A and CAN 2.0B, the original 11 bit identifier version and the extended 29 bit identifier version.
CAN 2.0A
CAN 2.0A is effectively the same as CAN 1.0 and 1.2. It uses 11 bit identifiers, so a maximum of 2048 devices can transmit on a network. If a device says it supports CAN, it supports this.
| Field name |
Length (bits) |
Purpose |
CAN 2.0B
CAN 2.0B builds on CAN 2.0A by allowing 29 bit identifiers.
| Field name |
Length (bits) |
Purpose |
CAN FD
CAN FD (Flexible Data-rate) is an extension of the CAN 2.0 protocol. It can dynamically switch between different data rates and longer or shorter messages, resulting in faster data speeds and higher data capacity.[2]
CAN bus application layer
J1939
CANopen
References
- ↑ "CAN Physical Layers - Kvaser". Retrieved 2023-01-21. https://www.kvaser.com/lesson/can-physical-layers/.
- ↑ Falch, Martin. "CAN FD Explained - A Simple Intro [2022] - CSS Electronics". Retrieved 2023-01-21. https://www.csselectronics.com/pages/can-fd-flexible-data-rate-intro.