Communication signal testing method and device based on CAN network

By analyzing communication protocol metadata and source code data, combining CAN communication stack and XCP protocol stack, automated testing of on-board ECU node signals is realized, solving the existing problems of inefficient and error-prone problems, and improving testing efficiency and accuracy.

CN119676126AActive Publication Date: 2025-03-21LIGOO (SHAN DONG) NEW ENERGY TECHNOLOGY CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411699792.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-26
Publication Date
2025-03-21
Estimated Expiration
2044-11-26

AI Technical Summary

Technical Problem

The existing vehicle-mounted ECU node signal testing methods rely on manual testing, which leads to inefficient testing and error-prone, making it difficult to meet the needs of fast iteration and high-quality verification. Especially in complex ECU systems, manual testing is difficult to cover all signals and easily miss potential problems.

Method used

The communication signal testing method based on CAN network is adopted, and the relevant attributes of the signal to be tested are obtained by analyzing the communication protocol metadata, and the intermediate variable is extracted in combination with the source code data, searching for the intermediate variable address information, calling the CAN communication stack and XCP protocol stack of the ECU node, obtaining the set value and received value, performing comparison and testing, and realizing automated testing.

Benefits of technology

Automatic testing of ECU node communication signals is realized, testing efficiency and accuracy is improved, and a large number of signal attributes can be fully covered, avoiding the influence of human factors, and ensuring the performance and stability of ECU nodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119676126A_ABST
    Figure CN119676126A_ABST
Patent Text Reader

Abstract

The invention relates to a communication signal testing method and device based on a CAN network, and belongs to the field of vehicle-mounted ECU node signal testing. The test method comprises the following steps: step 1, acquiring related attributes of a signal to be tested, acquiring an intermediate variable in combination with the related attributes, and searching intermediate variable address information according to the intermediate variable; and 2, calling a CAN communication stack and an XCP protocol stack based on the related attributes, the intermediate variables and the intermediate variable address information, obtaining a set value and a received value, and comparing the received value with the set value or a standard value. According to the method, the related attributes of the to-be-tested signal are extracted firstly, then the intermediate variable of the to-be-tested signal is extracted in combination with the related attributes, and the address information of the intermediate variable is searched according to the intermediate variable, so that the testing device can automatically extract the attributes of a large number of communication signals in the ECU node, and the testing efficiency is improved by means of the existing CAN communication stack and XCP protocol stack of the ECU node. Software of the ECU node does not need to be developed additionally.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of vehicle-mounted ECU node signal testing, and in particular relates to a communication signal testing method and device based on a CAN network. Background Art

[0002] In the software development of modern automotive electronic control unit (ECU) nodes, CAN (Controller Area Network) communication is a key technology for achieving information transmission between different modules. The current communication signal testing method mainly relies on manual testing. This method usually includes using specialized test equipment to simulate the signal input of the ECU, observe its response to CAN messages, and verify the transmission accuracy of each signal. Although these manual testing processes can guarantee the validity of the signal to a certain extent, in complex ECU systems, manual testing is very cumbersome and error-prone due to the large number of messages and signals involved. In addition, existing test equipment usually lacks automation functions, making the test process inefficient and difficult to meet the needs of rapid iteration and high-quality verification.

[0003] The existing communication signal testing methods and devices have significant deficiencies. First, manual testing is not only time-consuming and labor-intensive, but also easily affected by human factors, resulting in inconsistency and unreliability of test results. Secondly, with the continuous increase in the functions of ECU nodes, the number of CAN messages and signals required for testing has increased dramatically. Manual testing methods are difficult to cover all signals and are prone to missing potential problems. Finally, manual testing lacks systematization and standardization, and is difficult to adapt to the rapidly developing automotive electronics technology and increasingly complex testing needs. In the software development of on-board ECU nodes, such as BMS nodes, dozens of CAN messages and thousands of signals need to be sent and received. Each signal needs to be configured with many attributes, such as byte format, start bit, bit length, conversion coefficient, offset, initial value and other information. Comprehensive calculation shows that an ECU node has about thousands to tens of thousands of attribute configurations related to CAN communication signals. It will be a very large and difficult test project to perform signal testing in a manual testing manner and fully test and verify the signal of each CAN message. Therefore, there is an urgent need for a communication signal testing method and device based on a CAN network to achieve more efficient and reliable automated testing to ensure the performance and stability of ECU nodes. Summary of the invention

[0004] The purpose of the present invention is to provide a communication signal testing method and device based on a CAN network in order to solve the above-mentioned problem.

[0005] The present invention achieves the above-mentioned purpose through the following technical solutions:

[0006] A communication signal testing method based on a CAN network, the testing method is used to test multiple signals to be tested on an ECU node, and comprises the following steps:

[0007] S1. Obtain relevant attributes of the signal to be tested by parsing the communication protocol metadata; parse the source code data in combination with the relevant attributes to obtain a specific prefix of the signal to be tested, and extract the intermediate variables of the signal to be tested from the source code data according to the specific prefix; and search for the intermediate variable address information from the memory mapping metadata according to the intermediate variables;

[0008] S2. Based on the relevant attributes, intermediate variables and intermediate variable address information of the signal to be tested, the CAN communication stack and the XCP protocol stack in the ECU node are called to obtain the set value and the received value, and the received value is compared with the set value or the standard value to complete the test of the signal to be tested;

