A data transmission method, apparatus, device, and storage medium

CN116974968BActive Publication Date: 2026-10-16SHANDONG INSPUR SCI RES INST CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310955667.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-31
Publication Date
2026-10-16
Estimated Expiration
2043-07-31

AI Technical Summary

Technical Problem

但唯一的问题是,由于UART协议没有时钟,因此在波特率匹配的问题上就显得非常关键,如何在上位机在不知道UART外设的工作波特率的前提下,实现UART的数据传输是目前有待解决的问题

Benefits of technology

[0032]In this application, a target baud rate is determined based on a target baud rate selection signal sent by the Universal Asynchronous Receiver/Transmitter (UART), and this target baud rate is sent to a host computer. Baud rate matching between the host computer and the UART is then achieved based on the target baud rate. A corresponding output bit width is determined based on a bit width selection signal, and when the bit width of the target data obtained by the data buffer module from the UART reaches the output bit width, the target data is transmitted to the host computer based on the target baud rate. Therefore, this application, by determining the target baud rate based on the target baud rate selection signal sent by the UART when the operating baud rate of the peripheral communicating with the UART is unknown, and then sending the target baud rate to the host computer, automatically achieves baud rate matching between the UART and the host computer. This allows the UART to carry baud rate-related information during data transmission, improving the data transmission efficiency and overall utilization efficiency of the UART. Furthermore, by selecting the data transmission bit width, this application can adapt to scenarios with varying bit width requirements, enabling bit width expansion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116974968B_ABST
    Figure CN116974968B_ABST
Patent Text Reader

Abstract

The application discloses a data transmission method and device, equipment and storage medium, and relates to the field of data transmission, and comprises the following steps: determining a corresponding target baud rate based on a target baud rate selection signal sent by a universal asynchronous receiver, and sending the target baud rate to a host computer; completing baud rate matching between the host computer and the universal asynchronous receiver based on the target baud rate; determining a corresponding output bit width based on a bit width selection signal, and transmitting target data to the host computer based on the target baud rate when the bit width of the target data obtained by the data buffer module from the universal asynchronous receiver reaches the output bit width. In the case that the working baud rate of the peripheral device in communication with the universal asynchronous receiver is unknown, the baud rate matching between the universal asynchronous receiver and the host computer can be automatically realized, the data transmission efficiency and use efficiency of the universal asynchronous receiver are improved, and through the selection of the bit width, the bit width expansion can be realized in different scenes with different bit width requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data transmission, and in particular to a data transmission method, apparatus, device, and storage medium. Background Technology

[0002] Currently, UART (Universal Asynchronous Receiver / Transmitter) is a crucial protocol and interface in processor design. Compared to other protocols, UART is easier to adjust, more universal, and easier to send and receive data in serial communication. However, the only problem is that, since the UART protocol lacks a clock, baud rate matching becomes critical. How to achieve UART data transmission on the host computer without knowing the operating baud rate of the UART peripheral is a problem that needs to be solved. Summary of the Invention

[0003] In view of this, the purpose of this invention is to provide a data transmission method, apparatus, device, and storage medium that can automatically achieve baud rate matching between the universal asynchronous transceiver (UART) and the host computer when the operating baud rate of the peripheral communicating with the UART is unknown, thereby improving the data transmission efficiency and utilization efficiency of the UART. Furthermore, by selecting the bit width, it can adapt to scenarios with different bit width requirements, achieving bit width expansion. The specific solution is as follows:

[0004] In a first aspect, this application provides a data transmission method, including:

[0005] The target baud rate is determined based on the target baud rate selection signal sent by the universal asynchronous transceiver, and the target baud rate is sent to the host computer.

[0006] Based on the target baud rate, complete the baud rate matching between the host computer and the universal asynchronous transceiver;

[0007] The corresponding output bit width is determined based on the bit width selection signal, and when the bit width of the target data obtained by the data buffer module from the universal asynchronous transceiver reaches the output bit width, the target data is transmitted to the host computer based on the target baud rate.

[0008] Optionally, determining the corresponding target baud rate based on the target baud rate selection signal transmitted by the universal asynchronous transceiver includes:

