Communication data verification method, device, electronic device and storage medium
By introducing post-write read design and CRC8 verification into the I2C communication between BMC and CPLD, the data transmission reliability and accuracy problems are solved, and the data transmission integrity and server performance optimization are achieved.
Patent Information
- Application Number
- CN202510786943.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-12
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2045-06-12
AI Technical Summary
The I2C communication between BMC and CPLD lacks a complete data verification mechanism, resulting in poor data transmission reliability and accuracy, and the CPLD side cannot confirm whether the data is executed correctly.
Read verification is performed immediately after the BMC writes data to the CPLD. Through the improved communication format and CRC8 verification algorithm, the integrity and accuracy of data transmission are ensured, including initiating a read operation immediately after the write operation, and verifying whether the data is received and processed correctly through the CRC8 verification value.
It improves the reliability of data transmission and the response speed of the server, optimizes the continuity and performance of communication, and ensures the accuracy and reliability of data transmission.
Smart Images

Figure CN120315933B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a communication data verification method, device, electronic device, and storage medium. Background Art
[0002] The Baseboard Management Controller (BMC) and Complex Programming Logic Device (CPLD) are two crucial firmware chips in servers, ensuring proper server operation and status monitoring. Communication between the BMC and CPLD primarily occurs over the Inter-Integrated Circuit Bus (I2C) protocol. This protocol enables real-time monitoring and fault warnings, configuration management, and functional collaboration.
[0003] To ensure accurate data transmission, timely error detection and correction, and stable system operation, I2C communication between the BMC and CPLD requires data checksums. Related technologies for communication data checksums only send check bits when the BMC writes data to the CPLD. However, there's no guarantee that the CPLD verifies the data sent by the BMC and compares it with the checksum value sent by the BMC. If the CPLD doesn't compare the checksums, data communication errors can still lead to CPLD execution errors. Furthermore, even if the CPLD compares the checksums, the BMC can't determine whether the instructions it issued were actually executed. Summary of the Invention
[0004] The present application provides a communication data verification method, device, electronic device and storage medium to at least solve the problem that the verification mechanism of the related art is incomplete during data transmission, and the reliability and accuracy of data transmission are poor.
[0005] The present application provides a communication data verification method, comprising the following steps: after performing a write operation on a target terminal, initiating a read verification operation on the written data; filling the terminal address and read flag of the target terminal into first data in a first communication format corresponding to the read verification operation, wherein the first communication format includes multiple filling bits, at least one filling bit of the target terminal is reserved among the multiple filling bits, and the filling content in the at least one filling bit of the target terminal includes a comparison value, read data and a first verification value; in response to the read verification operation, sending the first data in the first communication format to the target terminal, obtaining second data in the first communication format fed back by the target terminal, identifying the filling content of the target terminal in the second data, and verifying the write operation according to the filling content of the target terminal.
[0006] The present application also provides a communication data verification device, including: an initiating module, used to initiate a read verification operation on the written data after performing a write operation on the target terminal; a filling module, used to fill the terminal address and read flag of the target terminal into the first data of the first communication format corresponding to the read verification operation, wherein the first communication format includes multiple filling bits, at least one filling bit of the target terminal is reserved among the multiple filling bits, and the filling content in the at least one filling bit of the target terminal includes a comparison value, read data and a first verification value; a verification module, used to respond to the read verification operation, send the first data of the first communication format to the target terminal, obtain the second data of the first communication format fed back by the target terminal, identify the filling content of the target terminal in the second data, and verify the write operation according to the filling content of the target terminal.
[0007] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned communication data verification methods when executing the computer program.
[0008] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned communication data verification methods are implemented.
[0009] This application enables a read operation to be initiated immediately after a write operation is performed on the target terminal. This write-before-read design allows for immediate verification of whether the written communication data has been correctly received and processed after it has been sent. Furthermore, improvements are made to the communication verification format, allowing for seamless switching from a write operation to a read operation while maintaining communication continuity. This not only improves data transmission reliability but also optimizes the server's response speed and performance. This solves the problem of incomplete verification mechanisms during data transmission in related technologies, resulting in poor data transmission reliability and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. 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 any creative work.
[0011] Figure 1 A flow chart of a communication data verification method provided in an embodiment of the present application;
[0012] Figure 2 An example diagram of the communication format for a write operation provided in an embodiment of the present application;
[0013] Figure 3An example diagram of the communication format for a read operation provided in an embodiment of the present application;
[0014] Figure 4 A block diagram of a communication data verification device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0015] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0016] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such 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 elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0017] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0018] The embodiment of the present application provides a communication data verification method, and the method is described in detail in conjunction with the execution process of the communication data verification method. Figure 1 As shown, the following steps are included:
[0019] In step S101, after performing a write operation on a target terminal, a read verification operation on the written data is initiated.
[0020] Among them, the target terminal can be the CPLD end. The data interaction between the BMC and the CPLD in the server is mainly through the I2C protocol, and the I2C communication between the BMC and the CPLD is extremely frequent. In order to ensure the correctness of the data sent by the BMC to the CPLD and the accuracy of the data read from the CPLD, the I2C communication between the two needs to add a data verification mechanism. In order to solve the problem that the BMC cannot obtain whether the instruction is successfully issued, it is meaningless for the BMC to simply write data to the CPLD. Therefore, the embodiment of the present application can read back the data immediately after the BMC writes the data (i.e., the reading process). At this time, the BMC can know whether the instruction is successfully issued. In this way, the BMC can verify in real time whether the previously written data is correctly received and processed, thereby ensuring the accuracy and integrity of data transmission.
[0021] In one embodiment of the present application, a write operation is performed on a target terminal, including: obtaining a terminal address, a write flag, a register address, and target data of the target terminal; calculating a second check value based on the terminal address, the write flag, the register address, and the target data, and filling the terminal address, the register address, the write flag, the target data, and the second check value into third data of a second communication format corresponding to the write operation, wherein the second communication format includes multiple fill bits, and the fill contents of the multiple fill bits are the terminal address, the write flag, the register address, the target data, and the second check value; in response to the write operation on the target terminal, the third data of the second communication format is written into the target terminal.
[0022] Specifically, in related art, when the BMC writes data to the CPLD, only the checksum (PECByte) is sent. However, there is no guarantee that the CPLD will also verify the data sent by the BMC and compare it with the checksum value sent by the BMC. If the CPLD does not compare the checksum value, data communication errors may still cause the CPLD to execute incorrectly. Therefore, embodiments of the present application improve the I2C data communication checksum format. The second communication format used when the BMC writes data to the CPLD refers to a data structure or protocol format that must be followed before performing an I2C communication write operation. This format ensures that the transmitted data packet can be correctly parsed and processed. Specifically, the first communication format contains five padding bits, which are used to store different information in sequence. Specifically, the first padding bit is used to store the terminal address of the target terminal (also known as the I2C address or address). This is a unique identifier for each device on the I2C bus, ensuring that data is accurately sent to the designated CPLD. The second padding bit is used to store the write flag (Wr), which indicates that the current operation is a write operation, distinguishing it from a read operation. The third padding bit is used to store the register address (Command Code). This specifies the location of the target register to which the data will be written, which is crucial for the CPLD to know which internal storage area to update. The fourth padding bit is used to store the actual target data to be written (Data byte 1). This refers to the specific data that the BMC wants to pass to the CPLD. The fifth padding bit is used to store the second checksum (PEC Byte 2). This is the CRC8 (Cyclic Redundancy Check) checksum (PEC Byte 2) calculated based on the above information (Address, Wr, Command Code, and Data byte 1). It is primarily used to detect errors that may occur during transmission and ensure data integrity.
[0023] Specifically, the BMC first sends the target terminal's I2C address and the write flag. It then sends the register address, informing the CPLD of the destination where the data will be written. It then sends the actual communication data. Finally, it sends the second checksum (PEC Byte 2) calculated based on all of this information, allowing the CPLD to verify the data's integrity and accuracy. This not only ensures accurate data transmission but also improves communication reliability by introducing a checksum mechanism. Furthermore, because the entire process is an improvement on the standard data communication format, it effectively enhances the security and stability of I2C communication without significantly increasing complexity.
[0024] Immediately after sending the data, a subsequent read operation is performed to confirm whether the data has been correctly received and processed. In one embodiment of the present application, before initiating a read verification operation on the written data, the following steps are performed: after performing a write operation on the target terminal, identifying whether the target terminal has fed back a confirmation signal, wherein if the target terminal receives the first data in the first communication format, the confirmation signal is generated; if the confirmation signal is recognized, a read verification operation on the communication data is initiated.
[0025] It is understood that after the target terminal successfully receives the third data in the second communication format (i.e., a data packet containing the target terminal address, register address, write flag, target data, and the second checksum), it parses this information and calculates a CRC8 checksum to verify the data integrity. If the data is correct, the target terminal generates an acknowledgment signal (ACK signal). This acknowledgment signal is part of the I2C protocol and indicates that the CPLD has successfully received the data from the BMC. In actual implementation, the acknowledgment signal not only indicates the successful receipt of the data but may also contain additional information, such as whether the BMC requires further action or the type of data to be returned. However, in the embodiments of the present application, the acknowledgment signal is primarily used to inform the BMC that it can safely proceed to the next step, namely, to initiate a read request for the communication data. This ensures that the BMC can promptly monitor the execution status of its issued instructions. Using the acknowledgment signal as a trigger to initiate the read operation improves the reliability of the entire I2C communication process and the accuracy of data transmission. In actual implementation, if the acknowledgment signal is not recognized, a communication interruption prompt is generated.
[0026] In step S102, the terminal address and the read flag of the target terminal are filled into the first data of the first communication format corresponding to the read verification operation, wherein the first communication format includes a plurality of padding bits, at least one padding bit of the target terminal is reserved among the plurality of padding bits, and the padding content of the at least one padding bit of the target terminal includes a comparison value, the read data, and the first verification value;
[0027] The first communication format refers to a specific data structure or protocol format followed during I2C communication read verification operations. It ensures that the BMC can correctly request to read the required data from the target terminal CPLD. The first data of the first communication format contains two key padding bits: the sixth padding bit and the seventh padding bit. The sixth padding bit is used to store the terminal address (I2C address) of the target terminal. This is to clearly indicate the target terminal with which the BMC intends to communicate, ensuring that the data packet is accurately sent to the specified target terminal. The seventh padding bit is used to store the read flag bit (Rd), indicating that the current operation is a read operation.
[0028] Furthermore, the terminal address of the target terminal is filled into the sixth fill bit, and the read flag is filled into the seventh fill bit. After the filling is completed, the BMC will send the organized data to the target terminal according to the second communication format. Specifically, after performing the write operation and receiving the confirmation signal (ACK signal) from the target terminal, the BMC does not immediately end the communication, but instead performs a restart (Sr) operation. This operation allows the BMC to switch from write mode to read mode without releasing the bus, thereby maintaining the continuity of communication. After the restart operation, the BMC sends the I2C address of the target terminal again, and this time it is accompanied by the read flag (Rd), which makes it clear that the BMC's next action is to read data.
[0029] It should be noted that, under normal circumstances, a complete I2C communication includes a start signal (Start), data transmission, and an end signal (Stop). When a new communication is to be initiated, a start signal is sent, and after the data exchange is completed, an end signal is sent to release the bus. In an embodiment of the present application, it is necessary to perform multiple different types of operations in an uninterrupted communication sequence, such as first writing some commands or address information to a device and then immediately reading data from the same device. In this case, using the restart operation can avoid sending a stop signal (Stop), thereby maintaining the continuity of communication and saving time.
[0030] It is understood that the first communication format also includes padding bits reserved for the target terminal. The padding content includes a comparison value, read data, and a first checksum. After completing the write operation and initiating a read request, the BMC will receive a set of second data returned by the target terminal as a response result. This response data includes a comparison value (CRC8-check code), read data (Data byte 2), and a first checksum value (PEC Byte 1), which are collectively used to verify the success of the write operation. The first checksum is calculated based on the terminal address, read flag, target data, and comparison value.
[0031] The CRC8-check code field contains the result of the CPLD's CRC8 check on the previously received data, compared with the second checksum (PEC Byte 2) sent by the BMC. This field is used to determine whether any errors occurred during data transmission. If the CRC8-check code indicates that the two checksums are consistent, the data transmission is correct; otherwise, a transmission error may have occurred. The read data (Data byte 2) contains the data that the BMC actually wants to read. By comparing the read-back Data byte 2 with the originally written target data (Data byte 1), the success of the write operation can be further confirmed. The first verification value (PEC Byte 1) is recalculated based on the four parts: Address, Rd, CRC8-check code, and Data byte 2, and is used to ultimately verify the data integrity and accuracy throughout the communication process.
[0032] In step S103, in response to the read verification operation, the first data in the first communication format is sent to the target terminal, the second data in the first communication format fed back by the target terminal is obtained, the target terminal's filling content in the second data is identified, and the write operation is verified according to the filling content of the target terminal.
[0033] It is understood that after completing the write operation and initiating a read request, the BMC receives second data in the first communication format from the target terminal. This second data includes a comparison value (CRC8-check code), read data (Data byte 2), and a first checksum value (PEC byte 1), which are used together to verify the success of the write operation.
[0034] In one embodiment of the present application, a write operation is verified based on the fill content of the target terminal, including: if the comparison value is a first value and the read data and the target data are the same, the write operation is determined to be successful; if the comparison value is a second value, the data transmission is determined to be an error and the write operation has failed; if the comparison value is a third value, the register address in the third data of the second communication format is determined to be an error, and the write operation has failed.
[0035] Among them, the target terminal calculates the third verification value based on the terminal address, write flag, register address, and target data. The embodiment of the present application calculates the comparison value based on the second verification value and the third verification value calculated by the target terminal.
[0036] It is understandable that after receiving the I2C address, write flag, register address and target data, the target terminal CPLD also performs CRC8 calculation on these four parts to obtain the third check value, and then compares the calculation result with the PECByte2 issued by the BMC, and puts the comparison result into the comparison value (CRC8-check code). The CRC8-check code value is specified as follows:
[0037] If the return value is the first value (i.e., 8'h00), the third checksum calculated by the target terminal's CPLD matches the second checksum sent by the BMC, and the BMC successfully reads the target data, Data byte 1, from the target terminal. This indicates that there were no errors during the data transmission and the write operation was successful. This indicates that the target terminal not only correctly received the data but also processed or stored it as expected. In this case, the BMC can continue with other operations as needed or record the successful write event for future reference.
[0038] If the return value is the second value (i.e., 8'hAA): The third checksum calculated by the CPLD is different from the second checksum issued by the BMC, and the data transmission is considered to be an error and the write operation has failed.
[0039] If the return value is the third value (i.e., 8'hFF), the command byte sent by the BMC is determined to be incorrect. The sent value is not defined by the CPLD, so the write operation is determined to have failed.
[0040] It should be noted that if the write operation is determined to have failed, this situation may be caused by a variety of reasons, such as data transmission errors, internal failures of the target terminal, etc. The embodiment of the present application can record the cause and specific details of the failure to facilitate subsequent analysis and troubleshooting.
[0041] For example, suppose the BMC needs to write a new configuration parameter to the CPLD and confirm whether the parameter has been correctly received and applied. During the write phase, the BMC sends a data packet containing the new configuration parameters to the CPLD, along with a calculated second checksum (PEC Byte 2). During the confirmation phase, the CPLD successfully receives the data packet and returns a confirmation signal. Receiving the confirmation signal indicates that the data has been successfully received and preliminarily verified to be correct. During the read phase, the BMC performs a restart operation and sends a read request, then receives the CRC8-check code, Data Byte 2, and PEC Byte 1 returned by the CPLD. If all verification results are consistent, the write operation is confirmed to be successful; otherwise, the BMC records an error log and may trigger a retry mechanism. Therefore, this read-after-write approach improves the reliability and accuracy of data transmission.
[0042] In one embodiment of the present application, if the write operation fails, a re-write mechanism is triggered; and a re-write operation is performed on the target terminal based on the re-write mechanism.
[0043] Based on the above embodiment, before triggering a rewrite, the BMC first records the reason for the write failure and related information. This may include but is not limited to: the timestamp of the failure, the type of operation attempted (which register to write to), the content of the data sent, and the error code returned.
[0044] It is understandable that when the BMC determines that the write operation has failed based on the response received from the target terminal (for example, the CRC8-check code shows that the verification result is inconsistent or the expected data cannot be read), the embodiment of the present application will automatically trigger the rewrite mechanism and try to write to the register again. In the actual implementation process, in order to avoid the problem of resource exhaustion caused by infinite retry, the embodiment of the present application can preset a maximum number of retries (such as three). If all three attempts fail, the BMC abandons the operation on the register and operates on other registers until the next polling of the register and attempts to operate again.
[0045] In summary, the process and communication format of the BMC performing a write operation to the CPLD end in the embodiment of the present application are as follows: Figure 2 As shown in the figure, the BMC writes the I2C address (Address) and write flag (Wr) to the CPLD, then writes the CPLD register address (CommandCode) and the target data to be written (Data byte1), and then writes the second check value (PEC Byte2). The value of this check bit is the calculation result of the four parts of Address, Wr, Command Code and Data byte1; after the CPLD returns ACK, the BMC restarts (Sr), then writes the CPLD's I2C address (Address) and read flag (Rd), and then the CPLD returns data including three parts: CRC8-check code, Data byte2, PEC Byte1. After receiving PECByte1, the BMC returns NACK (N) to the CPLD, and then ends the communication.
[0046] In some embodiments, in order to ensure the correctness of data sent by the BMC to the CPLD and the accuracy of data read from the CPLD. Unlike the reading in the above embodiments to verify whether the writing is successful, the BMC can also simply read data from the CPLD. In this case, the communication data verification method also includes: obtaining the terminal address and register address of the communication data to be read; generating a fourth verification value based on the terminal address, register address and write flag, the fourth verification value is calculated based on the cyclic redundancy check algorithm for the terminal address, register address and write flag, wherein the target terminal verifies the fourth verification value, and if the target terminal passes the verification, the communication data to be read is identified; performing a read operation on the target terminal, wherein the target terminal returns the communication data to be read based on the read operation.
[0047] In this embodiment of the present application, the terminal address and register address have the same definitions as in the above embodiment. To ensure the security and integrity of data transmission, this embodiment still requires calculating a check value. Specifically, a cyclic redundancy check (CRC8) algorithm is used to calculate the terminal address, register address, and write flag to generate the check value. Specifically, the BMC sends a data packet containing its I2C address, write flag (Wr), register address (Commond Code), and a fourth check value (PEC Byte 4) to the target terminal. After receiving this information, the target terminal performs the same CRC8 check algorithm based on the received terminal address, register address, and write flag, and compares the calculation result with the fourth check value sent by the BMC. If the calculated check value matches the fourth check value sent by the BMC, the data transmission is correct. The target terminal can then identify and prepare to transmit the communication data to be read (Data Byte 3). The target terminal then returns the data in the designated register (Data Byte 3) to the BMC. A fifth checksum value (PEC Byte 5) is also appended. This value is recalculated based on the Address, Rd, CRC8-check code, and Data Byte 3 to further verify data integrity and accuracy. Upon receiving the data returned by the target terminal, the BMC also verifies the data to confirm its correctness. If the verification passes, the read operation is considered successful; otherwise, an error log is logged and appropriate remedial measures (such as a retry mechanism) are considered.
[0048] Therefore, the process and communication format of the BMC performing the read operation on the CPLD end in the embodiment of the present application are as follows: Figure 3As shown, first you need to write the I2C address (Address) and read / write flag (Wr) of the CPLD. After receiving the ACK signal from the CPLD, write the register address to be read (Commond Code). After receiving the ACK signal from the CPLD, you need to send the fourth check value (PEC Byte4). This fourth check value is a check value calculated based on the address, Wr, and Command Code. After receiving the ACK from the CPLD, perform the restart (Sr) operation, write the I2C address (Address) and read / write flag (Rd). After receiving the ACK from the CPLD, the data returned by the CPLD is immediately followed. This data consists of three parts:
[0049] 1. Comparison value (CRC8-check code): This byte stores the comparison result between the CRC8 calculation result of the data sent by the CPLD and the PEC Byte4 sent by the BMC;
[0050] 2. Data byte 3: This byte stores the communication data to be read by the BMC. This part can be a single byte or multiple bytes;
[0051] 3. PEC Byte5: This byte stores the verification result of the data reported by the CPLD. The value is the calculation result of the four parts of data: Address, Rd, CRC8-check code, and Data byte3.
[0052] After receiving PEC Byte 5, the BMC returns NACK (N) to the CPLD, ending the communication.
[0053] For example, assume that in a server environment, the BMC needs to read the status information of a specific register (for example, the current hardware temperature) from the CPLD. First, the BMC obtains the I2C address of the CPLD. Assume that the I2C address of the CPLD is 0x4E. It also needs to determine the specific register address from which the data is to be read. Assume that the target register address is 0x20, which is used to store the current hardware temperature data. Based on the terminal address (0x4E), the register address (0x20), and the write flag (Wr), the BMC uses the CRC8 algorithm to calculate a fourth checksum (PEC Byte 4). Assume that the calculated fourth checksum is 0x3F.
[0054] In the implementation, the BMC sends a data packet to the CPLD containing its I2C address (0x4E), write flag (Wr), register address (0x20), and fourth checksum (0x3F). Upon receiving the data packet from the BMC, the CPLD recalculates the CRC8 checksum based on the same terminal address (0x4E), register address (0x20), and write flag (Wr), and compares it with the fourth checksum (0x3F) sent by the BMC. If the two match, the data transmission is correct, and the CPLD identifies and prepares to transmit the target data to be read. If they do not match, the CPLD may return an error code or other form of feedback to the BMC. After confirming that the verification is successful, the BMC performs a restart and resends the CPLD's I2C address, this time with the read flag (Rd), clearly indicating that the next operation is a read request. Based on the previously written information, the CPLD begins preparing and returning the corresponding response data. Upon receiving the data returned by the CPLD, the BMC performs detailed analysis and verification. If the CRC8 checksum indicates a match, the read operation is considered successful. For example, if the Data byte 3 received by the BMC is 0x64 and all verification results are consistent, the read operation is confirmed to be successful and the current hardware temperature is 100 degrees Celsius.
[0055] In summary, the data interaction between the BMC and CPLD in the server is mainly through the I2C protocol, and the I2C communication between the BMC and CPLD is extremely frequent. In order to ensure the correctness of the data sent by the BMC to the CPLD and the accuracy of the data read from the CPLD, the I2C communication between the two needs to include a data verification mechanism. Using the data communication format and the CRC8 data verification value calculation method in the embodiment of the present application, without interrupting the I2C communication and increasing the complexity of the BMC work, it is ensured that the CPLD end verifies the data and returns the verification result to the BMC. When a communication abnormality occurs, the BMC end can record and re-operate. Among them, the CRC8 polynomial is:
[0056]
[0057] The communication data verification method of the embodiment of the present application is described in detail below with reference to specific examples:
[0058] 1. BMC reads data from CPLD
[0059] After writing the terminal address (I2C address), write flag, and register address of the CPLD, the BMC places the CRC8 calculation result of the three parts into PEC Byte 4 and sends it to the CPLD. The BMC then restarts, writes the I2C address and reads the flag, and waits for the CPLD to report data.
[0060] After receiving the I2C address, write flag, and register address, the CPLD also performs CRC8 calculation on these three parts, then compares the calculation result with the PEC Byte4 sent by the BMC, and uses the comparison result as the CRC8-check code. The CRC8-check code value is specified as follows:
[0061] If the return value is 8'h00: The verification result calculated by the CPLD is the same as the PEC Byte4 value sent by the BMC, and there is no error in the data transmission process;
[0062] If the return value is 8'hAA: The checksum calculated by the CPLD is different from the PEC Byte4 value sent by the BMC, and an error occurred during the data transmission process;
[0063] If the return value is 8'hFF: The command byte sent by the BMC is incorrect and the value sent is undefined by the CPLD.
[0064] The CPLD then returns Data byte 3: This part is the value stored in the CPLD register. When the command byte sent by the BMC is correct, regardless of whether the CRC8-check code is 8'h00 or 8'hAA (regardless of whether the check results are consistent), the CPLD will report the value of this register.
[0065] Finally, the CPLD places the CRC8 calculation result of the four parts (Address, Rd, CRC8-check code, and Data byte 3) in PEC Byte 5 and sends it back to the BMC.
[0066] 2. BMC writes and reads data:
[0067] After writing the I2C address, write flag, register address, and target data to the CPLD, the BMC places the CRC8 calculation results of the four parts into PEC Byte 2 and sends it to the CPLD. The BMC then restarts, writes the I2C address and read flag, and waits for the CPLD to report data.
[0068] After receiving the I2C address, write flag, register address, and register data, the CPLD also performs a CRC8 calculation on these four components. It then compares the calculation result with the PEC Byte 2 sent by the BMC and sets the comparison result as the CRC8-check code. The CRC8-check code value is the same as that used during data reading. The CPLD then returns the register value (Data Byte 2) operated by the BMC.
[0069] If the CPLD calculation result is the same as the PEC Byte 2 value sent by the BMC, the CPLD executes the data instruction sent by the BMC, and the readback data is the real-time updated data. If the CPLD calculation result is different from the PEC Byte 1 value sent by the BMC, the CPLD does not execute the data instruction sent by the BMC, and the readback data is not updated and is the data before the BMC writes the data.
[0070] Finally, the CPLD places the CRC8 calculation results of the four parts (Address, Rd, CRC8-check code, and Data byte 2) in PEC Byte 1 and sends it back to the BMC.
[0071] The BMC uses the CRC8-check code to determine whether the data is written successfully. If the data is written successfully, it continues to operate other registers. If the data is written unsuccessfully, it tries to send the data again (retry mechanism) and records the failure reason in the BMC log for easy analysis and positioning. The retry behavior is repeated three times. If all three times fail, the BMC abandons the operation on the register and operates on other registers until the next polling of the register and tries to operate again.
[0072] In summary, the communication data verification method of the embodiment of the present application immediately initiates a read operation after performing a write operation on the target terminal. Through the write-after-read design, it is possible to immediately check whether the written communication data has been correctly received and processed after the data is sent. The communication verification format is improved, and while maintaining communication continuity, it can seamlessly switch from a write operation to a read operation. This not only improves the reliability of data transmission, but also optimizes the response speed and performance of the server. This solves the problem of incomplete verification mechanisms during data transmission in related technologies, resulting in poor data transmission reliability and accuracy.
[0073] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0074] Secondly, the embodiment of the present application also provides a communication data verification device, such as Figure 4 As shown, the communication data verification device 10 includes: an initiating module 101 , a filling module 102 and a verification module 103 .
[0075] Among them, the initiating module 101 is used to initiate a read verification operation on the written data after performing a write operation on the target terminal; the filling module 102 is used to fill the terminal address and read flag of the target terminal into the first data of the first communication format corresponding to the read verification operation, wherein the first communication format includes multiple filling bits, at least one filling bit of the target terminal is reserved among the multiple filling bits, and the filling content in the at least one filling bit of the target terminal includes a comparison value, read data and a first verification value; the verification module 103 is used to respond to the read verification operation, send the first data of the first communication format to the target terminal, obtain the second data of the first communication format fed back by the target terminal, identify the filling content of the target terminal in the second data, and verify the write operation according to the filling content of the target terminal.
[0076] In one embodiment of the present application, the initiating module 101 is further used to obtain the terminal address, write flag, register address and target data of the target terminal; calculate a second check value based on the terminal address, write flag, register address and target data, and fill the terminal address, register address, target data and the second check value into the third data of the second communication format corresponding to the write operation, wherein the second communication format includes multiple fill bits, and the fill content of the multiple fill bits is the terminal address, write flag, register address and target data and the second check value; in response to the write operation to the target terminal, the third data of the second communication format is written to the target terminal.
[0077] In one embodiment of the present application, the communication data verification device 10 also includes: a confirmation module, which is used to identify whether the target terminal feeds back a confirmation signal after performing a write operation on the target terminal before initiating a read verification operation on the write data, wherein if the target terminal receives the third data in the second communication format, it generates a confirmation signal; if the confirmation signal is recognized, a read verification operation on the communication data is initiated.
[0078] In one embodiment of the present application, the communication data verification device 10 further includes: a prompt module, configured to generate a communication interruption prompt if the confirmation signal is not recognized.
[0079] In one embodiment of the present application, the target terminal calculates the comparison value and the first verification value in the following manner: the first verification value is calculated based on the terminal address, read flag, read data and comparison value; the third verification value is calculated based on the terminal address, write flag, register address and target data, and the comparison value is calculated based on the second verification value and the third verification value.
[0080] In one embodiment of the present application, the verification module 103 is further used to determine that the write operation is successful if the comparison value is a first value and the read data and the target data are the same; if the comparison value is a second value, it is determined that the data transmission is incorrect and the write operation has failed; if the comparison value is a third value, it is determined that the register address in the third data of the second communication format is incorrect and the write operation has failed.
[0081] In one embodiment of the present application, the communication data verification device 10 further includes: a re-execution module for triggering a re-write mechanism after determining that the write operation fails; and performing a re-write operation on the target terminal based on the re-write mechanism.
[0082] It should be noted that, for the description of the features in the embodiment corresponding to the communication data verification device, reference can be made to the relevant description of the embodiment corresponding to the communication data verification method, and no further details will be given here.
[0083] According to the communication data verification device of the embodiment of the present application, after performing a write operation on the target terminal, a read operation is immediately initiated. Through the write-after-read design, it is possible to immediately check whether the written communication data has been correctly received and processed after the data is sent. The communication verification format is improved, and while maintaining communication continuity, it can seamlessly switch from a write operation to a read operation. This not only improves the reliability of data transmission, but also optimizes the response speed and performance of the server. This solves the problem of incomplete verification mechanisms during data transmission in related technologies, resulting in poor data transmission reliability and accuracy.
[0084] An embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above-mentioned communication data verification method embodiments.
[0085] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above-mentioned communication data verification method embodiments when running.
[0086] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0087] 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 above description has generally described the components and steps of each example according to their functions. 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 beyond the scope of this application.
[0088] The above is a detailed introduction to a communication data verification method provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only intended to help understand the method and core ideas of the present application. It should be noted that, for those skilled in the art, without departing from the principles of the present application, several improvements and modifications may be made to the present application, and such improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A communication data verification method, characterized in that: include: After executing the write operation on the target terminal, initiate a read and verify operation on the written data; Filling the terminal address and read flag of the target terminal into first data in a first communication format corresponding to the read verification operation, wherein the first communication format includes a plurality of padding bits, at least one padding bit of the target terminal is reserved among the plurality of padding bits, and the padding content of the at least one padding bit of the target terminal includes a comparison value, read data, and a first verification value; In response to the read verification operation, sending the first data in the first communication format to the target terminal, obtaining the second data in the first communication format fed back by the target terminal, identifying the padding content of the target terminal in the second data, and verifying the write operation according to the padding content of the target terminal; The write operation performed on the target terminal includes: obtaining the terminal address, write flag, register address and target data of the target terminal; calculating a second check value based on the terminal address, the write flag, the register address and the target data, and filling the terminal address, the register address, the target data and the second check value into the third data of the second communication format corresponding to the write operation, wherein the second communication format includes multiple fill bits, and the fill content of the multiple fill bits is the terminal address, the write flag, the register address, the target data and the second check value; in response to the write operation on the target terminal, writing the third data of the second communication format into the target terminal.
2. The communication data verification method according to claim 1, wherein: Before initiating a read verification operation on written data, including: After performing a write operation on the target terminal, identifying whether the target terminal feeds back a confirmation signal, wherein the target terminal generates the confirmation signal after receiving the third data in the second communication format; If the confirmation signal is recognized, a read verification operation of the communication data is initiated.
3. The communication data verification method according to claim 2, characterized in that: Before initiating a read verification operation on the written data, the following steps are also included: If the confirmation signal is not recognized, a communication interruption prompt is generated.
4. The communication data verification method according to claim 1, wherein: The target terminal calculates the comparison value and the first verification value in the following manner: Calculate a first check value according to the terminal address, the read flag, the read data and the comparison value; A third check value is calculated according to the terminal address, the write flag, the register address, and the target data, and a comparison value is calculated according to the second check value and the third check value.
5. The communication data verification method according to claim 4, characterized in that: The verifying the write operation according to the filling content of the target terminal includes: If the comparison value is a first value and the read data is identical to the target data, then it is determined that the write operation is successful; If the comparison value is a second value, it is determined that the data transmission is wrong and the write operation fails; If the comparison value is a third value, it is determined that the register address in the third data in the second communication format is incorrect, and it is determined that the write operation has failed.
6. The communication data verification method according to claim 5, characterized in that: After determining that the write operation fails, the method further includes: If the write operation fails, a re-write mechanism is triggered; A rewriting operation is performed on the target terminal based on the rewriting mechanism.
7. A communication data verification device, characterized in that: include: An initiating module, configured to initiate a read and verify operation on the written data after executing a write operation on the target terminal; a padding module, configured to pad the terminal address and read flag of the target terminal into first data in a first communication format corresponding to the read verification operation, wherein the first communication format includes a plurality of padding bits, at least one padding bit of the target terminal is reserved among the plurality of padding bits, and the padding content of the at least one padding bit of the target terminal includes a comparison value, read data, and a first verification value; a verification module, configured to, in response to the read verification operation, send the first data in the first communication format to the target terminal, obtain second data in the first communication format fed back by the target terminal, identify padding content of the target terminal in the second data, and verify the write operation based on the padding content of the target terminal; The initiating module is further used to obtain the terminal address, write flag, register address and target data of the target terminal; calculate a second check value based on the terminal address, the write flag, the register address and the target data, and fill the terminal address, the register address, the target data and the second check value into the third data of the second communication format corresponding to the write operation, wherein the second communication format includes multiple fill bits, and the fill content of the multiple fill bits is the terminal address, the write flag, the register address, the target data and the second check value; in response to the write operation to the target terminal, write the third data of the second communication format into the target terminal.
8. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the communication data verification method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the communication data verification method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Data transmission method and device and electronic device
CN107872422A
Data access method, and flash memory apparatus
CN110383698A