Data transmission device and method

Through the data transmission device and method, the problem of single and communication incompatibility between MCU wake-up mode is solved, and full-duplex communication and diversified wake-up mode in sleep mode are realized to meet the complex communication needs of the power system.

CN116204479BActive Publication Date: 2025-09-02HANGZHOU VANGO TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211570515.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-08
Publication Date
2025-09-02
Estimated Expiration
2042-12-08

AI Technical Summary

Technical Problem

In the prior art, the MCU wake-up mode is single, which cannot meet the needs of diversified communication scenarios of power system. Moreover, the data frame format and baud rate of different UART interfaces are incompatible, resulting in incompatible communication.

Method used

It provides a data transmission device, including a peripheral bus module, a forwarding module, an adaptive baud rate module, a receiving module and a sending module. Through parameter configuration and an adaptive baud rate module, it realizes full duplex communication of the MCU in sleep mode, and supports multiple wake-up modes and data frame format conversion.

Benefits of technology

It realizes full duplex communication based on low-frequency clocks when MCU sleeps, supports multiple wake-up types, and meets the applicability of diversified power system communication scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116204479B_ABST
    Figure CN116204479B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a device and method for data transmission. The device for data transmission includes: a peripheral bus module for configuring parameters of UART before the MCU enters sleep mode; a receiving module for receiving data through a preset pin in the UART, and judging the received data according to the parameter configuration to determine whether to wake up the MCU, and generating a first wake-up signal when the judgment result is yes, and sending the first wake-up signal to the MCU; a sending module for receiving data output by a forwarding module or a peripheral bus module, judging whether to wake up the MCU according to the data, and generating a second wake-up signal when the judgment result is yes, and sending the second wake-up signal to the MCU. The solution provided by the present invention can realize that when the MCU is asleep, the UART can rely on a low-frequency clock to achieve full-duplex communication and support multiple wake-up types, meeting the technical effect applicable to diversified scenarios of power system communication.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology applications, and in particular to a device and method for data transmission. Background Art

[0002] Under the existing technology, when the microcontroller unit (MCU) chip is idle, it will enter sleep mode in order to reduce power consumption. When the MCU needs to be used normally, a wake-up signal needs to be generated to wake it up. Under the current technology, the mode of generating the wake-up signal is relatively simple and cannot meet the various complex requirements in the field of power system communication. In addition, the data frame format of different universal asynchronous receiver / transmitter (UART) interfaces is different, and the baud rate may also be different, so direct communication is not possible, and when the MCU enters sleep mode, data can no longer be forwarded through the bus.

[0003] Currently, no effective solution has been proposed to address the above-mentioned problem that the existing technology cannot meet the application of diversified power system communication scenarios due to the single wake-up mode and incompatible communication modes. Summary of the Invention

[0004] To solve the above technical problems, an embodiment of the present invention hopes to provide a device and method for data transmission, so as to at least solve the problem that the prior art cannot meet the application of diversified power system communication scenarios due to the single wake-up mode and incompatible communication modes.

[0005] The technical solution of the present invention is achieved as follows:

[0006] In the first aspect, an embodiment of the present invention provides a data transmission device, comprising: a peripheral bus module, a forwarding module, an adaptive baud rate module, a receiving module and a sending module, wherein the peripheral bus module is used to configure parameters of the UART before the MCU enters the sleep mode; when the MCU enters the sleep mode, the peripheral bus module stops running, and the UART runs according to a preset frequency clock; the receiving module is used to receive data through a preset pin in the UART, and judge the received data according to the parameter configuration to determine whether to wake up the MCU, and if the judgment result is yes, generate a first wake-up signal and send the first wake-up signal to the MCU; one end of the forwarding module is connected to the output end of the receiving module, and the other end of the forwarding module is respectively connected to the output end of the peripheral bus module. The input end is connected to the input end of the sending module, and is used to determine whether the data received by the receiving module is sent to the peripheral bus module or the sending module, and when the data frame formats of the receiving module and the sending module are different, the data frame format of the data is converted from the data frame format of the receiving group to the data frame format of the sending module according to the parameter configuration; the sending module is used to receive data output by the forwarding module or the peripheral bus module, and judge whether to wake up the MCU according to the data. If the judgment result is yes, a second wake-up signal is generated and the second wake-up signal is sent to the MCU; the adaptive baud rate module is respectively connected to the receiving module and the sending module, and is used to generate corresponding baud rates for the receiving module and the sending module, so that the receiving module and the sending module perform full-duplex communication according to the corresponding baud rate.

[0007] Optionally, the receiving module includes: a data receiving module, a receiving data processing module, a receiving wake-up signal generating module and a receiving storage module, wherein the data receiving module is respectively connected to the adaptive baud rate module and the receiving data processing module, for receiving data through the preset pin in the UART, and storing the data in the register, generating a baud rate division coefficient by performing data frame detection on the data, and sending the baud rate division coefficient to the adaptive baud rate module; the receiving data processing module is respectively connected to the receiving wake-up signal generating module and the receiving storage module, for receiving the data received by the data receiving module, and decoding and verifying the data; the receiving wake-up signal generating module is used to judge whether the data wakes up the MCU based on the decoding result of the data by the receiving data processing module, and if the judgment result is yes, generates a first wake-up signal and sends the first wake-up signal to the MCU; the receiving storage module is used to receive the data decoded and verified by the receiving data processing module, and store the decoded and verified data.

