CN113568850A - Data transmission method and device, electronic equipment and storage medium - Google Patents
Data transmission method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN113568850A CN113568850A CN202010354572.5A CN202010354572A CN113568850A CN 113568850 A CN113568850 A CN 113568850A CN 202010354572 A CN202010354572 A CN 202010354572A CN 113568850 A CN113568850 A CN 113568850A
- Authority
- CN
- China
- Prior art keywords
- frame
- gpio
- level
- gpio level
- preset
- 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
Links
- 230000005540 biological transmission Effects 0.000 title claims abstract description 65
- 238000000034 method Methods 0.000 title claims abstract description 54
- 238000006243 chemical reaction Methods 0.000 claims abstract description 33
- 230000006854 communication Effects 0.000 claims description 20
- 238000004590 computer program Methods 0.000 claims description 9
- 238000005070 sampling Methods 0.000 abstract description 5
- 101001084254 Homo sapiens Peptidyl-tRNA hydrolase 2, mitochondrial Proteins 0.000 description 10
- 102100030867 Peptidyl-tRNA hydrolase 2, mitochondrial Human genes 0.000 description 10
- 238000004891 communication Methods 0.000 description 10
- 238000010586 diagram Methods 0.000 description 7
- 230000008569 process Effects 0.000 description 5
- 238000012545 processing Methods 0.000 description 5
- 230000001960 triggered effect Effects 0.000 description 5
- 230000009471 action Effects 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000000630 rising effect Effects 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 230000005856 abnormality Effects 0.000 description 1
- 230000008094 contradictory effect Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/14—Handling requests for interconnection or transfer
- G06F13/20—Handling requests for interconnection or transfer for access to input/output bus
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Communication Control (AREA)
Abstract
The embodiment of the application provides a data transmission method, a data transmission device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a digital code of data to be transmitted; determining general input/output port GPIO level frames corresponding to digital codes of data to be transmitted according to preset frame time and a preset coding level conversion rule to obtain target GPIO level frames, wherein the preset frame time is the duration of a single frame GPIO level frame, and the preset coding level conversion rule is a corresponding rule of the digital codes and the GPIO level frames; and sequentially sending each target GPIO level frame to a receiving end. According to the data transmission method, the data transmission is carried out in the mode of the GPIO level frames, the duration of each single frame GPIO level frame is the preset frame time, and each GPIO level frame can be effectively distinguished through the duration, so that each data can be effectively distinguished, the sampling difficulty is reduced, and the point-to-point single-wire GPIO data transmission is effectively realized.
Description
Technical Field
The present application relates to the field of communications technologies, and in particular, to a data transmission method and apparatus, an electronic device, and a storage medium.
Background
In the point-to-point single WIRE communication protocol, UART (Universal Asynchronous Receiver/Transmitter), 1-WIRE protocol, etc. are most commonly used. In these protocols, the receiving end needs to constantly detect the received signal at a sampling frequency far exceeding the baud rate of the transmitting end, which imposes a very large load on the CPU. Moreover, the conventional UART or 1-WIRE protocol is difficult to implement on a GPIO (General Purpose Input/Output port) through software, and the main reasons are 2 points, where 1 is inaccurate BIT edge sampling, and 2 is difficult to sample multiple continuous 0 or continuous 1 data, and therefore a single-WIRE GPIO data transmission method capable of being effectively applied to point-to-point is urgently needed.
Disclosure of Invention
An object of the embodiments of the present application is to provide a data transmission method, an apparatus, an electronic device, and a storage medium, so as to provide an effective single-wire GPIO data transmission method applied to point-to-point. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a data transmission method, which is applied to a sending end, and the method includes:
acquiring a digital code of data to be transmitted;
determining each general input/output port GPIO level frame corresponding to the digital code of the data to be transmitted according to preset frame time and a preset coding level conversion rule to obtain each target GPIO level frame, wherein the preset frame time is the duration of a single frame GPIO level frame, and the preset coding level conversion rule is a corresponding rule of the digital code and the GPIO level frame;
and sequentially sending each target GPIO level frame to a receiving end.
Optionally, the GPIO level frames indicate different digital codes by different levels of interruption times and/or levels of high and low.
Optionally, the digital code is a binary code, the binary code includes 0 and 1, a GPIO level frame corresponding to 0 includes one interrupt, and a GPIO level frame corresponding to 1 includes three interrupts.
Optionally, the GPIO level frames corresponding to the start signal and the end signal each include 5 interrupts, and the start level of the start signal is different from the start level of the end signal.
Optionally, in the transmission phase, the first digital bit is represented by two frames of GPIO level frames.
Optionally, the sending end is a master device or a slave device, where the communication process is initiated by the master device.
In a second aspect, an embodiment of the present application provides a data transmission method, which is applied to a receiving end, and the method includes:
receiving each GPIO level frame to be decoded sent by a sending end;
and sequentially decoding each GPIO level frame to be decoded into a digital code according to a preset frame time and a preset coding level conversion rule, wherein the preset frame time is the duration of a single frame of GPIO level frame, and the preset coding level conversion rule is a corresponding rule of the digital code and the GPIO level frame.
Optionally, the GPIO level frames indicate different digital codes by different levels of interruption times and/or levels of high and low.
Optionally, the digital code is a binary code, the binary code includes 0 and 1, a GPIO level frame corresponding to 0 includes one interrupt, and a GPIO level frame corresponding to 1 includes three interrupts.
Optionally, the GPIO level frames corresponding to the start signal and the end signal each include 5 interrupts, and the start level of the start signal is different from the start level of the end signal.
Optionally, in the transmission phase, the first digital bit is represented by two frames of GPIO level frames.
Optionally, the receiving end is a master device or a slave device, wherein a communication process is initiated by the master device.
In a third aspect, an embodiment of the present application provides a data transmission apparatus, which is applied to a sending end, and the apparatus includes:
the digital code acquisition module is used for acquiring a digital code of data to be transmitted;
the GPIO level frame determining module is used for determining each general purpose input/output port GPIO level frame corresponding to the digital code of the data to be transmitted according to preset frame time and a preset coding level conversion rule to obtain each target GPIO level frame, wherein the preset frame time is the duration of a single frame GPIO level frame, and the preset coding level conversion rule is a corresponding rule of the digital code and the GPIO level frame;
and the GPIO level frame sending module is used for sending each target GPIO level frame to a receiving end in sequence.
Optionally, the GPIO level frames indicate different digital codes by different levels of interruption times and/or levels of high and low.
Optionally, the digital code is a binary code, the binary code includes 0 and 1, a GPIO level frame corresponding to 0 includes one interrupt, and a GPIO level frame corresponding to 1 includes three interrupts.
Optionally, the GPIO level frames corresponding to the start signal and the end signal each include 5 interrupts, and the start level of the start signal is different from the start level of the end signal.
Optionally, in the transmission phase, the first digital bit is represented by two frames of GPIO level frames.
Optionally, the sending end is a master device or a slave device, where the communication process is initiated by the master device.
In a fourth aspect, an embodiment of the present application provides a data transmission apparatus, which is applied to a receiving end, where the apparatus includes:
the GPIO level frame receiving module is used for receiving each GPIO level frame to be decoded sent by the sending end;
and the digital coding conversion module is used for sequentially decoding each GPIO level frame to be decoded into a digital code according to a preset frame time and a preset coding level conversion rule, wherein the preset frame time is the duration of a single frame of the GPIO level frame, and the preset coding level conversion rule is a corresponding rule of the digital code and the GPIO level frame.
Optionally, the GPIO level frames indicate different digital codes by different levels of interruption times and/or levels of high and low.
Optionally, the digital code is a binary code, the binary code includes 0 and 1, a GPIO level frame corresponding to 0 includes one interrupt, and a GPIO level frame corresponding to 1 includes three interrupts.
Optionally, the GPIO level frames corresponding to the start signal and the end signal each include 5 interrupts, and the start level of the start signal is different from the start level of the end signal.
Optionally, in the transmission phase, the first digital bit is represented by two frames of GPIO level frames.
Optionally, the receiving end is a master device or a slave device, wherein a communication process is initiated by the master device.
In a fifth aspect, an embodiment of the present application provides an electronic device, including a memory and at least two processors, where the at least two processors are connected through a GPIO;
the memory is used for storing a computer program;
the processor is configured to implement any one of the above data transmission methods when executing the program stored in the memory.
In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and the computer program, when executed by a processor, implements any of the data transmission methods described above.
The data transmission method, the data transmission device, the electronic equipment and the storage medium provided by the embodiment of the application acquire the digital code of the data to be transmitted; determining general input/output port GPIO level frames corresponding to digital codes of data to be transmitted according to preset frame time and a preset coding level conversion rule to obtain target GPIO level frames, wherein the preset frame time is the duration of a single frame GPIO level frame, and the preset coding level conversion rule is a corresponding rule of the digital codes and the GPIO level frames; and sequentially sending each target GPIO level frame to a receiving end. The data transmission mode based on the GPIO level frame is characterized in that the data transmission mode is carried out in the form of the GPIO level frame, the duration of each single-frame GPIO level frame is preset frame time, each GPIO level frame can be effectively distinguished according to the duration, even if a plurality of continuous 0 or 1 frames are sent, effective distinguishing can be carried out according to the duration, the sampling difficulty is reduced, and point-to-point single-wire GPIO data transmission is effectively achieved. Of course, not all advantages described above need to be achieved at the same time in the practice of any one product or method of the present application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic diagram of a data transmission method applied to a sending end according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an application scenario according to an embodiment of the present application;
fig. 3 is a schematic diagram of levels in a data transmission method according to an embodiment of the present application;
fig. 4 is a schematic diagram of a data transmission method applied to a receiving end according to an embodiment of the present application;
fig. 5 is a schematic diagram of a data transmission apparatus applied to a transmitting end according to an embodiment of the present application;
fig. 6 is a schematic diagram of a data transmission apparatus applied to a receiving end according to an embodiment of the present application;
fig. 7 is a schematic diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
First, terms of art in the embodiments of the present application are explained:
GPIO: the General Purpose Input/Output (i/o) port is a controllable pin of the embedded device, and is connected with the external device, thereby realizing the functions of external communication, control and data acquisition.
Interrupting: when some accident occurs and the host computer is needed to intervene in the running process of the computer, the machine can automatically stop the running program and transfer to the program for processing the new condition, and after the processing is finished, the original suspended program is returned to continue running. The interruption of the GPIO level frame of the embodiment of the application is triggered by the rising edge and the falling edge of the level.
Embedding: a device for controlling, monitoring or assisting in the operation of machines and equipment is a special purpose computer system with strict requirements on functions, reliability, cost, volume, power consumption, etc., and is a complex of software and hardware.
Baud rate: the number of symbols transmitted per second is an index for measuring the data transmission rate, and is expressed by the number of times the carrier modulation state changes per unit time.
A CPU: the Central Processing Unit (cpu) is an ultra-large scale integrated circuit, and is an arithmetic Core (Core) and a Control Core (Control Unit) of a computer. Its functions are mainly to interpret computer instructions and to process data in computer software.
GPIO is widely applied to the existing CPU chip, in many communication modes, one device can be divided into a plurality of sub-boards, in many cases, signal interfaces between the sub-boards are fewer, but communication needs to be realized between the modules. In the prior art, network communication is adopted among modules, but the network communication cannot be used when an IP address and an MAC address are not configured among daughter boards.
In view of this, an embodiment of the present application provides a data transmission method, which is applied to a sending end, and referring to fig. 1, the method includes:
s101, digital codes of data to be transmitted are obtained.
The data transmission method applied to the sending end in the embodiment of the application can be realized through electronic equipment, specifically, can be realized through a CPU of the electronic equipment, the receiving end and the sending end can be different CPUs, for example, referring to FIG. 2, only one GPIO signal connecting line is needed for data transmission between two pieces of equipment. When interface signals between two devices are few and network communication is not established, the embodiment of the application can meet the requirement of simple communication between the two devices. Because the most common GPIO interface in the chip, and GPIO has low-power consumption, the simple advantage of wiring, and the suitability is strong, so adopt GPIO to communicate in this application embodiment.
The data to be transmitted may be transmitted in the form of digital codes, and the data to be transmitted is converted into digital codes, for example, binary codes or decimal codes, to obtain the digital codes of the data to be transmitted.
And S102, determining each GPIO level frame corresponding to the digital code of the data to be transmitted according to preset frame time and a preset coding level conversion rule to obtain each target GPIO level frame, wherein the preset frame time is the duration of a single frame GPIO level frame, and the preset coding level conversion rule is a corresponding rule of the digital code and the GPIO level frame.
In the embodiment of the application, data transmission is carried out in the form of GPIO level frames. The GPIO level frame refers to GPIO level in unit time length, the unit time length is preset frame time, and the GPIO level frame can be set in a user-defined mode according to actual conditions. The preset coding level conversion rule is a corresponding rule of digital coding and GPIO level frames. Different digital codes correspond to different GPIO level frames. The data transmission in the embodiment of the present application can be divided into three stages, including: start, Trans, and Stop. Start denotes the Start of data transmission, Trans denotes the specific data transmitted, i.e. the data to be transmitted, and Stop denotes the Stop of data transmission. And sequentially generating each GPIO level frame corresponding to the digital code of the data to be transmitted, namely each target GPIO level frame by taking the preset frame time as the duration of each frame of the GPIO level frame according to a preset coding level conversion rule.
In one possible implementation, the GPIO level frames represent different digital codes by different levels of interruption times and/or levels of high and low.
In the embodiment of the application, the interruption of the level is triggered by the rising edge and the falling edge of the level, when the level is converted from the low level to the high level, the interruption of the level is triggered once, and similarly, when the level is converted from the high level to the low level, the interruption of the level is triggered once. The number of level interruptions and/or the high or low of the level (i.e., high or low) within a unit time duration (i.e., within one frame of GPIO level) may be used to distinguish between different digital codes, Start, Stop, etc.
In the embodiment of the application, the number of interruptions is used to represent different digital codes, so that the selection of the counting time point is particularly important, and in order to avoid confusion of counting between different stages and between BYTEs, after the transmission of each stage and each BIT is finished, the frame time (preset frame time) is introduced, so that the GPIO level frames are distinguished. The inter-period of the baud rate successive interruptions is negligible compared to the frame time.
And S103, sequentially sending each target GPIO level frame to a receiving end.
And the sending end sends each target GPIO level frame to the receiving end in sequence.
In the embodiment of the application, a data transmission mode based on GPIO level frames is provided, data transmission is performed in the form of GPIO level frames, the duration of each single-frame GPIO level frame is preset frame time, each GPIO level frame can be effectively distinguished according to the duration, even if multiple continuous 0 or 1 frames are sent, effective distinguishing can be performed according to the duration, the sampling difficulty is reduced, and point-to-point single-wire GPIO data transmission is effectively achieved.
For binary coding, for example, the number of interrupts of 0(BIT0) and 1(BIT1) in the Trans phase is adjustable and can be set by self according to practical situations. In one possible embodiment, the digital code is a binary code, which, referring to fig. 3, includes 0 and 1, where the GPIO level frame for 0 includes one interrupt and the GPIO level frame for 1 includes three interrupts.
The GPIO level frames are distinguished by taking frame time as an interval, and are combined with counting characteristics of different stages to calculate the interruption times, and finally, each target GPIO level frame corresponding to data to be sent is calculated. Intermediate the Start and Stop phases is the Trans phase. In the Trans phase, a BYTE consists of eight BITs, each of which may be either 0 or 1. To distinguish BIT0 from BIT1, BIT0 may be designed as 1 interrupt and BIT1 as 3 consecutive interrupts.
In one possible embodiment, referring to fig. 3, the GPIO level frames corresponding to the start signal and the end signal each include 5 interrupts, and the start level of the start signal is different from the start level of the end signal.
The Start signal indicates Start, i.e., Start of transmission; the Stop signal indicates Stop, i.e. the end of the transmission. In the Start phase, there are 5 consecutive interrupts, and in the Stop phase, there are 5 consecutive interrupts. Although both the Start and Stop phases are 5 interrupts in succession, the Start and Stop phases may be distinguished by different Start levels. For example, the Start phase Start level is high and the 5 flipped levels remain low, while the Stop phase Start level is low and the 5 flipped levels remain high. Of course, the starting levels of the Start phase and the Stop phase can be switched, and can be set according to practical situations.
In the embodiment of the present application, the Start signal and the end signal have different Start levels, so that the Start phase and the Stop phase can be effectively distinguished.
In one possible implementation, the first digital bit is represented by two frames of GPIO level frames during the transmit phase.
In the Trans phase, for the counting of the first digital BIT, only one frame of GPIO level is used, and it is not possible to effectively distinguish BIT0 from BIT1, so the Trans phase is divided into two parts: the first digital bit and other bits.
For the first digital bit, two frames of GPIO level frames are selected, namely, the frame time after the Start is finished and the frame time after one digital bit is finished are added. For example, for the case that a single frame BIT0 is 1 interrupt and a single frame BIT1 is 3 continuous interrupts, if the first digital BIT is BIT0, the GPIO interrupt count is 2 after the two frames are ended; if the first digital BIT is BIT1, the GPIO interrupt count is 4 after the two frames are over.
Counting other bits except the first digital bit in the Trans stage only needs one frame of GPIO level frame, and the counting end time is the frame time after the bit ends. If a BIT except the first digital BIT is BIT0, after the GPIO level frame of the BIT is finished, the GPIO interruption count is 1; if a BIT other than the first digital BIT is BIT1, the GPIO interrupt count is 3 after the GPIO level frame for that BIT is over.
In a possible implementation, the sending end is a master device or a slave device, wherein the communication process is initiated by the master device.
In the single GPIO mode, in order to prevent both GPIO connections from preempting GPIO transmission, one is defined as HOST (master device) and the other is defined as SLAVE (SLAVE device), and all communication procedures must be initiated by HOST, that is, data transmitted by SLAVE is initiated after HOST notification, so that it is possible to avoid the situation that both ends transmit data simultaneously, which causes an abnormality.
An embodiment of the present application further provides a data transmission method, applied to a receiving end, referring to fig. 4, where the method includes:
s201, receiving each GPIO level frame to be decoded sent by a sending end.
And S202, sequentially decoding each GPIO level frame to be decoded into a digital code according to a preset frame time and a preset coding level conversion rule, wherein the preset frame time is the duration of a single frame of the GPIO level frame, and the preset coding level conversion rule is a corresponding rule of the digital code and the GPIO level frame.
In one possible implementation, the GPIO level frames represent different digital codes by different levels of interruption times and/or levels of high and low.
In one possible embodiment, the digital code is a binary code, the binary code includes 0 and 1, the GPIO level frame corresponding to 0 includes one interrupt, and the GPIO level frame corresponding to 1 includes three interrupts.
In one possible implementation, the GPIO level frames corresponding to the start signal and the end signal each include 5 interrupts, and the start level of the start signal is different from the start level of the end signal.
In one possible implementation, the first digital bit is represented by two frames of GPIO level frames during the transmit phase.
In a possible implementation, the receiving end is a master device or a slave device, wherein the communication process is initiated by the master device.
The GPIO interrupt mode is set to rising edge and falling edge triggered. The counting is distinguished by the frame time as an interval, and the interruption number comparison is carried out by combining the counting characteristics of different stages, and finally the transmission data is calculated.
In the Start stage and the Stop stage, the number of the interrupts of the Start stage and the Stop stage is different from that of the transit stage, the level state of the Start stage and the Stop stage is also different after the transmission is finished, the level is low after the Start transmission is finished, and the level is high after the Stop transmission is finished, so that the Start stage and the Stop stage are very easy to discriminate in time sequence.
In the Trans phase, for the first BIT count, it is impossible to determine whether BIT0 or BIT1 is a frame time, so the count is divided into two parts: the count of the first bit and the other bits. For the first BIT, two frame times are selected, namely, the frame time after the Start is finished and the frame time after the first BIT is finished, if the first BIT is BIT0, the GPIO interruption count is 2 after the two frames are finished; if the first BIT is BIT1, the GPIO interrupt count is 4 after the two frames are over.
For counting the other bits except the first bit in the Trans phase, only one frame time is needed, and the frame time is the frame time after the end of the bit. If the first BIT is BIT0, after the frame is finished, the GPIO interruption count is 1; if the first BIT is BIT1, the GPIO interrupt count is 3 after the frame is over.
Although the Stop phase is defined as 5 interrupts, the Stop bit is left with only 4 interrupts in the actual judgment since the count per bit of the Trans phase is the frame time after the bit.
In the embodiment of the application, a data transmission mode based on the GPIO level frame is provided, and point-to-point single-wire GPIO data transmission is effectively realized.
An embodiment of the present application further provides a data transmission apparatus, refer to fig. 5, applied to a sending end, where the apparatus includes:
a digital code obtaining module 11, configured to obtain a digital code of data to be sent;
a GPIO level frame determining module 12, configured to determine, according to a preset frame time and a preset coding level conversion rule, each GPIO level frame of the general input/output ports corresponding to the digital coding of the data to be transmitted, to obtain each target GPIO level frame, where the preset frame time is a duration of a single frame GPIO level frame, and the preset coding level conversion rule is a correspondence rule between the digital coding and the GPIO level frame;
and a GPIO level frame transmitting module 13, configured to sequentially transmit each target GPIO level frame to a receiving end.
Optionally, the GPIO level frames indicate different digital codes by different levels of interruption times and/or levels.
Optionally, the digital code is a binary code, the binary code includes 0 and 1, a GPIO level frame corresponding to 0 includes one interrupt, and a GPIO level frame corresponding to 1 includes three interrupts.
Optionally, the GPIO level frames corresponding to the start signal and the end signal each include 5 interrupts, and the start level of the start signal is different from the start level of the end signal.
Optionally, in the transmission phase, the first digital bit is represented by two frames of GPIO level frames.
Optionally, the sending end is a master device or a slave device, wherein the communication process is initiated by the master device.
An embodiment of the present application further provides a data transmission apparatus, see fig. 6, which is applied to a receiving end, where the apparatus includes:
a GPIO level frame receiving module 21, configured to receive each GPIO level frame to be decoded sent by the sending end;
and the digital coding conversion module 22 is configured to sequentially decode each GPIO level frame to be decoded into a digital code according to a preset frame time and a preset coding level conversion rule, where the preset frame time is a duration of a single frame of GPIO level frame, and the preset coding level conversion rule is a corresponding rule between the digital code and the GPIO level frame.
Optionally, the GPIO level frames indicate different digital codes by different levels of interruption times and/or levels.
Optionally, the digital code is a binary code, the binary code includes 0 and 1, a GPIO level frame corresponding to 0 includes one interrupt, and a GPIO level frame corresponding to 1 includes three interrupts.
Optionally, the GPIO level frames corresponding to the start signal and the end signal each include 5 interrupts, and the start level of the start signal is different from the start level of the end signal.
Optionally, in the transmission phase, the first digital bit is represented by two frames of GPIO level frames.
Optionally, the receiving end is a master device or a slave device, wherein the communication process is initiated by the master device.
The embodiment of the present application further provides an electronic device, see fig. 7, including a memory 32 and at least two processors 31, where the at least two processors 31 are connected through a GPIO;
the memory 32 is used for storing computer programs;
the processor 31 is configured to implement any one of the above data transmission methods when executing the program stored in the memory 32.
The Memory may include a RAM (Random Access Memory) or an NVM (Non-Volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also a DSP (Digital Signal Processing), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
An embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements any of the data transmission methods described above.
It should be noted that, in this document, the technical features in the various alternatives can be combined to form the scheme as long as the technical features are not contradictory, and the scheme is within the scope of the disclosure of the present application. Relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the embodiments of the apparatus, the electronic device, and the storage medium, since they are substantially similar to the method embodiments, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiments.
The above description is only for the preferred embodiment of the present application, and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims (16)
1. A data transmission method, applied to a transmitting end, the method comprising:
acquiring a digital code of data to be transmitted;
determining each general input/output port GPIO level frame corresponding to the digital code of the data to be transmitted according to preset frame time and a preset coding level conversion rule to obtain each target GPIO level frame, wherein the preset frame time is the duration of a single frame GPIO level frame, and the preset coding level conversion rule is a corresponding rule of the digital code and the GPIO level frame;
and sequentially sending each target GPIO level frame to a receiving end.
2. The method of claim 1, wherein the GPIO level frames represent different digital codes by different levels of interruption times and/or levels of high and low.
3. The method of claim 2, wherein the digital code is a binary code, wherein the binary code comprises 0 and 1, wherein a frame of GPIO levels for 0 comprises one interrupt and wherein a frame of GPIO levels for 1 comprises three interrupts.
4. The method of claim 1, wherein each corresponding GPIO level frame of a start signal and an end signal comprises 5 interrupts, and wherein the start signal and the end signal have different starting levels.
5. The method of claim 1, wherein during the transmit phase, the first digital bit is represented by a two frame GPIO level frame.
6. The method of claim 1, wherein the sender is a master device or a slave device, and wherein the communication process is initiated by the master device.
7. A data transmission method, applied to a receiving end, the method comprising:
receiving each GPIO level frame to be decoded sent by a sending end;
and sequentially decoding each GPIO level frame to be decoded into a digital code according to a preset frame time and a preset coding level conversion rule, wherein the preset frame time is the duration of a single frame of GPIO level frame, and the preset coding level conversion rule is a corresponding rule of the digital code and the GPIO level frame.
8. The method of claim 7, wherein the GPIO level frames represent different digital codes by different levels of interruption times and/or levels of high and low.
9. The method of claim 8, wherein the digital code is a binary code, wherein the binary code comprises 0 and 1, wherein a frame of GPIO levels for 0 comprises one interrupt and wherein a frame of GPIO levels for 1 comprises three interrupts.
10. The method of claim 7, wherein each corresponding GPIO level frame of a start signal and an end signal comprises 5 interrupts, and wherein the start signal and the end signal have different starting levels.
11. The method of claim 7, wherein during the transmit phase, the first digital bit is represented by a two frame GPIO level frame.
12. The method of claim 7, wherein the receiving end is a master device or a slave device, and wherein the communication process is initiated by the master device.
13. A data transmission apparatus, applied to a transmitting end, the apparatus comprising:
the digital code acquisition module is used for acquiring a digital code of data to be transmitted;
the GPIO level frame determining module is used for determining each general purpose input/output port GPIO level frame corresponding to the digital code of the data to be transmitted according to preset frame time and a preset coding level conversion rule to obtain each target GPIO level frame, wherein the preset frame time is the duration of a single frame GPIO level frame, and the preset coding level conversion rule is a corresponding rule of the digital code and the GPIO level frame;
and the GPIO level frame sending module is used for sending each target GPIO level frame to a receiving end in sequence.
14. A data transmission apparatus, applied to a receiving end, the apparatus comprising:
the GPIO level frame receiving module is used for receiving each GPIO level frame to be decoded sent by the sending end;
and the digital coding conversion module is used for sequentially decoding each GPIO level frame to be decoded into a digital code according to a preset frame time and a preset coding level conversion rule, wherein the preset frame time is the duration of a single frame of the GPIO level frame, and the preset coding level conversion rule is a corresponding rule of the digital code and the GPIO level frame.
15. The electronic equipment is characterized by comprising a memory and at least two processors, wherein the at least two processors are connected through GPIO;
the memory is used for storing a computer program;
the processor is configured to implement the data transmission method according to any one of claims 1 to 12 when executing the program stored in the memory.
16. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the data transmission method according to any one of claims 1 to 12.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010354572.5A CN113568850A (en) | 2020-04-29 | 2020-04-29 | Data transmission method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010354572.5A CN113568850A (en) | 2020-04-29 | 2020-04-29 | Data transmission method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113568850A true CN113568850A (en) | 2021-10-29 |
Family
ID=78158471
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010354572.5A Pending CN113568850A (en) | 2020-04-29 | 2020-04-29 | Data transmission method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113568850A (en) |
Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1665317A (en) * | 2004-03-03 | 2005-09-07 | 华为技术有限公司 | Method of data transmission in enhanced GPRS system |
US20090058458A1 (en) * | 2007-09-05 | 2009-03-05 | Hynix Semiconductor, Inc. | Digital-to-analog converting circuit and apparatus for on-die termination using the same |
US20100296589A1 (en) * | 2009-05-19 | 2010-11-25 | Takeshi Maeda | Information processing apparatus, encoding method and frame synchronization method |
US20130336420A1 (en) * | 2012-06-19 | 2013-12-19 | Richtek Technology Corporation | Method of Transmission through Single Wire |
WO2014008893A1 (en) * | 2012-07-10 | 2014-01-16 | Trinamic Motion Control Gmbh & Co. Kg | Method for serial data transmission |
CN103812557A (en) * | 2013-07-31 | 2014-05-21 | 深圳光启创新技术有限公司 | Visible light signal encoding and decoding method, device and system |
US20150301979A1 (en) * | 2014-04-21 | 2015-10-22 | Qualcomm Incorporated | Hybrid virtual gpio |
CN107404319A (en) * | 2016-11-24 | 2017-11-28 | 天地融科技股份有限公司 | Data receiver method and device |
CN108734944A (en) * | 2017-04-18 | 2018-11-02 | 陕西万方汽车零部件有限公司 | A kind of wireless remote control coding/decoding method and its device |
CN110324115A (en) * | 2019-06-10 | 2019-10-11 | 普联技术有限公司 | A kind of data transmission method, device, storage medium and terminal device |
CN110908940A (en) * | 2019-10-14 | 2020-03-24 | 百富计算机技术(深圳)有限公司 | Method for adjusting serial port communication parameters and terminal equipment |
-
2020
- 2020-04-29 CN CN202010354572.5A patent/CN113568850A/en active Pending
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1665317A (en) * | 2004-03-03 | 2005-09-07 | 华为技术有限公司 | Method of data transmission in enhanced GPRS system |
US20090058458A1 (en) * | 2007-09-05 | 2009-03-05 | Hynix Semiconductor, Inc. | Digital-to-analog converting circuit and apparatus for on-die termination using the same |
US20100296589A1 (en) * | 2009-05-19 | 2010-11-25 | Takeshi Maeda | Information processing apparatus, encoding method and frame synchronization method |
US20130336420A1 (en) * | 2012-06-19 | 2013-12-19 | Richtek Technology Corporation | Method of Transmission through Single Wire |
WO2014008893A1 (en) * | 2012-07-10 | 2014-01-16 | Trinamic Motion Control Gmbh & Co. Kg | Method for serial data transmission |
CN103812557A (en) * | 2013-07-31 | 2014-05-21 | 深圳光启创新技术有限公司 | Visible light signal encoding and decoding method, device and system |
US20150301979A1 (en) * | 2014-04-21 | 2015-10-22 | Qualcomm Incorporated | Hybrid virtual gpio |
CN107404319A (en) * | 2016-11-24 | 2017-11-28 | 天地融科技股份有限公司 | Data receiver method and device |
CN108734944A (en) * | 2017-04-18 | 2018-11-02 | 陕西万方汽车零部件有限公司 | A kind of wireless remote control coding/decoding method and its device |
CN110324115A (en) * | 2019-06-10 | 2019-10-11 | 普联技术有限公司 | A kind of data transmission method, device, storage medium and terminal device |
CN110908940A (en) * | 2019-10-14 | 2020-03-24 | 百富计算机技术(深圳)有限公司 | Method for adjusting serial port communication parameters and terminal equipment |
Non-Patent Citations (2)
Title |
---|
朱思荣;周万里;毕春元;赵晓华;高广恒;刘仲汇;: "C8051F120单片机串口扩展与通讯设计", 山东科学, no. 01, 15 February 2013 (2013-02-15), pages 73 - 77 * |
耿立中;王鹏;马骋;贾惠波;: "RS485高速数据传输协议的设计与实现", 清华大学学报(自然科学版)网络.预览, no. 08, 20 June 2008 (2008-06-20), pages 84 - 87 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7565583B2 (en) | Multilink receiver for multiple cordless applications | |
US9519603B2 (en) | Method and apparatus to enable multiple masters to operate in a single master bus architecture | |
EP3268868B1 (en) | Farewell reset and restart method for coexistence of legacy and next generation devices over a shared multi-mode bus | |
US8934528B2 (en) | Transition interval coding for serial communication | |
JP2017527231A (en) | Power saving mode for USB power carrier sourcing device | |
KR20160065206A (en) | Camera control interface slave device to slave device communication | |
CN110908940B (en) | Method for adjusting serial port communication parameters and terminal equipment | |
US10139875B2 (en) | Farewell reset and restart method for coexistence of legacy and next generation devices over a shared multi-mode bus | |
CN111177060B (en) | Serial port data sending method, serial port data receiving method, corresponding devices and terminal equipment | |
JP6398329B2 (en) | Control device, control method and program | |
CN116185936A (en) | SPI communication data receiving and transmitting abnormity detection control system and detection method | |
CN106533976B (en) | data packet processing method and device | |
US8837628B2 (en) | Method of transmission through single wire | |
CN113568850A (en) | Data transmission method and device, electronic equipment and storage medium | |
US6820145B2 (en) | Circuit arrangement and method for improving data management in a data communications circuit | |
CN114443537B (en) | PCIE signal transmitting end parameter configuration method, device, equipment and medium | |
CN116545582A (en) | Data transmission method based on serial transceiver, medium and equipment | |
CN113890781B (en) | Communication method, system and storage medium based on timer extension | |
CN115421801A (en) | Method and system for configuring peripheral parameters through serial port | |
EP0669738A2 (en) | System and method for automatically detecting speed, parity, and character length | |
US9443568B2 (en) | Electronic device and data transmission method thereof | |
CN108509365B (en) | DBI data transmission method and system | |
CN111490919A (en) | Master-slave machine system, equipment terminal and communication verification method thereof | |
TWI786890B (en) | Rs-485 circuit and communication system | |
CN110505038B (en) | Data transmission method and related 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 |