28
A NEW DIGITAL SIGNAL PROCESSING (DSP) EVALUATION BOARD FOR REAL TIME APPLICATION CHIENG WEE KAI UNIVERSITI TEKNOLOGI MALAYSIA

A New DSP Evaluation Board For Real Time Applicationeprints.utm.my/id/eprint/11881/1/ChiengWeeKaiMFKE2010.pdfan embedded processor and generally with a way to download and execute

Embed Size (px)

Citation preview

A NEW DIGITAL SIGNAL PROCESSING (DSP) EVALUATION BOARD

FOR REAL TIME APPLICATION

CHIENG WEE KAI

UNIVERSITI TEKNOLOGI MALAYSIA

A NEW DIGITAL SIGNAL PROCESSING (DSP) EVALUATION BOARD

FOR REAL TIME APPLICATION

CHIENG WEE KAI

A project report submitted in partial fulfillment of the requirements

for the award of the degree of

Master of Engineering (Electrical - Computer and Microelectronic System)

Faculty of Electrical Engineering

Universiti Teknologi Malaysia

May 2010

iii

Specially dedicated to my beloved parents, brother, girl friend, supervisor, lectures,

fellow friends and those who have guided and inspired me throughout my journey of

education.

iv

ACKNOWLEDGEMENT

This project will not able to complete without the help and guidance from

others. Thus, I would like to take this opportunity to acknowledge the people below.

First and most importantly, I would like to express my gratitude to my project

supervisor Dr. Muhammad Nasir Ibrahim. He guided me along the journey and

always gives constructive suggestions and opinions. With his help, I do not lose in

term of the project scope and objectives. I would say, throughout the whole year of

working under him, I really gain a lot of knowledge not only in the technical area but

also prepare myself to be a better person.

On top of that, I would like to thank my manager and Intel Penang Design

Centre for supporting and sponsoring me to sign up this part time course. Thanks to

my manager for being so thoughtful and always allows me to take examination leave

to complete my project.

On a personal level, my deepest thank go to my parents, girl friend Patricia

Ng Mee Ling and peers for their mental support throughout my academic years.

v

ABSTRACT

This project has a final goal of designing a new digital signal processing

(DSP) evaluation board for real time application. DSP encompasses the digital

representation of signals and the digital hardware to analyze, modify, extract

information from digital signals. An evaluation board is a general purpose board with

an embedded processor and generally with a way to download and execute user’s

program on it. Real time application places stringent demands on hardware and

software design to complete predefined tasks within a certain time frame. This

project consists of both hardware and software developments. The evaluation board

accepts audible sounds (less than 10kHz) as its inputs and performs real time

frequency and time domain transformation, frequency filtering and shifting operation.

The results are designed to be outputted through computer screen and speaker. In this

project, schematic is designed using Cadence Orcad v16.2 Capture, layout is

designed using Cadence Orcad v16.2 PCB designer, programmer is developed under

Microchip MPLAB IDE v8.46, DSP programs are developed by using Microchip

C30 combo lite edition v3.23 tool suite and computer reception programs are

developed by using Microsoft Visual C# 2008 express edition. This project was

scheduled for two semester in which the activities of project requirements

determination, embedded cores selection, modules planning, schematic design,

component footprint checkup and layout design were done in first semester whereas

activities to fabricate PCB board, solder components, set up programmer, develop

software programs, validate output were carried out in semester 2. Experiment results

prove that the project objectives have been fulfilled and problem statements have

been solved.

vi

ABSTRAK

Projek ini mempunyai tujuan akhir mencipta papan penilaian pemprosesan

isyarat digital (DSP) baru untuk aplikasi “real time”. Pemprosesan isyarat digital

meliputi perwakilan digital dari isyarat dan peranti keras digital untuk menganalisis,

mengubah, mengekstrak maklumat dari isyarat digital. Sebuah papan penilaian

adalah sebuah papan tujuan umum dengan prosesor tertanam dan umumnya dengan

cara untuk memuat dan menjalankan program pengguna di atasnya. "Real time"

aplikasi mengenakan tuntutan ketat pada peranti keras dan perancangan perisian

untuk menyelesaikan tugasan yang telah ditetapkan dalam jangka waktu tertentu.

