A serial communication bus verification method, device, system and storage medium
Verifying packets of the I2C bus on the MCU through the I2C debugging module solves the problem of low verification efficiency in the prior art and realizes efficient verification without external devices.
Patent Information
- Application Number
- CN202411943696.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-12-26
AI Technical Summary
The verification process of the existing I2C bus is inefficient, and requires external I2C slave peripheral chip and logic analyzer, so the verification efficiency is limited.
Through the I2C debugging module, after the MCU is triggered to perform the message sending task, it verifies the message to be checked, obtains the transmission verification result, and sends the message to be checked to the MCU for verification, obtains the received verification result, and determines the verification result of the I2C bus based on the results of both.
The correctness of sending and receiving packets of the I2C bus can be verified without external devices, which significantly improves verification efficiency.
Smart Images

Figure CN119382836B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a serial communication bus verification method, device, system and storage medium. Background Art
[0002] The serial communication bus (Inter-Integrated Circuit, I2C) is widely used in the data reading and writing and chip control of sensors, memories, and peripheral chips in automotive electronic systems. Due to the response mechanism of I2C bus communication, it requires at least one master and one slave device to communicate.
[0003] In the development and verification process of the existing I2C bus, the I2C slave peripheral chip soldered on the printed circuit board (PCB) is usually used for communication. To verify the correctness of the communication message, it is necessary to connect a logic analyzer to the test point on the PCB for viewing. Since the verification of the I2C bus requires not only an external I2C slave peripheral chip, but also a logic analyzer to the test point on the PCB for viewing, if there are many I2C buses to be verified, they need to be connected one by one for verification, resulting in low verification efficiency.
[0004] Therefore, how to improve verification efficiency has become an urgent problem to be solved in this field. Summary of the invention
[0005] The present application provides a serial communication bus verification method, device, system and storage medium, the purpose of which is to improve verification efficiency.
[0006] In order to achieve the above objectives, this application provides the following technical solutions:
[0007] A serial communication bus verification method, applied to an I2C debugging module, comprising:
[0008] After triggering the MCU to execute the message sending task, verify the message to be checked in the message sending task to obtain a sending verification result;
[0009] Sending the message to be checked to the MCU so that the MCU verifies the message to be checked and obtains a reception verification result;
[0010] Based on the sending verification result and the receiving verification result, a verification result of the I2C bus is determined.
[0011] Optionally, after the MCU is triggered to execute the message sending task, the message to be checked in the message sending task is verified to obtain a sending verification result, including:
[0012] When the working mode of the MCU is the host mode, the MCU is triggered to execute a message sending task; the message sending task includes a message to be checked;
[0013] When receiving the message to be checked, detecting whether the message to be checked is consistent with a preset message;
[0014] If the message to be checked is consistent with the preset message, determining that the sent verification result is verification passed;
[0015] If the message to be checked is inconsistent with the preset message, the verification result is determined to be unverified.
[0016] Optionally, after the MCU is triggered to execute the message sending task, the message to be checked in the message sending task is verified to obtain a sending verification result, including:
[0017] When the working mode of the MCU is the slave mode, a data read request is sent to the MCU so that the MCU performs a message sending task; the message sending task includes a message to be checked;
[0018] When receiving the message to be checked, detecting whether the message to be checked is consistent with a preset message;
[0019] If the message to be checked is consistent with the preset message, determining that the sent verification result is verification passed;
[0020] If the message to be checked is inconsistent with the preset message, the verification result is determined to be unverified.
[0021] Optionally, the sending the message to be checked to the MCU so that the MCU checks the message to be checked and obtains a reception verification result, includes:
[0022] When the working mode of the MCU is the host mode, receiving a data read request sent by the MCU;
[0023] After receiving the data read request, sending a preparation message to the MCU;
[0024] Start the buffer of the MCU according to the preparation message;
[0025] When the buffer of the MCU is started, the message to be checked is sent to the MCU, so that the MCU verifies the message to be checked and obtains a reception verification result.
[0026] Optionally, the sending the message to be checked to the MCU so that the MCU checks the message to be checked and obtains a reception verification result, includes:
[0027] When the working mode of the MCU is the slave mode, triggering the execution buffer receiving task of the MCU; the buffer receiving task is a task pre-added to the MCU;
[0028] When receiving the read request of the MCU, the message to be checked is sent to the MCU, so that the MCU checks the message to be checked in the buffer and obtains a reception check result.
[0029] Optionally, determining the verification result of the I2C bus based on the sending verification result and the receiving verification result includes:
[0030] When the sending verification result and the receiving verification result indicate that the message to be checked has passed the verification, determining that the verification result of the I2C bus is verification passed;
[0031] When the sending verification result or the receiving verification result indicates that the message to be checked has not passed the verification, it is determined that the verification result of the I2C bus is not passed.
[0032] A serial communication bus verification device, applied to an I2C debugging module, comprising:
[0033] A verification unit, used to verify the message to be checked in the message sending task after triggering the MCU to execute the message sending task, and obtain a sending verification result;
[0034] A verification unit, used for sending the message to be verified to the MCU, so that the MCU verifies the message to be verified and obtains a reception verification result;
[0035] A determination unit is used to determine a verification result of the I2C bus based on the sending verification result and the receiving verification result.
[0036] Optionally, the verification unit is specifically used for:
[0037] When the working mode of the MCU is the host mode, the MCU is triggered to execute a message sending task; the message sending task includes a message to be checked;
[0038] When receiving the message to be checked, detecting whether the message to be checked is consistent with a preset message;
[0039] If the message to be checked is consistent with the preset message, determining that the sent verification result is verification passed;
[0040] If the message to be checked is inconsistent with the preset message, determining that the verification result is not passed;
[0041] The verification unit is also used for:
[0042] When the working mode of the MCU is the slave mode, a data read request is sent to the MCU so that the MCU performs a message sending task; the message sending task includes a message to be checked;
[0043] When receiving the message to be checked, detecting whether the message to be checked is consistent with a preset message;
[0044] If the message to be checked is consistent with the preset message, determining that the sent verification result is verification passed;
[0045] If the message to be checked is inconsistent with the preset message, determining that the verification result is not passed;
[0046] The verification unit is also used for:
[0047] When the working mode of the MCU is the host mode, receiving a data read request sent by the MCU;
[0048] After receiving the data read request, sending a preparation message to the MCU;
[0049] Start the buffer of the MCU according to the preparation message;
[0050] When the buffer of the MCU is started, the message to be checked is sent to the MCU, so that the MCU verifies the message to be checked and obtains a reception verification result;
[0051] The verification unit is also used for:
[0052] When the working mode of the MCU is the slave mode, triggering the execution buffer receiving task of the MCU; the buffer receiving task is a task pre-added to the MCU;
[0053] When receiving the read request of the MCU, the message to be checked is sent to the MCU, so that the MCU checks the message to be checked in the buffer and obtains a reception check result.
[0054] A serial communication bus verification system, the system comprising: an MCU and an I2C debugging module;
[0055] The MCU is connected to the I2C debugging module via a data line SDA and a clock line SCL;
[0056] The I2C debugging module is used to execute any of the serial communication bus verification methods.
[0057] A computer-readable storage medium comprises a stored program, wherein the program executes any one of the serial communication bus verification methods.
[0058] The technical solution provided by the present application, after triggering the MCU to execute the message sending task, verifies the message to be checked in the message sending task to obtain the sending verification result; sends the message to be checked to the MCU so that the MCU verifies the message to be checked and obtains the receiving verification result; based on the sending verification result and the receiving verification result, determines the verification result of the I2C bus. In the present application, the I2C debugging module can verify whether the sending and receiving messages of the I2C bus are correct, and the verification of the I2C bus can be completed without an external device, thereby improving the verification efficiency of the I2C bus. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] 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 will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0060] Figure 1 A flowchart of a serial communication bus verification method provided in an embodiment of the present application;
[0061] Figure 2 A schematic diagram of a serial communication bus verification system provided in an embodiment of the present application;
[0062] Figure 3 A flowchart of a verification method for a message to be checked provided in an embodiment of the present application;
[0063] Figure 4 A flowchart of another method for verifying a message to be checked provided in an embodiment of the present application;
[0064] Figure 5 A flowchart of another method for verifying a message to be checked provided in an embodiment of the present application;
[0065] Figure 6 A flowchart of another method for verifying a message to be checked provided in an embodiment of the present application;
[0066] Figure 7 A schematic diagram of a serial communication bus verification process provided in an embodiment of the present application;
[0067] Figure 8 A schematic diagram of the architecture of a serial communication bus verification device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0068] 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 only 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.
[0069] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising 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 "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0070] like Figure 1 As shown, it is a flowchart of a serial communication bus verification method provided by an embodiment of the present application, which is applied to an I2C debugging module and includes the following steps:
[0071] It should be noted that the I2C debugging module includes: an I2C debugging device and a host computer. Since the I2C bus needs to be verified, the embodiment of the present application provides a serial communication bus verification system, which includes a microcontroller unit (Micro Control Unit, MCU) and an I2C debugging module. The I2C bus pin of the MCU can be connected to the I2C debugging device by wiring, that is, the MCU is connected to the I2C debugging device through a data line (Serial Data Line, SDA) and a clock line (Serial Clock Line, SCL), and the I2C debugging device is connected to the host computer through a USB interface. For specific connection relationships, please refer to Figure 2 .
[0072] S101: After the MCU is triggered to execute the message sending task, the message to be checked in the message sending task is verified to obtain a sending verification result.
[0073] Among them, the message sending task is pre-added in the periodic scheduling task of the MCU, and then the MCU can be triggered to execute the message sending task.
[0074] It can be understood that the conditions for triggering the MCU to execute the message sending task are different when the MCU is in different working modes.
[0075] It should be noted that before triggering the MCU to execute the message sending task, it is necessary to set the master-slave mode, slave address, sending message and other parameters of the I2C debugging module, that is, set the master-slave mode, slave address, sending message, baud rate and other parameters of the I2C debugging device through the host computer.
[0076] After the parameters of the I2C debug module are set, you need to initialize the modules required to verify the I2C bus, such as the MCU, the I2C debug module, and the MCU's input / output (i.e., PORT, such as SDA, SCL).
[0077] Optionally, in another embodiment of the present application, the specific implementation of step S101 is as follows: Figure 3 As shown, the following steps are included:
[0078] S301: When the working mode of the MCU is the host mode, the MCU is triggered to execute a message sending task.
[0079] Among them, the message sending task includes the message to be checked.
[0080] It should be noted that the message sending task at this time is the sending task when the I2C bus acts as the host.
[0081] It is understandable that when the working mode of the MCU is the host mode, the MCU is triggered to execute the message sending task, that is, the MCU is triggered to execute the message sending task pre-added to the periodic scheduling task, so that the I2C debugging module receives and verifies the message to be checked.
[0082] S302: When receiving a message to be checked, detecting whether the message to be checked is consistent with a preset message.
[0083] If the message to be checked is consistent with the preset message, step S303 is executed; if the message to be checked is inconsistent with the preset message, step S304 is executed.
[0084] The detection of whether the message to be checked is consistent with the preset message is performed. Specifically, the message to be checked and the preset message are displayed on the host computer to compare whether the message to be checked is consistent with the preset message.
[0085] Specifically, the message to be checked is the first message, and the preset message is the first message. It is detected whether the message to be checked is consistent with the preset message. Obviously, the message to be checked is consistent with the preset message, so step S303 is continued.
[0086] Specifically, the message to be checked is the first message, and the preset message is the second message. It is detected whether the message to be checked is consistent with the preset message. Obviously, the message to be checked is inconsistent with the preset message. Therefore, step S304 is continued.
[0087] S303: Determine that the sent verification result is verification passed.
[0088] It can be understood that if the message to be checked is consistent with the preset message, it means that the message to be checked received at this time is correct, and then the sent verification result is determined to be verification passed.
[0089] S304: Determine whether the verification result sent is not passed.
[0090] It is understandable that if the message to be checked is inconsistent with the preset message, it means that the message to be checked received at this time is incorrect, and then the verification result is determined to be not verified.
[0091] Optionally, in another embodiment of the present application, the specific implementation of step S101 is as follows: Figure 4 As shown, the following steps are included:
[0092] S401: When the working mode of the MCU is the slave mode, a data read request is sent to the MCU so that the MCU executes a message sending task.
[0093] Among them, the message sending task includes the message to be checked.
[0094] It should be noted that the message sending task at this time is the sending task when the I2C bus acts as a slave.
[0095] It is understandable that when the MCU works in slave mode, the MCU will prepare the pending message to be sent. At this time, the pending message will not be sent. Only by sending a data read request to the MCU can the MCU be triggered to execute the message sending task.
[0096] S402: When receiving a message to be checked, detecting whether the message to be checked is consistent with a preset message.
[0097] If the message to be checked is consistent with the preset message, step S403 is executed; if the message to be checked is inconsistent with the preset message, step S404 is executed.
[0098] Among them, when the MCU is triggered to execute the message sending task, the I2C debugging module receives the message to be checked sent by the MCU, and then checks whether the message to be checked is correct through the host computer.
[0099] It should be noted that the specific implementation of step S402 may refer to step S302 accordingly, and will not be repeated here.
[0100] S403: Determine that the sent verification result is verification passed.
[0101] It should be noted that the specific implementation of step S403 may refer to step S303 accordingly, and will not be repeated here.
[0102] S404: Determine whether the verification result sent is not passed.
[0103] It should be noted that the specific implementation of step S404 may refer to step S304 accordingly, and will not be repeated here.
[0104] S102: Send the message to be checked to the MCU, so that the MCU checks the message to be checked and obtains a reception verification result.
[0105] The received verification result indicates the result of checking the message to be checked after the MCU receives the message to be checked. One received verification result is the result that the message to be checked passes the check, and the other is the result that the message to be checked fails the check.
[0106] It can be understood that the purpose of sending the message to be checked to the MCU is to verify the message reception when the MCU is in slave mode, that is, to verify the message to be checked and obtain the reception verification result when the MCU is in slave mode.
[0107] Optionally, in another embodiment of the present application, the specific implementation of step S102 is as follows: Figure 5 As shown, the following steps are included:
[0108] S501: When the working mode of the MCU is the host mode, a data read request sent by the MCU is received.
[0109] It should be noted that since I2C communication is actually initiated by the host, no matter what the request is (such as a read or write request), when the I2C debug device receives the host's data read request, it does not know what data to send. This means that the debug device cannot correctly respond to the host's data read request. Therefore, the I2C debug device must first receive the data read request sent by the MCU in order to subsequently send data to the MCU.
[0110] S502: After receiving the data read request, send a preparation message to the MCU.
[0111] Among them, in I2C communication, the host usually sends a data read request to require the slave device to send data to the host, that is, after receiving the data read request, it sends a preparation message to the MCU.
[0112] S503: Start the buffer of the MCU according to the preparation message.
[0113] The buffer of the MCU is started according to the preparation message. Specifically, when the MCU receives the preparation message, the MCU is triggered to start the buffer so that the MCU receives the message to be checked in the buffer.
[0114] S504: After the buffer of the MCU is started, the message to be checked is sent to the MCU, so that the MCU checks the message to be checked and obtains a reception verification result.
[0115] Optionally, the message to be checked is sent to the MCU so that the MCU can verify the message to be checked, including but not limited to: viewing and verifying the message to be checked in the integrated development environment, displaying the data directly to the host computer through the printf function, and verifying the message to be checked on the host computer.
[0116] Optionally, in another embodiment of the present application, the specific implementation of step S102 is as follows: Figure 6 As shown, the following steps are included:
[0117] S601: When the working mode of the MCU is the slave mode, triggering the execution buffer receiving task of the MCU.
[0118] The buffer receiving task is a task pre-added to the MCU.
[0119] It is understandable that when the working mode of the MCU is the slave mode, after the execution buffer receiving task of the MCU is triggered, the buffer of the MCU can receive the message to be checked, so as to subsequently check whether the message to be checked in the buffer is correct.
[0120] S602: When receiving a read request from the MCU, a message to be checked is sent to the MCU, so that the MCU checks the message to be checked in the buffer and obtains a reception check result.
[0121] It can be understood that when receiving a read request from the MCU, the I2C debugging device sends a message to be checked to the MCU on the host computer. After sending the message to be checked, the triggering of the execution buffer receiving task of the MCU is suspended, so that the MCU suspends the execution buffer receiving task, and the MCU verifies the message to be checked in the buffer to obtain the receiving verification result.
[0122] S103: Determine the verification result of the I2C bus based on the sending verification result and the receiving verification result.
[0123] It is understandable that since the sending verification result is to verify the situation of the I2C bus sending messages, and the receiving verification result is to verify the situation of the I2C bus receiving messages, the verification result of the I2C bus is determined based on these two situations.
[0124] Optionally, in another embodiment of the present application, the specific implementation of step S103 includes the following steps:
[0125] When the sending verification result and the receiving verification result indicate that the message to be checked passes the verification, it is determined that the verification result of the I2C bus is verification passed.
[0126] Among them, when the sending verification result is that the sent message is a correct message when the working mode of the MCU is the host mode and the slave mode, and the receiving verification result is that the received message is a correct message when the working mode of the MCU is the host mode and the slave mode, the verification result of the I2C bus is determined to be passed.
[0127] When the sent verification result or the received verification result indicates that the message to be verified has not passed the verification, it is determined that the verification result of the I2C bus is not passed.
[0128] Among them, when the sending verification result is that the sending message fails the verification when the MCU's working mode is host mode or slave mode, and the receiving verification result is that the receiving message fails the verification when the MCU's working mode is host mode or slave mode, the verification result of the I2C bus is determined to be failed verification.
[0129] Combination Figure 1 For the contents shown, see Figure 7 , the I2C debugging module first sets the master-slave mode, baud rate, and slave address. After the settings are completed, the MCU, PORT, and I2C modules are initialized. After initialization, the MCU can be used as the host mode or the slave mode to send and receive messages.
[0130] First, the MCU sends a message as a host mode: first, the MCU is triggered to execute the message sending task (that is, the MCU sends a message to be checked). When the message to be checked (such as an I2C message) is received, the message to be checked is verified (that is, whether the received message to be checked is correct).
[0131] Second, when the MCU's working mode is the host mode for receiving messages: receive the read request sent by the MCU; after receiving the read request, send a prepare message to the MCU; start the MCU's buffer according to the prepare message; when the MCU's buffer is started, send a message to the MCU so that the MCU can verify the message (that is, pause the program to check whether the buffer data is correct).
[0132] Third, when the MCU works in slave mode and sends a message: send a data read request to the MCU to enable the MCU to perform the message sending task (that is, the MCU sends a message); when a message to be checked is received, check the message (that is, check whether the message is correct).
[0133] Fourth, when the MCU works in slave mode to receive messages: trigger the MCU's execution buffer receiving task; when receiving the MCU's read request, send the message to be checked to the MCU so that the MCU can check the message to be checked in the buffer (that is, pause the program to check whether the buffer data is correct).
[0134] In summary, the I2C debugging module can be used to verify whether the I2C bus's receiving and sending messages are correct, and the verification of the I2C bus can be completed without an external device, thereby improving the verification efficiency of the I2C bus.
[0135] like Figure 8 , which is a schematic diagram of the architecture of a serial communication bus verification device provided in an embodiment of the present application, and is applied to an I2C debugging module. The verification device includes: a verification unit 100, a verification unit 200 and a determination unit 300.
[0136] The verification unit 100 is used to verify the message to be checked in the message sending task after triggering the MCU to execute the message sending task, and obtain a sending verification result.
[0137] The verification unit 100 is specifically used for: when the working mode of the MCU is the host mode, triggering the MCU to execute the message sending task; the message sending task includes a message to be checked; when the message to be checked is received, detecting whether the message to be checked is consistent with the preset message; if the message to be checked is consistent with the preset message, determining that the sending verification result is verified; if the message to be checked is inconsistent with the preset message, determining that the sending verification result is not verified.
[0138] The verification unit 100 is specifically used for: when the working mode of the MCU is the slave mode, sending a data read request to the MCU so that the MCU executes a message sending task; the message sending task includes a message to be checked; when the message to be checked is received, detecting whether the message to be checked is consistent with a preset message; if the message to be checked is consistent with the preset message, determining that the sending verification result is verified; if the message to be checked is inconsistent with the preset message, determining that the sending verification result is not verified.
[0139] The verification unit 200 is used to send a message to be verified to the MCU, so that the MCU verifies the message to be verified and obtains a reception verification result.
[0140] The verification unit 200 is specifically used for: when the working mode of the MCU is the host mode, receiving a data read request sent by the MCU; after receiving the data read request, sending a preparation message to the MCU; starting the buffer of the MCU according to the preparation message; when the buffer of the MCU is started, sending a message to be checked to the MCU, so that the MCU checks the message to be checked and obtains a reception verification result.
[0141] The verification unit 200 is specifically used for: when the working mode of the MCU is the slave mode, triggering the execution buffer receiving task of the MCU; the buffer receiving task is a task pre-added to the MCU; when receiving a read request from the MCU, sending a message to be checked to the MCU, so that the MCU checks the message to be checked in the buffer and obtains a receiving verification result.
[0142] The determination unit 300 is used to determine the verification result of the I2C bus based on the sending verification result and the receiving verification result.
[0143] The determination unit 300 is specifically used to: when the sending verification result and the receiving verification result indicate that the message to be verified has passed the verification, determine that the verification result of the I2C bus is passed; when the sending verification result or the receiving verification result indicates that the message to be verified has not passed the verification, determine that the verification result of the I2C bus is not passed.
[0144] In summary, the I2C debugging module can be used to verify whether the I2C bus's receiving and sending messages are correct, and the verification of the I2C bus can be completed without an external device, thereby improving the verification efficiency of the I2C bus.
[0145] The present application also provides a computer-readable storage medium, which includes a stored program, wherein the program executes the serial communication bus verification method provided by the present application.
[0146] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.
[0147] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may 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.
[0148] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A serial communication bus verification method, characterized in that: Applicable to I2C debug module, including: After triggering the MCU to execute the message sending task, verify the message to be checked in the message sending task to obtain a sending verification result; Sending the message to be checked to the MCU so that the MCU verifies the message to be checked and obtains a reception verification result; Determining a verification result of the I2C bus based on the sending verification result and the receiving verification result; The step of sending the message to be checked to the MCU so that the MCU checks the message to be checked and obtains a reception verification result includes: When the working mode of the MCU is the host mode, receiving a data read request sent by the MCU; After receiving the data read request, sending a preparation message to the MCU; Start the buffer of the MCU according to the preparation message; When the buffer of the MCU is started, the message to be checked is sent to the MCU, so that the MCU verifies the message to be checked and obtains a reception verification result; When the working mode of the MCU is the slave mode, the MCU is triggered to execute a buffer receiving task; the buffer receiving task is a task pre-added to the MCU; When receiving the read request of the MCU, the message to be checked is sent to the MCU, so that the MCU checks the message to be checked in the buffer and obtains a reception verification result.
2. The method according to claim 1, characterized in that After the MCU is triggered to execute the message sending task, the message to be checked in the message sending task is verified to obtain a sending verification result, including: When the working mode of the MCU is the host mode, the MCU is triggered to execute a message sending task; the message sending task includes a message to be checked; When receiving the message to be checked, detecting whether the message to be checked is consistent with a preset message; If the message to be checked is consistent with the preset message, determining that the sent verification result is verification passed; If the message to be checked is inconsistent with the preset message, the verification result is determined to be unverified.
3. The method according to claim 1, characterized in that After the MCU is triggered to execute the message sending task, the message to be checked in the message sending task is verified to obtain a sending verification result, including: When the working mode of the MCU is the slave mode, a data read request is sent to the MCU so that the MCU performs a message sending task; the message sending task includes a message to be checked; When receiving the message to be checked, detecting whether the message to be checked is consistent with a preset message; If the message to be checked is consistent with the preset message, determining that the sent verification result is verification passed; If the message to be checked is inconsistent with the preset message, the verification result is determined to be unverified.
4. The method according to claim 1, characterized in that: The step of determining the verification result of the I2C bus based on the sending verification result and the receiving verification result includes: When the sending verification result and the receiving verification result indicate that the message to be checked has passed the verification, determining that the verification result of the I2C bus is verification passed; When the sending verification result or the receiving verification result indicates that the message to be checked has not passed the verification, it is determined that the verification result of the I2C bus is not passed.
5. A serial communication bus verification device, characterized in that: Applicable to I2C debug module, including: A verification unit, used to verify the message to be checked in the message sending task after triggering the MCU to execute the message sending task, and obtain a sending verification result; A verification unit, used for sending the message to be verified to the MCU, so that the MCU verifies the message to be verified and obtains a reception verification result; A determination unit, configured to determine a verification result of the I2C bus based on the sending verification result and the receiving verification result; Wherein, the verification unit is also used for: When the working mode of the MCU is the host mode, receiving a data read request sent by the MCU; After receiving the data read request, sending a preparation message to the MCU; Start the buffer of the MCU according to the preparation message; When the buffer of the MCU is started, the message to be checked is sent to the MCU, so that the MCU verifies the message to be checked and obtains a reception verification result; The verification unit is also used for: When the working mode of the MCU is the slave mode, the MCU is triggered to execute a buffer receiving task; the buffer receiving task is a task pre-added to the MCU; When receiving the read request of the MCU, the message to be checked is sent to the MCU, so that the MCU checks the message to be checked in the buffer and obtains a reception verification result.
6. The device according to claim 5, characterized in that The verification unit is specifically used for: When the working mode of the MCU is the host mode, the MCU is triggered to execute a message sending task; the message sending task includes a message to be checked; When receiving the message to be checked, detecting whether the message to be checked is consistent with a preset message; If the message to be checked is consistent with the preset message, determining that the sent verification result is verification passed; If the message to be checked is inconsistent with the preset message, determining that the verification result is not passed; The verification unit is also used for: When the working mode of the MCU is the slave mode, a data read request is sent to the MCU so that the MCU performs a message sending task; the message sending task includes a message to be checked; When receiving the message to be checked, detecting whether the message to be checked is consistent with a preset message; If the message to be checked is consistent with the preset message, determining that the sent verification result is verification passed; If the message to be checked is inconsistent with the preset message, it is determined that the sent verification result is not verified.
7. A serial communication bus verification system, characterized in that: The system comprises: an MCU and an I2C debugging module; The MCU is connected to the I2C debugging module via a data line SDA and a clock line SCL; The I2C debugging module is used to execute the serial communication bus verification method described in any one of claims 1-4.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the serial communication bus verification method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Verification method and verification system based on I3C bus communication
CN110489815A