Diagnostic routing configuration method and related device
By generating protocol data unit identifiers corresponding to object identifiers in automotive electronic systems and writing them into configuration files, diagnostic routing configuration is simplified, the development burden and failure risks caused by complex configurations are resolved, and system stability and efficiency are improved.
Patent Information
- Application Number
- CN202511172170.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-20
- Publication Date
- 2025-11-11
AI Technical Summary
In automotive electronic systems, the diagnostic routing configuration process is complex, increasing the workload for developers and potentially leading to communication failures that affect system stability and reliability.
By obtaining the object identifier, generating the corresponding protocol data unit identifier, and writing it into the communication configuration file, the identifier conversion process of the target module is simplified, the protocol data unit identifier is directly transmitted, and mapping lookup and conversion operations are reduced.
It simplifies the diagnostic routing configuration process, reduces configuration workload, improves development efficiency, and reduces the risk of communication failures.
Smart Images

Figure CN120935008A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of automotive electronics technology, and in particular to a diagnostic routing configuration method and related apparatus. Background Technology
[0002] With the widespread application of the DoIP protocol, modern automotive internal communication often involves both traditional diagnostic messages (UDSonCAN, UDSonLIN) and Ethernet-based diagnostic messages (UDSonIP). To ensure effective communication between various systems within the vehicle, information conversion is required between diagnostic messages of different protocols (such as between UDSonCAN and UDSonIP, or between UDSonCAN messages from two different nodes), i.e., diagnostic routing. The implementation of diagnostic routing is crucial for ensuring comprehensive fault diagnosis and maintenance.
[0003] To address this challenge, automotive embedded software development tools, such as ETAS (Electronic Test and Application Software), are widely used in the development of diagnostic routing functions. These tools provide robust support for feature development, enabling developers to implement various routing functions such as CAN-to-CAN and Ethernet-to-CAN.
[0004] However, configuring diagnostic routes becomes a challenge during feature development using these tools. The configuration process involves numerous parameter settings and protocol conversion logic definitions, which not only increases the workload for developers but can also lead to communication failures due to configuration errors, thereby affecting the stability and reliability of the entire vehicle system. Summary of the Invention
[0005] In view of the above problems, this application provides a diagnostic routing configuration method and related apparatus to reduce configuration workload and improve development efficiency. The specific solution is as follows:
[0006] The first aspect of this application provides a method for diagnosing routing configuration, including:
[0007] Obtain at least one object identifier; the object identifier is used to identify the forwarding path of the diagnostic message;
[0008] Based on at least one of the object identifiers, a protocol data unit identifier is generated for each diagnostic message in each target module of the electronic control unit; the value of the protocol data unit identifier and the value of the object identifier are consistent when corresponding to the same diagnostic message; the values of each protocol data unit identifier are different; the protocol data unit identifier is used to identify the protocol data unit corresponding to the diagnostic message; each target module is used to route and forward the diagnostic message.
[0009] Write the protocol data unit identifier corresponding to each diagnostic message into the communication configuration file corresponding to each target module of the electronic control unit.
[0010] In one possible implementation, the diagnostic routing configuration method further includes:
[0011] At least one target object identifier is selected from the at least one object identifier; the target object identifier is used to identify multiplexing of the diagnostic message.
[0012] A unique first target protocol data unit identifier is configured for the target object identifier, and the mapping relationship between the target object identifier and the first target protocol data unit identifier is written into the configuration file of the transport protocol routing module; the transport protocol routing module is used to perform routing management and periodic monitoring of the diagnostic messages;
[0013] Configure multiple second target protocol data unit identifiers for the first target protocol data unit identifier, and write the mapping relationship between the first target protocol data unit identifier and the multiple second target protocol data unit identifiers into the configuration file of the communication adaptation module; the communication adaptation module is used to forward diagnostic messages and diagnostic routing messages.
[0014] In one possible implementation, the protocol data unit corresponding to the diagnostic message is configured in the following way:
[0015] Based on the diagnostic routing requirements for switching from Ethernet communication protocol to CAN communication protocol, determine the maximum length of received messages and the maximum length of sent messages;
[0016] In the electronic control unit configuration module, a protocol data unit is configured according to the maximum length of the received message and the maximum length of the sent message, and the configured protocol data unit is assigned to the communication adapter module and the CAN communication driver module; the communication driver module is a lower-level module of the communication adapter module.
[0017] In one possible implementation, the diagnostic routing configuration method further includes:
[0018] The first protocol data unit for receiving and the second protocol data unit for transmitting, which correspond to each CAN channel respectively, are grouped together in the protocol data unit corresponding to each diagnostic message.
[0019] Within the group, all the first protocol data units are arranged before the second protocol data units.
[0020] In one possible implementation, the diagnostic routing configuration method further includes:
[0021] The second protocol data units within the group are merged to share the corresponding send buffer of the group.
[0022] In one possible implementation, the diagnostic routing configuration method further includes:
[0023] For functional addressing diagnostic messages, a processing flow is configured, which includes: passing the functional addressing diagnostic message to the diagnostic module for processing, and copying the functional addressing diagnostic message to the communication adaptation module to complete the routing function; and...
[0024] Configure a reception confirmation mechanism, which includes: ignoring whether the communication adaptation module has successfully received the function addressing diagnostic message and passing the return result of the diagnostic module confirming whether it has successfully received the function addressing diagnostic message to the underlying communication module.
[0025] Another aspect of this application provides a diagnostic routing configuration apparatus, comprising:
[0026] An acquisition module is used to acquire at least one object identifier; the object identifier is used to identify the forwarding path of the diagnostic message;
[0027] A generation module is configured to generate, based on at least one object identifier, a protocol data unit identifier for each diagnostic message in each target module of the electronic control unit; the value of the protocol data unit identifier and the value of the object identifier are consistent when corresponding to the same diagnostic message; the values of each protocol data unit identifier are different; the protocol data unit identifier is used to identify the protocol data unit corresponding to the diagnostic message; each target module is configured to route and forward the diagnostic message.
[0028] The first configuration module is used to write the protocol data unit identifier corresponding to each diagnostic message into the communication configuration file corresponding to each target module of the electronic control unit.
[0029] A third aspect of this application provides a computer program product including computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the diagnostic routing configuration method as described in any of the preceding claims.
[0030] A fourth aspect of this application provides an electronic device including at least one processor and a memory connected to the processor, wherein:
[0031] The memory is used to store computer programs;
[0032] The processor is used to execute the computer program to enable the electronic device to implement the diagnostic routing configuration method as described in any of the above.
[0033] A fifth aspect of this application provides a computer storage medium carrying one or more computer programs that, when executed by an electronic device, enable the electronic device to implement the diagnostic routing configuration method as described in any of the preceding claims.
[0034] In this application, by obtaining at least one object identifier, which is used to identify the forwarding path of diagnostic messages, and based on at least one object identifier, at least one protocol data unit identifier (DAC) is generated for each diagnostic message in each target module of the electronic control unit. The value of the DAC and the value of the object identifier remain consistent when corresponding to the same diagnostic message. This allows each target module to directly transmit the DAC. When some target modules receive a diagnostic message with a DAC, they can directly treat this DAC as an object identifier without performing any additional mapping lookup or conversion operations. In this way, each target module can quickly identify and forward the corresponding diagnostic message, thereby simplifying the routing logic. Through this configuration method, each target module no longer needs to maintain its own complex mapping relationship for identifier conversion. Therefore, the configuration of complex mapping relationships can be eliminated, the configuration workload can be reduced, and development efficiency can be improved.
[0035] Furthermore, the simplified configuration method can reduce the risk of communication failures caused by configuration errors. Attached Figure Description
[0036] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0037] Figure 1This is a flowchart illustrating a diagnostic routing configuration method provided in Embodiment 1 of this application;
[0038] Figure 2 A diagnostic routing flowchart is provided for this application;
[0039] Figure 3 This is a flowchart illustrating a diagnostic routing configuration method provided in Embodiment 2 of this application;
[0040] Figure 4 This is a flowchart illustrating a diagnostic routing configuration method provided in Embodiment 6 of this application;
[0041] Figure 5 A schematic diagram illustrating the processing flow of a functional addressing diagnostic message provided in this application;
[0042] Figure 6 This is a schematic diagram of a diagnostic routing configuration device provided in this application. Detailed Implementation
[0043] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is for explaining specific embodiments only and is not intended to limit the scope of this application.
[0044] The embodiments of this application will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.
[0045] The terms "first," "second," etc., used in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of units is not necessarily limited to those units, but may include other units not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0046] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0047] Reference Figure 1 This is a flowchart illustrating a diagnostic routing configuration method provided in Embodiment 1 of this application. Figure 1 As shown, the method may include, but is not limited to, the following steps:
[0048] Step S101: Obtain at least one object identifier; the object identifier is used to identify the forwarding path of the diagnostic message.
[0049] In this embodiment, at least one object identifier can be generated based on the diagnostic routing requirements of at least one diagnostic message. Each object identifier can be used to identify the forwarding path of each diagnostic message.
[0050] Step S102: Based on at least one of the object identifiers, generate at least one protocol data unit identifier for each diagnostic message in each target module of the electronic control unit; the value of the protocol data unit identifier and the value of the object identifier are consistent when corresponding to the same diagnostic message; the values of each protocol data unit identifier are different.
[0051] The protocol data unit identifier can be used to identify the protocol data unit corresponding to the diagnostic message.
[0052] In this embodiment, all diagnostic messages and their corresponding object identifiers can be traversed. Based on the order of the object identifiers, a Protocol Data Unit (PDU) identifier is generated in each target module of the electronic control unit for each diagnostic message. When generating the PDU identifier, its value can be set to be the same as the value of its corresponding object identifier. It should be noted that although the values are the same, the PDU identifier is unique within its respective target module. This is because each target module assigns an internally unique identifier to each diagnostic message to ensure correct data processing and tracking.
[0053] In the various target modules of the electronic control unit, the protocol data unit identifiers corresponding to the same diagnostic message may differ in form, but their numerical values are the same. For example, such as Figure 2 As shown, each target module may include: DoIP (Ethernet communication driver module), PduR (low-level communication module), and Cdd (communication adapter module).
[0054] DoIP can handle Ethernet-based diagnostic messages, such as UDSonIP, enabling communication between diagnostic devices and ECUs.
[0055] PduR can be used for protocol format conversion and data fragmentation and reassembly.
[0056] Cdd can act as a forwarding layer above PduR, receiving diagnostic messages from PduR and sending them to TpR (Transmission Protocol Routing Module) for timed management. Simultaneously, the Cdd module is also responsible for forwarding the diagnostic routing messages processed by TpR to PduR for further forwarding.
[0057] TpR can perform route management and periodic monitoring of diagnostic messages based on object identifiers.
[0058] Multiple diagnostic messages can include: diagnostic message A, diagnostic message B, diagnostic message C, and diagnostic message D. In the TpR, the object identifier corresponding to diagnostic message A in the receiving direction can be represented as Rx_HandleId=1, the object identifier corresponding to diagnostic message B in the receiving direction can be represented as Rx_HandleId=2, the object identifier corresponding to diagnostic message C in the receiving direction can be represented as Rx_HandleId=3, and the object identifier corresponding to diagnostic message D in the receiving direction can be represented as Rx_HandleId=4.
[0059] Based on Rx_HandleId=1, a Protocol Data Unit Identifier (PDU) DoIP_PduId is generated for diagnostic message A in DoIP, where DoIP_PduId = Rx_Rx_HandleId=1; and a PDU DoIP_PduId is generated for diagnostic message B in DoIP, where DoIP_PduId = Rx_HandleId=2; a PDU DoIP_PduId is generated for diagnostic message C in DoIP, where DoIP_PduId = Rx_HandleId=3; and a PDU DoIP_PduId is generated for diagnostic message D in DoIP, where DoIP_PduId = Rx_HandleId=4.
[0060] Based on Rx_HandleId=1, a Protocol Data Unit (PDU) identifier Rx_PduR_PduId is generated in PduR for diagnostic message A, where Rx_PduR_PduId = Rx_HandleId=1; and a PDU identifier Rx_PduR_PduId is generated in PduR for diagnostic message B, where Rx_PduR_PduId = Rx_HandleId=2; a PDU identifier Rx_PduR_PduId is generated in PduR for diagnostic message C, where Rx_PduR_PduId = Rx_HandleId=3; and a PDU identifier Rx_PduR_PduId is generated in PduR for diagnostic message D, where Rx_PduR_PduId = Rx_HandleId=4.
[0061] Based on Rx_HandleId=1, a Protocol Data Unit (PDU) identifier Rx_Cdd_PduId is generated in Cdd for diagnostic message A, where Rx_Cdd_PduId = Rx_HandleId=1; and a PDU identifier Rx_Cdd_PduId is generated in Cdd for diagnostic message B, where Rx_Cdd_PduId = Rx_HandleId=2; a PDU identifier Rx_Cdd_PduId is generated in Cdd for diagnostic message C, where Rx_Cdd_PduId = Rx_HandleId=3; and a PDU identifier Rx_Cdd_PduId is generated in Cdd for diagnostic message D, where Rx_Cdd_PduId = Rx_HandleId=4.
[0062] Similarly, in the TpR module, object identifiers can be set for diagnostic messages A, B, C, and D respectively in the sending direction, and the corresponding protocol data unit identifiers can be set in the same way.
[0063] Step S103: Write the protocol data unit identifier corresponding to each diagnostic message into the communication configuration file corresponding to each target module.
[0064] Communication configuration files (such as ETAS's arxml file) can be used to enable target modules to transmit diagnostic messages according to predetermined paths and formats during runtime. For example, during runtime, when a diagnostic device issues a diagnostic request containing diagnostic message A, DoIP (Ethernet communication driver module) can send the value 1 of PduId of diagnostic message A to PduR (lower-level communication module). PduR directly passes the value 1 to Cdd, which then passes it to TpR. TpR can directly determine the forwarding path of diagnostic message A based on HandleId=1. In this process, Cdd can avoid the operation of converting PduId.
[0065] In this application, by obtaining at least one object identifier, which is used to identify the forwarding path of diagnostic messages, and based on at least one object identifier, at least one protocol data unit identifier (DAC) is generated for each diagnostic message in each target module of the electronic control unit. The value of the DAC and the value of the object identifier remain consistent when corresponding to the same diagnostic message. This allows each target module to directly transmit the DAC. When some target modules receive a diagnostic message with a DAC, they can directly treat this DAC as an object identifier without performing any additional mapping lookup or conversion operations. In this way, each target module can quickly identify and forward the corresponding diagnostic message, thereby simplifying the routing logic. Through this configuration method, each target module no longer needs to maintain its own complex mapping relationship for identifier conversion. Therefore, the configuration of complex mapping relationships can be eliminated, the configuration workload can be reduced, and development efficiency can be improved.
[0066] Furthermore, the simplified configuration method can reduce the risk of communication failures caused by configuration errors.
[0067] As another optional embodiment of this application, refer to Figure 3 This is a flowchart illustrating a diagnostic routing configuration method provided in Embodiment 2 of this application. Figure 3 As shown, the method may include, but is not limited to, the following steps:
[0068] Step S201: Obtain at least one object identifier; the object identifier is used to identify the forwarding path of the diagnostic message.
[0069] Step S202: Based on at least one of the object identifiers, generate at least one protocol data unit identifier for each diagnostic message in each target module of the electronic control unit; the value of the protocol data unit identifier and the value of the object identifier remain consistent when corresponding to the same diagnostic message; the values of each protocol data unit identifier are different.
[0070] The protocol data unit identifier is used to identify the protocol data unit corresponding to the diagnostic message.
[0071] Each of the target modules is used to route and forward the diagnostic messages.
[0072] Step S203: Write the protocol data unit identifier corresponding to each diagnostic message into the communication configuration file corresponding to each target module of the electronic control unit.
[0073] For a detailed description of steps S201-S203, please refer to the relevant description of steps S101-S103 in Example 1, which will not be repeated here.
[0074] Step S204: Select at least one target object identifier from the at least one object identifier; the target object identifier is used to identify the multiplexing of the diagnostic message.
[0075] Step S205: Configure a unique first target protocol data unit identifier for the target object identifier, and write the mapping relationship between the target object identifier and the first target protocol data unit identifier into the configuration file of the transport protocol routing module; the transport protocol routing module is used to perform routing management and periodic monitoring of the diagnostic messages.
[0076] In this embodiment, if at least one object identifier does not contain a target object identifier, the transport protocol routing module can maintain only at least one object identifier.
[0077] If at least one object identifier contains a target object identifier, a unique first target protocol data unit identifier can be configured for the target object identifier. The mapping relationship between the first target protocol data unit identifier and the target object identifier can be used to identify that diagnostic messages need to be forwarded multiplexed.
[0078] Step S206: Configure multiple second target protocol data unit identifiers for the first target protocol data unit identifier, and write the mapping relationship between the first target protocol data unit identifier and the multiple second target protocol data unit identifiers into the configuration file of the communication adaptation module; the communication adaptation module is used to forward diagnostic messages and diagnostic routing messages.
[0079] Multiple second target protocol data unit identifiers can be used to identify multiple protocol data units that receive diagnostic messages, and these multiple protocol data units can come from different electronic control units.
[0080] For example, the object identifier of TpR corresponding to diagnostic message B in the sending direction can be represented as Tx_HandleId=6. Tx_HandleId=6 corresponds to Rx_HandleId=2 of TpR corresponding to diagnostic message B in the receiving direction. Tx_HandleId=6 indicates that diagnostic message B is forwarded to ECU1, ECU2 and ECU3.
[0081] A unique first target protocol data unit identifier, Tx_TpR_PduId=200, can be configured in TpR for Tx_HandleId=6. In Cdd, three second target protocol data unit identifiers can be configured for Tx_TpR_PduId=200, namely Tx_Cdd_PduId=201, Tx_Cdd_PduId=202, and Tx_Cdd_PduId=203. Tx_Cdd_PduId=201 corresponds to ECU1, Tx_Cdd_PduId=202 corresponds to ECU2, and Tx_Cdd_PduId=203 corresponds to ECU3.
[0082] During operation, when a diagnostic device issues a diagnostic request containing a diagnostic message B, DoIP (Ethernet communication driver module) can send the value 2 of PduId of the diagnostic message B to PduR (lower-level communication module). PduR directly passes the value 2 to Cdd, and Cdd then passes the value 2 to TpR. Cdd can avoid the operation of converting PduId.
[0083] TpR can directly determine Tx_HandleId=6 based on Rx_HandleId=2, and find Tx_TpR_PduId=200 based on Tx_HandleId=6. It then sends Tx_TpR_PduId=200 to Cdd. Cdd, based on Tx_TpR_PduId=201, Tx_Cdd_PduId=202, and Tx_Cdd_PduId=203 corresponding to Tx_TpR_PduId=200, continues to forward the diagnostic routing message obtained by TpR based on the diagnostic message B, until it is sent to ECU1, ECU2, and ECU3.
[0084] In this embodiment, if at least one object identifier contains a target object identifier, a unique first target protocol data unit identifier can be configured for the target object identifier. In the transport protocol routing module, it is not necessary to configure multiple protocol data unit identifiers for the target object identifier (these multiple protocol data unit identifiers correspond to multiple ECUs that need to receive diagnostic messages), which can also reduce the configuration workload.
[0085] As another optional embodiment of this application, this embodiment provides a diagnostic routing configuration method. This embodiment is mainly an implementation method for configuring the protocol data unit corresponding to the diagnostic message. The configuration process may include, but is not limited to, the following steps:
[0086] Step S11: Determine the maximum length of the received message and the maximum length of the sent message based on the diagnostic routing requirements for switching from Ethernet communication protocol to CAN communication protocol.
[0087] The maximum length of a received message can be understood as the upper limit of the length of an Ethernet communication protocol message received from a diagnostic device.
[0088] The message length can be understood as the upper limit of the length of the CAN communication protocol message sent to the ECU after converting the Ethernet communication protocol message into the CAN communication protocol.
[0089] Step S12: In the Electronic Control Unit Configuration Module (EcuC), the protocol data unit is configured according to the maximum length of the received message and the maximum length of the sent message, and the configured protocol data unit is assigned to the communication adapter module and the CAN communication driver module; the communication driver module is a lower-level module of the communication adapter module.
[0090] The CAN communication driver module may include: CANTp and CANIf.
[0091] As an important component of the AutoSAR standard, CANTP is primarily responsible for packaging upper-layer application data into CAN frames and transmitting them. It also supports functions such as segmented data transmission and reception, and error handling.
[0092] CANIf, as part of the AutoSAR standard, sits between the CAN module and CANTp. CANIf provides a transparent CAN bus access mechanism for upper-layer modules and shields them from the differences in the underlying hardware.
[0093] In this embodiment, by determining the maximum length of the received message and the maximum length of the sent message, the electronic control unit configuration module configures the protocol data unit according to the maximum length of the received message and the maximum length of the sent message, and assigns the configured protocol data unit to the communication adapter module and the CAN communication driver module. This ensures that the data during the communication process can be transmitted and processed in the most efficient way, thereby improving communication efficiency.
[0094] As another optional embodiment of this application, a diagnostic routing configuration method is provided in Embodiment 4 of this application. This embodiment is mainly an implementation method for configuring the protocol data unit corresponding to the diagnostic message. The configuration process may include, but is not limited to, the following steps:
[0095] Step S21: Determine the maximum length of the received message and the maximum length of the sent message based on the diagnostic routing requirements for switching from Ethernet communication protocol to CAN communication protocol.
[0096] Step S22: In the electronic control unit configuration module, according to the maximum length of the received message and the maximum length of the sent message, the protocol data unit is configured, and the configured protocol data unit is assigned to the communication adapter module and the CAN communication driver module; the communication driver module is a lower-level module of the communication adapter module.
[0097] For a detailed description of steps S21-S22, please refer to the relevant description of steps S11-S12 in Example 3, which will not be repeated here.
[0098] Step S23: Divide the first protocol data unit for receiving and the second protocol data unit for transmitting, which are respectively corresponding to each CAN channel, into a group.
[0099] Step S24: Within the group, arrange all the first protocol data units before the second protocol data units.
[0100] In this embodiment, steps S23-S24 can be applied to the CAN module and CANIf.
[0101] For example, suppose there are 3 CAN channels, each with 3 receive messages (1 functional addressing, 2 physical addressing) and 2 transmit messages (2 physical addressing). Then the CAN module's ordering of PDUs (Protocol Data Units) is as follows:
[0102] CAN1_RxPdu1
[0103] CAN1_RxPdu2
[0104] CAN1_RxPdu3
[0105] CAN1_TxPdu1
[0106] CAN1_TxPdu2
[0107] CAN2_RxPdu1
[0108] CAN2_RxPdu2
[0109] CAN2_RxPdu3
[0110] CAN2_TxPdu1
[0111] CAN2_TxPdu2
[0112] CAN3_RxPdu1
[0113] CAN3_RxPdu2
[0114] CAN3_RxPdu3
[0115] CAN3_TxPdu1
[0116] CAN3_TxPdu2
[0117] In this context, CAN1_RxPdu1, CAN1_RxPdu2, and CAN1_RxPdu3 represent the first protocol data units for receiving, corresponding to CAN1 channel, and CAN1_TxPdu1 and CAN1_TxPdu2 represent the second protocol data units for transmitting, corresponding to CAN1 channel.
[0118] CAN2_RxPdu1, CAN2_RxPdu2, and CAN2_RxPdu3 represent the first protocol data units for receiving corresponding to CAN2, and CAN2_TxPdu1 and CAN2_TxPdu2 represent the second protocol data units for transmitting corresponding to CAN2.
[0119] CAN3_RxPdu1, CAN3_RxPdu2, and CAN3_RxPdu3 represent the first protocol data units for receiving corresponding to CAN3, and CAN3_TxPdu1 and CAN3_TxPdu2 represent the second protocol data units for transmitting corresponding to CAN3.
[0120] In this embodiment, the first protocol data unit (Rx Pdu) for receiving and the second protocol data unit (Tx Pdu) for transmitting, corresponding to each CAN channel, are grouped together to ensure that the program can accurately retrieve the correct Pdu based on the first ID and offset when retrieving the PduId of each CAN channel. This grouping avoids confusion that may occur during the retrieval process, such as mistakenly retrieving the PduId of another CAN channel.
[0121] Furthermore, within each group, all received first protocol data units (Rx Pdu) are arranged before the transmitted second protocol data units (Tx Pdu). This ordering strategy takes into account the actual needs of program operation: received messages (Rx) directly affect the program's operating logic and state, while transmitted messages (Tx) are usually used for response or output and have a relatively smaller impact.
[0122] This ordering also helps reduce potential risks caused by errors in Pdu length calculation. If a Pdu goes out of bounds, placing the received Pdu (Rx) before the sent Pdu (Tx) minimizes the impact of erroneous data on subsequent data processing, thereby improving the stability and security of the entire system.
[0123] Furthermore, this structured sorting method makes the RAM partitioning of Can's Pdu clearer and more reasonable. This not only simplifies memory management but also makes the system easier to understand and operate during maintenance and upgrades.
[0124] As another optional embodiment of this application, this embodiment provides a diagnostic routing configuration method. This embodiment is mainly an implementation method for configuring the protocol data unit corresponding to the diagnostic message. The configuration process may include, but is not limited to, the following steps:
[0125] Step S31: Determine the maximum length of the received message and the maximum length of the sent message based on the diagnostic routing requirements for switching from Ethernet communication protocol to CAN communication protocol.
[0126] Step S32: In the electronic control unit configuration module, according to the maximum length of the received message and the maximum length of the sent message, the protocol data unit is configured, and the configured protocol data unit is assigned to the communication adapter module and the CAN communication driver module; the communication driver module is a lower-level module of the communication adapter module.
[0127] Step S33: Divide the first protocol data unit for receiving and the second protocol data unit for transmitting, which are respectively corresponding to each CAN channel, into a group.
[0128] Step S34: Within the group, arrange all the first protocol data units before the second protocol data units.
[0129] For detailed procedures of steps S31-S34, please refer to the relevant description of steps S21-S24 in Example 4, which will not be repeated here.
[0130] Step S35: Merge the second protocol data units within the group to share the corresponding transmission buffer of the group.
[0131] For example, suppose there are 3 CAN channels, each with 3 receive messages (1 functional addressing, 2 physical addressing) and 2 transmit messages (2 physical addressing). Then the CAN module's ordering of PDUs (Protocol Data Units) is as follows:
[0132] CAN1_RxPdu1
[0133] CAN1_RxPdu2
[0134] CAN1_RxPdu3
[0135] CAN1_TxPdu
[0136] CAN2_RxPdu1
[0137] CAN2_RxPdu2
[0138] CAN2_RxPdu3
[0139] CAN2_TxPdu
[0140] CAN3_RxPdu1
[0141] CAN3_RxPdu2
[0142] CAN3_RxPdu3
[0143] CAN3_TxPdu
[0144] In this context, CAN1_RxPdu1, CAN1_RxPdu2, and CAN1_RxPdu3 represent the first protocol data unit for receiving data corresponding to CAN1 channel, and CAN1_TxPdu represents the second protocol data unit for transmitting data corresponding to CAN1 channel.
[0145] CAN2_RxPdu1, CAN2_RxPdu2, and CAN2_RxPdu3 represent the first protocol data unit for receiving, corresponding to the CAN2 channel, and CAN2_TxPdu represents the second protocol data unit for transmitting, corresponding to the CAN2 channel.
[0146] CAN3_RxPdu1, CAN3_RxPdu2, and CAN3_RxPdu3 represent the first protocol data unit for receiving corresponding to CAN3, and CAN3_TxPdu represents the second protocol data unit for transmitting corresponding to CAN3.
[0147] In this embodiment, by merging the second protocol data units within a group, these transmitted data can share the same transmission buffer. This configuration can reduce the number of buffers, thereby optimizing the use of memory resources.
[0148] As another optional embodiment of this application, refer to Figure 4 This is a flowchart illustrating a diagnostic routing configuration method provided in Embodiment 6 of this application. Figure 4 As shown, the method may include, but is not limited to, the following steps:
[0149] Step S301: Obtain at least one object identifier; the object identifier is used to identify the forwarding path of the diagnostic message;
[0150] Step S302: Based on at least one of the object identifiers, generate at least one protocol data unit identifier for each diagnostic message in each target module of the electronic control unit; the value of the protocol data unit identifier and the value of the object identifier remain consistent when corresponding to the same diagnostic message; the values of each protocol data unit identifier are different.
[0151] The protocol data unit identifier is used to identify the protocol data unit corresponding to the diagnostic message.
[0152] Each of the target modules is used to route and forward the diagnostic messages.
[0153] Step S303: Write the protocol data unit identifier corresponding to each diagnostic message into the communication configuration file corresponding to each target module of the electronic control unit.
[0154] For a detailed description of steps S301-S303, please refer to the relevant description of steps S101-S103 in Example 1, which will not be repeated here.
[0155] Step S304: For the functional addressing diagnostic message, configure the processing flow, which includes: passing the functional addressing diagnostic message to the diagnostic module for processing, and copying the functional addressing diagnostic message to the communication adaptation module to complete the routing function.
[0156] Step S304: Configure a receiving confirmation mechanism, which includes: ignoring whether the communication adaptation module has successfully received the function addressing diagnostic message and passing the confirmation result of the diagnostic module on whether it has successfully received the function addressing diagnostic message to the underlying communication module.
[0157] After configuring the processing flow and receiving confirmation mechanism, such as Figure 5 As shown, when the diagnostic module of the electronic control unit receives a diagnostic message, it can determine whether the diagnostic message is a function-addressable diagnostic message. If it is not a function-addressable diagnostic message, it can directly enter the diagnostic message receiving logic, that is, determine whether the reception is successful. If the reception is successful, the diagnostic service is executed according to the diagnostic message, and the return result of successfully receiving the diagnostic message is returned to PduR; if the reception is unsuccessful, the return result of not successfully receiving the diagnostic message is returned to PduR.
[0158] If it is a function-addressable diagnostic message, the diagnostic module can send the diagnostic message to Cdd. Cdd receives the diagnostic message. If Cdd receives it successfully, it forwards the diagnostic message and waits for a response. If Cdd does not receive it successfully, it ends the forwarding process.
[0159] In this embodiment, for functional addressing diagnostic messages, a processing flow is configured. The processing flow includes: passing the functional addressing diagnostic message to the diagnostic module for processing, and copying the functional addressing diagnostic message to the communication adaptation module to complete the routing function. This allows the functional addressing diagnostic message to be passed to both the diagnostic module and the communication adaptation module for processing and routing simultaneously.
[0160] Furthermore, a reception acknowledgment mechanism is configured, which includes: ignoring whether the communication adaptation module successfully received the return result of the functional addressing diagnostic message, and passing the return result of the diagnostic module confirming whether it successfully received the functional addressing diagnostic message to the underlying communication module. The underlying communication module (PduR), as the message transmitter, needs to know whether its upper-layer modules (i.e., the diagnostic module and the communication adaptation module) successfully received the transmitted message. However, in this embodiment, PduR actually has two upper-layer modules that need to confirm the reception result. To simplify the reception acknowledgment process and improve efficiency, only the return result of the diagnostic module can be considered, and the return result of Cdd can be ignored. This is because the single-frame characteristic of the functional addressing diagnostic message makes it almost impossible for Cdd to fail during reception.
[0161] The diagnostic routing configuration device provided in this application will be described below. The diagnostic routing configuration device described below can be referred to in correspondence with the diagnostic routing configuration method described above.
[0162] Reference Figure 6 The diagnostic routing configuration device includes: an acquisition module 100, a generation module 200, and a first configuration module 300.
[0163] The module 100 is used to obtain at least one object identifier; the object identifier is used to identify the forwarding path of the diagnostic message.
[0164] The generation module 200 is configured to generate, based on at least one object identifier, a protocol data unit identifier for each diagnostic message in each target module of the electronic control unit; the value of the protocol data unit identifier and the value of the object identifier are consistent when corresponding to the same diagnostic message; the values of each protocol data unit identifier are different; the protocol data unit identifier is used to identify the protocol data unit corresponding to the diagnostic message; and each target module is used to route and forward the diagnostic message.
[0165] The first configuration module 300 is used to write the protocol data unit identifier corresponding to each diagnostic message into the communication configuration file corresponding to each target module of the electronic control unit.
[0166] The diagnostic routing configuration device may further include:
[0167] A filtering module is used to filter out at least one target object identifier from the at least one object identifier; the target object identifier is used to identify multiplexing of the diagnostic message.
[0168] The second configuration module is used to configure a unique first target protocol data unit identifier for the target object identifier, and write the mapping relationship between the target object identifier and the first target protocol data unit identifier into the configuration file of the transport protocol routing module; the transport protocol routing module is used to perform routing management and periodic monitoring of the diagnostic messages.
[0169] The third configuration module is used to configure multiple second target protocol data unit identifiers for the first target protocol data unit identifier, and write the mapping relationship between the first target protocol data unit identifier and the multiple second target protocol data unit identifiers into the configuration file of the communication adaptation module; the communication adaptation module is used to forward diagnostic messages and diagnostic routing messages.
[0170] The diagnostic routing configuration device may also include:
[0171] The determination module is used to determine the maximum length of the received message and the maximum length of the sent message based on the diagnostic routing requirements for switching from Ethernet communication protocol to CAN communication protocol.
[0172] The fourth configuration module is used in the electronic control unit configuration module to configure the protocol data unit according to the maximum length of the received message and the maximum length of the sent message, and to allocate the configured protocol data unit to the communication adapter module and the CAN communication driver module; the communication driver module is a lower-level module of the communication adapter module.
[0173] The diagnostic routing configuration device may further include:
[0174] The partitioning module is used to group the first protocol data unit for receiving and the second protocol data unit for transmitting, which are respectively associated with each CAN channel, into a group.
[0175] An arrangement module is used to arrange all the first protocol data units before the second protocol data units within the group.
[0176] The diagnostic routing configuration device may further include:
[0177] The merging module is used to merge the second protocol data units within the group to share the corresponding transmission buffer of the group.
[0178] The diagnostic routing configuration device may further include:
[0179] The fifth configuration module is used to configure the processing flow for the function addressing diagnostic message. The processing flow includes: passing the function addressing diagnostic message to the diagnostic module for processing, and copying the function addressing diagnostic message to the communication adaptation module to complete the routing function.
[0180] The sixth configuration module is used to configure a reception confirmation mechanism, which includes: ignoring the return result of whether the communication adaptation module has successfully received the function addressing diagnostic message, and passing the return result of the diagnostic module confirming whether it has successfully received the function addressing diagnostic message to the underlying communication module.
[0181] In another embodiment of this application, a computer program product is provided, including computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the diagnostic routing configuration method as described in any one of embodiments 1-6.
[0182] In another embodiment of this application, an electronic device is provided, including at least one processor and a memory connected to the processor, wherein:
[0183] The memory is used to store computer programs;
[0184] The processor is used to execute the computer program to enable the electronic device to implement the diagnostic routing configuration method as described in any one of Embodiments 1-6.
[0185] In another embodiment of this application, a computer storage medium is provided, the storage medium carrying one or more computer programs, which, when executed by an electronic device, enable the electronic device to implement the diagnostic routing configuration method as described in any one of embodiments 1-6.
[0186] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0187] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0188] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0189] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A method for diagnosing routing configuration, characterized in that, include: Obtain at least one object identifier; the object identifier is used to identify the forwarding path of the diagnostic message; Based on at least one of the object identifiers, a protocol data unit identifier is generated for each diagnostic message in each target module of the electronic control unit; the value of the protocol data unit identifier and the value of the object identifier remain consistent when corresponding to the same diagnostic message. Each of the protocol data unit identifiers has a different value; the protocol data unit identifier is used to identify the protocol data unit corresponding to the diagnostic message; each of the target modules is used to route and forward the diagnostic message; Write the protocol data unit identifier corresponding to each diagnostic message into the communication configuration file corresponding to each target module of the electronic control unit.
2. The diagnostic routing configuration method according to claim 1, characterized in that, The diagnostic routing configuration method also includes: At least one target object identifier is selected from the at least one object identifier; the target object identifier is used to identify multiplexing of the diagnostic message. A unique first target protocol data unit identifier is configured for the target object identifier, and the mapping relationship between the target object identifier and the first target protocol data unit identifier is written into the configuration file of the transport protocol routing module; the transport protocol routing module is used to perform routing management and periodic monitoring of the diagnostic messages; Configure multiple second target protocol data unit identifiers for the first target protocol data unit identifier, and write the mapping relationship between the first target protocol data unit identifier and the multiple second target protocol data unit identifiers into the configuration file of the communication adaptation module; the communication adaptation module is used to forward diagnostic messages and diagnostic routing messages.
3. The diagnostic routing configuration method according to claim 1, characterized in that, The protocol data unit corresponding to the diagnostic message is configured in the following way: Based on the diagnostic routing requirements for switching from Ethernet communication protocol to CAN communication protocol, determine the maximum length of received messages and the maximum length of sent messages; In the electronic control unit configuration module, a protocol data unit is configured according to the maximum length of the received message and the maximum length of the sent message, and the configured protocol data unit is assigned to the communication adapter module and the CAN communication driver module; the communication driver module is a lower-level module of the communication adapter module.
4. The diagnostic routing configuration method according to claim 3, characterized in that, The diagnostic routing configuration method also includes: The first protocol data unit for receiving and the second protocol data unit for transmitting, which correspond to each CAN channel respectively, are grouped together in the protocol data unit corresponding to each diagnostic message. Within the group, all the first protocol data units are arranged before the second protocol data units.
5. The diagnostic routing configuration method according to claim 4, characterized in that, The diagnostic routing configuration method also includes: The second protocol data units within the group are merged to share the corresponding send buffer of the group.
6. The diagnostic routing configuration method according to claim 1, characterized in that, The diagnostic routing configuration method also includes: For functional addressing diagnostic messages, a processing flow is configured, which includes: passing the functional addressing diagnostic message to the diagnostic module for processing, and copying the functional addressing diagnostic message to the communication adaptation module to complete the routing function; and... Configure a reception confirmation mechanism, which includes: ignoring whether the communication adaptation module has successfully received the function addressing diagnostic message and passing the return result of the diagnostic module confirming whether it has successfully received the function addressing diagnostic message to the underlying communication module.
7. A diagnostic routing configuration device, characterized in that, include: An acquisition module is used to acquire at least one object identifier; the object identifier is used to identify the forwarding path of the diagnostic message; A generation module is configured to generate, based on at least one of the object identifiers, a protocol data unit identifier for each diagnostic message in each target module of the electronic control unit; the value of the protocol data unit identifier and the value of the object identifier remain consistent when corresponding to the same diagnostic message; Each of the protocol data unit identifiers has a different value; the protocol data unit identifier is used to identify the protocol data unit corresponding to the diagnostic message; each of the target modules is used to route and forward the diagnostic message; The first configuration module is used to write the protocol data unit identifier corresponding to each diagnostic message into the communication configuration file corresponding to each target module of the electronic control unit.
8. A computer program product, characterized in that, It includes computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the diagnostic routing configuration method as described in any one of claims 1 to 6.
9. An electronic device, characterized in that, It includes at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program to enable the electronic device to implement the diagnostic routing configuration method as described in any one of claims 1 to 6.
10. A computer storage medium, characterized in that, The storage medium carries one or more computer programs that, when executed by an electronic device, enable the electronic device to implement the diagnostic routing configuration method as described in any one of claims 1 to 6.