WO2022188658A1 - Method and circuit for multiplexing usb interface, and electronic device and storage medium - Google Patents

Method and circuit for multiplexing usb interface, and electronic device and storage medium Download PDF

Info

Publication number
WO2022188658A1
WO2022188658A1 PCT/CN2022/078510 CN2022078510W WO2022188658A1 WO 2022188658 A1 WO2022188658 A1 WO 2022188658A1 CN 2022078510 W CN2022078510 W CN 2022078510W WO 2022188658 A1 WO2022188658 A1 WO 2022188658A1
Authority
WO
WIPO (PCT)
Prior art keywords
usb interface
signal
usb
data
transmission object
Prior art date
Application number
PCT/CN2022/078510
Other languages
French (fr)
Chinese (zh)
Inventor
常哲
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Priority to EP22766184.0A priority Critical patent/EP4261699A4/en
Priority to US18/272,359 priority patent/US20240078208A1/en
Priority to JP2023540749A priority patent/JP2024508592A/en
Publication of WO2022188658A1 publication Critical patent/WO2022188658A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/382Information transfer, e.g. on bus using universal interface adapter
    • G06F13/385Information transfer, e.g. on bus using universal interface adapter for adaptation of a particular data processing system to different peripheral devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4004Coupling between buses
    • G06F13/4022Coupling between buses using switching circuits, e.g. switching matrix, connection or expansion network
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4063Device-to-bus coupling
    • G06F13/4068Electrical coupling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0042Universal serial bus [USB]

