Understanding J1939 SAE Protocol: The Complete Guide to Communication in Commercial Vehicles part-5.
Published: 2024-03-05 04:09:01

Hello Readers, 👋😃
My name is Aravind B. N., and I work at Luxoft India as a junior software developer. Luxoft has given me several opportunities to work on various projects, which has inspired me to discuss the important processes involved in learning the SAE J1939 communication protocol [Part-4](https://dev.to/arvind_b_n_luxoft/understanding-j1939-sae-protocol-the-complete-guide-to-communication-in-commercial-vehicles-part-4-4mi) This is part 5 of the SAE J1939 communication protocol. Here we will discuss the Solution and Configurations and Handling in a Dynamic Network.

Cont... [Part-4]
**Solution & Configurations**
**Priority**

2.**Program-configurable**
The device at first broadcasts the PGN ‘Address Claimed’ with NULL address (254). This is seen on the network as ‘Cannot Claim Address’. An ECU can be assigned to a new device address by using “Commanded Address” network management service. The latter can be achieved through an external tool or any intelligent object in the network, "Cannot Claim Address"

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/st7bvk4wp1qwjikdqa2d.png)

The figure represents a sample scenario involving two Electronic Control Units (ECUs) known as ECU A and ECU B, undergoing initialization and address claiming on a network with particular focus on conflict resolution when both ECUs try to claim the same address.

A step-by-step explanation of what happens in the diagram is given below:

Initialization: Both ECU A and ECU B begin their initialization process as indicated by dashed lines at top of each vertical line. This is when each of them performs self-checks and gets ready for network communication.

Address Claimed by Both ECUs: NAME A claims an address over the network using Source Address (SA) of 20. At almost the exact same time, NAME B assigns itself this identical address (SA = 20), culminating into conflicts because two devices are trying to use similar source address.


Name comparison: The address contention is resolved by name comparison. Each ECU undertakes a NAME identifier check to know which one among them should have the highest priority when it comes to addressing.

ECU A Reclaims Address: After performing the name comparison, ECU A takes over the address SA = 20 with NAME A probably because of a higher priority as per the name comparison.

ECU B Cannot Claim Address: Having lost in the name comparison, ECU B tries to claim an address but this is not possible. It goes for SA = 254 and NAME B by default; which means that it could not acquire the desired address and now needs to be assigned new one.

Random delay and Commanded Address: Delayed Randomly and Commanded Address: After failing to claim an address, ECU B delays for some random period. This helps in avoiding repeated immediate conflicts and also gives time for network management system to resolve such issues. The footnote at the end indicates that if supported by the ECU, an optional “Commanded Address” network management service can be applied to give a new address for ECU B. This way, it would intervene in this case so that there will be no other conflict during communication process between all these ECUs.


Continued Operation: According to the diagram, after address claiming and conflict resolution processes, ECU A will remain operational with static address = 20, whereas network management intervention will eventually assign ECU B a new address.

The vertical lines have been used to represent the two ECUs while the horizontal lines show the events that occur over time (t) for each ECU. This process ensures that every ECU on the network is assigned a unique address; an essential requirement in any communication system or networked device.

3.**Manually configurable**
To assign a new address to this type of ECU, only a switch may be employed. The most common method of doing this kind of configuration is installing according to location in vehicle. An I/O port from the processor decodes this number as an address. Therefore, it is possible for door ECU to determine by itself whether it is installed on right or left and then select suitable location code.

4.**Non-configurable**
A non-configurable type of ECU can only be given another address through reprogramming its software.

**Handling in a Dynamic Network**

**AAC Bit**
An electronic control unit (ECU) that can be versatile and is not limited to a network connection should support the setup described as "Self configurable" in the section, on Solutions and Configurations. An ECU configured in this way may be identified by a NAME with its significant bit designated as "Arbitrary Address Capable." This designation indicates that ECUs can independently search for their addresses. If an ECU exists once in the network it can opt to use a fixed device address without needing to set the "Arbitrary Address bit. ECUs that are self configurable and have this feature activated are given priority over those lacking this setting in terms of naming conventions.

**Request**
The J1939 network management has an important mechanism called PGN ‘Request’. In turn, any PGNs can be requested from ECUs using this PGN. Therefore, it can also refer to the “Address Claimed” PGN. Here, the ‘Address Claimed’ PGN should respond to this “Request for Address Claimed”.

Important: When requesting ECU has a valid address, it must acknowledge its request itself!

**NULL Address**
Usually used at the beginning of communication during dynamic networks, whereby frequently request mechanism is applied. Thus any ECU that wants to participate in communication will request for the address status before starting addressing. 

Note: PGN 59904 is an exception in J1939. Specifically, this PGN is the only type of parameter group that can be sent without a valid address, but from NULL (254) instead.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cq6196ymkhm07mhajr0v.png)

Fig:Request for Address Claimed

The image you have shared with me looks like a series of interactions between an Electronic Control Unit (ECU) labeled “ECU A” and a network which is probably within the Controller Area Network (CAN) of a vehicle, or something similar to it in terms of ECU to ECU communication among other complex electronic systems found in vehicles.

This diagram can be described step by step as follows:

1. **ECU A**: This is the first processor that initiates electronic control unit to communication.

2. **Request for Address Claimed (SA = 254)**: To make all devices claim their addresses, ECU A transmits out a message over the network. The broadcast address for some protocols is 254 meaning every device should listen and capable of responding.

3. **Address Claimed (SA = X, NAME B)**: A computer on the network called NAME B has added its name while claiming its address with source address X.

4. **Address Claimed (SA = Y, NAME C)**: Another computer named NAME C however claims its address using source address Y.

5. **Address Claimed (SA = Z, NAME D)**: Another ECU, known as NAME D has confirmed its address by matching it with the source address Z.

6. **Time-out of 1250 ms**: A timeout of 1250 milliseconds is set, indicating that ECU A will wait for this duration to allow all ECUs, on the network to respond to the address claim request.

7. **Address Claimed (SA = T, NAME A)**: Following the timeout period ECU A asserts its address using source address T. Introduces itself as NAME A.

The vertical lines with arrows indicate the timeline, for both ECU A and the network showing that these events occur sequentially over time.

In networks, with devices it's common for them to establish their presence and secure addresses for effective communication. This helps prevent address conflicts and ensures messages reach the ECU. Such an address claiming process is frequently seen in systems utilizing the SAE J1939 protocol or similar protocols, in heavy duty vehicle and industrial settings.