Combined communication equipment based on USB batch transmission and data distribution method

By adopting a multi-device data shunt processing method based on the USB batch transmission protocol on a single USB physical device, the RNDIS network card function and the USB batch transmission function are configured as two interfaces, and data shunt processing is performed in a single USB computer, the problem of simultaneously realizing network and USB batch data transmission in a single USB device is solved, and the multifunctionality and efficiency of the device are realized.

CN119782225APending Publication Date: 2025-04-08BEIJING INST OF COMP TECH & APPL
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411808233.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

The prior art is difficult to realize network and USB batch data transmission simultaneously in a single USB physical device, resulting in the need to simultaneously use network communication and USB data read and write functions on the same device.

Method used

The multi-device data shunt processing method based on the USB batch transmission protocol is adopted. By configuring the RNDIS network card function and the USB batch transmission function in the descriptor, the endpoint of the device is retrieved in the microcontroller according to the USB data interrupt type, thereby realizing the shunt processing of the host direction and device direction data.

Benefits of technology

It realizes the ability to simultaneously have network communication and USB data reading and writing capabilities on a single USB physical device, meeting the need to simultaneously use network communication and USB data reading and writing functions on the same device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119782225A_ABST
    Figure CN119782225A_ABST
Patent Text Reader

Abstract

The invention relates to combined communication equipment based on USB batch transmission and a data distribution method, and belongs to the technical field of network communication. Combination device descriptors are configured based on a USB batch transport protocol, and shunting processing is carried out on the data of each functional device in the single-chip microcomputer, so that the USB combination device has network communication capability and USB data read-write capability at the same time, and the requirement that the two functions are used at the same time on the same device is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of network communication, and in particular relates to a combined communication device based on USB batch transmission and a data distribution method. Background Art

[0002] In most scenarios, USB devices usually only implement the functions of a single device, such as a keyboard, mouse, or storage device. However, in embedded systems, with the diversification of functional requirements, it is becoming more and more common for a single USB interface to carry more functions. USB combination devices can reduce hardware costs, improve the versatility and efficiency of devices, and simplify the user experience, but they increase the difficulty in design, development, and maintenance costs. Summary of the invention

[0003] 1. Technical issues to be resolved

[0004] The technical problem to be solved by the present invention is: in order to realize simultaneous network and USB bulk data transmission in a single USB physical device, the present invention implements a multi-device data diversion processing method based on the USB bulk transfer protocol, so that the USB combination device has both network communication capability and USB data reading and writing capability, meeting the demand for simultaneous use of the above two functions on the same device.

[0005] (II) Technical solution

[0006] In order to solve the above technical problems, the present invention provides a method for shunting USB data and network data based on a USB bulk transfer protocol. The method is implemented based on the USB protocol. The RNDIS network card function and the USB bulk transfer function are configured as two interfaces in the descriptor. The host operating system is registered as an RNDIS network card device and a USB read-write device during the USB enumeration process to implement data channel usage isolation for users. The RNDIS network card device and the USB read-write device are usable virtual devices registered for users in the host operating system. The single-chip microcomputer is a physical device inserted into the host with a USB interface. The endpoint of the corresponding device is retrieved in the single-chip microcomputer according to the USB data interrupt type, thereby shunting data in the host direction and the device direction. The host direction is the direction sent by the host to the single-chip microcomputer, and the device direction is the direction sent by the single-chip microcomputer to the host.

[0007] The present invention also provides a combined communication device based on USB batch transmission, and the device is used to implement the method described.

[0008] (III) Beneficial effects

[0009] The present invention provides a communication method for shunting USB data and network data based on a USB bulk transfer protocol. A combined device descriptor is configured based on the USB bulk transfer protocol, and the data of each functional device is shunted in a single-chip microcomputer, so that the USB combined device has both network communication capability and USB data reading and writing capability, meeting the requirement of using the above two functions simultaneously on the same device. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] Figure 1 This is a schematic diagram of the configuration descriptor structure;

[0011] Figure 2 Flowchart of the registration process for USB combination devices;

[0012] Figure 3 This is a schematic diagram of the data diversion process within the microcontroller. DETAILED DESCRIPTION

[0013] In order to make the purpose, content and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below in conjunction with the drawings and examples.

[0014] In the USB protocol, by configuring the descriptor, a combination device can be realized, that is, multiple USB protocol-based functions can be used simultaneously on a USB device. In order to realize simultaneous network and USB bulk data transmission in a single USB physical device, the present invention implements a multi-device data shunting processing method based on the USB bulk transfer protocol, so that the USB combination device has both network communication capabilities and USB data reading and writing capabilities, meeting the demand for using the above two functions simultaneously on the same device.

