Asynchronous serial communication method and system based on single-line time coding

By combining a single communication line with a pull-up resistor and an RC low-pass filter in a time coding protocol, the problems of noise interference and signal collision in single-line communication are solved, achieving low-cost, high-efficiency, and reliable asynchronous serial communication.

CN121841887APending Publication Date: 2026-04-10SHENZHEN FENDA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-04
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing single-wire communication protocols are susceptible to interference in long-distance transmission or noisy environments, have high bit error rates, and experience frequent signal collisions in multi-device shared media, resulting in insufficient communication reliability and efficiency, as well as insufficient flexibility in low-power design.

Method used

It employs a single communication line combined with pull-up resistors and RC low-pass filters, and achieves data transmission through a time-coding protocol. It features collision detection and dynamic backoff mechanisms, adaptive timing calibration at the receiver, and reduces hardware complexity and power consumption.

Benefits of technology

It achieves low-cost, noise-resistant, and low-error-rate communication, improves bus utilization and communication reliability, adapts to clock frequency deviations of different devices, and reduces wiring and power consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121841887A_ABST
    Figure CN121841887A_ABST
Patent Text Reader

Abstract

The invention discloses an asynchronous serial communication method and system based on single-line time coding, relates to the technical field of asynchronous serial communication, and is cooperatively completed by a sending device and a receiving device. A sending end detects the state of a line before communication, and when the line continues to be in an idle state with the low level exceeding 500 microseconds, transmission is initiated. During sending, the data frame is converted into a pulse sequence with a specific width according to a time coding protocol, conflict detection is executed after each high-level pulse, and sending is terminated when a line is found to be pulled down. And the receiving end identifies the communication start by monitoring the start bit pulse pair, so as to calibrate the time sequence of the receiving end. When a data bit is decoded, the pulse width is accurately measured by sampling for multiple times and averaging, and a logic value is judged according to a width range. A pull-up resistor, open-drain output and an RC low-pass filter are combined on hardware to ensure signal quality, and a low-power-consumption mode is supported to enter in an idle state.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of asynchronous serial communication, in particular to an asynchronous serial communication method and system based on single-wire time coding. BACKGROUND

[0002] In the field of asynchronous serial communication, traditional communication methods often rely on multiple communication lines, such as a sending line, a receiving line, and a ground line, to achieve bidirectional data transmission between devices. This multi-line communication structure is mature and widely used, but in some resource-constrained application scenarios, such as low-cost embedded systems, Internet of Things nodes, or sensor networks, hardware complexity and wiring costs become significant drawbacks. To simplify connections and reduce system costs, single-wire communication technology has gradually gained attention, as it enables bidirectional data exchange through a single communication line while also considering power transmission or signal ground sharing.

[0003] Existing single-wire communication protocols, such as single-bus-based communication schemes, use level coding or time coding methods to represent data. The level coding method relies on the high and low voltage of the signal to distinguish the logic state, but it is easily disturbed in long-distance transmission or noisy environments, leading to an increase in error rate. The time coding method encodes information through pulse width or interval time, which has better anti-noise performance, but its implementation often requires high-precision timers and complex synchronization mechanisms.

[0004] In time-coded asynchronous serial communication, the identification of start bits and data bits relies on accurate time measurement. The common approach is to use a fixed time threshold to sample and judge the pulse width, but this method is prone to synchronization errors when the clock drifts or the environment changes, affecting communication reliability. In addition, multiple devices in a single-wire shared medium may attempt to send data simultaneously, leading to signal collisions, and existing protocols are often not efficient in conflict detection and processing mechanisms, which may cause frequent data retransmission or increased communication delay.

[0005] Low-power design is an important requirement for modern electronic devices. Many communication systems enter sleep mode during idle periods to save energy, but traditional protocols lack flexibility in wake-up and resynchronization, which may cause response delays or additional power consumption. SUMMARY

[0006] The purpose of the present application is to provide an asynchronous serial communication method and system based on single-wire time coding to solve the problems in the prior art.

