CN111800488B - Data transmission method and system based on UDP (user Datagram protocol) and IPV6 (Internet protocol video protocol) - Google Patents
Data transmission method and system based on UDP (user Datagram protocol) and IPV6 (Internet protocol video protocol) Download PDFInfo
- Publication number
- CN111800488B CN111800488B CN202010576633.2A CN202010576633A CN111800488B CN 111800488 B CN111800488 B CN 111800488B CN 202010576633 A CN202010576633 A CN 202010576633A CN 111800488 B CN111800488 B CN 111800488B
- Authority
- CN
- China
- Prior art keywords
- computer
- packet
- target board
- data
- board card
- 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.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/38—Information transfer, e.g. on bus
- G06F13/382—Information transfer, e.g. on bus using universal interface adapter
- G06F13/385—Information transfer, e.g. on bus using universal interface adapter for adaptation of a particular data processing system to different peripheral devices
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
- G06F8/654—Updates using techniques specially adapted for alterable solid state memories, e.g. for EEPROM or flash memories
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/34—Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
- H04L69/164—Adaptation or special uses of UDP protocol
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2213/00—Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F2213/0042—Universal serial bus [USB]
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Software Systems (AREA)
- Computer And Data Communications (AREA)
Abstract
The application discloses a data transmission method based on UDP and IPV6 protocols. Step S10: implanting UDP and IPV6 protocols; and setting a UDP transparent transmission unit. Step S20: the computer runs the programming tool software and is connected to a target board card of the embedded system. Step S30: and a target board card of the embedded system runs a downloading program to become a data link server. Step S40: the computer is used as a client of the data link and is connected with the target board card through a handshake mechanism of the UDP transparent transmission unit; the transmission layer between the computer and the target board card adopts a UDP protocol, and the network layer adopts an IPV6 protocol. Step S50: and the computer sends a downloading command and/or data to the target board card, and the target board card responds to the computer, receives the firmware file transmitted by the computer according to the downloading command and writes the firmware file into the nonvolatile memory. The method realizes the rapid, sequential and high-reliability data transmission between the computer and the target board card of the embedded system.
Description
Technical Field
The present disclosure relates to a method for programming firmware in an embedded system, and more particularly, to a method for transmitting data between a computer and a target board of the embedded system, where the data includes, for example, a firmware file of the embedded system.
Background
An embedded system (embedded system) is a computer system that contains processors, memory, input and/or output peripherals for performing specialized functions in a larger mechanical and/or electrical system. The memory of the embedded system stores a control program.
In mass production of an embedded system, firmware (firmware) needs to be programmed into a memory such as a NAND Flash (NAND gate Flash), a NOR Flash (NOR gate Flash), an eMMC (embedded multimedia card), or the like as an operating system object code. The firmware is a program solidified in a storage medium and determines the functions and performance of the embedded system. Generally, the firmware cannot be directly read or modified by a user after being written into the embedded system, and if data output is abnormal in the programming process, a product cannot be normally started, so that the programmed firmware is safe and reliable.
The existing firmware programming modes capable of realizing mass production include a FLASH programmer, an SD card mode, a USB mode and the like. Because the USB programming mode can display the mass production progress in real time and can simultaneously carry out mass production of a plurality of product devices, the existing embedded system generally adopts the USB mode to carry out mass production programming of firmware data.
However, in the conventional firmware programming mode, in order to ensure reliability, verification is performed when data is programmed, which slows down programming speed and affects production line efficiency.
Disclosure of Invention
The technical problem to be solved by the application is to provide a quick and reliable data transmission method, which is used for programming batch firmware of an embedded system, improving the production efficiency of mass production of the embedded system and facilitating the tracking of mass production state of production line workers.
In order to solve the above technical problem, the present application provides a data transmission method based on UDP and IPV6 protocols, including the following steps. Step S10: UDP and IPV6 protocols are implanted into programming tool software of a computer and a downloading program of a target board card of an embedded system; UDP transparent transmission units are arranged between a UDP/IP protocol layer and a download protocol layer of a target board card of a computer and an embedded system; the UDP transparent transmission unit is used for realizing the bidirectional transparent transmission of data between the UDP/IP protocol layer and the download protocol layer. Step S20: the computer runs the programming tool software and is connected to a target board card of the embedded system. Step S30: and a target board card of the embedded system runs a downloading program to become a data link server. Step S40: the computer is used as a client of the data link and is connected with a target board card used as a server of the data link through a handshake mechanism of a UDP transparent transmission unit; the transmission layer between the computer and the target board card adopts a UDP protocol, and the network layer adopts an IPV6 protocol. Step S50: and the computer sends a downloading command and/or data to the target board card, the target board card responds to the computer, receives the firmware file transmitted by the computer according to the downloading command, and writes the firmware file into a nonvolatile memory of the embedded system. The method adopts the UDP protocol and the IPV6 protocol, and realizes the rapid, sequential and high-reliability data transmission between the computer and the target board card of the embedded system.
Further, in step S20, the computer is connected to a USB hub through a USB interface, and the USB hub is further connected to USB interfaces of target boards of one or more embedded systems. This is a typical application scenario for the above-described method.
Further, in step S30, when the target board presses a specific key and powers on, the target board enters a USB download mode, and automatically runs a download program. This is a preferred implementation of how the target board of the embedded system runs the downloading program.
Further, in step S50, the download command includes a request for the target board to receive a firmware file transmitted by the computer; the downloaded data comprises a firmware file which is stored in the computer and is suitable for the target board card. This shows that the present application is particularly suitable for use by a computer in programming firmware to an embedded system.
Furthermore, the programming tool software provides a first downloading protocol layer, the first downloading protocol layer actively pushes downloading commands and/or data to the target board card and blocks the reply and prompt information waiting for the target board card; and the download command and/or data sent by the first download protocol layer are sent to the UDP/IP protocol layer through the UDP transparent transmission unit, then packed into an Ethernet packet and forwarded to the bottom hardware drive layer, and finally sent to the USB hub from the USB interface of the computer. This is the software architecture of the programming tool software in the computer.
Further, a downloading command and/or data sent by the computer are transmitted to a USB interface of the target board card through a USB concentrator, sequentially pass through a bottom hardware driving layer, a UDP/IP protocol layer, a UDP transparent transmission unit and a downloading program transmitted to the target board card; the downloading program provides a second downloading protocol layer, the second downloading protocol layer passively receives the downloading command and/or data sent by the computer, immediately replies a response to the computer after receiving the downloading command and/or data, and executes a task corresponding to the downloading command. This is the software architecture of the downloaded program in the target board of the embedded system.
Furthermore, the first download protocol layer and the second download protocol layer both adopt a fastboot protocol. This is the preferred implementation of both download protocol layers.
Furthermore, the UDP/IP protocol layer of the computer end and the UDP/IP protocol layer of the target board end both adopt light-weight codes and comprise four layers of frameworks from top to bottom, namely an application layer, a transmission layer, a network layer and a data link layer. Therefore, the occupation of the storage space of a computer and an embedded system can be reduced, and the data transmission process is simplified.
Furthermore, a UDP transparent transmission unit at the computer end and a UDP transparent transmission unit at the target card end are added with a UDP transparent transmission field before the original data to realize transparent transmission; the UDP pass-through field comprises a data packet identifier used for indicating the type of the data packet, a packet flag used for indicating whether to continue to transmit and a data packet sequence number. The newly added UDP transparent transmission field records necessary information to realize the bidirectional transparent transmission of data.
Further, in step S40, the handshake mechanism of the UDP transparent transmission unit at the computer end and the UDP transparent transmission unit at the target card end includes the following steps. Step S401: a query phase; the computer issues an empty packet. Step S402: a query phase; after the target board card receives the empty packet sent by the computer, a reply packet is established and sent to the computer; the initial value of the local data packet sequence number of the target board card is contained. Step S403: a query phase; and after the computer receives the reply packet of the target board card, the initial value of the sequence number of the data packet is locally recorded. Step S404: an initial stage; the computer sends out a packet with data, and the carried data at least comprises a downloading protocol number of the computer and the maximum load byte number of the data packet which can be supported by the computer. Step S405: an initial stage; the target board card receives a packet with data sent by the computer, constructs a reply packet and sends the reply packet to the computer; the method comprises the steps of receiving a target board card, wherein the target board card comprises a download protocol number of the target board card and the maximum load byte number of a data packet which can be supported by the target board card. Step S406: an initial stage; after receiving the reply packet of the target board card, the computer compares whether the download protocol numbers are matched or not; if not, the downloading is not carried out; and if so, changing the maximum load byte number of the data packet of the computer into the maximum load byte number of the data packet supported by the target board card, and adding 1 to the sequence number of the locally stored data packet. Step S407: a transmission stage; a computer issues a packet with download commands and/or data; the computer firstly backs up the packet locally, then sends the packet, and adds 1 to the sequence number of the data packet stored locally after the packet is sent. Step S408: a transmission stage; after receiving a packet with a download command and/or data sent by the computer, the target board card builds a reply packet and sends the reply packet to the computer, wherein the value of the sequence number of the data packet is the value obtained by adding 1 to the sequence number of the data packet sent by the computer. Step S409: a transmission stage; the computer receives a reply packet of the target board card and compares the serial numbers of the data packets; if the sequence number of the data packet in the reply packet is equal to the sequence number of the locally stored data packet minus 1, retransmitting the backup packet; if the data packet sequence number in the reply packet is equal to the locally stored data packet sequence number, deleting the backup packet; and repeating the steps S407 to S409, wherein the data packet sequence number of each packet sent by the computer is the data packet sequence number of the last successfully sent packet plus 1. This is a detailed description of the handshake mechanism employed by the UDP transparent unit.
Further, the retransmission processing procedure after the computer finds the packet loss includes the following steps. Step S411: the computer sends the data packet to the target board card. Step S412: and the computer does not receive the reply packet of the target board card after the first timeout. Step S413: and the computer retransmits the last data packet to the target board card, and the sequence number of the data packet is unchanged. Step S414: and the computer does not receive the reply packet of the target board card after the second timeout. Step S415: and the computer retransmits the last data packet to the target board again, and the sequence number of the data packet is unchanged. Step S416: and the target board card receives the data packet sent by the computer, constructs a reply packet and sends the reply packet to the computer. Step S417: the computer receives the reply packet of the target board card and completes the operation of writing data once; the computer adds 1 to the data packet sequence number of the next packet transmission. This is the retransmission mechanism adopted by the UDP transparent transmission unit.
The application also provides a data transmission system based on UDP and IPV6 protocols, which comprises a setting unit, a first connecting unit, a second connecting unit, a handshake unit and a transmission unit. The setting unit is used for implanting UDP and IPV6 protocols in programming tool software of the computer and a downloading program of a target board card of the embedded system, and UDP transparent transmission units are arranged between the UDP/IP protocol layers and downloading protocol layers of the computer and the target board card of the embedded system; the UDP transparent transmission unit is used for realizing the bidirectional transparent transmission of data between the UDP/IP protocol layer and the download protocol layer. The first connecting unit is used for running programming tool software in a computer and connecting the computer to a target board card of the embedded system through a USB interface. And the second connecting unit is used for running a downloading program on a target board card of the embedded system so that the target board card becomes a data link service end. The handshake unit is used for enabling a computer to serve as a client of a data link and connecting a target board card serving as a server of the data link through a handshake mechanism of the UDP transmission unit; the transmission layer between the computer and the target board card adopts a UDP protocol, and the network layer adopts an IPV6 protocol. The transmission unit is used for enabling the computer to send a downloading command and/or data to the target board card, the target board card responds to the computer, receives the firmware file transmitted by the computer according to the downloading command, and writes the firmware file into the nonvolatile memory of the embedded system.
The technical effect that this application obtained is: a UDP transparent transmission unit is added on the light UDP and IPV6 protocols, a data link between a computer and a target board card is established, protocol stack codes are simplified, and the occupied memory amount is small. The application adopts UDP and IPV6 protocols to have better real-time performance, and the client can handshake the server again even if the UDP transparent transmission unit encounters a network drop. The UDP pass-through unit also provides a retransmission mechanism to realize reliable and sequential transmission, and prevents packet transmission delay or packet loss caused by long time for writing into the storage space.
Drawings
Fig. 1 is a flowchart of a data transmission method based on UDP and IPV6 protocols according to the present application.
Fig. 2 is a schematic diagram of the hardware connection between the computer and the target board.
FIG. 3 is a software architecture diagram of the programming tool software in the computer and the downloading program in the target board.
Fig. 4 is a diagram illustrating a data structure of the UDP transparent field.
Fig. 5 is a flowchart of three phases of the handshake process of the UDP transparent mechanism.
Fig. 6 is a flowchart of retransmission of the UDP transparent transmission mechanism in case of packet loss.
Fig. 7 is a schematic structural diagram of a data transmission system based on UDP and IPV6 protocols according to the present application.
The reference numbers in the figures illustrate: 10 is a setting unit; 20 is a first connecting unit; 30 is a second connecting unit; 40 is a handshake unit; and 50 is a transmission unit.
Detailed Description
Referring to fig. 1, the data transmission method based on UDP and IPV6 protocols proposed in the present application includes the following steps.
Step S10: UDP (User Datagram Protocol) and IPV6 (Internet Protocol version 6, version 6 of the Internet Protocol) protocols are embedded in the programming tool software of a computer and a downloading program of a target board card of an embedded system. UDP transparent transmission units are arranged between a UDP/IP protocol layer and a download protocol layer of a target board card of the computer and the embedded system.
The UDP protocol is a core component of the Internet protocol suite (Internet protocol suite), which is a simple datagram-oriented communication protocol located in the transport layer (transport layer) of the OSI model.
The IPV6 Protocol is an Internet Protocol newer than IPV4 (Internet Protocol version 4, version 4 of the Internet Protocol) Protocol, and is located at a network layer (network layer) of the OSI model.
The UDP transparent transmission unit is used for realizing the bidirectional transparent transmission of data between the UDP/IP protocol layer and the download protocol layer.
Step S20: and running programming tool software by the computer, and connecting the computer to a target board card of the embedded system through a USB interface.
Step S30: and a target board card of the embedded system runs a downloading program to become a data link server. For example, when the target board presses a specific key and powers on, the target board enters a USB download mode and automatically runs a download program.
Step S40: the computer is used as a client of the data link and is connected with a target board card used as a server of the data link through a handshake mechanism of the UDP transparent transmission unit. The transmission layer between the computer and the target board card adopts UDP protocol, and the network layer adopts IPV6 protocol. The data transmission of the UDP protocol has the advantage of high speed, and the handshaking, retransmission and continuous transmission mechanisms of the UDP transparent transmission unit can also ensure the transmission sequence and reliable transmission.
Step S50: the computer sends a download command and/or data to the target board, where the download command is, for example, to request the target board to receive a firmware file transmitted by the computer. The downloaded data is, for example, a firmware file stored in the computer and applicable to the target board. The target board card responds to the computer, receives the firmware file transmitted by the computer according to the downloading command, and writes the firmware file into a Flash (Flash memory) or other nonvolatile memories of the embedded system.
Please refer to fig. 2, which is a typical application scenario of the present application. The computer is connected to a USB hub (hub) through a USB interface, and the USB hub is connected to the USB interfaces of one or more target board cards. And after the computer runs the programming tool software and the target board card runs the downloading program, the computer is connected with the target board card which is automatically identified. The firmware file is stored in a computer, the target board card receives the firmware file and carries out programming by operating programming tool software at the computer end, and after the programming progress is completed, the power is cut off, so that the firmware volume production programming work of the target board card of the embedded system is completed.
Referring to fig. 3, from the perspective of the software architecture, the programming tool software in the computer provides a first download protocol layer, which actively pushes a download command and/or data to the target board, and blocks waiting for a reply response, a prompt message, and the like of the target board. And the download command and/or data sent by the first download protocol layer are sent to the UDP/IP protocol layer through the UDP transparent transmission unit, then packed into an Ethernet packet and forwarded to the bottom hardware drive layer, and finally sent to the USB hub from the USB interface of the computer. Preferably, the first download protocol layer adopts a fastboot protocol, which is a mechanism for communicating with a bootloader via a USB connection. Preferably, the UDP/IP protocol layer adopts lightweight codes, and includes four layers of architectures from top to bottom, namely an application layer, a transport layer, a network layer, and a data link layer. And the application layer sets the computer to work in a client mode. The transmission layer adopts UDP protocol, and the network layer adopts IPV6 protocol.
And a downloading program which is transmitted to the target board card by the UDP transmission unit through the bottom hardware driving layer, the UDP/IP protocol layer and the UDP transmission unit in sequence. The downloading program provides a second downloading protocol layer, the second downloading protocol layer passively receives the downloading command and/or data sent by the computer, immediately replies a response to the computer after receiving the downloading command and/or data, and executes a task corresponding to the downloading command. Preferably, the second download protocol layer adopts a fastboot protocol. Preferably, the UDP/IP protocol layer adopts lightweight codes, and includes four layers of frameworks from top to bottom, which are an application layer, a transport layer, a network layer, and a data link layer. And setting the target board card to work in a server side mode in the application layer. The transmission layer adopts UDP protocol, and the network layer adopts IPV6 protocol.
Referring to fig. 4, the UDP transparent unit of the computer and the UDP transparent unit of the target board are both implemented by adding a UDP transparent field before the original data to implement transparent transmission. The UDP transparent field has a total length of 4 bytes, and sequentially includes a 1-byte packet identifier, and a 2-byte packet sequence number.
The packet identifier has, for example, 4 values: 0x0 is an error prompt packet, 0x1 is a query packet, 0x2 is an initial packet, and 0x3 is a transmission packet, where 0x represents a hexadecimal number. 0x1 is the initial value used by the query packet to negotiate the packet sequence number. 0x2 is the data length of the initial packet used to negotiate the protocol number of the UDP pass-through and the maximum supported payload of the transport packet. The handshake process of the UDP protocol needs to go through two stages, namely, inquiry and initial, before entering the transmission stage to transmit the download command and/or data. No matter which of the three phases is currently in, if the network between the computer and the target board is interrupted, the UDP transparent code will be re-handshake to connect.
The grouping flag has 2 values: 0x0 is no retransmission and 0x1 is retransmission, where 0x represents a hexadecimal number. For example, a download command can be sent out only by one data packet, which is a data packet without continuous transmission. For example, a plurality of data packets are required for transmitting a firmware file, and the data packets except the last data packet are all continuous transmission packets, and the last data packet is a non-continuous transmission packet. Only when the data packet is not continuously transmitted, the UDP transparent transmission can reply an empty packet as a response.
The packet sequence number is sequentially increased by, for example, a value from 0x0 to 0xFFFF, where 0x denotes a hexadecimal number, and an initial value of the sequence number is negotiated at an initial stage. During the transmission phase, the packet sequence number starts counting with the initial value plus 1. The computer firstly backs up the data packet locally and then sends the data packet, and the sequence number of the local data packet is added with 1; the computer receives a reply data packet of the target board card and compares the serial numbers of the data packets; if the number of the data packet sequence is minus 1, retransmitting the backup data packet; if the serial numbers of the data packets are equal, the correct reply data packet is received, and the backup data packet is deleted.
Referring to fig. 5, the handshake mechanism of the UDP transparent transmission unit of the computer and the UDP transparent transmission unit of the target board card includes an inquiry phase, an initial phase, and a transmission phase, and specifically includes the following steps.
Step S401: a query phase. The computer sends out a null packet, the value of the identifier of the data packet in the UDP transparent transmission field is 0x1, the value of the grouping identifier is 0x0, and the serial number of the data packet can be any value.
Step S402: a query phase. And after the target board card receives the empty packet sent by the computer, establishing a reply packet and sending the reply packet to the computer. In the reply packet, the value of the data packet identifier of the UDP transparent transmission field is 0x1, the value of the packet identifier is 0x0, and the data packet sequence number is an initial value of the local data packet sequence number of the target board card.
Step S403: a query phase. And after the computer receives the reply packet of the target board card, the initial value of the sequence number of the data packet is locally recorded.
Step S404: and (5) an initial stage. The computer sends out a packet with data, the value of the identifier of the data packet in the UDP transparent transmission field is 0x2, the value of the grouping identifier is 0x0, and the value of the sequence number of the data packet is the initial value of the sequence number of the data packet obtained in the inquiry stage. The carried data at least comprises the download protocol number of the computer and the maximum load byte number of the data packet which can be supported by the computer.
Step S405: and (5) an initial stage. And the target board card receives the packet with the data sent by the computer, constructs a reply packet and sends the reply packet to the computer. In the reply packet, the value of the data packet identifier of the UDP transparent transmission field is 0x2, the value of the packet identifier is 0x0, and the value of the sequence number of the data packet is the sequence number of the computer sending packet. The reply packet further includes a download protocol number of the target board card and a maximum load byte number of the data packet that can be supported by the target board card.
Step S406: and (5) an initial stage. And after receiving the reply packet of the target board card, the computer compares whether the download protocol numbers are matched. If not, the download is not performed. And if so, changing the maximum load byte number of the data packet of the computer into the maximum load byte number of the data packet supported by the target board card, and adding 1 to the sequence number of the locally stored data packet.
Step S407: and (5) a transmission stage. The computer sends a packet with a download command and/or data, the value of the data packet identifier of the UDP transparent transmission field is 0x3, the value of the packet identifier is 0x0, and the value of the data packet sequence number is the locally stored data packet sequence number. The computer firstly backs up the packet locally, then sends the packet, and adds 1 to the sequence number of the data packet stored locally after the packet is sent.
Step S408: and (4) a transmission stage. And after the target board card receives a packet of the tape-downloading command and/or data sent by the computer, establishing a reply packet and sending the reply packet to the computer. In the reply packet, the value of the data packet sequence number of the UDP transparent transmission field is the value obtained by adding 1 to the data packet sequence number of the computer sending packet.
Step S409: and (4) a transmission stage. And the computer receives the reply packet of the target board card and compares the serial numbers of the data packets. And if the data packet sequence number in the reply packet is equal to the locally stored data packet sequence number minus 1, retransmitting the backup packet. If the data packet serial number in the reply packet is equal to the locally stored data packet serial number, the correct reply packet is received, and the backup packet is deleted. And repeating the steps S407 to S409, wherein the data packet sequence number of each packet sent by the computer is the data packet sequence number of the last successfully sent packet plus 1.
In the inquiry, initial or transmission phase, if the network connection between the computer and the target board is interrupted, the process returns to step S401 to start again, and the two parties handshake again until the transmission phase is entered again.
In the steps S407 to S409, the process of writing data into the target board by the computer is as follows: the computer sends a packet with a download command and/or data, and the target board card replies an empty packet as a response. The process of reading data from the target board card by the computer is as follows: the computer sends an empty packet to the target board card, the target board card sends the packet as a response, and data in the response packet can be empty or contain actual data content.
Referring to fig. 6, if the target board delays the packet reply time due to a long processing time for writing the firmware into the memory, or loses the packet due to a network problem, the retransmission processing procedure after the computer finds the packet loss includes the following steps.
Step S411: the computer sends the data packet to the target board card.
Step S412: and the computer does not receive the reply packet of the target board card after the first timeout. At this time, the target board may not receive the data packet sent by the computer, or the target board may receive the data packet sent by the computer but is busy processing other tasks (for example, writing the firmware into the memory) without timely processing.
Step S413: and the computer retransmits the last data packet to the target board card, and the sequence number of the data packet is unchanged.
Step S414: and the computer does not receive the reply packet of the target board card after the second timeout.
Step S415: and the computer retransmits the last data packet to the target board again, and the serial number of the data packet is unchanged.
Step S416: and the target board card receives the data packet sent by the computer, constructs a reply packet and sends the reply packet to the computer.
Step S417: and the computer receives the reply packet of the target board card and completes the operation of writing data once. The computer adds 1 to the data packet serial number of the next packet.
Referring to fig. 7, the data transmission system based on UDP and IPV6 protocols according to the present application includes a setting unit 10, a first connection unit 20, a second connection unit 30, a handshake unit 40, and a transmission unit 50.
The setting unit 10 is used for embedding UDP and IPV6 protocols in the programming tool software of the computer and the downloading program of the target board of the embedded system, and setting UDP transparent transmission units between the UDP/IP protocol layers and the downloading protocol layers of the target board of the computer and the embedded system.
The first connection unit 20 is used for running programming tool software in the computer and connecting the computer to a target board card of the embedded system through a USB interface. The first connection unit 20 is executed by, for example, a programming tool software in a computer.
The second connection unit 30 is used for running a downloading program on a target board card of the embedded system to become a data link server. The second connection unit 30 is, for example, responsible for executing a downloaded program in a target board of the embedded system.
The handshake unit 40 is used to enable the computer to serve as a client of the data link, and connect with a target board card serving as a server of the data link through a handshake mechanism of the UDP transparent transmission unit. The transmission layer between the computer and the target board card adopts a UDP protocol, and the network layer adopts an IPV6 protocol.
The transmission unit 50 is configured to enable the computer to send a download command and/or data to the target board, and the target board responds to the computer, receives a firmware file transmitted by the computer according to the download command, and writes the firmware file into the nonvolatile memory of the embedded system.
The method and the device adopt UDP and IPV6 protocols to realize data transmission of the computer and the embedded system, are mainly used for programming firmware files, have the advantages of high transmission speed, provide retransmission function and guarantee sequential transmission by the added UDP transparent transmission unit, and improve the reliability of data transmission.
The above are merely preferred embodiments of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims (12)
1. A data transmission method based on UDP and IPV6 protocol is characterized by comprising the following steps;
step S10: UDP and IPV6 protocols are implanted into programming tool software of a computer and a downloading program of a target board card of an embedded system; UDP transparent transmission units are arranged between a UDP/IP protocol layer and a download protocol layer of a target board card of a computer and an embedded system; the UDP transparent transmission unit is used for realizing the bidirectional transparent transmission of data between a UDP/IP protocol layer and a download protocol layer;
step S20: running a programming tool software by the computer, and connecting the computer to a target board card of the embedded system;
step S30: a target board card of the embedded system runs a downloading program to become a data link server;
step S40: the computer is used as a client of the data link and is connected with a target board card used as a server of the data link through a handshake mechanism of a UDP transparent transmission unit; a transmission layer between the computer and the target board card adopts a UDP protocol, and a network layer adopts an IPV6 protocol;
step S50: and the computer sends a downloading command and/or data to the target board card, and the target board card responds to the computer, receives the firmware file transmitted by the computer according to the downloading command and writes the firmware file into a nonvolatile memory of the embedded system.
2. The method according to claim 1, wherein in step S20, the computer is connected to a USB hub via a USB interface, and the USB hub is further connected to USB interfaces of target boards of one or more embedded systems.
3. The data transmission method according to claim 2, wherein in step S30, when the target board presses a specific key and powers on, the target board enters a USB download mode and automatically runs a download program.
4. The method according to claim 1, wherein in step S50, the download command includes a request for the target board to receive a firmware file transmitted from the computer; the downloaded data comprises a firmware file which is stored in the computer and is suitable for the target board card.
5. The UDP and IPV6 protocol-based data transmission method according to claim 1, wherein the programming tool software provides a first download protocol layer, and the first download protocol layer actively pushes a download command and/or data to the target board and blocks to wait for a reply response and a prompt message from the target board; and the download command and/or data sent by the first download protocol layer are sent to the UDP/IP protocol layer through the UDP transparent transmission unit, then packed into an Ethernet packet and forwarded to the bottom hardware drive layer, and finally sent to the USB hub from the USB interface of the computer.
6. The data transmission method based on the UDP and IPV6 protocols as claimed in claim 5, wherein the download command and/or data issued by the computer are transmitted to the USB interface of the target board card through the USB hub, and sequentially pass through the bottom hardware driving layer, the UDP/IP protocol layer, the UDP transparent transmission unit and the download program transmitted to the target board card; the downloading program provides a second downloading protocol layer, the second downloading protocol layer passively receives the downloading command and/or data sent by the computer, immediately replies a response to the computer after receiving the downloading command and/or data, and executes a task corresponding to the downloading command.
7. The method for data transmission according to claim 5 or 6, wherein the fastboot protocol is used for both the first and second download protocol layers.
8. The method according to claim 5 or 6, wherein the UDP/IP protocol layer at the computer end and the UDP/IP protocol layer at the target board card end both use lightweight codes, and comprise four layers, from top to bottom, including an application layer, a transport layer, a network layer, and a data link layer.
9. The data transmission method according to claim 1, wherein the UDP transparent transmission unit at the computer end and the UDP transparent transmission unit at the target card end are both implemented by adding a UDP transparent transmission field before the original data; the UDP pass-through field includes a packet identifier for indicating the type of the packet, a packet flag for indicating whether there is a continuation, and a packet sequence number.
10. The data transmission method according to claim 1, wherein the handshake mechanism between the UDP transparent unit at the computer end and the UDP transparent unit at the target card end in step S40 comprises the following steps;
step S401: an inquiry phase; the computer sends out an empty packet;
step S402: an inquiry phase; after the target board card receives the empty packet sent by the computer, a reply packet is established and sent to the computer; the initial value of the sequence number of the local data packet of the target board card is contained;
step S403: a query phase; after receiving a reply packet of a target board card, the computer locally records an initial value of a sequence number of a data packet;
step S404: an initial stage; the computer sends out a packet with data, and the carried data at least comprises a downloading protocol number of the computer and the maximum load byte number of the data packet which can be supported by the computer;
step S405: an initial stage; the target board card receives a packet with data sent by the computer, constructs a reply packet and sends the reply packet to the computer; the method comprises the steps of obtaining a target board card, wherein the target board card comprises a download protocol number of the target board card and the maximum load byte number of a data packet which can be supported by the target board card;
step S406: an initial stage; after receiving the reply packet of the target board card, the computer compares whether the download protocol numbers are matched or not; if not, the downloading is not carried out; if the number of the maximum load bytes of the data packet of the computer is matched with the number of the maximum load bytes of the data packet supported by the target board card, and adding 1 to the sequence number of the data packet stored locally;
step S407: a transmission stage; a computer issues a packet with download commands and/or data; the computer firstly backs up the packet locally, then sends the packet, adds 1 to the sequence number of the data packet stored locally after sending the packet;
step S408: a transmission stage; after receiving a packet of a downloading command and/or data sent by a computer, a target board card builds a reply packet and sends the reply packet to the computer, wherein the value of the sequence number of the data packet is the value of the sequence number of the data packet of the computer sending packet plus 1;
step S409: a transmission stage; the computer receives the reply packet of the target board card and compares the serial numbers of the data packets; if the sequence number of the data packet in the reply packet is equal to the sequence number of the data packet stored locally minus 1, retransmitting the backup packet; if the data packet sequence number in the reply packet is equal to the locally stored data packet sequence number, deleting the backup packet; and repeating the step S407 to the step S409, wherein the data packet sequence number of each packet sent by the computer is the data packet sequence number of the last successfully sent packet plus 1.
11. The data transmission method based on UDP and IPV6 protocols as claimed in claim 10, wherein the retransmission process after the computer finds a packet loss includes the following steps;
step S411: the computer sends a data packet to a target board card;
step S412: the computer does not receive the reply packet of the target board card when overtime for the first time;
step S413: the computer retransmits the last data packet to the target board card, and the serial number of the data packet is unchanged;
step S414: the computer does not receive the reply packet of the target board card after the second overtime;
step S415: the computer retransmits the last data packet to the target board card again, and the serial number of the data packet is unchanged;
step S416: the target board card receives the data packet sent by the computer, constructs a reply packet and sends the reply packet to the computer;
step S417: the computer receives the reply packet of the target board card and completes the operation of writing data once; the computer adds 1 to the data packet serial number of the next packet.
12. A data transmission system based on UDP and IPV6 protocols is characterized by comprising a setting unit, a first connecting unit, a second connecting unit, a handshake unit and a transmission unit;
the setting unit is used for implanting UDP and IPV6 protocols in programming tool software of the computer and a downloading program of a target board card of the embedded system, and UDP transparent transmission units are arranged between the UDP/IP protocol layers and downloading protocol layers of the computer and the target board card of the embedded system; the UDP transparent transmission unit is used for realizing the bidirectional transparent transmission of data between a UDP/IP protocol layer and a download protocol layer;
the first connecting unit is used for running programming tool software in a computer and connecting the computer to a target board card of the embedded system through a USB interface;
the second connection unit is used for running a downloading program on a target board card of the embedded system to enable the target board card to become a data link service end;
the handshake unit is used for enabling a computer to serve as a client of a data link and connecting a target board card serving as a server of the data link through a handshake mechanism of the UDP transmission unit; a transmission layer between the computer and the target board card adopts a UDP protocol, and a network layer adopts an IPV6 protocol;
the transmission unit is used for enabling the computer to send a downloading command and/or data to the target board card, the target board card responds to the computer, receives the firmware file transmitted by the computer according to the downloading command, and writes the firmware file into the nonvolatile memory of the embedded system.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010576633.2A CN111800488B (en) | 2020-06-23 | 2020-06-23 | Data transmission method and system based on UDP (user Datagram protocol) and IPV6 (Internet protocol video protocol) |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010576633.2A CN111800488B (en) | 2020-06-23 | 2020-06-23 | Data transmission method and system based on UDP (user Datagram protocol) and IPV6 (Internet protocol video protocol) |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN111800488A CN111800488A (en) | 2020-10-20 |
| CN111800488B true CN111800488B (en) | 2023-01-24 |
Family
ID=72804589
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010576633.2A Active CN111800488B (en) | 2020-06-23 | 2020-06-23 | Data transmission method and system based on UDP (user Datagram protocol) and IPV6 (Internet protocol video protocol) |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111800488B (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112291243B (en) * | 2020-10-29 | 2022-07-12 | 苏州浪潮智能科技有限公司 | Method, system medium and equipment for transparent transmission of data packet in routing mode |
| CN115022252B (en) * | 2022-05-31 | 2024-04-09 | 青岛海信移动通信技术有限公司 | A method and device for configuring the maximum length of a transmission data packet |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101674303A (en) * | 2009-07-31 | 2010-03-17 | 厦门敏讯信息技术股份有限公司 | Embedded network product programming equipment and method thereof |
| CN101715113A (en) * | 2009-07-27 | 2010-05-26 | 北京正唐科技有限责任公司 | Two-way radio embedded gateway based on ground digital television channels |
| CN107147655A (en) * | 2017-05-25 | 2017-09-08 | 北京中电普华信息技术有限公司 | A kind of network dual stack parallel process model and its processing method |
| CN108958781A (en) * | 2018-07-05 | 2018-12-07 | 嘉兴天控信息科技有限公司 | A kind of remote embedded firmware on line upgrading method |
| CN109828769A (en) * | 2018-12-24 | 2019-05-31 | 同济大学 | A system and method for remote updating of embedded programs based on TCP/IP |
-
2020
- 2020-06-23 CN CN202010576633.2A patent/CN111800488B/en active Active
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101715113A (en) * | 2009-07-27 | 2010-05-26 | 北京正唐科技有限责任公司 | Two-way radio embedded gateway based on ground digital television channels |
| CN101674303A (en) * | 2009-07-31 | 2010-03-17 | 厦门敏讯信息技术股份有限公司 | Embedded network product programming equipment and method thereof |
| CN107147655A (en) * | 2017-05-25 | 2017-09-08 | 北京中电普华信息技术有限公司 | A kind of network dual stack parallel process model and its processing method |
| CN108958781A (en) * | 2018-07-05 | 2018-12-07 | 嘉兴天控信息科技有限公司 | A kind of remote embedded firmware on line upgrading method |
| CN109828769A (en) * | 2018-12-24 | 2019-05-31 | 同济大学 | A system and method for remote updating of embedded programs based on TCP/IP |
Also Published As
| Publication number | Publication date |
|---|---|
| CN111800488A (en) | 2020-10-20 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| KR101627097B1 (en) | Inter-processor protocol in a multi-processor system | |
| EP1719276B1 (en) | Encoding a tcp offload engine within fcp | |
| CN100399305C (en) | Block storage within a computer network | |
| US20060146814A1 (en) | Remote direct memory access segment generation by a network controller | |
| CN115664883B (en) | Network adapter with efficient storage protocol emulation | |
| US6701373B1 (en) | Data transmission apparatus | |
| JPH05509430A (en) | Downloading the operating system over the network | |
| CN111800488B (en) | Data transmission method and system based on UDP (user Datagram protocol) and IPV6 (Internet protocol video protocol) | |
| CN101409727B (en) | Document transmission method and apparatus | |
| TWI779858B (en) | System and method for upgrading firmware | |
| CN107425943A (en) | Message data transmission method and device, electronic equipment and computer storage medium | |
| CN102664958A (en) | Transparent computing system | |
| EP3826244B1 (en) | Congestion control method and related device | |
| CN109688208B (en) | Data loading method based on FC-AE-ASM message | |
| CN115904418A (en) | A system and method for burning PCIE cascade chip firmware | |
| US20120072520A1 (en) | System and Method for Establishing Reliable Communication in a Connection-Less Environment | |
| CN105407003B (en) | A kind of data of 1553 bus add discharging method | |
| CN119473170A (en) | Method and system for constructing circular buffer area, storage medium and electronic device | |
| CN115883360B (en) | Remote upgrading method based on multi-layer grading of Internet of things | |
| CN102169439B (en) | Data transmission system | |
| CN114579166A (en) | Component module upgrade method, component module and financial robot | |
| CN100365573C (en) | A method for loading a machine frame | |
| EP2726992B1 (en) | Network control model driver | |
| US12375568B1 (en) | Communication protocol for accelerating artificial intelligence processing tasks over non-volatile memory express protocol | |
| CN120104168B (en) | A Fast and Stable Upgrade Method for ZYNQ Bare Core Based on TCP Protocol |
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 | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |