Introduction to SAE J1708
J1708 is an SAE specification developed especially for heavy duty vehicles (trucks and busses). The intention is that the protocol will promote a standard for serial communication between modules with microcontrollers. The standard means that data can be transferred between devices in a more cost-effective way. Further advantages are:
- Minimizes the hardware cost.
- Offers flexibility and the possibility of further expansion of an existing system.
- Uses standard industry electronics which gives more options when developing.
Areas of use
Since J1708 protocol only describes the lower layers of the OSI model it is always used with an overlaying application layer. An example of such a layer is J1587 which is used for data exchange between microcontrollers in heavy duty vehicles.
- Describes the physical and data link layer according to OSI model.
- Almost always used in conjunction with the application layer protocol SAE J1587.
- Based on electronic properties from the RS-485 bus.
- Twisted pair wire with a maximum length of 40m.
- The network is based on a bus topology.
- Serial byte-oriented communication with least significant byte first.
- Transmission rate 9600 bps.
- A message contains of
- a one byte long MID (Message Identification),
- followed by a number of data bytes,
- and finally a checksum.
- A message can be up to 21 bytes long.
- Error detection and handling at collision of message transmission.
The Protocol In Detail
The protocol describes both physical properties like how the voltage level on the bus should be interpreted, and how messages are constructed.
J1708 protocol uses the same transceiver as RS-485. The bus network supports at least 20 nodes with these transceivers. J1708 does not use the bus termination resistors used by RS-485.
An RS-485 transceiver. (Picture borrowed from the J1708 spec)
Note that this transceiver is, basically, the same as is used for the CAN bus.
The J1708 bus consists of two wires (A and B) with at least one twist (360°) per inch (2.54 cm) and a total length of up to 40 m. The voltage level on the bus is determined by the difference in voltage potential between wires “A” and “B”. A logical high level (1) is achieved when point A is at least 200 mV more positive than point B. A logical low level (0) means that point A is at least 200 mV more negative than point B (See the following figure). The transceiver should be fed with +6V to (-6V) in relation to common ground (common for all devices).
Determination of the logic bus-level.
The bus is in a logical high level when it is in idle mode, if all transmitters are deactivated or when all transmitters is sending a logical high bit (1). To place the bus in a logical low state only one transmitter has to send a logical low bit (0), which makes the logical low bit dominant.
Communication On Bit-Level
A J1708 network uses a bus topology with “random” access to the bus. Random access means that any node can transmit when it desires, unless the bus is not already busy. The bus must have been in idle mode (logical high level) for at least a bus access time before a node may access it.
The time counting is based on the bit time which, at 9600 bps, is about 104.2 microseconds. Every message has a priority between 1 and 8, where 1 has highest priority. A bus access time is determined as the shortest idle time (at least 10 bit times) plus two times the priority of the message.
If two messages is sent at exactly the same time a collision occurs on the bus. When this happens both sending nodes have to release control of the bus, i.e. deactivate their transmitters. Both nodes then have to wait for a bus access time before they can start sending again. Consequently the node with highest priority will gain access to the bus first and can start to transmit its message.
The anatomy of a J1708 message
The messages are byte-oriented, that is to say constructed of a number of bytes. Every byte consists of a start bit eight data bits and a stop bit. The start bit is of logical low level and the stop bit is a logical high level. The eight data bits are sent with the least significant bit first.
This follows a standard serial UART (Universal Asynchronous Receiver/Transmitter) communication.
A message consists of a MID (Message Identification Character), data bytes, and finally a one byte long checksum. The content of the data part is not described in J1708 specification but in an overlaying protocol, for example J1587. A message is always preceded by an idle time which is at least the shortest bus access time. The time between two bytes in a message is not allowed to be more than two bit times.
|MID||Data 1||Data 2||Data 3||Data 4||Checksum|
A J1708 message.
The first byte in every message must always be a MID. Valid values of the MID is 0-255.
- MIDs 0-68 belong to predefined devices to ensure consistency.
- MIDs 69-86 are set aside for J1922 protocol.
- MIDs 87-110 are reserved for future applications. Manufactures may apply to SAE Truck and Bus Electrical Committee to define a MID.
- MID 111 is designated for factory tests of electronic control units and shall not be used by any on-board unit.
- MIDs 112-127 are not reserved and can be used as wanted.
- MIDs 128-255 are reserved for the SAE J1587 protocol, where they are defined.
- It is every manufacturers responsibility that each MID is used only by one device in every network system.
The J1708 standard lists all MIDs and their areas of use.
Calculation of Checksum
bytes in the message. A simple way to decide if a message has been correctly transmitted is to add the checksum to the 8-bit sum of all data bytes plus the MID of a received message. The 8-bit sum should be zero (0) if the message was transmitted correctly.
As an example (using the sample message in the figure above),
- 44+23+61+114+62+208 = 512
- (512 AND 0xFF) = 0, so the message is correct.