Method, apparatus and device for baud rate adaptation

By acquiring and matching the level characteristics of serial port data and externally verifying the baud rate, the problem of poor applicability of existing baud rate adaptation methods is solved, and fast, accurate and low-memory baud rate adaptation is achieved.

CN117312871BActive Publication Date: 2026-05-29深圳市英维克软件技术有限公司

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
深圳市英维克软件技术有限公司
Filing Date
2023-09-22
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing baud rate adaptive methods have poor applicability, are time-consuming and labor-intensive, and are difficult to adjust accurately, especially in embedded communication devices with high memory requirements, making it impossible to quickly determine the other party's baud rate.

Method used

By acquiring the level characteristics of serial port data, a level characteristic set is obtained and matched with the comparison level characteristics. The baud rate to be verified is externally verified, and the target baud rate is determined. This avoids the need to understand the limitations of serial port data structure and format, and reduces memory requirements.

Benefits of technology

It achieves fast and accurate baud rate adaptation, is highly adaptable, has low memory requirements, is suitable for embedded communication devices, and reduces external verification time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117312871B_ABST
    Figure CN117312871B_ABST
Patent Text Reader

Abstract

The application provides a baud rate self-adapting method, device and equipment. In the baud rate self-adapting method applied to a first communication unit, a level feature set corresponding to serial port data is obtained by collecting the level features of the serial port data sent by a second communication unit, and then the level feature set of the serial port data is matched with comparative level features. The baud rate corresponding to the comparative level features matched with the level feature set is determined as a to-be-verified baud rate, and the to-be-verified baud rate is externally verified to determine a target baud rate used for communication with the second communication unit. The baud rate self-adapting method provided by the application has strong adaptability, low memory requirement for the first communication unit, and can quickly and accurately determine the target baud rate used for communication with the second communication unit.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and in particular to a baud rate adaptive method, apparatus, and device. Background Technology

[0002] Serial communication is widely used in industries such as manufacturing, healthcare, consumer electronics, and aerospace, where long-distance communication is required. For serial communication to function correctly, both devices must have the same baud rate. Therefore, when data is transmitted between devices, the baud rate of at least one of the two devices must be configured before they can communicate. The traditional method for configuring the baud rate is to try different baud rates one by one. However, this is time-consuming and laborious, as it's difficult to accurately determine the other device's baud rate within a limited number of attempts. Furthermore, if one device's baud rate changes, the other device needs to be readjusted, resulting in poor versatility and flexibility of serial communication devices. Therefore, baud rate adaptive communication technology has emerged.

[0003] One existing baud rate adaptive method requires support from a fixed protocol between the communicating parties and knowledge of the data structure sent by the other party's communication device to calculate the corresponding baud rate, resulting in poor applicability. A second existing method requires a large amount of memory on the receiving end communication device to store a large number of training samples, using adaptive conduction training to adaptively adjust the baud rate. This is unsuitable for most embedded communication devices and also suffers from poor applicability. A third existing method calculates the baud rate based on the minimum level pulse width of the serial port data at the receiving end. However, the minimum level pulse width is not necessarily a normal bit pulse width; therefore, this method cannot accurately adaptively adjust the baud rate. Summary of the Invention

[0004] To address existing technical problems, a baud rate adaptive method, baud rate adaptive device, and communication equipment are provided, which are highly adaptable, have low memory requirements, and can quickly and accurately achieve baud rate adaptive adjustment.

[0005] According to a first aspect of the embodiments of this application, a baud rate adaptive method is provided, applied to a first communication unit, comprising:

[0006] Level characteristics are acquired from the serial port data sent by the second communication unit to obtain the level characteristic set of the serial port data;

[0007] The baud rate to be verified is obtained by matching the set of level features with the comparison level features.

[0008] Test data is sent to the second communication unit at the baud rate to be verified to determine whether the baud rate to be verified passes external verification.

[0009] If the baud rate to be verified passes the external verification, the baud rate to be verified is determined as the target baud rate for transmitting data to the second communication unit.

[0010] According to a second aspect of the embodiments of this application, a baud rate adaptive device is provided, applied to a first communication unit, comprising:

[0011] The feature acquisition module is used to acquire the level features of the serial port data sent by the second communication unit to obtain the level feature set of the serial port data.

[0012] The feature matching module is used to match the set of level features with the comparison level features to obtain the baud rate to be verified;

[0013] An external verification module is used to send test data to the second communication unit at the baud rate to be verified, and to determine whether the baud rate to be verified passes external verification.

[0014] The determination module is configured to determine the baud rate to be verified as the target baud rate for transmitting data to the second communication unit after the external verification has been passed.

[0015] According to a third aspect of the embodiments of this application, a communication device is provided, comprising:

[0016] Memory, used to store programs;

[0017] A processor for implementing the baud rate adaptive method by executing a program stored in the memory.

[0018] As can be seen from the above, in the baud rate adaptive method applied to the first communication unit provided in this application embodiment, the level characteristics of the serial port data sent by the second communication unit are collected to obtain the level characteristic set corresponding to the serial port data. Then, the level characteristic set corresponding to the serial port data is matched with the comparison level characteristics. The baud rate corresponding to the comparison level characteristics that match the level characteristic set is used as the baud rate to be verified. External verification is performed on the baud rate to be verified to determine the final target baud rate used for communication with the second communication unit. Therefore, when determining the target baud rate, the baud rate adaptive method provided in this application embodiment only needs to obtain the level characteristics of each level in the serial port data. It does not need to know which one or more of the start bit, data bit, and stop bit are included in each level in the serial port data. That is, it does not need to know the data structure of the serial port data in advance, and it is not dependent on or limited by the content or format of the serial port data, thus having strong adaptability. In addition, the baud rate adaptive method provided in this application embodiment does not need to store a large number of training samples to obtain the target baud rate in a training-based manner, thus having low memory requirements for the first communication unit. Furthermore, the baud rate adaptation method provided in this application embodiment only uses the baud rate corresponding to the comparison level feature that matches the level feature set as the baud rate to be verified for external verification. This can ensure the accuracy of the target baud rate without excessively increasing the external verification time, thus achieving fast and accurate baud rate adaptation. Attached Figure Description