[0009] Send the target baud rate selection signal to the baud rate selection module via a universal asynchronous transceiver;

[0010] The baud rate selection module uses the correspondence between the baud rate selection signal and the baud rate to determine the initial baud rate corresponding to the target baud rate selection signal.

[0011] The initial baud rate obtained from the baud rate selection module is multiplied by the multiplier module to obtain the target baud rate.

[0012] Optionally, before sending the target baud rate selection signal to the baud rate selection module via the universal asynchronous transceiver, the method further includes:

[0013] When the Universal Asynchronous Transceiver (UART) receives a preset activation signal from a preset peripheral, it activates a preset flag signal and sends the preset flag signal to the baud rate selection module through the UART to establish a connection between the UART and the baud rate selection module.

[0014] Optionally, after completing the baud rate matching between the host computer and the universal asynchronous transceiver based on the target baud rate, the method further includes:

[0015] According to a preset signal transmission cycle, the universal asynchronous transceiver sends a preset number of preset failure signals to the baud rate selection module to perform failure processing on the preset flag signals and disconnect the connection between the universal asynchronous transceiver and the baud rate selection module.

[0016] Optionally, determining the corresponding output bit width based on the bit width selection signal includes:

[0017] The bit width selection module receives the output signal sent by the universal asynchronous transceiver and determines the corresponding bit width selection signal based on the output signal.

[0018] The data buffer module receives the bit width selection signal sent by the bit width selection module and determines the corresponding output bit width based on the bit width selection signal.

[0019] Optionally, the step of transmitting the target data to the host computer based on the target baud rate when the bit width of the target data obtained by the data buffer module from the universal asynchronous transceiver reaches the output bit width includes:

[0020] The target data sent by the preset peripheral is sent to the data cache module through the universal asynchronous transceiver;

[0021] When the bit width of the target data obtained by the data caching module reaches the output bit width, the target data is transmitted to the host computer based on the target baud rate.

[0022] Optionally, after sending the target data to be transmitted by the preset peripheral device to the data buffer module via the universal asynchronous transceiver, the method further includes:

[0023] When the bit width of the target data obtained by the data caching module does not reach the output bit width, the step of sending the target data sent by the preset peripheral through the universal asynchronous transceiver to the data caching module continues.

[0024] Secondly, this application provides a data transmission apparatus, comprising:

[0025] The baud rate determination module is used to determine the corresponding target baud rate based on the target baud rate selection signal sent by the universal asynchronous transceiver, and send the target baud rate to the host computer;

[0026] A baud rate matching module is used to complete baud rate matching between the host computer and the universal asynchronous transceiver based on the target baud rate.

[0027] The data transmission module is used to determine the corresponding output bit width based on the bit width selection signal, and when the bit width of the target data obtained by the data buffer module from the universal asynchronous transceiver reaches the output bit width, the target data is transmitted to the host computer based on the target baud rate.

[0028] Thirdly, this application provides an electronic device, comprising:

[0029] Memory, used to store computer programs;

[0030] A processor for executing the computer program to implement the aforementioned data transmission method.

[0031] Fourthly, this application provides a computer-readable storage medium for storing a computer program, which, when executed by a processor, implements the aforementioned data transmission method.

[0032] In this application, a target baud rate is determined based on a target baud rate selection signal sent by the Universal Asynchronous Receiver / Transmitter (UART), and this target baud rate is sent to a host computer. Baud rate matching between the host computer and the UART is then achieved based on the target baud rate. A corresponding output bit width is determined based on a bit width selection signal, and when the bit width of the target data obtained by the data buffer module from the UART reaches the output bit width, the target data is transmitted to the host computer based on the target baud rate. Therefore, this application, by determining the target baud rate based on the target baud rate selection signal sent by the UART when the operating baud rate of the peripheral communicating with the UART is unknown, and then sending the target baud rate to the host computer, automatically achieves baud rate matching between the UART and the host computer. This allows the UART to carry baud rate-related information during data transmission, improving the data transmission efficiency and overall utilization efficiency of the UART. Furthermore, by selecting the data transmission bit width, this application can adapt to scenarios with varying bit width requirements, enabling bit width expansion. Attached Figure Description

