RS-232 to J1939 Converter CE Model 1939STB Documentation Number 1939STB4600 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: orders@bb-elec.com -- Fax (815) 433-5109 Technical Support e-mail: support@bb-elec.com -- Fax (815) 433-5104 European Headquarters B&B Electronics Ltd. Westlink Commercial Park, Oranmore, Co.
Table of Contents INTRODUCTION ...................................................................................... 1 SAE Publications.................................................................................. 1 WARNING!................................................................................ 2 DESCRIPTION ............................................................................................. 3 Physical Description ......................................................................
Introduction SAE-J1939 is a communication protocol developed by SAE (Society of Automotive Engineers). The communication protocol is based on the CAN specification developed by Bosch 2.0 part B (September, 1991). Before using the Model 1939STB the user should be familiar with the SAE publications listed below, and follow all the guidelines before attempting to connect to an active J1939 network. The SAE-J1939 specifications are guidelines.
WARNING! This Model 1939STB Converter Module allows you to connect to active SAE J-1939 networks. It is possible that your transmissions through this converter module could cause malfunction of the network operation, damage to the 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.
Description The 1939STB is an interface device allowing the user to connect a PC to an SAE-1939 bus via a serial port. The 1939STB conforms to the Physical Layer specification as set forth in SAE-J1939/11. The 1939STB allows the reception and transmission of messages over an SAE-J1939 standard bus. This converter has 14 message “slots” that can be configured for either reception or transmission. A sample program is provided to aid in the setup of the interface.
Physical Description Length: Width: Height: Serial Connection: SAE-J1939 Connection: Power Connection: Temperature: 5.25 in. (134mm) 2.75 in. (70mm) 1.00 in (25.4mm) DB-9 female, DCE Terminal block, CAN HIGH/CAN LOW Terminal block, POWER/GND 0 to +70 degrees Centigrade Electrical Specification Input Power Requirement: 10 to 42 volts DC, 1 Watt max. Meets Physical Layer SAE-J1939/11 Fully compatible with ISO 11898-24v standard RS-232 driver meets EIA-232-E and V.
Communication directed to the device Format: Message header B B B B 1 2 3 4 B 5 8 1 9 5 2 1 1 F 0 5 Table 1. J1939STB Format Message Information B B B B B B B B 6 7 8 9 1 1 1 1 0 1 2 3 E 0 8 0 4 8 4 4 7 c 0 0 0 c 1 2 B 1 4 4 3 Data Payload B B B 1 1 1 5 6 8 4 4 4 4 5 6 B 1 9 4 7 B 2 0 4 8 All communications to the device start with a message header (white area). This header is removed from any message sent to the J1939 bus. The header is four bytes long.
Control Byte 3 Byte 3 directs the data packet to the proper destination. The setting of this byte will affect the rest of the message. That is to say changing this byte changes the meaning of the following data bytes. Bit 7 Table 3. Bits of Byte 3 Nibble 1 Bit 4 Bit 3 Bit 2 Bit 1 Nibble 2 Bit 6 Bit 5 Bit 0 Byte 3 has two parts, Nibble 1 and Nibble 2. Nibble 2 (bits 4 – 7) sets the control code as follows: Bit Number Bit 7 Table 4.
Control Byte 4 When control byte 3 is set to “external commands” (bit 4 set to 1), nibble 1 of control byte 4 is used to tell the J1939 in which message slot location (1 through 15) to place the message data. NOTE: Message location number 15 is receive only. Table 7.
Internal Functions While most of the information sent and received from the 1939STB will be transferred to the J1939 bus, the internal function codes allow the user to set up the serial port, and receive an identity string from the 1939STB. The identity string may be used to verify that the 1939STB is connected and working properly. Vendor String The vendor string function is sent to the 1939STB as shown in the table below.
RS-232 Baud Change Setting byte-3/nibble-2 to 2 and byte-4/nibble-1 to 2 causes the 1939STB to change baud. This function also requires 3 bytes of additional information bytes 5, 6, and 7. It is important to note that after a baud change the PC must have its baud changed to match the baud of the 1939STB for communication to exist.
RS-232 Baud Rate Change - cont’d. All baud rates are entered as hex numbers. To determine the decimal divisor use the following formula. The decimal number must be converted to hexadecimal before entering the number into byte 6 and 7. Baud rates faster than 57,600 are not supported.
RS-232 Baud Rate Change cont’d. Baud Change; Parity, word length, stop bits. Byte 5 (UB3) UB3 sets the LCR register on the UART Table 14. Byte 5 (UB3) Bit 7 Divisor latch Bit 6 Set break Bit 5 Set parity Bit 4 Even parity Bit 3 Parity enable Bit 2 Stop bits Bit 1 Word length 1 Bit 0 Word length 0 Bit 7 = 1 allows baud rate divisor to be changed. 0 baud rate change is blocked. Bit seven should not be set. The setting and resetting of this bit is handled internally.
RS-232 Baud Rate Change cont’d. Bit 2 stop bit works in conjunction with bits 1 and bit 0. Table 16. Stop Bit Setup Bit 2 0 1 1 Word length (bits) 5, 6, 7, 8 5 6, 7, 8 * Setup default value. Stop bit length 1* 1½ 2 Bits 1 and 0 set the word length. Table 17. Word Length Bit 1 0 0 1 1 12 Bit 2 Word length 0 5 1 6 0 7 1 8* * Setup default value.
External Commands The SAE-J1939 format is based on the CAN extended data frame. A detailed breakdown of the data frame is shown in Appendix A. The arbitration field is changed to conform to the SAE-J1939 message frame. The message frame must be broken down further before it can be sent to the 1939STB. The format for transmitting data to the 1939STB is shown in the following table: Table 18.
Message Header Setup Before a message can be sent to the SAE-J1939 bus, the message header must be configured to direct the data correctly. The following table shows the bytes that must be set to direct a message to the SAE-J1939 bus. Table 19. J1939 Message Header Message Header B B B B 1 2 3 4 81 21 1F 05 The first two bytes are for the start of message. The third byte (B3) containing hex 1F,1 directs the message to the J1939 bus. (F) hex is the number of bytes in the payload.
Message Information Table 22. J1939 Message Information Message Information B B B B 5 6 7 8 95 E7 0C 80 B 9 00 B 10 40 B 11 8C The message information controls the action of the message. It also contains the header information that will be sent out on the J1939 bus. The bytes that control the message and are not transmitted to the bus are grayed in. Byte 5 and 6 are the message control bytes. They work together to control the message.
Byte 5 Table 24. Byte 5 Bit Function Sets the message valid Sets the message invalid Transmit interrupt set Transmit interrupt not set Receive interrupt set Receive not set Interrupt has occurred No interrupt pending Bit 7 Bit 6 MSGVAL 1 0 0 1 Bit 5 1 0 Byte 5 Bit 4 Bit 3 Bit 2 TXIE RXIE Bit 1 Bit 0 INTPND 0 1 1 0 0 1 1 0 NOTE: The dark gray (white letters) should be set to this value when sending a new message to the 1939STB. MSGVAL Bits 6 and 7 Message Valid.
Byte 6 Table 25. Byte 6 Bit Function Remote Pending Bit 7 Bit 6 RMTPND 1 0 0 1 Transmit Request Message lost/ CPU update Byte 6 Bit 5 Bit 4 Bit 3 Bit 2 TXRQ MSGLIST/CPUUPD 1 0 Bit 1 Bit 0 NEWDAT 0 1 1 0 0 1 New data in message slot 1 0 NOTE: the dark gray (white letters) should be set to this value when sending a new message to the 1939STB. RMTPND Bits 7 and 6 Remote Pending (used for messages that are to be transmitted).
NEWDAT Bits 1and 0 Indicates if new data has been written into this slot by either the bus controller (receive messages) or the controller (transmit objects). Byte 11 Table 26. Byte 11 Bit Function Bit 7 Byte 11 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 DIR XT D DLC Number of data bytes (0 to 8) Message direction: Transmit Message direction: Receive Extended identifier must be 1 Bit not used set to 0 Bit not used set to 0 Bit 1 1 0 1 X X DLC Bits 7, 6, 5 and 4 Data length code.
SAE-J1939 Control Header Bytes 7 though 10 are the bytes that set the header information (“Arbitration Field” in the following table) for the SAE-J1939 bus. The areas shown in Table 27 in dark gray are set by the CAN specification and are NOT modified by SAE-J1939. Table 27.
20 1939STB4600 Manual B&B Electronics Mfg Co Inc – 707 Dayton Rd - PO Box 1040 - Ottawa IL 61350 - Ph 815-433-5100 - Fax 815-433-5104 B&B Electronics Ltd – Westlink Commercial Park – Oranmore, Galway, Ireland – Ph +353 91 792444 – Fax +353 91 792445
Byte 7 (Shown in Table 29) Bits 7, 6, and 5 of byte 7 set the J1939 priority bits. Bit 7 is the MSB. Bit 5 is the LSB. To code a priority value = 6 set bit 7 = 1 bit 6 = 1 bit 5 = 0. Bit 4 is the reserved bit - the J1939 specification sets this bit to zero. It may be used in the future therefore it is NOT hard coded. The user must set this bit to zero for every transmitted J1939 message. Bit 3 is the data page bit and select page 0 or page 1and is set by the user.
22 1939STB4600 Manual B&B Electronics Mfg Co Inc – 707 Dayton Rd - PO Box 1040 - Ottawa IL 61350 - Ph 815-433-5100 - Fax 815-433-5104 B&B Electronics Ltd – Westlink Commercial Park – Oranmore, Galway, Ireland – Ph +353 91 792444 – Fax +353 91 792445
Byte 8 (Shown in Table 30) Bits 7, 6, 5, 4, and 3 of Byte 8 along with Bits 2, 1, and 0 of Byte 7 make up the first part of the PDU (Protocol Data Unit). The first 8 bits are the PDU format. The values for specific formats will have to be supplied by the user. Bits 2, 1, and 0 of Byte 8 and bits 7, 6, 5, 4, and 3 of Byte 9 make up the second part of the PDU. The eight bits are the PDU specific. Values for the PDU specific will have to be supplied by the user .
24 1939STB4600 Manual B&B Electronics Mfg Co Inc – 707 Dayton Rd - PO Box 1040 - Ottawa IL 61350 - Ph 815-433-5100 - Fax 815-433-5104 B&B Electronics Ltd – Westlink Commercial Park – Oranmore, Galway, Ireland – Ph +353 91 792444 – Fax +353 91 792445
Bytes 9 and 10 (Shown in Table 31) Bits 7, 6, 5, 4 and 3 complete the PDU. Bits 2, 1, and 0 of byte 9 and bits 7, 6, 5,and 4 of byte 10 are the Source Address for the converter. Each Source Address MUST be unique. SAE J1939-81 describes address management and allocation in detail and should be consulted before connecting to a J1939 bus. Addresses 249 and 250 are designated for offboard diagnostic service tools. WARNING: These addresses are SUGGESTED.
26 1939STB4600 Manual B&B Electronics Mfg Co Inc – 707 Dayton Rd - PO Box 1040 - Ottawa IL 61350 - Ph 815-433-5100 - Fax 815-433-5104 B&B Electronics Ltd – Westlink Commercial Park – Oranmore, Galway, Ireland – Ph +353 91 792444 – Fax +353 91 792445
Byte 11 Table 32. J1939 Message Information Message Information B B B B B B B 5 6 7 8 9 10 11 95 E7 0C 80 00 40 8C Table 33. J1939 Message Control Message Information B B B B B B 5 6 7 8 9 10 95 E7 0C 80 00 40 B 11 8C Byte 11 Byte 11 is not sent to the J1939 bus and is coded as follows: Bit 7 DLC Bit 6 Table 34. Byte 11 DIR Bit 5 Bit 4 Bit 3 XTD Bit 2 Bit 1 Bit 0 DLC Data Length Code Number of bytes 0 to 8 in the data payload. DIR Message Direction DIR = 1 transmit.
Data Field The next 8 bytes are the data field and can have from 0 to 8 bytes used. This is the data payload. Table 35. J1939 Message Frame Arbitration Field S O F 1 Identifier (11 bits) 11 bits S R S 1 I D E 1 Identifier Extension (18 bits) 18 bits Control R T R 1 R 1 R 0 6 bits Data CRC ACK EOF 64 bits 16 bits 2 bits 7 bits D L C The remaining fields are handled by the controller and are not accessible through the converter.
Reception of Data The 1939STB sends data to the RS-232 port and onto the PC using a 16 byte format. The first byte of the message is 42hex. The next byte is the Function byte. The next field displays the SAE-J1939 header. If an internal message is received then this field is filled with zero. The receive message header is detailed below. I D 4 2 Func 4 2 28 09 Table 36.
Function This is used to show where the message came from. Refer to Table 37. If the Nibble 2 is set to 0, then the message is from the J1939 bus. If Nibble 2 is set to 2, it is an internal message (for example, Vendor ID). Bit 7 Table 38. MC Nibble 2 Bit 6 Bit 5 Bit 4 Bit 3 Nibble 1 Bit 2 Bit 1 Bit 0 MC This is a byte from the controller. Nibble 2 is the number of data bytes (08) in the message. Nibble 1, Bit 3 is the message direction. Bit 2 should always be set to 1. Bit 1 and 0 are not used.
Internal Messages I D 4 2 Func 4 2 28 09 Table 39. Message Received from the SAE-J1939 Bus J1939 Address M Data C C 80 00 40 1 41 42 43 44 45 46 47 E 0 0 00 00 00 00 48 A A A A Table 39 shows the data received from the J1939 bus highlighted in gray. The bytes (C,80,00,40) are the J1939 priority, reserve bit, data page, and PDU. The data field contains the data payload of the message and be from 0 to 8 bytes. The message starts with 42 hex. The function code is 28 hex.
Software The program included with the 1939STB is a Visual Basic program that allows the transmission and reception of simple messages from the SAEJ1939 bus. The source code for the program is included on the disk to aid in program development. Installation Two disks are provided with the 1939STB. Disk one is installed first. Start Windows and insert the disk in A: drive. Click on the Start icon. Then click on the Run icon. In the box type “a:setup”. Follow the screen instructions.
This screen is divided into two parts. The upper half of the screen allows the user to fill out the individual bytes that configure the 1939STB. The lower part of the screen displays data received from the 1939STB.
Message Transmission (sending data to the 1939STB) The transmission window is divided into three rows. The first row is the internal header information. The second row contains message control information. The third row is the data payload sent with the information. The first row has 4 bytes. Bytes 1 and 2 are set to 8 and 21 hex. All data is entered in hex. The next two bytes, 3 and 4, are set by the user. Refer to pages 6 and 7 of this manual for help setting theses two bytes.
Saving Message Information To save a configuration: “the byte data” Click on File at the top of the page. When the box opens click on Save. When the next box opens select a directory where the file should be stored and name the file. Click Save. The file is saved. To recall the information in a previously saved file use the File import command. Select the name of the file you wish to use. Click on Open. The data will be loaded into the Transmit window.
Appendix A.
Arbitration Field S O F X X X X X X Priority 3 Bits 1 1 0 R 1 * 0 1 2 4 5 7 6 Byte 7 5 4 D P PDU Format (PF) 8 Bits 0 1 1 1 1 0 0 6 7 8 9 10 11 12 3 2 1 0 Byte 8 7 6 5 S R S X X X X X X I D E X X X X X X PF Cont. PDU Specific 8 Bits Source Address 8 Bits (See note below.) 0 0 0 0 0 0 0 1 1 0 13 14 15 16 17 18 19 20 21 22 0 7 6 5 Byte E 8 cont.
Appendix B. Example This example uses the SAE “Electronic Axle Controller #1” (EAC#1). The specifications are as follows: Transmission Repetition Rate: Data Length: Data Page: PDU Format: PDU Specific: Default Priority: Parameter Group Number: Source Address: S O F X X X X X X Priority 3 Bits 1 2 3 R 1 * 1 1 2 4 5 6 1 Byte 7 5 4 0 0 7 1 D P 500 ms 8 bytes 0 240 5 6 61,446 (00F006) hex 249 (off-board diagnostic / service tool #1). See note below.