Definitions

  • the embodiments of the present application relate to the field of communication technologies, and in particular, to a multiplexing method, circuit, electronic device and storage medium of a USB interface.
  • the processor in the terminal has been gradually upgraded from a single core.
  • multi-core such as from a modem (modem) to a microcontroller unit (Microcontroller Unit, MCU) + modem, access point (Access Point, AP) + modem and so on.
  • Each processor in the multiprocessor has its own function, and each processor has its own interface for debugging and data communication, such as Universal Serial Bus (Universal Serial Bus, USB) interface, Universal Asynchronous Receiver Transmitter (Universal Asynchronous Receiver/Transmitter, UART) interface and SPI serial peripheral interface (Serial Peripheral Interface, SPI), etc.
  • Universal Serial Bus Universal Serial Bus, USB
  • Universal Asynchronous Receiver Transmitter Universal Asynchronous Receiver/Transmitter, UART
  • SPI serial peripheral interface Serial Peripheral Interface, SPI
  • each processor has its own processor interface for debugging and data communication, or, there is one processor in the terminal and the processor includes at least two processor interfaces, therefore,
  • the terminal needs to set up multiple interfaces for the access of peripheral devices, and respectively transmit the data for debugging and communication to the port of the corresponding processor, so as to realize the debugging and data communication of the processor.
  • each processor has a port for debugging and communication, such as UART interface + USB interface.
  • the terminal product should be designed with at least 4 interfaces for peripherals to connect to the processor port.
  • USB interfaces Data for debugging and communication is transmitted, and the interface forms for peripheral access include standard USB interfaces, debugging connectors, test points, etc., which are relatively complex.
  • some products need to design a debug board separately, and need to perform destructive operations such as disassembly during later debugging or troubleshooting, which makes some products need to design dual USB interfaces for peripheral access or sacrifice functions to design only a single USB interface. for peripheral access.
  • An embodiment of the present application provides a method for multiplexing a USB interface, where the electronic device to which the USB interface belongs includes multiple ports of a processor, or includes multiple processors, and each of the processors includes at least one
  • the method includes: acquiring at least one level signal in the USB interface except the service data signal and the ground signal; The target port of the target processor corresponding to the result is used as the transmission object of the USB interface; wherein, the corresponding relationship includes the logical result of the at least one level signal uniquely corresponding to each port of each processor; through the USB interface
  • the received data is transmitted to the transmission object, and the data to be sent of the transmission object is sent through the USB interface.
  • the embodiment of the present application also proposes a multiplexing circuit for a USB interface, including: a USB interface for transmitting signals; a decoder for acquiring at least one level of the USB interface except the service data signal and the ground signal signal; according to the logic result of the at least one level signal and the predefined correspondence, determine the target port of the target processor corresponding to the logic result as the transmission object of the USB interface; wherein, the correspondence includes The logical result of the at least one level signal uniquely corresponding to each port of each processor; a multi-way switch, used to select the transmission channel between the USB interface and the transmission object, so that the USB interface can The received data is transmitted to the transmission object, and the data to be sent of the transmission object is sent through the USB interface.
  • the embodiment of the present application also provides an electronic device, the device includes the above-mentioned multiplexing circuit of the USB interface.
  • An embodiment of the present application further provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the above-mentioned method for multiplexing a USB interface is implemented.
  • FIG. 1 is a flowchart of a method for multiplexing a USB interface provided by a first embodiment of the present application
  • FIG. 2 is a flowchart of a multiplexing method for a USB interface provided by a second embodiment of the present application
  • FIG. 3 is a flowchart of a method for multiplexing a USB interface provided by a third embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a multiplexing circuit of a USB interface provided by a fourth embodiment of the present application.
  • FIG. 5 is an application schematic diagram 1 of the multiplexing circuit of the USB interface provided by the fourth embodiment of the present application shown in FIG. 4;
  • FIG. 6 is a second application schematic diagram of the multiplexing circuit of the USB interface provided by the fourth embodiment of the present application shown in FIG. 4;
  • FIG. 7 is a schematic structural diagram of an electronic device provided by a fifth embodiment of the present application.
  • the main purpose of the embodiments of the present application is to propose a USB interface multiplexing method, circuit, electronic device and storage medium, aiming at realizing USB interface multiplexing in a multiprocessor terminal, so that no test points and debugging connectors are required. It uses only one standard USB interface to transmit data to different types of ports of multiple processors to realize functions such as data communication and debugging, which is very conducive to the simplified design and function expansion of product interfaces. And the later debugging and troubleshooting of the whole machine.
  • the first embodiment of the present application relates to a method for multiplexing a USB interface, which is applied in an electronic device to realize that a USB interface is multiplexed to multiple ports of a processor included in the electronic device, or multiple processors.
  • Each port of the device transmits data
  • the electronic devices here can be wireless terminal devices such as Tracker and CPE, as shown in Figure 1, including:
  • Step 101 Acquire at least one level signal in the USB interface except the service data signal and the ground signal.
  • the pins USB_DP and the pins USB_DM are used to transmit service data, and the signals provided by the pins USB_DP and the pins USB_DM are called service data signals; GND is used for grounding, and the signal provided by the pin GND is a grounding signal. Since the service data signal and the ground signal in the USB interface cannot be adjusted at will during the communication process, only the signals other than the service data signal and the ground signal of the USB interface can be selected for subsequent selection of the processor port. That is, a level signal provided by at least one different pin of the USB interface except the pin USB_DP, the pin USB_DM and the pin GND is obtained.
  • the signals provided by the USB interface include a service data signal, a ground signal, a USB_VBUS signal and a USB_ID signal.
  • the level signal obtained at this time is the USB_VBUS signal and/or the USB_ID signal.
  • the signals provided by the USB interface include the signal for transmitting service data, the ground signal, the USB_VBUS signal, the SBU1 signal, the SBU2 signal, the CC1 signal, the CC2 signal and the USB_ID signal, etc., and the USB_VBIS signal is obtained.
  • SBU1 signal, SBU2 signal, CC1 signal, CC2 signal any signal or signal combination, such as acquiring CC1 signal, or acquiring CC1 signal and SBU2 signal, or acquiring CC1 signal, USB_VBIS signal and CC2 signal.
  • the above is only a specific example, and in actual use, it may also include at least one signal other than the signal for transmitting service data and the ground signal in other types of USB interfaces, which will not be repeated here.
  • the method further includes: setting the high and low level states of at least one level signal according to the requirements.
  • a control switch can be designed to control the level state of the level signal in the USB port.
  • the above description of the signals is named in terms of pins, for example, the CC2 signal is a signal provided by the CC2 pin of the USB interface.
  • Step 102 according to the logic result of at least one level signal and the predefined correspondence, determine the target port of the target processor corresponding to the logic result as the transmission object of the USB interface; wherein, the correspondence includes that each port of each processor is unique The logical result of the corresponding at least one level signal.
  • the ports of the processor include a USB interface, a UART interface, an I2C interface, an SPI interface, and the like.
  • the processor interface may also include other interfaces that can be transmitted by the USB interface after the transmitted service data is converted, which will not be repeated here.
  • the correspondence defines a one-to-one correspondence between each port of each processor and various possible logics of at least one level signal, for example: the logic of the USB1 port of processor 1 corresponding to the CC1 signal Represents 0, and the logical representation of the CC1 signal corresponding to the USB2 port of the processor 1 is 1. Assuming that the logical representation of the level signal of the CC1 signal obtained after step 101 is 0, the transmission object is uniquely determined to be the USB1 port of the processor 1 according to the corresponding relationship.
  • the logical result refers to the logical combination result of multiple level signals, such as the logical combination 00 of the two-channel level signals corresponding to the USB port of the processor 1, and the universal asynchronous transceiver transmission of the processor 1
  • the logic combination 01 of the two-way level signal corresponding to the Universal Asynchronous Receiver/Transmitter (UART) interface and the logic combination 11 of the two-way level signal corresponding to the USB port of the processor 2, etc. assume that the step 101 is executed to obtain the two-way level signal signal and its logical combination result is 00, then according to the corresponding relationship, it is uniquely determined that the transmission object is the USB port of processor 1.
  • the total number of ports of the processor is not greater than the total number of various possible logical results of at least one level signal.
  • step 103 the received data is transmitted to the transmission object through the USB interface, and the data to be sent of the transmission object is sent through the USB interface.
  • a data transmission path is established between the USB interface and the transmission object, and the peripheral device sequentially sends the data in the peripheral device to the USB interface, the data transmission path and the transmission object.
  • the target processor then performs corresponding processing on the received data, and sends the processing result as the data to be sent to the peripheral through the transmission object, the data transmission path and the USB interface in turn.
  • the embodiment proposed in the present application can obtain at least one level signal except the service data signal and the ground signal in the USB interface, and then can use the logical combination result of the at least one level signal, so that the The logical result of the at least one level signal and the logical result of the at least one level signal uniquely corresponding to each port of each processor, and a target port of a target processor is selected from the various ports of all processors as the USB interface Therefore, the received data can be transmitted to the transmission object through the USB interface, and the to-be-sent data of the transmission object can be transmitted through the USB interface.
  • the second embodiment of the present application relates to a method for multiplexing a USB interface.
  • the to-be-sent data of the transmission object is sent through the USB interface , and also detects whether the transmission object adopts a two-wire serial bus, as shown in Figure 2, including:
  • Step 201 Acquire at least one level signal in the USB interface except the service data signal and the ground signal.
  • step 201 in this embodiment is substantially the same as step 101 in the first embodiment, and details are not repeated here.
  • Step 202 determine the target port of the target processor corresponding to the logical result as the transmission object of the USB interface; wherein, the correspondence includes that each port of each processor is unique The logical result of the corresponding at least one level signal.
  • step 202 in this embodiment is substantially the same as step 102 in the first embodiment, and details are not repeated here.
  • Step 203 detecting whether the transmission object adopts a two-wire serial bus, if yes, go to Step 204 , if not, go to Step 205 .
  • the type of the interface indicates the form of the bus used by the interface.
  • the SPI interface adopts a four-wire serial bus
  • the two-wire UART interface adopts a two-wire serial bus. Therefore, detecting whether the transmission object adopts a two-wire serial bus can be realized by detecting the interface type of the transmission object.
  • Step 204 Adjust the received data to a form that can be received by the transmission object, and adjust the data to be sent to a form that can be received by the USB interface.
  • the two-wire serial bus transmits 2 channels of data at a time
  • the four-wire serial bus transmits 4 channels of data at a time
  • data processing is required to send and receive data between two interfaces using different types of serial buses normally.
  • a bridge chip to process the stored data, such as , convert the data sent by the USB interface into a form that can be received by the SPI interface through the USB to SPI bridge chip.
  • step 205 the received data is transmitted to the transmission object through the USB interface, and the data to be sent of the transmission object is sent through the USB interface.
  • the received and adjusted data is transmitted to the transmission object through the USB interface, and the adjusted data to be sent of the transmission object is sent through the USB interface .
  • the transmission object and the USB interface use the same type of serial bus, the received data is directly transmitted to the transmission object through the USB interface, and the to-be-sent data of the transmission object is directly sent through the USB interface.
  • the embodiment of the present application can detect whether direct communication is possible between the USB interface and the transmission object. Adjust the received data into a form that can be received by the transmission object, and adjust the data to be sent into a form that can be received by the USB interface, so that when data transmission is performed between interfaces using different types of serial buses, the sender's data is converted. It is the data that can be received by the receiver, so that the data can be transmitted normally, avoid data transmission errors caused by the mismatch between the USB interface and the transmission object, and improve the accuracy of data transmission.
  • the third embodiment of the present application relates to a method for multiplexing a USB interface. After the received data is transmitted to the transmission object through the USB interface, and the to-be-sent data of the transmission object is sent through the USB interface, the transmission can also be switched.
  • Objects as shown in Figure 3, include:
  • Step 301 Acquire at least one level signal in the USB interface except the service data signal and the ground signal.
  • step 301 in this embodiment is substantially the same as step 101 in the first embodiment, and details are not repeated here.
  • Step 302 Determine the target port of the target processor corresponding to the logic result as the transmission object of the USB interface according to the logical result of at least one level signal and the predefined corresponding relationship; wherein, the corresponding relationship includes that each port of each processor is unique The logical result of the corresponding at least one level signal.
  • step 302 in this embodiment is substantially the same as step 102 in the first embodiment, and details are not repeated here.
  • step 303 the received data is transmitted to the transmission object through the USB interface, and the data to be sent of the transmission object is sent through the USB interface.
  • step 303 in this embodiment is substantially the same as step 103 in the first embodiment, and details are not repeated here.
  • Step 304 if it is detected that the high and low level states of the level signal change, re-execute the USB interface multiplexing method according to the changed level signal.
  • the high and low level states of the level signal uniquely determine the logical result of at least one level signal, and then uniquely determine the transmission object according to the corresponding relationship, once the high and low level states of the level signal change, that is, Indicates that the only identified transfer object has changed.
  • the high and low level states of at least one level signal obtained in step 301 can be detected in real time or periodically, and when any level signal of at least one level signal changes, the USB interface multiplexing method is re-executed, Thereby, the transmission object is re-determined, and the switching of the transmission object is realized.
  • the debugging of the processor in the terminal and the switching of the communication port, or the switching between different processors can be controlled by the multiplexing method of the USB interface provided in this embodiment, without the need to replace the USB interface, so that the USB port can be connected between each processor and the processor.
  • the smooth switching between processor ports reduces the waste of resources such as manpower and time, and improves the efficiency of data transmission and debugging.
  • the embodiment of the present application can re-execute the USB interface multiplexing method when any one of the at least one level signal changes on the basis of realizing the beneficial effects brought by the first embodiment. , so as to re-determine the transmission object and realize the switching of the transmission object.
  • the user can control the debugging of the processor in the terminal and the switching of the communication port, or switch between different processors by resetting the high and low level states of the level signal, without changing the USB interface, realizing the USB port.
  • the smooth switching between processors and processor ports reduces the waste of resources such as manpower and time, and improves the efficiency of data transmission and debugging.
  • the fourth embodiment of the present application relates to a multiplexing circuit of a USB interface, as shown in FIG. 4 , including:
  • the USB interface 401 is used to transmit signals.
  • the decoder 402 is used to obtain at least one level signal except the service data signal and the ground signal in the USB interface; according to the logic result of the at least one level signal and the predefined correspondence, determine the target corresponding to the logic result
  • the target port of the processor is used as the transmission object of the USB interface; wherein, the corresponding relationship includes the logical result of at least one level signal uniquely corresponding to each port of each processor.
  • the pins of the USB interface include a pin USB_DP, a pin USB_DM, a USB_ID pin, a USB_VBUS pin and a USB_ID pin.
  • the electronic device to which the USB interface 401 belongs includes two processors and each processor includes two ports, and as shown in FIG. 5 , the processors are AP1 and AP2 respectively, and the ports of AP1 include the AP1 USB port and the AP1 UART port, The ports of the AP2 include the AP2 USB port and the AP2 UART port, and the decoder 402 can select a 2-4 decoder.
  • the pins USB_DP, USB_DM and USB_ID in the USB interface are normally used, and the level signals provided by the USB_VBUS and USB_ID pins are used as the input of the decoder 402 (equivalent to at least one level signal). the logical result), and then the decoder 402 outputs a control signal after decoding to control the strobe state of the multiplexer 403, wherein, as shown in FIG. 5, the circuits where each switch of the multiplexer 403 is located are connected If different processor ports are connected, according to the connection relationship shown in Figure 5, the corresponding relationship represented by the logical combination result of at least one level signal uniquely corresponding to each port of each processor is shown in the following table:
  • the decoder 402 After each time the decoder 402 obtains the USB_VBUS signal and the USB_ID signal provided by the USB_VBUS pin and the USB_ID pin as input, it can uniquely determine the AP1 USB port, the AP1 UART port, the AP2 USB port and the AP2 UART port according to the above table. A port is used as a transmission object. If the level signal of the USB_VBUS pin and the USB_ID pin input to the decoder 402 is 10, then the processor port is determined as the AP2 USB port according to the above table, and the control signal 2 is generated to control the multiplexer. Strobe SWITCH2 for data transfer.
  • the pins of the USB interface include SBU1, SBU2, CC1, CC2, USB_DP, USB_DM, USB_ID, USB_VBUS pin and the USB_ID pin.
  • the electronic device to which the USB interface 401 belongs includes two processors, and the total number of processor ports is 7, and as shown in FIG.
  • the processors are AP1 and AP2 respectively, and the ports of AP1 include the AP1 USB1 port and the AP1 communication UART port , AP1 Debug_UART port, AP1 USB2 port and AP1 SPI port, AP2 ports include AP2 USB port, AP2 UART port, etc.
  • the decoder 402 can choose 3-8 decoder.
  • the pins USB_DP, USB_DM and USB_ID pins in the USB interface are normally used, and 3 pins are selected from the pins SBU1, SBU2, CC1, CC2 and USB_VBUS as The decoder 402 provides input signals, and the unselected pins remain in normal use.
  • the SBU1 pin, the SBU2 pin and the USB_VBUS pin are selected to provide input signals to the decoder 402 as an example for description.
  • the level signal provided by the SBU1 pin, the SBU2 pin and the USB_VBUS pin is used as the input of the decoder 402 (equivalent to the logical result of at least one level signal), and then the decoder 402 outputs a control signal after decoding to control the gating state of the multiplexer 403, wherein, as shown in FIG. 6 , the circuits where each switch of the multiplexer 403 is located are connected to different processor ports respectively, then according to the connection relationship shown in FIG.
  • the corresponding relationship represented by the logical combination result of at least one level signal corresponding to each port of the processor is as follows:
  • a Type-C USB cable or plug-in board is also provided for connecting switches or buttons, etc., so as to manually set the SBU1 pin, SBU2 pin and USB_VBUS pin in the USB interface 401 High and low state. Then each time the high and low level states of the SBU1 pin, the SBU2 pin and the USB_VBUS pin are set through the Type-C USB cable or the plug-in board, the decoder 402 obtains a corresponding input, and then according to the above table as shown in the table below.
  • only one port is determined as the transmission object, such as switching the VBUS pin, SUB1 pin and SBU2 pin by controlling the switch of the encoder through a Type-C USB cable or a plug-in board
  • the logic levels of all are 0, and the decoder 402 outputs the control signal 0 to control the multiplex switch to select the switch SWITCH0 corresponding to the AP1 USB1 port.
  • the encoder 402 outputs the control signal 6 to control the multiplexer to select the switch SWITCH6 corresponding to the AP2 UART port, and realize the data communication between the USB interface 401 and the AP2 UART port.
  • the USB_VBUS power supply of the AP2 needs to be cut off, and so on.
  • the decoder 402 can also use other types of decoders and signals provided by other pins connected to the USB interface 401 as input, which is not done here. Repeat them one by one.
  • the multiplexer 403 is used to select the transmission channel between the USB interface and the transmission object, so that the USB interface transmits the received data to the transmission object, and sends the data to be sent of the transmission object through the USB interface.
  • the multiplexer 403 also includes a data transmission path established between the USB interface and the transmission object.
  • the data enters the USB interface 401 from the peripheral device, and after the decoder 402 determines the gate state of the multiplexer switch, the data in the USB interface 401 passes The switch 403 reaches the corresponding processor port, and finally enters the processor for processing. After the processor has processed the data, the processing results and the like are also sent to the peripheral device through the processor port, the multiplexer 403 and the USB interface 401 in sequence.
  • this embodiment is an embodiment of the USB interface multiplexing circuit corresponding to the first embodiment, and this embodiment can be implemented in cooperation with the first embodiment.
  • the related technical details mentioned in the first embodiment are still valid in this embodiment, and are not repeated here in order to reduce repetition.
  • the relevant technical details mentioned in this embodiment can also be applied in the first embodiment.
  • this embodiment does not introduce units that are not closely related to solving the technical problem raised by the present application, but this does not mean that there are no other units in this embodiment.
  • the fifth embodiment of the present application relates to an electronic device.
  • the electronic device 701 includes a multiplexing circuit 702 of a USB interface.
  • the multiplexing circuit 702 of the USB interface in this embodiment is roughly the same as that of the fourth embodiment. are the same, and will not be repeated here.
  • the sixth embodiment of the present application relates to a computer-readable storage medium storing a computer program.
  • the above method embodiments are implemented when the computer program is executed by the processor.
  • the aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes .

Abstract

The embodiments of the present application relate to the technical field of communications, and provide a method and circuit for multiplexing a USB interface, and an electronic device and a storage medium. The method for multiplexing a USB interface comprises: acquiring at least one level signal, other than a service data signal and a ground signal, in a USB interface; according to a logical result of the at least one level signal and a predefined correlation, determining a target port of a target processor corresponding to the logical result as a transmission object of the USB interface, wherein the correlation comprises a logical result of the at least one level signal uniquely corresponding to each port of each processor; and transmitting received data to the transmission object by means of the USB interface, and sending data to be sent of the transmission object by means of the USB interface.

Description

USB接口的复用方法、电路、电子设备和存储介质Multiplexing method, circuit, electronic device and storage medium of USB interface
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本申请基于申请号为“202110258065.6”、申请日为2021年3月9日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此以引入方式并入本申请。This application is based on the Chinese patent application with the application number "202110258065.6" and the filing date is March 9, 2021, and claims the priority of the Chinese patent application. The entire content of the Chinese patent application is hereby incorporated by reference. Application.
技术领域technical field
本申请的实施例涉及通信技术领域,特别涉及一种USB接口的复用方法、电路、电子设备和存储介质。The embodiments of the present application relate to the field of communication technologies, and in particular, to a multiplexing method, circuit, electronic device and storage medium of a USB interface.
背景技术Background technique
随着无线终端产品的发展,产品的融合性越来越强,功能也越来越丰富,尤其是数据类终端产品为了提升产品的性能和竞争力,终端中的处理器已逐渐从单核升级为多核,如从一个调制解调器(modem)发展为微控制单元(Microcontroller Unit,MCU)+modem、访问接入点(Access Point,AP)+modem等。多处理器中每个处理器各有其功能,且每个处理器分别有各自进行调试和数据通信的接口,如通用串行总线(Universal Serial Bus,USB)接口、通用异步收发传输器(Universal Asynchronous Receiver/Transmitter,UART)接口和SPI串行外设接口(Serial Peripheral Interface,SPI)等。With the development of wireless terminal products, the integration of products has become stronger and stronger, and the functions have become more and more abundant, especially for data terminal products, in order to improve the performance and competitiveness of products, the processor in the terminal has been gradually upgraded from a single core. For multi-core, such as from a modem (modem) to a microcontroller unit (Microcontroller Unit, MCU) + modem, access point (Access Point, AP) + modem and so on. Each processor in the multiprocessor has its own function, and each processor has its own interface for debugging and data communication, such as Universal Serial Bus (Universal Serial Bus, USB) interface, Universal Asynchronous Receiver Transmitter (Universal Asynchronous Receiver/Transmitter, UART) interface and SPI serial peripheral interface (Serial Peripheral Interface, SPI), etc.
然而,由于终端中存在多个处理器,且每个处理器各自有用于调试和数据通信的处理器接口,或者,终端中存在一个处理器且该处理器包括至少两个处理器接口,因此,终端需要设置多个供外设接入的接口,分别向对应处理器的端口传输调试和通信用的数据,从而实现对处理器的调试和数据通信。以双处理器产品为例,每个处理器各有一个调试和通信的端口,如UART接口+USB接口,此时终端产品至少要设计4个供外设接入的接口用来向处理器端口传输调试和通信用的数据,供外设接入的接口形式包括标准USB接口、调测连接器、测试点等,比较复杂。尤其是,有些产品需要单独设计调试板,且在后期调试或故障处理时需执行拆机等破坏性操作,进而使得有些产品需设计双USB接口供外设接入或牺牲功能只设计单USB接口供外设接入。However, since there are multiple processors in the terminal, and each processor has its own processor interface for debugging and data communication, or, there is one processor in the terminal and the processor includes at least two processor interfaces, therefore, The terminal needs to set up multiple interfaces for the access of peripheral devices, and respectively transmit the data for debugging and communication to the port of the corresponding processor, so as to realize the debugging and data communication of the processor. Taking dual-processor products as an example, each processor has a port for debugging and communication, such as UART interface + USB interface. At this time, the terminal product should be designed with at least 4 interfaces for peripherals to connect to the processor port. Data for debugging and communication is transmitted, and the interface forms for peripheral access include standard USB interfaces, debugging connectors, test points, etc., which are relatively complex. In particular, some products need to design a debug board separately, and need to perform destructive operations such as disassembly during later debugging or troubleshooting, which makes some products need to design dual USB interfaces for peripheral access or sacrifice functions to design only a single USB interface. for peripheral access.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供了一种USB接口的复用方法,所述USB接口所属的电子设备包括一个处理器的多个端口,或者,包括多个处理器,且各所述处理器分别包括至少一个端口;所述方法包括:获取USB接口中除业务数据信号和接地信号之外的至少一路电平信号;根据所述至少一路电平信号的逻辑结果以及预定义的对应关系,确定与所述逻辑结果对应的目标处理器的目标端口作为所述USB接口的传输对象;其中,所述对应关系包括各处理器的各端口唯一对应的所述至少一路电平信号的逻辑结果;通过所述USB接口将接收到的数据传输至所述传输对象,并将所述传输对象的待发送数据通过所述USB接口进行发送。An embodiment of the present application provides a method for multiplexing a USB interface, where the electronic device to which the USB interface belongs includes multiple ports of a processor, or includes multiple processors, and each of the processors includes at least one The method includes: acquiring at least one level signal in the USB interface except the service data signal and the ground signal; The target port of the target processor corresponding to the result is used as the transmission object of the USB interface; wherein, the corresponding relationship includes the logical result of the at least one level signal uniquely corresponding to each port of each processor; through the USB interface The received data is transmitted to the transmission object, and the data to be sent of the transmission object is sent through the USB interface.
本申请实施例还提出了一种USB接口的复用电路,包括:USB接口,用于传输信号;译码器,用于获取USB接口中除业务数据信号和接地信号之外的至少一路电平信号;根据所述至少一路电平信号的逻辑结果以及预定义的对应关系,确定与所述逻辑结果对应的目标处理 器的目标端口作为所述USB接口的传输对象;其中,所述对应关系包括各处理器的各端口唯一对应的所述至少一路电平信号的逻辑结果;多路开关,用于选通所述USB接口与所述传输对象之间的传输通道,以供所述USB接口将接收到的数据传输至所述传输对象,并将所述传输对象的待发送数据通过所述USB接口进行发送。The embodiment of the present application also proposes a multiplexing circuit for a USB interface, including: a USB interface for transmitting signals; a decoder for acquiring at least one level of the USB interface except the service data signal and the ground signal signal; according to the logic result of the at least one level signal and the predefined correspondence, determine the target port of the target processor corresponding to the logic result as the transmission object of the USB interface; wherein, the correspondence includes The logical result of the at least one level signal uniquely corresponding to each port of each processor; a multi-way switch, used to select the transmission channel between the USB interface and the transmission object, so that the USB interface can The received data is transmitted to the transmission object, and the data to be sent of the transmission object is sent through the USB interface.
本申请实施例还提出了一种电子设备,所述设备包括如上所述的USB接口的复用电路。The embodiment of the present application also provides an electronic device, the device includes the above-mentioned multiplexing circuit of the USB interface.
本申请实施例还提出了一种计算机可读存储介质,存储有计算机程序,所述计算机程序被处理器执行时实现以上所述的USB接口的复用方法。An embodiment of the present application further provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the above-mentioned method for multiplexing a USB interface is implemented.
附图说明Description of drawings
一个或多个实施例通过与之对应的附图中的图片进行示例性说明,这些示例性说明并不构成对实施例的限定。One or more embodiments are exemplified by the pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments.
图1是本申请第一实施例提供的USB接口的复用方法的流程图;1 is a flowchart of a method for multiplexing a USB interface provided by a first embodiment of the present application;
图2是本申请第二实施例提供的USB接口的复用方法的流程图;2 is a flowchart of a multiplexing method for a USB interface provided by a second embodiment of the present application;
图3是本申请第三实施例提供的USB接口的复用方法的流程图;3 is a flowchart of a method for multiplexing a USB interface provided by a third embodiment of the present application;
图4是本申请第四实施例提供的USB接口的复用电路的结构示意图;4 is a schematic structural diagram of a multiplexing circuit of a USB interface provided by a fourth embodiment of the present application;
图5是图4所示的本申请的第四实施例提供的USB接口的复用电路的应用示意图一;FIG. 5 is an application schematic diagram 1 of the multiplexing circuit of the USB interface provided by the fourth embodiment of the present application shown in FIG. 4;
图6是图4所示的本申请的第四实施例提供的USB接口的复用电路的应用示意图二;FIG. 6 is a second application schematic diagram of the multiplexing circuit of the USB interface provided by the fourth embodiment of the present application shown in FIG. 4;
图7是本申请第五实施例提供的电子设备的结构示意图。FIG. 7 is a schematic structural diagram of an electronic device provided by a fifth embodiment of the present application.
具体实施方式Detailed ways
本申请实施例的主要目的在于提出一种USB接口的复用方法、电路、电子设备和存储介质,旨在实现多处理器终端中的USB接口复用,使得不需要借助测试点、调试连接器等多个供外设接入的接口,仅使用一个标准的USB接口实现向多个处理器的不同类型的端口传输数据以实现数据通信和调试等功能,非常利于产品接口的简化设计、功能扩展以及后期整机的调试、故障处理。The main purpose of the embodiments of the present application is to propose a USB interface multiplexing method, circuit, electronic device and storage medium, aiming at realizing USB interface multiplexing in a multiprocessor terminal, so that no test points and debugging connectors are required. It uses only one standard USB interface to transmit data to different types of ports of multiple processors to realize functions such as data communication and debugging, which is very conducive to the simplified design and function expansion of product interfaces. And the later debugging and troubleshooting of the whole machine.
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合附图对本申请的各实施例进行详细的阐述。然而,本领域的普通技术人员可以理解,在本申请各实施例中,为了使读者更好地理解本申请而提出了许多技术细节。但是,即使没有这些技术细节和基于以下各实施例的种种变化和修改,也可以实现本申请所要求保护的技术方案。以下各个实施例的划分是为了描述方便,不应对本申请的具体实现方式构成任何限定,各个实施例在不矛盾的前提下可以相互结合相互引用。In order to make the objectives, technical solutions and advantages of the embodiments of the present application more clear, each embodiment of the present application will be described in detail below with reference to the accompanying drawings. However, those of ordinary skill in the art can understand that, in each embodiment of the present application, many technical details are provided for the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in the present application can be realized. The following divisions of the various embodiments are for the convenience of description, and should not constitute any limitation on the specific implementation of the present application, and the various embodiments may be combined with each other and referred to each other on the premise of not contradicting each other.
本申请的第一实施例涉及一种USB接口的复用方法,应用在电子设备中,实现一个USB接口通过复用向所属电子设备包括的一个处理器的多个端口,或者,多个处理器的各端口,进行传输数据,此处的电子设备可以为Tracker、CPE等无线终端设备,如图1所示,具体包括:The first embodiment of the present application relates to a method for multiplexing a USB interface, which is applied in an electronic device to realize that a USB interface is multiplexed to multiple ports of a processor included in the electronic device, or multiple processors. Each port of the device transmits data, and the electronic devices here can be wireless terminal devices such as Tracker and CPE, as shown in Figure 1, including:
步骤101,获取USB接口中除业务数据信号和接地信号之外的至少一路电平信号。Step 101: Acquire at least one level signal in the USB interface except the service data signal and the ground signal.
具体地说,通用串行总线(Universal Serial Bus,USB)接口中,管脚USB_DP和管脚USB_DM用于传输业务数据,将管脚USB_DP和管脚USB_DM提供的信号称为业务数据信号;管脚GND用于接地,将管脚GND提供的信号为接地信号。由于USB接口中业务数据信号和接地 信号在通信过程中,不能够随意调整,因此,只能选取USB接口除业务数据信号和接地信号之外的信号,供后续选择处理器端口。即,获取USB接口除管脚USB_DP、管脚USB_DM和管脚GND之外的至少一个不同管脚提供的电平信号。Specifically, in the Universal Serial Bus (USB) interface, the pins USB_DP and the pins USB_DM are used to transmit service data, and the signals provided by the pins USB_DP and the pins USB_DM are called service data signals; GND is used for grounding, and the signal provided by the pin GND is a grounding signal. Since the service data signal and the ground signal in the USB interface cannot be adjusted at will during the communication process, only the signals other than the service data signal and the ground signal of the USB interface can be selected for subsequent selection of the processor port. That is, a level signal provided by at least one different pin of the USB interface except the pin USB_DP, the pin USB_DM and the pin GND is obtained.
更具体地说,当USB接口为Micron USB接口时,USB接口提供的信号包括业务数据信号、接地信号、USB_VBUS信号和USB_ID信号。此时获取的电平信号为USB_VBUS信号和/或USB_ID信号。当USB接口为Type-C USB接口时,USB接口提供的信号包括传输业务数据的信号、接地信号、USB_VBUS信号、SBU1信号、SBU2信号、CC1信号、CC2信号和USB_ID信号等,获取的是USB_VBIS信号、SBU1信号、SBU2信号、CC1信号、CC2信号中的任意一种信号或信号组合,如获取CC1信号,或者,获取CC1信号和SBU2信号,或者,获取CC1信号、USB_VBIS信号和CC2信号。当然,以上仅为具体的举例说明,在实际的使用过程中,还可以包括其他类型的USB接口中除传输业务数据的信号和接地信号之外的至少一路信号,此处不做一一赘述。More specifically, when the USB interface is a Micron USB interface, the signals provided by the USB interface include a service data signal, a ground signal, a USB_VBUS signal and a USB_ID signal. The level signal obtained at this time is the USB_VBUS signal and/or the USB_ID signal. When the USB interface is a Type-C USB interface, the signals provided by the USB interface include the signal for transmitting service data, the ground signal, the USB_VBUS signal, the SBU1 signal, the SBU2 signal, the CC1 signal, the CC2 signal and the USB_ID signal, etc., and the USB_VBIS signal is obtained. , SBU1 signal, SBU2 signal, CC1 signal, CC2 signal any signal or signal combination, such as acquiring CC1 signal, or acquiring CC1 signal and SBU2 signal, or acquiring CC1 signal, USB_VBIS signal and CC2 signal. Of course, the above is only a specific example, and in actual use, it may also include at least one signal other than the signal for transmitting service data and the ground signal in other types of USB interfaces, which will not be repeated here.
在一个例子中,为了满足用户的实际需求,在执行步骤101之前,还包括:根据需求设置至少一路电平信号的高低电平状态。同时,为了设置电平信号,可以设计一个控制开关来控制USB端口中电平信号的电平高低状态,如在USB线缆或者USB调试版上采用开关等方式选择设置。当然,以上仅为具体的举例说明,在实际的使用过程中电平信号的设置还可以通过其他方式实现,此处不做一一赘述。In one example, in order to meet the actual needs of the user, before step 101 is performed, the method further includes: setting the high and low level states of at least one level signal according to the requirements. At the same time, in order to set the level signal, a control switch can be designed to control the level state of the level signal in the USB port. Of course, the above is only a specific example, and the setting of the level signal in the actual use process can also be implemented in other ways, which will not be repeated here.
还需要说明的是,上述对信号的描述是以管脚的方式进行命名的,如CC2信号为USB接口的CC2管脚提供的信号。It should also be noted that the above description of the signals is named in terms of pins, for example, the CC2 signal is a signal provided by the CC2 pin of the USB interface.
步骤102,根据至少一路电平信号的逻辑结果以及预定义的对应关系,确定与逻辑结果对应的目标处理器的目标端口作为USB接口的传输对象;其中,对应关系包括各处理器的各端口唯一对应的至少一路电平信号的逻辑结果。 Step 102, according to the logic result of at least one level signal and the predefined correspondence, determine the target port of the target processor corresponding to the logic result as the transmission object of the USB interface; wherein, the correspondence includes that each port of each processor is unique The logical result of the corresponding at least one level signal.
具体地说,处理器的端口包括USB接口、UART接口、I2C接口、SPI接口等。当然,以上仅为具体的举例说明,在实际的使用过程中处理器接口还可以包括传输的业务数据经过转换后能够被USB接口传输的其他接口,此处不做一一赘述。Specifically, the ports of the processor include a USB interface, a UART interface, an I2C interface, an SPI interface, and the like. Of course, the above is only a specific example. In actual use, the processor interface may also include other interfaces that can be transmitted by the USB interface after the transmitted service data is converted, which will not be repeated here.
在一个具体的例子中,对应关系定义了各个处理器的各端口和至少一路电平信号的各种可能的逻辑之间的一一对应关系,例如:处理器1的USB1端口对应CC1信号的逻辑表示0,处理器1的USB2端口对应CC1信号的逻辑表示1,假设执行步骤101后得到CC1信号的电平信号逻辑表示为0,则根据对应关系唯一确定了传输对象为处理器1的USB1端口;当获取多路电平信号时,逻辑结果是指多个电平信号的逻辑组合结果,如处理器1的USB端口对应两路电平信号的逻辑组合00,处理器1的通用异步收发传输器(Universal Asynchronous Receiver/Transmitter,UART)接口对应的两路电平信号的逻辑组合01和处理器2的USB端口对应两路电平信号的逻辑组合11等,假设执行步骤101得到两路电平信号且其逻辑组合结果为00,则根据对应关系,唯一确定了传输对象为处理器1的USB端口。In a specific example, the correspondence defines a one-to-one correspondence between each port of each processor and various possible logics of at least one level signal, for example: the logic of the USB1 port of processor 1 corresponding to the CC1 signal Represents 0, and the logical representation of the CC1 signal corresponding to the USB2 port of the processor 1 is 1. Assuming that the logical representation of the level signal of the CC1 signal obtained after step 101 is 0, the transmission object is uniquely determined to be the USB1 port of the processor 1 according to the corresponding relationship. ; When acquiring multi-channel level signals, the logical result refers to the logical combination result of multiple level signals, such as the logical combination 00 of the two-channel level signals corresponding to the USB port of the processor 1, and the universal asynchronous transceiver transmission of the processor 1 The logic combination 01 of the two-way level signal corresponding to the Universal Asynchronous Receiver/Transmitter (UART) interface and the logic combination 11 of the two-way level signal corresponding to the USB port of the processor 2, etc., assume that the step 101 is executed to obtain the two-way level signal signal and its logical combination result is 00, then according to the corresponding relationship, it is uniquely determined that the transmission object is the USB port of processor 1.
需要说明的是,对应关系中,处理器的端口的总数量不大于至少一路电平信号的各种可能的逻辑结果总数量。It should be noted that, in the corresponding relationship, the total number of ports of the processor is not greater than the total number of various possible logical results of at least one level signal.
步骤103,通过USB接口将接收到的数据传输至传输对象,并将传输对象的待发送数据通过USB接口进行发送。In step 103, the received data is transmitted to the transmission object through the USB interface, and the data to be sent of the transmission object is sent through the USB interface.
具体地说,在执行步骤102确定出传输对象之后,USB接口和传输对象之间建立了数据 传输的通路,外设依次通过USB接口、数据传输的通路和传输对象将外设中的数据发送到目标的处理器中,接着,目标处理器对接收到的数据进行相应的处理,并将处理的结果作为待发送的数据依次通过传输对象、数据传输的通路和USB接口发送给外设。Specifically, after the transmission object is determined in step 102, a data transmission path is established between the USB interface and the transmission object, and the peripheral device sequentially sends the data in the peripheral device to the USB interface, the data transmission path and the transmission object. In the target processor, the target processor then performs corresponding processing on the received data, and sends the processing result as the data to be sent to the peripheral through the transmission object, the data transmission path and the USB interface in turn.
本申请提出的实施例相对于现有技术而言,获取USB接口中除业务数据信号和接地信号之外的至少一路电平信号之后,能根据至少一路电平信号的逻辑组合结果,使得能够根据各处理器的各端口唯一对应的所述至少一路电平信号的逻辑结果和至少一路电平信号的逻辑结果,从所有处理器的各种端口中选择出一个目标处理器的目标端口作为USB接口的传输对象,从而能够通过USB接口将接收到的数据传输至传输对象,并将传输对象的待发送数据通过USB接口进行传输。由于终端中所有处理器端口都可能作为传输对象,破坏了终端上供外设接入的USB接口和处理器端口之间的一一对应关系,使得一个USB接口可以与终端中所有处理器的各种端口之间进行通信,实现了对多处理器终端中USB接口的复用,进而达到不需要借助测试点、调试连接器仅使用一个标准的USB接口实现向多个处理器端口传输数据以实现数据通信和调试等功能,非常利于产品接口的简化设计、功能扩展以及后期整机的调试、故障处理的目的。Compared with the prior art, the embodiment proposed in the present application can obtain at least one level signal except the service data signal and the ground signal in the USB interface, and then can use the logical combination result of the at least one level signal, so that the The logical result of the at least one level signal and the logical result of the at least one level signal uniquely corresponding to each port of each processor, and a target port of a target processor is selected from the various ports of all processors as the USB interface Therefore, the received data can be transmitted to the transmission object through the USB interface, and the to-be-sent data of the transmission object can be transmitted through the USB interface. Since all processor ports in the terminal may be used as transmission objects, the one-to-one correspondence between the USB interface for peripheral access on the terminal and the processor port is destroyed, so that one USB interface can communicate with all processors in the terminal. Communication between various ports realizes the multiplexing of the USB interface in the multi-processor terminal, so as to achieve the realization of transferring data to multiple processor ports without the need of test points and debugging connectors using only one standard USB interface. The functions of data communication and debugging are very beneficial to the simplified design of product interface, function expansion, and the purpose of debugging and troubleshooting of the whole machine in the later stage.
本申请的第二实施例涉及一种USB接口的复用方法,本实施例中,在通过USB接口将接收到的数据传输至传输对象,并将传输对象的待发送数据通过USB接口进行发送之前,还检测传输对象是否采用两线式串行总线,如图2所示,具体包括:The second embodiment of the present application relates to a method for multiplexing a USB interface. In this embodiment, before the received data is transmitted to the transmission object through the USB interface, and the to-be-sent data of the transmission object is sent through the USB interface , and also detects whether the transmission object adopts a two-wire serial bus, as shown in Figure 2, including:
步骤201,获取USB接口中除业务数据信号和接地信号之外的至少一路电平信号。Step 201: Acquire at least one level signal in the USB interface except the service data signal and the ground signal.
具体地说,本实施例中的步骤201和第一实施例中的步骤101大致相同,此处就不一一赘述了。Specifically, step 201 in this embodiment is substantially the same as step 101 in the first embodiment, and details are not repeated here.
步骤202,根据至少一路电平信号的逻辑结果以及预定义的对应关系,确定与逻辑结果对应的目标处理器的目标端口作为USB接口的传输对象;其中,对应关系包括各处理器的各端口唯一对应的至少一路电平信号的逻辑结果。 Step 202, according to the logical result of at least one level signal and the predefined correspondence, determine the target port of the target processor corresponding to the logical result as the transmission object of the USB interface; wherein, the correspondence includes that each port of each processor is unique The logical result of the corresponding at least one level signal.
具体地说,本实施例中的步骤202和第一实施例中的步骤102大致相同,此处就不一一赘述了。Specifically, step 202 in this embodiment is substantially the same as step 102 in the first embodiment, and details are not repeated here.
步骤203,检测传输对象是否采用两线式串行总线,若是,执行步骤204,若否,执行步骤205。 Step 203 , detecting whether the transmission object adopts a two-wire serial bus, if yes, go to Step 204 , if not, go to Step 205 .
具体地说,接口的类型指示了接口采用的总线的形式,如SPI接口采用四线式串行总线、两线式UART接口采用两线式串行总线等。因此,检测传输对象是否采用两线式串行总线可以通过对传输对象的接口类型进行检测来实现。Specifically, the type of the interface indicates the form of the bus used by the interface. For example, the SPI interface adopts a four-wire serial bus, and the two-wire UART interface adopts a two-wire serial bus. Therefore, detecting whether the transmission object adopts a two-wire serial bus can be realized by detecting the interface type of the transmission object.
步骤204,将接收到的数据调整为传输对象可接收的形式,并将待发送数据调整为USB接口可接收的形式。Step 204: Adjust the received data to a form that can be received by the transmission object, and adjust the data to be sent to a form that can be received by the USB interface.
具体地说,由于两线式串行总线一次性传输2路数据、四线式串行总线一次性传输4路数据,因此,当数据在两个采用不同类型串行总线的接口之间进行传输时,不能直接从一个接口到另一个接口,需要对数据进行处理才能正常地在两个采用不同类型串行总线的接口之间收发数据。通过将接收到的数据调整为传输对象可接收的形式,并将待发送数据调整为USB接口可接收的形式,实现采用不同类型串行总线的接口之间进行数据传输时,发送方的数据被转化为接收方能够接收的数据,从而使数据能够正常传输。Specifically, since the two-wire serial bus transmits 2 channels of data at a time, and the four-wire serial bus transmits 4 channels of data at a time, when data is transmitted between two interfaces using different types of serial buses When it is not possible to directly transfer from one interface to another interface, data processing is required to send and receive data between two interfaces using different types of serial buses normally. By adjusting the received data into a form that can be received by the transmission object, and adjusting the data to be sent into a form that can be received by the USB interface, when data transmission between interfaces using different types of serial buses is implemented, the sender's data is It is converted into data that the receiver can receive, so that the data can be transmitted normally.
在一个例子中,为了将采用某种类型串行总线的接口中保存的数据转换为采用另一种类 型串行总线的接口可接收的数据,可以通过引入桥接芯片处理保存的数据来实现,例如,通过USB转SPI桥接芯片将USB接口发送的数据转化为SPI接口能够接收到的形式。In one example, in order to convert data stored in an interface using a certain type of serial bus into data that can be received by an interface using another type of serial bus, it can be achieved by introducing a bridge chip to process the stored data, such as , convert the data sent by the USB interface into a form that can be received by the SPI interface through the USB to SPI bridge chip.
步骤205,通过USB接口将接收到的数据传输至传输对象,并将传输对象的待发送数据通过USB接口进行发送。In step 205, the received data is transmitted to the transmission object through the USB interface, and the data to be sent of the transmission object is sent through the USB interface.
具体地说,若传输对象和USB接口采用不同类型串行总线,通过USB接口将接收到的且经过调整的数据传输至传输对象,并将传输对象的经过调整的待发送数据通过USB接口进行发送。若传输对象和USB接口采用相同类型串行总线,通过USB接口直接将接收到的数据传输至传输对象,并将传输对象的待发送数据直接通过USB接口进行发送。Specifically, if the transmission object and the USB interface use different types of serial buses, the received and adjusted data is transmitted to the transmission object through the USB interface, and the adjusted data to be sent of the transmission object is sent through the USB interface . If the transmission object and the USB interface use the same type of serial bus, the received data is directly transmitted to the transmission object through the USB interface, and the to-be-sent data of the transmission object is directly sent through the USB interface.
本申请实施例相对于现有技术而言,在实现第一实施例带来的有益效果基础上,能够检测USB接口和传输对象之间是否能够直接通信,在不能够直接通信的情况下,通过将接收到的数据调整为传输对象可接收的形式,并将待发送数据调整为USB接口可接收的形式,实现采用不同类型串行总线的接口之间进行数据传输时,发送方的数据被转化为接收方能够接收的数据,从而使数据能够正常传输,避免USB接口和传输对象之间不适配导致数据传输出现错误,提高了数据传输的准确性。Compared with the prior art, on the basis of realizing the beneficial effects brought by the first embodiment, the embodiment of the present application can detect whether direct communication is possible between the USB interface and the transmission object. Adjust the received data into a form that can be received by the transmission object, and adjust the data to be sent into a form that can be received by the USB interface, so that when data transmission is performed between interfaces using different types of serial buses, the sender's data is converted. It is the data that can be received by the receiver, so that the data can be transmitted normally, avoid data transmission errors caused by the mismatch between the USB interface and the transmission object, and improve the accuracy of data transmission.
本申请的第三实施例涉及一种USB接口的复用方法,在通过USB接口将接收到的数据传输至传输对象,并将传输对象的待发送数据通过USB接口进行发送之后,还能够切换传输对象,如图3所示,具体包括:The third embodiment of the present application relates to a method for multiplexing a USB interface. After the received data is transmitted to the transmission object through the USB interface, and the to-be-sent data of the transmission object is sent through the USB interface, the transmission can also be switched. Objects, as shown in Figure 3, include:
步骤301,获取USB接口中除业务数据信号和接地信号之外的至少一路电平信号。Step 301: Acquire at least one level signal in the USB interface except the service data signal and the ground signal.
具体地说,本实施例中的步骤301和第一实施例中的步骤101大致相同,此处就不一一赘述了。Specifically, step 301 in this embodiment is substantially the same as step 101 in the first embodiment, and details are not repeated here.
步骤302,根据至少一路电平信号的逻辑结果以及预定义的对应关系,确定与逻辑结果对应的目标处理器的目标端口作为USB接口的传输对象;其中,对应关系包括各处理器的各端口唯一对应的至少一路电平信号的逻辑结果。Step 302: Determine the target port of the target processor corresponding to the logic result as the transmission object of the USB interface according to the logical result of at least one level signal and the predefined corresponding relationship; wherein, the corresponding relationship includes that each port of each processor is unique The logical result of the corresponding at least one level signal.
具体地说,本实施例中的步骤302和第一实施例中的步骤102大致相同,此处就不一一赘述了。Specifically, step 302 in this embodiment is substantially the same as step 102 in the first embodiment, and details are not repeated here.
步骤303,通过USB接口将接收到的数据传输至传输对象,并将传输对象的待发送数据通过USB接口进行发送。In step 303, the received data is transmitted to the transmission object through the USB interface, and the data to be sent of the transmission object is sent through the USB interface.
具体地说,本实施例中的步骤303和第一实施例中的步骤103大致相同,此处就不一一赘述了。Specifically, step 303 in this embodiment is substantially the same as step 103 in the first embodiment, and details are not repeated here.
步骤304,若检测到电平信号的高低电平状态发生变化,根据变化后的电平信号重新执行USB接口的复用方法。 Step 304 , if it is detected that the high and low level states of the level signal change, re-execute the USB interface multiplexing method according to the changed level signal.
具体地说,由于电平信号的高低电平状态唯一确定了至少一路电平信号的逻辑结果,进而根据对应关系唯一确定了传输对象,因此,一旦电平信号的高低电平状态发生变化,即说明唯一确定的传输对象发生了变化。可以实时地或者周期性地对步骤301中获取的至少一路电平信号的高低电平状态进行检测,当至少一路电平信号中任何一路电平信号发生变化,则重新执行USB接口复用方法,从而重新确定传输对象,实现对传输对象的切换。Specifically, because the high and low level states of the level signal uniquely determine the logical result of at least one level signal, and then uniquely determine the transmission object according to the corresponding relationship, once the high and low level states of the level signal change, that is, Indicates that the only identified transfer object has changed. The high and low level states of at least one level signal obtained in step 301 can be detected in real time or periodically, and when any level signal of at least one level signal changes, the USB interface multiplexing method is re-executed, Thereby, the transmission object is re-determined, and the switching of the transmission object is realized.
需要说明的是,在用户需要切换传输对象而保持电子设备和外设等条件不变时,只需要对步骤301中获取的电平信号的高低电平状态按照自身需求和对应关系重新进行设置,就可以通过本实施例提供的USB接口的复用方法控制终端中处理器的调试与通信端口切换,或不 同处理器之间切换,而不需要更换USB接口,实现了USB端口在各处理器和处理器端口之间的平滑切换,减少人力、时间等资源的浪费,提高数据传输和调试的效率。It should be noted that, when the user needs to switch the transmission object and keep the conditions such as electronic equipment and peripherals unchanged, it is only necessary to reset the high and low level states of the level signal obtained in step 301 according to their own needs and corresponding relationships, The debugging of the processor in the terminal and the switching of the communication port, or the switching between different processors, can be controlled by the multiplexing method of the USB interface provided in this embodiment, without the need to replace the USB interface, so that the USB port can be connected between each processor and the processor. The smooth switching between processor ports reduces the waste of resources such as manpower and time, and improves the efficiency of data transmission and debugging.
本申请实施例相对于现有技术而言,在实现第一实施例带来的有益效果基础上,能够在至少一路电平信号中任何一路电平信号发生变化时,重新执行USB接口复用方法,从而重新确定传输对象,实现对传输对象的切换。进一步地,使得用户能够通过重新设置电平信号的高低电平状态,来控制终端中处理器的调试与通信端口切换,或不同处理器之间切换,而不需要更换USB接口,实现了USB端口在各处理器和处理器端口之间的平滑切换,减少人力、时间等资源的浪费,提高数据传输和调试的效率。Compared with the prior art, the embodiment of the present application can re-execute the USB interface multiplexing method when any one of the at least one level signal changes on the basis of realizing the beneficial effects brought by the first embodiment. , so as to re-determine the transmission object and realize the switching of the transmission object. Further, the user can control the debugging of the processor in the terminal and the switching of the communication port, or switch between different processors by resetting the high and low level states of the level signal, without changing the USB interface, realizing the USB port. The smooth switching between processors and processor ports reduces the waste of resources such as manpower and time, and improves the efficiency of data transmission and debugging.
此外,应当理解的是,上面各种方法的步骤划分,只是为了描述清楚,实现时可以合并为一个步骤或者对某些步骤进行拆分,分解为多个步骤,只要包括相同的逻辑关系,都在本专利的保护范围内;对算法中或者流程中添加无关紧要的修改或者引入无关紧要的设计,但不改变其算法和流程的核心设计都在该专利的保护范围内。In addition, it should be understood that the division of steps of the various methods above is only for the purpose of describing clearly, and can be combined into one step or split into some steps during implementation, and decomposed into multiple steps, as long as the same logical relationship is included, all Within the protection scope of this patent; adding insignificant modifications to the algorithm or process or introducing insignificant designs, but not changing the core design of the algorithm and process are all within the protection scope of this patent.
本申请第四实施例涉及一种USB接口的复用电路,如图4所示,包括:The fourth embodiment of the present application relates to a multiplexing circuit of a USB interface, as shown in FIG. 4 , including:
USB接口401,用于传输信号。The USB interface 401 is used to transmit signals.
译码器402,用于获取USB接口中除业务数据信号和接地信号之外的至少一路电平信号;根据至少一路电平信号的逻辑结果以及预定义的对应关系,确定与逻辑结果对应的目标处理器的目标端口作为USB接口的传输对象;其中,对应关系包括各处理器的各端口唯一对应的至少一路电平信号的逻辑结果。The decoder 402 is used to obtain at least one level signal except the service data signal and the ground signal in the USB interface; according to the logic result of the at least one level signal and the predefined correspondence, determine the target corresponding to the logic result The target port of the processor is used as the transmission object of the USB interface; wherein, the corresponding relationship includes the logical result of at least one level signal uniquely corresponding to each port of each processor.
具体地说,当USB接口401为Micron USB接口时,USB接口的管脚包括管脚USB_DP、管脚USB_DM、USB_ID管脚、USB_VBUS管脚和USB_ID管脚。假设USB接口401所属的电子设备包括两个处理器且各处理器均包括两个端口,且如图5所示,处理器分别为AP1和AP2,AP1的端口包括AP1 USB口和AP1 UART口,AP2的端口包括AP2 USB口和AP2 UART口,则译码器402可以选用2-4译码器。此时,正常使用USB接口中的管脚USB_DP、管脚USB_DM和USB_ID管脚,而将USB_VBUS管脚和USB_ID管脚提供的电平信号作为译码器402的输入(相当于至少一路电平信号的逻辑结果),然后译码器402经过译码后输出一个控制信号来控制多路开关403的选通状态,其中,如图5所示,多路开关403的每一各开关所在电路分别连接了不同的处理器端口,则根据图5所示的连接关系,各处理器的各端口唯一对应的至少一路电平信号的逻辑组合结果表示的对应关系如下表:Specifically, when the USB interface 401 is a Micron USB interface, the pins of the USB interface include a pin USB_DP, a pin USB_DM, a USB_ID pin, a USB_VBUS pin and a USB_ID pin. Assuming that the electronic device to which the USB interface 401 belongs includes two processors and each processor includes two ports, and as shown in FIG. 5 , the processors are AP1 and AP2 respectively, and the ports of AP1 include the AP1 USB port and the AP1 UART port, The ports of the AP2 include the AP2 USB port and the AP2 UART port, and the decoder 402 can select a 2-4 decoder. At this time, the pins USB_DP, USB_DM and USB_ID in the USB interface are normally used, and the level signals provided by the USB_VBUS and USB_ID pins are used as the input of the decoder 402 (equivalent to at least one level signal). the logical result), and then the decoder 402 outputs a control signal after decoding to control the strobe state of the multiplexer 403, wherein, as shown in FIG. 5, the circuits where each switch of the multiplexer 403 is located are connected If different processor ports are connected, according to the connection relationship shown in Figure 5, the corresponding relationship represented by the logical combination result of at least one level signal uniquely corresponding to each port of each processor is shown in the following table:
Figure PCTCN2022078510-appb-000001
Figure PCTCN2022078510-appb-000001
译码器402每次获取了USB_VBUS管脚和USB_ID管脚提供的USB_VBUS信号和USB_ID信号作为输入后,都能根据上表在AP1 USB口、AP1 UART口、AP2 USB口和AP2 UART口中唯一确定出一个端口作为传输对象,如某次USB_VBUS管脚和USB_ID管脚输入译码器402的电平信号为10,则根据上表确定处理器端口为AP2 USB口,产生控制信号2 以控制多路开关选通SWITCH2进行数据传输。After each time the decoder 402 obtains the USB_VBUS signal and the USB_ID signal provided by the USB_VBUS pin and the USB_ID pin as input, it can uniquely determine the AP1 USB port, the AP1 UART port, the AP2 USB port and the AP2 UART port according to the above table. A port is used as a transmission object. If the level signal of the USB_VBUS pin and the USB_ID pin input to the decoder 402 is 10, then the processor port is determined as the AP2 USB port according to the above table, and the control signal 2 is generated to control the multiplexer. Strobe SWITCH2 for data transfer.
类似的,当USB接口401为Type-C USB接口时,USB接口的管脚包括SBU1管脚、SBU2管脚、CC1管脚、CC2管脚、管脚USB_DP、管脚USB_DM、USB_ID管脚、USB_VBUS管脚和USB_ID管脚。假设USB接口401所属的电子设备包括两个处理器,且处理器端口总数量为7,且如图6所示,处理器分别为AP1和AP2,AP1的端口包括AP1 USB1口、AP1通信UART口、AP1 Debug_UART口、AP1 USB2口和AP1 SPI口,AP2的端口包括AP2 USB口、AP2 UART口等,则译码器402可以选用3-8译码器。此时,正常使用USB接口中的管脚USB_DP、管脚USB_DM和USB_ID管脚,而从SBU1管脚、SBU2管脚、CC1管脚、CC2管脚和USB_VBUS管脚中选出3各管脚为译码器402提供输入信号,未被选中的管脚保持正常使用情况,此处以选择SBU1管脚、SBU2管脚和USB_VBUS管脚为译码器402提供输入信号为例进行说明。将SBU1管脚、SBU2管脚和USB_VBUS管脚提供的电平信号作为译码器402的输入(相当于至少一路电平信号的逻辑结果),然后译码器402经过译码后输出一个控制信号来控制多路开关403的选通状态,其中,如图6所示,多路开关403的每一各开关所在电路分别连接了不同的处理器端口,则根据图6所示的连接关系,各处理器的各端口唯一对应的至少一路电平信号的逻辑组合结果表示的对应关系如下表:Similarly, when the USB interface 401 is a Type-C USB interface, the pins of the USB interface include SBU1, SBU2, CC1, CC2, USB_DP, USB_DM, USB_ID, USB_VBUS pin and the USB_ID pin. Assume that the electronic device to which the USB interface 401 belongs includes two processors, and the total number of processor ports is 7, and as shown in FIG. 6 , the processors are AP1 and AP2 respectively, and the ports of AP1 include the AP1 USB1 port and the AP1 communication UART port , AP1 Debug_UART port, AP1 USB2 port and AP1 SPI port, AP2 ports include AP2 USB port, AP2 UART port, etc., the decoder 402 can choose 3-8 decoder. At this time, the pins USB_DP, USB_DM and USB_ID pins in the USB interface are normally used, and 3 pins are selected from the pins SBU1, SBU2, CC1, CC2 and USB_VBUS as The decoder 402 provides input signals, and the unselected pins remain in normal use. Here, the SBU1 pin, the SBU2 pin and the USB_VBUS pin are selected to provide input signals to the decoder 402 as an example for description. The level signal provided by the SBU1 pin, the SBU2 pin and the USB_VBUS pin is used as the input of the decoder 402 (equivalent to the logical result of at least one level signal), and then the decoder 402 outputs a control signal after decoding to control the gating state of the multiplexer 403, wherein, as shown in FIG. 6 , the circuits where each switch of the multiplexer 403 is located are connected to different processor ports respectively, then according to the connection relationship shown in FIG. The corresponding relationship represented by the logical combination result of at least one level signal corresponding to each port of the processor is as follows:
Figure PCTCN2022078510-appb-000002
Figure PCTCN2022078510-appb-000002
此时,如图6所示,还提供Type-C USB线缆或插线板,用于连接开关或者按钮等,以实现人为设置USB接口401中SBU1管脚、SBU2管脚和USB_VBUS管脚的高低电平状态。则每次通过Type-C USB线缆或插线板设置了SBU1管脚、SBU2管脚和USB_VBUS管脚的高低电平状态后,译码器402获取一个相应的输入,接着根据上表在如图6所示的7个处理器的端口中唯一确定出一个端口作为传输对象,如通过Type-C USB线缆或插线板控制编码器的开关切换VBUS管脚、SUB1管脚和SBU2管脚的逻辑电平全为0,译码器402输出控制信号0,以控制多路开关选通AP1 USB1口对应的开关SWITCH0,此时,需要外部USB_VBUS电源给AP1VBUS口供电即提供枚举,实现USB接口401和AP1USB1口的数据通信;或者,通过Type-C USB线缆或插线板控制编码器的开关切换VBUS管脚、SUB1管脚和SBU2管脚的逻辑电平依次为“110”,译码器402输出控制信号6,以控制多路开关选通AP2UART口对应的开关SWITCH6,实现USB接口401和AP2 UART口的数据通信,此时,需要切断AP2的USB_VBUS电源,等等。At this time, as shown in FIG. 6 , a Type-C USB cable or plug-in board is also provided for connecting switches or buttons, etc., so as to manually set the SBU1 pin, SBU2 pin and USB_VBUS pin in the USB interface 401 High and low state. Then each time the high and low level states of the SBU1 pin, the SBU2 pin and the USB_VBUS pin are set through the Type-C USB cable or the plug-in board, the decoder 402 obtains a corresponding input, and then according to the above table as shown in the table below. Among the ports of the seven processors shown in Figure 6, only one port is determined as the transmission object, such as switching the VBUS pin, SUB1 pin and SBU2 pin by controlling the switch of the encoder through a Type-C USB cable or a plug-in board The logic levels of all are 0, and the decoder 402 outputs the control signal 0 to control the multiplex switch to select the switch SWITCH0 corresponding to the AP1 USB1 port. The data communication between the interface 401 and the AP1USB1 port; or, through the Type-C USB cable or the plug-in board to control the switch of the encoder to switch the logic levels of the VBUS pin, the SUB1 pin and the SBU2 pin to be "110" in turn, the translation The encoder 402 outputs the control signal 6 to control the multiplexer to select the switch SWITCH6 corresponding to the AP2 UART port, and realize the data communication between the USB interface 401 and the AP2 UART port. At this time, the USB_VBUS power supply of the AP2 needs to be cut off, and so on.
当然,以上仅为具体的举例说明,在实际的使用过程中,译码器402还可以使用其他类 型的译码器和接入USB接口401的其他管脚提供的信号作为输入,此处不做一一赘述。Of course, the above is only a specific example. In the actual use process, the decoder 402 can also use other types of decoders and signals provided by other pins connected to the USB interface 401 as input, which is not done here. Repeat them one by one.
多路开关403,用于选通USB接口与传输对象之间的传输通道,以供USB接口将接收到的数据传输至传输对象,并将传输对象的待发送数据通过USB接口进行发送。The multiplexer 403 is used to select the transmission channel between the USB interface and the transmission object, so that the USB interface transmits the received data to the transmission object, and sends the data to be sent of the transmission object through the USB interface.
具体地,多路开关403还包括了USB接口和传输对象之间建立的数据传输通路。在通基于USB接口401的可复用功能进行通信时,数据从外设进入USB接口401,然后在译码器402确定了多路开关的选通状态后,USB接口401中的数据通过多路开关403到达相应的处理器端口,最后进入处理器进行处理。而处理器处理完数据后,会将处理结果等也依次通过处理器端口、多路开关403和USB接口401达到送入外设。Specifically, the multiplexer 403 also includes a data transmission path established between the USB interface and the transmission object. When communicating based on the reusable function of the USB interface 401, the data enters the USB interface 401 from the peripheral device, and after the decoder 402 determines the gate state of the multiplexer switch, the data in the USB interface 401 passes The switch 403 reaches the corresponding processor port, and finally enters the processor for processing. After the processor has processed the data, the processing results and the like are also sent to the peripheral device through the processor port, the multiplexer 403 and the USB interface 401 in sequence.
不难发现,本实施例为与第一实施例相对应的USB接口复用电路实施例,本实施例可与第一实施例互相配合实施。第一实施例中提到的相关技术细节在本实施例中依然有效,为了减少重复,这里不再赘述。相应地,本实施例中提到的相关技术细节也可应用在第一实施例中。It is not difficult to find that this embodiment is an embodiment of the USB interface multiplexing circuit corresponding to the first embodiment, and this embodiment can be implemented in cooperation with the first embodiment. The related technical details mentioned in the first embodiment are still valid in this embodiment, and are not repeated here in order to reduce repetition. Correspondingly, the relevant technical details mentioned in this embodiment can also be applied in the first embodiment.
此外,为了突出本申请的创新部分,本实施例中并没有将与解决本申请所提出的技术问题关系不太密切的单元引入,但这并不表明本实施例中不存在其它的单元。In addition, in order to highlight the innovative part of the present application, this embodiment does not introduce units that are not closely related to solving the technical problem raised by the present application, but this does not mean that there are no other units in this embodiment.
本申请的第五实施例涉及一种电子设备,如图7所示,电子设备701包括USB接口的复用电路702,其中,本实施例中USB接口的复用电路702与第四实施例大致相同,此处就不一一赘述了。The fifth embodiment of the present application relates to an electronic device. As shown in FIG. 7 , the electronic device 701 includes a multiplexing circuit 702 of a USB interface. The multiplexing circuit 702 of the USB interface in this embodiment is roughly the same as that of the fourth embodiment. are the same, and will not be repeated here.
本申请第六实施例涉及一种计算机可读存储介质,存储有计算机程序。计算机程序被处理器执行时实现上述方法实施例。The sixth embodiment of the present application relates to a computer-readable storage medium storing a computer program. The above method embodiments are implemented when the computer program is executed by the processor.
即,本领域技术人员可以理解,实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。That is, those skilled in the art can understand that all or part of the steps in the method for implementing the above embodiments can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium and includes several instructions to make a device ( It may be a single chip microcomputer, a chip, etc.) or a processor (processor) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes .
本领域的普通技术人员可以理解,上述各实施例是实现本申请的具体实施例,而在实际应用中,可以在形式上和细节上对其作各种改变,而不偏离本申请的精神和范围。Those of ordinary skill in the art can understand that the above-mentioned embodiments are specific embodiments for realizing the present application, and in practical applications, various changes in form and details can be made without departing from the spirit and the spirit of the present application. scope.

