A communication method and device with adaptive baud rate

By detecting and recording the level signal and time width of the serial communication device and calculating the target baud rate, the adaptive baud rate setting between the serial communication devices is realized, and the baud rate needs to be agreed in advance between the serial communication devices is solved. The problem has improved the convenience and timeliness of communication.

CN116015549BActive Publication Date: 2024-12-20CHONGQING XINLIANXIN INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211632694.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-19
Publication Date
2024-12-20
Estimated Expiration
2042-12-19

AI Technical Summary

Technical Problem

In the field of industrial control, baud rate needs to be agreed upon in advance between serial communication devices, resulting in poor communication convenience and timeliness.

Method used

By detecting the level signal sent by the second communication device, recording the time width of the data bits, and calculating the target baud rate based on the preset fixed waveform, the communication of adaptive baud rate is realized, and the pre-appointed baud rate is avoided.

Benefits of technology

It improves the convenience and timeliness of baud rate setting, supports baud rate setting in full range scenarios, has a wide range of application, small calculation amount, and low error rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116015549B_ABST
    Figure CN116015549B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a communication method and device for adaptive baud rate, which relates to the field of communication technology. The method includes: a first communication device detects a level signal sent by a second communication device. If the level signal is a start bit, the target waveform corresponding to the multiple data bits received after the start bit is detected, and the time width occupied by each data bit is recorded. If the target waveform is a preset fixed waveform, the target baud rate is determined based on the time width occupied by each of the recorded multiple data bits, and then the target baud rate is used to perform data transmission with the second communication device. The second communication device sends a character string of a fixed waveform to the first communication device, and the first communication device calculates the target baud rate based on the character string of the fixed waveform, so as to realize baud rate adaptation between the first communication device and the second communication device, without the need for the first communication device and the second communication device to pre-agree on the baud rate, thereby improving the convenience and timeliness of setting the baud rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of communication technology, and in particular to a communication method and device with adaptive baud rate. Background Art

[0002] In the field of industrial control, most electronic devices use serial communication to exchange data. Before two communication devices communicate via serial ports, they need to agree on the baud rate between the two communication devices in advance, that is, agree on the same baud rate, so as to ensure successful communication.

[0003] However, the baud rates used by different communication devices are not necessarily the same. Therefore, any two communication devices need to agree on a baud rate before communicating, which results in poor convenience and timeliness. Summary of the invention

[0004] The embodiments of the present application provide a communication method and device for adaptive baud rate, which are used to improve the convenience and timeliness of baud rate setting.

[0005] On the one hand, an embodiment of the present application provides a communication method for adaptive baud rate, which is applied to a first communication device, including:

[0006] detecting a level signal sent by a second communication device;

[0007] If the level signal is a start bit, then detecting the target waveform corresponding to a plurality of data bits received after the start bit, and recording the time width occupied by each data bit;

[0008] If the target waveform is a preset fixed waveform, the target baud rate is determined based on the time widths each of the recorded data bits occupies;

[0009] The target baud rate is used to perform data transmission with the second communication device.

[0010] Optionally, the fixed fluctuation includes at least three groups of high and low level combinations.

[0011] Optionally, determining the target baud rate based on the time widths each occupied by the recorded multiple data bits includes:

[0012] An average value of the time widths occupied by each of the plurality of data bits is determined, and the reciprocal of the average value is used as the target baud rate.

[0013] Optionally, it also includes:

[0014] The time width occupied by the start bit and the time widths respectively occupied by the check bit and the stop bit received after the plurality of data bits are recorded.

[0015] Optionally, determining the target baud rate based on the time width occupied by the recorded multiple data bits includes:

[0016] A target baud rate is determined based on the time widths respectively occupied by the multiple data bits, the start bit, the check bit, and the stop bit.

[0017] Optionally, it also includes:

[0018] If the target waveform is not the fixed waveform, a warning character is sent to the second communication device, where the warning character is used to notify the second communication device that the baud rate configuration fails.

[0019] On the one hand, an embodiment of the present application provides a communication device with an adaptive baud rate, which is applied to a first communication device, including:

[0020] A detection unit, configured to detect a level signal sent by the second communication device; if the level signal is a start bit, detect a target waveform corresponding to a plurality of data bits received after the start bit, and record a time width occupied by each data bit;