[0007] To achieve the above purpose, the present application provides the following technical solution: an asynchronous serial communication system based on single-wire time coding; The asynchronous serial communication system comprises a hardware platform, a single communication line, a low-pass filter, a sending device, and a receiving device. The hardware platform is a microcontroller with general-purpose input GPIO pins, output GPIO pins, and microsecond-level precision timers to ensure the accuracy of pulse width encoding and decoding; The single communication line is connected to the positive power supply through a pull-up resistor with a resistance of 4.7 kΩ. When sending data, the GPIO is configured as an open-drain output mode. The open-drain output combined with the pull-up resistor is the key hardware foundation for enabling multiple devices to share the same bus and perform collision detection, thus making the system scalable. The RC low-pass filter is specifically constructed by connecting a 100-ohm resistor in series and a 100-picofarad capacitor in parallel between a single communication line and the GPIO pin of the microcontroller to form an RC low-pass filter, which suppresses high-frequency noise and transient glitches on the signal line and improves the stability and anti-interference capability of communication. In asynchronous serial communication, the transmitting device sends data frames to the receiving device. The transmitting device detects the duration of a low level in a single communication line and determines the level state based on the duration of the low level. If the level state is idle, the transmitting device converts the data frame to be transmitted into a corresponding pulse sequence to drive the single communication line according to a predefined time coding protocol. After transmitting each high-level pulse in the pulse sequence, a collision detection is performed. If the line is detected to be non-idle, the device waits for a backoff time and then re-executes this step. The backoff time is a randomly generated time within the range of 100 microseconds to 500 microseconds, and the idle state is a continuous low level for more than 500 microseconds. The backoff time can ensure that devices that have conflicted will not retry at the same time point, thus dispersing the probability of re-conflict and improving bus utilization and communication success rate.

[0008] The time coding protocol specifically defines the data frame structure as follows: the data frame consists of one start bit, eight data bits, and one stop bit; the stop bit is represented by a low-level pulse with a duration of 250-350 microseconds; after the eight data bits and before the stop bit, a parity bit is inserted, and the parity bit is encoded using the same pulse width as the data bit "0".

[0009] Following each high-level pulse, specifically after a 50-microsecond high-level pulse for the start bit and after a 100-microsecond or 200-microsecond high-level pulse for each data bit, the collision detection specifically involves the transmitting device switching its communication interface to input mode to read the instantaneous level of the communication line. If the read level is low, a collision is determined to have occurred, the current transmission is terminated, and the level status of the single communication line is re-detected. Performing collision detection immediately after each critical pulse enables the fastest detection of bus contention and timely termination of invalid transmissions.

[0010] The conflict detection method determines that when a conflict occurs, if the number of times the transmission is terminated reaches n, a k-millisecond silence period is waited before retransmission. This prevents the device from getting stuck in an infinite loop and consuming energy when there is a continuous conflict or bus failure. The n and k are constants that are set by professionals.

[0011] When the transmitting device detects that a single communication line has been idle for more than 500 microseconds, it configures its communication interface to a high-impedance state, shuts down the timer to enter a low-power mode to reduce power consumption during non-communication periods, and wakes up the monitoring of communication line activity through a level transition interrupt.

[0012] The receiving device monitors the level transitions on a single communication line and uses the start bit for dynamic timing calibration. It can adapt to small clock deviations between different devices and receive data frames when it detects a pulse sequence that matches the start bit characteristics. The receiving device uses the start bit timing as a reference to calibrate the sampling time of subsequent data bits. For each data bit, the receiving device measures the duration of the high-level pulse of the data bit and makes a judgment on the data bit.

[0013] The start bit feature is a high-level pulse with a width in the range of 40-60 microseconds followed by a low-level pulse with a width in the range of 40-60 microseconds; the calibration process specifically involves: upon detecting the start bit, the receiving device measures the actual duration T of the high-level pulse in the start bit. high and the actual duration T of the low-level pulse low ; Calculate the total duration T of the starting position. start =T high +T low Using this as the reference unit, the standard theoretical duration T of a single data bit is calculated according to the predefined time coding protocol. bit Further calculate the local duration scale T local =y×T bit y is a scaling factor; the receiving device uses T local Using the time reference, pulse width measurement and decoding operations are performed.