[0008] Optionally, the sending module includes: a sending storage module, a sending data processing module, a sending wake-up signal generating module and a data sending module, wherein the sending storage module is respectively connected to the forwarding module and the peripheral bus module, and is used to receive data forwarded by the forwarding module, or to receive data sent by the peripheral bus module before the MCU goes to sleep or wakes up; one end of the sending data processing module is connected to the output end of the sending storage module, and the other end of the sending data processing module is respectively connected to the data sending module and the sending wake-up signal generating module, and is used to encapsulate the data in the sending storage module, obtain a data frame, and send the data frame to the data sending module; the sending wake-up signal generating module is used to determine whether to wake up the MCU based on the data frame, and if the judgment result is yes, generate a second wake-up signal and send the second wake-up signal to the MCU; the data sending module is used to send the data frame output by the sending data processing module.

[0009] Optionally, the input end of the peripheral bus module is connected to the forwarding module, and the output end of the peripheral bus module is connected to the sending module, for sending the data forwarded by the forwarding module to the sending module before the MCU goes to sleep or wakes up; the output end of the peripheral bus module is connected to the adaptive baud rate module, for sending the received configuration instructions to the adaptive baud rate module, so that the adaptive baud rate module generates a baud rate according to the configuration instructions.

[0010] In a second aspect, an embodiment of the present invention provides a method for data transmission, which is applied to a device for data transmission, the method comprising: when the MCU enters sleep mode, the peripheral bus module stops running, the UART runs according to a preset frequency clock, and receives data through a preset pin in the UART; according to a preset parameter configuration, a corresponding wake-up mode is selected for the received data, wherein the wake-up mode comprises: a receiving wake-up mode or a sending wake-up mode; when the wake-up mode is a receiving wake-up mode, a first wake-up signal is generated by a receiving module, the first wake-up signal is sent to the MCU to wake up the MCU, and the data is sent to the sending module through the peripheral bus module; or, the data is sent to the sending module through a forwarding module; when the wake-up mode is a sending wake-up mode, the data is forwarded to the sending module through the forwarding module, a second wake-up signal is generated through a preset parameter configuration, the second wake-up signal is sent to the MCU to wake up the MCU, and the data is sent through the sending module; wherein, in sleep mode, the data received by the receiving module is forwarded to the sending module through the forwarding module.

[0011] Optionally, before the MCU enters the sleep mode, the method further includes: configuring parameters of the UART through the peripheral bus module, wherein the parameter configuration includes: data frame format, baud rate and wake-up mode.

[0012] Optionally, the data frame format includes: a start bit, data bits, a parity bit and an end bit, wherein the start bit is fixed to 0; the data bit length is 6-8 bits, the parity bit is 1 bit, and the end bit is fixed to 1.

[0013] Further, optionally, the wake-up mode includes: a receiving wake-up mode or a sending wake-up mode, wherein the receiving wake-up mode and the sending wake-up mode include at least one of the following: start bit wake-up, by setting a low level wake-up or a falling edge wake-up, during the process of receiving or sending data, if the start bit is detected to be a low level, or a falling edge occurs, a first wake-up signal or a second wake-up signal is generated; character wake-up, when a preset number of characters are received or sent, a first wake-up signal or a second wake-up signal is generated; character matching wake-up, when a preset number of characters are received or sent, and the character sequence content is the same as the preset character sequence content, a first wake-up signal or a second wake-up signal is generated; when the character matching wake-up is the receiving wake-up mode, the characters that are not successfully matched are filtered to see whether they are stored in the receiving storage module; threshold wake-up, the threshold wake-up includes a first threshold wake-up or a second threshold wake-up, wherein the threshold in the first threshold wake-up is greater than the threshold in the second threshold wake-up, and when the specified character received or sent is greater than the first threshold wake-up or less than the second threshold wake-up, a first wake-up signal or a second wake-up signal is generated; wherein, in the character matching wake-up and the threshold wake-up, the position of the compared data frame format is the data bit.

[0014] Optionally, forwarding the data received by the receiving module to the sending module through the forwarding module includes: when the data frame formats of the receiving module and the sending module are different, converting the data frame format of the data from the data frame format of the receiving group to the data frame format of the sending module according to the data frame format set in the parameter configuration.

[0015] Optionally, the method further includes: adjusting the baud rates corresponding to the receiving module and the sending module respectively according to the baud rates set in the parameter configuration, so that the receiving module and the sending module perform full-duplex communication according to the corresponding baud rates.

[0016] Optionally, the method further includes: after the MCU wakes up, adjusting the frequency of the preset frequency clock of the UART, wherein the frequency of the preset frequency clock is a first frequency, the adjusted frequency is a second frequency, and the second frequency is greater than the first frequency.

[0017] The embodiment of the present invention provides a device and method for data transmission. Among them, the peripheral bus module is used to configure the parameters of the UART before the MCU enters the sleep mode; when the MCU enters the sleep mode, the peripheral bus module stops running, and the UART runs according to the preset frequency clock; the receiving module is used to receive data through the preset pin in the UART, and judge the received data according to the parameter configuration to determine whether to wake up the MCU. If the judgment result is yes, a first wake-up signal is generated and sent to the MCU; one end of the forwarding module is connected to the output end of the receiving module, and the other end of the forwarding module is respectively connected to the input end of the peripheral bus module and the input end of the sending module, and is used to determine whether the data received by the receiving module is sent to the peripheral bus module or the sending module, and the data frame format of the receiving module and the sending module is determined. In different situations, the data frame format of the data is converted from the data frame format of the receiving group to the data frame format of the sending module according to the parameter configuration; the sending module is used to receive the data output by the forwarding module or the peripheral bus module, and judge whether to wake up the MCU based on the data. If the judgment result is yes, a second wake-up signal is generated and sent to the MCU; the adaptive baud rate module is respectively connected to the receiving module and the sending module, and is used to generate corresponding baud rates for the receiving module and the sending module respectively, so that the receiving module and the sending module perform full-duplex communication according to the corresponding baud rate, so that when the MCU is asleep, the UART can rely on the low-frequency clock to achieve full-duplex communication and support multiple wake-up types, meeting the technical effect applicable to diversified communication scenarios of the power system. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0019] Figure 1 A schematic diagram of a data transmission device provided in Embodiment 1 of the present invention;