[0009] Wherein, in the process of obtaining the setting value and the receiving value in S2, the type of the signal to be tested is determined. If the signal to be tested is a sending signal, the XCP protocol stack is called for the intermediate value test, the maximum value boundary test and the minimum value boundary test in sequence, and the setting value is established by modifying the intermediate variable in the ECU node, and the CAN communication stack is called to read the CAN message data of the setting value from the ECU node, and the receiving value is calculated;

[0010] If the signal to be tested is a receiving signal, the CAN communication stack is called for the intermediate value test, the maximum value boundary test, and the minimum value boundary test in sequence, and the setting value is established by modifying the intermediate variable in the ECU node. The CAN communication stack is called to send CAN message data to the ECU node, the intermediate variable is modified, and the XCP protocol stack is called to mark the intermediate variable to form the receiving value;

[0011] The CAN communication stack is used to process data interaction between ECU nodes and other nodes. ECU nodes are connected to other nodes through the CAN bus. The XCP protocol stack is a standard protocol for ECU nodes, which is designed to support ECU calibration, diagnosis and testing;

[0012] As a further optimization solution of the present invention, when the signal to be tested is a transmission signal, the process of the intermediate value test is as follows:

[0013] According to the relevant attributes of the sending signal, the intermediate variables and the intermediate variable address information, the XCP protocol stack in the ECU node is called to modify the intermediate variables in the ECU node, thereby establishing the intermediate set value SettedMidValue of the sending signal;

[0014] Call the CAN communication stack in the ECU node, read the CAN message data corresponding to the intermediate set value SettedMidValue from the ECU node, and calculate the intermediate received value ReceivedMidValue based on the relevant attributes of the sent signal;

[0015] Compare the intermediate set value SettedMidValue of the transmitted signal with the intermediate received value ReceivedMidValue. If the intermediate set value SettedMidValue is the same as the intermediate received value ReceivedMidValue, the intermediate value test passes; otherwise, the intermediate value test fails.

[0016] As a further optimization solution of the present invention, when the signal to be tested is a received signal, the process of the intermediate value test is as follows:

[0017] According to the relevant attributes, intermediate variables and intermediate variable address information of the received signal, the CAN communication stack in the ECU node is called to modify the intermediate variables in the ECU node, thereby establishing the intermediate set value SettedMidValue of the received signal, and calculating the message value corresponding to the intermediate set value SettedMidValue in combination with the relevant attributes of the received signal, and filling the message value into the CAN message data where the received signal is located;

[0018] Call the CAN communication stack in the ECU node, send the CAN message data to the ECU node, modify the intermediate variables, call the XCP protocol stack in the ECU node, mark the intermediate variables, and form the intermediate received value ReceivedMidValue of the received signal;

[0019] The intermediate set value SettedMidValue of the received signal is compared with the intermediate received value ReceivedMidValue. If the intermediate set value SettedMidValue is the same as the intermediate received value ReceivedMidValue, the intermediate value test passes; otherwise, the intermediate value test fails.

[0020] As a further optimization scheme of the present invention, the process of the maximum value test is as follows:

[0021] Establishing a maximum set value SettedMaxValue and a maximum received value ReceivedMaxValue of the signal to be tested, wherein the maximum received value ReceivedMaxValue is established in the same manner as the intermediate received value ReceivedMidValue, the signal to be tested has a maximum standard value MaxValue, and determining whether the maximum standard value MaxValue is the maximum expressible value of the signal to be tested;

[0022] If the judgment result is "yes", let SettedMaxValue=MaxValue, and analyze whether ReceivedMaxValue is the same as SettedMaxValue; if the judgment result is "no", let SettedMaxValue=MaxValue+1, and analyze whether ReceivedMaxValue is the same as SettedMaxValue.

[0023] As a further optimization scheme of the present invention, the process of the minimum value test is as follows:

[0024] Establishing a minimum set value SettedMinValue and a minimum received value ReceivedMinValue of the signal to be tested, wherein the minimum received value ReceivedMinValue is established in the same manner as the intermediate received value ReceivedMidValue, the signal to be tested has a minimum standard value MinValue, and determining whether the minimum standard value MinValue is the minimum expressible value of the signal to be tested;

[0025] If the judgment result is "yes", let SettedMinValue=MinValue, and analyze whether ReceivedMinValue is the same as SettedMinValue; if the judgment result is "no", let SettedMinValue=MinValue-1, and analyze whether ReceivedMinValue is the same as SettedMinValue.

[0026] As a further optimization solution of the present invention, the detection of the signal to be tested also includes an initial value test, and the process of the initial value test is as follows:

[0027] When the signal to be tested is a sending signal, after the ECU node is powered on, the CAN communication stack is called to parse the initial receiving value ReceivedInitValue of the sending signal to determine whether the initial receiving value ReceivedInitValue is the same as the initial standard value InitValue of the sending signal;

[0028] When the signal to be measured is a receiving signal, after the ECU node is powered on, the XCP protocol stack is called to read the value of the intermediate variable of the receiving signal to determine whether the value of the intermediate variable is the same as the initial standard value InitValue of the receiving signal.

[0029] A communication signal testing device based on a CAN network, the testing device is used to test multiple signals to be tested on an ECU node, comprising:

[0030] An information extraction module is used to obtain relevant attributes of the signal to be tested; obtain a specific prefix of the signal to be tested in combination with the relevant attributes, and extract an intermediate variable of the signal to be tested according to the specific prefix; and search for intermediate variable address information according to the intermediate variable;

[0031] The test module is called to call the CAN communication stack and the XCP protocol stack in the ECU node according to the relevant attributes, intermediate variables and intermediate variable address information of the signal to be tested, obtain the set value and the received value, compare the received value with the set value or the standard value, and complete the test of the signal to be tested.

