material

12
J1939 Introduction This article is intended to give engineers a brief overview of the SAE J1939 protocol. SAE J1939 is a replacement for the SAE J1587/J1708 network which has been used for medium and heavy duty commercial vehicles for the past 20 years. Today J1939 is used as the standard communications bus for commercial vehicle's diagnostic and control applications. Due to its popularity and success, it has been adopted by the agricultural (ISO 11789) and marine industries (NMEA2000). Competing high-level CAN protocols are ISO 15765 and CANopen. J1939 Overview SAE J1939 is a high level communications protocol, which operates on a Controller Area Network (CAN) bus. J1939 specifies exactly how information (e.g. engine RPM) is exchanged between electronic control units (ECUs) on a vehicle. It defines the data's priority, size, scaling, and offset. For example, J1939 specifies engine RPM to have a default priority of 3, to have a size of 16-bits, a resolution of 0.125 rpm/bit, and an offset of 0. The standard goes on to define many other aspects, including message timeouts, how large messages are fragmented and reassembled, the network speed, the physical layer, and how applications acquire network addresses. J1939 Messages At the heart of J1939 is the Parameter Group Number (PGN), which is a unique number assigned to every J1939 message. The PGN

Upload: wilinton-ariza

Post on 02-Jan-2016

42 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Material

J1939 Introduction

This article is intended to give engineers a brief overview of the SAE J1939 protocol.

SAE J1939 is a replacement for the SAE J1587/J1708 network which has been used for medium and heavy duty commercial vehicles for the past 20 years. Today J1939 is used as the standard communications bus for commercial vehicle's diagnostic and control applications. Due to its popularity and success, it has been adopted by the agricultural (ISO 11789) and marine industries (NMEA2000). Competing high-level CAN protocols are ISO 15765 and CANopen.

J1939 Overview

SAE J1939 is a high level communications protocol, which operates on a Controller Area Network (CAN) bus. J1939 specifies exactly how information (e.g. engine RPM) is exchanged between electronic control units (ECUs) on a vehicle.

It defines the data's priority, size, scaling, and offset. For example, J1939 specifies engine RPM to have a default priority of 3, to have a size of 16-bits, a resolution of 0.125 rpm/bit, and an offset of 0.

The standard goes on to define many other aspects, including message timeouts, how large messages are fragmented and reassembled, the network speed, the physical layer, and how applications acquire network addresses.

J1939 Messages

At the heart of J1939 is the Parameter Group Number (PGN), which is a unique number assigned to every J1939 message. The PGN serves to identify the message and its data. Although sometimes a message will contain a single parameter (e.g. VIN), typically the PGN will contain a group of parameters. In the standard there is a total of 8,672 PGNs.

For an example message, take PGN 61,444. It identifies the "Electronic Engine Controller 1" message. Per the specification, "EEC1" has seven different parameters embedded in the data field of the message. Engine RPM is one of those seven parameters.

J1939 Message Sizes

Page 2: Material

J1939 has three different allowed message sizes, they are: 3 bytes, 8 bytes, and variable length. There is only one message which is three bytes in length, and that is the request message (PGN 59,904).

The majority of messages in J1939 are 8 bytes in length. This allows for a more efficient use of the network bandwidth by maximizing the amount of data on the network by reducing the number of messages.

Variable length messages are messages with a length from 9 to 1,785 bytes. These messages are too large to fit in a single CAN data frame and must be fragmented by the transmitter and reassembled by the receiver. This process is defined by J1939's transport protocol which is specified by J1939-21.

J1939 Physical Layers

Currently there are two 250 Kbps physical layers defined, J1939-11 and J1939-15, with a 500 Kbps layer, J1939-14, under development.

J1939-11 specifies a shielded twisted pair of wires with a maximum backbone length of 40 meters. It uses a three pin connector and allows for up to 30 nodes.

J1939-15 specifies an unshielded twisted pair of wires with a maximum backbone length of 40 meters. It uses a two pin connector and allows for up to 10 nodes.

J1939 to RS232 SAE J1939 CANopen Software

Page 3: Material

J1939 Introducción

Este artículo tiene por objeto dar a los ingenieros una breve descripción del protocolo SAE J1939 .

