Introduction to SAE J2534

Summary

J2534 is a concept that enables flash programming of an emission related ECU regardless of the communication protocol that is used by the ECU. The purpose is that only one tool (hardware device), often referred to as the pass-thru device, should be needed for all kind of ECUs. The connection between the J2534 device and the ECU is a SAE J1962 connector. The J2534 hardware device is to be connected to a standard PC which holds the Application Program Interface (API) from the vehicle manufacturer (Figure 1). The connection between the PC and the J2534 hardware device is up to the manufacturer of the tool, but USB is probably the most common. A J2534 API DLL is provided from the hardware tool developer which handles the communication to the PC. The J2534 document withholds requirements for the hardware and software of a J2534 tool. The communication protocols supported are; ISO9141, ISO14230 (KWP2000), J1850, CAN (ISO11898), ISO15765 and SAE J2610. In 2005 J1939 was also included.

fig1-j2534-setup1

Figure 1. J2534 setup.

NEW! Developer Blog Series on J2534

This 3-part blog series introduces SAE J2534 (including it’s multiple editions), describes how to use the 2004 API, and then provides instruction on getting started with Kvaser and J2534.

SAE J2534 (Part I): An Introduction | READ MORE …

SAE J2534 (Part II): Using the 2004 API | READ MORE …

SAE J2534 (Part III): Getting Started with Kvaser and SAE J2534READ MORE …

Background

Vehicles become more and more complex and almost every function is controlled by an Electronic Control Unit (ECU). The ECUs are often connected onto a communication bus to be able to share data between each other. The most common protocol is CAN, but there are other protocols. There are many Vehicle manufactures and almost as many different communication protocols. Every vehicle manufacturer has a tool for analyzing and reprogramming their product, and this tool is often expensive. This makes it difficult for a car, bus or truck workshop to analyze and repair all kind of vehicles.

U.S. Environmental Protection Agency (EPA) and the California Air Resources Board (ARB) have been trying to get vehicle manufactures to support common emission-related services for the aftermarket. The Society of Automotive Engineers (SAE) created the J2534 standard, in 2002, to promote the EPA and ARB in their work.

Hardware Requirements

The J2534 hardware works like a gateway between the vehicle ECU and the PC. This pass-thru device translates messages sent from the PC into messages of the protocol being used in the vehicle ECU. J2534 supports the following protocols:

The connection between the PC and the J2534 hardware can freely chosen by the manufacturer of the device i.e. RS-232, USB or maybe a wireless interface. The vehicle manufacturers programming application is not dependant on the hardware connection. Therefore any device can be used for programming any vehicle regardless of the manufacturer.

The connection between the J2534 hardware and the vehicle should be the SAE J1962 connector (Fig 2), also called the OBDII connector. The maximum length of the cable between the J2534 device and the vehicle is 5 meters. If the vehicle manufacturer doesn’t use the J1962 connector, necessary information for connection has to be provided.

fig2-obd21

Figure 2. J1962-male connector (to the left) and J1962-female connector (to the right).

The J2534 hardware interface should be able to provide a supply voltage between 5 and 20 volts to the J1962 connector. The power supply should use one of the pins 6, 9, 11, 12, 13 or 14 of the connector and this choice should be selectable in the software. The maximum source current is 200mA and the settling time should be within 1ms.

The J2534 hardware interface should have enough memory to buffer 4Kb of transmit messages and 4Kb of received messages. And the processor must naturally be fast enough to process all messages so that no messages are lost.

Software Requirements

Programming of an emission related ECU using J2534 is done from a PC, preferably a laptop computer, with a Win32 operating system (Windows 95 or later).

Each vehicle manufacturer will have an own API software used for analyzing and programming of their vehicles. If their vehicles only use i.e. ISO 9141, no other protocols have to be supported by the application. It is important that this application conform to the functions in the J2534 API.

This application will have complete information of the ECUs that are supported by the application. This application also includes a user interface where choices can be made depending on the ECU and what action to perform.