Projek ini terdiri daripada perkembangan hardware dan software. Papan penilaian ini

menerima suara terdengar kurang dari 10kHz sebagai masukkan dan melakukan "real

time" transformasi domain masa dan frekuensi, frekuensi penapisan dan frekuensi

pergeseran. Keputusan direka untuk dipapar melalui skrin komputer dan speaker.

Dalam projek ini, litar direka dengan Cadence Orcad v16.2 Capture, tata letak direka

dengan Cadence Orcad v16.2 PCB desainer, pengaturcara dibangunkan dengan

Microchip MPLAB IDE v8.46, Program DSP direka dengan Microchip C30 combo

lite v3.23 dan program penerimaan data direka dengan Microsoft Visual C # 2008.

Projek ini dijadualkan selama dua semester di mana projek penentuan keperluan,

seleksi core, modul perancangan, rekaan skematik, pemeriksaan bahagian tapak dan

rekaan tata letak dilakukan pada semester 1 sementara kegiatan untuk membuat

papan PCB, solder komponen, menyiapkan programmer, mengembangkan program

perisian, memvalidasi output dilakukan pada semester 2. Keputusan eksperimen

membuktikan bahawa tujuan projek telah dipenuhi dan pernyataan masalah telah

diatasi.

vii

.

TABLE OF CONTENTS

CHAPTER TITLE PAGE

DECLARATION ii

DEDICATION iii

ACKNOLEDGEMENT iv

ABSTRACT v

ABSTRAK vi

TABLE OF CONTENTS vii

LIST OF TABLES xii

LIST OF FIGURES xiii

LIST OF ABBREVIATIONS xvi

LIST OF APPENDICES xviii

CHAPTER 1 INTRODUCTION

1.1 Title & brief introduction 1

1.2 Objectives 5

1.3 Scope of project & project background 6

1.4 Problem statement 7

CHAPTER 2 LITERATURE REVIEW

viii

2.1 Digital signal processing 10

2.1.1 Time representation of digital signal 10

2.1.2 Frequency representation of digital signal 12

2.1.3 Digital filter 15

2.2 Human voice signal 16

2.3 Embedded core 17

2.3.1 Using a microcontroller (MCU) 18

2.3.2 Using a digital signal processor (DSP) 19

2.3.3 Using a digital signal controller (DSC) 20

2.3.4 Using a MCU + DSP 21

2.4 Communication modules 22

2.4.1 Universal Serial Bus (USB) 22

2.4.2 Recommended Standard (RS232) 23

2.5 Programmer/ debugger 23

2.5.1 USB power supply and connection 23

2.5.2 PIC18F2550 ICSP connection 25

CHAPTER 3 DESIGN PROCESSES

3.1 Project overview 27

3.1.1 Project functions 27

3.1.2 Project components 28

3.1.3 Project development tools 38

3.2 Design procedures 40

3.2.1 Core’s selection 41

3.2.2 Select and plan up modules 43

3.2.3 Develop schematic 44

3.2.4 Plan up component footprint 45

3.2.5 Develop layout 46

3.2.6 Fabricate PCB board 47

3.2.7 SMT & through hole soldering 51

3.2.8 Program Pickit 2 52

ix

3.2.9 Develop circuit diagnostic program 53

3.2.10 Develop DSP application program 54

3.2.11 Develop PC data receiving program 55

3.3 Gantt chart 56

CHAPTER 4 HARDWARE DEVELOPMENT

4.1 Functional block diagram 57

4.2 Hardware design sequence 58

4.3 Circuit design & schematic explanation 60

4.3.1. DSC embedded core module 60

4.3.2. Pickit 2 programmer/debugger module 62

4.3.3. Power module 66

4.3.4. Input preamplifier module 68

4.3.5. USB module 70

4.3.6. RS232 module 71

4.3.7. ADC input module 73

4.3.8. LCD module 74

4.3.9. LED module 76

4.3.10. Speaker module 77

4.3.11. Switch module 78

4.3.12. Direct port access module 80

4.4 Physical layout design 81

4.4.1. Placement planning 81

4.4.2. Routing planning 82

4.5 Hardware cost calculation 84

CHAPTER 5 SOFTWARE DEVELOPMENT