[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention 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 embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0034] Figure 1 This is a flowchart of a data transmission method disclosed in this application;

[0035] Figure 2 This is a data transmission flowchart disclosed in this application;

[0036] Figure 3 This is a schematic diagram of the structure of a data transmission device disclosed in this application;

[0037] Figure 4 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation

[0038] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0039] Currently, since the UART protocol lacks a clock, baud rate matching is crucial. How to achieve UART data transmission when the host computer is unaware of the UART peripheral's operating baud rate is a problem that needs to be solved. To address this, this application provides a data transmission method that automatically achieves baud rate matching between the universal asynchronous transceiver (UART) and the host computer when the operating baud rate of the peripheral communicating with the UART is unknown. This improves the data transmission and utilization efficiency of the UART, and by selecting the bit width, it can adapt to scenarios with different bit width requirements, enabling bit width expansion.

[0040] See Figure 1 As shown, an embodiment of the present invention discloses a data transmission method, including:

[0041] Step S11: Determine the corresponding target baud rate based on the target baud rate selection signal sent by the universal asynchronous transceiver, and send the target baud rate to the host computer.

[0042] In this embodiment, determining the target baud rate based on the target baud rate selection signal sent by the universal asynchronous transceiver (UART) can include sending the target baud rate selection signal to the baud rate selection module via the UART; the baud rate selection module determining the initial baud rate corresponding to the target baud rate selection signal using the correspondence between the baud rate selection signal and the baud rate; and multiplying the initial baud rate obtained from the baud rate selection module using a multiplier module to obtain the target baud rate. It is understood that the UART first needs to send a target baud rate selection signal to the baud rate selection module. The UART supports normal UART protocol communication. The target baud rate selection signal is any one of 0x00 to 0x05. The correspondence between the baud rate selection signal and the baud rate includes: 0x00 corresponds to a baud rate of 96, 0x01 corresponds to a baud rate of 192, 0x02 corresponds to a baud rate of 384, 0x03 corresponds to a baud rate of 576, 0x04 corresponds to a baud rate of 1152, and 0x05 corresponds to a baud rate of 2304. Then, the baud rate selection module uses the correspondence between the baud rate selection signal and the baud rate to determine the initial baud rate corresponding to the target baud rate selection signal. This initial baud rate is then sent to the multiplier module, which multiplies the initial baud rate by 100 to obtain the target baud rate. Finally, the multiplier module transmits the target baud rate to the host computer for reception.

[0043] In this embodiment, before sending the target baud rate selection signal to the baud rate selection module via the universal asynchronous transceiver (UART), the method may further include activating a preset flag signal when the UART receives a preset activation signal from a preset peripheral, and then sending the preset flag signal to the baud rate selection module via the UART to establish a connection between the UART and the baud rate selection module. It can be understood that when the UART receives 0x56 (preset activation signal) from a preset peripheral with which it is communicating, it activates the flag signal, i.e., the preset flag signal, and then sends the activated flag signal to the baud rate selection module via the UART, thereby establishing a connection between the UART and the baud rate selection module.

[0044] Step S12: Complete baud rate matching between the host computer and the universal asynchronous transceiver based on the target baud rate.

[0045] In this embodiment, after the host computer receives the target baud rate sent from the multiplier module, it uses the target baud rate to perform baud rate matching between the host computer and the universal asynchronous transceiver. This allows the universal asynchronous transceiver to transmit data with the host computer even when the host computer does not know the operating baud rate of the peripheral communicating with the universal asynchronous transceiver, thereby improving the utilization efficiency and transmission efficiency of the universal asynchronous transceiver.

[0046] In this embodiment, after baud rate matching between the host computer and the universal asynchronous transceiver (UART) is completed based on the target baud rate, the method may further include sending a preset number of preset failure signals to the baud rate selection module via the UART according to a preset signal transmission cycle. This is to disable the preset flag signal and disconnect the connection between the UART and the baud rate selection module. It is understood that after completing the baud rate matching between the host computer and the UART, the UART needs to send two cycles of 0x00 signals to the baud rate selection module, causing the flag signal between the UART and the baud rate selection module to fail, thereby disconnecting the connection between the UART and the baud rate selection module.