[0020] Figure 2 A schematic diagram of communication between different UART interfaces in a data transmission device provided in Embodiment 1 of the present invention;

[0021] Figure 3 A schematic diagram of data frame formats before and after forwarding in a data transmission device provided in embodiment 1 of the present invention;

[0022] Figure 4 A schematic flow chart of a data transmission method provided in Embodiment 2 of the present invention;

[0023] Figure 5A schematic diagram of a communication data frame format used in a data transmission method provided in a second embodiment of the present invention;

[0024] Figure 6 A flowchart of another data transmission method provided in embodiment 2 of the present invention. DETAILED DESCRIPTION

[0025] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0026] It should be noted that the terms "first", "second", etc. in the specification, claims and drawings of the present invention are used to distinguish different objects rather than to limit a specific order.

[0027] It should also be noted that the following embodiments of the present invention can be executed independently, or in combination with each other, and the embodiments of the present invention do not impose specific limitations on this.

[0028] Technical terms involved in the embodiments of this application:

[0029] UART: Universal Asynchronous Receiver / Transmitter;

[0030] MCU: Micro Controller Unit;

[0031] RTC: Real Time Clock;

[0032] LSB: Least Significant Bit;

[0033] MSB: Most Significant Bit;

[0034] RAM: Random Access Memory;

[0035] FIFO: First In First Out data buffer;

[0036] DDR: Double Data Rate (Double Data Rate).

[0037] Example 1

[0038] In a first aspect, an embodiment of the present invention provides a data transmission device. Figure 1 Schematic diagram of a data transmission device provided in Example 1 of the present invention; Figure 1 As shown, the data transmission device provided in the embodiment of the present application includes:

[0039] The peripheral bus module 10, the forwarding module 12, the adaptive baud rate module 14, the receiving module 16 and the sending module 18, wherein the peripheral bus module 10 is used to configure the parameters of the UART before the MCU enters the sleep mode; when the MCU enters the sleep mode, the peripheral bus module 10 stops running, the UART runs according to the preset frequency clock, the receiving module 16 is used to receive data through the preset pin in the UART, and judge the received data according to the parameter configuration to determine whether to wake up the MCU. If the judgment result is yes, a first wake-up signal is generated and the first wake-up signal is sent to the MCU; one end of the forwarding module 12 is connected to the output end of the receiving module 16, and the other end of the forwarding module 12 is respectively connected to the input end of the peripheral bus module 10 and the input end of the sending module 18, When determining that the data received by the receiving module 16 is sent to the peripheral bus module 10 or the sending module 18, and when the data frame formats of the receiving module 16 and the sending module 18 are different, the data frame format of the data is converted from the data frame format of the receiving group to the data frame format of the sending module 18 according to the parameter configuration; the sending module 18 is used to receive the data output by the forwarding module 12 or the peripheral bus module 10, and judge whether to wake up the MCU according to the data. If the judgment result is yes, a second wake-up signal is generated and the second wake-up signal is sent to the MCU; the adaptive baud rate module 14 is respectively connected to the receiving module 16 and the sending module 18, and is used to generate corresponding baud rates for the receiving module 16 and the sending module 18, so that the receiving module 16 and the sending module 18 perform full-duplex communication according to the corresponding baud rate.

[0040] Optionally, the receiving module 16 includes: a data receiving module, a receiving data processing module, a receiving wake-up signal generating module and a receiving storage module, wherein the data receiving module is respectively connected to the adaptive baud rate module 14 and the receiving data processing module, for receiving data through the preset pin in the UART, and storing the data in the register, generating a baud rate division coefficient by performing data frame detection on the data, and sending the baud rate division coefficient to the adaptive baud rate module 14; the receiving data processing module is respectively connected to the receiving wake-up signal generating module and the receiving storage module, for receiving the data received by the data receiving module, and decoding and verifying the data; the receiving wake-up signal generating module is used to judge whether the data wakes up the MCU based on the decoding result of the data by the receiving data processing module, and if the judgment result is yes, generates a first wake-up signal and sends the first wake-up signal to the MCU; the receiving storage module is used to receive the data decoded and verified by the receiving data processing module, and store the decoded and verified data.

[0041] Optionally, the sending module 18 includes: a sending storage module, a sending data processing module, a sending wake-up signal generating module and a data sending module, wherein the sending storage module is respectively connected to the forwarding module 12 and the peripheral bus module 10, and is used to receive data forwarded by the forwarding module 12, or to receive data sent by the peripheral bus module 10 before the MCU goes to sleep or wakes up; one end of the sending data processing module is connected to the output end of the sending storage module, and the other end of the sending data processing module is respectively connected to the data sending module and the sending wake-up signal generating module, and is used to encapsulate the data in the sending storage module, obtain a data frame, and send the data frame to the data sending module; the sending wake-up signal generating module is used to determine whether to wake up the MCU based on the data frame, and if the judgment result is yes, generate a second wake-up signal and send the second wake-up signal to the MCU; the data sending module is used to send the data frame output by the sending data processing module.

