CN112118083A - Single-wire half-duplex communication method, communication device and equipment - Google Patents

Single-wire half-duplex communication method, communication device and equipment Download PDF

Info

Publication number
CN112118083A
CN112118083A CN202010909159.0A CN202010909159A CN112118083A CN 112118083 A CN112118083 A CN 112118083A CN 202010909159 A CN202010909159 A CN 202010909159A CN 112118083 A CN112118083 A CN 112118083A
Authority
CN
China
Prior art keywords
data
communication
receiving
capture function
communication method
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010909159.0A
Other languages
Chinese (zh)
Inventor
汪军
方桦
李洪嘉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Real Design Intelligent Technology Co Ltd
Original Assignee
Guangdong Real Design Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Real Design Intelligent Technology Co Ltd filed Critical Guangdong Real Design Intelligent Technology Co Ltd
Priority to CN202010909159.0A priority Critical patent/CN112118083A/en
Publication of CN112118083A publication Critical patent/CN112118083A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L5/00Arrangements affording multiple use of the transmission path
    • H04L5/14Two-way operation using the same type of signal, i.e. duplex
    • H04L5/16Half-duplex systems; Simplex/duplex switching; Transmission of break signals non-automatically inverting the direction of transmission

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Bidirectional Digital Transmission (AREA)

Abstract

The invention discloses a single-wire half-duplex communication method, which comprises the following steps: providing a data transmitting end and a data receiving end; the data sending end and the data receiving end establish communication connection through a data line, and the data sending end sends out a serial data frame during communication; when receiving data, loading a pulse width capture function in the data receiving end, detecting the interval time between two adjacent falling edges in a level signal in a data line through the pulse width capture function, and detecting a data bit after detecting a start bit; the invention aims to provide a single-wire half-duplex communication method, a communication device and equipment, wherein the method can effectively reduce the error rate of data transmission and ensure the reliability of data transmission.

Description

