Chip control method and device and slave equipment
By powering down the microcontroller and disabling the USB chip when the slave device is idle, the problem of high power consumption of the slave device is solved, thus reducing power consumption when idle and enabling rapid data transmission when needed.
Patent Information
- Application Number
- CN202410686642.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2044-05-30
AI Technical Summary
After the slave device is connected to the host device via a USB interface, the modules related to USB data transmission cannot enter sleep mode, resulting in high power consumption.
When the slave device is idle, the microcontroller is powered down and the USB chip is disabled. The system then checks if there is data to be transmitted. If there is data to be transmitted, the microcontroller is powered up and the USB chip is enabled.
By putting the USB data transfer modules into a sleep state, the power consumption of the slave device is reduced, and it can be quickly woken up to perform data transfer when needed.
Smart Images

Figure CN118656315B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of communication, and in particular, to a chip control method and device and a slave device. BACKGROUND
[0002] The slave device can perform data transmission with the master device through a universal serial bus (USB) interface of the master device.
[0003] When the slave device is in an idle state, a chip and a microcontroller of the slave device can enter a sleep state to reduce power consumption of the slave device. In actual application, for any chip or microcontroller, the chip or microcontroller can be in the sleep state only when each module in the chip or microcontroller is in the sleep state. In the above process, if the slave device establishes a connection with the master device through the USB interface, modules related to USB data transmission will always remain in a working state and cannot be set to the sleep state. Therefore, the slave device has modules that are not in the sleep state, resulting in high power consumption of the slave device. SUMMARY
[0004] Embodiments of the present application provide a chip control method and device and a slave device to solve the problem of high power consumption of the slave device.
[0005] In a first aspect, embodiments of the present application provide a chip control method applied to a slave device, the slave device including a universal serial bus (USB) chip and at least one microcontroller, and the method includes:
[0006] obtaining a current state of the slave device;
[0007] when it is determined that the current state of the slave device is an idle state, powering down the at least one microcontroller and setting the USB chip to a non-enabled 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, powering up the at least one microcontroller and setting the USB chip 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 the non-enabled state includes:
[0011] setting a transmission state of the controller to an off state;
[0012] setting the transceiver to a detection state.
[0013] In a possible implementation, the transceiver includes a first data pin and a second data pin; and setting the transceiver to a detection state includes:
[0014] acquiring 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, setting the second data pin to the low-level interrupt state to set the transceiver to the detection state.
[0017] In a possible implementation, determining that a current state of the slave device is an idle state includes:
[0018] acquiring a state signal corresponding to the USB chip;
[0019] if the state signal is a preset signal and a time length corresponding to the preset signal is greater than or equal to a preset time length, determining that the current state of the slave device is the idle state.
[0020] In a possible implementation, 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 a wake-up 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-wake-up state, determining that there is no data to be transmitted corresponding to the USB chip.
[0024] In a possible implementation, determining the detection state of the transceiver includes:
[0025] acquiring a comparison voltage;
[0026] if a signal voltage 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 wake-up state;
[0027] 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, determining that the detection state of the transceiver is the non-wake-up state.
[0028] In a possible implementation, the USB chip is set to an enabled state, including:
[0029] The transmission state of the controller is set to an open state.
[0030] The transceiver is set to a non-detection state.
[0031] In a possible implementation, the transceiver is set to a non-detection state, including:
[0032] 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 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, the USB chip is set to a non-detection state to close the interrupt detection function of the USB chip.
[0036] When the transceiver is in the non-detection state, the USB chip is set to a detection state to open the interrupt detection function of the USB chip.
[0037] In a second aspect, an embodiment of the present application provides a chip control device, and the device includes:
[0038] An acquisition module is configured to acquire a current state of a slave device.
[0039] A first setting module is configured to, when determining that the current state of the slave device is an idle state, power off at least one microcontroller and set a USB chip to a non-enabled state.
[0040] A detection module is configured to detect whether there is to-be-transmitted data corresponding to the USB chip.
[0041] A second setting module is configured to, when determining that there is to-be-transmitted data corresponding to the USB chip, power on the at least one microcontroller and set the USB chip to an enabled state.
[0042] In a possible implementation, the first setting module is specifically configured to:
[0043] The transmission state of the controller is set to a closed state.
[0044] set the transceiver to a detection state.
[0045] In a possible implementation, the first setting module is specifically configured to:
[0046] acquire a transmission type of the slave device;
[0047] if the transmission type of the slave device is a preset type, set the first data pin to a low-level interrupt state, so as to set the transceiver to the detection state;
[0048] if the transmission type of the slave device is a non-preset type, set the second data pin to the low-level interrupt state, so as to set the transceiver to the detection state.
[0049] In a possible implementation, the first setting module is specifically configured to:
[0050] acquire a state signal corresponding to the USB chip;
[0051] if the state signal is a preset signal, and a time length corresponding to the preset signal is greater than or equal to a preset time length, determine that a current state of the slave device is an idle state.
[0052] In a possible implementation, the detection module is specifically configured to:
[0053] determine a detection state of the transceiver;
[0054] if the detection state of the transceiver is a wake-up state, determine that there is to-be-transmitted data corresponding to the USB chip;
[0055] if the detection state of the transceiver is a non-wake-up state, determine that there is no to-be-transmitted data corresponding to the USB chip.
[0056] In a possible implementation, the detection module is specifically configured to:
[0057] acquire a comparison voltage;
[0058] if a signal voltage received by the transceiver through the first data pin or the second data pin is less than the comparison voltage, determine that the detection state of the transceiver is the wake-up state;
[0059] 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, determine that the detection state of the transceiver is the non-wake-up state.
[0060] In a possible implementation, the second setting module is specifically configured to:
[0061] setting a transmission state of the controller to an on state;
[0062] setting the transceiver to a non-detection state.
[0063] In a possible implementation, 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, setting the second data pin to the signal transmission state to set the transceiver to the non-detection state.
[0066] In a possible implementation, the apparatus further includes a third setting module.
[0067] The third setting module is configured to:
[0068] when the transceiver is in the detection state, setting the USB chip to a non-detection state to close an interrupt detection function of the USB chip;
[0069] when the transceiver is in the non-detection state, setting the USB chip to a detection state to open the interrupt detection function of the USB chip.
[0070] In a third aspect, the present application provides a chip, wherein the chip stores a computer program, and the computer program is executed by the chip to implement the method in any one of the first aspect.
[0071] In a fourth aspect, the present application provides a chip module, wherein the chip module stores a computer program, and the computer program is executed by the chip module to implement the method in any one of the first aspect.
[0072] In a fifth aspect, the present application provides a slave device, which includes:
[0073] at least one processor; and
[0074] a memory connected to the at least one processor in communication; wherein
[0075] The memory stores instructions executable 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 execute the method in any one of 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, where the computer instructions are used to cause the computer to perform the method in any one of the first aspect.
[0077] In a seventh aspect, an embodiment of the present application provides a computer program product, comprising a computer program, which, when executed by a processor, implements the method in any one of the first aspect.
[0078] The chip control method, device and slave device provided by the embodiments 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, the at least one microcontroller is powered off, and the USB chip is set to a disabled 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, the 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 the idle state, the USB chip can be set to the disabled 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. BRIEF DESCRIPTION OF DRAWINGS
[0079] Figure 1A A schematic diagram of an application scenario provided by the embodiments of the present application;
[0080] Figure 1B Another schematic diagram of an application scenario provided by the embodiments of the present application;
[0081] Figure 2 A flowchart of a chip control method provided by the embodiments of the present application;
[0082] Figure 3 A structural schematic diagram of a USB chip provided by the embodiments of the present application;
[0083] Figure 4 A flowchart of another chip control method provided by the embodiments of the present application;
[0084] Figure 5 A process diagram for determining that the current state of the slave device is an idle state provided by the embodiments of the present application;
[0085] Figure 6A A schematic diagram of a connection between a slave device and a host device provided by the embodiments of the present application;
[0086] Figure 6B Another schematic diagram of a connection between a slave device and a host device provided by the embodiments of the present application;
[0087] Figure 7 A schematic diagram of maintaining power supply of a UBS chip is provided for an embodiment of the present application.
[0088] Figure 8 A schematic diagram of a chip control process is provided for an embodiment of the present application.
[0089] Figure 9 A structural schematic diagram of a chip control device is provided for an embodiment of the present application.
[0090] Figure 10 A structural schematic diagram of another chip control device is provided for an embodiment of the present application.
[0091] Figure 11 A structural schematic diagram of a slave device is provided for an embodiment of the present application. DETAILED DESCRIPTION
[0092] The exemplary embodiments will be described in detail herein with reference to the attached drawings. In the following description, the same numbers are used to indicate the same or similar elements, unless otherwise represented. The embodiments described in the following exemplary embodiments do not represent all the implementations in accordance with this application. Instead, they simply represent exemplary devices and methods in accordance with some aspects of this application, as detailed in the appended claims.
[0093] It should be noted that, in this document, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, so that a process, method, article, or apparatus that comprises a list of elements does not include only those elements, but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without more limitations, an element defined by the phrase "comprising a" does not exclude the existence of additional identical elements in the process, method, article, or apparatus that includes 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 for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards, and provide corresponding operation portal for user to choose authorization or refusal.
[0095] For ease of understanding, below, the application is described in conjunction with Figures 1A-1B The application scenarios to which the embodiments of the present application are applied are described.
[0096] Figure 1AAn application scenario provided by an embodiment of the present application is shown in the following figure. Please refer to Figure 1A , which includes a host device 101 and a slave device 102. The host device 101 can be a computer, and the slave device 102 can be a mobile phone. 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 data is transmitted through the USB interface.
[0097] Figure 1B Another application scenario provided by an embodiment of the present application is shown in the following figure. Please refer to Figure 1B , which includes a decision tree 103 of a chip and microcontrollers in the slave device 102. According to the decision tree 103, it can be determined that the chip or the microcontroller can be in a sleep state only when the chip or the microcontroller is in a sleep state. When the chip or the microcontroller in the slave device 102 is in a sleep state, the power consumption of the slave device 102 can be reduced.
[0098] In the above process, if the slave device and the host device are connected through the USB interface, the modules related to USB data transmission will always be in a working state and cannot be set to a sleep state. Therefore, there are some modules in the slave device that are not in a sleep state, which leads to 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, the 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, the 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 modules related to USB data transmission can be in a sleep state, so that the USB chip of the slave device is in a sleep state, and the power consumption of the slave device is reduced on the basis that the modules related to USB data transmission are not powered off.
[0100] In the following, the method shown in the present application is described through specific embodiments. It should be noted that the following embodiments can exist independently or be combined with each other. For the same or similar content, it will not be repeated in different embodiments.
[0101] Figure 2 A flowchart of a chip control method provided by an embodiment of the present application is shown in the following figure. Please refer to Figure 2 , which can include the following steps.
[0102] S201, obtaining the current state of the slave device.
[0103] The execution subject of the embodiment of the application can be a slave device, or a chip, a chip module, or a chip control apparatus, etc. set in the slave device. The chip control apparatus can be realized by software, or by the 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 U disk, etc.
[0104] The slave device provided by the embodiment of the application is connected with the host device through 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. In the following, the structure of the USB chip is described in combination with Figure 3 The structure of the USB chip is described. Figure 3 The structure of the USB chip provided by the embodiment of the application is shown in the following figure. Please refer to Figure 3 The USB chip 301 includes a central processing unit (CPU), a register, a controller, and a transceiver. The transceiver can be a USB port physical layer (PHY). The transceiver includes four pins, which are a power supply pin, a first data pin, a second data pin, and a ground pin. The USB chip 301 is connected with a power supply through the power supply pin to supply power for the USB chip 301. The USB chip 301 is grounded through the ground pin. The USB chip 301 transmits data with the host device through the first data pin and the second data pin. The first data pin is connected with a D- data line to transmit a negative signal. The second data pin is connected with a D+ data line to transmit a positive signal.
[0106] After the slave device and the host device are connected 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 with the host device through the USB interface according to 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 a first preset voltage, it can be determined that the slave device is connected with 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 a second preset voltage, and the duration of the voltage being less than or equal to the second preset voltage is less than or equal to a preset value, it can be determined that the slave device is disconnected with the host device through the USB interface.
[0108] The first preset voltage, the second preset voltage and the preset value can be set in advance and stored in a preset storage space of the slave device. For example, the first preset voltage can be 2.0V, the second preset voltage can be 0.8V, and the preset value can be 2us.
[0109] When the host device sends a differential signal to the slave device, it indicates that the host device and the slave device are in data transmission. When the host device sends a quiescent state signal to the slave device, it indicates that the host device and the slave device are not in data transmission.
[0110] S202, when it is determined that the current state of the slave device is an idle state, the at least one microcontroller is powered off, and the USB chip is set to a non-enabled state.
[0111] The current state of the slave device can be obtained by: obtaining a state signal corresponding to the USB chip; if the state signal is a preset signal, and the duration of the state signal is greater than or equal to a preset duration, it is determined that the current state of the slave device is an idle state.
[0112] The preset signal can be a quiescent state signal. The preset signal and the preset duration can be set in advance and stored in a preset storage space of the slave device. For example, the preset duration can be 3ms.
[0113] The USB chip can be set to a non-enabled state by: setting the transmission state of the controller to an off state; setting the transceiver to a detection state.
[0114] When the transmission state of the controller is set to an off state, the controller does not transmit data with other modules of the USB chip and the 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 to enter the sleep state. In this way, the at least one microcontroller is powered off, so that the chips of the slave device and the at least one microcontroller are in a sleep state respectively, and the slave device can be in a sleep state, thereby 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 in a powered-on state, and the transceiver of the USB chip is set to a detection state. When the transceiver of the USB chip is in a 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, the slave device A includes a USB chip A, a microcontroller A1 and a microcontroller A2. The slave device A receives a signal sent by the host device to obtain a current state of the slave device A. When the slave device A receives a preset signal and a duration of receiving the preset signal is greater than or equal to 3 ms, it is determined that the current state of the slave device A is an idle state. At this time, the slave device A controls the microcontroller A1 and the microcontroller A2 to be powered off, keeps the USB chip A in a powered-on state, sets a transmission state of a controller of the USB chip A to an off state, and sets a transceiver to a detection state, so that the USB chip A is in a non-enabled state.
[0117] In S203, it is detected whether there is data to be transmitted corresponding to the USB chip.
[0118] The detection of whether there is data to be transmitted corresponding to the USB chip can be performed by determining a detection state of the transceiver, determining that there is data to be transmitted corresponding to the USB chip if the detection state of the transceiver is a wake-up state, and determining that there is no data to be transmitted corresponding to the USB chip if the detection state of the transceiver is a non-wake-up state.
[0119] For example, according to the example described above, 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 non-enabled state. At this time, the transceiver of the USB chip A is in a detection state, and it is determined that there is data to be transmitted corresponding to the USB chip A when it is determined that the detection state of the transceiver is a wake-up state.
[0120] In S204, at least one microcontroller is powered on and the USB chip is set to an enabled state when it is determined that there is data to be transmitted corresponding to the USB chip.
[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 woken up. Therefore, at least one microcontroller is powered on and the USB chip is set to an enabled state. In this way, data transmission can be performed between the USB chip and the at least one microcontroller in the slave device, and data sent by the host device can be responded to.
[0122] For example, according to the example described above, 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 this application embodiment obtains the current state of the slave device. When it is determined that the current state of the slave device is idle, at least one microcontroller is powered down and the USB chip is disabled. The method detects whether there is data to be transmitted corresponding to the USB chip. If 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 enabled. In the above process, when the slave device is idle, the USB chip can be disabled. This allows modules related to USB data transmission to be in a sleep state, thereby keeping the USB chip of the slave device in a sleep state and reducing the power consumption of the slave device without powering down the modules related to USB data transmission.
[0124] Based on any of the above embodiments, the following, in conjunction with Figure 4 The detailed process of chip control is explained.
[0125] Figure 4 This is a schematic flowchart illustrating another chip control method provided in an embodiment of this application. Please refer to... Figure 4 The method includes:
[0126] S401. Obtain the current status of the slave device.
[0127] It should be noted that the execution process of S401 can be found in S201, and will not be repeated here.
[0128] S402. When it is determined that the current state of the slave device is idle, power down at least one microcontroller.
[0129] Below, in conjunction with Figure 5 The process of determining that the current state of the slave device is idle is explained. Figure 5 This is a schematic diagram illustrating the process of determining that the current state of the slave device is idle, as provided in an embodiment of this application. Please refer to... Figure 5 This includes the signal waveform received by the slave device after establishing a connection with the host device via the USB interface. When data transmission occurs between the host and slave devices, the signal received by the slave device is a differential signal. When no data transmission occurs between the host and slave devices, the signal received by the slave device is a preset signal. The preset signal is a static signal, for example, an Idle signal. When the duration of the received Idle signal is greater than or equal to the preset duration, it can be determined that the current state of the slave device is idle. At this time, at least one microcontroller of the slave device is powered down.
[0130] S403. Set the controller's transmission status to the off state.
[0131] When the transmission state of the controller is the closed state, it indicates that data transmission between the UBS chip and the at least one microcontroller cannot be performed. At this time, it is also required to control the at least one microcontroller to be unable to access the registers of the USB chip, so as to prevent system crash of the slave device.
[0132] S404, acquiring the transmission type of the slave device.
[0133] The transmission type includes a high-speed type, a full-speed type and a low-speed type. The transmission type of the slave device can be determined according to the data pin to which the pull-up resistor in the slave device is connected. In the following, the connection of the data pin in the slave device to the host device is described. Figures 6A-6B The connection of the data pin in the slave device to the host device is described. Figure 6A A schematic diagram of the connection of a slave device to a host device is provided for the embodiment of the present application. Please refer to Figure 6A , which includes 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 slave device 602 has a D+ data line pull-up resistor R3, and the resistance value of R3 can be 1.5KΩ with an accuracy of 5%. At this time, the transmission type of the slave device 602 is a full-speed / high-speed type.
[0134] Figure 6B Another schematic diagram of the connection of a slave device to a host device is provided for the embodiment of the present application. Please refer to Figure 6B , which includes 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 slave device 602 has a D- data line pull-up resistor R3, and the resistance value of R3 can be 1.5KΩ with an accuracy of 5%. At this time, the transmission type of the slave device 602 is a low-speed type.
[0135] Because the positions of the pull-up resistors are different, the quiescent state signals of different types of slave devices are different. According to the USB2.0 specification: the quiescent state signal of the full-speed / high-speed type slave device: D+> output high voltage VOH (2.8V), D-< output low voltage VOL (0.3V). The quiescent state signal of the low-speed type slave device: D-> output low voltage VOH (2.8V), D+< output high voltage VOL (0.3V).
[0136] Taking the full-speed type 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] V1 is a pull-up voltage corresponding to a pull-up resistor of the slave device; R2 is a pull-down resistor of the USB host device; and R3 is a pull-up resistor of the slave device.
[0139] The pull-up voltage can be 5V. The voltage of the D- data line when the slave device of the low-speed type is in the idle state can also be determined by Formula 1.
[0140] For example, it is assumed that the pull-up voltage is 5V. According to the example shown above, it is determined that the resistance value of R2 is 15KΩ and the resistance value of R3 is 1.5KΩ. According to Formula 1, it can be determined that the theoretical voltage on the D+ data line or the D- data line when the slave device is in the idle state 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 can be a low-speed type. The preset type can be set in advance and stored in a preset storage space of the slave device.
[0144] The first data pin or the second data pin with the data transmission function can be switched 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 the low-level interrupt state, if there is a change in the signal level sent by the host device, 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] The D- data line is pulled down in the slave device of the low-speed type. When the slave device is in the idle state, the signal processing logic of the D- data line is high (1). Since the first data pin is connected to the D- data line, the first data pin is switched to the GPIO function and set to the 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 (after interrupt) to the slave device, and the host device inputs a low-level signal (0). After the first data pin of the transceiver of the UBS chip receives the low-level signal, the first data pin changes from the logic high level to the low level, thereby triggering the low-level interrupt.
[0146] When the transceiver is in the detection state, the USB chip is set to a 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 USB chip can be avoided. 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 a non-pre-set type, the second data pin is set to a low-level interrupt state to set the transceiver to a detection state.
[0148] The non-pre-set type can be a high-speed type or a full-speed type.
[0149] In the high-speed type or full-speed type slave device, the D+ data line is pulled down. When the slave device is in an idle state, the signal processing logic of the D+ data line is high (1). 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 the 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 (after interrupt) to the slave device, and the host device inputs a low-level signal (0). After the second data pin of the transceiver of the UBS chip receives the 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 state of the transceiver.
[0151] In order to enable the slave device to respond to the data sent by the host device in real time when the slave device is in an idle state. After the at least one microcontroller of the slave device is powered off, the power supply of the USB chip needs to be maintained. When the first data pin or the second data pin detects a level change, the corresponding voltage also changes. The detection state of the transceiver can be determined according to the voltage change.
[0152] Next, the process of maintaining the power supply of the UBS chip will be described in conjunction with Figure 7 The process of maintaining the power supply of the UBS chip will be described. Figure 7 The schematic diagram of maintaining the power supply of the UBS chip provided by the embodiment of the application is shown in FIG. 7. Please refer to Figure 7 , which includes 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 to enable the transceiver of the UBS chip 701 to determine the detection state of the transceiver according to the comparison voltage. 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 by the following method: 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, determining that the detection state of the transceiver is the wake-up state; and 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, determining that the detection state of the transceiver is the non-wake-up state.
[0154] When the transmission type of the slave device is the 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 the wake-up state; and 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 the non-wake-up state.
[0155] When the transmission type of the slave device is the high-speed type or the 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 the wake-up state; and 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 the non-wake-up 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 the idle state, the microcontroller B1 and the microcontroller B2 are powered off, and 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 the low-speed type according to the configuration information. When the slave device B determines that the transmission type is the preset type, the first data pin (the pin connected with the D- data line) is switched to the GPIO function, and the first data pin is set to the 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 slave device B obtains the comparison voltage as 1.8 V. When it is determined that the signal voltage received by the transceiver B through the first data pin is less than the comparison voltage, it is determined that the detection state of the transceiver B is the wake-up state.
[0157] S408, if the detection state of the transceiver is the wake-up state, it is determined that there is data to be transmitted corresponding to the USB chip.
[0158] For example, according to the example shown in the above example, it is determined that the detection state of the transceiver B is the wake-up 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 the non-wake-up state, it is determined that there is no data to be transmitted corresponding to the USB chip.
[0160] S410, powering on at least one microcontroller when it is determined that there is data to be transmitted corresponding to the USB chip.
[0161] For example, according to the example described above, it is determined that there is data to be transmitted corresponding to the USB chip B. At this time, the microcontroller B1 and the microcontroller B2 of the slave device B are powered on.
[0162] S411, setting the USB chip to an enabled state.
[0163] The USB chip can be set to the enabled state by setting the transmission state of the controller to an open 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 be detected at a low level 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 the non-detection state.
[0165] The transceiver can be set to the non-detection state by setting the first data pin to a signal transmission state if the transmission type of the transceiver is a preset type, or setting the second data pin to a signal transmission state if the transmission type of the transceiver is a non-preset type.
[0166] When the transceiver is in the non-detection state, the USB chip is set to a detection state to enable the interrupt detection function of the USB chip.
[0167] For example, according to the example described above, it is determined that there is data to be transmitted corresponding to the USB chip B. At this time, the slave device B sets the transmission state of the controller B to an open state. The first data pin is set to a signal transmission state to set the transceiver B to a non-detection state. And the interrupt detection function of the UBS chip is enabled.
[0168] The chip control method provided in the embodiments of the present application comprises the following steps: obtaining the current state 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. Setting the transmission state of the controller to an off state. Obtaining the transmission type of the transceiver. If the transmission type of the transceiver is a preset type, setting the first data pin 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, setting the second data pin to a low-level interrupt state to set the transceiver to a detection state. Determining 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, powering on the at least one microcontroller, and setting the USB chip 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 disabled 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. Moreover, the module related to USB data transmission is not powered off, so that the slave device can be woken up in real time for data transmission when it is detected that there is data to be transmitted corresponding to the USB chip.
[0169] On the basis of any one of the above embodiments, the following will be described in combination with Figure 8 The process of chip control is exemplified.
[0170] Figure 8 The schematic diagram of the chip control process provided in the embodiments of the present application is shown in FIG. 8. Please refer to Figure 8 , which comprises 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 comprises a chip control apparatus, a USB chip, a microcontroller 1 and a microcontroller 2. After the slave device 802 establishes a connection with the host device 801 through a USB interface, the current state of the slave device can be obtained according to a 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 time length of the state signal is greater than or equal to a preset time length 3 ms, 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 down 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-pre-set type. Therefore, the chip control device of the slave device 802 switches the second data pin to a 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 close 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 down, thereby reducing the power consumption of the slave device 802.
[0172] The chip control device of the slave device 802 obtains that the comparison voltage is 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 program, 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-wakeup state. Until the host device 801 sends data to the slave device 802 through the application program, 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 a wakeup 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 up the microcontroller 1 and the microcontroller 2, sets the transmission state of the controller to the on state. And switch the second data pin to a data transmission function, and set it to a signal transmission state to set the transceiver to a non-detection state. At the same time, the chip control device of the slave device 802 sets the USB chip to a detection state to enable the interrupt detection function of the USB chip. At this time, the USB chip is in an enabled state. Data transmission can be performed with the host device 801.
[0174] The chip control process provided by the embodiment of the 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, the at least one microcontroller is powered off. The transmission state of the controller is set to a closed 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-pre-set type, the second data pin is set to a low-level interrupt state to set the transceiver to a detection state. The detection state of the transceiver is determined. 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, the 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. Moreover, the module related to USB data transmission is not powered off, so that the slave device can be woken up in real time for data transmission when it is detected that there is data to be transmitted corresponding to the USB chip.
[0175] Figure 9 A structural schematic diagram of a chip control device provided by the embodiment of the application is shown in FIG. 1. Figure 9 The chip control device 10 can include:
[0176] The obtaining module 11 is configured to obtain the current state of the slave device.
[0177] The first setting module 12 is configured to, when it is determined that the current state of the slave device is an idle state, power off the at least one microcontroller, and set the USB chip to a non-enabled state.
[0178] The detection module 13 is configured to detect whether there is data to be transmitted corresponding to the USB chip.
[0179] The second setting module 14 is configured to, when it is determined that there is data to be transmitted corresponding to the USB chip, power on the at least one microcontroller, and set the USB chip to an enabled state.
[0180] In a possible implementation, the first setting module 12 is specifically configured to:
[0181] set the transmission state of the controller to a closed state;
[0182] set the transceiver to a detection state.
[0183] In a possible implementation, the first setting module 12 is specifically configured to:
[0184] obtain a transmission type of the slave device;
[0185] if the transmission type of the slave device is a preset type, set 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, set the second data pin to the low-level interrupt state to set the transceiver to the detection state.
[0187] In a possible implementation, the first setting module 12 is specifically configured to:
[0188] obtain a state signal corresponding to the USB chip;
[0189] if the state signal is a preset signal, and a time length corresponding to the preset signal is greater than or equal to a preset time length, determine that a current state of the slave device is an idle state.
[0190] In a possible implementation, the detection module 13 is specifically configured to:
[0191] determine a detection state of the transceiver;
[0192] if the detection state of the transceiver is a wake-up state, determine that there is data to be transmitted corresponding to the USB chip;
[0193] if the detection state of the transceiver is a non-wake-up state, determine that there is no data to be transmitted corresponding to the USB chip.
[0194] In a possible implementation, the detection module 13 is specifically configured to:
[0195] obtain a comparison voltage;
[0196] if a signal voltage received by the transceiver through the first data pin or the second data pin is less than the comparison voltage, determine that the detection state of the transceiver is the wake-up state;
[0197] 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, determine that the detection state of the transceiver is the non-wake-up state.
[0198] In a possible implementation, the second setting module 14 is specifically configured to:
[0199] setting the transmission state of the controller to an on state;
[0200] setting the transceiver to a non-detection state.
[0201] In a possible implementation, 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, setting the second data pin to the signal transmission state to set the transceiver to the non-detection state.
[0204] The chip control device provided in the embodiments of the present application can execute the technical solutions shown in the method embodiments, and has similar implementation principles and beneficial effects, which will not be repeated here.
[0205] Figure 10 Another structural diagram of a chip control device is provided in the embodiments of the present application. Based on the embodiments shown in Figure 9 , the chip control device 10 further includes a third setting module 15. Figure 10
[0206] The third setting module 15 is configured to:
[0207] when the transceiver is in the detection state, setting the USB chip to a non-detection state to close the interrupt detection function of the USB chip;
[0208] when the transceiver is in the non-detection state, setting the USB chip to a detection state to open the interrupt detection function of the USB chip.
[0209] The chip control device provided in the embodiments of the present application can execute the technical solutions shown in the method embodiments, and has similar implementation principles and beneficial effects, which will not be repeated here.
[0210] Figure 11 A structural diagram of a slave device is provided in the embodiments of the present application. Please refer to Figure 11 The slave device 20 can include a memory 21 and a processor 22. Exemplarily, the memory 21 and the processor 22 are connected with each other through a bus 23.
[0211] The memory 21 is configured to store program instructions.
[0212] The processor 22 is configured to execute program instructions stored in the memory to cause the slave device 20 to perform the method shown in the above method embodiments.
[0213] The slave device provided by the embodiments of the present application can perform the technical solutions shown in the above method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here.
[0214] The embodiments of the present application provide a computer readable storage medium, which stores computer execution instructions, and the computer execution instructions are used to implement the above method when executed by a processor.
[0215] The embodiments of the present application can also provide a computer program product, which includes a computer program, and the computer program can implement the above method when executed by a processor.
[0216] All or part of the steps of the above method embodiments can be completed by program instruction related hardware. The above program can be stored in a readable memory. When the program is executed, the steps of the above method embodiments are executed; and the above memory (storage medium) includes: read-only memory (read-only memory, ROM), random access memory (Random Access Memory, RAM), flash memory, hard disk, solid state disk, magnetic tape, floppy disk, optical disc, and any combination thereof.
[0217] The embodiments of the present application are described with reference to flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to produce a machine, so that the instructions executed by the computer or other programmable data processing devices produce a device that implements the functions specified in one or more flows in the flowcharts and / or one or more blocks in the block diagrams.
[0218] These computer program instructions can also be stored in a computer readable memory that can guide the computer or other programmable data processing devices to work in a specific way, so that the instructions stored in the computer readable memory produce a product including instruction devices, which implement the functions specified in one or more flows in the flowcharts and / or one or more blocks in the block diagrams.
[0219] These computer program instructions can also be loaded into a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart and / or block diagram block or blocks.
[0220] Obviously, persons having ordinary skill in the art can make various modifications and variations 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 belong to 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 "comprising" and its variants can refer to non-limiting inclusion; the term "or" and its variants can refer to "and / or". In the present application, the terms "first", "second" and the like are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. In the present application, "a plurality of" means two or more. "And / or", which describes the relationship between the associated objects, means that there can be three relationships, for example, A and / or B can mean that A exists alone, A and B exist together, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects.
Claims
1. A chip control method characterized by, The application is applied to a slave device, the slave device comprises a universal serial bus (USB) chip and at least one microcontroller, and the method comprises the following steps: acquiring a current state of the slave device; when determining 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 non-enabled state; detecting whether there is data to be transmitted corresponding to the USB chip; when determining that there is data to be transmitted corresponding to the USB chip, powering on the at least one microcontroller and setting the USB chip to an enabled state; the USB chip comprises a controller, a transceiver and a register; setting the USB chip to a non-enabled state comprises: setting a transmission state of the controller to an off state; and setting the transceiver to a detection state; the transceiver comprises a first data pin and a second data pin; setting the transceiver to a detection state comprises: acquiring 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, setting the second data pin to the low-level interrupt state to set the transceiver to the detection state.
2. The method of claim 1, wherein, determining that the current state of the slave device is an idle state comprises: acquiring a state signal corresponding to the USB chip; if the state signal is a preset signal and a time length corresponding to the preset signal is greater than or equal to a preset time length, determining that the current state of the slave device is an idle state.
3. The method of claim 1, wherein, detecting whether there is data to be transmitted corresponding to the USB chip comprises: determining a detection state of the transceiver; if the detection state of the transceiver is a wake-up state, determining 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, determining that there is no data to be transmitted corresponding to the USB chip.
4. The method of claim 3, wherein, determining the detection state of the transceiver comprises: acquiring a comparison voltage; if a signal voltage 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 wake-up 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, determining that the detection state of the transceiver is the non-wake-up state.
5. The method according to any one of claims 1 to 4, characterized in that, setting the USB chip to an enabled state comprises: setting a transmission state of the controller to an on state; setting the transceiver to a non-detection state.
6. The method of claim 5, wherein, setting the transceiver to a non-detection state comprises: if a 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, setting the second data pin to the signal transmission state to set the transceiver to the non-detection state.
7. The method according to any one of claims 1 to 4, characterized in that, the method further comprises: setting the USB chip to a non-detection state to close an interrupt detection function of the USB chip when the transceiver is in the detection state; setting the USB chip to a detection state to open the interrupt detection function of the USB chip when the transceiver is in the non-detection state.
8. A chip control device, characterized by comprising: The apparatus comprises: an acquisition module configured to acquire a current state of a slave device; a first setting module configured to, when determining that the current state of the slave device is an idle state, power down at least one microcontroller and set a USB chip to a non-enabled state; a detection module configured to detect whether there is data to be transmitted corresponding to the USB chip; a second setting module configured to, when determining that there is data to be transmitted corresponding to the USB chip, power up the at least one microcontroller and set the USB chip to an enabled state; the USB chip comprises a controller, a transceiver and a register; the first setting module is further configured to set a transmission state of the controller to a closed state and set the transceiver to a detection state; the transceiver comprises a first data pin and a second data pin; the first setting module is further configured to acquire a transmission type of the slave device; if the transmission type of the slave device is a preset type, set 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, set the second data pin to the low-level interrupt state to set the transceiver to the detection state.
9. A slave device, comprising: comprise: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable 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 of any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium having stored thereon computer instructions, wherein the computer instructions, when executed by a processor, cause the processor to perform the method of any one of claims 1-9. wherein the computer instructions are used to enable a computer to perform the method of any one of claims 1 to 7.
11. A computer program product comprising a computer program, characterized in that, The computer program is executed by a processor to implement the method of any one of claims 1 to 7.
Citation Information
Patent Citations
Mobile terminal data transmission method and device
CN107682918A
Method for responding to USB slave device by USB master device and related device
CN110018976A