[0019] Figure 1 This is a flowchart illustrating a baud rate adaptive method provided according to some embodiments of this application;

[0020] Figure 2 This is a flowchart illustrating a baud rate adaptive method provided according to some embodiments of this application;

[0021] Figure 3 This is a flowchart illustrating the process of obtaining a level feature set in a baud rate adaptive method provided according to some embodiments of this application;

[0022] Figure 4 This is a waveform diagram illustrating the acquisition of serial port data level change edges according to some embodiments of this application;

[0023] Figure 5 This is a flowchart illustrating a baud rate adaptive method provided according to some embodiments of this application;

[0024] Figure 6 This is a schematic diagram of the byte structure of serial data;

[0025] Figure 7 This is a flowchart illustrating a baud rate adaptive method provided according to some embodiments of this application;

[0026] Figure 8This is a schematic diagram of the baud rate adaptive device provided according to some embodiments of this application;

[0027] Figure 9 This is a schematic diagram of the structure of a communication device provided according to some embodiments of this application. Detailed Implementation

[0028] The technical solution of this application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0029] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein in the specification of this application is for the purpose of describing particular embodiments only and is not intended to limit the ways in which this application may be implemented. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.

[0030] In the description of this application, it should be understood that the terms "center," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, are used only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on this application. In the description of this application, unless otherwise stated, "a plurality of" means two or more.

[0031] In the description of this application, it should be noted that, unless otherwise expressly specified and limited, the terms "installation," "connection," and "joining" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal communication between two components. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.

[0032] Please see Figure 1The diagram shows a flowchart of a baud rate adaptive method provided according to some embodiments of this application. The baud rate adaptive method provided in some embodiments of this application is applied to a first communication unit to adaptively adjust the baud rate of the first communication unit when the first communication unit and the second communication unit communicate, so that the baud rate of the first communication unit matches the baud rate of the second communication unit. The first communication unit and the second communication unit can be two communication devices interacting with each other, such as a first communication device and a second communication device respectively, or two communication modules within a single device. Specifically, in some embodiments, the baud rate adaptive method provided in this application includes steps S01, S03, S05, and S07, each described below.

[0033] S01: Collect the level characteristics of the serial port data sent by the second communication unit to obtain the level characteristic set of the serial port data.

[0034] The serial port data sent by the second communication unit is received by the communication receiving port of the first communication unit. After the first communication unit receives the serial port data sent by the second communication unit, it performs level detection on the serial port data received by the communication receiving port to obtain the characteristics of each level in the serial port data, and constructs a level feature set from the characteristics of each level. In some embodiments, the level features include parameters characterizing the level change edge, parameters characterizing the level pulse width time, and / or parameters characterizing the level value.

[0035] S03: Match the level feature set with the comparison level features to obtain the baud rate to be verified.

[0036] Comparison level features refer to level features used to compare with a set of level features to determine the baud rate to be verified. Comparison level features can be preset level features or level features calculated based on assumptions. Matching the level feature set with the comparison level features specifically refers to comparing the level feature set with corresponding level features in the comparison level features to determine if there is a target comparison level feature that matches the level feature set. Specifically, in some embodiments, if the similarity or matching degree between the level feature corresponding to the level feature set and the comparison feature reaches a preset condition, it indicates that the comparison level feature currently being compared with the level feature set matches the level feature set, and the baud rate corresponding to the target comparison feature that matches the level feature set is taken as the baud rate to be verified. Comparison level features include level features compared with the level features of the start bit level and / or stop bit level of bytes in serial port data. Specifically, in some embodiments, the number of level features in the comparison level features is consistent with the number of level features to be compared in the level feature set. Each level feature in the level feature set is matched one by one with the corresponding level feature in the comparison level features. If the matching rate reaches a certain value, then the level feature set matches that level feature. The number of level features compared with the level feature set can be one or more.

[0037] In some embodiments, each time the level feature set is matched with a comparison level feature, as long as a comparison level feature is matched, the baud rate mapped to the matched comparison level feature is taken as the baud rate to be verified, and the matching in S03 is stopped, and the process proceeds to S05, meaning the number of baud rates to be verified is one. In other embodiments, the number of baud rates to be verified can be multiple, meaning that each time the level feature set is matched with a comparison level feature, multiple comparison level features can be matched, and the baud rates mapped to all of the matched comparison level features are taken as the baud rates to be verified, and then the process proceeds to S05.

[0038] S05: Send test data to the second communication unit at the baud rate to be verified, and determine whether the baud rate to be verified has passed external verification.

[0039] Test data is sent to the second communication unit multiple times at a baud rate to be verified. If no communication error signal is received from the second communication unit for the first preset number of consecutive tests, it indicates that the baud rate to be verified has passed external verification, meaning there is a baud rate to be verified that has passed external verification. If a communication error signal is received from the second communication unit for the second preset number of consecutive tests, it indicates that the baud rate to be verified has not passed external verification. If there are multiple baud rates to be verified, in step S05, test data is sent to the second communication unit at the baud rate to be verified. To determine whether there is a baud rate to be verified that has passed external verification, external verification is performed on each baud rate to be verified sequentially. That is, each external verification involves selecting one baud rate from multiple baud rates to be verified sequentially as the baud rate to send test data to the second communication unit, and determining whether the currently selected baud rate to be verified has passed external verification. If it has passed, external verification is stopped, and the baud rate to be verified that has passed external verification is used as the target baud rate. If it has not passed, the next baud rate to be verified is selected sequentially, and external verification is performed until a baud rate to be verified that has passed external verification is found.

[0040] S07: If the baud rate to be verified passes the external verification, the baud rate to be verified shall be determined as the target baud rate for transmitting data to the second communication unit.

[0041] After determining the target baud rate, the first communication unit sends the corresponding serial port data to the second communication unit at the target baud rate, that is, the first communication unit transmits data with the second communication unit at the target baud rate.

