Vehicle On-board Diagnostic

It is probably has happened for many of us, you are driving along in your car and the "Check Engine” yellow light illuminates on the dashboard as clear indication that is something wrong with your car. Unfortunately, it does not give any clue what might be the nature of the problem and can mean many different things, from a loose gas cap to catalytic converter fault. I do remember back to year 94 Acura Integra used to have the control unit under the driver seat and the LED was flashing if something was wrong. Counting the number of blinks during repeated intervals, you can get the error code. As vehicle computers are getting more and more sophisticated the number of possible error codes increases exponentially.

 

OBD-II

If your car manufactured for sale in the U.S. after 1996, it is equipped with on-board diagnostics (OBD-II) and has OBD connector somewhere in the passenger compartment. The OBD-II connector enables a scan tool to read diagnostic data from the engine computer. By law, the OBD diagnostic should supply a number of key parameters relating to the on-board monitoring of emissions from vehicles, including data such as engine speed, coolant temperature, and oxygen sensor readings. EOBD is a version of OBD-II required in Europe starting year 2004 for diesel vehicles and 2001 for gasoline vehicles. The table below shows the kinds of real-time data that you can read from your car's engine computer using OBD-II Mode 0x01 PIDs. This is a small subset of the data that is available from your vehicle's OBD-II bus.

PID Functions PID Functions
00 PIDs supported in range 01-1F 20 Supported PIDs in range 21-3F
01 System status since DTC cleared 21 Distance Traveled While MIL is Activated
02 DTC that cause freeze frame 22 Fuel Rail Pressure relative to manifold vacuum
03 Fuel System 1 Status 23 Fuel Rail Pressure
04 Calculated LOAD Value 2C Commanded EGR
05 Engine Coolant Temperature 2D EGR Error value
06 Short Term Fuel Trim - Bank 1 2E Commanded Evaporative Purge
07 Long Term Fuel Trim - Bank 1 2F Fuel Level Input
08 Short Term Fuel Trim - Bank 2 30 Number of warm-ups since DTC cleared
09 Long Term Fuel Trim - Bank 2 31 Distance Since DTC cleared
0A Fuel Rail Pressure 32 Evap System Vapor Pressure
0B Intake Manifold Pressure 33 Barometric Pressure
0C Engine RPM 40 Supported PIDs in range 41-5F
0D Vehicle Speed 41 Monitor status this driving cycle
0E Ignition Timing Advance for #1 Cylinder 42 Control module voltage
0F Air Intake Temperature 43 Absolute Load Value
10 Air Flow Rate from MAF 44 Commanded Equivalence Ratio
11 Absolute Throttle Position 45 Relative Throttle Position
13 Location of O2 sensors 46 Ambient air temperature
1C OBD requirements to which vehicle is designed 4C Commanded Throttle Actuator Control
1D Location of oxygen sensors 4D Minutes run by the engine while MIL activated
1F Time Since Engine Start 4E Time since DTC cleared

 

The Data Link Connector (DLC) for connecting the diagnostic equipment  is standard as well. The pinout of DLC connector is shown below as defined by SAE J1962 spec.

Pin Definition
1 Not defined
2 Bus positive line of SAE J1850
3 Not defined
4 Chassis ground
5 Signal ground
6 CAN(H) ISO 15765
7 K line ISO 9141/14230
8 Not defined
9 Not defined
10 Bus negative line of SAE J1850
11 Not defined
12 Not defined
13 Not defined
14 CAN(L) ISO 15765
15 L line ISO 9141/14230
16 +12 volt battery
 

 

The OBD-II standard, ISO 15031-5/SAE J1979 provides five distinct electrical interfaces:

  • SAE J1850 VPW
  • SAE J1850 PWM
  • ISO 9141-2
  • ISO 14230-2 KWP2000
  • ISO 15765-4 CAN

All cars manufactured after year 2008 should use only CAN (ISO 15765-4) protocol. However, that is rather wishful thinking as some manufactured were using the legacy OBD protocols even after year 2008. Tables below show the protocols that used for OBD services.

Applicability OSI 7 layers Emissions-related OBD communication requirements
Seven layers
according to
ISO/IEC 7498-1
and 
ISO/IEC 10731
Application
(layer 7)
ISO 15031-5/SAE J1979
Presentation
(layer 6)
ISO 15031-2, ISO 15031-5, ISO 15031-6
SAE J1930-DA, SAE J1979-DA, SAE J2012-DA
Session
(layer 5)
Not applicable ISO 14229-2
Transport
(layer 4)
ISO 15031-5 ISO 14230-4 ISO 15765-2 ISO 15765-4
Network
(layer 3)
Data link
(layer 2)
SAE J1850 ISO 9141-2 ISO 14230-2 ISO 11898-1,
ISO 11898-2
Physical
(layer 1)
ISO 14230-1

The IP-based diagnostic standard ISO 13400-3 was introduced as part of Worldwide Harmonized Vehicle Diagnostic WWH-OBD, a United Nation initiative

 

ISO 9141-2

ISO 9141-2 was the most used protocol by vehicle manufactures before the introduction of CAN. The original ISO document goes back to year 1994 with bidirectional serial communication on a single wire called the K-line. In addition, there is an optional L-line for connection initialization. The communication started by sending the distinct signal pattern on K-line and L-line and the all communication is performed over K-line. According to the specification, the L-line is only used to initiate the communication and remains inactive (high-level) afterward, seldom being used for diagnostic purposes. The maximum data length is limited to 255 bytes.

 

ISO 14230-2

The ISO 14230-2 protocol is similar to ISO 9141-2, with the initialization mechanism can use either slow signal pattern 5 bit/s like ISO9141 or fast init (short 50us pulse).

 

SAE J1850

It is a Class B Data Communication Network Interface employs media access layer (MAC) based on priority. The J1850 bus takes two forms, 41.6Kbps Pulse Width Modulated (PWM) two wires differential approach, or a 10.4Kbps Variable Pulse Width (VPW) single wire approach. The PWM flavor was used in Ford vehicles when VPW attributed to Chrysler/GM. Both variants are CSMA/CR protocols with collisions handled by arbitration. This contention bus is inherited from an open architecture that lets node be added or removed from a network without much impact on the rest of the system, which is called non-destructive contention resolution. The latest protocol revision, SAE J1850_201510 includes High Speed Mode (83.3 Kbps) for PWM as well as 4x Speed Mode (41.6 Kbps) and Block Mode (unlimited data length) for VPW.

 

ISO 15765-4

The Controller Area Network (CAN) was introduced by Bosch at the SAE Congress in Detroit In February 1996. It based on a non-destructive arbitration mechanism, which grants bus access to the message with the highest priority without any delays. There was no central bus master. The CAN standard is capable of sending data frames containing between 1 and 8 bytes of data. The standard defines a method for segmenting data consisting of up to 4095 bytes and 4 different types of frames: SingleFrame, FirstFrame, ConsecutiveFrame and FlowControl. The type of frame encoded in the first 4 bits (the high nibble) of the first data byte in each frame. Each frame contains Protocol Control Information (PCI) data.

Frame Type PCI bytes
Byte #1 Byte #2 Byte #3
Bits 7-4 Bits 3-0
Single Frame 0 Data Length    
First Frame 1 Data Length  
Consecutive Frame 2 Sequence Number    
Flow Control 3 Flow Status Block Size Separation Time

 

Physical Layer

CAN physical layer implementation is using UTP copper cabling. The two wires designated as CAN-H for CAN High, and CAN-L for CAN Low, and the signals on the twisted pair cables are driven differentially with a nominal voltage of 2.5V when measured from node ground. A dominant state is indicated by the CAN-H voltage moving up by a nominal value of 1V and CAN-L moving down by a nominal value of 1V making the differential signal 2V.

Frame Format

With CAN, each node has the freedom to attempt to transmit a frame whenever the bus is idle for greater than or equal to 11-bit times. For this reason, sometimes CAN is referred to as a multi-master bus system. Other than special cases such as diagnostic communications, most data transmitted is cyclic in nature. This is the standard 2.0A frame format, which has an 11-bit Arbitration ID. There is also CAN 2.0B format, sometimes called the extended frame format, which is used in SAE's I1939; it has a 29-bit Arbitration ID field. Figure below shows the standard CAN 2.0A frame format.

SOF

The Start of Frame is a single dominant bit that is transmitted by one or more nodes intending to send a frame. It signals the beginning of a frame (or arbitration for the right to send a frame) and is used to "hard synchronize" devices on the bus. A transmitter is allowed to start a frame only if there have been at least 11 consecutive bits of recessive states on the bus prior to initiation.

Arbitration

The arbitration field consists of 12 bits, where the first all are referred to as the Arbitration ID. One of this field's primary functions is to implement CAN's media access control mechanism, but it has another use as well. As many automotive network engineers are aware, CAN has a frame-based structure where the Arbitration ID not only determines the priority of a message—zero being the highest priority but also generally identifies the payload of the frame as well.

Control

The control field for a standard 11-bit frame consists of a dominant IDE flag—which is recessive in the case of an extended frame (29 bit ID field) - a reserved bit and a 4-bit Data field. The Data field determines the length of data in the Data or payload section of the frame. For ISO11898-1 any value is allowable in the 4 bit field but any value of 8 or greater means a data payload length of 8. In the newer CAN -FD specification, values greater than 8 mean the data payload is larger than 8, up to a maximum of 64 bytes.

Data

The Data field carries the data payload of the message and can be anywhere from 0 to 8 bytes for ISO11898 CAN.

CRC

The Cyclical Redundancy Check field is 16 bits long for an ISO11898 frame, consisting of a 15-bit CRC value and a single recessive CRC delimiter bit. The transmitter of a frame calculates this value based on an efficient algorithm given in the specification and transmits the calculated value in this field. All receivers compare their own calculation of this value with the one transmitted. If there is a mismatch or other error by any receiver, the next field, Ack, comes into play.

