Earphone detection system, earphone detection method and electronic equipment
By integrating plug-in/plug-out detection, headphone type recognition, and button detection modules into the digital-to-analog converter chip, and connecting it to the main control chip using an interrupt signal output terminal, the problem of scarce IO resources in the headphone detection solution is solved, achieving multi-functional detection while saving resources and improving layout and wiring.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ALLWINNER TECH CO LTD
- Filing Date
- 2025-12-04
- Publication Date
- 2026-04-21
AI Technical Summary
In existing technologies, headphone detection solutions require multiple IO interface resources, which leads to a lack of functionality when IO resources are scarce, and makes layout and wiring difficult.
The plug-in/plug-out detection module, headphone type recognition module, and button detection module are integrated into a digital-to-analog converter chip, which is connected to the I/O interface of the main control chip through an interrupt signal output terminal to achieve multi-functional detection.
It saves I/O interface resources of the main control chip, reduces signal traces, and improves the compactness of the layout and routing.
Smart Images

Figure CN121908206A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to an earphone detection system, earphone detection method, and electronic device. Background Technology
[0002] On terminal devices with headphone functionality, headphone plug-in / plug-out and button detection are required during headphone use. Mature headphone plug-in / plug-out and button detection solutions already exist in the industry. Electronic devices with headphone jacks, such as mobile phones, tablets, and computers, can convert external speaker sound into headphone playback and identify the type of headphones (i.e., whether they have a microphone). In related technologies, the main control chip requires at least two I / O interfaces to detect headphone plug-in / plug-out, identify headphone type, and detect buttons. Using two ordinary I / O interfaces enables headphone plug-in / plug-out detection and headphone type identification, but not button detection. Using one ordinary I / O interface and one I / O interface with voltage detection enables headphone plug-in / plug-out detection, headphone type identification, and button detection. However, using an extra I / O interface means missing a function when I / O resources are scarce; and layout and routing become more difficult when the board layout is compact. How to achieve multi-functional headphone detection while conserving I / O interface resources is a pressing technical problem that needs to be solved. Summary of the Invention
[0003] This application aims to address at least one of the technical problems existing in the prior art. To this end, this application proposes an earphone detection system, earphone detection method, and electronic device that can achieve multi-functional detection of earphones while saving I / O interface resources and allowing for better layout and routing during PCB fabrication.
[0004] In a first aspect, embodiments of this application provide an earphone detection system, including: A digital-to-analog converter chip, comprising: an interrupt signal output terminal, a plug-in / plug-out detection pin, an HBIAS power supply pin, a plug-in / plug-out detection module, an earphone type recognition module, and a button detection module; wherein, the plug-in / plug-out detection pin is connected to the core voltage source, the input terminal of the plug-in / plug-out detection module is connected to the plug-in / plug-out detection pin, the output terminal of the plug-in / plug-out detection module is connected to the interrupt signal output terminal and the input terminal of the earphone type recognition module respectively; the output terminal of the earphone type recognition module is connected to the HBIAS power supply pin and the input terminal of the button detection module respectively; and the output terminal of the button detection module is connected to the interrupt signal output terminal. The main control chip is connected to the digital-to-analog converter chip via a bus communication, and one of the I / O interfaces of the main control chip is connected to the interrupt signal output terminal.
[0005] Secondly, embodiments of this application provide a headphone detection method, applied to a headphone detection system as described in any of the embodiments of the first aspect. The headphone detection system includes: a digital-to-analog converter chip and a main control chip; the digital-to-analog converter chip includes: an interrupt signal output terminal, a plug-in / plug-out detection pin, an HBIAS power supply pin, a plug-in / plug-out detection module, a headphone type recognition module, and a button detection module; the main control chip and the digital-to-analog converter chip are connected via a bus communication connection, and one IO interface of the main control chip is connected to the interrupt signal output terminal. The method includes: The digital-to-analog converter chip detects the level signal on the insertion / removal detection pin through the insertion / removal detection module to determine the insertion / removal status information, and sends an interrupt signal to the main control chip so that the main control chip reads the insertion / removal status information to determine the insertion / removal status of the headphones; When an earphone is detected being inserted, the digital-to-analog converter chip detects and stores the HBIAS current value on the HBIAS power pin through the earphone type identification module, so that the main control chip can identify and determine the type of the inserted earphone based on the read HBIAS current value. The digital-to-analog converter chip uses the button detection module to determine the button status based on the HBIAS current value, determines the button status information, and sends an interrupt signal to the main control chip so that the main control chip can read the button status information to determine the headphone button status.
[0006] Thirdly, embodiments of this application provide an electronic device, including an earphone detection system as described in any of the embodiments of the first aspect.
[0007] This application embodiment includes: an earphone detection system comprising: a digital-to-analog converter chip and a main control chip; wherein, the digital-to-analog converter chip includes: an interrupt signal output terminal, a plug-in / plug-out detection pin, an HBIAS power supply pin, a plug-in / plug-out detection module, an earphone type recognition module, and a button detection module; wherein, the plug-in / plug-out detection pin is connected to the core voltage source, the input terminal of the plug-in / plug-out detection module is connected to the plug-in / plug-out detection pin, and the output terminal of the plug-in / plug-out detection module is connected to the interrupt signal output terminal and the input terminal of the earphone type recognition module respectively; the output terminal of the earphone type recognition module is connected to the HBIAS power supply pin and the input terminal of the button detection module respectively; the output terminal of the button detection module is connected to the interrupt signal output terminal; the main control chip and the digital-to-analog converter chip are connected via bus communication, and one IO interface of the main control chip is connected to the interrupt signal output terminal. During the operation of the headphone detection system, the digital-to-analog converter chip detects the level signal on the insertion / removal detection pin through the insertion / removal detection module to determine the insertion / removal status information, and sends an interrupt signal to the main control chip, so that the main control chip can read the insertion / removal status information to determine the insertion / removal status of the headphone; when the headphone is detected to be inserted, the digital-to-analog converter chip detects and stores the HBIAS current value on the HBIAS power pin through the headphone type identification module, so that the main control chip can identify and determine the headphone type of the inserted headphone based on the read HBIAS current value; the digital-to-analog converter chip judges the button status based on the HBIAS current value through the button detection module, determines the button status information, and sends an interrupt signal to the main control chip, so that the main control chip can read the button status information to determine the headphone button status. By integrating the plug-in / plug-out detection module, headphone type recognition module, and button detection module into the digital-to-analog converter chip, only one I / O interface of the main control chip is used to receive the interrupt signal sent by the digital-to-analog converter chip. This allows for multiple functions, including headphone plug-in / plug-out detection, headphone type recognition, and button status detection, working in conjunction with the digital-to-analog converter chip. This saves one I / O interface resource of the main control chip and reduces one signal trace, thus allowing for better layout and routing when the PCB layout is compact. In other words, this embodiment of the application can achieve multi-functional detection of headphones while saving I / O interface resources and enabling better layout and routing during PCB fabrication. Attached Figure Description
[0008] Figure 1 This is a schematic diagram of the structure of an existing headphone detection system; Figure 2 This is a schematic diagram of the structure of an earphone detection system provided in one embodiment of this application; Figure 3 This is a schematic diagram of the operation of an earphone detection system provided in one embodiment of this application; Figure 4This is a schematic diagram of the specific structure of a digital-to-analog converter chip provided in one embodiment of this application; Figure 5 This is a schematic flowchart of an embodiment of the headphone detection method provided in this application; Figure 6 This is a schematic diagram of the overall process of an earphone detection method provided in one embodiment of this application; Figure 7 This is a signal timing diagram of the process of implementing the headphone detection method according to an embodiment of this application. Detailed Implementation
[0009] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments.
[0010] It should be noted that although a logical order is shown in the flowcharts in this application, in some cases, the steps shown or described may be performed in a different order than that shown in the flowcharts. In the description of this application, "several" means one or more, and "more" means two or more. The terms "first" and "second" are used only to distinguish technical features and should not be construed as indicating or implying relative importance, or implicitly indicating the number of technical features indicated, or implicitly indicating the order in which the technical features are indicated.
[0011] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0012] First, let me explain some of the terms used in this application: HP_DET interface: Used to detect whether headphones are plugged in. When headphones are plugged in, the voltage level of this interface changes, thus notifying the device that the headphones are connected.
[0013] MIC_DET interface: Used to detect whether a microphone is connected. When a microphone is plugged in, the voltage level of this interface changes, notifying the device that the microphone is connected.
[0014] I2S is a serial communication protocol for audio data transmission, primarily used for connections between digital audio devices.
[0015] I2C is a serial communication protocol used for low-speed communication, primarily for communication between microcontrollers and various peripheral devices.
[0016] An IRQ (Interrupt Request Signal) is a signal used to request an interrupt. It allows hardware devices to send a signal to the processor when needed, requesting the processor to pause the current task and process a specific event or task.
[0017] This application provides an earphone detection system, an earphone detection method, and an electronic device, relating to the field of communication technology. The earphone detection system includes: a digital-to-analog converter chip and a main control chip connected via a bus communication connection. The digital-to-analog converter chip includes: an interrupt signal output terminal, a plug-in / plug-out detection pin, an HBIAS power supply pin, a plug-in / plug-out detection module, an earphone type recognition module, and a button detection module. The plug-in / plug-out detection pin is connected to the core voltage source; the input terminal of the plug-in / plug-out detection module is connected to the plug-in / plug-out detection pin; the output terminal of the plug-in / plug-out detection module is connected to the interrupt signal output terminal and the input terminal of the earphone type recognition module, respectively; the output terminal of the earphone type recognition module is connected to the HBIAS power supply pin and the input terminal of the button detection module, respectively; the output terminal of the button detection module is connected to the interrupt signal output terminal; and one I / O interface of the main control chip is connected to the interrupt signal output terminal. This system can achieve multi-functional detection of earphones while saving I / O interface resources.
[0018] The embodiments of this application will be further described below with reference to the accompanying drawings.
[0019] Firstly, such as Figure 2 As shown, the headphone detection system 1000 includes: a digital-to-analog converter chip 100 and a main control chip 200. The digital-to-analog converter chip 100 includes: an interrupt signal output terminal 140, a plug-in / plug-out detection pin 160, an HBIAS power supply pin 170, a plug-in / plug-out detection module 110, an earphone type recognition module 120, and a button detection module 130. The plug-in / plug-out detection pin 160 is connected to the core voltage source. The input terminal of the plug-in / plug-out detection module 110 is connected to the plug-in / plug-out detection pin 160, and the output terminal of the plug-in / plug-out detection module 110 is connected to both the interrupt signal output terminal 140 and the input terminal of the earphone type recognition module 120. The output terminal of the earphone type recognition module 120 is connected to both the HBIAS power supply pin 170 and the input terminal of the button detection module 130. The output terminal of the button detection module 130 is connected to the interrupt signal output terminal 140. A main control chip 200 is also included, which communicates with the digital-to-analog converter chip 100 via a bus 300. One I / O interface 400 of the main control chip 200 is connected to the interrupt signal output terminal 140.
[0020] Specifically, the interrupt signal output terminal 140 is used to output an interrupt signal. In one embodiment, when the digital-to-analog converter chip 100 is not integrated into the main control chip 200, the digital-to-analog converter chip 100 and the main control chip 200 are connected via an I2S bus or an I2C bus; in this case, the interrupt signal output by the interrupt signal output terminal 140 is an IRQ signal (i.e., an interrupt request signal). In another embodiment, the digital-to-analog converter chip 100 can be integrated into the main control chip 200, and the I2C bus can be replaced by a data bus 300 for interaction; in this case, the interrupt signal output by the interrupt signal output terminal 140 is a CPU interrupt signal. It is understood that in the headphone detection system 1000, whether the digital-to-analog converter chip 100 is not integrated into the main control chip 200 or is integrated into the main control chip 200, the same technical effect can be achieved: it can save IO interface resources while realizing multi-functional detection of headphones, and it can better lay out the wiring during board manufacturing. Therefore, this application embodiment does not impose specific restrictions on the integration relationship between the digital-to-analog converter chip 100 and the main control chip 200.
[0021] Specifically, the plug-in / plug-out detection pin 160 is the HP_DET interface, which is used to generate different level signals in response to the plugging / plugging status of the headphones.
[0022] Specifically, the HBIAS power pin 170 is used to output the HBIAS voltage to the headphones when the headphones are plugged in.
[0023] Specifically, the insertion / removal detection module 110 is used to detect the level signal on the insertion / removal detection pin 160 to determine the insertion / removal status information, and send an interrupt signal to the main control chip 200 so that the main control chip 200 can read the insertion / removal status information to determine the insertion / removal status of the headphones; thus realizing the headphone insertion / removal detection function.
[0024] Specifically, the headphone type identification module 120 is used to detect and store the HBIAS current value on the HBIAS power pin 170 when a headphone is detected to be inserted, so that the main control chip 200 can identify the type of the inserted headphone based on the read HBIAS current value, thereby realizing the headphone type identification function.
[0025] Specifically, the button detection module 130 is used to determine the button status based on the HBIAS current value, determine the button status information, and send an interrupt signal to the main control chip 200 so that the main control chip 200 can read the button status information to determine the headphone button status; thus realizing the headphone button detection function.
[0026] Specifically, such as Figure 2 As shown, the core voltage source connected to the insertion / removal detection pin 160 refers to VDDIO; VDDIO is the chip's IO (input / output) voltage.
[0027] According to the headphone detection system 1000 provided in the first aspect of this application, during the operation of the headphone detection system 1000, the digital-to-analog converter chip 100 detects the level signal on the insertion / removal detection pin 160 through the insertion / removal detection module 110 to determine the insertion / removal status information, and sends an interrupt signal to the main control chip 200 so that the main control chip 200 reads the insertion / removal status information to determine the insertion / removal status of the headphone; when the headphone is detected to be inserted, the digital-to-analog converter chip 100 detects and stores the HBIAS current value on the HBIAS power pin 170 through the headphone type identification module 120 so that the main control chip 200 identifies and determines the headphone type of the inserted headphone based on the read HBIAS current value; the digital-to-analog converter chip 100 judges the button status based on the HBIAS current value through the button detection module 130 to determine the button status information, and sends an interrupt signal to the main control chip 200 so that the main control chip 200 reads the button status information to determine the headphone button status. By integrating the insertion / removal detection module 110, the headphone type recognition module 120, and the button detection module 130 into the digital-to-analog converter chip 100, only one I / O interface 400 of the main control chip 200 is used to receive the interrupt signal sent by the digital-to-analog converter chip 100. These modules work in conjunction with the digital-to-analog converter chip 100 to complete multiple functions, including headphone insertion / removal detection, headphone type recognition, and button status detection. This saves one I / O interface resource of the main control chip 200 and reduces one signal trace, allowing for better layout and routing when the PCB layout is compact. Therefore, this embodiment of the application can achieve multi-functional detection of headphones while saving I / O interface resources and enabling better layout and routing during PCB fabrication.
[0028] It's important to emphasize that mature solutions for headphone plug / unplug and button detection already exist in the industry. For devices with headphone jacks, such as mobile phones, tablets, and computers, these solutions enable the external speaker to play sound as if headphones were plugged in, and can also identify the type of headphones plugged in (i.e., whether they have a microphone). Existing industry solutions include... Figure 1 As shown, the main control chip 200 requires at least two I / O interfaces to implement headphone plug / unplug detection, headphone type identification, and button status detection. Figure 1The HP_DET interface is used for insertion / removal detection, while the MIC_DET interface is used for headphone type identification and button detection. Before headphones are inserted, HP_DET is high; after insertion, HP_DET is low. Based on this, the main control chip's 200IO interface can detect the headphone insertion / removal status using a single GPIO pin. Upon detecting headphone insertion, the HBIAS power is enabled; upon detecting removal, the HBIAS power is disabled to prevent popping noises during insertion / removal. With the HBIAS power on, the headphone type and button detection can be performed by detecting the voltage of MIC_DET. Taking a 3.5mm round-jack headphone as an example, inserting a three-prong headphone is equivalent to grounding MIC_DET, resulting in a 0V voltage. For a four-prong headphone, the headset is equivalent to a resistor in series, and MIC_DET will detect an intermediate voltage V1, between the HBIAS voltage and 0V. Thus, the type of headphone inserted is distinguished based on the different voltage values. Similarly, when the headphone button is pressed, due to the voltage division caused by the resistor, the MIC_DET interface will detect another voltage level between V1 and 0V; thus, it determines that the headphone button is pressed based on this voltage level between V1 and 0V. In summary, the main control chip 200 requires at least two I / O interfaces to achieve pop-free headphone insertion detection, headphone type recognition, and button detection, and the HBIAS power control needs to be integrated into the main control chip 200. (Comparison) Figure 1 and Figure 3 Compared to existing technologies, this application optimizes the existing architecture by integrating the insertion / removal detection module 110, the headphone type recognition module 120, and the button detection module 130 into the digital-to-analog converter chip 100. The digital-to-analog converter chip 100 is connected to an I / O interface 400 of the main control chip 200 through an interrupt signal output terminal 140. The digital-to-analog converter chip 100 outputs a single interrupt signal IRQ to the main control chip 200. The main control chip 200 and the digital-to-analog converter chip 100 cooperate to achieve multi-functional detection, and save one I / O interface resource compared to existing industry solutions. Furthermore, the headphone type recognition and button detection functions can be achieved without using the MIC_DET interface, reducing a signal trace and saving PCB layout space.
[0029] According to some embodiments of this application, such as Figure 4 As shown, the insertion / removal detection module 110 includes: a first debouncing circuit 111, a level detection circuit 112, and an insertion / removal status register 113. The input terminal of the first debouncing circuit 111 is electrically connected to the insertion / removal detection pin 160; the input terminal of the level detection circuit 112 is electrically connected to the output terminal of the first debouncing circuit 111; the input terminal of the insertion / removal status register 113 is connected to the output terminal of the level detection circuit 112, and the output terminal of the insertion / removal status register 113 is connected to the interrupt signal output terminal 140.
[0030] Specifically, the first debounce circuit 111 is used to eliminate the jitter signal generated on the insertion / removal detection pin 160 and to eliminate the jitter signal generated by the mechanical switch or button at the moment of contact; thereby reducing popping noise during the process of pulling out the headphones and improving the user's headphone experience.
[0031] Specifically, the level detection circuit 112 is used to detect the debouncing level signal on the insertion / removal detection pin 160; thereby determining the removed state value and the inserted state value in the insertion / removal status register 113. Specifically, when the level signal on the insertion / removal detection pin 160 is high, the removed state value in the insertion / removal status register 113 is set to 1; wherein, the removed state value of 1 indicates that the headphones are in the removed state on the insertion / removal detection pin 160 and no headphones are connected; when the level signal on the insertion / removal detection pin 160 is low, the inserted state value in the insertion / removal status register 113 is set to 1; wherein, the inserted state value of 1 indicates that the headphones are in the inserted state on the insertion / removal detection pin 160.
[0032] Specifically, the plug-in / plug-out status register 113 is used to store the unplugged status value and the plugged-in status value; so that after the main control chip 200 detects an interrupt signal (such as an IRQ signal), it interacts with the digital-to-analog converter chip 100 through the bus 300 to read the unplugged status value and the plugged-in status value in the plug-in / plug-out status register 113, and knows the plug-in / plug-out status of the headphones; and clears the interrupt to realize the headphone plug-in / plug-out detection function.
[0033] Specifically, in combination Figure 3 To further illustrate the working principle of the insertion / removal detection module 110 in this application embodiment: Before the headphones are inserted, the HP_DET interface (i.e., insertion / removal detection pin 160) is pulled up to VDDIO, and the HP_DET signal is at a high level; after the headphones are inserted, the HP_DET interface (i.e., insertion / removal detection pin 160) is connected to ground through the 32Ω coil of the headphones, and the HP_DET signal is close to 0V (i.e., at a low level). The insertion / removal detection of the headphones can be achieved by detecting the level of the HP_DET signal.
[0034] In the plug-in / plug-out detection module 110 of this application embodiment, the headphone plug-in / plug-out detection is completed using one ordinary IO interface resource through the cooperation of the first debounce circuit 111, the level detection circuit 112, and the plug-in / plug-out status register 113.
[0035] According to some embodiments of this application, such as Figure 4As shown, the headphone type identification module 120 includes: an LDO power supply circuit 121, a current detection circuit 122, and a current value register 123; wherein, the input terminal of the LDO power supply circuit 121 is connected to the output terminal of the level detection circuit 112; the input terminal of the current detection circuit 122 is connected to the output terminal of the LDO power supply circuit 121, and the output terminal of the current detection circuit 122 is connected to the HBIAS power pin 170; the input terminal of the current value register 123 is connected to the output terminal of the current detection circuit 122.
[0036] Specifically, the LDO power supply circuit 121 is used to receive a low level from the level detection circuit 112 when the headphones are detected to be inserted, thereby activating the circuit to provide HBIAS power to the inserted headphones.
[0037] Specifically, the current detection circuit 122 is activated when the headphones are detected to be inserted, detects the HBIAS current value, and stores the HBIAS current value in the current value register 123.
[0038] Specifically, the current value register 123 is used to store the HBIAS current value detected by the current detection circuit 122, so that the main control chip 200 can interact with the digital-to-analog converter chip 100 through the bus 300 to read the HBIAS current value in the current value register 123, thereby determining the type of the inserted headphones based on the magnitude of the HBIAS current value; thus realizing the headphone type recognition function.
[0039] Specifically, in combination Figure 3 To further explain the working principle of the headphone type identification module 120 in this application embodiment: headphone types are divided into three-section headphones without a microphone and four-section headphones with a microphone; for headphone type identification, when a three-section headphone without a microphone is inserted, the HBIAS power pin 170 connected to the pull-up resistor will be directly connected to ground. At this time, the HBIAS current value output by the HBIAS power pin 170 is the largest; when a four-section headphone with a microphone is inserted, the microphone is connected in series, which is equivalent to connecting a resistor in series. At this time, the HBIAS current value output by the HBIAS power pin 170 is the smallest; therefore, the type of headphone inserted can be determined by detecting the magnitude of the HBIAS current.
[0040] The headphone type identification module 120 in this embodiment of the application realizes the headphone type identification function through the cooperation of the LDO power supply circuit 121, the current detection circuit 122, and the current value register 123.
[0041] According to some embodiments of this application, such as Figure 4As shown, the key detection module 130 includes: a threshold comparison circuit 131, a key status register 132, and a second debouncing circuit 133; wherein, the input terminal of the second debouncing circuit 133 is connected to the output terminal of the current detection circuit 122; the input terminal of the threshold comparison circuit 131 is connected to the output terminal of the second debouncing circuit 133; the input terminal of the key status register 132 is connected to the output terminal of the threshold comparison circuit 131; and the output terminal of the key status register 132 is connected to the interrupt signal output terminal 140.
[0042] Specifically, the threshold comparison circuit 131 is used to compare the HBIAS current value detected by the current detection circuit 122 with a preset button detection threshold when the earphone is detected to be inserted, so as to determine the button status information.
[0043] Specifically, the button status register 132 is used to store the button status information so that after the main control chip 200 detects the interrupt signal (i.e., the IRQ signal), it can interact with the digital-to-analog converter chip 100 through the bus 300 to read the button status information stored in the button status register 132, know the button status of the inserted earphone, and clear the interrupt to realize the button detection function.
[0044] Specifically, the second debounce circuit 133 is used to eliminate the jitter signal in the HBIAS current signal output by the current detection circuit 122, so as to output a more accurate HBIAS current value, which makes it easier for the threshold comparison circuit 131 to perform threshold comparison processing more accurately and improve the reliability of the threshold comparison result.
[0045] The principle of the button detection module 130 is as follows: When a button is released, no new resistor is connected in parallel, and the voltage remains constant, the HBIAS current value is less than the button detection threshold. When a button is pressed, a new resistor is connected in parallel with the pull-up resistor, reducing the total resistance. With the voltage remaining constant, the HBIAS current value increases and exceeds the button detection threshold. Thus, the button state can be determined based on the relationship between the detected HBIAS current value and the button detection threshold. It is understandable that different buttons have different resistors connected when pressed, resulting in different HBIAS current values, but all will exceed the button detection threshold. Therefore, when the detected HBIAS current value is greater than the button detection threshold, it can be determined that a button is pressed; further reading of the HBIAS current value can then determine which button was pressed.
[0046] The button detection module 130 in this embodiment of the application realizes headphone button detection using only one ordinary IO interface resource through the cooperation of the threshold comparison circuit 131 and the button status register 132.
[0047] In some embodiments, the digital-to-analog converter chip 100 further includes an RC oscillation circuit.
[0048] Combination Figures 2 to 4 It is understandable that the LOD power circuit that provides power to HBIAS is turned off before the headphones are plugged in, so no sound will be heard during the insertion of the headphones; and when the headphones are detected to be pulled out, the HBIAS power will be turned off immediately. Since it is a hardware automatic shutdown, the real-time performance is good. In addition, due to the de-shaking processing of the first de-shaking circuit 111, there is also no popping sound during the process of pulling out the headphones.
[0049] In this embodiment, one I / O interface 400 on the main control chip 200 is reused. When the headphones are plugged in, unplugged, or a button is pressed or released, the IRQ interrupt signal is output to the main control chip 200 through this I / O interface 400. After detecting the interrupt signal, the main control chip 200 interacts with the digital-to-analog converter chip 100 through the I2C bus to read the relevant status registers (plug-in / plug-out status register 113, current value register 123, and button status register 132) to know the current status of the headphones and clear the interrupt. This allows the headphone plug-in / plug-out detection, headphone type identification, and button detection functions to be completed using only one ordinary I / O interface resource.
[0050] Those skilled in the art will understand that the system structure shown in the figures does not constitute a limitation on the embodiments of this application, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0051] It will be understood by those skilled in the art that the system architecture and application scenarios described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. It is known by those skilled in the art that with the evolution of system architecture and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0052] Based on the above system structure, various embodiments of the headphone detection method of this application are proposed below.
[0053] Secondly, such as Figure 5 As shown in the figure, this application provides an earphone detection method that can be applied to, for example... Figure 5 The headphone detection system shown includes a digital-to-analog converter (DAC) chip and a main control chip. The DAC chip includes an interrupt signal output terminal, a plug-in / plug-out detection pin, an HBIAS power supply pin, a plug-in / plug-out detection module, a headphone type identification module, and a button detection module. The main control chip and the DAC chip are connected via a bus communication connection, and one I / O interface of the main control chip is connected to the interrupt signal output terminal. The headphone detection method includes, but is not limited to, steps S110 to S130.
[0054] Step S110: The digital-to-analog converter chip detects the level signal on the insertion / removal detection pin through the insertion / removal detection module to determine the insertion / removal status information, and sends an interrupt signal to the main control chip so that the main control chip can read the insertion / removal status information to determine the insertion / removal status of the headphones.
[0055] Step S120: When an earphone is detected to be inserted, the digital-to-analog converter chip detects and stores the HBIAS current value on the HBIAS power pin through the earphone type recognition module, so that the main control chip can identify and determine the earphone type of the inserted earphone based on the read HBIAS current value.
[0056] Step S130: The digital-to-analog converter chip uses the button detection module to determine the button status based on the HBIAS current value, determines the button status information, and sends an interrupt signal to the main control chip so that the main control chip can read the button status information to determine the headphone button status.
[0057] Specifically, the plugging and unplugging states of the headphones include: plugged-in state and unplugged state.
[0058] Specifically, the types of headphones that can be identified are: three-section headphones without a microphone and four-section headphones with a microphone.
[0059] Specifically, the headphone button states include: button pressed state and button released state. The button pressed state is further divided into: the volume up button being pressed, the volume down button being pressed, and the pause or play button being pressed. These three button pressed states correspond to different HBIAS current values. This application can determine the specific situation of the button pressed state by distinguishing and judging the read HBIAS current values.
[0060] In this embodiment, through steps S110 to S130, during the operation of the headphone detection system, the digital-to-analog converter chip detects the level signal on the insertion / removal detection pin through the insertion / removal detection module to determine the insertion / removal status information, and sends an interrupt signal to the main control chip so that the main control chip can read the insertion / removal status information to determine the insertion / removal status of the headphone; when the headphone is detected to be inserted, the digital-to-analog converter chip detects and stores the HBIAS current value on the HBIAS power pin through the headphone type identification module so that the main control chip can identify and determine the headphone type of the inserted headphone based on the read HBIAS current value; the digital-to-analog converter chip judges the button status based on the HBIAS current value through the button detection module, determines the button status information, and sends an interrupt signal to the main control chip so that the main control chip can read the button status information to determine the headphone button status. By integrating the plug-in / plug-out detection module, headphone type recognition module, and button detection module into the digital-to-analog converter chip, only one I / O interface of the main control chip is used to receive the interrupt signal sent by the digital-to-analog converter chip. This allows for multiple functions, including headphone plug-in / plug-out detection, headphone type recognition, and button status detection, working in conjunction with the digital-to-analog converter chip. This saves one I / O interface resource of the main control chip and reduces one signal trace, thus allowing for better layout and routing when the PCB layout is compact. In other words, this embodiment of the application can achieve multi-functional detection of headphones while saving I / O interface resources and enabling better layout and routing during PCB fabrication.
[0061] According to some embodiments of this application, the plugging / unplugging states of the earphone include: an inserted state and an unplugged state; the unplugging detection module includes: a first debounce circuit, a plugging / unplugging state register, and a level detection circuit; the plugging / unplugging state information includes: an inserted state value and an unplugged state value. Further explanation of step S110, wherein the plugging / unplugging state information is determined by detecting the level signal on the plugging / unplugging detection pin through the plugging / unplugging detection module, includes, but is not limited to, steps S111 to S113.
[0062] Step S111: Eliminate the jitter signal generated on the insertion / removal detection pin through the first debouncing circuit, and detect the debouncing level signal on the insertion / removal detection pin through the level detection circuit.
[0063] Step S112: When the level signal on the plug-in detection pin is high, set the unplugged status value in the plug-in status register to 1; wherein, the unplugged status value of 1 is used to indicate that the headphones are unplugged on the plug-in detection pin and no headphones are connected.
[0064] Step S113: When the level signal on the plug-in detection pin is low, set the insertion status value in the plug-in status register to 1; wherein, the insertion status value of 1 is used to indicate that the earphone is in the plug-in state on the plug-in detection pin.
[0065] To further explain step S110, initially, the insertion and removal status register has both the removal status value and the insertion status value as 0.
[0066] After step S111, Case 1: When the level signal on the insertion / removal detection pin is high, the removed state value in the insertion / removal status register is set to 1, and the inserted state value remains at 0; when the digital-to-analog converter chip sends an interrupt signal to the main control chip through an IO interface, the main control chip responds to the interrupt signal by reading the removed state value and the inserted state value from the insertion / removal status register. When the removed state value is set to 1, it is determined that the earphone is removed.
[0067] After step S111, Case 2: When the level signal on the insertion / removal detection pin is low, the insertion status value in the insertion / removal status register is set to 1, and the removal status value is maintained at 0; when the digital-to-analog converter chip sends an interrupt signal to the main control chip through an IO interface, the main control chip responds to the interrupt signal by reading the removal status value and insertion status value from the insertion / removal status register. When the insertion status value is set to 1, it is determined that the headphones are inserted.
[0068] Through steps S111 to S113, the headphone plugging / unplugging function is implemented based on a common IO interface resource.
[0069] According to some embodiments of this application, the headphone type identification module includes: an LDO power supply circuit, a current value register, and a current detection circuit; further, step S120 is described as follows: the digital-to-analog converter chip detects and stores the HBIAS current value on the HBIAS power supply pin through the headphone type identification module, and the main control chip identifies the headphone type of the inserted headphone based on the read HBIAS current value, including but not limited to steps S121 to S123.
[0070] Step S121: When the earphone is detected to be inserted, the digital-to-analog converter chip enables the LDO power circuit to provide HBIAS power to the inserted earphone, and starts the current detection circuit to detect the HBIAS current value and store the HBIAS current value in the current value register.
[0071] Step S122: The main control chip reads the HBIAS current value from the current value register.
[0072] Step S123: The main control chip reads the HBIAS current value from the current value register; when the HBIAS current value is identified as the maximum value, the type of the inserted earphone is determined to be: a three-section earphone without a microphone; when the HBIAS current value is identified as the minimum value, the type of the inserted earphone is determined to be: a four-section earphone with a microphone.
[0073] Through steps S121 to S123, the headphone type recognition function is implemented based on a common IO interface resource.
[0074] According to some embodiments of this application, the key detection module includes: a key status register and a threshold comparison circuit; the key status information includes: a key released status value and a key pressed status value; further, step S130 is described, wherein the key status information is determined by the key detection module based on the HBIAS current value, including but not limited to steps S131 to S133.
[0075] Step S131: The HBIAS current value detected by the current detection circuit is compared with the preset key detection threshold by the threshold comparison circuit.
[0076] Step S132: When the HBIAS current value is greater than the button detection threshold, set the button press status value in the button status register to 1; wherein, the button press status value of 1 is used to indicate that the button of the inserted earphone is pressed.
[0077] Step S133: When the HBIAS current value is less than the button detection threshold, set the button release status value in the button status register to 1; wherein, the button release status value of 1 is used to indicate that the button of the inserted earphone has been released.
[0078] It is understood that the key detection threshold is preset and can be set according to actual needs. This application does not impose specific limitations on the value of the key detection threshold.
[0079] Specifically, initially, both the button release status value and the button press status value in the button status register are 0. After step S131, in case one: when the HBIAS current value is greater than the button detection threshold, the button press status value in the button status register is set to 1, and the button release status value remains 0; when the digital-to-analog converter chip sends an interrupt signal to the main control chip through an IO interface, the main control chip responds to the interrupt signal by reading the button press status value and the button release status value from the button status register. When the button press status value is 1, it is determined that the button is pressed.
[0080] After step S131, in case two: when the HBIAS current value is less than the key detection threshold, the key release state value in the key status register is set to 1, and the key press state value is kept at 0; when the digital-to-analog converter chip sends an interrupt signal to the main control chip through an IO interface, the main control chip responds to the interrupt signal and reads the key press state value and key release state value from the key status register. When the key release state value is 1, it is determined that the key is released.
[0081] Through steps S131 to S133, the headphone button detection function was implemented based on a common IO interface resource.
[0082] According to some embodiments of this application, the method further includes: automatically turning off the HBIAS power supply when the headphones are detected to be unplugged; and automatically turning off the current detection circuit. This prevents any popping sound during the headphone unplugging process.
[0083] For example, combined with Figure 6 This application further illustrates the overall process of the headphone detection method of the headphone detection system provided in the embodiments of this application.
[0084] Step S601: Pre-set the key detection threshold.
[0085] Step S602: Enable the headphone detection system.
[0086] Step S603: Detect the HP_DET level signal.
[0087] Step S604: Determine whether the HP_DET level signal is high. If yes, return to step S603; otherwise, proceed to step S604.
[0088] Step S605: If it is determined that the headphones are inserted, set the insertion status value to 1, output a high level to the main control chip via IRQ, enable the HBIAS power pin, and turn on the current detection module to detect the HBIAS current value.
[0089] Step S606: Clear the insertion interrupt and restore IRQ to low level.
[0090] Step S607: Read the HBIAS current value to determine the headphone type.
[0091] Step S608: When the HBIAS current value is at its maximum, it is determined that the three-section headphone / LINEOUT interface is not connected to a headset; switch the headphone output and turn off the HBIAS power. When the headphone is detected to be unplugged and a high level is detected, proceed to step S615.
[0092] Step S609: When the HBIAS current value is at its minimum, it is determined to be a four-section headset with a microphone; switch the headset output and switch the microphone input. Continue to execute step S610.
[0093] Step S610: Based on the comparison result between the HBIAS current value and the button detection threshold, it is determined that the headphone button is pressed, the button pressed state is set to 1, and the IRQ outputs a high level to the main control chip.
[0094] Step S611: Clear the button press interrupt and restore IRQ to low level.
[0095] In step S612, the main control chip reads the HBIAS current value to determine the specific button information.
[0096] Step S613: Based on the comparison result between the HBIAS current value and the button detection threshold, it is determined that the headphone button is released. The button release state is set to 1, and the IRQ outputs a high level to the main control chip.
[0097] In step S614, the digital-to-analog converter chip clears the button release interrupt, and the IRQ returns to a low level.
[0098] Step S615: When the HP_DET level signal is detected to be high, it is determined that the headphones have been unplugged.
[0099] Step S616: Set the unplugged state to 1, and output a high level to the main control chip via IRQ; at the same time, turn off the HBIAS power supply and turn off the current detection circuit.
[0100] Step S617: Clear the unplug interrupt and restore IRQ to low level.
[0101] Step S618: Switch speaker output and switch onboard microphone input.
[0102] Specifically, the signal timing in the process of implementing the earphone detection method is as follows: Figure 7 As shown, RCOSC represents the clock signal generated by the RC oscillation circuit; HP_DET represents the HP_DET level signal on the insertion / removal detection pin; HP_DET_DEBOUNCE represents the debouncing HP_DET level signal on the insertion / removal detection pin; HBIAS_EN represents the enable signal for enabling the HBIAS power supply; HBIAS_EN_ADC_EN represents the enable signal for controlling the headphone microphone bias voltage (HBIAS) and the analog-to-digital converter (ADC); HBIAS represents the HBIAS voltage output by the HBIAS power supply; ADC_DATA (four-prong headphone) represents the data signal when the headphone type is four-prong headphone; ADC_DATA (three-prong headphone) represents the data signal when the headphone type is three-prong headphone; IRQ is the interrupt signal; and the dashed line represents the preset button detection threshold.
[0103] This application implements a headphone detection method through a headphone detection system. On one hand, it solves the problem of popping noises during insertion and removal by connecting the headphone insertion / removal detection module, headphone type identification module, and button detection module in series. When the headphone is inserted, the hardware automatically enables the HBIAS power supply and activates the current detection circuit, effectively preventing popping noises during insertion. When the headphone is detected being removed, the hardware automatically shuts off the HBIAS power supply, ensuring no popping noises occur during removal. On the other hand, the headphone insertion / removal function, headphone type identification function, and button detection function are integrated into a digital-to-analog converter chip, which is then connected to the main control chip via an I / O interface resource. One IRQ interrupt signal is reused to send signals to the main control chip, and the main control chip and the analog-to-digital converter chip cooperate to complete multi-functional detection. Furthermore, the integrated analog-to-digital converter chip determines the headphone type and performs button detection by detecting the HBIAS current, eliminating the need for additional detection I / O; achieving multi-functional detection while effectively saving I / O resources of the main control chip.
[0104] Thirdly, embodiments of this application provide an electronic device, including an earphone detection system as described in any of the embodiments of the first aspect.
[0105] According to an embodiment of the present invention, the headphone detection system in the electronic device includes: a digital-to-analog converter chip and a main control chip; wherein, the digital-to-analog converter chip includes: an interrupt signal output terminal, a plug-in / plug-out detection pin, an HBIAS power supply pin, a plug-in / plug-out detection module, a headphone type recognition module, and a button detection module; wherein, the plug-in / plug-out detection pin is connected to the core voltage source, the input terminal of the plug-in / plug-out detection module is connected to the plug-in / plug-out detection pin, and the output terminal of the plug-in / plug-out detection module is connected to the interrupt signal output terminal and the input terminal of the headphone type recognition module respectively; the output terminal of the headphone type recognition module is connected to the HBIAS power supply pin and the input terminal of the button detection module respectively; the output terminal of the button detection module is connected to the interrupt signal output terminal; the main control chip and the digital-to-analog converter chip are connected via bus communication, and one IO interface of the main control chip is connected to the interrupt signal output terminal. During the operation of the headphone detection system, the digital-to-analog converter (DAC) chip detects the level signal on the insertion / removal detection pin through the insertion / removal detection module to determine the insertion / removal status information and sends an interrupt signal to the main control chip, enabling the main control chip to read the insertion / removal status information and determine the headphone's insertion / removal status. When a headphone is detected inserted, the DAC chip detects and stores the HBIAS current value on the HBIAS power pin through the headphone type identification module, enabling the main control chip to identify the type of the inserted headphone based on the read HBIAS current value. The DAC chip also uses the button detection module to determine the button status based on the HBIAS current value, sends an interrupt signal to the main control chip, and enables the main control chip to read the button status information and determine the headphone button status. By integrating the plug-in / plug detection module, headphone type recognition module, and button detection module into the digital-to-analog converter chip, only one I / O interface of the main control chip is used to receive the interrupt signal sent by the digital-to-analog converter chip. This allows for multiple functions, including headphone plug-in / plug detection, headphone type recognition, and button status detection, working in conjunction with the digital-to-analog converter chip. This saves one I / O interface resource of the main control chip and reduces one signal trace, thus allowing for better layout and routing when the PCB layout is compact. Therefore, the electronic device of this embodiment can achieve multi-functional headphone detection while saving I / O interface resources and allowing for better layout and routing during PCB fabrication.
[0106] It should be noted that since the electronic device in this embodiment can implement the headphone detection method as in any of the preceding embodiments, the electronic device in this embodiment has the same technical principle and the same technical effect as the headphone detection method in any of the preceding embodiments. To avoid repetition and redundancy, it will not be described again here.
[0107] The above provides a detailed description of the preferred embodiments of this application. However, this application is not limited to the above-described embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of this application. All such equivalent modifications or substitutions are included within the scope defined by this application.
Claims
1. An earphone detection system, characterized in that, include: A digital-to-analog converter chip, comprising: an interrupt signal output terminal, a plug-in / plug-out detection pin, an HBIAS power supply pin, a plug-in / plug-out detection module, an earphone type recognition module, and a button detection module; wherein, the plug-in / plug-out detection pin is connected to the core voltage source, the input terminal of the plug-in / plug-out detection module is connected to the plug-in / plug-out detection pin, the output terminal of the plug-in / plug-out detection module is connected to the interrupt signal output terminal and the input terminal of the earphone type recognition module respectively; the output terminal of the earphone type recognition module is connected to the HBIAS power supply pin and the input terminal of the button detection module respectively; and the output terminal of the button detection module is connected to the interrupt signal output terminal. The main control chip is connected to the digital-to-analog converter chip via a bus communication, and one of the I / O interfaces of the main control chip is connected to the interrupt signal output terminal.
2. The headphone detection system according to claim 1, characterized in that, The insertion / removal detection module includes: A first debounce circuit, wherein the input terminal of the first debounce circuit is electrically connected to the insertion / removal detection pin; A level detection circuit, wherein the input terminal of the level detection circuit is electrically connected to the output terminal of the first debouncing circuit; A plug-in / plug-out status register, the input of which is connected to the output of the level detection circuit, and the output of which is connected to the interrupt signal output.
3. The headphone detection system according to claim 2, characterized in that, The headphone type recognition module includes: The LDO power supply circuit has its input terminal connected to the output terminal of the level detection circuit. A current sensing circuit, wherein the input terminal of the current sensing circuit is connected to the output terminal of the LDO power supply circuit, and the output terminal of the current sensing circuit is connected to the HBIAS power supply pin. A current value register, the input of which is connected to the output of the current detection circuit.
4. The headphone detection system according to claim 3, characterized in that, The key detection module includes: The second debounce circuit has its input terminal connected to the output terminal of the current detection circuit. A threshold comparison circuit, wherein the input terminal of the threshold comparison circuit is connected to the output terminal of the second debouncing circuit; A button status register, the input of which is connected to the output of the threshold comparison circuit; the output of which is connected to the interrupt signal output.
5. A method for detecting headphones, characterized in that, The headphone detection system as described in any one of claims 1 to 4 includes: a digital-to-analog converter chip and a main control chip; the digital-to-analog converter chip includes: an interrupt signal output terminal, a plug-in / plug-out detection pin, an HBIAS power supply pin, a plug-in / plug-out detection module, a headphone type identification module, and a button detection module; the main control chip is connected to the digital-to-analog converter chip via a bus communication connection, and one IO interface of the main control chip is connected to the interrupt signal output terminal. The method includes: The digital-to-analog converter chip detects the level signal on the insertion / removal detection pin through the insertion / removal detection module to determine the insertion / removal status information, and sends an interrupt signal to the main control chip so that the main control chip reads the insertion / removal status information to determine the insertion / removal status of the headphones; When an earphone is detected being inserted, the digital-to-analog converter chip detects and stores the HBIAS current value on the HBIAS power pin through the earphone type identification module, so that the main control chip can identify and determine the type of the inserted earphone based on the read HBIAS current value. The digital-to-analog converter chip uses the button detection module to determine the button status based on the HBIAS current value, determines the button status information, and sends an interrupt signal to the main control chip so that the main control chip can read the button status information to determine the headphone button status.
6. The headphone detection method according to claim 5, characterized in that, The headphone's plug-in / plug-out states include: inserted state and unplugged state; the plug-out detection module includes: a first debounce circuit, a plug-in / plug-out state register, and a level detection circuit; the plug-in / plug-out state information includes: an inserted state value and an unplugged state value; The step of determining the insertion / removal status information by detecting the level signal on the insertion / removal detection pin through the insertion / removal detection module includes: The first debouncing circuit eliminates the jitter signal generated on the insertion / removal detection pin, and the level detection circuit detects the debouncing level signal on the insertion / removal detection pin. When the level signal on the plug-in detection pin is high, the unplugged state value in the plug-in status register is set to 1; wherein, the unplugged state value of 1 is used to indicate that the earphone is unplugged on the plug-in detection pin and no earphone is connected. When the level signal on the plug-in detection pin is low, the insertion status value in the plug-in status register is set to 1; wherein, the insertion status value of 1 is used to indicate that the earphone is in the plug-in state on the plug-in detection pin.
7. The headphone detection method according to claim 5, characterized in that, The headphone type identification module includes: an LDO power supply circuit, a current value register, and a current detection circuit; The analog-to-digital converter chip detects and stores the HBIAS current value on the HBIAS power pin through the headphone type recognition module. The main control chip identifies the type of the inserted headphone based on the read HBIAS current value, including: When the earphone is detected to be inserted, the digital-to-analog converter chip enables the LDO power circuit to provide HBIAS power to the inserted earphone, and starts the current detection circuit to detect the HBIAS current value and store the HBIAS current value in the current value register. The main control chip reads the HBIAS current value from the current value register; The main control chip reads the HBIAS current value from the current value register; when the HBIAS current value is identified as the maximum value, the type of the inserted earphone is determined to be: a three-section earphone without a microphone; when the HBIAS current value is identified as the minimum value, the type of the inserted earphone is determined to be: a four-section earphone with a microphone.
8. The headphone detection method according to claim 5, characterized in that, The key detection module includes: a key status register and a threshold comparison circuit; the key status information includes: key release status value and key press status value. The step of determining the key status information by judging the key status based on the HBIAS current value through the key detection module includes: The threshold comparison circuit compares the HBIAS current value detected by the current detection circuit with a preset key detection threshold. When the HBIAS current value is greater than the button detection threshold, the button press status value in the button status register is set to 1; wherein, the button press status value of 1 is used to indicate that the button of the inserted earphone is pressed. When the HBIAS current value is less than the button detection threshold, the button release state value in the button state register is set to 1; wherein, the button release state value of 1 is used to indicate that the button of the inserted earphone has been released.
9. The headphone detection method according to claim 7, characterized in that, The method further includes: Automatically turn off HBIAS power when the headphones are detected to be unplugged; The current detection circuit is automatically shut down.
10. An electronic device, characterized in that, Includes the headphone detection system as described in any one of claims 1 to 4.