CAN Message Overview

Notation

There are many forms of notation for defining the position of data in a message.

Dash Design considers each data byte in a message to have the most significant bit on the left and the least significant bit on the right.

The bit layout of a CAN frame is as follows:

CAN Message Bit Numbering CAN Message Bit Numbering

CAN Message Bit Numbering

The CAN Message Layout view shows a visual representation of the layout of signals within a CAN message, which greatly simplifies the process of positioning signals.

Signals are extracted into data channels from CAN messages by specifying the start bit and bit-length of the data. The Start bit is specified as the least significant bit (lsb) of the least significant byte (LSB). For example, Byte 0 has a start bit of 0 and a length of 8. Byte 1 has a start bit of 8 and a length of 8 and so on. The least significant bit of a signal becomes the least significant bit in the extracted data channel.

Signal bit offsets need not be aligned to byte boundaries and can consist of less than 8 bits.

Byte Order (Endian) and Multi-byte data

When dealing with multi-byte data, there are two common ways of representing numbers:

  1. Little Endian (Intel) Format - The least significant byte occurs first.
  2. Big Endian (Motorola) Format - The most significant byte occurs first.

Because the start bit is specified as the least significant bit of the least significant byte, the byte order (endian) of the data affects the start bit. Consider a 16 bit number occupying the first two bytes of a message. In both cases, the length is 16 bits.

In Little Endian mode, the start bit is 0:

Little Endian Signal Layout Little Endian Signal Layout

Little Endian Signal Layout

In Big Endian mode, the start bit is 8:

Big Endian Signal Layout Big Endian Signal Layout

Big Endian Signal Layout

Note that lsb signifies Least Significant Bit and msb signifies Most Significant Bit. The arrow shows the direction from least significant data to most significant data.

Multiplexed CAN Data

Some ECUs send data in a multiplexed format. In this format, part of the message (often the first byte) is defined as the multiplexor. The other bytes in the message have different meanings depending on the value of the multiplexor.

For example, if the multiplexor is 0, Byte 1 could contain the current state of output 0 on a power management unit. If the multiplexor is 1, Byte 1 could contain the current state of output 1 and so on. In this way, ECUs that require transferring many parameters at a slow rate can do so with fewer message IDs, making it easier to manage the message IDs in the system as a whole.

Example Start Bits and Lengths for Common Data Types

The following table lists the start bit and length values for many common, byte aligned, data types and can be used a quick reference to simplify creating CAN setups.

The number following the value type indicates the position of the data within the 8 byte payload aligned to the size of the value type. For example, Byte 0 is on byte 0, Byte 1 on byte 1, Int16 0 is on bytes 0 & 1, Int16 1 is on bytes 2 & 3 etc.

The Byte order specifies LE for little endian and BE for big endian for multi-byte types.

Value Type Byte Order Start Bit Length Description
Byte 0 - 0 8 Byte 1
Byte 1 - 8 8 Byte 2
Byte 2 - 16 8 Byte 3
Byte 3 - 24 8 Byte 4
Byte 4 - 32 8 Byte 5
Byte 5 - 40 8 Byte 6
Byte 6 - 48 8 Byte 7
Byte 7 - 56 8 Byte 8
Int16 0 BE 8 16 Word 1 Big Endian
Int16 1 BE 24 16 Word 2 Big Endian
Int16 2 BE 40 16 Word 3 Big Endian
Int16 3 BE 56 16 Word 4 Big Endian
Int16 0 LE 0 16 Word 1 Little Endian
Int16 1 LE 16 16 Word 2 Little Endian
Int16 2 LE 32 16 Word 3 Little Endian
Int16 3 LE 48 16 Word 4 Little Endian
Int32 0 BE 24 32 Int 32, Byte 1 Big Endian
Int32 1 BE 56 32 Int 32, Byte 5 Big Endian
Int32 0 LE 0 32 Int 32, Byte 1 Little Endian
Int32 1 LE 32 32 Int 32, Byte 5 Little Endian
Int64 BE 56 64 Int 64 Big Endian
Int64 LE 0 64 Int 64 Little Endian
Float 0 BE 24 32 Float, Byte 1 Big Endian
Float 1 BE 56 32 Float, Byte 5 Big Endian
Float 0 LE 0 32 Float, Byte 1 Little Endian
Float 1 LE 32 32 Float, Byte 5 Little Endian
Double BE 56 64 Double Big Endian
Double LE 0 64 Double Little Endian