HDV100A2 1306CommandResponse

Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

HDV100A2 Command

Response Protocol
Documentation Number: HDV100A2-1306cr

International Headquarters
B&B Electronics Mfg. Co. Inc.
707 Dayton Road -- P.O. Box 1040 -- Ottawa, IL 61350 USA
Phone (815) 433-5100 -- General Fax (815) 433-5105
Home Page: www.bb-elec.com
Sales e-mail: [email protected] -- Fax (815) 433-5109
Technical Support e-mail: [email protected] -- Fax (815) 433-5104

© B&B Electronics -- November 2005

HDV100A2 Command & Response Manual Cover Page


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Table of Contents
INTRODUCTION........................................................................................ 1

J1708 PASS-THROUGH MODE ............................................................... 1

INTELLIGENT MODES ............................................................................ 2


Switching to Intelligent Mode ................................................................ 2
Intelligent Mode Command Protocol..................................................... 3
Formatting the Control Bytes ................................................................ 4
DETAILED DESCRIPTION OF GENERAL FUNCTION CODES...... 5
Command Acknowledgement ................................................................. 5
RS-232 Baud Rate Setup ........................................................................ 6
Setting Baud 1, Baud 2........................................................................... 8
Baud Rate Example................................................................................ 9
Time Stamp Information ...................................................................... 10
Master Reset Command ....................................................................... 12
Vendor Information.............................................................................. 12
J1708 COMMANDS .................................................................................. 13
Receiving Data from the J1708 Bus..................................................... 13
Transmitting Data to the J1708 Bus .................................................... 15
Set Filter Active.................................................................................... 17
Set Filter Off ........................................................................................ 17
Broadcast Message .............................................................................. 18
J1939 COMMANDS .................................................................................. 20
Start Receive on J1939 Bus.................................................................. 21
Stop Receive on J1939 Bus .................................................................. 21
Arbitration Field (Y1, Y2, Y3, Y4)........................................................ 22
Transmit Data to J1939 Bus ................................................................ 24
Set Mask ............................................................................................... 24
Set Filter 1 to 4 .................................................................................... 25
J1939 Header Worksheet ..................................................................... 27
ERROR CODES ........................................................................................ 28

HDV100A2 Command & Response Manual Table of Contents i


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
WARNING!
This Model HDV100A2 Converter Module allows
you to connect to active J1708 / J1939 networks.
It is possible that your transmissions through this
converter module could cause malfunction of the
network operation, damage to software or
equipment, or bodily harm.

Do Not Transmit Any Messages to the network


without a complete understanding
of the operation of the network.

B&B Electronics Mfg. Co. specifically disclaims


any responsibility for damage or injury to
software, hardware, equipment or persons as a
result of using this product.

WARNING!

ii HDV100A2 Command & Response Manual


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Introduction
The HDV100A2 adapter has three modes of operation: J1708 Pass-through,
J1708 Intelligent and J1939 Intelligent mode. In the Pass-through mode the
HDV100A2 mimics the operation of B&B’s J1708D15 and 232SAER. In
this mode data is passed from the RS-232 side to the J1708 bus. The baud
rate on the bus and on the PC are set to 9,600 baud. In the Intelligent mode
the HDV100A2 works with a command protocol to control different
operations of the HDV100A2.

Note that the HDV100A2 is powered from the vehicle side of the interface.
If the device is to be used without a vehicle, it will be necessary to connect
power to the device through the 15-pin connector. Positive voltage is
connected on pin 8. Pin 7 is connected to ground.

J1708 Pass-through Mode


When power is applied to the HDV100A2 it operates in the Pass-through
mode. In this mode, no data is buffered from the RS-232 or J1708 side of
the converter. Voltage levels are converted from RS-232 to J1708 and
J1708 to RS-232. Data sent from the RS-232 port to the J1708 bus is
transmitted onto the J1708 bus as well as looped back to the RS-232 side of
the converter. It is the host application’s responsibility to monitor collisions
by monitoring the CTS line. In this mode the HDV100A2 is compatible
with application software written for B&B Electronics models J1708P1 and
J1708D15.

The RS-232 CTS handshake line (pin 8 on the HDV100A2’s DB9F


connector) provides an idle-bus indicator to the host application software.
The CTS line goes to a high (space) state when the J1708 bus has been idle
for 2.18 milliseconds. In order to minimize the likelihood of a bus collision,
the host application should only transmit when the CTS line is in the high
(space) state.