[0032] As a further optimization solution of the present invention, the calling test module includes:

[0033] CAN driver unit, used to exchange data with ECU nodes via CAN bus;

[0034] The communication stack calling unit is used to cooperate with the CAN driver unit to call the CAN communication stack of the ECU node;

[0035] The protocol stack calling unit is used to cooperate with the CAN driver unit to call the XCP protocol stack of the ECU node;

[0036] The data processing unit is used to perform data processing and analysis on the signal to be tested.

[0037] The beneficial effects of the present invention are:

[0038] 1) During the test, the present invention first extracts the relevant attributes of the signal to be tested, then extracts the intermediate variables of the signal to be tested in combination with the relevant attributes, and searches for the intermediate variable address information according to the intermediate variables, so that the test device can automatically extract a large number of communication signal attributes in the ECU node, the test speed is fast, and error-free and full coverage of the signal test is achieved;

[0039] 2) When testing the sending signal, the present invention adopts the method of "XCP protocol stack modification-CAN communication stack reading-verification" for detection, and when testing the receiving signal, the method of "CAN communication stack modification-XCP protocol stack back reading-verification" is adopted for detection. The test device calls the existing CAN communication stack and XCP protocol stack of the ECU node, and no additional software development of the ECU node is required. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 is a flow chart of the testing method of the present invention;

[0041] Figure 2 It is a schematic diagram of the structure of the testing device of the present invention;

[0042] Figure 3 Here is a screenshot of the signal properties in the DBC file. DETAILED DESCRIPTION

[0043] The present application is further described in detail below in conjunction with the accompanying drawings. It is necessary to point out here that the following specific implementation methods are only used to further illustrate the present application and cannot be understood as limiting the scope of protection of the present application. Technical personnel in this field can make some non-essential improvements and adjustments to the present application based on the above application content.

[0044] First embodiment

[0045] like Figure 1 and Figure 2 As shown, this embodiment relates to a communication signal testing method based on a CAN network, which is used to test multiple signals to be tested on an ECU node. The ECU node is connected to a testing device via a CAN bus. The testing device tests the signals to be tested one by one in alphabetical order of the signal names. The following modules are arranged inside the ECU node: a runtime environment system signal module, a communication management module, a PDU routing module, a CAN interface module, a driver module, and an XCP protocol stack. The above modules correspond to Figure 2 The RTE_SystemSignal module, Com module, PduR module, CanIf module, Can module and XCP protocol stack in the ECU. The Com module, PduR module, CanIf module and Can module together constitute the CAN communication stack of the ECU node. The above Com module consists of a sending signal management unit, a receiving signal management unit, a sending PDU unit, and a receiving PDU unit. The SWC above the RTE_SystemSignal module is the application layer, and SWC is the abbreviation of Software Component.

[0046] Among them, the RTE_SystemSignal module is used to generate intermediate variables in the RTE (Run-Time Environment) of the ECU node. The Com module is responsible for managing the mapping of signals to PDUs (protocol data units) and the transmission of the signals to be tested in the network, and provides the packaging and unpacking functions between signals and PDUs. The PduR module is used to route PDUs between different communication modules. It ensures that PDUs from different buses (such as CAN, LIN, FlexRay) can be correctly routed to the target module. The CanIf module is responsible for providing a CAN bus interface for the upper-level communication modules (such as the Com module). It handles the sending and receiving of CAN data frames and manages the basic services of CAN communication. The Can module is responsible for handling the actual physical transmission of CAN bus data and executing the sending and receiving of CAN bus frames.

[0047] In addition, the four units in the Com module correspond to Figure 1 The ComTxSignal unit, ComRxSignal unit, ComTxIPdu unit, and ComRxIPdu unit in the CAN bus are as follows. The ComTxSignal unit is responsible for managing the signals to be sent from the application layer, passing the signals to the lower layer for packaging and transmission. The ComRxSignal unit is responsible for managing the received signals, unpacking them and passing them to the application layer for use. The ComTxIPdu unit is responsible for packaging the signals to be sent into PDUs (protocol data units) and passing them to the lower layer modules (such as PduR modules or CanIf modules) to prepare for sending on the CAN network. The ComRxIPdu unit is responsible for extracting signals from the PDUs received by the lower layer modules (such as the CanIf modules), unpacking them into separate signals and passing them to the upper layer modules (such as the RTE_SystemSignal modules).

[0048] The signals to be tested are divided into sending signals and receiving signals. This embodiment takes the sending signal as an example. The testing method includes the following steps:

[0049] Step S1, receiving communication protocol metadata, source code data and memory mapping metadata through the data calculation module, that is, obtaining DBC files, Rte.c files and Map files through the test equipment, wherein the DBC (Database CAN) file is a communication protocol metadata in a standard file format for describing communications in a CAN network; RTE is the English abbreviation for runtime environment (Runtime Environment), and the Rte.c file is a C code file generated according to the AUTOSAR (Automotive Open System Architecture) model, which is source code data responsible for realizing communication and data exchange between functional components within the ECU; the Map file is a mapping file, which is memory mapping metadata for describing the memory distribution and variable allocation of software modules or ECU functions.

[0050] The test equipment extracts the data received by the data receiving module through its built-in information extraction module, that is, extracts the relevant attributes, intermediate variables and address information of each signal to be tested from the communication protocol metadata, source code data and memory mapping metadata. The relevant attributes, intermediate variables and address information are the key information of the signal to be tested. The extraction of key information is divided into the following steps:

