WAN_0134 - Cirrus Logic

WAN_0134
w
WM9712 Jack Plug Auto-detection, Hookswitch
Detection and Microphone Headset Detection
INTRODUCTION
This application note describes two operations associated with using headsets. The first is the
facility to automatically switch between a mono ear speaker and stereo headphones for use in a
Smartphone, PDA etc. The second operation is a method which can be used to detect if stereo
headphones have been attached or if a mono headset with microphone has been attached.
JACK INSERTION AUTO-SWITCHING
There is a specific auto-switching jack insertion mode which is controlled by the WM9712 device.
This is specifically to switch from using a mono output on OUT3 to using Headphones (on jack
insertion) and vice versa (on jack removal). Figure 1 below details the setup of ear speaker and jack
for headphones. When the headphone connector is inserted the Ear speaker is disabled as OUT3 is
powered down.
OUT3
BTL ear
speaker
HPOUTL
WM9712L
HPOUTR
HPGND = 0V
Figure 1 Combined Headset / BTL Ear Speaker
-
+
HPOUTR
HPOUTL
+
GPIO1 (pin44) is required to be toggled by jack insertion. Therefore a logic signal must be
connected from the Jack Socket to indicate an insertion. A potential circuit for this purpose is
detailed below in Figure 2.
-
L
interrupt
logic
R
GPIO1
switch closes
on insertion
Figure 2 GPIO Jack Insertion Detection Circuit
WOLFSON MICROELECTRONICS plc
www.wolfsonmicro.com
April 2004, Rev 1.4
Copyright 2004 Wolfson Microelectronics plc
WAN_0134
Auto-detection is setup by setting register bit 58h bit 12 JIEN to "1".
When the jack plug is not inserted:
1.
GPIO is HIGH
2.
The OUT3 state is set by the register settings of 24h and 26h
3.
HPOUTL volume is set by register 16h HPOUTR volume is set by 04h
When the jack plug is inserted:
1.
GPIO is LOW
2.
The OUT3 state is disabled
3.
HPOUTL and HPOUTR volume is set by register 04h
No CPU access is required for these setups, the operation is controlled by the WM9712 (Note that
JIEN must be set to enable this feature). See the latest datasheet for further details.
Alternatively, the switch can be controlled by the software driver. When the GPIO is used in this way
for Jack insertion detection, it creates an interrupt (IRQ), which will be dealt with by the controller (the
controller must be setup to receive these interrupts).
To read the status of the GPIO's or change the settings PR4 must be set to 0.
Steps required for jack insertion are as listed below:
1.
Jack inserted.
2.
GPIO generates interrupt for logic level change
3.
Interrupt sent to CPU via AC Link
4.
CPU reads GPIO register to see what caused interrupt
5.
CPU runs appropriate software routine to setup the device for jack insertion.
6.
Jack removed.
7.
GPIO generates interrupt for logic level change
8.
Interrupt sent to CPU via AC Link
9.
CPU reads GPIO register to see what caused interrupt
10. CPU runs appropriate software routine to setup the device for jack removal.
HOOKSWITCH DETECTION
The circuit diagram displayed in Figure 3 shows how to detect when the “hookswitch” of a phone
headset is pressed (pressing the hookswitch is equivalent to lifting the receiver in a stationary
telephone).
w
Rev 1.4 April 2004
2
HPOUTR
HPOUTL
AGND
-
+
WM9712L
+
WAN_0134
-
MICL/MICR
interrupt
logic
L
R
HOOK
SWITCH
MIC
GPIO
MICBIAS
47Ω
680Ω − 2.2kΩ
PHONE HEADSET
Figure 3 Hookswitch Detection Circuit
The circuit uses a GPIO pin as a sense input. However, in this case the voltage level seen at the
GPIO can vary depending on the microphone impedance and the bias resistor connected to
MICBIAS. This can be difficult to setup correctly as the GPIO inputs are setup for CMOS input
levels.
Therefore, to operate correctly the impedance of the microphone and the resistor in the MICBIAS
path must be such that the potential at the GPIO pin is above 0.7×DBVDD when the hookswitch is
open, and below 0.3×DBVDD when it is closed.
This arrangement will not work for all types of microphones.
HPOUTR
HPOUTL
AGND
-
+
WM9712L
+
Alternatively, if available, either of the comparator COMP1 or COMP2 inputs can be used instead of
the standard GPIO. This allows the switching threshold to be set manually or to AVDD/2. So
instead of connecting the Mic Input to a GPIO pin, the connection would be made to COMP1 or
COMP2. The threshold for switching can be set to AVDD/2 or to a level connected to the AUX4 pin.
With this arrangement virtually any microphone can be selected and setup for hookswitch detection.
An example setup is displayed in Figure 4.
-
MICL/MICR
interrupt
logic
L
R
MIC
COMP1
MICBIAS
HOOK
SWITCH
47Ω
680Ω − 2.2kΩ
PHONE HEADSET
AUX4
External Reference level
(DESIGN SPECIFIC)
Figure 4 Possible Hookswitch Detection Circuit Using Internal Comparator
MICROPHONE HEADSET DETECTION
The WM9712 does not have the same auto-detect functionality as the WM9705 (refer to WM9705
datasheet for further details), however, it is possible to devise a circuit for this purpose using the
same principals as the WM9705 circuit.
Shown in Figure 5 is a potential circuit which can be used for headphone/headset detect on the
WM9712. This is based on the principal that headphone resistance is generally low (16 to 32Ω) and
mic resistance is high (approximately >1k).
w
Rev 1.4 April 2004
3
WAN_0134
Figure 5 Possible Stereo Headphone/Microphone Headset Detection Circuit
To understand how the circuit displayed in Figure 5 operates we need to consider what happens
when a stereo headphone jack is inserted or when a mono headset with microphone is inserted
STEREO HEADPHONE JACK INSERTED
When inserted, GPIO1 goes from HIGH to LOW indicating a jack insertion. The MICBIAS source is
then presented across the Micbias resistor and the headphone impedance to ground. The level
presented to the positive input of the comparator is the potential divide of these two resistances. For
example:
Comparator_+I/P = MICBIAS_VOLTS * [HP_RES / (HP_RES + MICBIAS_RES)]
Say,
MICBIAS = 3V
HP_RES = 32Ω
MICBIAS = 680Ω
Then,
Comparator_+I/P = 3 * [32 / (32 + 680)] = 0.135V
MONO HEADSET WITH MICROPHONE INSERTED
When inserted, GPIO1 goes from HIGH to LOW indicating a jack insertion. The MICBIAS source is
then presented across the Micbias resistor and the microphone impedance to ground (this assumes
the microphone connection is to the tip of the jack plug). The level presented to the positive input of
the comparator is the potential divide of these two resistances. For example:
Comparator_+I/P = MICBIAS_VOLTS * [MIC_RES / (MIC_RES + MICBIAS_RES)]
Say,
MICBIAS = 3V
HP_RES = 1KΩ
MICBIAS = 680Ω
Then,
Comparator_+I/P = 3 * [1000 / (1000 + 680)] = 1.785V
With the examples given above for Stereo Headphones and Mono Headset with Microphone the
Comparator's negative input still needs to be considered. This level should be set approximately
mid-way between the levels presented to the positive input of the comparator for the two different
jack insertions.
w
Rev 1.4 April 2004
4
WAN_0134
For the examples given the negative input to the comparator should be set to approximately 0.96V.
This means that for the example Stereo Headphone the Comparator Output will present a LOW to
the GPIO and the Mono Headset with Microphone will present a HIGH to the GPIO. This allows the
two types of insertions to be detected individually.
The sequence to use the attached circuit in terms of software driver control is as follows:
1. No connection to socket
2. Micbias, HPOUT and OUT3 disabled
3. Mic internal paths muted.
4. Headset/headphone connected
5. GPIO detects jack insertion
6. Set Micbias enabled
7. GPIO2 detects headphone or mic using comparator with threshold set by resistor divide
8. Enable HPOUT if headphones connected, enable mic and OUT3 if Headset connected
9. Headset/Headphone removed
10. GPIO detects jack removal
11. Set Micbias, HPOUT and OUT3 disabled
Potential setup problems are caused as there is such variance in headphone and microphone
designs, the selection of resistors for biasing and reference setting will be application specific. The
setup relies on the comparator differentiating between the impedance of the headphone and mic
using Micbias as the current source (alternatively instead of using an external comparator, if COMP1
or COMP2 are not being used either can be connected instead). This setup may not be applicable to
all requirements and may cause a "pop" on jack insertion. Please also note that in the circuit diagram
the decoupling capacitor which connects HPOUTR to the socket tip and mic bias is non-polarised.
This is required for when the DC offset at the socket side increases above VMID and biases the
capacitor in the opposite direction.
SUMMARY
This document describes how to setup the WM9712 for auto-switching between ear speaker and
stereo headphones and a potential circuit for detecting if a Microphone headset or Stereo
headphones have been connected. The detection of microphones or headphones is based on
monitoring the resistance connected and requires a DC level to be monitored. The side effects are
that non-polarised capacitors are required and there will be a "Pop" on the output.
w
Rev 1.4 April 2004
5
WAN_0134
APPLICATION SUPPORT
If you require more information or require technical support please contact Wolfson Microelectronics
Applications group through the following channels:
Email:
Telephone Apps:
Fax:
Mail:
[email protected]
+44 (0)131 272 7070
+44 (0)131 272 7001
Applications at the address on the last page.
or contact your local Wolfson representative.
Additional information may be made available from time to time on our web site at
http://www.wolfsonmicro.com
w
Rev 1.4 April 2004
6
WAN_0134
IMPORTANT NOTICE
Wolfson Microelectronics plc (WM) reserve the right to make changes to their products or to discontinue any product or service
without notice, and advise customers to obtain the latest version of relevant information to verify, before placing orders, that
information being relied on is current. All products are sold subject to the WM terms and conditions of sale supplied at the time of
order acknowledgement, including those pertaining to warranty, patent infringement, and limitation of liability.
WM warrants performance of its products to the specifications applicable at the time of sale in accordance with WM’s standard
warranty. Testing and other quality control techniques are utilised to the extent WM deems necessary to support this warranty.
Specific testing of all parameters of each device is not necessarily performed, except those mandated by government
requirements.
In order to minimise risks associated with customer applications, adequate design and operating safeguards must be used by the
customer to minimise inherent or procedural hazards. Wolfson products are not authorised for use as critical components in life
support devices or systems without the express written approval of an officer of the company. Life support devices or systems are
devices or systems that are intended for surgical implant into the body, or support or sustain life, and whose failure to perform when
properly used in accordance with instructions for use provided, can be reasonably expected to result in a significant injury to the
user. A critical component is any component of a life support device or system whose failure to perform can be reasonably
expected to cause the failure of the life support device or system, or to affect its safety or effectiveness.
WM assumes no liability for applications assistance or customer product design. WM does not warrant or represent that any
license, either express or implied, is granted under any patent right, copyright, mask work right, or other intellectual property right of
WM covering or relating to any combination, machine, or process in which such products or services might be or are used. WM’s
publication of information regarding any third party’s products or services does not constitute WM’s approval, license, warranty or
endorsement thereof.
Reproduction of information from the WM web site or datasheets is permissible only if reproduction is without alteration and is
accompanied by all associated warranties, conditions, limitations and notices. Representation or reproduction of this information
with alteration voids all warranties provided for an associated WM product or service, is an unfair and deceptive business practice,
and WM is not responsible nor liable for any such use.
Resale of WM’s products or services with statements different from or beyond the parameters stated by WM for that product or
service voids all express and any implied warranties for the associated WM product or service, is an unfair and deceptive business
practice, and WM is not responsible nor liable for any such use.
ADDRESS:
Wolfson Microelectronics plc
26 Westfield Road
Edinburgh
EH11 2QB
United Kingdom
Tel :: +44 (0)131 272 7000
Fax :: +44 (0)131 272 7001
Email :: [email protected]
w
Rev 1.4 April 2004
7