SAE J1939 es un sustituto de la red SAE J1587/J1708 que se ha utilizado para los vehículos comerciales medios y pesados durante los últimos 20 años. Hoy en día J1939 se utiliza como el bus de comunicaciones estándar para aplicaciones de diagnóstico y de control del vehículo comercial . Debido a su popularidad y éxito, que ha sido aprobada por la agricultura (ISO 11789 ) y las industrias marinas ( NMEA2000 ) . Protocolos competidoras de alto nivel se están ISO 15765 y CANopen .

J1939 Información general

SAE J1939 es un protocolo de comunicaciones de alto nivel , que opera en una red de área de controlador (CAN ) bus . J1939 especifican exactamente cómo se intercambia la información ( por ejemplo, RPM del motor ) entre unidades de control electrónico (ECU ) en un vehículo .

Se define la prioridad de los datos , el tamaño , la escala y offset. Por ejemplo , J1939 especifica RPM del motor para tener una prioridad por defecto de 3 , que tienen un tamaño de 16 bits , una resolución de 0.125 rpm / velocidad de bits , y un desplazamiento de 0 .

La norma pasa a definir muchos otros aspectos , como los tiempos de espera de mensajes, cómo se fragmenta y se vuelven a montar los mensajes grandes , la velocidad de la red , la capa física , y cómo las aplicaciones adquieren direcciones de red.

J1939 Mensajes

En el corazón de J1939 es el número del grupo de parámetros ( PGN ) , que es un número único asignado a cada mensaje J1939 . La PGN sirve para identificar el mensaje y sus datos . Aunque a veces un mensaje contendrá un solo parámetro ( por ejemplo, VIN ) , típicamente la PGN contener un grupo de parámetros . En la norma hay un total de 8672 PGN .

En un mensaje de ejemplo, tomemos PGN 61444 . Identifica el mensaje " Electronic Engine Controller 1 " . Por la especificación , " EEC1 " tiene siete diferentes parámetros embebidos en el campo de datos del mensaje . RPM del motor es uno de los siete parámetros .

Page 4: Material

J1939 Tamaños Mensaje

J1939 tiene tres tamaños de los mensajes permitidos diferentes , que son: 3 bytes , 8 bytes , la longitud variable. Sólo hay un mensaje que es de tres bytes de longitud , y que es el mensaje de solicitud ( PGN 59904 ) .

La mayoría de los mensajes en J1939 son 8 bytes de longitud . Esto permite un uso más eficiente del ancho de banda de la red mediante la maximización de la cantidad de datos en la red mediante la reducción del número de mensajes .

Mensajes de longitud variable son mensajes con una longitud de 9 a 1785 bytes . Estos mensajes son demasiado grandes para caber en una sola trama de datos CAN y deben ser fragmentados por el transmisor y volver a montar por el receptor. Este proceso es definido por el protocolo de transporte de J1939 que se especifica en J1939- 21 .

J1939 capas físicas

Actualmente hay dos 250 Kbps capas físicas definidas , J1939- 11 y J1939- 15 , con una capa de 500 Kbps , J1939- 14 , en fase de desarrollo .

J1939- 11 especifica un par trenzado de cables con una longitud máxima de columna vertebral de 40 metros. Se utiliza un conector de tres clavijas y permite hasta 30 nodos .

J1939- 15 especifica un par trenzado sin blindaje de los cables con una longitud máxima de columna vertebral de 40 metros. Se utiliza un conector de dos pines y permite hasta 10 nodos.

J1939 de SAE J1939 RS232 Software CANopen

SAE J1939

This article is intended to give engineers a brief overview of the SAE J1939 protocol. For details on the specification itself, please visit the Society of Automotive Engineers. Here is a printable version of thisJ1939 introduction and Bosch CAN specification.

SAE J1939 is a replacement for the SAE J1587/J1708 network which has been used for medium and heavy duty commercial vehicles for the past 20 years. Today SAE J1939 is used as the standard communications bus for commercial vehicle's diagnostic and control applications. Due to its popularity and success, it has been adopted by the agricultural (ISO 11789) and marine industries (NMEA2000).

Page 5: Material

J1939 Overview