5.1 Design planning & preparation 85

x

5.2 Module functions & flowchart 88

5.2.1. DSC application main module 88

5.2.2. DSC frequency manipulation module 90

5.2.3. DSC sampling module 94

5.2.4. DSC DAC module 95

5.2.5. DSC ADC module 96

5.2.6. DSC delay module 97

5.2.7. DSC LCD module 97

5.2.8. DSC data transmitting module 99

5.2.9. PC data receiving main module 101

5.2.10. PC data displaying module 103

CHAPTER 6 RESULT OF EXPERIMENTS

6.1 FFT/IFFT 104

6.2 Band pass filtering 105

6.3 Low pass filtering 108

6.4 High pass filtering 109

6.5 Frequency shifting 111

CHAPTER 7 DESIGN CHALLENGES & DIFFICULTIES

7.1 Hardware design challenges 113

7.2 Software design challenges 114

CHAPTER 8 CONCLUSION & PROPOSED FUTURE WORK

8.1 Conclusion 116

xi

8.2 Proposed hardware future work 117

8.3 Proposed software future work 118

REFERENCES 120

APPENDICES 121-140

xii

LIST OF TABLES

TABLE NO. TITLE PAGE

1.1 Summary of a microcontroller’s features. 3

1.2 Summary of a digital signal processor’s features. 4

3.1 Gantt chart. 56

4.1 Project’s cost calculation. 84

xiii

LIST OF FIGURES

FIGURE NO. TITLE PAGE

2.1 3 parameters that evaluate time domain performance. 12

2.2 The four common frequency responses. 13

2.3 3 parameters that evaluate frequency domain

performance. 14

2.4 FT232R as a USB to MCU UART interface. 22

2.5a USB mini-B connector. 24

2.5b USB type-B connector. 24

2.6a USB power supply and bleed resistor. 25

2.6b USB D+/D- & 3.3V supply. 25

2.7a ICSP pads for PIC18F2550 26

2.7b PIC18F2550 ICSP pins 26

3.1 Project functions overview. 28

3.2 Front side of the evaluation board. 29

3.3 Low pass filtering. 31

3.4 Frequency shifting. 32

3.5 High pass filtering. 33

3.6 Band pass filtering. 33

3.7 Back side of the evaluation board. 35

3.8 Microphone. 36

3.9 Speaker. 36

3.10 Signal display windows at PC terminal. 37

3.11 Complete project’s design procedures. 41

3.12 Factors that impact embedded core selection. 42

xiv

3.13 Factors that impact module planning and

module selection. 44

3.14 Layout design printed on short fiber type paper. 48

3.15 Copper plate ironed with layout design. 49

3.16 Paper washed away process. 49

3.17 Copper etching process. 50

3.18 Fabricated PCB board. 50

4.1 Project’s functional block diagram. 58

4.2 Hardware design sequence. 60

4.3 Schematic of DSC embedded core module. 61

4.4 Schematic of Pickit 2 programmer/debugger module. 63

4.5 Schematic of power module. 67

4.6 Schematic of input preamplifier module. 69

4.7 Schematic of USB module. 70

4.8 Schematic of RS232 module. 72

4.9 Schematic of AD converter input module. 73

4.10 Schematic of LCD module. 75

4.11 Schematic of LED module. 76

4.12 Schematic of speaker module. 77

4.13 Schematic of switch module. 78

4.14 Schematic of direct port access module. 80

4.15 Project’s layout design. 83

5.1 Software planning and design considerations. 87

5.2 DSC application main module (DSCapp.c). 89

5.3 Radix-2, 8 stages, 256 points FFT model. 90

5.4 1 frame of data (1032B) 91

5.5 Ping Pong buffering. 92

5.6 DSC frequency manipulation module (FFT.c). 93

5.7 Sampling rate of 20kHz and 10Hz. 94

5.8 DSC sampling module (samplingTimer.c). 95

5.9 DAC up sampling method. 96

5.10 Interrupt polling version of LCD display. 98

5.11 Data transmitting communication protocol. 99

5.12 Padding phenomenon. 99

xv

5.13 DSC data transmitting module (USBuartInt.c). 100

5.14 PC data receiving main module (dsPICapp.cs). 102

