[go: up one dir, main page]

WO2018095181A1 - 数据传输方法及装置 - Google Patents

数据传输方法及装置 Download PDF

Info

Publication number
WO2018095181A1
WO2018095181A1 PCT/CN2017/107600 CN2017107600W WO2018095181A1 WO 2018095181 A1 WO2018095181 A1 WO 2018095181A1 CN 2017107600 W CN2017107600 W CN 2017107600W WO 2018095181 A1 WO2018095181 A1 WO 2018095181A1
Authority
WO
WIPO (PCT)
Prior art keywords
sequence
waveform
data
bit
waveform sequence
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.)
Ceased
Application number
PCT/CN2017/107600
Other languages
English (en)
French (fr)
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.)
Tendyron Corp
Original Assignee
Tendyron Corp
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 Tendyron Corp filed Critical Tendyron Corp
Publication of WO2018095181A1 publication Critical patent/WO2018095181A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0002Systems modifying transmission characteristics according to link quality, e.g. power backoff by adapting the transmission rate
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0033Systems modifying transmission characteristics according to link quality, e.g. power backoff arrangements specific to the transmitter

Definitions

  • the present invention relates to the field of electronic technologies, and in particular, to a data transmission method and apparatus.
  • the communication parties generally use the previously negotiated baud rate for data interaction, thereby ensuring the correct transmission of data.
  • the communication baud rate parameter used by both communicating parties can only be a fixed value, which cannot be changed according to the communication environment, and when the communication parties perform data interaction with other terminals. The communication may fail due to the possibility of incompatibility with the communication baud rate of other terminals.
  • the present invention is directed to solving the above problems.
  • a main object of the present invention is to provide a data transmission method, including: acquiring a bit sequence of the first data to be transmitted, wherein the bit sequence of the first data to be transmitted includes at least: data to be transmitted, and the data to be transmitted is at least Include: a locally supported baud rate parameter; acquiring a waveform sequence corresponding to a bit in the bit sequence according to a bit sequence of the first to-be-sent data, wherein the first data bit is represented by the first waveform sequence, and the second waveform is The sequence or third waveform sequence represents a second data bit, the first data bit being one of bit 1 and bit 0, the second data bit being the other of bit 1 and bit 0, When there are at least two consecutive bits in the bit sequence as the second data bit, a waveform sequence corresponding to the first bit of the at least two consecutive bits is the second waveform sequence, the second bit and subsequent The waveform sequence corresponding to the bit is the third waveform sequence; wherein the characteristics of the waveform sequence include: duration of the first waveform sequence, the second The duration
  • Another main object of the present invention is to provide a data transmission apparatus, including: a first acquisition module, configured to acquire a bit sequence of the first data to be transmitted, where the bit sequence of the first data to be transmitted includes at least: Transmitting data, the data to be transmitted includes: a locally supported baud rate parameter; and a second acquiring module, configured to acquire a waveform sequence corresponding to a bit in the bit sequence according to a bit sequence of the first to-be-sent data, where Representing a first data bit in a first waveform sequence, and a second data bit in a second waveform sequence or a third waveform sequence, the first data bit being one of bit 1 and bit 0, the second data bit For the other of the bit 1 and the bit 0, when there are at least two consecutive bits in the bit sequence being the second data bit, a waveform corresponding to the first bit of the at least two consecutive bits
  • the sequence is the second waveform sequence, and the waveform sequence corresponding to the second bit and the subsequent bit is the third waveform sequence; wherein the feature
  • the first waveform sequence starts at a high level and exhibits a low level during the transmission duration, wherein a low level occurring in the first waveform sequence occupies the transmission duration
  • the total duration does not vary with a change in the baud rate of the sequence of waveforms, the second sequence of waveforms continuing at a high level for the duration of the transmission, the third sequence of waveforms starting at a low level and at a high level Ending, and the total duration of the low level occurring in the third waveform sequence during the transmission duration does not vary with the baud rate of the waveform sequence;
  • the first transmitting module is configured to follow the current
  • the baud rate used continuously transmits a sequence of waveforms corresponding to the bits in the sequence of bits, wherein the duration of the sequence of waveforms is inversely proportional to the currently used baud rate.
  • the local end sends the locally supported baud rate parameter to the peer end in the bit sequence of the first data to be sent, so that the local end and the opposite end can adopt multiple baud rates.
  • Data transmission increases the success rate of data transmission.
  • FIG. 1 is a flowchart of a data transmission method according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of a frame format of a data frame according to an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of waveforms of three first waveform sequences according to an embodiment of the present invention.
  • FIG. 4 is a schematic waveform diagram of a second waveform sequence according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of waveforms of three third waveform sequences according to an embodiment of the present invention.
  • FIG. 6 is a schematic diagram of determining a data frame header according to an embodiment of the present invention.
  • FIG. 7 is a schematic diagram of waveforms corresponding to a bit sequence of first to-be-sent data according to an embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of a data transmission apparatus according to an embodiment of the present invention.
  • the present embodiment provides a data transmission method.
  • two devices that are in communication can be classified into a master device and a slave device.
  • the master device can be a mobile terminal such as a PC or a mobile phone, and the card reader, and the slave device can be a USB device.
  • electronic signature device such as ICBC U-Shield, ABC Key
  • smart card after the master device and the slave device are electrically connected, the slave device can take power from the master device, and the master device can be a slave device while communicating with the slave device.
  • the port connected between the master device and the slave device maintains a high level
  • the master device can supply power to the slave device through the high-level master device
  • both the master device and the slave device can perform data by controlling the level change of the output of the port.
  • the baud rate parameter supported by the local end may be notified in the process of transmitting data between the local end and the opposite end, so that the peer end is enabled.
  • the baud rate supported by the local end can be used for data transmission, so that the local end can communicate with the peer end, and the success rate of communication between the local end and the opposite end is improved.
  • FIG. 1 is a flowchart of a data transmission method according to an embodiment. As shown in FIG. 1, the method mainly includes the following steps S101 to S103.
  • Step S101 acquiring a bit sequence of the first data to be transmitted
  • the bit sequence of the first data to be transmitted includes at least data to be transmitted, and the data to be transmitted includes at least: a locally supported baud rate parameter. .
  • the bit sequence of the first data to be transmitted may be a compiled bit string, and the bit string carries a locally supported baud rate parameter.
  • the bit sequence of the first data to be sent may be a data frame, and the frame format of the data frame may adopt the structure shown in FIG. 2, and one data frame may include: Start of Frame (SOF), transmission data (Byte 0 , Byte 1 ...
  • SOF Start of Frame
  • transmission data Byte 0 , Byte 1 ...
  • the transmission data includes the present The baud rate parameter supported by the local end and the end of frame (EOF), wherein the data frame header SOF is a waveform sequence corresponding to the agreed bit sequence of the communication parties, and the peer end can be Recognizing that a data frame is currently received, and can determine the starting position (or time) of the data to be transmitted in the received data frame.
  • the data frame header SOF can also indicate the baud rate of the data transmitted by the local end, by analyzing the data frame.
  • the head-to-end can obtain the baud rate of the data transmitted by the local end, and use the baud rate to parse the received data;
  • the EOF of the data frame is also a waveform sequence agreed by the communication parties, through the end of the data frame, the opposite end Do data reception ends, the data frame can be provided to distinguish the EOF waveform of the normal sequence of data to be transmitted and the data corresponding to the header so as to identify the end of a data frame EOF.
  • the first byte in the transmission data that is, Byte 0, may be used to identify the packet type.
  • Byte 0 is 8 bits, and the definition is as follows:
  • Device_type represents the device type of the message initiator. For example, 1 represents the master device, and 0 represents the slave device. This facilitates subsequent analysis tools to distinguish whether the packet is sent by the master device or sent from the device.
  • Rev is the default data
  • Packet_type represents the packet type.
  • 0001B indicates the ATR packet, and the ATR packet can be used as the parameter to obtain the packet.
  • the peer receives the ATR packet and returns the corresponding ATR packet.
  • 0010B indicates an ACK response message, that is, a response message indicating that the data is successfully received.
  • 0011B indicates a NAK message, that is, a response message indicating that the device is not ready (or data reception failure), for example, in the data.
  • the receiving end returns a NAK packet to the local end.
  • 0100B indicates a PKT packet, that is, the packet is a normal data packet. Therefore, the packet type can be distinguished. If the packet is the indication information or the normal data, the peer can respond accordingly after receiving the corresponding type of packet.
  • the last two bytes of the data to be transmitted, Byte n-1 and Byte n can be used as a CRC redundancy check bit, and the bit sequence of the received data frame can be used to check the bit sequence of the received data frame. Check to check or verify that the received data has an error.
  • the value of the Packet_type is 0001B in the data frame corresponding to the bit sequence of the first to-be-sent data, indicating that the data frame is an ATR.
  • the packet can obtain the baud rate parameter locally supported by the local end from the data frame according to the indication.
  • the data is transmitted between the local end and the opposite end through a waveform sequence, and the baud rate parameter locally supported by the local end is used to indicate that the local end uses the transmission data when transmitting data (including receiving and transmitting data).
  • the baud rate supported by the waveform sequence The waveform sequence in this embodiment will be described below.
  • the first data bit is represented by a first waveform sequence
  • the second data bit is represented by a second waveform sequence or a third waveform sequence, the first data bit being one of bit 1 and bit 0.
  • the second data bit is the other of the bit 1 and bit 0.
  • the first waveform sequence, the second waveform sequence, and the third waveform sequence are specifically characterized in that the durations of the first waveform sequence, the second waveform sequence, and the third waveform sequence are the same, and the transmission duration is
  • the baud rate of the waveform sequence is inversely proportional, and the first waveform sequence starts at a high level and exhibits a low level during the transmission duration, wherein the low frequency occurring in the first waveform sequence
  • the total duration occupied by the duration of the transmission does not vary with a change in the baud rate of the sequence of waveforms, the second sequence of waveforms continuing a high level for the duration of the transmission, the third waveform
  • the sequence begins with a low level and ends with a high level, and the total duration of the low level occurring in the third waveform sequence for the duration of the transmission does not vary with the baud rate of the waveform sequence.
  • the durations of different waveform sequences are the same, that is, one bit is transmitted by T, and the embodiment transmits one bit in a manner that requires different time intervals to transmit one bit value in the prior art.
  • the bit takes less time and, therefore, the coding efficiency is higher, reducing the cost and burden of the local and the peer.
  • the total duration of the low level occurring in the first waveform sequence during the transmission duration does not change with the change of the baud rate of the transmission waveform sequence; and/or, the third waveform sequence appears.
  • the total duration of the low level for the duration of the transmission does not change with the baud rate of the transmitted waveform sequence.
  • the duration of the low level in the first waveform sequence and the third waveform sequence may be preset to a fixed duration, and the baud rate of the data frame transmitted by the master and slave devices may be changed, such that the low level accounts for the transmission duration.
  • the air ratio is changing, not a fixed ratio.
  • the duration of the low level is fixed at 10 ns.
  • the duration of the low level accounts for 50% of the transmission duration, that is, from The power take-off efficiency of the device is 50%; when the master device transmits the waveform sequence at a baud rate of 25 Mbs, that is, a transmission duration of 40 ns, the duration of the low level accounts for 25% of the transmission duration, that is, the slave device takes The electrical efficiency is 75%. It can be seen that when the duration of the low level is fixed, the total duration of the low level during the transmission duration has no linear relationship with the baud rate, that is, the baud rate does not change with the transmission waveform sequence. However, the baud rate can be selected according to the actual situation, so that the interface of the master and slave devices is kept at a high level for as long as possible, thereby further improving the power supply efficiency in the two-wire communication.
  • the first waveform sequence may further have the following feature: a low level occurring in the first waveform sequence is in the duration Total time The length is less than one-half of the duration; and/or the third waveform sequence may also have the feature that the total duration of the low level occurring in the third waveform sequence is less than the total duration of the duration One-half of the duration.
  • the total duration occupied by the low level in the first waveform sequence and/or the third waveform sequence does not exceed one-half of a duration for a duration, thereby ensuring During the data transmission process, the high-level time between the local end and the opposite end enables the local end or the opposite end to obtain power from the other end for a long time, thereby improving the power supply efficiency.
  • a falling edge level transition (or a rising edge level transition) or a plurality of falling edge level transitions (or a rising edge level jump) may occur in the first waveform sequence and the third waveform sequence.
  • the high level of the port is changed to a low level by a hardware switch or software, etc.
  • a falling edge transition, and then controlling the port to return to a high level forms a rising edge transition.
  • the third waveform sequence appears only once during the transmission duration by the low level. A level transition that goes high.
  • the first waveform sequence starts at a high level and only occurs once from a high level to a low level during the transmission duration, and ends with a low level; or, the first waveform sequence is at a high level Starts and only one level transition from high to low occurs during the transmission duration and ends with a high level.
  • a waveform sequence that includes multiple falling edge transitions or multiple rising edge transitions there is only one falling edge level transition (or rising edge level transition) in one waveform sequence to reduce the control terminal. Operational complexity, no need to control the level of the transmission port to perform multiple hops to transmit a bit, improve the efficiency of data transmission.
  • Figure 3 shows a schematic diagram of three first waveform sequences
  • Figure 4 shows a schematic diagram of a second waveform sequence
  • Figure 5 shows a schematic diagram of several third waveform sequences.
  • the first waveform sequence starts at a high level and then transitions to a low level after a period of time, and the low level appearing in the first waveform sequence occupies the duration of the transmission.
  • the total duration does not vary with the baud rate of the waveform sequence.
  • the first waveform sequence has a transmission duration of 40 ns and a high level duration of 10 ns, which is 1/4 of the duration of the first waveform sequence.
  • the master and slave devices are always in the connected state.
  • the master device outputs a high level in the default state and continues to supply power to the slave device.
  • the master device When the master device needs to send data, it will generate a low level through its own on/off switch.
  • the high and low levels form different waveform sequences to transmit the corresponding bit data.
  • the master device When the master device outputs a low level, the master device cannot supply power to the slave device. Therefore, in order to power the slave device as efficiently as possible, preferably, the total time that the low level occurring in the first waveform sequence occupies during the transmission duration may be less than one-half of the transmission duration; thus, The longer the high level of the transmitted data, the higher the power supply efficiency. As shown in FIG.
  • the duration of the first waveform sequence is 40 ns, the high level duration is 30 ns, and the transmission duration of the first waveform sequence is 3/4, and the data is transmitted in the first waveform sequence.
  • the power supply efficiency is relatively high. Therefore, the first waveform sequence transmission data supply efficiency in FIG. 3(b) is higher than that in FIG. 3(a).
  • the waveform of the first waveform sequence can also be as shown in FIG. 3(c). End with a high level.
  • the second waveform sequence shown in FIG. 4 is always at a high level for the duration of time, thereby further improving the power supply efficiency.
  • the third waveform sequence begins with a low level and ends with a high level, and the total duration of the low level occurring in the third waveform sequence for the duration of the transmission does not vary with the baud rate of the waveform sequence. And change.
  • the baud rate is 50 Mbps
  • the transmission duration of the third waveform sequence is 20 ns.
  • the duration of the low level is fixed to 10 ns, then the duration of the low level is occupied.
  • the transmission duration of the three waveform sequences is 1/2, and the power take-off efficiency of the slave device is 50%.
  • the baud rate is 25 Mbps
  • the transmission duration of the third waveform sequence is 40 ns.
  • the duration of the low level is It takes 1/4 of the transmission duration of the third waveform sequence.
  • the power take-off efficiency of the slave device is 75%.
  • the transmission duration becomes longer as the baud rate decreases. The efficiency is improved, and thus it can be seen that the total duration of the low level during the duration of the transmission does not change with the change of the baud rate of the waveform sequence, which can improve the power taking efficiency. Therefore, the power transmission efficiency of the third waveform sequence transmission data in FIG. 5(b) is higher than that in FIG. 5(a).
  • the total time that the low level appearing in the third waveform sequence in FIG. 5(b) can be less than one-half of the transmission duration can further improve the power supply efficiency.
  • the durations of the first waveform sequence, the second waveform sequence, and the third waveform sequence are determined by the baud rate currently used by the local end. Therefore, in this embodiment, the baud rate parameter supported locally can be determined. The duration of the waveform sequence that can be resolved by the local end and the duration that the waveform sequence sent by the local end can be used.
  • the locally supported baud rate parameter includes at least: a baud rate of receiving data and/or a baud rate of transmitting data; wherein the baud receiving data is The rate includes one or more; the baud rate of the transmitted data includes one or more.
  • the baud rate of the received data is used to indicate the baud rate of the waveform sequence of the received data that can be parsed by the local end, and the baud rate of the transmitted data is used to indicate the baud rate that can be used by the waveform sequence sent by the local end, According to the baud rate of the transmitted data of the local end, the terminal can parse the waveform sequence sent by the local end.
  • the baud rate of the received data and the baud rate of the transmitted data may both be multiple, and after receiving the peer, the peer may select the same baud rate parameter according to the local end.
  • the baud rate of the end and the opposite end realizes the baud rate adaptation.
  • the local end may actively send the locally supported baud rate parameter to the opposite end, or may send the locally supported baud rate parameter to the opposite end after receiving the request from the opposite end. Therefore, in an optional implementation manner of this embodiment, before step S101, the method may further include: detecting a level change of the receiving port; determining continuous transmission according to the level change and the characteristic of the waveform sequence N waveform sequences corresponding to the first received data, wherein N is a positive integer, and each of the N waveform sequences corresponding to the first received data is one of: the first waveform sequence, the first a second waveform sequence and the third waveform sequence; determining a bit sequence of the first received data according to the N waveform sequences corresponding to the continuously transmitted first received data, the bit sequence of the first received data to The method includes: first transmission data, where the first transmission data includes at least: indication information for indicating that a baud rate parameter is acquired. With the optional implementation, the local end may acquire the first to-be-sent data after receiving the indication information that
  • the local end may be aware of a baud rate adopted by a waveform sequence corresponding to a bit sequence in which the peer end transmits the first received data, for example, the peer end transmits using a pre-determined baud rate, in which case The local end can determine the N waveform sequences corresponding to the first received data that are continuously transmitted according to the baud rate used by the opposite end and the detected level change.
  • the local end may not know the baud rate adopted by the waveform sequence corresponding to the bit sequence of the first receiving data of the peer end, in this case, the local end may be pre- Setting a waveform sequence included in the data frame header and the detected level change, and parsing the duration of the waveform sequence corresponding to the bit sequence of the first received data from the data frame header of the bit sequence of the first received data, and further Obtaining a baud rate adopted by the waveform sequence corresponding to the bit sequence of the first receiving data, and then parsing the transmitted data portion of the data frame according to the obtained baud rate, thereby obtaining the first transmission data.
  • the data frame header of the data frame transmitted between the local end and the opposite end includes at least one bit
  • the waveform sequence corresponding to the first bit of the data frame header is the The third waveform sequence or the first waveform sequence
  • the local end negotiates with the opposite end to use the first waveform sequence or the third waveform sequence as the data frame header
  • the detected level change of the receiving port forms the corresponding data frame header.
  • the waveform sequence it can be determined that the currently received waveform sequence is a data frame header, and the waveform sequence immediately after the data frame header is the starting position of the waveform sequence of the transmission data.
  • the data frame header can be identified by the above-described waveform sequence.
  • the data frame header of the data frame transmitted between the local end and the opposite end may include at least M bits, and the waveform order corresponding to the first M bits of the data frame header is determined by M.
  • the first waveform sequence is composed of; or the waveform sequence corresponding to the first M bits of the data frame header is composed of M third waveform sequences, M is a positive integer and M ⁇ 2; or, the first M bits of the data frame header correspond to
  • the waveform sequence consists of at least one first waveform sequence and at least one third waveform sequence.
  • the optional implementation manner may further determine a preset duration of a waveform sequence by using a waveform sequence corresponding to the first M bits of the data frame header, that is, determine a wave that the sender sends data.
  • the rate is high, and the baud rate can be used for data reception and transmission to achieve baud rate adaptation.
  • the same waveform sequence may be continuously The latter (as long as it can be followed, for example, immediately after the same sequence of waveforms, or after several waveform sequences), at least one waveform sequence different from the same waveform sequence, ie corresponding to the anti-jamming bits, is agreed upon.
  • Waveform sequence for example, data frame
  • the data frame header further includes: at least one anti-interference bit after the first M bits of the data frame header, wherein the at least one The anti-interference bit is a second waveform sequence or a third waveform sequence.
  • the waveform sequence corresponding to the data frame header may be XXXXYZYZ, where X is the first waveform sequence, Y is the second waveform sequence, and Z is the third waveform.
  • the data frame header further includes: at least one anti-interference after the first M bits of the data frame header And a bit sequence, wherein the waveform sequence corresponding to at least one of the at least one anti-interference bit is a first waveform sequence or a second waveform sequence.
  • the waveform sequence corresponding to the data frame header may be ZZZZXYZZ.
  • the frequency of the single-frequency interference is exactly the same as the baud rate, that is, the local end recognizes the same waveform sequence as the data frame header by the level change. At this time, the local end recognizes the single-frequency interference as the data frame header.
  • the data frame headers in the third embodiment have different time intervals after successive consecutive identical waveform sequences, so that the data frame headers have different time intervals, that is, no The single frequency interferes with the same sequence of waveforms, whereby single-frequency interference can be prevented by the data frame header in this embodiment.
  • the preset duration of a waveform sequence may be obtained by parsing the data frame header mentioned in the foregoing embodiments, and the preset duration is used as the transmission duration of each waveform sequence, according to The level change and waveform sequence characteristics determine the transmitted data in the received data and the data frame as a corresponding waveform sequence.
  • detecting a level change of the receiving port includes: continuously detecting S level transitions of the receiving port; and detecting the receiving port after detecting the S level transitions of the receiving port
  • Determining the continuously transmitted N waveform sequences according to the level change and the characteristics of the waveform sequence comprising: acquiring L waveform sequences formed by the preset S level jumps of the data frame header, wherein L is a positive integer and 1 ⁇ L ⁇ N; calculating the duration of a waveform sequence based on the characteristics of the L waveform sequences and the time interval between any two of the detected S level transitions; using the calculated duration as The duration of each waveform sequence determines the transmission data and the sequence of waveforms corresponding to the end of the data frame based on the Q level transitions and the characteristics of the waveform sequence.
  • the data sender and the data receiver pre-arrange the data frame header as a waveform sequence of L bits, the waveform sequence of the L bits corresponds to S level transitions, and the data receiver continuously detects the receiving port.
  • the detected S level transitions may be defaulted to S hops corresponding to the data frame header, and level changes (ie, detected Q hops) are detected after S hops.
  • the variable is used to determine the transmission data in the data frame and the waveform sequence corresponding to the end of the data frame.
  • the data receiver determines the duration T of a waveform according to the data frame header, and determines whether a level jump occurs in each T duration and a characteristic of each level jump.
  • the Q levels jump to the corresponding waveform sequence to determine the entire N waveform sequence.
  • the data frame header of several bits is received first, and then the subsequent transmission data and data are received.
  • the end of the frame, and the data frame header carries some parameter information.
  • the local end and the opposite end pre-arrange L waveform sequences as data frame headers. Therefore, the local end can obtain from the opposite end or obtain L from its own memory.
  • the characteristics of the waveform sequence that is, the characteristics of the waveform sequence in the data frame header are known at the local end.
  • the first waveform sequence X starts with a high level, and it undergoes a level jump for the duration of the waveform and the time of the transition is T1 (T1 is from each waveform).
  • T1 is from each waveform.
  • the second waveform sequence is a continuous high level, which does not undergo a level jump for the duration of the waveform
  • the third waveform sequence starts with a low level Since the default state of the local and the opposite ends is high, the third waveform sequence can be considered to undergo a level jump at the beginning of the waveform (which can be considered as time 0). For example, as shown in (a) of FIG.
  • the two parties have agreed that the L-bit data frame header format is a 4-bit sequence "XZZZ". If no error occurs during data transmission, the local end receives The S transitions should be 4 falling edge transitions.
  • the ratio of the second ratio is the third waveform sequence Z, and the third waveform sequence Z starts at a low level and continues to a high level after a fixed period of time (T2).
  • the local end can detect the time interval ⁇ between the first and second level jumps (level jump only refers to the level transition from high level to low level) at the receiving port, and the local end detects
  • the local end can calculate the duration T of a waveform sequence according to the waveform characteristics of the data frame header sequence and the time interval (ie, ⁇ ) between any two of the L level jumps, thereby
  • the data frame header data can be used to determine the baud rate (ie, 1/T) used by the peer to transmit data.
  • the first waveform sequence X in (a) of FIG. 6 and (b) of FIG. 6 ends with a high level
  • the third waveform sequence Z ends with a high level. It is also available if the first waveform sequence ends with a low level and will not be described here.
  • the transmission data can be parsed from the end position of the data frame header.
  • the local end determines the waveform type according to the level transition of the detection level from the high level to the low level, according to the previously known waveform characteristics, in each period of duration T, when a falling edge is detected,
  • the time of the flat jump and the transition is T1
  • the transmission data represented by the Q level transitions and the waveform sequence corresponding to the data frame tail can be determined by using the above method, and the data frame header has been determined in the foregoing.
  • the law of obtaining a complete level change may be sampled to obtain S level jumps, or only a circuit for monitoring the level change may be set to monitor the level jump, that is, The present invention is not limited to any one as long as it is possible to obtain S hops corresponding to the data frame header. If S level jumps are obtained by sampling, not only the characteristics of the level jump can be obtained, but also the waveform corresponding to the complete level change can be obtained, so that the characteristics of various waveform sequences need not be considered, and the method can be applied to The waveform sequence can be successfully resolved in any type of waveform sequence. If the monitoring level jump mode is used, it is not necessary to sample the level, and long-time sampling is avoided to restore the overall waveform. Only the characteristics of the level jump can be determined to determine N waveform sequences, which reduces the parsing. Complexity.
  • the sampling can use the sampling circuit to realize the level detection of the receiving port, and the matching sampling frequency can be adopted according to the different target to be sampled.
  • the level jump monitoring can be implemented by using a comparator, a differential amplifier, etc., of course, any hardware and software implementation that can achieve a monitoring level jump should be within the scope of the present invention.
  • the local end and the opposite end may pre-arrange a waveform sequence corresponding to the data frame tail of the data frame of the transmission data.
  • the data frame tail may include 2 bits, and the corresponding waveform sequence includes one of the following three modes: the waveform sequence corresponding to the first bit of the data frame tail is the second waveform sequence, and the second of the data frame tail The waveform sequence corresponding to the bit is the second waveform sequence; or the waveform sequence corresponding to the first bit of the data frame tail is the third waveform sequence, and the waveform sequence corresponding to the second bit of the data frame tail is the second waveform sequence; or The waveform sequence corresponding to the first bit of the data frame tail is the first waveform sequence, and the waveform sequence corresponding to the second bit of the data frame tail is the third waveform.
  • the waveform sequence determined according to the level change and the characteristics of the waveform sequence is the waveform sequence corresponding to the preset data frame end
  • the data reception ends.
  • the waveform sequence corresponding to the data frame header and the data frame tail is pre-agreed by the communication protocol.
  • the same waveform sequence does not appear in the data frame header and the data frame tail, so that the data frame header is easier to be used. Identifying and distinguishing from the end of the data frame. If the waveform sequence in the agreed data frame header contains two waveform sequences in the end of the data frame, the data frame header and the data frame can be distinguished by some strategies, for example, the data frame header.
  • the data frame header is started to be received, and the waveform sequence corresponding to the 8 preset data frame headers is continuously detected, and the data frame header is received.
  • the data frame header and the data frame can be distinguished. That is, the present embodiment does not specifically limit the waveform sequence corresponding to the data frame header and the data frame tail.
  • Step S102 Acquire a waveform sequence corresponding to a bit in the bit sequence according to a bit sequence of the first data to be transmitted.
  • the local end and the opposite end of the data transmission may negotiate in advance to indicate the waveform sequence type of bit 1 and bit 0, or the local end and the opposite end are pre-set and stored for indicating bit 1 and before being shipped from the factory.
  • the local end when the outgoing data bit 1 is required, The local end generates a first waveform sequence.
  • the local end When an outgoing data bit 0 is required, the local end generates a second waveform sequence or a third waveform sequence as needed.
  • the first waveform sequence represents bit 0
  • the second waveform sequence and The third waveform sequence can represent bit 1 at this time.
  • the local end when the outgoing data bit 1 is needed, the local end generates the second waveform sequence or the third waveform sequence as needed, when the outgoing data bit 0 is needed.
  • the local end generates a first waveform sequence; by using different waveform sequences to represent bit 0 and bit 1, the normal data transmission and reception of both communication parties can be realized, and the correctness of data interaction is ensured;
  • the first waveform sequence, the second waveform sequence, and the third waveform sequence are respectively three kinds of pulse waves having different waveforms
  • the first waveform sequence, the second waveform sequence, and the third waveform sequence are single waveforms.
  • the pulse duration is the same, that is, the single pulse of the three waveform sequences lasts for the same time from the start of the pulse to the end of the pulse; the duration of a single pulse of the three waveform sequences from the start of the pulse to the end of the pulse is T.
  • step S102 the local end acquires and analyzes the first to-be-sent data, and acquires according to the correspondence between the bit 1, the bit 0, the first waveform sequence, the second waveform sequence, and the third waveform sequence in the first to-be-sent data.
  • a waveform sequence corresponding to a first bit of the at least two consecutive bits is the second waveform sequence
  • a second The waveform sequence corresponding to the bit and the subsequent bit is the third waveform sequence; that is, when there are A (A ⁇ 2) consecutive second data bits in the bit sequence of the first data to be transmitted, only the first a second data bit with a second waveform sequence
  • the column indicates that the following A-1 second data bits are represented by the third waveform sequence, so that when the second data bit needs to be continuously transmitted, the local end continuously outputs the second waveform sequence, that is, the local end continuously outputs high power.
  • the flat signal causes the peer to distinguish between the received second data bit and the continuous high level when there is no data transmission.
  • Step S103 continuously transmitting a waveform sequence corresponding to the bit in the bit sequence according to the currently used baud rate, wherein the duration of the waveform sequence is inversely proportional to the currently used baud rate.
  • the baud rate currently used by the local end may be the default baud rate of the local end, or in the case that the local end receives the indication information for sending the baud rate parameter sent by the opposite end.
  • the baud rate currently used by the local end may be the baud rate of the indication information sent by the peer end to indicate the baud rate parameter, so as to ensure that the baud rate currently used by the local end is the baud rate supported by the peer end. It is convenient for the peer to parse the data sent by the local end.
  • the waveform sequence corresponding to the bit in the bit sequence of the first data to be transmitted is sent, the local end controls according to the currently used baud rate.
  • the level of the transmitting port is changed according to the waveform sequence corresponding to the bit in the bit sequence of the first data to be transmitted and the characteristics of the waveform sequence to transmit the first data to be transmitted.
  • the communication protocol stipulates that the bit "1" is represented by the first waveform sequence, and the bit "0" is represented by the second waveform sequence and the third waveform sequence.
  • each of the bit sequences of the first data to be transmitted The waveform sequence corresponding to the bits is determined.
  • the local end generates a high and low level by controlling the transmitting port, that is, the high level of the port is changed to a low level by a hardware switch or software, etc., as a transition of a falling edge. Then, controlling the port to return to a high level forms a jump on the rising edge.
  • the waveform sequence is obtained by the change of the high and low levels generated by the transmission port, whereby the waveform sequence corresponding to each bit can be generated, thereby forming a waveform sequence corresponding to the data frame.
  • the eight waveform sequences corresponding to the bit sequence of the first data to be transmitted are XXYZXYZZ, wherein X is the first waveform sequence, and Y is the second.
  • a waveform sequence, Z is a third waveform sequence, and the transmission durations of the first waveform sequence, the second waveform sequence, and the third waveform sequence are the same according to the characteristics of the waveform sequence of each waveform sequence, and the current used porter
  • the ratio is inversely proportional.
  • the first to be sent The eight waveform sequences corresponding to the bit sequence 11001000 of the data can be as shown in FIG.
  • the level of the transmission port is controlled to be hopped at a corresponding time to form a waveform sequence corresponding to the bit, thereby forming a waveform sequence corresponding to the bit sequence of the data frame. And transmitting a bit sequence of the first data to be transmitted.
  • the peer end receives the locally supported baud rate parameter sent by the local end, and the peer end may according to the locally supported wave of the local end.
  • the rate parameter selects the baud rate for subsequent communication with the local end.
  • the peer end may select the according to the locally supported baud rate parameter.
  • the maximum baud rate supported by the local end, and the selected baud rate is returned to the local end, thereby increasing the transmission rate.
  • the selected baud rate may be used for transmission, or may be used when the local end sends the locally supported baud rate parameter to the opposite end.
  • the method may further include: detecting a level change of the receiving port; determining the opposite end according to the level change and the characteristic of the waveform sequence
  • M is a positive integer and M ⁇ 2
  • each of the M waveform sequences corresponding to the second received data is one of the following: a first waveform sequence, the second waveform sequence, and the third waveform sequence; determining a bit sequence of the second received data according to the M waveform sequences corresponding to the continuously transmitted second received data;
  • Receiving data obtaining a baud rate selected by the peer end from the locally supported baud rate parameter; acquiring a bit sequence of the second to-be-sent data; and transmitting the second according to the selected baud rate
  • the local end determines the M waveform sequences corresponding to the second received data continuously transmitted by the opposite end according to the level change of the receiving port and the characteristics of the waveform sequence, and parses the second received data in the manner described above.
  • the manner of determining the N waveform sequences corresponding to the first received data and parsing the first received data is similar, and details are not described herein again.
  • the local end after receiving the second received data, the local end obtains the baud rate selected by the opposite end, and when transmitting the second to-be-sent data, the local end sends the second according to the selected baud rate.
  • the data to be sent is implemented, thereby realizing the baud rate adaptation between the local end and the opposite end.
  • the second to-be-sent data needs to be transmitted to the peer end, and in the specific transmission process, the local end may send the second to-be-sent data in the structure of the data frame, and the second to-be-sent data
  • the specific content of this embodiment is not limited.
  • the local end in order to ensure that the peer end uses the baud rate supported by the local end to perform data interaction in the subsequent data transmission process, the local end sends the local support to the peer end in the bit sequence of the first data to be sent.
  • the baud rate parameter so that the local end and the peer end can use a variety of baud rates for data interaction, and only need to include the locally supported baud rate parameter in the data to be sent at the local end, thereby realizing the wave during data transmission.
  • the hopping of the special rate enables the communication parties to adjust the baud rate according to different data transmission scenarios to meet the data transmission needs in different communication scenarios.
  • the present embodiment provides a data transmission apparatus, which may be disposed in the local end described in Embodiment 1 for performing the data transmission method described in Embodiment 1.
  • FIG. 8 is a schematic structural diagram of a data transmission apparatus according to the embodiment. As shown in FIG. 8, the data transmission apparatus mainly includes: a first acquisition module 800, a second acquisition module 802, and a first transmission module 804.
  • the first obtaining module 800 is configured to obtain a bit sequence of the first data to be sent, where the bit sequence of the first data to be sent includes at least: data to be transmitted, where the data to be transmitted includes at least: a locally supported baud a second parameter obtaining module 802, configured to acquire a waveform sequence corresponding to a bit in the bit sequence according to a bit sequence of the first data to be transmitted, where the first data bit is represented by the first waveform sequence, and the second The waveform sequence or the third waveform sequence represents a second data bit, the first data bit being one of bit 1 and bit 0, the second data bit being the other of bit 1 and bit 0, When there are at least two consecutive bits in the bit sequence as the second data bit, a waveform sequence corresponding to the first bit of the at least two consecutive bits is the second waveform sequence, the second bit and subsequent The waveform sequence corresponding to the bit is the third waveform sequence; wherein the characteristics of the waveform sequence include: a duration of the first waveform sequence, the second waveform sequence The duration of the third
  • the locally supported baud rate parameter is used to indicate the baud rate supported by the waveform sequence used by the local transmission data when transmitting data (including receiving and transmitting data).
  • the waveform sequence in this embodiment will be described below.
  • the first data bit is represented by a first waveform sequence
  • the second data bit is represented by a second waveform sequence or a third waveform sequence, the first data bit being one of bit 1 and bit 0.
  • the second data bit is the other of the bit 1 and bit 0.
  • the first sending module 804 is configured to continuously send a waveform sequence corresponding to a bit in the bit sequence according to the following manner: according to the currently used baud rate, control The level of the transmitting port is changed according to the waveform of the waveform sequence corresponding to the bit in the bit sequence and the characteristics of the waveform sequence to transmit the first to-be-sent data.
  • the communication protocol stipulates that the bit "1" is represented by the first waveform sequence, and the bit "0" is represented by the second waveform sequence and the third waveform sequence.
  • each of the bit sequences of the first data to be transmitted The waveform sequence corresponding to the bits is determined.
  • the first transmitting module 804 generates a high level by controlling the transmitting port, that is, controlling the high level of the port to become a low level by a hardware switch or software, etc. as a falling edge.
  • the transition, then controlling the port to return to a high level forms a rising edge transition.
  • the waveform sequence is obtained by the change of the high and low levels generated by the transmission port, thereby generating a waveform sequence corresponding to each bit, thereby forming a waveform sequence corresponding to the data frame.
  • the eight waveform sequences corresponding to the bit sequence of the i-th data frame are XXYZXYZZ, wherein X is the first waveform sequence, and Y is the second.
  • a waveform sequence, Z is a third waveform sequence, and the transmission durations of the first waveform sequence, the second waveform sequence, and the third waveform sequence are the same according to the characteristics of the waveform sequence of each waveform sequence, and the current used porter
  • the rate is inversely proportional.
  • the eight waveform sequences corresponding to the bit sequence 11001000 of the first data to be transmitted may be as shown in FIG. 7.
  • the level of the transmission port is controlled to be hopped at a corresponding time to form a waveform sequence corresponding to the bit, thereby forming a waveform sequence corresponding to the bit sequence of the data frame. And transmitting a bit sequence of the first data to be transmitted.
  • the data transmission apparatus may further include: a first detecting module, configured to detect the receiving port before the first obtaining module 800 acquires the bit sequence of the first data to be transmitted a first determining module, configured to determine, according to the level change and the feature of the waveform sequence, N waveform sequences corresponding to the first received data continuously transmitted, wherein N is a positive integer, Each of the N waveform sequences corresponding to the first received data is one of: the first waveform sequence, the second waveform sequence, and the third waveform sequence; and a second determining module, configured to: Determining, according to the N waveform sequences corresponding to the continuously transmitted first received data, a bit sequence of the first received data, where the bit sequence of the first received data includes at least: first transmission data, the first transmission data The method at least includes: indicating information for obtaining a baud rate parameter.
  • the first obtaining module 800 may obtain the first to-be-sent data after receiving the indication information that is sent by the peer to indicate that the baud rate parameter is obtained, that is, according to the request of the peer end.
  • the peer sends the locally supported baud rate parameter.
  • the first determining module determines, according to the detected level change and the feature of the waveform sequence, an optional implementation manner of the N waveform sequences corresponding to the first received data continuously transmitted and the second determining module according to the continuous transmission
  • the N-wave sequence corresponding to the first received data may be used to determine the N waveform sequences corresponding to the first received data in the first embodiment and determine the first receiving.
  • the description of the optional implementation of the bit sequence of the data is not described in detail in this embodiment.
  • the data transmission apparatus may further include: a second detecting module, configured to continuously transmit the bit in the bit sequence according to the bit sequence according to the first data to be transmitted After the corresponding waveform sequence, detecting a level change of the receiving port; and a third determining module, configured to determine, according to the level change and the feature of the waveform sequence, the M waveform sequences corresponding to the second received data continuously transmitted by the opposite end
  • M is a positive integer and M ⁇ 2
  • each of the M waveform sequences corresponding to the second received data is one of the following: the first waveform sequence, the second waveform sequence, and the a third determining module, configured to determine a bit sequence of the second received data according to the M waveform sequences corresponding to the continuously transmitted second received data
  • a third obtaining module configured to parse the Receiving data, acquiring a baud rate selected by the peer from the locally supported baud rate parameter; a fourth acquiring module, configured to acquire a bit sequence of
  • the baud rate selected by the peer end may be the maximum baud rate supported by the local end, so that the transmission rate may be increased.
  • the second sending module sends a waveform sequence corresponding to the bit sequence of the second to-be-sent data according to the following manner: controlling the sending port according to the selected baud rate The level is changed according to the waveform of the waveform sequence corresponding to the bit in the bit sequence of the second data to be transmitted and the characteristics of the waveform sequence to transmit the second data to be transmitted.
  • the embodiment of the present invention further provides a computer readable storage medium having instructions stored therein, when the processor of the terminal executes the instruction, the terminal performs a data transmission method according to an embodiment of the present invention.
  • a "computer-readable medium” can be any apparatus that can contain, store, communicate, propagate, or transport a program for use in an instruction execution system, apparatus, or device, or in conjunction with the instruction execution system, apparatus, or device.
  • portions of the invention may be implemented in hardware, software, firmware or a combination thereof.
  • multiple steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system.
  • a suitable instruction execution system For example, if implemented in hardware, as in another embodiment, it can be implemented by any one or combination of the following techniques well known in the art: having logic gates for implementing logic functions on data signals. Discrete logic circuits, application specific integrated circuits with suitable combinational logic gates, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Communication Control (AREA)
  • Dc Digital Transmission (AREA)

Abstract

本发明提供一种数据传输方法及装置,该方法包括:获取第一待发送数据的比特序列,其中,第一待发送数据的比特序列至少包括:待传输数据,待传输数据至少包括:本地支持的波特率参数;根据第一待发送数据的比特序列,获取比特序列中的比特对应的波形序列;按照当前使用的波特率,连续发送比特序列中的比特对应的波形序列,其中,波形序列的持续时间与当前使用的波特率成反比关系。通过本发明,可以提高数据传输的成功率。

Description

数据传输方法及装置
相关申请的交叉引用
本申请基于申请号为201611051707.0,申请日为2016年11月24日,发明名称为数据传输方法及装置的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。
技术领域
本发明涉及一种电子技术领域,尤其涉及一种数据传输方法及装置。
背景技术
随着通信技术的发展和完善,生活和工作中对通信的使用已经相当普及,同时对通信中信号发送和接收的可靠性及传输效率提出了越来越高的要求。在现有的通信方式中,通信双方一般均采用事先协商好的波特率进行数据交互,从而保证数据的正确传输。然而基于事先协商的波特率进行数据传输,通信双方采用的通信波特率参数只能是某一固定数值,无法根据通信环境的不同而进行改变,且当通信双方与其他终端进行数据交互时,由于与其他终端的通信波特率存在不兼容的可能性,会导致通信失败。
发明内容
本发明旨在解决上述问题。
为达到上述目的,本发明的技术方案具体是这样实现的:
本发明的主要目的在于提供一种数据传输方法,包括:获取第一待发送数据的比特序列,其中,所述第一待发送数据的比特序列至少包括:待传输数据,所述待传输数据至少包括:本地支持的波特率参数;根据第一待发送数据的比特序列,获取所述比特序列中的比特对应的波形序列,其中,以第一波形序列表示第一数据比特,以第二波形序列或第三波形序列表示第二数据比特,所述第一数据比特为比特1和比特0中的一个,所述第二数据比特为所述比特1和比特0中的另一个,在所述比特序列中有至少两个连续比特为所述第二数据比特时,所述至少两个连续比特中的第一个比特对应的波形序列为所述第二波形序列,第二个比特以及后续的比特对应的波形序列为所述第三波形序列;其中,所述波形序列的特征包括:所述第一波形序列的持续时间、所述第二波形序列的持续时间以及所述第三波形序列的持续时间相同,所述传输持续时间与所述波形序列的波特率呈反比关系,且所述第一波形序列以高电 平开始并在所述传输持续时间内出现低电平,其中,所述第一波形序列中出现的低电平在所述传输持续时间内所占的总时长不随所述波形序列的波特率的变化而变化,所述第二波形序列在所述传输持续时间内持续高电平,所述第三波形序列以低电平开始并以高电平结束,且所述第三波形序列中出现的低电平在所述传输持续时间内所占的总时长不随所述波形序列的波特率的变化而变化;按照当前使用的波特率,连续发送所述比特序列中的比特对应的波形序列,其中,所述波形序列的持续时间与所述当前使用的波特率成反比关系。
本发明的另一主要目的在于提供一种数据传输装置,包括:第一获取模块,用于获取第一待发送数据的比特序列,其中,所述第一待发送数据的比特序列至少包括:待传输数据,所述待传输数据至少包括:本地支持的波特率参数;第二获取模块,用于根据第一待发送数据的比特序列,获取所述比特序列中的比特对应的波形序列,其中,以第一波形序列表示第一数据比特,以第二波形序列或第三波形序列表示第二数据比特,所述第一数据比特为比特1和比特0中的一个,所述第二数据比特为所述比特1和比特0中的另一个,在所述比特序列中有至少两个连续比特为所述第二数据比特时,所述至少两个连续比特中的第一个比特对应的波形序列为所述第二波形序列,第二个比特以及后续的比特对应的波形序列为所述第三波形序列;其中,所述波形序列的特征包括:所述第一波形序列的持续时间、所述第二波形序列的持续时间以及所述第三波形序列的持续时间相同,所述传输持续时间与所述波形序列的波特率呈反比关系,且所述第一波形序列以高电平开始并在所述传输持续时间内出现低电平,其中,所述第一波形序列中出现的低电平在所述传输持续时间内所占的总时长不随所述波形序列的波特率的变化而变化,所述第二波形序列在所述传输持续时间内持续高电平,所述第三波形序列以低电平开始并以高电平结束,且所述第三波形序列中出现的低电平在所述传输持续时间内所占的总时长不随所述波形序列的波特率的变化而变化;第一发送模块,用于按照当前使用的波特率,连续发送所述比特序列中的比特对应的波形序列,其中,所述波形序列的持续时间与所述当前使用的波特率成反比关系。
由上述本发明提供的技术方案可以看出,本端在第一待发送数据的比特序列中向对端发送本地支持的波特率参数,从而使得本端与对端可以采用多种波特率进行数据交互,只需要在本端在待发送数据中包含本地支持的波特率参数,对端即可获得本端所支持的波特率,进而选择本端和对端都支持的波特率进行数据传输,提高了数据传输的成功率。
附图说明
为了更清楚地说明本发明实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的 普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他附图。
图1为本发明实施例提供的一种数据传输方法的流程图;
图2为本发明实施例提供的一种数据帧的帧格式示意图;
图3为本发明实施例提供的三种第一波形序列的波形示意图;
图4为本发明实施例提供的第二波形序列的波形示意图;
图5为本发明实施例提供的三种第三波形序列的波形示意图;
图6为本发明实施例提供的一种数据帧头确定的示意图;
图7为本发明实施例提供的一种第一待发送数据的比特序列对应的波形示意图;以及
图8为本发明实施例提供的一种数据传输装置的结构示意图。
具体实施方式
下面结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明的保护范围。
下面将结合附图和实施例对本发明进行详细描述。
实施例1
本实施例提供一种数据传输方法,在本实施例中通信的两个设备可以分为主设备和从设备,例如主设备可以为PC、手机等移动终端、读卡器,从设备可以为USB、电子签名设备(如工行U盾,农行Key宝)、智能卡,在主设备与从设备电连接后,从设备可以从主设备取电,主设备在与从设备通信的同时,可以为从设备供电,在静默态时,主设备与从设备连接的端口保持高电平,通过高电平主设备可以为从设备供电,主设备和从设备均可以通过控制该端口输出的电平变化进行数据发送,并检测该端口输入的电平变化进行数据接收。在本实施例提供的方法中,可以在本端与对端传输数据之前,也可以在本端与对端传输数据过程中,通知对端本端所支持的波特率参数,以使得对端可以采用本端所支持的波特率进行数据传输,进而使得本端可以与对端进行通信,提高本端与对端通信的成功率。
图1为本实施例提供的数据传输方法的流程图,如图1所示,该方法主要包括以下步骤S101至步骤S103。
步骤S101,获取第一待发送数据的比特序列;
在本实施例中,为了使对端获取本端本地支持的波特率参数,第一待发送数据的比特序列至少包括待传输数据,所述待传输数据至少包括:本地支持的波特率参数。
在本发明实施例的一个可选实施方案中,第一待发送数据的比特序列可以为编译好的比特串,该比特串中携带有本地支持的波特率参数。
在本发明实施例的一个可选实施方案中,第一待发送数据的比特序列可以为一个数据帧,该数据帧的帧格式可以采用如图2所示的结构,一个数据帧可以依次包括:数据帧头(Start of Frame,缩写SOF)、传输数据(Byte0,Byte1……Byten-1,Byten)(在第一待发送数据的比特序列对应的数据帧中,传输数据包括本端本地支持的波特率参数)和数据帧尾(End of Frame,缩写EOF),其中,数据帧头SOF为通信双方约定好的比特序列对应的波形序列,通过该数据帧头,对端可以识别出当前开始接收一个数据帧,并能够确定接收数据帧中待传输数据的起始位置(或时刻),此外,数据帧头SOF还可以指示本端传输数据的波特率,通过分析数据帧头对端可以获取本端传输数据的波特率,并采用该波特率解析接收数据;数据帧尾EOF也是通信双方约定好的波形序列,通过该数据帧尾,对端识别数据接收结束,该数据帧为EOF的设置可以区分于正常的待传输数据以及数据帧头对应的波形序列,以便于识别出数据帧尾EOF。
作为一种可选的实施方式,传输数据中的头一个字节即Byte0可以用来标识报文类型,例如,Byte0为8比特,定义如下:
Bit7 Bit[6:4] Bit[3:0]
Device_type Rev Packet_type
其中,Device_type代表该报文发起方设备类型,例如,1代表主设备,0代表从设备,便于后续分析工具可区分报文是主设备发出还是从设备发出。Rev为缺省数据,Packet_type代表报文类型,例如0001B表示ATR报文,ATR报文可以为参数获取报文,对端接收到该ATR报文,也要返回相应的ATR报文,并携带相应的参数;例如0010B表示ACK响应报文,即表示数据接收成功的响应报文,例如,0011B表示NAK报文,即表示设备未准备好(或数据接收失败)的响应报文,例如,在数据接收错误,或者数据丢包等情况下,对端会向本端返回NAK报文;例如,0100B表示PKT报文,即该报文就是正常的数据报文,由此,通过报文类型可以区分报文为指示信息还是正常的数据,对端在接收到相应类型的报文后,可以做出相应的响应。作为一种可选的实施方式,待传输数据中的最后两个字节Byten-1,Byten可以作为CRC冗余校验位,可以利用该校验位对接收数据帧的比特序列进行校验,以便检测或校验接收的数据是否出现错误。
在本实施例中,由于第一待发送数据传输的本地支持的波特率参数,因此,第一待发送数据的比特序列对应的数据帧中,Packet_type的值为0001B,指示该数据帧为ATR报文,对端可以根据该指示,从该数据帧中获取本端本地支持的波特率参数。
在本实施例中,本端与对端之间通过波形序列来传输数据,本端本地支持的波特率参数用于指示本端在传输数据(包括接收和发送数据)时,传输数据使用的波形序列所支持的波特率。下面对本实施例中的波形序列进行说明。
在本实施例中,以第一波形序列表示第一数据比特,以第二波形序列或第三波形序列表示第二数据比特,所述第一数据比特为比特1和比特0中的一个,所述第二数据比特为所述比特1和比特0中的另一个。
在本实施例中,第一波形序列、第二波形序列、和第三波形序列具体以下特征:第一波形序列、第二波形序列以及第三波形序列的持续时间相同,所述传输持续时间与所述波形序列的波特率呈反比关系,且所述第一波形序列以高电平开始并在所述传输持续时间内出现低电平,其中,所述第一波形序列中出现的低电平在所述传输持续时间内所占的总时长不随所述波形序列的波特率的变化而变化,所述第二波形序列在所述传输持续时间内持续高电平,所述第三波形序列以低电平开始并以高电平结束,且所述第三波形序列中出现的低电平在所述传输持续时间内所占的总时长不随所述波形序列的波特率的变化而变化。在本实施例中,不同的波形序列的持续时间相同,即均以T来传输一个比特,相比与现有技术中需要用不同的时间间隔来传输一个比特值的方式,本实施例传输一个比特所需的时间更短,因此,编码效率更高,降低了本端和对端的成本及负担。
在本实施例中,第一波形序列中出现的低电平在传输持续时间内所占的总时长不随传输波形序列的波特率的变化而变化;和/或,第三波形序列中出现的低电平在传输持续时间内所占的总时长不随传输波形序列的波特率的变化而变化。例如,第一波形序列以及第三波形序列中低电平的持续时长可以预设为一个固定时长,由于主从设备传输数据帧的波特率可以改变,这样低电平占传输持续时间的占空比就是变化的,而不是一个固定比例。例如,低电平的持续时间固定为10ns,当主设备以50Mbs的波特率,即传输持续时间为20ns进行波形序列的传输时,低电平的持续时间占传输持续时间的50%,即从设备的取电效率为50%;当主设备以25Mbs的波特率,即传输持续时间为40ns进行波形序列的传输时,低电平的持续时间占传输持续时间的25%,即从设备的取电效率为75%,由此可见,低电平的时长固定时,低电平在传输持续时间内所占的总时长与波特率没有线性关系,即不随传输波形序列的波特率的变化而变化,由此,可以根据实际情况选择波特率,使得主从设备的接口保持高电平的时间尽可能的长,从而进一步提高两线通信中的供电效率。
在本发明实施例的一个可选实施方案中,为了进一步提高本端或对端的取电效率,第一波形序列还可以具有以下特征:第一波形序列中出现的低电平在所述持续时间内所占的总时 长小于所述持续时间的二分之一;和/或,第三波形序列还可以具有以下特征:所述第三波形序列中出现的低电平在所述持续时间内所占的总时长小于所述持续时间的二分之一。即在该可选实施方式中,在一个持续时间内,第一波形序列和/或第三波形序列中低电平所占用的总时长不超过一个持续时间的二分之一,从而保证了在数据传输过程中,本端与对端之间高电平维持的时间,使得本端或对端可以长时间的从另一端获得电能,提高了供电效率。
在本实施例中,第一波形序列和第三波形序列中可以出现一次下降沿电平跳变(或上升沿电平跳变)或多次下降沿电平跳变(或上升沿电平跳变),在本实施例中,由于在静默态主从设备之间的一个端口的电平持续为高电平,通过硬件开关或软件等控制该端口的高电平变为低电平作为一次下降沿的跳变,然后控制该端口恢复为高电平则形成一次上升沿的跳变,作为一种可选的实施方式,第三波形序列在传输持续时间内仅出现一次由由低电平变为高电平的电平跳变。第一波形序列以高电平开始并在传输持续时间内仅出现一次由高电平变为低电平的电平跳变,并以低电平结束;或者,第一波形序列以高电平开始并在传输持续时间内仅出现一次由高电平变为低电平的电平跳变,并以高电平结束。相比于一个波形序列中包括多次下降沿跳变或多次上升沿跳变的情况,一个波形序列中仅存在一次下降沿电平跳变(或上升沿电平跳变)可以减少控制端的操作复杂性,无需控制发送端口的电平进行多次跳变才能传输一个比特,提高数据传输的效率。
下面对本实施例中的3种波形序列给出示例性的说明。图3给出了三种第一波形序列的示意图,图4给出了第二波形序列的示意图,图5给出了几种第三波形序列的示意图。其中,如图3所示,第一波形序列以高电平开始并持续一段时间后跳变为低电平,且第一波形序列中出现的低电平在所述传输持续时间内所占的总时长不随所述波形序列的波特率的变化而变化。例如,如图3(a)所示,第一波形序列的传输持续时间为40ns,高电平持续时间为10ns,占第一波形序列的持续时间的1/4。在实际应用中,主从设备一直处于连接状态中,主设备在默认状态输出高电平,持续为从设备供电,当主设备需要发送数据时,会通过自身的通断开关产生低电平,通过高低电平形成不同的波形序列,以传输相应的比特数据,当主设备输出低电平时,主设备则不能为从设备供电。因此,为了尽可能高效地为从设备供电,优选地,第一波形序列中出现的低电平在传输持续时间内所占的总时长可以小于传输持续时间的二分之一;由此,在传输的数据中高电平的出现时间越长则供电效率越高。如图3(b)所示,第一波形序列的持续时间为40ns,高电平持续设时间为30ns,占第一波形序列的传输持续时间的3/4,以此第一波形序列传输数据供电效率比较高。因此,图3(b)中的第一波形序列传输数据供电效率要比图3(a)中的高。此外,第一波形序列的波形还可以如图3(c)所示, 以高电平结束。图4所示的第二波形序列为在持续时间内一直为高电平,由此,又可以提高供电效率。第三波形序列以低电平开始并以高电平结束,且第三波形序列中出现的低电平在所述传输持续时间内所占的总时长不随所述波形序列的波特率的变化而变化。例如,如图5(a)所示,波特率为50Mbps,则第三波形序列的传输持续时间为20ns,假设低电平的持续时间固定为10ns,那么,低电平的持续时长占第三波形序列的传输持续时间的1/2,这时候从设备的取电效率为50%。又例如,如图5(b)所示,波特率为25Mbps,则第三波形序列的传输持续时间为40ns,假设低电平的持续时间仍然固定为10ns,那么,低电平的持续时长占第三波形序列的传输持续时间的1/4,此时从设备的取电效率为75%,当低电平的时长固定,随着波特率的降低,传输持续时间变长,取电效率提高,由此可见,低电平在所述传输持续时间内所占的总时长不随所述波形序列的波特率的变化而变化可以提高取电效率。因此,图5(b)中的第三波形序列传输数据供电效率要比图5(a)中的高。此外,图5(b)中第三波形序列中出现的低电平在传输持续时间内所占的总时长可以小于传输持续时间的二分之一还可以进一步提高供电效率。
本实施例中,第一波形序列、第二波形序列和第三波形序列的持续时间由本端当前使用的波特率决定,因此,在本实施例中,根据本地支持的波特率参数可以确定本端所能解析的波形序列的持续时间以及本端所发送的波形序列可以使用的持续时间。
在本发明实施例的一个可选实施方案中,所述本地支持的波特率参数至少包括:接收数据的波特率和/或发送数据的波特率;其中,所述接收数据的波特率包括一个或多个;所述发送数据的波特率包括一个或多个。其中,接收数据的波特率用于指示本端可以解析的接收数据的波形序列的波特率,发送数据的波特率用于指示本端所发送的波形序列可以使用的波特率,对端根据本端的发送数据的波特率,可以对本端发送的波形序列进行解析。在本实施例中,接收数据的波特率和发送数据的波特率均可以包括多个,对端在接收到之后,可以根据所述本端所支持的波特率参数,选择同时适合本端和对端的波特率,实现波特率自适应。
在本实施例中,本端可以主动向对端发送本地支持的波特率参数,或者,也可以是在接收到对端的请求之后,向对端发送本地支持的波特率参数。因此,在本实施例的一个可选实施方式中,在步骤S101之前,该方法还可以包括:检测接收端口的电平变化;根据所述电平变化以及所述波形序列的特征确定连续传输的第一接收数据对应的N个波形序列,其中,N为正整数,所述第一接收数据对应的N个波形序列中的各个波形序列为以下之一:所述第一波形序列、所述第二波形序列和所述第三波形序列;根据所述连续传输的第一接收数据对应的N个波形序列确定所述第一接收数据的比特序列,所述第一接收数据的比特序列至 少包括:第一传输数据,所述第一传输数据至少包括:用于指示获取波特率参数的指示信息。通过该可选实施方式,本端可以在接收到对端发送的用于指示获取波特率参数的指示信息之后,再获取所述第一待发送数据。
在上述可选实施方式中,本端可能知晓对端发送第一接收数据的比特序列对应的波形序列采用的波特率,例如,对端使用预先预定的波特率发送,在这种情况下,本端可以根据对端使用的波特率以及检测到的电平变化,确定连续传输的第一接收数据对应的N个波形序列。
在上述可选实施方式中,可选地,本端可能事先并不知晓对端发送第一接收数据的比特序列对应的波形序列采用的波特率,在这种情况下,本端可以根据预先设置好的数据帧头中包含的波形序列以及检测到的电平变化,从第一接收数据的比特序列的数据帧头中解析出第一接收数据的比特序列对应的波形序列的持续时间,进而得到对端发送第一接收数据的比特序列对应的波形序列采用的波特率,然后根据得到的波特率,对数据帧的传输数据部分进行解析,进而得到所述第一传输数据。
在本发明实施例的一个可选实施方案中,本端与对端之间传输的数据帧的数据帧头至少包括1个比特,数据帧头的第1个比特对应的波形序列为所述第三波形序列或者所述第一波形序列,本端与对端协商以第一波形序列或第三波形序列作为数据帧头,则在检测到的接收端口的电平变化形成上述数据帧头对应的波形序列时,可以确定当前接收到的波形序列为数据帧头,该数据帧头后紧接着的波形序列为传输数据的波形序列的起始位置。采用这种实施方式中在通信双方以预先协商的波特率进行数据传输的情况下,可以通过上述波形序列识别出数据帧头。
在本发明实施例的另一个可选实施方案中,本端与对端之间传输的数据帧的数据帧头可以至少包括M个比特,数据帧头的前M个比特对应的波形序由M个第一波形序列组成;或者,数据帧头的前M个比特对应的波形序列由M个第三波形序列组成,M为正整数且M≥2;或者,数据帧头的前M个比特对应的波形序列由至少一个第一波形序列和至少一个第三波形序列组成。相比于前一种可选实施方式,该可选实施方式还可以通过数据帧头的前M个比特对应的波形序列确定出一个波形序列的预设持续时间,即确定发送方发送数据的波特率,并可以利用该波特率进行数据的接收和发送,实现波特率自适应。
进一步地,本端与对端之间传输的数据帧的数据帧头的前几个比特对应的波形序列为连续相同的波形序列时,为了避免单频干扰,还可以在连续相同的波形序列的后面(只要在后面就可以,比如紧接着连续相同的波形序列后面,或者隔几个波形序列之后均可)约定至少1个与所述相同的波形序列不同的波形序列,即抗干扰比特对应的波形序列,例如,数据帧 头的前M个比特对应的波形序列由M个第一波形序列组成时,数据帧头还包括:在数据帧头的前M个比特之后的至少1个抗干扰比特,其中,所述至少1个抗干扰比特为第二波形序列或第三波形序列,例如,该数据帧头对应的波形序列可以为XXXXYZYZ,其中,X为第一波形序列,Y为第二波形序列,Z为第三波形序列;或者,数据帧头的前M个比特对应的波形序列由M个所述第三波形序列组成时,数据帧头还包括:在数据帧头的前M个比特之后的至少1个抗干扰比特,其中,所述至少1个抗干扰比特中至少有一个比特对应的波形序列为第一波形序列或第二波形序列,例如,该数据帧头对应的波形序列可以为ZZZZXYZZ。采用这种数据帧头结构,可以防止单频干扰,单频干扰可以理解为以相同周期产生的脉冲序列,因此,如果数据帧头由连续几个相同的波形序列组成,比如,连续4个Z,而单频干扰的频率恰好与波特率相同,即本端通过电平变化识别出与该数据帧头相同的波形序列,此时,本端会将该单频干扰识别为数据帧头,出现错误识别的情况,而通过第三种实施方式中的数据帧头中在连续相同的多个波形序列之后出现的不同的波形序列,使得数据帧头存在不同的时间间隔,即不会出现与单频干扰相同的波形序列,由此通过该实施方式中的数据帧头可以防单频干扰。
在本实施例中,可以通过对上述几种实施方式中提到的数据帧头进行解析得到一个波形序列的预设持续时间,以该预设持续时间作为每个波形序列的传输持续时间,根据电平变化以及波形序列特征确定接收数据中的传输数据以及数据帧为对应的波形序列。
以下给出如何检测接收端口的电平变化并根据电平变化确定N个波形序列的具体实现方式,本实施例包括但不限于以下情况:
在一个可选的实施方式中,检测接收端口的电平变化,包括:持续检测到接收端口的S个电平跳变;在检测到接收端口的S个电平跳变之后,继续检测接收端口的Q个电平跳变,其中S个电平跳变和Q个电平跳变均为从高电平跳变为低电平,S、Q均为正整数,且S>1,Q>1。根据电平变化以及波形序列的特征确定连续传输的N个波形序列,包括:获取数据帧头预设的S个电平跳变形成的L个波形序列,其中,L为正整数且1<L<N;根据L个波形序列的特征以及检测到的S个电平跳变中的任意两个电平跳变之间的时间间隔计算一个波形序列的持续时间;以该计算得到的持续时间作为每个波形序列的持续时间,根据Q个电平跳变以及波形序列的特征确定传输数据以及数据帧尾对应的波形序列。在本实施方式中,数据发送方和数据接收方预先约定数据帧头为L个比特的波形序列,该L个比特的波形序列对应S个电平跳变,数据接收方在持续检测接收端口的电平变化的过程中,可以将检测到的S个电平跳变默认为对应数据帧头的S个跳变,而在S个跳变之后检测到电平变化(即检测到的Q个跳变)则用于确定数据帧中的传输数据和数据帧尾对应的波形序列。当然,在 需要的时候,也可以判断根据检测到的S个电平跳变所形成的L个的波形序列是否与预设的数据帧头的L个比特波形序列对应,从而确定该S个电平跳变是否是数据帧头。数据接收方根据前述的方法接收到数据帧头后,根据数据帧头确定一个波形的持续时间T,再在每T时长内是否发生电平跳变以及每个电平跳变的特征,确定出Q个电平跳变对应的波形序列,从而确定整个N个波形序列。
具体来说,根据前述对待发送数据中格式的描述可以确定,本端在对端发送的第一接收数据时,是先接收到几个比特的数据帧头之后,再接收后续的传输数据以及数据帧尾信息,而数据帧头中携带了一些参数信息,例如,本端和对端预先约定L个波形序列作为数据帧头,因此,本端可以从对端获取或者从自身存储器中获取到L个波形序列的特征,即数据帧头中的波形序列的特征是本端已知的。而根据前文的波形序列的特征可以知道,第一波形序列X以高电平开始,且其在波形的持续时间内经历一次电平跳变且跳变的时间为T1(T1为从每一个波形开始的时间到发生跳变的时间,T1>0);第二波形序列为持续的高电平,其在波形的持续时间内不经历电平跳变;第三波形序列为以低电平开始,由于本端和对端默认状态是高电平,因此第三波形序列可以认为其在波形的最开始(可以认为是0时刻)经历一次电平跳变。例如,如图6中的(a)所示,当预先约定的数据帧头的L个波形序列为4bit的序列“XZZZ”时,则可以认为数据帧头需要经历4次下降沿的电平跳变(X和Z均有一次下降沿跳变),在图6中的(a)中当检测到4次下降沿跳变时,则认为数据帧头接收完毕。即该4次跳变对应的即为数据帧头。
接下来需要根据检测到的S个跳变和L个波形序列的特征计算出数据帧头中携带的持续时间等信息。仍然以前例来详细说明,如图6中的(b)所示,双方已经约定L位的数据帧头格式为4bit的序列“XZZZ”,如果在数据传输中没有发生错误,则本端接收到的S个跳变应当为4个下降沿跳变。本端已知数据帧头数据中的第1个波形序列为第一波形序列X,且第一波形序列X的跳变时间为T1=a*T,其中,a为预设的高电平占空比系数,第2个波形序列为第三波形序列Z,且第三波形序列Z以低电平开始,持续一固定时长(T2)之后,跳变为高电平。本端可以在接收端口检测到第1次和第2次电平跳变之间(电平跳变仅指由高电平到低电平的电平跳变)的时间间隔τ,本端检测到的时间间隔τ与持续时间T应满足τ=(T-T1),即τ=(T-a*T)。由此,本端可以根据数据帧头序列的波形特征以及L个电平跳变中的任意两个电平跳变之间的时间间隔(即τ)计算一个波形序列的持续时间T,从而本端通过数据帧头数据即可确定对端发送数据所采用的波特率(即1/T)。图6中的(a)和图6中的(b)中第一波形序列X以高电平结束,第三波形序列Z以高电平结束时。如果第一波形序列以低电平结束时也同样可以获得,在此不再赘叙。
由于在数据帧头的结束位置即是传输数据的开始位置,在确定了每个波形的持续时间T后,就可以从数据帧头的结束位置开始解析传输数据。当本端根据检测电平由高电平到低电平的电平跳变来确定波形类型时,根据前面已知的波形特征,在每一段持续时间T内,当检测到出现一次下降沿电平跳变且跳变的时间为T1时,则可以判定其为一个第一波形序列X;当检测到某一个波形序列在持续时间的一开始就发生下降沿电平跳变的,则可以判定其为一个第三波形序列Z;当检测到某一个模型序列在波形的持续时间内不发生下降沿电平跳变时,则可以判定其为一个第二波形序列Y。在图6中的(b)中可以看到,在数据帧头“XZZZ”之后的数据即为确定出的传输数据和数据帧尾,从解析的结果可以看出,在数据帧头“XZZZ”之后的波形序列依次为“XYXXYZZXYY”,如图6中的(c)所示,而一旦出现“YY”则可以认为其为数据帧尾,可见真正的传输数据为“XYXXYZZX”,如果是以X表示1、以Y或Z表示0的场合,则该传输数据为最终解析为“10110001”,如图6中的(d)所示。
因此,在确定完每个波形序列的持续时间后,利用上述方法可以确定出Q个电平跳变所代表的传输数据和数据帧尾对应的波形序列,而前文中已经确定了数据帧头的L个波形序列,至此可以确定出电平变化的连续的N个波形序列,从而最终解析出传输的数据。
在本实施方式的确定电平变化时,可以采样获得完整的电平变化的规律,从而获得S个电平跳变,也可以仅设置监测电平变化的电路来监测电平的跳变,即,只要能够获得对应于数据帧头的S个跳变均可,本发明并不局限于哪种方式。如果利用采样的方式获得S个电平跳变,则不仅可以获得电平发生跳变的特征,还可以获得完整的电平变化对应的波形,从而无需考虑各类波形序列的特征,可以适用在任何类型的波形序列中,均可以成功解析出波形序列。如果利用监测电平跳变的方式,则无需对电平进行采样,避免了长时间采样来还原整体波形,只需要根据电平跳变的特征就可以确定出N个波形序列,减少了解析的复杂程度。
在本实施方式中,采样可以利用采样电路来实现接收端口的电平检测,根据需要采样的目标的不同,可以采用相匹配的采样频率。
在本实施方式中,电平跳变监测可以采用比较器、差分放大器等器件来实现,当然,任何可以实现监测电平跳变的软硬件实现,均应是本发明所保护的范围。
作为一种可选的实施方式,本实施例中,本端与对端可以预先约定传输数据的数据帧的数据帧尾对应的波形序列。可选地,数据帧尾可以包括2个比特,对应的波形序列包括以下3种方式之一:数据帧尾的第一个比特对应的波形序列为第二波形序列,数据帧尾的第二个比特对应的波形序列为第二波形序列;或者,数据帧尾的第一个比特对应的波形序列为第三波形序列,数据帧尾的第二个比特对应的波形序列为第二波形序列;或者,数据帧尾的第一个比特对应的波形序列为第一波形序列,数据帧尾的第二个比特对应的波形序列为第三波形 序列。在本实施例中,当根据电平变化以及波形序列的特征确定的波形序列为上述预设的数据帧尾对应的波形序列,则说明数据接收结束。本实施例中,数据帧头和数据帧尾对应的波形序列是通信协议预先约定好的,一般来说,约定数据帧头和数据帧尾不出现同样的波形序列,这样更容易将数据帧头和数据帧尾进行识别和区别,如果约定的数据帧头中的波形序列包含了数据帧尾中的2个波形序列,那么可以通过一些策略区分数据帧头和数据帧为,例如,数据帧头可以约定为8比特,即由8个波形序列组成,而数据帧尾由2个波形序列组成,以此作为两者的区别,由于静默态接收端口的电平一直为高电平,在接收端口检测到第一个下降沿跳变时,开始接收数据帧头,连续检测到8个预设的数据帧头对应的波形序列,则数据帧头接收结束,总之可以区分数据帧头和数据帧为即可,因此,本实施例对数据帧头和数据帧尾对应的波形序列并不做具体限制。
步骤S102,根据第一待发送数据的比特序列,获取所述比特序列中的比特对应的波形序列。
在本实施例中,进行数据传输的本端与对端可提前协商用于表示比特1和比特0的波形序列类型,或者,本端与对端在出厂之前预先设置存储用于表示比特1和比特0的波形序列类型,例如,第一波形序列表示比特1,第二波形序列和第三波形序列均能够表示比特0,此时对于数据本端而言,当需要外发数据比特1时,本端产生第一波形序列,当需要外发数据比特0时,本端根据需要产生第二波形序列或第三波形序列;同样的,当第一波形序列表示比特0时,第二波形序列和第三波形序列均能够表示比特1,此时对于本端而言,当需要外发数据比特1时,本端根据需要产生第二波形序列或第三波形序列,当需要外发数据比特0时,本端产生第一波形序列;通过不同的波形序列表示比特0和比特1,能够实现通信双方的正常数据收发,保证数据交互的正确性;
在本实施例中,第一波形序列、第二波形序列、第三波形序列分别为三种波形不同的脉冲波,且第一波形序列、第二波形序列、第三波形序列三种波形的单个脉冲持续时间相同,也就是说,三种波形序列的单个脉冲从脉冲开始至脉冲结束所持续的时间相同;三种波形序列的单个脉冲从脉冲开始至脉冲结束所持续的时间均为T。
在步骤S102中,本端获取并分析第一待发送数据,并根据第一待发送数据中的比特1、比特0与第一波形序列、第二波形序列、第三波形序列的对应关系,获取第一待发送数据的比特序列相应的波形序列。其中,在所述比特序列中有至少两个连续比特为所述第二数据比特时,所述至少两个连续比特中的第一个比特对应的波形序列为所述第二波形序列,第二个比特以及后续的比特对应的波形序列为所述第三波形序列;也就是说,当第一待发送数据的比特序列中有A(A≥2)个连续的第二数据比特时,仅第一个第二数据比特用第二波形序 列表示,之后的A-1个第二数据比特均用第三波形序列进行表示,从而避免当需要连续传输第二数据比特时,本端持续输出第二波形序列,即本端持续输出高电平信号,导致对端无法区分接收到的是第二数据比特还是无数据传输时的持续高电平的情况。
步骤S103,按照当前使用的波特率,连续发送所述比特序列中的比特对应的波形序列,其中,所述波形序列的持续时间与所述当前使用的波特率成反比关系。
在本实施例中,本端当前使用的波特率可以为本端默认的波特率,或者,在本端在接收到对端发送的用于指示获取波特率参数的指示信息的情况下,本端当前使用的波特率可以是对端发送用于指示获取波特率参数的指示信息的波特率,这样可以保证本端当前使用的波特率为对端所支持的波特率,方便对端解析本端发送的数据。
在本实施例的一个可选实施方式中,在执行步骤S103发送所述述第一待发送数据的比特序列中的比特对应的波形序列时,本端按照所述当前使用的波特率,控制发送端口的电平按照第一待发送数据的比特序列中的比特对应的波形序列以及波形序列的特征进行变化,以发送第一待发送数据。例如,通信协议约定:比特“1”用第一波形序列表示,则比特“0”用第二波形序列和第三波形序列表示,本实施例中,第一待发送数据的比特序列中的每个比特对应的波形序列是确定的,例如,本端通过控制发送端口产生高低电平,即,通过硬件开关或软件等控制该端口的高电平变为低电平作为一次下降沿的跳变,然后控制该端口恢复为高电平则形成一次上升沿的跳变。波形序列是通过发送端口产生的高低电平的变化得到的,由此,就可以产生每个比特对应的波形序列,进而形成一个数据帧对应的波形序列。例如,第一待发送数据的比特序列为11001000,那么按照通信协议约定,第一待发送数据的比特序列对应的8个波形序列依次为XXYZXYZZ,其中,X为第一波形序列,Y为第二波形序列,Z为第三波形序列,根据各个波形序列的上述波形序列的特征,即第一波形序列、第二波形序列以及第三波形序列的传输持续时间相同且与所述当前使用的波特率呈反比,如均为T,第一波形序列的高电平的持续时间为T1,第一波形序列与第三波形序列中的低电平的固定时长均为T2,那么,第一待发送数据的比特序列11001000对应的8个波形序列可以如图7所示。在发送第一待发送数据的比特序列的每个比特时,在相应时刻控制发送端口的电平发生跳变,以形成该比特对应的波形序列,进而形成一个数据帧的比特序列对应的波形序列,传输第一待发送数据的比特序列。
在本发明实施例的一个可选实施方案中,在执行步骤S103之后,对端接收到本端发送的所述本地支持的波特率参数,则对端可以根据本端的所述本地支持的波特率参数,选择后续与本端进行通信的波特率。可选地,对端可以根据所述本地支持的波特率参数,选择所述 本端支持的最大波特率,并将选择的波特率返回给本端,从而可以提高传输速率。在具体应用中,对端发送选择的波特率时,可以采用选择的所述波特率进行传输,也可以采用本端向所述对端发送所述本地支持的波特率参数时所使用的波特率参数,或者,也可以采用对端当前使用的波特率进行传输。因此,在本发明实施例的一个可选实施方案中,在步骤S103之后,该方法还可以包括:检测接收端口的电平变化;根据所述电平变化以及所述波形序列的特征确定对端连续传输的第二接收数据对应的M个波形序列,其中,M为正整数且M≥2,所述第二接收数据对应的M个波形序列中的各个波形序列分别为以下之一:所述第一波形序列、所述第二波形序列和所述第三波形序列;根据所述连续传输的第二接收数据对应的M个波形序列确定所述第二接收数据的比特序列;解析所述第二接收数据,获取所述对端从所述本地支持的波特率参数中选择的波特率;获取第二待发送数据的比特序列;按照所述选择的波特率,发送所述第二待发送数据的比特序列对应的波形序列,其中,所述波形序列的持续时间与所述选择的波特率成反比。
在上述实施方式中,本端根据接收端口的电平变化及波形序列的特征确定对端连续传输的第二接收数据对应的M个波形序列,并解析得到第二接收数据的方式与前面所述的确定第一接收数据对应的N个波形序列,并解析得到第一接收数据的方式相似,在此不再赘述。
在上述实施方式中,本端在接收到第二接收数据之后,获得到对端选择的波特率,则在发送第二待发送数据时,本端按照所述选择的波特率发送第二待发送数据,从而实现了本端与对端之间的波特率自适应。
在上述实施方式中,第二待发送数据为本端需要向对端传输的数据,在具体传输过程中,本端可以将第二待发送数据以上述数据帧的结构发送,第二待发送数据的具体内容本实施例不作限定。
在本实施例提供的方案中,为保证对端在后续数据传输过程中采用本端支持的波特率进行数据交互,本端在第一待发送数据的比特序列中向对端发送本地支持的波特率参数,从而使得本端与对端可以采用多种波特率进行数据交互,只需要在本端在待发送数据中包含本地支持的波特率参数,即可实现数据传输过程中波特率的跳变,通过本方案,能够实现通信双方根据不同的数据发送场景,对波特率进行调整,以满足不同通信场景下的数据传输需要。
实施例2
本实施例提供了一种数据传输装置,该数据传输装置可以设置在实施例1所述的本端中,用于执行实施例1所述的数据传输方法。
图8为本实施例提供的数据传输装置的结构示意图,如图8所示,该数据传输装置主要包括:第一获取模块800、第二获取模块802和第一发送模块804。
下面主要对本实施例提供的数据传输装置的各个功能模块的功能进行描述,其它未尽事宜可以参考实施例1的描述。
第一获取模块800,用于获取第一待发送数据的比特序列,其中,所述第一待发送数据的比特序列至少包括:待传输数据,所述待传输数据至少包括:本地支持的波特率参数;第二获取模块802,用于根据第一待发送数据的比特序列,获取所述比特序列中的比特对应的波形序列,其中,以第一波形序列表示第一数据比特,以第二波形序列或第三波形序列表示第二数据比特,所述第一数据比特为比特1和比特0中的一个,所述第二数据比特为所述比特1和比特0中的另一个,在所述比特序列中有至少两个连续比特为所述第二数据比特时,所述至少两个连续比特中的第一个比特对应的波形序列为所述第二波形序列,第二个比特以及后续的比特对应的波形序列为所述第三波形序列;其中,所述波形序列的特征包括:所述第一波形序列的持续时间、所述第二波形序列的持续时间以及所述第三波形序列的持续时间相同,所述传输持续时间与所述波形序列的波特率呈反比关系,且所述第一波形序列以高电平开始并在所述传输持续时间内出现低电平,其中,所述第一波形序列中出现的低电平在所述传输持续时间内所占的总时长不随所述波形序列的波特率的变化而变化,所述第二波形序列在所述传输持续时间内持续高电平,所述第三波形序列以低电平开始并以高电平结束,且所述第三波形序列中出现的低电平在所述传输持续时间内所占的总时长不随所述波形序列的波特率的变化而变化。
在本实施例中,本地支持的波特率参数用于指示本端在传输数据(包括接收和发送数据)时,传输数据使用的波形序列所支持的波特率。下面对本实施例中的波形序列进行说明。
在本实施例中,以第一波形序列表示第一数据比特,以第二波形序列或第三波形序列表示第二数据比特,所述第一数据比特为比特1和比特0中的一个,所述第二数据比特为所述比特1和比特0中的另一个。
在本发明实施例的一个可选实施方案中,所述第一发送模块804用于按照以下方式连续发送所述比特序列中的比特对应的波形序列:按照所述当前使用的波特率,控制发送端口的电平按照所述比特序列中的比特对应的波形序列的波形以及所述波形序列的特征进行变化,以发送所述第一待发送数据。例如,通信协议约定:比特“1”用第一波形序列表示,则比特“0”用第二波形序列和第三波形序列表示,本实施例中,第一待发送数据的比特序列中的每个比特对应的波形序列是确定的,例如,第一发送模块804通过控制发送端口产生高低电平,即,通过硬件开关或软件等控制该端口的高电平变为低电平作为一次下降沿的跳变,然后控制该端口恢复为高电平则形成一次上升沿的跳变。波形序列是通过发送端口产生的高低电平的变化得到的,由此,就可以产生每个比特对应的波形序列,进而形成一个数据帧对应的波形序 列。例如,第一待发送数据的比特序列为11001000,那么按照通信协议约定,第i个数据帧的比特序列对应的8个波形序列依次为XXYZXYZZ,其中,X为第一波形序列,Y为第二波形序列,Z为第三波形序列,根据各个波形序列的上述波形序列的特征,即第一波形序列、第二波形序列以及第三波形序列的传输持续时间相同且与所述当前使用的波特率呈反比,如均为T,第一预设时间为T1,第二预设时间T2,那么,第一待发送数据的比特序列11001000对应的8个波形序列可以如图7所示。在发送第一待发送数据的比特序列的每个比特时,在相应时刻控制发送端口的电平发生跳变,以形成该比特对应的波形序列,进而形成一个数据帧的比特序列对应的波形序列,传输第一待发送数据的比特序列。
在本发明实施例的一个可选实施方案中,该数据传输装置还可以包括:第一检测模块,用于在所述第一获取模块800获取第一待发送数据的比特序列之前,检测接收端口的电平变化;第一确定模块,用于根据所述电平变化以及所述波形序列的特征确定连对端续传输的第一接收数据对应的N个波形序列,其中,N为正整数,所述第一接收数据对应的N个波形序列中的各个波形序列为以下之一:所述第一波形序列、所述第二波形序列和所述第三波形序列;第二确定模块,用于根据所述连续传输的第一接收数据对应的N个波形序列确定所述第一接收数据的比特序列,所述第一接收数据的比特序列至少包括:第一传输数据,所述第一传输数据至少包括:用于指示获取波特率参数的指示信息。通过该可选实施方式,第一获取模块800可以在接收到对端发送的用于指示获取波特率参数的指示信息之后,再获取所述第一待发送数据,即可以根据对端的请求向对端发送本地支持的波特率参数。
第一确定模块根据检测到的电平变化以及所述波形序列的特征确定连对端续传输的第一接收数据对应的N个波形序列的可选实施方式以及第二确定模块根据所述连续传输的第一接收数据对应的N个波形序列确定所述第一接收数据的比特序列的可选实施方式可以参见实施例1中对本端确定第一接收数据对应的N个波形序列以及确定第一接收数据的比特序列的可选实施方式的描述,具体本实施例不再赘述。
在本发明实施例的一个可选实施方案中,该数据传输装置还可以包括:第二检测模块,用于在所述根据第一待发送数据的比特序列,连续发送所述比特序列中的比特对应的波形序列之后,检测接收端口的电平变化;第三确定模块,用于根据所述电平变化以及所述波形序列的特征确定对端连续传输的第二接收数据对应的M个波形序列,其中,M为正整数且M≥2,所述第二接收数据对应的M个波形序列中的各个波形序列分别为以下之一:所述第一波形序列、所述第二波形序列和所述第三波形序列;第四确定模块,用于根据所述连续传输的第二接收数据对应的M个波形序列确定所述第二接收数据的比特序列;第三获取模块,用于解析所述第二接收数据,获取所述对端从所述本地支持的波特率参数中选择的波特率; 第四获取模块,用于获取第二待发送数据的比特序列;第二发送模块,用于按照所述选择的波特率,发送所述第二待发送数据的比特序列对应的波形序列,其中,所述波形序列的持续时间与所述选择的波特率成反比。通过该可选实施方式,本端可以获取到对端根据所述本地支持的波特率参数选择的波特率,并采用对端所选择的波特率发送第二待发送数据的比特序列,实现波特率的跳变。
在上述可选实施方式中,可选地,对端选择的波特率可以为本端支持的最大波特率,从而可以提高传输速率。
在本发明实施例的一个可选实施方案中,所述第二发送模块按照以下方式发送所述第二待发送数据的比特序列对应的波形序列:按照所述选择的波特率,控制发送端口的电平按照所述第二待发送数据的比特序列中的比特对应的波形序列的波形以及所述波形序列的特征进行变化,以发送所述第二待发送数据。
本发明实施例还提供了一种计算机可读存储介质,具有存储于其中的指令,当终端的处理器执行所述指令时,所述终端执行根据本发明一个实施例的数据传输方法。
在流程图中表示或在此以其他方式描述的逻辑和/或步骤,例如,可以被认为是用于实现逻辑功能的可执行指令的定序列表,可以具体实现在任何计算机可读介质中,以供指令执行系统、装置或设备(如基于计算机的系统、包括处理器的系统或其他可以从指令执行系统、装置或设备取指令并执行指令的系统)使用,或结合这些指令执行系统、装置或设备而使用。就本说明书而言,"计算机可读介质"可以是任何可以包含、存储、通信、传播或传输程序以供指令执行系统、装置或设备或结合这些指令执行系统、装置或设备而使用的装置。
应当理解,本发明的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。例如,如果用硬件来实现,和在另一实施方式中一样,可用本领域公知的下列技术中的任一项或他们的组合来实现:具有用于对数据信号实现逻辑功能的逻辑门电路的离散逻辑电路,具有合适的组合逻辑门电路的专用集成电路,可编程门阵列(PGA),现场可编程门阵列(FPGA)等。

Claims (16)

  1. 一种数据传输方法,其特征在于,包括:
    获取第一待发送数据的比特序列,其中,所述第一待发送数据的比特序列至少包括:待传输数据,所述待传输数据至少包括:本地支持的波特率参数;
    根据第一待发送数据的比特序列,获取所述比特序列中的比特对应的波形序列,其中,以第一波形序列表示第一数据比特,以第二波形序列或第三波形序列表示第二数据比特,所述第一数据比特为比特1和比特0中的一个,所述第二数据比特为所述比特1和比特0中的另一个,在所述比特序列中有至少两个连续比特为所述第二数据比特时,所述至少两个连续比特中的第一个比特对应的波形序列为所述第二波形序列,第二个比特以及后续的比特对应的波形序列为所述第三波形序列;其中,所述波形序列的特征包括:所述第一波形序列的持续时间、所述第二波形序列的持续时间以及所述第三波形序列的持续时间相同,所述传输持续时间与所述波形序列的波特率呈反比关系,且所述第一波形序列以高电平开始并在所述传输持续时间内出现低电平,其中,所述第一波形序列中出现的低电平在所述传输持续时间内所占的总时长不随所述波形序列的波特率的变化而变化,所述第二波形序列在所述传输持续时间内持续高电平,所述第三波形序列以低电平开始并以高电平结束,且所述第三波形序列中出现的低电平在所述传输持续时间内所占的总时长不随所述波形序列的波特率的变化而变化;
    按照当前使用的波特率,连续发送所述比特序列中的比特对应的波形序列,其中,所述波形序列的持续时间与所述当前使用的波特率成反比关系。
  2. 根据权利要求1所述的方法,其特征在于,按照当前使用的波特率,连续发送所述比特序列中的比特对应的波形序列,包括:
    按照所述当前使用的波特率,控制发送端口的电平按照所述比特序列中的比特对应的波形序列的波形以及所述波形序列的特征进行变化,以发送所述第一待发送数据。
  3. 根据权利要求1或2所述的方法,其特征在于,在获取第一待发送数据的比特序列之前,所述方法还包括:
    检测接收端口的电平变化;
    根据所述电平变化以及所述波形序列的特征确定连对端续传输的第一接收数据对应的N个波形序列,其中,N为正整数,所述第一接收数据对应的N个波形序列中的各个波形序列为以下之一:所述第一波形序列、所述第二波形序列和所述第三波形序列;
    根据所述连续传输的第一接收数据对应的N个波形序列确定所述第一接收数据的比特序列,所述第一接收数据的比特序列至少包括:第一传输数据,所述第一传输数据至少包括:用于指示获取波特率参数的指示信息。
  4. 根据权利要求1至3中任一项所述的方法,其特征在于,在所述根据第一待发送数据的比特序列,连续发送所述比特序列中的比特对应的波形序列之后,所述方法还包括:
    检测接收端口的电平变化;
    根据所述电平变化以及所述波形序列的特征确定对端连续传输的第二接收数据对应的M个波形序列,其中,M为正整数且M≥2,所述第二接收数据对应的M个波形序列中的各个波形序列分别为以下之一:所述第一波形序列、所述第二波形序列和所述第三波形序列;
    根据所述连续传输的第二接收数据对应的M个波形序列确定所述第二接收数据的比特序列;
    解析所述第二接收数据,获取所述对端从所述本地支持的波特率参数中选择的波特率;
    获取第二待发送数据的比特序列;
    按照所述选择的波特率,发送所述第二待发送数据的比特序列对应的波形序列,其中,所述波形序列的持续时间与所述选择的波特率成反比。
  5. 根据权利要求4所述的方法,其特征在于,按照所述选择的波特率,发送所述第二待发送数据的比特序列对应的波形序列,其中,所述波形序列的持续时间与所述选择的波特率成反比,包括:
    按照所述选择的波特率,控制发送端口的电平按照所述第二待发送数据的比特序列中的比特对应的波形序列的波形以及所述波形序列的特征进行变化,以发送所述第二待发送数据。
  6. 根据权利要求1至5中任一项所述的方法,其特征在于,
    所述本地支持的波特率参数至少包括:接收数据的波特率和/或发送数据的波特率;其中:
    所述接收数据的波特率包括一个或多个;
    所述发送数据的波特率包括一个或多个。
  7. 根据权利要求1至6中任一项所述的方法,其特征在于,所述波形序列的特征还包括:
    所述第一波形序列中出现的低电平在所述持续时间内所占的总时长小于所述持续时间的二分之一;和/或
    所述第三波形序列中出现的低电平在所述持续时间内所占的总时长小于所述持续时间 的二分之一。
  8. 根据权利要求1至7任一项所述的方法,其特征在于,
    所述第三波形序列在所述持续时间内仅出现一次由低电平变为高电平的电平跳变,并以高电平结束;
    所述第一波形序列以高电平开始并在所述持续时间内仅出现一次由高电平变为低电平的电平跳变,并以低电平结束;或者,所述第一波形序列以高电平开始并在所述持续时间内仅一次由高电平变为低电平的电平跳变,并以高电平结束。
  9. 根据权利要求1至8中任一项所述的方法,其特征在于,
    所述第一待发送数据的比特序列以及所述第二待发送数据的比特序列均包括一个数据帧,所述数据帧包括:数据帧头、传输数据以及数据帧尾;所述数据帧头至少包括M个比特,M为正整数且M≥2;
    其中,所述数据帧头的前M个比特对应的波形序列由M个所述第一波形序列组成;或
    所述数据帧头的前M个比特对应的波形序列由M个所述第三波形序列组成;或
    所述数据帧头的前M个比特对应的波形序列包括至少一个所述第一波形序列和至少一个所述第三波形序列。
  10. 根据权利要求9所述的方法,其特征在于,
    所述数据帧头的前M个比特对应的波形序列由M个所述第一波形序列组成时,所述数据帧头还包括:在所述数据帧头的前M个比特之后的至少1个抗干扰比特,其中,所述至少1个抗干扰比特对应的波形序列为所述第二波形序列或所述第三波形序列;
    所述数据帧头的前M个比特对应的波形序列由M个所述第三波形序列组成时,所述数据帧头还包括:在所述数据帧头的前M个比特之后的至少1个抗干扰比特,其中,所述至少1个抗干扰比特对应的波形序列为所述第二波形序列或所述第一波形序列。
  11. 一种数据传输装置,其特征在于,包括:
    第一获取模块,用于获取第一待发送数据的比特序列,其中,所述第一待发送数据的比特序列至少包括:待传输数据,所述待传输数据至少包括:本地支持的波特率参数;
    第二获取模块,用于根据第一待发送数据的比特序列,获取所述比特序列中的比特对应的波形序列,其中,以第一波形序列表示第一数据比特,以第二波形序列或第三波形序列表示第二数据比特,所述第一数据比特为比特1和比特0中的一个,所述第二数据比特为所述比特1和比特0中的另一个,在所述比特序列中有至少两个连续比特为所述第二数据比特时,所述至少两个连续比特中的第一个比特对应的波形序列为所述第二波形序列,第二个比特以及后续的比特对应的波形序列为所述第三波形序列;其中,所述波形序列的特征包括:所述 第一波形序列的持续时间、所述第二波形序列的持续时间以及所述第三波形序列的持续时间相同,所述传输持续时间与所述波形序列的波特率呈反比关系,且所述第一波形序列以高电平开始并在所述传输持续时间内出现低电平,其中,所述第一波形序列中出现的低电平在所述传输持续时间内所占的总时长不随所述波形序列的波特率的变化而变化,所述第二波形序列在所述传输持续时间内持续高电平,所述第三波形序列以低电平开始并以高电平结束,且所述第三波形序列中出现的低电平在所述传输持续时间内所占的总时长不随所述波形序列的波特率的变化而变化;
    第一发送模块,用于按照当前使用的波特率,连续发送所述比特序列中的比特对应的波形序列,其中,所述波形序列的持续时间与所述当前使用的波特率成反比关系。
  12. 根据权利要求11所述的装置,其特征在于,所述第一发送模块用于按照以下方式连续发送所述比特序列中的比特对应的波形序列:
    按照所述当前使用的波特率,控制发送端口的电平按照所述比特序列中的比特对应的波形序列的波形以及所述波形序列的特征进行变化,以发送所述第一待发送数据。
  13. 根据权利要求11或12所述的装置,其特征在于,还包括:
    第一检测模块,用于在所述第一获取模块获取第一待发送数据的比特序列之前,检测接收端口的电平变化;
    第一确定模块,用于根据所述电平变化以及所述波形序列的特征确定连对端续传输的第一接收数据对应的N个波形序列,其中,N为正整数,所述第一接收数据对应的N个波形序列中的各个波形序列为以下之一:所述第一波形序列、所述第二波形序列和所述第三波形序列;
    第二确定模块,用于根据所述连续传输的第一接收数据对应的N个波形序列确定所述第一接收数据的比特序列,所述第一接收数据的比特序列至少包括:第一传输数据,所述第一传输数据至少包括:用于指示获取波特率参数的指示信息。
  14. 根据权利要求11至13中任一项所述的装置,其特征在于,还包括:
    第二检测模块,用于在所述根据第一待发送数据的比特序列,连续发送所述比特序列中的比特对应的波形序列之后,检测接收端口的电平变化;
    第三确定模块,用于根据所述电平变化以及所述波形序列的特征确定对端连续传输的第二接收数据对应的M个波形序列,其中,M为正整数且M≥2,所述第二接收数据对应的M个波形序列中的各个波形序列分别为以下之一:所述第一波形序列、所述第二波形序列和所述第三波形序列;
    第四确定模块,用于根据所述连续传输的第二接收数据对应的M个波形序列确定所述 第二接收数据的比特序列;
    第三获取模块,用于解析所述第二接收数据,获取所述对端从所述本地支持的波特率参数中选择的波特率;
    第四获取模块,用于获取第二待发送数据的比特序列;
    第二发送模块,用于按照所述选择的波特率,发送所述第二待发送数据的比特序列对应的波形序列,其中,所述波形序列的持续时间与所述选择的波特率成反比。
  15. 根据权利要求14所述的装置,其特征在于,所述第二发送模块按照以下方式发送所述第二待发送数据的比特序列对应的波形序列:
    按照所述选择的波特率,控制发送端口的电平按照所述第二待发送数据的比特序列中的比特对应的波形序列的波形以及所述波形序列的特征进行变化,以发送所述第二待发送数据。
  16. 一种计算机可读存储介质,具有存储于其中的指令,当终端的处理器执行所述指令时,所述终端执行如权利要求1至10任一项所述的数据传输方法。
PCT/CN2017/107600 2016-11-24 2017-10-25 数据传输方法及装置 Ceased WO2018095181A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201611051707.0A CN107241161B (zh) 2016-11-24 2016-11-24 一种数据传输方法及装置
CN201611051707.0 2016-11-24

Publications (1)

Publication Number Publication Date
WO2018095181A1 true WO2018095181A1 (zh) 2018-05-31

Family

ID=59982925

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/107600 Ceased WO2018095181A1 (zh) 2016-11-24 2017-10-25 数据传输方法及装置

Country Status (2)

Country Link
CN (1) CN107241161B (zh)
WO (1) WO2018095181A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112511334A (zh) * 2020-10-13 2021-03-16 博流智能科技(南京)有限公司 提高通信速率的方法及系统
CN112968752A (zh) * 2021-01-28 2021-06-15 歌尔科技有限公司 一种uart通信的波特率切换方法、装置及发起方终端
CN116886247A (zh) * 2023-09-01 2023-10-13 珠海芯探索微电子有限公司 基于uart通信的波特率自适应方法、装置、uart系统、介质
WO2025157315A1 (zh) * 2024-05-24 2025-07-31 中兴通讯股份有限公司 信号传输方法、装置、物联网节点及计算机可读存储介质

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107241161B (zh) * 2016-11-24 2019-12-31 天地融科技股份有限公司 一种数据传输方法及装置
WO2018095180A1 (zh) * 2016-11-24 2018-05-31 天地融科技股份有限公司 数据发送方法、数据接收方法和装置
CN113742003B (zh) * 2021-09-15 2023-08-22 深圳市朗强科技有限公司 一种基于fpga芯片的程序代码执行方法及设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7415543B2 (en) * 2003-11-12 2008-08-19 Lsi Corporation Serial port initialization in storage system controllers
CN101710857A (zh) * 2009-11-05 2010-05-19 厦门敏讯信息技术股份有限公司 串行通信波特率自适应方法及其装置
CN103716118A (zh) * 2012-09-28 2014-04-09 京信通信系统(中国)有限公司 一种自适应多速率的数据发送和接收方法及装置
CN107241162A (zh) * 2016-11-24 2017-10-10 天地融科技股份有限公司 一种数据传输方法及装置
CN107241161A (zh) * 2016-11-24 2017-10-10 天地融科技股份有限公司 一种数据传输方法及装置

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5033241B2 (ja) * 2007-11-13 2012-09-26 エヌエックスピー ビー ヴィ デューティサイクル変調伝送
JP2010147943A (ja) * 2008-12-19 2010-07-01 Sony Corp 情報処理装置、及び信号伝送方法
CN102333054B (zh) * 2011-09-26 2015-06-17 天地融科技股份有限公司 一种数据发送、接收方法及装置
CN103716270B (zh) * 2011-09-26 2017-10-03 天地融科技股份有限公司 一种数据发送、接收方法及装置
CN104796222A (zh) * 2014-11-21 2015-07-22 湖南先步信息股份有限公司 Can波特率自动匹配的方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7415543B2 (en) * 2003-11-12 2008-08-19 Lsi Corporation Serial port initialization in storage system controllers
CN101710857A (zh) * 2009-11-05 2010-05-19 厦门敏讯信息技术股份有限公司 串行通信波特率自适应方法及其装置
CN103716118A (zh) * 2012-09-28 2014-04-09 京信通信系统(中国)有限公司 一种自适应多速率的数据发送和接收方法及装置
CN107241162A (zh) * 2016-11-24 2017-10-10 天地融科技股份有限公司 一种数据传输方法及装置
CN107241161A (zh) * 2016-11-24 2017-10-10 天地融科技股份有限公司 一种数据传输方法及装置

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112511334A (zh) * 2020-10-13 2021-03-16 博流智能科技(南京)有限公司 提高通信速率的方法及系统
CN112511334B (zh) * 2020-10-13 2024-05-07 博流智能科技(南京)有限公司 提高通信速率的方法及系统
CN112968752A (zh) * 2021-01-28 2021-06-15 歌尔科技有限公司 一种uart通信的波特率切换方法、装置及发起方终端
CN112968752B (zh) * 2021-01-28 2023-01-24 歌尔科技有限公司 一种uart通信的波特率切换方法、装置及发起方终端
CN116886247A (zh) * 2023-09-01 2023-10-13 珠海芯探索微电子有限公司 基于uart通信的波特率自适应方法、装置、uart系统、介质
CN116886247B (zh) * 2023-09-01 2023-11-21 珠海芯探索微电子有限公司 基于uart通信的波特率自适应方法、装置、uart系统、介质
WO2025157315A1 (zh) * 2024-05-24 2025-07-31 中兴通讯股份有限公司 信号传输方法、装置、物联网节点及计算机可读存储介质

Also Published As

Publication number Publication date
CN107241161A (zh) 2017-10-10
CN107241161B (zh) 2019-12-31

Similar Documents

Publication Publication Date Title
WO2018095181A1 (zh) 数据传输方法及装置
EP2763365B1 (en) Method and device for sending and receiving data
CN102088320B (zh) 超音波系统及其通讯方法
CN101710857A (zh) 串行通信波特率自适应方法及其装置
WO2017050234A1 (zh) 数据传输方法及数据处理设备
CN107241162B (zh) 一种数据传输方法及装置
CN108075579B (zh) 一种可智能配对的无线供电系统及供电方法
WO2018095179A1 (zh) 一种数据传输方法及终端
CN107359963B (zh) 一种数据传输方法及终端
CN107346997A (zh) 一种数据传输方法以及终端
CN107404319B (zh) 数据接收方法和装置
US10038459B2 (en) Network control device
CN107359962B (zh) 数据接收方法和装置
CN107359964B (zh) 数据发送方法和装置
CN107346998B (zh) 一种数据帧尾检测方法及数据传输装置
CN107346999B (zh) 一种数据帧尾检测方法及数据传输装置
CN107404366B (zh) 数据发送方法和装置
CN107465498B (zh) 传输参数获取方法及终端
WO2018095180A1 (zh) 数据发送方法、数据接收方法和装置
CN109347605A (zh) 一种编码方法、解码方法及装置、计算机可读存储介质
WO2018095183A1 (zh) 传输参数获取方法及终端
CN114243954A (zh) 基于波形特征的无线设备匹配通讯系统及方法与电子设备
CN107370565B (zh) 一种传输参数自适应的数据传输方法和装置
CN119135492B (zh) Ask信号的解调方法、装置、无线充电发射器及存储介质
CN114172620B (zh) 一种用于igbt驱动的通信方法、装置及设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17874983

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17874983

Country of ref document: EP

Kind code of ref document: A1