[0042] As can be seen from the above, the baud rate adaptive method provided in some embodiments of this application only needs to obtain the level characteristics of each level in the serial port data when determining the target baud rate. It does not require knowing which of the start bit, data bit, and stop bit(s) each level in the serial port data specifically includes. That is, it does not require prior knowledge of the data structure of the serial port data and is not dependent on or limited by the content or format of the serial port data, thus exhibiting strong adaptability. Furthermore, it has low memory requirements for the first communication unit because the baud rate adaptive method provided in the embodiments of this application does not require storing a large number of training samples to obtain the target baud rate in a training-based manner, resulting in low memory requirements for the first communication unit. In addition, the baud rate adaptive method provided in some embodiments of this application only uses the baud rate corresponding to the comparison level characteristics matched with the level feature set as the baud rate to be verified for external verification. This ensures the accuracy of the target baud rate without excessively increasing the external verification time, achieving fast and accurate baud rate adaptation.

[0043] Please see Figure 2The diagram shown is a flowchart of a baud rate adaptation method provided according to some embodiments of this application. In some embodiments, after S05, the baud rate adaptation method further includes S09: if the baud rate to be verified fails external verification, the comparison level characteristics are updated, and the process returns to execute S03.

[0044] If the judgment result in S05 is negative, the comparison level feature needs to be updated. Updating the comparison level feature includes updating the value of at least one level feature or updating the composition of the comparison level feature. For example, if the original comparison level feature consisted of the 1st to Nth level features, after updating the comparison level feature, the updated comparison level feature consists of the Mth to Nth level features from the 1st to Nth level features, where M is a number from 1 to N. In some embodiments, updating the comparison level feature further includes updating the independent variable of the comparison level feature, thereby ultimately updating the comparison level in S03. Changes in the independent variable of the comparison level feature cause corresponding changes in the comparison level feature. Therefore, updating the comparison level feature in S09 can directly update the composition or value of the comparison level feature itself, or it can be done by updating the independent variable of the comparison level feature to calculate the updated comparison level feature in S03 based on the updated independent variable. Different comparison level features correspond to different baud rates; that is, different level features matched with the level feature set correspond to different baud rates to be verified.

[0045] In the baud rate adaptive method provided according to some embodiments of this application, after obtaining the baud rate to be verified based on the matching of the level feature set and the comparison level feature, the baud rate to be verified is externally verified. If the external verification passes, the target baud rate is determined; if the external verification fails, the comparison level feature is updated, and the level feature set is matched with the updated comparison feature again to obtain a new baud rate to be verified. This process is repeated until a baud rate that passes external verification is found. Clearly, the baud rate adaptive method provided in some embodiments of this application iteratively updates the comparison level feature to match the level feature set with the comparison level feature, eliminating the need for a large memory of the first communication unit to store a large number of training samples, as required by the prior art described in the background section. Therefore, the baud rate adaptive method provided in some embodiments of this application can reduce the memory consumption of the first communication unit. Furthermore, in the baud rate adaptive method provided according to some embodiments of this application, the final target baud rate is determined by matching the baud rate to be verified based on cyclic iteration and then performing iterative external verification on the baud rate to be verified. This method has higher accuracy than the prior art described in the background art, which determines the target baud rate based solely on the minimum level pulse width.

[0046] Please see Figure 3The diagram shown illustrates the process of obtaining a level feature set in a baud rate adaptive method according to some embodiments of this application. In some embodiments, S01 further includes S011, S013, and S015, each step of which is described below.

[0047] S011: Acquire the level change edges of the serial port data to obtain the change edge count value corresponding to each level in the serial port data, forming the initial feature set of the serial port data.

[0048] Level transitions include rising and falling edges, and the level values ​​of each level in serial port data include high and low levels. The count value of each level transition in serial port data can be the number of counting pulses. Specifically, an independent counter can be used to count each level transition of the serial port data, which is beneficial for accurately obtaining the level feature set of the serial port data. A level in the serial port data, its corresponding level value, and its corresponding edge transition count value constitute a level feature in the initial feature set.

[0049] Please see Figure 4 As shown, this is a waveform diagram illustrating the acquisition of level transition edges of serial port data according to some embodiments of this application. When acquiring the level transition edges of received serial port data, the first bit acquired is the idle bit at a high level. Since the start bit of each byte in the serial port data is at a low level, the detected first falling edge is the start time of the start bit level. The levels in the serial port data are as follows: Figure 4 The S1, S2, S3, S4, and S5 levels, etc., correspond to the count values ​​of the changes in each level, as shown in the example. Figure 4 The values ​​t1, t2, t3, t4, and t5 are used. Each level includes two corresponding level change edge count values. For example, the level change edge count values ​​for level S1 are t1 and t2, for level S2 they are t2 and t3, and for level S3 they are t3 and t4. These will not be repeated for all levels.

[0050] In some embodiments, acquiring the level change edges of serial port data specifically includes acquiring the level change edges of a preset number of levels in the serial port data. The preset number of levels can be 64. When 64 level change edges are acquired, acquisition stops, and based on the acquisition timing, the level values ​​of the 64 levels and the corresponding change edge count values ​​are used to form an initial feature set.

[0051] S013: Based on the count values ​​of the change edges of each level in the initial feature set, obtain the pulse width time of each level.

[0052] The pulse width duration of each level is also the duration of that level's duration. For example... Figure 4As shown, the pulse width times of each level in the serial port data include T1 for level S1, T2 for level S2, T3 for level S3, T4 for level S4, and T5 for level S5. Specifically, the pulse width time of each level is determined based on the difference between the count value of the next edge change and the count value of the previous edge change for each level in each initial feature set. For example, in some embodiments, t1 to t5 can be the number of counting clock pulses. For instance, t1 is n counting clock pulses, and t2 is m counting clock pulses, and the time corresponding to one counting clock pulse is k. Then, the formula for calculating the pulse width time T1 of level S1 is: T1 = (mn) * k.