Single-wire half-duplex communication method, communication device and equipment
Technical Field
The invention relates to the technical field of MCU (microprogrammed control unit) communication, in particular to a single-wire half-duplex communication method, a single-wire half-duplex communication device and single-wire half-duplex communication equipment.
Background
At present, data communication between MCUs is generally carried out by using asynchronous serial ports, parallel ports, CAN and RS 485. The above communication systems are not supported by hardware resources, and the hardware support is accompanied by an increase in cost. On some low-power-consumption equipment, the power consumption can be greatly increased by using a hardware serial port, and if the serial port is wanted to be used, the simulation can be only carried out through an IO port. In some schemes, it is determined that in a project with fixed hardware resources, if a user wants to expand more data communication ports, the user needs to redesign and develop the data communication ports without the support of the framework, and a great amount of time and energy of technicians can be wasted to design and debug the data communication ports.
Disclosure of Invention
The invention aims to provide a single-wire half-duplex communication method which can effectively reduce the error rate of data transmission and ensure the reliability of the data transmission.
In order to achieve the purpose, the technical scheme of the invention is as follows:
a single-wire half-duplex communication method, comprising the steps of:
s1: providing a data transmitting end and a data receiving end;
s2: the data transmitting end and the data receiving end establish communication connection through a data line, the data transmitting end transmits a serial data frame during communication, each frame of data consists of two parts, namely a start bit and a plurality of data bits, and each data bit consists of two parts, namely a continuous clock synchronization unit and a data representation unit;
s3: when a serial data frame is sent, the start bit is a high level with the time length D, the clock synchronization unit is a high level with the time length A, and the data representation unit comprises low levels with the time lengths B and C respectively;
s4: when receiving data, loading a pulse width capture function in the data receiving end, detecting the interval time between two adjacent falling edges in a level signal in a data line through the pulse width capture function, and detecting a data bit after detecting a start bit; when detecting data bits, the time interval between two falling edges is detected according to the pulse width capture function, and data 0 and data 1 are determined.
By the method, each data bit contains a specific clock synchronization signal, so that the influence of accumulated errors on the communication process when a plurality of data bits are continuously transmitted is avoided; the time interval between two adjacent falling edges is directly acquired by using the pulse capture function, the data 0 and the data 1 are judged, the time interval is not determined by low levels with the time lengths of B and C in the data representation unit, so that the error generated by analyzing a serial data frame by a data sending end can be reduced, the pulse width captured by the pulse capture function is determined, the clock synchronization unit can be adjusted, the error rate is reduced, meanwhile, the communication error caused by the accumulated error during continuous transmission of a plurality of data bits in the communication process is avoided, and the scheme is convenient to be applied to the internal single-wire half-duplex communication of the vehicle-mounted split type electric equipment.
Further, in the step S2: when the data receiving end detects the start bit, the data receiving end regards as a new serial data frame to start transmission, and automatically stops receiving after receiving the complete serial data frame.
Further, in the step S2: after the data sending end sends out a serial data frame, the data sending end is switched to a receiving mode.
Further, in the step S2: the data transmitting terminal and the data receiving terminal are both provided with a buffer area, the buffer area comprises a first buffer area and a second buffer area, and the first buffer area and the second buffer area are used for temporarily storing serial data frames.
Further, in the step S4: when receiving data, loading a rising edge capture function and a falling edge capture function in the data receiving end, detecting the rising edge and the falling edge of a level signal in a data line through the rising edge capture function and the falling edge capture function, acquiring a count value, wherein the count value is used for confirming the interval time between adjacent rising edges and falling edges, and judging data 0 and data 1 according to the time length of the interval time.
Further, in the step S4: and exiting the receiving of the current data frame when the data transmitting end detects an invalid clock synchronization unit or data representation unit.
The invention also provides a communication device, which comprises a first device and a second device, wherein the first device and the second device are in communication connection through a communication line; wherein, the first device and the second device communicate with each other by the communication method.
The invention also provides equipment which comprises a control host and an application component, wherein the control host and the application component are in communication connection through a communication line; wherein, the control host and one or more modules in the application component communicate with each other through the communication method.
Furthermore, the communication line is one of a serial port line, a parallel port line, an RS485 bus and a CAN bus.
For a better understanding and practice, the invention is described in detail below with reference to the accompanying drawings.
Drawings
FIG. 1 is a flow chart illustrating a communication method;
fig. 2 is a system flow diagram of half-duplex in a communication method according to an embodiment of the present invention.
Fig. 3 is a diagram illustrating a format of a data frame according to an embodiment of the invention.
Detailed Description
In order to better illustrate the invention, the invention is described in further detail below with reference to the accompanying drawings.
Example one
As shown in fig. 1 and 3, a single-wire half-duplex communication method includes the following steps:
s1: providing a data transmitting end and a data receiving end;
s2: the data transmitting end and the data receiving end establish communication connection through a data line, the data transmitting end transmits a serial data frame during communication, each frame of data consists of two parts, namely a start bit and a plurality of data bits, and each data bit consists of two parts, namely a continuous clock synchronization unit and a data representation unit;
s3: when a serial data frame is sent, the start bit is a high level with the time length D, the clock synchronization unit is a high level with the time length A, and the data representation unit comprises low levels with the time lengths B and C respectively;
s4: when receiving data, loading a pulse width capture function in the data receiving end, detecting the interval time between two adjacent falling edges in a level signal in a data line through the pulse width capture function, and detecting a data bit after detecting a start bit; when detecting data bits, the time interval between two falling edges is detected according to the pulse width capture function, and data 0 and data 1 are determined.
By the method, each data bit contains a specific clock synchronization signal, so that the influence of accumulated errors on the communication process when a plurality of data bits are continuously transmitted is avoided; the time interval between two adjacent falling edges is directly acquired by using the pulse capture function, the data 0 and the data 1 are judged, the time interval is not determined by low levels with the time lengths of B and C in the data representation unit, so that the error generated by analyzing a serial data frame by a data sending end can be reduced, the pulse width captured by the pulse capture function is determined, the clock synchronization unit can be adjusted, the error rate is reduced, meanwhile, the communication error caused by the accumulated error during continuous transmission of a plurality of data bits in the communication process is avoided, and the scheme is convenient to be applied to the internal single-wire half-duplex communication of the vehicle-mounted split type electric equipment.
As a specific embodiment of the present invention, which is only for illustration and is not limited to the specific number, in this embodiment, the low level pulse B is 5 μ s, the low level pulse C is 10 μ s, and the time length A of the time synchronization unit is 20 μ s
In the step S2: when the data receiving end detects the start bit, the data receiving end regards as a new serial data frame to start transmission, and automatically stops receiving after receiving the complete serial data frame.
In the step S2: after the data sending end sends out a serial data frame, the data sending end is switched to a receiving mode.
In the step S2: the data transmitting terminal and the data receiving terminal are both provided with a buffer area, the buffer area comprises a first buffer area and a second buffer area, and the first buffer area and the second buffer area are used for temporarily storing serial data frames.
In the step S4: when receiving data, loading a rising edge capture function and a falling edge capture function in the data receiving end, detecting the rising edge and the falling edge of a level signal in a data line through the rising edge capture function and the falling edge capture function, acquiring a count value, wherein the count value is used for confirming the interval time between adjacent rising edges and falling edges, and judging data 0 and data 1 according to the time length of the interval time.
In the step S4: and exiting the receiving of the current data frame when the data transmitting end detects an invalid clock synchronization unit or data representation unit.
As shown in fig. 2 and 3, at the time of starting detection, in the present embodiment, the start bit is considered to be valid within the tolerance range of the time length D, wherein D is generally 2ms in the application, the data transmitting end transmits a serial data frame, and analyzes the serial data frame into a waveform and outputs the waveform to the first buffer area for storage, in the application, an output function (OW _ SendBytes) is called and stored in a first buffer area, after the step is finished, a data sending end is initialized, and a total interrupt is closed, after the serial data frame is analyzed into waveform output in the first buffer area, a total interrupt is started, at the moment, a data receiving end is initialized, a pulse capture function (OW _ PushWidth) is called to obtain the waveform output of the serial data frame and convert the waveform output into data to be stored in a pulse buffer area, the data are processed into byte data according to convention, and application processing is called by a receiving function (OW _ ReceiveByte). There may be a situation when the data receiving end is not initialized, in this scheme, the data receiving end defaults to having unprocessed data.
The pulse capture function (OW _ PushWidth) is used for directly inputting the pulse width in a manner of capturing the input of the timer, and the pulse capture function has been already applied in the prior art and is used for directly obtaining the value of the pulse width of the output waveform, which is not described herein again.
The pulse waveform analyzed by the data sending end indicates that the time interval of each data is fixed, namely data 0 is (a + B), data 1 is (a + C), in the application, data 0 is 25 μ s, and data 1 is 30 μ s, so that compared with the time interval of each data, generally, the smaller the pulse width is, the faster the rate is, the higher the error rate is, the problem of the error rate when data bits are transmitted and communicated is effectively reduced, and the reliability of communication is also improved.
The meaning of the data bits is represented by the length of the data representation unit, the serial data frame of a plurality of continuous data bits is passed, and the validity of the serial data frame is verified by the check bytes. Therefore, the influence of accumulated errors of the communication clock during data bit transmission is effectively avoided, and the communication reliability is improved.
As described above, in order to avoid that the hardware device mounted with the pulse capture function cannot be applied, the present invention is supplemented by loading the rising edge capture function and the falling edge capture function in the data receiving terminal when receiving data, detecting the rising edge and the falling edge of the level signal in the data line by the rising edge capture function and the falling edge capture function, acquiring the count value for confirming the interval time between the adjacent rising edge and falling edge, and determining data 0 and data 1 according to the time length of the interval time.
And the rising edge capture function (OW _ RisingEdge) and the falling edge capture function (OW _ FallingEdge) are used for obtaining the current timer count value in an external upper and lower edge interrupt mode, and then calculating the pulse width.
Example two
The invention also provides a communication device, which comprises a first device and a second device, wherein the first device and the second device are in communication connection through a communication line; wherein, the first device and the second device communicate with each other by the communication method. The communication device can be applied to household appliances and vehicle-mounted equipment, and the household appliances or the vehicle-mounted equipment using the communication device can improve the effective rate of communication between the household appliances or the vehicle-mounted equipment and the control host.
EXAMPLE III
The equipment comprises a control host and an application component, wherein the control host and the application component are in communication connection through a communication line; wherein, the control host and one or more modules in the application component communicate with each other through the communication method.
Furthermore, the communication line is one of a serial port line, a parallel port line, an RS485 bus and a CAN bus.
As a specific example in the third embodiment, the device may be a vehicle-mounted air purifier, and includes a control host and a purifying assembly, where the control host and the purifying assembly are in communication connection through a communication line;
the device can also be a vehicle-mounted cigarette lighter which comprises a control host and a cigarette lighting assembly, wherein the control host and the purification assembly are in communication connection through a communication line.
Variations and modifications to the above-described embodiments may occur to those skilled in the art, which fall within the scope and spirit of the above description. Therefore, the present invention is not limited to the specific embodiments disclosed and described above, and some modifications and variations of the present invention should fall within the scope of the claims of the present invention. Furthermore, although specific terms are employed herein, they are used in a generic and descriptive sense only and not for purposes of limitation.

