Disclosure of Invention
In view of the deficiencies in the prior art, the present invention provides a method and an electronic device for reducing power consumption of USB transmission, which can save power consumption of a PLL in certain specific scenarios by turning off the PLL and using an externally provided 60M clock to implement normal functions of a USB PHY.
In order to achieve the purpose, the invention can adopt the following technical scheme:
a method of reducing power consumption for USB transmissions, comprising:
judging that the USB is about to enter or exit a high-speed mode according to the received control signal, the bus state signal and the current connection state;
if the high-speed mode is about to be entered, opening the PLL of the USB, and switching a clock source to the PLL;
and if the high-speed mode is to be exited, switching the clock source of the USB to an externally provided clock, and closing the PLL.
The method for reducing power consumption of USB transmission as described above further obtains a current bus state signal according to a signal level on a port of the USB.
The method for reducing power consumption of USB transmission as described above, further, the current connection state includes reset handshake, high-speed idle, full-speed idle, high-speed sleep, and full-speed sleep states.
An electronic device for reducing power consumption of USB transmission, comprising:
a first transceiver;
a second transceiver which transmits data at a lower speed than the first transceiver, and the first transceiver and the second transceiver communicate with another electronic device through a data line DP and a data line DM;
a clock unit having a first clock circuit and a second clock circuit, and connected to the first transceiver and the second transceiver, respectively; and (c) a second step of,
a controller connected to the first transceiver, the second transceiver, and the clock unit, respectively, wherein,
and the controller judges whether the subsequent operation mode of the USB is a high-speed mode or a non-high-speed mode according to the control signal, the bus state signal and the current connection state received by the first transceiver or/and the second transceiver of the USB.
The electronic device for reducing power consumption of USB transmission as described above, further, the clock unit switches between the first clock circuit and the second clock circuit according to an instruction issued by the controller.
In the electronic device for reducing power consumption of USB transmission, when the controller determines that the USB is in the non-high-speed mode or is about to enter the non-high-speed mode, the clock source of the USB is changed from the first clock circuit to the second clock circuit.
In the electronic device for reducing power consumption of USB transmission, when the controller determines that the USB is in the high-speed mode or is about to enter the high-speed mode, the clock source of the USB is changed from the second clock circuit to the first clock circuit.
In the electronic device for reducing power consumption of USB transmission, further, the first transceiver or/and the second transceiver obtains a current bus state signal according to a signal level on a port of the USB.
The electronic device for reducing power consumption of USB transmission as described above, further, the current connection state machine includes reset handshake, high-speed idle, full-speed idle, high-speed sleep, and full-speed sleep states.
In the electronic device for reducing power consumption of USB transmission as described above, further, the first transceiver is in a USB2.0 specification supporting a 480Mbps rate; the second transceiver is USB1.1 specification supporting 12Mbps rate or/and USB1.0 specification of 1.5Mbps rate.
Compared with the prior art, the invention has the beneficial effects that: the invention provides a method and an electronic device for reducing power consumption of USB transmission, which can realize the normal function of a USB PHY by closing a PLL and using an externally provided 60M clock, thereby saving the power consumption of one PLL under certain specific scenes.
Detailed Description
The technical solutions in the embodiments of the present invention will be described clearly and completely with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Example (b):
it should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In the description of the present invention, "a plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise. Furthermore, unless expressly stated or limited otherwise, the terms "mounted," "connected," and "connected" are to be construed broadly, as they may be fixedly connected, detachably connected, or integrally connected, for example; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
Referring to fig. 1 to 6, the present invention provides a method and an electronic device for reducing power consumption of USB transmission, which can save power consumption of a PLL in certain specific scenarios by turning off the PLL and using an externally provided 60M clock to implement normal functions of a USB PHY.
It should be noted that, in the USB2.0 interface standard of the latest version, the USB1.1 is 12Mbps, the new USB2.0 standard divides the USB interface speed into three types, which are High-speed interfaces (HS for short) with a transmission rate of 25Mbps to 400Mbps (480 Mbps at most); a Full-speed interface (FS for short) with the transmission rate of 500Kbps-10Mbps (maximum 12 Mbps); the transmission rate is 10kbps-400100kbps (maximum 1.5Mbps) Low-speed interface (LS for short).
The DM is a USB data line D- (normally, a white line), and the DP is a USB data line D + (normally, a green line).
It should be noted that the USB full-speed peripheral (FS) and the low-speed peripheral (LS) are distinguished by pulling up a 1.5K resistor on the D + or D-data line, where D + is a full-speed peripheral and D-is a low-speed peripheral. The identification of the high-speed peripheral equipment needs to be identified through the handshake between the host and the high-speed peripheral equipment.
It should be noted that the USB PHY of the present invention is a device connected to a USB controller, which has a speed of at most 480Mbps or more, and is a high-speed USB device compliant with the USB2.0 standard. Further, the USB PHY according to the present invention is in the form of a module or a device, and the USB PHY in the form of a module or an equipment is loadable in a portable terminal device.
It should be noted that the first transceiver and the second transceiver of the present invention are also referred to as a high-speed transceiver and a non-high-speed transceiver, respectively, in the following embodiments.
Referring to fig. 1, aUSB host 101 connects theUSB host 101 and a first USB PHY102 through a connection line or a data cable inside an integrated circuit, and transmits and receives data. TheUSB slave 104 connects theUSB slave 104 and the second USB PHY 103 through a connection line or a data cable inside the integrated circuit, wherein the first USB PHY102 and the second USB PHY 103 communicate through a data line DM and a data line DP.
The method for clock switching of the clock unit of the present embodiment is shown in fig. 2. The PLL is in an off state when the PHY is reset, and is in an off state by default after the reset is released, and is not turned on until a certain condition is satisfied. When the high-speed mode is subsequently entered, the PLL is opened, and after the PLL is stabilized, the relevant clock source is switched to the clock generated by the PLL. When the high-speed mode is exited subsequently, the relevant clock source is switched to the external clock, and the PLL is turned off. The logic circuit for judging whether to switch the PLL subsequently can be realized in the PHY or in the controller. The circuit using the PLL and its divided clock is a first clock circuit, and the circuit using the external clock is a second clock circuit. It can be understood that the wake-up signal of this embodiment is only one, that is, the wake-up signal conforms to the USB standard protocol, the controller determines the data rate of the subsequent normal operating mode according to the connection state before entering the sleep mode, and determines whether the clock source selects the external low-frequency clock or the PLL high-frequency clock according to the data rate. With reference to fig. 1, further, after receiving the sleep signal, the PLL clock is directly turned off, and after receiving the wake-up signal, the subsequent connection state is determined according to the wake-up signal and the previous connection state, and the clock source in the normal operating mode is switched according to the subsequent connection state. In the above embodiment, further, the controller switches the clock source according to the predetermined peripheral connection state and when the sleep is finished, and selects the available clock source with the minimum power consumption according to the data transmission rate, so that the power consumption during the normal operation (non-sleep) is saved.
TABLE 1 timing parameter Table for USB high speed handshaking operation
Referring to fig. 3 and table 1, fig. 3 is a schematic flow chart of USB high-speed handshake. If the final arbitration result of the reset handshake is full-speed or low-speed, the PLL does not need to start, so this embodiment does not involve other reset handshake flows, and only needs to analyze the high-speed mode handshake flow. At time T0, when the host state machine is in an unconnected state, the device is seen to be present, at this time, the device DP is pulled up to 3.3V through a 1.5K resistor, and DM is pulled down to ground, the host state machine enters a reset state, the xcvrel signal is set to 0, the termsel signal is set to 0, and the 45 Ω terminating resistor is openedThe bus will become SE 0. If the device supports the high-speed mode, the device enters the high-speed mode at the time of T1 and starts to transmit Chirp K (a port signal defined in a USB standard protocol), the Chirp K length transmitted by the slave computer is maintained for at least 1ms, and the master computer starts to transmit the KJ sequence after detecting that the Chirp K transmitted by the device is finished. For the slave, the slave considers that the master supports the high-speed mode after seeing that the master sends 6 KJ sequences, and then enters the high-speed mode, at the moment, the slave can open the PLL, and after the PLL is stabilized, the clock source is switched to the PLL clock. According to USB protocol section 7.1.7.5, the device only needs to be T after time T4WTHSIt is only necessary to complete the switching to the high-speed mode internally, TWTHSThe maximum value is 500us, and the PLL only needs 50us from opening to stabilizing in design, so that the timing requirement of the protocol can be met. For the host, according to the USB protocol section 7.1.7.5, the interval from T6 to T7 is not less than 100us and not more than 500us, and if the host turns on the PLL at time T6, after 50us, the PLL is stable, the clock source can be switched to the PLL clock, which can meet the timing requirement of the USB protocol.
TABLE 2 timing parameter table for USB Suspend operation
Referring to fig. 4 and table 2, fig. 4 is a schematic diagram illustrating the USB entering into the sleep state. Going to sleep from the high speed mode is necessarily a host initiated operation, and at time T0 the software sets the host to go to sleep, the host stops sending data (including SOF), and the bus is thereafter in SE0 (a port level state defined in the USB standard protocol). For the slave, after seeing the SE0 for 3ms, the slave determines whether the SE0 is a reset flow or a sleep flow: if it is a reset flow, the subsequent flow refers to the high-speed handshake of fig. 3. If it is a sleep flow, the controller sets the PHY to a sleep state before the time point T3 and the time point T5, turns off the PLL, and switches the clock source to the external clock. For the host, the USB protocol does not specify the time point when the host enters the sleep state, nor does it specify the low power consumption state that the host must enter, and the designer decides the processing method at his discretion. In the design scheme of the invention, the host enters the sleep mode 4ms after the sleep operation is sent, the PLL is closed, and the clock source is switched to the external clock.
TABLE 3 timing parameter table for USB to perform high-speed remote _ wakeup operation
Referring to fig. 5 and table 3, fig. 5 is a schematic flowchart of the USB performing the high-speed remote wake-up operation. When the device enters sleep for a long enough time, that is, after time point T4 in fig. 4, the software may initiate the remote wakeup operation, and the controller at time T0 notifies the PHY to exit the sleep state, and even if the device is in the high-speed state before entering sleep and the PLL does not need to be started at this time, the xcvrel signal is 1, the termsel signal is 1, the PHY is in the full-speed mode, after utmi _ clk is stable, the controller sets the txvalid signal high, and the PHY starts to transmit the full-speed K signal at time T1, and the K signal holding time of the slave is not less than TDRSMDN and not greater than TDRSMUP. At this time, only 15K of pull-down resistors are pulled down to the ground at the host end, the signal strength sent by the device is larger, the bus is in a K state, the host recognizes a wake-up signal sent by the slave at time T2 after seeing the continuous K signal on the bus, exits from the sleep state, and starts to send a full-speed K signal, and the full-speed K signal continues to a time point T5 for a time period of not less than 20ms (tdrsmdn). As can be seen from fig. 4, if the slave PHY starts the PLL 15ms after the time T1 is transmitted, the start PLL operation can be completed within 50us, and there is enough time to complete the clock switching before the time T5. The host starts the PLL 15ms after seeing the wake-up signal of the slave (theoretically, the timing is 16ms after the time point of T1), the PLL start operation can be completed within 50us, and the clock switching is completed before the time point of T6.
TABLE 4 timing parameter table for USB high speed resume operation
Referring to fig. 6 and table 4, fig. 6 is a schematic flowchart of the USB performing the high-speed wake-up operation. At time T0, the software starts the wake-up operation, the controller notifies the PHY to exit the sleep state, even if the device is in a high-speed state before entering the sleep state, the PLL does not need to be started at this time, the xcvrel signal is 1, the termsel signal is 1, the PHY is in a full-speed mode, and after utmi _ clk is stable, the controller sets the txvalid signal high, at time T1, the PHY starts to transmit a full-speed K signal, the wake-up signal transmitted by the PHY needs to last at least 20ms (tdrsmdn), and after the slave sees the K signal that continues on the bus, the wake-up signal transmitted by the slave is recognized at time T2, and the slave exits the sleep state. As can be seen from fig. 4, if the slave PHY starts the PLL 15ms after the time T2 is transmitted, the start PLL operation can be completed within 50us, and there is enough time to complete the clock switching before the time T5. The host starts the PLL 15ms after T, and the PLL start operation is completed within 50us, and the clock switching is completed before T6.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
The above embodiments are only for illustrating the technical concept and features of the present invention, and the purpose thereof is to enable those skilled in the art to understand the contents of the present invention and implement the present invention accordingly, and not to limit the protection scope of the present invention accordingly. All equivalent changes or modifications made in accordance with the spirit of the present disclosure are intended to be covered by the scope of the present disclosure.