HDV100A2 Command & Response Manual 1


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Intelligent Modes
The HDV100A2 performs several functions in Intelligent mode in order to
reduce the overhead and timing requirements of the host application when
communicating with the J1708 bus. The device handles collision detection
and retries with no additional interaction from the host application. This
greatly reduces the processor overhead required by the host in order to
communicate efficiently with the J1708 bus.

Switching to Intelligent Mode


There are two methods of switching the HDV100A2 into its Intelligent
operation mode.
1. Hold the RTS line (pin 7 of the HDV100A2’s DB9F connector) low.
While holding RTS low, send a string of 10 ASCII “B” characters (hex
42) to the device.
2. With the RTS line high, send a string of 20 ASCII “B” characters (hex
42) to the device.

For either method, the string must be sent within the first 30 bytes received
by the RS-232 port. After the device has received its first 30 bytes, it is
locked into Pass-through mode and can only be switched into Intelligent
mode by recycling power to the device.

If the string is accepted the device will stop receiving or transmitting data to
or from the bus. The HDV100A2 is now in Intelligent mode, and is ready to
receive messages using the command protocol.

Intelligent Mode Verification


To confirm that the HDV100A2 has been switched into Intelligent mode, the
host application can send the time stamp message. An example of this
command can be found in the Time Stamp Information section of this
document.

2 HDV100A2 Command & Response Manual


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Intelligent Mode Command Protocol

The HDV100A2 uses a simple protocol to communicate to vehicle bus. The


protocol is divided into four parts:
Start Of Frame (SOF)
Control Field (shown in light gray)
Data Field (shown in dark gray)
Checksum (CS)

Intelligent Mode Message Structure


SOF Number of Control Bytes Number of Data Bytes CS
Control Bytes Data Bytes
1 byte 1 byte 1 to 20 bytes 1 byte 1 to 100 bytes 1 byte

The Start of Frame byte is the first byte in a valid frame and is
always 01 hex.

The Control Field sets up the function and control of the


HDV100A2 hardware and is formatted as shown below.

Control Field Structure


Number of Control ID Byte Function Control Data Bytes
Bytes to Follow Byte
1 byte 1 byte 1 byte Up to 20 bytes

The first byte of the Control Field is the number of control bytes in
the message. This value indicates the number of control bytes, excluding
itself, to follow. If the message doesn’t contain any control bytes, the
Number of Control Bytes value will be set to 00 hex as a placeholder.
The next part of the message frame is the data field. The data field
is preceded by the number of data bytes, excluding itself, to follow and is set
to 00 hex if no data is present in the message. The data field is reserved for
data that is to be communicated to the vehicle bus.

Data Field Structure


Number of Data Bytes
Data Bytes
1 byte Up to 100 bytes

The last element of a valid message is the checksum. The checksum


is calculated by adding ALL bytes from the Start of Frame (inclusive) to the
last data byte and using the last 8 bits as a checksum.

HDV100A2 Command & Response Manual 3


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Formatting the Control Bytes

The 2nd byte is “Number of Control Bytes” to follow and always


precedes the control field. The third byte is the ID byte. This byte tells the
hardware where to direct the message. Valid entries for functions are:

ID Codes
=01 Message for J1708
=02 Message for J1939
=08 General message (for control of the HDV100A2 device)
=05 Device identification (reverse compatible)

The fourth byte is the function byte. The functions that are
supported are listed below. Note that some of the function codes are
followed by additional bytes of information. These bytes must be included in
the control byte count.

Valid General Function Codes


Function codes
=01 change PC baud rate, followed by 3 bytes (UB3, Baud1, Baud2)
=02 send time stamp
=04 hardware handshaking
=08 reset converter, followed by 2 bytes (01,and 02)
=10 time stamp off
=20 time stamp on

Valid Entries for J1708 Functions


Function codes = 07 set broadcast message
= X8 set filter X off
= X9 set filter X on
= 11 Sync with J1708 bus and start reception
= 10 Stop reception
= 12 Transmit to J1708 bus

Valid Entries for J1939 Functions


Function codes =00 Receive off
=01 Receive on
=02 Transmit message
=08 Set mask
=X8 set filter X off
=X9 set filter X on