Claims (9)

1. A single-wire half-duplex communication method, comprising the steps of:
s1: providing a data transmitting end and a data receiving end;
s2: the data transmitting end and the data receiving end establish communication connection through a data line, the data transmitting end transmits a serial data frame during communication, each frame of data consists of two parts, namely a start bit and a plurality of data bits, and each data bit consists of two parts, namely a continuous clock synchronization unit and a data representation unit;
s3: when a serial data frame is sent, the start bit is a high level with the time length D, the clock synchronization unit is a high level with the time length A, and the data representation unit comprises low levels with the time lengths B and C respectively;
s4: when receiving data, loading a pulse width capture function in the data receiving end, detecting the interval time between two adjacent falling edges in a level signal in a data line through the pulse width capture function, and detecting a data bit after detecting a start bit; when detecting data bits, the time interval between two falling edges is detected according to the pulse width capture function, and data 0 and data 1 are determined.
2. The communication method according to claim 1, wherein in the step S2: when the data receiving end detects the start bit, the data receiving end regards as a new serial data frame to start transmission, and automatically stops receiving after receiving the complete serial data frame.
3. The communication method according to claim 1, wherein in the step S2: after the data sending end sends out a serial data frame, the data sending end is switched to a receiving mode.
4. The communication method according to claim 1, wherein in the step S2: the data transmitting terminal and the data receiving terminal are both provided with a buffer area, the buffer area comprises a first buffer area and a second buffer area, and the first buffer area and the second buffer area are used for temporarily storing serial data frames.
5. The communication method according to claim 1, wherein in the step S4: when receiving data, loading a rising edge capture function and a falling edge capture function in the data receiving end, detecting the rising edge and the falling edge of a level signal in a data line through the rising edge capture function and the falling edge capture function, acquiring a count value, wherein the count value is used for confirming the interval time between adjacent rising edges and falling edges, and judging data 0 and data 1 according to the time length of the interval time.
6. The communication method according to claim 1, wherein in the step S4: and exiting the receiving of the current data frame when the data transmitting end detects an invalid clock synchronization unit or data representation unit.
7. A communication apparatus, comprising
The system comprises a first device and a second device, wherein the first device and the second device are in communication connection through a communication line;
wherein the first device and the second device communicate with each other by the communication method according to claims 1 to 6.
8. An apparatus, comprising
The system comprises a control host and an application component, wherein the control host and the application component are in communication connection through a communication line;
wherein, the control host and one or more modules in the application component are communicated by the communication method of claims 1 to 6.
9. The device of claim 8, wherein the communication line is one of a serial line, a parallel line, an RS485 bus, and a CAN bus.
CN202010909159.0A 2020-09-02 2020-09-02 Single-wire half-duplex communication method, communication device and equipment Pending CN112118083A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010909159.0A CN112118083A (en) 2020-09-02 2020-09-02 Single-wire half-duplex communication method, communication device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010909159.0A CN112118083A (en) 2020-09-02 2020-09-02 Single-wire half-duplex communication method, communication device and equipment

