DSPDemo. By Moe Wheatley MoeTronix.

Similar documents
Welcome to the tutorial for the MPLAB Starter Kit for dspic DSCs

DAC Digital To Analog Converter

Simple SDR Receiver. Looking for some hardware to learn about SDR? This project may be just what you need to explore this hot topic!

K2 CW Filter Alignment Procedures Using Spectrogram 1 ver. 5 01/17/2002

A DESIGN OF DSPIC BASED SIGNAL MONITORING AND PROCESSING SYSTEM

Lab Experiment 1: The LPC 2148 Education Board

POCKET SCOPE 2. The idea 2. Design criteria 3

An Introduction to MPLAB Integrated Development Environment

Evo Laser Firmware Developer s Manual

IEC Algorithmic Alert Tone Demo

Department of Electrical and Computer Engineering Ben-Gurion University of the Negev. LAB 1 - Introduction to USRP

SKP16C62P Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc.

FFT Frequency Detection on the dspic

LEVERAGING FPGA AND CPLD DIGITAL LOGIC TO IMPLEMENT ANALOG TO DIGITAL CONVERTERS

FREQUENCY RESPONSE OF AN AUDIO AMPLIFIER

Digital Signal Controller (DSC) Development Tools

Propagation Channel Emulator ECP_V3

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

AN-007 APPLICATION NOTE MEASURING MAXIMUM SUBWOOFER OUTPUT ACCORDING ANSI/CEA-2010 STANDARD INTRODUCTION CEA-2010 (ANSI) TEST PROCEDURE

EE289 Lab Fall LAB 4. Ambient Noise Reduction. 1 Introduction. 2 Simulation in Matlab Simulink

DsPIC HOW-TO GUIDE Creating & Debugging a Project in MPLAB

AN3252 Application note

