Sie sind auf Seite 1von 15

Vehicle Network Gateway (VNG)

(With emphasis on the j1850 interface)

Fetah Basic

(Spencer Volmar and Marc Oliver – Co-Workers)


Abstract vehicles from compact cars to freightliners.

The Vehicle Network Gateway or VNG The VNG interfaces to the OBD through the

(pronounced “ving”) is a small embedded Engine/Electronic Control Unit (ECU). On-

microcontroller system that is utilized by a Board Diagnostics are used to communicate

host computer as an interface to the different to a vehicles engine, transmission, brakes

types of in-vehicle networks that are and other electronic components and

integrated on today’s electronic engines. The monitor there performance. These standards

Vehicle Network Gateway multiplexes SAE and protocols have been regulated by the US

J1708, J1939, and J1850 vehicle networks government and they have been required by

on a single asynchronous serial channel to federal law since 1996 for passenger

reduce the hardware overhead of a host vehicles and even earlier for medium to

system. A simple and easy to use interface heavy duty vehicles. The J1708 and J1939

eliminates the complexities of dealing with protocols are for medium to heavy duty

each protocol and their timing constraints. vehicles while the J1850 is for passenger

Below is a basic description of the J1708, cars.

J1939 and J1850 protocols. A complete OBD is most commonly associated

description can be found in the SAE J1708, with car mechanics that use OBD

SAE J1939 and SAE J1850 publications technology to diagnose engine troubles. But

found at http://www.sae.org. the often forgotten sector of this industry is

The VNG is envisioned for the big the fleet management market. This

and ever growing OBD (On-Board enormous market is comprised of Fleet

Diagnostics) market that encompasses both Companies, Countless Trucking Companies,

the private and commercial sector of First Responders (e.g., Ambulance, Police,
etc), etc. These OBD capabilities are usually driving, on duty, resting or off duty. This is

integrated in some sort of fleet management used to regulate the driver’s driving time

system that trucking companies use to and resting time to help prevent accidents

monitor their drivers. The common from fatigue, and help trucking companies

measurements utilized by the Trucking with the pay role.

Companies are: odometer, fuel spent, RPM, 1. General


brakes, engine idle, engine time (time engine (For Block Diagram and Data Flow Diagram
has been running) and some other similar see Diagram 1 and Diagram 2 respectfully)
measurements. These companies use the

engine measurements provided by the OBD

along with the fleet management systems to

find out if the drivers are speeding, hard

braking, over idling, over RPM, etc. They

also monitor when the truck is moving,

when it is stopped, when it is idling, the

miles traveled, miles traveled per gallon, etc.

These measurements are very important in

compiling the Hours of Service (HOS)

reports for the drivers required by federal

law, and also figuring out the fuel tax

reports for each state traveled through also

required by federal law. HOS is the driver’s

weekly report on how long they have been


Diagram 1. VNG Block Diagram

Diagram 2. VNG Data Flow (Red my Responsibility)


1.1 The SAE J1708 Protocol The one character MID field ranges from 0

J1708 protocols support communication to 255. A MID value in the field is a unique

among devices installed on a transit vehicle identifier. It pertains to a device or

(e.g., bus, truck). The physical connection of transmitter and indicates the characteristics

SAE J1708 Protocol is a modification of the of the data following the MID value. MID

ISO EIA/RS 485 standard for electrical values ranging between 128 and 255 are

characteristics of generators and receivers reserved by SAE J1587 for devices or

for use in balanced digital multipoint components which may be installed in a bus

systems. It defines a small entity or other heavy-duty vehicle. Data characters

transmitted on a physical communications convey the meaning of a message that is

channel as a character of 10 bits. The embedded from higher layers. They conform

format of the character is: to the definition of a character structure

described in Figure 2. SAE J1708 does not

impose any modifications or constraints on

the data characters transferred during data


In addition to this character structure, J1708
transmission. The checksum is a specific
also defines messages. A message consists
character generated from the two’s
of Message Identification (MID) character, a
complement of the sum of the MID value
set of data characters, and a checksum (see
and the data characters for a message. It is
Figure 1).
used to verify error-free transmission.

Each message in SAE J1708 is limited to 21

Figure 1. Message Structure in SAE J1708 characters including MID and checksum.