4 HDV100A2 Command & Response Manual


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Detailed Description of General Function Codes
Command Acknowledgement

All commands sent to the device will be acknowledged. If no error occurs


an ACK will be sent with the ID byte that accompanied the command. If an
error occurred, a NACK will be sent with the ID byte that accompanied the
command as well as a Function code of $05 and the Error Code. The
responses will not be shown for each command since it is the same for
almost all commands. Below is the format of the ACK/NACK response. If
an ACK/NACK response is different for a particular command, it will be
specified.

ACK/NACK Format:
Byte Byte Function
Number Value
1 01 Start of frame
2 01 or 03 Number of control bytes = 1 for ACK, 3 for NACK
3 aa ID byte 08 = internal command
4 bb Function code 02 = send time stamp
5 cc
6 00 Number data bytes
7 CS Checksum

aa – ID Byte
$01 = J1708 Interface
$02 = J1939 Interface
$05 = Device Id
$08 = RS-232 Interface
$09 = Message Xmit OK Response
bb – FC Byte
None = Command Received and Valid
$05 = A error was detected, NACK
cc – CD Byte
None = No Error Condition
Error Code = See Section 5.10

HDV100A2 Command & Response Manual 5


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
RS-232 Baud Rate Setup

To set the baud rate for the RS-232 port, set a general command code of 08.
Set the function code to 01. Then set 3 control bytes as follows.

Function Start Control Command Function UB3 Baud Baud Data Check
of Bytes Code Code 1 2 Bytes Sum
Frame
Byte # 1 2 3 4 5 6 8 9 10
Value 01 05 08 01 00

Setting UB3

Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0


Divisor Set Set Even Parity Stop Word Word
Latch Break Parity Parity Enable Bits Length 1 Length 0

Bit 7 = 1 allows baud rate divisor to be changed. 0 baud rate change is


blocked. Bit 7 should not be set. The setting and resetting of this bit is
handled internally.

Bit 6 = 1 forces the transmitter output to a logic 0 for alerting the remote
receiver to a line break. 0 indicates no break condition.

Bit 5, 4 and 3 work together to set parity

Bit 5 Bit 4 Bit 3 Parity Selection


* * 0 No parity (default)
0 0 1 Odd parity
0 1 1 Even parity
1 0 1 Force parity “1”
1 1 1 Force parity “0”
*Don’t care state.

Bit 2, stop bit, works in conjunction with bits 1 and bit 0

Bit 2 Word Length (bits) Stop Bit Length


0 5,6,7,8 1 (default)
1 5 1½
1 6,7,8 2

6 HDV100A2 Command & Response Manual


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Bits 1 and 0 set the word length

Bit 0 Bit 1 Word Length


0 0 5
0 1 6
1 0 7
1 1 8 (default)

Default value. The HDV100A2 should always be set to 8-bit word length.

HDV100A2 Command & Response Manual 7


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Setting Baud 1, Baud 2

Baud Rate Setup Table

Baud Decimal Hex Divisor MSB Hex Divisor LSB


Rate Divisor (Baud 2) (Baud 1)
9600 48 $00 (default) $30 (default)
14400 32 $00 $20
19200 24 $00 $18
38,400 12 $00 $0C
57,600 8 $00 $08
115,200 4 $00 $04
230,400 2 $00 $02
460,800 1 $00 $01

All baud rates are entered as hex numbers. To calculate your own
decimal divisor use the following formula. The decimal number must be
converted to hexadecimal before entering the number. Baud rates below
9,600 are not recommended because of the difference in speed between the
vehicle bus and PC serial port. Additionally, baud rates faster than 115,200
baud are not supported.

The UART clock = 7,372,800 Hz

Decimal Divisor = Clock frequency ( 7,372,800)


Baud output x 16

If you want a baud rate of 9,600 baud


Decimal Divisor = 7,372,800
9,600 x 16

Decimal Divisor = 48 = 30 hex

Baud 1= 30
Baud 2= 00

8 HDV100A2 Command & Response Manual


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Baud Rate Example

To set the PC baud rate to 57,600 baud, N,8,1, format the message as
follows.

Byte Byte
Byte Function
Number Value
Hex
1 01 Start of frame
2 05 Number of control bytes
3 08 Command byte (08 = internal command)
4 01 Function Bbte (01 = change baud)
5 03 UB3
6 08 Baud 1
7 00 Baud 2
8 00 Number of data bytes
9 1A Checksum

