MCP3901 ADC Evaluation Board for 16-Bit MCUs User’s Guide 2010 Microchip Technology Inc. DS51845B 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, dsPIC, KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART, PIC32 logo, rfPIC and UNI/O are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor, MXDEV, MXLAB, SEEVAL 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, HI-TIDE, In-Circuit Serial Programming, ICSP, Mindi, MiWi, MPASM, MPLAB Certified logo, MPLIB, MPLINK, mTouch, Omniscient Code Generation, PICC, PICC-18, PICDEM, PICDEM.net, PICkit, PICtail, REAL ICE, rfLAB, Select Mode, Total Endurance, TSHARC, UniWinDriver, 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. © 2010, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved. Printed on recycled paper. ISBN: 978-1-60932-571-8 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. DS51845B-page 2 2010 Microchip Technology Inc. MCP3901 ADC EVALUATION BOARD FOR 16-BIT MCUs USER’S GUIDE Table of Contents Preface ........................................................................................................................... 5 Introduction............................................................................................................ 5 Document Layout .................................................................................................. 5 Conventions Used in this Guide ............................................................................ 6 Recommended Reading........................................................................................ 7 The Microchip Web Site ........................................................................................ 7 Customer Support ................................................................................................. 7 Document Revision History ................................................................................... 7 Chapter 1. Hardware Description 1.1 Overview ........................................................................................................ 9 1.2 PIM Module/MCP3901 Connection and Peripheral Usage Overview .......... 11 1.3 MCP3901 Delta-Sigma Sampling/MCLK Options ........................................ 12 1.4 Analog Input Structure .................................................................................. 13 1.5 Universal Serial Bus (USB) .......................................................................... 13 Chapter 2. Firmware 2.1 DSPIC33 Firmware Description ................................................................... 15 2.2 Data Acquisition ........................................................................................... 16 2.3 UART Communication Protocol ................................................................... 18 Chapter 3. MCP3901 PC Software Tool 3.1 Software Overview ....................................................................................... 21 3.2 Setting the Configuration of the ADC ........................................................... 22 3.3 Connectivity and Recording Length ............................................................. 22 3.4 Scope Plot Window - Time Domain Analysis ............................................... 22 3.5 Histogram Window – Noise Analysis ............................................................ 22 3.6 FFT Window – Frequency Domain Analysis ................................................ 23 2010 Microchip Technology Inc. DS51845B-page 3 MCP3901 ADC Evaluation Board for 16-Bit MCUs User’s Guide Appendix A. Schematics and Layouts A.1 Introduction .................................................................................................. 25 A.2 Schematic – Analog ..................................................................................... 26 A.3 Schematic – LCD and UART ...................................................................... 27 A.4 Schematic – USB and Memory .................................................................... 28 A.5 Schematic – Microcontroller (MCU) ............................................................. 29 A.6 Schematic – PIM Module ............................................................................. 30 A.7 Schematic – Power ...................................................................................... 31 A.8 Board – Top Trace and Top Silk .................................................................. 32 A.9 Board – Bottom Trace and Bottom Silk ........................................................ 32 A.10 Board – Layer #2 VDD .............................................................................. 33 A.11 Board – Layer #3 GND .............................................................................. 33 A.12 Board – Top Silk and Pads ........................................................................ 34 A.13 Board – Bottom Top Silk and Pads ............................................................ 34 Appendix B. Bill Of Materials (BOM) Worldwide Sales and Service .....................................................................................38 DS51845B-page 4 2010 Microchip Technology Inc. MCP3901 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 MCP3901 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 MCP3901 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 MCP3901 ADC Evaluation Board for 16-Bit MCUs hardware. • Chapter 2. “Firmware”– Describes the MCP3901 ADC Evaluation Board for 16-Bit MCUs firmware. • Chapter 3. “MCP3901 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 MCP3901 ADC Evaluation Board for 16-Bit MCUs. • Appendix B. “Bill Of Materials (BOM)” – Lists the parts used to build the MCP3901 ADC Evaluation Board for 16-Bit MCUs. 2010 Microchip Technology Inc. DS51845B-page 5 MCP3901 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 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 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 Represents code supplied by user DS51845B-page 6 Examples File>Save Press <Enter>, <F1> #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} var_name [, var_name...] void main (void) { ... } 2010 Microchip Technology Inc. Preface RECOMMENDED READING This user's guide describes how to use MCP3901 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: MCP3901 Data Sheet - “Two Channel Delta Sigma A/D Converter”, DS22192 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 (July 2009) • Initial Release of this Document. Revision B (October 2010) • Minor grammatical changes throughout document. No technical information has changed. 2010 Microchip Technology Inc. DS51845B-page 7 MCP3901 ADC Evaluation Board for 16-Bit MCUs User’s Guide NOTES: DS51845B-page 8 2010 Microchip Technology Inc. MCP3901 ADC EVALUATION BOARD FOR 16-BIT MCUs USER’S GUIDE Chapter 1. Hardware Description 1.1 OVERVIEW The MCP3901 ADC Evaluation Board for 16-Bit MCUs system provides the ability to evaluate the performance of the MCP3901 dual channel ADC. It also provides a development platform for 16-bit PIC® MCU-based applications, using existing 100-pin Plug-in Module (PIM) systems compatible with the Explorer 16 and other high pin count PIC MCU demo boards. The system comes with programmed dsPIC33FJ256GP710 PIM modules that communicate with the LabVIEW™ software GUI for data exchange and ADC setup. 1.1.1 Feature Highlights • Dual ADC MCP3901 output display using serial communication to PC software interface • Simultaneous 4 ksps at 90 dB SINAD and top speed of 55 ksps performance on dual MCP3901 channels • 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 MCP3901 devices. Separate power supplies and power planes – 4 layer board • PICtail™ Plus connectors for Explorer 16 daughter board compatibility 2010 Microchip Technology Inc. DS51845B-page 9 MCP3901 ADC Evaluation Board for 16-Bit MCUs User’s Guide CH0+ GND CH0- G CH1+ GND CH1- + MCP3901 G - + - + - EXT +5V Serial Connector EXT +5V +9V IN USB PIM RESET MCP3901 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 MCP3901 ADC Evaluation Board for 16-Bit MCUs FIGURE 1-1: DS51845B-page 10 MCP3901 ADC Evaluation Board for 16-Bit MCUs. 2010 Microchip Technology Inc. Hardware Description 1.2 PIM MODULE/MCP3901 CONNECTION AND PERIPHERAL USAGE OVERVIEW The MCP3901 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 is available in Chapter 1. “Hardware Description”. D6 D7 RA9/10 RB8/9/10 (Green) CONTROL SWITCHES (X3) RF2/U1RX UART SERIAL TO PC COMMUNICATION RF3/U1TX OC1/RD0 AGND DGND MDAT0 MDAT1 IC4/RD11 IC3/RD10 OSC2 DVDD Modulator Output Translation Block RA4 SCK1/RF6 SDI1/RF7 SDO1/RF8 PIM Module FIGURE 1-2: CS SCK SDO SDI SPI Serial Interface SINC3 Digital Filter INT3/RA4 DR SINC3 Digital Filter RESET AVDD Clock Generation/ Phase Correction Current Boost Circuit RA5 OSC1 INT VREF CH0+ Delta Sigma Multi-Level Modulator + PGA - CH0- Delta Sigma Multi-Level Modulator + PGA CH1+ - CH1- MCP3901 Digital Connection Overview PIM/MCP3901 Connections. Ports A, B, and D are used for signals such as push buttons, output LEDs, CS and MCLR (for MCP3901 data mode setting). Output Capture 1 is used for MCP3901’s clock generation. Serial communication is achieved through the MSSP module 1. 2010 Microchip Technology Inc. DS51845B-page 11 MCP3901 ADC Evaluation Board for 16-Bit MCUs User’s Guide 1.3 MCP3901 DELTA-SIGMA SAMPLING/MCLK OPTIONS The MCP3901 device is an ADC with a second order modulator and a third order sync filter. This Delta-Sigma A/D converter has an adjustable oversampling ratio. The CLKIN pin of the MCP3901 is the oversampling clock (MCLK) input. The MCP3901 ADC Evaluation Board for 16-Bit MCUs offers two different options for the MCP3901 master clock (MCLK). 1.3.1 Using the Crystal X2 The MCP3901 ADC Evaluation Board for 16-Bit MCUs is populated with a 3.58 MHz crystal, which is used as a clock source by placing jumpers in the following position on the MCP3901 Digital I/O header block: CLKOUT CLKIN CLKIN FIGURE 1-3: 1.3.2 XTAL XTAL PIM OC1 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 MCP3901, setting the ADC sample rate through the use of the output compare module OC1. To use this, make the following jumper change to the MCP3901 Digital I/O header block: CLKOUT CLKIN CLKIN FIGURE 1-4: XTAL XTAL PIM OC1 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). The signal frequency from OC1 can be changed by the user from the PS software by changing the value in the sampling rate control box. A low number will generate a high frequency signal. The value of the sampling rate, which is directly proportional with the clock frequency from OC1, is indicated in the sampling speed indicator box in the PC software (see Figure 3-1). DS51845B-page 12 2010 Microchip Technology Inc. Hardware Description 1.4 ANALOG INPUT STRUCTURE Two differential input paths allow external signal sources to be easily connected to the MCP3901 input. Edge connectors JP1 and JP2 are 3-pin connectors that act both as 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 MCP3901 ADC Evaluation Board for 16-Bit MCUs also contains a USB connection for higher speed sampling and data collection. The circuit includes a 512x8 SRAM for data collection. Figure 1-5 summarizes the connections between the ADC, the two microcontrollers and memory. Note: For the MCP3901 ADC Evaluation Board for 16-Bit MCUs release, no USB firmware is supplied. The PIC18F86J55 is blank and only included for development purposes. SRAM 512x8 USB PIC18F86J55 8 RD6/SCK2 2010 Microchip Technology Inc. SCK2/RG6 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: MCP3901 ADC I SERIAL USB Block Diagram. DS51845B-page 13 MCP3901 ADC Evaluation Board for 16-Bit MCUs User’s Guide NOTES: DS51845B-page 14 2010 Microchip Technology Inc. MCP3901 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 global variables ConfigHValue, ConfigLValue, GainValue, and StatusComValue are written to 0x00. These variables will be written with values received from the PC, to set up the MCP3901 as required. Next, the Initialization() function is called to set up the dsPIC33. First, interrupt nesting is configured in order to disable the user interrupts by putting the MCU priority at 7 (maximum). External interrupt 3 is enabled on the positive edge. The INT3 interrupt is enabled but the priority is set to 6. Since it is lower than 7, it will not be active until the MCU priority is decreased to less than 6. The MCU uses the FRC (7.37 MHz) with PLL. The clock on the MCU will be 80 MHz, the maximum frequency for dsPIC33, at which the computing power is 40 MIPS. Timer2 is placed on the Output Compare 1 pin (OC1), and is used to generate the master clock (MCLK) for the MCP3901. In addition, some initial values are set up for the MCP3901 clock frequency. Timer5 is configured (but not active), and the interrupt is disabled. The user can enable it for different applications. The SPI peripheral is configured, but the interrupt is disabled. The SPI interrupt will be enabled in code to establish the communication between MCU and MCP3901. The UART is used to send and receive data from the PC at a speed of 115200 baud. Timer8 and Timer9 are configured to create a 32-bit timer that runs at maximum speed. It is used to measure the time needed to fill the data buffer, so it measures the sampling speed of the MCP3901. After the execution of the Initialization() function, the MCP3901 is configured with values given by a set of functions especially developed for the MCP3901 configuration. In this case, this step is not necessary because the MCP3901 will update its configuration using data from the PC GUI. These functions are helpful for users to develop applications that do not involve a PC to configure the MCP3901. For example, AddressLoop(NONE) is used to select the loop on specific registers groups and types. DRHIZ(ON) will allow the data ready pulse to be present at the output of the MCP3901 even if there is no pull-up resistor. SetGain(1,1) configures the gain of both channels at 1. A list of all configuration functions are found in the firmware file, main.c, starting at line 345. It is important to have interrupts disabled during this configuration. Only after the MCP3901 is configured using the functions described, can the interrupts be enabled. In this case, it is done by decreasing the CPU priority to 3. 2010 Microchip Technology Inc. DS51845B-page 15 MCP3901 ADC Evaluation Board for 16-Bit MCUs User’s Guide 2.2 DATA ACQUISITION The end of a conversion is indicated with a short high pulse on the Data Ready (DR) pin of the ADC. The DR pin is connected to the External Interrupt 3 pin and is used for detecting the end of a conversion on MCP3901. In the INT3 interrupt, the SPI interrupt is activated and the first transmission on the SPI is initiated. The SPI communication that follows can be a read of the ADC conversion register or the Configuration register. CCT = 0 is a read of the ADC Conversion register, and CCT = 1 is a read of the MCP3901 Configuration register. It is possible to read the ADC conversion registers and MCP3901 configuration registers at the same time, but due to transfer volume and its impact on speed, this will prevent achieving a high sampling rate. SPI communication is always in 8-bit mode. External Interrupt 3 Detected Clear External Interrupt 3 Flag Disable External Interrupt 3 Enable SPI1 Interrupt Tight to GND CS to Select MCP3901 Turn ON Red LED If CCT = 0 (If true, follows the reading of the ADC results) YES Send on SPI 0b00000001 (Read Address 0 – CH0 MSB) NO If CCT = 1 (If true, follows the reading of the ADC configuration registers) YES Send on SPI 0b00001101 (Read Address 6 – ModOut) Exit External Interrupt 3 FIGURE 2-1: INT3 Flowchart. An SPI interrupt takes place after each successful data transfer between master and slave on the SPI. As with any interrupt, the first thing to do is to clear the interrupt flag; otherwise, a new interrupt will occur without reason. The CCSPI global value is the counter that indicates if the SPI transfer that is occuring is the first, the second, etc. After saving the samples into the MCU, SPI communication is disabled by setting CS high. If CCT was ‘0’, then the data that comes from the MCP3901 is ADC conversion data and will be converted from 3 bytes into an unsigned long number. This 24-bit value will be saved into the current or voltage buffers. DS51845B-page 16 2010 Microchip Technology Inc. Firmware When the first sample is written in the buffer, the 32-bit timer created using Timer8 and 9, begins counting from 0. When the last sample is written into the buffer, the 32-bit timer is read. The value indicated will be used to compute the sampling speed. If the CCT is 1, then the data read from the MCP3901 will be the configuration data. This will be saved in MCU in other global variables, used later to send this info to the PC GUI. After the SPI communication completes, the SPI interrupt will be disabled and the UART TX interrupt will be enabled. The first character sent on UART is char 33; this is the header of the UART communication protocol that is adopted here. SPI1 Transfer Interrupt Clear Flag; Read SPI1BUF; Read Address Loop Bits from Status Registr YES If Address Loop = NONE? Send 12 transfers on the SPI to read the content of the 6 registers that are holding the ADC result; Compute the 24-bit value for each channel and save it in voltage and current buffers; At the first sample, read start timer 32-bit Timer8:9; At the read of the last sample, read the Timer8:9 content (for sampling speed measurement) NO Send 6 transfers on the SPI to read the content of the 6 registers that are holding the ADC result; Compute the 24-bit value for each channel and save it in voltage and current buffers; At the first sample read, start timer 32-bit Timer8:9; At the read of the last sample, read the Timer8:9 content (for sampling speed measurement) Read Modulator Output register; Read Phase register; Read Gain register; Read Status register; Read Configuration High register; Read Configuration Low register Read Modulator Output register; Read Phase register; Read Gain register; Read Status register; Read Configuration High register; Read Configuration Low register Disable SPI interrupt; Enable UART TX interrupt; Sent the char 0d33 on UART Exit SPI Interrupt FIGURE 2-2: SPI Routine Flowchart. 2010 Microchip Technology Inc. DS51845B-page 17 MCP3901 ADC Evaluation Board for 16-Bit MCUs User’s Guide 2.3 UART COMMUNICATION PROTOCOL The MCU uses the UART to send and receive data to the PC. The TX and RX interrupts are not used simultaneously in this firmware example, but it is possible to do so, if the user requires it. As soon as the buffer is filled with data from the ADC, the SPI interrupt is disabled, and the TX interrupt is enabled. There are more types of data to be sent from the MCU to the PC. The first to be sent is the data stored in the buffers. Before being sent, each number is translated to ASCII characters that represent the number stored in the buffer. The start of the buffer data transmissions is acknowledged by transmitting the character: “!”. The numbers in the current buffer are comma delimited, and each row ends with the characters “0x0D”. After 512 rows, the buffer data transmission is complete, which is signaled by sending out the character “D”. Next, the data regarding the MCP3901 configuration and sampling speed is sent out. After a total of 35 characters are sent, the MCP3901 configuration data is fully transmitted, which is signaled by sending the character “;” to the PC. This character also signals that the result of an FFT computation will be sent out next. In the last UART TX interrupt, the TX interrupt is disabled and the RX interrupt is enabled. Through the RX interrupt, the MCU will receive the configuration for the MCP3901 desired by the user. The protocol is simple. The first character received must be “D” from configuration data. Following this character will be the values of 6 registers: PHASE, GAIN, CONFIGH, CONFIGL, STATUS, PPREG8. The first 5 registers can hold values from 0 to 255, so they are made up of a maximum 3 characters. If the equivalent number is less than 100, the first character will be the space character (“ ”), not zero. The PREG8 register is a 16-bit register inside the MCU that controls the frequency of the clock signal from OC1, which controls the sampling speed of the MCP3901. Since it is a 16-bit register, the number of characters that create the correct value is 5. DS51845B-page 18 2010 Microchip Technology Inc. Firmware UART TX Interrupt contrd<=512? NO YES Get CH0 sample from current[contrd]; Change Long into 8 digit string; write character “,” to val[8]; Get CH1 samples from voltage[contrd]; Change the value in 8 digit string; Write char CR to val[17] contrd=513? NO YES Send char “D”; Increment contrd NO contrd2<=17? NO contrd=514? YES YES contrd2=0; Increment contrd Send val[contrd2]; Increment contrd2 NO contrd=515? YES NO Contrd==515+ REAL_N+1? YES Contrd<=515+REAL_N? YES Transform the FFT result of the voltage channel from int to 5 chars; Transform the FFT result of the current channel from int to 5 chars; (IN CURRENT FIRMWARE FFT IS NOT COMPUTED) Disable UART TX interrupt; Contrd=515+REAL_N+2; Enable UART RX interrupt Sent to PC char “;”; Increment contrd NO Transform MODr from byte in 3 chars; Transform PHASEr from byte in 3 chars; Transform GAINr from byte in 3 chars; Transform STATUSr form byte in 3 chars Transform CONFIGHr from byte in 3 chars; Transform CONFIGLr from byte in 3 chars; Transform Timer8 from int in 5 chars; Transform Timer9 form int in 5 chars Contrd2<=35? NO Contrd2=36? NO Reset contrd2; Increment contrd Send one char to PC Increment contrd2 Contrd2<=11? YES YES Reset contrd2; Increment contrd Sent char to PC; Increment contrd2 Exit UART TX Interrupt FIGURE 2-3: Serial Transmission Flowchart. 2010 Microchip Technology Inc. DS51845B-page 19 MCP3901 ADC Evaluation Board for 16-Bit MCUs User’s Guide NOTES: DS51845B-page 20 2010 Microchip Technology Inc. MCP3901 ADC EVALUATION BOARD FOR 16-BIT MCUs USER’S GUIDE Chapter 3. MCP3901 PC Software Tool 3.1 SOFTWARE OVERVIEW The MCP3901 ADC Evaluation Board for 16-Bit MCUs includes a PC Graphical User Interface (GUI) that performs: • ADC configuration • Data analysis for easier system debugging • Device evaluation Figure 3-1 shows a sample of the software’s GUI. FIGURE 3-1: MCP3901 Data View Interface. 2010 Microchip Technology Inc. DS51845B-page 21 MCP3901 ADC Evaluation Board for 16-Bit MCUs User’s Guide 3.2 SETTING THE CONFIGURATION OF THE ADC The MCP3901 Data View sets up the configuration registers of the MCP3901 by putting the desired value on the “Write Registers” tab. Usually, it takes a few seconds to update the MCP3901 configuration. To learn the configuration of the MCP3901 without changing it, click on the “Read Registers” tab and the same image as in “Write Registers” will display. The difference is that the controls will be indicators, and the user cannot change the values, but can only read the setup of the MCP3901. 3.3 CONNECTIVITY AND RECORDING LENGTH The PC is connected to the MCP3901 ADC Evaluation Board for 16-Bit MCUs through the RS232 cable. It is important to have a COM port on the PC. It is also possible to use a USB to RS232 adaptor cable, but the user will need to note 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 parenthesis after the device name. The COM port number must be selected in the “VISA Resource Name” field. The MCU sends a large package of data to the PC. If the user only needs to see a small part of the buffer, define the desired buffer length in the “Buffer Length” field. The maximum length is 512 samples. The average control can be used to view the impact of averaging over the ADC accuracy. The number of points in the waveform graph will be less than the number written in the “Buffer Length” control by a ratio equal with the value of the average. A value equal to zero will cause an error. A value of ‘1’ means that no averaging is done. When the program is opened for the first time, the value from the controls will have some default values. The user must set up the communication port before starting the acquisition by pressing the START button. To stop the acquisition, press the STOP button. Close the MCP3901 Data View application by clicking the “X” in the upper right corner of the window. 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 axis is given by the number written in the “Buffer Length” field. On the Y axis, the LSBs are indicated. To scale the time axis, it is necessary to modify either the buffer length (the number of points indicated in the waveform graph), or to change the sampling rate of the ADC. The sampling rate of the ADC can be changed from the “Sampling Speed Control” box. Writing a small value will achieve a high sampling rate. The correct value of the sampling rate is indicated in the “Sampling Speed Indicator”. The highest sampling speed that can be obtained is 55 ksps by setting: OSR = 32, Addr Loop = ALL and Sampling Speed Control = 5. 3.5 HISTOGRAM WINDOW – NOISE ANALYSIS For the evaluation of the Effective Number Of Bits (ENOB), the GUI will compute a few statistical parameters: the mean value, standard deviation, and variance for each channel. These parameters display at the bottom of the GUI, under the Histogram Graph screens. The formula used for the ENOB in the case of a DC signal is seen in Equation 3-1, if the application indicates the acquired data on 16 bits. EQUATION 3-1: ENOB = 16 – log 2 DS51845B-page 22 2010 Microchip Technology Inc. MCP3901 PC Software Tool Use Equation 3-2 if the data is represented on 24 bits. EQUATION 3-2: ENOB = 24 – log 2 ENOB can also be computed when an AC signal is applied at the input. The formula to compute ENOB in an AC case is shown in Equation 3-3. EQUATION 3-3: SINAD – 1.76 ENOB = ---------------------------------6.02 The distribution of noise from the acquired signal displays on the Histogram Graph screens.These graphs indicate how many times a code was present inside a buffer. 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 axis to be linear or logarithmic. A logarithmic scale on the 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 scaled directly in Hz units. 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 the GUI performs 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, under the Histogram Graph screens. 2010 Microchip Technology Inc. DS51845B-page 23 MCP3901 ADC Evaluation Board for 16-Bit MCUs User’s Guide NOTES: DS51845B-page 24 2010 Microchip Technology Inc. MCP3901 ADC EVALUATION BOARD FOR 16-BIT MCUs USER’S GUIDE Appendix A. Schematics and Layouts A.1 INTRODUCTION This appendix contains the following schematics and layouts of the MCP3901 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 2010 Microchip Technology Inc. DS51845B-page 25 MCP3901 ADC Evaluation Board for 16-Bit MCUs User’s Guide SCHEMATIC – ANALOG M A.2 DS51845B-page 26 2010 Microchip Technology Inc. Schematics and Layouts SCHEMATIC – LCD AND UART M A.3 2010 Microchip Technology Inc. DS51845B-page 27 MCP3901 ADC Evaluation Board for 16-Bit MCUs User’s Guide SCHEMATIC – USB AND MEMORY M A.4 DS51845B-page 28 2010 Microchip Technology Inc. Schematics and Layouts SCHEMATIC – MICROCONTROLLER (MCU) M A.5 2010 Microchip Technology Inc. DS51845B-page 29 MCP3901 ADC Evaluation Board for 16-Bit MCUs User’s Guide SCHEMATIC – PIM MODULE M A.6 DS51845B-page 30 2010 Microchip Technology Inc. Schematics and Layouts SCHEMATIC – POWER M A.7 2010 Microchip Technology Inc. DS51845B-page 31 MCP3901 ADC Evaluation Board for 16-Bit MCUs User’s Guide A.8 BOARD – TOP TRACE AND TOP SILK MCP3901 ADC Eval Board for 16-bit MCU A.9 BOARD – BOTTOM TRACE AND BOTTOM SILK DS51845B-page 32 2010 Microchip Technology Inc. Schematics and Layouts A.10 BOARD – LAYER #2 VDD A.11 BOARD – LAYER #3 GND 2010 Microchip Technology Inc. DS51845B-page 33 MCP3901 ADC Evaluation Board for 16-Bit MCUs User’s Guide A.12 BOARD – TOP SILK AND PADS MCP3901 ADC Eval Board for 16-bit MCU A.13 BOARD – BOTTOM TOP SILK AND PADS DS51845B-page 34 2010 Microchip Technology Inc. MCP3901 ADC EVALUATION BOARD FOR 16-BIT MCUs USER’S GUIDE Appendix B. Bill Of Materials (BOM) TABLE B-1: Qty BILL OF MATERIALS Reference Description Manufacturer ® Part Number 30 C11<>C22 CAP CER .1UF 25V 10% X7R 0603 Murata Electronics C24<>C30 C33, C34, C35, C36, C39, C40, C43 C47, C48, C49 C50 GRM188R71E104KA01D 2 C2, C6 CAP CER 4.7UF 25V X5R 0805 Murata Electronics GRM21BR61E475KA12L 2 C21, C4 CAP CER 10UF 16V X5R 0805 Murata Electronics GRM21BR61C106KE15L 1 C23 CAPACITOR TANT 47UF 6.3V 20% Kemet® Electronics SMD Corp. T491A476M006AT 5 C3, C5, C44 C45, C46 CAP CER .1UF 25V 10% X7R 0805 Murata Electronics GRM21BR71E104KA01L 6 C31, C32, C37 CAP CER 18PF 50V 5% C0G 0603 Murata Electronics C38, C41, C42 North America GRM1885C1H180JA01D 4 C7, C8, C9, C10 CAP CER 68000PF 50V C0G 1206 Murata Electronics GRM31C5C1H683JA01L 2 D1, D6 LED 570NM GRN WHT/DIFF 0603 SMD Rohm SML-512MWT86 2 D2, D7 LED RED 470NM CLEAR LENS (0603 Red) PARA LIGHT L-C192KRCT-U1 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 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 1 J1 CONN POWERJACK MINI .08" R/A Switchcraft Inc. T/H RAPC722X 1 J2 Mini USB Type B Surface Mount SAMTEC MUSB-05-S-B-SM-A 1 J3 CONN D-SUB RCPT R/A 9POS 15GOLD Tyco® Electronics Amp 1734354-2 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, P8, JP6 11 X 2 Header 2.54mm on center 6 SAMTEC mm/2.5mm TSW-111-07-G-D Note 1: The components listed in this Bill of Materials are representative of the PCB assembly. The released BOM used in manufacturing uses all RoHS-compliant components. 2010 Microchip Technology Inc. DS51845B-page 35 MCP3901 ADC Evaluation Board for 16-Bit MCUs User’s Guide TABLE B-1: Qty BILL OF MATERIALS (CONTINUED) Reference Description Manufacturer Part Number 1 L1 Shielded 10uH Power Inductor 0805 Coilcraft 0805PS-103KLC 1 LCD2 16X2 FTN Reflective No. BLWT COG 3V TianMa TM162JCAWG1 4 MOD1 25 X 1 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 1 P3 TERM BLK PIN HEADER 24Pin Pos One 24 Pin Header is enough for 3 Boadrs Keystone Electronics 8724 1 P5 10 X 2 Header 2.54mm on center 6 SAMTEC mm/2.5mm TSW-110-07-G-D 1 PCB RoHS Compliant Bare PCB, MCP3901 Eval Board for 16-bit MCU Microchip Technology Inc. 104-00221 4 R13, R19 R23, R30 RES 4.70K OHM 1/10W 1% 0603 SMD Rohm MCR03EZPFX4701 8 R14, R20, R24 RES 1.00K OHM 1/10W 1% 0603 R3, R32, R33 SMD R36, R37 Rohm MCR03EZPFX1001 3 R15, R21, 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 RES 100 OHM 1/10W 1% 0603 R42, R43, R45 SMD R46, R47, R48 R49, R50, R53 R54, R55, R56 R58, R63, R64 R65, R66, R67 R68, R69, R77 R78, R79, R80 Rohm MCR03EZPFX1000 7 R44, R70, R71 RES 100K OHM 1/10W 1% 0603 R72, R74, R75 SMD R76 Rohm MCR03EZPFX1003 4 R5, R7 R11, R12 RES 1.0K OHM .1% 1/4W 0805 SMD Susumu Co Ltd RGH2012-2E-P-102-B 2 R59, R60 RES 10.0 OHM 1/8W 1% 0805 SMD Rohm MCR10EZHF10R0 4 SW1, SW2 SW3, SW4 SWITCH TACT 6MM 230GF H=4.3MM Omron Electronics Inc-ECB Div B3S-1002P Note 1: The components listed in this Bill of Materials are representative of the PCB assembly. The released BOM used in manufacturing uses all RoHS-compliant components. DS51845B-page 36 2010 Microchip Technology Inc. Bill Of Materials (BOM) TABLE B-1: Qty BILL OF MATERIALS (CONTINUED) Reference Description Manufacturer Part Number 1 TP1 Wire Test Point 0.3" Length 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 PIC18F86J55-I/PT 1 U3 IC REG LDO 800MA 3.3V SOT-223 National Semiconductor® LM1117MP-3.3/NOPB 1 U4 IC ENERGY METER 24SSOP Microchip Technology Inc. MCP3901-I/SS 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 SN75C3223PW 1 U8 2.7V Voltage Supervisor SOT-23-3 Microchip Technology Inc. MCP130T-270I/TT 1 X1 CRYSTAL 48.0000MHZ 10PF SMD Abracon Corporation ABM3B-48.000MHZ-10-1-U-T 1 X2 CRYSTAL 3.579545MHZ 18PFFUND SMD ABLS-3.579545MHZ-B2-T 1 X3 CRYSTAL 7.3728MHZ 18PF FUND Abracon Corporation SMD Microchip Abracon Corporation ABLS-7.3728MHZ-B2-T The components listed in this Bill of Materials are representative of the PCB assembly. The released BOM used in manufacturing uses all RoHS-compliant components. Note 1: TABLE B-2: Qty Component Corporation PJ-202-30 BILL OF MATERIALS — COMPONENTS NOT INSTALLED Reference Description Manufacturer Part Number J4 DO NOT INSTALL 120-pin MINI EDGE CARD SOCKET SAMTEC MEC1-160-02-L-D-A 1 LCD1 DO NOT INSTALL — — 1 P9 DO NOT INSTALL — — 13 R1, R2, R3, DO NOT INSTALL R4 R6, R8, R9, R10, R17, R18, R25 R29, R35 — — 1 U7 — — Note 1: DO NOT INSTALL The components listed in this Bill of Materials are representative of the PCB assembly. The released BOM used in manufacturing uses all RoHS-compliant components. 2010 Microchip Technology Inc. DS51845B-page 37 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-3090-4444 Fax: 91-80-3090-4123 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 Cleveland Independence, OH Tel: 216-447-0464 Fax: 216-447-0643 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 - Chongqing Tel: 86-23-8980-9588 Fax: 86-23-8980-9500 Korea - Seoul Tel: 82-2-554-7200 Fax: 82-2-558-5932 or 82-2-558-5934 China - Hong Kong SAR Tel: 852-2401-1200 Fax: 852-2401-3431 Malaysia - Kuala Lumpur Tel: 60-3-6201-9857 Fax: 60-3-6201-9859 China - Nanjing Tel: 86-25-8473-2460 Fax: 86-25-8473-2470 Malaysia - Penang Tel: 60-4-227-8870 Fax: 60-4-227-4068 China - Qingdao Tel: 86-532-8502-7355 Fax: 86-532-8502-7205 Philippines - Manila Tel: 63-2-634-9065 Fax: 63-2-634-9069 China - Shanghai Tel: 86-21-5407-5533 Fax: 86-21-5407-5066 Singapore Tel: 65-6334-8870 Fax: 65-6334-8850 China - Shenyang Tel: 86-24-2334-2829 Fax: 86-24-2334-2393 Taiwan - Hsin Chu Tel: 886-3-6578-300 Fax: 886-3-6578-370 China - Shenzhen Tel: 86-755-8203-2660 Fax: 86-755-8203-1760 Taiwan - Kaohsiung Tel: 886-7-213-7830 Fax: 886-7-330-9305 China - Wuhan Tel: 86-27-5980-5300 Fax: 86-27-5980-5118 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 - Xiamen Tel: 86-592-2388138 Fax: 86-592-2388130 China - Zhuhai Tel: 86-756-3210040 Fax: 86-756-3210049 08/04/10 DS51845B-page 38 2010 Microchip Technology Inc.