Skip to content

J1939

J1939 is a CAN-based layer 7 protocol mainly used in Truck and Bus control and communications. The typical properties of J1939 are:

  • 29 bit extended CAN identifier.
  • Point-to-point and broadcast communication.
  • Transmission up to 1785 bytes.

J1939_Architecture.bmp

J1939 Protocol Stack

PGN identifies the Parameter Group (PG). PGs point to information of parameter assignments within 8 byte CAN data field, repetition rate and priority. The structure of PGN allows a total of 8672 different Parameter Groups per page – 2 pages are available.

J1939_PGN.bmp

Parameter Group Number

Transport protocol functions are mainly used for transmission and reception of multi-packet messages which can extend upto 1785 bytes. Function involves packaging into sequence of 8 byte size messages during transmission, re-assemble of such data at the receiver side.

A broadcast message is broadcasted to all nodes in the network. Sender node must first send a Broadcast Announce Message (BAM) followed by sequence of 8 byte data. Receiving nodes can prepare for reception if interested.

BAM message contains following information.

  1. PGN to be sent

  2. Size of multi-packet message

  3. Number of packages

J1939_BAM.bmp

Multi-packet broadcast data transfer

For destination specific data transmission, communication needs to be established hence subject to flow control. Transport protocol function is applied in three steps.

1. Connection Initialization - The sender of a message transmits a Request to Send message. The receiving node responds with either a Clear to Send message or a Connection abort message incase it decides not to establish connection.

2. Data Transfer - Sender transmits data after receiving Clear to Send message.

***3. Connection Closure -***The receiver of the message , upon reception sends End of Message ACK message.

J1939_PEER_2_PEER.bmp

Multi-packet peer-to-peer data transfer

Each ECU in a J1939 network must hold at least one NAME and claim one 8 bit address for identification purposes.

***1. ECU NAME -***64 bit identifier includes an indication of the ECU’s main function performed at the ECU’s address.

J1939_ECU_NAME.bmp

J1939 NAME Fields

***2. ECU Address -***8-bit ECU address defines the source or destination for messages.

The address claim feature considers two possible scenarios

***1. Sending an address claimed message (ACL) -***At the network startup, an ECU will cliam an address and send Address Claimed message. All ECUs receiving the address claim will record and verify the newly claimed address with their internal address table. In case of an address conflict, the ECU with the lowest NAME will succeed.

***2. Request for Address Claimed message -***An ECU Requests ACL message from all nodes in the network and claims available address.### BUSMASTER.J1939

Prerequisite of employing the J1939 functionalities is getting hold of J1939 interface, and this is the sole purpose of this function. This will query for the available J1939 interface. Once this is available, the associated menu item and button will be disabled. The query operation involves DIL.J1939 interface initialisation, a J1939 client registration and finally the J1939 logger interface query and initialisation. Outcome of the query operation can be seen on the Trace window.

This invokes the logging configuration dialog box whose layout and the configuration procedure is exactly same as that of CAN. Only difference is that for J1939 a message is identified not by CAN identifier, but by its PGN number.

This function connects the application to the J1939 network. Both the associated menu item and toolbar icon are toggling in nature and hence shuttle between “Go Online” and “Go Offline” modes.

This brings in the J1939 transmit message window in which the presently transmittable message can be configured and sent in both monoshot and cylcic mode.

J1939_TransmitWnd.bmp

J1939 Transmit Message Window

By selecting the associated menu item or clicking on the toolbar icon, the user can start the logging process. This has the characteristics of a toggle switch and hence using the same, ongoing logging process can be stopped too.

J1939_LogFile.bmp

J1939 Log File

J1939 database editor is similar to CAN database editor. User can define a new message based on its PGN and it can have maximum data size of 1785 bytes.

J1939_DB_EDITOR.bmp

User can associate/dissociate J1939 database files.

J1939_DB_FUNCTIONS.bmp

J1939 features can be accessed from the below options.

J1939_Toolbar.bmp

User can configure timeouts which will be considered when flow control messages are being sent or received.

Corresponding dialog box can be invoked by clicking the menu J1939 –> Timeout Configuration.

Timeout’s description will appear on clicking the corresponding check box.

J1939_ConfigureTimeouts.bmp

**Tb:**Time interval between two packets in broadcast transmission.

**Tr:**Maximum wait period for a sender to receive a response from the receiver.

**Th:**Time interval between two ‘Clear to Send’ message when delaying the data.

**T1:**Maximum wait period for a receiver when more packets were expected.

**T2:**Maximum wait period for a receiver to receive data packets after sending ‘Clear to Send’ message.

**T3:**Maximum wait period for a sender to receive ‘End of Message Acknowledgement’ after sending last data packet.

**T4:**Maximum wait period for a sender to receive another ‘Clear to Send’ message after receiving one to delay the data.

J1939 signal watch window is similar to CAN signal watch window. User can add SPNs(Signals) of the PGN defined in database.

Seperate menu items are available for configuring J1939 node programming. Use ‘J1939 –> Node Simulation –> Configure’ menu for configuring nodes. Most of the features of J1939 node programming remain same as that of CAN. Few differences are listed down.

**1. Node Addition :**User has to provide following information to create a new node.

a. Node Name b. Preferred Address c. 64 bit ECU name.

J1939_NODE_DETAILS.bmp

**2. Function Editor :**J1939 Function Editor is similar to CAN Function Editor. In addition to the handlers available in the CAN Function Editor it has Event Handlers where user can configure

  • **Data confirmation event :**Handler is executed whenever a long(> 8 bytes) message is transmitted.

void OnEvent_DataConf(UINT32 unPGN, BYTE bySrc, BYTE byDest, BOOL bSuccess);

unPGN - PGN of the message transmitted. **bySrc -**Source node. **byDest -**Destination node. bSuccess - Result of transmission. ( TRUE-success, FALSE-failure)

  • **Address confirmation event :**Handler is executed whenever a node claims or loses an address.

void OnEvent_AddressClaim(BYTE byAddress) ;

**byAddress -**New Address claimed by the node. Address lost If the value is 254.

Note: These event handlers are always enabled once added.

J1939_EVENT_HANDLERS.bmp

**3. J1939 API Reference :**A new set of API is introduced in-order to perform functions on J1939 bus. Please refer following section API Reference J1939 for further details.

J1939_API_SET.bmp


Authoritative source: BUSMASTER DITA help source J1939.dita, compiled into BUSMASTER.CHM with the application.