Publications (1)

Publication Number Publication Date
CN112118083A true CN112118083A (en) 2020-12-22

Family

ID=73804867

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010909159.0A Pending CN112118083A (en) 2020-09-02 2020-09-02 Single-wire half-duplex communication method, communication device and equipment

Country Status (1)

Country Link
CN (1) CN112118083A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115827535A (en) * 2022-11-07 2023-03-21 珠海东之尼电子科技有限公司 Control method, device and storage medium for single-wire synchronous two-way communication
CN115877761A (en) * 2022-12-06 2023-03-31 深圳市显控科技股份有限公司 Signal processing method, system, electronic equipment and storage medium
CN116634308A (en) * 2023-07-20 2023-08-22 杭州炬华科技股份有限公司 Instrument abnormal event acquisition method and system

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1212517A (en) * 1997-08-28 1999-03-31 三星电子株式会社 Serial data communication between integrated circuits
US7053667B1 (en) * 2003-09-12 2006-05-30 Analog Devices, Inc. Single wire digital interface
US20060153326A1 (en) * 2005-01-11 2006-07-13 Samsung Electronics Co. Ltd. Serial data communication apparatus and methods of using a single line
CN101431389A (en) * 2008-11-19 2009-05-13 北京巨数数字技术开发有限公司 Circuit and its signal transmission method
CN102279834A (en) * 2011-06-10 2011-12-14 深圳市骏普科技开发有限公司 Serial communication method
US20120027104A1 (en) * 2010-07-27 2012-02-02 Stmicroelectronics (Rousset) Sas Single-wire bus communication protocol
US20120139768A1 (en) * 2010-12-01 2012-06-07 Dialog Semiconductor Gmbh Device and method for the transmission and reception of high fidelity audio using a single wire
US20130336420A1 (en) * 2012-06-19 2013-12-19 Richtek Technology Corporation Method of Transmission through Single Wire
US8929467B1 (en) * 2014-01-13 2015-01-06 Liming Xiu Circuits and methods for one-wire communication bus of using pulse-edge for clock and pulse-duty-cycle for data
CN108429612A (en) * 2018-03-01 2018-08-21 航天柏克(广东)科技有限公司 A kind of semiduplex means of communication of single line
CN108989014A (en) * 2018-07-11 2018-12-11 江苏省精创电气股份有限公司 A kind of single serial half-duplex operation method of width clock tolerance

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1212517A (en) * 1997-08-28 1999-03-31 三星电子株式会社 Serial data communication between integrated circuits
US7053667B1 (en) * 2003-09-12 2006-05-30 Analog Devices, Inc. Single wire digital interface
US20060153326A1 (en) * 2005-01-11 2006-07-13 Samsung Electronics Co. Ltd. Serial data communication apparatus and methods of using a single line
CN101431389A (en) * 2008-11-19 2009-05-13 北京巨数数字技术开发有限公司 Circuit and its signal transmission method
US20120027104A1 (en) * 2010-07-27 2012-02-02 Stmicroelectronics (Rousset) Sas Single-wire bus communication protocol
US20120139768A1 (en) * 2010-12-01 2012-06-07 Dialog Semiconductor Gmbh Device and method for the transmission and reception of high fidelity audio using a single wire
CN102279834A (en) * 2011-06-10 2011-12-14 深圳市骏普科技开发有限公司 Serial communication method
US20130336420A1 (en) * 2012-06-19 2013-12-19 Richtek Technology Corporation Method of Transmission through Single Wire
US8929467B1 (en) * 2014-01-13 2015-01-06 Liming Xiu Circuits and methods for one-wire communication bus of using pulse-edge for clock and pulse-duty-cycle for data
CN108429612A (en) * 2018-03-01 2018-08-21 航天柏克(广东)科技有限公司 A kind of semiduplex means of communication of single line
CN108989014A (en) * 2018-07-11 2018-12-11 江苏省精创电气股份有限公司 A kind of single serial half-duplex operation method of width clock tolerance

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ST中文论坛: "stm32如何提高采集方波脉宽的精度", 《HTTPS://SHEQU.STMICROELECTRONICS.CN/THREAD-621676-1-1.HTML》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115827535A (en) * 2022-11-07 2023-03-21 珠海东之尼电子科技有限公司 Control method, device and storage medium for single-wire synchronous two-way communication
CN115877761A (en) * 2022-12-06 2023-03-31 深圳市显控科技股份有限公司 Signal processing method, system, electronic equipment and storage medium
CN116634308A (en) * 2023-07-20 2023-08-22 杭州炬华科技股份有限公司 Instrument abnormal event acquisition method and system
CN116634308B (en) * 2023-07-20 2023-12-26 杭州炬华科技股份有限公司 Instrument abnormal event acquisition method and system

