Method for increasing reading speed of USB slave device

A technology of reading speed and equipment, which is applied in the field of data processing, can solve problems such as cost increase and data loss, and achieve the effect of increasing transmission speed and improving data transmission efficiency

Active Publication Date: 2018-02-16
HUNAN GOKE MICROELECTRONICS
7 Cites 0 Cited by

AI-Extracted Technical Summary

Problems solved by technology

[0014] However, when the ability of the slave device is not strong enough, and the background interrupt service program copies the memory speed insufficiently, data loss will occur; in the prior art, the solutio...
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Method used

1, the embodiment of the present invention divides memory into a plurality of memory blocks and bindings with endpoints, when one of the memory blocks is filled with data sent, the filled memory is transferred to the background for processing, and the endpoints then Bind another memory block to receive data, thus improving data transmission efficiency.
2, USB is when using another memory block to receive data from equipment, also will be transferred to the data copy of the memory block that has filled up data in background to storage space, and data transmission mode is changed into parallel by serial, It solves the problems in the prior art that internal copying is performed after all data is transmitted, resulting in long copying time and low efficiency.
It can be seen that, in the embodiment of the present invention, USB is executing simultaneously from the device: utilize the endpoint to send data to the 2nd memory block, and copy the data in the 1st memory block that has been filled with data to storage space There are two actions in the middle, so the data sent by the USB master device can be processed separately, which improves the work efficiency, and through the mode of receivi...
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Abstract

The invention relates to a method for increasing a reading speed of a USB slave device. The method is applied to a system comprising a USB master device and the USB slave device. The method comprisesthe steps of 1, judging whether the USB slave device is connected with the USB master device or not; 2, binding an end point with a memory matched with the end point by the USB slave device; 3, receiving data sent by the USB master device through the USB slave device, and storing the data in the memory bound with the end point; and 4, unbinding the memory from the end point by the USB slave device, and if data transmission is not finished, executing the step 1 again. By dividing an available memory of the USB slave device into multiple memory blocks and performing filling respectively, serialtransmission is changed to parallel transmission, so that the data sent by the USB master device can be quickly read and a second end point command is sent to a register in the same time; and the method can remarkably increase the data transmission speed.

Application Domain

Technology Topic

Image

  • Method for increasing reading speed of USB slave device
  • Method for increasing reading speed of USB slave device

Examples

  • Experimental program(2)

Example Embodiment

[0046] Example one
[0047] The embodiment of the present invention provides a method for improving the reading speed of a USB slave device, which is applied to a system including a USB host device and a USB slave device, wherein the method includes:
[0048] Step 1. Determine whether the USB slave device is connected to the USB master device, if connected, perform step 2, and if not connected, end;
[0049] Step 2. The USB slave device binds the endpoint to a memory matching the endpoint;
[0050] Step 3. The USB slave device receives the data sent by the USB master device, and stores the data in the memory bound to the endpoint;
[0051] Step 4. The USB slave device unbinds the memory from the endpoint, and if the data transmission has not ended, step 2 is executed again until the data transmission ends.
[0052] Further, the step 1 includes:
[0053] The USB host device automatically detects the USB port;
[0054] If a USB slave device is detected, the USB slave device is connected to the USB host device;
[0055] If it is not detected, it is not connected.
[0056] Further, the step 2 includes:
[0057] Step 2.1: The USB slave device prepares the endpoint and the memory;
[0058] Step 2.2: The USB slave device divides the memory into N memory blocks and sorts them, where the N memory blocks all match the endpoints, and N is an integer greater than 1.
[0059] Step 2.3: The USB slave device binds the endpoint to the M-th memory block, where M≤N;
[0060] Step 2.4: The USB slave device sends the endpoint and data command to the register of the USB slave device.
[0061] Further, the step 3 includes:
[0062] Step 3.1: The register receives the endpoint and the data command, and receives the data sent by the USB host device according to the data command;
[0063] Step 3.2: The USB slave device stores the data in the Mth memory block.
[0064] Further, the step 4 includes:
[0065] Step 4.1: The USB slave device unbinds the endpoint and the M-th memory block, and the M-th memory block carries the data sent by the USB master device;
[0066] Step 4.2: Return to step 2.3 in step 2, where the M-th memory block is changed to the M+1-th memory block, and when the M+1 is greater than N, the value of M is 0 until the end of data transmission.
[0067] Further, after the USB slave device unbinds the memory from the endpoint, the method further includes:
[0068] The USB slave device copies the data in the Mth memory block to the storage space of the USB slave device, and releases the memory space of the Mth memory block.
[0069] The embodiments of the present invention have the following advantages:
[0070] 1. The embodiment of the present invention divides the memory into multiple memory blocks and binds them to the endpoint. When one of the memory blocks is filled with data sent, the filled memory is transferred to the background for processing, and the endpoint is bound to another A memory block receives data, therefore, the efficiency of data transmission is improved.
[0071] 2. While the USB slave device uses another memory block to receive data, it also copies the data of the memory block filled with data transferred to the background to the storage space. The data transmission method is changed from serial to parallel, which solves the problem. In some technologies, internal copying is performed after all data is transmitted, which leads to long copying time and low efficiency.
[0072] 3. In the embodiment of the present invention, the slave device can quickly read the data sent by the master device during the synchronous transmission and send the endpoint command to the register for the second time at the same time. The method of the present invention can increase the transmission speed by 20%.