[0015] With the development of communication technology, USB interfaces are widely used, and integrated and multifunctional USB devices are constantly emerging. Multifunctional USB devices are usually realized by connecting different types of devices through a single or multiple USB controllers. One is a composite device and the other is a combined device. The use of composite devices is the same as developing two different types of USB devices, and the development difficulty is relatively low. It is similar to the device formed by multiple single-function USB devices through a USB HUB, which has multiple device addresses and design redundancy. A USB combined device refers to a USB device with multiple interfaces that are independent of each other. A device uses a USB control chip and has only one device address. Each functional module in the device corresponds to a different interface. By controlling different interfaces to communicate with different functional modules, the problem of distinguishing the data flow of each functional module in the host and the combined device can be solved.

[0016] 1. Solution design

[0017] The present invention provides a communication method for shunting USB data and network data based on the USB bulk transfer protocol. Based on the USB protocol, there is no need to develop a device driver. In the descriptor, the RNDIS network card function and the USB bulk transfer function are configured as two interfaces. The host (i.e., host) operating system is registered as the RNDIS network card device and the USB read-write device during the USB enumeration process, so as to implement the isolation of the use of data channels for users. The RNDIS network card function and the USB read-write device are virtual devices that can be registered for users in the host operating system, and the single-chip microcomputer is a physical device inserted into the host with a USB interface. In the single-chip microcomputer, the endpoint of the corresponding device is retrieved according to the USB data interrupt type, so as to perform shunting processing on the data in the host direction and the device direction. The host direction is the direction sent by the host to the single-chip microcomputer, and the device direction is the direction sent by the single-chip microcomputer to the host. The above processing can realize the RNDIS network card device function and the USB data read-write function with the same USB device (the USB device is a physical device single-chip microcomputer, referring to the RNDIS network card identification and the USB read-write device, both of which perform data shunting through the physical device), which is simple and easy for users to use.

[0018] 2. Specific implementation

[0019] (1) Complete USB device enumeration by configuring the USB descriptor, and configure the RNDIS network card function and USB bulk transfer function as two interfaces in the descriptor;

[0020] First, you need to define the configuration descriptor of the USB protocol. A total of five USB endpoints are used, of which one control endpoint is used for USB default control transmission, one pair of bulk transfer endpoints are used for data transmission in the host direction and device direction of the RNDIS network card device, and another pair of bulk transfer endpoints are used for data transmission in the host direction and device direction of the USB read-write device. Correspondingly, three interfaces are registered in the configuration descriptor. Among the three interfaces, in addition to the default control transmission interface, two bulk transfer interfaces are used for RNDIS network card device data transmission and USB data transmission, respectively, which are specified by the interface type in the interface descriptor. Since the serial number (address) of each USB endpoint is unique, the correspondence between the device type and the device data transmission direction and the endpoint serial number can be clearly defined.

[0021] After the USB device microcontroller is connected to the host USB bus and the hardware module is initialized, the USB enumeration process is executed by the USB bus protocol, the USB device registration is completed on the host side, and then the RNDIS protocol completes the registration of the RNDIS network card device (i.e., network card adapter); after the device registration is completed, the user can use the RNDIS network card device for normal network communication and read and write data to the USB device endpoint at the same time, and the two data transmission channels do not interfere with each other.

[0022] (2) Data diversion process

[0023] After enumerating and registering the combined device of the RNDIS network card device and the USB read / write device in (1), since the two devices share the same USB device bus address, it is necessary to divert the data in the microcontroller. The data in both directions are diverted according to the data transmission device (RNDIS network card device and USB read / write device) and the corresponding endpoint allocation in the configuration descriptor.

[0024] Host direction:

[0025] When data sent by the host arrives, the USB control chip in the microcontroller generates an interrupt, distinguishes the data packets arriving at different endpoints according to the interrupt value, and then further processes the data packets according to the endpoint type. The data packets arriving at the corresponding endpoint of the RNDIS device are converted into the protocol format and then moved to the network card module for processing by DMA; similarly, the data packets arriving at the corresponding endpoint of the USB bulk transfer device are converted into the protocol format and then moved to the USB peripheral module by DMA for further processing.

[0026] Device Orientation:

[0027] The single-chip microcomputer polls the data buffer flags of the network card module and the USB peripheral module respectively, and when a new data packet arrives, the flag changes.