[0021] a processing unit, configured to determine a target baud rate based on a time width occupied by each of the plurality of recorded data bits if the target waveform is a preset fixed waveform;

[0022] A communication unit is used to perform data transmission with the second communication device using the target baud rate.

[0023] Optionally, the fixed fluctuation includes at least three groups of high and low level combinations.

[0024] Optionally, the processing module is specifically used for:

[0025] An average value of the time widths occupied by each of the plurality of data bits is determined, and the reciprocal of the average value is used as the target baud rate.

[0026] Optionally, the processing module is further used for:

[0027] The time width occupied by the start bit and the time widths respectively occupied by the check bit and the stop bit received after the plurality of data bits are recorded.

[0028] Optionally, the processing module is specifically used for:

[0029] A target baud rate is determined based on the time widths respectively occupied by the multiple data bits, the start bit, the check bit, and the stop bit.

[0030] Optionally, the processing module is further used for:

[0031] If the target waveform is not the fixed waveform, a warning character is sent to the second communication device, where the warning character is used to notify the second communication device that the baud rate configuration fails.

[0032] On the one hand, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned adaptive baud rate communication method when executing the program.

[0033] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program that can be executed by an electronic device. When the program runs on the electronic device, the electronic device executes the steps of the above-mentioned adaptive baud rate communication method.

[0034] In the embodiment of the present application, the second communication device sends a fixed waveform character string to the first communication device, so that the first communication device calculates the target baud rate based on the time width of the bit in the fixed waveform character string, and realizes baud rate adaptation between the first communication device and the second communication device, without the need for the first communication device and the second communication device to pre-agree on the baud rate, thereby improving the convenience and timeliness of setting the baud rate. Secondly, the baud rate determination method in the present application supports baud rate setting in a full range of scenarios and has a wide range of applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0036] Figure 1 A schematic diagram of a system architecture provided in an embodiment of the present application;

[0037] Figure 2 A schematic diagram of a system architecture provided in an embodiment of the present application;

[0038] Figure 3 A flow chart of a communication method with an adaptive baud rate provided in an embodiment of the present application;

[0039] Figure 4 A schematic diagram of a string provided in an embodiment of the present application;

[0040] Figure 5 A flow chart of a communication method with an adaptive baud rate provided in an embodiment of the present application;

[0041] Figure 6A schematic diagram of the structure of a communication device with adaptive baud rate provided in an embodiment of the present application;

[0042] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solution and beneficial effects of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0044] For ease of understanding, the terms involved in the embodiments of the present invention are explained below.

[0045] Serial port communication: a communication method in which the serial port sends and receives bytes bit by bit.

[0046] Serial interface: A device that can convert parallel data characters received from the CPU into continuous serial data streams and send them out, and can also convert the received serial data streams into parallel data characters and supply them to the CPU. The circuit that generally performs this function is called a serial interface circuit.

[0047] Baud rate: refers to the modulation rate of the data signal on the carrier, which can be understood as the rate of serial communication, that is, the binary bits (bits) sent or received per second in serial communication. For example, for serial communication with an agreed baud rate of 9600, the host computer will send a signal every 1 / 9600=104us, and the serial port module will receive a signal every 104us, that is, the time width occupied by each bit should be 104us to ensure the complete and correct data transmission.

[0048] refer to Figure 1 , which is a system architecture diagram applicable to an embodiment of the present application, the system architecture includes at least a first communication device 101 and a second communication device 102, the first communication device 101 and the second communication device 102 are connected via a serial communication line 103, the serial communication line 103 is a UART (RS-232, RS-422, RS-423, RS-485) line that complies with the industrial serial interface standard, or a serial interface standard that complies with custom specifications, and the present application does not limit the type of serial interface standard. The serial communication line 103 includes at least one data line and one reference line, and the difference in level between the two is used to transmit one or more digital bits. In some embodiments, when the data line and the reference line have a certain level difference, it can be regarded as a digital bit 1; otherwise, it can be regarded as a digital bit 0. The adaptive baud rate communication method in the embodiment of the present application can be applied to any communication scenario.

[0049] Take FPGA (Field programmable gate array, FPGA) test scenario as an example. Figure 2 As shown, the first communication device 101 is a test device, and the second communication device 102 is an FPGA chip.

[0050] The first communication device 101 may be a calculator with a human-machine interface, such as a desktop calculator, a laptop calculator, a portable calculator, a tablet calculator, a smart phone, an intelligent personal digital assistant, etc. The first communication device 101 includes a central processing unit module 201, which includes at least one central processing unit chip for executing an operating system (Operating System) and an application (Application) running on the operating system to control the first communication device 101. The operating system may be a UNIX series operating system (LINUX, Harmony, MacOS, HP-UX, AIX) on the market, a window series operating system, or other types of real-time operating systems. The present application does not limit the types of the central processing unit and operating system of the first communication device 101.

[0051] The first communication device 101 further includes a graphics processor module 202, a display 203, an input / output module 204, an input / output device 205, and a first serial interface module 206. The graphics processor module 202 and the display 203 are used to display the contents of the operating system and the application program. The input / output module 204 uses an industrial standard bus or interface to connect various input / output devices 205. For example, the input / output module 204 can be a bus controller such as PCI, PCI-Express, SCSI, serial SCSI, or USB. The input / output device 205 can include a keyboard, a mouse, a touch pad, a trackball, a touch screen, a microphone, a camera, a wired or wireless network connection device, etc. The first serial interface module 206 can be a UART (RS-232, RS-422, RS-423, RS-485 interface that complies with the industrial serial interface standard, or a serial interface of a custom specification.

[0052] The second communication device 102 includes a second serial interface module 207 and a serial communication protocol processing module 208. The first serial interface module 206 of the first communication device 101 is connected to the second serial interface module 207 of the second communication device 102. The first serial interface module 206 and the second serial interface module 207 must coordinate the baud rate before they can smoothly perform serial communication.

[0053] When the logic circuit in the second communication device 102 wants to transmit data to the first communication device 101, the data is first transmitted to the serial communication protocol processing module 208 for serial communication protocol analysis, and then modulated by the second serial interface module 207, and then the data is transmitted to the first communication device 101 through the serial communication line 103. The serial communication protocol processing module 208 can be a combination circuit of the logic circuit unit burned in the second communication device 102, which can be used to arrange the buffer, timing and scheduling of data transmission. The second serial interface module 207 modulates the data in sequence according to the set baud rate and transmits it to the serial communication line 103. Conversely, the second serial interface module 207 will also receive the modulated signal from the serial communication line 103 according to its set baud rate, and forward it to the serial communication protocol processing module 208 for processing.

[0054] based on Figure 1 The system architecture diagram shown in the figure, the embodiment of the present application provides a process of a communication method for adaptive baud rate, such as Figure 3 As shown, the process of the method is executed by the first communication device, and includes the following steps:

[0055] Step S301: Detect a level signal sent by a second communication device.

[0056] Step S302: If the level signal is a start bit, then detect the target waveform corresponding to a plurality of data bits received after the start bit, and record the time width occupied by each data bit.

[0057] Specifically, when the second communication device does not transmit data to the first communication device, the default level signal is a low level state or a high level state. If the default level signal is a low level state, when the level signal is detected to be a high level state, it is determined that the start bit is detected. If the default level signal is a high level state, when the level signal is detected to be a low level state, it is determined that the start bit is detected.

[0058] When the start bit is detected, it means that the data bits will be detected later, wherein the specific number of data bits can be flexibly selected, usually 5 or 8. After all the data bits are detected, the parity bit and the stop bit are detected. Of course, the second communication device may not send the parity bit, but only send the stop bit, and this application does not make specific limitations on this.

[0059] After detecting multiple data bits, determine the target waveform composed of multiple data bits. When the start bit is detected, record the time width occupied by the start bit; when each data bit is detected, record the time width occupied by each data bit. When the parity bit and the stop bit are detected, the time widths occupied by the parity bit and the stop bit are also recorded respectively. In addition, the timing can also be started when the start bit is detected and ended when the stop bit is detected. The timing can also be started when the first data bit is detected and ended when the last data bit is detected.

[0060] Step S303: if the target waveform is a preset fixed waveform, determine the target baud rate based on the time widths each occupied by the recorded multiple data bits.

[0061] Specifically, the fixed waveform is a pre-agreed specific waveform. In some embodiments, in order to ensure that the first communication device correctly learns the baud rate, the fixed waveform includes at least three groups of high and low level combinations, wherein the high and low level combinations can be 01 combinations or 10 combinations.

[0062] When the high and low level combination is a 01 combination, a 01 combination is obtained by detecting the rising edge and the falling edge, and then the detected 01 combination is counted to determine whether the target waveform is a fixed waveform. When the high and low level combination is a 10 combination, a 10 combination is obtained by detecting the falling edge and the rising edge, and then the detected 10 combination is counted to determine whether the target waveform is a fixed waveform.

[0063] For example, see Figure 4 , is a schematic diagram of a string provided by an embodiment of the present application. When there is no data transmission, the default level signal is set to a high level state, and the fixed waveform is 10101010. When the level signal is detected to be in a low level state (0), it means that the start bit is detected, and the time width occupied by the start bit is recorded. Then continue to detect multiple data bits received after the start bit, and record the time width occupied by each data bit. After that, the parity bit and the stop bit are detected, and the time width occupied by the parity bit and the stop bit are recorded, wherein the stop bit is in a high level state.

[0064] Depend on Figure 4 It can be seen that the target waveform composed of multiple data bits is 10101010, which is the same as the fixed waveform. The target baud rate is determined based on the time width occupied by each of the multiple recorded data bits.

[0065] In some embodiments, an average value of the time widths occupied by each of the plurality of data bits is determined, and the reciprocal of the average value is used as the target baud rate.

[0066] Specifically, the time widths occupied by the multiple data bits may be averaged; or the ratio of the total time width of the multiple data bits to the number of bits of the multiple data bits may be taken as the average value of the time widths occupied by the multiple data bits.

[0067] For example, if the average value of the time widths occupied by a plurality of data bits is calculated to be 104us, then the target baud rate is 1 / 104us=9600.

[0068] In some embodiments, the target baud rate is determined based on the time widths respectively occupied by a plurality of data bits, a start bit, a parity bit, and a stop bit.

[0069] Specifically, the average value of the time widths respectively occupied by a plurality of data bits, a start bit, a check bit, and a stop bit is calculated, and the reciprocal of the average value is used as the target baud rate.

[0070] In the embodiment of the present application, the time width occupied by each bit in the string is recorded and the average value of each time width is calculated, and then the reciprocal of the average value is used as the target baud rate. The entire process only involves the calculation of the average and the reciprocal, and the calculation amount is small and the error rate is low.

[0071] In some embodiments, if the target waveform is not a fixed waveform, a warning character is sent to the second communication device, where the warning character is used to notify the second communication device that the baud rate configuration fails.

[0072] Specifically, if the target waveform is not a fixed waveform, it means that the baud rate configuration has failed. In the case of a baud rate configuration failure, the embodiment of the present application provides a feedback mechanism, that is, sending an alarm character to the second communication device, and the alarm character is pre-agreed. When the second communication device receives the alarm character, it learns that the baud rate configuration has failed, and then resends a character string containing a fixed waveform to the first communication device. The fixed waveform of the resent character string can maintain the fixed waveform sent last time, but the time width occupied by each bit in the character string changes, so as to improve the success rate of the baud rate configuration.

[0073] Step S304: perform data transmission with the second communication device using the target baud rate.

[0074] After setting the target baud rate, the first serial interface module of the first communication device transmits data to the second communication device based on the set target baud rate, the second serial interface module of the second communication device receives data based on the set target baud rate, and transmits the data to the serial communication protocol processing module of the second communication device, the serial communication protocol processing module processes the data and generates a response message, and transmits the response message to the second serial interface module. The second serial interface module adjusts the response message based on the target baud rate and sends it to the first serial interface module of the first communication device.

[0075] In the embodiment of the present application, the second communication device sends a fixed waveform character string to the first communication device, so that the first communication device calculates the target baud rate based on the time width of the bit in the fixed waveform character string, and realizes baud rate adaptation between the first communication device and the second communication device, without the need for the first communication device and the second communication device to pre-agree on the baud rate, thereby improving the convenience and timeliness of setting the baud rate. Secondly, the baud rate determination method in the present application supports baud rate setting in a full range of scenarios and has a wide range of applications.

[0076] In order to better explain the embodiment of the present application, the following describes an adaptive baud rate communication method provided by the embodiment of the present application in combination with a specific implementation scenario. The process of the method can be interactively executed by a first communication device and a second communication device, including the following steps, such as Figure 5 As shown:

[0077] Step S501: The second communication device sends a character string including a fixed waveform to the first communication device.

[0078] Step S502: When the first communication device detects a start bit in a character string, it detects a target waveform corresponding to a plurality of data bits received after the start bit.

[0079] Step S503: the first communication device records the time width occupied by each data bit.

[0080] Step S504, the first communication device determines whether the target waveform is a fixed waveform, if so, executes step S505, otherwise executes step S507.

[0081] Step S505: The first communication device calculates an average value of time widths occupied by each of the plurality of data bits, and uses the reciprocal of the average value as the target baud rate.

[0082] Step S506: The first communication device performs data transmission with the second communication device using the target baud rate.

[0083] Step S507: The first communication device sends a warning character to the second communication device, where the warning character is used to notify the second communication device that the baud rate configuration fails.

[0084] After receiving the warning character, the second communication device re-executes the above step S501 to perform baud rate adaptation.

[0085] In the embodiment of the present application, the second communication device sends a fixed waveform character string to the first communication device, so that the first communication device calculates the target baud rate based on the time width of the bit in the fixed waveform character string, and realizes the baud rate adaptation between the first communication device and the second communication device, without the need for the first communication device and the second communication device to pre-agree on the baud rate, thereby improving the convenience and timeliness of setting the baud rate. Secondly, the baud rate determination method in the present application supports baud rate setting in a full range of scenarios and has a wide range of applications.

[0086] Based on the same technical concept, the embodiment of the present application provides a structural diagram of a communication device with an adaptive baud rate, such as Figure 6 As shown, the communication device 600 with adaptive baud rate includes:

[0087] The detection unit 601 is used to detect the level signal sent by the second communication device; if the level signal is a start bit, detect the target waveform corresponding to multiple data bits received after the start bit, and record the time width occupied by each data bit;

[0088] The processing unit 602 is configured to determine a target baud rate based on a time width occupied by each of the plurality of recorded data bits if the target waveform is a preset fixed waveform;

[0089] The communication unit 603 is configured to perform data transmission with the second communication device using the target baud rate.

[0090] Optionally, the fixed fluctuation includes at least three groups of high and low level combinations.

[0091] Optionally, the processing module 602 is specifically configured to:

[0092] An average value of the time widths occupied by each of the plurality of data bits is determined, and the reciprocal of the average value is used as the target baud rate.

[0093] Optionally, the processing module 602 is further configured to:

[0094] The time width occupied by the start bit and the time widths respectively occupied by the check bit and the stop bit received after the plurality of data bits are recorded.

[0095] Optionally, the processing module 602 is specifically configured to:

[0096] A target baud rate is determined based on the time widths respectively occupied by the multiple data bits, the start bit, the check bit, and the stop bit.

[0097] Optionally, the processing module 602 is further configured to:

[0098] If the target waveform is not the fixed waveform, a warning character is sent to the second communication device, where the warning character is used to notify the second communication device that the baud rate configuration fails.

[0099] In an embodiment of the present application, the second communication device sends a character string of a fixed waveform to the first communication device, so that the first communication device calculates the target baud rate based on the time width of the bits in the character string of the fixed waveform, and realizes baud rate adaptation between the first communication device and the second communication device, without the need for the first communication device and the second communication device to pre-agree on the baud rate, thereby improving the convenience and timeliness of setting the baud rate. Secondly, the baud rate determination method in the present application supports baud rate settings in a full range of scenarios and has a wide range of applications. By recording the time width occupied by each bit in the character string and calculating the average value of each time width obtained, and then taking the inverse of the average value as the target baud rate, the entire process only involves the calculation of the average and the inverse, and the calculation amount is small and the error rate is low.

[0100] Based on the same technical concept, the embodiment of the present application provides an electronic device, which can be Figure 1 The first communication device shown, such as Figure 7 As shown, it includes at least one processor 701 and a memory 702 connected to the at least one processor. The specific connection medium between the processor 701 and the memory 702 is not limited in the embodiment of the present application. Figure 7 For example, the processor 701 and the memory 702 are connected via a bus. The bus can be divided into an address bus, a data bus, a control bus, etc.

[0101] In the embodiment of the present application, the memory 702 stores instructions that can be executed by at least one processor 701, and the at least one processor 701 can execute the steps of the above-mentioned adaptive baud rate communication method by executing the instructions stored in the memory 702.

[0102] Among them, the processor 701 is the control center of the electronic device, and can use various interfaces and lines to connect various parts of the electronic device, and realize the baud rate setting by running or executing instructions stored in the memory 702 and calling data stored in the memory 702. Optionally, the processor 701 may include one or more processing units, and the processor 701 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 701. In some embodiments, the processor 701 and the memory 702 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on independent chips.

[0103] Processor 701 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware processor for execution, or can be executed by a combination of hardware and software modules in the processor.

[0104] The memory 702 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 702 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 702 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by an electronic device, but is not limited thereto. The memory 702 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0105] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium storing a computer program executable by an electronic device. When the program runs on the electronic device, the electronic device executes the steps of the above-mentioned adaptive baud rate communication method.