The first byte is the start of frame and always 01. Next is the
number of control bytes (05). There are 5 bytes in the control section (in
gray). Byte number 3 sets the HDV100A2 to an internal operation (08).
Byte 4 is the internal function to be executed; (01) is the change baud
command. Bytes 5, 6, and 7 set the baud rate, parity, stop bits and word
length. Next is the number of data bytes, in this case there are no data bytes.
Last is the checksum, the value is the 8 bit addition of bytes 1 to 8.

HDV100A2 Command & Response Manual 9


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Time Stamp Information
The HDV100A2 supports a four-byte rolling time stamp with a
resolution of 1.5 microseconds per bit. The maximum time stamp value is
6,442.45 seconds before roll over. The 4-byte time stamp will be added to all
transmission from the bus. The time stamp will be added to the transmission
confirmation message.
The host application can request that the HDV100A2 send a time
stamp, formatted as follows.

Byte Byte Function


Number Value
1 01 Start of frame
2 02 Number of control bytes
3 08 ID byte 08 = internal command
4 02 Function code 02 = send time stamp
5 00 Number data bytes
6 0D Checksum

Reply from HDV100A2


Byte Byte Function
Number Value
1 01 Start of frame
2 05 Number of control bytes
3 0A ID 0A = time stamp
4 XX Time msb
5 XX Time msb-1
6 XX Time msb – 2
7 XX Time lsb
8 00 Data bytes 00
9 CS Checksum

The time stamp is attached to all messages received from the


vehicle bus as part of the control header. After the start of frame byte, the
number of control bytes, ID byte and the next 4 bytes are the time stamp.
The fourth byte is the MSB the seventh byte is the LSB.

Message time stamping is the default condition when the


HDV100A2 is placed in the smart mode. To stop the time stamp from being
added to the J1708 message, send the following command to the
HDV100A2.

10 HDV100A2 Command & Response Manual


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Byte Byte Function
Number Value
1 01 Start of frame
2 02 Number of control bytes
3 08 ID byte 08 = internal command
4 20 Function code 20 = stop time stamping
5 00 Number data bytes
6 2B Checksum

To resume time stamping send the following command:

Byte Byte Function


Number Value
1 01 Start of frame
2 02 Number of control bytes
3 08 ID byte 08 = internal command
4 10 Function code 10 = resume time stamping
5 00 Number data bytes
6 1B Checksum

Time stamping will resume after reset.

HDV100A2 Command & Response Manual 11


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Master Reset Command

The master reset command allows the HDV100A2 to be reset from the PC.
Sending this command resets the HDV100A2 to the default mode (dumb
mode). You will lose all setting sent in the smart mode.

Byte Byte Function


Number Value
1 01 Start of frame
2 04 Number of control bytes
3 08 ID byte 08 = internal command
4 08 Function code 08= master reset
5 01 Check byte
6 02 Check byte
7 00 Number data bytes
8 18 Checksum

Note after sending a master reset the baud rate is 9,600.

Vendor Information

To receive the vendor information from the HDV100A2 send hex (01, 01,
05, 00, 07) to the device. It will respond as follows:

Hex (01, 0B, 85, MM, DD, MA, M1, M2, MO, 00, VV, VV, 00, DB, CS)

0B = Number of control bytes


85 = Compatibility with other models
MM = Month firmware was created
DD = Day firmware was created
MA = Major firmware revision number
M1 = MSB of minor firmware revision
M2 = LSB of firmware revision
MO = Model
VV = Customer code 1
VV = Customer code 2
DB = Number of data bytes
CS = Checksum

12 HDV100A2 Command & Response Manual


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
J1708 Commands

Receiving Data from the J1708 Bus

After the HDV100A2 is set into its Intelligent mode of operation


and the RS-232 data rate is configured, you are now ready to communicate
with the J1708 bus. A receive command must be sent to the HDV100A2
before attempting to transmit to the bus. The receive message synchronizes
the HDV100A2 with the bus. To start receiving J1708 bus data, send the
following to the HDV100A2.

Byte Byte Value Byte Function


Number (hex)
1 01 Start of frame
2 02 The number of control bytes
3 01 ID byte 01= J1708
4 11 Function code 11 hex start receive
5 00 Number of data bytes (00 place holder)
6 15 Checksum (bytes 1 through 5 added together)