[0051] 1) Obtain relevant properties of the signal to be tested by parsing the DBC file.

[0052] 2) Parse the Rte.c file in combination with relevant attributes to obtain a specific prefix of the signal to be tested, and extract the intermediate variables of the signal to be tested from the Rte.c file based on the specific prefix.

[0053] 3) According to the intermediate variable, search for the intermediate variable address information from the Map file.

[0054] The above specific prefix is ​​obtained by the RTE tool that generates the Rte.c file. The RTE tool has corresponding prefix rules when generating specific prefixes. During the actual vehicle ECU node signal test, the corresponding RTE tool can be selected to parse the Rte.c file according to the manufacturer's needs.

[0055] After extracting the key information of the transmitted signal, perform the following test steps:

[0056] Step S2, determine the type of the signal to be tested, clarify whether the signal to be tested is a sending signal or a receiving signal, and based on the relevant attributes of the signal to be tested, the intermediate variables and the intermediate variable address information, call the CAN communication stack and the XCP protocol stack in the ECU node, process and analyze the signal to be tested, and obtain the set value and the received value. In this embodiment, the sending signal is taken as an example, and each signal to be tested is clearly a sending signal after judgment. Compare the received value with the set value or the standard value to complete the test of a signal to be tested. Repeat the above step S2 to perform numerical detection on other signals to be tested. It should be noted that the above-mentioned received value includes the intermediate received value ReceivedMidValue, the maximum received value ReceivedMaxValue and the minimum received value ReceivedMinValue, the initial received value ReceivedInitValue parsed by the CAN communication stack and the value of the intermediate variable of the received signal read by the XCP protocol stack also belong to the received value. The above-mentioned set value includes the intermediate set value SettedMidValue, the maximum set value SettedMaxValue and the minimum set value SettedMinValue. The above-mentioned standard value includes the maximum standard value MaxValue, the minimum standard value MinValue and the initial standard value InitValue.

[0057] The value detection of the signal to be tested includes an intermediate value test. In the value detection process of step S2, the intermediate value of the transmitted signal is detected by adopting the method of "XCP protocol stack modification-CAN communication stack reading-verification".

[0058] Next, we take the sending signal SignalTxA as an example to illustrate the entire test process:

[0059] In step S1, the DBC file, Rte.c file and Map file are first input into the test equipment, which consists of a data receiving module, an information extraction module and a calling test module. The DBC file, Rte.c file and Map file are received by the data receiving module.

[0060] Then extract the key information of the transmitted signal SignalTxA. The extraction process is as follows:

[0061] 1) The information extraction module of the test device parses the DBC file and extracts NameA, StartBitA, BitLengthA, FactorA, OffsetA, ByteOrderA, MaxValueA, MinValueA, ValueTypeA, and InitValueA of SignalTxA.

[0062] Among them, NameA is the signal name of the transmitted signal SignalTxA, StarBitA is the starting bit of the transmitted signal SignalTxA, BitLenghtA is the bit length of the transmitted signal SignalTxA, FactorA is the conversion coefficient of the transmitted signal SignalTxA, OffsetA is the offset of the transmitted signal SignalTxA, ByteOrderA is the byte order of the transmitted signal SignalTxA, MaxValueA is the maximum standard value of the transmitted signal SignalTxA, MinValueA is the minimum standard value of the transmitted signal SignalTxA, ValueTypeA is the value type of the transmitted signal SignalTxA, and InitValueA is the initial standard value of the transmitted signal SignalTxA.

[0063] 2) The information extraction module combines NameA with the Rte.c file to find the intermediate variable RteNameA in the Rte corresponding to the sending signal SignalTxA.

[0064] 3) The information extraction module combines the intermediate variable RteNameA in Rte with the map file to find the intermediate variable address information RteNameA_Address in Rte.

[0065] In step S2, it is determined that the signal to be tested is a transmission signal, and the transmission signal SignalTxA is tested as follows:

[0066] ① Test of the middle value

[0067] ② Maximum value boundary test

[0068] ③ Minimum boundary test

[0069] ④Testing of initial value

[0070] Among them, the intermediate value of SignalTxA can verify the following parameters: StartBitA, BitLenghtA, FactorA, OffsetA, ValueTypeA, ByteOrderA.

[0071] The testing process for the intermediate value is as follows:

[0072] 1) The test device combines the following related attributes of the extracted transmission signal SignalTxA, RteNameA, RteNameA_Address, BitLengthA, ValueTypeA, confirms the data type of RetNameA (such as uint8 / uint16 / uint32 / sint8 / sin16 / sint32 / float32, etc.), and modifies the intermediate variable RteNameA in the ECU to the intermediate set value SettedMidValueA by calling the XCP protocol stack;

[0073] 2) The test device calls the CAN communication stack by calling the test module and the CAN bus, so that the intermediate set value SettedMidValueA of the sending signal SignalTxA passes through the RTE_SystemSignal module, the Com module, the PduR module, the CanIf module, the Can module and the CAN bus in sequence and reaches the test device;

[0074] 3) The test device reads the CAN message data where SignalTxA is located, and calculates the intermediate received value ReceivedMidValueA of SignalTxA by combining the attributes of StartBitA, BitLenghtA, FactorA, OffsetA, ValueTypeA, and ByteOrderA;

[0075] 4) Compare the intermediate set value SettedMidValueA of the transmitted signal with the intermediate received value ReceivedMidValueA. If the intermediate set value SettedMidValueA is the same as the intermediate received value ReceivedMidValueA, the intermediate value test passes; otherwise, the intermediate value test fails.