This means that an application cannot


generate a message, which contains more device has gained control of the network, the

than 19 characters. Further, messages transmission of the character stream is in an

assigned by different MID values have asynchronous mode. The start and stop bits

different message priorities. These priorities control the transmission process.

represent different levels of importance 1.1.1 The SAE J1587 Protocol

based on transmitter categories. J1708 SAE J1587 protocol is an extension of SAE

compliant-components are allowed to access J1708, which defines data and message

the vehicle network simultaneously. This identifiers. It expands SAE J1708 to handle

causes network contention or conflicts. In messages created and used by components

order to solve this problem, J1708 assigns a in a heavy-duty vehicle like class 8 trucks.

delay that determines the time when the The messages defined in SAE J1587

device may re-access the network. The include:

delay is based on the priority of the message 1. Vehicle and component information

content and device. Clearly, the which pertains to the operational status

communications configuration depicted by and performance of the vehicle

the SAE J1708 protocol is a peer-to-peer (or 2. Routing and scheduling information

balanced) communications configuration. which relates to the planned or actual

Under this configuration, devices attempt to route of the vehicle, current vehicle

transmit whenever they have a message to location, and estimated time of arrival

send; the protocol employs a contention 3. Driver information which relates to

mechanism to determine which device is driver activity

allowed to send if two or more devices 4. Freight information that pertains to

attempt to send simultaneously. Once a freight status and billing activities.


specified for connection management and

Currently, the SAE J1587 protocol is limited data transfer. The connection management

to the formats for basic vehicle and includes connection requesting and closing,

component identifiers, and performance message acknowledgments, and flow

data. control. The data transfer includes

The SAE J1587 functions on the data link operations used for transferring user-defined

layer as the addressing or routing service. (proprietary control) data.

Instead of using the term data characters, it SAE J1587 protocol can act as an

organizes an address by parameters. A application-level protocol, however

parameter consists of a Parameter application-level messages (or protocol data

Identification (PID) character and a series of units) that can be passed down to the data

data characters (see Figure 2). Currently, link layer to form parameters are not

SAE J1587 uses 511 parameters to specify defined. In addition, application-level

various activities associated with a heavy- network services used to create and map the

duty vehicle. messages into lower level protocols are also

not clearly defined.

1.2 The SAE J1939 Protocol


Figure 2. Message Structure in SAE J1587
J1939 is a high speed communications
The SAE J1587 protocol acts not only as a
network designed to support real-time
protocol on the data link layer but also as
closed loop control functions between
network services on the transport layer. It
Electronic Control Units (ECU’s) physically
incorporates a set of the transport-level
distributed throughout the vehicle. J1939 is
services and organizes them by two
capable of performing all of the functions of
parameters. These two parameters are
J1708/J1587 as well as the control system

support.
Figure 1. PDU Structure in SAE J1939
J1939 uses the CAN protocol which permits

any ECU to transmit a message on the


The priority field is used by the CAN
network when the bus is idle. Every
controller chip and CAN protocol. This
message contains an identifier that defines
field is not used by the J1939 protocol.
the message priority, who sent it, and what
The PGN (Parameter Group Number)
data is contained within it. Collisions are
uniquely identifies each parameter group.
avoided due to the arbitration process that
This field is similar to the J1708 MID/PID
occurs while the identifier is transmitted
fields. This number uniquely identifies the
(using a non-destructive arbitration scheme).
type of message and type of data that is
Such a scheme assures that the highest
being transmitted. There are five message
priority message will be transmitted on the
types currently supported by the J1939
bus first, even if multiple ECU’s are
protocol. These types are: Commands,
attempting to transmit at the same time. The
Requests, Broadcasts, Acknowledgment,
J1939 protocol supports only the CAN 2.0B
and Group Functions. More information
29 bit identifier/arbitration field.
about the specific PGN assignments can be
J1939 messages are broken up into Protocol
obtained in Appendix A of the SAE J1939
Data Units (PDU’s) which can be
documentation.
transmitted onto the CAN bus. Each PDU
The source address field of the PDU
contains information about message priority,
contains the address of the ECU transmitting
type, and content. Figure 1 shows the three
the message. For a given network, every
required fields of a J1939 PDU.
address must be unique (254 available).
Two different ECUs cannot use the same transmitted correctly. Messages are