[0042] Optionally, the input end of the peripheral bus module 10 is connected to the forwarding module 12, and the output end of the peripheral bus module 10 is connected to the sending module 18, for sending the data forwarded by the forwarding module 12 to the sending module 18 before the MCU goes to sleep or wakes up; the output end of the peripheral bus module 10 is connected to the adaptive baud rate module 14, for sending the received configuration instructions to the adaptive baud rate module 14, so that the adaptive baud rate module 14 generates a baud rate according to the configuration instructions.

[0043] In summary, the parameter configuration in the data transmission device provided in the embodiment of the present application includes: data frame format, baud rate, wake-up mode; before the MCU enters sleep mode, it is necessary to set the relevant configuration of the low-power UART through the peripheral bus module 10, such as data frame format, baud rate, wake-up mode (that is, the parameter configuration in the embodiment of the present application), etc. When the MCU is asleep, the peripheral bus module 10 stops working, and at this time the UART relies on a low-frequency clock (that is, the preset frequency clock in the embodiment of the present application) to work. Then the UART starts to receive and send data in full-duplex, and detects whether the wake-up conditions are met. When the wake-up conditions are met, the UART will generate a wake-up signal, the MCU will enter the normal working mode, and the peripheral bus module 10 will start working again. After reconfiguring the relevant configurations of the UART, the MCU can enter sleep mode again.

[0044] Specifically, such as Figure 1 As shown, in the data transmission device provided in the embodiment of the present application,

[0045] The receiving module 16 includes: a data receiving module, a receiving data processing module, a receiving wake-up signal generating module and a receiving storage module; wherein,

[0046] The data receiving module selects a pin from among multiple common UART pins (i.e., a preset pin in the UART in the embodiment of the present application) to receive data and stores the data in a register. It also detects data frames and generates a baud rate division factor for the adaptive baud rate module 14, thereby automatically adapting to the communication baud rate.

[0047] Receiving data processing module: When the data receiving module passes the data to the receiving data processing module, the data will be decoded and verified.

[0048] Receive wake-up signal generating module: When the received data processing module decodes and processes the data, if the wake-up condition is met, it will generate a wake-up signal (ie, the first wake-up signal in the embodiment of the present application) to the MCU.

[0049] Receiving and storing module: After the receiving data processing module decodes and verifies the data, it will store the data in the receiving and storing module.

[0050] The sending module 18 includes: a sending storage module, a sending data processing module, a sending wake-up signal generating module and a data sending module, wherein:

[0051] Sending storage module: The sending storage module can receive data in the forwarding module 12, and can also receive data in the peripheral bus module 10 before the MCU goes to sleep or after waking up.

[0052] Sending data processing module: When the sending storage module passes the data to the sending data processing module, it will encapsulate the data to form a data frame, and then send the data to the data sending module.

[0053] Sending wake-up signal generating module: When the sending data processing module processes the data, if the wake-up condition is met, it will generate a wake-up signal (ie, the second wake-up signal in the embodiment of the present application) to the MCU.

[0054] Data sending module: can select a pin from multiple common UART pins for data sending.

[0055] In the embodiment of the present application, the receiving storage module and the sending storage module may include: RAM, FIFO, DDR, which is only used as an example for illustration and is not specifically limited.

[0056] In addition, in the embodiment of the present application, the check method that can be used for the check bit in the data frame format can be parity check, XOR check, cyclic redundancy check (CRC) redundancy check, etc.

[0057] It should be noted that when the MCU is asleep, the low-power UART can support multiple wake-up modes, including N-character receive / send wake-up, start bit receive / send wake-up, N-character match receive / send wake-up, and threshold receive / send wake-up.

[0058] Based on the functions of the receiving module 16 and the sending module 18, the mode of waking up the MCU in the data transmission device provided in the embodiment of the present application is as follows:

[0059] The wakeup modes can be divided into two categories: receive wakeup and transmit wakeup. Each of these categories can be further divided into the following four wakeup modes. Before the UART goes to sleep, the specific wakeup method should be set first.

[0060] Start bit wake-up: In the data frame format, the end bit is fixed to 1 and the start bit is fixed to 0. This wake-up mode can be set to low-level wake-up or falling edge wake-up, that is, when the start bit is detected to be 0 or a falling edge occurs during receiving or sending data, a wake-up signal is generated.

[0061] N-character wake-up: After receiving or sending N characters, a wake-up signal is generated.

[0062] N character match wakeup: When N characters are received or sent, and the character sequence is the same as the character sequence to be compared, a wakeup signal is generated. When this mode is receive wakeup mode, you can set whether the characters that did not match successfully are stored in the receive storage module.

[0063] Threshold wake-up, threshold wake-up is divided into high threshold wake-up and low threshold wake-up. When a character received or sent is higher or lower than the threshold, a wake-up signal is generated.

[0064] In N-character match wakeup and threshold wakeup, only the data bits are compared; other bits are not included in the comparison.

[0065] When the MCU is asleep, the UART can achieve full-duplex communication using a low-frequency clock, and the data frame format, transmission method, and baud rate for sending and receiving can differ. To meet the diverse and complex requirements of power system communications, various wakeup methods are available. For example, when using the UART to receive data from complex protocols, subsequent data is only meaningful if the correct message header is received. In this case, the N-character match wakeup mode can be used.