5.15 Computer display window. 103

6.1 FFT/IFFT result with human normal speaking voice. 104

6.2 Band pass filtering result with human normal

speaking voice (experiment 1). 106

6.3 Band pass filtering result with 8kHz generated

sound (experiment 2). 106

6.4 Low pass filtering result with 8kHz generated sound. 108

6.5 High pass filtering result with 8kHz generated sound. 110

6.6 Frequency shifting result with 8kHz generated sound. 111

6.7 A closer look on frequency shifting comparison. 112

xvi

LIST OF ABBREVIATIONS

AC - Alternating Current

ADC - Analog to Digital Converter

AI - Artificial Intelligence

DAC - Digital to Analog Converter

DC - Direct Current

DCE - Data Circuit-terminating Equipment

DRC - Design Rule Check

DSC - Digital Signal Controller

DSP - Digital Signal Processing

DTE - Data Terminal Equipment

FFT - Fast Fourier Transform

I/O - Input Output

IC - Integrated Circuit

ICSP - In Circuit Serial Programming

IDE - Integrated Development Environment

IFFT - Inverse Fast Fourier Transform

IIR - Infinite Impulse Response

LCD - Liquid Crystal Display

LED - Light Emitting Diode

MCU - Micro Controller Unit

MIPS - Million Instructions Per Second

Op-Amp - Operational Amplifier

PLL - Phase Locked Loop

RS232 - Recommended Standard 232

SMC - Surface Mount Component

SMT - Surface Mount Technology

xvii

UART - Universal Asynchronous Receiver Trasmitter

USB - Universal Serial Bus

VCO - Voltage Controlled Oscillator

VCP - Virtual COM Port

ZIF - Zero Insertion Force

xviii

LIST OF APPENDICES

APPENDIX TITLE PAGE

APPENDIX A - Microchip C30 Program Code

A1 DSC application main module (DSCapp.c) 121

A2 DSC frequency manipulation module (FFT.c) 122

A3 DSC sampling module (samplingTimer.c) 124

A4 DSC DAC module (DACintFunc.c) 126

A5 DSC ADC module (ADCsamp.c) 127

A6 DSC delay module (delay.c) 128

A7 DSC LCD module (LCDfunc.c) 129

A8 DSC data transmitting module (USBuartInt.c) 132

APPENDIX B - Microchip C30 Header Code

B1 Hardware header file (hardware.h) 134

B2 FFT header file (fft.h) 135

B3 LCD header file (LCDfunc.h) 135

APPENDIX C - Microsoft Visual C# Program Code

xix

C1 PC data receiving main module (dsPICapp.cs) 136

C2 PC data displaying module (Class1.cs) 140

1

CHAPTER 1

INTRODUCTION

1.1 Title & brief introduction

The title of this project is “A New DSP Evaluation Board For Real Time

Application”. Digital signal processing encompasses the digital representation of

signals and the digital hardware to analyze, modify, extract information from digital

signals. There are certain advantages in term of flexibility, reproducibility, reliability

and complexity we can acquire in using digital techniques for processing rather than

traditional analog devices.

Real time application is an application which places stringent demands on

hardware and software design to complete predefined tasks within a certain time

frame. Hence, a limitation of digital signal processing system for real time

application is that the bandwidth of the system is limited by sampling rate. The

processing speed determines the rate at which the analog signal can be sampled. In

other words, a real time digital signal processing system demands that the signal

processing time must be less than the sampling period in order to complete the

current processing task before the new sample comes in. This real time constraint

limits the highest frequency signal that can be processed by a digital signal

processing system.

2

A common characteristic found in many emerging deeply embedded markets

is a need to process some form of real time analog data, regardless a communications

stream or multimedia information, while at the same time maintaining real time

control of external events. The mixture of the two varies as widely as the diversity of

the real time systems.

Embedded processors like microcontrollers are designed primarily in

handling control oriented applications that are interrupt-driven and excited by

external events. The external event is detected either via digital input/output,

interrupt pins, or analog to digital convertor inputs. The source of the signals to these

pins comes from switches, analog and digital sensors, or status signals from other

systems. Each input represents a piece of information on the status of some outside

event. Outputs are sent to actuators, relays, motors, or other drivers that control