Claims (10)

  1. 一种USB接口的复用方法,所述USB接口所属的电子设备包括多个处理器端口;所述方法包括:A multiplexing method for a USB interface, wherein the electronic device to which the USB interface belongs includes a plurality of processor ports; the method includes:
    获取USB接口中除业务数据信号和接地信号之外的至少一路电平信号;Obtain at least one level signal in the USB interface except the service data signal and the ground signal;
    根据所述至少一路电平信号的逻辑结果以及预定义的对应关系,确定与所述逻辑结果对应的目标处理器的目标端口作为所述USB接口的传输对象;其中,所述对应关系包括各处理器的各端口唯一对应的所述至少一路电平信号的逻辑结果;According to the logic result of the at least one level signal and the predefined correspondence, the target port of the target processor corresponding to the logic result is determined as the transmission object of the USB interface; wherein the correspondence includes each processing The logical result of the at least one level signal uniquely corresponding to each port of the device;
    通过所述USB接口将接收到的数据传输至所述传输对象,并将所述传输对象的待发送数据通过所述USB接口进行发送。The received data is transmitted to the transmission object through the USB interface, and the to-be-sent data of the transmission object is sent through the USB interface.
  2. 根据权利要求1所述的USB接口的复用方法,其中,所述USB接口为Micron USB接口,所述电平信号为USB_VBUS信号或USB_ID信号。The multiplexing method of a USB interface according to claim 1, wherein the USB interface is a Micron USB interface, and the level signal is a USB_VBUS signal or a USB_ID signal.
  3. 根据权利要求1或2所述的USB接口的复用方法,其中,所述USB接口为Type-C USB接口,所述电平信号为USB_VBUS信号、SBU1信号、SBU2信号、CC1信号或CC2信号。The multiplexing method of a USB interface according to claim 1 or 2, wherein the USB interface is a Type-C USB interface, and the level signal is a USB_VBUS signal, an SBU1 signal, an SBU2 signal, a CC1 signal or a CC2 signal.
  4. 根据权利要求1至3中任一项所述的USB接口的复用方法,其中,所述通过所述USB接口将接收到的数据传输至所述传输对象,并将所述传输对象的待发送数据通过所述USB接口进行发送之前,还包括:The multiplexing method of a USB interface according to any one of claims 1 to 3, wherein the data received through the USB interface is transmitted to the transmission object, and the to-be-sent data of the transmission object is transmitted Before the data is sent through the USB interface, it also includes:
    检测所述传输对象是否采用两线式串行总线;Detecting whether the transmission object adopts a two-wire serial bus;
    若否,将所述接收到的数据调整为所述传输对象可接收的形式,并将所述待发送数据调整为所述USB接口可接收的形式。If not, adjust the received data into a form receivable by the transmission object, and adjust the to-be-sent data into a form receivable by the USB interface.
  5. 根据权利要求1至4中任一项所述的USB接口的复用方法,其中,所述获取USB接口中除业务数据信号和接地信号之外的至少一路电平信号之前,还包括:The method for multiplexing a USB interface according to any one of claims 1 to 4, wherein before acquiring at least one level signal in the USB interface except the service data signal and the ground signal, the method further comprises:
    设置所述至少一路电平信号的高低电平状态。The high and low level states of the at least one level signal are set.
  6. 根据权利要求1至5中任一项所述的USB接口的复用方法,其中,在所述通过所述USB接口将接收到的数据传输至所述传输对象,并将所述传输对象的待发送数据通过所述USB接口进行发送之后,还包括:The multiplexing method of a USB interface according to any one of claims 1 to 5, wherein, in the transmission of the received data through the USB interface to the transmission object, and the transmission object to be After the sending data is sent through the USB interface, it also includes:
    若检测到所述至少一路电平信号的高低电平状态发生变化,根据变化后的所述电平信号重新执行所述USB接口的复用方法。If it is detected that the high and low level states of the at least one level signal change, the method for multiplexing the USB interface is re-executed according to the changed level signal.
  7. 根据权利要求1至6中任一项所述的USB接口的复用方法,其中,所述目标端口为UART接口、I2C接口或SPI接口。The multiplexing method of a USB interface according to any one of claims 1 to 6, wherein the target port is a UART interface, an I2C interface or an SPI interface.
  8. 一种USB接口的复用电路,包括:A multiplexing circuit of a USB interface, comprising:
    USB接口,用于传输信号;USB interface for signal transmission;
    译码器,用于获取USB接口中除业务数据信号和接地信号之外的至少一路电平信号;根据所述至少一路电平信号的逻辑结果以及预定义的对应关系,确定与所述逻辑表示结果对应的目标处理器的目标端口作为所述USB接口的传输对象;其中,所述对应关系包括各处理器的各端口唯一对应的所述至少一路电平信号的逻辑结果;The decoder is used to obtain at least one level signal in the USB interface except the service data signal and the ground signal; The target port of the target processor corresponding to the result is used as the transmission object of the USB interface; wherein, the corresponding relationship includes the logical result of the at least one level signal uniquely corresponding to each port of each processor;
    多路开关,用于选通所述USB接口与所述传输对象之间的传输通道,以供所述USB接口将接收到的数据传输至所述传输对象,并将所述传输对象的待发送数据通过所述USB接口进行发送。a multiplexer, used for gating the transmission channel between the USB interface and the transmission object, so that the USB interface transmits the received data to the transmission object, and the to-be-sent data of the transmission object Data is sent through the USB interface.
  9. 一种电子设备,包括如权利要求8所述的USB接口的复用电路。An electronic device, comprising the multiplexing circuit of the USB interface as claimed in claim 8 .
  10. 一种计算机可读存储介质,存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1至7中任一项所述的USB接口的复用方法。A computer-readable storage medium storing a computer program, when the computer program is executed by a processor, the USB interface multiplexing method according to any one of claims 1 to 7 is implemented.