How To Program A Microcontroller Board (Eb064) With A Psp Microcontroller (B064-74) With An Ios 2.5V (Power) And A Ppt (Power Control) (Power Supply) (

dspic30f4012 Microcontroller

Lab 1 Course Guideline and Review

Developing applications under CODE COMPOSER STUDIO

AN3998 Application note

Fondamenti su strumenti di sviluppo per microcontrollori PIC

Glitch Free Frequency Shifting Simplifies Timing Design in Consumer Applications

Microcontroller Code Example Explanation and Words of Wisdom For Senior Design

DSP Laboratory: Analog to Digital and Digital to Analog Conversion

Impedance 50 (75 connectors via adapters)

AN1229. Class B Safety Software Library for PIC MCUs and dspic DSCs OVERVIEW OF THE IEC STANDARD INTRODUCTION

Hideo Okawara s Mixed Signal Lecture Series. DSP-Based Testing Fundamentals 46 Per-pin Signal Generator

EMBEDDED C USING CODEWARRIOR Getting Started Manual

miditech Audiolink II

Digital Guitar Effects Pedal

Freescale Semiconductor, I

LOW COST HARDWARE IMPLEMENTATION FOR DIGITAL HEARING AID USING

Field Calibration Software

Digitale Signalverarbeitung mit FPGA (DSF) Soft Core Prozessor NIOS II Stand Mai Jens Onno Krah

Audiomedia III Installation Guide

RFSPACE CLOUD-IQ #CONNECTED SOFTWARE DEFINED RADIO

Small Hardware Development and Prototyping Board for the SX28

Manual for the sound card oscilloscope V1.24 C. Zeitnitz english translation by P. van Gemmeren and K. Grady

LEN s.r.l. Via S. Andrea di Rovereto 33 c.s CHIAVARI (GE) Tel Fax mailto: len@len.it url: http//

RF Network Analyzer Basics

Digital Signal Controller Based Automatic Transfer Switch

FUNDAMENTALS OF MODERN SPECTRAL ANALYSIS. Matthew T. Hunter, Ph.D.

Optimizing VCO PLL Evaluations & PLL Synthesizer Designs

Continuous-Time Converter Architectures for Integrated Audio Processors: By Brian Trotter, Cirrus Logic, Inc. September 2008

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

Tutorial for MPLAB Starter Kit for PIC18F

S7 for Windows S7-300/400

Using the HT46R46 I/O Ports to Implement Half-Duplex SPI Communication

The front end of the receiver performs the frequency translation, channel selection and amplification of the signal.

Modification Details.

Lab Exercise 1: Acoustic Waves

Non-Data Aided Carrier Offset Compensation for SDR Implementation

CHAPTER 11: Flip Flops

GETTING STARTED WITH STUDIO ONE ARTIST

QUALITY AV PRODUCTS INMATE/INMATE USB PROFESSIONAL 19" MIXER. User Guide and Reference Manual

25. AM radio receiver

Voice Communication Package v7.0 of front-end voice processing software technologies General description and technical specification

Accurate Measurement of the Mains Electricity Frequency

DDS. 16-bit Direct Digital Synthesizer / Periodic waveform generator Rev Key Design Features. Block Diagram. Generic Parameters.

-Helping to make your life betterwww.person-to-person.net

SR2000 FREQUENCY MONITOR

THE IMPLEMENTATION OF A DTV RF ANALYSIS AND REGENERATION SYSTEM

Analog Devices Welcomes Hittite Microwave Corporation NO CONTENT ON THE ATTACHED DOCUMENT HAS CHANGED

Audio-Technica AT-LP60-USB, AT-LP120-USB, AT-LP240-USB & AT-LP1240-USB Turntables. Software Guide

Synchronization of sampling in distributed signal processing systems

Timer A (0 and 1) and PWM EE3376

AN3997 Application note

6.025J Medical Device Design Lecture 3: Analog-to-Digital Conversion Prof. Joel L. Dawson

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 1 Introducing Hardware

DR-1 Portable Digital Recorder OWNER'S MANUAL

Radio Interface Setup

1. SAFETY INFORMATION

User Guide FFFA

SIGNAL GENERATORS and OSCILLOSCOPE CALIBRATION

MP3 Player CSEE 4840 SPRING 2010 PROJECT DESIGN.

Implementing an In-Service, Non- Intrusive Measurement Device in Telecommunication Networks Using the TMS320C31

Audacity Sound Editing Software

Final Project Example

Dayton Audio is proud to introduce DATS V2, the best tool ever for accurately measuring loudspeaker driver parameters in seconds.

Teaching DSP through the Practical Case Study of an FSK Modem

Video Conferencing Unit. by Murat Tasan

Lab 3: Introduction to Data Acquisition Cards

User's Guide. Integrating Sound Level Datalogger. Model Introduction

MATRIX TECHNICAL NOTES

PRODUCT INFORMATION. Insight+ Uses and Features

VME IF PHASE MODULATOR UNIT. mod

QAM Demodulation. Performance Conclusion. o o o o o. (Nyquist shaping, Clock & Carrier Recovery, AGC, Adaptive Equaliser) o o. Wireless Communications

RF Measurements Using a Modular Digitizer

ELAD FDM-SW1 USER MANUAL. Ver. 1.0

Filter Comparison. Match #1: Analog vs. Digital Filters

User Manual. Please read this manual carefully before using the Phoenix Octopus

Best Practises for LabVIEW FPGA Design Flow. uk.ni.com ireland.ni.com

Transcription:

DSPDemo By Moe Wheatley MoeTronix www.moetronix.com Sept. 10, 2004

Table of Contents 1 Introduction... 3 1.1 The Idea... 3 1.2 Hardware... 3 1.2.1 Block Diagram... 3 1.3 Software... 4 1.3.1 Basic Modules... 4 2 User Operation Guide... 5 2.1 Program Loading... 5 2.2 Initial Setup... 5 2.3 Menus... 6 2.3.1 Input Source... 6 2.3.2 DSP Processing... 6 2.3.3 Codec Adjust... 10 2.3.4 Time Display... 10 2.3.5 Frequency Display... 10 3 Summary... 11 3.1 Processor Resources... 11 3.2 Toolset Issues... 11 3.3 DSP Performance Results... 11 3.3.1 Issues... 11 3.3.2 Conclusions... 11 Ver. 1.0 2

1 Introduction 1.1 The Idea This project was an attempt to evaluate the performance of some of the basic DSP functions of the dspic. Several signal sources were created and then fed into an assortment of DSP filters and functions. Output can be analyzed using graphical displays of time or frequency domain data or sent to a D/A for external analysis. It was desired to evaluate the MPLAB C30 compiler and the DSP library and discover how well it performed so all but a couple of small DSP routines were written in 'C'. 1.2 Hardware The hardware chosen for this project was the dspicdem 1.1 evaluation board from Microchip. It provides a standalone platform for the software with no hardware modifications or additions. 1.2.1 Block Diagram Processed Data Sound Output Power Supply Si3000 Codec Audio In LCD Controller SPI dspic30f6014 8KRAM 48KWords ProgramFLASH DCI 12Bit A/D 32x122 LCD 4 LEDs GPIO 3 GP Pots Input signals can be input to the CODEC audio MIC input jack J16. The processed output is always on the CODEC audio SPKR OUT jack J17. The three available pots, RP1 and 3 are used to set the input/output level as well as set the generator source frequency. They are hooked to the dspic 12bit A/D converter and read periodically and the values used to adjust the parameters. The LCD and 4 key switches SW1-4 are used to implement a simple menu and display system. Four LEDs, LED1-4 provide a way to measure the time required to generate input signals, process data, and write to the output device. DsPIC resources used are a couple timers, the 12 bit A/D converter, the DCI module, the SPI module, internal EEROM, and some I/O ports. Ver. 1.0 3

1.3 Software The software is written primarily in C using the Microchip MPLAB C30 Compiler. Debug and program development was accomplished using the MPLAB IDE and the ICD-2 programming/debug module along with an oscilloscope. DSPDemo Signal Processing Block Diagram LP FIR Audio Input Sampled at 7200 SPS CODEC A/D HP FIR BP FIR CODEC A/D Audio Out Frequency SW NCO BS FIR + 256 Sample Buffer Pitch Shifter Noise LMS Time Display Frequency Display 1.3.1 Basic Modules There are nine software modules that are linked together. The following is a list of the modules and their basic functions: Main.c Program Entry and main execution loop Timers.c Timer setup, IRQ service, and EEROM utilities AtoD.c 12 bit A/D setup and utilities Codec.c Si3000 Codec setup and IRQ service routine LCD.c LCD controller setup and interface routines Menu.c Menu system implementation Generators.c Implements various sine/cosine and noise generators ProcDsp.c DSP section which processes the input data FftFunct.c Performs FFT and log-magnitude function of output AsmUtils.s A couple of assembler code helper functions for the DSP tasks The following include files are also used: Timers.h Module Includes AtoD.h Module Includes Codec.h Module Includes LCD.h Module Includes Menu.h Module Includes Generators.h Module Includes ProcDsp.h Module Includes FftFunct.h Module Includes Common.h common program definitions Tables.h DSP filter tables DSPDemo.* Various project files for MPLAB Ver. 1.0 4

2 User Operation Guide LCD Display Input Time Output Time In Level RP1 RP2 Out Level RP3 J16 J17 MENU LMS SCROLL Dec MENU ITEM SCROLL LMS Inc Proc Time Blink Frequency Select Audio IN Audio OUT 2.1 Program Loading First the MPLAB IDE, the MPLAB C30 Compiler, and ICD-2 software must be installed and the ICD-2 attached to the PC and to the dspicdem 1.1 evaluation board as described in the documentation for the tool sets. Create a folder and place all the DSPDemo project files into it. From within the MPLAB IDE, load the project file DSPDemo.mcp into the IDE workspace. If the C30 Compiler is setup then the project can be compiled and the demo board programmed with the compiled code in either debug mode or just use the programming mode. 2.2 Initial Setup Once the program is loaded and running, a splash screen should appear followed by the main menu screen displaying the input signal source. If headphones or a speaker is connected to the SPKR jack of the demo board. Adjust RP3 for the output volume. A microphone or other signal source can be plugged into J16. Adjust RP1 to adjust the input level. Ver. 1.0 5

2.3 Menus There are seven menus that can be reached by pressing the Menu Scroll button(sw1) 2.3.1 Input Source The Input Source menu allows the user to select various input sources using the menu Item scroll key(sw2). INPUT SOURCE xxxxx = CODEC, SINE, NOISE, SINE+NOISE FREQUENCY = 0 to 3500Hz (changed with RP2) IN SCALE = 0 to 32768 (input scale value adjusted with RP1) 2.3.2 DSP Processing This menu selects the type of digital signal processing to apply to the Input using the Menu Item Scroll key(sw2). DSP PROCESSING NONE, LP FIR, HP FIR, BP FIR, BS FIR, FSHIFT, LMS NONE == No processing is performed so is straight through path. LP FIR == 1500Hz Low Pass 101 Tap FIR filter Inphase Filter Frequency Response 10 0-10 Magnitude in db -20-30 -40-50 -60-70 -80-90 0 400 800 1200 1600 2000 2400 2800 3200 3600 Frequency in Hz Ver. 1.0 6

HP FIR == 1500Hz High Pass 101 Tap FIR filter Inphase Filter Frequency Response 20 0 Magnitude in db -20-40 -60-80 -100-120 0 400 800 1200 1600 2000 2400 2800 3200 3600 Frequency in Hz BP FIR == 1800Hz Band Pass 100 Tap FIR filter Inphase Filter Frequency Response 20 0 Magnitude in db -20-40 -60-80 -100 0 400 800 1200 1600 2000 2400 2800 3200 3600 Frequency in Hz Ver. 1.0 7

BS FIR == 1800Hz Band Stop 99 Tap FIR filter Inphase Filter Frequency Response 10 0-10 Magnitude in db -20-30 -40-50 -60-70 0 400 800 1200 1600 2000 2400 2800 3200 3600 Frequency in Hz FSHIFT == Complex mixer, +/- 1750Hz NCO, with two 126Tap Hilbert Band Pass filters Implement simple pitch shifter. Below is the response of the Hilbert I/Q band-pass filters. Two are used that have identical magnitude responses but whose outputs are 90 degrees out of phase with each other. 10 Inphase Filter Frequency Response 0 Magnitude in db -10-20 -30-40 -50 0 400 800 1200 1600 2000 2400 2800 3200 3600 Frequency in Hz Ver. 1.0 8

Below is a block diagram of the basic pitch shifting algorithm. It is essentially a single sideband modulator operating at audio frequencies. 1700Hz BP I Filter X Cos Input NCO +/- 1750HZ + Shifted Outputt Sin 1700Hz BP Q Filter +90Deg X Ver. 1.0 9

LMS == LMS noise reduction filter Reference - + e 35uS Delay Z -256 Input 24 Tap LMS FIR Output The LMS filter is implemented with the DSP library LMS function and a single delay line. The basic idea is to enhance any correlated signals and minimize uncorrelated (noise) signals by minimizing the error difference signal which in this case is the difference between the input signal and a delayed version of the input. 2.3.3 Codec Adjust The Codec Adjust menu displays the Codec output value that is adjusted with pot RP3. CODEC ADJUST OUT VOLUME = 0 to 7F The volume value is the Si3000 Codec DAC volume control register and has a range of +12 to -34.5dB. 0dB corresponds to the value of 0x5A. 2.3.4 Time Display This menu shows the output signal amplitude versus time. It is just the first 123 samples of the data buffer plotted where zero is in the middle and the top and bottom of the screen are +32767 and -32768 respectively. 2.3.5 Frequency Display This menu displays power versus frequency and is the output of a 256 point FFT of the output signal. The vertical scale is 1 to 32 points corresponding to the log2() of the power output spectrum. This allows most of the 16 bit 96dB dynamic range to be shown on a very limited resolution display. Ver. 1.0 10

3 Summary This project served its purpose in gaining a better understanding of the dspic and its DSP library development tool set. 3.1 Processor Resources This demo project is functional and did not consume all the dspic resources in terms of CPU power or program memory. It does use all the available RAM. The program used about 15Kbytes of program memory and a just about all the 8Kbytes of data RAM. The worst case CPU load in the main non-interrupt processing loop was about 51% at the slowest dspicdem 1.1 board clock rate of 7.3728MHz and an x4 PLL. The interrupt background tasks add about another 5% to the CPU load. 3.2 Toolset Issues The MPLAB IDE and C30 compiler operated with few problems. The ICD-2 debugger worked as long as one didn't forget to plug it into the demo board before programming. Usually a program restart and power sequence of the target board and ICD-2 would be required of that occurred. Most of the debugging was done with a scope and not the IDE. Single stepping was problematic especially when interrupts were flailing away. 3.3 DSP Performance Results 3.3.1 Issues The FIR filter functions worked as expected using the DSP Library functions. The Sine generation function creates some artifacts due to the limited table lookup size resolution. Perhaps a longer table or linear interpolation would reduce the noise. The LMS filter is very sub-optimum and could be greatly improved by adding a leaky coefficient algorithm and also by optimizing all the parameters. The FFT consumes most of the RAM and a 512 point FFT is probably at the limit of being practical on the 8K RAM processor. Any additional buffering makes the 256 point a more likely limit. 3.3.2 Conclusions The dspic has a very respectable DSP core and was never pushed to the limit by this program. One will probably run out of RAM long before running out of CPU cycles in most applications. Ver. 1.0 11