Real-time Digital Signal Processing with the TMS320C6x

Slides:



Advertisements
Similar presentations
Design of Digital IIR Filter
Advertisements

Digital signal processing -G Ravi kishore. INTRODUCTION The goal of DSP is usually to measure, filter and/or compress continuous real-world analog signals.
Digital Signal Processing – Chapter 11 Introduction to the Design of Discrete Filters Prof. Yasser Mostafa Kadah
1 Dr. Un-ki Yang Particle Physics Group or Shuster 5.15 Amplifiers and Feedback: 3.
Discussion #25 – ADCECEN 3011 Conversion Mosiah 5:2 2 And they all cried with one voice, saying: Yea, we believe all the words which though has spoken.
AMI 4622 Digital Signal Processing
CEN352, Dr. Ghulam Muhammad King Saud University
Implementation of Basic Digital Filter Structures R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003.
Image (and Video) Coding and Processing Lecture 2: Basic Filtering Wade Trappe.
Microcomputer Systems 1 Introduction to DSP’s. 9 August 2015Veton Këpuska2 Introduction to DSP’s  Definition: DSP – Digital Signal Processing/Processor.
Prepared by: Hind J. Zourob Heba M. Matter Supervisor: Dr. Hatem El-Aydi Faculty Of Engineering Communications & Control Engineering.
Speech Signal Processing I Edmilson Morais and Prof. Greg. Dogil October, 25, 2001.
Lecture 9 FIR and IIR Filter design using Matlab
Digital Signals and Systems
EE513 Audio Signals and Systems Digital Signal Processing (Systems) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky.
The sampling of continuous-time signals is an important topic It is required by many important technologies such as: Digital Communication Systems ( Wireless.
DSP. What is DSP? DSP: Digital Signal Processing---Using a digital process (e.g., a program running on a microprocessor) to modify a digital representation.
Discrete-Time and System (A Review)
1 Chapter 8 The Discrete Fourier Transform 2 Introduction  In Chapters 2 and 3 we discussed the representation of sequences and LTI systems in terms.
Random signals. Histogram of the random signal Continuous Time Sinusoidal signals.
Digital signal Processing
ELEN 5346/4304 DSP and Filter Design Fall Lecture 12: Number representation and Quantization effects Instructor: Dr. Gleb V. Tcheslavski Contact:
Digital Signal Processing
Chapter 6 Digital Filter Structures
DISP 2003 Lecture 6 – Part 2 Digital Filters 4 Coefficient quantization Zero input limit cycle How about using float? Philippe Baudrenghien, AB-RF.
Ch.5 Fixed-Point vs. Floating Point. 5.1 Q-format Number Representation on Fixed-Point DSPs 2’s Complement Number –B = b N-1 …b 1 b 0 –Decimal Value D.
1 Lecture 1: February 20, 2007 Topic: 1. Discrete-Time Signals and Systems.
Z TRANSFORM AND DFT Z Transform
1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.
EEE 503 Digital Signal Processing Lecture #2 : EEE 503 Digital Signal Processing Lecture #2 : Discrete-Time Signals & Systems Dr. Panuthat Boonpramuk Department.
1 Digital Signal Processing Lecture 3 – 4 By Dileep kumar
revision Transfer function. Frequency Response
Technological Educational Institute Of Crete Department Of Applied Informatics and Multimedia Neural Networks Laboratory Slide 1 FOURIER TRANSFORMATION.
Digital Signal Processing
Professor A G Constantinides 1 Finite Wordlength Effects Finite register lengths and A/D converters cause errors in:- (i) Input quantisation. (ii)Coefficient.
Digital Signal Processing
DEPARTMENTT OF ECE TECHNICAL QUIZ-1 AY Sub Code/Name: EC6502/Principles of digital Signal Processing Topic: Unit 1 & Unit 3 Sem/year: V/III.
Continuous-time Signal Sampling
Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)1 BME452 Biomedical Signal Processing Lecture 2  Discrete Time Signals and.
Chapter 6 Discrete-Time System. 2/90  Operation of discrete time system 1. Discrete time system where and are multiplier D is delay element Fig. 6-1.
DISP 2003 Lecture 5 – Part 1 Digital Filters 1 Frequency Response Difference Equations FIR versus IIR FIR Filters Properties and Design Philippe Baudrenghien,
What is filter ? A filter is a circuit that passes certain frequencies and rejects all others. The passband is the range of frequencies allowed through.
Lecture 09b Finite Impulse Response (FIR) Filters
Analysis of Linear Time Invariant (LTI) Systems
Learning from the Past, Looking to the Future James R. (Jim) Beaty, PhD - NASA Langley Research Center Vehicle Analysis Branch, Systems Analysis & Concepts.
1 Digital Signal Processing (DSP) By: Prof. M.R.Asharif Department of Information Engineering University of the Ryukyus, Okinawa, Japan.
1 Basic Signal Conversion 센서 및 계측 공학 (Sensor and Instrumentation Engineering) 2016 년 1 학기 충북대학교 전기전자반도체공학과 박 찬식
Digital Signal Processing
Real-time Digital Signal Processing Digital Filters.
بسم الله الرحمن الرحيم Digital Signal Processing Lecture 2 Analog to Digital Conversion University of Khartoum Department of Electrical and Electronic.
1 Chapter 8 The Discrete Fourier Transform (cont.)
Unit IV Finite Word Length Effects
MECH 373 Instrumentation and Measurements
Chapter 4 Dynamical Behavior of Processes Homework 6 Construct an s-Function model of the interacting tank-in-series system and compare its simulation.
Chapter 4 Dynamical Behavior of Processes Homework 6 Construct an s-Function model of the interacting tank-in-series system and compare its simulation.
Lattice Struture.
EEE4176 Applications of Digital Signal Processing
Sampling rate conversion by a rational factor
EE Audio Signals and Systems
Soutenance de thèse vendredi 24 novembre 2006, Lorient
لجنة الهندسة الكهربائية
Quantization in Implementing Systems
Z TRANSFORM AND DFT Z Transform
Chapter 6 Discrete-Time System
Conversation between Analogue and Digital System
Finite Wordlength Effects
DEPARTMENT OF INFORMATION TECHNOLOGY DIGITAL SIGNAL PROCESSING UNIT 4
DEPARTMENT OF INFORMATION TECHNOLOGY DIGITAL SIGNAL PROCESSING UNIT 4
Chapter 9 Advanced Topics in DSP
ELEN E4810: Digital Signal Processing Topic 11: Continuous Signals
Presentation transcript:

