Access detection method of electronic device interface, electronic device, and storage medium
By acquiring and controlling the pin connections of the analog switch, the voltage divider signal is reacquired to identify the type of external device, thus solving the problem of electronic devices misjudging the 1-to-2 adapter and enabling normal audio playback.
Patent Information
- Application Number
- CN202210094396.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-26
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2042-01-26
AI Technical Summary
The electronic device incorrectly identified the 1-to-2 adapter as a 3-segment headphone, causing the audio to fail to play properly.
By acquiring the voltage divider signal from the codec, the pins of the analog switch are interchanged, and the voltage divider signal is acquired again to determine the type of external device, thus avoiding misjudgment.
Accurately identify the type of external device to ensure that audio is played out properly through the speaker.
Smart Images

Figure CN116546410B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of electronics, and in particular to an access detection method for an interface of an electronic device, an electronic device, and a readable storage medium. BACKGROUND
[0002] Currently, a one-to-two adapter can improve the compatibility of the external interface of an electronic device. The one-to-two adapter is used to simultaneously couple a charging line and earphones to the external interface of the electronic device, so that the electronic device can be charged while music is played.
[0003] There is a one-to-two adapter, and the SBU pins of the A face and the B face of the Type-C interface of the one-to-two adapter are only short-circuited to ground. Therefore, in the application scenario where the Type-C interface of the one-to-two adapter is independently accessed to the electronic device interface without connecting other devices, the one-to-two adapter is inserted into the electronic device with the A face facing up or the B face facing up. The ground impedance of the SBU pin of the electronic device interface is different, and the voltage division value formed is different, so the electronic device can identify that the one-to-two adapter is a different type of external device. For example, when the Type-C interface of the one-to-two adapter is inserted into the electronic device with the A face facing up, the electronic device identifies that a lengthening line is inserted, and when the Type-C interface of the one-to-two adapter is inserted into the electronic device with the B face facing up, the electronic device identifies that a three-segment earphone is inserted.
[0004] The electronic device incorrectly identifies the independently inserted one-to-two adapter as a three-segment earphone, which can cause the one-to-two adapter to be inserted into the electronic device, and the audio output by the electronic device cannot be normally played through the loudspeaker. SUMMARY
[0005] The present application provides an access detection method for an interface of an electronic device, an electronic device, and a readable storage medium, which aims to solve the problem that the electronic device incorrectly identifies the inserted one-to-two adapter as a three-segment earphone, which causes the audio output by the electronic device to be unable to be normally played through the loudspeaker.
[0006] To achieve the above object, the present application provides the following technical solutions:
[0007] In a first aspect, the present application provides an access detection method of an electronic device interface, applied to an electronic device, and the electronic device interface is a Type-C interface. The access detection method of the electronic device interface comprises: the electronic device acquires a voltage division signal of a codec; the electronic device determines, by using the voltage division signal, that an external device connected to the electronic device interface is a three-segment earphone; the electronic device controls the first pin and the second pin of an analog switch to exchange the pins connected thereto respectively, and acquires the voltage division signal of the codec again, the first pin being used to transmit a microphone signal to the electronic device, and the second pin being a ground pin; and the electronic device determines the category of the external device by using the voltage division signal acquired again.
[0008] As can be seen from the above, after the external device is connected to the electronic device interface, the electronic device acquires the voltage division signal of the codec. If the voltage division signal is used to determine that the external device connected to the electronic device interface is a three-segment earphone, the first pin and the second pin of the analog switch are controlled to exchange the pins connected thereto respectively, and the voltage division signal of the codec is acquired again. The electronic device determines the category of the external device by using the voltage division signal acquired again. In this way, when a one-to-two adapter with one SBU pin grounded and the other SBU pin floating is connected to the electronic device interface independently, even if the electronic device misjudges this type of one-to-two adapter as a three-segment earphone by using the voltage division signal. After the electronic device controls the first pin and the second pin of the analog switch to exchange the pins connected thereto respectively and acquires the voltage division signal again, it can be determined accurately that the electronic device interface is connected to a one-to-two adapter, thereby avoiding the problem that the electronic device incorrectly identifies the one-to-two adapter as a three-segment earphone, resulting in that the audio output by the electronic device cannot be normally played through a loudspeaker.
[0009] In a possible implementation, the manner in which the electronic device determines that the external device is a three-segment earphone by using the voltage division signal comprises: the electronic device determines, according to a corresponding relationship between the voltage division signal and the external device, that the external device corresponding to the voltage division signal is a three-segment earphone.
[0010] In a possible implementation, the corresponding relationship between the voltage division signal and the external device comprises: the voltage division signal in a first interval corresponds to an extension cord, the voltage division signal in a second interval corresponds to a positive four-segment earphone, and the voltage division signal in a third interval corresponds to a three-segment earphone or a negative four-segment earphone; the voltage division signal in the first interval is greater than the voltage division signal in the second interval, and the voltage division signal in the second interval is greater than the voltage division signal in the third interval; wherein: the electronic device determines, according to the corresponding relationship between the voltage division signal and the external device, that the external device corresponding to the voltage division signal is a three-segment earphone, comprising: the electronic device determines that the voltage division signal is located in the third interval, and determines that the external device connected to the electronic device interface is a three-segment earphone.
[0011] In a possible implementation, the access detection method of the electronic device interface further includes: determining, by the electronic device, that the voltage division signal is located in the first interval, and determining that the external device connected to the electronic device interface is an extension cord; determining, by the electronic device, that the voltage division signal is located in the second interval, and determining that the external device connected to the electronic device interface is a four-segment earphone.
[0012] In a possible implementation, the method for controlling the first pin and the second pin of the analog switch to be connected to each other by the electronic device includes: generating, by the electronic device, a control signal for controlling the first pin and the second pin of the analog switch to be connected to each other; and transmitting, by the electronic device, the control signal to the analog switch.
[0013] In a possible implementation, the method for transmitting, by the electronic device, the control signal to the analog switch includes: transmitting, by the electronic device, the control signal to the third pin and the fourth pin of the analog switch, and the third pin and the fourth pin are used to connect an I2C bus.
[0014] In a possible implementation, the method for determining, by the electronic device, the category of the external device by using the re-acquired voltage division signal includes: determining, by the electronic device, that the re-acquired voltage division signal corresponds to a three-segment earphone; and determining, by the electronic device, that the re-acquired voltage division signal does not correspond to a three-segment earphone, and determining the category of the external device corresponding to the re-acquired voltage division signal by using a correspondence relationship between the voltage division signal and the category of the external device.
[0015] In a possible implementation, the correspondence relationship between the voltage division signal and the external device includes: the voltage division signal in the first interval corresponds to an extension cord, the voltage division signal in the second interval corresponds to a positive four-segment earphone, and the voltage division signal in the third interval corresponds to a three-segment earphone or a negative four-segment earphone; the voltage division signal in the first interval is greater than the voltage division signal in the second interval, and the voltage division signal in the second interval is greater than the voltage division signal in the third interval; and the method for determining, by the electronic device, that the re-acquired voltage division signal corresponds to a three-segment earphone includes: determining, by the electronic device, that the re-acquired voltage division signal is located in the third interval, and determining that the external device connected to the electronic device interface is a three-segment earphone.
[0016] In a possible implementation, the method for determining, by the electronic device, the category of the external device corresponding to the re-acquired voltage division signal by using the correspondence relationship between the voltage division signal and the category of the external device includes: determining, by the electronic device, that the re-acquired voltage division signal is located in the first interval, and determining that the external device connected to the electronic device interface is an extension cord; and determining, by the electronic device, that the re-acquired voltage division signal is located in the second interval, and determining that the external device connected to the electronic device interface is a four-segment earphone.
[0017] In a possible implementation, the method for determining, by the electronic device, the category of the external device by using the re-acquired voltage division signal includes: determining, by the electronic device, the category of the external device corresponding to the re-acquired voltage division signal according to the correspondence relationship between the voltage division signal and the external device.
[0018] In a possible implementation, the correspondence between the voltage division signal and the external device includes: the voltage division signal in the first interval corresponds to an extension cord, the voltage division signal in the second interval corresponds to a positive four-segment earphone, and the voltage division signal in the third interval corresponds to a three-segment earphone or a reverse four-segment earphone; the voltage division signal in the first interval is greater than the voltage division signal in the second interval, and the voltage division signal in the second interval is greater than the voltage division signal in the third interval; the electronic device determines the type of the external device corresponding to the voltage division signal obtained again according to the correspondence between the voltage division signal and the external device, including: the electronic device determines that the voltage division signal obtained again is located in the first interval, and determines that the external device connected to the interface of the electronic device is the extension cord; the electronic device determines that the voltage division signal obtained again is located in the second interval, and determines that the external device connected to the interface of the electronic device is the four-segment earphone; and the electronic device determines that the voltage division signal obtained again is located in the third interval, and determines that the external device connected to the interface of the electronic device is the three-segment earphone.
[0019] In a possible implementation, the first interval includes: a voltage division signal range of [2.55V, 2.7V]; the second interval includes: a voltage division signal range of (0.9V, 2.55V); and the third interval includes: a voltage division signal range of [0V, 0.9V].
[0020] In a possible implementation, before the electronic device obtains the voltage division signal of the codec, the method further includes: the electronic device determines that the external device is connected to the interface of the electronic device.
[0021] In a possible implementation, the manner in which the electronic device determines that the external device is connected to the interface of the electronic device includes: the electronic device determines that the external device is connected to the interface of the electronic device by using a level value of a CC pin of the interface of the electronic device.
[0022] In a possible implementation, the external device is a one-to-two adapter in which one SBU pin of the interface is grounded and the other SBU pin is left floating; and the electronic device determines the type of the external device by using the voltage division signal obtained again, including: the electronic device determines that the voltage division signal obtained again is located in the first interval, and determines that the external device connected to the interface of the electronic device is the extension cord.
[0023] In a possible implementation, the external device is a one-to-two adapter with one SBU pin of the interface grounded and the other SBU pin floating. In a scenario where the one-to-two adapter is independently connected to the interface of the electronic device, the electronic device determines, by using the voltage division signal, that the external device connected to the interface of the electronic device is a three-segment earphone, controls the first pin and the second pin of the analog switch to exchange the pins connected thereto, and obtains the voltage division signal of the codec again. The electronic device determines, by judging the voltage division signal obtained again, that the external device connected to the interface of the electronic device is an extension cord. In this way, the electronic device can accurately identify the type of the external device connected to the interface of the electronic device.
[0024] In a second aspect, the present application provides an electronic device, comprising: an electronic device interface configured to connect to an external device; an analog switch configured to connect pins of the electronic device interface; a voltage division discrimination circuit configured to connect the analog switch and a codec, obtain a voltage division signal, and provide the voltage division signal to the codec; one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is configured to store computer program codes, the computer program codes comprising computer instructions, when the one or more processors execute the computer instructions, the electronic device performs the method for detecting connection of the electronic device interface according to any one of the first aspect.
[0025] In a possible implementation, the voltage division discrimination circuit comprises: a first resistor, a second resistor, a third resistor, and a fourth resistor, wherein: one end of the first resistor is connected to the second resistor, and the other end of the first resistor is connected to the third resistor; a connection point of the first resistor and the second resistor is connected to a first pin of the codec, and the first pin is configured to output a direct current bias voltage of a microphone; a port of the second resistor that is not connected to the first resistor is connected to the fourth resistor; or a port of the third resistor that is not connected to the first resistor or a port of the fourth resistor that is not connected to the second resistor outputs the voltage division signal.
[0026] In a third aspect, the present application provides a computer readable storage medium configured to store a computer program, when the computer program is executed, the computer program is specifically configured to implement the method for detecting connection of the electronic device interface according to any one of the first aspect.
[0027] In a fourth aspect, the present application provides a computer program product, when the computer program product is executed on a computer, the computer program product causes the computer to perform the method for detecting connection of the electronic device interface according to any one of the first aspect. BRIEF DESCRIPTION OF DRAWINGS
[0028] Figure 1a A connection diagram of the electronic device and the one-to-two adapter provided by the embodiment of the present application;
[0029] Figure 1b A pin diagram of a Type-C interface provided by the embodiment of the present application;
[0030] Figure 2 The display diagram of the one-to-two adapter accessing the electronic device interface is provided in the embodiments of the present application;
[0031] Figure 3 The hardware structure diagram of the electronic device is provided in the embodiments of the present application;
[0032] Figure 4a The internal circuit diagram of the electronic device is provided in the embodiments of the present application;
[0033] Figure 4b The display diagram of the corresponding relationship between the external device and the divided voltage MIC_P is provided in the embodiments of the present application;
[0034] Figure 5 The flowchart of the access detection method of the electronic device interface is provided in the embodiments of the present application;
[0035] Figure 6a The circuit connection diagram of the electronic device and the one-to-two adapter is provided in the embodiments of the present application;
[0036] Figure 6b The circuit connection diagram of the electronic device and the one-to-two adapter is provided in the embodiments of the present application;
[0037] Figure 7 The display diagram of the one-to-two adapter accessing the electronic device interface is provided in the embodiments of the present application. DETAILED DESCRIPTION
[0038] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. The terms used in the following embodiments are only for the purpose of describing the specific embodiments and are not intended to be limiting to the present application. As used in the specification and the appended claims of the present application, the singular forms “a,” “an,” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that “one or more” in the embodiments of the present application means one, two, or more than two; “and / or” describes the association relationship of the associated objects, which means that there can be three kinds of relationships; for example, A and / or B can represent the following three cases: A exists alone, A and B exist together, and B exists alone, where A and B can be singular or plural. The character “ / ” generally represents an “or” relationship between the associated objects.
[0039] Reference in the specification to "one embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. The appearances of the phrase "in one embodiment" or "in some embodiments" in various places in the specification are not necessarily all referring to the same embodiment, although it can. The terms "including," "comprising," "having" and variations thereof are meant to encompass the items listed thereafter and equivalents thereof as well as additional items.
[0040] The plurality referred to in the embodiments of the present application means greater than or equal to two. It should be noted that in the description of the embodiments of the present application, the terms "first", "second", and the like are used only for the purpose of distinguishing the described purposes, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.
[0041] In the present application, unless specifically defined and limited otherwise, the term "connection" should be interpreted broadly, for example, "connection" can be fixed connection, or detachable connection, or integral; can be directly connected, or indirectly connected through an intermediate medium. In addition, the term "coupling" can be an electrical connection mode for realizing signal transmission.
[0042] With the gradual improvement of the portability requirements of electronic devices, electronic devices, such as mobile phones, interfaces for coupling with external devices need to have high compatibility. When the interface is connected to a charging line, the mobile phone can be charged through the charging line and the interface. When the interface is connected to a headset, the audio signal in the mobile phone can be transmitted to the headset through the interface. In order to be able to charge the mobile phone while listening to music, a one-to-two adapter can be used to simultaneously couple the charging line, the headset, and the interface of the mobile phone.
[0043] Figure 1a A connection diagram of an electronic device 100 and a one-to-two adapter 200 is shown. As shown in Figure 1a The one-to-two adapter 200 includes a plug 21, a socket end 22, and a connection line 23 connecting the plug 21 and the socket end 22. The plug 21 is used to connect the interface of the electronic device 100, and the socket end 22 includes two socket interfaces, which can be used to connect the headset and the charging line. The two socket interfaces of the socket end 22 can simultaneously connect the charging line and the headset, realizing audio output while charging the electronic device, or the two socket interfaces of the socket end 22 can simultaneously connect two headsets, realizing simultaneous audio output at the two socket interfaces. Of course, the two socket interfaces of the socket end 22 can also connect the headset or the charging line by one socket interface, and the other socket interface is suspended, realizing audio output at one socket interface or charging the electronic device.
[0044] Figure 1a The one-to-two adapter 200 shown is an example of a conventional one-to-two adapter and does not constitute a limitation of the one-to-two adapter targeted by the present application.
[0045] In general, the interface of the electronic device 100 is a Type-C interface, and the plug 21 of the one-to-two adapter 200 is also a Type-C interface. Figure 1b The internal pin diagram of the Type-C interface is provided. As shown in Figure 1b The A face and the B face of the Type-C interface each have 12 pins. The Type-C interface also supports the “reversible insertion” function that can be inserted from both the front and the back. In an example, the A face of the Type-C interface is inserted upward, which belongs to front insertion; the B face of the Type-C interface is inserted upward, which belongs to back insertion.
[0046] Referring to Figure 1b , the A face and the B face of the Type-C interface each include two symmetrically arranged VBUS pins (for providing USB voltage, pin 4 and pin 9), a CC pin (pin 5), a Dp1 pin (pin 6), a Dn1 pin (pin 7), an SBU pin (labeled as SBU1 on the A face and SBU2 on the B face), and four GND pins (for grounding, pin 1 and pin 12 on the A face and the B face). The A face of the Type-C interface further includes a TXp1 pin, a TXn1 pin, an RXp2 pin, and an RXn2 pin; the B face of the Type-C interface further includes an RXp1 pin, an RXn1 pin, a TXp2 pin, and a TXn2 pin, for transmitting digital signals.
[0047] When the external device accesses the Type-C interface of the electronic device 100, the SBU pin of the Type-C interface of the external device is connected to the SBU pin of the Type-C interface of the electronic device 100, which brings the impedance to ground to the SBU pin of the electronic device. Due to the impedance to ground, the SBU pin of the Type-C interface of the electronic device forms a voltage division on the voltage of the electronic device, and the voltage division value is used to judge the type of the external device.
[0048] At present, the one-to-two adapters that can access the interface of the electronic device are generally divided into two types. The first type of one-to-two adapter is a common one-to-two adapter, and the SBU1 pin and the SBU2 pin of the Type-C interface of the one-to-two adapter are open to ground, that is, the two pins are in a suspended state. The second type of one-to-two adapter belongs to a special type, and the SBU1 pin and the SBU2 pin of the Type-C interface of the one-to-two adapter are open to ground, that is, the pin is suspended, and one is short-circuited to ground, that is, the pin is grounded.
[0049] The first one-to-two adapter, because the SBU1 pin and the SBU2 pin of the Type-C interface are both open to ground. Therefore, in the application scenario where the socket end of the first one-to-two adapter is not connected to other devices and only the first one-to-two adapter is connected to the electronic device interface, the first one-to-two adapter is inserted into the electronic device interface face up or face down, the SBU1 pin or the SBU2 pin of the Type-C interface of the first one-to-two adapter brings the same ground impedance to the SBU pin of the electronic device interface, and the voltage division value of the electronic device is also the same. In this way, whether the first one-to-two adapter is inserted into the electronic device interface face up or face down, the electronic device recognizes that the first one-to-two adapter is the same kind of external device.
[0050] However, the second one-to-two adapter, because the two SBU pins of the Type-C interface are only one SBU pin shorted to ground and the other SBU pin open to ground. Therefore, in the application scenario where the socket end of the second one-to-two adapter is not connected to other devices and only the second one-to-two adapter is connected to the electronic device interface, the second one-to-two adapter is inserted into the electronic device interface face up or face down, the ground impedance of the SBU pin of the electronic device interface is different, and the voltage division value formed is different, and the electronic device will recognize that the one-to-two adapter is a different kind of external device. Under normal circumstances, the second one-to-two adapter is connected to the electronic device interface in different insertion modes, and the electronic device will recognize that the second one-to-two adapter is a line out or a headset.
[0051] In Figure 2 In one example, the SBU pin of the A face of the Type-C interface 21 of the one-to-two adapter 200 is suspended, and the SBU pin of the B face is suspended and connected to a pull-down resistor. Based on this, referring to (a) in Figure 2 , the A face of the Type-C interface 21 of the one-to-two adapter 200 is inserted into the Type-C interface of the electronic device 100 face up, and the electronic device 100 recognizes that a line out is inserted, and the electronic device 100 can normally play out. Referring to (b) in Figure 2 , the B face of the Type-C interface 21 of the one-to-two adapter 200 is inserted into the Type-C interface of the electronic device 100 face up, and the electronic device 100 incorrectly recognizes that a headset is inserted, such as recognizing that a three-section headset is inserted, and the electronic device 100 defaults to playing audio in the form of a headset and cannot normally play out.
[0052] Based on the foregoing problems, the embodiments of the present application provide a method for detecting the connection of an electronic device interface, which can be applied to an electronic device, Figure 3A structural diagram of the electronic device 100 is shown. The electronic device 100 can be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a notebook computer, an ultra-mobile personal computer (UMPC), a handheld computer, a netbook, a personal digital assistant (PDA), a wearable electronic device, a smart watch, and the like.
[0053] Taking a mobile phone as an example, the electronic device 100 can include a processor 110, an external memory interface 120, an internal memory 121, 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 loudspeaker 170A, a receiver 170B, a microphone 170C, and the like.
[0054] It can be understood that the structure shown in the embodiments 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 can include more or fewer components than shown, or combine certain components, or split certain components, or different arrangement of components. The components shown can be implemented in hardware, software, or a combination of software and hardware.
[0055] The processor 110 can include one or more processing units, for example: the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), and the like. Among them, different processing units can be independent devices, or can be integrated in one or more processors. Among them, the processor can be the nerve center and command center of the electronic device 100. The processor can generate operation control signals according to instruction operation codes and timing signals, complete the control of fetching instructions and executing instructions.
[0056] The processor 110 can also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can hold instructions or data that the processor 110 has just used or is using repeatedly. If the processor 110 needs to use the instructions or data again, it can be called directly from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thus improving the efficiency of the system.
[0057] In some embodiments, the processor 110 can include one or more interfaces. The interfaces can include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0058] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 performs various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 can include a program storage area and a data storage area. The program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), etc. The data storage area can store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0059] The electronic device interface can be a USB interface 130 for connecting a wired earphone. In the embodiments of the present application, the USB interface 130 is an interface conforming to the USB standard specification, and can be a USB Type C interface or the like. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and a peripheral device. It can also be used to connect an earphone to play audio through the earphone. The interface can also be used to connect other electronic devices, such as AR devices, adapters, and the like.
[0060] The charging management module 140 is used to receive charging input from a charger. The charging management module 140 can also supply power to the electronic device through the power management module 141 while charging the battery 142. 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 to supply power to the processor 110, the internal memory 121, the external memory, the flexible screen, the camera, and the wireless communication module 160, and the like. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, battery health status (leakage, impedance), and the like.
[0061] The wireless communication function of the electronic device 100 can be realized through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor, and the like.
[0062] The electronic device 100 can realize audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the electronic device interface, and the application processor, and the like. For example, music playing, recording, and the like.
[0063] The audio module 170 is used to convert digital audio information into analog audio signals, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be disposed in the processor 110, or some functional modules of the audio module 170 can be disposed in the processor 110. In some embodiments, the audio module 170 includes a CODEC for converting digital audio information into analog audio signals and converting analog audio input into digital audio signals.
[0064] The speaker 170A, also known as a "loudspeaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.
[0065] The receiver 170B, also called "earpiece", is used to convert the audio electrical signal into the sound signal. When the electronic device 100 answers the phone or voice message, the user can answer the voice by placing the receiver 170B close to the ear.
[0066] The microphone 170C, also called "microphone", "sound collector", is used to convert the sound signal into the electrical signal. When making a call or sending a voice message, the user can make a sound by placing the mouth close to the microphone 170C, and input the sound signal into the microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In some other embodiments, the electronic device 100 can be provided with two microphones 170C, which can realize the noise reduction function in addition to collecting the sound signal. In some other embodiments, the electronic device 100 can be provided with three, four or more microphones 170C, which can realize the sound signal collection, noise reduction, sound source identification, directional recording and other functions.
[0067] Figure 4a An internal circuit diagram of an electronic device provided by an embodiment of the present application is shown. Figure 4a In the electronic device shown, the electronic device interface 130 is connected to the power management unit (PMU), and is connected to the CODEC through the analog switch and the voltage division discrimination circuit. The electronic device interface 130 can be understood as Figure 3 The USB interface 130 shown.
[0068] Specifically, the PMU is connected to the two CC pins of the electronic device interface 130, so that the PMU can receive the signal transmitted by the CC pin. In addition, the PMU and the CODEC are respectively provided with CC_OUT pins, and the two CC_OUT pins can be connected to realize the signal interaction between the PMU and the CODEC through the CC_OUT pins. In some embodiments, the interface of the external device is inserted into the electronic device interface 130, the CC pin of the electronic device interface 130 is pulled down, and the PMU receives the CC signal interruption. The PMC outputs the level signal to the CC_OUT pin of the CODEC through the CC_OUT pin. In this way, the CODEC can determine that the electronic device interface 130 is inserted with the external device.
[0069] As described above, the electronic device interface 130 adopts the Type-C interface, and the SBU1 pin and the SBU2 pin of the interface are respectively located on the A face and the B face of the electronic device interface 130. Based on this, the front and back faces of the external device are connected to the electronic device interface 130, and the connection between the external device and the electronic device will be different.
[0070] In one example, the external device is a headset with a Type-C interface. The MIC end and the ground end AGND on the headset can be coupled with the SBU1 pin and the SBU2 pin of the Type-C interface of the headset. In this example, the MIC end on the headset is coupled with the SBU1 pin, and the ground end AGND on the headset is coupled with the SBU2 pin.
[0071] The headset is inserted into the electronic device interface 130 in a front insertion manner. The MIC end on the headset is coupled with the SBU1 pin of the Type-C interface of the headset through the SBU1 pin of the electronic device interface 130, and the ground end AGND on the headset is coupled with the SBU2 pin of the Type-C interface of the headset through the SBU2 pin of the electronic device interface 130. Based on this, the MIC end on the headset is coupled with the MIC signal end of the CODEC through the analog switch and the voltage division discrimination circuit, and the ground end AGND on the headset is coupled with the GND of the analog switch. The signal of the MIC end on the headset can be normally input to the CODEC.
[0072] However, the headset is inserted into the electronic device interface 130 in a reverse insertion manner. The MIC end on the headset is coupled with the SBU2 pin of the electronic device interface 130 through the SBU1 pin of the Type-C interface of the headset, and the ground end AGND on the headset is coupled with the SBU1 pin through the SBU2 pin of the Type-C interface of the headset. The signal of the MIC end on the headset cannot be normally transmitted to the CODEC.
[0073] The analog switch is used to switch the coupling mode of the SBU1 pin and the SBU2 pin of the electronic device interface and the CODEC, so that no matter whether the headset is inserted in a forward or reverse manner, the MIC end on the headset can be coupled with the signal ground end of the CODEC.
[0074] Specifically, the analog switch is provided with two end pins. One end pin, such as the SBU1 pin and the SBU2 pin shown in the figure, is connected with the SBU1 pin and the SBU2 pin of the electronic device interface 130. The other end pin, such as the MIC pin and the ground pin GND shown in the figure, is connected with the MIC pin and the ground pin GND of the CODEC. Figure 4a The SBU1 pin and the SBU2 pin shown in the figure are connected with the SBU1 pin and the SBU2 pin of the electronic device interface 130. The other end pin, such as the MIC pin and the ground pin GND shown in the figure, is connected with the MIC pin and the ground pin GND of the CODEC. Figure 4a The MIC pin is connected with the CODEC through the voltage division discrimination circuit, and the SENSE pin is used to connect the MIC pin and the left and right channels of the electronic device.
[0075] It should be further noted that the left and right channels of the electronic device are also connected with the left and right channels of the headset through the analog switch. In this way, the left and right channels of the headset form a loop with the MIC end or the ground end AGND of the headset.
[0076] The two end pins of the analog switch can be switched to be connected. In some embodiments, the SCL pin and the SDA pin of the analog switch are configured to receive a control signal issued by a processor of the electronic device through an I2C bus (shown as I2C_SCL and I2C_SDA), and the control signal is used to control the switched connection of the two end pins of the analog switch, so as to realize that the SBU1 pin of the analog switch is connected to the MIC pin, or the SBU2 pin of the analog switch is connected to the ground pin GND. Figure 4a
[0077] The voltage dividing discrimination circuit of the electronic device is configured to divide the MIC_BIAS output by the CODEC, and obtain a voltage dividing value MIC_N and a voltage dividing value MIC_P, and input the voltage dividing value MIC_N and the voltage dividing value MIC_P to the CODEC. The voltage dividing discrimination circuit includes Figure 4a The capacitors C1 to C6 and the resistors R4 to R7 are shown in the figure, and the connection relationship is as shown in the figure, which will not be described in detail. In the voltage dividing discrimination circuit, the capacitors C1 to C6 play a protection role, and can be optional components. In some embodiments, the voltage dividing discrimination circuit can only include the resistors R4 to R7, and does not include the capacitors C1 to C6, or includes part of the capacitors C1 to C6. Figure 4a
[0078] Of course, Figure 4a The voltage dividing discrimination circuit shown is an example, and does not constitute a limitation on the voltage dividing discrimination circuit of the electronic device of the present application. In some embodiments, the voltage dividing discrimination circuit can also include more components than those shown in the figure.
[0079] It should be noted that the CODEC uses the voltage dividing value MIC_P to identify the category of the external device connected to the interface 130 of the electronic device. Of course, the CODEC can also use the voltage dividing value MIC_N to identify the category of the external device connected to the interface 130 of the electronic device, and the following will be described by taking the CODEC using the voltage dividing value MIC_P to identify the category of the external device connected to the interface 130 of the electronic device as an example.
[0080] In addition to the aforementioned one-to-two adapter that can access the electronic device interface, other external devices can also access the electronic device interface. Currently, external devices that can access the electronic device interface can generally be divided into extension cords and earphones. The extension cord can be understood as a component for assisting other devices to access the electronic device interface. The extension cord generally includes two ports and a connecting line between the two ports, one of the two ports is a Type-C interface for accessing the electronic device interface, and the other port can be connected to other devices. According to the function, the extension cord can be divided into charging cords, data lines, and adapters, etc. In some embodiments, the charging cord and the data line can be the same, which can charge the external device and also can realize data transmission between the external device and the electronic device. Figure 1a The one-to-two adapter 200 shown belongs to one of the extension cords. Common earphones can be divided into three-section earphones and four-section earphones.
[0081] The SBU1 pin and the SBU2 pin of the Type-C interface of different categories of external devices will have different connection modes. Specifically:
[0082] In addition to the second one-to-two adapter proposed in the foregoing, common extension cords include the first one-to-two adapter, and the SBU1 pin and the SBU2 pin of the Type-C interface of the first one-to-two adapter are both open to ground, that is, the two pins are in a suspended state.
[0083] The three-section earphone and the four-section earphone are coupled to the Type-C interface of the electronic device, and the SBU1 pin and the SBU2 pin of the Type-C interface are equivalent to being grounded through a resistor. The equivalent resistance of the left and right channels of the earphone is commonly 8 ohm, 16 ohm, 32 ohm, etc. The difference between the two types of earphones is that the MIC end of the three-section earphone is connected to the ground end AGND, and the MIC end of the four-section earphone is independent of the ground end AGND. The MIC end of the four-section earphone has a ground impedance of about several hundred to several thousand ohms, and the ground end AGND has a ground impedance of 0. Therefore, there is a difference of about several hundred ohms to several thousand ohms of ground impedance between the MIC end and the ground end AGND.
[0084] When the external device is coupled to the electronic device, a voltage dividing resistor for the output voltage MIC_BIAS of the CODEC is generated at the analog switch MIC pin. Of course, because the SBU1 pin and the SBU2 pin of the external device have different connection modes, the voltage dividing resistor for the output voltage MIC_BIAS of the CODEC generated at the analog switch MIC pin is different. Therefore, when the electronic device interface accesses different external devices, the different voltage dividing resistors caused by the different connection modes of the SBU1 pin and the SBU2 pin of the external device, and the effect of the resistor in the voltage dividing discrimination circuit, the CODEC receives different voltage dividing values MIC_P.
[0085] In order to distinguish the types of external devices accessible to the electronic device interface, such as distinguishing extension cords, three-section earphones, and four-section earphones, the electronic device stores a correspondence between external devices and a voltage division value MIC P.
[0086] In one possible implementation, as shown in FIG. 2, the voltage division value MIC P ranges from 0 to 2.7 V. Figure 4b
[0087] In some embodiments, the range of the voltage division value MIC P can be divided into three intervals, and the correspondence between the external devices and the voltage division value MIC P includes: [2.55 V, 2.7 V] corresponding to the extension cord, (0.9 V, 2.55 V) corresponding to the four-section earphone with a positive plug, and [0 V, 0.9 V] corresponding to the three-section earphone and the four-section earphone with a reverse plug. Of course, the end points of the three intervals are not limited to the foregoing division manner, and other division manners can also be used, such as (2.55 V, 2.7 V] corresponding to the extension cord, (0.9 V, 2.55 V] corresponding to the four-section earphone with a positive plug, and [0 V, 0.9 V] corresponding to the three-section earphone and the four-section earphone with a reverse plug.
[0088] It should be noted that the two end points of the three intervals mentioned above can have a certain error range, such as an error range of 0.01. Thus, in one example, the correspondence between the external devices and the voltage division value MIC P can include: 2.55 V±0.01 V to 2.7 V±0.01 V corresponding to the extension cord, 0.9 V to 2.55 V corresponding to the four-section earphone with a positive plug, and 0 to 0.9 V±0.01 V corresponding to the three-section earphone and the four-section earphone with a reverse plug.
[0089] Based on the foregoing, the electronic device interface access detection method provided by the embodiments of the present application, as shown in FIG. 5, includes the following steps: Figure 5
[0090] S501, detecting the state of the electronic device interface.
[0091] When it is detected that the electronic device interface is accessed by the external device, S502 is performed.
[0092] Generally, the various types of external devices mentioned in the foregoing have Type-C interfaces. The external device interface is inserted into the electronic device interface, the pins of the external device interface are connected to the corresponding pins in the electronic device interface, and the pin level in the electronic device interface changes, so that it can be detected whether the electronic device interface is accessed by the external device.
[0093] In some embodiments, the CC pin in the external device interface is pulled down to ground, the external device interface is inserted into the electronic device interface, and the CC pin in the electronic device interface is also pulled down to form a low level because it is connected to the CC pin in the external device interface. In this way, the processor of the electronic device can detect the level of the CC pin in the electronic device interface to determine whether the electronic device interface is connected to the external device.
[0094] Figure 6a In one example, the interface of the electronic device 100 is a Type-C interface, and the interface of the external device 300 connected to the electronic device interface is also a Type-C interface. In addition, the external device 300 can be understood as the second one-to-two adapter described above. The CC pin in the interface of the second one-to-two adapter is pulled down to ground. When the second one-to-two adapter is not connected to other devices and is inserted into the electronic device interface in a reverse manner, the CC pin in the electronic device interface is also pulled down to form a low level because it is connected to the CC pin in the interface of the second one-to-two adapter.
[0095] S502, obtaining a voltage division value received by a CODEC of the electronic device.
[0096] The electronic device detects that the external device is connected to the electronic device interface, and can determine the type of the external device by using the voltage division value received by the CODEC of the electronic device. Therefore, the electronic device obtains the voltage division value received by the CODEC of the electronic device.
[0097] Figure 6a In one example, the SBU1 pin of the interface of the external device 300 is connected to ground, and the SBU2 pin is left floating. As described in step S501, the interface of the external device 300 is inserted into the interface of the electronic device 100, the CC pin of the interface of the electronic device 100 is pulled low, and the PMU receives a CC signal interruption. The PMU outputs a level signal to the CC_OUT pin of the CODEC through the CC_OUT pin. In this way, the CODEC can determine that the electronic device interface is inserted with the external device.
[0098] The CODEC is connected to the power supply voltage VREG_BOB of the electronic device. When the CODEC receives a level signal at the CC_OUT pin, the CODEC controls the switch of the CODEC to enable the power supply voltage VREG_BOB of the electronic device to supply power and output a direct current bias voltage (MIC_BIAS) of a microphone.
[0099] And, the SBU1 pin and the SBU2 pin of the interface of the electronic device 100 are connected to the SBU1 pin and the SBU2 pin of the interface of the external device 300 respectively. Since the analog switch controls the SBU1 pin to connect the MIC pin and the SBU2 pin to connect the GND, the MIC of the analog switch is connected to the SBU1 pin of the external device 300 through the SBU1 pin of the analog switch and the SBU1 pin of the interface of the electronic device 100, that is, a pull-down is introduced at the MIC pin of the analog switch.
[0100] The MIC_BIAS signal output by the CODEC is divided into a voltage value MIC_P under the action of the voltage dividing discrimination circuit and the pull-down. The processor of the electronic device can obtain the voltage value MIC_P (the voltage value MIC_P can also be referred to as a voltage signal).
[0101] S503, in the correspondence between the external device and the voltage value, the voltage value received by the CODEC is used to determine the type of the external device.
[0102] It should be noted that after the electronic device obtains the voltage value received by the CODEC of the electronic device, the processor of the electronic device can use the voltage value to determine the type of the external device. Figure 4b The type of the external device is identified according to the correspondence between the external device and the voltage value.
[0103] It should be noted that if the external device is a common extension line, since the SBU1 pin and the SBU2 pin of the Type-C interface are open to ground, the voltage value received by the CODEC of the electronic device obtained in step S502 is usually large, located in Figure 4b 2.55V-2.7V, so in step S503, it can be determined that the external device is an extension line.
[0104] If the external device is a three-section earphone, since the SBU1 pin and the SBU2 pin of the Type-C interface are connected to ground through a resistor, the voltage value received by the CODEC of the electronic device obtained in step S502 will be located in Figure 4b 0-0.9V, so in step S503, it can be determined that the external device is a three-section earphone or a reverse-plugged four-section earphone.
[0105] If the external device is a four-section earphone, since the SBU1 pin and the SBU2 pin of the Type-C interface are connected to ground through a resistor. Since the SBU1 pin and the SBU2 pin of the Type-C interface also form a loop with the MIC end or the ground end AGND of the four-section earphone, that is, a connection is established. Therefore, the pin connecting the MIC end in the SBU1 pin and the SBU2 pin of the Type-C interface will cause the voltage value received by the CODEC of the electronic device obtained in step S502 to be located inFigure 4b 0.9V~2.55V. And, the pin connecting the ground AGND in the SBU1 pin and the SBU2 pin of the Type-C interface, because the impedance of the ground AGND to the ground is 0, the voltage received by the CODEC of the electronic device obtained in step S502 will be located in Figure 4b 0~0.9V.
[0106] Thus, when the four-section earphone is inserted in the front, the voltage received by the CODEC of the electronic device obtained in step S502 will be located in Figure 4b 0.9V~2.55V, thus, in step S503, it can be determined that the external device is a four-section earphone inserted in the front. When the four-section earphone is inserted in the back, the voltage received by the CODEC of the electronic device obtained in step S502 will be located in Figure 4b 0~0.9V, thus, in step S503, it can be determined that the external device is a three-section earphone or a four-section earphone inserted in the back.
[0107] In Figure 6a In the example shown, the external device 300 is the second one-to-two adapter, the SBU1 pin is grounded, and the SBU2 pin is suspended. In the scenario where the one-to-two adapter is not connected to other devices and is inserted into the electronic device interface in the back, as described in step S502, because the MIC_BIAS signal output by the CODEC is subjected to the voltage division of the voltage division circuit and the pull-down resistance, the voltage division value MIC_P is relatively small, and is basically located in Figure 4b 0~0.9V. Thus, the processor of the electronic device can determine that the external device connected is a three-section earphone or a four-section earphone inserted in the back, by screening the correspondence between the external device and the voltage division value MIC_P received by the CODEC.
[0108] It should be noted that if the second one-to-two adapter is inserted into the electronic device interface in the front. Thus, the SBU2 pin of the interface of the second one-to-two adapter is suspended, the SBU2 pin of the interface of the second one-to-two adapter is connected to the SBU1 pin of the electronic device interface, and the voltage division value received by the CODEC of the electronic device is usually large, located in Figure 4b 2.55V~2.7V, thus, in step S503, it can be determined that the external device is an extension cord.
[0109] After the electronic device determines the category of the external device according to step S504, it can execute the following steps S504a, S504b and S504c according to the several categories of the external device determined.
[0110] S504a, if it is determined that the external device is a three-section earphone or a reverse-plugged four-section earphone, a control signal is generated, which is used to control the pins of the MIC pin and the ground pin GND of the analog switch to be connected to each other.
[0111] The MIC pin and the ground pin GND of the analog switch are connected to each other, that is, the pin connected to the MIC pin of the analog switch is adjusted to be connected to the ground pin GND of the analog switch, and the pin connected to the ground pin GND of the analog switch is adjusted to be connected to the MIC pin of the analog switch.
[0112] In Figure 6a In the example shown, the connection pin of the MIC pin of the analog switch is SBU1, and the connection pin of the ground pin GND is SBU2. When the processor determines that the external device is a three-section earphone or a reverse-plugged four-section earphone, the processor generates a control signal to control the MIC pin and the ground pin GND of the analog switch to be connected to each other. After the connection pins are exchanged, the connection form of the pins of the analog switch is as shown in Figure 6b In the example shown, the connection pin of the MIC pin of the analog switch is SBU1, and the connection pin of the ground pin GND is SBU2. When the processor determines that the external device is a three-section earphone or a reverse-plugged four-section earphone, the processor generates a control signal to control the MIC pin and the ground pin GND of the analog switch to be connected to each other. After the connection pins are exchanged, the connection form of the pins of the analog switch is as shown in
[0113] The processor generates a control signal to control the MIC pin and the ground pin GND of the analog switch to be connected to each other. The specific implementation manner is as described above, and will not be described here.
[0114] It should be noted that the electronic device performs step S504a, and then performs steps S505 to S508.
[0115] S504b, if it is determined that the external device is a lengthening line, the electronic device is controlled to play audio through a loudspeaker.
[0116] If the electronic device determines that the external device is a lengthening line, the electronic device is controlled to play audio through a loudspeaker when audio needs to be played.
[0117] S504c, if it is determined that the external device is a four-section earphone plugged in directly, the electronic device is controlled to play audio in the form of an earphone.
[0118] If the electronic device determines that the external device is a four-section earphone plugged in directly, the electronic device is controlled to play audio in the form of an earphone when audio needs to be played.
[0119] S505, obtaining a voltage division value received by a CODEC of the electronic device.
[0120] After the MIC pin and the ground pin GND of the analog switch are connected to each other, Figure 6bAs shown, the MIC pin of the analog switch is connected to SBU2, and is connected to the SBU2 pin of the interface of the external device 300 through the SBU2 pin of the interface of the electronic device 100. Since the SBU2 pin of the interface of the external device 300 is left open, the MIC pin of the analog switch is in an open circuit state, and the voltage MIC_P received by the CODEC of the electronic device is only the voltage divided by the voltage dividing circuit for the MIC_BIAS signal, which is usually the voltage of the MIC_BIAS signal. Figure 4b The voltage range is 2.55V-2.7V.
[0121] S506, determine whether the voltage received by the CODEC is in the voltage range corresponding to the three-segment earphone.
[0122] As described in step S505, the external device 300 is a one-to-two adapter, and the voltage received by the CODEC is in the voltage range of 2.55V-2.7V, which is not in the voltage range 0-0.9V corresponding to the three-segment earphone.
[0123] If the external device 300 is a three-segment earphone, as described above, the two SBU pins of the three-segment earphone are connected to ground through a grounding resistor, and the MIC pin of the analog switch is connected to the ground pin GND. The voltage MIC_P received by the CODEC of the electronic device is still the voltage divided by the voltage dividing circuit and the grounding resistor for the MIC_BIAS signal, so the voltage MIC_P received by the CODEC is still in the voltage range of 2.55V-2.7V. Figure 4b The voltage range is 0-0.9V.
[0124] If it is determined that the voltage received by the CODEC is in the voltage range corresponding to the three-segment earphone, step S507 is performed to determine that the external device is a three-segment earphone.
[0125] If it is determined that the external device is a three-segment earphone, the processor of the electronic device can perform the normal process of the three-segment earphone inserted into the device, such as controlling the audio information to be output through the three-segment earphone, which is not described here.
[0126] If it is determined that the voltage received by the CODEC is not in the voltage range corresponding to the three-segment earphone, step S508 is performed to determine the type of the external device using the voltage received by the CODEC in the correspondence between the external device and the voltage.
[0127] In some embodiments, in step S504, the external device is identified as a three-segment earphone or a reverse-plugged four-segment earphone, and then secondary detection is performed in steps S506 and S506. If the external device is indeed a four-segment earphone, after the MIC pin and the ground pin GND of the analog switch are connected to each other in step S504, the four-segment earphone is switched from reverse plug to normal plug, and the voltage division value MIC_P obtained in step S505 will fall within the range of 0.9-2.55V. Thus, in step S506, it is determined that the external device is a normal-plugged four-segment earphone.
[0128] In addition, if the inserted external device is a one-to-two adapter, in step S504, the external device is identified as a three-segment earphone or a reverse-plugged four-segment earphone. When secondary detection is performed in steps S506 and S506, after the MIC pin and the ground pin GND of the analog switch are connected to each other, the voltage division value MIC_P obtained in step S505 will fall within the range of 2.55V-2.7V. Thus, in step S506, it is determined that the external device is an extension cord, avoiding the error of identifying the one-to-two adapter as a three-segment earphone, so that the electronic device can correctly play audio information through the loudspeaker. Figure 7 As shown in FIG. 6, when the one-to-two adapter is inserted into the electronic device in the front or in the back, the electronic device can correctly identify the one-to-two adapter as an extension cord, ensuring that the electronic device can normally play audio information through the loudspeaker.
[0129] It should be further noted that steps S506-S508 are a way in which the electronic device identifies the type of the external device by using the voltage division value received by the CODEC. In some embodiments, after the electronic device obtains the voltage division value received by the CODEC in step S505, the electronic device can also identify the external device by using the voltage division value and the corresponding relationship between the voltage division value and the external device.
[0130] Another embodiment of the present application provides a computer-readable storage medium, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can perform the access detection method of the electronic device interface in any of the above embodiments.
[0131] The computer-readable storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0132] Another embodiment of the present application also provides a computer program product containing instructions. When the computer program product is run on a computer or a processor, the computer or the processor performs one or more steps in any of the above methods.
Claims
1. An access detection method for an electronic device interface, characterized by, The method comprises the steps of: In the case that the electronic device interface accesses an external device, the electronic device acquires a voltage division signal of a codec; wherein the codec is connected to an analog switch through a voltage division discrimination circuit, the analog switch is connected to the electronic device interface, and the voltage division signal of the codec is a voltage division of a direct current bias voltage output by the codec through the voltage division discrimination circuit and a pin of the external device; The electronic device determines that the external device accessed by the electronic device interface is a three-section earphone by using the voltage division signal. The electronic device controls the first pin and the second pin of the analog switch to interchange the pins connected thereto, and acquires the voltage division signal of the codec again; the first pin is used to transmit a microphone signal to the electronic device, and the second pin is a ground pin; the pins connected to the first pin and the second pin include an SBU1 pin and an SBU2 pin of the analog switch, the SBU1 pin is used to connect an SBU1 pin of the electronic device interface and one of the first pin and the second pin, and the SBU2 pin is used to connect an SBU2 pin of the electronic device interface and the other of the first pin and the second pin; The electronic device determines the category of the external device by using the voltage division signal acquired again.
2. The access detection method of an electronic device interface according to claim 1, wherein, The electronic device determines that the external device is a three-section earphone by using the voltage division signal, which comprises the steps of: The electronic device determines that the external device corresponding to the voltage division signal is a three-section earphone according to the correspondence between the voltage division signal and the external device.
3. The access detection method of an electronic device interface according to claim 2, wherein, The correspondence between the voltage division signal and the external device comprises: the voltage division signal in a first interval corresponds to an extension cord, the voltage division signal in a second interval corresponds to a positive four-section earphone, and the voltage division signal in a third interval corresponds to a three-section earphone or a reverse four-section earphone; the voltage division signal in the first interval is greater than that in the second interval, and the voltage division signal in the second interval is greater than that in the third interval. The electronic device determines that the external device accessed by the electronic device interface is a three-section earphone according to the correspondence between the voltage division signal and the external device, which comprises the steps of: The electronic device determines that the external device accessed by the electronic device interface is a three-section earphone according to the correspondence between the voltage division signal and the external device, which comprises the steps of:
4. The access detection method of an electronic device interface according to claim 3, wherein, The electronic device determines that the external device accessed by the electronic device interface is a three-section earphone according to the correspondence between the voltage division signal and the external device, which comprises the steps of: The electronic device controls the first pin and the second pin of the analog switch to interchange the pins connected thereto, which comprises the steps of: The electronic device generates a control signal, and the control signal is used to control the first pin and the second pin of the analog switch to interchange the pins connected thereto; 5. The access detection method of an electronic device interface according to any one of claims 1 to 4, characterized in that, The electronic device transmits the control signal to the analog switch. The electronic device transmits the control signal to the analog switch, which comprises the steps of: 6. The access detection method of an electronic device interface according to claim 5, wherein, The electronic device transmits the control signal to a third pin and a fourth pin of the analog switch, and the third pin and the fourth pin are used to connect an I2C bus.
7. The access detection method of an electronic device interface according to any one of claims 1 to 4, characterized in that, The electronic device determines the category of the external device according to the correspondence relationship between the voltage division signal and the external device. The electronic device determines that the voltage division signal corresponds to a three-section earphone. The electronic device determines that the voltage division signal does not correspond to a three-section earphone, and determines the category of the external device corresponding to the voltage division signal according to the correspondence relationship between the voltage division signal and the external device.
8. The access detection method of an electronic device interface according to claim 7, wherein, The correspondence relationship between the voltage division signal and the external device includes: the voltage division signal in a first interval corresponds to an extension line, the voltage division signal in a second interval corresponds to a positive four-section earphone, and the voltage division signal in a third interval corresponds to a three-section earphone or a reverse four-section earphone; the voltage division signal in the first interval is greater than that in the second interval, and the voltage division signal in the second interval is greater than that in the third interval. The electronic device determines that the voltage division signal corresponds to a three-section earphone, including: The electronic device determines that the voltage division signal is located in the third interval, and determines that the external device connected to the interface of the electronic device is a three-section earphone.
9. The access detection method of an electronic device interface according to claim 8, wherein, The electronic device determines that the voltage division signal corresponds to a three-section earphone, including: The electronic device determines that the voltage division signal is located in the first interval, and determines that the external device connected to the interface of the electronic device is an extension line. The electronic device determines that the voltage division signal is located in the second interval, and determines that the external device connected to the interface of the electronic device is a four-section earphone.
10. The access detection method of an electronic device interface according to any one of claims 1 to 4, characterized in that, The electronic device determines the category of the external device according to the correspondence relationship between the voltage division signal and the external device. The electronic device determines the category of the external device according to the correspondence relationship between the voltage division signal and the external device.
11. The access detection method of an electronic device interface according to claim 10, wherein, The correspondence relationship between the voltage division signal and the external device includes: the voltage division signal in a first interval corresponds to an extension line, the voltage division signal in a second interval corresponds to a positive four-section earphone, and the voltage division signal in a third interval corresponds to a three-section earphone or a reverse four-section earphone; the voltage division signal in the first interval is greater than that in the second interval, and the voltage division signal in the second interval is greater than that in the third interval. The electronic device determines the category of the external device according to the correspondence relationship between the voltage division signal and the external device, including: The electronic device determines that the voltage division signal is located in the first interval, and determines that the external device connected to the interface of the electronic device is an extension line. The electronic device determines that the voltage division signal is located in the second interval, and determines that the external device connected to the interface of the electronic device is a four-section earphone. The electronic device determines that the voltage division signal is located in the third interval, and determines that the external device connected to the interface of the electronic device is a three-section earphone.
12. The access detection method of an electronic device interface according to claim 3, 8 or 11, characterized in that, The first interval includes a voltage division signal range of [2.55V, 2.7V], the second interval includes a voltage division signal range of (0.9V, 2.55V), and the third interval includes a voltage division signal range of [0V, 0.9V].
13. The access detection method of an electronic device interface according to any one of claims 1 to 4, characterized in that, Before the electronic device acquires the voltage division signal of the codec, the method further includes: The electronic device determines that the electronic device interface accesses the external device.
14. The access detection method of an electronic device interface according to claim 13, wherein, The electronic device determines that the electronic device interface accesses the external device. The electronic device determines that the electronic device interface accesses the external device.
15. The access detection method of an electronic device interface according to claim 3, wherein, The electronic device determines that the electronic device interface accesses the external device. The external device is a one-to-two adapter with one SBU pin grounded and the other SBU pin floating. The electronic device determines the category of the external device by using the voltage division signal acquired again.
16. An electronic device, comprising: The electronic device determines that the voltage division signal acquired again is located in the first interval, and determines that the external device accessed by the electronic device interface is an extension cord. The method includes: An electronic device interface for accessing an external device; An analog switch for connecting a pin of the electronic device interface; A voltage division discrimination circuit for connecting the analog switch and a codec to obtain a voltage division signal and provide the voltage division signal to the codec; One or more processors and a memory; 17. The electronic device of claim 16, wherein, The memory is coupled to the one or more processors, and the memory is configured to store computer program code including computer instructions, when the one or more processors execute the computer instructions, the electronic device executes the access detection method of the electronic device interface as claimed in any one of claims 1 to 15. The voltage division discrimination circuit includes a first resistor, a second resistor, a third resistor, and a fourth resistor, wherein: One end of the first resistor is connected to the second resistor, and the other end is connected to the third resistor, the connection point of the first resistor and the second resistor is connected to a first pin of a codec, and the first pin is used to output a direct current bias voltage of a microphone; 18. A computer-readable storage medium, characterized in that, The port of the second resistor not connected to the first resistor is connected to the fourth resistor, and the port of the third resistor not connected to the first resistor or the port of the fourth resistor not connected to the second resistor outputs the voltage division signal. The computer program is used to store a computer program, and when the computer program is executed, it is specifically used to implement the access detection method of the electronic device interface as claimed in any one of claims 1 to 15.
Citation Information
Patent Citations
Equivalent circuit of microphone and test fixture
CN215268725U