Communication method and device based on multi-circuit board system, and medium
By introducing communication authentication and multiple baud rate adaptive matching mechanisms in multi-circuit board systems, the problems of poor adaptability and communication failure in the prior art are solved, and higher adaptability and communication reliability are achieved.
Patent Information
- Application Number
- CN202510118298.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-24
- Publication Date
- 2025-05-06
AI Technical Summary
The communication methods of existing multi-circuit board systems have poor adaptability and cannot automatically identify the baud rate of the new access device module, resulting in communication failure or data transmission errors.
Through communication authentication and multiple baud rate adaptive matching mechanism, baud rate negotiation is performed using handshake protocol. If it fails, switch to the test method or bit interval analysis method, calculate the baud rate prediction value of the device module, and verify the communication status through the test data.
It improves the adaptability and communication reliability of multi-circuit board systems, automatically recognizes and matches the baud rate of device modules, reduces communication failures and data transmission errors, and improves the flexibility and robustness of the system.
Smart Images

Figure CN119945623A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a communication method, equipment and medium based on a multi-circuit board system. Background Art
[0002] A multi-circuit board system usually consists of a master control board and at least one slave circuit board, each of which is equipped with multiple device modules, such as sensors, actuators, controllers, etc. These device modules are connected to the master control board through a communication interface to achieve data transmission and collaborative work.
[0003] In a multi-circuit board system, different device modules may use different baud rates (i.e., the number of bits transmitted per second). The existing technology usually uses a fixed baud rate or a manually configured baud rate method to communicate between modules on multiple circuit boards. However, the fixed baud rate communication method cannot automatically identify the baud rate of the newly connected device module, which easily leads to communication failure or data transmission errors; the manually configured baud rate communication method is inefficient.
[0004] Therefore, the existing communication method based on the multi-circuit board system has the problems of poor adaptability and low communication efficiency. Summary of the invention
[0005] The purpose of the present invention is to provide a communication method, device and medium based on a multi-circuit board system, aiming to solve the existing technical problems.
[0006] To achieve the above object, the present invention provides a communication method based on a multi-circuit board system, wherein the multi-circuit board system includes a main control board and at least one slave circuit board, and the slave circuit board includes a plurality of device modules, and the communication method includes the following steps:
[0007] S100, authenticating the communication relationship between the main control board and each device module according to the communication authentication request;
[0008] S200, based on the handshake protocol, determine whether the main control board and the device module can switch to the same baud rate; if so, the two communicate normally, if not, execute S300 or S400;
[0009] S300, based on the preset baud rate list, determine whether the baud rate matching between the main control board and the device module is successful, if so, the two communicate normally, if not, execute S400;
[0010] S400, calculating the baud rate prediction value of the device module, and sending test data to verify whether the communication status between the main control board and the device module is normal. If so, the two communicate normally.
[0011] Optionally, S100 includes at least the following steps:
[0012] S110, the main control board sends a communication authentication request to the device module;
[0013] S120, the device module generates an original random number, signs the random number using a preset private key, and sends the signed random number and the original random number to the main control board;
[0014] S130, the main control board verifies the validity of the signature through the public key of the device module, and determines the legitimacy of the identity of the device module. If the signature is valid, the communication relationship between the main control board and the device module is legal.
[0015] Optionally, before each communication, the communication relationship between the main control board and the device module is re-authenticated.
[0016] Optionally, S200 includes at least the following steps:
[0017] S210, configuring the serial port to the first baud rate;
[0018] S220, the main control board sends a handshake request message to the device module through the serial port, where the handshake request message at least includes a unique identifier of the main control board and a handshake command code;
[0019] S230, the main control board waits for response information from the device module, where the response information at least includes a unique identifier of the device module and a currently used baud rate;
[0020] S240, the main control board configures the serial port to the same baud rate as the device module according to the response information;
[0021] S250, the main control board sends a handshake request message to the device module through the serial port again to determine whether the device module can correctly parse and respond. If so, the main control board and the device module have switched to the same baud rate and the two communicate normally. If not, execute S300 or S400.
[0022] Optionally, S300 includes at least the following steps:
[0023] S310, selecting a preset baud rate from the preset baud rate list, and configuring the serial port to the selected baud rate;
[0024] S320, the main control board sends a group of known data frames to the device module and waits for response information;
[0025] S330, judging whether the response information is correct, if so, the baud rates of the main control board and the device module are matched successfully, and the two communicate normally; if not, selecting another preset baud rate from the preset baud rate list, and reconfiguring the serial port to the selected baud rate, and repeating S320 and S330;
[0026] If all preset baud rates have been tested and the response information is still incorrect, S400 is executed.
[0027] Optionally, S400 includes at least the following steps:
[0028] S410, configuring the serial port to the second baud rate, and enabling the low-level read mode of the serial port;
[0029] S420, obtaining the original bit stream or synchronization byte sent by the device module, and recording the arrival time of each original bit stream or synchronization byte;
[0030] S430, calculating a baud rate prediction value of the device module according to the original bit stream or the synchronization byte;
[0031] S440, configuring the serial port to the baud rate prediction value, and sending test data to verify whether the communication status between the main control board and the device module is normal. If so, the two communicate normally.
[0032] Optionally, calculating the baud rate prediction value of the device module according to the original bit stream includes at least the following steps:
[0033] Calculate the interval time between adjacent bits, and calculate the average value of multiple interval times, and use the average value as the bit interval time;
[0034] The baud rate prediction value of the device module is calculated according to the preset formula and the bit interval time.
[0035] Optionally, the baud rate prediction value of the device module is calculated based on the synchronization byte, specifically: the baud rate prediction value of the device module is calculated based on the width and arrival time interval of the synchronization byte.
[0036] Corresponding to the communication method based on a multi-circuit board system, the present invention provides a communication device based on a multi-circuit board system, including a processor, a memory, and a computer program stored in the memory, wherein the computer program is executed by the processor to implement the communication method based on a multi-circuit board system as described above.
[0037] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable medium, on which a communication program based on a multi-circuit board system is stored. When the communication program based on the multi-circuit board system is executed by a processor, the steps of the communication method based on the multi-circuit board system as described above are implemented.
[0038] The beneficial effects of the present invention are:
[0039] (1) Compared with the prior art, the present invention uses communication authentication and a multiple baud rate adaptive matching mechanism to first try to use a handshake protocol for baud rate negotiation. If the handshake fails, it switches to a trial method or a bit interval analysis method for further detection, which can improve the accuracy and efficiency of identification; it solves the problem of communication failure and low efficiency caused by fixed baud rate or manual baud rate configuration in the prior art, can automatically identify and match the baud rate of the device module, and improves the adaptability and communication reliability of the multi-circuit board system;
[0040] (2) Compared with the prior art, the present invention ensures the legitimacy of the identities of both parties in communication through the authentication mechanism between the main control board and the device module; it also uses digital signatures and public key verification to enhance the security of communication, prevent illegal device access and data tampering, and provide security for subsequent communication processes;
[0041] (3) Compared with the prior art, the present invention ensures the continuous security of the communication process through a mechanism of re-authentication before each communication; it can timely detect and prevent the access of illegal devices, further improving the security and reliability of the multi-circuit board system;
[0042] (4) Compared with the prior art, the present invention realizes baud rate negotiation between the main control board and the device module through a handshake protocol. By dynamically adjusting the baud rate, it ensures that both parties can switch to the same baud rate for communication, solves the communication failure problem caused by the fixed baud rate in the prior art, improves the adaptability and communication efficiency of the multi-circuit board system, and reduces data transmission errors caused by baud rate mismatch;
[0043] (5) Compared with the prior art, the present invention can automatically identify the baud rate of the device module by trying the preset baud rate one by one and verifying the communication status, thereby solving the problem of low efficiency of manually configuring the baud rate in the prior art, improving the adaptability and flexibility of the multi-circuit board system, and is particularly suitable for the access and dynamic configuration scenarios of new device modules;
[0044] (6) Compared with the prior art, the present invention further optimizes the baud rate matching process by calculating the baud rate prediction value and verifying the communication status; it can more accurately predict the baud rate of the device module, improve the accuracy and efficiency of baud rate matching, provide a backup plan when the preset baud rate list cannot match, and further enhance the adaptability and robustness of the multi-circuit board system;
[0045] (7) Compared with the prior art, the communication device provided by the present invention can automatically identify and match the baud rate of the device module, thereby improving the adaptability and communication efficiency of the multi-circuit board system, while reducing the workload of manual configuration and improving the user experience.
[0046] These and other aspects of the present application will be more concise and understandable in the following description of the embodiments. It should be understood that the above general description and the following detailed description are only exemplary and explanatory and cannot limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the embodiments of the present invention 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 in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying creative work.
[0048] In the figure:
[0049] Figure 1 It is a flow chart of an embodiment of a communication method based on a multi-circuit board system of the present invention;
[0050] Figure 2 It is a flow chart of an embodiment of the present invention that realizes normal communication between the main control board and the device module based on the handshake protocol;
[0051] Figure 3 It is a flow chart of an embodiment of the present invention that realizes normal communication between the main control board and the device module based on the preset baud rate list;
[0052] Figure 4 The present invention is a flow chart of an embodiment of realizing normal communication between a main control board and a device module based on a baud rate prediction value. DETAILED DESCRIPTION
[0053] Below, the present application is further described in conjunction with the accompanying drawings and specific implementation methods. It should be noted that, under the premise of no conflict, the various embodiments or technical features described below can be arbitrarily combined to form a new embodiment.
[0054] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the embodiments of the present invention are further described in detail below in combination with specific embodiments and with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0055] It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are intended to distinguish two non-identical entities or non-identical parameters with the same name. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on the embodiments of the present invention. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, other steps or units inherent to a process, method, device, product or medium that includes a series of steps or units.
[0056] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0057] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0058] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0059] See also Figure 1 As shown, an embodiment of the present invention provides a communication method based on a multi-circuit board system, the multi-circuit board system includes a main control board and at least one slave circuit board, and the slave circuit board includes multiple device modules, and the communication method includes at least the following steps:
[0060] S100, authenticating the communication relationship between the main control board and each device module according to the communication authentication request;
[0061] S200, based on the handshake protocol, determine whether the main control board and the device module can switch to the same baud rate; if so, the two communicate normally, if not, execute S300 or S400;
[0062] S300, based on the preset baud rate list, determine whether the baud rate matching between the main control board and the device module is successful, if so, the two communicate normally, if not, execute S400;
[0063] S400, calculating the baud rate prediction value of the device module, and sending test data to verify whether the communication status between the main control board and the device module is normal. If so, the two communicate normally.
[0064] The present invention uses communication authentication and a variety of baud rate adaptive matching mechanisms, first attempts to use a handshake protocol to negotiate the baud rate, and if the handshake fails, switches to a trial method or a bit interval analysis method for further detection, which can improve the accuracy and efficiency of recognition; solves the problems of communication failure and low efficiency caused by fixed baud rates or manually configured baud rates in the prior art, can automatically identify and match the baud rates of device modules, and improves the adaptability and communication reliability of the multi-circuit board system.
[0065] Preferably, each device module is provided with a unique identifier (UID) when it leaves the factory, which is used to distinguish different modules. The UID can be a hardware ID or a unique number generated by software, ensuring that each module is unique globally. In addition, a registration table is preset on the main control board to record all connected device modules and related information, and the related information includes at least one or more of the UID, model, version number, and communication protocol of the device module.
[0066] In this embodiment, each time the main control board is started, it automatically scans all device modules and updates their related information into the registration table.
[0067] In this embodiment, S100 includes at least the following steps:
[0068] S110, the main control board sends a communication authentication request to the device module;
[0069] S120, the device module generates an original random number, signs the random number using a preset private key, and sends the signed random number and the original random number to the main control board;
[0070] S130, the main control board verifies the validity of the signature through the public key of the device module, and determines the legitimacy of the identity of the device module. If the signature is valid, the communication relationship between the main control board and the device module is legal.
[0071] The present invention ensures the legitimacy of the identities of both communicating parties through the authentication mechanism between the main control board and the device module; it also uses digital signatures and public key verification to enhance the security of communications, prevent illegal device access and data tampering, and provide security for subsequent communication processes.
[0072] In this embodiment, before each communication, the communication relationship between the main control board and the device module is re-authenticated.
[0073] The present invention ensures the continuous security of the communication process through a mechanism of re-authentication before each communication; it can timely detect and prevent the access of illegal devices, and further improves the security and reliability of the multi-circuit board system.
[0074] like Figure 2 As shown, in this embodiment, S200 at least includes the following steps:
[0075] S210, configuring the serial port to the first baud rate;
[0076] S220, the main control board sends a handshake request message to the device module through the serial port, where the handshake request message at least includes a unique identifier of the main control board and a handshake command code;
[0077] S230, the main control board waits for response information from the device module, where the response information at least includes a unique identifier of the device module and a currently used baud rate;
[0078] S240, the main control board configures the serial port to the same baud rate as the device module according to the response information;
[0079] S250, the main control board sends a handshake request message to the device module through the serial port again to determine whether the device module can correctly parse and respond. If so, the main control board and the device module have switched to the same baud rate and the two communicate normally. If not, execute S300 or S400.
[0080] Preferably, the first baud rate is 9600 baud / second.
[0081] The present invention realizes baud rate negotiation between the main control board and the device module through a handshake protocol, and ensures that both parties can switch to the same baud rate for communication by dynamically adjusting the baud rate, thereby solving the communication failure problem caused by fixed baud rate in the prior art, improving the adaptability and communication efficiency of the multi-circuit board system, and reducing data transmission errors caused by baud rate mismatch.
[0082] like Figure 3 As shown, in this embodiment, S300 at least includes the following steps:
[0083] S310, selecting a preset baud rate from the preset baud rate list, and configuring the serial port to the selected baud rate;
[0084] S320, the main control board sends a group of known data frames to the device module and waits for response information;
[0085] S330, judging whether the response information is correct, if so, the baud rates of the main control board and the device module are matched successfully, and the two communicate normally; if not, selecting another preset baud rate from the preset baud rate list, and reconfiguring the serial port to the selected baud rate, and repeating S320 and S330;
[0086] If all preset baud rates have been tested and the response information is still incorrect, S400 is executed.
[0087] Preferably, the preset baud rate list stores a plurality of preset baud rates, specifically common baud rates, such as two or more of 9600, 19200, 38400, 57600, and 115200 baud / second. The known data frame is an ASCII character or a preset check sequence.
[0088] The present invention can automatically identify the baud rate of a device module by trying to preset baud rates one by one and verifying the communication status, thereby solving the problem of low efficiency in manually configuring the baud rate in the prior art, improving the adaptability and flexibility of a multi-circuit board system, and is particularly suitable for access and dynamic configuration scenarios of new device modules.
[0089] like Figure 4 As shown, in this embodiment, S400 at least includes the following steps:
[0090] S410, configuring the serial port to the second baud rate, and enabling the low-level read mode of the serial port;
[0091] S420, obtaining the original bit stream or synchronization byte sent by the device module, and recording the arrival time of each original bit stream or synchronization byte;
[0092] S430, calculating a baud rate prediction value of the device module according to the original bit stream or the synchronization byte;
[0093] S440, configuring the serial port to the baud rate prediction value, and sending test data to verify whether the communication status between the main control board and the device module is normal. If so, the two communicate normally.
[0094] Preferably, the second baud rate is 115200 baud / second. The synchronization byte, such as 0xAA or 0x55, is used to identify the starting position of the data frame. The baud rate of the device module can be calculated by detecting the frequency of occurrence of the synchronization byte. Since the width of the synchronization byte is fixed, the baud rate can be calculated based on the time interval of the received synchronization bytes.
[0095] It should be noted that turning on the low-level read mode of the serial port in S410 means: directly accessing and controlling the underlying hardware characteristics of the serial communication interface so that each bit of the received signal can be accurately captured and processed. This method is different from the commonly used high-level abstract API (such as standard library functions). The low-level read mode allows developers to control the data reception process more finely and obtain the original, unprocessed signal information. Signal acquisition in this mode bypasses the standard serial port communication library provided by the operating system or programming language and interacts directly with the serial port hardware. Through this mode, the voltage level on the serial data line can be sampled with very high precision, which is implemented by polling or interrupt drive or direct memory access. The three different implementation methods are as follows:
[0096] a. Polling: Continuously checking the status of the serial data line (high or low), which requires a precise time base to ensure timely sampling;
[0097] b. Interrupt drive: Set up hardware interrupts and trigger an interrupt service routine (ISR) every time a state change is detected on the data line;
[0098] c.DMA (Direct Memory Access): For some advanced MCUs, a DMA channel can be used to transfer serial data directly to memory without CPU intervention.
[0099] In this embodiment, calculating the baud rate prediction value of the device module according to the original bit stream includes at least the following steps:
[0100] Calculate the interval time between adjacent bits, and calculate the average value of multiple interval times, and use the average value as the bit interval time;
[0101] The baud rate prediction value of the device module is calculated according to a preset formula and the bit interval time; wherein the preset formula is specifically: baud rate = 1 / bit interval time.
[0102] In this embodiment, the baud rate prediction value of the device module is calculated according to the synchronization byte, specifically: the baud rate prediction value of the device module is calculated according to the width and arrival time interval of the synchronization byte.
[0103] It should be noted that the width of the synchronization byte describes the length of time each synchronization byte (or frame) occupies, and the arrival time interval describes the interval between consecutive synchronization bytes.
[0104] The baud rate is calculated as follows: Baud rate = total number of bits / time (seconds), where "total number of bits" refers to the number of bits sent in a complete transmission cycle, and "time" refers to the time required to complete this transmission cycle. For example, if a synchronization byte consists of 10 bits (assuming it includes 1 start bit, 8 data bits, and 1 stop bit), and the time interval between two consecutive synchronization bytes is 1 millisecond (i.e. 0.001 seconds).
[0105] Based on the width and arrival time interval of the synchronization byte, the baud rate prediction value of the device module is calculated; the baud rate can be calculated as follows: 10 / 0.001=10000 baud / second.
[0106] The present invention further optimizes the baud rate matching process by calculating the baud rate prediction value and verifying the communication status; the baud rate of the device module can be predicted more accurately, the accuracy and efficiency of baud rate matching are improved, a backup plan is provided when the preset baud rate list cannot be matched, and the adaptability and robustness of the multi-circuit board system are further enhanced.
[0107] Furthermore, the communication method based on a multi-circuit board system described in the present invention also includes: the main control board monitors in real time whether the communication is interrupted, and if so, automatically attempts to re-establish the connection and restores the unfinished task according to the status of the last communication.
[0108] Preferably, the communication method based on the multi-circuit board system of the present invention further includes:
[0109] The main control board monitors the quality of the communication link in real time, and the quality of the communication link includes at least the signal strength and bit error rate indicators;
[0110] According to the monitoring results, it is determined whether the communication parameters need to be adjusted; if so, the main control board dynamically adjusts the communication parameters according to preset rules or user-defined rules, and the communication parameters at least include the communication rate and error checking method;
[0111] After the adjustment is completed, the main control board notifies the device module to update the communication parameters;
[0112] Once the device module confirms that the update is successful, the two continue to communicate normally.
[0113] In addition, the communication method based on the multi-circuit board system of the present invention further includes:
[0114] The main control board regularly performs health checks on each device module and records the operating status and abnormal information. If a fault is detected, the main control board immediately triggers an alarm and records detailed information in the log.
[0115] For faults, the main control board attempts to automatically repair the recorded faults; if the automatic repair fails, it will prompt the user with fault repair guidance suggestions to help the user perform manual maintenance;
[0116] The main control board continuously monitors the system's operating status to ensure system stability and reliability.
[0117] The present invention also provides a communication device based on a multi-circuit board system, comprising a processor, a memory and a computer program stored in the memory, wherein the computer program is executed by the processor to implement the communication method based on the multi-circuit board system as described above.
[0118] The communication device provided by the present invention can automatically identify and match the baud rate of the device module, thereby improving the adaptability and communication efficiency of the multi-circuit board system, while reducing the workload of manual configuration and improving the user experience.
[0119] The embodiment of the present invention further provides a computer-readable medium, which may be a computer-readable medium included in the memory in the above embodiment; or a computer-readable medium that exists independently and is not assembled into a medium. The computer-readable medium stores at least one instruction, which is loaded and executed by a processor to implement Figure 1 The communication method based on the multi-circuit board system is shown. The computer readable medium can be a read-only memory, a magnetic disk or an optical disk, etc.
[0120] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the device embodiment and the medium embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0121] Furthermore, in this document, the terms "comprises," "comprising," or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or medium that includes a list of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or medium. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or medium that includes the element.
[0122] The above description shows and describes the preferred embodiments of the present invention. It should be understood that the present invention is not limited to the form disclosed herein, and should not be regarded as excluding other embodiments, but can be used in various other combinations, modifications and environments, and can be modified within the scope of the invention, through the above teachings or the technology or knowledge of the relevant field. The changes and modifications made by those skilled in the art shall not depart from the spirit and scope of the present invention, and shall be within the scope of protection of the claims attached to the present invention.
Claims
1. A communication method based on a multi-circuit board system, the multi-circuit board system includes a main control board and at least one slave circuit board, and the slave circuit board includes a plurality of device modules, characterized in that: The communication method comprises at least the following steps: S100, authenticating the communication relationship between the main control board and each device module according to the communication authentication request; S200, based on the handshake protocol, determine whether the main control board and the device module can switch to the same baud rate; if so, the two communicate normally, if not, execute S300 or S400; S300, based on the preset baud rate list, determine whether the baud rate matching between the main control board and the device module is successful, if so, the two communicate normally, if not, execute S400; S400, calculating the baud rate prediction value of the device module, and sending test data to verify whether the communication status between the main control board and the device module is normal. If so, the two communicate normally.
2. The communication method based on a multi-circuit board system according to claim 1, characterized in that: S100 at least includes the following steps: S110, the main control board sends a communication authentication request to the device module; S120, the device module generates an original random number, signs the random number using a preset private key, and sends the signed random number and the original random number to the main control board; S130, the main control board verifies the validity of the signature through the public key of the device module, and determines the legitimacy of the identity of the device module. If the signature is valid, the communication relationship between the main control board and the device module is legal.
3. The communication method based on a multi-circuit board system according to claim 1, characterized in that: Before each communication, the communication relationship between the main control board and the device module is re-authenticated.
4. The communication method based on a multi-circuit board system according to claim 1, characterized in that: S200 at least includes the following steps: S210, configuring the serial port to the first baud rate; S220, the main control board sends a handshake request message to the device module through the serial port, where the handshake request message at least includes a unique identifier of the main control board and a handshake command code; S230, the main control board waits for response information from the device module, where the response information at least includes a unique identifier of the device module and a currently used baud rate; S240, the main control board configures the serial port to the same baud rate as the device module according to the response information; S250, the main control board sends a handshake request message to the device module through the serial port again to determine whether the device module can correctly parse and respond. If so, the main control board and the device module have switched to the same baud rate and the two communicate normally. If not, execute S300 or S400.
5. The communication method based on a multi-circuit board system according to claim 1, characterized in that: S300 at least includes the following steps: S310, selecting a preset baud rate from the preset baud rate list, and configuring the serial port to the selected baud rate; S320, the main control board sends a group of known data frames to the device module and waits for response information; S330, judging whether the response information is correct, if so, the baud rates of the main control board and the device module are matched successfully, and the two communicate normally; if not, selecting another preset baud rate from the preset baud rate list, and reconfiguring the serial port to the selected baud rate, and repeating S320 and S330; If all preset baud rates have been tested and the response information is still incorrect, S400 is executed.
6. The communication method based on a multi-circuit board system according to claim 1, characterized in that: S400 at least includes the following steps: S410, configuring the serial port to the second baud rate, and enabling the low-level read mode of the serial port; S420, obtaining the original bit stream or synchronization byte sent by the device module, and recording the arrival time of each original bit stream or synchronization byte; S430, calculating a baud rate prediction value of the device module according to the original bit stream or the synchronization byte; S440, configuring the serial port to the baud rate prediction value, and sending test data to verify whether the communication status between the main control board and the device module is normal. If so, the two communicate normally.
7. The communication method based on a multi-circuit board system according to claim 6, characterized in that: Calculating a baud rate prediction value of a device module according to an original bit stream includes at least the following steps: Calculate the interval time between adjacent bits, and calculate the average value of multiple interval times, and use the average value as the bit interval time; The baud rate prediction value of the device module is calculated based on the preset formula and the bit interval time.
8. The communication method based on a multi-circuit board system according to claim 6, characterized in that: The baud rate prediction value of the device module is calculated according to the synchronization byte, specifically: the baud rate prediction value of the device module is calculated according to the width and arrival time interval of the synchronization byte.
9. A communication device based on a multi-circuit board system, characterized in that: The system comprises a processor, a memory and a computer program stored in the memory, wherein the computer program is executed by the processor to implement the communication method based on a multi-circuit board system as claimed in any one of claims 1 to 8.
10. A computer-readable medium, characterized in that The computer-readable medium stores a communication program based on a multi-circuit board system, and when the communication program based on a multi-circuit board system is executed by a processor, the steps of the communication method based on a multi-circuit board system as described in any one of claims 1 to 8 are implemented.
Citation Information
Cited By
Communication method for inverter firmware upgrade and electronic equipment
CN121418462A