Example Embodiment

[0073] Example two
[0074] Such as figure 2 As shown, figure 2 It is a schematic flowchart of the method provided by the embodiment of the present invention. The embodiment of the present invention provides a method for improving the reading speed of a USB slave device, which is mainly applied in the data interaction process between the USB host device and the USB slave device. The specific content is as follows:
[0075] Step 1. Determine whether the USB slave device is connected to the USB master device, if connected, perform step 2, and if not connected, end;
[0076] The specific judgment process is as follows:
[0077] The USB host device automatically detects the USB port,
[0078] If a USB slave device is detected, the USB slave device is connected to the USB host device;
[0079] If it is not detected, it is not connected.
[0080] It should be noted that, in the embodiment of the present invention, after the USB slave device is detected, the following content is also included:
[0081] Step 1.1: The USB master device sends a query command to the USB slave device;
[0082] Step 1.2: The USB slave device receives the query command, and sends identity information to the USB host device;
[0083] Step 1.3: The USB host device confirms the identity information.
[0084] Specifically, the USB host device queries each USB port in turn. When the USB host device detects a voltage difference between D+ and D-, it considers that there is a new setting access, and then sends it to the external device (that is, the USB slave device) Query command. After receiving the query command, the USB slave device returns its basic attributes such as the supported transmission data length, current load, and the supported USB version to the USB host device in a fixed format, and the USB host device receives this Basic information of the USB slave device and confirm it. The specific thing is to assign an address to the USB slave device. So far, the USB slave device interacts with the USB master device, completing the identification preparation before data transmission.
[0085] Step 2. The USB slave device binds the endpoint to a memory matching the endpoint;
[0086] Step 2.1: The USB slave device prepares the endpoint and the memory;
[0087] Step 2.2: The USB slave device divides the memory into N memory blocks and sorts them, where the N memory blocks all match the endpoints, and N is an integer greater than 1.
[0088] Step 2.3: The USB slave device binds the endpoint to the M-th memory block, where M≤N;
[0089] Step 2.4: The USB slave device sends the endpoint and data command to the register of the USB slave device.
[0090] Specifically, in this step, after the USB slave device receives the identity confirmation information of the USB master device, the USB slave device prepares an endpoint and memory, the endpoint is a data transmission endpoint, and the data sent by the USB master device is transmitted to the USB slave device through the endpoint In, the memory is used to temporarily store the data participating in the transmission,
[0091] Further, the USB slave device divides the memory into N memory blocks by itself (N is an integer greater than 1), and sorts them to facilitate system selection; in this way, the data sent by the USB master device is stored in different In the memory block, the effect of dividing the transmission data is achieved; the N memory blocks are all matched with the data transmission endpoint of the USB slave device, that is, the data transmission endpoint can be linked to the N memory blocks. The present invention In the embodiment, the endpoint is bound to the Mth memory block, that is, the data transmission endpoint points to the Mth memory block, where M≤N, at this time, the data transmission endpoint is only related to the Mth memory block, It has nothing to do with other memory blocks.
[0092] It should be noted that, in the embodiment of the present invention, the preparation of the USB slave device not only includes binding the endpoint and the memory block, but also includes sending the endpoint and data commands to the register so that the register executes the data command.
[0093] Step 3. The USB slave device receives the data sent by the USB master device, and stores the data in the memory bound to the endpoint;
[0094] Step 3.1: The register receives the endpoint and the data command, and receives the data sent by the USB host device according to the data command;
[0095] Step 3.2: The USB slave device stores the data in the Mth memory block.
[0096] Specifically, after the USB slave device's register receives the data transmission endpoint and data command, according to the data command, the data transmission endpoint automatically receives the data sent by the USB host device, and stores the data in the memory block pointed to by the data transmission endpoint Specifically, according to the sorting of the N memory blocks, in the embodiment of the present invention, the data transmission endpoint is first bound to the M-th memory block. For example, the value of M is 1, that is, the endpoint is connected to the first memory block. Block binding, then the data received through the data transmission endpoint is stored in the first memory block.
[0097] It should be noted that in the embodiment of the present invention, when the USB slave device sends a signal to the USB master device, the USB master device generates an interrupt. The USB slave device triggers the interrupt service program after receiving the interrupt sent by the USB master device, and The function of receiving data is triggered in the interrupt service program. Therefore, in the embodiment of the present invention, the receiving data is executed by the interrupt service program triggered by the chip interrupt of the USB slave device, so that the data transmission can be carried out in the interrupt service program without occupying system resource.
[0098] Step 4. The USB slave device unbinds the memory from the endpoint, and if the data transmission has not ended, step 2 is executed again until the data transmission ends. Specifically include the following:
[0099] Step 4.1: The USB slave device unbinds the endpoint and the M-th memory block, and the M-th memory block carries the data sent by the USB master device;
[0100] Step 4.2: Return to step 2.3 in step 2, where the M-th memory block is changed to the M+1-th memory block, and when the M+1 is greater than N, the value of M is 0 until the end of data transmission.
[0101] In the embodiment of the present invention, after the first memory block bound to the data transmission endpoint is filled with data, the first memory block cannot continue to be filled with data. Therefore, the point between the first memory block and the endpoint The relationship is cancelled, that is, the binding is released. After the binding is released, the USB slave device performs step 2.3: the USB slave device binds the endpoint to the M-th memory block; where M is changed to M+1 , Refers to the step 2.3 performed in step 4, the endpoint is bound to the M-th memory block, and the M refers to the result of adding 1 to the first M, that is, the endpoint and the second The memory block is bound; then the USB slave device sends the endpoint and data command to the register again, and the register stores the data received by the endpoint in the second memory block, and when the second memory block is full , The USB slave device releases the binding relationship between the endpoint and the second memory block, and will perform step 2.3 in step 2 again, at this time M is changed to M+1, the third occurrence of M is in the second The result of adding 1 to the second M, that is, the endpoint is bound to the third memory block, and so on until the last memory block is reached.
[0102] In the embodiment of the present invention, the USB slave device divides the memory into N memory blocks, assuming that N takes a value of 4. After the fourth cycle, the data of the USB master device has not yet been sent. At this time, in step 3, The USB slave device unbinds the endpoint and the fourth memory block, and executes step 2.3 in step 2 again, where M is changed to M+1, that is, the new M is 5, and M+1 is greater than N , And the fifth memory block does not exist. At this time, the value of M is 0, that is, the new M is 0+1, and the "5th memory block" is the first memory block, and so on until data transmission End.
[0103] It should be noted that, in the embodiment of the present invention, after the memory block filled with data is unbound from the endpoint, the following steps are further included:
[0104] The USB slave device copies the data in the Mth memory block to the storage space of the USB slave device, and releases the memory space of the Mth memory block.
[0105] Specifically, after the first memory block is unbound from the endpoint, the USB slave device transfers the first memory block carrying data to the background interrupt service program, and copies the data stored in the first memory block to the USB From the storage space of the device, the memory space of the first memory block is released. After the data copy is completed, the first memory block can be used again to satisfy "When the M+1 is greater than N, M takes The value is 0".
[0106] It can be seen that in the embodiment of the present invention, the USB slave device is simultaneously executing: using the endpoint to send data to the second memory block, and copying the data in the first memory block that has been filled with data to the storage space. Therefore, the data sent by the USB host device can be processed separately, which improves work efficiency. Moreover, the mode of receiving data while copying data changes the data transmission mode from serial transmission to parallel transmission, which improves the USB system Utilization rate, and solves the technical problem of long copying time and slow speed in the prior art that all data is copied after all data is received. Therefore, the USB slave device can quickly read the data sent by the USB master device and send the second endpoint command to the register at the same time. The method of the present invention can increase the transmission speed by 20%.
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

no PUM

Description & Claims & Application Information

We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.
the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Similar technology patents

Classification and recommendation of technical efficacy words

  • Improve data transfer efficiency
  • Fast transmission

IP (Internet Protocol) network application accelerating system

Owner:NO 54 INST OF CHINA ELECTRONICS SCI & TECH GRP

People also interested in

Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products