PCT/CN2022/078510 2021-03-09 2022-02-28 Method and circuit for multiplexing usb interface, and electronic device and storage medium WO2022188658A1 (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
EP22766184.0A EP4261699A4 (en) 2021-03-09 2022-02-28 Method and circuit for multiplexing usb interface, and electronic device and storage medium
US18/272,359 US20240078208A1 (en) 2021-03-09 2022-02-28 Method and circuit for multiplexing usb interface, electronic device and storage medium
JP2023540749A JP2024508592A (en) 2021-03-09 2022-02-28 USB interface multiplexing method, circuit, electronic equipment and storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110258065.6 2021-03-09
CN202110258065.6A CN115048324A (en) 2021-03-09 2021-03-09 Multiplexing method, circuit, electronic device and storage medium of USB interface

Publications (1)

Publication Number Publication Date
WO2022188658A1 true WO2022188658A1 (en) 2022-09-15

Family

ID=83156716

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/078510 WO2022188658A1 (en) 2021-03-09 2022-02-28 Method and circuit for multiplexing usb interface, and electronic device and storage medium

Country Status (5)

Country Link
US (1) US20240078208A1 (en)
EP (1) EP4261699A4 (en)
JP (1) JP2024508592A (en)
CN (1) CN115048324A (en)
WO (1) WO2022188658A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117251404A (en) * 2023-11-17 2023-12-19 北京小米移动软件有限公司 Control method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN201927859U (en) * 2011-01-10 2011-08-10 华为终端有限公司 Reusable interface
US20120263101A1 (en) * 2011-04-13 2012-10-18 Jibbe Mahmoud K Method to de-multiplex data and/or signals from a single data card into multiple interfaces and to allow parallel connectivity
CN105677602A (en) * 2015-12-30 2016-06-15 努比亚技术有限公司 Terminal port reusing device and method
CN205725735U (en) * 2016-04-14 2016-11-23 科立讯通信股份有限公司 Communication interface multiplexing switching circuit, device and digital handset
CN111597131A (en) * 2020-04-21 2020-08-28 广东天波信息技术股份有限公司 USB multiplexing circuit

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN201927859U (en) * 2011-01-10 2011-08-10 华为终端有限公司 Reusable interface
US20120263101A1 (en) * 2011-04-13 2012-10-18 Jibbe Mahmoud K Method to de-multiplex data and/or signals from a single data card into multiple interfaces and to allow parallel connectivity
CN105677602A (en) * 2015-12-30 2016-06-15 努比亚技术有限公司 Terminal port reusing device and method
CN205725735U (en) * 2016-04-14 2016-11-23 科立讯通信股份有限公司 Communication interface multiplexing switching circuit, device and digital handset
CN111597131A (en) * 2020-04-21 2020-08-28 广东天波信息技术股份有限公司 USB multiplexing circuit

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117251404A (en) * 2023-11-17 2023-12-19 北京小米移动软件有限公司 Control method and device, electronic equipment and storage medium
CN117251404B (en) * 2023-11-17 2024-01-30 北京小米移动软件有限公司 Control method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
EP4261699A4 (en) 2024-05-01
EP4261699A1 (en) 2023-10-18
JP2024508592A (en) 2024-02-28
US20240078208A1 (en) 2024-03-07
CN115048324A (en) 2022-09-13

Similar Documents

Publication Publication Date Title
US8521929B2 (en) Virtual serial port management system and method
US10198396B2 (en) Master control board that switches transmission channel to local commissioning serial port of the master control board
CN111901164B (en) Adaptive control method, device, equipment and system of OCP NIC network card
US9760525B2 (en) Sideband signal consolidation fanout using a clock generator chip
CN114721992B (en) Server and server management system thereof
CN116647247B (en) Signal transceiver and signal receiving and transmitting system suitable for flexible connection
WO2022188658A1 (en) Method and circuit for multiplexing usb interface, and electronic device and storage medium
TW201800954A (en) Universal serial bus hub with multiple hosts supported and automobile head unit using the same
CN105653461A (en) System for converting single USB interface into plurality of UART debugging interfaces
CN107480085A (en) Multiplex roles integrated test system
CN112256615B (en) USB conversion interface device
CN112069111B (en) Circuit design of timer adapter card compatible with bidirectional transmission
US10176133B2 (en) Smart device with no AP
CN207503207U (en) For the integrated test system of multiplex roles
CN111858459B (en) Processor and computer
CN201378316Y (en) Universal input/output interface extension circuit and mobile terminal with same
CN113900985A (en) IO and SPI multiplexing chip, multiplexing auxiliary chip and data interaction method
CN108874166B (en) KVM controller based on FPGA and PS2 protocol
CN209860929U (en) Communication bus structure
TW202018497A (en) Addressing method for integrated circuit chip and system thereof
CN105095033B (en) Debugging apparatus and method on a kind of server
TWI609270B (en) An automatic interface-changing system
TWI680683B (en) Network management device with wireless transmission
TWI818834B (en) Microcontroller and serial peripheral interface system using the same
CN213715913U (en) Micro control system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22766184

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2023540749

Country of ref document: JP

WWE Wipo information: entry into national phase

Ref document number: 18272359

Country of ref document: US

ENP Entry into the national phase

Ref document number: 2022766184

Country of ref document: EP

Effective date: 20230714

NENP Non-entry into the national phase

Ref country code: DE