SAE J1939 is a high level communications protocol, which operates on a Controller Area Network (CAN) bus. SAE J1939 specifies exactly how information (e.g. engine RPM) is exchanged between electronic control units (ECUs) on a vehicle.

It defines the data's priority, size, scaling, and offset. For example, J1939 specifies engine RPM to have a default priority of 3, to have a size of 16-bits, a resolution of 0.125 rpm/bit, and an offset of 0.

The standard goes on to define many other aspects, including message timeouts, how large messages are fragmented and reassembled, the network speed, the physical layer, and how applications acquire network addresses.

J1939 Datalink

SAE J1939 uses a simple datalink layer to communicate information. Altogether there are six subfields which are encoded into the 29-bit CAN identifier, they are shown below and are: Priority, Extended Data Page, Data Page, Protocol Format, Protocol Specific, and Source Address.

P EDP DP PF PS SA

3 bits 1 bit 1 bit 8 bits 8 bits 8 bits

P is the priority of the message, EDP and DP make up 4 different pages with one page being reserved for ISO 15765-3. PF and PS define the parameter group number and destination address, and SA is the source address of the controller application. For details about this encoding, refer to SAE J1939-21.

J1939 Messages

At the heart of J1939 is the Parameter Group Number (PGN), which is a unique number assigned to every J1939 message. The PGN serves to identify the message and its data. Although sometimes a message will contain a single parameter (e.g. VIN), typically the PGN will contain a group of parameters. In the standard there is a total of 8,672 PGNs.

For an example message, take PGN 61,444. It identifies the "Electronic Engine Controller 1" message. Per the specification, "EEC1" has seven different parameters embedded in the data field of the message. Engine RPM is one of those seven parameters.

J1939 Message Sizes

J1939 has three different allowed message sizes, they are: 3 bytes, 8 bytes, and variable length. There is only one message which is three bytes in length, and that is the request message (PGN 59,904).

The majority of messages in J1939 are 8 bytes in length. This allows for a more efficient use of the network bandwidth by maximizing the amount of data on the network by reducing the number of messages.

Variable length messages are messages with a length from 9 to 1,785 bytes. These messages are too large to fit in a single CAN data frame and must be fragmented by the transmitter and reassembled by the receiver. This process is defined by J1939's transport protocol which is specified by J1939-21.

The transport protocol layer defines two different types of message fragmentation: BAM and CM. There are several differences between those two types, the main difference being the destination address. A BAM uses a global destination address and is therefore sent to all CAs, while a CM is destination specific. Due to the addressing scheme, only a single BAM can be transmitted simultaneously, while multiple CMs using different destination addresses may be simultaneously transmitted.

Another difference between BAMs and CMs is the time is takes to send a messages. With a BAM, data packets must be spaced at least 50 ms apart and no more than 200 ms. With a CM, data frames may be sent as quickly as possible.

Page 6: Material

J1939 Physical Layers

Currently there are two 250 Kbps physical layers defined, J1939-11 and J1939-15, with a 500 Kbps layer, J1939-14, under development.

J1939-11 specifies a shielded twisted pair of wires with a maximum backbone length of 40 meters and maximum stub length of 1 meter. It uses a three pin connector and allows for up to 30 nodes.

J1939-15 specifies an unshielded twisted pair of wires with a maximum backbone length of 40 meters and maximum stub length of 3 meters. It uses a two pin connector and allows for up to 10 nodes.

J1939 CAN Parameters

SAE J1939-11 and -15 specify a network data rate of 250 Kbps with a minimum period of 3.998 us and a maximum period of 4.002 us. CAN networks also allow and require for custom sample point settings. For J1939, the sample point setting has a maximum value of 87.5%. Nodes should be set as close as possible but not exceed 87.5%. CAN peripherals also allow for synchronous jump width (SJW) settings of 1 to 3. The SJW value dictates how much time can be added or subtracted to the node's CAN clock for syncronization purposes. J1939 allows only for a single SJW.

J1939 Shield Termination

For networks with a shield, in one spot with least electrical noise and close to the middle, the shield should be connected directly to ground.

Nodes will connect to the shield via a resistor and capacitor in series. The resistor should have a value of 1 ohm and the capacitor should have a value of 0.68 uF.