[0014] The measurement of the duration of the high-level pulse of the data bit and the judgment of the data bit are specifically as follows: x redundant samplings are performed during each high-level pulse, and the average value is taken as the effective pulse width; if the effective pulse width falls within the range of 90-110 microseconds, the data bit is determined to be logic "0"; if the effective pulse width falls within the range of 150-250 microseconds, the data bit is determined to be logic "1". The x is a constant set by professionals.

[0015] An asynchronous serial communication method based on single-line time coding, characterized in that the asynchronous serial communication method includes the following steps: Step S100: In asynchronous serial communication, the transmitting device sends a data frame to the receiving device. The transmitting device detects the duration of the low level in a single communication line and determines the level state by the duration of the low level. If the level state is in an idle state, proceed to step S200; if the line is detected to be in a non-idle state, wait for a backoff time and then re-execute this step. Step S200: The transmitting device converts the data frame to be transmitted into a corresponding pulse sequence to drive a single communication line according to a predefined time coding protocol; after transmitting each high-level pulse in the pulse sequence, a collision detection is performed; Step S300: The receiving device monitors the level transition on a single communication line, and receives a data frame when it detects a pulse sequence that matches the start bit characteristics; the receiving device calibrates the sampling time of subsequent data bits based on the start bit timing. Step S400: For each data bit, the receiving device measures the duration of its high-level pulse and determines the data bit.

[0016] Compared with the prior art, the beneficial effects of the present invention are: 1. Highly simplified hardware structure and low wiring cost: This invention uses a single communication line to achieve full-duplex asynchronous serial communication. Through a simple circuit design integrating pull-up resistors and RC low-pass filters, it eliminates the reliance on dedicated communication chips or complex level conversion modules. This reduces BOM costs and PCB wiring complexity. The system can directly adapt to various general-purpose microcontrollers with microsecond-level timers, providing a hardware solution for cost-sensitive multi-node applications such as IoT terminals and distributed sensor networks.

[0017] 2. Equipped with intelligent collision detection and dynamic backoff mechanism, resulting in high bus utilization efficiency: The system features an efficient collision avoidance mechanism. After each high-level pulse, the transmitting device switches to input mode to detect the line status. Once a collision is detected, transmission is immediately terminated and a random backoff timer is initiated. This "transmit-detect-response" mechanism solves the problem of multiple devices competing for the channel on a shared bus in a masterless architecture, improving communication reliability.

[0018] 3. Adaptive Timing Calibration at the Receiver: Addressing potential clock frequency discrepancies between different microcontrollers, the receiving device utilizes the actual pulse width of the start bit as a reference for dynamic timing calibration, generating a local time scale. This fundamentally eliminates the risk of sampling misalignment caused by accumulated clock errors. Combined with redundant sampling during high-level periods and a pulse width decision mechanism, the system effectively filters signal jitter and random noise, ensuring stable, low-error-rate data decoding even in complex electrical environments. Attached Figure Description

[0019] Fig. 1 This is a schematic diagram of the structure of an asynchronous serial communication method based on single-line time coding according to the present invention; Fig. 2 This is a schematic diagram of the data transmission process of an asynchronous serial communication system based on single-line time coding according to the present invention; Fig. 3 This is a schematic diagram of the data receiving process of an asynchronous serial communication system based on single-line time coding according to the present invention. Detailed Implementation

[0020] 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.