[0053] S015: Compare the pulse width and time of each level with a preset threshold to filter out levels with abnormal pulse width and time in the initial feature set, and obtain the level feature set.

[0054] After obtaining the pulse width times of each level in the initial feature set, to further improve the accuracy of the acquired levels, the baud rate adaptive method provided in the following embodiments of this application further includes feature processing of the initial feature set to obtain a level feature set. Processing the initial feature set includes filtering out abnormal levels and their corresponding level features. Specifically, the pulse width times of each level in the initial feature set are compared with preset thresholds, and levels with pulse width times outside the preset threshold range are identified as abnormal levels with abnormal pulse width times. For example, such an abnormal level might be the interval level between two adjacent bytes in serial port data. The initial feature set after filtering out abnormal levels is the final level feature set used for matching with the comparison level features.

[0055] Please see Figure 5 The diagram shown is a flowchart illustrating a baud rate adaptive method provided according to some embodiments of this application. Figure 5 In the illustrated embodiment, S03 further includes S031, S033, S035, and S037. Specifically, each step is described below.

[0056] S031: Under the preset byte structure conditions, calculate the predicted baud rate of the serial port data based on the level characteristics of the specified start bit level and specified stop bit level in the level characteristic set, generate simulated serial port data based on the predicted baud rate, and use the level characteristics in the simulated serial port data as the comparison level characteristics.

[0057] Please see Figure 6The diagram illustrates the byte structure of serial data. Each byte in serial port data always includes a start bit, data bits, and a stop bit, and may also include a parity bit. The start bit always occupies 1 bit, the number of bits occupied by the data bits is uncertain (e.g., 7 or 8 bits), the parity bit always occupies 1 bit, and the number of bits occupied by the stop bit is uncertain (e.g., 1 or 2 bits). The byte structure refers to the structure of a single byte in serial port data. Once the inclusion of a parity bit, the number of bits occupied by the data bits, and the number of bits occupied by the stop bits are determined, the byte structure is also determined. That is, a preset byte structure refers to an assumed byte structure for serial port data.

[0058] Specifying a start bit level refers to designating a low level among the various levels of serial port data to serve as the start bit level for a byte of serial port data. For example, ... Figure 4 The specified start bit level is such as level S1. Based on the level characteristics of the specified start bit level, the start time of the byte can be determined, and the start time of the byte is the start time of the specified start bit level. For example, when level S1 is the specified start bit level, t1 is the start time of the start bit, which is also the start time of the byte.

[0059] Specifying a stop bit refers to assigning a high-level signal in the serial data to serve as the stop bit level for a byte of serial data. For example... Figure 4 The high level S2 or S4, etc., can be used. The specified start bit level and the end time from the start time to the specified stop bit level may include one or more complete bytes. Specifically, in some embodiments, the specified start bit level and the specified stop bit level are specified bit levels corresponding to the same byte. In this case, the specified start bit level and the end time from the start time to the specified stop bit level may only include one complete byte, which facilitates faster determination of the target baud rate. For example, when level S2 is the specified stop bit level, its corresponding end time is t3, meaning t3 may be the end time of the stop bit. Based on the level characteristics of the specified stop bit level, the start time of the byte can be determined, and this start time of the byte is the start time of the specified start bit level. For example, when level S1 is the specified start bit level, t1 is the start time of the byte.

[0060] Based on the level characteristics of the specified start bit and stop bit, the time range occupied by a complete byte can be determined. For example, if level S1 is the specified start bit level and level S2 is the specified stop bit level, then the start time t1 of S1 is the start time of a complete byte, and the end time t3 of level S2 is the possible end time of a complete byte. If the preset byte structure is: serial data bytes do not include parity bits, data bits occupy 7 bits, and stop bits occupy 1 bit, then according to the preset byte structure, t1 to t3 corresponds to the time of 9 bits (1 start bit, 7 data bits, and 1 stop bit). Based on the time from t1 to t3, the predicted baud rate can be inferred to be (t3-t1) / 9.

[0061] Based on the predicted baud rate and the current preset byte structure, generating simulated serial port data means: using the predicted baud rate as the transmission time for each bit, and according to the preset byte structure, simulating the generation of simulated serial port data after the current specified stop bit level. Then, the characteristics of each level in the simulated serial port data are used as comparison level characteristics and compared with the corresponding levels in the level characteristic set. Still using level S1 as the specified start bit level and level S2 as the specified stop bit level, and with the preset byte structure as follows: the serial port data byte does not include the parity bit, the data bits occupy 7 bits, and the stop bits occupy 1 bit, then the predicted baud rate is (t3-t1) / 9. Based on this predicted baud rate and preset byte structure, simulated serial port data after time t3 is generated. After the data bits of the first byte in this simulated serial port data end, a high-level stop bit is entered. The time difference between the end time of the first byte data bit and the end time t3 of the current specified stop bit level should be 8*(t3-t1) / 9. If the level value corresponding to time t3+8*(t3-t1) / 9 in the level feature set is also high, then the current comparison level feature may match the level feature set; otherwise, it is considered not to match. The specific matching process for whether the comparison level feature matches the level feature set is not limited to this and will not be described in detail here.

[0062] S033: Compare the comparison level feature with the corresponding level feature in the level feature set to determine whether the comparison level feature matches the level feature set.

[0063] The comparison level features are the level features of each level in the analog serial port data. The comparison level features are compared with the corresponding level features in the level feature set to determine whether the level features of each level in the analog serial port data are consistent with the corresponding level features in the level feature set. If they are consistent, it is determined that the comparison level features match the level feature set; if they are inconsistent, it is determined that the comparison level features do not match the level feature set.

[0064] Based on matching or similarity algorithms, the comparison level features and the corresponding level features in the level feature set can be compared for consistency to determine the matching degree or similarity between the comparison level features and the level feature set. If the matching degree or similarity exceeds a preset value, it is considered that the current comparison level feature matches the level feature set.

[0065] S035: If the comparison level feature matches the level feature set, then the predicted baud rate is taken as the baud rate to be verified.