[0066] Based on the receiving module 16 and the sending module 18, the data transmission device provided in the embodiment of the present application further includes:

[0067] Forwarding module 12: Data in the receiving storage module can be indirectly sent to the transmitting storage module or to the peripheral bus module before or after the MCU is asleep. The forwarding module determines whether to send data to the peripheral bus module or the transmitting storage module. When data flows from the receiving storage module to the transmitting storage module, if the data frame formats of the two modules differ, the forwarding module repackages the data in the receiving storage module according to the format of the transmitting storage module.

[0068] Due to the functionality and connection structure of the forwarding module 12, when the MCU is operating normally, the peripheral bus module 10 can read data from the receiving storage module and simultaneously write data to the transmitting storage module. Therefore, data received by the UART can be forwarded via the peripheral bus module 10. During forwarding, the data frame format can be modified to accommodate different interface formats. Furthermore, the transmission rates for sending and receiving can also be different. However, when the MCU enters sleep mode, the peripheral bus module 10 cannot continue operating, and the forwarding function is therefore unavailable.

[0069] In the data transmission device provided in the embodiments of the present application, a data path is added between the receiving storage module and the sending storage module. This path is implemented by forwarding module 12. When the MCU enters sleep mode, forwarding module 12 can forward data from the receiving storage module to the sending storage module. When data flows from the receiving storage module to the sending storage module, if the data frame formats of the two modules are different, forwarding module 12 repackages the data in the receiving storage module according to the format of the sending storage module. Figure 2 A schematic diagram of communication between different UART interfaces in a data transmission device provided in the first embodiment of the present invention is shown as follows: Figure 2 As shown in the figure, when the data frame format and baud rate of interfaces UART1 and UART3 are different, interface UART2 is required as an intermediary. After receiving data at the baud rate of UART1, UART2 repackages it according to the data frame format of UART3 and sends the data at the baud rate of UART3.

[0070] Figure 3 Schematic diagram of data frame formats before and after forwarding in a data transmission device provided in embodiment 1 of the present invention; Figure 3 As shown, the data frame format of UART2 before forwarding is the same as that of UART1, which is 1 start bit, 8 data bits, 1 check bit, and 1 end bit. After passing through the forwarding module 12, the data frame format of UART2 is the same as that of UART3, which is 2 start bits, 6 data bits, 1 check bit, and 2 end bits. When long data is modified into short data, a truncation method is adopted to truncate the low bit. When short data is modified into long data, a high bit is padded with 0. The UART supports LSB and MSB transmission modes, and the transmission modes of receiving and sending can be different. When intercepting and padded with 0, the forwarding module 12 will make corresponding adjustments according to the transmission modes of receiving and sending. The forwarding module 12 will adjust the baud rate according to the baud rate of the receiving data processing module and the sending data processing module because the adaptive baud rate module 14 can generate baud rates for the receiving data processing module and the sending data processing module respectively. Therefore, after the data is forwarded, the baud rate can also be different.

[0071] It should be noted that when the MCU is asleep, the low-power UART can forward the received data through the forwarding module and can modify the format, transmission mode and baud rate of the data frame.

[0072] Peripheral bus module 10: Before the MCU goes to sleep or wakes up, it can receive data from the forwarding module and send data to the sending storage module. It can also send commands to the adaptive baud rate module to set the baud rate.

[0073] In this embodiment of the present application, when received data is to be sent to the peripheral bus module 10, it must pass through the forwarding module 12 and then to the peripheral bus module 10. The peripheral bus module 10 is connected to the adaptive baud rate module 14, which configures the initial baud rate. To achieve full-duplex communication, the adaptive baud rate module 14 generates baud rates for both the receive data processing module and the transmit data processing module.

[0074] In the data transmission device provided in the embodiments of the present application, the low-power UART can achieve UART full-duplex communication, and the data frame format, transmission mode, and baud rate of the sent and received data can be different. When the MCU is asleep, the operating clock is a low-frequency clock. When the MCU wakes up, the operating clock is the Advanced Peripheral Bus (APB) clock.

[0075] An embodiment of the present invention provides a device for data transmission. Among them, the peripheral bus module is used to configure the parameters of the UART before the MCU enters the sleep mode; when the MCU enters the sleep mode, the peripheral bus module stops running, and the UART runs according to the preset frequency clock; the receiving module is used to receive data through the preset pin in the UART, and judge the received data according to the parameter configuration to determine whether to wake up the MCU. If the judgment result is yes, a first wake-up signal is generated and sent to the MCU; one end of the forwarding module is connected to the output end of the receiving module, and the other end of the forwarding module is respectively connected to the input end of the peripheral bus module and the input end of the sending module, and is used to determine whether the data received by the receiving module is sent to the peripheral bus module or the sending module, and the data frame format of the receiving module and the sending module is determined. In different situations, the data frame format of the data is converted from the data frame format of the receiving group to the data frame format of the sending module according to the parameter configuration; the sending module is used to receive the data output by the forwarding module or the peripheral bus module, and judge whether to wake up the MCU based on the data. If the judgment result is yes, a second wake-up signal is generated and sent to the MCU; the adaptive baud rate module is respectively connected to the receiving module and the sending module, and is used to generate corresponding baud rates for the receiving module and the sending module respectively, so that the receiving module and the sending module perform full-duplex communication according to the corresponding baud rate, so that when the MCU is asleep, the UART can rely on the low-frequency clock to achieve full-duplex communication and support multiple wake-up types, meeting the technical effect applicable to diversified communication scenarios of the power system.