address at the same time. The PGNs are received from the CAN bus by waiting for

independent of the Source Address, thus any the CAN controller to send an interrupt

ECU can transmit any message. signifying that it has received a message and

Each J1939 message is limited to 1785 data then reading the message from the CAN

bytes. Messages greater than eight bytes in controller’s registers. The CAN controller

length are too large to fit into a single CAN ensures that messages are transmitted

data frame. They must therefore be broken according to the message priority and at the

into several smaller packets, and those specified rate of the network.

packets transmitted in separate message 1.3 The SAE J1850 Protocol

frames. At the destination end, the The SAE J1850 On-Board Diagnostics

individual message frames must be received, standard used in On and Off-Road vehicles

parsed, and the original message is an “Open Architecture” protocol that is

reassembled from the received packets. The low cost, intended for “masterless” bus

Transport Protocol Message is used to control, and it is a single level bus topology.

transmit these multiple packet messages. J1850 has two main operation methods,

Transmitting and Receiving messages is Pulse Width Modulation (PWM) at 41.6

accomplished with the help of an integrated Kb/s, and a Variable Pulse Width (VPW) at

CAN controller. Messages are transmitted 10.4 Kb/s approach. The VNG will support

on the CAN bus by writing the appropriate both approaches. J1850 has three main

information into the registers of the CAN classifications, A, B, C class. The

controller and waiting for an interrupt performance or data-rate increases

response signifying that the message was respectfully for each class. VNG will
primarily be utilizing the B class. The B to all network nodes to access the network.

class usually supports intermodule, non-real Because in J1850 the transmitting node

time control and communication. In class B broadcasts its message, all the other nodes

the high speed PWM uses two wire see the message including the transmitting

differential approach and the 10.4 Kb/s node itself. Because of its asynchronous

VPW uses single wire approach. VPW nature some kind of arbitration scheme

supports General Motors (GM) and needs to be in place to offer a non-colliding

Chrysler, while PWM supports Ford. J1850 environment that supports the peer-to-peer

is an intermodule data communication equal access protocol. Before a node

network for sharing information passed in transmits a frame it first listens to the bus for

frames between all vehicle electronic some pre set amount of time. If the bus is

components that are connected on the J1850 not busy then the message is transmitted,

bus. Communication of digital signals otherwise if the bus is busy transmitting

between these electronic components can be another message then the listing node waits

achieved using multiplexing. The two types for the current message to finish transmitting

of multiplexing are frequency division and before it sends its. Collision Resolution

time division. Frequency division sends two allows multiple transmitting nodes to talk at

or more frames at the same time on a single the same time, and it resolves the issue of

channel. Time division sends two or more who controls the bus by utilizing a message

signals with fixed or variable time delays or prioritization scheme. Checking is done

buffers in-between, also on a single channel. using a bit-by-bit arbitration.

J1850 is an asynchronous, masterless, peer-

to-peer protocol that gives equal opportunity


Beginning of every frame start with a pre-set the end of the data field is the CRC (or

high potential nominal period of 200us Cyclical Redundancy Check) byte. The CRC

called the Start of Frame (SOF). This is divides the entire message excluding the

followed by bit symbols representing data SOF, by a special polynomial. The 1’s

bytes. Anywhere between one byte to eleven complement result of the polynomial is

bytes can be transmitted. The field following appended to the frame after the data field.

the SOF is the Header Field. The HF can The receiving nodes do a similar polynomial

either be one or three bytes in length. HF calculation to the received frame and if no

contains critical information about what a errors occurred the result will always be the

receiving node should expect in the same (C4 in hex). After the CRC byte,

proceeding frame, such as how many bytes comes the End of Data (EOD) which is a

are in the HF or how many data bytes the 200us low potential. The receiving nodes

frame contains. For more information on the after this symbol can immediately respond

header byte bit definition, a bit by bit break with an In-Frame Response (IFR) message

down of the header field and the meaning which is a form of error handling that J1850

refer to the SAE J1850 manual. The Data supports. Otherwise if no IFR is needed by

Field consists of ones and zeros. A passive the receiver then the EOD extends into an

1-bit symbol is 128us long low potential, End of Frame (EOF) symbol. These to

