O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Real-Time Digital Signal Processing from MATLAB to C with the TMS320C6x DSPs, Third Edition, 3rd Edition

Book Description

This updated edition gives readers hands-on experience in real-time DSP using a practical, step-by-step framework that also incorporates demonstrations, exercises, and problems, coupled with brief overviews of applicable theory and MATLAB applications. Organized in three sections that cover enduring fundamentals and present practical projects and invaluable appendices, this new edition provides support for the most recent and powerful of the inexpensive DSP development boards currently available from Texas Instruments: the OMAP-L138 LCDK. It includes two new real-time DSP projects, as well as three new appendices: an introduction to the Code Generation tools available with MATLAB, a guide on how to turn the LCDK into a portable battery-operated device, and a comparison of the three DSP boards directly supported by this edition.

Table of Contents

  1. Cover
  2. Half Title
  3. Title Page
  4. Copyright Page
  5. Dedication
  6. Foreword
  7. Authors
  8. Table of Contents
  9. List of Figures
  10. List of Tables
  11. List of Program Listings
  12. Preface
  13. Acknowledgments
  14. Section I: Enduring Fundamentals
    1. 1 Introduction and Organization
      1. 1.1 Why Do You Need This Book?
        1. 1.1.1 Other DSP Books
        2. 1.1.2 Demos and DSP Hardware
        3. 1.1.3 Philosophy of This Book
      2. 1.2 Real-Time DSP
      3. 1.3 How to Use This Book
        1. 1.3.1 Supported Boards
        2. 1.3.2 Host Computer to DSP Board Communication
        3. 1.3.3 Transition to Real-Time
        4. 1.3.4 Chapter Coverage
        5. 1.3.5 Hardware and Software Installation
        6. 1.3.6 Reading Program Listings
      4. 1.4 Get Started
      5. 1.5 Problems
    2. 2 Sampling and Reconstruction
      1. 2.1 Theory
        1. 2.1.1 Choosing a Sampling Frequency
        2. 2.1.2 Input/Output Issues: Samples or Frames?
        3. 2.1.3 The Talk-Through Concept
      2. 2.2 winDSK Demonstration
        1. 2.2.1 Starting winDSK
        2. 2.2.2 Talk-Thru Application
      3. 2.3 Talk-Through Using Windows
      4. 2.4 Talk-Through Using MATLAB and Windows
        1. 2.4.1 Talk-Through Using MATLAB Only
        2. 2.4.2 Talk-Through Using MATLAB and the DSK
      5. 2.5 DSK Implementation in C
      6. 2.6 Follow-On Challenges
      7. 2.7 Problems
    3. 3 FIR Digital Filters
      1. 3.1 Theory
        1. 3.1.1 Traditional Notation
        2. 3.1.2 FIR Filters Compared to IIR Filters
        3. 3.1.3 Calculating the Output of a Filter
      2. 3.2 winDSK Demonstration
        1. 3.2.1 Graphic Equalizer Application
        2. 3.2.2 Notch Filter Application
        3. 3.2.3 Audio Effects Application
      3. 3.3 MATLAB Implementation
        1. 3.3.1 Built-In Approach
        2. 3.3.2 Creating Your Own Filter Algorithm
      4. 3.4 DSK Implementation in C
        1. 3.4.1 Brute-Force FIR Filtering in C: Part 1
        2. 3.4.2 Brute-Force FIR Filtering in C: Part 2
        3. 3.4.3 Circular Buffered FIR Filtering
      5. 3.5 Follow-On Challenges
      6. 3.6 Problems
    4. 4 IIR Digital Filters
      1. 4.1 Theory
      2. 4.2 win DSK Demonstration: Notch Filter Application
      3. 4.3 MATLAB Implementation
        1. 4.3.1 Filter Designand Analysis
        2. 4.3.2 IIR Filter Notation
        3. 4.3.3 Block Diagrams
        4. 4.3.4 Built-In Approach
        5. 4.3.5 Creating Your Own Filter Algorithm
      4. 4.4 DSK Implementation in C
        1. 4.4.1 Brute-Force IIR Filtering
        2. 4.4.2 More Efficient IIR Filtering
      5. 4.5 Follow-On Challenges
      6. 4.6 Problems
    5. 5 Periodic Signal Generation
      1. 5.1 Theory
        1. 5.1.1 Periodic Signals in DSP
        2. 5.1.2 Signal Generation
      2. 5.2 winDSK Demonstration
        1. 5.2.1 Arbitrary Waveform
        2. 5.2.2 DTMF
      3. 5.3 MATLAB Implementation
        1. 5.3.1 Direct Digital Synthesizer Technique
        2. 5.3.2 Table Lookup Technique
      4. 5.4 DSK Implementation in C
        1. 5.4.1 Direct Digital Synthesizer Technique
        2. 5.4.2 Table Lookup Technique
        3. 5.4.3 Table Lookup Technique with Table Creation
        4. 5.4.4 Digital Resonator Technique
      5. 5.5 Pseudonoise Sequences
        1. 5.5.1 Theory
        2. 5.5.2 winDSK Demonstration
        3. 5.5.3 MATLAB Implementation
        4. 5.5.4 DSK Implementation in C
      6. 5.6 Follow-On Challenges
      7. 5.7 Problems
    6. 6 Frame-Based DSP
      1. 6.1 Theory
        1. 6.1.1 Drawbacks of Sample-Based DSP
        2. 6.1.2 What Is a Frame?
      2. 6.2 winDSK Demonstration
      3. 6.3 MATLAB Implementation
      4. 6.4 DSK Implementation in C
        1. 6.4.1 Triple Buffering
        2. 6.4.2 A Frame-Based DSP Example
        3. 6.4.3 Using Direct Memory Access
      5. 6.5 Summary of Frame-Based Processing
      6. 6.6 Follow-On Challenges
      7. 6.7 Problems
    7. 7 Digital Filters Using Frames
      1. 7.1 Theory
      2. 7.2 winDSK Demonstration
      3. 7.3 MATLAB Implementation
      4. 7.4 DSK Implementation in C
        1. 7.4.1 Understanding the FIR Process for Frames
        2. 7.4.2 How to Avoid the “Edge” Problems
        3. 7.4.3 Explanation of the C Code
      5. 7.5 Follow-On Challenges
      6. 7.6 Problems
    8. 8 The Fast Fourier Transform
      1. 8.1 Theory
        1. 8.1.1 Defining the FFT
        2. 8.1.2 The Twiddle Factors
        3. 8.1.3 The FFT Process
        4. 8.1.4 Bit-Reversed Addressing
        5. 8.1.5 Using the FFT for Filtering
        6. 8.1.6 Avoiding Circular Convolution
        7. 8.1.7 Real-Time Fast Convolution
      2. 8.2 winDSK Demonstration
      3. 8.3 MATLAB Implementation
      4. 8.4 Implementation in C
      5. 8.5 Follow-On Challenges
      6. 8.6 Problems
    9. 9 Spectral Analysis and Windowing
      1. 9.1 Theory
        1. 9.1.1 Power Spectrum of a Signal
        2. 9.1.2 The Need for Windowing
        3. 9.1.3 Window Characteristics
      2. 9.2 winDSK Demonstration
      3. 9.3 MATLAB Implementation
      4. 9.4 DSK Implementation in C
      5. 9.5 Conclusion
      6. 9.6 Follow-On Challenges
      7. 9.7 Problems
  15. Section II: Projects
    1. 10 Project 1: Guitar Special Effects
      1. 10.1 Introduction to Projects
      2. 10.2 Theory
        1. 10.2.1 Background
        2. 10.2.2 How the Effects Work
      3. 10.3 winDSK Demonstration
      4. 10.4 MATLAB Implementation
        1. 10.4.1 FIR Comb Filter
        2. 10.4.2 IIR Comb Filter
        3. 10.4.3 Notch Filter
        4. 10.4.4 Flanger
        5. 10.4.5 Tremelo
      5. 10.5 DSK Implementation in C
        1. 10.5.1 Real-Time Comb Filters
        2. 10.5.2 Other Real-Time Special Effects
      6. 10.6 Follow-On Challenges
    2. 11 Project 2: Graphic Equalizer
      1. 11.1 Theory
      2. 11.2 winDSK Demonstration
        1. 11.2.1 Graphic Equalizer Application
        2. 11.2.2 Effect of the Graphic Equalizer
      3. 11.3 MATLAB Implementation
      4. 11.4 DSK Implementation in C
        1. 11.4.1 Applying Gain to Filter Bands
        2. 11.4.2 GEL File Slider Control
      5. 11.5 Follow-On Challenges
    3. 12 Project 3: Second-Order Sections
      1. 12.1 Theory
      2. 12.2 winDSK Demonstration: Notch Filter Application
      3. 12.3 MATLAB Implementation
      4. 12.4 DSK Implementation in C
        1. 12.4.1 Example SOS Code
      5. 12.5 Points to Ponder
      6. 12.6 Follow-On Challenges
    4. 13 Project 4: Peak Program Meter
      1. 13.1 Theory
      2. 13.2 winDSK Demonstration: commDSK
      3. 13.3 MATLAB Implementation
      4. 13.4 DSK Implementation in C
        1. 13.4.1 Example PPM Code
        2. 13.4.2 DSK LED Control
        3. 13.4.3 Another PPM Code Version
      5. 13.5 Follow-On Challenges
    5. 14 Project 5: Adaptive Filters
      1. 14.1 Theory
        1. 14.1.1 A Problem Solved by Adaptive Filters
        2. 14.1.2 The LMS Adpative Filter
      2. 14.2 winDSK8 Demonstration
      3. 14.3 MATLAB Implementation
      4. 14.4 DSK Implementation in C
      5. 14.5 Follow-On Challenges
    6. 15 Project 6: AM Transmitters
      1. 15.1 Theory
      2. 15.2 winDSK Demonstration
      3. 15.3 MATLAB Implementation
      4. 15.4 DSK Implementation in C
      5. 15.5 Follow-On Challenges
    7. 16 Project 7: AM Receivers
      1. 16.1 Theory
        1. 16.1.1 Envelope Detector
        2. 16.1.2 The Hilbert-Based AM Receiver
      2. 16.2 winDSK Demonstration
      3. 16.3 MATLAB Implementation
      4. 16.4 DSK Implementation in C
      5. 16.5 Follow-On Challenges
    8. 17 Project 8: Phase-Locked Loop
      1. 17.1 Theory
      2. 17.2 winDSK Demonstration
      3. 17.3 MATLAB Implementation
        1. 17.3.1 PLL Simulation
        2. 17.3.2 A Few Updates to the MATLAB Implementation
      4. 17.4 DSK Implementation in C
        1. 17.4.1 Components of the PLL
        2. 17.4.2 System Testing
      5. 17.5 Follow-On Challenges
    9. 18 Project 9: BPSK Digital Transmitters
      1. 18.1 Theory
        1. 18.1.1 Random Data and Symbol Generation
        2. 18.1.2 BPSK Using Antipodal Rectangularly Shaped Bits
        3. 18.1.3 BPSK Using Impulse Modulated Raised-Cosine Shaped Bits
      2. 18.2 winDSK Demonstration
        1. 18.2.1 commDSK: Unfiltered BPSK
        2. 18.2.2 commDSK: Raised-Cosine Filtered BPSK
      3. 18.3 MATLAB Implementation
        1. 18.3.1 Rectangular Shaped BPSK Signal Generator
        2. 18.3.2 Impulse Modulated Raised-Cosine BPSK Signal Generator
      4. 18.4 DSK Implementation in C
        1. 18.4.1 A Rectangular Pulse Shaped BPSK Transmitter
        2. 18.4.2 A Raised-Cosine Pulse Shaped BPSK Transmitter
        3. 18.4.3 Summary of Real-Time Code
      5. 18.5 Follow-On Challenges
    10. 19 Project 10: BPSK Digital Receivers
      1. 19.1 Theory
        1. 19.1.1 The Output of the Matched Filter
        2. 19.1.2 The Eye-Pattern
        3. 19.1.3 Maximum Likelihood Timing Recovery
      2. 19.2 winDSK Demonstration
      3. 19.3 MATLAB Implementation
      4. 19.4 DSK Implementation in C
        1. 19.4.1 Components of the Digital Receiver
        2. 19.4.2 System Testing
      5. 19.5 Follow-On Challenges
    11. 20 Project 11: MPSK and QAM Digital Transmitters
      1. 20.1 Theory
        1. 20.1.1 I- and Q-Based Transmitters
        2. 20.1.2 A Few Constellation Diagrams
      2. 20.2 winDSK Demonstration
        1. 20.2.1 commDSK: Root-Raised-Cosine Filtered QPSK
      3. 20.3 MATLAB Implementation
        1. 20.3.1 Impulse Modulated Root-Raised-Cosine QPSK Signal Generator
      4. 20.4 DSK Implementation in C
        1. 20.4.1 A Root-Raised-Cosine Pulse Shaped QPSK Transmitter
        2. 20.4.2 A More Efficient RRC Pulse Shaped QPSK Transmitter
        3. 20.4.3 Summary of Real-Time Code
      5. 20.5 Higher-Order Modulation Schemes
      6. 20.6 Follow-On Challenges
    12. 21 Project 12: QPSK Digital Receivers
      1. 21.1 Theory
      2. 21.2 winDSK8 Demonstration
      3. 21.3 MATLAB Implementation
        1. 21.3.1 Through the AGC
        2. 21.3.2 A Complete QPSK Receiver
      4. 21.4 DSK Implementation in C
        1. 21.4.1 Through the AGC
        2. 21.4.2 A Complete QPSK Receiver
        3. 21.4.3 System Testing
      5. 21.5 Follow-On Challenges
  16. Section III: Appendices
    1. A Code Composer Studio: An Overview
      1. A.1 Introduction
      2. A.2 Starting Code Composer Studio
      3. A.3 Conclusion
    2. B DSP/BIOS
      1. B.1 Introduction
        1. B.1.1 DSP/BIOS Major Features
        2. B.1.2 DSP/BIOS Threads
      2. B.2 DSP/BIOS Sample Projects
    3. C Numeric Representations
      1. C.1 Endianness
      2. C.2 Integer Representations
      3. C.3 Integer Division and Rounding
      4. C.4 Floating-Point Representations
      5. C.5 Fixed-Point Representations
      6. C.6 Summary of Numeric Representations
    4. D TMS320C6x Architecture
      1. D.1 Computer Architecture Basics
        1. D.1.1 Instruction Set Architecture
        2. D.1.2 Register Architectures
        3. D.1.3 Memory Architectures
        4. D.1.4 Fetch-Execute Model
        5. D.1.5 Pipelining
        6. D.1.6 Single- versus Multiple-Issue
        7. D.1.7 Scheduling
      2. D.2 TMS320C671x Architecture
        1. D.2.1 Memory System
        2. D.2.2 Pipeline and Scheduling
        3. D.2.3 Peripherals
        4. D.2.4 Host Port Interface
      3. D.3 TMS320C674x Architecture
    5. E Related Tools for DSKs
      1. E.1 Introduction
      2. E.2 Windows Control Applications
        1. E.2.1 Sample Windows Control Application
      3. E.3 MATLAB Exports
        1. E.3.1 Exporting Direct-Form II Implementations
        2. E.3.2 Exporting Second-Order Section Implementations
      4. E.4 MATLAB Real-Time Interface
    6. F Using the Code Generator with MATLAB
      1. F.1 Introduction
      2. F.2 An FIR Filter Example
        1. F.2.1 Before Using the MATLAB Coder
        2. F.2.2 Using the MATLAB Coder
        3. F.2.3 Transferring to a CCS Project
        4. F.2.4 Observations
      3. F.3 Conclusion
    7. G Battery Power for the DSP Boards
      1. G.1 Introduction
      2. G.2 Method
      3. G.3 Testing
      4. G.3.1 Initial testing
      5. G.3.2 Final testing
      6. G.4 Conclusion
    8. H Programming Perils and Pitfalls
      1. H.1 Debug versus Release Builds
      2. H.2 The Volatile Keyword
      3. H.3 Function Prototypes and Return Types
      4. H.4 Arithmetic Issues
      5. H.5 Controlling the Location of Variables in Memory
      6. H.6 Real-Time Schedule Failures
      7. H.7 Variable Initialization
      8. H.8 Integer Data Sizes
    9. I Comparison of DSP Boards
      1. I.1 Introduction
      2. I.2 Three Boards
      3. I.3 Conclusion
    10. J Abbreviations, Acronyms, and Symbols
  17. References
  18. Index