The present document relates to the field of Universal Serial Bus (USB) communication, and specifically, to a method and terminal for starting a USB state machine.
A start condition of a charging state machine of a hand-held terminal is to detect whether a Charging Voltage (VCHG) is greater than a certain threshold limit value (e.g., 3.3V), when an external voltage is greater than the value, it is to begin to start the charging state machine and begin a charging management, otherwise the charging is stopped.
A start condition of a USB state machine of a hand-held terminal is to detect whether a voltage of a USB Voltage Bus (USB_VBUS) end is greater than a Session value (e.g., 2.0V) in the USB specification, when an external voltage is greater than the value, it is to begin to start a USB enumeration process, otherwise the USB state machine is stopped.
The China's Ministry of Information Industry (MII) issued Technical Requirements and Test Method of Charger and Interface for Mobile Telecommunication Terminal Equipment (YD/T1591-2009) in November, 2006, it is formulated that a USB communication cable and a USB charging cable are an identical cable in a handset, that is, the cable can serve as a charging cable and also can serve as a USB communication cable, thus the VCHG and the USB_VBUS of a charging interface of mobile phone are shorted together. Currently, in the industry, a common practice of a USB start scheme that a charger and USB communication share one interface is described below.
A. The VCHG and the USB_VBUS are shorted together.
The circuit of this method is comparatively simple, but there exists the following disadvantage, a withstand voltage of the USB_VBUS end of hand-held terminal chip is lower, which cannot satisfy overvoltage protection requirements formulated in the Technical Requirements and Test Method of Charger and Interface for Mobile Telecommunication Terminal Equipment.
B. The VCHG is used to control the USB_VBUS power-on through a hardware circuit.
This scheme can implement the charging overvoltage protection, but there exists an external circuit, which increases costs.
The technical problem required to be solved by the present document is to provide a method and terminal for starting a USB state machine, to trigger the start-up of the USB state machine through a signal for detecting plug-in and pull-out of a charger and possess a function of satisfying overvoltage protection.
In order to solve the above technical problem, the present document provides a method for starting a Universal Serial Bus (USB) state machine, which comprises:
connecting a USB voltage bus pin to a logic level;
if detecting that a voltage of a charging voltage pin is greater than a threshold limit value, starting a charging state machine and the USB state machine.
Preferably, the above method can further be characterized in that: the logic level is a high level and the high level is not greater than a withstand voltage value of the USB voltage bus pin, the method further comprises: before monitoring the voltage of the charging voltage pin, shielding a USB session interruption.
Preferably, the above method can further be characterized in that: the step of connecting a USB voltage bus pin to a logic level comprises: grounding the USB voltage bus pin.
Preferably, the above method can further be characterized in that: after the step of starting a charging state machine and the USB state machine, the method further comprises: if detecting that the voltage of the charging voltage pin is less than or equal to the threshold limit value, quitting the USB state machine.
Preferably, the above method can further be characterized in that: the threshold limit value is 3.3V.
In order to solve the above problem, the present document further provides a terminal, which comprises a Universal Serial Bus (USB) interface, the terminal comprises a logic level module and a management module, wherein a USB voltage bus pin is connected to the logic level module, wherein,
the logic level module is configured to: output a logic level;
the management module is configured to: if detecting that voltage of a charging voltage pin is greater than a threshold limit value, trigger a charging state machine and a USB state machine.
Preferably, the above terminal can further be characterized in that: the terminal further comprises a shielding module, wherein,
the management module is further configured to: if detecting that the logic level output by the logic level module is a high level and the high level is not greater than a withstand voltage value of the USB voltage bus pin, trigger the shielding module;
the shielding module is configured to: shield a USB session interruption.
Preferably, the above terminal can further be characterized in that: the logic level module is a grounding module.
Preferably, the above terminal can further be characterized in that: the management module is further configured to: after starting the charging state machine and the USB state machine, if detecting that the voltage of the charging voltage pin is less than or equal to the threshold limit value, quit the USB state machine.
Preferably, the above terminal can further be characterized in that: the threshold limit value is 3.3V.
In conclusion, a method and terminal for starting a USB state machine are provided in the present document, the USB state machine is started through a signal for detecting plug-in and pull-out of a charger, which can not only trigger the start-up of the USB state machine, but also possess a function of satisfying overvoltage protection, thereby the charger and the USB are enabled to share one physical interface with the simplest and securest method under the premise of guaranteeing the reliability.
The scheme of the present document is mainly to fix a USB_VBUS pin to a certain kind of logic level, and then through a threshold limit value of a voltage of a VCHG pin, to trigger a charging state machine and a USB state machine simultaneously. Compared with other like products, this method has the following advantages: no additional components are required and costs of hand-held terminal are not increased.
The main characteristic of the present document is to fix the USB_VBUS pin to a certain kind of logic level, the logic level is unrelated to the VCHG, the hand-held terminal software is utilized to start the USB state machine according to a level of the VCHG, and a principle of the VCHG starting the USB state machine is described as follows.
(1) The present document relates to two pins within an internal circuit of the hand-held terminal device.
One pin is a Charging Voltage (VCHG) pin, a role of the VCHG pin is to detect a plug-in state and a pull-out state of charger, when a voltage value of a VCHG end is greater than a certain threshold limit value (e.g., 3.3V), it is judged that the charger is plugged in, and when the voltage value of the VCHG end is less than or equal to a certain threshold limit value (e.g., 3.3V), it is judged that the charger is pulled out.
The other pin is a USB_VBUS pin which provides the power supply for a USB, when a voltage value of the USB_VBUS end is greater than a Session value (e.g., 2.0V) in the USB specification, it is judged that a USB communication cable is plugged in to start the USB state machine, and when a voltage value of the USB_VBUS end is less than or equal to a Session value (e.g., 2.0V) in the USB specification, it is judged that the USB communication cable is pulled out.
(2) An operating voltage range of the VCHG is comparatively high, which is normally from 10 volts to 20 volts (e.g., 18V); and an operating voltage range of the USB_VBUS end is comparatively low (e.g., 5.5V).
(3) It is required that a charging cable and the USB communication cable share an interface according to the Technical Requirements and Test Method of Charger and Interface for Mobile Telecommunication Terminal Equipment, and it is also required that the charging satisfies an overvoltage protection function, a overvoltage value is about 8V-10V, that is, when an output of the charger is 8V-10V, the hand-held terminal will not be damaged.
A specific implementation principle of the present document is described as follows.
In hardware, the USB_VBUS pin is fixed to a certain logic level, and the logic level is not greater than a withstand voltage value of the USB voltage bus pin, thus the USB_VBUS pin can be protected.
Since the withstand voltage of USB_VBUS is lower than a threshold limit value of overvoltage protection of the charging, when it is charged in overvoltage, the hand-held terminal may be damaged, thus the USB_VBUS pin and the VCHG pin are separated, the USB_VBUS pin is fixed to a certain kind of logic level such as a low logic level (e.g., short to the ground), or a voltage value of a high logic level (not greater than the withstand voltage value of USB_VBUS) is supplied.
In software, the USB state machine is started by detecting the voltage value of VCHG.
When the voltage value of VCHG end is greater than 3.3V, the part of Power Management (PM) in a terminal circuit judges that the charger is plugged in, an interruption request is generated at the meantime, it is to notify the part of base band control in the terminal of that the charger has been plugged in, it prepares to execute a flow of controlling the USB state machine, and the USB state machine is started in a flow of the charging state machine in the present document.
In order to better understand the present document, the present document will be further described in combination with the accompanying drawings and specific examples below.
the logic level module is configured to: output a logic level;
the management module is configured to: if detecting that a voltage of a charging voltage pin is greater than a threshold limit value, trigger a charging state machine and a USB state machine.
The terminal of the example also can include a shielding module, when the logic level output by the logic level module is a high level, the management module will trigger the shielding module, and the shielding module shields a USB session interruption.
The logic level module can be a grounding module, for example, the USB_VBUS is directly grounded.
Preferably, after starting the charging state machine and the USB state machine, the management module is further configured to: if detecting that the voltage of the charging voltage pin is less than or equal to the threshold limit value, quit the USB state machine.
In step S10, a USB_VBUS pin is connected to a logic level.
In step S20, if detecting that a voltage of a VCHG pin is greater than a threshold limit value, a charging state machine and a USB state machine are started.
The method for starting the USB state machine according to the present document will be described through two examples below.
In hardware, a USB_VBUS pin is connected to a low logic level.
In software, the implementation steps are shown in
In step 101, it is to detect whether a voltage value of a VCHG end is greater than a threshold limit value, if yes, i.e., it is detected that a charger is plugged in, step 102 and step 103 are executed, and if not, no processing is executed.
In step 102, a charging state machine is started, and a battery is charged.
In step 103, a USB state machine is started, and a USB enumeration process is performed.
A sequence for executing step 102 and step 103 is not limited.
In step 104, after the USB state machine is started, if detecting that the voltage value of the VCHG end is less than or equal to the threshold limit value, the software quits the USB state machine.
In hardware, a USB_VBUS pin is connected to a high logic level.
In software, the implementation steps are shown in
In step 201, when it is detected that a level of the USB_VBUS pin is the high logic level, during an initialization, a USB Session interruption is shielded, which makes the USB_VBUS pin fail to start a USB state machine.
In step 202, it is to detect whether a voltage value of a VCHG end is greater than a threshold limit value, if yes, i.e., it is detected that a charger is plugged in, step 203 and step 204 are executed, and if not, no processing is executed.
In step 203, a charging state machine is started, and a battery is charged.
In step 204, a USB state machine is started, and a USB enumeration process is performed.
A sequence of executing step 203 and step 204 is not limited.
In step 205, after the USB state machine is started, if detecting that the voltage value of VCHG end is less than or equal to the threshold limit value, the software quits the USB state machine.
The method for the hand-held terminal starting the USB state machine through a signal namely the Charging Voltage (VCHG) for detecting plug-in and pull-out of the charger is applied to any terminal products in which the charger and USB communication share one physical interface function.
The ordinary person skilled in the art can understand that all or part of the steps in the above method can be completed by a program instructing related hardware, and the program can be stored in a computer readable memory medium, such as a read-only memory, disk or optical disk and so on. Alternatively, all or part of the steps of the above examples also can be implemented by using one or multiple integrated circuits. Correspondingly, each module/unit in the above examples can be implemented in a form of hardware, and also can be implemented in a form of software function module. The present document is not limited to any combination of hardware and software in a specific form.
The above description is only the preferred examples of the present document, Certainly, the present document can still have other various examples, the skilled familiar to the art can make various corresponding changes and transformations according to the present document without departing from the spirit and essence of the present document, and these corresponding changes and transformations shall all fall into the protection scope of the appended claims of the present document.
A method and terminal for starting a USB state machine are provided in the present document, the USB state machine is started through a signal for detecting plug-in and pull-out of a charger, which can not only trigger the start-up of the USB state machine, but also possess a function of satisfying overvoltage protection, thereby the charger and the USB are enabled to share one physical interface with the simplest and securest method under the premise of guaranteeing the reliability.
Number | Date | Country | Kind |
---|---|---|---|
2010 1 0565920 | Nov 2010 | CN | national |
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/CN2011/072121 | 3/24/2011 | WO | 00 | 7/3/2013 |
Publishing Document | Publishing Date | Country | Kind |
---|---|---|---|
WO2012/071837 | 6/7/2012 | WO | A |
Number | Name | Date | Kind |
---|---|---|---|
20090045779 | Sherman et al. | Feb 2009 | A1 |
20100090644 | Nokkonen et al. | Apr 2010 | A1 |
20100164440 | Ikeda | Jul 2010 | A1 |
Number | Date | Country |
---|---|---|
101383627 | Mar 2009 | CN |
101702146 | May 2010 | CN |
101867647 | Oct 2010 | CN |
2001202163 | Jul 2001 | JP |
2007312476 | Nov 2007 | JP |
2007034803 | Mar 2007 | WO |
Entry |
---|
International Search Report for PCT/CN2011/072121 dated May 31, 2011. |
Number | Date | Country | |
---|---|---|---|
20130275644 A1 | Oct 2013 | US |