TB3013 Using the ESD Parasitic Diodes on Mixed Signal Microcontrollers FIGURE 1: Author: PASS-GATE Joseph Julicher Microchip Technology Inc. Control: 0 = OPEN 1 = CLOSED INTRODUCTION Microchip application note, AN521 "Interfacing to AC Power Lines", provides a number of guidelines for implementing low-cost, zero cross circuits by relying upon the parasitic ESD diodes in the I/O pins. These guidelines have been used successfully for many years, but, with the increase in analog functionality on the microcontrollers, the simple world in AN521 is now much more complex. Many recent devices are pin-compatible with older devices and can be inserted into an older socket, but the application can now exhibit strange behaviors unless the interaction with the new analog features are understood and avoided. BACKGROUND Adding analog to any digital system is an exercise in trade-offs. This is especially true in microcontrollers, where silicon space is at a premium. To reduce the size impact of peripheral circuitry, each analog module is attached to multiple I/O pins by analog pass-gates. This allows the microcontroller firmware to select the required analog input at any time based upon the needs of the application. As the demand for the analog functions goes up, more and more I/O pins are added to the pass-gate array and the probability increases for unexpected behaviors when the data sheet specifications are violated. The ESD protection diodes shown in the data sheet and discussed in AN521 forward conduct at a voltage of approximately 0.6 to 0.7V. This is reflected in the absolute maximum ratings published in data sheets for older devices. The addition of the analog pass-gates reduces the possibilities of using the voltage clamping ability of the ESD diodes by adding an additional voltage sensitivity described in the next section. Pass-gates Pass-gates are simply two CMOS transistors connected in parallel (see Figure 1). The transistors are a P MOSFET and an N MOSFET. This arrangement allows the bidirectional current flow necessary for the proper operation of an analog circuit. © 2008 Microchip Technology Inc. From I/O pin To Analog Function This pass-gate topology works very well and has been used for many years. The only potential problem occurs when the voltage on the I/O pin exceeds VDD. Under these circumstances, the VGS voltage on the PMOS device (the top transistor in Figure 1) becomes negative. PMOS transistors begin to conduct as VGS becomes negative. When the voltage on the I/O pin exceeds VDD by 0.4V (VGS = -0.4V), then the PMOS device has become sufficiently conductive that secondary affects begin to appear. The data sheet absolute maximum voltage on the I/O pin is specified as VDD + 0.3V. Whereas, older devices without analog circuitry specified VDD + 0.6V. This specification is intended to guide engineers towards operating under conditions where the pass-gate operates as expected. The voltages used in this document are typical values. These voltages tend to decrease with decreasing temperatures and increase with increasing temperatures. Use them as a guideline and not as an absolute value. ADC Affects The analog-to-digital converter has a single input that is routed to all the pass-gates of the pins with ADC functionality (see Figure 2). DS93013A-page 1 TB3013 FIGURE 2: ANALOG-TO-DIGITAL CONVERTER AN0 VREF (some devices) Analog pass-gate LCD Devices with LCD pins also use a pass-gate array to steer voltages between the VLCD pins and the segment/common drives. Overvoltages applied to a segment or a common can appear on one or more VLCD pins and may cause improper LCD operation or long-term damage. AN1 0.6V Ref (some devices) Internal analog peripherals AN2 1.2V Ref ANx AIN Bus to ADC (some devices) I/0 Input Pin ADC Oscillator The internal oscillator is stabilized by a 0.6V reference. Some devices make this reference available to the ADC. If an overvoltage is on VDD while the 0.6V reference is selected for the ADC, the 0.6V reference can shut down. This will stop the internal oscillator until a Reset clears the ADC channel selection. Some devices have a 1.2V reference. This reference is derived from the 0.6V reference so an overvoltage here can cause the same problems. When the oscillator is stopped by overvoltage, it most often looks like a continuous Reset. This is caused by the WDT triggering a device Reset and then the software reconfiguring the pins to cause the problem. External to Internal to microcontroller microcontroller The pass-gate array connects the analog sources to the ADC. The control logic determines which one of the channels will be seen by the ADC. If one of the analog channels is being driven beyond the specification, then the excess voltage will be added to the voltages on the ADC input, and the voltage seen by the ADC will no longer represent the voltage of the desired channel. The ADC analog pass-gates are bidirectional devices. If a pin is overdriven, a different analog input pin may source current. This will appear as crosstalk between the overdriven input and the selected ADC channel. This can cause problems with external or internal circuits if the overvoltage input is strong enough to affect the signal source. CORRECTIVE ACTION With an understanding of pass-gates, the solution to the overvoltage input problem can be found. Protect the Pin The first solution is to prevent any overvoltage from appearing on the I/O pins of the microcontroller. This can be done by adding Schottky diodes to VDD and from VSS on each pin that could see a high voltage. This will clamp the voltages to VDD + 0.3V, which will not cause the pass-gates to conduct. More protection examples are shown in Figure 3. Comparator Connections The comparators also have a pass-gate array to select the inputs that are attached to the comparator. The pass-gate array allows overvoltages to appear on the comparator or on the selected comparator input pins. This affects the comparator or causes crosstalk on the I/O pins. Some comparator inputs, such as the 0.6V reference, are internal. This reference, if present on the device, is the default comparator input after Reset. DS93013A-page 2 © 2008 Microchip Technology Inc. TB3013 FIGURE 3: EXAMPLES OF INPUT PIN PROTECTION VDD 1k-4.7k Typical External input 100k Typical Clever Software If digital-only I/O pins cannot be chosen and the input pins cannot have the voltage limited, the last option is to fix the problem in the software. One method is to simply drive the overvoltaged pin as an output while the ADC is converting. This will allow the output drivers in the pad to limit the input voltage to VDD or VSS. With the input voltage under control, there are no issues. After the ADC measurements are finished, switch the I/O pin back to an input to make the measurements. When using this technique, series resistors need to be used to keep the I/O currents within specifications. VSS Undervoltage External input R1 R2 D1 VSS R1 = 470k typical. Size to the bias current in D1. R2 = 100Ω typical. Size for minimal current into the pin during overvoltage. D1 = Clamp to VDD during over voltage with R1 for bias current selection. Diode may need to be fast if transients are expected. VDD D1 External input R1 D2 VSS External to Internal to device device R1 = Sets the maximum current through D1 and D2. The clamp voltage is determined by the forward current through the diode. D1, D2 = Size for a 0.3V forward voltage during the transient conditions. A BAT54S is a good choice. Choose Your Pins Wisely If the design simply does not allow the extra components, then choosing pins with no analog features is the best choice for overvoltage. Purely digital pins do not have pass-gates, therefore they are not subject to the same constraints. However, future devices with this pinout may have additional analog functions and therefore require a re-evaluation of the circuit and its performance. Never use MCLR/VPP for a input with overvoltage. © 2008 Microchip Technology Inc. Voltages below VSS are a special case. These voltages cause negative currents in the die substrate. When the die substrate is negatively biased, the silicon structures change from field-effect devices to bipolar devices. All diodes on the die become transistors and shunt currents into the substrate. Many devices will not have adverse affects from this negative voltage. However, if enough current is injected into the device, it is possible to cause latch-up, which is a severe problem and must be corrected externally with diodes or power supply changes. If the device is caught by latch-up, it will consume many milliamps or hundreds of milliamps. This additional current can cause local overheating and hardware failures. Even if latch-up does not occur, the negative current can cause oscillator shifts, or POR Resets. The undervoltage sensitivity increases as the temperature increases, so test your application over the expected temperature range. The best way to handle the undervoltage condition is: • prevent it with external circuit design, or • characterize the I/O pins and choose a pin far away from the OSC pins or VDD. • work with Microchip Sales office to make an I/O pin recommendation. One word of caution with repeated undervoltage: undervoltage conditions cause degrading damage to the oxide layers on the die. Problems may not appear until the product has been in the field a long time. Degradation is faster with higher current levels. DS93013A-page 3 TB3013 CONCLUSION Exceeding the absolute maximum voltage ratio for the device I/O pins may not cause physical damage unless the maximum current specification is also violated. These conditions can be minimized by following the techniques described in this document. Even if the silicon is not damaged, the out-of-specification voltage can cause unexpected application problems. The techniques shown in this application note are not guaranteed to be appropriate for all situations and operating the device outside of the data sheet specification is not supported by Microchip without written documentation. This documentation can be obtained via NSCAR from your Sales office. DS93013A-page 4 © 2008 Microchip Technology Inc. Note the following details of the code protection feature on Microchip devices: • Microchip products meet the specification contained in their particular Microchip Data Sheet. • Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions. • There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property. • Microchip is willing to work with the customer who is concerned about the integrity of their code. • Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as “unbreakable.” Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act. Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer’s risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights. Trademarks The Microchip name and logo, the Microchip logo, Accuron, dsPIC, KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART, rfPIC and SmartShunt are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. FilterLab, Linear Active Thermistor, MXDEV, MXLAB, SEEVAL, SmartSensor and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A. Analog-for-the-Digital Age, Application Maestro, CodeGuard, dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN, ECONOMONITOR, FanSense, In-Circuit Serial Programming, ICSP, ICEPIC, Mindi, MiWi, MPASM, MPLAB Certified logo, MPLIB, MPLINK, mTouch, PICkit, PICDEM, PICDEM.net, PICtail, PIC32 logo, PowerCal, PowerInfo, PowerMate, PowerTool, REAL ICE, rfLAB, Select Mode, Total Endurance, UNI/O, WiperLock and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. All other trademarks mentioned herein are property of their respective companies. © 2008, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved. Printed on recycled paper. Microchip received ISO/TS-16949:2002 certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California and India. The Company’s quality system processes and procedures are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified. © 2008 Microchip Technology Inc. DS93013A-page 5 WORLDWIDE SALES AND SERVICE AMERICAS ASIA/PACIFIC ASIA/PACIFIC EUROPE Corporate Office 2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-792-7200 Fax: 480-792-7277 Technical Support: http://support.microchip.com Web Address: www.microchip.com Asia Pacific Office Suites 3707-14, 37th Floor Tower 6, The Gateway Harbour City, Kowloon Hong Kong Tel: 852-2401-1200 Fax: 852-2401-3431 India - Bangalore Tel: 91-80-4182-8400 Fax: 91-80-4182-8422 India - New Delhi Tel: 91-11-4160-8631 Fax: 91-11-4160-8632 Austria - Wels Tel: 43-7242-2244-39 Fax: 43-7242-2244-393 Denmark - Copenhagen Tel: 45-4450-2828 Fax: 45-4485-2829 India - Pune Tel: 91-20-2566-1512 Fax: 91-20-2566-1513 France - Paris Tel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79 Japan - Yokohama Tel: 81-45-471- 6166 Fax: 81-45-471-6122 Germany - Munich Tel: 49-89-627-144-0 Fax: 49-89-627-144-44 Atlanta Duluth, GA Tel: 678-957-9614 Fax: 678-957-1455 Boston Westborough, MA Tel: 774-760-0087 Fax: 774-760-0088 Chicago Itasca, IL Tel: 630-285-0071 Fax: 630-285-0075 Dallas Addison, TX Tel: 972-818-7423 Fax: 972-818-2924 Detroit Farmington Hills, MI Tel: 248-538-2250 Fax: 248-538-2260 Kokomo Kokomo, IN Tel: 765-864-8360 Fax: 765-864-8387 Los Angeles Mission Viejo, CA Tel: 949-462-9523 Fax: 949-462-9608 Santa Clara Santa Clara, CA Tel: 408-961-6444 Fax: 408-961-6445 Toronto Mississauga, Ontario, Canada Tel: 905-673-0699 Fax: 905-673-6509 Australia - Sydney Tel: 61-2-9868-6733 Fax: 61-2-9868-6755 China - Beijing Tel: 86-10-8528-2100 Fax: 86-10-8528-2104 China - Chengdu Tel: 86-28-8665-5511 Fax: 86-28-8665-7889 Korea - Daegu Tel: 82-53-744-4301 Fax: 82-53-744-4302 China - Hong Kong SAR Tel: 852-2401-1200 Fax: 852-2401-3431 Korea - Seoul Tel: 82-2-554-7200 Fax: 82-2-558-5932 or 82-2-558-5934 China - Nanjing Tel: 86-25-8473-2460 Fax: 86-25-8473-2470 Malaysia - Kuala Lumpur Tel: 60-3-6201-9857 Fax: 60-3-6201-9859 China - Qingdao Tel: 86-532-8502-7355 Fax: 86-532-8502-7205 Malaysia - Penang Tel: 60-4-227-8870 Fax: 60-4-227-4068 China - Shanghai Tel: 86-21-5407-5533 Fax: 86-21-5407-5066 Philippines - Manila Tel: 63-2-634-9065 Fax: 63-2-634-9069 China - Shenyang Tel: 86-24-2334-2829 Fax: 86-24-2334-2393 Singapore Tel: 65-6334-8870 Fax: 65-6334-8850 China - Shenzhen Tel: 86-755-8203-2660 Fax: 86-755-8203-1760 Taiwan - Hsin Chu Tel: 886-3-572-9526 Fax: 886-3-572-6459 China - Wuhan Tel: 86-27-5980-5300 Fax: 86-27-5980-5118 Taiwan - Kaohsiung Tel: 886-7-536-4818 Fax: 886-7-536-4803 China - Xiamen Tel: 86-592-2388138 Fax: 86-592-2388130 Taiwan - Taipei Tel: 886-2-2500-6610 Fax: 886-2-2508-0102 China - Xian Tel: 86-29-8833-7252 Fax: 86-29-8833-7256 Thailand - Bangkok Tel: 66-2-694-1351 Fax: 66-2-694-1350 Italy - Milan Tel: 39-0331-742611 Fax: 39-0331-466781 Netherlands - Drunen Tel: 31-416-690399 Fax: 31-416-690340 Spain - Madrid Tel: 34-91-708-08-90 Fax: 34-91-708-08-91 UK - Wokingham Tel: 44-118-921-5869 Fax: 44-118-921-5820 China - Zhuhai Tel: 86-756-3210040 Fax: 86-756-3210049 01/02/08 DS93013A-page 6 © 2008 Microchip Technology Inc.