[0028] For the data packets of the network card module, they are first encapsulated as data into the RNDIS protocol, and then moved to the device direction endpoint corresponding to the RNDIS network card device using DMA, and then transmitted to the kernel driver of the RNDIS device and USB device in the host operating system by the USB bus protocol for data processing.

[0029] The USB module data packet processing flow is similar.

[0030] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for splitting USB data and network data based on USB bulk transfer protocol, characterized in that: The method is implemented based on the USB protocol. The RNDIS network card function and the USB bulk transfer function are configured as two interfaces in the descriptor. The host operating system is registered as the RNDIS network card device and the USB read-write device during the USB enumeration process to implement data channel isolation for users. The RNDIS network card device and the USB read-write device are usable virtual devices registered for users in the host operating system. The single-chip microcomputer is a physical device inserted into the host with a USB interface. The endpoint of the corresponding device is retrieved in the single-chip microcomputer according to the USB data interrupt type, so as to perform shunting processing on the host direction and the device direction. The host direction is the direction sent by the host to the single-chip microcomputer, and the device direction is the direction sent by the single-chip microcomputer to the host.

2. The method according to claim 1, characterized in that The USB device enumeration and registration are completed by configuring the USB descriptor, and the RNDIS network card function and the USB bulk transfer function are configured as two interfaces in the descriptor.

3. The method according to claim 2, characterized in that The USB device enumeration and registration are completed by configuring the USB descriptor, and the method for configuring the RNDIS network card function and the USB bulk transfer function as two interfaces in the descriptor is as follows: first, the configuration descriptor of the USB protocol is defined, and a total of five USB endpoints are defined, among which one control endpoint is used for USB default control transmission, and a pair of bulk transfer endpoints are used for data transmission in the host direction and device direction of the RNDIS network card device respectively; another pair of bulk transfer endpoints are used for data transmission in the host direction and device direction of the USB read-write device respectively; accordingly, three interfaces are registered in the configuration descriptor, among which, in addition to the default control transmission interface, the two bulk transfer interfaces are used for RNDIS network card device data transmission and USB data transmission respectively, which are specified by the interface type in the interface descriptor; the serial number of each USB endpoint is unique, so the correspondence between the device type and the device data transmission direction and the endpoint serial number can be clearly defined.

4. The method according to claim 3, characterized in that After the MCU is connected to the host USB bus and the hardware module is initialized, the USB bus protocol executes the USB enumeration process, completes the registration of the USB device on the host side, and then completes the RNDIS network card device registration by the RNDIS protocol; After registration is completed, the user can use the RNDIS network card device for normal network communication and read and write data to the USB device endpoint at the same time. The two data transmission channels do not interfere with each other.

5. The method according to claim 3, characterized in that After completing the USB device enumeration and registration, since the RNDIS network card device and the USB read-write device share the same USB device bus address, the data is diverted in the microcontroller. Data in both directions is diverted according to the RNDIS network card device and USB read-write device in the configuration descriptor and the corresponding endpoint allocation.

6. The method according to claim 5, characterized in that The process of data diversion in the host direction within the MCU is as follows: When data sent by the host arrives, the USB control chip in the microcontroller generates an interrupt and distinguishes the data packets arriving at different endpoints based on the interrupt value; the data packets are further processed according to the endpoint type, and the data packets arriving at the corresponding endpoint of the RNDIS device are converted into a protocol format and then moved to the network card module for processing by DMA; similarly, the data packets arriving at the corresponding endpoint of the USB bulk transfer device are converted into a protocol format and then moved to the USB peripheral module by DMA for further processing.

7. The method according to claim 6, characterized in that The process of data diversion in the device direction within the MCU is as follows: The single-chip microcomputer polls the data buffer flags of the network card module and the USB peripheral module respectively. When a new data packet arrives, the flag changes. For the data packet of the network card module, it is first encapsulated into the RNDIS protocol as data, and then moved to the device direction endpoint corresponding to the RNDIS network card device using DMA, and then transmitted to the kernel driver of the RNDIS device and USB device in the host operating system by the USB bus protocol for data processing.

8. The method according to any one of claims 1 to 7, characterized in that The method realizes the RNDIS network card device function and the USB data reading and writing function by using the same USB device, namely the single chip microcomputer.

9. A combined communication device based on USB bulk transfer, characterized in that: The device is used to implement the method according to any one of claims 1 to 7.

10. The device according to claim 8, characterized in that The combined communication device includes an RNDIS network card device and a USB reading and writing device.

Citation Information

Cited By

  • Data transmission method, electronic equipment and computer readable medium

    CN120186174A