After sending this command to the device, the device will respond
with a confirmation message. The message confirms that the command was
received by the HDV100A2 and the checksum verified correctly. The reply
from the device is formatted as follows:

Byte Byte Value Byte Function


Number (hex)
1 01 Start of frame byte
2 01 Control byte
3 01 ID byte (ID of the sent message)
4 00 Number of data bytes
5 03 Checksum

The confirmation message is sent in response to a command sent to


the device. The ID byte and the check-sum will change with different
commands but the format will remain the same. If the checksum is not
correct an error message is sent. Its format is covered at the end of this
document.

To stop receiving data from the J1708 bus send the following
command to the HDV100A2.

HDV100A2 Command & Response Manual 13


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Byte Byte value Byte Function
number (hex)
1 01 Start of frame
2 02 The number of control bytes
3 01 ID byte 01= J1708
4 10 Function code 10 hex stop receive
5 00 Number of data bytes (00 place holder)
6 14 Checksum (bytes 1 through 5 added
together)

After sending this command to the device, the device will respond
with a confirmation message and data will cease. Note that there is the
possibility of an incomplete message being sent to the PC after sending this
command. Use the check-sum to verify all messages.

To restart reception, send the (01, 02, 01, 11, 00, 15) command to
the HDV.

14 HDV100A2 Command & Response Manual


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Transmitting Data to the J1708 Bus

The HDV100A2 supports standard J1708 commands of up to 21


bytes. Additionally the HDV100A2 can send messages up to 100 bytes to
the J1708 bus. It is the responsibility of the sending software to check for
“ignition off” before using the J1708 bus to send messages with more than
21 bytes to the bus. Failure to check for a “quiet bus” condition before
transmitting a long message may cause erratic bus operation. The format to
send information to the J1708 bus is shown below:

Byte Byte Value Byte Function


Number (hex)
1 01 Start of frame
2 03 Number of control bytes
3 01 ID bytes 1= J1708
4 12 Function code 12 (hex) transmit to J1708 bus
5 02 Priority byte 00000010 set bit 0 to 7 see below
6 XX Number of data bytes to follow (excludes checksum byte)
YY Data bytes up to 100 bytes
CS Checksum

Set the priority bit using the chart below.

Priority Byte Value Binary Value Hex Value


1 00000001 01
2 00000010 02
3 00000100 04
4 00001000 08
5 00010000 10
6 00100000 20
7 01000000 40
8 10000000 80

HDV100A2 Command & Response Manual 15


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
After sending a transmit message to the HDV100A2 you will get
the confirmation message if the checksum is correct. A transmit complete
message is sent to the PC after the device successfully transmits the message
to the J1708 bus. A second message should not be sent to the device before
confirming that the first message has been sent. The transmit confirmation is
formatted as follows:

Byte Number Byte Value Byte Function


(hex)
1 01 Start of frame
2 01 Number of control bytes
3 09 ID bytes 9 = transmit OK
8 00 Number of data bytes
9 0B Checksum

16 HDV100A2 Command & Response Manual


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
J1708 Message Filter
The J1708 message filter will operate on 4 different MID’s. Only messages
with the same MID as set in the filter will be sent to the PC. The filters will
be OR’ed together so that multiple MID’s can be filtered, MID1 or MID2 or
MID3. The format for the setting of J1708 filtering is as follows:

Set Filter Active


Byte Byte Function
Number Value
1 01 Start of frame
2 03 Control bytes
3 01 ID byte 1 = J1708 message
4 X9 Set filter 9 = Set filter active X = filter number 1 to 4
5 XX Value of MID to filter On
6 00 Data bytes
7 CS Checksum

Set Filter Off


Byte Byte Function
Number Value
1 01 Start of frame
2 02 Control bytes
3 01 ID byte 1 = J1708 message
4 X8 Set filter 8 = Set filter inactive X = filter number 1 to 4
6 00 Data bytes
7 CS Checksum

Setting all filters off will stop all data from the J1708 bus. When all filters
are set off you must send the receive J1708 command to start receiving all
bus messages.

HDV100A2 Command & Response Manual 17


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Broadcast Message

The HDV100A2 supports one broadcast message. Once configured by the