[0066] In some embodiments, the baud rate corresponding to the comparison level feature is used to calculate its predicted baud rate.

[0067] S037: If the comparison level feature does not match the level feature set, according to the level feature set, re-specify one of the remaining high levels of the serial port data as the specified stop bit level, and return to execute S031.

[0068] Specifically, under the current preset byte structure, if the number of times the specified stop bit level is updated does not reach the preset number of updates, it means that the number of remaining high levels does not reach the preset number. If the level feature does not match the level feature set at this time, according to the level feature set, a new one is specified as the specified stop bit level from the remaining high levels of the serial port data, and the process returns to execute S031.

[0069] The remaining high level refers to the high level in the serial port data that has not been designated as a specified stop bit under the current preset byte structure conditions. In some embodiments, stop bit levels are specified sequentially from front to back according to the timing of the serial port number until the corresponding comparison level feature matches the level feature set, or the number of updates to the specified stop bit level has reached the set number of updates, or the number of remaining high levels in the level feature set has reached a preset number. If it is 0, it means that the specified stop bit level cannot be updated again under the current preset byte structure conditions. That is, in some embodiments, when the comparison level feature corresponding to the previously specified stop bit level fails to match the level feature set, the next high level adjacent to the previously specified stop bit level is re-designated as the specified stop bit level to update the comparison level feature. When the specified stop bit level changes, its corresponding predicted baud rate also changes, the obtained analog serial port data also changes, and the final obtained comparison level feature also changes. Therefore, the specified stop bit level is the independent variable of the comparison level feature, and the comparison level feature is updated by updating the specified stop bit level.

[0070] For example, level S1 is the specified start bit level, and level S2 is the specified stop bit level for the current iteration. If the current comparison level feature does not match the level feature set, then the end time of level S2 is considered not to be the end time of the byte, but only the end time of a data bit in the byte. Then, the next specified level S4 is used as the specified stop bit level, and so on, until the comparison level feature matches the level feature set.

[0071] exist Figure 5 In the baud rate adaptive method shown, under a preset byte structure, a level is specified as the start bit level and a level as the stop bit level in the level feature set. Then, based on the current specified start bit level and stop bit level, and the current preset byte structure, a predicted baud rate is calculated, and simulated serial port data is generated based on the predicted baud rate as reference data for the currently received serial port data, i.e., as a comparison level feature. The currently calculated comparison level feature is then compared with the corresponding level feature in the level feature set. If the comparison result is consistent, the current predicted baud rate is used to obtain the baud rate to be verified based on the comparison result for further external verification. Otherwise, a new stop bit level needs to be specified to obtain a new predicted baud rate, and it is determined whether it can be used as the baud rate to be verified. This baud rate adaptive method provided in this application embodiment can pre-filter out some predicted baud rates that do not meet the requirements, i.e., eliminate the possibility of some assumptions. The baud rate to be verified has a higher probability of passing external verification, avoiding external verification of too many predicted baud rates, and can quickly and accurately determine the target baud rate.

[0072] Please continue reading. Figure 5 As shown, in some embodiments, after S05 above, the baud rate adaptive method further includes S091: if there is no baud rate to be verified through external verification, according to the level feature set, a new stop bit level is specified in the remaining high level of the serial port data to update the comparison level feature, and then returns to S031.

[0073] The baud rate adaptive method provided in this application determines the target baud rate through iterative verification. That is, for each baud rate to be verified, it is first externally verified. If the verification is successful, the target baud rate is determined. There is no need to update the specified stop bits to continue calculating the new predicted baud rate. In other words, it is not necessary to specify all the high levels in the level feature set first to obtain all possible predicted baud rates before determining whether there is a predicted baud filter that has passed external verification. This allows for a faster and more accurate target baud rate.

[0074] In some embodiments, if only one baud rate to be verified is matched in S031, then S05 needs to be entered to perform external verification on that baud rate. If the verification fails, then it needs to return to S031 to re-match and obtain a new baud rate to be verified. However, before S031, the comparison level feature needs to be updated. Specifically, the comparison level feature is updated by updating the specified stop bit level, as described above, and will not be described again here.

[0075] For further information, please refer to [link / reference]. Figure 5 As shown, in some embodiments, the baud rate adaptive method further includes S041: when the level characteristics in the analog serial port data are inconsistent with the corresponding level characteristics in the level characteristic set, or when there is no externally verified predicted baud rate, if, under the current preset byte structure conditions, the number of updates for the specified stop bit level reaches a preset number of updates or the number of remaining high levels reaches a preset number, then the preset byte structure conditions are updated, and S031 is returned. Specifically, when updating the preset byte structure conditions, the number of updates for the specified stop bit also needs to be cleared to zero. In this embodiment, by setting the number of updates or the number of remaining high levels as the termination condition for the iterative assumption under the current preset byte structure conditions, unnecessary computing power is reduced, and the computing power requirement for the processor in the first communication unit is reduced.

[0076] If, under the current preset byte structure, after updating all specified stop bit levels, the comparison level feature and the level feature set still do not match, or if they match but all baud rates to be verified fail external verification, it indicates that the currently assumed preset byte structure may be incorrect. In this case, the preset byte structure needs to be updated, and the process needs to be repeated in S031 to finally obtain the baud rates to be verified that have passed external verification.

[0077] Please see Figure 7 The diagram shown is a flowchart illustrating a baud rate adaptive method provided according to some embodiments of this application. Figure 7 In the illustrated embodiment, S03 specifically includes S032 and S034.

[0078] S032: Based on the comparison level feature and baud rate mapping table, match the level feature set with the comparison level features in the comparison level feature and baud rate mapping table to determine whether a target comparison level feature that matches the level feature set is found.

