CN107544936A - A kind of data transmission method based on USB programmings - Google Patents

A kind of data transmission method based on USB programmings Download PDF

Info

Publication number
CN107544936A
CN107544936A CN201710843347.6A CN201710843347A CN107544936A CN 107544936 A CN107544936 A CN 107544936A CN 201710843347 A CN201710843347 A CN 201710843347A CN 107544936 A CN107544936 A CN 107544936A
Authority
CN
China
Prior art keywords
data
transmission
usb host
data transfer
equipment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710843347.6A
Other languages
Chinese (zh)
Inventor
吕振
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuhai Wisdom Electronic Technology Co Ltd
Original Assignee
Zhuhai Wisdom Electronic Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuhai Wisdom Electronic Technology Co Ltd filed Critical Zhuhai Wisdom Electronic Technology Co Ltd
Priority to CN201710843347.6A priority Critical patent/CN107544936A/en
Publication of CN107544936A publication Critical patent/CN107544936A/en
Pending legal-status Critical Current

Links

Abstract

The present invention provides a kind of data transmission method based on USB programmings, can be by the programming of firmware data fast and reliable ground into equipment medium in embedded system firmware volume production technical field.It is using technical scheme:Data transfer is transmitted using the handshake method of two layers of confirmation of application layer and transport layer, every layer of data transfer will pass through order transmission, data transfer, three transmission stages of state transfer, reliable data transmission path is established by way of two layers confirms three phases, carries out fast and effectively data transfer.Data transfer flow as shown in drawings, by usb host initiated by data transfer, sends application layer order AC first(S201), then usb host judged(S202), carry out data transmission(S203), judge whether transmission is completed(S204), finally receive and apply layer state AS(S205), complete data transfer.Effectively solves the problems, such as the low speed and reliability of traditional USB volume productions mode, production efficiency significantly improves.

Description