host application, this message will be sent repeatedly by the HDV100A2 at a
programmed time interval. This feature is useful to provide a “heartbeat”
function to the J1708 bus with no overhead to the host application’s
software. Sending 0 in the time value stops the broadcast message from
being sent.

To start a broadcast message the time interval, message slot,


priority, number of data bytes, and the data must be sent to the HDV100A2.
Once sent, the HDV100A2 will send the message out on the bus at the
specified interval. Existing bus traffic or any bus messages sent to the
HDV100A2 from the host application take priority over a pending broadcast
message.

Once a broadcast message is started the “Stop Broadcast 07”


message must be sent before any changes to the broadcast message can be
made. Changing from one time value (17) to another (37) without stopping
the broadcast will cause the HDV100A2 to act erratically.

Byte Byte Function


Number Value
1 01 Start of frame
2 04 Control bytes
3 01 ID byte 1 = J1708 message
4 X7 Set broadcast 7 = On X = Time interval (see chart)
5 0X Message slot number (01 only active at this time)
6 PP Priority (see chart below)
7 YY Data bytes
DATA From 4 to 21 bytes
CS Checksum

18 HDV100A2 Command & Response Manual


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
To stop broadcast transmission it is not necessary to send the whole
message. The message below will stop broadcast transmission.

Byte Byte Function


Number Value
1 01 Start of frame
2 02 Control bytes
3 01 ID byte 1 = J1708 message
4 07 Set broadcast 7 = On X = Time interval (see chart)
7 00 Data bytes
8 0B Checksum

Byte 4 Values
Byte Time
Value Value
07 Stop broadcast
17 .5 sec.
27 1.0 sec
37 1.5 sec
47 2.0 sec

Byte 6 (Priority) Values


Byte Value Byte Value Priority
(hex) Binary

01 00000001 1
02 00000010 2
04 00000100 3
08 00001000 4
10 00010000 5
20 00100000 6
40 01000000 7
80 10000000 8

HDV100A2 Command & Response Manual 19


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
J1939 Commands

The J1939 protocol is similar to the J1708 protocol.

The message starts with Start of Frame byte 01. The number of
control bytes will be 06. The control code for J1939 is 02. The function
codes (XX) are as follows:
00=Sets receive function off
01=Sets receive on
02=Transmits a message with data
04=Set mask
19=filter 1 set on
18=filter 1 set off
29=filter 2 set on
28=filter 2 set off
39=filter 3 set on
38=filter 3 set off
49=filter 4 set on
48=filter 4 set off

Function codes are shown in detail below.

Before operating the HDV100A2 in the J1939 mode it is


recommended that the baud rate be set to 115.2kb. This is done by sending
the following code: (01, 05, 08, 01, 03, 04, 00, 00 16). After sending this
command the baud rate of the sending device (PC) must also be changed.

Because of the difference in baud rates between the J1939 bus and
the RS-232 serial bus, the HDV100A2 may miss messages on the J1939 bus.
This depends on bus load, message length, and filter settings.

Sending any message with a control code of (02) to the J1939 bus
stops the operation on the J1708 bus. If you wish to restart operation on the
J1708 bus you must send the start J1708 reception message (01, 02, 01, 11,
00, 15). Sending this message stops operation on the J1939 bus.

Function codes 00 and 01, Receive OFF, ON operate together to control a


receive register. Sending the command (01, 02, 02, 01, 00, 06) starts
reception on the J1939 bus. This command resets the filter mask to all zeros
(don’t care). All bus traffic is then received. However, it may not be possible
to send all messages to the PC side. Any message that is not serviced before
the next message is received will be overwritten by the new message.
Sending the command (01, 02, 02, 00, 00, 05) turns off the receiver. It is

20 HDV100A2 Command & Response Manual


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
wise to set the receiver off when not in use. Sending the Start Receive clears
the mask. This renders the filter function useless.

Start Receive on J1939 Bus


Byte Byte Function
Number Value
1 01 Start of frame
2 02 Control bytes
3 02 ID byte 02 = J1939 message
4 01 Function code 01 start reception
5 00 Data bytes
6 06 Checksum

Stop Receive on J1939 Bus

Byte Byte Function


Number Value
1 01 Start of frame
2 02 Control bytes
3 02 ID byte 02 = J1939 message
4 00 Function code 00 stop reception
5 00 Data bytes
6 05 Checksum

HDV100A2 Command & Response Manual 21


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Data messages received from the HDV100A2 operating in the J1939 mode,
is formatted as follows:

Control Field Data Field


Start # of Contr Time Stamp # of Arbitration # of Bus Data Check
of Control Byte 4 Bytes Data Field Data Up to 8 Bytes sum
Frame bytes Bytes Bytes
in
Message
01 05 02 msb lsb ZZ Y1 Y2 Y3 Y4 0X

The message starts with 01. The number of control bytes is 05. Next is the
control byte 02, followed by the time stamp, four bytes, with msb first. The
number of data bytes is the number of bytes to follow excluding itself and
the checksum byte. Next is a four byte that contains the arbitration field.
J1939 divides this field for different functions show in the chart below. The
number of data bytes sent by the bus is next. This will be a value between 0
and 8. Next is the bus data followed by the checksum byte.

Arbitration Field (Y1, Y2, Y3, Y4)


The first byte Y1 contains the most significant bits in the J1939 arbitration
field. It is followed by Y2, Y3 and Y4. J1939 assigns different function to
the arbitration field that must be observed by the user. There is a work sheet
included on page 33 to help set up this field.
Arbitration Byte Y1 Y2 Y3 Y4
Arbitration Bit 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0

J1939 Arbitration Field 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1


Bit Position
J1939 Function Priority R D PDU Format PDU Specific Source Address
bits P

22 HDV100A2 Command & Response Manual


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
A message received from the HDV will be formatted as follows:
<01><05><02><06><C7><CC><ED><0D><67><80><20><00><08><F0><7D><DA><00><
00><FF><FF><DA><C9>
The < > are placeholders and are NOT transmitted with the data.
** = value changes with message.

Byte Byte Function


Number Value
1 01 Start of frame
2 05 Control bytes
3 02 ID byte 02 = J1939 message
4 06 Time stamp MSB **
5 C7 Time stamp MSB –1 **
6 CC Time stamp MSB –2 **
7 ED Time stamp LSB **
8 0D Number of data bytes to follow (13 dec) **
9 67 First byte of arbitration field **
10 80 Second byte of arbitration field **
11 20 Third byte of arbitration field **
12 00 Fourth byte of arbitration field **
13 08 Number of data bytes in bus message **
14 F0 Data bytes **
15 7D Data bytes **
16 DA Data bytes **
17 00 Data bytes **
18 00 Data bytes **
19 FF Data bytes **
20 FF Data bytes **
21 DA Data bytes **
22 C9 Checksum **

Function code 02 sends data to the J1939 bus.


The transmit code is set up as follows: (01, 06, 02, 02, XX, XX, XX, XX,
DD, YY, YY, YY, YY, YY, YY, YY, YY, CS). The header starts with 01.
There are six control bytes (06). The control code is (02). The transmit
command is (02). The arbitration field is filled out as shown above. There
is also a worksheet to help fill out this field. Next is the number of data bytes
in the data payload. The data payload for the message is entered in the data
field. After a transmission is successfully sent out and confirmed by at least
one active node, an acknowledge message is sent to the PC
(01, 01, 02, 00, 04). There is a form on page 33 to help set up the arbitration
field.

HDV100A2 Command & Response Manual 23


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Transmit Data to J1939 Bus

Byte Byte Function


Number Value
1 01 Start of frame
2 06 Control bytes
3 02 ID byte 1 = J1708 message
4 02 Function byte 02 transmit message
5 XX MSB of arbitration field (J1939 priority bits)
6 XX MSB-1
7 XX MSB-2
8 XX LSB of arbitration field (J1939 source address)
9 DD Number of data bytes
DATA From 0 to 8 bytes
CS Checksum

Set Mask

Function code 04 set mask. The mask is applied to ALL filters. The mask is
32 bits long. The last 3 bits are not used and must be set to zero. This mask
covers the 29-bit arbitration field. To use the filter function, the mask must
be set. The mask determines what position(s) will be tested and matched to
the incoming message. If a 1 is set in a particular position, that position will
be tested. It will be “and” with any active filters to determine if the message
will be passed to the PC side. Any position marked with a 0 is a “don’t
care” position and will pass all data in that position. There is a form on page
33 that helps set up the mask for the arbitration field.

Byte Byte Function