J1939 Clock Tolerance

J1939, which is based on a CAN bus, has a much tighter clock tolerance than what is stated in the CAN ISO 11898 documents. CAN specifics a tolerance of 1.58% while J1939-11 and J1939-15 specify a clock tolerance of 0.05%. Because of these tight tolerances, CAN peripherals often may not be driven by PLL (Phase Lock Loop) and FLL (Frequency Locked Loop) multipliers.

PLLs and FLLs, which are used to multiply frequencies introduce clock jitter. Clock jitter is variation from period to period in a clock signal. Crystals have very low jitter as compared to PLL/FLL circuits. Due to this, jitter can introduction errors into the CAN bus. Consult the microcontroller datasheet for PLL/FLL jitter amounts.

J1939 Network Termination

All SAE J1939 networks utilize, and require, two resistors at each end of the backbone. These resistors are balanced with the impedance of the network cable and prevent electrical reflections. Reflections are much like audiable echos, and without dampening, can prevent high-speed operation.

SAE J1939-11 and J1939-15 both specify terminating resistors should not be contained inside of electronic control units. If resistors are placed inside of an ECU, if that ECU is removed from the network then the network will fail to operate. This also allows for backbones to be extended as needed. Instead, terminating resistors should be placed into cable plugs which serve to seal and cap the end of networks. Terminating resistors have a minimum resistance of 110 ohms, typical of 120 ohms, and maximum of 130 ohms.

J1939 Protocol Stack

What is a J1939 protocol stack? A J1939 protocol stack is a software library that handles the appropriate layers of the OSI 7 layer model. J1939 specifies layer 1 (physical), layer 2 (data link), layer 3 (network), and layer 4 (transport), and layer 7 (application).

Page 7: Material

In simple terms, a J1939 protocol stack, for inbound data, will convert and reassemble received raw CAN frames and present complete and valid J1939 messages to the user's application. For outbound data, a J1939 protocol stack will accept complete messages from the user's application then convert, fragment, and transmit raw CAN frames onto the J1939 network.

J1939 NAME Field

Every ECU, or CA (controller application) on a J1939 network has a unique NAME. The NAME is 64 bits wide and is made up of the following fields: Arbitrary Address Capable, Industry Group, Vehicle System Instance, Vehicle System, Reserved Bit, Function, Function instance, ECU Instance, Manufacturer Code, and Identity Number. The NAME field gives each CA a unique identity. Nodes on the network use the NAME field to distinguish between each other. The NAME field is also essential toNetwork Management as it establishes node priority. The NAME translates to a number; the lowest numeric values have the highest priority when claiming addresses.

An ECU may contain multiple CAs and NAME fields.

J1939 Address Claiming

In J1939 CAs, or electronic control units, on the vehicle network bus must claim a unique source address to enable communication. Addresses 0 to 128 are pre-assigned and CAs which use these addresses are allowed to communicate immediately after power up. In anticipation of future devices and functions, however, J1939 includes a method for dynamically assigning addresses. New devices must announce an address for themselves by transmitting an address claim message.

Sending an Address Claim message the new (non-addressed) device sends out an Address Claim PGN indicating the address it is assuming. All devices on the network compare this newly claimed address with their internal address tables. If the address is already in use by a device with a higher priority (determined by the NAME), the higher priority device indicates the conflict by sending out a Address Claim message. The lower priority device immediately stops using the address and must claim a new one.

About the SAE

SAE, Society of Automotive Engineers, is an organization of engineers and technical experts in the aerospace, automotive and commercial-vehicle industries. Their primary goal is to develop technical standards, for example: SAE J2497, SAE J1939, SAE J1850, SAE J1587, and SAE J1708. The SAE provides a venue for government and businesses to agree on technical standards for the worldwide vehicle mobility industry. In general these standards are only recommended practices, which means there is no legal mandate for business to adhere to them. However sometimes goverments madate adoption (e.g. OBD2 and SAE J1979).

J1939 Specifications

