Freescale Semiconductor Application Note Document Number:AN4564 Rev. 0, 8/2012 MC9S08MP16 PGA Module Introduction and Deep Application by: Paul Tian Automotive and Industrial Solutions Group Contents 1 Introduction 1 Introduction................................................................1 This application note introduces programmable gain amplified (PGA) module in MC9S08MP16. PGA module is commonly used for weak signal detection in sensor precision applications. 2 PGA feature and module structure............................1 Freescale offers MC9S08MP16 as an 8-bit MCU with PGA module. Apart from general applications, this MCU is especially used in motor control applications, where it acts as a root detector. 3 This application note guides the user to achieve PGA module principle, feature, the procedure to use, and some applications. 4 2 PGA feature and module structure 2.1 PGA feature The PGA is a switched capacitor which amplifies and converts differential signals to a single-ended value. This value is passed on to the analog-to-digital converter (ADC) for conversion to digital format. © 2012 Freescale Semiconductor, Inc. 2.1 PGA feature...................................................1 2.2 PGA structure.................................................2 2.3 PGA calculation..............................................3 PGA module operation..............................................4 3.1 PGA startup....................................................4 3.2 PGA calibration..............................................5 3.3 PGA mission modes.......................................5 PGA simple application.............................................5 4.1 Typical circuit.................................................5 4.2 Sample project flowchart...............................6 5 Conclusion.................................................................7 6 References.................................................................7 PGA feature and module structure The PGA module has the following features: • Converts differential analog signals to single-ended value • Software and hardware triggers are available. • Large input signal range from ground to VDDA is available. • PGA outputs are driven to on-chip ADC input channels with 1x, 2x, 4x, 8x, 16x or 32x gain. • Integrated sample/hold circuit • Eliminates offset error associated with the sample/hold circuit to reduce 1/f noise • Automatic offset cancellation occurs during PGA startup. • Offset calibration eliminates any errors in the internal reference used to generate the VDDA/2 output center point. • Gain calibration can be used to verify the gain of the overall data path. 2.2 PGA structure The PGA module is intended to operate in synchronization with ADC. By itself, the PGA has no useful function. Figure 1. PGA module structure MC9S08MP16 PGA Module Introduction and Deep Application, Rev. 0, 8/2012 2 Freescale Semiconductor, Inc. PGA feature and module structure Figure 2. Analog block diagram of the PGA module 2.3 PGA calculation Figure 3. PGA sample diagram The following equations can be used to calculate PGA. MC9S08MP16 PGA Module Introduction and Deep Application, Rev. 0, 8/2012 Freescale Semiconductor, Inc. 3 PGA module operation Assume: The equation can be re-written as: As a first order approximation, assume R>>RSENSE and that the PGA input currents are zero. Then: 3 PGA module operation The output of the PGA module must be relative with that of the ADC module. In MC9S08MP16, ADC channel13 is used to measure PGA output voltage. MC9S08MP16 provides PGA calibration function and PGA mission mode. 3.1 PGA startup The PGA module provides the following three types of startup flows according to different trigger modes: • Software trigger • Hardware trigger • PDB trigger 3.1.1 Software Trigger mode • The PGA module must be enabled by setting PGACNTL0[EN] to 1. • Trigger mode must be set to software by setting PGACNTL0[TM] to 1. NOTE For ADC setting requirements, please see MC9S08MP16RM, available on http:// www.freescale.com. In this mode, a PGA conversion will be initiated after writing 1 to PGACNTL2[SWTRIG]. This character can be used with other functions in MC9S08MP16, such as RTC and timer. MC9S08MP16 PGA Module Introduction and Deep Application, Rev. 0, 8/2012 4 Freescale Semiconductor, Inc. PGA simple application 3.1.2 Hardware Trigger mode • The PGA module must be enabled by setting PGACNTL0[EN] to 1. • Trigger mode must be set to hardware by setting PGACNTL0[TM] to 0 NOTE For ADC setting requirements, please see MC9S08MP16RM, available on http:// www.freescale.com In this mode, a PGA conversion will be initiated on the positive edge of the hardware trigger. 3.1.3 PDB Trigger mode • The PDB module provides the hardware trigger to the PGA module. • Trigger mode must be set to hardware by setting PGACNTL0[TM] to 0. NOTE For ADC setting requirements, please see MC9S08MP16RM, available on http:// www.freescale.com. In this mode, PDB provides flexible trigger timing for PGA start conversion. PDB shares the same timer with other function and can generate different timing based on just one timer. 3.2 PGA calibration The PGA module supports various types of calibration, including internal offset calibration, external offset calibration, and gain calibration. 3.3 PGA mission modes Mission mode encompasses a number of options. These include: • Number of gain stage clocks per conversion: PGACNTL2[NUM_CLK_GS] • Low/Full Power: PGACNTL0[LP] • Choice of Hardware or Software Trigger: PGACNTL0[TM] • Any gain setting: PGACNTL0[GAINSEL] 4 PGA simple application The PGA can be widely used in analog transmission and sensor signal collection in industrial fields, such as temperature, pressure, and flow meter. PGA can amplify the small signals into the ADC measuring range. This application notes gives out a thermocouple as an example. 4.1 Typical circuit Generally, some customers use thermocouple to measure or compare temperature. In compare condition, if the voltage difference is small, PGA can be used to amplify the difference and provide larger enough voltage for ADC detection. MC9S08MP16 PGA Module Introduction and Deep Application, Rev. 0, 8/2012 Freescale Semiconductor, Inc. 5 PGA simple application Figure 4. Typical circuit of PGA module 4.2 Sample project flowchart This sample project uses hardware trigger for the PGA module. The hardware trigger source is PDB output. The PDB clock resource is an FTM timer. This program will get an average of 100 samples of PGA. The following figure is the flowchart of sample project. MC9S08MP16 PGA Module Introduction and Deep Application, Rev. 0, 8/2012 6 Freescale Semiconductor, Inc. Conclusion 5 Conclusion The PGA module can amplify small signals proportionally to match the ADC sampling range. PGA can also provide several gain levels such as 1, 2, 4, 8, 16, 32. For MC9S08MP16, the integrated PGA module can save circuit and avoid the outside noise effect. 6 References The following documents are available on http://www.freescale.com • MC9S08MP16RM : MC9S08MP16RM, MC9S08MP16 Reference Manual • MC9S08MP16DS : MC9S08MP16 Series Data Sheet MC9S08MP16 PGA Module Introduction and Deep Application, Rev. 0, 8/2012 Freescale Semiconductor, Inc. 7 How to Reach Us: Home Page: www.freescale.com Web Support: http://www.freescale.com/support USA/Europe or Locations Not Listed: Freescale Semiconductor Technical Information Center, EL516 2100 East Elliot Road Tempe, Arizona 85284 +1-800-521-6274 or +1-480-768-2130 www.freescale.com/support Europe, Middle East, and Africa: Freescale Halbleiter Deutschland GmbH Technical Information Center Schatzbogen 7 81829 Muenchen, Germany +44 1296 380 456 (English) +46 8 52200080 (English) +49 89 92103 559 (German) +33 1 69 35 48 48 (French) www.freescale.com/support Japan: Freescale Semiconductor Japan Ltd. Headquarters ARCO Tower 15F 1-8-1, Shimo-Meguro, Meguro-ku, Tokyo 153-0064 Japan 0120 191014 or +81 3 5437 9125 [email protected] Asia/Pacific: Freescale Semiconductor China Ltd. Exchange Building 23F No. 118 Jianguo Road Chaoyang District Beijing 100022 China +86 10 5879 8000 [email protected] Document Number: AN4564 Rev. 0, 8/2012 Information in this document is provided solely to enable system and software implementers to use Freescale Semiconductors products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document. Freescale Semiconductor reserves the right to make changes without further notice to any products herein. Freescale Semiconductor makes no warranty, representation, or guarantee regarding the suitability of its products for any particular purpose, nor does Freescale Semiconductor assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any liability, including without limitation consequential or incidental damages. "Typical" parameters that may be provided in Freescale Semiconductor data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All operating parameters, including "Typicals", must be validated for each customer application by customer's technical experts. Freescale Semiconductor does not convey any license under its patent rights nor the rights of others. Freescale Semiconductor products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which failure of the Freescale Semiconductor product could create a situation where personal injury or death may occur. Should Buyer purchase or use Freescale Semiconductor products for any such unintended or unauthorized application, Buyer shall indemnify Freescale Semiconductor and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claims alleges that Freescale Semiconductor was negligent regarding the design or manufacture of the part. RoHS-compliant and/or Pb-free versions of Freescale products have the functionality and electrical characteristics as their non-RoHS-complaint and/or non-Pb-free counterparts. For further information, see http://www.freescale.com or contact your Freescale sales representative. For information on Freescale's Environmental Products program, go to http://www.freescale.com/epp. Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © 2012 Freescale Semiconductor, Inc.