[0076] The bounds of the maximum value are tested as follows:

[0077] Since the MaxValueA, i.e. the maximum value, of SignalTxA is described in the dbc file, this attribute cannot be covered in the test of the intermediate value and needs to be tested separately.

[0078] The specific testing process is as follows:

[0079] 1) Establishing a maximum set value SettedMaxValueA and a maximum received value ReceivedMaxValueA of the transmitted signal SignalTxA, wherein the maximum received value ReceivedMaxValueA is established in the same manner as the intermediate received value ReceivedMidValueA of the transmitted signal SignalTxA, the signal to be tested has a maximum standard value MaxValueA, and determining whether the maximum standard value MaxValueA is the maximum expressible value of the signal to be tested;

[0080] 2) If the judgment result is "yes", then let SettedMaxValueA = MaxValueA, and compare and analyze whether ReceivedMaxValueA is the same as SettedMaxValueA; if the judgment result is "no", then let SettedMaxValueA = MaxValueA + 1, and compare and analyze whether ReceivedMaxValueA is the same as SettedMaxValueA. In the above comparative analysis, when the analysis result is "same", the maximum value boundary test passes, and when the analysis result is "different", the maximum value boundary test fails.

[0081] The bounds test for the minimum value is as follows:

[0082] Since the MinValueA, i.e. the minimum value, of SignalTxA is described in the dbc file, this attribute cannot be covered in the test of the intermediate value and needs to be tested separately.

[0083] The specific testing process is as follows:

[0084] 1) establishing a minimum set value SettedMinValueA and a minimum received value ReceivedMinValueA of the transmitted signal SignalTxA, wherein the establishment method of the minimum received value ReceivedMinValueA is the same as the establishment method of the intermediate received value ReceivedMidValueA of the transmitted signal SignalTxA, the signal to be tested has a minimum standard value MinValueA, and determining whether the minimum standard value MinValueA is the minimum expressible value of the signal to be tested;

[0085] 2) If the judgment result is "yes", then set SettedMinValueA = MinValueA, and compare and analyze whether ReceivedMinValueA is the same as SettedMinValueA; if the judgment result is "no", then set SettedMinValueA = MinValueA-1, and compare and analyze whether ReceivedMinValueA is the same as SettedMinValueA. In the above comparative analysis, when the analysis result is "same", the maximum value boundary test passes, and when the analysis result is "different", the maximum value boundary test fails.

[0086] The initial value is tested as follows:

[0087] The initial value InitValueA of SignTxA also needs to be tested separately.

[0088] The specific testing process is as follows:

[0089] After the ECU node is powered on, no XCP calibration is performed. The test device calls the CAN communication stack by calling the test module and the CAN bus. Only the initial received value ReceivedInitValueA of the sent signal is parsed through the CAN communication stack. The initial received value ReceivedInitValueA is compared and analyzed to see if it is the same as the initial standard value InitValueA. If the analysis result is "same", the initial value test passes. If the analysis result is "different", the initial value test fails. The order of the test items for the intermediate value test, the maximum value boundary test, the minimum value boundary test, and the initial value test can be adjusted according to actual needs. In the actual test process, only some of the test items in the above tests can be tested. Then, other signals to be tested are tested according to step S2.

[0090] Second embodiment

[0091] See also Figure 1 and Figure 2 This embodiment relates to a communication signal testing method based on a CAN network. This embodiment takes a received signal as an example. The first two steps of this embodiment are consistent with the previous embodiment. In the third step, the intermediate value of the received signal is detected by using the "CAN communication stack modification-XCP protocol stack readback-verification" method.

[0092] Next, we take the receiving signal SignalRxB as an example to illustrate the entire test process:

[0093] In step S1, the DBC file, Rte.c file and Map file are first input into the test equipment, which consists of a data receiving module, an information extraction module and a calling test module. The DBC file, Rte.c file and Map file are received by the data receiving module.

[0094] Then determine that the signal to be tested is a receiving signal, and extract the key information of the receiving signal SignalRxB. The extraction process is as follows:

[0095] 1) The information extraction module of the test device parses the DBC file and extracts NameB, StartBitB, BitLengthB, FactorB, OffsetB, ByteOrderB, MaxValueB, MinValueB, ValueTypeB, and InitValueB of SignalRxB.

[0096] Among them, NameB is the signal name of the received signal SignalRxB, StarBitB is the starting bit of the received signal SignalRxB, BitLenghtB is the bit length of the received signal SignalRxB, FactorB is the conversion coefficient of the received signal SignalRxB, OffsetB is the offset of the received signal SignalRxB, ByteOrderB is the byte order of the received signal SignalRxB, MaxValueB is the maximum standard value of the received signal SignalRxB, MinValueB is the minimum standard value of the received signal SignalRxB, ValueTypeB is the value type of the received signal SignalRxB, and InitValueB is the initial standard value of the received signal SignalRxB.

[0097] 2) The information extraction module combines NameB with the Rte.c file to find the intermediate variable RteNameB in the corresponding Rte of the received signal SignalRxB.

[0098] 3) The information extraction module combines the intermediate variable RteNameB in Rte with the map file to find the intermediate variable address information RteNameB_Address in Rte.

[0099] In step S2, SignalRxB is tested as follows:

[0100] ① Test of the middle value

[0101] ② Maximum value boundary test

[0102] ③ Minimum boundary test

[0103] ④Testing of initial value