[0047] Step S13: Determine the corresponding output bit width based on the bit width selection signal, and when the bit width of the target data obtained by the data buffer module from the universal asynchronous transceiver reaches the output bit width, transmit the target data to the host computer based on the target baud rate.

[0048] In this embodiment, determining the corresponding output bit width based on the bit width selection signal can include receiving the output signal sent by the universal asynchronous transceiver (UART) through the bit width selection module and determining the corresponding bit width selection signal based on the output signal; and receiving the bit width selection signal sent by the bit width selection module through the data buffer module and determining the corresponding output bit width based on the bit width selection signal. It is understood that the UART will send an output signal to the bit width selection module, where the output signal is any signal from 0x01 to 0x16. After receiving the output signal, the bit width selection module will generate a bit width selection signal based on the output signal and send it to the read enable terminal of the data buffer module to activate the data buffer module, enabling the data buffer module to become a module with the corresponding output bit width according to the bit width selection signal. In this context, 0x01 indicates that the data buffer module will transmit an 8-bit data sent by the universal asynchronous transceiver to the host computer after receiving it, with a corresponding output bit width of 8 bits; 0x02 indicates that the data buffer module will transmit two 8-bit data sent by the universal asynchronous transceiver to the host computer after receiving them, with a corresponding output bit width of 16 bits; and so on, 0x16 indicates that the data buffer module will transmit 16 8-bit data sent by the universal asynchronous transceiver to the host computer after receiving them, with a corresponding output bit width of 128 bits.

[0049] In this embodiment, after configuring the output bit width of the data buffer module, the target data to be sent by the peripheral device communicating with it can be sent to the data buffer module via the universal asynchronous transceiver. If the bit width of the target data obtained by the data buffer module does not reach the output bit width, the steps described above for sending the target data to the data buffer module via the universal asynchronous transceiver continue. When the bit width of the target data obtained by the data buffer module reaches the output bit width, the target data is transmitted to the host computer based on the target baud rate. It should be noted that after data transmission, according to the UART protocol, the start bit of the UART needs to be set to 1 (i.e., entering the idle state), and the data bits need to be set to 0.

[0050] Therefore, this application, when the operating baud rate of the peripheral communicating with the universal asynchronous transceiver (UART) is unknown, can determine the corresponding target baud rate based on the target baud rate selection signal sent by the UART and send the target baud rate to the host computer. This automatically achieves baud rate matching between the UART and the host computer, allowing the UART to carry baud rate-related information during data transmission, thus improving the data transmission efficiency and utilization efficiency of the UART. In addition, this application, through the selection of data transmission bit width, can adapt to scenarios with different bit width requirements, achieving bit width expansion.

[0051] See Figure 2As shown, an embodiment of the present invention discloses a data transmission method, including:

[0052] When the UART transceiver module (UART transceiver) receives the 0x56 signal from a UART peripheral, it activates the flag signal and sends the activated flag signal to the baud rate selection module to establish a connection between them. Then, the host computer sends a drive clock to the baud rate selection module to initiate its operation. The baud rate selection module uses the correspondence between the baud rate selection signal and the baud rate, and determines the initial baud rate based on the 8-bit target baud rate selection signal sent by the UART transceiver module. This initial baud rate is then sent to the multiplier module. The multiplier module multiplies the initial baud rate by 100 to obtain the target baud rate, which is then sent to the host computer for baud rate matching between the host computer and the UART transceiver. After baud rate matching is completed, the UART transceiver module sends a two-cycle 0x00 signal to the baud rate selection module to disable the flag signal, thereby disconnecting the connection between the UART transceiver module and the baud rate selection module.

[0053] Simultaneously, the UART transceiver module sends an 8-bit output signal to the bit width selection module. This allows the bit width selection module to determine the bit width selection signal based on the output signal and send it to the read enable pin of the data buffer module. This activates the data buffer module, enabling it to adjust to the corresponding output bit width based on the bit width selection signal. Data transmission then begins. The UART transceiver module sends target data from the UART-related peripherals to the data buffer module. If the bit width of the target data stored in the data buffer module does not reach the output bit width, the module continues to retrieve target data from the UART transceiver module. If the bit width of the target data stored in the data buffer module reaches the output bit width, the stored target data is transmitted to the host computer according to the target baud rate, completing the data transmission operation.