[0106] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0107] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer device or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0108] These computer program instructions may also be stored in a computer readable memory capable of directing a computer device or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0109] These computer program instructions can also be loaded onto a computer device or other programmable data processing device so that a series of operation steps are executed on the computer device or other programmable device to produce a process implemented by the computer device, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0110] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0111] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A communication method for adaptive baud rate, applied to a first communication device, characterized in that: include: detecting a level signal sent by a second communication device; If the level signal is a start bit, then detecting the target waveform corresponding to a plurality of data bits received after the start bit, and recording the time width occupied by each data bit; By counting the high and low level combinations in the target waveform, determining whether the target waveform is a fixed waveform, the fixed waveform comprising at least three groups of high and low level combinations; If the target waveform is a preset fixed waveform, then determining an average value of the time widths occupied by each of the plurality of data bits, and taking the reciprocal of the average value as the target baud rate; If the target waveform is not the fixed waveform, sending a warning character to the second communication device, wherein the warning character is used to notify the second communication device that the baud rate configuration fails; receiving a level signal of a character string containing a fixed waveform retransmitted by the second communication device, wherein a time width occupied by each bit in the character string changes; The target baud rate is used to perform data transmission with the second communication device.

2. The method according to claim 1, characterized in that Also includes: The time width occupied by the start bit and the time widths respectively occupied by the check bit and the stop bit received after the plurality of data bits are recorded.