Ack

The Acknowledge Field is used for all receivers on the bus to signal to the transmitter that the CRC matched, and the entire frame was received correctly. If any node correctly receives the frame without an error, this bit is set to dominant by transmitter, signifying that it transmitted the message correctly. If a receiver detects a problem, it will overwrite the Ack bit with an error frame informing all participants of the problem.

End of Frame

A succession of seven recessive bits indicate the end of a frame.

CAN-FD

CAN with Flexible Data Rate (CAN-FD) is the latest variant of CAN. In CAN 2.0 the maximum achievable bit rate is 1 Mbps, a limit that is largely imposed by the arbitration method. Because arbitration is not needed during the transmission of other parts of a frame, it is possible to increase the bit rate during the control, payload and CRC sections. CAN-FD maintains the 1 Mbps speed during arbitration, and then sends these other parts of the frame at up to 8 Mbps. Another limitation of original CAN is its 8-byte frame size, which is not adequate for modern networks. Bosch reformulated the CRC calculation so that the payload can increase from 8 bytes to 64 while maintaining CAN 2.0's error detection robustness.

ISO 13400-3

The ISO 13400-3 - diagnostic communication over Internet Protocol (DoIP). Note, that standart is not part of OBD (ISO 15031-5/SAE J1979) but WWH-OBD. The intent of ISO 13400 is to describe a standardized vehicle interface which:

  • Separates in-vehicle network technology from the external test equipment
  • Utilizes existing industry standards to define a long-term stable state-of-the-art communication standard usable for legislated diagnostic communication as well as for manufacturer-specific use cases
  • Can easily be adapted to new Physical and Data Link Layers, including wired and wireless connections, by using existing adaptation layers.

To achieve this goals, the standard is based on the Open Systems Interconnection (OSI) Basic Reference Model specified in ISO/IEC 7498-1 and ISO/IEC 10731, which structures communication systems into seven layers. When mapped on this model, the services specified by ISO 14229-1, ISO 14229-2 and ISO 14229-5 are divided into

  • Unified diagnostic services (layer 7), specified in ISO 14229-1, ISO 14229-5, ISO 27145-3
  • Presentation (layer 6)
  • Enhanced diagnostics, specified by the vehicle manufacturer and WWH-OBD according to ISO 27145-2, SAE J1930-DA, SAE J1979-DA, SAE J2012-DA
  • Session layer services (layer 5), specified in ISO 14229-2
  • Transport protocol (layer 4), specified in ISO 13400-2
  • Network layer (layer 3) services, specified in ISO 13400-2
  • Physical and data link services (layers 1 and 2), specified in this part of ISO 13400
Applicability OSI seven layers Vehicle manufacturer enhanced diagnostics WWH-OBD reference
Seven layers according to
ISO/IEC 7498-1
and
ISO/IEC 10731
Application (layer 7) ISO 14229-1/ISO 14229-5 ISO 14229-1/ISO 27145-3
Presentation (layer 6) Vehicle manufacturer specific ISO 27145-2, SAE J1930-DA, SAE J1939, Appendix C (SPNs), SAE J1939-73, SAE J1979-DA, SAE J2012-DA
Session (layer 5) ISO 14229-2 ISO 14229-2
Transport (layer 4) ISO 13400-2 ISO 13400-2
Network (layer 3)
Data link (layer 2) ISO 13400-3 ISO 13400-3
Physical (layer 1)

 

ISO 14229 – Unified diagnostic services (UDS)

The ISO 14229 standard defines the actual diagnostic services used in automotive ECUs. These services can be used to upload and download software and data to the ECU, read and erase the fault codes and etc. Note, that the standard does not depend on a specific type of data link, but rather rely on application layer protocol functionality to send and receive the data. In reality, the underlying communication protocol imposes the actual limitation on the maximum data length. The ISO14229 standard consists of the following parts:

Part 1 and 2 specifies the data-link independent requirements for the diagnostic services and the session handling, respectively. Part 3 through 7 specifies requirements for the data-link specific implementation of the ISO14229 standard.

Applicability OSI seven layers Emissions-related OBD communication requirements
Seven layers according to ISO/IEC 7498-1and 
ISO/IEC 10731
Application (layer 7) ISO 15031-5
Presentation (layer 6) ISO 15031-2, SAE J1930-DA
ISO 15031-5, SAE J1979-DA
ISO 15031-6, SAE J2012-DA (OBD)
Session (layer 5) ISO 14229-2 Not applicable ISO 14229-2
Transport (layer 4) ISO 15765-2 ISO 15765-4 ISO 15031-5 ISO 14230-4
Network (layer 3)
Data link (layer 2) ISO 11898-1,
ISO 11898-2
SAE J1850 ISO 9141-2 ISO 14230-2
Physical (layer 1) ISO 14230-1