[0079] The mapping relationship between comparison level features and baud rates can be referenced in Table 1 below. Each comparison level has a corresponding baud rate. If comparison level feature 3 matches the level feature set, comparison level feature 3 is the target comparison level feature, and baud rate 3 is used as a baud rate to be verified in the current matching process. In some embodiments, in S032, once a target comparison level feature is matched, the matching stops, and the baud rate corresponding to the target comparison level feature is used as a baud rate to be verified for external verification. If the external verification fails, the process returns to S032 to continue matching. In other embodiments, in S032, multiple or all target comparison level features can be matched first, and then each baud rate corresponding to each target comparison level feature can be used as a baud rate to be verified for external verification one by one. In some embodiments, the mapping relationship between comparison level features and baud rates can be specifically a hash table.

[0080] Table 1

[0081] Comparison level characteristic 1 baud rate 1 Comparison level characteristics 6 baud rate 6 Comparison level characteristics 2 Baud rate 2 Comparison level characteristics 7 baud rate 7 Comparison level characteristics 3 baud rate 3 Comparison level characteristics 8 baud rate 8 Comparison level characteristics 4 baud rate 4 Comparison level characteristics 9 Baud rate 9 Comparison level characteristics 5 baud rate 5 Comparison level characteristics 10 baud rate 10

[0082] S034: If a target comparison level feature that matches the level feature set is found, the baud rate mapped by the target comparison level feature is taken as the baud rate to be verified.

[0083] like Figure 7 In the baud rate adaptive method shown, a pre-defined comparison level feature and baud rate mapping table is used. Then, the level feature set is matched with the comparison level features in the pre-defined comparison level feature and baud rate mapping table to quickly obtain the baud rate to be verified.

[0084] Please continue reading. Figure 7 As shown, in some embodiments, after S05, the baud rate adaptive method further includes S092: if there is no externally verified baud rate to be verified, the remaining unmatched comparison level features in the comparison level feature and baud rate mapping table are used as the updated comparison level features to update the comparison level features, and then return to S032.

[0085] In the process of obtaining the baud rate to be verified based on the above mapping table, if a match is found, the matching stops and external verification is performed. If the external verification fails, the comparison level features need to be updated and the process returns to S032 for rematching. In this embodiment, updating the comparison level features means updating their composition, that is, taking each comparison level feature in the above mapping table that has not been matched with the level feature set as the next matching object, i.e., as the comparison level feature in the next matching process. In S032, if a baud rate to be verified is matched, the matching stops and external verification is performed. If the external verification fails, the comparison level features are updated and the matching is performed again to obtain the baud rate to be verified. This method does not require matching the level feature set with all the comparison level features in the above mapping table one by one, which is beneficial for quickly obtaining the target baud rate.

[0086] For further information, please refer to [link / reference]. Figure 7 As shown, after S07, some embodiments of this application provide a baud rate adaptive method that further includes S081: forming a mapping relationship based on the level feature set and the target baud rate, and adding the mapping relationship to the comparison level feature and baud rate mapping relationship table to update the comparison level feature and baud rate mapping relationship table, so as to enrich the comparison level features in the above mapping relationship table.

[0087] Furthermore, in some embodiments, after S032, the adaptive baud rate method further includes: if no matching comparison level is found in the comparison level feature and baud rate mapping table, or if a matching level is found but all baud rates to be verified have not passed external verification, the baud rate adaptive method further includes: under a preset byte structure condition, calculating the predicted baud rate of the serial port data based on the level features of the specified start bit level and specified stop bit level in the level feature set; generating simulated serial port data based on the predicted baud rate; and determining whether the level features in the simulated serial port data are consistent with the corresponding level features in the level feature set. When it is determined that the level features in the simulated serial port data are consistent with the corresponding level features in the level feature set, test data is sent to the second communication unit at the predicted baud rate, and it is determined whether there is an externally verified predicted baud rate. If it is determined that there is an externally verified predicted baud rate, the externally verified predicted baud rate is determined as the target baud rate. If the level characteristics in the simulated serial port data are inconsistent with the corresponding level characteristics in the level characteristic set, or if there is no externally verified predicted baud rate, then according to the level characteristic set, a new stop bit level is specified from the remaining high level of the serial port data, and the process returns to the step of calculating the predicted baud rate of the serial port data based on the level characteristics of the specified start bit level and the specified stop bit level in the level characteristic set under the preset byte structure conditions.

[0088] In the baud rate adaptive method provided according to some embodiments of this application, if no matching comparison level feature is found in the comparison level feature and baud rate mapping table, or if a match is found but the baud rates corresponding to all matched comparison level features have not passed external verification, further verification based on the comparison level feature and baud rate mapping table is required. Figure 5 The corresponding implementation scheme determines the target baud rate in a similar manner, due to the above-mentioned... Figure 5 The corresponding steps have been described in detail and will not be repeated here. In the baud rate adaptive method provided according to some embodiments of this application, it is first determined whether the baud rate to be verified can be matched in the comparison level feature and baud rate mapping table. If a match is found, the matched baud rate to be verified is verified. If no match is found, or the external verification of the matched baud rate to be verified fails, the baud rate to be verified is further determined using an iterative assumption-based method as described in S041 above, until the target baud rate is accurately found. The baud rate adaptive method provided in this application, by combining table matching and iterative assumptions, can reduce the number of level features required in the comparison level feature and baud rate mapping table, while also quickly and accurately obtaining the target baud rate.

[0089] Furthermore, in some embodiments, the baud rate adaptive method further includes: when the level characteristics in the simulated serial port data are inconsistent with the corresponding level characteristics in the level characteristic set, or when there is no externally verified predicted baud rate, if the number of updates to the specified stop bit level reaches a preset number of updates or the number of remaining high levels reaches a preset number, then the preset byte structure conditions are updated, and the process returns to the step of calculating the predicted baud rate of the serial port data based on the level characteristics of the specified start bit level and the specified stop bit level in the level characteristic set under the preset byte structure conditions. This step refers to S041 above and will not be repeated here.

