USB data packet transmission method and USB transmission system
By defining multiple interrupt upload endpoints on the USB device side and establishing pipelines on the host side, multiple time-sharing uploads of USB interrupt transmission are realized, and the problem of insufficient response time and data refresh rate of USB interrupt transmission is solved, which significantly improves the real-time and reliability of transmission.
Patent Information
- Application Number
- CN202510598193.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-09
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2045-05-09
AI Technical Summary
The existing USB interrupt transmission has insufficient response time and data refresh rate, especially in high-speed and ultra-high-speed USB environments. The response time is limited by the duration of microframes, making it difficult to meet the real-time needs of industrial control and consumer electronics fields.
By defining N interrupt upload endpoints on the USB device side and establishing corresponding pipelines on the host side, multiple interrupt upload endpoints can upload the same target data stream in time. The specific steps include: setting multiple event detection specified time points in the microframe, detecting the device's request to upload data in real time, and notifying the host asynchronously through the ERDY transaction packet for transmission.
This method can significantly shorten the response time of USB interrupt transmission, increase the data refresh rate N times, improve the real-time and reliability of USB interrupt transmission, and is suitable for application scenarios that require high data refresh rate.
Smart Images

Figure CN120123280A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of USB communication, and particularly relates to a USB data packet transmission method and a USB transmission system. Background Art
[0002] USB communication is widely used, but the real-time performance of USB data packet transmission is relatively weak. According to the USB specification, USB bulk transmission (Bulk) cannot guarantee bus bandwidth and real-time performance. USB isochronous transmission (Isochronous) is relatively real-time but lacks an acknowledgment and retransmission mechanism, so it cannot guarantee reliability. USB interrupt transmission (Interrupt) can balance real-time performance and reliability.
[0003] In the prior art, USB interrupt transmission has a high bandwidth priority. After the start of each microframe (125 μs) of high-speed USB and super-high-speed USB, high-priority transmissions such as USB interrupt transmission will be preferentially arranged, and the remaining time within the microframe will be used to arrange USB bulk transmission, etc. However, USB interrupt transmission can transmit at most one data packet within each microframe. Even for high-bandwidth transmission, at most three data packets can be uploaded at a time within a microframe, but the three data packets must be continuously transmitted and are usually concentrated at the head of the microframe interval. Therefore, the response time of USB interrupt transmission is limited by the duration of the microframe. That is, the real-time performance of USB interrupt transmission is limited by the granularity of one frame. Specifically, for full-speed USB, each frame interval is 1 ms, so the response time that interrupt transmission can guarantee is 1 ms; for high-speed USB, each microframe interval is 125 μs, and the bus interval of super-high-speed USB (USB 3.x and above) (Bus interval, which is equivalent to the Micro-frame of high-speed USB and will be collectively referred to as microframe in this article) is also 125 μs. Therefore, the response time that high-speed and super-high-speed USB interrupt transmission can guarantee is 125 μs. That is to say, if an interrupt data packet cannot be transmitted within the current microframe, it can only wait for the next microframe.
[0004] In the field of industrial control, a response time of 125 μs is not conducive to quickly and timely responding to external events and making corresponding processing in a timely manner; in the field of consumer electronics, a response time of 125 μs is equivalent to a data refresh rate of 8KHz, which is difficult to meet the data refresh requirements of 16 kHz or higher. Summary of the Invention
[0005] Object of the Invention: To solve the problems of relatively weak real-time performance and low refresh rate of USB data packet transmission in the prior art, the present invention provides a USB data packet transmission method and a USB transmission system.
[0006] Technical Solution: A USB data packet transmission method includes the following steps: The USB device - side chip defines N interrupt - upload endpoints for transmitting the target data stream, where N is a positive integer greater than or equal to 2, and at least N - 1 interrupt - upload endpoints are configured as notification - type interrupt - upload endpoints; The host - side module establishes N pipes; Each notification - type interrupt - upload endpoint of the USB device - side chip waits for a valid event to be activated. The valid events include that the endpoint data of this notification - type interrupt - upload endpoint is ready, and the endpoint data comes from the target data stream; After the valid event corresponding to a certain notification - type interrupt - upload endpoint is activated, this notification - type interrupt - upload endpoint sequentially executes through the pipe: sending an ERDY transaction packet to the host, receiving a request ACK transaction packet initiated by the host for uploading, returning a data packet to the host, and receiving an ACK transaction packet for the data packet from the host; The host - side module reassembles the data packets received through all pipes in order into the target data stream.
[0007] Further, the valid event is detecting that the endpoint data is ready at a specified time point within a micro - frame.
[0008] Further, a micro - frame is equally divided into N time periods, and the starting point of each time period starting from at least the second time period is the specified time point.
[0009] Further, each time period uniquely corresponds to an interrupt - upload endpoint, and each specified time point starting from the second time period uniquely corresponds to a notification - type interrupt - upload endpoint.
[0010] Further, the valid event is detecting in real - time a request for the device to upload data and that the endpoint data is ready.
[0011] Further, the host - side module reassembles the data packets received from all interrupt - upload endpoints into the target data stream according to the actual arrival order of each data packet.
[0012] Further, the host - side module reassembles the data packets received from all interrupt - upload endpoints into the target data stream according to the sequence of each time period within the micro - frame.
[0013] Further, among the N interrupt - upload endpoints, there is a non - notification - type interrupt - upload endpoint. At the beginning of a micro - frame, the non - notification - type interrupt - upload endpoint receives a request ACK transaction packet initiated by the host for uploading. If the data of the non - notification - type interrupt - upload endpoint is ready, it returns a data packet to the host and then receives an ACK transaction packet for the data packet from the host.
[0014] Further, after the pipes are established, the host - side module pre - sets at least two USB upload requests to the host transaction queue for each interrupt - upload endpoint, waiting for the USB device to upload data; After each interrupt upload endpoint processes an upload transaction, the host module rebuilds a USB upload request to the host transaction queue.
[0015] A USB transmission system comprises a USB device-side chip and a USB host-side module, wherein the USB device-side chip comprises N interrupt upload endpoints for transmitting a target data stream, N being a positive integer ≥ 2, wherein at least N-1 interrupt upload endpoints are configured as notification-type interrupt upload endpoints; the notification-type interrupt upload endpoints are used to sequentially execute, after a valid event is activated, the following steps are performed: sending an ERDY transaction packet to a host, receiving an ACK transaction packet of a request for upload initiated by the host, returning a data packet to the host, and receiving an ACK transaction packet of a response to the data packet by the host; the valid event comprises that the endpoint data of the notification-type interrupt upload endpoint is ready, and the endpoint data comes from the target data stream; The USB host module is a program product or a hardware module installed on the host, and is used to sequentially reassemble the data packets received from all interrupt upload endpoints into a target data stream.
[0016] Furthermore, the USB device-side chip also includes a USB microframe interval timer, which is used to determine a specified time point in each microframe and determine whether a valid event is activated at the specified time point.
[0017] Compared with the prior art, the USB data packet transmission method and USB transmission system provided by the present invention have at least the following beneficial effects: (1) Multiple event detection specified time points are set within a microframe of the ultra-high-speed USB to upload data packets regularly; breaking the one-to-one convention, N USB interrupt upload endpoints are used on the USB device side to upload real-time data of the same target data stream in time-sharing, and data from multiple USB pipes are sequentially aggregated into the same data stream on the USB host side, so that the response time guaranteed by USB interrupt transmission from a global perspective is shortened to 1 / N of the original response time (125μs), thereby increasing the data refresh rate by N times.
[0018] (2) Detect the device's request to upload data in real time, and asynchronously notify the USB host to transmit with an ERDY transaction packet; the response time of the USB interrupt transmission is determined by the interaction process and duration of the ultra-high-speed USB transaction packet and the data packet, thereby generally improving the real-time performance of the USB interrupt upload data packet to a few μs level.
[0019] (3) It inherits the reliability of conventional USB interrupt transmission and shortens the response time without occupying too much USB bus bandwidth.
[0020] (4) By relatively evenly distributing specified time points within a micro-frame, the effect of uniform transmission can be further achieved, which is especially suitable for some devices with periodic query characteristics, such as high-speed HID devices.
[0021] (5) The entire implementation method has a simple process. The target data stream does not need to be parsed during transmission, and the transmission data packets do not need to carry sequence numbers, enabling the effect of data transparent transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 It is a schematic diagram of the USB data packet transmission process in the first embodiment; Figure 2 It is a schematic diagram of the USB data packet transmission process in the second embodiment; Figure 3 It is a schematic diagram of the USB data packet transmission process in the third embodiment. DETAILED DESCRIPTION OF THE INVENTION
[0023] The present invention will be further explained and described below in conjunction with the accompanying drawings and specific embodiments.
[0024] First Embodiment:
[0025] A USB data packet transmission method, as Figure 1 shown, includes the following steps: The USB device-side chip defines N interrupt upload (IN) endpoints for transmitting the target data stream, where N is a positive integer ≥ 2, and at least N - 1 interrupt upload endpoints are configured as notification interrupt upload endpoints. For example, in this embodiment, there are 3 interrupt upload endpoints, and all three interrupt upload endpoints are notification interrupt upload endpoints; The host-side module establishes N pipes; after the pipes are established, the host-side module pre-arranges at least two USB upload requests for each interrupt upload endpoint to the host transaction queue, waiting for the USB device-side chip to upload an ERDY transaction packet; Each notification interrupt upload endpoint of the USB device-side chip waits for a valid event to be activated, and the valid event is detecting that the endpoint data is ready at a specified time point within the micro-frame, and the endpoint data comes from the target data stream; When the valid event corresponding to a certain notification interrupt upload endpoint is activated, this notification interrupt upload endpoint sequentially executes through the pipe: sending an ERDY transaction packet to the host, receiving the request ACK transaction packet (ACKTP) initiated by the host for upload, returning a data packet (DP) to the host, and receiving the ACK transaction packet for the reply of the data packet from the host; When each interrupt upload endpoint has processed an upload transaction, the host-side module reconstructs a USB upload request to the host transaction queue to maintain at least two USB upload requests for each interrupt upload endpoint stored in the host transaction queue.
[0026] The host end reorganizes the data packets received through all pipelines into the target data stream in sequence.
[0027] Preferably, the interrupt polling time interval of the USB interrupt upload endpoint is configured to the minimum value of 1. Preferably, the BELT is set to the minimum value allowed by the USB specification through the LTM packet to improve the response speed.
[0028] Preferably, the maximum packet length of each USB interrupt endpoint is set to the minimum value that meets the application requirements to improve the efficiency of the USB bus bandwidth.
[0029] As Figure 1 shown, from T0 to T0 + t represents a microframe. The microframe is equally divided into 3 time periods, and the starting point of each time period is the specified time point. As Figure 1 shown by the thick arrow on the left in, the specified time points are T0, T0 + 1 / 3*t, T0 + 2 / 3*t within this microframe, and T0 + t is the first specified time point of the next microframe. The actual specified time points can also be appropriately fine-tuned forward or backward or arbitrarily specified according to the characteristics that the front part of the bus bandwidth within the microframe is busier and the rear part is less busy, and they do not necessarily have a uniform distribution. At each specified time point, it is detected whether the endpoint data is ready. If the endpoint data is ready, the interrupt is activated. As Figure 1 shown, when it is detected that the interrupt data is ready at the second specified time point within this microframe, the subsequent interaction steps are executed between the USB device end chip and the host end module through the pipeline.
[0030] Theoretically, there is no need for a one-to-one correspondence between each specified time point and each interrupt upload endpoint. In FIG. 1, N USB interrupt upload endpoints each wait for a valid event to activate. Preferably, one time period uniquely corresponds to one USB interrupt upload endpoint. At a certain specified time point, if the data is ready, the ERDY transaction packet is sent by the USB interrupt upload endpoint corresponding to this specified time point, and the data packet is transmitted.
[0031] On the USB host side, through software or special hardware, the data packets received from all interrupt upload endpoints are reorganized into a target data stream in a fixed order according to each time period within a microframe. For example, the data packets of the interrupt upload endpoint corresponding to the first time period within the microframe are ranked first on the host side; the data packets of the interrupt upload endpoint corresponding to the second time period within the microframe are ranked second on the host side, but if there is no data at the endpoint corresponding to the first time period, they are ranked first on the host side. This reorganization scheme is more suitable for the case where each specified time point corresponds one-to-one to an interrupt upload endpoint. Or, the data packets received from all interrupt upload endpoints can also be directly reorganized into a target data stream according to the actual arrival order of each data packet. That is, the device side can dynamically allocate available endpoints instead of each specified time point matching a fixed interrupt upload endpoint. The host side does not need to care about which endpoint is specifically used for transmission. What is important is to upload in a timely manner.
[0032] For more precise timing, the USB device-side chip can locate multiple time periods based on the Synchronization Timestamp Packet (ITP) and correction parameters, or even the Packet Transmission Map (PTM).
[0033] A USB transmission system includes a USB device-side chip and a host-side module. The USB device-side chip includes N interrupt upload endpoints for transmitting a target data stream, where N is a positive integer greater than or equal to 2, and at least N - 1 interrupt upload endpoints are configured as notification-type interrupt upload endpoints. For example, in this embodiment, the USB device-side chip has three interrupt upload endpoints, and all of them are notification-type interrupt upload endpoints. The notification-type interrupt upload endpoints are used to sequentially execute the following after a valid event is activated: sending an ERDY transaction packet to the host, receiving a request ACK transaction packet initiated by the host for upload, returning a data packet to the host, and receiving an ACK transaction packet from the host for the data packet. The valid event includes that the endpoint data of the notification-type interrupt upload endpoint is ready, and the endpoint data comes from the target data stream. The USB host-side module is a program product or a hardware module installed on the host, and is used to reorganize the data packets received from all interrupt upload endpoints into a target data stream in order. The program product includes a computer program, and when the computer program is executed by the host processor, it can implement the above functions.
[0034] To accurately determine each specified time point and detect whether the endpoint data is ready at the specified time point, the USB device-side chip also needs to include a USB microframe interval timer for determining the specified time point within each microframe and judging whether a valid event is activated at the specified time point.
[0035] In the prior art, USB interrupt transfers have a relatively high bandwidth priority. After the start of each microframe (125 μs) of high-speed USB and super-high-speed USB, high-priority transfers such as USB interrupt transfers are preferentially arranged, and the remaining time within the microframe is used to arrange USB bulk transfers, etc. However, USB interrupt transfers can transfer at most one data packet within each microframe, and are usually concentrated at the head of the microframe interval. Therefore, the response time of USB interrupt transfers is limited by the duration of the microframe.
[0036] In this embodiment, 3 interrupt upload (IN) endpoints are set on the USB device-side chip, all configured as notification interrupt upload endpoints; each notification interrupt upload endpoint waits for a valid event to activate. When the corresponding valid event is activated, this notification interrupt upload endpoint issues an ERDY transaction packet, the host issues a request ACK transaction packet, this notification interrupt upload endpoint returns a data packet, and the host issues an ACK transaction packet for answering this data packet; on the USB host side, the data packets of each interrupt upload endpoint are aggregated into the same target data stream in sequence. In contrast, the conventional design is that one USB endpoint corresponds to one USB pipe, corresponding to a functional data stream; this embodiment breaks the convention. Hardware-wise, it includes multiple USB interrupt upload endpoints, logically establishes multiple USB pipes, and software-wise, on the USB host side, it aggregates the data of multiple USB pipes into the same target data stream. When a piece of real-time data is ready, if it misses a certain specified time point, then an asynchronous transfer of a USB interrupt upload endpoint will be triggered at the next specified time point, that is, the response time is the interval between two specified time points. For the case where the specified time points are evenly distributed within the microframe, the response time is equivalent to one Nth of the microframe duration.
[0037] Embodiment 2:
[0038] The difference between Embodiment 2 and Embodiment 1 is that among the three interrupt upload endpoints of the USB device-side chip in Embodiment 2, one is a non-notification interrupt upload endpoint and two are notification interrupt upload endpoints. As Figure 2As shown in the figure, at the start of the first time period of a micro-frame, it corresponds to a non-notification interrupt upload endpoint, and at the start of the second and third time periods, each corresponds to a notification interrupt upload endpoint. At the beginning of a micro-frame, the non-notification interrupt upload endpoint receives the request ACK transaction packet initiated by the host for uploading. If the data of the non-notification interrupt upload endpoint is ready, it returns a data packet to the host and then receives the ACK transaction packet of the host's response to the data packet. If the data of the non-notification interrupt upload endpoint is not ready, it can return a transaction packet to the host, containing information indicating no data, which can be pre-agreed with the host (such as a zero-length packet), or send an NRDY transaction packet to the host, but an ERDY transaction packet needs to be sent in time subsequently to resume. That is to say, the endpoint corresponding to the start of the first time period among the N time periods in the micro-frame can either be a notification interrupt upload endpoint initiated asynchronously by the device or a traditional non-notification interrupt upload endpoint initiated actively by the host after the start of a new micro-frame, because the non-notification interrupt upload endpoint is default to be concentrated in the head time of the micro-frame interval for transmission.
[0039] At the start of the third time period T0 + 2 / 3*t, when it is detected that the endpoint data is ready, the notification interrupt upload endpoint sends an ERDY transaction packet to the host. The host initiates the upload through the request ACK transaction packet, and this endpoint returns a data packet, and the host issues an ACK transaction packet for the response to this data packet.
[0040] From Figure 2 it can be seen that the second and third time periods occupy one more ERDY time than the first time period, so the actual specified time points can also be appropriately adjusted forward or backward to offset such differences.
[0041] Embodiment 3:
[0042] The difference between Embodiment 3 and Embodiment 1 or Embodiment 2 is that in Embodiment 3, no fixed time point is specified for detection, but when a request for the device to upload data is detected in real time and the endpoint data is ready, the interrupt is activated. As Figure 3 shown in the figure, at T1 and T2, when a request for the device to upload data is detected and the endpoint data is ready, at this time, the notification interrupt upload endpoint sends an ERDY transaction packet to the host. The host issues a request ACK transaction packet, and this endpoint returns a data packet, and the host issues an ACK transaction packet for the response to this data packet.
[0043] The advantage of this embodiment is that the data is sent as it arrives, with stronger real-time performance; the disadvantage is that a sufficient number of endpoints are required to ensure the real-time performance of the next adjacent data, otherwise there will be no available endpoints for the next data. If the data is sporadic and does not occur adjacent to each other, then the method of this embodiment is more applicable.
Claims
1. A USB data packet transmission method, characterized in that: The following steps are involved: The USB device chip defines N interrupt upload endpoints for transmitting target data streams, where N is a positive integer ≥ 2, and at least N-1 interrupt upload endpoints are configured as notification interrupt upload endpoints; The host-side module establishes N pipelines; Each notification type interrupt upload endpoint of the USB device end chip waits for a valid event to be activated, wherein the valid event includes that the endpoint data of the notification type interrupt upload endpoint is ready, and the endpoint data comes from the target data stream; When a valid event corresponding to a notification-type interrupt upload endpoint is activated, the notification-type interrupt upload endpoint executes in sequence through the pipeline: sending an ERDY transaction packet to the host, receiving an ACK transaction packet of a request for upload initiated by the host, returning a data packet to the host, and receiving an ACK transaction packet of a response to the data packet from the host; The host module reassembles the data packets received through all pipelines into the target data stream in sequence.
2. The USB data packet transmission method according to claim 1, characterized in that: The valid event is detecting that endpoint data is ready at a specified time point within a microframe.
3. The USB data packet transmission method according to claim 2, characterized in that: A microframe is equally divided into N time periods, and the starting point of each time period starting from at least the second time period is the designated time point.
4. The USB data packet transmission method according to claim 3, characterized in that: Each time period uniquely corresponds to an interrupt upload endpoint, and each designated time point starting from the second time period uniquely corresponds to a notification-type interrupt upload endpoint.
5. The USB data packet transmission method according to claim 1, characterized in that: The valid event is that a request for the device to upload data is detected in real time and the endpoint data is ready.
6. The USB data packet transmission method according to any one of claims 1 to 5, characterized in that: The host-side module reassembles the data packets received from all interrupt upload endpoints into a target data stream according to the actual arrival order of each data packet.
7. The USB data packet transmission method according to claim 4, characterized in that: The host module reassembles the data packets received from all interrupt upload endpoints into the target data stream according to the sequence of each time period in the microframe.
8. The USB data packet transmission method according to any one of claims 1 to 5, characterized in that: The N interrupt upload endpoints include a non-notification interrupt upload endpoint. At the beginning of a microframe, the non-notification interrupt upload endpoint receives the request ACK transaction packet initiated by the host for upload. If the data of the non-notification interrupt upload endpoint is ready, it returns a data packet to the host and then receives the host's response ACK transaction packet to the data packet.
9. The USB data packet transmission method according to any one of claims 1 to 5, characterized in that: After the pipeline is established, the host module presets at least two USB upload requests for each interrupt upload endpoint to the host transaction queue, waiting for the USB device to upload data; After each interrupt upload endpoint processes an upload transaction, the host module rebuilds a USB upload request to the host transaction queue.
10. A USB transmission system, characterized in that: It includes a USB device-side chip and a USB host-side module, wherein the USB device-side chip includes N interrupt upload endpoints for transmitting a target data stream, where N is a positive integer ≥ 2, and at least N-1 interrupt upload endpoints are configured as notification-type interrupt upload endpoints; The notification-type interrupt upload endpoint is used to execute in sequence after a valid event is activated: sending an ERDY transaction packet to the host, receiving an ACK transaction packet of a request for upload initiated by the host, returning a data packet to the host, and receiving an ACK transaction packet of a response to the data packet from the host; the valid event includes that the endpoint data of the notification-type interrupt upload endpoint is ready, and the endpoint data comes from a target data stream; The USB host module is a program product or a hardware module installed on the host, and is used to sequentially reassemble the data packets received from all interrupt upload endpoints into a target data stream.
11. The USB transmission system according to claim 10, characterized in that: The USB device chip also includes a USB microframe interval timer, which is used to determine a specified time point in each microframe and determine whether a valid event is activated at the specified time point.
Citation Information
Patent Citations
Universal serial bus (USB) host controller and control method for same
CN101673255A
System and method for improving direct memory access (DMA) efficiency of multi-data buffer
CN102541779A
Real-time and efficient USB data transmission method
CN111813727A
Virtual transmission method based on multiple USB interrupt endpoints
CN112261117A
Device and method for carrying out transmission via universal serial bus channel
CN1885747A
Cited By
HID data uploading system and method thereof
CN122340145A