[0021] Example: Figs. 1-3 As shown, this invention provides a technical solution: an asynchronous serial communication system based on single-line time coding. It simulates a simple smart home sensor network, where a temperature and humidity sensor acts as the transmitting device, and a central controller acts as the receiving device. They communicate via a shared single communication line. The asynchronous serial communication system includes: a hardware platform, a single communication line, a low-pass filter, a transmitting device, and a receiving device; The hardware platform is a microcontroller with general-purpose input GPIO pins, output GPIO pins, and microsecond-level precision timers to ensure the accuracy of pulse width encoding and decoding; The single communication line is connected to the positive power supply through a pull-up resistor with a resistance of 4.7 kΩ. When sending data, the GPIO is configured as an open-drain output mode. The open-drain output combined with the pull-up resistor is the key hardware foundation for enabling multiple devices to share the same bus and perform collision detection, thus making the system scalable. The RC low-pass filter is specifically constructed by connecting a 100-ohm resistor in series and a 100-picofarad capacitor in parallel between a single communication line and the GPIO pin of the microcontroller to form an RC low-pass filter, which suppresses high-frequency noise and transient glitches on the signal line and improves the stability and anti-interference capability of communication. In asynchronous serial communication, the transmitting device sends data frames to the receiving device. The transmitting device detects the duration of a low level in a single communication line and determines the level state based on the duration of the low level. If the level state is idle, the transmitting device converts the data frame to be transmitted into a corresponding pulse sequence to drive the single communication line according to a predefined time coding protocol. After transmitting each high-level pulse in the pulse sequence, a collision detection is performed. If the line is detected to be non-idle, the device waits for a backoff time and then re-executes this step. The backoff time is a randomly generated time within the range of 100 microseconds to 500 microseconds, and the idle state is a continuous low level for more than 500 microseconds. The backoff time can ensure that devices that have conflicted will not retry at the same time point, thus dispersing the probability of re-conflict and improving bus utilization and communication success rate.

[0022] The time coding protocol specifically defines the data frame structure as follows: the data frame consists of one start bit, eight data bits, and one stop bit; the stop bit is represented by a low-level pulse with a duration of 250-350 microseconds; after the eight data bits and before the stop bit, a parity bit is inserted, and the parity bit is encoded using the same pulse width as the data bit "0".

[0023] Following each high-level pulse, specifically after a 50-microsecond high-level pulse for the start bit and after a 100-microsecond or 200-microsecond high-level pulse for each data bit, the collision detection specifically involves the transmitting device switching its communication interface to input mode to read the instantaneous level of the communication line. If the read level is low, a collision is determined to have occurred, the current transmission is terminated, and the level status of the single communication line is re-detected. Performing collision detection immediately after each critical pulse enables the fastest detection of bus contention and timely termination of invalid transmissions.

[0024] The conflict detection method determines that when a conflict occurs, if the number of times the transmission is terminated reaches n, a k-millisecond silence period is waited before retransmission. This prevents the device from getting stuck in an infinite loop and consuming energy when there is a continuous conflict or bus failure. The n and k are constants that are set by professionals.

[0025] When the transmitting device detects that a single communication line has been idle for more than 500 microseconds, it configures its communication interface to a high-impedance state, shuts down the timer to enter a low-power mode to reduce power consumption during non-communication periods, and wakes up the monitoring of communication line activity through a level transition interrupt.

[0026] The receiving device monitors the level transitions on a single communication line and uses the start bit for dynamic timing calibration. It can adapt to small clock deviations between different devices and receive data frames when it detects a pulse sequence that matches the start bit characteristics. The receiving device uses the start bit timing as a reference to calibrate the sampling time of subsequent data bits. For each data bit, the receiving device measures the duration of the high-level pulse of the data bit and makes a judgment on the data bit.

[0027] The start bit feature is a high-level pulse with a width in the range of 40-60 microseconds followed by a low-level pulse with a width in the range of 40-60 microseconds; the calibration process specifically involves: upon detecting the start bit, the receiving device measures the actual duration T of the high-level pulse in the start bit. high and the actual duration T of the low-level pulse low ; Calculate the total duration T of the starting position. start =T high +T low Using this as the reference unit, the standard theoretical duration T of a single data bit is calculated according to the predefined time coding protocol. bit Further calculate the local duration scale T local =y×T bit y is a scaling factor; the receiving device uses T local Using the time reference, pulse width measurement and decoding operations are performed.

[0028] The measurement of the duration of the high-level pulse of the data bit and the judgment of the data bit are specifically as follows: x redundant samplings are performed during each high-level pulse, and the average value is taken as the effective pulse width; if the effective pulse width falls within the range of 90-110 microseconds, the data bit is determined to be logic "0"; if the effective pulse width falls within the range of 150-250 microseconds, the data bit is determined to be logic "1". The x is a constant set by professionals.

[0029] An asynchronous serial communication method based on single-line time coding, characterized in that the asynchronous serial communication method includes the following steps: Step S100: In asynchronous serial communication, the transmitting device sends a data frame to the receiving device. The transmitting device detects the duration of the low level in a single communication line and determines the level state by the duration of the low level. If the level state is in an idle state, proceed to step S200; if the line is detected to be in a non-idle state, wait for a backoff time and then re-execute this step. Step S200: The transmitting device converts the data frame to be transmitted into a corresponding pulse sequence to drive a single communication line according to a predefined time coding protocol; after transmitting each high-level pulse in the pulse sequence, a collision detection is performed; Step S300: The receiving device monitors the level transition on a single communication line, and receives a data frame when it detects a pulse sequence that matches the start bit characteristics; the receiving device calibrates the sampling time of subsequent data bits based on the start bit timing. Step S400: For each data bit, the receiving device measures the duration of its high-level pulse and determines the data bit.

[0030] Example: After the transmitting device is initialized, the GPIO is configured to a high-impedance state to enter a low-power mode. Simultaneously, the bus level is monitored via interrupts. When data needs to be transmitted, the sensor is woken up. First, the bus level is detected; if it remains low for more than 500 microseconds, the bus is determined to be idle. The sensor then switches its GPIO from high-impedance to open-drain output mode, preparing to transmit the first frame of temperature data: 0001 1001. Transmit start bit: The transmitting device generates a 50-microsecond high level, followed by a 50-microsecond low level. After the 50-microsecond high level ends, the sensor immediately switches GPIO to input mode and reads the level. If a high level is read, it indicates no collision, and transmission continues. Data bits and parity bits to be sent: The data to be sent is: 0001 1001. Send the first bit 0: Generate a 100-microsecond high-level pulse. After the high-level pulse ends, check for no collision. Send stop bit: Send a low-level pulse for 300 microseconds to indicate the end of the frame; Start bit detection and dynamic calibration: The receiving device (central controller) continuously monitors the bus. Upon detecting a rising edge, it starts a timer. It measures a high level lasting 52 microseconds, followed by a low level lasting 48 microseconds. The total start bit time is calculated to be 100 microseconds. According to the protocol, the standard time for a data bit "0" is 100 microseconds. The scaling factor y is set to 1.0, and the receiving device sets its local time scale T. local =1.0 × 100 = 100 microseconds; Data bit sampling and decision: Starting from the first rising edge after the start bit, the receiving device measures the high-level pulse width. It performs redundant sampling x=5 times during the pulse period and takes the average to obtain the pulse width. After receiving 8 data bits and 1 parity bit, the receiving device detects a low level lasting 300 microseconds and confirms it as a valid stop bit, thus completing the reception of one frame of data.

[0031] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

Claims

1. An asynchronous serial communication system based on single-line time coding, characterized in that: The asynchronous serial communication system includes: a hardware platform, a single communication line, a low-pass filter, a transmitting device, and a receiving device; The hardware platform is a microcontroller with general-purpose input GPIO pins, output GPIO pins, and microsecond-level precision timers; The single communication line is connected to the positive power supply via a 4.7 kΩ pull-up resistor. When transmitting data, the GPIO is configured to open-drain output mode. The RC low-pass filter is specifically constructed by connecting a 100-ohm resistor in series and a 100-picofarad capacitor in parallel between a single communication line and the GPIO pin of the microcontroller. In asynchronous serial communication, the transmitting device sends data frames to the receiving device. The transmitting device detects the duration of a low level in a single communication line and determines the level state based on the duration of the low level. If the level state is idle, the transmitting device converts the data frame to be transmitted into a corresponding pulse sequence to drive the single communication line according to a predefined time coding protocol. After transmitting each high-level pulse in the pulse sequence, a collision detection is performed. If the line is detected to be non-idle, the device waits for a backoff time and then re-executes this step. The receiving device monitors the level transition on a single communication line and receives a data frame when it detects a pulse sequence that matches the start bit characteristics. The receiving device calibrates the sampling time of subsequent data bits based on the start bit timing. For each data bit, the receiving device measures the duration of the high-level pulse of the data bit and makes a judgment on the data bit.