[0090] Please see Figure 8The diagram shows a schematic of a baud rate adaptive device provided according to some embodiments of this application. In some embodiments, the baud rate adaptive device provided in this application is applied to a first communication unit, specifically including a feature acquisition module 101, a feature matching module 102, an external verification module 103, and a determination module 104. The feature acquisition module 101 is used to acquire the level features of the serial port data sent from the second communication unit to obtain a set of level features of the serial port data. The feature matching module 102 is used to match the set of level features with the comparison level features to obtain the baud rate to be verified. The external verification module 103 is used to send test data to the second communication unit at the baud rate to be verified and determine whether the baud rate to be verified passes the external verification. The determination module 104 is used to determine the baud rate to be verified as the target baud rate for transmitting data to the second communication unit if the baud rate to be verified passes the external verification. The baud rate adaptive device provided in the embodiments of this application and the baud rate adaptive method provided in the embodiments of this application can achieve the same technical effect, and will not be described in detail here.

[0091] Furthermore, in some embodiments, the baud rate adaptive device further includes an iterative update module, which is specifically used to update the comparison level features when there is no externally verified baud rate to be verified, and return the step of matching the level feature set with the comparison level features to obtain the baud rate to be verified.

[0092] Furthermore, in some embodiments, the feature acquisition module 101 is specifically used to acquire the level change edges of the serial port data, obtain the change edge count value corresponding to each level in the serial port data, form an initial feature set of the serial port data, and obtain the pulse width time of each level based on the change edge count value of each level in the initial feature set, and compare the pulse width time of each level with a preset threshold to filter out levels with abnormal pulse width time in the initial feature set, thereby obtaining a level feature set.

[0093] Furthermore, in some embodiments, the feature matching module 102 is also specifically used to calculate the predicted baud rate of the serial port data based on the level characteristics of the specified start bit level and specified stop bit level in the level feature set under the preset byte structure conditions, generate simulated serial port data based on the predicted baud rate, use the level characteristics in the simulated serial port data as comparison level characteristics, compare the comparison level characteristics with the corresponding level characteristics in the level feature set, determine whether the comparison level characteristics match the level feature set, and specifically used to use the predicted baud rate as the baud rate to be verified when the comparison level characteristics match the level feature set, and when the comparison level characteristics match the level feature set, to re-specify one of the remaining high levels in the serial port data as the specified stop bit level according to the level feature set, and return to the step of calculating the predicted baud rate of the serial port data based on the level characteristics of the specified start bit level and specified stop bit level in the level feature set.

[0094] Furthermore, in some embodiments, the iterative update module is specifically used to, when there is no externally verified baud rate to be verified, re-specify one of the remaining high levels of the serial port data as the specified stop bit level according to the level feature set, so as to update the comparison level features, and return the step of calculating the predicted baud rate of the serial port data according to the level features of the specified start bit level and the specified stop bit level in the level feature set under the preset byte structure conditions.

[0095] Furthermore, in some embodiments, the feature matching module 102 is specifically used to match the level feature set with the comparison level features in the comparison level feature and baud rate mapping table according to the comparison level feature and baud rate mapping table, and when a target comparison level feature that matches the level feature set is matched, the baud rate mapped by the target comparison level feature is used as the baud rate to be verified.

[0096] Furthermore, in some embodiments, the iterative update module is specifically used to update the comparison level features by taking the remaining comparison level features that have not been matched in the comparison level feature and baud rate mapping table as the updated comparison level features when there is no externally verified baud rate to be verified, and returning the step of matching the level feature set with the comparison level features in the comparison level feature and baud rate mapping table according to the comparison level feature and baud rate mapping table.

[0097] Furthermore, in some embodiments, the iterative update module 5 is also specifically used to form a mapping relationship based on the level feature set and the target baud rate, and add the mapping relationship to the comparison level feature and baud rate mapping relationship table to update the comparison level feature and baud rate mapping relationship table.

[0098] Furthermore, in some embodiments, the feature matching module 102 is also specifically used to calculate the predicted baud rate of the serial port data based on the level features of the specified start bit level and specified stop bit level in the level feature set when no target comparison level feature matching the level feature set is found, or when there is no externally verified baud rate to be verified, under a preset byte structure condition; generate simulated serial port data based on the predicted baud rate; and determine whether the level features in the simulated serial port data are consistent with the corresponding level features in the level feature set; and when the level features in the simulated serial port data are consistent with the corresponding level features in the level feature set, to... The predicted baud rate is sent to the second communication unit to test data to determine whether there is an externally verified predicted baud rate. If there is an externally verified predicted baud rate, it is determined as the target baud rate. If the level characteristics in the simulated serial port data are inconsistent with the corresponding level characteristics in the level characteristic set, or if there is no externally verified predicted baud rate, then according to the level characteristic set, a new stop bit level is specified from the remaining high level of the serial port data, and the predicted baud rate of the serial port data is calculated again according to the level characteristics of the specified start bit level and the specified stop bit level in the level characteristic set.

[0099] The iterative update module is also specifically used when the level characteristics in the simulated serial port data are inconsistent with the level characteristics corresponding to the level characteristic set, or when there is no externally verified predicted baud rate, if the number of updates of the specified stop bit level reaches the preset number of updates or the number of remaining high levels reaches the preset number, then the preset byte structure conditions are updated, and the execution is returned to the step of calculating the predicted baud rate of the serial port data based on the level characteristics of the specified start bit level and the specified stop bit level in the level characteristic set under the preset byte structure conditions.

[0100] Please see Figure 9 The diagram shows a schematic representation of a communication device provided according to some embodiments of this application. In some embodiments, the communication device, such as the first communication unit described above, includes a memory 201 and a processor 202. The memory 201 stores a program, and the processor 202 executes the program stored in the memory 201 to implement the baud rate adaptive method provided in any embodiment of this application. The communication device can be a temperature control device, such as an air conditioner. Specifically, the communication device can be an industrial air conditioner, such as a refrigeration device. The first communication unit provided in the embodiments of this application achieves the same technical effect as the baud rate adaptive method provided in some embodiments of this application, and will not be repeated here.