A kind of data transmission method based on USB programmings
Technical field
The present invention relates to embedded system firmware volume production technical field, more particularly to embedded system is based on USB programmings The scene of firmware data.
Background technology
Embedded product is widely used to all trades and professions of society, in process of producing product, it is necessary to by embedded system Firmware volume production of uniting is into product facility.Firmware(Firmware)As operating system object code be stored in Nand Flash, In the storage mediums such as Nor Flash, Emmc, firmware is the program for being solidificated in storage medium, is the soul of embedded product, is determined The function and performance of the equipment of product.
Usual firmware data directly can not be read or changed by user after being written to embedded product, if in programming Data occur abnormal in journey, and may result in whole product can not normally start, so ensureing that the firmware data of programming is safe and reliable Just seem extremely important.The firmware data programming mode that volume production can be carried out at present has USB modes, card mode etc., because USB burns WriteMode can with real-time display volume production progress, and can simultaneously the multiple product facilities of volume production, be in different type product volume production When use a kind of more mode.
But the firmware programming mode of traditional embedded product in order to ensure firmware data programming to storage medium can By property, verification increasing is carried out in programming data and has dragged slowly burn writing speed, influences producing line efficiency.To lift the use in product volume production stage Family is experienced, the reliability and burn writing speed of the programming data of firmware particularly during volume production, while facilitates producing line worker to carry out Volume production status tracking is, it is necessary to a kind of reliable quickly data programming method.
The content of the invention
The present invention proposes a kind of reliable quickly USB volume production programming methods, can effectively solve traditional USB volume productions mode The problem of low speed and reliability, production efficiency significantly improves.
The goal systems of application claims processing meets following condition:(1)USB connection status between usb host and equipment Normally,(2)The USB drivings of usb host can normally enumerate USB device,(3)Want the firmware data holding equipment medium class of programming Type.
It is of the invention to be using technical scheme:Data transfer is carried out using the handshake method of two layers of confirmation of application layer and transport layer Transmission, every layer of data transfer will pass through order transmission, data transfer, three transmission stages of state transfer, true by two layers The mode for recognizing three phases establishes reliable data transmission path, carries out fast and effectively data transfer.
Data transmission path is established by application layer order AC (Application Command) first, is confirming to order After being transmitted, usb host starts application layer data AD (Application Data) transmission, and transmission direction is readable writeable, institute Some firmware programming data are exactly to be transmitted by this stage, and for transmission direction to write, data transfer can be by complete several times Into, after the completion of application-layer data transmission it is necessary to USB device carry out using layer state AS (Application Status) transmit To obtain the status information of equipment, further confirm that data transfer is completed.When application layer order is transmitted, usb host is sent first Transport layer order TC (Transfers Command), order regular length are 16byte, and usb host enters to transport layer order TC Row judges, after transport layer order TC is sent completely, then sends transport layer data TD (Transfers Data), that is, AC The particular content of order, after transport layer data TD is sent completely, then usb host obtains equipment end transmission layer state TS (Transfers Status), application-layer data transmission AD and application layer state transfer the two stages of AS and application layer order AC The process in transmission stage is identical, and simply content is different.
The beneficial effects of the invention are as follows:(1)The reliability of data is improved, the side transmitted by two layers of three phases of shaking hands Formula, each data transfer all can pass through repeatedly to shake hands to be judged with data reliability, ensure that the correctness of data.(2)It need not enter Row data check, reduce workload of the equipment end to transmission data check, improve the speed of volume production programming, lift the life of producing line Produce efficiency.(3)Using the data transmission method of layering stage by stage, also allow for carrying out secondary development, increase new work(if desired Can, it is only necessary to, it is only necessary to it is extended in the application layer command phase, there is relatively low coupling with other stages or level. (4)The data transfer mode that the present invention realizes is with less handshake data(Each AC is 32 Byte, TC, and TD, AS are 16 Byte), ensure that the transmission of the big data quantity of firmware data(Can it not limited in theory with transmitted data amount every time, with business Logic is related), improve the validity for transmitting data.
Brief description of the drawings
Fig. 1:The hierarchical structure of data transfer between usb host and equipment.
Fig. 2:The entire flow of USB data transmission.
Fig. 3:The detailed process in stage is transmitted in application layer order, is that the realization that transmission is ordered in Fig. 2 refines description.
Fig. 4:The detailed process in application-layer data transmission stage, it is the realization refinement description of data transfer in Fig. 2.
Fig. 5:The detailed process in application layer state transfer stage, it is the realization refinement description of state transfer in Fig. 2.
Fig. 6:Application layer order AC member's structure, length are 32 Byte, including magic evil spirit numbers be necessary for " AC ", Cmd orders, tag serial numbers etc..
Fig. 7:Using member's structure of layer state, length is 16 Byte, including magic evil spirit numbers be necessary for " AS ", Mark indicates, it is necessary to it is 0xffff, tag serial numbers, equipment state etc..
Fig. 8:Member's structure of transport layer order, length are 16 Byte, including magic evil spirit numbers be necessary for " TC ", The length of this imperative structures of size is necessary for 16 Byte, dir transmission directions, tag serial numbers, the len data lengths to be transmitted Deng.
Fig. 9:Transmit member's structure of layer state, length is 16 Byte, including magic evil spirit numbers be necessary for " TS ", Tag serial numbers, equipment state etc..
Embodiment
The specific implementation of the present invention, is described in detail as follows:As shown in figure 1, data transfer uses application layer(S104)And biography Defeated layer(S108)The handshake method of two layers of confirmation is transmitted, and every layer of data transfer will pass through order and transmit, data transfer, The transmission stages of state transfer three, three transmission stages of application layer are:AC is transmitted in application layer order(S101), application layer data AD(S102), using layer state AS(S103)In three transmission stages, three transmission stages of transport layer are:Transport layer order TC (S105), transport layer data TD(S106), transmission layer state TS(S107)Three transmission stages, according to the agreement of usb bus, PC As usb host(S109)The initiative of data transfer is known completely, and the read-write operation of USB device is sent out by usb host Rise.
Overall data transfer implementation process as shown in Fig. 2 usb host by sending application layer order AC(S201)Establish Data transmission path, after confirming that application layer order AC is transmitted, usb host determines whether to carry out data transmission (S202), carry out data transmission if desired, start application-layer data transmission(S203), transmission direction is readable writeable, all Firmware programming data are exactly to be transmitted by this stage, and transmission direction can be transmitted several times to write, and judge number After being transmitted(S203), usb host will obtain equipment application layer state AS to read acquisition status information of equipment (S205), data transfer completion.
The embodiment of application layer order transmission AC transmission is, it is necessary to be described in conjunction with flow, specifically such as Fig. 3 institutes Show, data start to transmit(S301), initially enter the application layer order transmission AC stages(S302), usb host transmission transport layer life Make TC(S303), order regular length is 16byte, comprising command id, magic, data transfer direction, serial number, to be transmitted Application layer order AC length etc.(S305), data transfer direction is to write data, after transport layer order TC is sent completely, is then sent out Transport layer data TD, that is, the particular content of AC orders (S304) are sent, after transport layer data TD is sent completely, then USB Main frame obtains transmission layer state TS, and the inside contains the status information that return to usb host at USB device end, USB device this When to go to judge whether the magic for the transport layer order TC that usb host is sent is " TC "(S305), data transfer direction is necessary To write, then go to judge transport layer data TD again(That is AS orders)Command format whether support(Whether it is " TS including magic ", whether in the support list of agreement, whether tag serial numbers are identical with TC serial numbers by cmd(S306)), if all correct The ready status information of returning equipment is to main frame(S307), otherwise being returned to Error status information to main frame(S308), After usb host receives defeated layer data TS orders(S309), in addition to the status information of equipment to be judged, usb host will also judge Whether magic is " TS ", and whether tag serial numbers are identical with transport layer order TC, if status information, magic, serial number three As long as any differ of person will stop transmitting(S310), it is identical just to carry out performing the data transfer AD transmission stages (S312), otherwise equipment state mistake, transmission stops(S311).
The application layer data AD transmission stages, specific implementation flow was as shown in figure 4, application layer data AD transmission starts(S401) When, whether usb host will carry out data transmission first(S402)If do not have data to transmit, it is only necessary to which small generator terminal performs life Order, the data transfer ends(S411), if necessary to data transfer, send transport layer order TC(S403), order fixed length Spend for 16byte, include command id, magic, data transfer direction, serial number, the data length to be transmitted etc., data transfer Direction can be that reading data can also write data, after transport layer order TC is sent completely, then send transport layer data TD, Also with regard to application layer data AD particular content, usb host is it is first determined whether be to write data(S404), data are write if desired, Then there is main frame to send data(S406), application-layer data transmission AD can be divided into be transmitted several times(S407), if desired Data are read, usb host receives data(S405), reading data can also transmit several times(S408), after being transmitted, then Usb host obtains transmission layer state TS(S409), the inside contains the status information that return to usb host at USB device end, USB device will now go to judge whether the magic for the transport layer order TC that usb host is sent is " TC ", also to judge data Whether whether the total length of transmission equal with the length arranged in transmission order TC(S410), returning equipment is just if all correct The status information of thread is to main frame, otherwise being returned to Error status information to main frame, usb host receives transmission layer state After TS orders, it is judged, if equipment state normally enters the application layer state transfer AS stages(S411), otherwise shape State abnormal transmission stops(S412).
Using layer state AS transmission stages specific implementation flow as shown in figure 5, starting using layer state AS transmission(S501) When, usb host sends transport layer order TC first(S502), order regular length is 16byte, comprising command id, magic, Data transfer direction, serial number, the data length to be transmitted etc., data transfer direction read data, and transport layer order TC has been sent Into afterwards, transport layer data TD is then received, also just applies layer state AS(S503), Effective judgement is carried out to AS content, Specifically include magic evil spirit numbers(“ AS ”), tag serial numbers, equipment state etc.(S504)If invalid using layer state, data Transmission stops(S507)If parameters state is effective, usb host receiving device end transmission layer state TS(S505), USB master After machine receives transmission layer state TS, judge whether the magic number, tag serial numbers, equipment state that transmit layer state TS are normal (S506), if normal condition is transmitted, and whole transmitting procedure normally completes(S508), otherwise data transfer termination, Bust this(S507).

Claims (6)

  1. A kind of 1. data transmission method based on USB programmings, it is characterised in that:Data transfer is using two layers of application layer and transport layer The handshake method of confirmation is transmitted, and every layer of data transfer will pass through order transmission, three data transfer, state transfer biographies The defeated stage;Specifically comprise the following steps:Step 1, usb host and equipment establish the connecting path of data transfer, and usb host is actively Notice equipment will transmit the information such as the size of data, equipment prepares to be confirmed after receiving;Step 2, usb host annunciator will Carry out data transmission, and carry out data transmission, after equipment receives appointment data, return to the information such as the length of transmission data;Step Rapid 3, equipment is handled data, after the completion of, equipment obtains result.
  2. 2. according to the method for claim 1, it is characterised in that:The step 1 is specially that usb host is established with USB device The connecting path of data transfer is further depicted as usb host and sends transport layer life first, it is necessary to establish reliable handshaking information TC is made, order regular length is 16 Byte, and magic evil spirit numbers are necessary for " TC ", transmission direction, serial number, the number to be transmitted According to length etc., data transfer direction can be that reading data can also write data.
  3. 3. according to the method for claim 1, it is characterised in that:It is specific that the step 1 describes usb host proactive notification equipment It is described as, after connecting path is established, usb host sends transport layer data TD, namely application layer order AC data, the length of data The equal length to be transmitted that must arrange with transport layer order TC.
  4. 4. according to the method for claim 1, it is characterised in that:The step 1 describes equipment and prepares to be confirmed after receiving; Specially confirmation transmission layer state can be sent after the preparation of the accurate good data transfer of equipment(TS), wait main frame to go to read, in order " TS ", serial number, equipment state etc. are necessary for comprising magic evil spirit numbers, serial number must be sent out in claim 2 with main frame Send transport layer order TC serial number identical.
  5. 5. according to the method for claim 1, it is characterised in that:The step 2, which describes usb host annunciator, will enter line number According to transmission, order TC will be transmitted by being specifically described as main frame transmission, order all items included with sending transport layer in claim 2 Order all items of TC identical, simply content is different.
  6. 6. according to the method for claim 1, it is characterised in that:The step 3 describes specific explanations, and equipment is to transmitting number After processing, equipment state is returned into usb host, is further depicted as according to the method for claim 2, usb host TC orders are actively sent, command format is identical with the form that claim 2 describes, and content is different, while USB device end is according to power Profit requires that the method described in 3 prepares to apply layer state AS, including magic number, tag serial numbers, equipment state etc., waits usb host to obtain Take;Prepare transmission layer state according to the method for claim 4(TS), wait usb host to obtain.
CN201710843347.6A 2017-09-18 2017-09-18 A kind of data transmission method based on USB programmings Pending CN107544936A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710843347.6A CN107544936A (en) 2017-09-18 2017-09-18 A kind of data transmission method based on USB programmings

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710843347.6A CN107544936A (en) 2017-09-18 2017-09-18 A kind of data transmission method based on USB programmings

Publications (1)

Publication Number Publication Date
CN107544936A true CN107544936A (en) 2018-01-05

Family

ID=60964251

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710843347.6A Pending CN107544936A (en) 2017-09-18 2017-09-18 A kind of data transmission method based on USB programmings

Country Status (1)

Country Link
CN (1) CN107544936A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1385794A (en) * 2001-05-14 2002-12-18 精工爱普生株式会社 Data transmission controller, electronic device and data transmission method
US20050015523A1 (en) * 2003-06-06 2005-01-20 Seiko Epson Corporation Data transfer control device, electronic instrument, and data transfer control method
US20080126611A1 (en) * 2006-11-28 2008-05-29 Via Technologies, Inc. Hardware accelerator and data transmission system and method using the same
US20080162753A1 (en) * 2006-12-31 2008-07-03 Baojing Liu Method for Performing Full Transfer Automation in a USB Controller

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1385794A (en) * 2001-05-14 2002-12-18 精工爱普生株式会社 Data transmission controller, electronic device and data transmission method
US20050015523A1 (en) * 2003-06-06 2005-01-20 Seiko Epson Corporation Data transfer control device, electronic instrument, and data transfer control method
US20080126611A1 (en) * 2006-11-28 2008-05-29 Via Technologies, Inc. Hardware accelerator and data transmission system and method using the same
US20080162753A1 (en) * 2006-12-31 2008-07-03 Baojing Liu Method for Performing Full Transfer Automation in a USB Controller

Similar Documents

Publication Publication Date Title
CN102057363A (en) Direct data transfer between slave devices
JP6193859B2 (en) RFID card management method and terminal
CN100507940C (en) Efficient connection between modules of removable electronic circuit cards
CN105474238B (en) Communication and related connector, system and method for the operation based on M-PHY on the interface based on massive store
CN104980190A (en) Data transmission system and transmission method of Bluetooth interface
CN103426013A (en) Device, system, and method for logging near field communications tag interactions
CN104350720B (en) The device, method and system of serial protocol for bidirectional linked list interconnection are provided
CN106899053B (en) Utilize the wireless charging device in the wireless charging space of three-dimensional configuration
CN104144109A (en) Equipment control method, device and system
CN103838516B (en) A kind of method and system for polycaryon processor efficient access iscsi disk array
CN106991352A (en) The data read-write method of NFC reader and NFC label
CN102446284A (en) Ic card, mobile electronic device and data processing method in ic card
CN102740295A (en) System and method for authenticating mobile terminal
CN106484652B (en) A kind of more queue communication method and system based on NTB hardware
CN103077139B (en) Use integrated circuit and the control method thereof of internal integrate circuit bus
CN105528655A (en) Ticket buying method and system
CN107544936A (en) A kind of data transmission method based on USB programmings
JP6403122B2 (en) Communication device and communication system
CN104579870A (en) RFID-chip-based fast networking method and special device
JP3596056B2 (en) Identification system and coil used therein
CN105956854A (en) Data processing method and cloud server
CN103927563A (en) Component lofting method based on RFID and device applied to method
KR20160124637A (en) Wireless charging method using internet of things and Wireless charger
JP4714556B2 (en) Contract information providing system and contract information providing method
CN203825821U (en) Serial port forwarding server

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