2. The asynchronous serial communication system based on single-line time coding according to claim 1, characterized in that, The backoff time is a randomly generated time within the range of 100 microseconds to 500 microseconds, and the idle state is a continuous low level for more than 500 microseconds.

3. The asynchronous serial communication system based on single-line time coding according to claim 1, characterized in that, The time coding protocol specifically defines the data frame structure as follows: the data frame consists of one start bit, eight data bits, and one stop bit; the stop bit is represented by a low-level pulse with a duration of 250-350 microseconds; after the eight data bits and before the stop bit, a parity bit is inserted, and the parity bit is encoded using the same pulse width as the data bit "0".

4. The asynchronous serial communication system based on single-line time coding according to claim 1, characterized in that, After each high-level pulse, specifically after a 50-microsecond high-level pulse for the start bit and after a 100-microsecond or 200-microsecond high-level pulse for each data bit, the collision detection specifically involves the transmitting device switching its communication interface to input mode to read the instantaneous level of the communication line. If the read level is low, a collision is determined to have occurred, the current transmission is terminated, and the level status of a single communication line is re-detected.

5. An asynchronous serial communication system based on single-line time coding according to claim 1, characterized in that, The conflict detection determination is that when a conflict occurs, if the number of times the transmission is terminated reaches n, a silent period of k milliseconds is waited before retransmission. The n and k are constants that are set by professionals.

6. The asynchronous serial communication system based on single-line time coding according to claim 1, characterized in that, When the transmitting device detects that a single communication line has been idle for more than 500 microseconds, it configures its communication interface to a high-impedance state, shuts down the timer to enter a low-power mode, and wakes up the monitoring of communication line activity through a level transition interrupt.

7. An asynchronous serial communication system based on single-line time coding according to claim 1, characterized in that, The start bit feature is a high-level pulse with a width in the range of 40-60 microseconds followed by a low-level pulse with a width in the range of 40-60 microseconds; the calibration process specifically involves: upon detecting the start bit, the receiving device measures the actual duration T of the high-level pulse in the start bit. high and the actual duration T of the low-level pulse low ; Calculate the total duration T of the starting position. start =T high +T low Using this as the reference unit, the standard theoretical duration T of a single data bit is calculated according to the predefined time coding protocol. bit Further calculate the local duration scale T local =y×T bit y is a scaling factor; the receiving device uses T local Using the time reference, pulse width measurement and decoding operations are performed.

8. An asynchronous serial communication system based on single-line time coding according to claim 1, characterized in that, The measurement of the duration of the high-level pulse of the data bit and the judgment of the data bit are specifically as follows: x redundant samples are performed during each high-level pulse, and the average value is taken as the effective pulse width; if the effective pulse width falls within the range of 90-110 microseconds, the data bit is determined to be logic "0"; if the effective pulse width falls within the range of 150-250 microseconds, the data bit is determined to be logic "1". The x is a constant set by professionals.

9. An asynchronous serial communication method based on single-line time coding, characterized in that, The asynchronous serial communication method includes the following steps: Step S100: In asynchronous serial communication, the transmitting device sends a data frame to the receiving device. The transmitting device detects the duration of the low level in a single communication line and determines the level state by the duration of the low level. If the level state is in an idle state, proceed to step S200; if the line is detected to be in a non-idle state, wait for a backoff time and then re-execute this step. Step S200: The transmitting device converts the data frame to be transmitted into a corresponding pulse sequence to drive a single communication line according to a predefined time coding protocol; after transmitting each high-level pulse in the pulse sequence, a collision detection is performed; Step S300: The receiving device monitors the level transition on a single communication line, and receives a data frame when it detects a pulse sequence that matches the start bit characteristics; the receiving device calibrates the sampling time of subsequent data bits based on the start bit timing. Step S400: For each data bit, the receiving device measures the duration of its high-level pulse and determines the data bit.