3. The method according to claim 2, characterized in that If the target waveform is a preset fixed waveform, determining an average value of the time widths occupied by each of the plurality of data bits, and taking the reciprocal of the average value as the target baud rate, comprises: If the target waveform is a preset fixed waveform, the average value of the time widths respectively occupied by the multiple data bits, the start bit, the check bit and the stop bit is calculated, and the reciprocal of the average value is used as the target baud rate.

4. A communication device with adaptive baud rate, applied to a first communication device, characterized in that: include: A detection unit, used to detect a level signal sent by the second communication device; If the level signal is a start bit, then detecting the target waveform corresponding to a plurality of data bits received after the start bit, and recording the time width occupied by each data bit; A processing unit, configured to determine whether the target waveform is a fixed waveform by counting high and low level combinations in the target waveform, wherein the fixed waveform includes at least three groups of high and low level combinations; If the target waveform is a preset fixed waveform, then determining an average value of the time widths occupied by each of the plurality of data bits, and taking the reciprocal of the average value as the target baud rate; A communication unit, configured to perform data transmission with the second communication device using the target baud rate; The processing unit is further configured to send a warning character to the second communication device if the target waveform is not the fixed waveform, wherein the warning character is used to notify the second communication device that the baud rate configuration fails; A level signal containing a character string of fixed waveform retransmitted by the second communication device is received, wherein a time width occupied by each bit in the character string changes.

5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of any one of the methods of claims 1 to 3 are implemented.

6. A computer-readable storage medium, characterized in that: It stores a computer program executable by an electronic device, and when the program is run on the electronic device, the electronic device executes the steps of any method described in claims 1 to 3.