Real-time Digital Signal Processing with the TMS320C6x Lecture 7 Real-time Digital Signal Processing with the TMS320C6x Dr. Konstantinos Tatas

Outline Digital Signal Processing Basics ADC and sampling Aliasing Discrete-time signals Digital Filtering FFT Effects of finite fixed-point wordlength Efficient DSP application implementation on TMS320C6x processors FIR filter implementation IIR filter implementation

Digital Signal Processing Basics A basic DSP system is composed of: An ADC providing digital samples of an analog input A Digital Processing system (μP/ASIC/FPGA) A DAC converting processed samples to analog output Real-time signal processing: All processing operation must be complete between two consecutive samples

ADC and Sampling An ADC performs the following: Quantization Binary Coding Sampling rate must be at least twice as much as the highest frequency component of the analog input signal

Aliasing When sampling at a rate of fs samples/s, if k is any positive or negative integer, it’s impossible to distinguish between the sampled values of a sinewave of f0 Hz and a sinewave of (f0+kfs) Hz.

Discrete-time signals A continuous signal input is denoted x(t) A discrete-time signal is denoted x(n), where n = 0, 1, 2, … Therefore a discrete time signal is just a collection of samples obtained at regular intervals (sampling frequency)

Common Digital Sequences Unit-step sequence: Unit-impulse sequence:

The z transform Discrete equivalent of the Laplace transform

z-transform properties Linear Shift theorem Note:

Transfer Function z-transform of the output/z transfer of the input Pole-zero form

Pole-zero plot

System Stability Position of the poles affects system stability The position of zeroes does not

Example 1 A system is described by the following equation: y(n)=0.5x(n) + 0.2x(n-1) + 0.1y(n-1) Plot the system’s transfer function on the z plane Is the system stable? Plot the system’s unit step response Plot the system’s unit impulse response