SAE J1939 Parent Document SAE J1939-11 Physical Layer, 250 Kbps SAE J1939-13 Off-Board Diagnostic Connector SAE J1939-14 Physical Layer, 500 Kbps SAE J1939-15 Reduced Physical Layer, 250 Kbps SAE J1939-21 Data Link Layer SAE J1939-31 Network Layer SAE J1939-71 Vehicle Application Layer SAE J1939-73 Vehicle Diagnostic Layer SAE J1939-74 Application - Configurable Messaging SAE J1939-75 Application Layer - Generator Sets and Industrial SAE J1939-81 Network Management SAE J1939-82 Compliance - Truck and Bus SAE J1939 Protocol Description

J1939 Protocol Dictionary

Page 8: Material

    PGN SPN DTC

    SA DA CA

    PDU1 PDU2 BAM

    NAME

Our SAE J1939 protocol stack was designed by Simma Software, a nationally recognized J1939 expert, to meet the demanding needs of the high speed Controller Area Network (CAN). The J1939 source code uses a high performance modular design and has a simple API. Benchmarks have shown the stack to be 800% more efficient than other commercially available J1939 software solutions. The software protocol stack is well documented and has been used in more than a quarter of a milliion embedded systems.

J1939 CPU Cycles per Msg(apprx. for HCS12 CPU)

J1939 Code Size Comparison(apprx. for HCS12 CPU)

There are two J1939 software packages available: J1939-Full and J1939-Light. J1939-Full handles reception and transmission of standard single frame and multi-frame (i.e. Transport Protocol) J1939 messages. Also, the J1939-Full software package handles address claim arbitration specified by the network management layer. J1939-Light is identical to J1939-Full without support for the J1939 transport protocol which is used for multi-frame messages. If you have questions about our J1939 software, please see our J1939 Protocol Stack FAQ for possible answers.

SAE J1939 Protocol Stack Details:

J1939 compliant MISRA C compliant ANSI C source code Use with or without an RTOS Use with 8, 16, 32, or 64-bit CPU Complete user’s reference manual

Page 9: Material

SAE J1939 Software Benchmarks

Simma Software provides high-performance deterministic real-time software for the embedded systems industry. For reference and comparitive purposes for our customers, we are providing the below performance analysis metrics. These J1939 software benchmarks are for the combined packages of ssJ1939-Full and ssCAN. They were measured with a 100% utilized 250 Kbps SAE J1939 network. CAN identifiers were randomized and acceptance masks disabled. All builds were compiled with full optimizations enabled and code execution from internal flash memory.

 SAE J1939 Ports

Our real-time SAE J1939 protocol stack is completely platform independent and written in the ANSI C programming language. It is the CAN device driver, ssCAN, that is target specific and incorporates the details for a given microcontroller.

Together ssJ1939 and ssCAN form a complete ported system allowing customers to be up and running almost immediately. Our ssCAN device driver has been ported to over 40 different microcontrollers. Below is the list of available ports. Please contact us if you are interested in a port or device driver for a hardware platform that is not listed.

Linux Windows XP/7/Embedded Texas Instruments RM4x (DCAN) Texas Instruments LM3Sx Texas Instruments TMS470x Texas Instruments TMS470Mx Texas Instruments TMS570x Texas Instruments Tiva TM4C Texas Instruments F28M35xx Texas Instruments TMS320F280x Texas Instruments TMS320F281x Texas Instruments TMS320F282x Texas Instruments TMS320F283x Texas Instruments AM3x - Sitara Texas Instruments DM8x - DaVinci Atmel SAM7 Atmel AT90 Freescale HCS08 Freescale HCS12 Freescale HCS12X Freescale MC68xxx Freescale MCF5xxx Freescale MPC5xxx

Page 10: Material

Freescale Kinetis Kxx Infineon C16x Infineon TriCore Intel 82527 Microchip PIC18 Microchip PIC24 Microchip PIC32 Microchip dsPIC30 Microchip dsPIC33 Microchip MCP2515 NXP LPC11xx NXP LPC17xx NXP LPC21xx NXP LPC23xx NXP SJA1000 Silicon Labs C8051 STMicro ST7 STMicro ST10 STMicro STR7 STMicro STM8 STMicro STM32F1x STMicro STM32F2x STMicro STM32F3x STMicro STM32F4x Xilinx LogiCORE AXI (axi_can)