In part 1 of How OBD-II Vehicle Diagnostics Work we quickly went over some history of electronics in cars and why you should care about OBD-II, even if you’re not an automotive buff.
Then, we went over some OBD-II basics and touched on the 4 “sub-standards” of the OBD-II main standard.
You learned about passive and active states and we went over OBD-II data packet structure before dissecting a typical OBD-II data packet.
The post finished with a quick overview of diagnostic trouble code (DTC) structure and my promise to take a closer look at each of the four OBD-II standards in part 2 of the series.
I’m a man of my word, so here it is. Let’s get a closer look at each standard. That way if you do decide to embark on an automotive related project, you’ll be well prepared.
OBD-II Standards
As a quick recap, here is a list of the four standards:
- ISO 9141-2
- SAE J1850 variable pulse width (VPW)
- SAE J1850 pulse width modulation (PWM)
- The newer CAN standard (ISO 15765)
I’ve also included the diagram of an OBD-II port and pinout (figure 1) from part 1 of the series as a reference.
Figure 1: OBD-II connector and pinout.
Let’s dive right on in.
OBD-II ISO 9141-2
This one is popular with Chrysler, European, and many Asian vehicles. It uses pins 7 and 15 on the connector.
This standard uses an asynchronous serial format running at 10,400 bps, like a UART.
The voltage level ranges from 0 V to 12 V with 12 V being the passive state and 0 V the active state.
Each byte begins with an active start bit. Next come 8 data bits. There is no parity and a stop bit comes last.
Communication mainly takes place on pin 7 (a.k.a. the “K” line). Pin 15 (a.k.a. the “L” line) is optional. Pin 15, if used, serves a unidirectional wake up signal to the engine control unit (ECU). Message data can be up to 12 bytes per command.
Note that the term ECU can refer to a single module or a collection of modules. They are the brains of the vehicle which monitor and control many functions of the car. Common types of ECUs include the ECM (engine control module), the TCM (transmission control module) and there are others.
An alternate, yet similar protocol to ISO 9141-2 is ISO 14230-4 KWP2000. Basically, the format is the same, only the messages can contain up to 255 bytes. This one is common in US vehicles made after 2003, but before 2008.
The ECU will go to sleep if it receives no communications in a 5 second period. Therefore, communications usually will begin with a wake up.
Become the Maker you were born to be. Try Arduino Academy for FREE!
ISO 9141-2 uses a slow initialization, while ISO 14230-4 uses a fast initialization (another small difference).
For a slow initialization, you need to send a 0x33 (as your data byte) at 5 bps to the ECU. The ECU then does a sort of “handshake” and things begin.
The fast initialization process for ISO 14230-4 only takes about 500 ms.
OBD-II SAE J1850 VPW
You’ll often find this standard in pre-2008 General Motors vehicles.
This single-wire protocol uses pin 2 and runs at about 10 Kb/s. The bus may have a length up to 35 meters with 32 nodes.
Variable pulse width (VPW) modulation uses 2-bit symbols, a 64 µs wide pulse and a 128 µs wide pulse. The signal level varies between 0 V (passive) and 7 or 8 V (active). Each packet it sends begins with a 200 µs start-of-frame (SOF) pulse, then comes the header. Following the header are the data bits.
A symbol is a concept that can be used to encode multiple bits or just one bit. It is a waveform, a state or some significant condition of the communication channel that lasts for a fixed amount of time.
The maximum number of data bytes the protocol allows in a normal message is 12, which transmits the most significant bit (MSB) first. Once all the data transmits, a cyclic redundancy check (CRC) byte is calculated and appended to the message.
When the message is received by the receiving node, it shifts the header, data, and CRC bytes through some CRC circuitry. The circuitry performs a calculation that should produce 0xC4. If it doesn’t, the receiving node flags the sender letting it know there is an error.
Only two pulse widths are used when encoding data, either a short (64μs) or a long (128μs).
There is a change in polarity for each bit symbol. The first bit is always passive since the SOF is always active. A 64 µs passive pulse is a 0 and a 128 µs passive pulse is a 1. Once the first symbol’s pulse ends, the bit symbols reverse with a 64 µs active pulse being a 1 and a 128 µs active pulse being a 0.
Since there is always a transition between states as each bit of a message is transmits, a series of high, low, high, low, etc. pulses compose the message. Logic 0s and 1s are uniquely encoded into both the active and passive states by varying the width of the pulse.
Yep, it’s sort of confusing. Figure 2 may help shed some light on it.
Figure 2: SAE J1850 VPW logic 0 and logic 1.
Like ISO 9141-2, J1850 VPW runs at 10,400 bps. Note that you can add or remove nodes easily without affecting other nodes.
While the timing for SAE J1850 VPW isn’t very strict, the standard assumes that all the nodes on the bus are using the exact same ground. If the nodes are at different ground levels errors can result. Keep this in mind when working with this standard.
For arbitration, an active state always dominates over a passive, or a zero always dominates over a one. Because of this, whichever message has a lower value in the header information wins arbitration. If two or more nodes are arbitrating with the same header information, then arbitration continues through every byte of the message until one node wins.
Finally, the SAE J1850 VPW protocol doesn’t require any sort of wake-up signal like the previous one did.
OBD-II SAE J1850 PWM
This version of SAE J1850 is popular in pre-2008 Ford vehicles.
The data rate is fixed and 10,400 bps like ISO 9141-2. The average throughput is about the same as the VPW version. The PWM version also has a 4x mode where the data rate bumps up to 41,600 bps. Like the previous version, PWM doesn’t require any special wake-up or stay-up signal.
This protocol also uses a SOF with an active pulse whose duration is twice that of the data bit time followed by a short passive pause.
Data bit times are 96 µs (or 24 µs for the 4x mode) and each one begins in an active state. It uses a fixed frequency PWM pulse for each bit of data with a one-third (either 32 µs or 8 µs for 4x mode) active PWM being a 1 and a two-thirds (either 64 µs or 16 µs for 4x mode) active PWM as a 0.
PWM uses an acknowledge (ACK) for each packet that transmits between the source and destination.
Message length is restricted to 12 bytes, including the CRC. The header is 3 bytes.
The data packet structure and arbitration scheme are the same as those for SAE J1850 VPW.
To be more immune to noise, the output signal of SAE J1850 PWM transmits differentially on pin 2 (B+) and pin 10 (B-) of the OBD-II connector. Note that “B” stands for bus, not battery.
Differential signals use two complementary voltages in order to transmit one signal. The receiver extracts information by detecting the potential difference between the inverted and non-inverted signals. Figure 3 depicts this.
The B+ line has an active state of 5 V while the B- line has an active state of 0 V. It is the opposite for the passive state (B+ at 0 V and B- at 5 V).
Figure 3: the bottom trace shows a differential signal, the top shows a normal “single-ended” signal.
ISO 15765 Controller Area Network (CAN)
All vehicles sold in the U.S. since January 1st, 2008 are required to use this protocol. If you have a European vehicle from 2003 or later, the vehicle may have CAN. Some pre-2003 vehicles may even use it, as it’s been around since the 1980s.
There are many articles and resources that relate to CAN and one can write a lot about it, so obviously part of a single blog post can’t cover everything.
The post You CAN Do It: A CAN Networking Tutorial for Beginners is a nice introduction to the protocol. I suggest reading it before going any further.
While CAN can operate at up to 1 Mbps, the version specified for OBD-II runs at 250 or 500 kbps. CAN addressing supports two modes: an 11-bit mode and a 29-bit extended mode. Given the two speeds and two addressing schemes, there are four different flavors of CAN that apply to the automotive sector.
To help keep things in sync, CAN uses bit stuffing. Bit stuffing is the procedure of adding an opposite state bit whenever the data state remains the same for five consecutive bit times. On the receiving end, the next bit automatically gets tossed once the receiver gets five consecutive bits of the same state.
Like SAE J1850 PWM, CAN uses differential signals to transmit data on 2 wires CAN high (CANH) and CAN low (CANL). Pin 6 of the OBD-II connector is the CANH line and pin 14 is CANL. The CANH line uses an active state of 3.5 V – 5 V and the CANL line uses an active state of 0 V – 2 V. The passive state of both the lines is 2.5 V.
CAN communications use non-return-to-zero (NRZ) for coding and decoding bits.
The idle state of the CAN bus is a logic 1, so a logic 0 bit of 4 µs (for 250 kbps) or 2 µs (for 500 kbps) indicates an SOF. The data bits follow using the same timing.
Figure 4 depicts a typical CAN data frame. The frame is similar to the other protocols. The exception is that the header can use either an 11-bit format which is standard, or a 29-bit extended format.
Figure 4: a typical CAN data frame.
The RTR, IDE, r0, and DLC parts make up a byte and together are sometimes called the PCI byte. This byte is simply formatting information for the data bytes that follow. This is another small difference. The You CAN Do It article explains these bits in a bit more detail (pardon the pun). The article also goes over CAN bus arbitration.
Working With OBD-II
For those who have the interest, I’d like to give you some information on how to actually work with the OBD-II system in a vehicle before we wrap things up.
ELM Electronics makes several preprogrammed chips that will enable you to easily interface with your vehicle’s OBD-II system. In fact, ELM has become the standard in this area, and you’ll find their chips inside many of the scan tools that mechanics use.
Some of you may find it inconvenient to sit in your car with a laptop and soldering iron, so if you’d like to experiment with OBD-II there are a few options.
You could buy an old ECU from a junk yard and take it to your bench. ScanTool.net makes the ECUsim 2000 (and other items relating to OBD-II) which is a small simulator. The catch is that you must pick one protocol and the price currently starts at $200, which may be out of reach for some people. Additional protocols are available at an additional cost.
The ECUsim 2000 simulates a vehicle with three ECUs, an ECM, a TCM, and an antilock braking module (ABS). This enables you to experiment with OBD-II at your bench without tethering you to the vehicle.
Whatever you choose to do with OBD-II, just be careful and make sure everything is right before implementing it in your own vehicle. And don’t forget to have some fun and learn something!
Until next time, which OBD-II protocol does your vehicle use? Comment and let us know.
Leave a Reply