and a dominate 1-bit symbol is 64us long combined make the EOF which is 280us

high potential. The zero bit symbol is the long low potential.

opposite, passive is 64us long low potential There are much more detailed explanations,

and dominate is 128us long high potential. tables and definitions of the J1850 protocol

Only one transition is required per bit. At in the SAE J1850 manual.
2. Tasks/Interface/Parts components that will be needed to make the

2.1 Tasks project a success.

Most all of my tasks are going to involve

coding C and Assembly (Maybe). I estimate

ninety five percent of coding will be done in

C and zero to five percent will be done in

assembly. Other tasks will involve learning

the protocols. Finally my last task will be

integrating the J1850 capability on to the

VNG board.

2.2 Interface

The interfacing will be between the vehicle

Electronic Control Unit and the

microcontroller (J1850, VPW, PWM). In

that interface there will be an interface

between the different processes and there

protocols (RS232, RS422 or 5v buffered).

Semaphores will be the major part of task

scheduling and flow control.

2.3 Parts

The most important and central part of the


Its multiple network modules support
project is the microcontroller. The Motorola
CAN/J1850-based ECU environment by
MC9S12DJ256 offers the necessary
enabling highly efficient communications
between different network buses. This Also the uCOS-II has a great real time

microcontroller will be running on the compiler and debugger, meaning when you

uCOS-II (microCOS-II) operating system. step through the code you are stepping

This is a real time operating system. The through the physical chip in real time.

Real-Time Kernel is a highly portable, Besides these two integral components

ROMable, very scalable, preemptive real- everything else is taken care of since my two

time, multitasking kernel (RTOS) for co-workers have already done the J1708 and

microprocessors and microcontrollers. J1939 long time ago. The VNG board is

µC/OS-II can manage up to 63 application almost finished with the exception of my

tasks and provides the following services: part the J1850 capability. I may need few

more small electronic parts (caps, resisters,


• Semaphores
etc) but nothing big. I have all the parts
• Mutual Exclusion Semaphores (to
needed for this project to be completed.
reduce priority inversions) (added in

V2.04) 3. Testing/Demo

• Event Flags (added in V2.51) 3.1 Testing

• Message Mailboxes Testing will be done through the process of

• Message Queues writing and debugging the code. Testing will

• Task Management (Create, Delete, also be done by simulating ECU input and

Change Priority, Suspend/Resume checking for corresponding output. Output

etc.) data will be captured using the Dearborn, a

• Fixed Sized Memory Block device that captures the output data and can

management play it back in a meaningful structure.

• Time Management 3.2 Demo


The Demo will be done by simulating 4.1.4 November

Vehicle ECU output, which will be hooked Tie up any looses ends left over. Finalize all

up to the VNG. If time permits I will write the components. Test the finished product

an application in C# or C++ to take what and prepare for the Demo. Finish the Report.

appears like meaningless data to the average 4.1.5 December

observer, and display it in a meaningful way Everything has tested fine. The project is

such as a RPM gage, or Odometer or ready for demonstration.

Speedometer found in a car. So for example 4.2 Plans

when the gas pedal is being pressed the Have project assessment get together every

RPM gage mirrors this by increasing or week. Review the progress of the project.

decreasing accordingly. Adjust according to the progress.

4. Schedule/Plans/BOM 4.3 BOM

4.1 Schedule All the parts are present, ready and

4.1.1 Summer available.

Research the subject and familiarize myself 5. Conclusion

with the different protocols and standards. I am looking forward to doing this project

Have all the material needed for the project. and completing my undergraduate capstone.

4.1.2 September I believe that having the precedence of the

Begin writing the procedures and processes already completed J1708 and J1939

for J1850. protocols will help me and aid me in adding

4.1.3 October the J1850 capability to the VNG board.

Finish up writing the code, interface the 6. References

code components. Finish the board.


[1] SAE On-Board Diagnostics for Light

and Medium Duty Vehicles Standards

manual

[2] www.sae.org

[3] http://www.ucos-ii.com/contents

/products/ucos-ii/benefits.html

[4] http://www.freescale.com/files/

microcontrollers/doc/prod_breif/

MC9S12DJ256FS.pdf

Das könnte Ihnen auch gefallen