MPLAB Starter Kit for dsPIC® Digital Signal Controllers User’s Guide © 2008 Microchip Technology Inc.
Note the following details of the code protection feature on Microchip devices: • Microchip products meet the specification contained in their particular Microchip Data Sheet. • Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions. • There are dishonest and possibly illegal methods used to breach the code protection feature.
MPLAB STARTER KIT FOR dsPIC® DIGITAL SIGNAL CONTROLLERS USER’S GUIDE Table of Contents Preface ........................................................................................................................... 1 Chapter 1. Introduction 1.1 Overview ........................................................................................................ 7 1.2 Operational Requirements ............................................................................. 8 1.3 Board Setup .....................
MPLAB Starter Kit for dsPIC® DSCs User’s Guide NOTES: DS51700A-page iv © 2008 Microchip Technology Inc.
MPLAB STARTER KIT FOR dsPIC® DIGITAL SIGNAL CONTROLLERS 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.
MPLAB Starter Kit for dsPIC® DSCs User’s Guide • Chapter 4. Hardware – This chapter provides a functional overview of the starter kit and identifies the major hardware components. • Appendix A. Schematics – This appendix provides detailed schematic diagrams of the starter kit.
Preface RECOMMENDED READING This user's guide describes how to use the MPLAB Starter Kit for dsPIC Digital Signal Controllers. Other useful documents are listed below. The following Microchip documents are available and recommended as supplemental reference resources. Readme Files For the latest information on using other tools, read the tool-specific Readme files in the Readmes subdirectory of the MPLAB IDE installation directory.
MPLAB Starter Kit for dsPIC® DSCs User’s Guide 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.
Preface 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.
MPLAB Starter Kit for dsPIC® DSCs User’s Guide NOTES: DS51700A-page 6 © 2008 Microchip Technology Inc.
MPLAB STARTER KIT FOR dsPIC® DIGITAL SIGNAL CONTROLLERS USER’S GUIDE Chapter 1. Introduction Thank you for purchasing Microchip Technology's MPLAB Starter Kit for dsPIC® Digital Signal Controllers. This kit is intended to introduce and demonstrate the features of the dsPIC33F Digital Signal Controllers (DSCs), and, in particular, some of the speech and audio processing capabilities of dsPIC DSC devices.
MPLAB Starter Kit for dsPIC® DSCs User’s Guide 1.2 OPERATIONAL REQUIREMENTS To communicate with and program the MPLAB Starter Kit for dsPIC Digital Signal Controllers, the following hardware and software requirements must be met: • • • • PC compatible system An available USB port on PC or powered USB hub CD-ROM drive Windows® 2000 SP4, Windows XP SP2, and Windows Vista™ (32-Bit)* Operating Systems * Only initial testing has been performed on 32-bit Vista for this release.
MPLAB STARTER KIT FOR dsPIC® DIGITAL SIGNAL CONTROLLERS USER’S GUIDE Chapter 2. Speech Record and Playback Demo This chapter describes the Speech Record and Playback Demonstration application that is preloaded on the dsPIC33F device. This application demonstrates how to use the starter kit for speech capture, speech playback, speech encoding and decoding, and using the serial Flash memory to store speech samples. Topics covered include: • • • • 2.
MPLAB Starter Kit for dsPIC® DSCs User’s Guide 2.2 UNDERSTANDING THE DEMO The dsPIC33F device on the starter kit is pre-programmed with a Speech Record and Playback Demonstration application. The CD that accompanies the starter kit contains the application code. As shown in Figure 2-1, this sample application uses the board to capture an input microphone signal using the audio codec.
Speech Record and Playback Demo 2.2.2 G.711 Speech Encoder and Decoder The G.711 Encoder and Decoder implement the ITU-T G.711 Speech Compression algorithm. This algorithm is an example of a waveform coder and provides a compression ratio of 2:1. The algorithm is implemented in G711.s and its interface is defined by G711.h 2.2.3 Serial Flash Memory Driver The Serial Flash Memory driver uses the SPI peripheral on the dsPIC33F device to interface with the external serial Flash memory device.
MPLAB Starter Kit for dsPIC® DSCs User’s Guide FIGURE 2-2: APPLICATION FLOW CHART – PART ONE START Initialize Audio Codec Driver Initialize Flash Memory Driver Start Audio Codec Driver Start Flash Memory Driver B* No No Record = 1? Playback = 1? Yes Play back Intro Message Yes No Is Flash Erased? Erase Flash Red LED On A* C* Yes Yellow LED On Read Codec Data G.
Speech Record and Playback Demo FIGURE 2-3: APPLICATION FLOW CHART – PART TWO A Read Serial Flash Green LED On G.711 μ-Law Decode Output Audio Data to Codec Yes End of Message? Rewind Playback Pointer No C Yes Switch 1 Active? Record = 1 Stop Playback No Yes Switch 2 Active? Playback = 1 Stop Record No B © 2008 Microchip Technology Inc.
MPLAB Starter Kit for dsPIC® DSCs User’s Guide 2.4 OTHER DEMO CODE EXAMPLES The starter kit software CD includes other demo code examples. The SASK Record Play Demo with Intro Code Example demonstrates the low-cost speech capture and playback option. It uses the dsPIC DSC 12-bit ADC to capture speech samples. The data is stored in the serial Flash memory. The application then uses the Output Compare module in Pulse-Width Modulation (PWM) mode to generate a PWM signal representing the speech signal.
MPLAB STARTER KIT FOR dsPIC® DIGITAL SIGNAL CONTROLLERS USER’S GUIDE Chapter 3. Develop an Application The MPLAB Starter Kit for dsPIC® Digital Signal Controllers may be used with MPLAB IDE, the free integrated development environment available on Microchip’s website. MPLAB IDE allows the starter kit to be used as an in-circuit debugger as well as a programmer for the featured device.
MPLAB Starter Kit for dsPIC® DSCs User’s Guide 3.2 SETTING UP AN EXAMPLE APPLICATION FOR DEBUG The MPLAB IDE software that is installed on your PC by the starter kit CD-ROM automatically opens an example application that you may use to examine debug features of the starter kit. To prepare the application for debug: 1. Launch MPLAB IDE. The example application project and related workspace will open.
Develop an Application 3.3 RUNNING THE EXAMPLE APPLICATION The starter kit executes in either real-time (Run) or steps (Step Into, Step Over, Animate.) Real-time execution occurs when you select Run in MPLAB IDE. Once the device code is halted, either by Halt or a breakpoint, you can step.
MPLAB Starter Kit for dsPIC® DSCs User’s Guide 3.4.1 Editing Application Code To view application code so it may be edited, do one of the following: • Select Edit>New to create new code or Edit>Open to search for and open an existing code file. • Double click on a file in the Project window to open an existing code file. See an example Project window in Figure 3-2. FIGURE 3-2: EXAMPLE PROJECT Existing Code File For more information on using the editor to create and edit code, see MPLAB Editor Help. 3.
Develop an Application A breakpoint set in code will appear as a red hexagon with a “B” as shown in Figure 3-3. FIGURE 3-3: EXAMPLE BREAKPOINT Once code is halted, hovering over variables pops up the current value of those variables (see Figure 3-3.) Note: 3.4.3 This feature must be set up. See Edit>Properties, Tooltips tab, check the “Enable Variable Mouseover Values” checkbox. Using Watch Windows To use a Watch window: 1. The Watch window is made visible on the desktop by selecting View>Watch.
MPLAB Starter Kit for dsPIC® DSCs User’s Guide 3.5 PROGRAMMING THE DEBUGGED APPLICATION When the program is successfully debugged and running, the next step is to program the device for stand-alone operation in the finished design. When doing this, the resources reserved for debug are released for use by the application. To program the application, use the following steps: 1. Disable Starter Kits as a debug tool by selecting Debugger>Select Tool>None. 2.
Develop an Application 3.8 TROUBLESHOOTING Debug Connection Problems While using the starter kit as a debugger, you may get the error “Unable to Enter Debug Mode” when programming the device. This can result from communication being lost between the starter kit and MPLAB IDE. To resolve this: 1. Unplug the USB cable from the starter kit. 2. Plug the USB cable back into the starter kit. MPLAB IDE should automatically reconnect to the starter kit. If this does not work, do the following: 1.
MPLAB Starter Kit for dsPIC® DSCs User’s Guide NOTES: DS51700A-page 22 © 2008 Microchip Technology Inc.
MPLAB STARTER KIT FOR dsPIC® DIGITAL SIGNAL CONTROLLERS USER’S GUIDE Chapter 4. Hardware This chapter provides a functional overview of the MPLAB Starter Kit for dsPIC® Digital Signal Controllers and identifies the major hardware components. Topics covered include: • Audio Functional Overview • Debug Functional Overview • Board Components 4.1 AUDIO FUNCTIONAL OVERVIEW The block diagram shown in Figure 4-1 illustrates the mainstream operation of the starter kit.
MPLAB Starter Kit for dsPIC® DSCs User’s Guide The amplifier has a variable gain from 3 db to 23 db, which can be adjusted to control microphone sensitivity or boost a low line-input signal. The output of the amplifier is biased at 1.65V. 4.1.2 Speech Playback The mainstream speech playback interface processes the PWM digital signal from the Output Compare module of the dsPIC33F device. A low-pass filter demodulates the PWM signal as shown in Figure 4-2.
Hardware 4.2 DEBUG FUNCTIONAL OVERVIEW The block diagram shown in illustrates the debugging/programming operation of the starter kit. STARTER KIT DEBUG BLOCK DIAGRAM USB Mini-B Jack 12 MHz Crystal 3.3V LDO Regulator Status LEDs SPI PIC18F67J50 Device Serial EEPROM 25LC010A ICSP™ FIGURE 4-3: dsPIC33F Device The starter kit, with its built-in debugger/programmer, provides an all-in-one solution for debugging and programming applications using MPLAB IDE.
MPLAB Starter Kit for dsPIC® DSCs User’s Guide 4.3 BOARD COMPONENTS Figure 4-4 identifies the key starter kit hardware components.
Hardware 4.3.1 Debug Components The following components support the debug function of the starter kit. See Appendix A. “Schematics” for debug schematics. 4.3.1.1 MINI-B USB CONNECTOR (J1) Provides system power and bidirectional communication between the host PC and starter kit. 4.3.1.2 MCP1727 (U1) 3.3V Linear regulator. Regulates the USB unregulated voltage to 3.3 volts (with respect to VSS) and supplies the starter kit with system power. 4.3.1.
MPLAB Starter Kit for dsPIC® DSCs User’s Guide 4.3.2.4 PWM LOW PASS FILTER (U8:A,B) The PWM signal from the Output Compare module on the dsPIC33F device on the board is demodulated by the PWM low-pass filter (Ref A4). This fourth-order filter uses two op-amps (U8:A and U8:B) on the MCP6022 quad op-amp IC. 4.3.2.5 OUTPUT SELECT JUMPER (J6) The Output Select Jumper (Ref A5) determines whether the input signal for the Headphone Amplifiers comes from the PWM filter or the audio codec.
Hardware 4.3.2.12 MICROPHONE GAIN CONTROL (R56) MIC ADJ Potentiometer R56 (Ref A12) controls the gain of the Line/Microphone Pre-Amplifier (U10:A). The default setting is with the arrow on the potentiometer pointing to the arrow on the board. Note: 4.3.2.13 Setting the gain too high can cause the output of the amplifier to saturate and clip. LINE/MICROPHONE PRE-AMPLIFIER (U10:A) The Microphone/Line Pre-amplifier (Ref A13) is implemented using one of the four op-amps on the MCP6024 quad op-amp IC (U10).
MPLAB Starter Kit for dsPIC® DSCs User’s Guide NOTES: DS51700A-page 30 © 2008 Microchip Technology Inc.
MPLAB STARTER KIT FOR dsPIC® DIGITAL SIGNAL CONTROLLERS USER’S GUIDE Appendix A.
MPLAB Starter Kit for dsPIC® DSCs User’s Guide FIGURE A-2: DEBUG INPUT AND CONTROL SCHEMATIC – PART 2 PIC18F67J50 Bypass/Decoupling Capacitors Serial EEPROM Status LED - Debug FIGURE A-3: USB Interface (Bus Powered) DS51700A-page 32 USB INTERFACE/TARGET POWER SWITCHING SCHEMATIC 3.3V LDO Linear Regulator Status LED System Power Host MCU Switchable 3.3V Regulated Supply © 2008 Microchip Technology Inc.
Schematics FIGURE A-4: SPEECH PROCESSING SCHEMATIC dsPIC33FJ256GP506 FIGURE A-5: FLASH MEMORY SCHEMATICS 4 Mbit High Speed SPI Serial Flash Memory 4 Mb (512k x 8) © 2008 Microchip Technology Inc. Flash Memory 3.
MPLAB Starter Kit for dsPIC® DSCs User’s Guide FIGURE A-6: OUTPUT COMPARE MODULE PWM FILTERS SCHEMATIC FIGURE A-7: AUDIO CODEC SCHEMATIC FIGURE A-8: AUDIO INPUT SCHEMATIC MIcrophone/Line Input Pre-Amplifier Anti-Aliasing Filter 10 DS51700A-page 34 © 2008 Microchip Technology Inc.
Schematics FIGURE A-9: AUDIO OUTPUT SCHEMATIC Power Amplifier for Headphone FIGURE A-10: USER LEDS, USER SWITCHES AND TEMP SENSOR SCHEMATICS User LEDs User Switches Temperature Sensor © 2008 Microchip Technology Inc.
MPLAB Starter Kit for dsPIC® DSCs User’s Guide NOTES: DS51700A-page 36 © 2008 Microchip Technology Inc.
MPLAB STARTER KIT FOR dsPIC® DIGITAL SIGNAL CONTROLLERS USER’S GUIDE Index A O Audio Codec Schematic........................................... 34 Audio I/O Schematics .........................................34, 35 OCPWM Filters Schematic ...................................... 34 B Playback................................................................... 24 Programmer ............................................................. 20 PWM ...............................................................
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.
Mouser Electronics Authorized Distributor Click to View Pricing, Inventory, Delivery & Lifecycle Information: Microchip: DM330011