Chip control method and device and slave equipment
By detecting the current status in the slave device and powering on and off, enabling or disabling the USB chip as needed, the problem of high power consumption caused by the inability of USB data transmission-related modules to sleep is solved, and the method of reducing power consumption in the idle state is achieved. Effect.
Patent Information
- Application Number
- CN202410686642.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-05-30
AI Technical Summary
After the slave device is connected to the host device through the USB interface, the modules related to USB data transmission cannot enter the sleep state, resulting in high power consumption.
By obtaining the current status of the slave device, when it is determined to be in the idle state, power off the microcontroller and set the USB chip to a non-enabled state, detect whether there is data to be transmitted, and if so, power on and enable the USB chip. In order to set the USB chip to sleep state in idle state.
It effectively reduces the power consumption of the slave device, allows the USB chip to be in a sleep state without affecting data transmission, and reduces ineffective power supply.
Smart Images

Figure CN118656315A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of communication technology, and in particular, to a chip control method, device and slave device. Background Art
[0002] The slave device can perform data transmission with the master device through the Universal Serial Bus (USB) interface of the host device.
[0003] When the slave device is in an idle state, the chip and microcontroller of the slave device can enter a dormant state to reduce the power consumption of the slave device. In actual applications, for any chip or microcontroller, the chip or controller can only be in a dormant state when each module in the chip or microcontroller is in a dormant state. In the above process, if the slave device is connected to the host device through the USB interface, the module related to USB data transmission will always remain in a working state and cannot be set to a dormant state. Therefore, there are modules in the slave device that are not in a dormant state, resulting in higher power consumption of the slave device. Summary of the invention
[0004] The embodiments of the present application provide a chip control method, device and slave device to solve the problem of high power consumption of the slave device.
[0005] In a first aspect, an embodiment of the present application provides a chip control method, which is applied to a slave device, wherein the slave device includes a universal serial bus USB chip and at least one microcontroller, and the method includes:
[0006] Obtaining the current state of the slave device;
[0007] When it is determined that the current state of the slave device is an idle state, powering off the at least one microcontroller and setting the USB chip to a disabled state;
[0008] Detecting whether there is data to be transmitted corresponding to the USB chip;
[0009] When it is determined that there is data to be transmitted corresponding to the USB chip, the at least one microcontroller is powered on, and the USB chip is set to an enabled state.
[0010] In a possible implementation, the USB chip includes a controller, a transceiver, and a register; and setting the USB chip to a disabled state includes:
[0011] Setting the transmission state of the controller to a closed state;
[0012] The transceiver is set to a detection state.
[0013] In a possible implementation manner, the transceiver includes a first data pin and a second data pin; and setting the transceiver to a detection state includes:
[0014] Obtaining a transmission type of the slave device;
[0015] If the transmission type of the slave device is a preset type, setting the first data pin to a low level interrupt state to set the transceiver to the detection state;
[0016] If the transmission type of the slave device is a non-preset type, the second data pin is set to the low-level interrupt state to set the transceiver to the detection state.
[0017] In a possible implementation manner, determining that the current state of the slave device is an idle state includes:
[0018] Obtaining a status signal corresponding to the USB chip;
[0019] If the state signal is a preset signal, and the duration corresponding to the state signal being the preset signal is greater than or equal to the preset duration, it is determined that the current state of the slave device is an idle state.
[0020] In a possible implementation manner, detecting whether there is data to be transmitted corresponding to the USB chip includes:
[0021] determining a detection state of the transceiver;
[0022] If the detection state of the transceiver is the awake state, determining that there is data to be transmitted corresponding to the USB chip;
[0023] If the detection state of the transceiver is a non-awakening state, it is determined that there is no data to be transmitted corresponding to the USB chip.
[0024] In a possible implementation manner, determining the detection state of the transceiver includes:
[0025] Get the comparison voltage;
[0026] If the voltage of the signal received by the transceiver through the first data pin or the second data pin is less than the comparison voltage, determining that the detection state of the transceiver is the awake state;
[0027] If the voltage of the signal received by the transceiver through the first data pin or the second data pin is greater than or equal to the comparison voltage, it is determined that the detection state of the transceiver is the non-awakening state.
[0028] In a possible implementation, setting the USB chip to an enabled state includes:
[0029] Setting the transmission state of the controller to an on state;
[0030] The transceiver is set to a non-detection state.
[0031] In a possible implementation manner, setting the transceiver to a non-detection state includes:
[0032] If the transmission type of the transceiver is a preset type, setting the first data pin to a signal transmission state to set the transceiver to the non-detection state;
[0033] If the transmission type of the transceiver is a non-preset type, the second data pin is set to the signal transmission state to set the transceiver to the non-detection state.
[0034] In a possible implementation, the method further includes:
[0035] When the transceiver is in the detection state, setting the USB chip to a non-detection state to disable an interrupt detection function of the USB chip;
[0036] When the transceiver is in the non-detection state, the USB chip is set to the detection state to enable the interruption detection function of the USB chip.
[0037] In a second aspect, an embodiment of the present application provides a chip control device, the device comprising:
[0038] The acquisition module is used to obtain the current status of the slave device;
[0039] A first setting module, configured to power off at least one microcontroller and set a USB chip to a disabled state when determining that the current state of the slave device is an idle state;
[0040] A detection module, used for detecting whether there is data to be transmitted corresponding to the USB chip;
[0041] The second setting module is used to power on the at least one microcontroller and set the USB chip to an enabled state when it is determined that there is data to be transmitted corresponding to the USB chip.
[0042] In a possible implementation manner, the first setting module is specifically configured to:
[0043] Setting the transmission state of the controller to a closed state;
[0044] The transceiver is set to a detection state.
[0045] In a possible implementation manner, the first setting module is specifically configured to:
[0046] Obtaining a transmission type of the slave device;
[0047] If the transmission type of the slave device is a preset type, setting the first data pin to a low level interrupt state to set the transceiver to the detection state;
[0048] If the transmission type of the slave device is a non-preset type, the second data pin is set to the low-level interrupt state to set the transceiver to the detection state.
[0049] In a possible implementation manner, the first setting module is specifically configured to:
[0050] Obtaining a status signal corresponding to the USB chip;
[0051] If the state signal is a preset signal, and the duration corresponding to the state signal being the preset signal is greater than or equal to the preset duration, it is determined that the current state of the slave device is an idle state.
[0052] In a possible implementation, the detection module is specifically used to:
[0053] determining a detection state of the transceiver;
[0054] If the detection state of the transceiver is the awake state, determining that there is data to be transmitted corresponding to the USB chip;
[0055] If the detection state of the transceiver is a non-awakening state, it is determined that there is no data to be transmitted corresponding to the USB chip.
[0056] In a possible implementation, the detection module is specifically used to:
[0057] Get the comparison voltage;
[0058] If the voltage of the signal received by the transceiver through the first data pin or the second data pin is less than the comparison voltage, determining that the detection state of the transceiver is the awake state;
[0059] If the voltage of the signal received by the transceiver through the first data pin or the second data pin is greater than or equal to the comparison voltage, it is determined that the detection state of the transceiver is the non-awakening state.
[0060] In a possible implementation manner, the second setting module is specifically configured to:
[0061] Setting the transmission state of the controller to an on state;
[0062] The transceiver is set to a non-detection state.
[0063] In a possible implementation manner, the second setting module is specifically configured to:
[0064] If the transmission type of the transceiver is a preset type, setting the first data pin to a signal transmission state to set the transceiver to the non-detection state;
[0065] If the transmission type of the transceiver is a non-preset type, the second data pin is set to the signal transmission state to set the transceiver to the non-detection state.
[0066] In a possible implementation manner, the device further includes a third setting module.
[0067] Wherein, the third setting module is used for:
[0068] When the transceiver is in the detection state, setting the USB chip to a non-detection state to disable an interrupt detection function of the USB chip;
[0069] When the transceiver is in the non-detection state, the USB chip is set to the detection state to enable the interruption detection function of the USB chip.
[0070] In a third aspect, the present application provides a chip having a computer program stored thereon, wherein when the computer program is executed by the chip, the method as described in any one of the first aspects is implemented.
[0071] In a fourth aspect, the present application provides a chip module having a computer program stored thereon, wherein when the computer program is executed by the chip module, the method as described in any one of the first aspects is implemented.
[0072] In a fifth aspect, an embodiment of the present application provides a slave device, including:
[0073] at least one processor; and
[0074] a memory communicatively connected to the at least one processor; wherein,
[0075] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform any method described in the first aspect.
[0076] In a sixth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute any one of the methods described in the first aspect.
[0077] In a seventh aspect, an embodiment of the present application provides a computer program product, including a computer program, which implements any method in the first aspect when executed by a processor.
[0078] The chip control method, device and slave device provided in the embodiment of the present application obtain the current state of the slave device. When it is determined that the current state of the slave device is an idle state, at least one microcontroller is powered off, and the USB chip is set to a non-enabled state. Detect whether there is data to be transmitted corresponding to the USB chip. When it is determined that there is data to be transmitted corresponding to the USB chip, at least one microcontroller is powered on, and the USB chip is set to an enabled state. In the above process, when the slave device is in an idle state, the USB chip can be set to a non-enabled state. In this way, the module related to USB data transmission can be in a dormant state, so that the USB chip of the slave device is in a dormant state, and the power consumption of the slave device is reduced on the basis that the module related to USB data transmission is not powered off. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] Figure 1A A schematic diagram of an application scenario provided in an embodiment of the present application;
[0080] Figure 1B A schematic diagram of another application scenario provided for an embodiment of the present application;
[0081] Figure 2 A schematic diagram of a chip control method provided in an embodiment of the present application;
[0082] Figure 3 A schematic diagram of the structure of a USB chip provided in an embodiment of the present application;
[0083] Figure 4 A schematic flow chart of another chip control method provided in an embodiment of the present application;
[0084] Figure 5 A schematic diagram of a process for determining that the current state of a slave device is an idle state provided in an embodiment of the present application;
[0085] Fig. 6A A schematic diagram of a connection between a slave device and a host device provided in an embodiment of the present application;
[0086] Figure 6B A schematic diagram of another connection between a slave device and a host device provided in an embodiment of the present application;
[0087] Figure 7 A schematic diagram of maintaining power supply of a UBS chip provided in an embodiment of the present application;
[0088] Figure 8 A schematic diagram of a chip control process provided in an embodiment of the present application;
[0089] Fig. 9 A schematic diagram of the structure of a chip control device provided in an embodiment of the present application;
[0090] Fig.10 A schematic diagram of the structure of another chip control device provided in an embodiment of the present application;
[0091] Fig.11 A schematic diagram of the structure of a slave device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0092] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0093] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0094] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0095] For ease of understanding, below, combined Figure 1A-1B , the application scenarios to which the embodiments of the present application are applicable are described.
[0096] Figure 1AA schematic diagram of an application scenario provided by an embodiment of the present application. Figure 1A , including a host device 101 and a slave device 102. The host device 101 can be a computer, the slave device 102 can be a mobile phone, and the slave device 102 includes a USB chip and at least one microcontroller. The host device 101 and the slave device 102 are connected through a USB interface and transmit data through the USB interface.
[0097] Figure 1B Another application scenario diagram provided for the embodiment of the present application. Figure 1B , including a decision tree 103 of the chip and each microcontroller in the slave device 102. According to the decision tree 103, it can be determined that the chip or the controller can be in a dormant state only when the chip or the microcontroller is in a dormant state. When the chip or the microcontroller of the slave device 102 is in a dormant state, the power consumption of the slave device 102 can be reduced.
[0098] In the above process, if the slave device is connected to the host device through the USB interface, the modules related to USB data transmission will always remain in working state and cannot be set to sleep state. Therefore, some modules of the slave device are not in sleep state, resulting in high power consumption of the slave device.
[0099] In an embodiment of the present application, the current state of the slave device is obtained. When it is determined that the current state of the slave device is an idle state, at least one microcontroller is powered off, and the USB chip is set to a non-enabled state. It is detected whether there is data to be transmitted corresponding to the USB chip. When it is determined that there is data to be transmitted corresponding to the USB chip, at least one microcontroller is powered on, and the USB chip is set to an enabled state. In the above process, when the slave device is in an idle state, the USB chip can be set to a non-enabled state. In this way, the module related to the USB data transmission can be in a dormant state, so that the USB chip of the slave device is in a dormant state, and the power consumption of the slave device is reduced on the basis that the module related to the USB data transmission is not powered off.
[0100] The method shown in the present application is described below through specific embodiments. It should be noted that the following embodiments can exist independently or in combination with each other, and the same or similar contents will not be described repeatedly in different embodiments.
[0101] Figure 2 A schematic diagram of a chip control method provided in an embodiment of the present application. Figure 2 , the method may include:
[0102] S201. Obtain the current status of the slave device.
[0103] The execution subject of the embodiment of the present application can be a slave device, or a chip, chip module or chip control device set in the slave device. The chip control device can be implemented by software or by a combination of software and hardware. The slave device includes a USB chip and at least one microcontroller. The slave device can be a mobile phone, a tablet computer, a smart watch, a USB flash drive, etc.
[0104] The slave device provided in the embodiment of the present application is connected to the host device via a USB interface, and the USB protocol is lower than USB 3.0. The microcontroller can be a chip or a chip module. For example, the microcontroller can be an application processor (AP).
[0105] The USB chip includes a controller, a transceiver, and a register. Figure 3 , the structure of the USB chip is explained. Figure 3 This is a schematic diagram of the structure of the USB chip provided in the embodiment of the present application. Figure 3 , including a UBS chip 301. The UBS chip 301 includes a central processing unit (CPU), a register, a controller and a transceiver. The transceiver can be a physical layer (PHY) of a USB port. The transceiver includes four pins, namely a power pin, a first data pin, a second data pin and a ground pin. Among them, the USB chip 301 is connected to a power source through a power pin to power the USB chip 301. The USB chip 301 is grounded through a ground pin. The USB chip 301 transmits data to a host device through a first data pin and a second data pin. The first data pin is connected to a D- data line to transmit a negative signal. The second data pin is connected to a D+ data line to transmit a positive signal.
[0106] After the slave device and the host device establish a connection through the USB interface, the current state of the slave device can be obtained according to the state signal sent by the host device. The host device can determine whether the slave device is connected to the host device through the USB interface by detecting the voltage of the first data pin or the second data pin.
[0107] If the voltage of the first data pin or the second data pin is greater than the first preset voltage, it can be determined that the slave device is connected to the host device through the USB interface. If the voltage of the first data pin or the second data pin is less than or equal to the second preset voltage, and the duration of being less than or equal to the second preset voltage is less than or equal to the preset value, it can be determined that the slave device is disconnected from the host device through the USB interface.
[0108] The first preset voltage, the second preset voltage and the preset value may be set in advance and stored in a preset storage space of the slave device. For example, the first preset voltage may be 2.0V, the second preset voltage may be 0.8V, and the preset value may be 2us.
[0109] When the host device sends a differential signal to the slave device, it indicates that data is being transmitted between the host device and the slave device. When the host device sends a static signal to the slave device, it indicates that no data is being transmitted between the host device and the slave device.
[0110] S202: When it is determined that the current state of the slave device is an idle state, power off at least one microcontroller and set the USB chip to a disabled state.
[0111] The current state of the slave device can be obtained in the following manner: obtain the state signal corresponding to the USB chip; if the state signal is a preset signal and the duration of the state signal being the preset signal is greater than or equal to the preset duration, determine that the current state of the slave device is an idle state.
[0112] The preset signal may be a static signal. The preset signal and the preset duration may be set in advance, and the preset signal and the preset duration may be stored in a preset storage space of the slave device. For example, the preset duration may be 3 ms.
[0113] The USB chip can be set to a disabled state in the following manner: setting the transmission state of the controller to a closed state; and setting the transceiver to a detection state.
[0114] When the transmission state of the controller is set to the off state, no data is transmitted between the controller and other modules of the USB chip and at least one microcontroller. At this time, the USB chip no longer prevents the slave device from entering the sleep state, so that the slave device has the possibility of entering the sleep state. In this way, powering off at least one microcontroller can make the chip and at least one microcontroller of the slave device respectively in the sleep state, so that the slave device can be in the sleep state, reducing the power consumption of the slave device.
[0115] In order to enable the slave device to respond in real time when the host device sends data to the slave device, the USB chip remains powered on and the transceiver of the USB chip is set to the detection state. When the transceiver of the USB chip is in the detection state, the host device sends data to the slave device, and the slave device can detect the signal corresponding to the sent data and wake up the slave device to respond.
[0116] For example, slave device A includes USB chip A, microcontroller A1 and microcontroller A2. Slave device A receives a signal sent by the host device to obtain the current state of slave device A. When slave device A receives a preset signal, and the duration of receiving the preset signal is greater than or equal to 3ms, it is determined that the current state of slave device A is an idle state. At this time, slave device A controls microcontroller A1 and microcontroller A2 to power off and keep USB chip A powered on. The transmission state of the controller of USB chip A is set to the off state, and the transceiver is set to the detection state, so that USB chip A is in a non-enabled state.
[0117] S203: Detect whether there is data to be transmitted corresponding to the USB chip.
[0118] Whether there is data to be transmitted corresponding to the USB chip can be detected in the following manner: determine the detection state of the transceiver; if the detection state of the transceiver is the awake state, determine that there is data to be transmitted corresponding to the USB chip; if the detection state of the transceiver is the non-awakening state, determine that there is no data to be transmitted corresponding to the USB chip.
[0119] For example, according to the above example, it is determined that the microcontroller A1 and the microcontroller A2 of the slave device A are powered off, and the USB chip A of the slave device A is in a disabled state. At this time, the transceiver of the USB chip A is in a detection state, and when it is determined that the detection state of the transceiver is a wake-up state, it is determined that there is data to be transmitted corresponding to the USB chip A.
[0120] S204: When it is determined that there is data to be transmitted corresponding to the USB chip, power on at least one microcontroller and set the USB chip to an enabled state.
[0121] When it is determined that there is data to be transmitted corresponding to the USB chip, the slave device needs to perform data transmission with the host device. At this time, the slave device needs to be awakened. Therefore, at least one microcontroller is powered on, and the USB chip is set to an enabled state. In this way, data can be transmitted between the USB chip and at least one microcontroller in the slave device, and the data sent by the host device can be responded to.
[0122] For example, according to the above example, it is determined that there is data to be transmitted corresponding to the USB chip A. At this time, the slave device A powers on the microcontroller A1 and the microcontroller A2, and sets the USB chip to an enabled state.
[0123] The chip control method provided in the embodiment of the present application obtains the current state of the slave device. When it is determined that the current state of the slave device is an idle state, at least one microcontroller is powered off, and the USB chip is set to a non-enabled state. It is detected whether there is data to be transmitted corresponding to the USB chip. When it is determined that there is data to be transmitted corresponding to the USB chip, at least one microcontroller is powered on, and the USB chip is set to an enabled state. In the above process, when the slave device is in an idle state, the USB chip can be set to a non-enabled state. In this way, the module related to the USB data transmission can be in a dormant state, so that the USB chip of the slave device is in a dormant state, and the power consumption of the slave device is reduced on the basis that the module related to the USB data transmission is not powered off.
[0124] Based on any of the above embodiments, Figure 4 , the detailed process of chip control is explained.
[0125] Figure 4 This is a flow chart of another chip control method provided in the embodiment of the present application. Figure 4 , the method comprising:
[0126] S401. Obtain the current status of the slave device.
[0127] It should be noted that the execution process of S401 can refer to S201 and will not be repeated here.
[0128] S402: When it is determined that the current state of the slave device is an idle state, power off at least one microcontroller.
[0129] Next, combine Figure 5 , a process of determining that the current state of a slave device is an idle state is described. Figure 5 A schematic diagram of a process for determining that the current state of a slave device is an idle state provided in an embodiment of the present application. Figure 5 , including a signal waveform received by the slave device after the slave device establishes a connection with the host device through a USB interface. When data is transmitted between the host device and the slave device, the signal received by the slave device is a differential signal. When data is not transmitted between the host device and the slave device, the signal received by the slave device is a preset signal. The preset signal is a static signal, for example, the preset signal can be an Idle signal. When the duration of receiving the preset signal as an Idle signal is greater than or equal to the preset duration, it can be determined that the current state of the slave device is an idle state. At this time, at least one microcontroller of the slave device is powered off.
[0130] S403: Set the transmission state of the controller to a closed state.
[0131] When the transmission state of the controller is closed, it indicates that data cannot be transmitted between the USB chip and at least one microcontroller. At this time, it is also necessary to control at least one microcontroller to not access the register of the USB chip to prevent the system of the slave device from crashing.
[0132] S404: Obtain the transmission type of the slave device.
[0133] The transmission types include high-speed type, full-speed type and low-speed type. The transmission type of the slave device can be determined based on the data pin to which the pull-up resistor in the slave device is connected. Figure 6A-6B Describes how to connect the data pins of the slave device to the master device. Fig. 6A A schematic diagram of a connection between a slave device and a host device provided in an embodiment of the present application. Fig. 6A , including a host device 601 and a slave device 602. The host device 601 has a D+ data line pull-down resistor R1 and a D- data line pull-down resistor R2. The resistance values of R1 and R2 can be 15KΩ with an accuracy of 5%. The D+ data line pull-up resistor R3 of the slave device 602 can have a resistance value of 1.5KΩ with an accuracy of 5%. At this time, the transmission type of the slave device 602 is full speed / high speed type.
[0134] Figure 6B This is a schematic diagram of another slave device and a host device connected in accordance with an embodiment of the present application. Figure 6B , including a host device 601 and a slave device 602. The host device 601 has a D+ data line pull-down resistor R1 and a D- data line pull-down resistor R2. The resistance values of R1 and R2 can be 15KΩ with an accuracy of 5%. The D- data line pull-up resistor R3 of the slave device 602 can have a resistance value of 1.5KΩ with an accuracy of 5%. At this time, the transmission type of the slave device 602 is a low-speed type.
[0135] Due to the different positions of the pull-up resistors, the quiescent signals of different types of slave devices are different. According to the USB2.0 regulations: the quiescent signal of full-speed / high-speed slave devices: D+> output high voltage VOH (2.8V), D-< output low voltage VOL (0.3V). The quiescent signal of low-speed slave devices: D-> output low voltage VOH (2.8V), D+< output high voltage VOL (0.3V).
[0136] Taking a full-speed slave device as an example, when the slave device is in an idle state, the voltage of the D+ data line of the slave device can be determined by the following formula 1:
[0137]
[0138] Among them, the voltage of the D+ data line for the full-speed slave device; V1 is the pull-up voltage corresponding to the pull-up resistor of the slave device; R2 is the pull-down resistor of the USB host device; R3 is the pull-up resistor of the slave device.
[0139] The pull-up voltage can be 5 V. Formula 1 can also be used to determine the voltage of the D-data line when the low-speed slave device is in an idle state.
[0140] For example, assuming the pull-up voltage is 5V. According to the above example, the resistance of R2 is determined to be 15KΩ and the resistance of R3 is 1.5KΩ. According to Formula 1, when the slave device is in an idle state, the theoretical voltage on the D+ data line or the D- data line is 5*15 / (1.5+15)=4.5V.
[0141] In actual application, the transmission type of the slave device is obtained according to the configuration information of the slave device.
[0142] S405: If the transmission type of the slave device is a preset type, the first data pin is set to a low-level interrupt state to set the transceiver to a detection state.
[0143] The preset type may be a low speed type. The preset type may be set in advance and stored in the preset storage space of the slave device.
[0144] The first data pin or the second data pin can be switched from a data transmission function to a general-purpose input / output (GPIO) function. In this way, the first data pin or the second data pin can be set to a low-level interrupt state. When the first data pin or the second data pin is in a low-level interrupt state, if the signal level sent by the host device changes, the transceiver of the slave device can capture the change in the signal level sent by the host device in real time and trigger an interrupt, thereby waking up the slave device.
[0145] In a low-speed type slave device, the D-data line has a pull-down resistor. When the slave device is in an idle state, the signal processing logic of the D-data line is a high level (1). Since the first data pin is connected to the D-data line, the first data pin is switched to the GPIO function and is set to a low-level interrupt state. When the host device sends data to the slave device, it indicates that there is data to be transmitted corresponding to the USB chip. At this time, the host device sends a resume signal to the slave device (after the interruption), and the host device inputs a low-level signal (0). After the first data pin of the transceiver of the UBS chip receives a low-level signal, the first data pin changes from a logic high level to a low level, thereby triggering a low-level interrupt.
[0146] When the transceiver is in the detection state, the USB chip is set to the non-detection state to turn off the interrupt detection function of the USB chip. In this way, the low-level interrupt of the transceiver in the USB chip and the interrupt detection function of the UBS chip can be avoided from being mutually exclusive. The interrupt detection function of the USB chip is used to detect whether the slave device is disconnected from the host device.
[0147] S406: If the transmission type of the slave device is not a preset type, the second data pin is set to a low level interrupt state to set the transceiver to a detection state.
[0148] The non-preset type may be a high-speed type or a full-speed type.
[0149] In a high-speed or full-speed slave device, the D+ data line has a pull-down resistor. When the slave device is in an idle state, the signal processing logic high level (1) of the D+ data line. Since the second data pin is connected to the D+ data line, the second data pin is switched to the GPIO function and set to a low-level interrupt state. When the host device sends data to the slave device, it indicates that there is data to be transmitted corresponding to the USB chip. At this time, the host device sends a (resume) signal to the slave device (after interruption), and the host device inputs a low-level signal (0). After the second data pin of the transceiver of the UBS chip receives a low-level signal, the first data pin changes from a logic high level to a low level, thereby triggering a low-level interrupt.
[0150] S407: Determine the detection status of the transceiver.
[0151] In order to make the slave device in an idle state, it can respond to the data sent by the host device in real time. After at least one microcontroller of the slave device is powered off, it is necessary to keep the power supply of the USB chip. When the first data pin or the second data pin detects a level change, the corresponding voltage also sends a change. The detection state of the transceiver can be determined according to the voltage change.
[0152] Next, combine Figure 7 , the process of maintaining the power supply of the UBS chip is explained. Figure 7 A schematic diagram of maintaining power supply of a UBS chip provided in an embodiment of the present application. Figure 7 , including a UBS chip 701. The UBS chip 701 includes an interface 1 and an interface 2. The power supply voltage can be connected through the interface 1 of the USB chip to maintain the power supply of each module (controller, register, transceiver) in the USB chip 701. The comparison voltage can be connected through the interface 2 of the USB chip so that the transceiver of the UBS chip 701 determines the detection state of the transceiver according to the comparison voltage. Among them, the power supply voltage can be AVDD3V3_USB, and the comparison voltage can be AVDD1V8_USB.
[0153] The detection state of the transceiver can be determined in the following manner: obtaining a comparison voltage; if the signal voltage received by the transceiver through the first data pin or the second data pin is less than the comparison voltage, then determining that the detection state of the transceiver is an awake state; if the signal voltage received by the transceiver through the first data pin or the second data pin is greater than or equal to the comparison voltage, then determining that the detection state of the transceiver is a non-awake state.
[0154] When the transmission type of the slave device is a low-speed type, if the signal voltage received by the transceiver through the first data pin is less than the comparison voltage, the detection state of the transceiver is determined to be an awake state; if the signal voltage received by the transceiver through the first data pin is greater than or equal to the comparison voltage, the detection state of the transceiver is determined to be a non-awake state.
[0155] When the transmission type of the slave device is a high-speed type or a full-speed type, if the signal voltage received by the transceiver through the second data pin is less than the comparison voltage, the detection state of the transceiver is determined to be an awake state; if the signal voltage received by the transceiver through the second data pin is greater than or equal to the comparison voltage, the detection state of the transceiver is determined to be a non-awake state.
[0156] For example, it is assumed that the slave device B includes a UBS chip B, a microcontroller B1, and a microcontroller B2. The UBS chip B includes a controller B, a transceiver B, and a register B. When the slave device B determines that the current state is an idle state, the microcontroller B1 and the microcontroller B2 are powered off, while the power supply of the USB chip B is maintained. The slave device B sets the transmission state of the controller B to the off state, and determines that the transmission type of the slave device B is a low-speed type according to the configuration information. When the slave device B determines that the transmission type is a preset type, the first data pin (the pin connected to the D-data line) is switched to the GPIO function, and the first data pin is set to a low-level interrupt state to set the transceiver B to the detection state. At the same time, the interrupt detection function of the USB chip B is turned off. The comparison voltage obtained by the slave device B is 1.8V. When it is determined that the signal voltage received by the transceiver B through the first data pin is less than the comparison voltage, the detection state of the transceiver B is determined to be a wake-up state.
[0157] S408: If the detection state of the transceiver is the awake state, it is determined that there is data to be transmitted corresponding to the USB chip.
[0158] For example, according to the above example, it is determined that the detection state of the transceiver B is the awake state. Therefore, it can be determined that there is data to be transmitted corresponding to the USB chip B.
[0159] S409: If the detection state of the transceiver is a non-awakening state, it is determined that there is no data to be transmitted corresponding to the USB chip.
[0160] S410: When it is determined that there is data to be transmitted corresponding to the USB chip, power on at least one microcontroller.
[0161] For example, according to the above example, it is determined that there is data to be transmitted corresponding to the USB chip B. At this time, the slave device B powers on the microcontroller B1 and the microcontroller B2.
[0162] S411, setting the USB chip to an enabled state.
[0163] The USB chip can be set to an enabled state in the following manner: setting the transmission state of the controller to an on state; and setting the transceiver to a non-detection state.
[0164] When it is determined that there is data to be transmitted corresponding to the USB chip, the USB chip needs to perform data transmission. At this time, the first data pin or the second data pin does not need to perform low level detection and trigger an interrupt. Therefore, the first data pin or the second data pin is switched from the GPIO function in the idle state to the data transmission function to set the transceiver to a non-detection state.
[0165] The transceiver can be set to a non-detection state in the following manner: if the transmission type of the transceiver is a preset type, the first data pin is set to a signal transmission state to set the transceiver to a non-detection state; if the transmission type of the transceiver is a non-preset type, the second data pin is set to a signal transmission state to set the transceiver to a non-detection state.
[0166] When the transceiver is in a non-detection state, the USB chip is set to a detection state to enable an interrupt detection function of the USB chip.
[0167] For example, according to the above example, it is determined that there is data to be transmitted corresponding to USB chip B. At this time, slave device B sets the transmission state of controller B to the on state. The first data pin is set to the signal transmission state to set transceiver B to the non-detection state. And the interrupt detection function of the UBS chip is turned on.
[0168] The chip control method provided in the embodiment of the present application obtains the current state of the slave device. When it is determined that the current state of the slave device is an idle state, at least one microcontroller is powered off. The transmission state of the controller is set to the off state. The transmission type of the transceiver is obtained. If the transmission type of the transceiver is a preset type, the first data pin is set to a low-level interrupt state to set the transceiver to a detection state. If the transmission type of the transceiver is a non-preset type, the second data pin is set to a low-level interrupt state to set the transceiver to a detection state. Determine the detection state of the transceiver. If the detection state of the transceiver is a wake-up state, it is determined that there is data to be transmitted corresponding to the USB chip. If the detection state of the transceiver is a non-wake-up state, it is determined that there is no data to be transmitted corresponding to the USB chip. When it is determined that there is data to be transmitted corresponding to the USB chip, at least one microcontroller is powered on, and the USB chip is set to an enabled state. In the above process, when the slave device is in an idle state, the USB chip can be set to a non-enabled state. In this way, the module related to USB data transmission can be in a dormant state, so that the USB chip of the slave device is in a dormant state, and the module related to USB data transmission is not powered off, thereby reducing the power consumption of the slave device. Moreover, the module related to USB data transmission is not powered off, and when the data to be transmitted corresponding to the USB chip is detected, the slave device can be awakened in real time for data transmission.
[0169] Based on any of the above embodiments, Figure 8 , the chip control process is illustrated by examples.
[0170] Figure 8 This is a schematic diagram of the chip control process provided by the embodiment of the present application. Figure 8 , including a host device 801 and a slave device 802. The slave device 802 can be a mobile phone, a tablet computer, a smart watch, etc. The slave device 802 includes a chip control device, a USB chip, a microcontroller 1, and a microcontroller 2. After the slave device 802 establishes a connection with the host device 801 through the USB interface, the current state of the slave device can be obtained according to the state signal sent by the host device 801. When the slave device 801 determines that the received state signal is a preset signal, and the duration of the state signal being the preset signal is greater than or equal to the preset duration of 3ms, it is determined that the current state of the slave device 802 is an idle state.
[0171] The chip control device of the slave device 802 powers off the microcontroller 1 and the microcontroller 2, keeps the power supply of the UBS chip, and sets the transmission state of the controller to the off state. The chip control device of the slave device 802 obtains that the transmission type of the slave device is a high-speed type, and determines that the transmission type is a non-preset type. Therefore, the chip control device of the slave device 802 switches the second data pin to the GPIO function, and sets it to a low-level interrupt state to set the transceiver to a detection state. At the same time, the chip control device of the slave device 802 sets the USB chip to a non-detection state to turn off the interrupt detection function of the USB chip. At this time, the USB chip of the slave device 802 is in a non-enabled state, and the microcontroller 1 and the microcontroller 2 are powered off, which reduces the power consumption of the slave device 802.
[0172] The chip control device of the slave device 802 obtains the comparison voltage as 1.8V, and obtains the detection state of the transceiver in real time according to the comparison voltage. When the host device 801 does not send data to the slave device 802 through the application, the signal voltage received by the transceiver through the second data pin is less than the comparison voltage. At this time, the detection state of the transceiver is a non-awakening state. Until the host device 801 sends data to the slave device 802 through the application, the signal voltage received by the transceiver through the second data pin is greater than the comparison voltage. At this time, the chip control device of the slave device 802 determines that the detection state of the transceiver is an awake state. The chip control device of the slave device 802 determines that there is data to be transmitted corresponding to the USB chip.
[0173] When it is determined that there is data to be transmitted corresponding to the USB chip, the chip control device of the slave device 802 powers on the microcontroller 1 and the microcontroller 2, and sets the transmission state of the controller to the on state. The second data pin is switched to the data transmission function and set to the signal transmission state to set the transceiver to the non-detection state. At the same time, the chip control device of the slave device 802 sets the USB chip to the detection state to turn on the interrupt detection function of the USB chip. At this time, the USB chip is in an enabled state. Data transmission can be performed between the host device 801.
[0174] The chip control process provided in the embodiment of the present application obtains the current state of the slave device. When it is determined that the current state of the slave device is an idle state, at least one microcontroller is powered off. The transmission state of the controller is set to the off state. The transmission type of the transceiver is obtained. If the transmission type of the transceiver is a preset type, the first data pin is set to a low-level interrupt state to set the transceiver to a detection state. If the transmission type of the transceiver is a non-preset type, the second data pin is set to a low-level interrupt state to set the transceiver to a detection state. Determine the detection state of the transceiver. If the detection state of the transceiver is a wake-up state, it is determined that there is data to be transmitted corresponding to the USB chip. If the detection state of the transceiver is a non-wake-up state, it is determined that there is no data to be transmitted corresponding to the USB chip. When it is determined that there is data to be transmitted corresponding to the USB chip, at least one microcontroller is powered on, and the USB chip is set to an enabled state. In the above process, when the slave device is in an idle state, the USB chip can be set to a non-enabled state. In this way, the module related to USB data transmission can be in a dormant state, so that the USB chip of the slave device is in a dormant state, and the module related to USB data transmission is not powered off, thereby reducing the power consumption of the slave device. Moreover, the module related to USB data transmission is not powered off, and when the data to be transmitted corresponding to the USB chip is detected, the slave device can be awakened in real time for data transmission.
[0175] Fig. 9 This is a schematic diagram of the structure of a chip control device provided in an embodiment of the present application. Fig. 9 , the chip control device 10 may include:
[0176] An acquisition module 11 is used to acquire the current state of the slave device;
[0177] A first setting module 12 is used to power off at least one microcontroller and set the USB chip to a disabled state when it is determined that the current state of the slave device is an idle state;
[0178] A detection module 13, used to detect whether there is data to be transmitted corresponding to the USB chip;
[0179] The second setting module 14 is used to power on the at least one microcontroller and set the USB chip to an enabled state when it is determined that there is data to be transmitted corresponding to the USB chip.
[0180] In a possible implementation manner, the first setting module 12 is specifically configured to:
[0181] Setting the transmission state of the controller to a closed state;
[0182] The transceiver is set to a detection state.
[0183] In a possible implementation manner, the first setting module 12 is specifically configured to:
[0184] Obtaining a transmission type of the slave device;
[0185] If the transmission type of the slave device is a preset type, setting the first data pin to a low level interrupt state to set the transceiver to the detection state;
[0186] If the transmission type of the slave device is a non-preset type, the second data pin is set to the low-level interrupt state to set the transceiver to the detection state.
[0187] In a possible implementation manner, the first setting module 12 is specifically configured to:
[0188] Obtaining a status signal corresponding to the USB chip;
[0189] If the state signal is a preset signal, and the duration corresponding to the state signal being the preset signal is greater than or equal to the preset duration, it is determined that the current state of the slave device is an idle state.
[0190] In a possible implementation manner, the detection module 13 is specifically used to:
[0191] determining a detection state of the transceiver;
[0192] If the detection state of the transceiver is the awake state, determining that there is data to be transmitted corresponding to the USB chip;
[0193] If the detection state of the transceiver is a non-awakening state, it is determined that there is no data to be transmitted corresponding to the USB chip.
[0194] In a possible implementation manner, the detection module 13 is specifically used to:
[0195] Get the comparison voltage;
[0196] If the voltage of the signal received by the transceiver through the first data pin or the second data pin is less than the comparison voltage, determining that the detection state of the transceiver is the awake state;
[0197] If the voltage of the signal received by the transceiver through the first data pin or the second data pin is greater than or equal to the comparison voltage, it is determined that the detection state of the transceiver is the non-awakening state.
[0198] In a possible implementation manner, the second setting module 14 is specifically configured to:
[0199] Setting the transmission state of the controller to an on state;
[0200] The transceiver is set to a non-detection state.
[0201] In a possible implementation manner, the second setting module 14 is specifically configured to:
[0202] If the transmission type of the transceiver is a preset type, setting the first data pin to a signal transmission state to set the transceiver to the non-detection state;
[0203] If the transmission type of the transceiver is a non-preset type, the second data pin is set to the signal transmission state to set the transceiver to the non-detection state.
[0204] The chip control device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.
[0205] Fig.10 This is a schematic diagram of the structure of another chip control device provided in an embodiment of the present application. Fig. 9 Based on the examples shown, see Fig.10 The chip control device 10 also includes a third setting module 15 .
[0206] Wherein, the third setting module 15 is used for:
[0207] When the transceiver is in the detection state, setting the USB chip to a non-detection state to disable an interrupt detection function of the USB chip;
[0208] When the transceiver is in the non-detection state, the USB chip is set to the detection state to enable the interruption detection function of the USB chip.
[0209] The chip control device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.
[0210] Fig.11 This is a schematic diagram of the structure of the slave device provided in the embodiment of the present application. Fig.11 The slave device 20 may include: a memory 21 and a processor 22. Exemplarily, the memory 21 and the processor 22 are interconnected via a bus 23.
[0211] The memory 21 is used to store program instructions;
[0212] The processor 22 is used to execute the program instructions stored in the memory, so as to enable the slave device 20 to execute the method shown in the above method embodiment.
[0213] The slave device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.
[0214] An embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the above method.
[0215] The embodiment of the present application may also provide a computer program product, including a computer program, which can implement the above method when executed by a processor.
[0216] All or part of the steps of the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned memory (storage medium) includes: read-only memory (ROM), random access memory (RAM), flash memory, hard disk, solid state drive, magnetic tape, floppy disk, optical disc and any combination thereof.
[0217] The present application embodiment is described with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the present application embodiment. It should be understood that each process and / or box in the flowchart and / or block diagram and the combination of the process and / or box in the flowchart and / or block diagram can be realized by computer program instructions. These computer program instructions can be provided to the processing unit of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device produce a device for realizing the function specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.
[0218] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0219] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0220] Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
[0221] In the present application, the term "include" and its variations may refer to non-restrictive inclusion; the term "or" and its variations may refer to "and / or". The terms "first", "second", etc. in the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. In the present application, "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previously associated objects are in an "or" relationship.
Claims
1. A chip control method, characterized in that: Applied to a slave device, the slave device includes a universal serial bus (USB) chip and at least one microcontroller, and the method includes: Obtaining the current status of the slave device; When it is determined that the current state of the slave device is an idle state, powering off the at least one microcontroller and setting the USB chip to a disabled state; Detecting whether there is data to be transmitted corresponding to the USB chip; When it is determined that there is data to be transmitted corresponding to the USB chip, the at least one microcontroller is powered on, and the USB chip is set to an enabled state.
2. The method according to claim 1, characterized in that The USB chip includes a controller, a transceiver, and a register; setting the USB chip to a disabled state includes: Setting the transmission state of the controller to a closed state; The transceiver is set to a detection state.
3. The method according to claim 2, characterized in that The transceiver includes a first data pin and a second data pin; setting the transceiver to a detection state includes: Obtaining a transmission type of the slave device; If the transmission type of the slave device is a preset type, setting the first data pin to a low-level interrupt state to set the transceiver to the detection state; If the transmission type of the slave device is a non-preset type, the second data pin is set to the low-level interrupt state to set the transceiver to the detection state.
4. The method according to any one of claims 1 to 3, characterized in that Determining that the current state of the slave device is an idle state includes: Obtaining a status signal corresponding to the USB chip; If the status signal is a preset signal, and the duration corresponding to the status signal being the preset signal is greater than or equal to the preset duration, it is determined that the current state of the slave device is an idle state.
5. The method according to any one of claims 1 to 4, characterized in that Detecting whether there is data to be transmitted corresponding to the USB chip includes: determining a detection status of the transceiver; If the detection state of the transceiver is the awake state, determining that there is data to be transmitted corresponding to the USB chip; If the detection state of the transceiver is a non-awakening state, it is determined that there is no data to be transmitted corresponding to the USB chip.
6. The method according to claim 5, characterized in that Determining a detection status of the transceiver includes: Get the comparison voltage; If the voltage of the signal received by the transceiver through the first data pin or the second data pin is less than the comparison voltage, determining that the detection state of the transceiver is the awake state; If the voltage of the signal received by the transceiver through the first data pin or the second data pin is greater than or equal to the comparison voltage, it is determined that the detection state of the transceiver is the non-awakening state.
7. The method according to any one of claims 1 to 6, characterized in that Setting the USB chip to an enabled state includes: Setting the transmission state of the controller to an on state; The transceiver is set to a non-detection state.
8. The method according to claim 7, characterized in that Setting the transceiver to a non-detection state includes: If the transmission type of the transceiver is a preset type, setting the first data pin to a signal transmission state to set the transceiver to the non-detection state; If the transmission type of the transceiver is a non-preset type, the second data pin is set to the signal transmission state to set the transceiver to the non-detection state.
9. The method according to any one of claims 1 to 8, characterized in that The method further comprises: When the transceiver is in the detection state, setting the USB chip to a non-detection state to disable an interrupt detection function of the USB chip; When the transceiver is in the non-detection state, the USB chip is set to the detection state to enable the interruption detection function of the USB chip.
10. A chip control device, characterized in that: The device comprises: The acquisition module is used to obtain the current status of the slave device; a first setting module, configured to, when determining that the current state of the slave device is an idle state, power off at least one microcontroller and set the USB chip to a disabled state; A detection module, used to detect whether there is data to be transmitted corresponding to the USB chip; The second setting module is used to power on the at least one microcontroller and set the USB chip to an enabled state when it is determined that there is data to be transmitted corresponding to the USB chip.
11. A slave device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 9.
12. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: in, The computer instructions are used to cause a computer to execute the method according to any one of claims 1 to 9.
13. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Sleep and wake-up methods and systems for equipment
CN102200827A
Mobile terminal data transmission method and device
CN107682918A
System-level chip, universal serial bus master device, system and wake-up method
CN109857243A
Method for responding to USB slave device by USB master device and related device
CN110018976A
System-on-chip, universal serial bus master device, system and awaking method
WO2019104947A1
Cited By
Remote wake-up processing method, device and system and storage medium
CN121387384A
Remote wake-up processing method, device, system, and storage medium
CN121387384B
