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, K
EELOQ, KEELOQ logo, MPLAB, PIC, PICmicro,
PICSTART, PRO MATE, rfPIC and SmartShunt are registered
trademarks of Microchip Technology Incorporated in the
U.S.A. and other countries.
AmpLab, 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, PowerCal, PowerInfo, PowerMate,
PowerTool, REAL ICE, rfLAB, Select Mode, Total Endurance,
UNI/O, WiperLock and ZENA are trademarks of Microchip
Technology Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
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
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.
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
Select the Help menu, and then Topics to open a list of available online help files.
®
IDE online help.
INTRODUCTION
This chapter contains general information that will be useful to know before you use the
MPLAB Starter Kit for dsPIC
include:
• Document Layout
• Conventions Used in this Guide
• Warranty Registration
• Recommended Reading
• The Microchip Web Site
• Development Systems Customer Change Notification Service
• Customer Support
• Document Revision History
DOCUMENT LAYOUT
This document describes how to use the starter kit as a development and demonstrative tool for dsPIC33F device’s speech and audio processing capabilities. The manual
layout is as follows:
• Chapter 1. Introduction – This chapter introduces the starter kit and provides an
overview of its features.
• Chapter 2. Speech Record and Playback Demo – This chapter describes a
simple program that demonstrates how to use the starter kit for speech capture
and playback.
• Chapter 3. Develop an Application – This chapter describes how to debug
application software on the starter kit using MPLAB
®
Digital Signal Controllers. Items discussed in this chapter
Choice of mutually exclusive
arguments; an OR selection
Represents code supplied by
user
“Save project before build”
4‘b0010, 2‘hF1
any valid filename
[options]
errorlevel {0|1}
void main (void)
{ ...
}
®
IDE User’s Guide
WARRANTY REGISTRATION
Please complete the enclosed Warranty Registration Card and mail it promptly.
Sending in the Warranty Registration Card entitles you to receive new product updates.
Interim software releases are available at the Microchip web site.
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. The Readme files
contain update information and known issues that may not be included in this user’s
guide.
dsPIC33F Family Reference Manual (DS70046)
Refer to this document for detailed information on dsPIC33F device operation. This
reference manual explains the operation of the dsPIC33F Digital Signal Controller
(DSC) family architecture and peripheral modules, but does not cover the specifics of
each device. Refer also to the appropriate device data sheet for device-specific
information and specifications.
dsPIC33F Family Data Sheet (DS70165)
This document provides an overview of the functionality of the dsPIC33F product
family. It includes device-specific information such as pinout diagrams, register maps,
electrical specifications and packaging, in addition to an overview of the CPU and
peripheral features.
This manual is a software developer’s reference for the dsPIC30F and dsPIC33F 16-bit
DSC devices. It describes the instruction set in detail and also provides general
information to assist in developing software for the dsPIC30F/33F DSC family.
MPLAB
This document helps you use Microchip Technology’s language tools for dsPIC33F and
PIC24H devices based on GNU technology. The language tools discussed are the
MPLAB ASM30 Assembler, MPLAB LINK30 Linker, MPLAB LIB30 Archiver/Librarian
and other 16-bit device utilities.
MPLAB
This document helps you use Microchip’s MPLAB C30 C compiler to develop your
application. MPLAB C30 is a GNU-based language tool, based on source code from
the Free Software Foundation (FSF). For more information about FSF, see
www.fsf.org
MPLAB
This document describes how to use the MPLAB IDE integrated development environment, as well as the MPLAB Project manager, MPLAB Editor and MPLAB SIM
simulator. Use these development tools to help you develop and debug application
code.
dsPIC
This document describes the dsPIC DSC Speech Encoding/Decoding Libraries including G.711, G.726A and Speex Speech Encoding/Decoding software application solutions. The individual libraries provide toll-quality voice compression and
decompression to help generate speech-based embedded applications on the
dsPIC30F and dsPIC33F families of digital signal controllers.
®
ASM30, MPLAB® LINK30 and Utilities User’s Guide (DS51317)
®
C30 C Compiler User’s Guide and Libraries (DS51284)
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
DEVELOPMENT SYSTEMS CUSTOMER CHANGE NOTIFICATION SERVICE
Microchip’s customer notification service helps keep customers current on Microchip
products. Subscribers will receive e-mail notification whenever there are changes,
updates, revisions or errata related to a specified product family or development tool of
interest.
To register, access the Microchip web site at www.microchip.com, click on Customer
Change Notification and follow the registration instructions.
The Development Systems product group categories are:
• Compilers – The latest information on Microchip C compilers and other language
tools. These include the MPLAB C18 and MPLAB C30 C compilers; MPASM™
and MPLAB ASM30 assemblers; MPLINK™ and MPLAB LINK30 object linkers;
and MPLIB™ and MPLAB LIB30 object librarians.
• In-Circuit Emulators – The latest information on Microchip in-circuit emulators.
These include the MPLAB REAL ICE and MPLAB ICE 2000 in-circuit emulators.
• In-Circuit Debuggers – The latest information on Microchip in-circuit debuggers.
These include MPLAB ICD 2 and PICkit™ 2.
• MPLAB IDE – The latest information on Microchip MPLAB IDE, the Windows
Integrated Development Environment for development systems tools. This list is
focused on the MPLAB IDE, MPLAB IDE Project Manager, MPLAB Editor and
MPLAB SIM simulator, as well as general editing and debugging features.
• Programmers – The latest information on Microchip programmers. These include
the MPLAB PM3 device programmer and the PICSTART
development programmers.
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
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. The starter kit demonstrates a
low-cost yet effective software technique for processing acceptable voice-quality audio.
Also, the board includes a 24-bit audio codec for high-quality audio applications. In
addition, the starter kit has on-board in-circuit debug circuitry so that you may develop
and debug your own application.
This chapter introduces the starter kit and provides an overview of its features. Topics
covered include:
•Overview
• Operational Requirements
• Board Setup
1.1OVERVIEW
The MPLAB Starter Kit for dsPIC Digital Signal Controllers connects directly to the USB
port on a computer. The PC USB connection supplies communications and power to
the board.
The starter kit includes debug and programmer circuitry that allows applications to be
programmed onto the board’s dsPIC33F device and then debugged, all using MPLAB
IDE.
Audio input signals from an external microphone or audio equipment are routed to the
ADC module in the on-board dsPIC33F device for software processing. Alternatively,
applications can use the audio codec for converting the audio signal.
Output signals can be generated by the dsPIC33F device’s Output Compare module
as a Pulse-Width Modulated (PWM) digital waveform. This PWM signal is converted to
an analog signal by a low-pass filter on the starter kit board. Alternatively, applications
can output audio data using the audio codec. The output audio signal is then amplified
using a headphone amplifier circuit for playback on a headphone.
In addition to the Recommended Reading listed in the Preface, the following
manufacturers’ data sheets are also recommended as reference sources:
• National Semiconductor Corporation Data Sheet, LM4811 Boomer
• Wolfson Microelectronics Data Sheet, WM8510 Mono CODEC with Speaker
®
Audio Power
Amplifier Series Dual 105mW Headphone Amplifier with Digital Volume Control
and Shutdown Mode (DS200061)
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
Operating Systems
* Only initial testing has been performed on 32-bit Vista for this release. 64-bit
Vista is not supported at this time.
• Headphones (not included) – See Section 4.3.2.9 “Headphone Output Jack (J8)” for requirements.
• Microphone (not included) – See Section 4.3.2.10 “Line/Microphone Input
Phone Jack (J9)” for requirements.
1.3BOARD SETUP
Figure 1-1 is a drawing of a set up MPLAB Starter Kit for dsPIC Digital Signal
Controllers. A microphone and headphone will need to be connected to the board (not
included). The USB connection provides communication and power to the board. The
demonstration software on the dsPIC33F device plays back speech stored on the
board’s serial Flash memory and allows recording and playback of recorded speech.
®
2000 SP4, Windows XP SP2, and Windows Vista™ (32-Bit)*
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:
• Running the Demo
• Understanding the Demo
• Examining Demo Software Flow
• Other Demo Code Examples
2.1RUNNING THE DEMO
To run the demo, follow these basic steps:
1. Connect a microphone to socket J9. Connect a headphone to socket J8. Ensure
that potentiometer R56 is set to the factory setting, i.e., the arrow on the
potentiometer points to the arrow on the board.
2. Power up the starter kit by connecting the board to the USB port of a computer.
You should briefly see a pop-up balloon in the system tray (lower right of desktop)
that states (1) new hardware has been found, (2) drivers are being installed, and
(3) new hardware is ready for use. If you do not see these messages and then
the starter kit does not work, try reconnecting the USB. If this does not work, see
Section 3.8 “Troubleshooting”.
3. When powered up, the application will repeatedly play back an introductory
message.
To use the application, follow these steps:
1. To record speech, press switch S1 and wait till the Red LED turns off (the serial
Flash memory is being erased) and the Yellow LED turns on. The application will
now record the microphone audio signals and store them in the serial Flash
memory.
2. Press switch S2 to playback and listen to the stored speech samples. The Green
LED turns on during playback.
3. Pressing switch S1 again erases the serial Flash memory and prepares the
system for another recording.
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. The application program
running on the device does the following:
• Reads an introductory speech message stored on the serial Flash memory and
uses the audio codec to play back the audio signal.
• If speech recording is desired, the application compresses the incoming digital
signal from 16 bits to 8 bits using the G.711 μ-law encoding algorithm and stores
the encoded speech samples on the serial flash memory.
• If playback is desired, the application reads the serial Flash memory device and
decodes the read samples using the G.711 μ-law decoding algorithm. The
application then uses the audio codec to play back the speech signal.
FIGURE 2-1:SPEECH RECORD AND PLAYBACK DEMO OVERVIEW
STARTER KIT BOARD
dsPIC33F
Data
AUDIO
CODEC
Control
DCI
2
I
C™
G.711
μ-LAW
ENCODE
G.711
μ-LAW
DECODE
SPI
Serial Flash Memory
The board also features circuitry for audio playback using the Pulse-Width Modulation
technique. This technique can be used to implement a low-cost audio playback system.
For a demo of this technique, access the starter kit’s CD-ROM.
The demo program consists of three basic software elements: WM8510 Codec Driver,
G.711 Speech Encoder and Decoder, and Serial Flash Memory Driver.
2.2.1WM8510 Codec Driver
The WM8510 Codec Driver configures the WM8510 audio codec and provides an interface for reading and writing audio data to the codec. The driver is implemented in
WM8510CodecDrv.c and the interface is defined in WM8510CodecDrv.h. The driver
uses the DCI module on the dsPIC33F device module to process data and the I
module as a codec control bus. The demo application configures the codec for a 8 KHz
sampling rate.
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.3Serial 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. The driver requires a buffer for
its operation and this buffer must be allocated by the application. The driver allows the
application to perform operations such as read, chip erase, sector erase and status
check.
2.3EXAMINING DEMO SOFTWARE FLOW
The Speech Record and Playback Demonstration application uses the WM8510
codec, G.711 speech encoding and decoding libraries, and the serial Flash memory
drivers to read, output and store speech signals with the starter kit. The application will
encode a microphone signal, store the encoded samples in serial flash memory and
play back the decoded samples to a headphone output. The G.711 μ-law algorithm is
used for encoding and decoding speech samples. Figure 2-2 and Figure 2-3 are flow
charts of the demo application.
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.
Note:Jumper J6 should in the OCPWM position to use this demo.
The SASK Intro Speech Prog code example can be used to program the introductory
message into the serial Flash. This is useful in a case where the entire serial Flash has
been erased and it is desirable to set up the introductory message again.
Note:The SASK Intro Speech Prog code example performs a full chip erase on
the serial Flash. In order to prevent accidental serial Flash chip erase when
the board is taken in and out of Reset, erase the dsPIC33F program Flash
via MPLAB IDE after the running the SASK Intro Speech Prog code
example. Refer to the readme.txt files in the project folder for more
details.
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.
In-circuit debugging allows you to run, examine and modify your program for the device
embedded in the starter kit hardware. This greatly assists you in debugging your
firmware and hardware together.
Special starter kit software interacts with the MPLAB IDE application to run, stop and
single-step through programs. Breakpoints can be set and the processor can be reset.
Once the processor is stopped, the register’s contents can be examined and modified.
For more information on how to use MPLAB IDE, reference the following
documentation:
• MPLAB
• MPLAB
• MPLAB
This chapter includes the following:
• Installing the Hardware and Software
• Setting Up an Example Application for Debug
• Running the Example Application
• Debugging the Example Application
• Programming the Debugged Application
• Creating Other dsPIC DSC Applications
• Determining Device Support and Reserved Resources
• Troubleshooting
• Settings Dialog, Info Tab
®
IDE User’s Guide (DS51519)
®
IDE Quick Start Guide (DS51281)
®
IDE On-line Help
3.1INSTALLING THE HARDWARE AND SOFTWARE
To install the hardware:
If you have not already set up the hardware to run the demo, follow these steps:
1. Connect a microphone to socket J9. Connect a headphone to socket J8. Ensure
that potentiometer R56 is set to the factory setting, i.e., the arrow on the
potentiometer points to the arrow on the board.
2. Power up the starter kit by connecting the board to the USB port of a computer.
You should briefly see a pop-up balloon in the system tray (lower right of desktop)
that states (1) new hardware has been found, (2) drivers are being installed, and
(3) new hardware is ready for use. If you do not see these messages and then
the starter kit does not work, try reconnecting the USB. If this does not work, see
Section 3.8 “Troubleshooting”.
3. When powered up, the application will repeatedly play back an introductory
message.
To install the software:
Run CD-ROM enclosed with the starter kit and install software as directed.
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. For information on projects and workspaces, see the MPLAB IDE
documentation mentioned at the beginning of this chapter.
2. Select Project>Build All
visible in the Build tab of the Output window.
3. Select Debugger>Select Tool>Starter Kits
kit debug features (Figure 3-1): (1) the status bar will show Starter Kits as the
debug tool, (2) a Starter Kit debug toolbar will be added, (3) the Debugger menu
will change to add Starter Kit debug functions and (4) the Output window will display communication status between MPLAB IDE and the stater kit on the Starter Kit Debugger tab.
Also, several device resources are used for debug. For details, see
Section 3.7 “Determining Device Support and Reserved Resources”.
FIGURE 3-1:STARTER KIT AS DEBUG TOOL
to build the application code. The build’s progress will be
. MPLAB IDE will change to add starter
2
4
3
1
4. Select Debugger>Program
DCS device on the starter kit. The debug programming progress will be visible in
the Starter Kit tab of the Output window.
Note:Debug executive code is automatically programmed in the upper program
memory of the starter kit device when the starter kit is selected as a debugger. Debug code must be programmed into the target device to use the
in-circuit debugging capabilities of the starter kit.
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.
The following toolbar buttons can be used for quick access to commonly used debug
operations:
Debugger MenuToolbar Buttons
Run
Halt
Animate
Step Into
Step Over
Reset
To see how these options function, do the following:
1. Select Debugger>Reset>Processor Reset
program.
2. Select Debugger>Run
operates.
3. Select Debugger>Halt
green solid arrow will mark the line of code in the File window where the program
halted.
4. Select Debugger>Step Into
cution once. The green solid arrow will move down one line of code in the File
window. Click the button several times to step through some code.
5. Select Debugger>Reset>Processor Reset
program again. The arrow will disappear, meaning the device is reset.
or click the Run button. Observe how the application
or click the Halt button to stop the program execution. A
or click the Step Into button to step the program exe-
Develop an Application
or click the Reset button to reset the
click the Reset button to reset the
3.4DEBUGGING THE EXAMPLE APPLICATION
For the example code given, everything works fine. However, when you are developing
code, it will likely not work the first time and need to be debugged. MPLAB IDE provides
an editor and several debug features such as breakpoints and Watch windows to aid
in application code debugging.
To view application code so it may be edited, do one of the following:
•Select Edit>New
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
to create new code or Edit>Open to search for and open an
Existing Code File
For more information on using the editor to create and edit code, see MPLAB Editor
Help.
3.4.2Using Breakpoints and Mouseovers
To set a breakpoint in code:
1. Double Click in the Gutter – Double click in the window gutter next to the line
of code where you want the breakpoint. Double click again to remove the
breakpoint.
Note:Double click must be set up for breakpoints. See Edit>Properities
ASM/C/BAS File Type tab, checkbox for “Double-click Toggles
Breakpoint”.
2. Pop-up Menu – Place the cursor over the line of code where you want the breakpoint. Then, right click to pop up a menu and select “Set Breakpoint”. Once a
breakpoint is set, “Set Breakpoint” will become “Remove Breakpoint” and
“Disable breakpoint”. Other options on the pop-up menu under Breakpoints are
for deleting, enabling or disabling all breakpoints.
3. Breakpoint Dialog – Open the Breakpoint dialog (Debugger>Breakpoints
set, delete, enable or disable breakpoints. See MPLAB IDE Help for more
information on this dialog.
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. Select Starter Kits as the programmer in the Programmer>Select Programmer
menu.
3. Select Programmer>Program
Now the starter kit will run independently.
3.6CREATING OTHER dsPIC DSC APPLICATIONS
This starter kit is just one way to use Microchip dsPIC DSCs in an application. Other
tools and resources exist to support these devices.
• dsPIC DSC Demo Boards – Many boards are available for developing applica-
tions. See our website (http://www.microchip.com/) under Design>Development
Tools>Demo Boards>dsPIC DSC.
• MPLAB C30 C Compiler, Full Version – More optimization options than the stu-
dent version for full-scale development. See http://www.microchip.com/c30.
• Application Notes – Example applications with code for using dsPIC DSC fea-
tures. See our website (http://www.microchip.com/) under Design>App Notes &
Source Code>16-bit PIC MCUs & dsPIC DSCs.
.
.
3.7DETERMINING DEVICE SUPPORT AND RESERVED RESOURCES
Due to the built-in in-circuit debugging capability of ICD devices and the ICSP™
function offered by the debugger, the starter kit uses some on-chip resources when
debugging. It also uses program memory and file register locations in the target device
during debugging. These locations are not available for use by user code. In the
MPLAB IDE, registers marked with an “R” in register displays represent reserved
registers.
For information on device resources that are needed for in-circuit debugging, please
refer to the MPLAB ICD 2 Help, found in MPLAB IDE under Help>Topics
reserved resource information found under “Resources Used By MPLAB ICD 2” is the
same for the starter kit.
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. Check the USB connection between the PC and starter kit at both ends.
2. If using a USB hub, make sure it is powered.
3. Make sure the USB port is not in use by another device.
Programming Problems
If during the course of developing your own application you can no longer program the
device on the starter kit, you may have set device configuration bits to code protect or
some other state that prevents programming. To view the settings of the configuration
bits, select Configure>Configuration Bits
Develop an Application
.
3.9SETTINGS DIALOG, INFO TAB
When you select Debugger>Settings or Programmer Settings, you will open the Starter
Kit Settings dialog.
Currently, there is only one (Info) tab on this dialog, displaying the following
information:
• Firmware Version: The version of firmware on the starter kit board.
• Debug Exec Version: The version of the debug executive that is loaded into the
dsPIC33F device program memory to enable debug operation.
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.1AUDIO FUNCTIONAL OVERVIEW
The block diagram shown in Figure 4-1 illustrates the mainstream operation of the
starter kit.
FIGURE 4-1:STARTER KIT BLOCK DIAGRAM
LINE/MIC
MICROPHONE
LINE INPUT
SELECT
J7
LINE/MICROPHONE
AMPLIFIER
3 db to 23 db
MPLAB STARTER KIT FOR
USER’S GUIDE
ANTI-
ALIASING
LOW-PASS
FILTER
AN0
HEADPHONES
-33 db to 12 db
AN4
DCI
I2C™
SPI
OC1
dsPIC33F
Device
HEADPHONE
AMPLIFIER
OUTPUT
SELECT
J6
LOWPASS
FILTER
TEMPERATURE
SENSOR
In
AUDIO
CODEC
Out
4 Mbit
FLASH
MEMORY
4.1.1Speech Sampling
The incoming audio signal can come from a line input or a condenser microphone. The
speech sampling input is jumper selected (J7). The selected signal is amplified by a
non-inverting AC amplifier (Line/Microphone Amplifier) and routed to the ADC module
on the dsPIC33F device through an anti-aliasing filter. This sixth-order Sallen-Key
low-pass filter has a cut-off frequency of 3300 Hz. The output of the anti-aliasing filter
is connected to input AN0 of the ADC module on the device. If the input to the amplifier
is a condenser microphone, a bias voltage provides a working supply voltage for the
microphone. The line input does not require this bias voltage.
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.2Speech 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. The low-pass filter behaves like an integrator
whose output signal amplitude depends on the duty cycle of the input PWM waveform.
The PWM frequency should be an integral multiple of the audio sampling rate.
FIGURE 4-2:PWM DEMODULATION
PWM SIGNAL FROM OCPWMLOW-PASS FILTERDEMODULATED AUDIO SIGNAL
R
C
The output of the low-pass filter feeds the headphone amplifier The headphone
amplifier drives an audio headphone. This amplifier can drive up to 75 mW into a 32
ohm headphone. The amplifier uses a digital volume control that is controlled by I/O
lines from the dsPIC33F device.
4.1.3Codec
The audio codec can be used for a higher-end audio application. The input to the audio
codec is the output of the line/microphone pre-amplifier. The output feeds the
headphone amplifier. The codec must interact with the application program running on
the dsPIC33F device. Commands from the application program control the codec
operating parameters (such as communication protocol, sampling rate, volume control,
level control, filter settings, etc.). Command information is exchanged over the
Inter-Integrated Circuit™ (I
2
C™) module on the device.
The codec converts the incoming audio signal to a digital signal for the Digital
Converter Interface (DCI) module of the dsPIC33F device. Audio output from the
application program is sent to the codec via the DCI module. The codec converts this
digital signal to audio for the headphone amplifiers.
4.1.44 Mb Serial Flash Memory
The starter kit includes 4 Mb serial Flash memory that can be used for storing data. The
memory interfaces with the SPI bus on dsPIC33F device and might typically be used
by applications that require storage of speech samples for playback purposes.
The block diagram shown in illustrates the debugging/programming operation of the
starter kit.
FIGURE 4-3:STARTER KIT DEBUG BLOCK DIAGRAM
Hardware
3.3V LDO
Regulator
ICSP™
dsPIC33F
Device
Status
LEDs
12 MHz
Crystal
USB Mini-B
Jack
PIC18F67J50 Device
SPI
Serial EEPROM
25LC010A
The starter kit, with its built-in debugger/programmer, provides an all-in-one solution for
debugging and programming applications using MPLAB IDE. Also, no additional
external power supply is needed as power is supplied by the host PC’s USB port.
The starter kit's debugging/programming operations are controlled by a PIC18F67J50
MCU running at 48 MHz. The PIC18F67J50's built-in USB engine provides the
communications interface between the starter kit and the host PC.
Power to the starter kit is provided via USB whose nominal 5 volt unregulated supply
is regulated by a Microchip MC1727 3.3 volt low-dropout (LDO) linear regulator. Proper
starter kit main system power is indicated by the green LED ‘D1’.
The PIC18F67J50 MCU accomplishes debugging or programming of the target
dsPIC33FJ256GP506 by controlling the target’s MCLR
PGD1/EMUD1 signals. Target power is switched on/off via a low V
, PGC1/EMUC1, and
CE saturation PNP
transistor configured as a high-side switch. Target clocking is also provided by the
PIC18F67J50 MCU.
A Microchip 25LC010A serial EEPROM is used to store the starter kit’s serial number
and debug control information.
Provides target power (via high-side switching) to the dsPIC33FJ256GP506 (and
ancillary circuitry) via control by the PIC18F67J50 programming/debugging MCU.
4.3.1.725LC010A SERIAL EEPROM (U3)
Provides nonvolatile parameter storage for the PIC18F67J50 MCU.
4.3.2Audio Components
The following components support the audio portion of the starter kit. See Appendix
A. “Schematics” for audio schematics.
4.3.2.1FLASH MEMORY (U5)
The starter kit includes a serial Flash memory chip (Ref A1). The power supply for U5
is provided by regulator U4. The regulator provides the required amount of current for
flash programming operation.
4.3.2.2DIGITAL SIGNAL CONTROL (U6)
The dsPIC33F256GP506 digital signal controller (Ref A2) provides the computation
and processing resource for application development on the starter kit. This DSC
features 256 KB of program flash and 16 KB RAM. The application can either use the
on-chip FRC or the external 12 MHz signal as clock source.
4.3.2.3TEMPERATURE SENSOR (U7)
The starter kit includes a temperature sensor (Ref A3) that interfaces to the ADC
module on the dsPIC33F device. The temperature sensor is a Microchip TC1047.
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.5OUTPUT 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. Default setting
is CODEC.
4.3.2.6CODEC (U9)
The starter kit includes an audio codec (Ref A6) that interfaces to the DCI module (data
interface) and I
the output of the Line/Microphone Amplifier (MIC2).
The codec is a Wolfson WM8510 and uses a 12 MHz clock signal generated by U2 for
clocking.
4.3.2.7HEADPHONE AMPLIFIER (U11)
The Headphone Amplifier (Ref A7) is a National Semiconductor LM4811 70-mW stereo
amplifier with digital volume control. The input to the amplifier is controlled by the
setting of Output Select Jumper J6. The output of the amplifier is available at
Headphone stereo jack (J8).
Gain is controlled by the logic levels applied through the device I/O ports to the CLK
and UP/DN pins of U11. Each time the CLK line goes logic high, the gain increases or
decreases by 3 dB, depending on the logic level of UP/DN line. The gain can be
adjusted over a range of +12 db to -33 db in 16 discrete gain settings.
4.3.2.8LINE/MICROPHONE INPUT SELECT JUMPER (J7)
The Line/Microphone Input Select jumper (Ref A8) determines if the Microphone/Line
Pre-Amplifier (U10-A) operates as a line amplifier or a microphone amplifier. If the MIC
option is selected, a bias voltage of +3.3V is applied to the Microphone/Line Input
Socket (J9). Default setting is MIC.
4.3.2.9HEADPHONE OUTPUT JACK (J8)
2
C bus (control interface) of the dsPIC33F device. It is AC coupled to
The Headphone jack (Ref A9) is a 3.5 mm stereo connector. A 32-ohm headphone can
be connected to this socket.
4.3.2.10LINE/MICROPHONE INPUT PHONE JACK (J9)
The Line/Microphone Input (Ref A10) is a 3.5 mm mono input phone jack (SJ3504).
This connection accepts either a condenser microphone or a line level signal.
4.3.2.11USER LEDS (D3,D4 AND D5)
The starter kit features three general purpose LEDs which are connected to the I/O
ports on the dsPIC33F device. The user application can use these LEDs for indication
purposes.
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:Setting the gain too high can cause the output of the amplifier to saturate
and clip.
4.3.2.13LINE/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). The output of this non-inverting AC
amplifier is biased at 1.65V. The gain of the amplifier is controlled by Potentiometer
R56, as given by Equation 4-1.
EQUATION 4-1:INPUT PRE-AMPLIFIER GAIN
R56 R50+()
Gain1
4.3.2.14ANTI-ALIASING LOW-PASS FILTER (U10:B,C,D)
⎛⎞
------------- ------------ ------
+=
⎝⎠
R44
The Anti-Aliasing Low-Pass filter uses three of the four operational amplifiers on the
MCP6024 quad op-amp IC (U10). The output of the Line/Microphone Pre-Amplifier
(Ref A14) uses an anti-aliasing low-pass sixth order Sallen-Key structure to filter the
signal and provide a cut-off frequency of 3300 Hz.
4.3.2.15USER SWITCHES (S2 AND S1)
The starter kit features two press switches which are connected to the I/O ports on the
dsPIC33F device. The function of these switches is defined by the user application.