Equipment identification device and method and electronic equipment
The ADC pin and CC pin form a detection path, combined with software detection logic, to solve the problem of requiring an additional chip to determine the type of external device in the USB Type-C interface, realizing device type identification while reducing circuit complexity and hardware costs. .
Patent Information
- Application Number
- CN202410766769.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-15
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2043-03-15
AI Technical Summary
The existing USB Type-C interface requires an additional CC detection chip to determine the type of external device, resulting in a complex circuit structure and high hardware cost.
The detection path is formed through the ADC pin and the CC pin, combined with the software detection logic, eliminating the need for a detection chip, and directly identifying the insertion status and device type through the processor, reducing circuit complexity and hardware costs.
It realizes device type identification while reducing circuit complexity and hardware cost, and simplifying the circuit structure.
Smart Images

Figure CN118606244A
Abstract
Description
[0001] This application is a divisional application. The application number of the original application is 202310270247.4, and the original application date is March 15, 2023. The entire contents of the original application are incorporated into this application by reference. Technical Field
[0002] The present application relates to the field of universal serial bus connection technology, and in particular to a device identification apparatus, method and electronic device. Background Art
[0003] The Universal Serial Bus Type-C (USB Type-C) interface is an interface type that supports both forward and reverse insertion. It can be used as a charging interface, display interface, and data transmission interface, which can enhance the user experience.
[0004] The Type-C interface has a configuration channel (CC) pin. Generally, a CC detection chip can be used to detect the voltage coupled to the CC pin to determine the type of the external device connected to it.
[0005] However, in order to determine the type of external device to which it is connected, the electronic device needs to add an additional CC detection chip, or use other chips that can achieve the same function, such as a power delivery (PD) chip, which results in a complex circuit structure and high hardware cost. Summary of the invention
[0006] The present application provides a device identification apparatus, method and electronic device, which can solve the problem that determining the type of a connected external device through a chip leads to a complex circuit structure and high hardware cost, eliminates the detection chip, reduces the circuit complexity, and reduces the hardware cost.
[0007] In a first aspect, the present application provides a device identification device, which is applied to an electronic device, and the device includes: a first port, including a first configuration channel CC1 pin and a second configuration channel CC2 pin; the CC1 pin is coupled to a first voltage; the CC2 pin is coupled to a second voltage; wherein the first voltage, and / or the second voltage changes in response to the first terminal being inserted into the first port and the first terminal being pulled out of the first port; a processor, including a first analog-to-digital conversion ADC1 pin and a second analog-to-digital conversion ADC2 pin; the ADC1 pin is connected to the CC1 pin to form a first detection path; the ADC1 pin is configured to detect a first voltage through the first detection path; the ADC2 pin is connected to the CC2 pin to form a second detection path; the ADC2 pin is configured to detect a second voltage through the second detection path; the processor is configured to identify the insertion state of the first terminal based on the first voltage and the second voltage, and identify the device type of an external device connected to the first terminal.
[0008] The device identification device shown in the present application forms a first detection path through the ADC1 pin and the CC1 pin, and forms a second detection path through the ADC2 pin and the CC2 pin, so as to respectively detect the first voltage and the second voltage, and at the same time cooperates with the software detection logic to realize the functions of identifying the insertion status of the first terminal and identifying the device type of the external device connected to the first terminal, eliminating the detection chip, reducing the circuit complexity, and reducing the hardware cost.
[0009] In one implementation, it also includes: a first pull-up resistor, one end of which is coupled to the port power supply, and the other end is coupled to the first detection path; the first pull-up resistor is configured to use the port power supply to pull up the first voltage to a preset threshold range; a second pull-up resistor, one end of which is coupled to the port power supply, and the other end is coupled to the second detection path; the second pull-up resistor is configured to use the port power supply to pull up the second voltage to a preset threshold range. In this implementation, the first pull-up resistor can provide the port power supply to the CC1 pin, and the second pull-up resistor can provide the port power supply to the CC2 pin, so that the first voltage and the second voltage can be within the preset threshold range, and then the insertion state of the first terminal can be identified according to the preset threshold range, and the device type of the external device connected to the first terminal can be identified.
[0010] In one implementation, it also includes: a first switch, one end of which is coupled to the port power supply, the other end of which is coupled to the first detection path, and is connected in series with the first pull-up resistor; a second switch, one end of which is coupled to the port power supply, the other end of which is coupled to the second detection path, and is connected in series with the second pull-up resistor. With this implementation, the first switch can control the connection or disconnection of the first pull-up resistor, and the second switch can control the connection or disconnection of the second pull-up resistor. In this way, when it is necessary to detect the insertion state of the first terminal and the device type of the external device, the first switch and the second switch can be closed, and when it is not necessary to identify the insertion state of the first terminal and the device type of the external device, the first switch and the second switch can be disconnected. The setting of the first switch and the second switch can prevent the uninterrupted connection of the first pull-up resistor and the second pull-up resistor from affecting the voltage detection.
[0011] In one implementation, it further includes: a first pull-down resistor, one end of which is coupled to the first detection path and the other end of which is coupled to the ground; the first pull-down resistor is configured to pull the first voltage down to a preset threshold range; a second pull-down resistor, one end of which is coupled to the second detection path and the other end of which is coupled to the ground; the second pull-down resistor is configured to pull the second voltage down to a preset threshold range. With this implementation, the first pull-down resistor and the second pull-down resistor can provide an inherent pull-down resistor for the electronic device, so that when the first terminal is inserted into the first port, the external device can accurately identify the device type of the electronic device.
[0012] In one implementation, it also includes: a third pull-down resistor, one end of which is coupled to the first detection path, the other end of which is coupled to the ground, and is connected in parallel with the first pull-down resistor; a third switch, one end of which is coupled to the first detection path, the other end of which is coupled to the ground, and is connected in series with the third pull-down resistor; a fourth pull-down resistor, one end of which is coupled to the second detection path, the other end of which is coupled to the ground, and is connected in parallel with the second pull-down resistor; a fourth switch, one end of which is coupled to the second detection path, the other end of which is coupled to the ground, and is connected in series with the fourth pull-down resistor. With this implementation, the third pull-down resistor and the fourth pull-down resistor can provide different resistance values to adjust the corresponding first voltage and second voltage. At the same time, when it is necessary to detect the insertion state of the first terminal and the device type of the external device, the third switch and the fourth switch can be closed, and when it is not necessary to detect the insertion state of the first terminal and the device type of the external device, the third switch and the fourth switch can be disconnected to adapt to different scenarios of electronic device applications.
[0013] In one implementation, it further includes: a first diode located on the first detection path, the anode of the first diode coupled to the ADC1 pin, and the cathode of the first diode coupled to the CC1 pin; a second diode located on the second detection path, the anode of the second diode coupled to the ADC2 pin, and the cathode of the second diode coupled to the CC2 pin. In this implementation, the unidirectional conductivity of the first diode and the second diode can prevent the high voltage introduced from the first terminal to the CC1 pin and the CC2 pin from damaging the ADC1 pin and the ADC2 pin.
[0014] In one implementation, the processor includes: at least one of a system-on-chip (SOC), a central processing unit (CPU), and a power management unit (PMU). By adopting this implementation, the technical solution shown in this application can be implemented on a variety of processor chips.
[0015] In one implementation, the processor is specifically configured to: obtain a first voltage and a second voltage; match the first voltage and the second voltage with the state code in a preset first truth table respectively to obtain a first code combination, the first code combination including a first target code corresponding to the first voltage and a second target code corresponding to the second voltage; match the first code combination with the code combination in the preset second truth table to determine the insertion state of the first terminal and / or the device type of the external device. By adopting this implementation, the software detection logic can be combined with a simplified circuit without a detection chip to realize the function of identifying the insertion state of the first terminal and the device type of the external device connected to the first terminal, eliminating the detection chip, reducing the circuit complexity, and reducing the hardware cost.
[0016] In one implementation, the processor is further configured to: determine the insertion state of the first terminal according to the first voltage and the second voltage; if the insertion state of the first terminal is that it has been inserted into the first port, perform the step of matching the first voltage and the second voltage with the state code in the preset first truth table respectively. With this implementation, the insertion state of the first terminal can be determined directly through the first voltage and the second voltage shown by ADC1 and ADC2.
[0017] In one implementation, the processor is further configured to: after determining the insertion state of the first terminal, if the insertion state of the first terminal is not inserted into the first port, delay a first time length to obtain the first voltage and the second voltage. With this implementation, detection can be performed based on the speed at which the user inserts or removes the first terminal to meet the identification requirements of the external device.
[0018] In one implementation, the processor is further configured to: before acquiring the first voltage and the second voltage, detect whether the electronic device is in a dormant state; the dormant state includes: the operating system kernel of the electronic device is completely dormant; if the electronic device is not in a dormant state, acquire the first voltage and the second voltage; if the electronic device is in a dormant state, delay a second time length to detect whether the electronic device is in a dormant state. With this implementation, the insertion state of the first terminal and the device type of the external device can be identified only in a non-dormant state to reduce the power consumption of the electronic device.
[0019] In one implementation, the processor is further configured to: after determining the device type of the external device, perform universal serial bus enumeration with the external device; if the enumeration is successful, determine that the external device has been connected; determine whether the device type of the external device matches the first voltage and the second voltage according to the first voltage and the second voltage; if the first voltage and the second voltage do not match the device type of the external device, determine whether the first terminal has been unplugged; if the first terminal has been unplugged, detect again whether the electronic device is in a dormant state; if the first terminal has not been unplugged, obtain the insertion state of the first terminal again. With this implementation, after determining that the external device is plugged in and the enumeration is successful, regardless of whether the electronic device is in a dormant state, the insertion state of the first terminal and the device type of the external device are continuously detected. If the device type of the external device does not match, re-enumeration is triggered. When the first terminal has been unplugged, it is further determined whether the electronic device is in dormant state. If the electronic device is in dormant state, there is no need to continue to detect the voltage. In this way, the purpose of reducing power consumption can be achieved.
[0020] In one implementation, the processor is further configured to: if the first voltage and the second voltage match the device type of the external device, delay the acquisition of the first voltage and the second voltage for a third time. With this implementation, the first voltage and the second voltage can be acquired by delaying the third time, so as to timely acquire the insertion state of the first terminal and the device type of the external device.
[0021] In one implementation, the processor is specifically configured to: determine a first target threshold corresponding to the first voltage, and determine a first target code according to the first target threshold; and determine a second target threshold corresponding to the second voltage, and determine a second target code according to the second target threshold. In this implementation, the insertion state of the first terminal is determined by matching the first voltage with the first target threshold and matching the second voltage with the second target threshold.
[0022] In one implementation, the processor is further configured to: if the first target threshold or the second target threshold is the first preset threshold, determine the number of pull-up resistors coupled to the first terminal according to the first voltage, the second voltage, and the first preset threshold. With this implementation, it is possible to identify whether the first terminal is coupled to a port power supply of an external device with one pull-up resistor or two pull-up resistors with the port power supply of an external device through the first voltage, the second voltage, and the first preset threshold, so that the data line type of the universal serial bus can be determined.
[0023] In one implementation, the processor is further configured to: if the first target threshold or the second target threshold is the second preset threshold, determine that the first terminal is a dual-role port DRP; and determine that the first port is a downstream port DFP or an upstream port UFP according to the internal configuration of the electronic device. With this implementation, the role capability of the first terminal can be determined based on the matching result, and if the first terminal is a dual-role port, the role corresponding to the first port can be determined.
[0024] In one implementation, the device type of the external device includes: at least one of a data exchange OTG device, a debugging device, an audio device, a power adapter, and a power transmission PD device. With this implementation, the solution shown in this application can identify the device types of multiple external devices.
[0025] In one implementation, the processor is specifically configured to: if the first detection path is provided with a first diode, and the second detection path is provided with a second diode, the first target threshold is determined according to the temperature of the first diode, and the second target threshold is determined according to the temperature of the second diode. In this way, in a circuit with a diode and a circuit without a diode, the threshold value is adaptively adjusted, so that the accuracy of the insertion state of the first terminal and the device type identification of the external device can be guaranteed.
[0026] In a second aspect, the present application provides an electronic device, including a device identification apparatus as described in the first aspect and its implementation method.
[0027] In a third aspect, the present application provides a device identification method, which is applied to the device identification device in the first aspect and its implementation method, including: obtaining a first voltage and a second voltage; the first voltage is a voltage coupled to a first configuration channel CC1 pin of a first port in the device identification device, and the second voltage is a voltage coupled to a second configuration channel CC2 pin of the first port; the first voltage and / or the second voltage changes in response to the first terminal being inserted into the first port and the first terminal being pulled out of the first port; matching the first voltage and the second voltage with the state code in a preset first truth table respectively to obtain a first code combination, the first code combination including a first target code corresponding to the first voltage and a second target code corresponding to the second voltage; matching the first code combination with the code combination in the preset second truth table to determine the insertion state of the first terminal and / or the device type of the external device. By adopting this implementation method, the software detection logic can be combined with a simplified circuit without a detection chip to realize the function of identifying the insertion state of the first terminal and the device type of the external device connected to the first terminal, eliminating the detection chip, reducing the circuit complexity, and reducing the hardware cost.
[0028] In one implementation, the method further includes: determining the insertion state of the first terminal according to the first voltage and the second voltage; if the insertion state of the first terminal is that the first terminal has been inserted into the first port, performing the step of matching the first voltage and the second voltage with the state code in the preset first truth table. With this implementation, the insertion state of the first terminal can be determined directly through the first voltage and the second voltage shown by ADC1 and ADC2.
[0029] In one implementation, after determining the insertion state of the first terminal, the method further includes: if the insertion state of the first terminal is not inserted into the first port, delaying a first time length to obtain the first voltage and the second voltage. With this implementation, detection can be performed based on the speed at which the user inserts or removes the first terminal to meet the identification requirements of the external device.
[0030] In one implementation, before obtaining the first voltage and the second voltage, it includes: detecting whether the electronic device corresponding to the device identification device is in a dormant state; the dormant state includes: the operating system kernel of the electronic device is completely dormant; if the electronic device is not in a dormant state, obtaining the first voltage and the second voltage; if the electronic device is in a dormant state, delaying a second time length to detect whether the electronic device is in a dormant state. With this implementation, the insertion state of the first terminal and the device type of the external device can be identified only in a non-dormant state, so as to reduce the power consumption of the electronic device.
[0031] In one implementation, after determining the device type of the external device, it also includes: performing universal serial bus enumeration with the external device; if the enumeration is successful, determining that the external device has been connected; judging whether the device type matches the external device based on the first voltage and the second voltage; if the first voltage and the second voltage do not match the device type of the external device, judging whether the first terminal has been unplugged; if the first terminal has been unplugged, detecting again whether the electronic device is in a dormant state; if the first terminal has not been unplugged, obtaining the insertion state of the first terminal again. With this implementation, after determining that the external device is plugged in and the enumeration is successful, regardless of whether the electronic device is in a dormant state, the insertion state of the first terminal and the device type of the external device are continuously detected. If the device type of the external device does not match, re-enumeration is triggered. When the first terminal has been unplugged, it is further determined whether the electronic device is in dormant state. If the electronic device is in dormant state, there is no need to continue detecting the voltage. In this way, the purpose of reducing power consumption can be achieved.
[0032] In one implementation, the method further includes: if the first voltage and the second voltage match the device type of the external device, delaying the acquisition of the first voltage and the second voltage for a third time. With this implementation, the first voltage and the second voltage can be acquired by delaying the acquisition of the third time, so as to timely acquire the insertion state of the first terminal and the device type of the external device.
[0033] In one implementation, matching the first voltage and the second voltage with the state code in the preset first truth table respectively includes: determining a first target threshold corresponding to the first voltage, and determining the first target code according to the first target threshold; and determining a second target threshold corresponding to the second voltage, and determining the second target code according to the second target threshold. With this implementation, the insertion state of the first terminal is determined by matching the first voltage with the first target threshold and matching the second voltage with the second target threshold.
[0034] In one implementation, the method further includes: if the first target threshold or the second target threshold is the first preset threshold, determining the number of pull-up resistors coupled to the first terminal according to the first voltage, the second voltage, and the first preset threshold. With this implementation, it is possible to identify whether the first terminal is coupled with one pull-up resistor to the port power supply of the external device or two pull-up resistors to the port power supply of the external device through the first voltage, the second voltage, and the first preset threshold, so that the data line type of the universal serial bus can be determined.
[0035] In one implementation, it further includes: if the first target threshold or the second target threshold is the second preset threshold, determining that the first terminal is a dual-role port DRP; and determining that the first port is a downlink port DFP or an uplink port UFP according to the internal configuration of the electronic device corresponding to the device identification device. With this implementation, the role capability of the first terminal can be determined based on the matching result, and if the first terminal is a dual-role port, the role corresponding to the first port can be determined.
[0036] In one implementation, the device type of the external device includes: at least one of a data exchange OTG device, a debugging device, an audio device, a power adapter, and a power transmission PD device. With this implementation, the solution shown in this application can identify the device types of multiple external devices.
[0037] In one implementation, if the first detection path is provided with a first diode, and the second detection path is provided with a second diode, the first target threshold is determined according to the temperature of the first diode, and the second target threshold is determined according to the temperature of the second diode. In this way, in a circuit with a diode and in a circuit without a diode, the threshold value is adaptively adjusted, and the accuracy of the insertion state of the first terminal and the device type identification of the external device can be ensured. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0039] Figure 1 This is a schematic diagram of a Type-C interface application scenario;
[0040] Figure 2 It is a schematic diagram of the Type-C interface structure;
[0041] Figure 3 This is a circuit diagram of the CC pins being connected when the Type-C plug is inserted in the forward direction;
[0042] Figure 4 It is a circuit diagram of CC pin connection when Type-C plug is inserted in reverse;
[0043] Figure 5 It is a schematic diagram of a chip detection circuit;
[0044] Figure 6 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0045] Figure 7is a software structure block diagram of the electronic device 100 provided in an embodiment of the present application;
[0046] Figure 8 This is the first circuit diagram of the device identification apparatus provided in the embodiment of the present application;
[0047] Fig. 9 is a second circuit diagram of the device identification apparatus provided in an embodiment of the present application;
[0048] Fig.10 This is the first flow chart of the device identification method provided in the embodiment of the present application;
[0049] Fig.11 is a second flow chart of the device identification method provided in an embodiment of the present application;
[0050] Fig.12 This is the third flow chart of the device identification method provided in the embodiment of the present application. DETAILED DESCRIPTION
[0051] The technical solution of the embodiment of the present application will be clearly described below in conjunction with the drawings in the embodiment of the present application.
[0052] In the description of this application, unless otherwise specified, " / " means "or", for example, A / B can mean A or B. "And / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, "at least one" means one or more, and "plurality" means two or more. The words "first", "second", etc. do not limit the quantity and execution order, and the words "first", "second", etc. do not limit them to be different.
[0053] It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0054] The terms used in the implementation method part of this application are only used to explain the specific embodiments of this application, and are not intended to limit this application. The embodiments of this application will be described in detail below in conjunction with the accompanying drawings.
[0055] Universal Serial Bus (USB) is a serial bus standard used to regulate the connection and communication between computers and external devices.
[0056] Among them, the Universal Serial Bus Type-C (USB Type-C) interface, hereinafter referred to as the Type-C interface, is an interface type that supports forward insertion and reverse insertion. It can be used as a charging interface, display interface, and data transmission interface, which can enhance the user experience.
[0057] Figure 1 This is a schematic diagram of a Type-C interface application scenario. Figure 1 As shown, the Type-C interface is composed of a Type-C socket 011 and a Type-C plug 012. Taking the electronic device 001 having the Type-C socket 011 and the external device 002 having the Type-C plug 012 as an example, the external device 002 is plugged into the Type-C socket 011 through the Type-C plug 012 to connect to the electronic device 001.
[0058] Figure 2 This is a schematic diagram of the Type-C interface structure. Figure 2 As shown, the Type-C socket 011 usually has four pairs of transmit (Transmit, TX) pins (PN) / receive (Receive, RX) pins, two pairs of USB data positive signal pins (USB DataPositive, USB-DP) / USB data negative signal pins (USB Data Minus, USB-DM), a pair of sideband use (SideBand Use, SBU) pins, two configuration channel (Configuration Channel, CC) pins, four power (VoltageBus, VBUS) pins and four ground pins, etc., a maximum of twenty-four pins.
[0059] The Type-C plug 012 may be provided with a maximum of twenty-four pins corresponding to the Type-C socket 011, or a smaller number of pins may be provided according to different functions to be implemented, so as to implement functions such as charging and data transmission respectively.
[0060] Based on the number of pins set on the Type-C plug 012, the Type-C interface can be applied to at least one scenario such as charging scenario and data transmission scenario.
[0061] During the process of establishing a connection between the electronic device 001 and the external device 002, the electronic device 001 and the external device 002 need to communicate with each other to determine their own roles, and then transmit current and / or data in different scenarios according to their corresponding roles.
[0062] The two ends of the Type-C interface usually correspond to the master device and the slave device. Taking the electronic device 001 as the master device and the external device 002 as the slave device as an example, the port corresponding to the master device is called the downstream port (Downstream Facing Port, DFP), and the port corresponding to the slave device is called the upstream port (Upstream Facing Port, UFP). Among them, DFP has a narrow interpretation and a broad interpretation. The narrow interpretation specifically refers to the downstream transmission of data in the USB Type-C cable and connector specification version 1.1 (Universal Serial Bus Type-C Cable and Connector Specification, revision 1.1), and the broad interpretation refers to the downstream transmission of data and external power supply. Correspondingly, the narrow interpretation of UFP specifically refers to the upstream transmission of data, and the broad interpretation refers to the upstream transmission of data and internal power supply. The DFP and UFP in this application both adopt the corresponding broad interpretation to apply to different scenarios such as charging scenarios and data transmission scenarios.
[0063] Among them, the working modes of both ends of the Type-C interface between some electronic devices can be changed, so that the master device and the slave device can be converted to each other. If the electronic device 001 can be converted from a master device to a slave device, the port corresponding to the electronic device 001 can be used as both a DFP and a UFP, which is a dual-role port (DRP). It should be noted that not all working modes between electronic devices can be changed. Only when both ends of the Type-C interface are DRP, the master device and the slave device can be converted to each other, such as a mobile phone and a computer. When one of the two ends of the Type-C interface is not a DRP, the master device and the slave device cannot be converted to each other, such as a power adapter and a mobile phone.
[0064] Based on this, the electronic device 001 can have one of the following three role capabilities.
[0065] The first role capability: The port corresponding to the electronic device 001 is DFP, which acts as the master device. After the electronic device 001 establishes a connection with the external device 002, it supplies power to the external device 002 or sends data. It should be noted that at this time, the port corresponding to the external device 002 must be UFP or DRP. For example, the electronic device 001 is a power adapter and the external device 002 is a mobile phone.
[0066] The second role capability: The port corresponding to the electronic device 001 is UFP, which acts as a slave device. After the electronic device 001 establishes a connection with the external device 002, it draws power from the external device 002 or uploads data. It should be noted that at this time, the external device 002 must be a DFP or DRP. For example, the electronic device 001 is a storage device, such as a USB flash drive, a mobile hard disk, etc., and the external device 002 is a mobile phone.
[0067] The third role capability: the port corresponding to the electronic device 001 is DRP. If the port corresponding to the external device 002 is UFP, after the electronic device 001 and the external device 002 are connected, the electronic device 001 acts as the master device; if the port corresponding to the external device 002 is DFP, after the electronic device 001 and the external device 002 are connected, the electronic device 001 acts as the slave device; if the port corresponding to the external device 002 is DRP, after the electronic device 001 and the external device 002 are connected, the electronic device 001 randomly selects to act as the master device or the slave device, and performs the corresponding function according to the selected role. For example, the electronic device 001 is a mobile phone, and the external device 002 is a computer.
[0068] Correspondingly, the external device 002 has a role capability corresponding to the electronic device 001, which is not elaborated in this application.
[0069] It should be noted here that the present application does not restrict the device types of the electronic device 001 and the external device 002. The following is an exemplary description of the electronic device 001 as a device having a Type-C socket 011 and the external device 002 as a device having a Type-C plug 012. The electronic device 001 and the external device 002 can be interchangeable according to actual conditions. Among them, the Type-C plug 012 can be a plug on a data line that is detachably connected to the external device 002, or it can be a plug that is integrally formed with the external device 002. The present application describes the Type-C plug 012 as a part of the external device 002. The Type-C plug 012 in the present application is taken as an example of a plug on a data line provided with a chip.
[0070] The corresponding role capabilities of the electronic device 001 and the external device 002 are determined by the CC pin.
[0071] Specifically, the CC pin can be used to confirm the forward and reverse directions of the Type-C plug 012 insertion, confirm the transmission direction between the electronic device 001 and the external device 002, and perform load power configuration.
[0072] The internal circuit design of the CC pin in the electronic device 001 of different roles is different. If the port corresponding to the electronic device 001 is DFP, the CC pin is usually pulled up to a high level through a pull-up resistor Rp; if the port corresponding to the electronic device 001 is UFP, the CC pin is usually grounded through a pull-down resistor Rd; if the port corresponding to the electronic device 001 is DRP, the CC pin is alternately pulled up to a high level through a pull-up resistor Rp or grounded through a pull-down resistor Rd. Therefore, when the electronic device 001 is not connected to the external device 002, the voltage coupled to the CC pin on the electronic device 001 alternates between a high level and a low level. Among them, the electronic device 001 and the external device 002 are usually provided with a CC detection chip for voltage detection, so that the electronic device 001 and the external device 002 can detect the voltage coupled to the CC pin through the CC detection chip, and then determine their corresponding roles.
[0073] When the port corresponding to the electronic device 001 is DRP, when the electronic device 001 is in a dormant state, the CC detection chip can switch between DFP and UFP every 50ms. When switching to DFP, the CC detection chip controls the CC pin to access at least one pull-up resistor Rp, and when switching to UFP, the CC detection chip controls the CC pin to access at least one pull-down resistor Rd. The CC detection chip controls the CC pin to access the pull-up resistor Rp or the pull-down resistor Rd by controlling the switching of the switch on the corresponding path.
[0074] Figure 3 This is a circuit diagram of the CC pins being connected when the Type-C plug is inserted in the forward direction.
[0075] Figure 4 This is a circuit diagram of the CC pins being connected when the Type-C plug is inserted in reverse.
[0076] like Figure 3 and Figure 4 As shown, the CC detection chip can also identify the positive and negative directions of the Type-C plug 012 insertion according to the voltage detected on the CC pin.
[0077] For ease of description, the Type-C socket 011 of the electronic device 001 usually has two CC pins, which are hereinafter referred to as CC1 pin and CC2 pin. The external device 002 usually has two CC pins, which are hereinafter referred to as CC1-1 pin and CC2-1 pin. The Type-C plug 012 usually has only one CC pin, which is hereinafter referred to as CC1-A pin.
[0078] For example, the CC1-A pin is connected to the CC1-1 pin, and when the Type-C plug 012 is inserted into the Type-C socket 011, the CC1 pin or the CC2 pin is connected to the CC1-1 pin through the CC1-A pin. If the CC1 pin is connected to the CC1-1 pin for transmitting data, the CC2 pin can be used to provide port power.
[0079] If the port corresponding to the electronic device 001 is DFP and the port corresponding to the external device 002 is UFP, since the DFP usually has a pull-up resistor Rp and the UFP usually has a pull-down resistor Rd, when the electronic device 001 is connected to the external device 002, the CC detection chip of the electronic device 001 can recognize that the CC1 pin is pulled down by the CC1-1 pin of the external device 002. At this time, the electronic device 001 can determine that the insertion direction of the Type-C plug 012 is forward; accordingly, the CC detection chip can recognize that the CC2 pin is pulled down by the CC1-1 pin of the external device 002. At this time, the electronic device 001 can determine that the insertion direction of the Type-C plug 012 is reverse.
[0080] The CC detection chip can also confirm the data transmission direction between the electronic device 001 and the external device 002.
[0081] When the insertion direction of the Type-C plug 012 is forward, the CC1 pin is connected to the CC1-1 pin. At this time, data is transmitted from the RX1+ / - and TX1+ / - pins of the Type-C socket 011 to the RX1+ / - and TX1+ / - pins of the Type-C plug 012 (not shown in the figure).
[0082] When the insertion direction of the Type-C plug 012 is reverse, the CC1 pin is connected to the CC2-1 pin. At this time, data is transmitted from the RX1+ / - and TX1+ / - pins of the Type-C socket 011 to the RX2+ / - and TX2+ / - pins of the Type-C plug 012 (not shown in the figure).
[0083] The main control chip in the electronic device 001 usually has only one pair of TX / RX channels. Since electronic devices such as mobile phones have high data rate requirements, during the data transmission process, the signal path must be switched by the multiplexer (Mux) chip to ensure impedance consistency and signal transmission quality. In this way, the Mux chip selects one pair of TX / RX channels from the two pairs of TX / RX channels formed by the external device 002 to connect to the main control chip to maintain the correct communication connection. This process needs to be controlled by the CC detection chip, which needs to measure the voltage of the CC pin to determine the direction of the data line and the Type-C socket 011, and then determine the data transmission direction.
[0084] The CC detection chip can also perform load power configuration.
[0085] Taking the port corresponding to the electronic device 001 as UFP as an example, the CC detection chip can obtain the output capability of the port DFP corresponding to the external device 002 by detecting the voltage on the CC pin.
[0086] The CC detection chip also has the function of determining the device type corresponding to the external device 002 through the voltage on the CC pin on the electronic device 001 .
[0087] For example, the CC1 pin of the electronic device 001 is suspended, and the CC2 pin is connected to a pull-up resistor Rp, and the device type of the connected external device 002 is determined to be an on-the-go (OTG) device.
[0088] Some electronic devices (such as mobile phones) are usually equipped with CC detection chips to implement the above functions (or use other chips that can achieve the same functions, such as power delivery (PD) chips, or platform chips with integrated CC detection functions).
[0089] Figure 5 This is a schematic diagram of a chip detection circuit. Figure 5 As shown, taking the PD chip as an example, the processor 003 in the electronic device 001 is usually connected to the PD chip 004 through a bidirectional two-wire synchronous serial (Inter-Integrated Circuit, I2C) bus (including I2C bidirectional transmission line (I2C_CLK) 005 and I2C data transmission line (I2C_DATA) 006), and the PD chip 004 forms a CC detection path 007 with the CC1 pin or CC2 pin on the Type-C socket 011, and forms a power path 008 with the VBUS pin. The PD chip 004 transmits the detected voltage to the processor 003 through the input (Input, INT) line 009. In general, CC detection is performed through chip detection, resulting in high hardware costs, so it is urgent to reduce production costs.
[0090] In order to solve the above problems, an embodiment of the present application provides a device identification device, which can be applied to electronic devices. The electronic devices in the embodiments of the present application can be, for example, tablet computers (portable android devices, PADs), personal digital assistants (personal digital assistants, PDAs), handheld devices with wireless communication functions, computing devices, vehicle-mounted devices or wearable devices, virtual reality (virtual reality, VR) terminal devices, augmented reality (augmented reality, AR) terminal devices, wireless terminals in industrial control (industrial control), wireless terminals in self-driving, wireless terminals in remote medical, wireless terminals in smart grids (smart grids), wireless terminals in transportation safety (transportation safety), wireless terminals in smart cities (smart cities), wireless terminals in smart homes (smart homes), etc., mobile terminals or fixed terminals with touch screens. The electronic devices involved in the present application can be equipped with Harmony Or other operating systems, this application does not limit this.
[0091] Figure 6 Schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. Figure 6As shown, the electronic device 100 may include a processor 110, a memory 120, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, a camera 192, a display screen 193, and a subscriber identification module (SIM) card interface 194, etc. Among them, the sensor module 180 may include a touch sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a geomagnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, etc. Among them, the gyroscope sensor 180B, the air pressure sensor 180C, the geomagnetic sensor 180D, the acceleration sensor 180E, etc. can all be used to detect the motion state of the electronic device, and therefore, can also be called motion sensors.
[0092] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0093] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0094] The memory 120 can be used to store computer executable program codes, and the executable program codes include instructions. The memory 120 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the memory 120, and / or instructions stored in a memory provided in the processor.
[0095] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
[0096] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0097] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
[0098] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the memory 120, the display screen 193, the camera 192, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0099] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0100] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0101] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0102] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 193. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0103] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0104] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. GNSS may include the global positioning system (GPS), the global navigation satellite system (GLONASS), the Beidou navigation satellite system (BDS), the quasi-zenith satellite system (QZSS) and / or the satellite based augmentation system (SBAS).
[0105] The electronic device 100 implements the display function through a GPU, a display screen 193, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 193 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0106] The display screen 193 is used to display images, videos, etc. The display screen 193 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 193, where N is a positive integer greater than 1.
[0107] The electronic device 100 can realize the shooting function through ISP, camera 192, video codec, GPU, display screen 193 and application processor.
[0108] The ISP is used to process the data fed back by the camera 192. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 192.
[0109] The camera 192 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element converts the optical signal into an electrical signal, which is then transmitted to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, RYYB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 192, where N is a positive integer greater than 1.
[0110] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0111] The touch sensor 180A is also called a "touch control device". The touch sensor 180A can be set on the display screen 193, and the touch sensor 180A and the display screen 193 form a touch screen, also called a "touch control screen". The touch sensor 180A is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 193. In other embodiments, the touch sensor 180A can also be set on the surface of the electronic device 100, which is different from the position of the display screen 193.
[0112] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.
[0113] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
[0114] The geomagnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the geomagnetic sensor 180D to detect the opening and closing of the flip leather case. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover according to the geomagnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover can be automatically unlocked.
[0115] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.
[0116] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
[0117] The proximity light sensor 180G may include, for example, a light emitting diode and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.
[0118] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
[0119] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 performs a boost on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
[0120] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
[0121] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 193, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
[0122] The SIM card interface 194 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 194 or pulling it out from the SIM card interface 194. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 194 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 194 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 194 can also be compatible with different types of SIM cards. The SIM card interface 194 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
[0123] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device 100.
[0124] Figure 7 It is a software structure block diagram of the electronic device 100 provided in an embodiment of the present application.
[0125] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
[0126] The application layer can include a series of application packages.
[0127] like Figure 7 As shown, the application package may include applications such as battery management, camera, gallery, calendar, call, map, navigation, music, video, short message, etc.
[0128] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0129] like Figure 7As shown, the application framework layer may include a window manager, an input manager, a sensor manager, a phone manager, a resource manager, a notification manager, and the like.
[0130] The input manager can be used to monitor the user's input events, such as click events and slide events performed by the user's finger on the display screen 193 of the electronic device 100. By monitoring the input events, the electronic device 100 can determine whether the electronic device is being used.
[0131] The sensor manager is used to monitor the data returned by various sensors in the electronic device, such as motion sensor data, proximity light sensor data, temperature sensor data, etc. Using the data returned by each sensor, the electronic device can determine whether it is shaking, or whether the display screen 193 is blocked, etc.
[0132] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.
[0133] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
[0134] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0135] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0136] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0137] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0138] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0139] A 2D graphics engine is a drawing engine for 2D drawings.
[0140] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, sensor driver and power driver.
[0141] In the embodiments of the present application, software programs such as power driver, battery management, sensor driver, etc. can cooperate with hardware such as processor, USB interface, charging management module, power management module, etc. to implement the method steps and functions involved in each embodiment of the present application.
[0142] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0143] Figure 8 This is the first circuit diagram of the device identification device provided in the embodiment of the present application. Figure 8 As shown, the device identification apparatus 200 may include a first port 201. For example, the first port 201 may be a Type-C socket.
[0144] The first port 201 may include a first configuration channel CC1 pin 2011 and a second configuration channel CC2 pin 2012. The CC1 pin 2011 is coupled to a first voltage U1, and the CC2 pin 2012 is coupled to a second voltage U2. The first voltage U1 and / or the second voltage U2 changes in response to the first terminal 202 being inserted into the first port 201 and the first terminal 202 being removed from the first port 201.
[0145] For example, the first terminal 202 may be a Type-C plug. The first terminal 202 may be a Type-C plug on a data cable detachably connected to the external device 300 , or may be a Type-C plug integrally formed with the external device 300 .
[0146] The external device 300 corresponding to the first terminal 202 usually has two CC pins, which are hereinafter referred to as CC1-1 pin and CC2-1 pin. The first terminal 202 usually has only one CC pin, which is hereinafter referred to as CC1-A pin.
[0147] For example, the CC1-A pin is connected to the CC1-1 pin, and when the first terminal 202 is inserted into the first port 201, the CC1 pin 2011 or the CC2 pin 2012 establishes a connection with the CC1-1 pin through the CC1-A pin. If the CC1 pin 2011 establishes a connection with the CC1-1 pin for transmitting data, the CC2 pin 2012 can be used to provide a port power supply (Voltage DrainDrain, VDD) 220. It should be noted that the functions of the CC2 pin include but are not limited to providing a port power supply 220, and can also be left floating or perform other functions. Among them, the port power supply 220 is the internal working voltage of the electronic device 100.
[0148] Based on this, after the CC1 pin 2011 or the CC2 pin 2012 establishes a connection with the CC1-1 pin through the CC1-A pin, the first voltage U1 and / or the second voltage U2 changes in response to the first terminal 202 being inserted into the first port 201. For example, it changes from alternating between a high level and a low level to a stable intermediate level. Correspondingly, the first voltage U1 and / or the second voltage U2 changes in response to the first terminal 202 being pulled out of the first port 201. For example, it changes from a stable intermediate level to alternating between a high level and a low level.
[0149] The device identification apparatus 200 may further include a processor 203. The processor 203 may be connected to a plurality of analog to digital converter (ADC) pins. In the embodiment of the present application, the first analog to digital converter ADC1 pin 2031 and the second analog to digital converter ADC2 pin 2032 in the processor 203 are used for illustration.
[0150] In some embodiments, the processor 203 may be at least one of a system on chip (System On Chip, SOC), a central processing unit (Central Processing Unit, CPU), and a power management unit (Power Management Unit, PMU). These types of chips may provide an ADC1 pin 2031 and an ADC2 pin 2032 for voltage detection. It should be noted that the chip types provided in the embodiments of the present application are only for exemplary description, and other types of chips with ADC pins may also be used in actual applications, and the present application is not limited to this.
[0151] The ADC1 pin 2031 is connected to the CC1 pin 2011 to form a first detection path 204. The ADC1 pin 2031 is configured to detect a first voltage U1 through the first detection path 204. The ADC2 pin 2032 is connected to the CC2 pin 2012 to form a second detection path 205. The ADC2 pin 2032 is configured to detect a second voltage U2 through the second detection path 205.
[0152] The processor 203 is configured to identify the insertion state of the first terminal 202 according to the first voltage U1 and the second voltage U2 , and to identify the device type of the external device 300 connected to the first terminal 202 .
[0153] It should be noted here that the ADC1 pin 2031 and the ADC2 pin 2032 in the above chip are generally not connected to the CC1 pin 2011 and the CC2 pin 2012, but are usually connected to the sensor to obtain the voltage of the sensor so that the chip can control the sensor through software logic; or the ADC1 pin 2031 and the ADC2 pin 2032 are only used as vacant standby pins. The embodiment of the present application changes the way the CC logic chip is connected to the CC1 pin 2011 and the CC2 pin 2012, and changes the way the CC logic chip detects the CC1 pin 2011 and the CC2 pin 2012, directly connects the ADC1 pin 2031 and the ADC2 pin 2032 to the CC1 pin 2011 and the CC2 pin 2012, and detects the CC1 pin 2011 and the CC2 pin 2012 by configuring software logic in the processor, and then identifies the insertion state of the first terminal 202 according to the first voltage U1 and the second voltage U2, and identifies the device type of the external device 300 connected to the first terminal 202. In this way, the electronic device 100 can save a detection chip during the production process, reduce circuit complexity, and reduce hardware costs.
[0154] Fig. 9 is a second circuit diagram of the device identification apparatus provided in the embodiment of the present application. Fig. 9 As shown, in some embodiments, the device identification apparatus 200 may further include a first pull-up resistor 206 and a second pull-up resistor 207. One end of the first pull-up resistor 206 is coupled to the port power supply 220, and the other end is coupled to the first detection path 204. The first pull-up resistor 206 is configured to pull up the first voltage U1 to a preset threshold range using the port power supply 220. One end of the second pull-up resistor 207 is coupled to the port power supply 220, and the other end is coupled to the second detection path 205. The second pull-up resistor 207 is configured to pull up the second voltage U2 to a preset threshold range using the port power supply 220.
[0155] In some embodiments, the first pull-up resistor 206 can be disposed outside the ADC1 pin 2031, and externally pulled up to the port power supply 220. The first pull-up resistor 206 can also be a pull-up resistor inside the ADC1 pin 2031, and pulled up from the ADC1 pin 2031 to the port power supply 220. The second pull-up resistor 207 can be disposed outside the ADC2 pin 2032, and externally pulled up to the port power supply 220. The second pull-up resistor 207 can also be a pull-up resistor inside the ADC2 pin 2032, and pulled up from the ADC2 pin 2032 to the port power supply 220.
[0156] In some embodiments, the device identification apparatus 200 may further include a first switch 208 and a second switch 209. The first switch 208 has one end coupled to the port power supply 220, and the other end coupled to the first detection path 204, and is connected in series with the first pull-up resistor 206. The second switch 209 has one end coupled to the port power supply 220, and the other end coupled to the second detection path 205, and is connected in series with the second pull-up resistor 207.
[0157] It should be noted here that Fig. 9 The positions of the first switch 208 and the second switch 209 are only for exemplary description. In a specific implementation, the first switch 208 can be set between the port power supply 220 and the first pull-up resistor 206, or between the first pull-up resistor 206 and the first detection path 204. This application does not limit this. Correspondingly, the second switch 209 is similar, and this application does not elaborate on this.
[0158] Accordingly, the first switch 208 can be set outside or inside the ADC1 pin 2031 according to the position of the first pull-up resistor 206 , and the second switch 209 can be set outside or inside the ADC2 pin 2032 according to the position of the second pull-up resistor 207 .
[0159] The pull-up resistor can clamp the uncertain signal at a high level through the resistor and play a role in current limiting. It can be used to provide the port power supply 220 in the process of identifying the external device 300 and power the external device 300. In this way, when the first switch 208 is closed, the first pull-up resistor 206 can provide the port power supply 220 for the CC1 pin 2011 on the first detection path 204. When the second switch 209 is closed, the second pull-up resistor 207 can provide the port power supply 220 for the CC1 pin 2011 on the second detection path 205. The resistance value of the first pull-up resistor 206 and the resistance value of the second pull-up resistor 207 can be reasonably configured according to the voltage value of the port power supply 220 or the pull-down voltage value of the first port 201 when the first terminal 202 is inserted. The embodiment of the present application does not limit the resistance value of the first pull-up resistor 206 and the second pull-up resistor 207.
[0160] Among them, the first pull-up resistor 206 can pull up the first voltage U1 to a preset threshold range, and the preset threshold range here can be the range of voltage values corresponding to the pull-up resistor. The second pull-up resistor 207 is similar, and this application will not go into details. In this way, when the first port 201 is used as a DFP, the first pull-up resistor 206 or the second pull-up resistor 207 can supply power to the first terminal 202, and at this time, the first pull-up resistor 206 pulls up the first voltage U1 to the preset threshold range, or the second pull-up resistor 207 pulls up the second voltage U2 to the preset threshold range. It should be noted here that the preset threshold range of the embodiment of the present application is only used for exemplary description, and can be specifically set according to actual conditions.
[0161] When the first switch 208 and the second switch 209 are disconnected, the first pull-up resistor 206 and the second pull-up resistor 207 are not connected, and power cannot be supplied through the port power supply 220. At this time, the first port 201 can only be used as a UFP. It should be noted that the first switch 208 and the second switch 209 can be selectively set. If the uninterrupted connection of the first pull-up resistor 206 and the second pull-up resistor 207 has no effect on the detection of the first voltage U1 and the second voltage U2, the first switch 208 and the second switch 209 may not be set.
[0162] In some embodiments, the device identification apparatus 200 may further include a first pull-down resistor 210 and a second pull-down resistor 211. The first pull-down resistor 210 has one end coupled to the first detection path 204 and the other end coupled to the ground 212. The first pull-down resistor 210 is configured to pull the first voltage U1 down to a preset threshold range. The second pull-down resistor 211 has one end coupled to the second detection path 205 and the other end coupled to the ground 212. The second pull-down resistor 211 is configured to pull the second voltage U2 down to a preset threshold range.
[0163] The pull-down resistor can clamp an uncertain signal at a low level through a resistor, and can be used to pull down the high level of the external device 300 when the external device 300 is connected, so as to provide a stable intermediate level for the external device 300. The first pull-down resistor 210 and the second pull-down resistor 211 can be inherent resistors of the electronic device 100, and when the first port 201 is used as a UFP, the external device 300 can accurately identify the electronic device 100, so that the electronic device 100 receives data or draws power internally.
[0164] It should be noted here that the resistance values of the first pull-down resistor 210 and the second pull-down resistor 211 can be reasonably configured. For example, the resistance range of the first pull-down resistor 210 can be 5.1kΩ±20%. Preferably, the resistance range of the first pull-down resistor 210 is 5.1kΩ±1%; the resistance range of the second pull-down resistor 211 can be 5.1kΩ±20%; preferably, the resistance range of the second pull-down resistor 211 is 5.1kΩ±1%.
[0165] In some embodiments, the device identification apparatus 200 may further include a third pull-down resistor 213, a third switch 214, a fourth pull-down resistor 215, and a fourth switch 216. The third pull-down resistor 213 has one end coupled to the first detection path 204 and the other end coupled to the ground 212, and is connected in parallel with the first pull-down resistor 210. The third switch 214 has one end coupled to the first detection path 204 and the other end coupled to the ground 212, and is connected in series with the third pull-down resistor 213. The fourth pull-down resistor 215 has one end coupled to the second detection path 205 and the other end coupled to the ground 212, and is connected in parallel with the second pull-down resistor 211. The fourth switch 216 has one end coupled to the second detection path 205 and the other end coupled to the ground 212, and is connected in series with the fourth pull-down resistor 215.
[0166] The third pull-down resistor 213 and the fourth pull-down resistor 215 can be used to adjust the first voltage U1 and the second voltage U2 during the process of identifying the external device 300 to ensure that the first voltage U1 and the second voltage U2 can be at a stable intermediate level. Therefore, the third switch 214 and the fourth switch 216 are only turned on during the process of identifying the external device 300. When the first port 201 is used as a UFP, the third switch 214 and the fourth switch 216 are open.
[0167] It should be noted here that the resistance values of the third pull-down resistor 213 and the fourth pull-down resistor 215 can be reasonably configured, which will not be elaborated in the embodiment of the present application.
[0168] In some embodiments, when the port power supply 220 is 1.8V, since the first pull-down resistor 210 and the second pull-down resistor 211 are usually fixed resistors of 5.1kΩ, the preset threshold range is usually set according to the first pull-up resistor 206 and the second pull-up resistor 207. For example, the resistance of the first pull-up resistor 206 is 5.1kΩ, and the resistance of the second pull-up resistor 207 is 5.1kΩ. When the CC pin is in a floating state, the voltage division of the first voltage U1 and the second voltage U2 is 0.9V. After the first terminal 202 is inserted, the resistor coupled to the first terminal 202 forms a parallel circuit with the first pull-down resistor 210 and the second pull-down resistor 211. If the external device 300 corresponding to the first terminal 202 is a data exchange (On-The-Go, OTG) device, the data exchange device can have a pull-down resistor of 5.1kΩ, and when the first terminal 202 of the data exchange device is inserted, the threshold should be 0.6V. The preset threshold range can be set based on reasonable circuit deviation. For example, in this embodiment, the preset threshold range is set to 0.6V±20%.
[0169] In some embodiments, the device identification apparatus 200 may further include a first diode 217 and a second diode 218. The first diode 217 is located on the first detection path 204, the anode of the first diode 217 is coupled to the ADC1 pin 2031, and the cathode of the first diode 217 is coupled to the CC1 pin 2011. The second diode 218 is located on the second detection path 205, the anode of the second diode 218 is coupled to the ADC2 pin 2032, and the cathode of the second diode 218 is coupled to the CC2 pin 2012.
[0170] When the first terminal 202 is inserted into the first port 201, the CC1 pin 2011 and the CC2 pin 2012 may introduce a high voltage from the first terminal 202, which may cause damage to the ADC1 pin 2031 and the ADC2 pin 2032. Therefore, the unidirectional conductivity of the first diode 217 and the second diode 218 can prevent damage to the CC1 pin 2011 and the CC2 pin 2012.
[0171] It should be noted here that since the CC1 pin 2011 and the CC2 pin 2012 are close to the VBUS pin, the CC1 pin and the CC2 pin usually need to withstand a constant high voltage of 5V or even 10V from the VBUS pin. Therefore, the CC1 pin 2011 and the CC2 pin 2012 in some electronic devices 100 are configured as pins that can withstand constant high voltage when leaving the factory. If the ADC1 pin and the ADC2 pin can also be configured with the highest voltage, then the first diode 217 and the second diode 218 may not be set.
[0172] The circuit of the device identification apparatus 200 provided in the above embodiment does not include a detection chip, which reduces the complexity of the circuit and reduces the hardware cost.
[0173] The embodiment of the present application further provides a device identification method, which can be applied to the device identification apparatus 200 provided in the above embodiments of the present application. For example, each step of the device identification method can be executed by the processor 203 in the device identification apparatus 200 provided in the above embodiments. In other words, it can be understood that the processor 203 is configured to execute each step of the device identification method.
[0174] Fig.10 This is the first flow chart of the device identification method provided in the embodiment of the present application.
[0175] like Fig.10 As shown, the method may include the following steps S1-S3.
[0176] Step S1, obtaining a first voltage U1 and a second voltage U2.
[0177] The first voltage U1 and the second voltage U2 are obtained by the processor 203 from the ADC1 pin 2031 and the ADC2 pin 2032. After obtaining the first voltage U1 and the second voltage U2, the processor 203 implements the same function as the CC detection chip through software logic, thereby avoiding the CC detection chip from detecting and controlling the first voltage U1 and the second voltage U2.
[0178] Since the insertion state of the first terminal 202 and the device type of the external device 300 are different, the corresponding first voltage U1 and second voltage U2 are different. Therefore, different status codes are set according to different insertion states of the first terminal 202 and the device type of the external device 300, and then the insertion state of the first terminal 202 and / or the device type of the external device 300 are determined according to the status code.
[0179] Step S2, matching the first voltage U1 and the second voltage U2 with the state codes in a preset first truth table respectively to obtain a first code combination, wherein the first code combination includes a first target code corresponding to the first voltage U1 and a second target code corresponding to the second voltage U2.
[0180] The status code may be a code preset based on the value of the first voltage U1 and the value of the second voltage U2. The status code may be used to characterize the connection status between the CC1 pin 2011 or CC2 pin 2012 and the CC1-1 pin or CC2-1 pin.
[0181] In some embodiments, the processor 203 may determine a first target threshold corresponding to the first voltage U1, and determine a first target code based on the first target threshold; and determine a second target threshold corresponding to the second voltage U2, and determine a second target code based on the second target threshold.
[0182] That is to say, it is necessary to set at least one threshold based on different voltage values, and make each threshold correspond to a state code. In this way, by determining the preset threshold range where the value of the first voltage U1 and the value of the second voltage U2 are located, it is possible to determine the current connection state of the CC1 pin 2011 or CC2 pin 2012 and the CC1-1 pin or CC2-1 pin.
[0183] For example, a first threshold, a second threshold, a third threshold, a fourth threshold and a fifth threshold are set, and each threshold corresponds to a different status code; the first threshold corresponds to a first status code A, the second threshold corresponds to a second status code B, the third threshold corresponds to a third status code C, the fourth threshold corresponds to a fourth status code D, and the fifth threshold corresponds to a fifth status code E. If the first voltage U1 is within the first threshold range, the first state code A can be used to indicate that the CC1 pin 2011 is in a floating state; if the first voltage U1 is within the second threshold range, the second state code B can be used to indicate that the CC1 pin 2011 is in a data exchange state, and the CC1 pin 2011 is loaded with a pull-down resistor; if the first voltage U1 is within the third threshold range, the third state code C can be used to indicate that the CC1 pin is in an analog audio device plugged in state, and the CC1 pin 2011 is loaded with a pull-down resistor; if the first voltage U1 is within the fourth threshold range, the fourth state code D can be used to indicate that the CC1 pin 2011 is plugged into a power adapter state; if the first voltage U1 is within the fifth threshold range, the fifth state code E can be used to indicate that the CC1 pin 2011 is plugged into a power delivery (PD) device. The second voltage U2 is similar to the first voltage U1, and this application will not elaborate on this.
[0184] It should be noted here that the ranges from the first threshold to the fifth threshold do not overlap each other, and the specific ranges are set according to the corresponding different states and can be adjusted according to actual conditions.
[0185] Among them, the threshold corresponding to the first voltage U1 in at least one threshold is the first target threshold, and the state code corresponding to the first target threshold is the first target code. The threshold corresponding to the second voltage U2 in at least one threshold is the second target threshold, and the state code corresponding to the second target threshold is the second target code. The above process can be specifically implemented by matching the first voltage U1 and the second voltage U2 with a preset first truth table.
[0186] The preset first truth table may be built into the memory 120 of the electronic device 100 , or built into a register inside the processor 203 , which is not limited in the embodiment of the present application.
[0187] The preset first truth table may be shown in the following table:
[0188]
[0189] For example, the first voltage U1=280mV, and the corresponding first target code is A.
[0190] It should be noted here that the first threshold, the second threshold, the third threshold, the fourth threshold and the fifth threshold range can be different voltage ranges respectively, and the specific threshold value setting method is configured according to the differentiation between different states. For example, the voltage corresponding to the CC pin floating state is 280mV, and its corresponding threshold can be set to 280mV±20%, that is, the first threshold is 280mV±20%. The above values are only for illustrative purposes, and this application does not limit this. The threshold can also be set in other ways, for example, the threshold is set according to the resistance value or the current value. This application does not elaborate on the various ways of setting the threshold.
[0191] Wherein, corresponding to different circuit configuration modes, the values of the first threshold to the fifth threshold need to be adaptively adjusted.
[0192] In some embodiments, if the first detection path 204 is provided with a first diode 217 and the second detection path 205 is provided with a second diode 218 , the first target threshold is determined according to the temperature of the first diode 217 and the second target threshold is determined according to the temperature of the second diode 218 .
[0193] In some embodiments, since the device identification device 200 includes a first diode 217 and a second diode 218, the diode circuit generates a difference in on-resistance as the operating temperature changes. Therefore, the first threshold to the fifth threshold in the preset first truth table are set based on different temperature settings. This can more accurately determine the connection status between the first port 201 and the first terminal 202.
[0194] That is, when the first detection path 204 is not provided with the first diode 217 and the second detection path 205 is not provided with the second diode 218, the numerical ranges of the first threshold to the fifth threshold are different from those when the first detection path 204 is provided with the first diode 217 and the second detection path 205 is provided with the second diode 218. Accordingly, the first target threshold and the second target threshold are different when the corresponding circuits are different.
[0195] The code form of the target code in this application is only used for exemplary explanation. The target code is not limited to being set to A, B, C, D, E, and can also be set to other forms of characters or numbers.
[0196] Furthermore, the state code may be a code preset based on the waveform of the first voltage U1 and the waveform of the second voltage U2. Accordingly, the matching method of the first voltage U1 and the second voltage U2 may be adjusted according to the waveform, and the threshold may be set according to the waveform. This application does not limit the matching method of the state code.
[0197] After obtaining the first target code corresponding to the first voltage U1 and the second target code corresponding to the second voltage U2 based on the above implementation, the first target code and the second target code are matched with a preset second truth table.
[0198] The preset second truth table may be built into the memory 120 of the electronic device 100 , or built into a register inside the processor 203 , which is not limited in the embodiment of the present application.
[0199] The preset second truth table may be as shown in the following table:
[0200] First voltage U1 The second voltage U2 Insertion state of the first terminal 202 Device type of the external device 300 A A Not inserted No device type A B Inserted Data exchange equipment B A Inserted Data exchange equipment B B Inserted Debugging equipment C C Inserted Audio equipment
[0201] In some embodiments, the data exchange device can be a USB flash drive, a Type-C digital headset, a keyboard, a mouse, etc. The debugging device is Debug accessory. The audio device is Audio accessory.
[0202] For example, if the first target code corresponding to the first voltage U1 is A and the second target code corresponding to the second voltage U2 is B, the first target code A and the second target code B form a first code combination AB.
[0203] Step S3 , matching the first code combination with a code combination in a preset second truth table to determine the insertion state of the first terminal 202 and / or the device type of the external device 300 .
[0204] For example, by matching the first code combination AB with the code combination in the preset second truth table, it can be determined that the insertion state of the first terminal 202 is inserted into the first port 201 and the device type of the external device 300 is a data exchange device.
[0205] For example, the first code combination is AA, and the first code combination AA is matched with the code combination in the preset second truth table, and only the insertion state of the first terminal 202 can be determined as not inserted into the first port 201, and does not have the device type corresponding to the external device 300.
[0206] It should be noted that the code combinations in the preset second truth table include but are not limited to AA, AB, BA, BB, and CC shown in the above second truth table. The embodiment of the present application only exemplifies the code combinations, and more code combinations can be set according to actual conditions to represent different insertion states and device types.
[0207] In this way, the processor 203 can obtain the first voltage U1 and the second voltage U2 from a simplified circuit without a chip, and implement a device identification method based on the first voltage U1 and the second voltage U2 to determine the insertion status of the first terminal 202 and / or the device type of the external device 300, thereby eliminating the detection chip, reducing the circuit complexity, and reducing the hardware cost.
[0208] Fig.11 This is the second flow chart of the device identification method provided in the embodiment of the present application. Fig.11 As shown, in some embodiments, step S4 is also included before step S3.
[0209] Step S4 , determining the insertion state of the first terminal 202 according to the first voltage U1 and the second voltage U2 .
[0210] If the insertion status of the first terminal 202 is that it has been inserted into the first port 201 , step S3 is executed.
[0211] If the insertion state of the first terminal 202 is not inserted into the first port 201 , step S5 is executed.
[0212] It is understandable that if the insertion state of the first terminal 202 is not inserted into the first port 201 , it can be considered that it does not have a device type corresponding to the external device 300 .
[0213] Different from the above-mentioned embodiment, after obtaining the values of the first voltage U1 and the second voltage U2, the insertion state of the first terminal 202 is first determined according to the values of the first voltage U1 and the second voltage U2. In the specific implementation process, the processor 203 may be preset with the first value and the second value, the first value being the voltage value corresponding to the first voltage U1 when the first terminal 202 is not inserted into the first port 201, and the second value being the voltage value corresponding to the second voltage U2 when the first terminal 202 is not inserted into the first port 201. If the first voltage U1 is the first value and the second voltage U2 is the second value, it is determined that the insertion state of the first terminal 202 is not inserted into the first port 201. If the first voltage U1 is not the first value, or the second voltage U2 is not the second value, it is determined that the insertion state of the first terminal 202 is inserted into the first port 201. In this way, the insertion state of the first terminal 202 is first determined according to the value, and after the insertion state of the first terminal 202 is inserted into the first port 201, the first truth table matching method is further adopted.
[0214] Further Fig.11 As shown, in some embodiments, step S4 is followed by step S5.
[0215] Step S5, delay for a first time period, and jump to S1.
[0216] In some embodiments, the first duration can be set to 1 second. The first duration can be set based on the user's actual plugging and unplugging speed of the first terminal 202 , so that the processor 203 polls and obtains the first voltage U1 and the second voltage U2 within the first duration, meeting the identification requirements for the external device 300 .
[0217] It should be noted here that the embodiment of the present application does not limit the specific value of the first duration, and the first duration can be set according to actual conditions.
[0218] In the above embodiment, the processor 203 can reduce the step of matching the device type of the external device 300 after determining that the insertion state of the first terminal 202 is not inserted into the first port 201, and can identify the device types of the first terminal 202 and the external device 300 based on the speed at which the user actually plugs and unplugs the first terminal 202.
[0219] Fig.12 This is the third flow chart of the device identification method provided in the embodiment of the present application. Fig.12 As shown, in some embodiments, step S6 is further included before step S1.
[0220] Step S6, before obtaining the first voltage U1 and the second voltage U2, detecting whether the electronic device 100 is in a dormant state; the dormant state includes: the operating system kernel of the electronic device 100 is completely dormant.
[0221] If the electronic device is not in the sleep state, execute step S1.
[0222] If the electronic device is in a dormant state, step S6 is executed again.
[0223] In some embodiments, if the electronic device is in a sleep state, a second time period is delayed and then step S6 is executed again.
[0224] The electronic device 100 has a sleep state and a non-sleep state. In the sleep state, some external devices 300 cannot perform their functions. Therefore, even if the first voltage U1 and the second voltage U2 are obtained in the sleep state, the external device 300 cannot be further driven to perform its function. Therefore, not obtaining the first voltage U1 and the second voltage U2 in the sleep state can reduce power consumption.
[0225] In some embodiments, a low-power space is provided in part of the electronic device 100, and the low-power space can still run even when the core is completely dormant. For example, the low-power space can be a Sensorhub, and therefore, the ADC1 pin 2031 and the ADC2 pin 2032 can be provided inside the low-power space. In this way, the insertion state of the first terminal 201 and the device type of the external device 300 can be identified with low power consumption even in the dormant state.
[0226] In some embodiments, the dormant state does not include a state where the electronic device 100 turns off the screen but is still playing music. Since headphones are a common external device 300, and the user may not perform other operations when listening to music, the electronic device 100 turns off the screen to reduce power consumption. In this scenario, the first voltage U1 and the second voltage U2 still need to be continuously obtained to ensure that the connection state of the external device 300 is good.
[0227] Further Fig.12 As shown, in some embodiments, step S3 further includes steps S7-S12.
[0228] Step S7 , after determining the device type of the external device 300 , perform universal serial bus enumeration with the external device 300 .
[0229] USB enumeration is a process in which the external device 300 is connected to the electronic device 100 and assigns a clear address code to the electronic device 100, and the address code is used to access the electronic device 100. In this way, the electronic device 100 and the external device 300 can establish communication.
[0230] Step S8: If the enumeration is successful, it is determined that the external device 300 has been connected.
[0231] Step S9, after determining that the external device 300 has been connected, obtain the first voltage U1 and the second voltage U2.
[0232] It should be noted that the first voltage U1 and the second voltage U2 may be voltages acquired in step S1, or may be voltages acquired again after determining that the external device 300 has been connected. This embodiment of the present application is not limited to this.
[0233] Step S10 , judging whether the first voltage U1 and the second voltage U2 match the device type of the external device 300 .
[0234] Among them, since the processor 203 needs to determine whether the external device 300 is still in place after the external device 300 is connected, the processor 203 determines again whether the first voltage U1 and the second voltage U2 match the device type of the external device 300. If the first voltage U1 and the second voltage U2 do not match the device type of the external device 300, S11 is executed. If the first voltage U1 and the second voltage U2 match the device type of the external device 300, S12 is executed.
[0235] Step S11, determining whether the first terminal 202 has been unplugged.
[0236] For example, the first target code corresponding to the first voltage U1 is A, and the second target code corresponding to the second voltage U2 is B. At this time, the device type of the corresponding external device 300 is a data exchange device. If the second target code corresponding to the second voltage U2 is changed to A, the device type of the external device 300 is not present at this time, and it does not match the device type of the data exchange device, and it is further determined that the first terminal 202 has been unplugged.
[0237] The processor 203 can determine that the first terminal 202 has been unplugged based on whether the first target code and the second target code are a combination of AA codes. The processor 203 can also determine that the first terminal 202 has been unplugged based on whether the first voltage U1 and the second voltage U2 match the preset first value and the second value.
[0238] If the first terminal 202 has been unplugged, it is detected again whether the electronic device 100 is in the sleep state.
[0239] If the first terminal 202 is not unplugged, the insertion state of the first terminal 202 is acquired again.
[0240] Step S12, delay for a third time period, and jump to step S9.
[0241] In this way, the processor 203 can determine whether the external device 300 continues to be present.
[0242] In some embodiments, the third time length can be set to 1 second. The third time length can be set based on the actual speed of the user plugging and unplugging the first terminal 202, so that the processor 203 polls and obtains the first voltage U1 and the second voltage U2 within the third time length to meet the identification requirements of the external device 300.
[0243] In some embodiments, the device type of the external device 300 can also be a preset specific device type, for example, the specific device type is a headset, and this specific device type is an external device 300 that can still operate after the screen is turned off. In this way, if the first voltage U1 and the second voltage U2 still match the specific device type, the first voltage U1 and the second voltage U2 can be obtained by delaying the fourth time length, and the fourth time length is greater than the third time length. In this way, power consumption can be reduced by extending the acquisition time of the first voltage U1 and the second voltage U2.
[0244] In the above embodiment, the processor 203 can identify the device types of the first terminal 202 and the external device 300 based on the speed at which the user actually plugs and unplugs the first terminal 202 .
[0245] In some embodiments, if the device type of the external device 300 is a specific device type, after the electronic device 100 turns on the screen, step S1 is triggered.
[0246] In some embodiments, it also includes:
[0247] If the first target threshold or the second target threshold is the first preset threshold, the number of pull-up resistors coupled to the first terminal 202 is determined according to the first voltage U1 , the second voltage U2 , and the first preset threshold.
[0248] The first preset threshold may be the fourth threshold. If the first target threshold or the second target threshold is the fourth threshold, the first voltage U1, the second voltage U2 and the fourth threshold may be combined to determine whether the first terminal 202 is coupled with one pull-up resistor or two pull-up resistors.
[0249] It should be noted that when the processor 203 detects the first voltage U1 or the second voltage U2, it can be determined that the first terminal 202 is pulled up to the VBUS pin by a single resistor. When the processor 203 detects the first voltage U1 and the second voltage U2, it can be determined that the first terminal 202 is pulled up to the VBUS pin by two resistors. Based on this, the data line type can be identified.
[0250] In some embodiments, it also includes:
[0251] If the first target threshold or the second target threshold is the second preset threshold, the first terminal 202 is determined to be a dual role port DRP; and the first port 202 is determined to be a downlink port DFP or an uplink port UFP according to the internal configuration of the electronic device 100 .
[0252] The second preset threshold may be the fifth threshold. Thus, if the first target threshold or the second target threshold is the fifth threshold, it is determined that the first terminal 202 is a DRP.
[0253] In some embodiments, the device type of the external device includes at least one of a data exchange OTG device, a debugging device, an audio device, a power adapter, and a power transmission PD device.
[0254] The device identification apparatus 200 and the device identification method shown in the present application form a first detection path 204 through the ADC1 pin 2031 and the CC1 pin 2011, and form a second detection path 205 through the ADC2 pin 2032 and the CC2 pin 2012, so as to respectively detect the first voltage U1 and the second voltage U2, and at the same time cooperate with the software detection logic to realize the functions of identifying the insertion status of the first terminal 202 and identifying the device type of the external device 300 connected to the first terminal 202, eliminating the detection chip, reducing the circuit complexity, and reducing the hardware cost.
[0255] The device identification method shown in the present application, based on the device identification device 200, cooperates with the software detection logic to realize the function of identifying the insertion state of the first terminal 202 and the device type of the external device 300 connected to the first terminal 202, eliminating the detection chip, reducing the circuit complexity, and reducing the hardware cost. The above mainly introduces the scheme provided by the embodiment of the present application from the perspective of electronic equipment. It can be understood that in order to realize the above functions, the electronic equipment includes a hardware structure and / or software module corresponding to each function. Those skilled in the art should easily realize that, in combination with the steps of a device identification method of each example described in the embodiment disclosed in the present application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the form of hardware or electronic equipment software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0256] The embodiment of the present application can divide the above-mentioned electronic device into functional modules or functional units according to the above-mentioned method example. For example, each functional module or functional unit can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of software functional modules or functional units. Among them, the division of modules or units in the embodiment of the present application is schematic, which is only a logical function division, and there may be other division methods in actual implementation.
[0257] The embodiment of the present application also provides a chip system, which includes at least one processor and at least one interface circuit. The processor and the interface circuit can be interconnected by lines. For example, the interface circuit can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit can be used to send signals to other devices. Exemplarily, the interface circuit can read instructions stored in the memory and send the instructions to the processor. When the instructions are executed by the processor, the electronic device can perform the various steps in the above embodiments. Of course, the chip system can also include other discrete devices, which is not specifically limited in the embodiment of the present application.
[0258] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device, the electronic device executes each function or step executed by the mobile phone in the above-mentioned method embodiment.
[0259] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute each function or step executed by the mobile phone in the above method embodiment.
[0260] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0261] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0262] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0263] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0264] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0265] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A device identification apparatus, characterized in that: Applied to electronic equipment, the device comprises: A first port including a first configuration channel CC1 pin and a second configuration channel CC2 pin; The processor comprises a first analog-to-digital conversion ADC1 pin and a second analog-to-digital conversion ADC2 pin; The ADC1 pin is connected to the CC1 pin to form a first detection path; The ADC2 pin is connected to the CC2 pin to form a second detection path; The processor is configured to: detect a first voltage of the CC1 pin through the first detection path, and detect a second voltage of the CC2 pin through the second detection path; The first voltage and / or the second voltage changes in response to the first terminal being inserted into the first port and the first terminal being removed from the first port.
2. The device identification apparatus according to claim 1, characterized in that: The processor is further configured to: identify an insertion state of the first terminal according to the first voltage and the second voltage, and identify a device type of an external device connected to the first terminal.
3. The device identification apparatus according to claim 1, characterized in that: Also includes: A first pull-up resistor, one end of which is coupled to the port power supply, and the other end of which is coupled to the first detection path; The first pull-up resistor is configured to pull up the first voltage to a preset threshold range using the port power supply; A second pull-up resistor, one end of which is coupled to the port power supply, and the other end of which is coupled to the second detection path; The second pull-up resistor is configured to pull up the second voltage to within a preset threshold range using the port power supply.
4. The device identification apparatus according to claim 3, characterized in that: Also includes: A first switch, one end of which is coupled to the port power supply, the other end of which is coupled to the first detection path, and is connected in series with the first pull-up resistor; A second switch has one end coupled to the port power supply, the other end coupled to the second detection path, and is connected in series with the second pull-up resistor.
5. The device identification apparatus according to any one of claims 1 to 4, characterized in that: Also includes: A first pull-down resistor, one end of which is coupled to the first detection path, and the other end of which is coupled to ground; The first pull-down resistor is configured to pull the first voltage down to a preset threshold range; A second pull-down resistor, one end of which is coupled to the second detection path, and the other end of which is coupled to ground; The second pull-down resistor is configured to pull the second voltage down to within a preset threshold range.
6. The device identification apparatus according to claim 5, characterized in that: Also includes: a third pull-down resistor, one end of which is coupled to the first detection path, the other end of which is coupled to the ground, and which is connected in parallel with the first pull-down resistor; A third switch, one end of which is coupled to the first detection path, the other end of which is coupled to the ground, and is connected in series with the third pull-down resistor; a fourth pull-down resistor, one end of which is coupled to the second detection path, the other end of which is coupled to the ground, and which is connected in parallel with the second pull-down resistor; A fourth switch has one end coupled to the second detection path and the other end coupled to the ground, and is connected in series with the fourth pull-down resistor.
7. The device identification apparatus according to claim 1, characterized in that: Also includes: A first diode is located on the first detection path, an anode of the first diode is coupled to the ADC1 pin, and a cathode of the first diode is coupled to the CC1 pin; The second diode is located on the second detection path, the anode of the second diode is coupled to the ADC2 pin, and the cathode of the second diode is coupled to the CC2 pin.
8. The device identification apparatus according to claim 1, characterized in that: The processor includes at least one of a system-on-chip (SOC), a central processing unit (CPU), and a power management unit (PMU).
9. The device identification apparatus according to claim 6 or 7, characterized in that: The processor is further configured to: acquiring the first voltage and the second voltage; Matching the first voltage and the second voltage with state codes in a preset first truth table respectively to obtain a first code combination, wherein the first code combination includes a first target code corresponding to the first voltage and a second target code corresponding to the second voltage; The first code combination is matched with a code combination in a preset second truth table to determine the insertion state of the first terminal and / or the device type of the external device.
10. The device identification apparatus according to claim 9, characterized in that: The processor is further configured to: determining an insertion state of the first terminal according to the first voltage and the second voltage; If the insertion state of the first terminal is that it has been inserted into the first port, the step of matching the first voltage and the second voltage with the state codes in the preset first truth table is performed.
11. The device identification apparatus according to claim 10, characterized in that: The processor is further configured to: After determining the insertion state of the first terminal, if the insertion state of the first terminal is not inserted into the first port, the first voltage and the second voltage are acquired with a delay of a first time length.
12. The device identification apparatus according to claim 11, characterized in that: The processor is further configured to: Before acquiring the first voltage and the second voltage, detecting whether the electronic device is in a dormant state; The dormant state includes: the operating system kernel of the electronic device is completely dormant; If the electronic device is not in the sleep state, obtaining the first voltage and the second voltage; If the electronic device is in the sleep state, delay for a second time period to detect whether the electronic device is in the sleep state.
13. The device identification apparatus according to claim 12, characterized in that: The processor is further configured to: After determining the device type of the external device, performing universal serial bus enumeration with the external device; If the enumeration is successful, it is determined that the external device has been connected; determining whether the first voltage and the second voltage match the device type of the external device; If the first voltage and the second voltage do not match the device type of the external device, determining whether the first terminal has been unplugged; If the first terminal has been unplugged, detecting again whether the electronic device is in the dormant state; If the first terminal is not unplugged, the insertion state of the first terminal is acquired again.
14. The device identification apparatus according to claim 13, characterized in that: The processor is further configured to: If the first voltage and the second voltage match the device type of the external device, the first voltage and the second voltage are acquired after a third time delay.
15. The device identification apparatus according to claim 10, characterized in that: The processor is further configured to: Determining a first target threshold corresponding to the first voltage, and determining the first target code according to the first target threshold; And, determining a second target threshold corresponding to the second voltage, and determining the second target code according to the second target threshold.
16. The device identification apparatus according to claim 15, characterized in that: The processor is further configured to: If the first target threshold or the second target threshold is a first preset threshold, the number of pull-up resistors coupled to the first terminal is determined according to the first voltage, the second voltage, and the first preset threshold.
17. The device identification apparatus according to claim 15, characterized in that: The processor is further configured to: If the first target threshold or the second target threshold is a second preset threshold, determining that the first terminal is a dual role port DRP; The first port is determined to be a downstream port DFP or an upstream port UFP according to the internal configuration of the electronic device.
18. The device identification apparatus according to claim 1, characterized in that: The device type of the external device includes: at least one of a data exchange OTG device, a debugging device, an audio device, a power adapter, and a power transmission PD device.
19. The device identification apparatus according to claim 15, characterized in that: The processor is further configured to: If the first detection path is provided with a first diode, and the second detection path is provided with a second diode, the first target threshold is determined according to the temperature of the first diode, and the second target threshold is determined according to the temperature of the second diode.
20. An electronic device, characterized in that: It comprises a device identification apparatus as described in any one of claims 1-19.
21. A device identification method, characterized in that: The device identification device according to any one of claims 1 to 19 comprises: Acquire a first voltage and a second voltage; the first voltage is a voltage of a first configuration channel CC1 pin of a first port in the device identification apparatus, and the second voltage is a voltage of a second configuration channel CC2 pin of the first port; the first voltage and / or the second voltage changes in response to a first terminal being inserted into the first port and the first terminal being removed from the first port; Matching the first voltage and the second voltage with state codes in a preset first truth table respectively to obtain a first code combination, wherein the first code combination includes a first target code corresponding to the first voltage and a second target code corresponding to the second voltage; The first code combination is matched with a code combination in a preset second truth table to determine the insertion state of the first terminal and / or the device type of the external device.
22. The device identification method according to claim 21, characterized in that: Also includes: determining an insertion state of the first terminal according to the first voltage and the second voltage; If the insertion state of the first terminal is that it has been inserted into the first port, the step of matching the first voltage and the second voltage with the state codes in the preset first truth table is performed.
23. The device identification method according to claim 21 or 22, characterized in that: After determining the insertion state of the first terminal, the method further includes: If the insertion state of the first terminal is not inserted into the first port, the first voltage and the second voltage are acquired after a first delay.
24. The device identification method according to claim 23, characterized in that: Before obtaining the first voltage and the second voltage, the method includes: Detecting whether the electronic device corresponding to the device identification device is in a dormant state; the dormant state includes: the operating system kernel of the electronic device is completely dormant; If the electronic device is not in the sleep state, obtaining the first voltage and the second voltage; If the electronic device is in the sleep state, delay for a second time period to detect whether the electronic device is in the sleep state.
25. The device identification method according to claim 24, characterized in that: After determining the device type of the external device, the method further includes: Performing universal serial bus enumeration with the external device; If the enumeration is successful, it is determined that the external device has been connected; determining whether the first voltage and the second voltage match the device type of the external device; If the first voltage and the second voltage do not match the device type of the external device, determining whether the first terminal has been unplugged; If the first terminal has been unplugged, detecting again whether the electronic device is in the dormant state; If the first terminal is not unplugged, the insertion state of the first terminal is acquired again.
26. The device identification method according to claim 25, characterized in that: Also includes: If the first voltage and the second voltage match the device type of the external device, the first voltage and the second voltage are acquired after a third time delay.
27. The device identification method according to claim 21 or 22, characterized in that: The matching the first voltage and the second voltage with the state codes in a preset first truth table respectively includes: Determining a first target threshold corresponding to the first voltage, and determining the first target code according to the first target threshold; And, determining a second target threshold corresponding to the second voltage, and determining the second target code according to the second target threshold.
28. The device identification method according to claim 27, characterized in that: Also includes: If the first target threshold or the second target threshold is a first preset threshold, the number of pull-up resistors coupled to the first terminal is determined according to the first voltage, the second voltage, and the first preset threshold.
29. The device identification method according to claim 27, characterized in that: Also includes: If the first target threshold or the second target threshold is a second preset threshold, determining that the first terminal is a dual role port DRP; The first port is determined as a downlink port DFP or an uplink port UFP according to the internal configuration of the electronic device corresponding to the device identification device.
30. The device identification method according to claim 21, characterized in that: The device type of the external device includes: at least one of a data exchange OTG device, a debugging device, an audio device, a power adapter, and a power transmission PD device.
31. The device identification method according to claim 27, characterized in that: If the first detection path is provided with a first diode, and the second detection path is provided with a second diode, the first target threshold is determined according to the temperature of the first diode, and the second target threshold is determined according to the temperature of the second diode.
Citation Information
Patent Citations
Device identification method, apparatus, storage medium and electronic device
CN108920397A
A processing apparatus and a processing method
CN110492717A
Pin testing device and method, control equipment and storage medium
CN113590402A
Interface identification circuit, interface identification method and intelligent terminal
CN113922465A
CC detection function circuit of Type C
CN215986443U