Number Value
1 01 Start of frame
2 06 Control bytes
3 02 ID byte 02 = J1939
4 04 Function byte 04 set mask
5 XX MSB of arbitration field (J1939 priority bits)
6 XX MSB-1
7 XX MSB-2
8 XX LSB of arbitration field (J1939 source address)
9 00 Number of data bytes
10 CS Checksum

24 HDV100A2 Command & Response Manual


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
The mask can be used to look at a group of messages:
To set the mask to filter on the J1939 priority field, the mask would be
loaded with:
(01, 06, 02, 04, E0, 00, 00, 00, 00, ED)
To set the mask to filter on the J1939 PGN field, the mask would be loaded
with:
(01, 06, 02, 04, 07, FF, F8, 00, 00, 0B)
To set mask to filter on both the priority field and the PGN field the mask
would be loaded with:
(01, 06, 02, 04, B7, FF, F8, 00, 00, BB)

Set Filter 1 to 4

Function codes 18 and 19, 28 and 29, 38 and 39, 48 and 49 are filter pairs.
These filters are set by sending the desired arbitration code to each filter, 1
to 4. The filters work with the mask function. If the mask is set to zero in a
position (don’t care) the value of the filter in that position doesn’t matter.
The filter arbitration field is set to match the aberration code of the incoming
message. A match of the filter “and” the mask will pass the message to the
PC. The X9 sets the filter On; X8 sets the filter Off, where X=1 through 4.
Important: the receiver and each filter must have a different arbitration
code. If the receiver and a filter are given the same arbitration code the
controller may become erratic. It will need to be powered-off reset to
recover from this error.

Byte Byte Function


Number Value
1 01 Start of Frame
2 06 Control bytes
3 02 ID byte = J1708 message
4 YY Function byte (18 or 19) (28 or 29) (38 or 39) (48 or 49)
5 XX MSB of arbitration field (J1939 priority bits)
6 XX MSB-1
7 XX MSB-2
8 XX LSB of arbitration field (J1939 source address)
9 00 Number of data bytes
10 CS Checksum

To use the HDV100A2, the filter for a particular J1939 PGN the following
procedure must be followed.

HDV100A2 Command & Response Manual 25


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
1. Turn off the “Receive” function by sending (01, 02, 02, 00, 00, 05).

2. Set the “Mask” to the desired pattern (01, 06, 02, 04, XX, XX, XX, XX,
00, CS).

3. Set a filter (1 to 4) to the match value (01, 06, 02, YY, XX, XX, XX, XX,
00, CS). Be sure that this is NOT the same as any other filter value or the
HDV100A2 may become erratic.

4. Sending this value to the HDV100A2 will continuously send this match to
the PC.

Note that sending the “ Start Receive” or the “Stop Receive” command
resets the mask rendering the filters useless.

26 HDV100A2 Command & Response Manual


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
J1939 Header Worksheet

This worksheet will aid in filling out/decoding the J1939 arbitration field.

Bit J1939 CAN Frame Hex


Number Function Entry Value
29 Priority Bits Byte 1
28
27
26 Reserved 0
25 Data Page 0
24 PDU-Format
23 (PGN Byte 2)
22
21 Byte 2
20
19
18
17
16 PDU Specific
15 (PGN Byte 3)
14
13 Byte 3
12
11
10
9
8 Source Address
7
6
5 Byte 4
4
3
2
1
0
0
0

HDV100A2 Command & Response Manual 27


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Error Codes

Error Code Format:


Byte Number Byte Value Function
1 01 Start of frame
2 03 Number of control bytes
3 05 Function code error = 05
4 XY ID of message that caused error
5 0Z Error code (see chart below)
6 00 Number of data bytes
7 CS Checksum

Error Code Type of Error Meaning of Error Generated


Generated
DEC HEX
1 1 Gen Inbuffer overflow; more than 127 bytes
2 2 Gen Checksum mismatch
3 3 Gen Protocol error; function, ID, code bad
4 4 J1708 J1708 input buffer full missed bus message
5 5 J1708 J1708 command unknown
6 6 J1708 J1708 output buffer full
7 7
8 8 J1939 Bus off
9 9
10 A J1708 J1708 inbuffer overflow more than 127 bytes
11 B
12 C
13 D
14 E
15 F

28 HDV100A2 Command & Response Manual


B&B Electronics -- 707 Dayton Rd. -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104

You might also like