Test system and method, electronic equipment and storage medium
By combining the data processing module and the SPI sending module in the test system, the consistency test of SPI signals is realized, which solves the problem of inability to actively set the measured signal and low test efficiency in the prior art, and improves the coverage and efficiency of test cases.
Patent Information
- Application Number
- CN202411954708.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-03-28
AI Technical Summary
In the prior art, when conducting SPI transmission signal consistency test, the value of the measured signal cannot be actively set, resulting in limited design of the test case. When the number of measured signals is huge, the manual observation and comparison method is prone to errors and the test efficiency is low.
A test system and method are provided, including a data processing module and an SPI sending module. By converting the transmitted value in the test case into an SPI signal and sending it to the controller under test, the received value of the SPI signal by the controller under test is obtained, and compared with the transmitted value, to obtain the test results.
The consistency test of the transmission and reception of SPI signals in the measured controller is realized, and the value of the measured signal can be actively set, the test scenario can be expanded, the coverage of test cases can be improved, and the error rate can be reduced when the number of measured signals is huge, thereby improving the testing efficiency.
Smart Images

Figure CN119714945A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of testing technology, and in particular to a testing system, method, electronic equipment and storage medium. Background Art
[0002] As a cutting-edge technology of the Electric Power Steering (EPS) system, the controller in the steering motor of steer-by-wire adopts a dual-redundancy design, that is, there are two controllers in the steering motor, which can perform independent calculations and controls, and when one controller fails, the other controller can still operate independently, thus ensuring the safety of the steer-by-wire system. The two controllers of the steering motor use the Serial Peripheral Interface (SPI) to communicate with each other to transmit signals such as controller status, vehicle status information, and control commands. Therefore, the consistency of sending and receiving SPI transmission signals will directly affect the calculation of the controller.
[0003] At present, the SPI transmission signal consistency test solution mainly observes the sending value of a certain signal at the sender through a debugger, and observes the receiving value of the signal at the receiver at the same time. For the same signal, if the sending value of the sender is consistent with the receiving value of the receiver, it is considered that the sending and receiving consistency of the signal is normal, otherwise the consistency is abnormal. However, this consistency test solution cannot actively set the value of the signal under test, which will affect the design of the test case. And when the number of signals under test is large, the manual observation and comparison method is prone to errors and has low test efficiency. Summary of the invention
[0004] The embodiments of the present application provide a test system, method, electronic device and storage medium to solve the problems in the prior art of not being able to actively set the value of the tested signal and low test efficiency in performing SPI transmission signal consistency testing.
[0005] In a first aspect, an embodiment of the present application provides a testing system, including:
[0006] A data processing module and a serial peripheral interface SPI sending module; wherein the data processing module and the SPI sending module are both connected to the controller under test;
[0007] The SPI sending module is used to convert the sending value in the test case into an SPI signal, and send the SPI signal to the controller under test;
[0008] The data processing module is used to obtain a received value obtained by parsing the SPI signal by the controller under test, and compare the received value with the sent value in the test case to obtain a test result.
[0009] In a second aspect, the present application also provides a testing method, including:
[0010] Convert the sent value in the test case into an SPI signal;
[0011] The SPI signal is sent to the controller under test through the SPI communication board;
[0012] Obtaining a received value obtained by parsing the SPI signal by the controller under test;
[0013] The received value is compared with the sent value in the test case to obtain a test result.
[0014] In a third aspect, an embodiment of the present application further provides an electronic device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the above-mentioned test method when executed by the processor.
[0015] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program implements the above-mentioned test method when executed by a processor.
[0016] The embodiments of the present application include at least the following technical effects:
[0017] The technical solution of the embodiment of the present application realizes the consistency test of the sending and receiving of the SPI signal in the tested controller through the cooperation of the data processing module and the SPI sending module. The sending value in the test case can be accurately converted into an SPI signal and sent to the tested controller through the SPI sending module, so that the value of the tested signal can be actively set, the test scenario is expanded, and the coverage of the test case is improved. The receiving value corresponding to the SPI signal received by the tested controller is obtained through the data processing module, and the receiving value is compared with the sending value to obtain the test result. Compared with the method of manual observation and comparison, when the number of tested signals is large, the error rate can be reduced and the test efficiency can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0019] Figure 1 It is one of the structural schematic diagrams of the test system provided in the embodiment of the present application;
[0020] Figure 2 This is the second structural diagram of the test system provided in the embodiment of the present application;
[0021] Figure 3 This is the third structural diagram of the test system provided in the embodiment of the present application;
[0022] Figure 4 It is a flow chart of the testing method provided in the embodiment of the present application;
[0023] Figure 5 A block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0025] It should be understood that the references to "one embodiment" or "an embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present application. Therefore, the references to "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0026] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0027] The controller in the steering motor of the steer-by-wire system adopts a dual-redundancy design, that is, there are two controllers in the steering motor, and the two controllers communicate with each other using SPI. The consistency of sending and receiving SPI transmission signals will directly affect the calculation of the controller.
[0028] At present, the SPI transmission signal consistency test solution mainly observes the sending value of a certain signal at the sender through a debugger, and observes the receiving value of the signal at the receiver at the same time. For the same signal, if the sending value of the sender is consistent with the receiving value of the receiver, it is considered that the sending and receiving consistency of the signal is normal, otherwise the consistency is abnormal. However, this consistency test solution cannot actively set the value of the signal under test, which will affect the design of the test case. And when the number of signals under test is large, the manual observation and comparison method is prone to errors and the test efficiency is low.
[0029] In view of this, the present application proposes a system, method, and electronic device for fault testing, aiming to actively set the value of the signal under test, expand the test scenarios, and improve the test efficiency.
[0030] like Figure 1 As shown, an embodiment of the present application provides a test system, and the test system 100 includes:
[0031] A data processing module 110 and an SPI sending module 120; wherein the data processing module 110 and the SPI sending module 120 are both connected to the controller under test 200;
[0032] The SPI sending module 120 is used to convert the sending value in the test case into an SPI signal, and send the SPI signal to the controller under test 200;
[0033] The data processing module 110 is used to obtain a received value obtained by the controller under test 200 parsing the SPI signal, and compare the received value with the sent value in the test case to obtain a test result.
[0034] Specifically, the data processing module is responsible for data processing and analysis tasks in the test system. The data processing module is connected to the controller under test to obtain the received value obtained by the controller under test from parsing the SPI signal, and compares the received value with the sent value in the test case to determine the test result. The data processing module has powerful data processing capabilities and can process a large amount of test data quickly and accurately.
[0035] The SPI sending module is responsible for converting the sending value in the test case into an SPI signal that complies with the SPI communication protocol in the test system and accurately sending it to the controller under test. Based on various requirements of the SPI communication protocol, such as data format, clock signal, polarity, phase and other parameters, the SPI sending module can correctly encode and modulate the sending value in the test case to generate a signal that can be transmitted on the SPI bus. And these signals are sent out at the appropriate clock signal edge.
[0036] During the test, the SPI sending module receives the sending value in the test case and pre-processes the sending value, for example, checking the legitimacy and integrity of the data to ensure that the data meets the requirements of SPI communication. Then, according to the configuration parameters of the SPI communication protocol, such as clock frequency, polarity and phase, the sending value is encoded and modulated to generate an SPI signal. Finally, according to the set sending timing, the SPI signal is sent to the controller under test through the physically connected SPI line. During the sending process, the SPI sending module also monitors the sending status to ensure that the signal can be sent completely and accurately. If a sending error occurs, the error information will be recorded in time and resent to ensure the smooth progress of the test.
[0037] The data processing module first waits for the controller under test to complete the reception and analysis of the SPI signal. Once the controller under test generates a received value, the data processing module will immediately obtain this data. Then, the received value is compared with the corresponding sent value. If the two are exactly the same, the data processing module will record the test results of the test passing; if they are inconsistent, the differences will be recorded in detail and the test results of the test failure will be marked. Finally, the data processing module will organize and summarize all the test results and generate a detailed test report, which may include test time, test case number, sent value, received value, comparison result, error information, etc., so that the tester can fully understand the test situation.
[0038] In the embodiment of the present application, the consistency of sending and receiving SPI signals in the tested controller is tested through the cooperation of the data processing module and the SPI sending module. The sending value in the test case can be accurately converted into an SPI signal and sent to the tested controller through the SPI sending module, so that the value of the tested signal can be actively set, the test scenario is expanded, and the coverage of the test case is improved. The receiving value corresponding to the SPI signal received by the tested controller is obtained through the data processing module, and the receiving value is compared with the sending value to obtain the test result. Compared with the method of manual observation and comparison, when the number of tested signals is large, the error rate can be reduced and the test efficiency can be improved.
[0039] In addition, the embodiments of the present application can simultaneously meet the SPI communication consistency test of the main controller and the sub-controller. When switching the main and sub-controller tests, both the test cases and the test environment can be reused, thereby improving the convenience of testing.
[0040] Alternatively, if Figure 2 As shown, the data processing module 110 includes a data acquisition unit and a data comparison unit;
[0041] The data acquisition unit is used to send a calibration function request to the controller under test, and receive a received value obtained by the controller under test parsing the SPI signal based on the calibration function request;
[0042] The data comparison unit is used to compare the received value obtained by the data acquisition unit with the sent value in the test case to obtain a test result.
[0043] The data acquisition unit is connected to the controller under test via a controller area network (CAN) bus.
[0044] In an embodiment of the present application, the data acquisition unit plays a role in the data processing module to interact with the controller under test to obtain data. The data acquisition unit can actively obtain the received value after parsing the SPI signal from the controller under test by sending a calibration function request to the controller under test. This request mechanism based on the calibration function makes data acquisition targeted and controllable. The calibration function is a commonly used method in the field of automotive electronics, which is used to monitor, adjust and acquire data of internal parameters of the device. By sending a calibration function request, the data acquisition unit can go deep into the internal data processing flow of the controller under test, obtain the SPI signal reception value after the controller has parsed according to its own logic, and ensure that the collected data is closely related to the actual application scenario and is valid data after being processed by the controller.
[0045] Specifically, the data acquisition unit generates a calibration function request based on the test requirements and the pre-set calibration protocol so that the controller under test can accurately understand the intention of the data acquisition unit. Then, the data acquisition unit sends this calibration function request to the controller under test through a communication link connected to the controller under test (such as a CAN bus or other dedicated communication line). After receiving the request, the controller under test will search for the corresponding SPI signal analysis result internally according to the content of the request, and encapsulate it into a response message and send it to the data acquisition unit. After receiving the response message, the data acquisition unit extracts the received value from it and passes it to the data comparison unit for subsequent processing.
[0046] In the embodiment of the present application, the task of the data comparison unit is to compare the received value obtained by the data acquisition unit with the sent value in the test case, and then obtain the test result, that is, the consistency test result of the sent value and the received value of the SPI signal of the controller under test.
[0047] Specifically, when the data comparison unit receives the received value from the data acquisition unit, it first obtains the sent value in the test case corresponding to the received value. Then, according to the set comparison rules, the received value and the sent value are compared in detail. For example, if it is simple numerical data, a comparison of numerical equality may be performed; if it is a complex data structure containing multiple data fields, each data field may be compared separately, and the logical relationship between the data fields may be checked to see if it is correct. During the comparison process, if it is found that the received value is exactly the same as the sent value, the data comparison unit will determine that the test has passed and record the relevant test pass information, such as test time, test case number, sent value, received value, etc. If any difference is found during the comparison process, the data comparison unit will determine that the test has failed and record the specific situation of the difference in detail, such as which data bits are different, the numerical value of the difference, etc., so as to facilitate subsequent troubleshooting and analysis.
[0048] It should be noted that the controller under test includes an SPI communication module and a CAN and calibration module, wherein the SPI communication module can parse the received SPI signal according to the SPI communication protocol to obtain the received value. The CAN and calibration module supports the calibration function, and can respond to the calibration function request sent by the data acquisition unit in the test system, and send the received value parsed by the SPI communication module to the data acquisition unit via the CAN bus.
[0049] The above implementation scheme of the present application obtains the received value based on the calibration function request through the data acquisition unit, and the data comparison unit performs strict comparison, so as to realize accurate verification of the SPI communication data. The structure and working mode of the data processing module make it very flexible and can adapt to different types of SPI communication test requirements. Since the data acquisition unit can obtain various types of data according to different calibration function requests, and the data comparison unit can perform diversified comparisons according to different test cases and comparison rules, flexible test settings can be performed for different SPI communication devices, different application scenarios and different test purposes, thereby improving the versatility and adaptability of the test system.
[0050] Optional, such as Figure 2 As shown, the SPI sending module 120 includes a signal setting unit and a SPI communication board;
[0051] The signal setting unit is used to convert the sending value in the test case into an SPI signal;
[0052] The SPI communication board is used to send the SPI signal to the controller under test.
[0053] In the embodiment of the present application, the signal setting unit is a functional unit in the SPI sending module that preprocesses the test data, and is used to convert the sending value in the test case into an SPI signal that complies with the SPI communication protocol. For example, the SPI communication protocol specifies the bit order of data transmission, the encoding method of data, and the synchronization method of data and clock signals, etc. The signal setting unit needs to convert the original test case sending value accordingly according to these rules to ensure that the controller under test can correctly receive the generated SPI signal.
[0054] The SPI communication board serves as a physical transmission device in the SPI sending module, and is used to send the SPI signal generated by the signal setting unit to the controller under test through a physical connection.
[0055] In the specific implementation process, the signal setting unit first reads the transmission value in the test case, then encodes and converts the transmission value to obtain the SPI signal, and passes it to the SPI communication board, which sends the SPI signal to the controller under test. During the transmission process, the SPI communication board continuously monitors the transmission status, including whether the data is successfully sent, whether there is a signal conflict or error, etc. If a transmission error is detected, such as a bus conflict or an error signal fed back by the receiving end, the SPI communication board will handle it according to the pre-set error handling mechanism, such as trying to resend the data, recording the error information and notifying the upper layer of the system for further processing.
[0056] The above implementation scheme of the present application ensures that the transmission value in the test case is accurately converted into an SPI signal and reliably sent to the controller under test through the collaborative work of the signal setting unit and the SPI communication board. The signal setting unit ensures the correctness of the format and content of the generated SPI signal, so that the controller under test can receive and parse it according to the same protocol rules. The SPI communication board provides a stable physical transmission channel, thereby improving the accuracy and reliability of SPI communication and laying the foundation for the normal operation of the entire system.
[0057] Optionally, the SPI sending module also includes a board configuration unit;
[0058] The board configuration unit is used to configure the properties of the SPI communication board to be consistent with the properties of the SPI communication module in the controller under test, so as to establish an SPI communication connection between the SPI communication board and the controller under test;
[0059] The attributes include at least clock frequency, phase and polarity.
[0060] In the embodiment of the present application, the board configuration unit configures the properties of the SPI communication board, such as key parameters such as clock frequency, phase and polarity, so that it reaches consistency with the SPI communication module in the controller under test in these aspects, thereby establishing a stable and reliable SPI communication connection, and ensuring that the SPI communication board and the SPI communication module in the controller under test can achieve seamless connection at the electrical characteristics and communication protocol levels.
[0061] It should be noted that the clock frequency determines the data transmission rate. Different devices may adopt different clock frequency standards according to their own performance and application requirements. The phase and polarity affect the sampling time of the data at the clock signal edge and the logical representation of the data bit. If these properties do not match, even if the data can be transmitted, the receiver will not be able to correctly parse the data, which will cause communication failures.
[0062] In the specific implementation process, the board configuration unit needs to obtain the attribute information of the SPI communication module in the controller under test. Then, the board configuration unit sets the corresponding attributes of the SPI communication board according to the acquired attribute information, sends control signals to the components such as the clock generator, phase controller and polarity switching circuit inside the SPI communication board, and adjusts the working parameters of these components so that the clock frequency, phase and polarity of the SPI communication board are fully matched with the requirements of the controller under test. After the configuration is completed, the board configuration unit will also perform self-test and verification operations, by sending some test signals or performing simple communication tests with the controller under test, to ensure the correctness and effectiveness of the configuration, and make full preparations for the subsequent formal SPI communication.
[0063] The above implementation scheme of the present application, through the precise configuration of the SPI communication board properties by the board configuration unit, fundamentally guarantees the communication compatibility with the controller under test. By making the clock frequency, phase and polarity of the two properties completely consistent, the communication barriers caused by the mismatch between electrical characteristics and communication protocols are eliminated, and the stability of SPI communication is greatly improved. And the board configuration unit can also improve the scalability and flexibility of the SPI sending module. When the test system performs consistency testing on other controllers under test, it is only necessary to reconfigure the SPI communication board through the board configuration unit according to the SPI communication property requirements of the new device, without the need for large-scale hardware or software modifications to the entire SPI sending module, thereby improving the reliability and availability of the system.
[0064] Optionally, the SPI sending module also includes a time synchronization unit;
[0065] The time synchronization unit is used for sending a start flag signal to the data processing module when the SPI sending module sends the SPI signal to the controller under test;
[0066] The data processing module is also used to request the received value corresponding to the SPI signal from the controller under test after receiving the start flag signal.
[0067] In the embodiment of the present application, the time synchronization unit undertakes the key task of coordinating the SPI signal transmission and the start time of the data acquisition action of the data processing module in the SPI transmission module. When the SPI transmission module sends the SPI signal to the controller under test, a start flag signal is sent to the data processing module. Ensure that the data processing module can know and start preparing for subsequent data acquisition and processing work at the moment when the SPI signal is just sent out, so as to achieve accurate synchronization of the entire test system in the time dimension. In this way, problems such as data correspondence errors or test result deviations caused by inconsistent transmission and acquisition processing time can be avoided, laying the foundation for subsequent accurate evaluation of the performance and data accuracy of SPI communication.
[0068] In the specific implementation process, when the SPI sending module starts to execute the operation of sending the SPI signal to the controller under test, the time synchronization unit immediately generates and sends a start flag signal to the data processing module. This process is usually implemented based on the clock or trigger mechanism inside the SPI sending module. For example, at the moment when the SPI sending module starts to send the first data bit or data frame according to the set timing, the time synchronization unit sends a start flag signal with a specific coding or level state to the data processing module, notifying the data processing module that the SPI signal transmission has started, and the data processing module can start the relevant data collection and processing process accordingly.
[0069] Correspondingly, after receiving the start flag signal sent by the time synchronization unit, the data processing module requests the received value corresponding to the SPI signal from the controller under test according to a predetermined process. This ensures that the received value obtained by the data processing module is closely related to the SPI signal just sent by the SPI sending module and is consistent in time, so as to perform subsequent accurate comparison and analysis.
[0070] The above implementation scheme of the present application realizes the time synchronization of SPI signal transmission and data collection by the data processing module through the time synchronization unit, so that each link of the entire test system is coordinated in time, avoiding data inconsistency problems caused by time difference, and reducing the occurrence of various errors and abnormal situations caused by time confusion, thereby improving the overall reliability and stability of the system.
[0071] Optionally, an SPI sending signal model is installed in the signal setting unit;
[0072] Among them, the SPI sending signal model is a model built according to the SPI communication protocol and sending timing.
[0073] In the embodiment of the present application, the SPI transmission signal model is a simulation tool based on the SPI communication protocol and transmission timing, and is installed in the signal setting unit. The SPI transmission signal model provides a standardized and normalized signal generation framework for the signal setting unit, ensuring that the transmission value in the test case is accurately converted into an SPI signal that meets the requirements of the SPI communication protocol, and the transmission timing also strictly follows the protocol regulations.
[0074] The SPI transmission signal model is built according to the detailed specifications of the SPI communication protocol. For example, the SPI protocol specifies the bit order of data transmission, and the model will reorganize the transmission value in the test case according to this requirement; for the synchronization of data and clock signals, the model will determine whether to sample and transmit data on the rising edge or falling edge of the clock signal, and set the corresponding delay and waiting time to ensure that the data can be accurately sampled by the receiver. At the same time, the model also takes into account the transmission timing, such as before sending a set of data, it may be necessary to send a specific start bit or command word, and after the data transmission is completed, it may be necessary to send a stop bit or check bit, etc. These are all reflected in the model according to the pre-set timing logic. When the signal setting unit receives the transmission value in the test case, it inputs it into the SPI transmission signal model. The model performs a series of processing on the transmission value according to internal rules and algorithms, such as encoding conversion, adding synchronization marks, and generating a complete SPI signal sequence according to the timing, and finally outputs an SPI signal that meets the SPI communication protocol and transmission timing requirements for the SPI communication board to send.
[0075] The above implementation scheme of the present application ensures that the SPI signal generated by the signal setting unit fully complies with the SPI communication protocol requirements in terms of format, coding and timing through the SPI signal transmission model. At the same time, the model's automated signal generation capability also improves test efficiency, especially in large-scale and complex test scenarios, which can significantly shorten test time, speed up test cycles, and reduce test costs. The SPI signal transmission model can also conveniently simulate various complex test scenarios, generate SPI signals of different types, formats, and timings to meet diverse test requirements, and can comprehensively test the consistency of the SPI communication of the controller under test, discover potential problems and hidden dangers, and improve the quality and performance of the system.
[0076] like Figure 3 As shown, in the specific implementation process, the test tool TSMaster can be used as a data processing module, relying on the supporting hardware TC1013, and using the XPC calibration function to collect the receiving value corresponding to the SPI signal received by the controller under test, and finally perform data comparison in TSMaster.
[0077] The SPI sending module uses the software environment of Matlab / Simulink and the hardware environment of Speedgoat real-time controller, and the real-time controller integrates the SPI communication board.
[0078] The specific implementation process is introduced below.
[0079] According to the SPI communication protocol and transmission timing, the SPI transmission signal model is built in Matlab / Simulink. Among them, the SPI transmission signal model mainly includes the signal Editor module of simulink. In this module, all the transmission signals in SPI are assigned according to the time series, for example, once in 1-5s, and once in 6-10s. According to the value range of each signal, 10 assignments can be made. In the assignment process, methods such as equivalence class, boundary value, and error conjecture can be considered. Connect the SPI transmission driver module to the Signal Editor module to complete the construction of the SPI transmission signal model.
[0080] According to the driver package of the SPI communication board, create an SPI configuration model in Matlab / Simulink, configure the SPI clock, phase, polarity and other properties, and these properties need to be consistent with the properties of the controller under test to meet the SPI communication between the real-time controller and the controller under test. If the properties are inconsistent, the two parties will not be able to parse the signal according to unified rules during the data transmission process, which will cause communication failure or data errors. For example, if the SPI clock frequency set by the real-time controller is 1MHz, and the clock frequency expected by the controller under test is 2MHz, then the two parties will have a timing mismatch during data exchange, and will not be able to correctly receive and identify the data sent by the other party.
[0081] The SPI sending signal model and the SPI configuration model are downloaded to the real-time controller, and the start and stop of the SPI communication are controlled by the host computer of the real-time controller.
[0082] The SPI communication between the real-time controller and the controller under test is a physical connection. When the SPI communication is started, based on the above physical connection and the SPI properties (such as clock, phase, polarity, etc.) that have been configured by both parties, the two parties can establish effective SPI communication according to the SPI communication protocol.
[0083] In TSMaster, create a test case for consistency testing of the SPI signal of the controller under test, and keep the send value in the test case consistent with the value in the SPI send signal model. When executing the test, the send value set in the test case and the value of the received signal collected in the controller under test will be compared, and the test result will be automatically determined to form a test report.
[0084] It should be noted that during the test process, the time synchronization of the data in the TSMaster test case and the SPI sending signal model is ensured in the following way: when the real-time controller is started, the start flag is sent to the bus, and after the data acquisition device obtains the start flag, it executes the data acquisition and data comparison functions, thereby ensuring the synchronization of the start time.
[0085] It should be further explained that data collection is carried out continuously to ensure that all signal data received by the controller under test can be fully obtained. Data comparison can be intermittent and optional, and the method of selecting comparison 3 times is adopted. After all 3 times are passed, the value comparison on this time series is considered to have passed. For example, when comparing 1-5s data, wait for 1s to compare once, wait for 1s to compare once, wait for 1s to compare again, wait for 1s to compare again, wait for 2s to execute the next set of data, and so on. This intermittent comparison method can not only effectively verify the consistency of data at different time points, but also avoid problems such as resource consumption and misjudgment caused by too frequent comparisons, thereby ensuring the accuracy and reliability of the test.
[0086] like Figure 4 As shown, the embodiment of the present application provides a testing method, which includes:
[0087] Step 401: Convert the sending value in the test case into an SPI signal.
[0088] First, the transmission value in the test case needs to be processed according to the provisions of the SPI communication protocol. The SPI protocol usually specifies the format of the data, such as the order of data bits, the encoding method of data, and the synchronization method of data and clock signals. Then, according to the requirements of the SPI protocol for synchronization of data and clock signals, determine the timing of sampling and transmitting the data bits at a specific edge (rising or falling edge) of the clock signal, and add necessary synchronization marks or waiting time, so as to convert the original transmission value into a complete SPI signal that meets the requirements of the SPI communication protocol, so that it can be accurately transmitted on the SPI bus later.
[0089] Step 402: Send the SPI signal to the controller under test through the SPI communication board.
[0090] The SPI communication board acts as the physical transmission layer. When the generated SPI signal is to be sent out, the SPI communication board drives the level conversion circuit at the set clock signal edge to convert the data into the corresponding level signal and send it to the controller under test. During the entire sending process, the sending status is continuously monitored, such as checking whether the data is sent successfully, whether there is a signal conflict or error, etc. If a problem occurs, it will be handled according to the pre-set error handling mechanism, such as trying to resend the data, recording the error information and notifying the upper layer of the system for further processing.
[0091] Step 403: Obtain a received value obtained by parsing the SPI signal by the controller under test.
[0092] After receiving the SPI signal, the controller under test will parse the signal according to the processing logic of the SPI communication module preset inside it. This parsing process includes operations such as extracting the data bit, decoding according to the encoding method specified by the protocol, and removing the synchronization mark, so as to obtain the original received value. In order to obtain this received value, it is usually necessary to establish a data interaction mechanism. For example, it can be obtained by sending a request message on the communication link (such as CAN bus) between the data acquisition unit and the controller under test. The data acquisition unit generates a message frame requesting to obtain the received value according to a predetermined rule. The message frame contains information such as the type of request, the identification of the target data, and then sends it to the controller under test. After receiving the request, the controller under test searches for the corresponding parsing result, encapsulates it into a response message and sends it back to the data acquisition unit. The data acquisition unit extracts the received value from the response message for subsequent comparison operations.
[0093] Step 404: Compare the received value with the sent value in the test case to obtain a test result.
[0094] After obtaining the received value, compare it with the sent value in the test case one by one. If the received value is exactly the same as the sent value, then the test is considered to have passed, and the relevant test pass information is recorded, such as test time, test case number, sent value, received value, etc.; if any difference is found during the comparison process, the test is considered to have failed, and the specific circumstances of the difference are recorded in detail, such as which data bits are different, the value of the difference, etc., for subsequent troubleshooting and analysis.
[0095] In the embodiment of the present application, by converting the transmission value in the test case into an SPI signal and sending it to the controller under test through the SPI communication board, the value of the signal under test can be actively set, the test scenario is expanded, and the coverage of the test case is improved. By obtaining the reception value corresponding to the SPI signal received by the controller under test, the reception value is compared with the transmission value to obtain the test result, and the consistency of the transmission and reception of the SPI signal in the controller under test is tested. Compared with the method of manual observation and comparison, when the number of signals under test is large, the error rate can be reduced and the test efficiency can be improved.
[0096] An embodiment of the present application also provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned test method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0097] For example, Figure 5 FIG. 1 shows a schematic diagram of the physical structure of an electronic device. Figure 5 As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530, and the processor 510 is used to perform the following steps: converting the sending value in the test case into an SPI signal; sending the SPI signal to the controller under test through the SPI communication board; obtaining the receiving value obtained by the controller under test parsing the SPI signal; comparing the receiving value with the sending value in the test case to obtain the test result. The processor 510 may also perform other schemes in the embodiments of the present application, which will not be further elaborated here.
[0098] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application.
[0099] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned test method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0100] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0101] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0102] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
[0103] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the present application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0104] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0105] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0106] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0107] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0108] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.
[0109] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A testing system, characterized in that: include: A data processing module and a serial peripheral interface SPI sending module; wherein the data processing module and the SPI sending module are both connected to the controller under test; The SPI sending module is used to convert the sending value in the test case into an SPI signal, and send the SPI signal to the controller under test; The data processing module is used to obtain a received value obtained by parsing the SPI signal by the controller under test, and compare the received value with the sent value in the test case to obtain a test result.
2. The test system according to claim 1, characterized in that: The data processing module includes a data acquisition unit and a data comparison unit; The data acquisition unit is used to send a calibration function request to the controller under test, and receive a received value obtained by the controller under test parsing the SPI signal based on the calibration function request; The data comparison unit is used to compare the received value obtained by the data acquisition unit with the sent value in the test case to obtain a test result.
3. The test system according to claim 1, characterized in that: The SPI sending module includes a signal setting unit and a SPI communication board; The signal setting unit is used to convert the sending value in the test case into an SPI signal; The SPI communication board is used to send the SPI signal to the controller under test.
4. The test system according to claim 3, characterized in that: The SPI sending module also includes a board configuration unit; The board configuration unit is used to configure the properties of the SPI communication board to be consistent with the properties of the SPI communication module in the controller under test, so as to establish an SPI communication connection between the SPI communication board and the controller under test; The attributes include at least clock frequency, phase and polarity.
5. The test system according to claim 3, characterized in that: The SPI sending module also includes a time synchronization unit; The time synchronization unit is used for sending a start flag signal to the data processing module when the SPI sending module sends the SPI signal to the controller under test; The data processing module is also used to request the received value corresponding to the SPI signal from the controller under test after receiving the start flag signal.
6. The test system according to claim 3, characterized in that The signal setting unit is provided with an SPI sending signal model; Among them, the SPI sending signal model is a model built according to the SPI communication protocol and sending timing.
7. The test system according to claim 2, characterized in that: The data acquisition unit is connected to the controller under test via a controller area network (CAN) bus.
8. A testing method, characterized in that: include: Convert the sent value in the test case into an SPI signal; The SPI signal is sent to the controller under test through the SPI communication board; Obtaining a received value obtained by parsing the SPI signal by the controller under test; The received value is compared with the sent value in the test case to obtain a test result.
9. An electronic device, characterized in that: The device comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the testing method according to claim 8 when executed by the processor.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the testing method according to claim 8 is implemented.