[0076] Example 2

[0077] In a second aspect, an embodiment of the present invention provides a method for data transmission. Figure 4 A flowchart of a data transmission method provided in the second embodiment of the present invention; Figure 4 As shown, the device is applied to data transmission, and the data transmission method provided by the embodiment of the present application includes:

[0078] Step S402, when the MCU enters sleep mode, the peripheral bus module stops running, the UART runs according to a preset frequency clock, and receives data through a preset pin in the UART;

[0079] Step S404: selecting a corresponding wake-up mode for the received data according to a preset parameter configuration, wherein the wake-up mode includes: a receiving wake-up mode or a sending wake-up mode;

[0080] Step S406: When the wake-up mode is the receiving wake-up mode, a first wake-up signal is generated by the receiving module, the first wake-up signal is sent to the MCU to wake up the MCU, and data is sent to the sending module through the peripheral bus module; or, the data is sent to the sending module through the forwarding module;

[0081] Among them, after receiving and waking up the MCU, the received data can be sent to the sending module through the forwarding module (without passing through the peripheral bus module to the sending module), and the received data can also be sent to the peripheral bus module through the forwarding module (after waking up, by adopting this method, the data will be stored in the register through the bus, and the user can read the data by reading the register). Step S408, when the wake-up mode is the sending wake-up mode, the data is forwarded to the sending module through the forwarding module, and a second wake-up signal is generated through the preset parameter configuration. The second wake-up signal is sent to the MCU to wake up the MCU, and the data is sent through the sending module; wherein, in the sleep mode, the data received by the receiving module is forwarded to the sending module through the forwarding module.

[0082] Optionally, before the MCU enters sleep mode in step S402, the data transmission method provided in the embodiment of the present application also includes: configuring the UART parameters through the peripheral bus module, wherein the parameter configuration includes: data frame format, baud rate and wake-up mode.

[0083] Optionally, the data frame format includes: a start bit, data bits, a parity bit and an end bit, wherein the start bit is fixed to 0; the data bit length is 6-8 bits, the parity bit is 1 bit, and the end bit is fixed to 1.

[0084] The UART communication method used in the data transmission method provided in the embodiments of the present application is asynchronous serial communication, and its basic transmission unit is the character. During communication, the transmission is carried out in a one-bit sequence, and the time interval between each two adjacent bits is fixed, and the length of the interval can be characterized by the baud rate. Figure 5 A schematic diagram of a communication data frame format used in a data transmission method provided in the second embodiment of the present invention is shown as follows: Figure 5 As shown in the figure, the data frame format consists of a start bit, data bits, parity bit, and end bit. The start bit is fixed to 0 and has a length of 1-2 bits, the data bit is 6-8 bits long, the parity bit is 1 bit, and the end bit is fixed to 1 and has a length of 1-2 bits.

[0085] Further, optionally, the wake-up mode includes: a receiving wake-up mode or a sending wake-up mode, wherein the receiving wake-up mode and the sending wake-up mode include at least one of the following: start bit wake-up, by setting a low level wake-up or a falling edge wake-up, during the process of receiving or sending data, if the start bit is detected to be a low level, or a falling edge occurs, a first wake-up signal or a second wake-up signal is generated; character wake-up, when a preset number of characters are received or sent, a first wake-up signal or a second wake-up signal is generated; character matching wake-up, when a preset number of characters are received or sent, and the character sequence content is the same as the preset character sequence content, a first wake-up signal or a second wake-up signal is generated; when the character matching wake-up is the receiving wake-up mode, the characters that are not successfully matched are filtered to see whether they are stored in the receiving storage module; threshold wake-up, the threshold wake-up includes a first threshold wake-up or a second threshold wake-up, wherein the threshold in the first threshold wake-up is greater than the threshold in the second threshold wake-up, and when the specified character received or sent is greater than the first threshold wake-up or less than the second threshold wake-up, a first wake-up signal or a second wake-up signal is generated; wherein, in the character matching wake-up and the threshold wake-up, the position of the compared data frame format is the data bit.

[0086] Specifically, the wake-up mode in the embodiment of the present application is as follows:

[0087] When the MCU is in sleep mode, the low-power UART can support multiple wake-up modes, including N-character receive / send wake-up, start bit receive / send wake-up, N-character match receive / send wake-up, and threshold receive / send wake-up.

[0088] Based on the functions of the receiving module and the sending module, the mode of waking up the MCU in the data transmission device provided in the embodiment of the present application is as follows:

[0089] The wakeup modes can be divided into two categories: receive wakeup and transmit wakeup. Each of these categories can be further divided into the following four wakeup modes. Before the UART goes to sleep, the specific wakeup method should be set first.

[0090] Start bit wake-up: In the data frame format, the end bit is fixed to 1 and the start bit is fixed to 0. This wake-up mode can be set to low-level wake-up or falling edge wake-up, that is, when the start bit is detected to be 0 or a falling edge occurs during receiving or sending data, a wake-up signal is generated.

[0091] N-character wake-up: After receiving or sending N characters, a wake-up signal is generated.

[0092] N character match wakeup: When N characters are received or sent, and the character sequence is the same as the character sequence to be compared, a wakeup signal is generated. When this mode is receive wakeup mode, you can set whether the characters that did not match successfully are stored in the receive storage module.