[0101] This application also provides a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the baud rate adaptive method provided in any embodiment of this application and achieves the same technical effect. To avoid repetition, further details are omitted here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0102] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A baud rate adaptive method, applied to a first communication unit, characterized in that, include: Level characteristics are acquired from the serial port data sent by the second communication unit to obtain the level characteristic set of the serial port data; The level feature set is matched with the comparison level features to obtain the baud rate to be verified. The comparison level features include level features in the simulated serial port data. The simulated serial port data is generated based on the predicted baud rate calculated according to the level features of the specified start bit level and specified stop bit level in the level feature set under the preset byte structure conditions. Test data is sent to the second communication unit at the baud rate to be verified to determine whether the baud rate to be verified passes external verification. If the baud rate to be verified passes the external verification, the baud rate to be verified is determined as the target baud rate for transmitting data to the second communication unit.

2. The baud rate adaptive method according to claim 1, characterized in that, After determining whether the baud rate to be verified has passed external verification, the method further includes: If the baud rate to be verified fails the external verification, the comparison level feature is updated, and the process returns to the step of matching the level feature set with the comparison level feature to obtain the baud rate to be verified.

3. The baud rate adaptive method according to claim 1, characterized in that, The step of acquiring the level characteristics of the serial port data sent by the second communication unit to obtain the level characteristic set of the serial port data includes: The level change edges of the serial port data are collected to obtain the change edge count value corresponding to each level in the serial port data, forming the initial feature set of the serial port data; The pulse width time of each level is obtained based on the change edge count value of each level in the initial feature set; The pulse width time of each level is compared with a preset threshold to filter out levels with abnormal pulse width time in the initial feature set, thereby obtaining the level feature set.

4. The baud rate adaptive method according to claim 1, characterized in that, The step of matching the level feature set with the comparison level features to obtain the baud rate to be verified includes: Under a preset byte structure, the predicted baud rate of the serial port data is calculated based on the level characteristics of the specified start bit level and specified stop bit level in the level feature set. Based on the predicted baud rate, simulated serial port data is generated, and the level characteristics in the simulated serial port data are used as the comparison level characteristics. The comparison level feature is compared with the corresponding level feature in the level feature set to determine whether the comparison level feature matches the level feature set. If so, the predicted baud rate is used as the baud rate to be verified; If not, according to the level feature set, re-designate one of the remaining high levels in the serial port data as the designated stop bit level, and return to execute the step of calculating the predicted baud rate of the serial port data under the preset byte structure conditions based on the level features of the designated start bit level and the designated stop bit level in the level feature set, wherein the remaining high level is the high level in the serial port data that has not been designated as the designated stop bit under the current preset byte structure conditions.

5. The baud rate adaptive method according to claim 1, characterized in that, The step of matching the level feature set with the comparison level features to obtain the baud rate to be verified includes: According to the comparison level feature and baud rate mapping table, the level feature set is matched with the comparison level features in the comparison level feature and baud rate mapping table; If a target comparison level feature that matches the level feature set is found, the baud rate mapped by the target comparison level feature is taken as the baud rate to be verified.

6. The baud rate adaptive method according to claim 5, characterized in that, After determining the target baud rate, the method further includes: forming a mapping relationship based on the level feature set and the target baud rate, and adding the mapping relationship to the comparison level feature and baud rate mapping relationship table to update the comparison level feature and baud rate mapping relationship table.

7. The baud rate adaptive method according to claim 5, characterized in that, After matching the set of level features with the comparison level features in the comparison level feature and baud rate mapping table according to the comparison level feature and baud rate mapping table, the method further includes: If no target comparison level feature matching the level feature set is found, then under the preset byte structure conditions, the predicted baud rate of the serial port data is calculated based on the level features of the specified start bit level and the specified stop bit level in the level feature set. Based on the predicted baud rate, simulated serial port data is generated, and it is determined whether the level features in the simulated serial port data are consistent with the level features corresponding to the level feature set. When it is determined that the level characteristics in the simulated serial port data are consistent with the level characteristics corresponding to the level characteristic set, test data is sent to the second communication unit at the predicted baud rate to determine whether the predicted baud rate passes the external verification. If it passes, the predicted baud rate that passes the external verification is determined as the target baud rate. When the level characteristics in the simulated serial port data are inconsistent with the level characteristics corresponding to the level characteristic set, then according to the level characteristic set, a new high level in the remaining high level of the serial port data is reassigned as the specified stop bit level, and the process returns to the step of calculating the predicted baud rate of the serial port data based on the level characteristics of the specified start bit level and specified stop bit level in the level characteristic set under the preset byte structure condition. The remaining high level is the high level in the serial port data that has not been assigned as the specified stop bit under the current preset byte structure condition.

8. The baud rate adaptive method according to claim 4 or 7, characterized in that, The step of re-designating a stop bit level from the remaining high levels of the serial port data according to the level feature set, and then returning to execute the step of calculating the predicted baud rate of the serial port data based on the level features of the specified start bit level and the specified stop bit level in the level feature set under the preset byte structure conditions, includes: Determine whether the number of times the specified stop bit level has been updated has reached the preset number of updates; If so, update the preset byte structure conditions, and re-designate one of the remaining high levels of the serial port data as the specified stop bit level, and return to execute the step of calculating the predicted baud rate of the serial port data based on the level characteristics of the specified start bit level and specified stop bit level in the preset byte structure conditions.

9. A baud rate adaptive device, applied to a first communication unit, characterized in that, include: The feature acquisition module is used to acquire the level features of the serial port data sent by the second communication unit to obtain the level feature set of the serial port data. The feature matching module is used to match the level feature set with the comparison level features to obtain the baud rate to be verified. The comparison level features include level features in the simulated serial port data. The simulated serial port data is generated based on the predicted baud rate calculated by the level features of the specified start bit level and specified stop bit level in the level feature set under the preset byte structure conditions. An external verification module is used to send test data to the second communication unit at the baud rate to be verified, and to determine whether the baud rate to be verified passes external verification. The determination module is configured to determine the baud rate to be verified as the target baud rate for transmitting data to the second communication unit after the external verification has been passed.

10. A communication device, characterized in that, include: Memory, used to store programs; A processor for implementing the baud rate adaptive method as described in any one of claims 1 to 8 by executing a program stored in the memory.