CN111698366B - Mobile phone hardware extension method based on USB interface - Google Patents
Mobile phone hardware extension method based on USB interface Download PDFInfo
- Publication number
- CN111698366B CN111698366B CN202010381755.6A CN202010381755A CN111698366B CN 111698366 B CN111698366 B CN 111698366B CN 202010381755 A CN202010381755 A CN 202010381755A CN 111698366 B CN111698366 B CN 111698366B
- Authority
- CN
- China
- Prior art keywords
- usb
- main processor
- mobile phone
- expansion
- resistor
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/10—Program control for peripheral devices
- G06F13/12—Program control for peripheral devices using hardware independent of the central processor, e.g. channel or peripheral processor
- G06F13/124—Program control for peripheral devices using hardware independent of the central processor, e.g. channel or peripheral processor where hardware is a sequential transfer control unit, e.g. microprocessor, peripheral processor or state-machine
- G06F13/126—Program control for peripheral devices using hardware independent of the central processor, e.g. channel or peripheral processor where hardware is a sequential transfer control unit, e.g. microprocessor, peripheral processor or state-machine and has means for transferring I/O instructions and statuses between control unit and main processor
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
Abstract
The invention provides a mobile phone hardware expansion method based on a USB interface, which is used for a multi-link communication mobile phone and comprises a main processor module, a control module and a USB interface module, wherein the main processor module is used for changing a working mode according to a preset level signal and sending a control signal; the working mode of the main processor module is any one of the following modes: USB-host mode or USB-device mode; the USB switching module is used for receiving a control signal of the main processor module and connecting at least one of the USB hub control chip and the TYPE-C connector according to the control signal; when the working mode of the main processor module is the USB-host mode, the USB switching module is communicated with the USB hub control chip, and the multi-link mobile phone is a main device and is used for connecting a plurality of USB external devices; and when the working mode of the main processor module is the USB-device mode, the USB switching module is electrically connected with the TYPE-C connector, and the multi-link communication mobile phone is a slave device and is used for connecting a control host.
Description
Technical Field
The invention relates to the technical field of USB interfaces, in particular to a mobile phone hardware expansion method based on a USB interface.
Background
At present, a common mobile phone generally has only one communication module; the main processor of the mobile phone is generally provided with a USB interface for charging the mobile phone or exchanging data with the PC, that is, the main processor of the mobile phone is used as a USB slave device, and the USB interface is used in a single manner. The lack of design is to increase the function of the USB by designing the USB.
Disclosure of Invention
The invention provides a mobile phone hardware expansion method based on a USB interface, which is used for solving the problem that the USB interface is single in use mode.
A mobile phone hardware expansion method based on USB interface is used for a multi-link communication mobile phone, and is characterized by comprising the following steps: the USB switching device comprises a main processor module, a USB switching module, a USB hub control chip and a TYPE-C connector, wherein the main processor module is respectively connected with the USB switching module and the TYPE-C connector, and a USB switching switch is connected with the USB hub control chip and the TYPE-C connector, wherein
The main processor module is used for changing a working mode according to a preset level signal and sending a control signal; wherein the content of the first and second substances,
the working mode of the main processor module is any one of the following modes:
USB-host mode or USB-device mode;
the USB switching module is used for receiving a control signal of the main processor module and connecting at least one of the USB hub control chip and the TYPE-C connector according to the control signal;
when the working mode of the main processor module is the USB-host mode, the USB switching module is communicated with the USB hub control chip, and the multi-link mobile phone is a main device and is used for connecting a plurality of USB external devices;
and when the working mode of the main processor module is the USB-device mode, the USB switching module is electrically connected with the TYPE-C connector, and the multi-link communication mobile phone is a slave device and is used for connecting a control host.
As an embodiment of the present invention: the main processor comprises a USB-ID end and is used for receiving a level signal sent by the GPIO end, judging whether the level signal is high level or low level, and switching the working mode of the main processor according to the judgment result, wherein,
the default working mode of the main processor is the USB-host mode;
when the main processor is started, when the USB-ID end judges that the level signal sent by the GPIO end is low level, the USB-host mode is switched;
and when the main processor is started, when the USB-ID terminal judges that the level signal sent by the GPIO terminal is high level, the USB-ID terminal is converted into a USB-device mode.
As an embodiment of the present invention: the USB switching module comprises a USB switching switch and a signal detection circuit; wherein the content of the first and second substances,
the USB selector switch comprises a first input channel group, a first output channel group, a second output channel group and a signal receiving end;
the first input channel group is connected with the main processor module;
the first output channel group is connected with the USB hub control chip;
the second output channel group is connected with the TYPE-C connector;
the signal receiving end is connected with the signal detection circuit and controls the first output channel group and the second output channel group to be switched on and off according to received signals.
As an embodiment of the present invention: the signal detection circuit includes: a first resistor, a second resistor, a third resistor, a fourth resistor, a first triode, a third triode and a power supply, wherein,
the positive electrode of the first resistor is connected with the main processor module, the negative electrode of the first resistor is connected with the base electrode of the first triode, and the base electrode of the first triode is also connected with the emitting electrode of the first triode through a second resistor and grounded;
the collector of the first triode is connected with the power supply through a third resistor;
the collector electrode of the first triode is also connected with the base electrode of a second triode, and the collector electrode of the second triode is connected with the signal receiving end of the USB transfer switch and used for controlling the first output channel group and the second output channel group to be switched on and switched off;
the collector of the second triode is also connected with the power supply through a fourth resistor;
the emitter of the second triode is grounded;
the first triode and the second triode are both NPN type triodes.
As an embodiment of the present invention: the USB hub control chip is connected with the USB switching module through a connector, the reset end of the USB hub control chip is also connected with the main processor module through a control circuit, wherein,
when the USB hub control chip is communicated with the USB selector switch, the USB hub control chip realizes a USB expansion function by connecting external communication equipment and external function equipment;
the control circuit includes: the second power supply, the fifth resistor, the sixth resistor, the third triode, the seventh resistor, the eighth resistor and the first capacitor;
the positive electrode of the fifth resistor is connected with the main processor module and used for receiving level signals;
the negative electrode of the fifth resistor is electrically connected with the base electrode of the third triode, and the negative electrode of the fifth resistor is also connected with the emitting electrode of the third triode through a sixth resistor and is connected with a node;
the collector of the third triode is electrically connected with the second power supply through a seventh resistor;
the collector of the third triode is connected with the reset end of the USB hub control chip through an eighth resistor;
and the negative electrode of the eighth resistor is also connected with a second power supply through a ninth resistor and is grounded through the first capacitor.
As an embodiment of the present invention: when TYPE-C connector with owner processor module and USB switch over the module and communicate simultaneously, TYPE-C connector can support two kinds of data transmission mode of USB2.0 and USB3.0 simultaneously.
As an embodiment of the present invention, the processor module further includes:
the coding module: the USB hub control chip is used for numbering the extended expansion ports of the USB hub control chip in the working mode of the USB-host mode and transmitting the serial numbers to the main processor control module for storing the serial numbers;
when the expansion port is used, the main processor control module detects the working condition of each serial number port of the expansion port according to the serial number, and controls the opening and closing of the expansion port expanded by the USB hub control chip through the serial number.
As an embodiment of the present invention, the step of controlling, by the main processor module, on and off of the expansion port expanded by the USB hub control chip according to the serial number includes:
step 11: constructing a transmission graph by taking the expansion port as a node, and displaying the transmission graph on the transmission graph through numbers;
step 12: marking a transmission vector of each numbered expansion port in the transmission diagram;
step 13: constructing a binary matrix of the expansion port according to the transmission vector; wherein;
the point mark 1 of data transmission in the binary matrix and the point mark 0 of data non-transmission;
step 14: determining the sparsity of data transmission of the expansion port according to the number of 0 and 1 in the binary matrix;
step 15: and judging the progress of data transmission according to the sparsity, marking 0 at all points of data transmission in the binary matrix, and turning off the expansion port with the corresponding number when the sparsity is 0.
As an embodiment of the present invention: when the main processor control module detects the working condition of the expansion port with each number, the following steps are executed:
acquiring a plurality of instantaneous data transmission speeds of each expansion port;
acquiring the instantaneous data transmission rate R of each expansion port according to the preset width T of the digital pulse signal and the instantaneous number x of the digital pulse signal transmitted by each expansion port acquired in real time:
R=(x/T)log2 Nwherein N is an effective discrete value of the digital pulse signal;
obtaining a plurality of continuous time instant data transmission rates R according to the instant data transmission rate R1,R2,R3……Rn;
Respectively calculating a plurality of variation amplitudes R of the transmission speed of the instantaneous data at each momentf:Wherein, f ═ (1,2,3 … … f) represents the f-th variation amplitude;
according to the variation amplitude RfObtaining the variation amplitude RfAverage value R offp;
According to the variation amplitude RfAverage value R offpAnd f variation amplitudes RfAnd calculating a condition value m of the change amplitude:the larger the condition value m of the change amplitude is, the worse the working condition of the expansion port is, and the smaller the condition value m of the change amplitude is, the better the working condition of the expansion port is.
As an embodiment of the present invention, the main processor module further includes:
an extension detection module: the system comprises a plurality of expansion ports, a data transmission module and a data transmission module, wherein the expansion ports are used for connecting equipment; wherein the content of the first and second substances,
the expansion detection module judges whether data transmission can be carried out or not through the following steps:
step 1: detecting the transmission efficiency A of the multilink mobile phone:
wherein δ represents a total amount of data transmitted by the multi-link handset; the Δ V represents the transmission rate of the multi-link mobile phone; the phi represents a spatial coefficient of the data; the S represents the space occupied by the data transmitted by the multi-link mobile phone; the beta represents a data conversion coefficient of the multi-link mobile phone;
step 2: detecting the transmission efficiency B of each expansion porti:
Wherein i represents the ith device, i is greater than 1; delta. theiRepresenting the total data output by the expansion port connected with the ith device; the Δ ViIndicating an output rate of an expansion port connected to the ith device; the phi represents a spatial coefficient of the data; said SiIndicating the estimated space occupied by the data transmitted from the expansion port connected with the ith device(ii) a Beta is the same asiA data conversion coefficient indicating an expansion port connected to the ith device;
and step 3: obtaining the adaptation degree mu of the equipment connected with the multilink mobile phone and the expansion port according to the transmission efficiency of the multilink mobile phone and the transmission efficiency of the expansion port:
when the adaptation degree mu is less than 1, the equipment connected with the multi-link mobile phone and the expansion port is not appropriate and cannot transmit data;
when the adaptation degree mu is 1, the device connected with the multi-link mobile phone and the expansion port is suitable for data transmission.
The invention has the beneficial effects that: by expanding the use mode of the USB interface of the mobile phone, the mobile phone processor can be connected with a plurality of communication modules, so that multilink communication is realized, and the inherent use of the USB interface is not influenced.
The main processor manages a plurality of communication modules through the USB, so that the multilink mobile phone is powered on and defaults to be in a USBhost state.
When the mobile phone needs to be used as a USB main device, after the mobile phone is powered on, the GPIO outputs low level to pull down the USB _ ID, so that the main processor enters a USBhost mode. At this time, the low level of the USB _ ID signal enables the USB2.0 switch to switch the USB2.0 interface of the main processor to the USB hub control chip side, so that the main processor manages the hardware paths of the plurality of communication modules through the hub chip.
When the mobile phone needs to be used as a USB slave device, a user sends a USBslave command to the processor from an upper application program, the GPIO outputs high level to pull up the USB _ ID, so that the main processor is converted into a USB device mode, and meanwhile, the high level of the USB _ ID signal enables the USB2.0 switch to switch the USB2.0 interface of the main processor to the TYPE C connector, so that the multi-link mobile phone can be used as a USB slave to be accessed into the host and simultaneously supports USB2.0 and USB 3.0.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and drawings.
The technical solution of the present invention is further described in detail by the accompanying drawings and embodiments.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the principles of the invention and not to limit the invention. In the drawings:
FIG. 1 is a schematic diagram of an embodiment of the present invention;
FIG. 2 is a schematic diagram of a USB switch of the USB switch module according to an embodiment of the present invention;
FIG. 3 is a schematic circuit diagram of a detection circuit of the USB switch module according to an embodiment of the present invention;
FIG. 4 is a control circuit for receiving GPIO signals in a peripheral circuit diagram of a USB hub control chip according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a USB hub control chip and its peripheral circuit diagram according to an embodiment of the present invention
Detailed Description
The preferred embodiments of the present invention will be described in conjunction with the accompanying drawings, and it will be understood that they are described herein for the purpose of illustration and explanation and not limitation.
As shown in fig. 1: the scheme is mainly the expansion of the USB2.0 technology, and the invention is used as a mobile phone hardware expansion method based on a USB interface, is used for a multi-link communication mobile phone, and comprises the following steps: the USB switching device comprises a main processor module, a USB switching module, a USB hub control chip and a TYPE-C connector, wherein the main processor module is respectively connected with the USB switching module and the TYPE-C connector, and a USB switching switch is connected with the USB hub control chip and the TYPE-C connector, wherein
The main processor module is used for changing a working mode according to a preset level signal and sending a control signal; the working mode of the main processor module is any one of the following modes:
USB-host mode or USB-device mode;
the USB switching module is used for receiving a control signal of the main processor module and connecting at least one of the USB hub control chip and the TYPE-C connector according to the control signal;
when the working mode of the main processor module is the USB-host mode, the USB switching module is communicated with the USB hub control chip, and the multi-link mobile phone is a main device and is used for connecting a plurality of USB external devices;
and when the working mode of the main processor module is the USB-device mode, the USB switching module is electrically connected with the TYPE-C connector, and the multi-link communication mobile phone is a slave device and is used for connecting a control host.
The principle of the invention is as follows: by expanding the use mode of the USB interface of the mobile phone, the mobile phone processor can be connected with a plurality of communication modules, so that multilink communication is realized, and the inherent use of the USB interface is not influenced. The main processor can manage a plurality of communication modules through the USB, and the power-on state of the multilink mobile phone is defaulted to be the USBhost state. When the mobile phone needs to be used as a USB main device, after the mobile phone is powered on, the GPIO outputs low level to pull down the USB-ID, so that the main processor enters a USBhost mode. At this time, the low level of the USB-ID signal enables the USB2.0 selector switch to switch the USB2.0 interface of the main processor to one side of the USB hub control chip, so that the main processor manages hardware channels of a plurality of communication modules through the hub control chip and is opened. When the mobile phone needs to be used as a USB slave device, a user sends a USBslave command to the processor from an upper application program, the GPIO outputs high level to pull up the USB _ ID, so that the main processor is converted into a USB device mode, and meanwhile, the high level of the USB _ ID signal enables the USB2.0 switch to switch the USB2.0 interface of the main processor to the TYPE C connector, so that the multi-link mobile phone can be used as a USB slave to be accessed into the host and simultaneously supports USB2.0 and USB 3.0.
The invention has the beneficial effects that: the invention can realize the switching between the slave equipment and the master equipment; when the USB expansion chip is switched to the master device, the plurality of external ports can be expanded through the USB expansion chip; when acting as a slave, USB2.0 and USB3.0 may be enabled for common use by TYPE-C connectors as slaves to a host device.
As an embodiment of the present invention: the main processor module comprises a main processor and a port expansion chip; wherein the content of the first and second substances,
the port expansion chip comprises a GPIO (general purpose input/output) end and sends out one of a low level signal or a high level signal through the GPIO end; the level signal output by the port expansion chip can only be a high level signal or a low level signal. The USB-ID of the main processor is pulled down or raised directly through the level signal to change the working mode of the main processor.
The main processor comprises a USB-ID end and is used for receiving a level signal sent by the GPIO end, judging whether the level signal is high level or low level, and switching the working mode of the main processor according to the judgment result, wherein,
the default working mode of the main processor is the USB-host mode;
when the main processor is started, when the USB-ID end judges that the level signal sent by the GPIO end is low level, the USB-host mode is switched;
and when the main processor is started, when the USB-ID terminal judges that the level signal sent by the GPIO terminal is high level, the USB-ID terminal is converted into a USB-device mode.
The principle of the invention is as follows: the main processor works in a USB-host mode by default, and the GPIO end is set to be at a low level when the main processor is started, so that the USB-ID end is at the low level; when the USB-device mode is converted, a high level signal can be automatically sent out through the GPIO end through connected equipment, and the command for controlling the level signal of the GPIO end determines the control command to be sent out according to actual equipment. And setting the GPIO terminal to be high level, and enabling the main processor to work in a USB-device mode. The main processor changes the working mode into a USB-host mode or a USB-device mode through the received level signal, and because of the certainty of the level signal, the working mode of the main processor is determined to be only the USB-host mode or the USB-device mode, that is to say, the multi-link mobile phone can be used as a main device capable of expanding a USB interface or a slave device capable of being used as a TYPE-C interface at the same time. Not only the USB interface is expanded, but also the multi-link mobile phone realizes the bidirectional selection of the expansion mode. As an extension of the use of a master or slave. So that the use mode of the multi-link mobile phone is more. The defect that the existing mobile phone can only be used as a slave device for charging the mobile phone or exchanging data with a PC (personal computer) is overcome, more functions are added to the multi-link mobile phone, and conditions are provided for connecting more USB (universal serial bus) devices. The invention selects the connecting equipment to be connected according to the level, and the USB-ID is used as the level identification end of the USB interface and can only identify the high level and the low level. The level and the equipment needing to be connected can be judged very quickly.
The invention has the beneficial effects that: the main processor module outputs high level or low level through the GPIO port to control the working mode; only two control signals of high level and low level are provided, thus ensuring the stability of the invention when the master device and the slave device are switched.
As an embodiment of the present invention: fig. 2 is a schematic circuit diagram of a USB switch of a USB switching module, where the USB switching module includes a USB switch and a signal detection circuit; wherein the content of the first and second substances,
the USB change-over switch comprises a first input channel group (D +, D-), a first output channel group (HSD1-, HSD1+), a second output channel group (HSD2-, HSD2) + and a signal receiving end OE;
the first input channel group (D +, D-) is connected with the main processor module;
the first output channel group (HSD1-, HSD1+) is connected with the USB hub control chip;
a second set of output channels (HSD2-, HSD2+) connected to said TYPE-C connector;
the signal receiving end is connected with the signal detection circuit, and controls the first output channel group (HSD1-, HSD1+) and the second output channel group (HSD2-, HSD2+) to be switched on and switched off according to received signals.
The OE end of the USB transfer switch is grounded through a resistor, and system resonance and overvoltage (such as ferromagnetism, high frequency, frequency division resonance and the like) caused by various reasons can be eliminated due to the obvious damping effect of the resistor. And the S end of the USB transfer switch is connected with the control signal of the main processor to execute a switch switching instruction.
The USB switch is used for connecting the main processor, the USB hub control chip and the TYPE-C connector, therefore, the USB switch at least has one input channel and two output channels, and for the main processor, the USB switch must also have a signal receiving end for receiving the control signal of the main processor for switching.
The invention has the beneficial effects that: the USB selector switch is switched through an electric signal, and the switched state is unique; the signal detection circuit of the present invention is composed to eliminate the system resonance and overvoltage caused by various reasons. And the USB switching process is ensured not to be interfered.
As an embodiment of the present invention: as shown in the schematic circuit diagram of the detection circuit of the USB switching module shown in fig. 3, the signal detection circuit includes: a first resistor R1, a second resistor R2, a third resistor R3, a fourth resistor R4, a first triode Q1, a third triode Q2 and a power supply VCC, wherein,
the anode of the first resistor R1 is connected with the main processor module, the cathode of the first resistor R1 is connected with the base of the first triode Q1, and the base of the first triode Q1 is also connected with the emitter of the first triode Q1 through a second resistor R2 and is grounded; the control signal enters the base electrode through the first resistor R1, is also connected with the emitter electrode through the first resistor R1 and the second resistor R2, and is grounded.
The collector of the first triode Q1 is connected with the power supply VCC through a third resistor R3; the power supply of the power supply is received, and the input voltage is divided through the third resistor R3, so that the current received by the triode is prevented from being too high.
The collector of the first triode Q1 is also connected with the base of a second triode Q2, and the collector of the second triode Q2 is connected with the signal receiving end of the USB change-over switch, so as to control the first output channel group and the second output channel group to be switched on and off; through two sets of output channels respectively in first output channel group and second output channel group, the USB change over switch of being convenient for switches the passageway of connecting. And the expansion function of the USB is realized.
The collector of the second triode Q2 is also connected with the power supply through a fourth resistor R4; and realizing the voltage division of the power supply VCC.
The emitter of the second triode Q2 is grounded; the emitter is grounded, that is, the connection between the internal emitter region and an external circuit is realized, according to the working condition, when the triode works in an amplifying state, the emitter potential of the NPN tube must be the lowest, the emitter potential of the PNP tube must be the highest, and the common amplifiers use the NPN tubes, and the direct-current power supply is generally grounded at the negative electrode, so the emitters of the triodes are grounded.
The first triode Q1 and the second triode Q2 are both NPN type triodes. The main functions are current amplification and as a switching function.
The invention has the beneficial effects that: the control signal input into the USB change-over switch can be detected through the detection circuit, and the control signal is guaranteed to be effective. The first transistor Q1 and the second transistor Q2 in the invention are both NPN transistors having power amplification and current gain functions.
As an embodiment of the present invention: fig. 5 is a schematic diagram of a USB hub control chip and its peripheral circuits according to an embodiment of the present invention, which is a selected one of the USB hub expansion chips according to the present invention. The USB hub control chip is connected with the USB switching module through a connector, the reset end of the USB hub control chip is also connected with the main processor module through a control circuit, wherein,
when the USB hub control chip is communicated with the USB change-over switch, the USB hub control chip realizes the USB expansion function by connecting external communication equipment and external functional equipment, and the peripheral circuit also comprises a circuit for filtering and controlling and adjusting. In addition, as shown in fig. 5, the USB hub control chip in this embodiment can extend four groups of external extension channels, so that the multi-link mobile phone can be used as a slave device and externally connected with four types of external extension devices.
The control circuit for receiving GPIO signals of the present invention as shown in fig. 4 includes: the circuit comprises a second power supply VCC2, a fifth resistor R5, a sixth resistor R6, a third triode Q3, a seventh resistor R7, an eighth resistor R8 and a first capacitor C1;
the anode of the fifth resistor R5 is connected with the main processor module and is used for receiving level signals; and dividing the output signal of the main processor to filter out the clutter in the signal.
The negative electrode of the fifth resistor R5 is electrically connected with the base electrode of the third triode Q3, and the negative electrode of the fifth resistor R5 is also connected with the emitter electrode of the third triode Q3 through a sixth resistor R6 to form a common collector emission amplifying circuit which is used as an input stage, an output stage and a buffer stage of the voltage amplifying circuit.
A collector of the third transistor Q3 is connected to the second power supply VCC2 through a seventh resistor R7; and supplying power to the third triode Q3, dividing the voltage of the output signal, and filtering out the noise in the signal.
The collector of the third triode Q3 is connected with the reset end of the USB hub control chip through an eighth resistor R8; and judging whether the function of the USB hub control chip is reset or not by receiving a signal of a GPIO end of the port expansion chip.
The negative electrode of the eighth resistor R8 is also connected with a second power supply through a ninth resistor R9; and the first capacitor C1 is grounded and used for filtering and removing impurities from the signal at the GPIO end of the port expansion chip. The control circuit is mainly used for connecting the USB hub control chip and controlling the data transmission and expansion of the USB hub control chip.
The invention has the beneficial effects that: the invention can receive the control signal of the GPIO end of the controller module; and the USB equipment controls the expansion of the USB hub control chip.
As an embodiment of the present invention: when TYPE-C connector with owner processor module and USB switch over the module and communicate simultaneously, TYPE-C connector can support two kinds of data transmission mode of USB2.0 and USB3.0 simultaneously.
In the invention, when the multi-link mobile phone is used as the slave equipment, the data transmission protocols of the USB2.0 bus and the USB3.0 bus can be executed simultaneously, and the data transmission mode of the slave equipment can be transmitted at different transmission rates according to requirements. When data transmission is increased, the control of the transmission speed is increased.
As an embodiment of the present invention: the main processor module further comprises:
the coding module: the USB hub control chip is used for numbering the extended expansion ports of the USB hub control chip in the working mode of the USB-host mode and transmitting the serial numbers to the main processor control module for storing the serial numbers;
when the expansion port is used, the main processor control module detects the working condition of each serial number port of the expansion port according to the serial number, and controls the opening and closing of the expansion port expanded by the USB hub control chip through the serial number.
When the coding module is used, a precondition is provided for the main processor to identify the extended USB interfaces, and the coding module codes each USB extended interface. The serial number of the USB expansion interface is obtained. The response of the expansion interface can be controlled by coding the number, and a precondition is provided for the single control of the expansion interface. The method is beneficial to the independent control of any expansion interface and the detection of the working condition of the expansion interface, namely the data transmission condition in use.
The invention has the beneficial effects that: after the encoding, the extended USB extended interface is convenient to identify, and further equipment connected with the USB extended interface can be controlled. The devices of the extended interface are more convenient to manage and distinguish.
As an embodiment of the present invention, the processor module further includes:
the coding module: the USB hub control chip is used for numbering the extended expansion ports of the USB hub control chip in the working mode of the USB-host mode and transmitting the serial numbers to the main processor control module for storing the serial numbers;
when the expansion port is used, the main processor control module detects the working condition of each serial number port of the expansion port according to the serial number, and controls the opening and closing of the expansion port expanded by the USB hub control chip through the serial number.
As an embodiment of the present invention, the step of controlling, by the main processor module, on and off of the expansion port expanded by the USB hub control chip according to the serial number includes:
step 11: constructing a transmission graph by taking the expansion port as a node, and displaying the transmission graph on the transmission graph through numbers; the transmission diagram marks the state of data transmission of each expansion port by numbers, namely transmission and non-transmission;
step 12: marking a transmission vector of each numbered expansion port in the transmission diagram;
the quantity of the transmitted data of each expansion port is marked, the quantity of the transmitted data is judged in the form of area size, and the transmission vector is the quantity of the transmitted data.
Step 13: constructing a binary matrix of the expansion port according to the transmission vector; wherein; the binary matrix is the state of each expansion port for transmitting data, which is marked with 0 and 1, and when the expansion port transmits, because it is a USB port, it includes a plurality of transmission channels, and the binary matrix represents the state of each transmission channel.
The point mark 1 of data transmission in the binary matrix and the point mark 0 of data non-transmission;
step 14: determining the sparsity of data transmission of the expansion port according to the number of 0 and 1 in the binary matrix; sparsity is the ratio of the transmission channel over which data is transmitted to the transmission channel over which no data is transmitted.
Step 15: and judging the progress of data transmission according to the sparsity, marking 0 at all points of data transmission in the binary matrix, and turning off the expansion port with the corresponding number when the sparsity is 0. And the sparsity is 0, all the data transmission points in the binary matrix are marked with 0, and the data transmission is finished.
The principle of the invention is as follows: the invention judges the transmission vector of the transmission port and whether each port is in an idle state or a working state by constructing the transmission diagram of the expansion port, automatically shuts off the data port in the idle state, and directly shuts off when the transmission is finished and the port is idle when a certain point transmits data to some equipment, thereby preventing other people from stealing the data from the port and being beneficial to keeping the security of the data.
When the main processor control module detects the working condition of the expansion port with each number, the following steps are executed:
acquiring a plurality of instantaneous data transmission speeds of each expansion port;
acquiring the instantaneous data transmission rate R of each expansion port according to the preset width T of the digital pulse signal and the instantaneous number x of the digital pulse signal transmitted by each expansion port acquired in real time:
R=(x/T)log2 Nwherein N is an effective discrete value of the digital pulse signal;
obtaining a plurality of continuous time instant data transmission rates R according to the instant data transmission rate R1,R2,R3……Rn;
Respectively calculating a plurality of variation amplitudes R of the transmission speed of the instantaneous data at each momentf:
according to the variation amplitude RfObtaining the variation amplitude RfAverage value R offp;
According to the variation amplitude RfAverage value R offpAnd f variation amplitudes RfAnd calculating a condition value m of the change amplitude:the larger the condition value m of the change amplitude is, the worse the working condition of the expansion port is, and the smaller the condition value m of the change amplitude is, the better the working condition of the expansion port is.
The principle of the invention is as follows: the method comprises the steps of obtaining the instantaneous transmission rate of each expansion interface, further determining each instantaneous transmission rate of each expansion interface and the change amplitude of the universal rate relative to the last instantaneous moment, and then calculating a plurality of state values of the change amplitudes through variance, and further determining whether the expanded USB interface is in a normal working state or not according to the working change amplitude of the working USB interface in a period of time.
The invention has the beneficial effects that: the operating condition of each USB interface can be detected. And further, whether each extended USB interface is in a good state or not is determined, and the detection and the maintenance of each USB extended interface are facilitated.
As an embodiment of the present invention, the main processor module further includes:
an extension detection module: the system comprises a plurality of expansion ports, a data transmission module and a data transmission module, wherein the expansion ports are used for connecting equipment; wherein the content of the first and second substances,
the expansion detection module judges whether data transmission can be carried out or not through the following steps:
step 1: detecting the transmission efficiency A of the multilink mobile phone:
wherein δ represents a total amount of data transmitted by the multi-link handset; the Δ V represents the transmission rate of the multi-link mobile phone; the phi represents a spatial coefficient of the data; the S represents the space occupied by the data transmitted by the multi-link mobile phone; the beta represents a data conversion coefficient of the multi-link mobile phone;
step 2: detecting the transmission efficiency B of each expansion porti:
Wherein i represents the ith device, i is greater than 1; delta. theiRepresenting the total data output by the expansion port connected with the ith device; the Δ ViIndicating an output rate of an expansion port connected to the ith device; the phi represents a spatial coefficient of the data; said SiRepresenting the estimated occupied space of data transmitted by an expansion port connected with the ith device; beta is the same asiA data conversion coefficient indicating an expansion port connected to the ith device;
and step 3: obtaining the adaptation degree mu of the equipment connected with the multilink mobile phone and the expansion port according to the transmission efficiency of the multilink mobile phone and the transmission efficiency of the expansion port:
when the adaptation degree mu is less than 1, the equipment connected with the multi-link mobile phone and the expansion port is not appropriate and cannot transmit data;
when the adaptation degree mu is 1, the device connected with the multi-link mobile phone and the expansion port is suitable for data transmission.
When the expansion port is used, some devices are good devices, but some devices can be placed for a long time, or the specification is not suitable, or some port pins fail, so that the ports are not matched during data transmission, or the data transmission is particularly slow, the working efficiency is influenced, the occurrence of the situation is reduced through calculation of the adaptation degree in the invention, and the devices which are not adapted are replaced.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.
Claims (9)
1. A mobile phone hardware expansion method based on USB interface is used for a multi-link communication mobile phone, and is characterized by comprising the following steps: the USB switching device comprises a main processor module, a USB switching module, a USB hub control chip and a TYPE-C connector, wherein the main processor module is respectively connected with the USB switching module and the TYPE-C connector, and a USB switching switch is connected with the USB hub control chip and the TYPE-C connector, wherein
The main processor module is used for changing a working mode according to a preset level signal and sending a control signal; wherein the content of the first and second substances,
the working mode of the main processor module is any one of the following modes:
USB-host mode or USB-device mode;
the USB switching module is used for receiving a control signal of the main processor module and connecting at least one of the USB hub control chip and the TYPE-C connector according to the control signal;
when the working mode of the main processor module is the USB-host mode, the USB switching module is communicated with the USB hub control chip, and the multi-link mobile phone is a main device and is used for connecting a plurality of USB external devices;
when the working mode of the main processor module is the USB-device mode, the USB switching module is electrically connected with the TYPE-C connector, and the multi-link communication mobile phone is a slave device and is used for connecting a control host;
the main processor module further comprises:
an extension detection module: the system comprises a plurality of expansion ports, a data transmission module and a data transmission module, wherein the expansion ports are used for connecting equipment; wherein the content of the first and second substances,
the expansion detection module judges whether data transmission can be carried out or not through the following steps:
Wherein, theRepresenting the total amount of data transmitted by a multi-link handset, saidRepresenting the transmission rate of the multi-link handset; the above-mentionedSpatial coefficients representing data, saidThe space occupied by the data transmitted by the multi-link mobile phone is represented; the above-mentionedRepresenting data conversion coefficients of the multi-link handset;
Wherein, theIs shown asThe number of the devices is one,greater than 1; the above-mentionedIndicates that is connected toTotal amount of data output from expansion port of each deviceIndicates that is connected toAn output rate of an expansion port of the device; the above-mentionedSpatial coefficients representing the data; the above-mentionedIndicates that is connected toEstimating the size of occupied space of data transmitted by an expansion port of each device; the above-mentionedIndicates that is connected toData conversion coefficients of expansion ports of the respective devices;
and step 3: obtaining the adaptation degree of the multilink mobile phone and the equipment connected with the expansion port according to the transmission efficiency of the multilink mobile phone and the transmission efficiency of the expansion port:
When the degree of adaptation isWhen the mobile phone is connected with the expansion port, the equipment connected with the multi-link mobile phone and the expansion port is not suitable, and data transmission cannot be carried out;
2. The mobile phone hardware expansion method based on the USB interface according to claim 1, wherein the main processor module includes a main processor and a port expansion chip; wherein the content of the first and second substances,
the port expansion chip comprises a GPIO (general purpose input/output) end and sends out one of a low-level signal and a high-level signal through the GPIO end;
the main processor comprises a USB-ID end and is used for receiving the level signal sent by the GPIO end, judging whether the level signal is high level or low level, and switching the working mode of the main processor according to the judgment result, wherein,
the default working mode of the main processor is the USB-host mode;
when the main processor is started, when the USB-ID end judges that the level signal sent by the GPIO end is low level, the USB-host mode is switched;
and when the main processor is started, when the USB-ID terminal judges that the level signal sent by the GPIO terminal is high level, the USB-ID terminal is converted into a USB-device mode.
3. The hardware expansion method for mobile phone based on USB interface as claimed in claim 1, wherein said USB switching module comprises USB switch and signal detection circuit; wherein the content of the first and second substances,
the USB selector switch comprises a first input channel group, a first output channel group, a second output channel group and a signal receiving end;
the first input channel group is connected with the main processor module;
the first output channel group is connected with the USB hub control chip;
the second output channel group is connected with the TYPE-C connector;
the signal receiving end is connected with the signal detection circuit and controls the first output channel group and the second output channel group to be switched on and off according to received signals.
4. The hardware extension method for mobile phone based on USB interface of claim 3, wherein the signal detection circuit comprises a first resistor, a second resistor, a third resistor, a fourth resistor, a first transistor, a third transistor and a power supply, wherein,
the positive electrode of the first resistor is connected with the main processor module, the negative electrode of the first resistor is connected with the base electrode of the first triode, and the base electrode of the first triode is also connected with the emitting electrode of the first triode through a second resistor and grounded;
the collector of the first triode is connected with the power supply through a third resistor;
the collector electrode of the first triode is also connected with the base electrode of a second triode, and the collector electrode of the second triode is connected with the signal receiving end of the USB transfer switch and used for controlling the first output channel group and the second output channel group to be switched on and switched off;
the collector of the second triode is also connected with the power supply through a fourth resistor;
the emitter of the second triode is grounded;
the first triode and the second triode are both NPN type triodes.
5. The mobile phone hardware expansion method based on the USB interface according to claim 1, wherein: the USB hub control chip is connected with the USB switching module through a connector, the reset end of the USB hub control chip is also connected with the main processor module through a control circuit, wherein,
when the USB hub control chip is communicated with the USB selector switch, the USB hub control chip realizes a USB expansion function by connecting external communication equipment and external function equipment;
the control circuit includes: the second power supply, the fifth resistor, the sixth resistor, the third triode, the seventh resistor, the eighth resistor and the first capacitor;
the positive electrode of the fifth resistor is connected with the main processor module and used for receiving level signals;
the negative electrode of the fifth resistor is electrically connected with the base electrode of the third triode, and the negative electrode of the fifth resistor is also connected with the emitting electrode of the third triode through a sixth resistor;
the collector of the third triode is connected with the second power supply through a seventh resistor;
the collector of the third triode is connected with the reset end of the USB hub control chip through an eighth resistor;
and the negative electrode of the eighth resistor is also connected with a second power supply through a ninth resistor and is grounded through the first capacitor.
6. The mobile phone hardware expansion method based on the USB interface according to claim 1, wherein: when TYPE-C connector with owner processor module and USB switch over the module and communicate simultaneously, TYPE-C connector can support two kinds of data transmission mode of USB2.0 and USB3.0 simultaneously.
7. The method as claimed in claim 1, wherein the main processor module further comprises:
the coding module: the USB hub control chip is used for numbering the extended expansion ports of the USB hub control chip in the working mode of the USB-host mode and transmitting the serial numbers to the main processor module for storing the serial numbers;
when the expansion port is used, the main processor module detects the working condition of each serial number port of the expansion port according to the serial number, and controls the opening and closing of the expansion port expanded by the USB hub control chip through the serial number.
8. The method as claimed in claim 7, wherein the step of controlling the opening and closing of the expansion port of the USB hub control chip expansion by the main processor module according to the serial number includes the following steps:
step 11: constructing a transmission graph by taking the expansion port as a node, and displaying the transmission graph on the transmission graph through numbers;
step 12: marking a transmission vector of each numbered expansion port in the transmission diagram;
step 13: constructing a binary matrix of the expansion port according to the transmission vector; wherein;
the point mark 1 of data transmission in the binary matrix and the point mark 0 of data non-transmission;
step 14: determining the sparsity of data transmission of the expansion port according to the number of 0 and 1 in the binary matrix;
step 15: and judging the progress of data transmission according to the sparsity, marking 0 at all points of data transmission in the binary matrix, and turning off the expansion port with the corresponding number when the sparsity is 0.
9. The mobile phone hardware expansion method based on the USB interface according to claim 7, wherein: when the main processor module detects the working condition of the numbered expansion port, the following steps are executed:
acquiring a plurality of instantaneous data transmission speeds of each expansion port;
according to the preset width of the digital pulse signalAnd the instantaneous number of the digital pulse signals transmitted by each expansion port acquired in real timeObtaining the instantaneous data transmission rate of each expansion port:
according to the instantaneous data transmission rateObtaining multiple instantaneous data transmission rates in continuous time;
Respectively calculating a plurality of variation amplitudes of the transmission speed of the instantaneous data at each moment:
According to the amplitude of variationAverage value of (2)And f change amplitudesCalculating the condition value of the variation amplitude:;
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010381755.6A CN111698366B (en) | 2020-05-08 | 2020-05-08 | Mobile phone hardware extension method based on USB interface |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010381755.6A CN111698366B (en) | 2020-05-08 | 2020-05-08 | Mobile phone hardware extension method based on USB interface |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111698366A CN111698366A (en) | 2020-09-22 |
CN111698366B true CN111698366B (en) | 2021-03-19 |
Family
ID=72477354
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010381755.6A Active CN111698366B (en) | 2020-05-08 | 2020-05-08 | Mobile phone hardware extension method based on USB interface |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111698366B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112131160B (en) * | 2020-09-27 | 2023-06-23 | 京东科技信息技术有限公司 | Working mode switching circuit, working mode switching method and robot |
CN111930184B (en) * | 2020-10-13 | 2021-01-01 | 飞天诚信科技股份有限公司 | Method, device and system for realizing external equipment simulation keyboard |
CN112579500A (en) * | 2020-12-08 | 2021-03-30 | 深圳市道通科技股份有限公司 | Method and device for prompting anti-misplug USB interface and electronic equipment |
CN116013379B (en) * | 2021-10-22 | 2024-04-02 | 广州开得联智能科技有限公司 | Control circuit of recording and broadcasting equipment and recording and broadcasting equipment |
CN114035023B (en) * | 2021-10-22 | 2022-08-19 | 宁波集联软件科技有限公司 | Multi-mode automobile core plate clamp judgment method and judgment system |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105744075A (en) * | 2016-03-31 | 2016-07-06 | 大连楼兰科技股份有限公司 | Mobile phone interconnection method based on OTG technique |
JP2016218972A (en) * | 2015-05-26 | 2016-12-22 | 株式会社バッファロー | USB hub device |
CN107908587A (en) * | 2017-10-19 | 2018-04-13 | 天津大学 | Real-time data acquisition transmitting device based on USB3.0 |
CN208689570U (en) * | 2018-08-01 | 2019-04-02 | 深圳市天英联合教育股份有限公司 | USB interface built-up circuit and all-in-one machine |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102662897B (en) * | 2012-03-31 | 2015-04-29 | 北京壹人壹本信息科技有限公司 | Mobile terminal and data interaction method between mobile terminals |
CN203966113U (en) * | 2014-07-28 | 2014-11-26 | 南京淼孚自动化有限公司 | The USB device that a kind of intelligence of the principal and subordinate for telemetry terminal system is switched |
CN106897239A (en) * | 2015-12-21 | 2017-06-27 | 小米科技有限责任公司 | state switching method and device |
CN108563537A (en) * | 2018-03-13 | 2018-09-21 | 珠海慧联科技有限公司 | A kind of USB principals and subordinates detection device and method |
WO2020088414A1 (en) * | 2018-10-29 | 2020-05-07 | SZ DJI Technology Co., Ltd. | A movable object performing real-time mapping using a payload assembly |
CN110377540A (en) * | 2019-07-18 | 2019-10-25 | 深圳优地科技有限公司 | Master-slave equipment switching device and terminal device under a kind of mode based on USB_OTG |
-
2020
- 2020-05-08 CN CN202010381755.6A patent/CN111698366B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2016218972A (en) * | 2015-05-26 | 2016-12-22 | 株式会社バッファロー | USB hub device |
CN105744075A (en) * | 2016-03-31 | 2016-07-06 | 大连楼兰科技股份有限公司 | Mobile phone interconnection method based on OTG technique |
CN107908587A (en) * | 2017-10-19 | 2018-04-13 | 天津大学 | Real-time data acquisition transmitting device based on USB3.0 |
CN208689570U (en) * | 2018-08-01 | 2019-04-02 | 深圳市天英联合教育股份有限公司 | USB interface built-up circuit and all-in-one machine |
Also Published As
Publication number | Publication date |
---|---|
CN111698366A (en) | 2020-09-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111698366B (en) | Mobile phone hardware extension method based on USB interface | |
CN108647180A (en) | A kind of arithmetic system and corresponding electronic equipment | |
CN114745224A (en) | Isolated asynchronous communication circuit and method of household appliance and household appliance | |
CN111597131B (en) | USB multiplexing circuit | |
CN103684407A (en) | Otg device | |
JP2012015803A (en) | Communication device, program, and communication method | |
CN113741257A (en) | Current loop communication circuit and air conditioning unit | |
CN210119772U (en) | Multiplexing interface device | |
CN109743240B (en) | Interface switching device and method for communication equipment | |
CN217821585U (en) | MAX485 receiving and dispatching control signal generating device based on serial port sending signal | |
CN108880599B (en) | Communication circuit, communication method thereof, controller and electric equipment | |
CN210327615U (en) | Communication circuit | |
US9735837B2 (en) | Method and wireless charging receiver capable of automatically detecting information of wireless power transmitter to limit maximum charging current provided for portable device | |
US8755291B2 (en) | Network interface apparatus with power management and power saving method thereof | |
CN114385527A (en) | Hard disk compatible platform, mainboard and control method | |
CN111400225B (en) | USB switching circuit | |
CN109344016B (en) | USB device capable of switching between host and device modes and switching method | |
CN216527161U (en) | Single-wire serial port communication circuit and electric equipment with same | |
TWI792840B (en) | Usb chip and operation method thereof | |
CN213240957U (en) | Electronic equipment | |
CN109558350B (en) | Program monitoring multiplexing port, control method and household appliance | |
CN215954102U (en) | Current loop communication circuit and air conditioning unit | |
CN215910619U (en) | Special cable detection device | |
CN213213461U (en) | Single-wire communication circuit capable of receiving and transmitting | |
CN215813787U (en) | Access equipment identification switching circuit and monitoring equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20210119 Address after: 2 / F, building 3, 19 Dongying Road, zhaoquanying Town, Shunyi District, Beijing Applicant after: Beijing Lianshan Science and Technology Co.,Ltd. Address before: 1 / F, building 3, 19 Dongying Road, zhaoquanying Town, Shunyi District, Beijing Applicant before: BEIJING LIANSHAN TIMES TECHNOLOGY Co.,Ltd. |
|
TA01 | Transfer of patent application right | ||
GR01 | Patent grant | ||
GR01 | Patent grant |