[0093] Threshold wake-up, threshold wake-up is divided into high threshold wake-up and low threshold wake-up. When a character received or sent is higher or lower than the threshold, a wake-up signal is generated.

[0094] In N-character match wakeup and threshold wakeup, only the data bits are compared; other bits are not included in the comparison.

[0095] For example, if 5 bytes of data are sent and the 5 bytes to be compared match the 5 bytes to be compared, a wake-up signal is generated. When the MCU is asleep, the UART can achieve full-duplex communication using a low-frequency clock, and the data frame format, transmission method, and baud rate for sending and receiving can differ. To meet the diverse and complex requirements of power system communications, various wake-up sources are available. For example, when using the UART to receive data from complex protocols, subsequent data is only meaningful if the correct message header is received. In this case, the N-character match wake-up mode can be used.

[0096] Optionally, forwarding the data received by the receiving module to the sending module through the forwarding module in step S408 includes: when the data frame formats of the receiving module and the sending module are different, converting the data frame format of the data from the data frame format of the receiving group to the data frame format of the sending module according to the data frame format set in the parameter configuration.

[0097] Optionally, the data transmission method provided in the embodiment of the present application also includes: according to the baud rate set in the parameter configuration, respectively corresponding baud rates for the receiving module and the sending module, so that the receiving module and the sending module perform full-duplex communication according to the corresponding baud rate.

[0098] Optionally, the data transmission method provided in an embodiment of the present application also includes: after the MCU wakes up, adjusting the frequency of the preset frequency clock of the UART, wherein the frequency of the preset frequency clock is a first frequency, the adjusted frequency is a second frequency, and the second frequency is greater than the first frequency.

[0099] In summary, Figure 6 A flowchart of another data transmission method provided in the second embodiment of the present invention; Figure 6 As shown in the figure, before the MCU enters sleep mode, the peripheral bus module must configure the low-power UART, such as the data frame format, baud rate, and wake-up mode. When the MCU enters sleep mode, the peripheral bus module stops operating, and the UART operates using a low-frequency clock. The UART then begins full-duplex transmission and reception and checks for wake-up conditions. If the conditions are met, the UART generates a wake-up signal, the MCU enters normal operation, and the peripheral bus module resumes operation. After reconfiguring the UART, the MCU can enter sleep mode again.

[0100] An embodiment of the present invention provides a method for data transmission. When an MCU enters sleep mode, a peripheral bus module stops running, a UART operates according to a preset frequency clock, and receives data through a preset pin in the UART. A corresponding wake-up mode is selected for the received data according to a preset parameter configuration, wherein the wake-up mode includes: a receive wake-up mode or a transmit wake-up mode. When the wake-up mode is the receive wake-up mode, a first wake-up signal is generated by a receive module, the first wake-up signal is sent to the MCU to wake up the MCU, and data is sent to a transmit module through the peripheral bus module. When the wake-up mode is the transmit wake-up mode, the data is forwarded to the transmit module by a forwarding module, a second wake-up signal is generated by a preset parameter configuration, the second wake-up signal is sent to the MCU to wake up the MCU, and the data is sent through the transmit module. In the sleep mode, the data received by the receive module is forwarded to the transmit module by the forwarding module, so that when the MCU is in sleep mode, the UART can rely on a low-frequency clock to achieve full-duplex communication and support multiple wake-up types, meeting the technical effect applicable to diversified communication scenarios of the power system.

[0101] 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 flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, 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 or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. 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.

[0102] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

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

[0104] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention.

Claims

1. A data transmission device, characterized in that: include: Peripheral bus module, forwarding module, adaptive baud rate module, receiving module and sending module, among which, The peripheral bus module is used to configure the parameters of the UART before the MCU enters the sleep mode; When the MCU enters the sleep mode, the peripheral bus module stops running, the UART runs according to a preset frequency clock, and the receiving module is used to receive data through a preset pin in the UART, and judge the received data according to the parameter configuration to determine whether to wake up the MCU. If the judgment result is yes, a first wake-up signal is generated and the first wake-up signal is sent to the MCU; One end of the forwarding module is connected to the output end of the receiving module, and the other end of the forwarding module is connected to the input end of the peripheral bus module and the input end of the sending module respectively, and is used to determine whether the data received by the receiving module is sent to the peripheral bus module or the sending module, and when the data frame formats of the receiving module and the sending module are different, convert the data frame format of the data from the data frame format of the receiving module to the data frame format of the sending module according to the parameter configuration; The sending module is configured to receive the data output by the forwarding module or the peripheral bus module, determine whether to wake up the MCU based on the data, and if the determination result is yes, generate a second wake-up signal and send the second wake-up signal to the MCU; The adaptive baud rate module is connected to the receiving module and the sending module respectively, and is used to generate corresponding baud rates for the receiving module and the sending module respectively, so that the receiving module and the sending module perform full-duplex communication according to the corresponding baud rates.

2. The data transmission device according to claim 1, characterized in that The receiving module includes: a data receiving module, a receiving data processing module, a receiving wake-up signal generating module and a receiving storage module, wherein: The data receiving module is connected to the adaptive baud rate module and the received data processing module respectively, and is used to receive the data through the preset pin in the UART, store the data in a register, generate a baud rate division coefficient by performing data frame detection on the data, and send the baud rate division coefficient to the adaptive baud rate module; The received data processing module is connected to the received wake-up signal generating module and the received storage module respectively, and is used to receive the data received by the data receiving module and decode and verify the data; The received wake-up signal generating module is configured to determine whether the data wakes up the MCU based on a decoding result of the data by the received data processing module, and if the determination result is yes, generate the first wake-up signal and send the first wake-up signal to the MCU; The receiving storage module is used to receive the data decoded and verified by the receiving data processing module, and store the decoded and verified data.