events. In between input excitations and output responses, there sits the

microcontroller, which analyzes the inputs and the present state of the

system, determining what and when the correct decisions need to be done. Table 1.1

below shows how microcontroller is specially designed to perform control oriented

applications.

Embedded

Processor

System

Requirement

Processor feature Benefit

Microcontroller I/O control I/O ports with bit-

level control

Efficient control of

external devices

Direct interface to

actuators, switches, etc

Peripheral

communications

Serial Ports: SPI,

I²C, UART,

CAN

Hardware support for

expansion & external

device networking and

communications

3

Precision control of

motors and actuators

Sophisticated timers

and PWM

peripherals

Low software overhead

Quickly resolve

complex software

program control flow

Conditional jumps

Bit test instructions

Interrupt priority

control

Efficiently implement

control oriented algorithms

Fast response to

external events

External interrupts

with multiple

priority levels

Program control

Immediately redirected on

event occurrence with

minimal overhead

Conversion of sensor

data

Analog-to-digital

(A/D)

converters

Hardware support for

external sensors

Table 1.1: Summary of a microcontroller’s features

Digital Signal Processors (DSP), on the other hand, are embedded processors

which found in systems that require the precision processing of digitized analog

signals. The ultimate goal of a digital signal processor is to perform as many

arithmetic operations as possible in the smallest number of cycles. Traditional DSPs

use complex, compound instructions that allow the programmer to perform multiple

operations in a single instruction and increase the amount of useful processing done.

DSP cores are designed to be number crunchers. They must perform two tasks very

well: first, a DSP core must perform multiple math functions, including

multiplication, extremely quickly; and second, a DSP needs to continuously feed the

data path to the number crunching computational units so that they can continue to

crunch away. All this makes the programming model of a DSP look all so different

when compared to a microcontroller. Table 1.2 below shows how a DSP is specially

designed to perform number crunching digital signal processing applications.

4

Embedded

Processor

System

Requirement

Processor feature Benefit

Digital Signal

Processor

Software filters Multiply/Accumulate

unit

Digital filtering in few

cycles

Zero-overhead loops

Interface to codec High-speed serial

ports

Hardware support for

translation of analog

signals

High data

throughput

from serial ports

Peripheral DMA Less wasted cycles

fetching data from serial

ports

Fast data access Harvard architectures

and variants

Fast execution of signal

processing algorithms

Table 1.2: Summary of a digital signal processor’s features

The two divergent paths of microcontroller and DSP may cross occasionally

each other with each processor performing both tasks (controlling tasks and digital

signal processing tasks) due to the explosive growth in personal computing,

telecommunications, internet technologies, telephony, and portable applications.

An evaluation board is a general purpose board with an embedded processor

and generally with a way to download user’s program and execute user’s program as

well on it. This is very useful as a quick development aid for a user. An evaluation

board can be bought as an off–the-shelf product or can be self developed in

accordance to user’s project requirements. Self tailored evaluation board integrates a

bare embedded processor with different types of modules based on user’s

requirements. Once the evaluation board is ready, a user can develop a large variety

of programs for different design applications.

5

1.2 Objectives

Our ultimate goal is to produce a new digital signal processing evaluation

board for real time application. We wish to seek best solution among market

available architectures to perform digital signal processing task and controlling task

for real time application.

With ultimate objective as mentioned above in mind, we eagerly wish to

analyze digital signal processing algorithms and transform these theorized algorithms

into real time application by developing high level language or machine language

programs. Accomplished program will be downloaded into microprocessor for

application purposes.

On top of application program development, we aim to resolve rigid

hardware design problem which is inherent in off-the-shelf evaluation board. To

achieve this, we customize our own evaluation board for this project.

On the other hand, we wish to expose ourselves towards knowledge of

embedded processor core selection, module selection, module planning, module

testing, module integration, printed circuit board design, communication channel

between personal computer and embedded microprocessor and other related

knowledge fields.

Cost reduction is anticipated can be achieved as well through self developed

evaluation board compared to a purchase of an off-the-shelf evaluation board.

6

In a nutshell, we hope to figure out the process flow of designing an

evaluation board which seems to be a black box for most of the users in addition to

develop digital signal processing algorithm by using appropriate embedded