[0104] Among them, the intermediate value of SignalRxB can verify the following parameters: StartBitB, BitLenghtB, FactorB, OffsetB, ValueTypeB, ByteOrderB.

[0105] The testing process for the intermediate value is as follows:

[0106] 1) The test device combines the following related attributes of the extracted receiving signal SignalRxB, RteNameB, RteNameB_Address, BitLengthB, ValueTypeB, confirms the data type of RetNameB (such as uint8 / uint16 / uint32 / sint8 / sin16 / sint32 / float32, etc.), first sets SignalRxB to the physical value SettedMidValueB, combines StartBitB, BitLengthB, FactorB, OffsetB, ValueTypeB, ByteOrderB to calculate the message value of SignalRxB as SignalTxB_MessageValueB, and fills it into the CAN message data where SignalRxB is located;

[0107] 2) The test device calls the CAN communication stack in the ECU node by calling the test module and the CAN bus. SignalTxB_MessageValueB passes through the Can bus, the Can module, the CanIf module, the PduR module, and the Com module, and reaches the RTE_SystemSignal module to modify the intermediate variable RteNameB.

[0108] 3) The test device calls the XCP protocol stack in the ECU node by calling the test module and the CAN bus, reads the value of the intermediate variable RteNameB, and marks it as the intermediate received value ReceivedMidValueB;

[0109] 4) Compare the intermediate set value SettedMidValueB of the received signal with the intermediate received value ReceivedMidValueB. If the intermediate set value SettedMidValueB is the same as the intermediate received value ReceivedMidValueB, the intermediate value test passes; otherwise, the intermediate value test fails.

[0110] The bounds of the maximum value are tested as follows:

[0111] Since the MaxValueB of SignalTxB, i.e. the maximum value, is described in the dbc file, this attribute cannot be covered in the test of the intermediate value and needs to be tested separately.

[0112] The specific testing process is as follows:

[0113] 1) Establishing a maximum set value SettedMaxValueB and a maximum received value ReceivedMaxValueB of a received signal SignalRxB, wherein the maximum received value ReceivedMaxValueB is established in the same manner as the intermediate received value ReceivedMidValueB of the received signal SignalRxB, the signal to be tested has a maximum standard value MaxValueB, and determining whether the maximum standard value MaxValueB is the maximum expressible value of the signal to be tested;

[0114] 2) If the judgment result is "yes", then set SettedMaxValueB = MaxValueB, and compare and analyze whether ReceivedMaxValueB is the same as SettedMaxValueB; if the judgment result is "no", then set SettedMaxValueB = MaxValueB + 1, and compare and analyze whether ReceivedMaxValueB is the same as SettedMaxValueB. In the above comparative analysis, when the analysis result is "same", the maximum value boundary test passes, and when the analysis result is "different", the maximum value boundary test fails.

[0115] The bounds test for the minimum value is as follows:

[0116] Since the dbc file describes MinValueB, the minimum value, of SignalTxB, this property cannot be covered in the test of the intermediate value and needs to be tested separately.

[0117] The specific testing process is as follows:

[0118] 1) establishing a minimum set value SettedMinValueB and a minimum received value ReceivedMinValueB of the received signal SignalRxB, wherein the establishment method of the minimum received value ReceivedMinValueB is the same as the establishment method of the intermediate received value ReceivedMidValueB of the received signal SignalRxB, the signal to be tested has a minimum standard value MinValueB, and determining whether the minimum standard value MinValueB is the minimum expressible value of the signal to be tested;

[0119] 2) If the judgment result is "yes", then set SettedMinValueB = MinValueB, and compare and analyze whether ReceivedMinValueB is the same as SettedMinValueB; if the judgment result is "no", then set SettedMinValueB = MinValueB-1, and compare and analyze whether ReceivedMinValueB is the same as SettedMinValueB. In the above comparative analysis, when the analysis result is "same", the maximum value boundary test passes, and when the analysis result is "different", the maximum value boundary test fails.

[0120] The initial value is tested as follows:

[0121] The initial value InitValueB of SignTxB also needs to be tested separately.

[0122] The specific testing process is as follows:

[0123] After the ECU node is powered on, the test device calls the XCP protocol stack by calling the test module and the CAN bus, reads the value RteNameB of the intermediate variable of the received signal, and determines whether the value RteNameB of the intermediate variable is the same as the initial standard value InitValueB of the received signal. If the judgment result is "yes", the initial value test passes, and if the judgment result is "no", the initial value test fails. Then, other signals to be tested are tested according to step S2.

[0124] Figure 3 The relevant properties of the signal to be tested in the DBC file are displayed, where "Name" is the signal name, "Length[Bit]" is the bit length, "Byte Order" is the byte order, "Unit" is the physical unit of the signal or parameter, "Value Type" is the value type, "Init.Value" is the initial value, "Factor" is the conversion coefficient, "Offset" is the offset, "Minimum" is the minimum value, "Maximum" is the maximum value, and "Value Table" is the value comparison table. In the prior art, the signals to be tested in the vehicle CAN network are generally tested one by one by manual search and manual inspection. The defect analysis of this test scheme is as follows:

[0125] There are a large number of signals to be tested in the vehicle CAN network, and each signal has many attributes. Manual testing is complicated, time-consuming and labor-intensive, and it is difficult to achieve full coverage testing under manual testing. Taking the BMS node of a recent vehicle project as an example, there are about 2,000 signals to be tested, each with about 10 attributes, for a total of about 20,000 attributes that need to be tested. If each attribute requires 5 seconds to be manually tested, it will take about 100,000 seconds, or 27 hours. This technical solution can also avoid problems such as missed tests and test errors that are prone to occur in manual testing. In summary, compared with existing manual testing, the first and second embodiments have the following advantages:

