Communication baud rate adaptation method and module, device and readable storage medium
By calculating the baud rate of the receiving end based on the duration of the UART communication negotiation signal, the problem of baud rate mismatch between the receiving and transmitting ends is solved, thereby improving the stability and efficiency of communication.
Patent Information
- Application Number
- PCT/CN2024/138396
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-04-23
- Filing Date
- 2024-12-11
- Publication Date
- 2025-10-30
AI Technical Summary
In UART communication, the receiver may have difficulty obtaining the baud rate of the transmitter, leading to communication abnormalities between the receiver and transmitter, especially when the transmitter signal has a non-standard waveform.
The receiving end determines the duration of the start and stop signals by receiving the communication negotiation signals from the sending end, and calculates the second baud rate based on these durations to match the baud rate of the sending end.
It achieves adaptive matching of the receiver baud rate, ensuring normal communication between the sender and receiver, and improving the stability and efficiency of data transmission.
Smart Images

Figure CN2024138396_30102025_PF_FP_ABST
Abstract
Description
Communication baud rate adaptation methods, modules, devices and readable storage media
[0001] This application claims priority to Chinese Patent Application No. 202410493980.7, filed on April 23, 2024, entitled "Communication Baud Rate Adaptation Method, Module, Device and Readable Storage Medium", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of communication technology, and in particular to communication baud rate adaptation methods, modules, devices and readable storage media. Background Technology
[0003] Universal Asynchronous Receiver / Transmitter (UART) communication is an asynchronous serial communication method. A UART communication system mainly consists of two parts: a transmitter and a receiver, which transmit data via data lines. In UART communication, the baud rate determines the speed and stability of data transmission.
[0004] To ensure normal communication between the sender and receiver, the receiver's baud rate is typically configured based on the sender's baud rate. However, in practice, the receiver may struggle to obtain the sender's baud rate, and the signal transmitted by the sender is not always a standard waveform. This makes it difficult for the receiver to determine a matching baud rate with the sender, leading to communication anomalies between the two ends. Summary of the Invention
[0005] This application provides a communication baud rate adaptation method, the method comprising:
[0006] The receiving end sends a communication negotiation signal based on the first baud rate;
[0007] The first duration is determined based on the duration of the initiation signal included in the communication negotiation signal;
[0008] The second duration is determined based on the duration of the termination signal included in the communication negotiation signal;
[0009] A second baud rate is determined based on one or both of the first duration and the second duration, and the second baud rate is used to receive the signal from the transmitting end.
[0010] In one embodiment, this application provides a communication baud rate adaptation module, the module comprising:
[0011] The receiving unit is used to receive the communication negotiation signal sent by the sending end based on the first baud rate;
[0012] A determining unit is configured to determine a first duration based on the duration of the start signal included in the communication negotiation signal;
[0013] The determining unit is further configured to determine a second duration based on the duration of the termination signal included in the communication negotiation signal;
[0014] The processing unit is configured to determine a second baud rate based on one or both of the first duration and the second duration, wherein the second baud rate is used to receive the signal from the transmitting end.
[0015] In one embodiment, this application provides a computer device including a memory and one or more processors. The memory stores computer-readable instructions, which, when executed by the processors, cause the one or more processors to perform the communication baud rate adaptation method provided in this application.
[0016] In one embodiment, this application also provides one or more non-volatile readable storage media storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the communication baud rate adaptation method provided in this application.
[0017] Details of one or more embodiments of this application are set forth in the following drawings and description. Other features, objects, and advantages of this application will become apparent from the specification, drawings, and claims. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. The appendices or examples used to describe the drawings should not be considered as limiting the scope of any of the disclosed invention, the currently described embodiments and / or examples, and the best mode of these inventions as currently understood.
[0019] Figure 1 is a schematic diagram of the system architecture of a communication baud rate adaptation system provided by this application;
[0020] Figure 2 is a flowchart illustrating a communication baud rate adaptation method provided by this application;
[0021] Figure 3 is a schematic diagram of a communication negotiation signal provided by example in this application;
[0022] Figure 4 is a schematic diagram of a communication baud rate adaptation method provided by example in this application;
[0023] Figure 5 is a flowchart illustrating another communication baud rate adaptation method provided by this application;
[0024] Figure 6 is a schematic diagram of another communication baud rate adaptation method provided by example in this application;
[0025] Figure 7 is a structural block diagram of a communication baud rate adaptation module provided by this application;
[0026] Figure 8 is a structural block diagram of a computer device provided by example in this application. Detailed Implementation
[0027] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0028] It should be noted that the terms "first," "second," etc., used in the embodiments of this application are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a technical feature specified with "first" or "second" may explicitly or implicitly include at least one of those features.
[0029] In practical applications, the types of transmitting ends are quite complex, and the receiving end often cannot accurately obtain the baud rate of the transmitting end, nor can it accurately determine whether the waveform of the signal transmitted by the transmitting end is a standard waveform. This situation can lead to a mismatch between the baud rate determined by the receiving end and the baud rate of the transmitting end, which can easily cause communication abnormalities between the transmitting and receiving ends.
[0030] Based on this, embodiments of this application provide a communication baud rate adaptation method, which can receive a communication negotiation signal sent by a transmitter based on a first baud rate; determine a first duration based on the duration of a start signal included in the communication negotiation signal, and determine a second duration based on the duration of a stop signal included in the communication negotiation signal; determine a second baud rate based on one or both of the first and second durations, and the second baud rate is used to receive the signal from the transmitter. Through the method provided by embodiments of this application, the baud rate of the receiver can be determined based on the signal sent by the transmitter, enabling adaptive matching of the baud rates of the transmitter and receiver, and ensuring normal communication between the receiver and transmitter.
[0031] The communication baud rate adaptation method provided in this application can be applied to embedded systems. An embedded system refers to a system that applies computer technology to various electronic devices. In embedded systems, the UART communication protocol is typically used to achieve communication between the system and external devices. For example, data transmission between an embedded system and devices such as sensors, actuators, and displays can be achieved through the UART communication protocol. The communication baud rate adaptation method provided in this application can be applied to embedded systems. Taking an external device as the transmitter and the embedded system as the receiver as an example, the embedded system can receive a communication negotiation signal sent by the external device based on a first baud rate. It determines a first duration based on the duration of the start signal included in the communication negotiation signal, and determines a second duration based on the duration of the termination signal included in the communication negotiation signal. The embedded system determines a second baud rate based on one or both of the first and second durations. The second baud rate is used by the receiver to receive signals sent by the transmitter. Through the method provided in this application, adaptive matching of the baud rates of the transmitter and receiver can be achieved, ensuring normal communication between the embedded system and external devices.
[0032] The architecture of the communication baud rate adaptation system provided in this application will be described below with reference to the accompanying drawings. Please refer to Figure 1, which is a schematic diagram of the system architecture of a communication baud rate adaptation system provided by this application. The communication baud rate adaptation system includes a transmitting end 101 and a receiving end 102. Wherein:
[0033] The transmitting end 101 can send signals to the receiving end 102, including start signals, stop signals, and data signals. The transmitting end 101 can be a transmitting module in a communication device, or a device that communicates based on the UART communication protocol. When the transmitting end 101 is a device, it can be a handheld device with communication capabilities (e.g., a smartphone, tablet), a computing device (e.g., a personal computer (PC), in-vehicle terminal, intelligent voice interaction device, wearable device, external device associated with an embedded system, or other intelligent device), but is not limited to these. Figure 1 uses a sensor as an example of an external device associated with an embedded system; for example, the sensor can be a temperature sensor, pressure sensor, etc. The transmitting end 101 can be a sensor that communicates with the receiving end 102 via a data line; Figure 1 uses a temperature sensor as an example.
[0034] Receiver 102 can receive signals sent by transmitter 101 and determine the receiver baud rate based on the received signals. Receiver 102 can be a receiving module in a communication device or a device that communicates based on the UART communication protocol. When receiver 102 is a device, it can be a handheld device with communication capabilities (e.g., a smartphone, tablet), a computing device (e.g., a personal computer (PC), in-vehicle terminal, intelligent voice interaction device, wearable device, device configured with an embedded system, or other intelligent device), but is not limited to these. In Figure 1, receiver 102 can be a device configured with an embedded system.
[0035] The working principle of the communication baud rate adaptation system shown in Figure 1 will be explained in detail below:
[0036] The transmitting end 101 and the receiving end 102 can be connected via a data line. The transmitting end 101 can send a communication negotiation signal to the receiving end 102 based on a first baud rate. This communication negotiation signal may include a start signal and a stop signal. The receiving end 102 can receive the communication negotiation signal sent by the transmitting end 101 and determine a first duration based on the duration of the start signal included in the communication negotiation signal, and determine a second duration based on the duration of the stop signal included in the communication negotiation signal. The first duration and the second duration can indicate relevant information about the signal sent by the transmitting end, such as whether the waveform of the signal is a standard waveform. The receiving end 102 can determine a second baud rate based on one or both of the first duration and the second duration. This second baud rate is used by the receiving end 102 to receive the signal sent by the transmitting end 101. The receiving end 102 can receive the signal sent by the transmitting end based on the second baud rate. Through the communication baud rate adaptation method provided in this application embodiment, the baud rate of the receiving end can be determined according to the signal sent by the transmitting end, which can achieve adaptive matching of the receiving end baud rate and help ensure normal communication between the transmitting end and the receiving end.
[0037] It is understood that the schematic diagram of the communication baud rate adaptation system described in the embodiments of this application is for the purpose of more clearly illustrating the communication baud rate adaptation method of the embodiments of this application, and does not constitute a limitation on the communication baud rate adaptation method provided in the embodiments of this application. For example, the communication baud rate adaptation method provided in the embodiments of this application can be executed not only by the receiving end 102, but also by other devices different from the receiving end 102 that can communicate with the sending end 101. As those skilled in the art will know, the number of sending ends 101 and receiving ends 102 in Figure 1 is merely illustrative. Any number of devices can be configured according to business implementation needs. Furthermore, with the evolution of system architecture and the emergence of new business scenarios, the communication baud rate adaptation method provided in the embodiments of this application is also applicable to similar technical problems.
[0038] Please refer to Figure 2, which is a schematic flowchart of a communication baud rate adaptation method exemplarily provided in this application. This communication baud rate adaptation method can be implemented by the aforementioned receiver 102, or by other devices capable of implementing the same method. The following description uses the implementation of the communication baud rate adaptation method by the aforementioned receiver 102 as an example. The flow of the communication baud rate adaptation method provided in this embodiment includes, but is not limited to:
[0039] S201, Receive the communication negotiation signal sent by the transmitting end based on the first baud rate.
[0040] In this embodiment, the transmitting end and the receiving end can be connected via a data line, and the transmitting end can send signals to the receiving end via the data line. During communication, it is generally desirable for the baud rate of the transmitting end to match the baud rate of the receiving end to ensure signal transmission rate and effectiveness. However, in practical applications, the receiving end often cannot accurately obtain the baud rate of the transmitting end, and the signal sent by the transmitting end may be a standard waveform or a non-standard waveform. This makes it impossible for the receiving end to determine a reasonable baud rate, resulting in low transmission efficiency between the transmitting and receiving ends and potentially data loss during transmission. The method provided in this application can be used to achieve adaptive matching of the receiving end's baud rate. Specifically, the receiving end can receive a communication negotiation signal sent by the transmitting end based on a first baud rate. This communication negotiation signal can be a signal sent by the transmitting end before sending a signal containing data to establish a communication connection and negotiate communication parameters, or it can be a signal containing data sent by the transmitting end. The communication negotiation signal can include a start signal and a stop signal.
[0041] It should be noted that the sending and receiving ends can communicate based on the UART communication protocol. UART (Universal Asynchronous Receiver / Transmitter) is a commonly used serial communication protocol, widely used in communication between microcontrollers or various embedded devices.
[0042] S202. Determine the first duration based on the duration of the start signal included in the communication negotiation signal.
[0043] In this embodiment, the receiving end can receive a communication negotiation signal, which includes a start signal and a stop signal. The start signal has a low-level waveform, and the stop signal has a high-level waveform. When receiving the communication negotiation signal, the receiving end can determine a first duration based on the duration of the start signal in the communication negotiation signal. The first duration can reflect the baud rate of the signal transmitted by the transmitting end. The method provided in this embodiment can determine the first duration, providing effective data support for achieving baud rate adaptation.
[0044] S203. Determine the second duration based on the duration of the termination signal included in the communication negotiation signal.
[0045] In this embodiment of the application, when receiving the communication negotiation signal, the receiving end can also determine the second duration based on the duration of the termination signal in the communication negotiation signal. The second duration can also reflect the baud rate of the signal transmitted by the sending end. The method provided in this embodiment of the application can determine the second duration, providing effective data support for achieving baud rate adaptation.
[0046] Please refer to Figure 3, which is a schematic diagram of a communication negotiation signal provided by example in this application. The transmitting end can send a communication negotiation signal to the receiving end based on a first baud rate. The communication negotiation signal can be a UART data frame, which may include a start bit (i.e., start signal), data bits, a parity bit, and a stop bit (i.e., stop signal). The duration of the signal in the data frame can be associated with the first baud rate of the transmitting end. As shown in Figure 3, when in an idle state, the UART transmission bus between the transmitting and receiving ends is at a high level. When data transmission is required, the transmitting end sends a start bit, which is low (logic "0"). After sending the start bit, the transmitting end can send data bits (Figure 3 shows 8 data bits, representing "11001100". The LSB identifier precedes the MSB identifier, indicating that the data bits are sent from low to high. Therefore, the information sent in Figure 3 is actually "00110011", which is the ASCII code of the hexadecimal number 0x33). After sending the data bits, the transmitting end can send a stop bit, which is high (logic "1"). After sending the stop bit, the UART transmission bus enters an idle state. Upon receiving the communication negotiation signal, the receiving end can determine a first duration based on the duration of the start bit and a second duration based on the duration of the stop bit. The method provided in this application embodiment can determine the first and second durations, which is beneficial for subsequent adaptive matching of the receiving end's baud rate.
[0047] S204. Determine a second baud rate based on one or both of the first duration and the second duration, wherein the second baud rate is used to receive the signal from the transmitting end.
[0048] In this embodiment, the receiving end can determine a second baud rate based on one or both of a first duration and a second duration. This second baud rate can be used by the receiving end to receive signals transmitted by the transmitting end. The method provided in this embodiment allows the receiving end to determine its baud rate based on the signals transmitted by the transmitting end, ensuring that the baud rate of the transmitting end matches the baud rate of the receiving end. This improves the data transmission rate between the transmitting and receiving ends and avoids data transmission failures due to baud rate mismatch.
[0049] In one or more embodiments, the determination of the second baud rate based on one or both of the first duration and the second duration can be achieved by: determining the starting baud rate as the second baud rate, or determining the ending baud rate as the second baud rate; wherein the starting baud rate is calculated based on the baud rate of the first duration, and the ending baud rate is calculated based on the baud rate of the second duration. After determining the starting baud rate using the first duration and the ending baud rate using the second duration, the receiving end can determine either the starting baud rate or the ending baud rate as the second baud rate. Through the method provided in this application, the baud rate of the receiving end can be determined based on the signal sent by the transmitting end, enabling baud rate adaptation and ensuring normal communication between the transmitting and receiving ends.
[0050] In one or more embodiments, the determination of the second baud rate based on one or both of the first duration and the second duration can be achieved by: averaging the start baud rate and the end baud rate to obtain an average baud rate; and determining the average baud rate as the second baud rate. The start baud rate is calculated based on the baud rate of the first duration, and the end baud rate is calculated based on the baud rate of the second duration. After determining the start baud rate using the first duration and the end baud rate using the second duration, the receiving end can average the start baud rate and the end baud rate to obtain the average baud rate, and determine the average baud rate as the receiving end's baud rate. Through the method provided in this application, the receiving end's baud rate can be determined based on the signal transmitted by the transmitting end, enabling baud rate adaptation and ensuring normal communication between the transmitting and receiving ends.
[0051] Please refer to Figure 4, which is a schematic diagram of a communication baud rate adaptation method exemplarily provided in this application. The communication baud rate adaptation method shown in Figure 4 may include the following steps: S401, receiving a communication negotiation signal sent by a transmitting end. The transmitting end may send a communication negotiation signal including a start signal and a stop signal to the receiving end. The communication negotiation signal includes a start signal and a stop signal; S402, determining a first duration based on the duration of the start signal, and determining a second duration based on the duration of the stop signal; the receiving end may determine the first duration based on the duration of the start signal included in the communication negotiation signal, and determine the second duration based on the duration of the stop signal included in the communication negotiation signal; S403, determining a second baud rate based on either the first duration or the second duration; the receiving end may determine the second baud rate based on either the first duration or the second duration; S404, determining the second baud rate based on both the first duration and the second duration; the receiving end may also determine the second baud rate based on either the first duration or the second duration. Through the method provided in this application embodiment, the baud rate of the receiving end can be determined based on the signal sent by the transmitting end, achieving automated adaptation of the communication baud rate and effectively ensuring normal communication between the transmitting end and the receiving end.
[0052] The communication baud rate adaptation method provided in this application embodiment can receive the communication negotiation signal sent by the transmitting end and determine the first duration and the second duration. The baud rate of the receiving end can be determined according to one or both of the first duration and the second duration, realizing the automatic configuration of the receiving end baud rate and improving communication efficiency. The method of determining the receiving end baud rate in two different ways has good universality and can be applied to a variety of different application scenarios. It can accurately determine the receiving end baud rate that matches the transmitting end baud rate, thereby ensuring normal communication between the transmitting end and the receiving end, improving communication efficiency, and avoiding data transmission failure due to baud rate mismatch.
[0053] Please refer to Figure 5, which is a flowchart illustrating another communication baud rate adaptation method exemplarily provided in this application. This communication baud rate adaptation method can be implemented by the aforementioned receiver 102, or by other communication devices or modules. The flow of the communication baud rate adaptation method provided in this embodiment includes, but is not limited to:
[0054] S501, Receive the communication negotiation signal sent by the transmitting end based on the first baud rate.
[0055] In this embodiment, the transmitting end can send a communication negotiation signal to the receiving end based on a first baud rate. The transmitting end and the receiving end can be connected via a data line, and they can communicate based on the UART communication protocol. In practical applications, the baud rate preset by the transmitting end may differ from the actual baud rate used when transmitting the signal. For example, the preset baud rate of the transmitting end may be 115200, and the preset signal waveform of the transmitted signal may be a standard waveform. However, due to equipment malfunctions (such as equipment aging), the actual signal waveform transmitted by the transmitting end may be a non-standard waveform, and the baud rate of the transmitted signal may also differ from the preset baud rate. The method provided in this application can be used to obtain the communication negotiation signal sent by the transmitting end, and the baud rate of the receiving end can be determined based on the communication negotiation signal. The method provided in this embodiment can obtain the communication protocol signal sent by the transmitting end, which is beneficial for subsequent adaptive baud rate control of the receiving end.
[0056] S502. Determine a first duration based on the duration of the start signal included in the communication negotiation signal, and determine a second duration based on the duration of the termination signal included in the communication negotiation signal.
[0057] In this embodiment, the communication negotiation signal may include a start signal and a stop signal. The receiving end can determine a first duration based on the duration of the start signal and a second duration based on the duration of the stop signal. For example, if the duration of the start signal in the communication negotiation signal is 8.6 microseconds, then the first duration can be determined to be 8.6 microseconds; if the duration of the stop signal in the communication negotiation signal is 8.5 microseconds, then the second duration can be determined to be 8.4 microseconds. The method provided in this embodiment allows for the determination of both the first and second durations, which is beneficial for subsequently determining the waveform of the signal transmitted by the transmitting end and for subsequently determining the baud rate of the receiving end.
[0058] S503. Determine the waveform type of the communication negotiation signal based on the first duration and the second duration, wherein the waveform type is used to indicate whether the waveform of the communication negotiation signal is a standard waveform.
[0059] In this embodiment, during data transmission, when the waveform of the signal transmitted by the transmitting end is a standard waveform, the baud rate of the signal transmitted by the transmitting end is relatively stable (or fluctuates little), and the duration difference of various signals (e.g., start signal, stop signal, etc.) in the signal transmitted by the transmitting end is small; when the waveform of the signal transmitted by the transmitting end is a non-standard waveform, the baud rate of the signal transmitted by the transmitting end is not very stable (or fluctuates greatly), and the duration difference of various signals (e.g., start signal, stop signal, etc.) in the signal transmitted by the transmitting end is large. Based on this, the receiving end can determine the waveform type of the communication negotiation signal according to the first duration corresponding to the start signal and the second duration corresponding to the stop signal. This waveform type can indicate whether the waveform of the communication negotiation signal is a standard waveform, and can also indicate to some extent whether the waveform of the signal transmitted by the transmitting end is a standard waveform.
[0060] When the waveform of the communication negotiation signal is a standard waveform, the difference between the duration of the start signal and the duration of the end signal is small. When the waveform of the communication negotiation signal is a non-standard waveform, the difference between the duration of the start signal and the duration of the end signal is large. Therefore, the receiving end can determine the waveform type of the communication negotiation signal based on the first duration and the second duration. This waveform type can be used to indicate whether the waveform of the communication negotiation signal is a standard waveform, and can also, to some extent, indicate whether the waveform of the signal sent by the transmitting end is a standard waveform. The method provided in this application allows the waveform type of the signal sent by the transmitting end to be determined based on the signal duration. This facilitates the subsequent determination of the receiving end's baud rate using different methods based on different waveform types, thereby achieving communication baud rate adaptation.
[0061] In one or more embodiments, determining the waveform type of the communication negotiation signal based on a first duration and a second duration can be achieved by: calculating the baud rate for the first duration to obtain a starting baud rate; calculating the baud rate for the second duration to obtain a ending baud rate; determining the baud rate difference between the starting and ending baud rates; and determining the waveform type of the communication negotiation signal based on the starting baud rate, the ending baud rate, the baud rate difference, and a difference threshold. The baud rate and signal duration can be calculated as follows: baud rate = 1 / signal duration. This calculation method can be used to calculate the baud rate for the first duration to obtain the starting baud rate, i.e., the baud rate corresponding to the starting signal; the same method can be used to calculate the baud rate for the second duration to obtain the ending baud rate, i.e., the baud rate corresponding to the ending signal. The baud rate difference between the starting and ending baud rates can be determined. For standard waveforms, the difference between the start baud rate and the stop baud rate in a communication negotiation signal (or data frame) is generally small. However, for non-standard waveforms, the difference between the start baud rate and the stop baud rate in a communication negotiation signal (or data frame) is generally large. Therefore, the waveform type of the communication negotiation signal can be determined based on the start baud rate, the stop baud rate, the baud rate difference, and a difference threshold. The method provided in this application allows the waveform type of the signal transmitted by the transmitting end to be determined using the difference between the start baud rate and the stop baud rate. This facilitates the subsequent determination of the receiver's baud rate based on the waveform type, enabling accurate adaptive baud rate control at the receiver.
[0062] In one or more embodiments, the implementation of determining the waveform type of the communication negotiation signal based on the start baud rate, the end baud rate, the baud rate difference, and the difference threshold can be as follows: when the first difference value corresponding to the baud rate difference and the start baud rate is greater than the difference threshold, or the second difference value corresponding to the baud rate difference and the end baud rate is greater than the difference threshold, the waveform type of the communication negotiation signal is determined to be a non-standard waveform; when the first difference value corresponding to the baud rate difference and the start baud rate is less than or equal to the difference threshold, and the second difference value corresponding to the baud rate difference and the end baud rate is less than or equal to the difference threshold, the waveform type of the communication negotiation signal is determined to be a standard waveform.
[0063] The baud rate difference between the first baud rate and the starting baud rate, and the baud rate difference between the second baud rate and the ending baud rate, can both indicate the baud rate fluctuation of the signal sent by the transmitter. When the first or second difference value is greater than the difference threshold, it indicates that the waveform of the communication negotiation signal is a non-standard waveform, and it can also determine to some extent that the waveform of the signal sent by the transmitter is a non-standard waveform. For example: If the receiving end determines that the first duration is 9.1 microseconds (μs) and the second duration is 8.1 microseconds (μs), then based on the first duration, the starting baud rate can be determined to be 1s / 9.1μs = 109800, and based on the second duration, the ending baud rate can be determined to be 1s / 8.1μs = 123456. The baud rate difference is 123456 - 109800 = 13656. The first difference value corresponding to the baud rate difference and the starting baud rate can be 13656 / 109800 = 12%. The second difference value corresponding to the baud rate difference and the ending baud rate can be 13656 / 123456 = 11%. If the difference threshold is 5%, then it can be determined that both the first and second difference values are greater than the difference threshold, and the waveform type of the communication negotiation signal is a non-standard waveform.
[0064] When the first difference value is less than or equal to the difference threshold, and the second difference value is less than or equal to the difference threshold, the receiver can determine that the waveform type of the communication negotiation signal is a standard waveform, and can also determine to some extent that the waveform of the signal sent by the transmitter is a standard waveform.
[0065] In practical applications, the difference threshold corresponding to the standard waveform is generally 5%. That is, in communication negotiation signals with a standard waveform, the first difference value corresponding to the start baud rate and the second difference value corresponding to the end baud rate are generally less than or equal to 5%. Therefore, the first difference value, the second difference value, and the difference threshold can be compared, and the waveform type of the communication negotiation signal sent by the transmitting end can be determined based on the comparison result. The method provided in this application embodiment can accurately determine the waveform type of the signal sent by the transmitting end using the start baud rate and the end baud rate. This is beneficial for subsequently determining the baud rate of the receiving end based on the waveform type, avoiding communication anomalies caused by the mismatch between the preset signal waveform and the actual signal waveform at the transmitting end, and effectively ensuring normal communication between the transmitting end and the receiving end.
[0066] S504. Using the waveform type of the communication negotiation signal, determine a second baud rate based on one or both of the first duration and the second duration, wherein the second baud rate is used to receive the signal from the transmitting end.
[0067] In this embodiment, the receiving end can utilize the waveform type of the communication negotiation signal and determine the second baud rate (i.e., the receiving end's baud rate) based on one or both of the first and second durations. This ensures that the receiving end can determine a baud rate that matches the sending end's baud rate regardless of whether the signal sent by the sending end is a standard waveform. The method provided in this embodiment can determine the waveform type of the signal sent by the sending end based on the communication negotiation signal and determine the receiving end's baud rate based on different waveform types. This approach is compatible with both standard and non-standard waveforms, offering good versatility. It also effectively solves the problem of communication anomalies caused by a mismatch between the sending end's preset baud rate and the actual baud rate, ensuring normal communication between the sending and receiving ends.
[0068] In one or more embodiments, the implementation of determining the second baud rate based on one or both of the first duration and the second duration using the waveform type of the communication negotiation signal can be as follows: when the waveform type of the communication negotiation signal is a standard waveform, the second baud rate is determined based on the first duration or the second duration; when the waveform type of the communication negotiation signal is a non-standard waveform, the second baud rate is determined based on the first duration and the second duration.
[0069] When the waveform type of the communication negotiation signal is a standard waveform, it indicates that the baud rate of the signal sent by the transmitting end is relatively stable, and the duration difference of various signals (such as start signal, stop signal, etc.) in the signal sent by the transmitting end is small. Either the first duration or the second duration can be used to determine the baud rate of the transmitting end. Therefore, the receiving end can determine the second baud rate based on the first duration or the second duration.
[0070] When the waveform of the communication negotiation signal is non-standard, it indicates that the baud rate of the signal transmitted by the transmitting end is not very stable, and the duration of various signals (such as start signals, stop signals, etc.) in the transmitted signal varies greatly. The second baud rate of the receiving end can be determined by simultaneously using the first duration and the second duration, thus making the second baud rate closer to the first baud rate of the transmitting end. Through the method provided in this application, different methods can be used to determine the baud rate of the receiving end for different waveforms of the transmitting end, thereby effectively achieving baud rate adaptation at the receiving end and ensuring normal communication between the transmitting and receiving ends.
[0071] In one or more embodiments, the implementation of determining the second baud rate based on one or both of the first duration and the second duration can be: determining the starting baud rate as the second baud rate, or determining the ending baud rate as the second baud rate; wherein the starting baud rate is obtained by baud rate calculation based on the first duration, and the ending baud rate is obtained by baud rate calculation based on the second duration. The implementation methods for determining the starting and ending baud rates can refer to the implementation methods in the above embodiments. When the receiving end determines that the waveform type of the communication negotiation signal is a standard waveform, and the starting baud rate corresponding to the starting signal and the ending baud rate corresponding to the ending signal in the communication negotiation signal match the first baud rate of the transmitting end (e.g., the difference is small), the receiving end can directly determine the starting baud rate as the second baud rate, or determine the ending baud rate as the second baud rate. For example: if the receiving end determines that the waveform type of the communication negotiation signal is a standard waveform, and the starting baud rate is 115200 and the ending baud rate is 115201, the receiving end can directly determine the starting baud rate or the ending baud rate as the second baud rate. The method provided in this application embodiment can determine the receiving baud rate that matches the transmitting baud rate when the waveform type of the signal transmitted by the transmitting end is a standard waveform, thereby ensuring normal communication between the receiving end and the transmitting end.
[0072] In one or more embodiments, the determination of the second baud rate based on one or both of the first duration and the second duration can be achieved by: averaging the start baud rate and the end baud rate to obtain an average baud rate; and determining the average baud rate as the second baud rate. The start baud rate is calculated based on the baud rate of the first duration, and the end baud rate is calculated based on the baud rate of the second duration. When the waveform type of the communication negotiation signal is a non-standard waveform, the difference between the start baud rate and the end baud rate is large. Therefore, averaging the start baud rate and the end baud rate can be calculated to obtain an average baud rate; and determining the average baud rate as the second baud rate will reduce the difference between the second baud rate and the first baud rate, thereby achieving baud rate matching between the receiving end and the transmitting end. For example, if the first baud rate of the transmitting end is 115200, and the waveform type of the communication negotiation signal is a non-standard waveform, and the starting baud rate determined by the communication negotiation signal is 109800 and the ending baud rate is 123456, then the receiving end can calculate the average baud rate by averaging the starting and ending baud rates, resulting in an average baud rate of 116628. The difference between the average baud rate and the first baud rate is (116628-115200) / 115200 = 1%. This difference rate is within an acceptable range (the acceptable range can be 5%), so the average baud rate can be determined as the second baud rate. Through the method provided in this application embodiment, when the waveform type of the signal transmitted by the transmitting end is a non-standard waveform, a receiving end baud rate matching the transmitting end baud rate can be determined, thereby ensuring normal communication between the receiving end and the transmitting end.
[0073] In one or more embodiments, the communication baud rate adaptation method provided in this application may further include the following steps: receiving a verification signal sent by a transmitter based on a second baud rate; parsing the verification signal to obtain a parsed character; and determining that communication between the transmitter and receiver is normal when the parsed character meets the verification requirements. After determining the second baud rate, the receiver can receive the verification signal sent by the transmitter based on the second baud rate. The receiver can parse the received verification signal to obtain a parsed character. When the parsed character meets the verification requirements, it can be determined that communication between the transmitter and receiver is normal; when the parsing of the received verification signal fails, it can be determined that communication between the transmitter and receiver is abnormal; or when the parsed character does not meet the verification requirements, it can be determined that communication between the transmitter and receiver is abnormal. The receiver can then adjust the second baud rate, and the adjusted second baud rate can be used by the receiver to receive signals sent by the transmitter. For example, after receiving the communication negotiation signal sent by the transmitting end, the receiving end can determine the second baud rate based on the communication negotiation signal. The receiving end then receives a verification signal sent by the transmitting end based on the second baud rate. This verification signal may include the signal corresponding to the AT character. The receiving end can parse the verification signal. If parsing fails, it indicates a communication abnormality between the transmitting and receiving ends. If the parsed character is not an AT character, it also indicates a communication abnormality between the transmitting and receiving ends. If the parsed character is an AT character, it indicates normal communication between the transmitting and receiving ends. The method provided in this application embodiment allows for the determination of the received end baud rate, which helps to further ensure normal communication between the transmitting and receiving ends.
[0074] In one or more embodiments, when a communication anomaly is determined between the sender and receiver, the receiver may send a renegotiation signal to the sender, causing the sender to resend the communication negotiation signal to the receiver. The receiver then determines a third baud rate based on the resent communication negotiation signal using the communication baud rate adaptation method provided in this application. This third baud rate can be used to receive signals sent by the sender. Alternatively, the receiver may adjust the second baud rate based on other signals (e.g., data signals) included in the communication negotiation signal sent by the sender based on the first baud rate.
[0075] Please refer to Figure 6, which is a schematic diagram of another communication baud rate adaptation method provided by this application. The communication baud rate adaptation method shown in Figure 6 may include the following steps: S601, sending a communication negotiation signal to the receiving end; the sending end may send the communication negotiation signal to the receiving end based on a first baud rate, the communication negotiation signal including a start signal and a stop signal. S602, determining a first duration based on the duration of the start signal; the receiving end may determine the first duration based on the duration of the start signal. S603, determining a second duration based on the duration of the stop signal; the receiving end may also determine the second duration based on the duration of the stop signal. S604, calculating the start baud rate based on the first duration; the receiving end may calculate the start baud rate based on the first duration. S605, calculating the stop baud rate based on the second duration; the receiving end may also calculate the stop baud rate based on the second duration. S606, determining the waveform type of the communication negotiation signal based on the start baud rate and the stop baud rate; the receiving end may determine the waveform type (standard waveform or non-standard waveform) of the communication negotiation signal based on the start baud rate and the stop baud rate. S607. Determine whether the waveform type of the communication negotiation signal is a standard waveform; the receiving end can determine whether the waveform type of the communication negotiation signal is a standard waveform. If it is a standard waveform, the receiving end can execute step S608. S608. Determine the start baud rate or the end baud rate as the second baud rate; the receiving end determines the start baud rate or the end baud rate as the second baud rate. If not (i.e., the waveform type of the communication negotiation signal is a non-standard waveform), the receiving end can execute step S609. S609. Calculate the average baud rate by averaging the start baud rate and the end baud rate, and determine the average baud rate as the second baud rate; the receiving end can calculate the average baud rate by averaging the start baud rate and the end baud rate, and determine the average baud rate as the second baud rate. S610. Receive the verification signal sent by the sending end based on the second baud rate, and parse the verification signal to obtain the parsed character; the receiving end can receive the verification signal sent by the sending end based on the second baud rate, and parse the verification signal to obtain the parsed character. S611. When the parsed character meets the verification requirements, it is determined that the communication between the sending end and the receiving end is normal; when the receiving end determines that the parsed character meets the verification requirements, it indicates that the communication between the sending end and the receiving end is normal, and subsequent communication can continue. The method provided in this application embodiment can determine the baud rate of the receiving end based on the signal sent by the sending end, and is compatible with various waveform types, applicable to various scenarios, effectively ensuring normal communication between the sending end and the receiving end.
[0076] It should be understood that although the steps shown in Figures 2, 4, 5, and 6 are displayed sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the sub-steps or stages of other steps.
[0077] The communication baud rate adaptation method provided in this application embodiment can receive the communication negotiation signal sent by the transmitting end and determine the first duration and the second duration. The baud rate of the receiving end can be determined based on one or both of the first duration and the second duration, realizing automatic adaptation of the receiving end baud rate and improving communication efficiency. The first duration and the second duration can determine whether the waveform of the signal sent by the transmitting end is a standard waveform, and different methods can be used to determine the baud rate of the receiving end for different waveforms, which is compatible with two possible situations (the case where the signal sent by the transmitting end is a standard waveform and the case where the signal sent by the transmitting end is a non-standard waveform), and has good universality, which can be applied to a variety of different application scenarios. It can accurately determine the receiving end baud rate that matches the transmitting end baud rate, realize adaptive baud rate matching, thereby ensuring normal communication between the transmitting end and the receiving end, improving communication efficiency, and avoiding data transmission failure due to baud rate mismatch.
[0078] Please refer to Figure 7, which is a structural block diagram of a communication baud rate adaptation module provided by this application. The module includes:
[0079] The receiving unit 701 is used to receive the communication negotiation signal sent by the transmitting end based on the first baud rate;
[0080] The determining unit 702 is configured to determine a first duration based on the duration of the start signal included in the communication negotiation signal;
[0081] The determining unit 702 is further configured to determine a second duration based on the duration of the termination signal included in the communication negotiation signal;
[0082] Processing unit 703 is configured to determine a second baud rate based on one or both of the first duration and the second duration, the second baud rate being used to receive signals from the transmitting end.
[0083] In one or more embodiments, when the processing unit 703 determines the second baud rate based on one or both of the first duration and the second duration, it is specifically configured to: determine the waveform type of the communication negotiation signal based on the first duration and the second duration, wherein the waveform type is used to indicate whether the waveform of the communication negotiation signal is a standard waveform; and determine the second baud rate based on one or both of the first duration and the second duration using the waveform type of the communication negotiation signal.
[0084] In one or more embodiments, when the processing unit 703 determines the second baud rate based on one or both of the first duration and the second duration using the waveform type of the communication negotiation signal, it is specifically configured to: determine the second baud rate based on the first duration or the second duration when the waveform type of the communication negotiation signal is a standard waveform; and determine the second baud rate based on the first duration and the second duration when the waveform type of the communication negotiation signal is a non-standard waveform.
[0085] In one or more embodiments, when the processing unit 703 determines the waveform type of the communication negotiation signal based on the first duration and the second duration, it is specifically configured to: calculate the baud rate for the first duration to obtain a start baud rate; calculate the baud rate for the second duration to obtain a stop baud rate; determine the baud rate difference between the start baud rate and the stop baud rate; and determine the waveform type of the communication negotiation signal based on the start baud rate, the stop baud rate, the baud rate difference, and the difference threshold.
[0086] In one or more embodiments, when the processing unit 703 determines the waveform type of the communication negotiation signal based on the start baud rate, the end baud rate, the baud rate difference, and the difference threshold, it is specifically configured to: determine that the waveform type of the communication negotiation signal is a non-standard waveform when the first difference value corresponding to the baud rate difference and the start baud rate is greater than the difference threshold, or the second difference value corresponding to the baud rate difference and the end baud rate is greater than the difference threshold; and determine that the waveform type of the communication negotiation signal is a standard waveform when the first difference value corresponding to the baud rate difference and the start baud rate is less than or equal to the difference threshold, and the second difference value corresponding to the baud rate difference and the end baud rate is less than or equal to the difference threshold.
[0087] In one or more embodiments, when the processing unit 703 determines the second baud rate based on one or both of the first duration and the second duration, it is specifically configured to: determine the starting baud rate as the second baud rate, or determine the ending baud rate as the second baud rate; wherein the starting baud rate is obtained by baud rate calculation based on the first duration, and the ending baud rate is obtained by baud rate calculation based on the second duration.
[0088] In one or more embodiments, when the processing unit 703 determines the second baud rate based on one or both of the first duration and the second duration, it is specifically configured to: calculate the average of the start baud rate and the end baud rate to obtain an average baud rate; and determine the average baud rate as the second baud rate; wherein the start baud rate is obtained by baud rate calculation based on the first duration, and the end baud rate is obtained by baud rate calculation based on the second duration.
[0089] It is understood that the functions of each functional unit of the communication baud rate adaptation module in this application embodiment can be specifically implemented according to the communication baud rate adaptation method in the above-described communication baud rate adaptation method embodiment. The specific implementation process can be referred to the relevant description in the above-described communication baud rate adaptation method embodiment, and will not be repeated here. In this application embodiment, the terms "module" and "system" are intended to represent computer-related entities, which can be hardware, a hardware and software assembly, software, or software in execution. For example, a component can be, but is not limited to, a process running on a processor, a processor, an object, executable code, an executing thread, a program, and / or a computer. For illustration, an application running on a server and the server itself can both be components. One or more components can reside in a process and / or an executing thread, and components can be located within a computer and / or distributed between two or more computers.
[0090] The communication baud rate adaptation module provided in this application embodiment can receive the communication negotiation signal sent by the transmitting end and determine the first duration and the second duration. It can determine the baud rate of the receiving end based on one or both of the first and second durations, achieving automatic baud rate adaptation and improving communication efficiency. It can determine whether the waveform of the signal sent by the transmitting end is a standard waveform based on the first and second durations, and can use different methods to determine the baud rate of the receiving end for different waveforms, accommodating two possible situations (the case where the signal sent by the transmitting end is a standard waveform and the case where the signal sent by the transmitting end is a non-standard waveform), exhibiting good versatility and applicable to various application scenarios. It can accurately determine the receiving end baud rate that matches the transmitting end baud rate, achieving adaptive baud rate matching, thereby ensuring normal communication between the transmitting and receiving ends, improving communication efficiency, and avoiding data transmission failures due to baud rate mismatch.
[0091] Please refer to Figure 8, which is a structural block diagram of a computer device exemplarily provided in this application. The computer device shown in Figure 8 can be the receiver 102 in Figure 1 above. The computer device described in this application embodiment includes: one or more processors (one or more processors are represented as processor 801) and memory 802. The processor 801 and memory 802 can be connected via a bus or other means; this application embodiment takes a bus connection as an example.
[0092] The processor 801 (or CPU, Central Processing Unit) is the computing and control core of the computer device. It can parse various instructions and process various data within the computer device. For example, the CPU can parse power-on / off commands sent by the user and control the computer device to perform power-on / off operations; it can also transmit various interactive data between internal structures of the computer device, and so on. The memory 802 is the storage device in the computer device, used to store programs and data. It is understood that the memory 802 here can include the computer device's built-in memory, or it can include extended memory supported by the computer device. The memory 802 provides storage space for the computer device's operating system, which may include, but is not limited to, Android, iOS, Windows Phone, etc., and this application does not limit this.
[0093] In this embodiment, the processor 801 performs the following operations by running the executable program code in the memory 802:
[0094] The receiving end sends a communication negotiation signal based on the first baud rate;
[0095] The first duration is determined based on the duration of the initiation signal included in the communication negotiation signal;
[0096] The second duration is determined based on the duration of the termination signal included in the communication negotiation signal;
[0097] A second baud rate is determined based on one or both of the first duration and the second duration, and the second baud rate is used to receive the signal from the transmitting end.
[0098] In one or more embodiments, when the processor 801 determines the second baud rate based on one or both of the first duration and the second duration, it is specifically configured to: determine the waveform type of the communication negotiation signal based on the first duration and the second duration, wherein the waveform type is used to indicate whether the waveform of the communication negotiation signal is a standard waveform; and determine the second baud rate based on one or both of the first duration and the second duration using the waveform type of the communication negotiation signal.
[0099] In one or more embodiments, when the processor 801 determines the second baud rate based on one or both of the first duration and the second duration using the waveform type of the communication negotiation signal, it is specifically configured to: determine the second baud rate based on the first duration or the second duration when the waveform type of the communication negotiation signal is a standard waveform; and determine the second baud rate based on the first duration and the second duration when the waveform type of the communication negotiation signal is a non-standard waveform.
[0100] In one or more embodiments, when the processor 801 determines the waveform type of the communication negotiation signal based on the first duration and the second duration, it is specifically configured to: calculate the baud rate for the first duration to obtain a start baud rate; calculate the baud rate for the second duration to obtain a stop baud rate; determine the baud rate difference between the start baud rate and the stop baud rate; and determine the waveform type of the communication negotiation signal based on the start baud rate, the stop baud rate, the baud rate difference, and a difference threshold.
[0101] In one or more embodiments, when the processor 801 determines the waveform type of the communication negotiation signal based on the start baud rate, the end baud rate, the baud rate difference, and the difference threshold, it specifically performs the following: when the first difference value between the baud rate difference and the start baud rate is greater than the difference threshold, or the second difference value between the baud rate difference and the end baud rate is greater than the difference threshold, it determines that the waveform type of the communication negotiation signal is a non-standard waveform; when the first difference value between the baud rate difference and the start baud rate is less than or equal to the difference threshold, and the second difference value between the baud rate difference and the end baud rate is less than or equal to the difference threshold, it determines that the waveform type of the communication negotiation signal is a standard waveform.
[0102] In one or more embodiments, when the processor 801 determines the second baud rate based on one or both of the first duration and the second duration, it is specifically configured to: determine the starting baud rate as the second baud rate, or determine the ending baud rate as the second baud rate; wherein the starting baud rate is obtained by baud rate calculation based on the first duration, and the ending baud rate is obtained by baud rate calculation based on the second duration.
[0103] In one or more embodiments, when the processor 801 determines the second baud rate based on one or both of the first duration and the second duration, it is specifically configured to: calculate the average of the start baud rate and the end baud rate to obtain an average baud rate; and determine the average baud rate as the second baud rate; wherein the start baud rate is obtained by baud rate calculation based on the first duration, and the end baud rate is obtained by baud rate calculation based on the second duration.
[0104] In specific implementations, the processor 801 and memory 802 described in the embodiments of this application can execute the implementation of the receiving end described in the communication baud rate adaptation method provided in the embodiments of this application, or the implementation of the communication baud rate adaptation module provided in the embodiments of this application, which will not be repeated here.
[0105] The computer device provided in this application embodiment can receive communication negotiation signals sent by the transmitting end and determine a first duration and a second duration. It can determine the baud rate of the receiving end based on one or both of the first and second durations, achieving automatic baud rate adaptation and improving communication efficiency. It can determine whether the waveform of the signal sent by the transmitting end is a standard waveform based on the first and second durations, and can use different methods to determine the baud rate of the receiving end for different waveforms, accommodating two possible situations (the case where the signal sent by the transmitting end is a standard waveform and the case where the signal sent by the transmitting end is a non-standard waveform), exhibiting good versatility and applicable to various application scenarios. It can accurately determine the receiving end baud rate that matches the transmitting end baud rate, achieving adaptive baud rate matching, thereby ensuring normal communication between the transmitting and receiving ends, improving communication efficiency, and avoiding data transmission failures due to baud rate mismatch.
[0106] This application also provides one or more non-volatile readable storage media storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, they can cause the one or more processors to perform the steps in the various method embodiments of this application to implement the communication baud rate adaptation method provided in this application. The specific implementation method can be found in the foregoing description and will not be repeated here.
[0107] This application also provides a computer program product, which includes a computer program or computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer program or computer instructions from the computer-readable storage medium and executes the computer program or computer instructions, causing the computer device to perform the steps in the various method embodiments of this application to implement the communication baud rate adaptation method provided in this application. The specific implementation method can be found in the foregoing description and will not be repeated here.
[0108] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0109] In the above embodiments, the descriptions of each embodiment have their own emphasis. Parts not described in detail in a certain embodiment can be referred to in the relevant descriptions of other embodiments. The technical solutions of this application, in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which can be a computer, server, or network device, specifically a processor in the computer device) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium may include: a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM), and other media capable of storing program code.
[0110] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, it should be understood that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A communication baud rate adaptation method, the method comprising: The receiving end sends a communication negotiation signal based on the first baud rate; The first duration is determined based on the duration of the initiation signal included in the communication negotiation signal; The second duration is determined based on the duration of the termination signal included in the communication negotiation signal; A second baud rate is determined based on one or both of the first duration and the second duration, and the second baud rate is used to receive the signal from the transmitting end.
2. The method as described in claim 1, characterized in that, Determining the second baud rate based on one or both of the first duration and the second duration includes: The waveform type of the communication negotiation signal is determined based on the first duration and the second duration, and the waveform type is used to indicate whether the waveform of the communication negotiation signal is a standard waveform; The second baud rate is determined based on one or both of the first duration and the second duration, using the waveform type of the communication negotiation signal.
3. The method as described in claim 2, characterized in that, The step of determining the second baud rate based on one or both of the first duration and the second duration using the waveform type of the communication negotiation signal includes: When the waveform type of the communication negotiation signal is a standard waveform, the second baud rate is determined according to the first duration or the second duration; When the waveform type of the communication negotiation signal is a non-standard waveform, the second baud rate is determined based on the first duration and the second duration.
4. The method as described in claim 2, characterized in that, Determining the waveform type of the communication negotiation signal based on the first duration and the second duration includes: The baud rate is calculated based on the first duration to obtain the initial baud rate; The baud rate is calculated for the second duration to obtain the termination baud rate; Determine the baud rate difference between the starting baud rate and the ending baud rate; The waveform type of the communication negotiation signal is determined based on the starting baud rate, the ending baud rate, the baud rate difference, and the difference threshold.
5. The method as described in claim 4, characterized in that, Determining the waveform type of the communication negotiation signal based on the starting baud rate, the ending baud rate, the baud rate difference, and the difference threshold includes: When the first difference value between the baud rate difference and the starting baud rate is greater than the difference threshold, or the second difference value between the baud rate difference and the ending baud rate is greater than the difference threshold, the waveform type of the communication negotiation signal is determined to be a non-standard waveform. When the first difference value between the baud rate difference and the starting baud rate is less than or equal to the difference threshold, and the second difference value between the baud rate difference and the ending baud rate is less than or equal to the difference threshold, the waveform type of the communication negotiation signal is determined to be a standard waveform.
6. The method according to any one of claims 1-5, characterized in that, Determining the second baud rate based on one or both of the first duration and the second duration includes: Set the starting baud rate to the second baud rate, or set the ending baud rate to the second baud rate; The starting baud rate is calculated based on the baud rate of the first duration, and the ending baud rate is calculated based on the baud rate of the second duration.
7. The method according to any one of claims 1-6, characterized in that, Determining the second baud rate based on one or both of the first duration and the second duration includes: The average baud rate is obtained by averaging the starting and ending baud rates. The average baud rate is determined as the second baud rate; The starting baud rate is calculated based on the baud rate of the first duration, and the ending baud rate is calculated based on the baud rate of the second duration.
8. A communication baud rate adaptation module, characterized in that, The module includes: The receiving unit is used to receive the communication negotiation signal sent by the sending end based on the first baud rate; A determining unit is configured to determine a first duration based on the duration of the start signal included in the communication negotiation signal; The determining unit is further configured to determine a second duration based on the duration of the termination signal included in the communication negotiation signal; The processing unit is configured to determine a second baud rate based on one or both of the first duration and the second duration, wherein the second baud rate is used to receive the signal from the transmitting end.
9. A computer device comprising a memory and one or more processors, the memory storing computer-readable instructions that, when executed by the processors, cause the one or more processors to perform the following steps: The receiving end sends a communication negotiation signal based on the first baud rate; The first duration is determined based on the duration of the initiation signal included in the communication negotiation signal; The second duration is determined based on the duration of the termination signal included in the communication negotiation signal; A second baud rate is determined based on one or both of the first duration and the second duration, and the second baud rate is used to receive the signal from the transmitting end.
10. One or more non-volatile readable storage media storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the following steps: The receiving end sends a communication negotiation signal based on the first baud rate; The first duration is determined based on the duration of the initiation signal included in the communication negotiation signal; The second duration is determined based on the duration of the termination signal included in the communication negotiation signal; A second baud rate is determined based on one or both of the first duration and the second duration, and the second baud rate is used to receive the signal from the transmitting end.
Citation Information
Patent Citations
Baud rate adaptive method for UART, device and UART
CN103684678A
UART Baud rate self-adaption method and system and SoC chip
CN114584276A
Baud rate adaptive communication method and device, storage medium and electronic equipment
CN117650958A
Communication baud rate adaptation method, module, equipment and readable storage medium
CN118316573A
Automatic speed detection for asynchronous serial communications
CN1293852A