microprocessor. This project provides us a precious opportunity to achieve all the

objectives as discussed earlier.

1.3 Scope of project & project background

This project is an effort continuation from a student who has designed an

evaluation board by using TMS320 digital signal processor core 2 semesters ago.

The student, who comes from the faculty of biomedical engineering, Universiti

Teknologi Malaysia, is not having his prototype completely functioning due to

certain specific reasons.

Due to time frame and hardware equipment constraints, the project has been

scoped down to concentrate on the digital signal processing of human voice which

falls below the frequency of 10 kHz.

The personal computer terminal which connects to the evaluation board is

expected to display the real time output result in textual or graphical format from the

digital signal processing tasks that have been performed by embedded processor. For

instance, the computer terminal should be able to display the human voice signal in

frequency domain at monitor screen.

This project is targeted to have its embedded microprocessor performing

some basic digital signal processing functions such as frequency domain

manipulations, time domain manipulations and filtering operations. Amount of

7

additional digital signal processing operations to be included in this project strongly

depends on available project’s bandwidth.

Fundamental modules and control modules which will be integrated into

evaluation board are LCD module, LED module, power module, direct port access

module and key press/keypad/switch module

Communication module which establishes connection between personal

computer and evaluation board will preferably be Universal Serial Bus (USB) via

Universal asynchronous receiver/transmitter (UART) output from embedded

microprocessor core. Recommended Standard 232 (RS232) communication will be

included as well as a secondary connection link if time frame permits since most of

the early generation computers still support this type of connection.

Since this project focuses on human voice signal processing, some related

modules will be included in order to favor this digital signal processing task. These

modules are codec module and analog to digital converter input module.

1.4 Problem statement

Certain embedded microprocessors have been designed for their supervisory

& control ability while others have been crafted for their data throughput &

computational power. Explosive growth in electronic field places a strong request for

an embedded system to own both excellent supervisory ability and high

computational ability. Every embedded microprocessor available in market more or

less faces some challenges for certain extent to possess those two abilities.

8

An evaluation board can be bought as an off–the-shelf product or can be self

developed. Generally, an evaluation board is used by users who intend to exploit the

full potential of the embedded microprocessor. The board is designed to demonstrate

the capability the embedded microprocessor and to provide a hardware tool for

developing and evaluating applications for the embedded microprocessor. Off the

shelf evaluation board often includes tool suite which allows the user to develop and

simulate routines, download the software to on-chip memory, run it and debug it

using a debugger.

From an initial view, it seems like off-the-shelf evaluation board provide a

complete and satisfactory solutions towards application system development. But, on

the contrary, taking a closer look will discover that off-the-shelf evaluation board

only provides flexibility in term of program design and does not favor flexibility of

hardware design. Flexible program design enables a user to develop various types of

applications but rigid hardware design may results in performance mismatch, system

incompatibility, project failure, cost ineffectiveness and other undesired

consequences.

It is true for certain extent that we can choose among off-the-shelf evaluation

boards which best suit our hardware demands, but it is very hard to find one board

which completely fulfills every desired specification. Discrepancy always exists

between an anticipated and ready made evaluation board. For example, a user who

chooses an off-the-shelf evaluation board with his or her intended core operating

speed, supply voltage and memory size may not find the board providing useful USB

connection as a communication channel with personal computer. Same theory

applies when a user successfully finds a board with intended communication channel

but the board is accompanied with disappointing core performance at the same

instant.

9

Besides core performance and communication methods, there are some

hardware factors which a user may also greatly wish to have the freedom to

customize such as the various types of evaluation board’s integrated modules like

LCD, codec, motor and the others. The size of the evaluation board sometimes is

listed into user’s consideration as well when buying an off-the-shelf product.

Undoubtedly, the cost of an evaluation board plays an important role as well. Even if

we are optimistic enough to assume that we finally manage to buy a product which

match all of our requirements, it is still not guaranteed that we can get it in low price.

All the factors as mentioned above have forced the users to achieve certain

tradeoff towards design specifications when they decide to utilize an off-the-shelf

evaluation board for their project development. Design tradeoff unavoidably leads to

performance mismatch, system incompatibility, project imperfection, cost

ineffectiveness and other undesired consequences.