Downloaded from SAE International by University of British Columbia, Tuesday, September 25, 2018 SAE TECHNICAL PAPER SERIES Dynamic Address Configuration in SAE J1939 Marvin L. Stone Oklahoma State Univ. The Engineering Society For Advancing Mobility Sea Air and Space, 400 Commonwealth Drive, Warrendale, PA 15096-0001 U.S.A. International Off-Highway & Powerplant Congress & Exposition Milwaukee, Wisconsin September 8-10, 1997 Tel: (412)776-4841 Fax:(412)776-5760 Downloaded from SAE International by University of British Columbia, Tuesday, September 25, 2018 Theappearanceofthe codeatthe bottom of pageindicates consent that copiesof the be or isgivenon the conditionhowever, thatthecopierpay theCopyrightClearanceCenter, Operations RosewoodDrive, Danvers, bySections U.S. Copyright MA 01 Law. Thisconsentdoesnot extendtootherkindsofcopyingsuchas copyingfor general distribution,for advertisingorpromotionalpurposes,forcreatingnewcollectiveworks, or forresale. SAE routinely stocks printed papers for a period of three years following date ofpublication. Directyour orders toSAECustomerSales andSatisfactionDepartment. ment beobtainedfromtheCustomerSalesandSatisfactionDepart- Torequestpermissiontoreprint to use copyrightedSAE publicationsin otherworks,contacttheSAEPublicationsGroup. DATABASE All standards, and selected the Nopartofthiispublication withoutthepriorwrittenpermissionof the Copyright1997 AutomotiveEngineers, Inc. Positions inthis the andnot thoseof Theauthor is thepaper. is availableby which discussionswillbe printed with the paper it is publishedin SAE Transactions. For permissionto publishthis paper in fullor in part, contactthe Personswishing papers or through SAEshouldsendthe manuscriptora300word abstract of a proposedmanuscript to: Secretary, EngineeringMeetingsBoard, SAE. Printedin USA Downloaded from SAE International by University of British Columbia, Tuesday, September 25, 2018 Dynamic Address Configuration in SAE Marvin L. Stone Oklahoma State Univ. industry initiated standards development for multiplexed wiring in 1990 in conjunction with the establishment of the That working group has focused on development of a standardized multiplex communications protocol 11783) for agricultural and forestry equipment. ABSTRACT SAE is an emerging communications protocol for on-board electronics in agricultural and construction equipment as well as for heavy duty highway equipment. The standard supports ECUs with both statically and dynamically configured addresses. This paper examines the dynamic addressing process, the process for ECUs that select addresses during initial power-up. A state diagram is proposed to implement the process described in the standard. Simulation results of systems with up to 100 dynamically configuredECUs are presented. Use of a pseudo-random delay after a power-ON self test was successful in minimizing bus-off collisions and allowed initialization times of under 1 second for 30 ECU systems. Minimum bus-off states during initialization of 30 ECU networks occurred with pseudo-random delays having a range of to 15 ms. An additional pressure to create a standardized multiplex communications protocol for agricultural equipment has been the recent market opportunities in precision farming. Precision farming systems require inter-operation of electronic components of agricultural implements and tractors. This requirement makes a standardized communications protocol between tractor and implement critical. Early in the standards development process, US agricultural and construction equipment manufacturers decided to pursue a joint standard (SAE with the heavy duty truck and bus industry. Parts of that standard have become working documents for the international 11783). standard effort by the industry INTRODUCTION Electronic components have become common on agricultural and construction equipment as equipment manufacturers have attempted to build more functionality and efficiency into their products. A natural consequence of the proliferation of electronic components has been the development of multiplexed communications networks on-board the equipment. These networks allow communicationbetween multiple electronic control units (ECUs) over multiplexed or shared communications wiring. Multiplexingsimplifies wiring and lowers total system costs while providing a means to share sensor values and other data. On the other hand, multiplexing increases the complexity of the electronics systems, as some technique must be implemented for controlling access by each of the ECUs to the shared wiring. A further complication is the need for ECUs to have some means of unique identity on the shared network. SAE 51939 SAE specifies a communications protocol which is intended to allow communication between electronic control units on-board a vehicle. Figure 1 shows a schematic of agricultural application of the network with a tractor and implement. SAE (SAE, 1997) is based on CAN (Bosch, 1991) protocol with 29 bit identifiers. In this protocol, messages are sent serially on a multiplexed data bus with a 29 bit message identifier and including an 8 byte data field. defines the structure of the identifier SAE and creates a physical addressing scheme. Each ECU connected in a network must have a unique 8 bit address. CAN requires that identifiers used in messages on the network be unique for proper specifies that the address of arbitration. The the sending ECU (source address) be included in the identifier of each message. The identification of the data is included elsewhere in the identifier. This allows any ECU to send any data. A consequence of the requirement of an address for ECUs is that an address must be assigned at manufacture or some means of Efforts by agricultural and construction equipment manufacturers to control product costs have also affected development of multiplexed wiring systems. Higher volumes of electronic components reduce cost and have driven standardizationof multiplexed wiring systems. The construction and agricultural equipment I Downloaded from SAE International by University of British Columbia, Tuesday, September 25, 2018 address assignment must be included in the network protocol. , Self Confi urable ECU A Initialize Messages Time Name Address Claim Figure ECU B should select a new address and attempt to claim it Tractor Implement Implementation of SAE An initialization process is provided in the Network Management document, to allow ECUs to secure an address during initialization. The process uses no centralized master and relies on each ECU to manage its address. The process allows ECUs with hard coded addresses to co-exist with ECUs which secure their address dynamically during initialization. ECUs require some form of unique identification for the purposes of securing and arbitrating an address. This identification is standardized as a NAME, an 8 byte numeric quantity which includes a manufacturers code and a manufacturer assigned identity number. Manufacturers must assure that the NAME value is unique within an interconnected system. Figure 2 shows the message traffic and sequence that occurs during an initialization process when two ECUs attempt to secure the same address. The resolution of the conflict is shown. After a power-on self-test (POST), ECU A sends an address claim message containing the address it is claiming and its NAME. ECU B completes its POST at a later time and attempts to claim the same address, not hearing the original claim from ECU A. In this event, ECU A compares the value of its NAME with the contender and reclaims its address because it has a lower value (higher priority) NAME. Since ECU B is self-configurable, it must seek a new address and attempt to claim it. If ECU B is unable to select or find a different address, it will send a Cannot Claim Address message and be in a state of not being able to claim an address. Figure 2. Message sequence for a self-configuring ECU (SAE The CAN protocol in SAE uses a prioritized arbitration process to allow messages access to the bus. When two messages are sent at the same time, their identifiers are imposed bit-serially onto the bus. The bus must be designed to allow dominant bits to overwhelm recessive bits when both are applied by different ECUs on the bus. This is described in SAE the Physical Layer specification for construction and agricultural applications. No conflict occurs as long as the ECUs are sending the same bits, but when one sends a recessive bit while the other sends a dominant bit, the bus state is dominant. The ECU sending the recessive bit must sense the bus is at a dominant state when the bit was sent and must cease transmitting the message at that time until the next time the bus becomes idle. This strategy allows more dominant identifiers, those with a lower value, to have a higher priority on the bus. To allow this feature to work properly, CAN synchronizes messages at the beginning of each transmission to assure bits are aligned. The prioritized message arbitration mechanism built into CAN is only performed during the identifier portion of the message. A consequence is that a message error occurs when two messages are sent with the same identifier at the same time. Both identifiers are sent without conflict, but when the data are sent immediately following the identifier, the data of both together resulting in a garbled messages are transmission. This is detected by the receivers as a bad checksum in the message, and signaled to the transmitters via an error frame. The transmitter in most protocol controllers automatically re-sends the message. Unfortunately, both of the senders repeat this process. The senders keep an error count and after repeating the message 32 times with an error, both senders assume a bus-OFF state and cease transmitting. In most protocol controllers, the ECU must reset the protocol controller to allow further transmission. Downloaded from SAE International by University of British Columbia, Tuesday, September 25, 2018 The possibility exists in applying the SAE specification for the bus-off condition to occur if two self-configuring ECUs attempt to claim the same address at the same time. If the ECUs have different NAMES, they generate the same identifier, an address claim for the same address followed by different data. The data in the address claim message is the ECUs NAME which should be unique. In this event, the standard recommends each ECU retry the claim process after a pseudo-randomdelay of to 256 message lengths. This process would be expected to work well when there are few ECUs attempting to claim the same address at the same time. INITIALIZATION STATE DIAGRAM A state diagram can be constructed to describe the address configurationprocess within a single configuring ECU as shown in Figure 3. The state diagram is entered after power-up. A power-ON self-test is assumed, and the ECU then selects an address to claim. This address should be the ECUs preferred address and may be a single fixed address as or may be computed or selected in a found in different manner as specified for a particular application. For agricultural and construction applications, specifies application specific requirements including computationof addresses for self-configuring ECUs. Address Selecting 'Bus-Off' different from Address Claim received during the 250 ms period or afterward, the ECU must compare its NAME with the contender. The ECU with the lower valued NAME may re-claim its address, while the ECU with the higher valued NAME must select another address and attempt to claim that address. The ability to select an alternate address and claim it is the defining characteristic of a self-configurableECU. If the ECU cannot find another address, the ECU sends a cannot claim address message and waits. This dynamic address configuration process is likely to be used with agricultural implements. Implements may be detached and moved from tractor to tractor and multiple implements may be connected at once. The nature of agricultural implements required either some mutually exclusive addressing system or a dynamic configuration process. The later process is now being written into 783 and will be included in SAE To improve the reliability of the process, the current strategy proposed for 11783 is that ECUs should use the last successfully claimed address as a preferred address. The result of this constraint is that address contentions may occur when a new configuration of implements is connected, but should not occur if no changes in configuration have been made. There is some concern regarding the initialization time required with a dynamic address configuration process using the strategies described above. Some of the implements for both agricultural equipment and for construction equipment may consist of many nearly identical ECUs. An example of this type of system might be a planter where each row might be configured with a single ECU. Current ECU costs probably prevent large numbers of ECUs on an implement, but as ECU costs drop, a 30 30 ECU planter would be possible. A planter with this many ECUs initializing the could present long initialization times and merits further study. Without a mntending INITIALIZATION SIMULATION address Contention And Receiving greater than mine /AddressClaim for Cannot Cannot Address A message by message simulation was developed to allow computation of initializationtime and evaluation of the initializationprocess. The simulation was based on the state diagram in Figure 3. A listing of the time step subroutine of the simulation is included in the appendix. The following assumptions were used: 1. Time granularity was assumed to be one message time. Message data lengths were assumed to be 8 bytes. This is consistent with which currently uses an 8 byte message for address claim. Eight byte messages are approximately 125 bits long and at the 250 kbit per second rate used require approximately 0.5 ms per in SAE message. 2. The set of ECUs simulated were all self-configuring ECUs. Address Figure 3. State diagram for Self-configuring ECUs After address selection, the ECU sends an address claim message and waits for any contending claims for the same address. If none are received for a period of 250 ms, the ECU may begin normal communications on the network. If a contending claim is Downloaded from SAE International by University of British Columbia, Tuesday, September 25, 2018 3. 4. Only the power-ON self-test (POST) time and initialization traffic was simulated. lnitialization times will be longer as ECUs which have initialized consume significant bandwidth with normal traffic. This issue should not be a problem for the ECUs involved in the claim process as they are required to wait 250 ms before transmitting normal message traffic after a claim. lnitialization time after the POST was found to be less than 250 ms. (Total times were under 550 ms including an assumed 300 ms POST.) the POST time plus the 250 ms delay before normal network traffic is begun. A potential addition to the current proposed requirements in the standard was investigated. That addition would be to recommend that ECUs constructed by the same manufacturer with nearly identical POST times add a pseudo-random delay after POST before issuing an address claim message. This delay would minimize the probability that all of the ECUs issued the address claim at the same time. Bus-OFF times were computed as 32 message times plus 9 bit times per message for error frames. The Bosch CAN specification (Bosch, 1991) specifies error frames will be 6 to 12 bit times in length. An average number was used. 5. ECUs claimed an address at random between 128 and 247 as a preferred address. This strategy has been proposed at the working group 11783. Later initializations of the developing system would use the addresses determined on an early power-up. No address contention would occur and the process would not require the long initialization process simulated here. 6. A 5 message time delay (2.5 ms) was assumed to occur in an ECU before it attempts to claim a new address after losing arbitration. This process is shown in Figure 2. and is a conservative estimate of the time between the first and second address claim by the self-configurable ECU. 7. ECUs do not use any address claims received during pseudo-random delays to improve their address selection by eliminating used addresses. Logging of address claims by other ECUs during pseudo-random delays while initializing could reduce the chances of unnecessary arbitration. The more conservative but less efficient path of ignoring previous address claims was used here. 8. Twenty five initialization cycles were simulated to allow average times to be determined. 9. The total average initializationtimes reported do not include the 250 ms wait after claim to assure no conflicting claim. This time must be added to the total average initialization time for actual systems to determine the time at which normal network traffic can take place. Figure 4 shows the effect of the number of ECUs on the total time required for all ECUs to initialize. In addition, the number of bus-OFF events was also determined. For 10 or fewer ECUs, the average number of bus-OFF events was low and initialization time was essentially equal to the POST time plus the time to claim and address. For 10 or more ECUs, the initialization times become significantly longer. For 10 or fewer ECUs the total initialization time for an actual system would be Initialization Characteristics For SAE Identical POST times 2 0 0 10 20 30 40 60 70 90 I Number of ECUs Figure 4. Effect of the number of ECUs on lnitialization time A potential method of reducing the number of bus-OFF states and minimizing initialization time would be to add a pseudo-random delay before transmitting the initial address claim. This method reduces the probability of simultaneous claims for the same address. The simultaneous claim problem would not be a problem for ECUs constructed by different manufacturers as the variation of the POST time would be expected to be on the order of 100 ms or larger. The problem occurs when a set of nearly identical ECUs are connected from the same manufacturer. In this case, the ECUs would be expected to all have the same POST time and would all attempt to claim an address at the same time. As the number of ECUs increase, the probability that ECUs claim the same address at the same time increases. Figure 5 shows the result of varying the pseudorandom delay with a network of 30 ECUs. The pseudorandom delay is inserted after the POST. A pseudorandom delay after POST of 15 nearly eliminated the bus-OFF states that occurred. The slight increase in bus-OFF states at 35 ms was due to a single event and would be eliminated by increasing the number of simulations. Increasing the pseudo-random delay after POST beyond 10 ms increased the initialization time slightly. A prudent selection of pseudo-random delay after POST would appear to be 15 ms as this would nearly eliminate bus-OFF states and provide a short initializationtime. The average number of Bus-OFF Downloaded from SAE International by University of British Columbia, Tuesday, September 25, 2018 states at a pseudo-random delay after POST of 10 ms was or that 7% of the time, one bus-OFF state could be expected, while this level was or did not occur in 25 tests at the 15 ms pseudo-random delay. Interestingly, this time is the amount that would be required for one message for each self configuring ECU. lnitialization Characteristics for Randomly varied POST tlme T lnitialization Characteristics for of POST Std. T 4W a POST 20 30 40 50 60 Number of ECUs 0 20 30 40 50 60 0 100 70 Pseudo-Random Delay (Maximum) Figure 5. Effect of pseudo-random delay after POST on lnitialization time lnitialization Characteristics for Number of ECUs 0 m 5 .... ... 200 ... POST .... 10 20 30 40 50 70 80 90 100 Number of ECUs Figure 6. Effect of a 15 rns pseudo-random delay after POST on lnitialization time Figure 6 shows the effect of a 15 ms pseudorandom delay after POST on lnitialization time. The ideal selection of pseudo-random delay can be seen to be a function of the numbers of ECUs involved in the dynamic address initializationprocess. A selection of 15 ms may be appropriate for 30 ECUs, but a larger delay is indicated for a much larger set of ECUs. Figure 7 repeats Figure 6 except with 50 ms pseudo-random delay. The 50 rns pseudo-random delay appears adequate for 100 ECUs. Bus-OFF states are maintained below 0.5 occurrences per initialization cycle. The necessary amount of pseudo-random delay to maintain bus-OFF states below 1 per initialization can be computed approximately by multiplying the number of identical self configuring ECUs in a system by 0.5 ms. 80 .:I Figure 7. Effect of Number of ECUs on lnitialization time for a 50 ms pseudo-random delay after POST. SUMMARY The dynamic address configuration process was examined and a state included in SAE diagram presented describing the process. Using that process, a simulation was developed to evaluate the average initialization time and number of bus-OFF states that occurred during initialization. The simulation results demonstrate that a pseudo-randomdelay should be inserted after the POST for ECUs which are manufactured to have the same POST time, and will use dynamic address configuration. This recommendation is especially appropriate for construction and agricultural equipment applications where multiple instances of the same type of ECU are being connected in a system. An example of this type of system would be planters where each row might use a single ECU. lnitialization times for 100 ECU systems were found to be less than 500 rns including a 300 ms POST for systems using a pseudo-random delay after the POST. A pseudo-random delay after the POST of 0.5 ms per ECU in the initializing system was found to be adequate with negligible numbers of bus-OFF states during initialization. lnitialization times reported here do not include the 250 ms delay that must be used before starting normal network traffic. REFERENCES Bosch, Robert GmbH. 1991. CAN Specification. 50, D-7000 Version 2.0. Robert Bosch GmbH, 1, Germany. SAE. 1997. SAE Recommended Practices SAE, Warrendale, PA. Downloaded from SAE International by University of British Columbia, Tuesday, September 25, 2018 APPENDIX Single Time Step Segment of InitializationSimulation Address As lnteger 'Address of ECU Time As Integer 'Time at which ECU attempts claim CAN-Arbs As lnteger 'Number of CAN arbitrations Claimed As Boolean 'Whether ECU has claimed Bus-OFF As Boolean 'Whether the ECU is Bus OFF Bus-Off-Time As lnteger 'Message cycles left in Bus-OFF End Type of 150 ECUs) 'Module wide variables Dim As a-node Sub time-step() Dim This As lnteger Dim Other As lnteger For This = 1 To ECUs If = t Then 'Claim (Check other nodes for same address to arbitrate or same time and same address for collision) ClaimSuccess True If = False Then For Other 1 To ECUs If = Then Other) Then If (This If = True) Then 'Must Claim New Address 'Assume the other node has a lower name (one has to reclaim and it does not matter which) = 128 + 119 'Prepare to reclaim new address after hearing other ECU reclaim. Assuming 4 msg lengths until reclaim =t+5 ClaimSuccess False = Then 'ECUs will go Bus-OFF Busoff-Count = Busoff-Count + 1 'Set up ECUs to transmit again next message cycle =t+1 t+1 'Set ECUs to Bus-OFF True True 'Set ECUs Bus-OFF counter 32 = 32 ClaimSuccess = False End If 'If True) End If 'If (This Other) Then = Then 'No conflict but one message has higher priority and the other is delayed by CAN arbitration Then If =t+1 +1 Else t+1 +1 ClairnSuccess = False End If = End If 'If Next Other Bus-OFF False Else 'Decrement the Bus-OFF counter Then False False Compute the random message delay after Bus Off 1 (this is not the delay before initial as per claim) = t + 255 = + 255 'Select a new address assuming the worst, that the node does not listen during the delay for further address claims = 128 + 119 128 + 119 Else 'Set up for the next cycle t+1 t+1 End If 'If Bus-Off-Time End If = False ClaimSuccess Time t End If 'If Next This End Sub