MCP3909 ADC Evaluation Board for 16-Bit MCUs User’s Guide © 2008 Microchip Technology Inc. DS51777A 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, SmartShunt and UNI/O 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, 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. DS51777A-page ii © 2008 Microchip Technology Inc. MCP3909 ADC EVALUATION BOARD FOR 16-BIT MCUs USER’S GUIDE Table of Contents Preface ........................................................................................................................... 1 Introduction............................................................................................................ 1 Document Layout .................................................................................................. 1 Conventions Used in this Guide ............................................................................ 2 Recommended Reading........................................................................................ 3 The Microchip Web Site ........................................................................................ 3 Customer Support ................................................................................................. 3 Document Revision History ................................................................................... 3 Chapter 1. Hardware Description 1.1 Overview ........................................................................................................ 5 1.2 PIM Module / MCP3909 Connection and Peripheral Usage Overview .......... 7 1.3 MCP3909 Delta-Sigma Sampling / MCLK Options ........................................ 8 1.4 Analog Input Structure .................................................................................... 9 1.5 Universal Serial Bus (USB) ............................................................................ 9 Chapter 2. Firmware 2.1 DSPIC33 Firmware Description ................................................................... 11 2.2 Display Mode Control - SW2 ........................................................................ 13 2.3 Sampling Speed Rate Control - SW3 ........................................................... 13 2.4 Data Acquisition ........................................................................................... 13 2.5 Data Transmission ....................................................................................... 15 Chapter 3. MCP3909 PC Software Tool 3.1 Software Overview ....................................................................................... 17 3.2 Setting the Sample Rate .............................................................................. 18 3.3 Connectivity, Recording Length and Calibration of Data .............................. 18 3.4 Scope Plot Window - Time Domain Analysis ............................................... 18 3.5 Histogram Window - Noise Analysis ............................................................ 19 3.6 FFT Window - Frequency Domain Analysis ................................................. 19 3.7 Auxiliary Data Window ................................................................................. 19 © 2008 Microchip Technology Inc. DS51777A-page iii MCP3909 ADC Evaluation Board for 16-Bit MCUs User’s Guide Appendix A. Schematics and Layouts A.1 Introduction .................................................................................................. 21 A.2 Schematic - Analog ...................................................................................... 22 A.3 Schematic - LCD And UART ....................................................................... 23 A.4 Schematic - USB And Memory .................................................................... 24 A.5 Schematic - Microcontroller (MCU) .............................................................. 25 A.6 Schematic - PIM Module .............................................................................. 26 A.7 Schematic - Power ....................................................................................... 27 A.8 Board - Top Trace and Top Silk ................................................................... 28 A.9 Board - Bottom Trace and Bottom Silk ........................................................ 28 A.10 Board - Layer #2 VDD ................................................................................ 29 A.11 Board - Layer #3 GND ............................................................................... 29 A.12 Board -Top Silk and Pads .......................................................................... 30 A.13 Board - Bottom Silk and Pads .................................................................... 30 Appendix B. Bill of Materials (BOM) Worldwide Sales and Service .....................................................................................34 DS51777A-page iv © 2008 Microchip Technology Inc. MCP3909 ADC EVALUATION BOARD FOR 16-BIT MCUs USER’S GUIDE Preface NOTICE TO CUSTOMERS All documentation becomes dated, and this manual is no exception. Microchip tools and documentation are constantly evolving to meet customer needs, so some actual dialogs and/or tool descriptions may differ from those in this document. Please refer to our web site (www.microchip.com) to obtain the latest documentation available. Documents are identified with a “DS” number. This number is located on the bottom of each page, in front of the page number. The numbering convention for the DS number is “DSXXXXXA”, where “XXXXX” is the document number and “A” is the revision level of the document. For the most up-to-date information on development tools, see the MPLAB® IDE on-line help. Select the Help menu, and then Topics to open a list of available on-line help files. INTRODUCTION This chapter contains general information that will be useful to know before using the MCP3909 ADC Evaluation Board for 16-Bit MCUs. Items discussed in this chapter include: • • • • • • Document Layout Conventions Used in this Guide Recommended Reading The Microchip Web Site Customer Support Document Revision History DOCUMENT LAYOUT This document describes how to use the MCP3909 ADC Evaluation Board for 16-Bit MCUs as a development tool to emulate and debug firmware on a target board. The manual layout is as follows: • Chapter 1. “Hardware Description”– Provides important information about the MCP3909 ADC Evaluation Board for 16-Bit MCUs hardware. • Chapter 2. “Firmware”– Describes the MCP3909 ADC Evaluation Board for 16-Bit MCUs firmware. • Chapter 3. “MCP3909 PC Software Tool” – Provides detailed information about board’s PC software tool. • Appendix A. “Schematics and Layouts”– Shows the schematic and board layouts for the MCP3909 ADC Evaluation Board for 16-Bit MCUs. • Appendix B. “Bill of Materials (BOM)” – Lists the parts used to build the MCP3909 ADC Evaluation Board for 16-Bit MCUs. © 2008 Microchip Technology Inc. DS51777A-page 1 MCP3909 ADC Evaluation Board for 16-Bit MCUs User’s Guide CONVENTIONS USED IN THIS GUIDE This manual uses the following documentation conventions: DOCUMENTATION CONVENTIONS Description Arial font: Italic characters Represents Referenced books Emphasized text A window A dialog A menu selection A field name in a window or dialog A menu path MPLAB® IDE User’s Guide ...is the only compiler... the Output window the Settings dialog select Enable Programmer “Save project before build” A dialog button A tab A number in verilog format, where N is the total number of digits, R is the radix and n is a digit. A key on the keyboard Click OK Click the Power tab 4‘b0010, 2‘hF1 Italic Courier New Sample source code Filenames File paths Keywords Command-line options Bit values Constants A variable argument Square brackets [ ] Optional arguments Curly brackets and pipe character: { | } Ellipses... Choice of mutually exclusive arguments; an OR selection Replaces repeated text #define START autoexec.bat c:\mcc18\h _asm, _endasm, static -Opa+, -Opa0, 1 0xFF, ‘A’ file.o, where file can be any valid filename mcc18 [options] file [options] errorlevel {0|1} Initial caps Quotes Underlined, italic text with right angle bracket Bold characters N‘Rnnnn Text in angle brackets < > Courier New font: Plain Courier New Represents code supplied by user DS51777A-page 2 Examples File>Save Press <Enter>, <F1> var_name [, var_name...] void main (void) { ... } © 2008 Microchip Technology Inc. Preface RECOMMENDED READING This user's guide describes how to use MCP3909 ADC Evaluation Board for 16-Bit MCUs. Other useful documents are listed below. The following Microchip document is available and recommended as supplemental reference resources: • MCP3909 Data Sheet - “Energy Metering IC with SPI Interface and Active Power Pulse Output” (DS22025) THE MICROCHIP WEB SITE Microchip provides online support via our web site at www.microchip.com. This web site is used as a means to make files and information easily available to customers. Accessible by using your favorite Internet browser, the web site contains the following information: • Product Support – Data sheets and errata, application notes and sample programs, design resources, user’s guides and hardware support documents, latest software releases and archived software • General Technical Support – Frequently Asked Questions (FAQs), technical support requests, online discussion groups, Microchip consultant program member listing • Business of Microchip – Product selector and ordering guides, latest Microchip press releases, listing of seminars and events, listings of Microchip sales offices, distributors and factory representatives CUSTOMER SUPPORT Users of Microchip products can receive assistance through several channels: • • • • Distributor or Representative Local Sales Office Field Application Engineer (FAE) Technical Support Customers should contact their distributor, representative or field application engineer (FAE) for support. Local sales offices are also available to help customers. A listing of sales offices and locations is included in the back of this document. Technical support is available through the web site at: http://support.microchip.com. DOCUMENT REVISION HISTORY Revision A (November 2008) • Initial Release of this Document. © 2008 Microchip Technology Inc. DS51777A-page 3 MCP3909 ADC Evaluation Board for 16-Bit MCUs User’s Guide NOTES: DS51777A-page 4 © 2008 Microchip Technology Inc. MCP3909 ADC EVALUATION BOARD FOR 16-BIT MCUs USER’S GUIDE Chapter 1. Hardware Description 1.1 OVERVIEW The MCP3909 ADC Evaluation Board for 16-Bit MCUs system provides the ability to evaluate the performance of the MCP3909 dual channel ADC. It also provides a development platform for 16-bit PIC based applications, using existing 100-pin PIM systems compatible with the Explorer-16 and other high pincount PIC demo boards. The system comes with programmed PIC24FJ128GA010 and dsPIC33FJ256GP710 PIM modules that communicate both to on-board LCD and a LabView GUI for both in-circuit and PC signal processing. 1.1.1 Feature Highlights • Dual 16-bit ADC MCP3909 output display using Serial communication to PC Software Interface • Simultaneous 15 ksps at 81 dB SINAD performance on dual 16-Bit MCP3909 channels • Spectral Analysis using DFT dsPIC33F calculations, resolution of TBDAH • System and ADC performance analysis through graphical PC tools showing Noise Histogram, Frequency Domain (FFT), Time domain scope plot, and statistical numerical analysis • Robust hardware design with analog grounding and analog/digital separation, allowing low noise evaluation of MCP3909 devices. Separate power supplies and power planes - 4 layer board • Pigtail Plus connectors for Explorer-16 daughter board compatibility © 2008 Microchip Technology Inc. DS51777A-page 5 MCP3909 ADC Evaluation Board for 16-Bit MCUs User’s Guide HFOUT G CH1+ GND CH1- + MCP3909 G - + - EXT +5V CH0+ GND CH0- + - Serial Connector EXT +5V +9V IN USB PIM RESET MCP3909 Digital I/O SW2 SW3 SW4 RA9 USB +3V REG PWR LED (Blue) PIC18F86J65 PIC18 AUX I/O SRAM PICtail Plus PIC18 ICD PIC18 ICD 9V EXT. IN +5V REG RA10 PIM (100-PIN) PIC18 EXTERNAL I/O MCP3909 ADC Evaluation Board for 16-bit MCU FIGURE 1-1: DS51777A-page 6 Evaluation Board Block Diagram. © 2008 Microchip Technology Inc. Hardware Description 1.2 PIM MODULE / MCP3909 CONNECTION AND PERIPHERAL USAGE OVERVIEW The MCP3909 ADC Evaluation Board for 16-Bit MCUs contains a 100-pin PIM socket compatible with Microchip’s PIM modules. The system comes with 2 PIM modules: the PIC24FJ128GA010 and dsPIC33FJ256GA710. A complete description of the firmware programmed with these two modules see in Chapter 1. “Hardware Description”. RA9/10 D6 D7 RB8/9/10 (Green) CONTROL SWITCHES (X3) RF2/U1RX UART SERIAL TO PC COMMUNICATION RF3/U1TX RD10 RD11 OC1/RD0 CLKIN RA5 RA4 SCK1/RF6 SDO1/RF8 SDI1/RF7 T2CK/RC1 PIM Module FIGURE 1-2: MCLR Clock Generation CS SCK SDI G1 HPF G0 HPF1 16-bit Multi-level ΔΣ ADC + PGA ‚ CH0+ CH0- HPF1 16-bit Multi-level ΔΣ ADC + ‚ CH1+ CH1- Serial Interface Block SDO HFOUT Digital to Frequency Converter MCP3909 Digital Connection Overview PIM/MCP3909 connections. Ports A, B, and D are used for signals such as push buttons, output LEDs, CS and MCLR (for MCP3909 data mode setting). Output Capture 1 is used for MCP3909’s clock generation. Serial communication is achieved through the MSSP module 1, and the Timer2 Capture Compare can be used to measure MCP3909 active power output frequency (HFOUT). © 2008 Microchip Technology Inc. DS51777A-page 7 MCP3909 ADC Evaluation Board for 16-Bit MCUs User’s Guide 1.3 MCP3909 DELTA-SIGMA SAMPLING / MCLK OPTIONS The MCP3909 device is an ADC with a second order modulator and a third order sinc filter. This Delta-Sigma A/D converter has an oversampling ratio of 64. The CLKIN pin of the MCP3909 is the oversampling clock (MCLK) input and the output data rate is MCLK/256. The MCP3909 ADC Evaluation Board for 16-Bit MCUs offers two different options for the MCP3909 master clock (MCLK). 1.3.1 Using the Crystal X2 The MCP3909 ADC Evaluation Board for 16-Bit MCUs is populated with a 3.58 MHz crystal, being used as a clock source by placing jumpers in the following position on the MCP3909 Digital I/O header block: XTAL XTAL PIM OC1 CLKOUT CLKIN CLKIN FIGURE 1-3: 1.3.2 ADC Clock Selection Jumpers - External Crystal. Driving the clock with the PIM module The PIC MCU can be used to generate the CLKIN (MCLK) signal for the MCP3909, setting the ADC sample rate through the use of the output compare module OC1. To use this, make the following jumper change to the MCP3909 Digital I/O header block: XTAL XTAL PIM OC1 CLKOUT CLKIN CLKIN FIGURE 1-4: ADC Clock Selection Jumpers - Clock from MCU. The frequency of the OC1 output is based on the PR1 bits settings in the firmware (for both PIC24 and dsPIC33 PIM modules supplied with this system). These settings can be cycled through by pressing SW2 of the PIM AUX Switches. The Table 1-1 shows the settings that are immediately available by changing PR2, the timer period register: TABLE 1-1: DS51777A-page 8 SAMPLE RATES Gear PR Bit Setting OC1 Frequency MCP3909 Data Rate 1 48 164.96 kHz 644.2 sps 2 14 758.7 kHz 2.96 ksps 3 8 1264.36 kHz 4.94 ksps 4 4 2.2755 MHz 8.89 ksps 5 2 3.7921 MHz 14.81 ksps © 2008 Microchip Technology Inc. Hardware Description 1.4 ANALOG INPUT STRUCTURE Two differential input paths allow external signal sources to be easily connected to the MCP3909 input. Edge connectors P1 and P2 are 3-pin connectors that act as both crew type and clip on post connectors. Note: To use an edge connector as a post connector, pull up the blue plastic top to access posts. JP1 and JP2 can be used to force either channel from a differential to single-ended configuration. R3 and R4 (on CH0), and R1 and R2 (on CH2) act as locations for burden resistor connectors for any current transformer inputs. 1.5 UNIVERSAL SERIAL BUS (USB) The MCP3909 ADC Evaluation Board for 16-Bit MCUs also contains a USB connection for higher speed sampling and data collection. The circuit includes a 512 x 8 SRAM for data collection. The following figure summarizes the connections between the ADC, 2 micros, and memory. Note: For this board release, no USB firmware is supplied. The PIC18F86J55 is blank and only included for development purposes. SRAM 512x8 USB PIC18F86J55 8 RD6/SCK2 © 2008 Microchip Technology Inc. SCK2/RG6 MCP3909 ADC RF6/SCK1 SCK RD4/SDO2 SDI2/RG7 RF7/SDI1 SDO RD5/SDI2 SDO2/RG8 RF8/SDO1 SDI RD7/SS2 SS2/RG9 USB FIGURE 1-5: PIM Module SERIAL USB Block Diagram. DS51777A-page 9 MCP3909 ADC Evaluation Board for 16-Bit MCUs User’s Guide NOTES: DS51777A-page 10 © 2008 Microchip Technology Inc. MCP3909 ADC EVALUATION BOARD FOR 16-BIT MCUs USER’S GUIDE Chapter 2. Firmware 2.1 DSPIC33 FIRMWARE DESCRIPTION 2.1.1 Reset and Initialization After reset, the code jumps to line 305 from main.c file, where the initialization routine is called: Initialization(). First, the nested interrupts are disabled. External interrupt 3 is enabled on the negative edge. Timer 2 is running on the Output Compare 1, being used to generate the clock for the MCP3909. In addition, some initial values are set up for the MCP3909 clock frequency. Timer 5 is enabled and set to generate an interrupt at compare mach; the time period between two interrupts is a few hundred milliseconds. Note: The time period can be changed from PR5 register. The SPI module is initialized and started, but the corresponding interrupt is not enabled. UART transmitter is initialized, but the corresponding interrupt is not enabled. Communication speed is set for 115200 baud. The UART receiver is not used. Pins with analogue alternate function are setup as digital-input outputs. Initial values for different variables are being set at the end of the initialization routine. Back in the void main() routine the nested interrupts are enabled. Then the routine that starts the MCP3909 is called: startMCP3909(). 2.1.2 startMCP3909() During this routine the MCP3909 is put into a test mode, according to the MCP3909 data sheet. At the beginning CS and MCP3909 reset pins (MCLR) have high values. After a slight delay, MCLR is toggled low, and then the serial command b10100100 is sent to the device. This means that the ADC is placed into “Dual Channel Output PRE HPF1” mode. Then, a short positive pulse is sent to CS. 2.1.3 Main() In the main() file, the LCD will display the samples values. At this point, the Main routine will enter an infinite loop. All the other tasks are being done during the interrupt routines. 2.1.4 Timer 5 Compare Mach Interrupt All events that don't need to take place to a repeated, constant period of time are processed during this interrupt. One event that is happening at the time of this routine is the blinking of LED D7 - as a life sign for the system. This routine is monitoring the buttons state (pressed or not pressed), and also counts how many times each of them have been pressed. © 2008 Microchip Technology Inc. DS51777A-page 11 MCP3909 ADC Evaluation Board for 16-Bit MCUs User’s Guide START Initialization LCD: “Samples Value” SW2 pressed? NO YES Adjust value of: But1Cont SW2 pressed once YES Copy CH0 samples in signal[] buffer; Compute FFT; Indicate on LCD FFT results: magnitude and frequency; NO SW2 pressed twice YES Copy CH1 samples in signal[] buffer; Compute FFT; Indicate on LCD FFT results: magnitude and frequency; NO SW2 pressed 3rd time YES Copy CH0 samples in signal[] buffer; Compute Autocorrelation function; Indicate on the LCD the signal frequency and the index of maximum value NO SW3 pressed? YES Adjust value of: But2Cont NO SW3 pressed once YES Set sampling speed: gear 1 NO SW3 pressed twice YES Set sampling speed: gear 2 NO SW3 pressed 3rd time YES Set sampling speed: gear 3 NO SW3 pressed 4th time YES Set sampling speed: gear 4 NO SW3 pressed 5th time YES Set sampling speed: gear 5 NO FIGURE 2-1: DS51777A-page 12 LCD Control Flowchart. © 2008 Microchip Technology Inc. Firmware 2.2 DISPLAY MODE CONTROL - SW2 Table 2-1 describes the actions made to the SW2 button, and the results shown on the LCD. TABLE 2-1: LCD MESSAGE DURING SW2 MANIPULATION Type of Operation NEVER PRESSED LCD indicates the same message as the one during the reset time: samples values. 1st Time LCD shows the results of the FFT performed on CH0. 2nd LCD shows the results of the FFT performed on samples recorded from CH1. Time 3rd Time 2.3 LCD Screen Results LCD indicates the results form the auto-correlation function: signal frequency and the index of maximum of the auto-correlation function. SAMPLING SPEED RATE CONTROL - SW3 SW3 button is used to control the sampling speed rate of the ADC by changing the frequency of the MCP3909 clock signal. The initial sampling frequency rate is around 640 sps. For a 64 sample buffer it means a 0.1s recording buffer. Table indicates estimated values for the sampling frequency when operating the SW3 button: TABLE 2-2: RESULTS DURING SW3 MANIPULATION Type of Operation Pressed 1st time Pressed 2nd Sampling Frequency Rate Estimation The sampling speed rate is to 2000 sps. time The sampling frequency rate is 3800 sps. Pressed 3rd time The sampling frequency rate is 7600 sps. Pressed 4th time The sampling speed rate is 15000 sps. These higher sampling rates can be used when the measured signal has a high frequency, or when a signal doesn't have a stable frequency and we want to measure its amplitude. For higher sampling rate the measurement error induced by the Sinc filter is reduced. Note: 2.4 Important! When using the GUI for evaluation, the ‘gear’ on the GUI must be set to the speed on the board, i.e. 1st, 2nd, 3rd, etc. DATA ACQUISITION External interrupt 3 is used for detecting the end of conversion on MCP3909. Because this line is the same with the SPI data output, the first thing done after the detection of an external interrupt is to disable this particular interrupt. Otherwise an interrupt will be generated on each falling edges of the SPI signal. Then the setup for the SPI is changed: it will be used in 16-bit mode, and the interrupt is activated. The SPIBUF register is being read to clear the SPI interrupt flag. For the first 16 periods of SPI clock, 0 value will be send to the MCP3909. The SPI interrupt takes place after each successful data transfer between master and slave on SPI. As in any interrupt, first thing to do is to clear the interrupt flag, otherwise a new interrupt will happen again, for no reason. © 2008 Microchip Technology Inc. DS51777A-page 13 MCP3909 ADC Evaluation Board for 16-Bit MCUs User’s Guide The CCSPI global value is the counter that indicates if the SPI happens soon after the INT3, and the value present in the SPI is CH0, or if a previous SPI interrupt happened and now is time to save value of CH1. After saving the samples into MCU, a small pulse is sent on CS, to the MCP3909, to prepare it for a new conversion. The acquired data is saved in form of two vectors in SRAM, one for CH0 and ne for CH1. Finally, the Timer 5 interrupt and UART TX interrupt are enabled. The first Character sent to UARt is:!. External Interrupt 3 Disable INT3; Set SPI on 16 bit Mode; Enable SPI; ccspi=0? NO YES Read CH0; Save word; Increment ccspi; ccspi=1? YES Read CH1; Save word; Increment ccspi; NO ccspi=2; YES Disable SPI interrupt; Enable INT3; ccspi=0; Save data in buffer Buffer Full? YES Enable timer 5 interrupt; Enable UART TX interrupt; Sent char 0d33; FIGURE 2-2: DS51777A-page 14 ADC Communication Flowchart. © 2008 Microchip Technology Inc. Firmware 2.5 DATA TRANSMISSION When UART TX interrupt takes place, data is extracted from SRAM as a 16-bit number, then translated into STRING. Each word is converted into a five digit number without sign. During transmission, the digits with the values of CH0 are sent first, then the character ‘,’. Next are the five digits of the CH1, and last, the character Carriage return. This is done 512 times. After the transmission of the acquired samples, the FFT value must be sent on UART. To delimit the buffer of the acquired samples from FFT values, character ‘;’ is being sent. The FFT information is sent in the same manner as the stored samples (five digit numbers delimited by ‘,’ and CR), but the FFT length is limited to 128 values. These values are used by the GUI to compare the FFT computed into the MCU to the one computed on the PC. UART TX Interrupt contrd<=511 NO YES Get CH0 from buffer; Change INT into 5 digit string; Sent the 5 characters; Sent character: , Get CH1 from Buffer; Change the value in 5 digit string; Sent the 5 characters; Sent character Carriage Return Increment contrd; FIGURE 2-3: contrd<=512+FFT length? NO YES Get Voltage FFT value; Change value into 5 digit string; Sent the 5 characters; Sent character: , Get Current FFT value; Change the value in 5 digit string; Sent the 5 characters; Sent character Carriage Return Increment contrd; UART TX disable; contwr=0; Serial Transmission Flowchart. © 2008 Microchip Technology Inc. DS51777A-page 15 MCP3909 ADC Evaluation Board for 16-Bit MCUs User’s Guide NOTES: DS51777A-page 16 © 2008 Microchip Technology Inc. MCP3909 ADC EVALUATION BOARD FOR 16-BIT MCUs USER’S GUIDE Chapter 3. MCP3909 PC Software Tool 3.1 SOFTWARE OVERVIEW The MCP3909 ADC Evaluation Board for 16-Bit MCUs includes a PC graphical user interface (GUI) that performs data analysis for easier system debugging and device evaluation. The following figure a sample of the software’s GUI. FIGURE 3-1: Data View Interface. © 2008 Microchip Technology Inc. DS51777A-page 17 MCP3909 ADC Evaluation Board for 16-Bit MCUs User’s Guide 3.2 SETTING THE SAMPLE RATE On the MCP3909 ADC Evaluation Board for 16-Bit MCUs is possible to select from five different sampling rates, referred here as gears. The control is placed in the up left areas of the GUI. The value of the sampling rate for each gear is as follows: • • • • • 1st gear 2nd gear 3th gear 4th gear 5th gear - 644.2 sps - 2963 sps - 4938 sps - 8888 sps - 14813 sps Once the gear is changed, the actualized value of the sampling rate is indicated on the “Sampling Frequency (sps)” field. The “Frequency Resolution” field will indicate the space between spectral lines of the sampled signal, at the indicated sample rate. Changing the sampling rate in the GUI will not automatically change the one on the MCP3909 ADC Evaluation Board for 16-Bit MCUs. For this to happen it is necessary to manually change the gear, by pressing the RB9 button placed on the board. 3.3 CONNECTIVITY, RECORDING LENGTH AND CALIBRATION OF DATA The PC is connected to the MCP3909 ADC Evaluation Board for 16-Bit MCUs through the RS232 cable. It is important to have a COM port on the PC. It is possible to use a USB to RS232 adaptor cable, for this case being necessary to write the number of the virtual COM port. To do this, right-click on My computer > Manage > Device Manager > Port (COM and LPT), and read the number in the parenthesis, after the device name. The COM port number must be selected in the “VISA Resource Name” field. The MCU is sending a big packet of data to the PC. If the user need to see only to a small part of the buffer, he will write the desired buffer length in the “Buffer length” field. The maximum length is 512 samples. The user have the option to choose between Calibrate and Not Calibrate tab from the up-right corner of the window. The calibration is possible for an AC signal measurement, calibrating the scale and selecting the desired unit of measure for the processed data. When selecting the Calibrate tab, two fields are shown: the “Amplitude CH0” and the “Amplitude CH1”, with the corresponding Calibration buttons. The user must write the peak-to-peak value in the two fields, and then press the Calibration button for each, or use the shortcuts (<F2> for CH0 and <F3> for CH1). If the Calibration button is not pressed, or the shortcut is not applied, plot screens will be empty. If the Not Calibrated tab is selected, the “Amplitude” fields and Calibration buttons are not visible, and the data plotted on the screen will be indicated in LSBs (in ADC code). To stop the GUI it is necessary to press the STOP button, or the <F4> shortcut key. 3.4 SCOPE PLOT WINDOW - TIME DOMAIN ANALYSIS The recorded samples from a buffer are indicated on the “Waveform Graphs” screens. The size of the X scale is given by the number showed in the “Buffer Length” field. If the Not Calibrated tab is selected, the value on Y axis will be given by the LSBs. If the data is calibrated, and calibration value is 0.5, for example, the data on the waveform graphs will have an amplitude peak-to-peak of 2x0.5. It is important to note that the offset is not removed. DS51777A-page 18 © 2008 Microchip Technology Inc. MCP3909 PC Software Tool 3.5 HISTOGRAM WINDOW - NOISE ANALYSIS For the evaluation of the Effective Number Of Bits (ENOB) the GUI will compute some statistical parameters: “mean” value, “standard deviation” and “variance”, for each channel. These parameters can be seen at the bottom of the GUI, right under the Histogram Graph screens. The formula used for the ENOB is: EQUATION 3-1: ENOB = 16 – log 2 ( σ ) The right value for the acquired ENOB is correct only when the DC signal is applied on the inputs. The distribution of noise from the acquired signal can be seen on the Histogram Graph screens.These graphs are indicating how many transitions took place in between two codes. In the case of a noiseless signal (a straight line), the histogram graphs will show nothing. If the signal is a digital noise signal (transition between two values) the histogram will indicate just one vertical bar. 3.6 FFT WINDOW - FREQUENCY DOMAIN ANALYSIS The spectrum of the acquired signal is visible in the Signal Spectrum screen. Above these graphics there is a button that can be used to set the Y scale to be linear or logarithmic. A logarithmic scale on Y axis is useful to see the level of low harmonics, or the noise floor. The length of the FFT is given by the buffer length and the sampling speed. The X axis is directly scaled in Hz units. Do remember when changing the sampling speed in the GUI, to manually change the sampling speed on the MCP3909 ADC Evaluation Board for 16-Bit MCUs. Another feature of the software is the window selection for the FFT computation. This is done from the “Window” fields, in the lower region of the GUI, right above the Current FFT screens. The user can select from a large number of windows. Since GUI is performing the spectral analysis of the acquired signal, it is possible to compute AC performance parameters of the ADC: “THD” and “SINAD” are shown on the indicators, right under the Histogram Graph screens. 3.7 AUXILIARY DATA WINDOW At the bottom of the GUI there are two screens called Current FFT and Voltage FFT. These graphics are used to compare the FFT computed on the MCU (the green FFT) with the one computed on the PC (the red FFT). The Current channel is CH0, and the Voltage channel is CH1. In the beginning these graphs do not indicate anything. For a correct use it is necessary to have the same window used on both MCU and PC. In addition, on the PC, the Linear scale for the FFT must be used. Because on the MCU the FFT has 128 points in length, the buffer length should be the same. The MCU is not sending the data to the PC simultaneously. To choose which view to see (Current FFT or Voltage FFT), press SW3 placed on the board. © 2008 Microchip Technology Inc. DS51777A-page 19 MCP3909 ADC Evaluation Board for 16-Bit MCUs User’s Guide NOTES: DS51777A-page 20 © 2008 Microchip Technology Inc. MCP3909 ADC EVALUATION BOARD FOR 16-BIT MCUs USER’S GUIDE Appendix A. Schematics and Layouts A.1 INTRODUCTION This appendix contains the following schematics of the MCP3909 ADC Evaluation Board for 16-Bit MCUs. • • • • • • • • • • • • Schematic - Analog Schematic - LCD and UART Schematic - USB and Memory Schematic - Microcontroller (MCU) Schematic - PIM Module Schematic - Power Board - Top Trace and Top Silk Board - Bottom Trace and Bottom Silk Board - Layer #2 VDD Board - Layer #3 GND Board - Top Silk and Pads Board - Bottom Silk and Pads © 2008 Microchip Technology Inc. DS51777A-page 21 MCP3909 ADC Evaluation Board for 16-Bit MCUs User’s Guide SCHEMATIC - ANALOG Lynium A.2 DS51777A-page 22 © 2008 Microchip Technology Inc. Schematics and Layouts SCHEMATIC - LCD AND UART Lynium A.3 © 2008 Microchip Technology Inc. DS51777A-page 23 MCP3909 ADC Evaluation Board for 16-Bit MCUs User’s Guide SCHEMATIC - USB AND MEMORY Lynium A.4 DS51777A-page 24 © 2008 Microchip Technology Inc. Schematics and Layouts SCHEMATIC - MICROCONTROLLER (MCU) Lynium A.5 © 2008 Microchip Technology Inc. DS51777A-page 25 MCP3909 ADC Evaluation Board for 16-Bit MCUs User’s Guide SCHEMATIC - PIM MODULE Lynium A.6 DS51777A-page 26 © 2008 Microchip Technology Inc. Schematics and Layouts SCHEMATIC - POWER Lynium A.7 © 2008 Microchip Technology Inc. DS51777A-page 27 MCP3909 ADC Evaluation Board for 16-Bit MCUs User’s Guide A.8 BOARD - TOP TRACE AND TOP SILK MCP3909 ADC Eval Board for 16-bit MCU A.9 BOARD - BOTTOM TRACE AND BOTTOM SILK DS51777A-page 28 © 2008 Microchip Technology Inc. Schematics and Layouts A.10 BOARD - LAYER #2 VDD A.11 BOARD - LAYER #3 GND © 2008 Microchip Technology Inc. DS51777A-page 29 MCP3909 ADC Evaluation Board for 16-Bit MCUs User’s Guide A.12 BOARD -TOP SILK AND PADS MCP3909 ADC Eval Board for 16-bit MCU A.13 BOARD - BOTTOM SILK AND PADS DS51777A-page 30 © 2008 Microchip Technology Inc. MCP3909 ADC EVALUATION BOARD FOR 16-BIT MCUs USER’S GUIDE Appendix B. Bill of Materials (BOM) TABLE B-1: Qty BILL OF MATERIALS (BOM) Reference Description Manufacturer Part Number 2 C1, C4 CAP CER 10UF 16V X5R 0805 Murata Electronics® GRM21BR61C106KE15L 2 C2, C6 CAP CER 4.7UF 25V X5R 0805 Murata Electronics GRM21BR61E475KA12L 5 C3, C5, C44, C45, CAP CER .1UF 25V 10% X7R 0805 C46 Murata Electronics GRM21BR71E104KA01L 4 C7, C8, C9, C10 CAP CER 68000PF 50V C0G 1206 Murata Electronics GRM31C5C1H683JA01L 1 C23 CAPACITOR TANT 47UF 6.3V 20% SMD Kemet Electronics® T491A476M006AT 30 C11, C12, C13, C14, C15, C16, C17, C18, C19, C20, C21, C22, C24, C25, C26, C27, C28, C29, C30, C33, C34, C35, C36, C39, C40, C43, C47, C48, C49, C50 CAP CER .1UF 25V 10% X7R 0603 Murata Electronics GRM188R71E104KA01D 6 C31, C32, C37, C38, C41, C42 CAP CER 18PF 50V 5% C0G 0603 Murata Electronics GRM1885C1H180JA01D 2 D1, D6 LED 570NM GRN WHT/DIFF 0603 SMD Rohm 3 D2, D4, D7 LED RED 470NM CLEAR LENS (0603 Red) PARA Light 1 D3 DIODE SCHOTTKY 20V 0.5A SOD123 ON Semiconductor® MBR0520LT1G 1 D5 LED BLUE 470NM CLEAR LENS (0603 Blue) PARA Light L-C191LBCT-U1 1 J1 CONN POWERJACK MINI .08" R/A T/H Switchcraft Inc. RAPC722X 1 J2 Mini USB Type B Surface Mount Samtec MUSB-05-S-B-SM-A ® SML-512MWT86 L-C192KRCT-U1 1 J3 CONN D-SUB RCPT R/A 9POS 15GOLD Tyco Electronics Amp 1734354-2 1 J4 DO NOT INSTALL 120-pin MINI EDGE CARD SOCKET Samtec MEC1-160-02-L-D-A 3 JP1, JP2, JP3 3 X 2 Header 2.54mm on center 6 mm/2.5mm Samtec TSW-103-07-G-D 1 JP4 4 X 2 Header 2.54mm on center 6 mm/2.5mm Samtec TSW-104-07-G-D 1 JP5, JP6, JP7, P7, P8 18 X 2 Header 2.54mm on center 6 mm/2.5mm Samtec TSW-118-07-G-D 1 L1 Shielded 10uH Power Inductor 0805 Coilcraft 0805PS-103KLC 1 LCD1 DO NOT INSTALL — — 1 LCD2 16X2 FTN Reflective No. BLWT COG 3V TianMa. TM162JCAWG1 4 MOD1 25 X1 Header 1.27mm on center Samtec MTMS-125-01-G-S-230 1 P1, P2 CONN TERM BLK PLUG 6A 3.5MM 3POS Keystone Electronics® 8723 1 P3 CONN TERM BLK PLUG 6A 3.5MM 2POS Keystone Electronics 8722 Note 1: The components listed in this Bill of Materials are representative of the PCB assembly. The released BOMused in manufacturing uses all RoHS-compliant components. © 2008 Microchip Technology Inc. DS51777A-page 31 Bill of Materials (BOM) TABLE B-1: Qty BILL OF MATERIALS (BOM) (CONTINUED) Reference Description Manufacturer Part Number 1 P3 TERM BLK PIN HEADER 24Pin Pos One 24 Pin Header is enough for 3 Boards Keystone Electronics 8724 1 P5 10 X2 Header 2.54mm on center 6 mm/2.5mm Samtec TSW-110-07-G-D 1 P9 DO NOT INSTALL — — 1 PCB RoHS Compliant Bare PCB, MCP3909 ADC Evaluation Board for 16-Bit MCUs Microchip Technology Inc. 104-000189 13 R1, R2, R3, R4, R6, R8, R9, R10, R17, R18, R25, R29, R35 DO NOT INSTALL — — 4 R5, R7, R11, R12 RES 1.0K OHM .1% 1/4W 0805 SMD Susumu Co Ltd RGH2012-2E-P-102-B 4 R13, R19, R23, R30 RES 4.70K OHM 1/10W 1% 0603 SMD Rohm MCR03EZPFX4701 8 R14, R20, R24, R31, R32, R33, R36, R37 RES 1.00K OHM 1/10W 1% 0603 SMD Rohm MCR03EZPFX1001 4 R15, R21, R61, R73 RES 10.0K OHM 1/10W 1% 0603 SMD Rohm MCR03EZPFX1002 1 R16 RES 1.30K OHM 1/10W 1% 0603 SMD Rohm MCR03EZPFX1301 2 R22, R26 RES 0.0 OHM 1/10W 5% 0603 SMD Rohm MCR03EZPJ000 2 R27, R28 RES 2.20K OHM 1/10W 1% 0603 SMD Rohm MCR03EZPFX2201 3 R34, R40, R51 RES 1.00M OHM 1/10W 1% 0603 SMD Rohm MCR03EZPFX1004 28 R38, R39, R41, R42, R43, R45, R46, R47, R48, R49, R50, R52, R53, R54, R55, R56, R57, R58, R62, R63, R64, R65, R66, R67, R68, R69, R77, R78 RES 100 OHM 1/10W 1% 0603 SMD Rohm MCR03EZPFX1000 7 R44, R70, R71, R72, R74, R75, R76 RES 100K OHM 1/10W 1% 0603 SMD Rohm MCR03EZPFX1003 MCR10EZHF10R0 2 R59, R60 RES 10.0 OHM 1/8W 1% 0805 SMD Rohm 4 SW1,SW2, SW3, SW4 SWITCH TACT 6MM 230GF H=4.3MM Omron Electronics Inc B3S-1002P - ECB Div 1 TP1 Wire Test Point 0.3" Length Component Corporation PJ-202-30 1 U1 IC REG LDO 800MA 5.0V SOT-223 National Semiconductor LM1117MP-5.0/NOPB 1 U2 IC PIC USB MCU FLASH 48KX16 80TQFP Microchip Technology PIC18F86J55-I/PT Inc 1 U3 IC REG LDO 800MA 3.3V SOT-223 National Semiconductor 1 U4 IC ENERGY METER 24SSOP Microchip Technology MCP3909-I/SS Inc 1 U5 IC SRAM 4MB ASYNC 44-TSOPII ISSI, Integrated Silicon Solution Inc IS61LV5128AL-10TLI 1 U6 IC DRVR/RCVR MLTCH RS232 20TSSOP Texas Instruments MAX3223IPWR 1 U7 DO NOT INSTALL — — Note 1: LM1117MP-3.3/NOPB The components listed in this Bill of Materials are representative of the PCB assembly. The released BOMused in manufacturing uses all RoHS-compliant components. © 2008 Microchip Technology Inc. DS51777A-page 32 Bill of Materials (BOM) TABLE B-1: Qty BILL OF MATERIALS (BOM) (CONTINUED) Reference Description Manufacturer Part Number 1 U8 2.7V Voltage Supervisor SOT-23-3 Microchip Technology MCP130T-270I/TT Inc 1 X1 CRYSTAL 48.0000MHZ 10PF SMD Abracon Corporation 1 X2 CRYSTAL 3.579545MHZ 18PFFUND SMD Abracon Corporation ABLS-3.579545MHZ-B2-T 1 X3 CRYSTAL 8.000MHZ 18PF FUND SMD Abracon Corporation ABLS-8.000MHZ-B2-T 9 Jumpper Shunt CONN JUMPER SHORTING TIN Sullins Connector Solutions STC02SYAN 4 Ea. Conner of PCB STANDOFF HEX .500/4-40THR NYLON Keystone Electronics 1902C 4 Ea. Conner of PCB SCREW MACH PHIL 4-40X3/8 NYLON Building Fasteners NY PMS 440 0038 PH Note 1: ABM3B-48.000MHZ-10-1-U-T The components listed in this Bill of Materials are representative of the PCB assembly. The released BOMused in manufacturing uses all RoHS-compliant components. © 2008 Microchip Technology Inc. DS51777A-page 33 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 DS51777A-page 34 © 2008 Microchip Technology Inc.