The Discrete Fourier Transform (DFT) Discrete equivalent of the continuous Fourier Transform A mathematical procedure used to determine the harmonic, or frequency, content of a discrete signal sequence

The Fast Fourier Transform (FFT) FFT is not an approximation of the DFT, it gives precisely the same result

Digital Filtering In signal processing, the function of a filter is to remove unwanted parts of the signal, such as random noise, or to extract useful parts of the signal, such as the components lying within a certain frequency range Analog Filter: Input: electrical voltage or current which is the direct analogue of a physical quantity (sensor output) Components: resistors, capacitors and op amps Output: Filtered electrical voltage or current Applications: noise reduction, video signal enhancement, graphic equalisers Digital Filter: Input: Digitized samples of analog input (requires ADC) Components: Digital processor (PC/DSP/ASIC/FPGA) Output: Filtered samples (requires DAC)

Averaging Filter

Ideal Filter Frequency Response

Realistic vs. Ideal Filter Response

FIR filtering Finite Impulse Response (FIR) filters use past input samples only Example: y(n)=0.1x(n)+0.25x(n-1)+0.2x(n-2) Z-transform: Y(z)=0.1X(z)+0.25X(z)z^(-1)+0.2X(z)(z^-2) Transfer function: H(z)=Y(z)/X(z)=0.1+0.25z^(-1)+0.2(z^-2) No poles, just zeroes. FIR is stable

FIR filter design Inverse DFT of H(m)

FIR Filter Implementation y(n)=h(0)x(n)+h(1)x(n-1)+h(2)x(n-2)+h(3)x(n-3)

Example 2 A filter is described by the following equation: y(n)=0.5x(n) + 1x(n-1) + 0.5x(n-2), with initial condition y(-1) = 0 What kind of filter is it? Plot the filter’s transfer function on the z plane Is the filter stable? Plot the filter’s unit step response Plot the filter’s unit impulse response

IIR Filtering Infinite Impulse Response (IIR) filters use past outputs together with past inputs

IIR Filter Implementation y(n)=b(0)x(n)+b(1)x(n-1)+b(2)x(n-2)+b(3)x(n-3) + a(0)y(n)+a(1)y(n-1)+a(2)y(n-2)+a(3)y(n-3)

FIR - IIR filter comparison Simpler to design Inherently stable Can be designed to have linear phase Require lower bit precision IIR Need less taps (memory, multiplications) Can simulate analog filters

Example 3 A filter is described by the following equation: y(n)=0.5x(n) + 0.2x(n-1) + 0.5y(n-1) + 0.2y(n-2), with initial condition y(-1)=y(-2) = 0 What kind of filter is it? Plot the filter’s transfer function on the z plane Is the filter stable? Plot the filter’s unit step response Plot the filter’s unit impulse response

Software and Hardware Implementation of FIR filters

Fixed-Point Binary Representation Representation of a number with integer and fractional part: This is denoted as Qnm representation The binary point is implied It will affect the accuracy (dynamic range and precision) of the number Purely a programmer’s convention and has no relationship with the hardware.

Examples x = 0100 1000 0001 1000b Q0.15 => x= 2^(-1) + 2^(-4) + 2^(-11)+2^(-12) Q1.14 => x= 2^0 + 2^(−3) + 2^(−10) + 2^(−11) Q2.13 => x = 2^1 + 2^(−2) + 2^(−9) + 2^(−10) Q7.8 => x = ? Q12.3 => x = ?

EFFECTS OF FINITE FIXED-POINT BINARY WORD LENGTH Quantization Errors ADC Coefficients Truncation Rounding Data Overflow

ADC Quantization Error ADC converts an analog signal x(t) into a digital signal x(n), through sampling, quantization and encoding Assuming x(n) is interpreted as the Q15 fractional number such that −1 ≤ x(n) < 1 dynamic range of fractional numbers is 2. Since the quantizer employs B bits, the number of quantization levels available is 2B The spacing between two successive quantization levels is Δ = 2/2^B = 2^(1-B) Therefore the quantization error is |e(n)|≤Δ/2

