Communication system and method between devices in test scene and electronic device
By adopting a communication system based on a single-line protocol in the test scenario, the problem of poor communication efficiency and stability between the main control device and the test device is solved, efficient and reliable data transmission is achieved, and strict costs and functions are met. Performance requirements.
Patent Information
- Application Number
- CN202411122871.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2025-01-03
AI Technical Summary
In the test scenario, the communication transmission efficiency and stability between the main control device and the test device are poor, and cannot meet the stringent cost and functional performance requirements.
Using a communication system based on a single-line protocol, the master control device constructs the instruction frame and sends it to the test device. The test device parses the instruction frame and performs corresponding operations, and records the test situation to build a response frame sent back to the master control device, and the instruction frame and the response frame data structure. It includes frame start character, device address, frame type, data code, check code, reserved fields and frame end characters, and uses a logic level standard input and output interface.
It improves the transmission efficiency and stability between the main control equipment and the test equipment in the test scenario, meets strict cost and functional performance requirements, and ensures the accuracy and reliability of the test results.
Smart Images

Figure CN119254841A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of communication technology, and in particular to a system, method and electronic device for inter-device communication in a test scenario. Background Art
[0002] As market competition becomes increasingly fierce, the market places stringent cost and functional performance requirements on each component of a product. For each product manufacturer, low cost, high performance, and complete performance are factors that must be considered in research and development, and testing is an important means to ensure functionality and performance.
[0003] During the test process, it is necessary to ensure communication between the main control device and the test device. However, although the current communication solution can realize communication between the main control device and the test device, since the current communication solution is not aimed at test scenarios, it does not have advantages in terms of transmission efficiency and transmission stability when applied to communication between the main control device and the test device. Summary of the invention
[0004] The embodiment of the present invention provides a system, method and electronic device for inter-device communication in a test scenario to solve the problem that the communication between a main control device and a test device in a test scenario does not have advantages in terms of transmission efficiency and transmission stability.
[0005] An embodiment of the present invention discloses a communication system between devices in a test scenario, wherein the communication system includes a main control device and a test device, wherein the main control device and the test device perform single-line communication based on a single-line protocol for the test scenario, wherein the single-line protocol has an instruction set, and during the test of the test device:
[0006] The main control device constructs an instruction frame and sends it to the test device, the test device parses the instruction frame to obtain a parsing result, performs a corresponding test control operation according to the parsing result, and records the test situation when performing the test control operation to construct a response frame and sends it to the main control device; the instruction frame and the response frame are constructed according to the instruction set;
[0007] The main control device parses the response frame to obtain the test situation of the test device, and performs corresponding processing according to the test situation.
[0008] Optionally, the instruction frame, the response frame and the answer frame are data frames, and the data structure of the data frame includes multiple parts, and the parts of the data structure include a frame start character, a device address, a frame type, a data code, a check code, a reserved field, a version control field and a frame end character.
[0009] Optionally, the single-wire protocol defines a waveform corresponding to the data frame, and each part in the data structure of the data frame has a corresponding time length; the single-wire protocol defines the input and output interface between the master control device and the test device to adopt a logic level standard.
[0010] Optionally, the instruction set includes instruction frames for different test control requirements, and the test control requirements include at least initializing test equipment, starting testing, stopping testing, reading test data, setting test parameters, starting specific test items, skipping specific test items, setting breakpoints at specified locations to pause execution, responding to feedback error fault codes, and repeating test failed items.
[0011] Optionally, the main control device constructs an instruction frame and sends it to the test device, including:
[0012] The main control device constructs an instruction frame, and sends the instruction frame to the test device corresponding to the device address in the instruction frame.
[0013] Optionally, the main control device constructs an instruction frame and sends it to the test device, the test device parses the instruction frame to obtain a parsing result, performs a corresponding test control operation according to the parsing result, and records the test situation when performing the test control operation to construct a response frame and send it to the main control device, including:
[0014] The main control device sends an initialization instruction frame to the test device;
[0015] The test device performs test device initialization upon receiving the initialization instruction frame, and sends a response frame to the main control device after the test device initialization is completed;
[0016] The main control device constructs a test instruction frame and sends it to the test device;
[0017] The test device parses the frame type and data code in the test instruction frame to obtain a parsing result, and performs a corresponding test control operation according to the parsing result. When performing the test control operation, the test situation is recorded to construct a response frame and send it to the main control device; wherein the frame type includes a read type and a write type, and the data code is a read parameter or a write parameter corresponding to the frame type.
[0018] Optionally, if the answer frame or the response frame sent by the test device is not received within a preset time, the main control device re-sends the initialization instruction frame or the instruction frame to the test device.
[0019] Optionally, when receiving a data frame, the main control device and the test device verify the data frame according to the verification code of the data frame to determine a verification result, and perform processing according to the verification result.
[0020] Optionally, the processing according to the verification result includes:
[0021] When the verification result is that the data frame fails the verification, discarding the data frame that fails the verification;
[0022] An error response frame is sent to the main control device or the test device that sends the data frame, and the main control device or the test device resends the data frame according to the error response frame or records the data frame that fails the check.
[0023] The embodiment of the present invention further discloses a method for communication between devices in a test scenario, which is applied to a communication system, wherein the communication system includes a main control device and a test device, and the main control device and the test device perform single-line communication based on a single-line protocol for the test scenario, wherein the single-line protocol has an instruction set, and during the test of the test device, the method includes:
[0024] Constructing an instruction frame and sending it to the test device, the test device parsing the instruction frame to obtain a parsing result, so as to perform a corresponding test control operation according to the parsing result, and recording the test situation when performing the test control operation to construct a response frame and send it to the main control device; the instruction frame and the response frame are constructed according to the instruction set;
[0025] The response frame is parsed to obtain the test condition of the test device, and corresponding processing is performed according to the test condition.
[0026] Optionally, the instruction frame, the response frame and the answer frame are data frames, and the data structure of the data frame includes multiple parts, and the parts of the data structure include a frame start character, a device address, a frame type, a data code, a check code, a reserved field, a version control field and a frame end character.
[0027] In one embodiment of the present invention, the single-wire protocol defines the waveform corresponding to the data frame, and each part in the data structure of the data frame has a corresponding time length; the single-wire protocol defines the input and output interface between the main control device and the test device as adopting a logic level standard.
[0028] Optionally, the instruction set includes instruction frames for different test control requirements, and the test control requirements include at least initializing test equipment, starting testing, stopping testing, reading test data, setting test parameters, starting specific test items, skipping specific test items, setting breakpoints at specified locations to pause execution, responding to feedback error fault codes, and repeating test failed items.
[0029] Optionally, the main control device constructs an instruction frame and sends it to the test device, including:
[0030] The main control device constructs an instruction frame, and sends the instruction frame to the test device corresponding to the device address in the instruction frame.
[0031] Optionally, the main control device constructs an instruction frame and sends it to the test device, the test device parses the instruction frame to obtain a parsing result, performs a corresponding test control operation according to the parsing result, and records the test situation when performing the test control operation to construct a response frame and send it to the main control device, including:
[0032] The main control device sends an initialization instruction frame to the test device;
[0033] The test device performs test device initialization upon receiving the initialization instruction frame, and sends a response frame to the main control device after the test device initialization is completed;
[0034] The main control device constructs a test instruction frame and sends it to the test device;
[0035] The test device parses the frame type and data code in the test instruction frame to obtain a parsing result, and performs a corresponding test control operation according to the parsing result. When performing the test control operation, the test situation is recorded to construct a response frame and send it to the main control device; wherein the frame type includes a read type and a write type, and the data code is a read parameter or a write parameter corresponding to the frame type.
[0036] Optionally, the method further comprises:
[0037] If the answer frame or the response frame sent by the test device is not received within the preset time, the main control device re-sends the initialization instruction frame or the instruction frame to the test device.
[0038] Optionally, the method further comprises:
[0039] When receiving a data frame, the main control device and the test device verify the data frame according to the verification code of the data frame to determine a verification result, and perform processing according to the verification result.
[0040] Optionally, the processing according to the verification result includes:
[0041] When the verification result is that the data frame fails the verification, discarding the data frame that fails the verification;
[0042] An error response frame is sent to the main control device or the test device that sends the data frame, and the main control device or the test device resends the data frame according to the error response frame or records the data frame that fails the check.
[0043] The embodiment of the present invention further discloses an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0044] The memory is used to store computer programs;
[0045] The processor is used to implement the method described in the embodiment of the present invention when executing the program stored in the memory.
[0046] The embodiment of the present invention further discloses a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the embodiment of the present invention.
[0047] The embodiment of the present invention further discloses a computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, enables the processors to execute the method described in the embodiment of the present invention.
[0048] The embodiments of the present invention include the following advantages:
[0049] The device communication system under the test scenario of the embodiment of the present invention includes a main control device and a test device. The main control device and the test device perform single-line communication based on a single-line protocol. The single-line protocol has an instruction set. In the process of testing the test device, the main control device constructs an instruction frame and sends it to the test device. The test device parses the instruction frame to obtain the parsing result, so as to perform the corresponding test control operation according to the parsing result. When performing the test control operation, the test situation is recorded to construct a response frame and send it to the main control device; the instruction frame and the response frame are constructed according to the instruction set, and the main control device parses the response frame to obtain the test situation of the test device, and performs corresponding processing according to the test situation. The data frames such as the instruction frame and the response frame transmitted between the main control device and the test device of the embodiment of the present invention are generated according to the instruction set of the single-line protocol for the test scenario. The signal waveforms of different data frames are different, that is, the construction principles of the data frames are different. Compared with the frame structure of the data frame of the existing technology, the data frame constructed based on the instruction set of the single-line protocol in the embodiment of the present invention communicates between the main control device and the test device, which has advantages in low transmission efficiency and transmission stability in the test scenario. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 is a structural block diagram of the communication status between devices in a test scenario provided in an embodiment of the present invention;
[0051] Figure 2 is a schematic diagram of a data structure of a data frame provided in an embodiment of the present invention;
[0052] Figure 3 This is an overall flow chart of a method for communication between devices in a test scenario provided in an embodiment of the present invention.
[0053] Figure 4 is a flowchart of a method for communication between devices in a test scenario provided in an embodiment of the present invention;
[0054] Figure 5 It is a schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention. DETAILED DESCRIPTION
[0055] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0056] Reference Figure 1 , shows a structural block diagram of an inter-device communication system in a test scenario provided in an embodiment of the present invention, the communication system includes a main control device and a test device, the main control device and the test device perform single-line communication based on a single-line protocol for the test scenario, the single-line protocol has an instruction set, and during the test of the test device:
[0057] The main control device constructs an instruction frame and sends it to the test device, the test device parses the instruction frame to obtain a parsing result, performs a corresponding test control operation according to the parsing result, and records the test situation when performing the test control operation to construct a response frame and sends it to the main control device; the instruction frame and the response frame are constructed according to the instruction set;
[0058] The main control device parses the response frame to obtain the test situation of the test device, and performs corresponding processing according to the test situation.
[0059] In a specific implementation, there is usually one master device and multiple test devices. The master device and the test device communicate using a single signal line at the physical layer, and can support a half-duplex communication mode. The interface standard between the master device and the test device based on the IO (Input / Output) used for communication is the TTL (Transistor-Transistor Logic) level standard. For example, 0V (volts) can represent a low level, and 5V can represent a high level.
[0060] In one embodiment of the present invention, the master device and the test device can mutually transmit data frames constructed based on the instruction set of the single-wire protocol, such as instruction frames, response frames, and answer frames, wherein the data structure of the data frame may include multiple parts, and the data structure may include multiple parts such as a frame start character, a device address, a frame type, a data code, a check code, a reserved field, a version control field, and a frame end character. In addition, the single-wire protocol of the embodiment of the present invention defines the waveform corresponding to the data frame, and each part in the data structure of the data frame has a corresponding time length; the single-wire protocol defines that the input and output interface between the master device and the test device adopts a logic level standard.
[0061] In one embodiment of the present invention, a rich instruction set is constructed in the single-line protocol to meet various test control requirements of the distributed test platform. Specifically, the instruction set of the single-line protocol may include instruction frames for different test control requirements. Exemplarily, the test control requirements may at least include test equipment initialization, test start, test stop, test data reading, test parameter setting, start of specific test items, skipping of a specific test item, setting breakpoints at specified locations to pause execution, response feedback error fault codes, and repeated test failure items, etc. Of course, the embodiment of the present invention can expand the instruction set based on other test control requirements to meet more test control requirements, and the embodiment of the present invention does not need to be limited to this.
[0062] For example, refer to Figure 2, is a data structure diagram of a data frame provided in an embodiment of the present invention. Specifically, after the test of the main control device and the test device is initialized, the input and output interface between the main control device and the test device is pulled up to a high level, indicating an idle state, and both the front and back of the frame are in an idle state, wherein the appearance of a frame start symbol (start bit) indicates the beginning of the data frame.
[0063] Frame start character: fixed to a specific character or sequence, used to mark the beginning of the data frame. The frame start character consists of a low level of 400us to 500us. At this time, the master device waits for the test device to reply. When the response signal is received, it means that the test device is ready for communication. Among them, the master device sends the device address after the frame start character.
[0064] Device address (destination address): an address or unique identifier used to identify the target test device. The length is 8 bits, and can support up to 256 different device addresses. In a specific embodiment, the device address can use a unipolar non-return-to-zero code, with a high level of 1 and a low level of 0. The time length of each bit in the device address is 20us (microseconds) to 30us. After the master device sends the device address, wait for the test device to reply with a response frame (response signal). After the master device receives the response signal, the master device sends a frame type.
[0065] Frame type: used to identify the communication direction of this data frame, which can include master device reading and master device writing.
[0066] Data code (data field): Depending on the frame type, the data code may contain different parameters or data. The data code is used to identify the test control instruction (write, instruction frame) issued by the specific master device or the test feedback (read, response frame) received by the master device from the test device. The data code is 8 bits long and can support up to 256 different test instructions. In a specific embodiment, the data code may use a unipolar non-return-to-zero code, with a high level of 1 and a low level of 0, and each bit of the data code is 20us to 30us.
[0067] Check code (check bit): used to check the data frame, including integrity check. In a specific embodiment, the check of the data frame can adopt odd check, and the integrity of the data frame is basically checked. Specifically, the odd check needs to calculate the number of 1s in the data frame. If it is an even number, the check bit is 1, and if it is an odd number, the check bit is 0. Of course, in addition to odd check, check methods such as cyclic redundancy check (CRC) can also be used, and the embodiment of the present invention does not need to be limited to this.
[0068] Frame end mark (end bit): used to mark the end of the data frame. Fixed to 100us low level + 300us high level + 100us low level.
[0069] In summary, the data structure of the data frame constructed based on the single-wire protocol in the embodiment of the present invention may be: [start bit][destination address][response][frame type][data field][check bit][end bit].
[0070] In addition, the embodiments of the present invention are scalable for data frames. Specifically, the data frames may also include reserved fields and version control fields, wherein the reserved fields refer to a certain field space reserved in the data frame structure for adding new functions or information in the future, and the version control field defines a version number in the single-wire protocol. When the single-wire protocol is upgraded or modified, it is distinguished by the version number to ensure that the use of different versions of the single-wire protocol can ensure that the main control device and the test device continue to communicate correctly.
[0071] It should be noted that the signal waveform of each data frame in the embodiment of the present invention is different, that is, the construction principle of each data frame is different. In some related schemes, there may be a more complex or simpler data frame data structure, which will lead to low transmission efficiency or poor transmission stability of the data frame. The single-line protocol of the embodiment of the present invention is for a specific test scenario. Therefore, in a specific test scenario, the data frame constructed by the embodiment of the present invention has more advantages in terms of transmission efficiency and transmission stability. In some examples, in the test scenario, the accuracy and reliability of data transmission are very important, because erroneous or lost data will lead to inaccurate test results of the test equipment. Therefore, it is necessary to ensure transmission efficiency and transmission stability in the test scenario. The embodiment of the present invention designs a compact data frame structure for the single-line protocol of the test scenario, reduces unnecessary fields, and thus can reduce the overhead of data transmission. In addition, the single-line protocol of the embodiment of the present invention can use variable-length data frames, dynamically adjust the length of the data frame according to the test requirements, so as to adapt to data transmission of different sizes and improve transmission efficiency. In addition, the single-line protocol of the embodiment of the present invention introduces a management strategy for the test equipment, for example, the data structure of the data frame can be adjusted or the sending rate or number of the data frame can be adjusted according to the test content, test environment, number of test equipment and network environment of the test equipment, so as to maintain a stable transmission rate of the communication system.
[0072] In an embodiment of the present invention, the main control device can construct an instruction frame (data frame) according to the instruction set of the single-wire protocol and send it to the test device. The test device parses the instruction frame to obtain a parsing result, such as whether it is necessary to read data, write data to execute a test item, and other test control operations. Then, the corresponding test control operation can be executed according to the parsing result, and the test situation can be recorded when executing the test control operation, such as execution-related data after executing a test item, to construct a response frame and send it to the main control device. After receiving the response frame, the main control device parses the response frame to obtain the test situation of the test device, such as whether a test item is executed normally, and can subsequently perform corresponding processing according to the test situation.
[0073] The device communication system under the test scenario of the embodiment of the present invention may include a main control device and a test device. The main control device and the test device perform single-line communication based on a single-line protocol. The single-line protocol has an instruction set. During the test of the test device, the main control device constructs an instruction frame and sends it to the test device. The test device parses the instruction frame to obtain the parsing result, so as to perform the corresponding test control operation according to the parsing result. When performing the test control operation, the test situation is recorded to construct a response frame and send it to the main control device; the instruction frame and the response frame are constructed according to the instruction set, and the main control device parses the response frame to obtain the test situation of the test device, and performs corresponding processing according to the test situation. The data frames such as the instruction frame and the response frame transmitted between the main control device and the test device of the embodiment of the present invention are generated according to the instruction set of the single-line protocol for the test scenario. The signal waveforms of different data frames are different, that is, the construction principles of the data frames are different. Compared with the frame structure of the data frame of the prior art, the data frame constructed based on the instruction set of the single-line protocol in the embodiment of the present invention communicates between the main control device and the test device, which has advantages in low transmission efficiency and transmission stability in the test scenario.
[0074] In one embodiment of the present invention, the main control device constructs an instruction frame and sends it to the test device, including:
[0075] The main control device constructs an instruction frame, and sends the instruction frame to the test device corresponding to the device address in the instruction frame.
[0076] In an embodiment of the present invention, the main control device can construct a device address of the instruction frame based on the address or unique identifier of the target test device to be tested, and can send the instruction frame to the corresponding target test device based on the device address of the data frame, so that the target test device can perform corresponding test control operations based on the instruction frame.
[0077] In one embodiment of the present invention, the main control device constructs an instruction frame and sends it to the test device, the test device parses the instruction frame to obtain a parsing result, performs a corresponding test control operation according to the parsing result, and records a test situation when performing the test control operation to construct a response frame and send it to the main control device, including:
[0078] The main control device sends an initialization instruction frame to the test device;
[0079] The test device performs test device initialization upon receiving the initialization instruction frame, and sends a response frame to the main control device after the test device initialization is completed;
[0080] The main control device constructs a test instruction frame and sends it to the test device;
[0081] The test device parses the frame type and data code in the test instruction frame to obtain a parsing result, and performs a corresponding test control operation according to the parsing result. When performing the test control operation, the test situation is recorded to construct a response frame and send it to the main control device; wherein the frame type includes a read type and a write type, and the data code is a read parameter or a write parameter corresponding to the frame type.
[0082] In a specific implementation, the communication process between the main control device and the test device in the embodiment of the present invention is:
[0083] Test equipment initialization: The master device sends an initialization command frame to all test devices. After receiving the initialization command frame, the test device sends a response frame to complete the test equipment initialization process to facilitate subsequent test verification.
[0084] Command sending: The master device constructs a command frame including a frame type and a data code, and sends it to the target test device to be tested through the single-wire interface between the master device and the test device.
[0085] Instruction execution and response: After receiving the instruction frame, the test device parses the frame type and data code in the instruction frame to obtain the analysis result, performs the corresponding test control operation according to the analysis result, and records the test situation, so as to construct a response frame based on the test situation and send it to the main control device.
[0086] Data reception and processing: After receiving the response frame, the master device verifies and parses the response frame to obtain the relevant test situation of the target test device regarding the execution of the instruction frame, and then performs subsequent processing according to the test situation as needed.
[0087] In an embodiment of the present invention, if the answer frame or the response frame sent by the test device is not received within a preset time, the main control device re-sends the initialization instruction frame or the instruction frame to the test device.
[0088] In order to ensure that the test between the master device and the test device can be executed normally, a retransmission mechanism is also defined in the single-wire protocol. Specifically, the retransmission mechanism is a timeout retransmission mechanism. If the master device does not receive a response frame returned by the test device within a specified preset time after sending a data frame such as an initialization instruction frame or a test instruction frame, the timeout retransmission mechanism can be triggered to resend the data frame such as the initialization instruction frame or the test instruction frame to the test device. In an optional embodiment, if the number of times the timeout retransmission mechanism is triggered exceeds the preset number or the time for triggering the timeout retransmission mechanism exceeds the specified preset retransmission time, a prompt message can be sent to a designated object (such as a test management personnel) to remind the designated object to perform corresponding processing to ensure the normal execution of the test and the overall efficiency of the test.
[0089] In an embodiment of the present invention, when receiving a data frame, the main control device and the test device verify the data frame according to the verification code of the data frame to determine a verification result, and perform processing according to the verification result.
[0090] In order to ensure that the test between the master device and the test device can be executed normally, a verification error mechanism is also defined in the single-wire protocol. Specifically, the verification error mechanism is that if the master device and the test device receive a data frame, the data frame is verified based on the verification code in the data frame, for example, the integrity of the data frame is verified, and corresponding processing can be performed based on the verification result.
[0091] In one embodiment of the present invention, the processing according to the verification result includes:
[0092] When the verification result is that the data frame fails the verification, discarding the data frame that fails the verification;
[0093] An error response frame is sent to the main control device or the test device that sends the data frame, and the main control device or the test device resends the data frame according to the error response frame or records the data frame that fails the check.
[0094] If the checksum of the data frame does not match, the receiver (master device or test device) should discard the data frame and may send an error response to the sender (master device or test device). The sender can perform corresponding processing based on the error response, such as triggering the sender to resend the data frame, or record the error data frame, and then the specified object can be corrected based on the record read single-line protocol.
[0095] In order to enable those skilled in the art to better understand the embodiments of the present invention, a complete example is used below for illustration. Figure 3 , shows an overall flow chart of a method for communication between devices in a test scenario provided in an embodiment of the present invention. The master control device and the test device communicate by constructing data frames based on a single-line protocol for the test scenario. The specific process includes:
[0096] The test device waits for the initialization command frame; when starting the test, the master device sends the initialization command frame to the test device to be tested, and then waits for the test device to send a response frame, wherein, if the test device fails to send a response frame within a preset time, it is deemed to have timed out and no response is given, triggering a timeout retransmission mechanism; the test device receives the initialization command frame, and initializes the test device according to the initialization command frame, and after the initialization is completed, sends a response frame to the master device; after receiving the response frame, the master device constructs a command frame and sends the command frame to the test device; after receiving the command frame, the test device parses the command frame to obtain a parsing result, so that the corresponding Test control operations and record the test conditions when executing test control operations; then, the test device can construct a response frame based on the test conditions and send the response frame to the main control device. At this time, the test device can wait for the next instruction from the main control device or end the test; after receiving the response frame, the main control device processes the response data in the response frame, wherein processing the response data in the response frame includes verifying the response frame against the check code in the response frame. If the check fails, it is necessary to resend the initialization instruction frame to the test device to reset the test environment of the test device, thereby ensuring the accuracy of the test. If the check succeeds, it is possible to continue to send the next instruction frame or end the test.
[0097] By applying the single-wire protocol for the test scenario of the embodiment of the present invention, the main control device can send data frames such as instruction frames to the test device, and the test device executes the instruction frames and returns the results, providing a single-wire communication solution for a distributed test platform including multiple test devices. The single-wire protocol of the embodiment of the present invention has more advantages than the existing device communication protocol in terms of transmission efficiency and transmission stability in the test scenario.
[0098] Reference Figure 4 , shows a flow chart of the steps of a method for communication between devices in a test scenario provided in an embodiment of the present invention, which is applied to a communication system, wherein the communication system includes a main control device and a test device, and the main control device and the test device perform single-line communication based on a single-line protocol for the test scenario, and the single-line protocol has an instruction set. In the process of testing the test device, the method may specifically include the following steps:
[0099] Step 401: construct an instruction frame and send it to the test device, the test device parses the instruction frame to obtain a parsing result, performs a corresponding test control operation according to the parsing result, records the test situation when performing the test control operation to construct a response frame and sends it to the main control device; the instruction frame and the response frame are constructed according to the instruction set;
[0100] Step 402: parse the response frame to obtain the test condition of the test device, and perform corresponding processing according to the test condition.
[0101] In one embodiment of the present invention, the instruction frame, the response frame and the answer frame are data frames, and the data structure of the data frame includes multiple parts, and the parts of the data structure include a frame start character, a device address, a frame type, a data code, a check code, a reserved field, a version control field and a frame end character.
[0102] In one embodiment of the present invention, the single-wire protocol defines the waveform corresponding to the data frame, and each part in the data structure of the data frame has a corresponding time length; the single-wire protocol defines the input and output interface between the main control device and the test device as adopting a logic level standard.
[0103] In one embodiment of the present invention, the instruction set includes instruction frames for different test control requirements, and the test control requirements at least include test equipment initialization, test start, test stop, test data reading, test parameter setting, start of specific test items, skipping of specific test items, setting breakpoints at specified locations to pause execution, response feedback error fault codes, and repeated testing of failed items.
[0104] In one embodiment of the present invention, the main control device constructs an instruction frame and sends it to the test device, including:
[0105] The main control device constructs an instruction frame, and sends the instruction frame to the test device corresponding to the device address in the instruction frame.
[0106] In one embodiment of the present invention, the main control device constructs an instruction frame and sends it to the test device, the test device parses the instruction frame to obtain a parsing result, performs a corresponding test control operation according to the parsing result, and records a test situation when performing the test control operation to construct a response frame and send it to the main control device, including:
[0107] The main control device sends an initialization instruction frame to the test device;
[0108] The test device performs test device initialization upon receiving the initialization instruction frame, and sends a response frame to the main control device after the test device initialization is completed;
[0109] The main control device constructs a test instruction frame and sends it to the test device;
[0110] The test device parses the frame type and data code in the test instruction frame to obtain a parsing result, and performs a corresponding test control operation according to the parsing result. When performing the test control operation, the test situation is recorded to construct a response frame and send it to the main control device; wherein the frame type includes a read type and a write type, and the data code is a read parameter or a write parameter corresponding to the frame type.
[0111] In one embodiment of the present invention, the method further comprises:
[0112] If the answer frame or the response frame sent by the test device is not received within the preset time, the main control device re-sends the initialization instruction frame or the instruction frame to the test device.
[0113] In one embodiment of the present invention, the method further comprises:
[0114] When receiving a data frame, the main control device and the test device verify the data frame according to the verification code of the data frame to determine a verification result, and perform processing according to the verification result.
[0115] In one embodiment of the present invention, the processing according to the verification result includes:
[0116] When the verification result is that the data frame fails the verification, discarding the data frame that fails the verification;
[0117] An error response frame is sent to the main control device or the test device that sends the data frame, and the main control device or the test device resends the data frame according to the error response frame or records the data frame that fails the check.
[0118] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0119] Data frames such as command frames and response frames transmitted between the main control device and the test device in the embodiment of the present invention are generated according to the instruction set of the single-wire protocol for the test scenario. The signal waveforms of different data frames are different, that is, the construction principles of the data frames are different. Compared with the frame structure of the data frames in the existing technology, the embodiment of the present invention uses data frames constructed based on the instruction set of the single-wire protocol to communicate between the main control device and the test device, which has more advantages in low transmission efficiency and transmission stability in the test scenario.
[0120] As for the method embodiment, since it is basically similar to the system embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the system embodiment.
[0121] In addition, an embodiment of the present invention further 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 embodiment of the device-to-device communication method under the above-mentioned test scenario are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0122] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, each process of the embodiment of the device-to-device communication method in the above-mentioned test scenario 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.
[0123] An embodiment of the present invention also provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the embodiment of the device communication method in the above-mentioned test scenario, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0124] Figure 5 A schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention.
[0125] The electronic device 500 includes but is not limited to: a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509, a processor 510, and a power supply 511. Those skilled in the art will appreciate that Figure 5The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. In the embodiments of the present invention, the electronic device includes but is not limited to a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted terminal, a wearable device, and a pedometer.
[0126] It should be understood that in the embodiment of the present invention, the radio frequency unit 501 can be used for receiving and sending signals during information transmission or communication. Specifically, after receiving downlink data from the base station, it is sent to the processor 510 for processing; in addition, uplink data is sent to the base station. Generally, the radio frequency unit 501 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, etc. In addition, the radio frequency unit 501 can also communicate with the network and other devices through a wireless communication system.
[0127] The electronic device provides users with wireless broadband Internet access through the network module 502, such as helping users to send and receive emails, browse web pages, and access streaming media.
[0128] The audio output unit 503 can convert the audio data received by the RF unit 501 or the network module 502 or stored in the memory 509 into an audio signal and output it as sound. Moreover, the audio output unit 503 can also provide audio output related to a specific function performed by the electronic device 500 (for example, a call signal reception sound, a message reception sound, etc.). The audio output unit 503 includes a speaker, a buzzer, a receiver, etc.
[0129] The input unit 504 is used to receive audio or video signals. The input unit 504 may include a graphics processor (GPU) 5041 and a microphone 5042. The graphics processor 5041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The processed image frame can be displayed on the display unit 506. The image frame processed by the graphics processor 5041 can be stored in the memory 509 (or other storage medium) or sent via the radio frequency unit 501 or the network module 502. The microphone 5042 can receive sound and can process such sound into audio data. The processed audio data can be converted into a format output that can be sent to a mobile communication base station via the radio frequency unit 501 in the case of a telephone call mode.
[0130] The electronic device 500 also includes at least one sensor 505, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 5061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 5061 and / or the backlight when the electronic device 500 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, which can be used to identify the posture of the electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; the sensor 505 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be repeated here.
[0131] The display unit 506 is used to display information input by the user or information provided to the user. The display unit 506 may include a display panel 5061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0132] The user input unit 507 can be used to receive input digital or character information, and to generate key signal input related to user settings and function control of the electronic device. Specifically, the user input unit 507 includes a touch panel 5071 and other input devices 5072. The touch panel 5071, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 5071 or near the touch panel 5071 using any suitable object or accessory such as a finger, stylus, etc.). The touch panel 5071 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the contact point coordinates, and then sends it to the processor 510, receives the command sent by the processor 510 and executes it. In addition, the touch panel 5071 can be implemented using multiple types such as resistive, capacitive, infrared and surface acoustic waves. In addition to the touch panel 5071, the user input unit 507 may also include other input devices 5072. Specifically, other input devices 5072 may include but are not limited to a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail here.
[0133] Furthermore, the touch panel 5071 may be overlaid on the display panel 5061. When the touch panel 5071 detects a touch operation on or near it, it transmits the information to the processor 510 to determine the type of the touch event. Then, the processor 510 provides a corresponding visual output on the display panel 5061 according to the type of the touch event. Figure 5 In the figure, the touch panel 5071 and the display panel 5061 are used as two independent components to realize the input and output functions of the electronic device. However, in some embodiments, the touch panel 5071 and the display panel 5061 can be integrated to realize the input and output functions of the electronic device, which is not limited here.
[0134] The interface unit 508 is an interface for connecting an external device to the electronic device 500. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, etc. The interface unit 508 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the electronic device 500 or may be used to transmit data between the electronic device 500 and an external device.
[0135] The memory 509 can be used to store software programs and various data. The memory 509 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 509 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0136] The processor 510 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 509 and calling data stored in the memory 509, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. The processor 510 may include one or more processing units; preferably, the processor 510 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 510.
[0137] The electronic device 500 may also include a power supply 511 (such as a battery) for supplying power to each component. Preferably, the power supply 511 may be logically connected to the processor 510 through a power management system, thereby implementing functions such as charging, discharging, and power consumption management through the power management system.
[0138] In addition, the electronic device 500 includes some functional modules not shown, which will not be described in detail here.
[0139] 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.
[0140] 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 invention, 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 enabling 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 invention.
[0141] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
[0142] 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 embodiments of the present invention 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 the present invention.
[0143] 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.
[0144] 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.
[0145] 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.
[0146] In addition, each functional unit in each embodiment of the present invention 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.
[0147] 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 invention, 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. The computer software product is stored in a storage medium, including 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 method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.
[0148] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A device communication system in a test scenario, characterized in that: The communication system includes a main control device and a test device. The main control device and the test device perform single-line communication based on a single-line protocol for a test scenario. The single-line protocol has an instruction set. During the test of the test device: The main control device constructs an instruction frame and sends it to the test device, the test device parses the instruction frame to obtain a parsing result, performs a corresponding test control operation according to the parsing result, and records the test situation when performing the test control operation to construct a response frame and sends it to the main control device; the instruction frame and the response frame are constructed according to the instruction set; The main control device parses the response frame to obtain the test situation of the test device, and performs corresponding processing according to the test situation.
2. The communication system according to claim 1, characterized in that The instruction frame, the response frame and the answer frame are data frames, and the data structure of the data frame includes multiple parts, and the parts of the data structure include a frame start character, a device address, a frame type, a data code, a check code, a reserved field, a version control field and a frame end character.
3. The communication system according to claim 2, characterized in that The single-wire protocol defines the waveform corresponding to the data frame, and each part in the data structure of the data frame has a corresponding time length; the single-wire protocol defines that the input and output interface between the main control device and the test device adopts a logic level standard.
4. The communication system according to claim 3, characterized in that: The instruction set includes instruction frames for different test control requirements, and the test control requirements at least include test equipment initialization, test start, test stop, test data reading, test parameter setting, start of specific test items, skipping of specific test items, setting breakpoints at specified locations to pause execution, response feedback error fault codes, and repeated testing of failed items.
5. The communication system according to claim 4, characterized in that: The main control device constructs an instruction frame and sends it to the test device, including: The main control device constructs an instruction frame, and sends the instruction frame to the test device corresponding to the device address in the instruction frame.
6. The communication system according to claim 4, characterized in that: The main control device constructs an instruction frame and sends it to the test device, the test device parses the instruction frame to obtain a parsing result, performs a corresponding test control operation according to the parsing result, and records the test situation when performing the test control operation to construct a response frame and send it to the main control device, including: The main control device sends an initialization instruction frame to the test device; The test device performs test device initialization upon receiving the initialization instruction frame, and sends a response frame to the main control device after the test device initialization is completed; The main control device constructs a test instruction frame and sends it to the test device; The test device parses the frame type and data code in the test instruction frame to obtain a parsing result, and performs a corresponding test control operation according to the parsing result. When performing the test control operation, the test situation is recorded to construct a response frame and send it to the main control device; wherein the frame type includes a read type and a write type, and the data code is a read parameter or a write parameter corresponding to the frame type.
7. The communication system according to claim 4, characterized in that: If the answer frame or the response frame sent by the test device is not received within the preset time, the main control device re-sends the initialization instruction frame or the instruction frame to the test device.
8. The communication system according to claim 4, characterized in that: When receiving a data frame, the main control device and the test device verify the data frame according to the verification code of the data frame to determine a verification result, and perform processing according to the verification result.
9. The communication system according to claim 8, characterized in that: The processing according to the verification result includes: When the verification result is that the data frame fails the verification, discarding the data frame that fails the verification; An error response frame is sent to the main control device or the test device that sends the data frame, and the main control device or the test device resends the data frame according to the error response frame or records the data frame that fails the check.
10. A method for communication between devices in a test scenario, characterized in that: Applied to a communication system, the communication system includes a main control device and a test device, the main control device and the test device perform single-line communication based on a single-line protocol for a test scenario, the single-line protocol has an instruction set, and during the test of the test device, the method includes: Constructing an instruction frame and sending it to the test device, the test device parsing the instruction frame to obtain a parsing result, so as to perform a corresponding test control operation according to the parsing result, and recording the test situation when performing the test control operation to construct a response frame and send it to the main control device; the instruction frame and the response frame are constructed according to the instruction set; The response frame is parsed to obtain the test condition of the test device, and corresponding processing is performed according to the test condition.
11. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; The memory is used to store computer programs; The processor is used to implement the method according to claim 10 when executing the program stored in the memory.
12. A computer-readable storage medium having instructions stored thereon, which when executed by one or more processors cause the processors to perform the method of claim 10.
Citation Information
Patent Citations
Distributed remote test system, method and server
CN101741648A
Method and apparatus for serial data transmission at a switchable data rate
CN103098419A
Electronic product data transmission method and system, storage medium and program product
CN113726467A
Unibus communication method, device, system and equipment
CN116578521A
Communication method and system for charger testing device and upper computer
CN117614942A