[0126] 1) Automatically extract attributes and test automatically, with fast speed, full coverage and no errors;

[0127] 2) By using the existing CAN communication stack and XCP protocol stack of the ECU node, no additional development is required for the software of the ECU node.

[0128] Third embodiment

[0129] like Figure 2 As shown, this embodiment relates to a communication signal testing device based on a CAN network, which is applicable to the communication signal testing methods in the first two embodiments. The testing device comprises:

[0130] Data receiving module, used to receive DBC files, Rte.c files and Map files;

[0131] The information extraction module is used to parse the DBC file, Rte.c file and Map file to extract the key information of one of the signals to be tested. The information extraction module consists of a DBC parsing unit, a variable extraction unit and an address extraction unit. The DBC parsing unit is used to obtain the relevant attributes of the signal to be tested through the DBC file. The variable extraction unit is used to parse the Rte.c file in combination with the relevant attributes, obtain the specific prefix of the signal to be tested, and extract the intermediate variables of the signal to be tested from the Rte.c file based on the specific prefix. The address extraction unit is used to search for the intermediate variable address information from the Map file based on the intermediate variable.

[0132] The calling test module is used to call the CAN communication stack and the XCP protocol stack in the ECU node in combination with the key information to perform a numerical detection on the signal to be tested. The internal structure of the ECU node refers to the introduction in the first embodiment and will not be described in detail.

[0133] The signals to be tested are divided into sending signals and receiving signals. The numerical detection of the signals to be tested includes intermediate value test, maximum value boundary test, minimum value boundary test and initial value test. In the process of calling the numerical detection of the test module:

[0134] When the measured signal is a sending signal, the test module is called to detect the intermediate value of the sending signal using the "XCP protocol stack modification-CAN communication stack reading-verification" method;

[0135] When the measured signal is a receiving signal, the test module is called to detect the intermediate value of the receiving signal using the "CAN communication stack modification-XCP protocol stack readback-verification" method.

[0136] The call test module includes a CAN driver unit, a communication stack call unit, a protocol stack call unit and a data processing unit. The CAN driver unit is used to exchange data with the ECU node through the CAN bus. The communication stack call unit cooperates with the CAN driver unit and the CAN bus to communicate with the ECU node, thereby realizing the call of the CAN communication stack of the ECU node. The protocol stack call unit cooperates with the CAN driver unit and the CAN bus to communicate with the ECU node, thereby realizing the call of the XCP protocol stack of the ECU node. The data processing unit is used to perform data processing and analysis on the signal to be tested.

[0137] In the application of the above two embodiments, when the test device tests the sending signal SignalTxA, the DBC file, Rte.c file and Map file are parsed by the information extraction module. The XCP protocol stack is called by the communication stack calling unit to modify the intermediate variable RteNameA of the sending signal SignalTxA to establish a setting value. In each test item, the data processing unit can calculate the intermediate received value ReceivedMidValueA, the maximum received value ReceivedMaxValueA, and the minimum received value ReceivedMinValueA of the sending signal SignalTxA respectively. The data processing unit can also compare and analyze the setting value in the intermediate value test, the maximum value boundary test and the minimum value boundary test with the received value, and can compare and analyze the standard value in the initial value test with the received value.

[0138] In the process of testing the receiving signal SignalRxB, the test device parses the DBC file, Rte.c file and Map file through the information extraction module, sets the receiving signal SignalRxB to a physical value through the data processing unit in combination with the relevant attributes of the receiving signal SignalRxB, calculates the message value, and fills the message value into the CAN message data where SignalRxB is located. By calling the test module and the CAN bus, the CAN communication stack in the ECU node is called, and the message value reaches the RTE_SystemSignal module to form an intermediate variable. The intermediate variable is read through the XCP protocol stack to obtain the received value. By comparing and analyzing the set value with the received value, it is determined whether the test can pass. In the initial value test process, the data processing unit only needs to compare and analyze the received value with the standard value. The received value is the value of the intermediate variable of the received signal to be tested read by the XCP protocol.

[0139] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention.

Claims

1. A communication signal testing method based on a CAN network, the testing method is used to test multiple signals to be tested on an ECU node, characterized in that: The following steps are involved: S1. Obtain relevant attributes of the signal to be tested; obtain a specific prefix of the signal to be tested in combination with the relevant attributes, and extract an intermediate variable of the signal to be tested according to the specific prefix; and search for intermediate variable address information according to the intermediate variable; S2. Based on the relevant attributes, intermediate variables and intermediate variable address information of the signal to be tested, the CAN communication stack and the XCP protocol stack in the ECU node are called to obtain the set value and the received value, and the received value is compared with the set value or the standard value to complete the test of the signal to be tested; Wherein, in the process of obtaining the setting value and the receiving value in S2, the type of the signal to be tested is determined. If the signal to be tested is a sending signal, the XCP protocol stack is called for the intermediate value test, the maximum value boundary test and the minimum value boundary test in sequence, the setting value is established by modifying the intermediate variable, the CAN communication stack is called, the CAN message data of the setting value is read and the receiving value is calculated; If the signal to be tested is a receiving signal, the intermediate value test, maximum value boundary test and minimum value boundary test are performed in sequence, the CAN communication stack is called, the setting value is established by modifying the intermediate variable, the CAN communication stack is called, the CAN message data is sent and the intermediate variable is modified, and the XCP protocol stack is called to mark the intermediate variable to form the receiving value.