[0054] Therefore, this application, when the operating baud rate of the peripheral communicating with the universal asynchronous transceiver (UART) is unknown, can determine the corresponding target baud rate based on the target baud rate selection signal sent by the UART and send the target baud rate to the host computer. This automatically achieves baud rate matching between the UART and the host computer, allowing the UART to carry baud rate-related information during data transmission, thus improving the data transmission efficiency and utilization efficiency of the UART. In addition, this application, through the selection of data transmission bit width, can adapt to scenarios with different bit width requirements, thereby achieving bit width expansion.

[0055] See Figure 3 As shown, an embodiment of the present invention discloses a data transmission device, comprising:

[0056] The baud rate determination module 11 is used to determine the corresponding target baud rate based on the target baud rate selection signal sent by the universal asynchronous transceiver, and send the target baud rate to the host computer;

[0057] Baud rate matching module 12 is used to complete baud rate matching between the host computer and the universal asynchronous transceiver based on the target baud rate;

[0058] The data transmission module 13 is used to determine the corresponding output bit width based on the bit width selection signal, and when the bit width of the target data obtained by the data buffer module from the universal asynchronous transceiver reaches the output bit width, the target data is transmitted to the host computer based on the target baud rate.

[0059] Therefore, this application, when the operating baud rate of the peripheral communicating with the universal asynchronous transceiver (UART) is unknown, can determine the corresponding target baud rate based on the target baud rate selection signal sent by the UART and send the target baud rate to the host computer. This automatically achieves baud rate matching between the UART and the host computer, allowing the UART to carry baud rate-related information during data transmission, thus improving the data transmission efficiency and utilization efficiency of the UART. In addition, this application, through the selection of data transmission bit width, can adapt to scenarios with different bit width requirements, achieving bit width expansion.

[0060] In some specific embodiments, the baud rate determination module 11 may specifically include:

[0061] The signal transmission unit is used to transmit the target baud rate selection signal to the baud rate selection module via a universal asynchronous transceiver;

[0062] A baud rate determination unit is used to determine an initial baud rate corresponding to the target baud rate selection signal by using the correspondence between the baud rate selection signal and the baud rate through the baud rate selection module;

[0063] The baud rate multiplier unit is used to multiply the initial baud rate obtained from the baud rate selection module through the multiplier module to obtain the target baud rate.

[0064] In some specific embodiments, the data transmission device may further include:

[0065] The connection establishment unit is used to activate a preset flag signal when the universal asynchronous transceiver receives a preset activation signal sent by a preset peripheral, and send the preset flag signal to the baud rate selection module through the universal asynchronous transceiver to establish a connection between the universal asynchronous transceiver and the baud rate selection module.

[0066] In some specific embodiments, the data transmission device may further include:

[0067] The connection disconnection unit is used to send a preset number of preset failure signals to the baud rate selection module through the universal asynchronous transceiver according to a preset signal transmission period, so as to perform failure processing on the preset flag signal and disconnect the connection between the universal asynchronous transceiver and the baud rate selection module.

[0068] In some specific embodiments, the data transmission module 13 may specifically include:

[0069] The signal determination unit is used to receive the output signal sent by the universal asynchronous transceiver through the bit width selection module, and determine the corresponding bit width selection signal based on the output signal;

[0070] The output bit width determination unit is used to receive the bit width selection signal sent by the bit width selection module through the data buffer module, and determine the corresponding output bit width based on the bit width selection signal.

[0071] In some specific embodiments, the data transmission module 13 may specifically include:

[0072] The target data caching unit is used to send target data sent by a preset peripheral to the data caching module through the universal asynchronous transceiver;

[0073] The target data transmission unit is used to transmit the target data to the host computer based on the target baud rate when the bit width of the target data obtained by the data buffer module reaches the output bit width.

[0074] In some specific embodiments, the data transmission device may further include:

[0075] The step execution unit is used to continue executing the step of sending the target data sent by the preset peripheral to the data cache module through the universal asynchronous transceiver when the bit width of the target data obtained by the data cache module does not reach the output bit width.