Coefficient Quantization Error Effects on FIR filters Location of zeroes changes Therefore, frequency response changes Effects on IIR filters Location of poles and zeroes change Could move poles outside of unit circle, leading to unstable implementations

Roundoff error

Overflow error signals and coefficients normalized in the range of −1 to 1 for fixed-point arithmetic, the sum of two B-bit numbers may fall outside the range of −1 to 1. Severely distorts the signal Overflow handling Saturation arithmetic “Clips” the signal, although better than overflow Should only be used to guarantee no overflow, but should not be the only solution Scaling of signals and coefficients

Coefficient representation Fractional 2’s complement (Q) representation is used To avoid overflow, often scaling down by a power of two factor (S) (right shift) is used. The scaling factor is given by the equation: S=Imax(|h(0)|+|h(1)|+|h(2)|+…) Furthermore, filter coefficient larger than 1, cause overflow and are scaled down further by a factor B, in order to be less than 1

Example 1 Given the FIR filter Solution: y(n)=0.1x(n)+0.25x(n-1)+0.2x(n-2) Assuming the input range occupies ¼ of the full range Develop the DSP implementation equations in Q-15 format. What is the coefficient quantization error? Solution: S=1/4((|h(0)|+|h(1)|+|h(2)|) = ¼(0.1+0.25+0.2)=3.25/4 Overflow cannot occur, no input (S) scaling required No coefficents > 1, no coefficient (B) scaling required

Example 2 Given the FIR filter Solution: y(n)=0.8x(n)+3x(n-1)+0.6x(n-2) Assuming the input range occupies ¼ of the full range Develop the DSP implementation equations in Q-15 format. What is the coefficient quantization error? Solution: S=1/4((|h(0)|+|h(1)|+|h(2)|) = ¼(0.8+3+0.6)=4.4/4 = 1.1 Therefore: S=2 Largest coefficient: h(1) = 3, therefore B=4 ys(n)=0.2xs(n)+0.75xs(n-1)+0.15xs(n-2)

Simple FIR Hardware implementation VHDL 4-tap filter entity ENTITY my_fir is Port (clk, rst: in std_logic; sample_in: in std_logic_vector(length-1 downto 0); sample_out: out std_logic_vector(length-1 downto 0) ); END ENTITY my_fir;

Example (continued) VHDL 4-tap filter architecture ARCHITECTURE rtl of my_fir is type taps is array 0 to 3 of std_logic_vector(length-1 downto 0); Signal h: taps_type; Signal x_p1, x_p2, x_p3: std_logic_vector(length-1 downto 0); --past samples Signal y: std_logic_vector(2*length-1 downto 0); Begin Process (clk, rst) If rst=‘1’ then x_p1 <= (others => ‘0’); x_p2 <= (others => ‘0’); x_p3 <= (others => ‘0’); Elsif rising_edge(clk) then x_p1 <= sample_in; --delay registers x_p2 <= x_p1; x_p3 <= x_p2; End if; End process; y <= sample_in*h(0)+x_p1*h(1)+x_p2*h(2)+x_p3*h(3); Sample_out <= y(2*length-1 downto length); End;

FIR Software Implementation int yn=0; //filter output initialization short xdly[N+1]; //input delay samples array interrupt void c_int11() //ISR { short i; yn=0; short h[N] = { //coefficients }; xdly[0]=input_sample(); for (i=0; i<N; i++) yn += (h[i]*xdly[i]); for (i=N-1; i>0; i--) xdly[i] = xdly[i-1]; output_sample(yn >> 15); //filter output return; //return from ISR }

IIR C implementation int yn=0; //filter output initialization short xdly[N+1]; //input delay samples array Short ydly[M]; //output delay array interrupt void c_int11() //ISR { short i; yn=0; short a[N] = { //coefficients }; short b[M] = { //coefficients }; xdly[0]=input_sample(); for (i=0; i<N; i++) yn += (a[i]*xdly[i]); for (i=0; i<M; i++) yn += (b[i]*ydly[i]); for (i=N-1; i>0; i--) xdly[i] = xdly[i-1]; ydly[0] = yn >> 15; for (i=M-1; i>0; i--) ydly[i] = ydly[i-1]; output_sample(yn >> 15); //filter output return; //return from ISR }