Similar Documents

Publication Publication Date Title
CN112118083A (en) Single-wire half-duplex communication method, communication device and equipment
CN110471872B (en) System and method for realizing M-LVDS bus data interaction based on ZYNQ chip
JP5963783B2 (en) Microcontroller with CAN bus module and automatic speed detection
CN103714029A (en) Novel two-line synchronous communication protocol and application
CN105116830B (en) A kind of PLC control system and PLC expansion bus implementation methods
Liu et al. A flexible hardware architecture for slave device of i2c bus
CN110457744B (en) SD/SDIO equipment simulation model framework and design method thereof
CN107977290B (en) MIPI loop test method and test system
CN109062850B (en) Data sending and receiving method of single chip microcomputer
EP4391439A1 (en) Detection system for vehicle-mounted ethernet link synchronization signal
CN116670528A (en) System and technique for line diagnostics
CN113032320A (en) Asynchronous serial port communication baud rate self-adaption method
CN110635854B (en) Transmission protocol self-adaptive decoding system and method
CN116155843B (en) PYNQ-based pulse neural network chip data communication method and system
CN116209002A (en) Test data interaction method, test data interaction device and electronic equipment
WO2008038388A1 (en) Signal receiver apparatus and waveform shaping method
CN102447599A (en) Control system and control method for short-distance home communication protocol based on FSM (Finite State Machine)
CN115904844A (en) UART simulation model for printing BOOT information and working method thereof
CN115225723A (en) Method and device for decoding sent protocol
CN202385121U (en) Control system of FSM-based short distance home communication protocol
KR20170094699A (en) Digital Data Communication Module and its Data Simulator
CN113709010A (en) Modbus communication protocol system without frame length limitation
KR20070038519A (en) Baud rate detection
CN116860672B (en) Digital processing SMBus communication system and method
US20240323061A1 (en) Data transmission chip and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20201222