3. The data transmission device according to claim 1, characterized in that The sending module includes: a sending storage module, a sending data processing module, a sending wake-up signal generating module and a data sending module, wherein: The sending storage module is connected to the forwarding module and the peripheral bus module respectively, and is used to receive the data forwarded by the forwarding module, or receive the data sent by the peripheral bus module before the MCU goes to sleep or wakes up; One end of the sending data processing module is connected to the output end of the sending storage module, and the other end of the sending data processing module is connected to the data sending module and the sending wake-up signal generating module respectively, for encapsulating the data in the sending storage module to obtain a data frame, and sending the data frame to the data sending module; The wake-up signal generating module is configured to determine whether to wake up the MCU according to the data frame, and if the determination result is yes, generate the second wake-up signal and send the second wake-up signal to the MCU; The data sending module is used to send the data frame output by the sending data processing module.

4. The data transmission device according to claim 1, characterized in that The input end of the peripheral bus module is connected to the forwarding module, and the output end of the peripheral bus module is connected to the sending module, so as to send the data forwarded by the forwarding module to the sending module before the MCU goes to sleep or wakes up; and the output end of the peripheral bus module is connected to the adaptive baud rate module, so as to send the received configuration instruction to the adaptive baud rate module, so that the adaptive baud rate module generates a baud rate according to the configuration instruction.

5. A data transmission method, characterized in that: Applicable to a device for data transmission, the method comprising: When the MCU enters sleep mode, the peripheral bus module stops running, the UART runs according to the preset frequency clock, and receives data through the preset pins in the UART; Selecting a corresponding wake-up mode for the received data according to a preset parameter configuration, wherein the wake-up mode includes: a receiving wake-up mode or a sending wake-up mode; When the wake-up mode is the receiving wake-up mode, a first wake-up signal is generated by a receiving module, the first wake-up signal is sent to the MCU to wake up the MCU, and the data is sent to the sending module through the peripheral bus module; or, the data is sent to the sending module through a forwarding module; When the wake-up mode is the sending wake-up mode, the data is forwarded to the sending module through the forwarding module, a second wake-up signal is generated according to the preset parameter configuration, the second wake-up signal is sent to the MCU, the MCU is woken up, and the data is sent through the sending module; Wherein, in the sleep mode, the data received by the receiving module is forwarded to the sending module through the forwarding module.

6. The data transmission method according to claim 5, characterized in that: Before the MCU enters the sleep mode, the method further includes: The UART is parameterized via the peripheral bus module, wherein the parameter configuration includes: data frame format, baud rate, and wake-up mode.

7. The data transmission method according to claim 6, characterized in that: The data frame format includes: a start bit, data bits, a parity bit and an end bit, wherein the start bit is fixed to 0; the data bit length is 6-8 bits, the parity bit is 1 bit, and the end bit is fixed to 1.

8. The data transmission method according to claim 7, characterized in that: The wake-up mode includes: the receiving wake-up mode or the sending wake-up mode, wherein the receiving wake-up mode and the sending wake-up mode include at least one of the following: Start bit wake-up, by setting low level wake-up or falling edge wake-up, during the process of receiving or sending the data, if the start bit is detected to be the low level or a falling edge occurs, the first wake-up signal or the second wake-up signal is generated; Character wake-up, generating the first wake-up signal or the second wake-up signal when a preset number of characters are received or sent; Character matching wakeup: when a preset number of characters are received or sent, and the character sequence content is the same as the preset character sequence content, the first wakeup signal or the second wakeup signal is generated; when the character matching wakeup is the receiving wakeup mode, the characters that are not successfully matched are screened to see whether they are stored in the receiving storage module; Threshold wake-up, the threshold wake-up includes a first threshold wake-up or a second threshold wake-up, wherein the threshold in the first threshold wake-up is greater than the threshold in the second threshold wake-up, and when the received or sent designated character is greater than the first threshold wake-up or less than the second threshold wake-up, the first wake-up signal or the second wake-up signal is generated; In the character matching wakeup and the threshold wakeup, the position of the data frame format compared is the data bit.

9. The data transmission method according to claim 5, characterized in that: The forwarding of the data received by the receiving module to the sending module by the forwarding module includes: In the case that the data frame formats of the receiving module and the sending module are different, the data frame format of the data is converted from the data frame format of the receiving module to the data frame format of the sending module according to the data frame format set in the parameter configuration.

10. The data transmission method according to claim 6, characterized in that: The method further comprises: According to the baud rate set in the parameter configuration, the baud rates corresponding to the receiving module and the sending module are respectively set, so that the receiving module and the sending module perform full-duplex communication according to the corresponding baud rates.

11. The data transmission method according to claim 5, characterized in that: The method further comprises: After the MCU wakes up, the frequency of the preset frequency clock of the UART is adjusted, wherein the frequency of the preset frequency clock is a first frequency, the adjusted frequency is a second frequency, and the second frequency is greater than the first frequency.

Citation Information

Patent Citations

  • Method for preventing UART from receiving lost data during deep sleep of MCU

    CN111198776A

  • Equipment wakeup circuit, electronic equipment, wakeup system and equipment wakeup method

    CN111683399A