2. The communication signal testing method according to claim 1, characterized in that: When the signal to be tested is a transmission signal, the process of the intermediate value test is as follows: According to the relevant attributes of the sending signal, the intermediate variables and the intermediate variable address information, the XCP protocol stack in the ECU node is called to modify the intermediate variables in the ECU node, thereby establishing the intermediate set value SettedMidValue of the sending signal; Call the CAN communication stack in the ECU node, read the CAN message data corresponding to the intermediate set value SettedMidValue from the ECU node, and calculate the intermediate received value ReceivedMidValue based on the relevant attributes of the sent signal; The intermediate set value SettedMidValue of the transmitted signal is compared with the intermediate received value ReceivedMidValue. If the intermediate set value SettedMidValue is the same as the intermediate received value ReceivedMidValue, the intermediate value test passes; otherwise, the intermediate value test fails.

3. The communication signal testing method according to claim 2, characterized in that: When the signal to be tested is a received signal, the process of the intermediate value test is as follows: According to the relevant attributes, intermediate variables and intermediate variable address information of the received signal, the CAN communication stack in the ECU node is called to modify the intermediate variables in the ECU node, thereby establishing the intermediate set value SettedMidValue of the received signal, and calculating the message value corresponding to the intermediate set value SettedMidValue in combination with the relevant attributes of the received signal, and filling the message value into the CAN message data where the received signal is located; Call the CAN communication stack in the ECU node, send the CAN message data to the ECU node, modify the intermediate variables, call the XCP protocol stack in the ECU node, mark the intermediate variables, and form the intermediate received value ReceivedMidValue of the received signal; The intermediate set value SettedMidValue of the received signal is compared with the intermediate received value ReceivedMidValue. If the intermediate set value SettedMidValue is the same as the intermediate received value ReceivedMidValue, the intermediate value test passes; otherwise, the intermediate value test fails.

4. The communication signal testing method according to claim 3, characterized in that: The process of the maximum value test is as follows: Establishing a maximum set value SettedMaxValue and a maximum received value ReceivedMaxValue of the signal to be tested, wherein the maximum received value ReceivedMaxValue is established in the same manner as the intermediate received value ReceivedMidValue, the signal to be tested has a maximum standard value MaxValue, and determining whether the maximum standard value MaxValue is the maximum expressible value of the signal to be tested; If the judgment result is "yes", let SettedMaxValue=MaxValue, and analyze whether ReceivedMaxValue is the same as SettedMaxValue; if the judgment result is "no", let SettedMaxValue=MaxValue+1, and analyze whether ReceivedMaxValue is the same as SettedMaxValue.

5. The communication signal testing method according to claim 3, characterized in that: The process of the minimum value test is as follows: Establishing a minimum set value SettedMinValue and a minimum received value ReceivedMinValue of the signal to be tested, wherein the minimum received value ReceivedMinValue is established in the same manner as the intermediate received value ReceivedMidValue, the signal to be tested has a minimum standard value MinValue, and determining whether the minimum standard value MinValue is the minimum expressible value of the signal to be tested; If the judgment result is "yes", let SettedMinValue=MinValue, and analyze whether ReceivedMinValue is the same as SettedMinValue; if the judgment result is "no", let SettedMinValue=MinValue-1, and analyze whether ReceivedMinValue is the same as SettedMinValue.

6. The communication signal testing method according to claim 3, characterized in that: The detection of the signal to be tested also includes an initial value test, and the process of the initial value test is as follows: When the signal to be tested is a sending signal, after the ECU node is powered on, the CAN communication stack is called to parse the initial receiving value ReceivedInitValue of the sending signal to determine whether the initial receiving value ReceivedInitValue is the same as the initial standard value InitValue of the sending signal; When the signal to be measured is a receiving signal, after the ECU node is powered on, the XCP protocol stack is called to read the value of the intermediate variable of the receiving signal to determine whether the value of the intermediate variable is the same as the initial standard value InitValue of the receiving signal.

7. A communication signal testing device based on a CAN network, the testing device is used to test multiple signals to be tested on an ECU node, characterized in that: include: An information extraction module, used to obtain relevant properties of the signal to be tested; Acquire a specific prefix of the signal to be tested in combination with the related attributes, and extract an intermediate variable of the signal to be tested according to the specific prefix; search for intermediate variable address information according to the intermediate variable; The test module is called to call the CAN communication stack and the XCP protocol stack in the ECU node according to the relevant attributes, intermediate variables and intermediate variable address information of the signal to be tested, obtain the set value and the received value, compare the received value with the set value or the standard value, and complete the test of the signal to be tested.

8. The communication signal testing device according to claim 7, characterized in that: The calling test module includes: CAN driver unit, used to exchange data with ECU nodes via CAN bus; The communication stack calling unit is used to cooperate with the CAN driver unit to call the CAN communication stack of the ECU node; The protocol stack calling unit is used to cooperate with the CAN driver unit to call the XCP protocol stack of the ECU node; The data processing unit is used to perform data processing and analysis on the signal to be tested.

Citation Information

Patent Citations

  • Vehicle electronic control unit CAN interface automatic test system and method

    CN107145140A

  • CAN communication function test method and test system

    CN115348200A

  • Communication test method and device, equipment and storage medium

    CN117201350A

  • Method and system for automatically testing CAN (Controller Area Network) signal of electronic controller

    CN118606215A

  • Controller interface test method and device, storage medium and program product

    CN118819113A