A vehicle repair workshop that wants to analyze and re-program vehicles from different manufactures must have an API for each. This API can be downloaded from the internet or installed from a CD or DVD. How this API is provided depend on the manufacturer, but they do charge the customer (repair workshop) ordering it. The price differs a lot between manufacturers, a one year subscription costs between $75 and $2500.

Each manufacturer of a J2534 tool (hardware device) must have a DLL-file which includes functions and routines for communicating with the PC. The DLL-file is then loaded into the vehicle manufacturer’s application. The functions in the J2534 tool are linked to a corresponding function in the application. The DLL-file also includes routines for the connection (RS-232, USB etc.) between the J2534 tool and the PC.

The intention is that every J2534 tool should to be capable of communicating with all protocols supported by the J2534 standard. The application provided by the vehicle manufacturers use commands described in J2534 standard to connect to a hardware tool (of any brand). The connection and initialization gives the hardware tool information of which protocol that is used. Thereafter it is up to the hardware tool to manage the connection to the vehicle with de desired protocol. The PC application will send messages in the earlier determined protocol format to the hardware tool which buffers the messages and transmits the messages in the order they were received.

J2534 Application Programming Interface (API)

The J2534 API consists of a number of functions for communication which must be supported by both hardware tool and vehicle manufacturer application. For the PC application developer this means that all commands and messages must made with the functions defined in the API. See table 1 below.

Function Description
PassThruConnect Establish a connection with a protocol channel.
PassThruDisconnect Terminate a connection with a protocol channel.
PassThruReadMsgs Read message(s) from a protocol channel.
PassThruWriteMsgs Write message(s) to a protocol channel.
PassThruStartPeriodicMsg Start sending a message at a specified time interval on a protocol channel.
PassThruStopPeriodicMsg Stop a periodic message.
PassThruStartMsgFilter Start filtering incoming messages on a protocol channel.
PassThruStopMsgFilter Stops filtering incoming messages on a protocol channel.
PassThruSetProgrammingVoltage Set a programming voltage on a specific pin.
PassThruReadVersion Reads the version information for the DLL and API.
PassThruGetLastError Gets the text description of the last error.
PassThruIoctl General I/O control functions for reading and writing protocol configuration parameters (e.g. initialization, baud rates, programming voltages, etc.).

Table 1. J2534 function description.

The first command that is sent is the PassThruConnect which establish the connection between the PC application and the J2534 hardware tool. This command includes information about which protocol to use, standard or extended CAN identifier or if ISO15765 is used. The command also includes a channel identification which will be used for all following communication. If the connection was successful, a STATUS_NOERROR value is returned, which indicates that the function has been successfully performed. Before any messages can be sent an initialization has to be made, PassThruIoctl, where parameters like node address, baud rate or protocol specific parameters are set.

All messages sent from the PC application follow the same structure which consists of: protocol type (i.e. J1850, CAN, J9141), receive message status, transmit message flags, received message timestamp (microseconds), data size in bytes, extra data index (start position of extra data in received message i.e. IFR, CRC, checksum), and last but not least an array of data bytes (the received message). It is possible to send CAN messages longer than 8 bytes using ISO15765 commands if this feature was selected upon connection.

Some ECUs sends a lot of messages with short period of time between each message. The filter function, PassThruStartMsgFilter, can be set to either block or pass messages. This will decrease the messages needed to be sent between the hardware tool and the PC. The message is first “ANDed” with a mask which gives the opportunity to compare only some important bits of the identifier. Thereafter the “ANDed” message is compared to a specific pattern.

J2534 API DLL

The J2534 API DLL provides a linkage between the API functions and the hardware tool. Since the PC application should not have to care about which communication protocol is being used between the PC and the hardware tool. Each manufacturer of a hardware tool has a DLL-file with a unique name. This way it is possible for the software application on the PC to distinguish which hardware tool to connect. It is important that the developer of the firmware in the hardware tool follows the API and name the functions exactly as in the J2534 description. Otherwise it will be impossible for the PC application to find the functions in the DLL when performing the linkage.

Go Back To CAN Standards