[0076] Furthermore, embodiments of this application also disclose an electronic device, Figure 4This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.

[0077] Figure 4 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the data transmission method disclosed in any of the foregoing embodiments. Furthermore, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0078] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.

[0079] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0080] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including computer programs capable of performing the data transmission method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.

[0081] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned disclosed data transmission method. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.

[0082] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0083] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0084] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0085] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0086] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A data transmission method, characterized in that, include: The target baud rate is determined based on the target baud rate selection signal sent by the universal asynchronous transceiver, and the target baud rate is sent to the host computer. Based on the target baud rate, complete the baud rate matching between the host computer and the universal asynchronous transceiver; The corresponding output bit width is determined based on the bit width selection signal, and when the bit width of the target data obtained by the data buffer module from the universal asynchronous transceiver reaches the output bit width, the target data is transmitted to the host computer based on the target baud rate. The step of determining the corresponding target baud rate based on the target baud rate selection signal transmitted by the universal asynchronous transceiver includes: Send the target baud rate selection signal to the baud rate selection module via a universal asynchronous transceiver; The baud rate selection module uses the correspondence between the baud rate selection signal and the baud rate to determine the initial baud rate corresponding to the target baud rate selection signal. The initial baud rate obtained from the baud rate selection module is multiplied by the multiplier module to obtain the target baud rate; The step of determining the corresponding output bit width based on the bit width selection signal includes: The bit width selection module receives the output signal sent by the universal asynchronous transceiver and determines the corresponding bit width selection signal based on the output signal. The data buffer module receives the bit width selection signal sent by the bit width selection module and determines the corresponding output bit width based on the bit width selection signal.

2. The data transmission method according to claim 1, characterized in that, Before sending the target baud rate selection signal to the baud rate selection module via the universal asynchronous transceiver, the method further includes: When the Universal Asynchronous Transceiver (UART) receives a preset activation signal from a preset peripheral, it activates a preset flag signal and sends the preset flag signal to the baud rate selection module through the UART to establish a connection between the UART and the baud rate selection module.

3. The data transmission method according to claim 2, characterized in that, After completing the baud rate matching between the host computer and the universal asynchronous transceiver based on the target baud rate, the process further includes: According to a preset signal transmission cycle, the universal asynchronous transceiver sends a preset number of preset failure signals to the baud rate selection module to perform failure processing on the preset flag signals and disconnect the connection between the universal asynchronous transceiver and the baud rate selection module.

4. The data transmission method according to any one of claims 1 to 3, characterized in that, When the bit width of the target data obtained by the data caching module from the universal asynchronous transceiver reaches the output bit width, the step of transmitting the target data to the host computer based on the target baud rate includes: The target data sent by the preset peripheral is sent to the data cache module through the universal asynchronous transceiver; When the bit width of the target data obtained by the data caching module reaches the output bit width, the target data is transmitted to the host computer based on the target baud rate.

5. The data transmission method according to claim 4, characterized in that, After the target data to be sent by the preset peripheral device is sent to the data buffer module through the universal asynchronous transceiver, the method further includes: When the bit width of the target data obtained by the data caching module does not reach the output bit width, the step of sending the target data sent by the preset peripheral through the universal asynchronous transceiver to the data caching module continues.

6. A data transmission device, characterized in that, The data transmission device is used to implement the data transmission method as described in any one of claims 1 to 5, and the data transmission device includes: The baud rate determination module is used to determine the corresponding target baud rate based on the target baud rate selection signal sent by the universal asynchronous transceiver, and send the target baud rate to the host computer; A baud rate matching module is used to complete baud rate matching between the host computer and the universal asynchronous transceiver based on the target baud rate. The data transmission module is used to determine the corresponding output bit width based on the bit width selection signal, and when the bit width of the target data obtained by the data buffer module from the universal asynchronous transceiver reaches the output bit width, the target data is transmitted to the host computer based on the target baud rate.

7. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the data transmission method as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, Used to store a computer program, which, when executed by a processor, implements the data transmission method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • UART Baud rate self-adaption method and system and SoC chip

    CN114584276A

  • UART communication interface with FIFO cache function based on APB bus

    CN115934614A