100% found this document useful (5 votes)
19 views

Instant Access to Digital Signal Processing and Applications with the TMS320C6713 and TMS320C6416 DSK Topics in Digital Signal Processing 2nd Edition Rulph Chassaing ebook Full Chapters

The document provides information about the book 'Digital Signal Processing and Applications with the TMS320C6713 and TMS320C6416 DSK' by Rulph Chassaing and Donald Reay, including details on its content, structure, and available resources for download. It highlights various topics covered in the book, such as DSP development systems, filter design, and code optimization. Additionally, it includes links to download the book and other related ebooks.

Uploaded by

nasratjantje
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (5 votes)
19 views

Instant Access to Digital Signal Processing and Applications with the TMS320C6713 and TMS320C6416 DSK Topics in Digital Signal Processing 2nd Edition Rulph Chassaing ebook Full Chapters

The document provides information about the book 'Digital Signal Processing and Applications with the TMS320C6713 and TMS320C6416 DSK' by Rulph Chassaing and Donald Reay, including details on its content, structure, and available resources for download. It highlights various topics covered in the book, such as DSP development systems, filter design, and code optimization. Additionally, it includes links to download the book and other related ebooks.

Uploaded by

nasratjantje
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 84

Visit https://ebookultra.

com to download the full version and


explore more ebooks

Digital Signal Processing and Applications with


the TMS320C6713 and TMS320C6416 DSK Topics in
Digital Signal Processing 2nd Edition Rulph
Chassaing

_____ Click the link below to download _____


https://ebookultra.com/download/digital-signal-
processing-and-applications-with-the-tms320c6713-and-
tms320c6416-dsk-topics-in-digital-signal-
processing-2nd-edition-rulph-chassaing/

Explore and download more ebooks at ebookultra.com


Here are some suggested products you might be interested in.
Click the link to download

Digital Signal Processing and Applications with the


TMS320C6713 and TMS320C6416 DSK Second Edition Rulph
Chassaing
https://ebookultra.com/download/digital-signal-processing-and-
applications-with-the-tms320c6713-and-tms320c6416-dsk-second-edition-
rulph-chassaing/

Digital Signal Processing Second Edition Fundamentals and


Applications Li Tan

https://ebookultra.com/download/digital-signal-processing-second-
edition-fundamentals-and-applications-li-tan/

Digital signal processing with examples in MATLAB Second


Edition Hush

https://ebookultra.com/download/digital-signal-processing-with-
examples-in-matlab-second-edition-hush/

Digital Signal Processing Techniques and Applications in


Radar Image Processing 1st Edition Bu-Chin Wang

https://ebookultra.com/download/digital-signal-processing-techniques-
and-applications-in-radar-image-processing-1st-edition-bu-chin-wang/
Signal Processing for Digital Communications Artech House
Signal Processing Library George J. Miao

https://ebookultra.com/download/signal-processing-for-digital-
communications-artech-house-signal-processing-library-george-j-miao/

Digital Signal Processing Laboratory Second Edition Kumar

https://ebookultra.com/download/digital-signal-processing-laboratory-
second-edition-kumar/

Digital Signal Processing 1st Edition A. Anand Kumar

https://ebookultra.com/download/digital-signal-processing-1st-edition-
a-anand-kumar/

Digital Signal Processing Laboratory 2nd ed Edition B.


Preetham Kumar

https://ebookultra.com/download/digital-signal-processing-
laboratory-2nd-ed-edition-b-preetham-kumar/

Digital Audio Signal Processing 2nd ed Edition Udo Zölzer

https://ebookultra.com/download/digital-audio-signal-processing-2nd-
ed-edition-udo-zolzer/
Digital Signal Processing and Applications with the
TMS320C6713 and TMS320C6416 DSK Topics in Digital
Signal Processing 2nd Edition Rulph Chassaing Digital
Instant Download
Author(s): Rulph Chassaing, Donald Reay
ISBN(s): 9780470138663, 0470138661
Edition: 2
File Details: PDF, 17.21 MB
Year: 2008
Language: english
Digital Signal Processing
and Applications with the
TMS320C6713 and
TMS320C6416 DSK
SECOND EDITION

Rulph Chassaing
Worcester Polytechnic Institute

Donald Reay
Heriot-Watt University

A JOHN WILEY & SONS, INC., PUBLICATION


Digital Signal Processing
and Applications with the
TMS320C6713 and
TMS320C6416 DSK
TOPICS IN DIGITAL SIGNAL PROCESSING

C. S. BURRUS and T. W. PARKS: DFT/FFT AND CONVOLUTION


ALGORITHMS: THEORY AND IMPLEMENTATION
JOHN R. TREICHLER, C. RICHARD JOHNSON, JR., and MICHAEL G.
LARIMORE: THEORY AND DESIGN OF ADAPTIVE FILTERS
T. W. PARKS and C. S. BURRUS: DIGITAL FILTER DESIGN
RULPH CHASSAING and DARRELL W. HORNING: DIGITAL SIGNAL
PROCESSING WITH THE TMS320C25
RULPH CHASSAING: DIGITAL SIGNAL PROCESSING WITH C AND THE
TMS320C30
RULPH CHASSAING: DIGITAL SIGNAL PROCESSING LABORATORY
EXPERIMENTS USING C AND THE TMS320C31 DSK
RULPH CHASSAING: DSP APPLICATIONS USING C AND THE TMS320C6x
DSK
RULPH CHASSAING and DONALD REAY: DIGITAL SIGNAL PROCESSING
AND APPLICATIONS WITH THE TMS320C6713 AND TMS320C6416 DSK,
Second Edition
Digital Signal Processing
and Applications with the
TMS320C6713 and
TMS320C6416 DSK
SECOND EDITION

Rulph Chassaing
Worcester Polytechnic Institute

Donald Reay
Heriot-Watt University

A JOHN WILEY & SONS, INC., PUBLICATION


Copyright © 2008 by John Wiley & Sons, Inc. All right reserved.

Published by John Wiley & Sons, Inc., Hoboken, New Jersey


Published simultaneously in Canada

No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form
or by any means, electronic, mechanical, photocopying, recording, scanning, or otherwise, except as
permitted under Section 107 or 108 of the 1976 United States Copyright Act, without either the prior
written permission of the Publisher, or authorization through payment of the appropriate per-copy fee
to the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400, fax
978-750-4470, or on the web at www.copyright.com. Requests to the Publisher for permission should
be addressed to the Permissions Departments, John Wiley & Sons, Inc., 111 River Street, Hoboken,
NJ 07030, 201-748-6011, fax 201-748-6008, or online at http://www.wiley.com/go/permission.

Limit of Liability/Disclaimer of Warranty: While the publisher and author have used their best efforts
in preparing this book, they make no representations or warranties with respect to the accuracy or
completeness of the contents of this book and specifically disclaim any implied warranties of
merchantability or fitness for a particular purpose. No warranty may be created or extended by sales
representatives or written sales materials. The advice and strategies contained herein may not be
suitable for your situation. You should consult with a professional where appropriate. Neither the
publisher nor author shall be liable for any loss of profit or any other commercial damages, including
but not limited to special, incidental, consequential, or other damages.

For general information on our other products and services or for technical support, please contact
our Customer Care Department within the United States at 877-762-2974, outside the United States
at 317-572-3993 or fax 317-572-4002.

Wiley also publishes its books in a variety of electronic formats. Some content that appears in print
may not be available in electronic formats. For more information about Wiley products, visit our
web site at www.wiley.com.

Library of Congress Cataloging-in-Publication Data:

Chassaing, Rulph.
Digital signal processing and applications with the TMS320C6713 and TMS320C6416 DSK /
Rulph Chassaing, Donald Reay.—2nd ed.
p. cm.
ISBN 978-0-470-13866-3 (cloth/CD)
1. Signal processing–Digital techniques. 2. Texas Instruments TMS320
series microprocessors–Programming. I. Reay, Donald. II. Title.
TK5102.9.C47422 2008
621.382′2—dc22
20070290065

Printed in the United States of America

10 9 8 7 6 5 4 3 2 1
To Reiko
And to the memory of Rulph and of Jay
Contents

Preface xv
Preface to the First Edition xvii
List of Examples xxi
Programs/Files on Accompanying CD xxvii

1 DSP Development System 1


1.1 Introduction 1
1.2 DSK Support Tools 3
1.2.1 C6713 and C6416 DSK Boards 4
1.2.2 TMS320C6713 Digital Signal Processor 4
1.2.3 TMS320C6416 Digital Signal Processor 5
1.3 Code Composer Studio 6
1.3.1 CCS Version 3.1 Installation and Support 6
1.3.2 Installation of Files Supplied with This Book 7
1.3.3 File Types 7
1.4 Quick Tests of the DSK (On Power On and Using CCS) 7
1.5 Programming Examples to Test the DSK Tools 9
1.6 Support Files 30
1.6.1 Initialization/Communication File (c6713dskinit.c) 30
1.6.2 Header File (c6713dskinit.h) 33
1.6.3 Vector Files (vectors_intr.asm,
vectors_poll.asm) 34
1.6.4 Linker Command File (c6713dsk.cmd) 34
1.7 Assignments 38
References 41
vii
viii Contents

2 Input and Output with the DSK 45


2.1 Introduction 45
2.2 TLV320AIC23 (AIC23) Onboard Stereo Codec for Input
and Output 46
2.3 Programming Examples Using C Code 48
2.3.1 Real-Time Sine Wave Generation 60
2.4 Assignments 101
References 101

3 Architecture and Instruction Set of the C6x Processor 102


3.1 Introduction 102
3.2 TMS320C6x Architecture 104
3.3 Functional Units 105
3.4 Fetch and Execute Packets 106
3.5 Pipelining 108
3.6 Registers 110
3.7 Linear and Circular Addressing Modes 110
3.7.1 Indirect Addressing 110
3.7.2 Circular Addressing 111
3.8 TMS320C6x Instruction Set 112
3.8.1 Assembly Code Format 112
3.8.2 Types of Instructions 113
3.9 Assembler Directives 115
3.10 Linear Assembly 116
3.11 ASM Statement Within C 117
3.12 C-Callable Assembly Function 117
3.13 Timers 118
3.14 Interrupts 118
3.14.1 Interrupt Control Registers 118
3.14.2 Interrupt Acknowledgment 120
3.15 Multichannel Buffered Serial Ports 121
3.16 Direct Memory Access 122
3.17 Memory Considerations 122
3.17.1 Data Allocation 122
3.17.2 Data Alignment 123
3.17.3 Pragma Directives 123
3.17.4 Memory Models 124
3.18 Fixed- and Floating-Point Format 124
3.18.1 Data Types 124
3.18.2 Floating-Point Format 125
3.18.3 Division 126
3.19 Code Improvement 126
3.19.1 Intrinsics 126
3.19.2 Trip Directive for Loop Count 127
Contents ix

3.19.3 Cross-Paths 127


3.19.4 Software Pipelining 127
3.20 Constraints 128
3.20.1 Memory Constraints 128
3.20.2 Cross-Path Constraints 128
3.20.3 Load/Store Constraints 129
3.20.4 Pipelining Effects with More Than One EP
Within an FP 129
3.21 Programming Examples Using C, Assembly, and Linear
Assembly 130
3.22 Assignments 142
References 145

4 Finite Impulse Response Filters 146


4.1 Introduction to the z-Transform 146
4.1.1 Mapping from s-Plane to z-Plane 149
4.1.2 Difference Equations 150
4.2 Discrete Signals 151
4.3 FIR Filters 152
4.4 FIR Lattice Structure 154
4.5 FIR Implementation Using Fourier Series 158
4.6 Window Functions 162
4.6.1 Hamming Window 163
4.6.2 Hanning Window 163
4.6.3 Blackman Window 164
4.6.4 Kaiser Window 164
4.6.5 Computer-Aided Approximation 164
4.7 Programming Examples Using C and ASM Code 165
4.8 Assignments 207
References 207

5 Infinite Impulse Response Filters 210


5.1 Introduction 210
5.2 IIR Filter Structures 211
5.2.1 Direct Form I Structure 212
5.2.2 Direct Form II Structure 212
5.2.3 Direct Form II Transpose 214
5.2.4 Cascade Structure 215
5.2.5 Parallel Form Structure 216
5.3 Bilinear Transformation 217
5.3.1 BLT Design Procedure 219
5.4 Programming Examples Using C and ASM Code 220
5.5 Assignments 252
References 253
x Contents

6 Fast Fourier Transform 255


6.1 Introduction 255
6.2 Development of the FFT Algorithm with Radix-2 256
6.3 Decimation-in-Frequency FFT Algorithm with Radix-2 257
6.4 Decimation-in-Time FFT Algorithm with Radix-2 263
6.5 Bit Reversal for Unscrambling 268
6.6 Development of the FFT Algorithm with Radix-4 269
6.7 Inverse Fast Fourier Transform 272
6.8 Programming Examples 273
6.8.1 Frame-Based Processing 280
6.8.2 Fast Convolution 297
References 318

7 Adaptive Filters 319


7.1 Introduction 319
7.2 Adaptive Structures 321
7.3 Adaptive Linear Combiner 324
7.4 Performance Function 327
7.5 Searching for the Minimum 329
7.6 Programming Examples for Noise Cancellation and System
Identification 332
References 352

8 Code Optimization 354


8.1 Introduction 354
8.2 Optimization Steps 355
8.2.1 Compiler Options 355
8.2.2 Intrinsic C Functions 356
8.3 Procedure for Code Optimization 356
8.4 Programming Examples Using Code Optimization Techniques 356
8.5 Software Pipelining for Code Optimization 363
8.5.1 Procedure for Hand-Coded Software Pipelining 363
8.5.2 Dependency Graph 364
8.5.3 Scheduling Table 365
8.6 Execution Cycles for Different Optimization Schemes 372
References 373

9 DSP/BIOS and RTDX Using MATLAB, Visual C++, Visual Basic,


and LabVIEW 374
9.1 Introduction to DSP/BIOS 374
9.1.1 Periodic Functions 376
9.1.2 Hardware Interrupts 378
Contents xi

9.1.3 Real-Time Analysis with DSP/BIOS 382


9.1.4 Software Interrupts 382
9.2 RTDX Using MATLAB to Provide Interface Between
PC and DSK 386
9.3 RTDX Using Visual C++ to Interface with DSK 400
9.4 RTDX Using Visual Basic to Provide Interface Between
PC and DSK 411
9.5 RTDX Using LabVIEW to Provide Interface Between
PC and DSK 415
Acknowledgments 421
References 421

10 DSP Applications and Student Projects 422


10.1 DTMF Signal Detection Using Correlation, FFT, and
Goertzel Algorithm 422
10.1.1 Using a Correlation Scheme and Onboard LEDs
for Verifying Detection 424
10.1.2 Using RTDX with Visual C++ to Display Detected
DTMF Signals on the PC 427
10.1.3 Using FFT and Onboard LEDs for Verifying
Detection 429
10.1.4 Using Goertzel Algorithm 429
10.2 Beat Detection Using Onboard LEDs 429
10.3 FIR with RTDX Using Visual C++ for Transfer of Filter
Coefficients 434
10.4 Radix-4 FFT with RTDX Using Visual C++ and MATLAB
for Plotting 435
10.5 Spectrum Display Through EMIF Using a Bank of 32 LEDs 438
10.6 Spectrum Display Through EMIF Using LCDs 440
10.7 Time–Frequency Analysis of Signals with Spectrogram 445
10.7.1 Simulation Using MATLAB 446
10.7.2 Spectrogram with RTDX Using MATLAB 446
10.7.3 Spectrogram with RTDX Using Visual C++ 450
10.8 Audio Effects (Echo and Reverb, Harmonics, and Distortion) 451
10.9 Voice Detection and Reverse Playback 453
10.10 Phase Shift Keying—BPSK Encoding and Decoding with PLL 454
10.10.1 BPSK Single-Board Transmitter/Receiver
Simulation 455
10.10.2 BPSK Transmitter/Voice Encoder with Real-Time
Input 459
10.10.3 Phase-Locked Loop 460
10.10.4 BPSK Transmitter and Receiver with PLL 465
10.11 Binary Phase Shift Keying 468
xii Contents

10.12 Modulation Schemes—PAM and PSK 470


10.12.1 Pulse Amplitude Modulation 470
10.12.2 Phase Shift Keying 474
10.13 Selectable IIR Filter and Scrambling Scheme Using Onboard
Switches 479
10.14 Convolutional Encoding and Viterbi Decoding 482
10.15 Speech Synthesis Using Linear Prediction of Speech Signals 493
10.16 Automatic Speaker Recognition 496
10.17 µ-Law for Speech Companding 500
10.18 SB-ADPCM Encoder/Decoder: Implementation of G.722
Audio Coding 501
10.19 Encryption Using the Data Encryption Standard Algorithm 503
10.20 Phase-Locked Loop 506
10.21 Miscellaneous Projects 508
10.21.1 Multirate Filter 508
10.21.2 Acoustic Direction Tracker 513
10.21.3 Neural Network for Signal Recognition 515
10.21.4 Adaptive Temporal Attenuator 519
10.21.5 FSK Modem 521
10.21.6 Image Processing 521
10.21.7 Filter Design and Implementation Using a Modified
Prony’s Method 521
10.21.8 PID Controller 522
10.21.9 Four-Channel Multiplexer for Fast Data Acquisition 522
10.21.10 Video Line Rate Analysis 522
Acknowledgments 522
References 523

Appendix A TMS320C6x Instruction Set 528


A.1 Instructions for Fixed- and Floating-Point Operations 528
A.2 Instructions for Floating-Point Operations 528
References 528

Appendix B Registers for Circular Addressing and Interrupts 530


Reference 530

Appendix C Fixed-Point Considerations 533


C.1 Binary and Two’s-Complement Representation 533
C.2 Fractional Fixed-Point Representation 536
C.3 Multiplication 536
Reference 539
Contents xiii

Appendix D MATLAB and Goldwave Support Tools 540


D.1 fdatool for FIR Filter Design 540
D.2 fdatool for IIR Filter Design 542
D.3 MATLAB for FIR Filter Design Using the Student Version 544
D.4 MATLAB for IIR Filter Design Using the Student Version 546
D.5 Using the Goldwave Shareware Utility as a Virtual Instrument 548
References 549

Appendix E Fast Hartley Transform 550


References 556

Appendix F Goertzel Algorithm 557


F.1 Design Considerations 557
References 560

Appendix G TMS320C6416 DSK 561


G.1 TMS320C64x Processor 561
G.2 Programming Examples Using the C6416 DSK 562
References 566

Index 567
Preface

Since the publication of the first edition of this book in 2005, Texas Instruments has
released a new version of Code Composer Studio (CCS). Consequently, although
nearly all of the program examples presented in the first edition will work with the
DSK, some of the detailed instructions for using CCS described in the first edition
are no longer accurate. Every effort has been made to ensure that this edition is
compatible with Version 3 of Code Composer Studio. Slight changes have been
made to the program examples to the extent that the examples provided with this
edition should not be mixed with the earlier versions.
Sadly, Rulph Chassaing passed away in 2005. I had the privilege and the pleasure
of being able to work with Rulph after attending his workshop at the TI developer
conference in 1999. We corresponded regularly while he was writing his book on
the C6711 DSK and Rulph kindly included some of the program examples I had
developed. I helped Rulph to present a workshop at the TI developer conference
in 2002, and we maintained contact while he wrote the first edition of this book.
I have used Rulph’s books, on the C31, C6711, and C6713 processors, for teaching
both at Heriot-Watt (UK) and at Zhejiang (PRC) universities.
Rulph’s books are an extensive and valuable resource for teaching DSP hands-on
in a laboratory setting. They contain a wealth of practical examples—programs that
run on TI DSKs (nearly all in real-time) and illustrate vividly many key concepts
in digital signal processing. It would have been a great shame if the continued use
of this text had been compromised by incompatibilities with the latest version of
CCS.
While thoroughly checking the first edition and attempting to ensure the compat-
ibility (with CCS) and integrity of the example programs, I have taken the oppor-
tunity to develop and to add more (particularly in Chapters 2, 5, 6, and 9) and to
evolve a slightly more narrative structure (particularly in Chapters 2, 4, 5, and 6).
xv
xvi Preface

A small amount of material from the first edition has been dropped. Due to their
natures, Chapters 3, 8, and 10 have been left very much unchanged.
While it contains a degree of introductory DSP theory, some details of the archi-
tecture of the C6713 and C6416 processors, an introduction to assembly language
programming for those processors, and no little instruction on the use of Code
Composer Studio, the emphasis of this book is on illustrating DSP concepts hands-
on in a laboratory environment using real audio frequency signals.
The strength of this book lies, I believe, in the number (and utility) of program
examples. I hope that professors and instructors will be able to pick material from
the book in order to hold their own hands-on laboratory classes.
I am thankful to Robert Owen of the Texas Instruments University Program in
Europe for support of the DSP teaching facilities at Heriot-Watt University and
to Cathy Wicks of the Texas Instruments University Program in North America for
the initial suggestion of updating the book and for her continued support. Walter
J. Gomes III (Jay) and I mapped out the update to this book before he passed away
last year. The thought of his enthusiasm for the project has been a constant
motivation.
I thank my colleague at Heriot-Watt University, Dr. Keith Brown, for his help in
testing program examples and for his suggestions. But above all, I thank Rulph for
inspiring me to get involved in teaching hands-on DSP.

Donald Reay
Heriot-Watt University
Edinburgh, United Kingdom
January 2008
Preface to the First Edition

Digital signal processors, such as the TMS320 family of processors, are used in a
wide range of applications, such as in communications, controls, speech processing,
and so on. They are used in cellular phones, digital cameras, high-definition televi-
sion (HDTV), radio, fax transmission, modems, and other devices. These devices
have also found their way into the university classroom, where they provide an
economical way to introduce real-time digital signal processing (DSP) to the
student.
Texas Instruments introduced the TM320C6x processor, based on the very-long-
instruction-word (VLIW) architecture. This new architecture supports features that
facilitate the development of efficient high-level language compilers. Throughout
the book we refer to the C/C++ language simply as C. Although TMS320C6x/assem-
bly language can produce fast code, problems with documentation and maintenance
may exist. With the available C compiler, the programmer must “let the tools do the
work.” After that, if the programmer is not satisfied, Chapters 3 and 8 and the last
few examples in Chapter 4 can be very useful.
This book is intended primarily for senior undergraduate and first-year graduate
students in electrical and computer engineering and as a tutorial for the practicing
engineer. It is written with the conviction that the principles of DSP can best be
learned through interaction in a laboratory setting, where students can appreciate
the concepts of DSP through real-time implementation of experiments and projects.
The background assumed is a course in linear systems and some knowledge of C.
Most chapters begin with a theoretical discussion, followed by representative
examples that provide the necessary background to perform the concluding experi-
ments. There are a total of 105 programming examples, most using C code, with a
few in assembly and linear assembly code. A list of these examples appears on page
xvii. A total of 22 students’ projects are also discussed. These projects cover a wide
xvii
xviii Preface to the First Edition

range of applications in filtering, spectrum analysis, modulation techniques, speech


processing, and so on.
Programming examples are included throughout the text. This can be useful to
the reader who is familiar with both DSP and C programming but who is not nec-
essarily an expert in both. Many assignments are included at the end of Chapters
1–6.
This book can be used in the following ways:

1. For a DSP course with a laboratory component, using parts of Chapters 1–9.
If needed, the book can be supplemented with some additional theoretical
materials, since its emphasis is on the practical aspects of DSP. It is possible
to cover Chapter 7 on adaptive filtering following Chapter 4 on finite impulse
response (FIR) filtering (since there is only one example in Chapter 7 that
uses materials from Chapter 5). It is my conviction that adaptive filtering
should be incorporated into an undergraduate course in DSP.
2. For a laboratory course using many of the examples and experiments from
Chapters 1–7 and Chapter 9. The beginning of the semester can be devoted
to short programming examples and experiments and the remainder of the
semester for a final project. The wide range of sample projects (for both
undergraduate and graduate students) discussed in Chapter 10 can be very
valuable.
3. For a senior undergraduate or first-year graduate design project course using
selected materials from Chapters 1–10.
4. For the practicing engineer as a tutorial and reference, and for workshops and
seminars, using selected materials throughout the book.

In Chapter 1 we introduce the tools through three programming examples.


These tools include the powerful Code Composer Studio (CCS) provided with
the TMS320C6713 DSP starter kit (DSK). It is essential to perform these examples
before proceeding to subsequent chapters. They illustrate the capabilities of CCS
for debugging, plotting in both the time and frequency domains, and other matters.
Appendix H contains several programming examples using the TMS320C6416
DSK.
In Chapter 2 we illustrate input and output (I/O) with the AIC23 stereo codec
on the DSK board through many programming examples. Chapter 3 covers the
architecture and the instructions available for the TMS320C6x processor. Special
instructions and assembler directives that are useful in DSP are discussed. Pro-
gramming examples using both assembly and linear assembly are included in this
chapter.
In Chapter 4 we introduce the z-transform and discuss FIR filters and the effect
of window functions on these filters. Chapter 5 covers infinite impulse response
(IIR) filters. Programming examples to implement real-time FIR and IIR filters are
included. Appendix D illustrates MATLAB for the design of FIR and IIR filters.
Preface to the First Edition xix

Chapter 6 covers the development of the fast Fourier transform (FFT). Program-
ming examples on FFT are included using both radix-2 and radix-4 FFT. In Chapter
7 we demonstrate the usefulness of the adaptive filter for a number of applications
with least mean squares (LMS). Programming examples are included to illustrate
the gradual cancellation of noise or system identification. Students have been very
receptive to applications in adaptive filtering. Chapter 8 illustrates techniques for
code optimization.
In Chapter 9 we introduce DSP/BIOS and discuss a number of schemes (Visual
C++, MATLAB, etc.) for real-time data transfer (RTDX) and communication
between the PC and the DSK.
Chapter 10 discusses a total of 22 projects implemented by undergraduate and
graduate students. They cover a wide range of DSP applications in filtering, spec-
trum analysis, modulation schemes, speech processing, and so on.
A CD is included with this book and contains all the programs discussed. See
page xxi for a list of the folders that contain the support files for the examples and
projects.

Over the last 10 years, faculty members from over 200 institutions have taken my
workshops on “DSP and Applications.” Many of these workshops were supported
by grants from the National Science Foundation (NSF) and, subsequently, by Texas
Instruments. I am thankful to NSF, Texas Instruments, and the participating faculty
members for their encouragement and feedback. I am grateful to Dr. Donald Reay
of Heriot-Watt University, who contributed several examples during his review of
my previous book based on the TMS320C6711 DSK. I appreciate the many sugges-
tions made by Dr. Mounir Boukadoum of the University of Quebec, Dr. Subrama-
niam Ganesan from Oakland University, and Dr. David Kozel from Purdue
University at Calumet. I also thank Dr. Darrell Horning of the University of New
Haven, with whom I coauthored my first book, Digital Signal Processing with the
TMS320C25, for introducing me to “book writing.” I thank all the students at Roger
Williams University, the University of Massachusetts at Dartmouth, and Worcester
Polytechnic Institute (WPI) who have taken my real-time DSP and senior design
project courses, based on the TMS320 processors, over the last 20 years. The contri-
bution of Aghogho Obi, from WPI, is very much appreciated.
The continued support of many people from Texas Instruments is also very much
appreciated: Cathy Wicks and Christina Peterson, in particular, have been very sup-
portive of this book.
Special appreciation: The laboratory assistance of Walter J. Gomes III in several
workshops and during the development of many examples has been invaluable. His
contribution is appreciated.
Rulph Chassaing
List of Examples

1.1 Sine Wave Generation Using Eight Points with DIP Switch Control
(sine8_LED) 9
1.2 Generation of Sinusoid and Plotting with CCS (sine8_buf) 21
1.3 Dot Product of Two Arrays (dotp4) 23
2.1 Basic Input and Output Using Polling (loop_poll) 48
2.2 Basic Input and Output Using Interrupts (loop_intr) 51
2.3 Modifying Program loop_intr.c to Create a Delay (delay) 53
2.4 Modifying Program loop_intr.c to Create an Echo (echo) 53
2.5 Echo with GEL Slider Control of Delay and Feedback
(echo_control) 54
2.6 Loop Program with Input Data Stored in a Buffer (loop_buf) 57
2.7 Sine Wave Generation Using a Lookup Table (sine8_intr) 60
2.8 Sine Wave Generation Using sin() Function Call (sine_intr) 61
2.9 Sine Wave Generation with Stereo Output (sine_stereo) 62
2.10 Sine Wave Generation with Two Sliders for Amplitude and
Frequency Control (sine2sliders) 63
2.11 Sweep Sinusoid Using Table with 8000 Points (sweep8000) 65
2.12 Generation of DTMF Tones Using a Lookup Table
(sineDTMF_intr) 66
2.13 Sine Wave Generation with Table Values Generated Within
Program (sinegen_table) 69
2.14 Sine Wave Generation with Table Created by MATLAB
(sin1500MATL) 70
xxi
xxii List of Examples

2.15 Sine Wave Generation with DIP Switch Control (sine_led_ctrl) 72


2.16 Signal Reconstruction, Aliasing, and the Properties of the
AIC23 Codec 74
2.17 Square Wave Generation Using Lookup Table (squarewave) 75
2.18 Step and Impulse Responses of the DAC Reconstruction Filter
(dimpulse) 78
2.19 Frequency Response of the DAC Reconstruction Filter Using
Pseudorandom Noise (prandom) 78
2.20 Step Response of the AIC23 Codec Antialiasing Filter (loop_buf) 82
2.21 Demonstration of Aliasing (aliasing) 82
2.22 Identification of AIC23 Codec Bandwidth Using an Adaptive Filter
(sysid) 85
2.23 Identification of AIC23 Codec Bandwidth Using Adaptive Filter
(sysid16) 85
2.24 Ramp Generation (ramp) 92
2.25 Amplitude Modulation (am) 92
2.26 Use of External Memory to Record Voice (record) 95
2.27 Use of Flash Memory to Run an Application on Power Up
(flash_sine) 95
3.1 Sum of n + (n − 1) + (n − 2) + · · · + 1, Using C Calling an
Assembly Function (sum) 131
3.2 Factorial of a Number Using C Calling an Assembly Function
(factorial) 132
3.3 32-bit Pseudorandom Noise Generation Using C Calling an
Assembly Function (Noisegen_casm) 133
3.4 Code Detection Using C Calling an ASM Function (code_casm) 135
3.5 Dot Product Using Assembly Program Calling an Assembly
Function (dotp4a) 135
3.6 Dot Product Using C Function Calling a Linear Assembly
Function (dotp4clasm) 139
3.7 Factorial Using C Calling a Linear Assembly Function (factclasm) 141
4.1 Moving Average Filter (average) 165
4.2 Moving Average Filter with Internally Generated Pseudorandom
Noise as Input (averagen) 168
4.3 Identification of Moving Average Filter Frequency Response
Using a Second DSK (sysid) 168
4.4 FIR Filter with Moving Average, Bandstop, and Bandpass
Characteristics (fir) 175
4.5 FIR Implementation with a Pseudorandom Noise Sequence as
Input to a Filter (firprn) 178
List of Examples xxiii

4.6 FIR Filter with Internally Generated Pseudorandom Noise as


Input to a Filter and Output Stored in Memory (firprnbuf) 182
4.7 Effects on Voice or Music Using Three FIR Lowpass Filters
(FIR3LP) 186
4.8 Implementation of Four Different Filters: Lowpass, Highpass,
Bandpass, and Bandstop (fir4types) 188
4.9 Two Notch Filters to Recover a Corrupted Speech Recording
(notch2) 191
4.10 FIR Implementation Using Two Different Methods (fir2ways) 193
4.11 Voice Scrambling Using Filtering and Modulation (scrambler) 193
4.12 FIR Implementation Using C Calling an ASM Function (FIRcasm) 197
4.13 FIR Implementation Using C Calling a Faster ASM Function
(FIRcasmfast) 200
4.14 FIR Implementation Using C Calling an ASM Function with a
Circular Buffer (FIRcirc) 201
4.15 FIR Implementation Using C Calling an ASM Function Using a
Circular Buffer in External Memory (FIRcirc_ext) 206
5.1 Implementation of IIR Filter Using Cascaded Second Order
Direct Form II Sections (iirsos) 223
5.2 Implementation of IIR Filter Using Cascaded Second Order
Transposed Direct Form II Sections (iirsostr) 225
5.3 Estimating the Frequency Response of an IIR Filter Using
Pseudorandom Noise as Input (iirsosprn) 225
5.4 Estimating the Frequency Response of an IIR Filter Using a
Sequence of Impulses as Input (iirsosdelta) 228
5.5 Fourth Order Elliptical Lowpass IIR Filter Designed Using
fdatool 237
5.6 Bandpass Filter Designed Using fdatool 241
5.7 Fixed-Point Implementation of IIR Filter (iir) 243
5.8 Generation of a Sine Wave Using a Difference Equation
(sinegenDE) 244
5.9 Generation of DTMF Signal Using Difference Equations
(sinegenDTMF) 247
5.10 Generation of a Swept Sinusoid Using a Difference Equation
(sweepDE) 248
5.11 Sine Wave Generation Using a Difference Equation with C
Calling an ASM Function (sinegencasm) 251
6.1 DFT of a Sequence of Real Numbers with Output in the
CCS Graphical Display Window (dft) 273
6.2 Estimating Execution Times for DFT and FFT Functions (fft) 279
xxiv List of Examples

6.3 Frame-Based Processing (frames) 283


6.4 DFT of a Signal in Real-Time Using a DFT Function with
Precalculated Twiddle Factors (dft128c) 285
6.5 FFT of a Real-Time Input Signal Using an FFT Function in C
(fft128c.c) 290
6.6 FFT of a Sinusoidal Signal from a Table Using TI’s C Callable
Optimized FFT Function (FFTsinetable) 290
6.7 FFT of Real-Time Input Using TI’s C Callable Optimized Radix-2
FFT Function (FFTr2) 295
6.8 Radix-4 FFT of Real-Time Input Using TI’s C Callable Optimized
FFT Function (FFTr4) 297
6.9 Frame-Based Implementation of FIR Filters Using Time-Domain
Convolution (timeconvdemo) 299
6.10 Real-Time Frame-Based Implementation of FIR Filters Using
Time-Domain Convolution (timeconv) 306
6.11 Frame-Based Implementation of FIR Filters Using Frequency-
Domain Convolution (fastconvdemo) 306
6.12 Real-Time Frame-Based Fast Convolution (fastconv) 308
6.13 Graphic Equalizer (graphicEQ) 312
7.1 Adaptive Filter Using C Code (adaptc) 332
7.2 Adaptive Filter for Sinusoidal Noise Cancellation (adaptnoise) 335
7.3 Adaptive FIR Filter for Noise Cancellation Using External Inputs
(adaptnoise_2IN) 335
7.4 Adaptive FIR Filter for System ID of a Fixed FIR as an Unknown
System (adaptIDFIR) 339
7.5 Adaptive FIR for System ID of a Fixed FIR as an Unknown
System with Weights of an Adaptive Filter Initialized as an
FIR Bandpass (adaptIDFIRw) 343
7.6 Adaptive FIR for System ID of Fixed IIR as an Unknown System
(iirsosadapt) 343
7.7 Adaptive FIR Filter for System Identification of System External
to DSK (sysid) 345
8.1 Sum of Products with Word-Wide Data Access for Fixed-Point
Implementation Using C Code (twosum) 357
8.2 Separate Sum of Products with C Intrinsic Functions Using
C Code (dotpintrinsic) 358
8.3 Sum of Products with Word-Wide Access for Fixed-Point
Implementation Using Linear ASM Code (twosumlasmfix.sa) 358
8.4 Sum of Products with Double-Word Load for Floating-Point
Implementation Using Linear ASM Code (twosumlasmfloat) 359
List of Examples xxv

8.5 Dot Product with No Parallel Instructions for Fixed-Point


Implementation Using ASM Code (dotpnp) 359
8.6 Dot Product with Parallel Instructions for Fixed-Point
Implementation Using ASM Code (dotpp) 360
8.7 Two Sums of Products with Word-Wide (32-bit) Data for
Fixed-Point Implementation Using ASM Code (twosumfix) 360
8.8 Dot Product with No Parallel Instructions for Floating-Point
Implementation Using ASM Code (dotpnpfloat) 361
8.9 Dot Product with Parallel Instructions for Floating-Point
Implementation Using ASM Code (dotppfloat) 362
8.10 Two Sums of Products with Double-Word-Wide (64-bit) Data for
Floating-Point Implementation Using ASM Code (twosumfloat) 362
8.11 Dot Product Using Software Pipelining for a Fixed-Point
Implementation 367
8.12 Dot Product Using Software Pipelining for a Floating-Point
Implementation 367
9.1 Blinking of LEDs at Different Rates Using DSP/BIOS PRDs
(bios_LED) 376
9.2 Sine Wave Generation Using DSP/BIOS Hardware Interrupts
(HWIs) (bios_sine8_intr) 379
9.3 Using LOG_printf() Within a Sine Wave Generation Program
(bios_sine8_intr_LOG) 382
9.4 FIR Filter Using DSP/BIOS Hardware Interrupts (HWIs) and
Software Interrupts (SWIs) (bios_fir_SWI) 383
9.5 fft128c.c Using SWI Object for Buffer Processing
(bios_fft128c_SWI) 385
9.6 fastconv.c Using TSK Object for Buffer Processing
(bios_fastconv_TSK) 386
9.7 MATLAB–DSK Interface Using RTDX (rtdx_matlab_sim) 388
9.8 MATLAB–DSK Interface Using RTDX, with MATLAB for
FFT and Plotting (rtdx_matlabFFT) 393
9.9 MATLAB–DSK Interface Using RTDX for FIR Filter
Implementation (rtdx_matlabFIR) 396
9.10 Visual C++–DSK Interface Using RTDX for Amplitude Control of
the Sine Wave (rtdx_vc_sine) 400
9.11 Visual C++–DSK Interface Using RTDX, with MATLAB Functions
for FFT and Plotting (rtdx_vc_FFTmatlab) 406
9.12 Visual Basic–DSK Interface Using RTDX for Amplitude Control of
a Sine Wave (rtdx_vbsine) 411
9.13 Visual Basic–DSK Interface Using RTDX for Amplitude Control of
Output in a Loop Program (rtdx_vbloop) 413
xxvi List of Examples

9.14 LabVIEW–DSK Interface Using RTDX for FIR Filtering


(rtdx_lv_filter) 415
9.15 LabVIEW–DSK Interface Using RTDX for Controlling the
Gain of a Generated Sinusoid (rtdx_lv_gain) 417
9.16 LabVIEW–DSK Interface Using RTDX for Controlling the
Amplitude of a Generated Sinusoid with Real-Time Output from
the DSK (rtdx_lv_sine) 420
D.1 Design of FIR Bandstop Filter Using fdatool and dsk_fir67() 541
D.2 Design of IIR Bandstop Filter Using fdatool and dsk_sos_iir67() 542
D.3 Design of FIR Filters Using the Student Version of MATLAB 544
D.4 Multiband FIR Filter Design Using the Student Version of
MATLAB 546
D.5 Design of IIR Bandstop Filter Using the Bilinear Transform in
MATLAB 546
G.1 Sine Wave Generation with DIP Switch Control (sine8_LED) 562
G.2 Loop Program Using the C6416 DSK (loop_intr) 564
G.3 Estimating Execution Times for DFT and FFT Functions 564
Programs/Files on Accompanying CD

xxvii
xxviii Programs/Files on Accompanying CD
1
DSP Development System

• Installing and testing Code Composer Studio Version 3.1


• Use of the TMS320C6713 or TMS320C6416 DSK
• Programming examples

This chapter describes how to install and test Texas Instruments’ integrated develop-
ment environment (IDE), Code Composer Studio (CCS), for either the TMS320C6713
or the TMS320C6416 Digital Signal Processing Starter Kit (DSK). Three example
programs that demonstrate hardware and software features of the DSK and CCS
are presented. It is recommended strongly that you review these examples before
proceeding to subsequent chapters. The detailed instructions contained in this
chapter are specific to CCS Version 3.1.

1.1 INTRODUCTION

The Texas Instruments TMS320C6713 and TMS320C6416 Digital Signal Processing


Starter Kits are low cost development platforms for real-time digital signal pro-
cessing applications. Each comprises a small circuit board containing either a
TMS320C6713 floating-point digital signal processor or a TMS320C6416 fixed-point
digital signal processor and a TLV320AIC23 analog interface circuit (codec) and
connects to a host PC via a USB port. PC software in the form of Code Composer
Studio (CCS) is provided in order to enable software written in C or assembly

Digital Signal Processing and Applications with the TMS320C6713 and TMS320C6416 DSK,
Second Edition By Rulph Chassaing and Donald Reay
Copyright © 2008 John Wiley & Sons, Inc.

1
2 DSP Development System

language to be compiled and/or assembled, linked, and downloaded to run on the


DSK. Details of the TMS320C6713, TMS320C6416, TLV320AIC23, DSK, and CCS
can be found in their associated datasheets [36–38]. The purpose of this chapter is
to introduce the installation and use of either DSK.
A digital signal processor (DSP) is a specialized form of microprocessor. The
architecture and instruction set of a DSP are optimized for real-time digital signal
processing. Typical optimizations include hardware multiply-accumulate (MAC)
provision, hardware circular and bit-reversed addressing capabilities (for efficient
implementation of data buffers and fast Fourier transform computation), and
Harvard architecture (independent program and data memory systems). In many
cases, DSPs resemble microcontrollers insofar as they provide single chip computer
solutions incorporating onboard volatile and nonvolatile memory and a range of
peripheral interfaces and have a small footprint, making them ideal for embedded
applications. In addition, DSPs tend to have low power consumption requirements.
This attribute has been extremely important in establishing the use of DSPs in cel-
lular handsets. As may be apparent from the foregoing, the distinctions between
DSPs and other, more general purpose, microprocessors are blurred. No strict defi-
nition of a DSP exists. Semiconductor manufacturers bestow the name DSP on
products exhibiting some, but not necessarily all, of the above characteristics as they
see fit.
The C6x notation is used to designate a member of the Texas Instruments (TI)
TMS320C6000 family of digital signal processors. The architecture of the C6x digital
signal processor is very well suited to numerically intensive calculations. Based on
a very-long-instruction-word (VLIW) architecture, the C6x is considered to be TI’s
most powerful processor family.
Digital signal processors are used for a wide range of applications, from com-
munications and control to speech and image processing. They are found in cellular
phones, fax/modems, disk drives, radios, printers, hearing aids, MP3 players, HDTV,
digital cameras, and so on. Specialized (particularly in terms of their onboard
peripherals) DSPs are used in electric motor drives and a range of associated
automotive and industrial applications. Overall, DSPs are concerned primarily with
real-time signal processing. Real-time processing means that the processing must
keep pace with some external event; whereas nonreal-time processing has no
such timing constraint. The external event to keep pace with is usually the analog
input. While analog-based systems with discrete electronic components including
resistors and capacitors are sensitive to temperature changes, DSP-based systems
are less affected by environmental conditions such as temperature. DSPs enjoy
the major advantages of microprocessors. They are easy to use, flexible, and
economical.
A number of books and articles have been published that address the importance
of digital signal processors for a number of applications [1–22]. Various technologies
have been used for real-time processing, from fiber optics for very high frequency
applications to DSPs suitable for the audio frequency range. Common applications
using these processors have been for frequencies from 0 to 96 kHz. It is standard
DSK Support Tools 3

within telecommunications systems to sample speech at 8 kHz (one sample every


0.125 ms). Audio systems commonly use sample rates of 44.1 kHz (compact disk) or
48 kHz. Analog/digital (A/D)-based data-logging boards in the megahertz sampling
rate range are currently available.

1.2 DSK SUPPORT TOOLS

Most of the work presented in this book involves the development and testing of
short programs to demonstrate DSP concepts. To perform the experiments described
in the book, the following tools are used:

1. A Texas Instruments DSP starter kit (DSK). The DSK package includes:
(a) Code Composer Studio (CCS), which provides the necessary software
support tools. CCS provides an integrated development environment
(IDE), bringing together the C compiler, assembler, linker, debugger, and
so on.
(b) A circuit board (the TMS320C6713 DSK is shown in Figure 1.1) contain-
ing a digital signal processor and a 16-bit stereo codec for analog signal
input and output.
(c) A universal synchronous bus (USB) cable that connects the DSK board
to a PC.
(d) A +5 V universal power supply for the DSK board.
2. A PC. The DSK board connects to the USB port of the PC through the USB
cable included with the DSK package.
3. An oscilloscope, spectrum analyzer, signal generator, headphones, microphone,
and speakers. The experiments presented in subsequent chapters of this
book are intended to demonstrate digital signal processing concepts in real-
time, using audio frequency analog input and output signals. In order to
appreciate those concepts and to get the greatest benefit from the experi-
ments, some forms of signal source and sink are required. As a bare minimum,
a microphone and either headphones or speakers are required. A far greater
benefit will be acquired if a signal generator is used to generate sinusoidal,
and other, test signals and an oscilloscope and spectrum analyzer are used to
display, measure, and analyze input and output signals. Many modern digital
oscilloscopes incorporate FFT functions, allowing the frequency content of
signals to be displayed. Alternatively, a number of software packages that
use a PC equipped with a soundcard to implement virtual instruments are
available.

All the files and programs listed and discussed in this book (apart from some
of the student project files in Chapter 10) are included on the accompanying CD.
A list of all the examples is given on pages xxi–xxvi.
4 DSP Development System

1.2.1 C6713 and C6416 DSK Boards

The DSK packages are powerful, yet relatively inexpensive, with the necessary
hardware and software support tools for real-time signal processing [23–43]. They
are complete DSP systems. The DSK boards, which measure approximately 5 × 8
inches, include either a 225-MHz C6713 floating-point digital signal processor or
a 1-GHz C6416 fixed-point digital signal processor and a 16-bit stereo codec
TLV320AIC23 (AIC23) for analog input and output.
The onboard codec AIC23 [38] uses sigma–delta technology that provides analog-
to-digital conversion (ADC) and digital-to-analog conversion (DAC) functions. It
uses a 12-MHz system clock and its sampling rate can be selected from a range of
alternative settings from 8 to 96 kHz.
A daughter card expansion facility is also provided on the DSK boards.
Two 80-pin connectors provide for external peripheral and external memory
interfaces.
The DSK boards each include 16 MB (megabytes) of synchronous dynamic RAM
(SDRAM) and 512 kB (kilobytes) of flash memory. Four connectors on the boards
provide analog input and output: MIC IN for microphone input, LINE IN for line
input, LINE OUT for line output, and HEADPHONE for a headphone output
(multiplexed with line output). The status of four user DIP switches on the DSK
board can be read from within a program running on the DSP and provide the user
with a feedback control interface. The states of four LEDs on the DSK board can
be controlled from within a program running on the DSP. Also onboard the DSKs
are voltage regulators that provide 1.26 V for the DSP cores and 3.3 V for their
memory and peripherals.

1.2.2 TMS320C6713 Digital Signal Processor

The TMS320C6713 (C6713) is based on the very-long-instruction-word (VLIW)


architecture, which is very well suited for numerically intensive algorithms. The
internal program memory is structured so that a total of eight instructions can be
fetched every cycle. For example, with a clock rate of 225 MHz, the C6713 is capable
of fetching eight 32-bit instructions every 1/(225 MHz) or 4.44 ns.
Features of the C6713 include 264 kB of internal memory (8 kB as L1P and L1D
Cache and 256 kB as L2 memory shared between program and data space), eight
functional or execution units composed of six ALUs and two multiplier units, a 32-
bit address bus to address 4 GB (gigabytes), and two sets of 32-bit general-purpose
registers.
The C67xx processors (such as the C6701, C6711, and C6713) belong to the family
of the C6x floating-point processors; whereas the C62xx and C64xx belong to the
family of the C6x fixed-point processors. The C6713 is capable of both fixed- and
floating-point processing. The architecture and instruction set of the C6713 are dis-
cussed in Chapter 3.
DSK Support Tools 5

(a)

(b)

FIGURE 1.1. TMS3206713-based DSK board: (a) board and (b) block diagram.
(Courtesy of Texas Instruments.)

1.2.3 TMS320C6416 Digital Signal Processor

The TMS320C6416 (C6416) is based on the VELOCITI advanced very-long-


instruction-word (VLIW) architecture, which is very well suited for numerically
intensive algorithms. The internal program memory is structured so that a total of
eight instructions can be fetched every cycle. For example, with a clock rate of 1 GHz,
the C6416 is capable of fetching eight 32-bit instructions every 1/(1 GHz) or 1.0 ns.
6 DSP Development System

Features of the C6416 include 1056 kB of internal memory (32 kB as L1P and
L1D cache and 1024 kB as L2 memory shared between program and data space),
eight functional or execution units composed of six ALUs and two multiplier units,
a 32-bit address bus to address 4 GB (gigabytes), and two sets of 32-bit general-
purpose registers.

1.3 CODE COMPOSER STUDIO

Code Composer Studio (CCS) provides an integrated development environment


(IDE) for real-time digital signal processing applications based on the C program-
ming language. It incorporates a C compiler, an assembler, and a linker. It has
graphical capabilities and supports real-time debugging.
The C compiler compiles a C source program with extension .c to produce an
assembly source file with extension .asm. The assembler assembles an .asm source
file to produce a machine language object file with extension .obj. The linker com-
bines object files and object libraries as input to produce an executable file with
extension .out. This executable file represents a linked common object file format
(COFF), popular in Unix-based systems and adopted by several makers of digital
signal processors [44]. This executable file can be loaded and run directly on the
digital signal processor. Chapter 3 introduces the linear assembly source file with
extension .sa, which is a “cross” between C and assembly code. A linear optimizer
optimizes this source file to create an assembly file with extension .asm (similar to
the task of the C compiler).
A Code Composer Studio project comprises all of the files (or links to all of the
files) required in order to generate an executable file. A variety of options enabling
files of different types to be added to or removed from a project are provided. In
addition, a Code Composer Studio project contains information about exactly how
files are to be used in order to generate an executable file. Compiler/linker options
can be specified. A number of debugging features are available, including setting
breakpoints and watching variables, viewing memory, registers, and mixed C and
assembly code, graphing results, and monitoring execution time. One can step
through a program in different ways (step into, or over, or out).
Real-time analysis can be performed using CCS’s real-time data exchange
(RTDX) facility. This allows for data exchange between the host PC and the target
DSK as well as analysis in real-time without halting the target. The use of RTDX
is illustrated in Chapter 9.

1.3.1 CCS Version 3.1 Installation and Support

Instructions for installation of CCS Version 3.1 are supplied with the DSKs. The
default location for CCS files is c:\CCStudio_v3.1 and the following instructions
assume that that you have used this default. An icon with the label 6713 DSK
CCStudio v3.1 (or 6416 DSK CCStudio v3.1) should appear on the desktop.
Quick Tests of the DSK (On Power On and Using CCS) 7

CCS Version 3.1 provides extensive help facilities and a number of examples
and tutorials are included with the DSK package. Further information (e.g.,
data sheets and application notes) are available on the Texas Instruments website
http://www.ti.com.

1.3.2 Installation of Files Supplied with This Book

The great majority of the examples described in this book will run on either the
C6713 or the C6416 DSK. However, there are differences, particularly concerning
the library files used by the different processors, and for that reason a complete set
of files is provided on the CD for each DSK. Depending on whether you are using
a C6713 or a C6416 DSK, copy all of the subfolders, and their contents, supplied
on the CD accompanying this book in folders C6416 or C6713 into the folder
c:\CCStudio_v3.1\MyProjects so that, for example, the source file sine8_LED.c
will be located at c:\CCStudio_v3.1\MyProjects\sine8_LED\sine8_LED.c.
Change the properties of all the files copied so that they are not read-only (all
the folders can be highlighted to change the properties of their contents at once).

1.3.3 File Types

You will be working with a number of files with different extensions. They include:

1. file.pjt: to create and build a project named file.


2. file.c: C source program.
3. file.asm: assembly source program created by the user, by the C compiler,
or by the linear optimizer.
4. file.sa: linear assembly source program. The linear optimizer uses file.sa
as input to produce an assembly program file.asm.
5. file.h: header support file.
6. file.lib: library file, such as the run-time support library file rts6700.lib.
7. file.cmd: linker command file that maps sections to memory.
8. file.obj: object file created by the assembler.
9. file.out: executable file created by the linker to be loaded and run on the
C6713 or C6416 processor.
10. file.cdb: configuration file when using DSP/BIOS.

1.4 QUICK TESTS OF THE DSK (ON POWER ON AND USING CCS)

1. On power on, a power on self-test (POST) program, stored by default in the


onboard flash memory, uses routines from the board support library (BSL) to
test the DSK. The source file for this program, post.c, is stored in folder
8 DSP Development System

c:\CCStudio_v3.1\examples\dsk6713\bsl\post. It tests the internal, exter-


nal, and flash memory, the two multichannel buffered serial ports (McBSP),
DMA, the onboard codec, and the LEDs. If all tests are successful, all four
LEDs blink three times and stop (with all LEDs on). During the testing of
the codec, a 1-kHz tone is generated for 1 second.
2. Launch CCS from the icon on the desktop. A USB enumeration process will
take place and the Code Composer Studio window will open.
3. Click on Debug→Connect and you should see the message “The target is now
connected” appear (for a few seconds) in the bottom left-hand corner of the
CCS window.
4. Click on GEL→Check DSK→QuickTest. The Quick Test can be used for
confirmation of correct operation and installation. A message of the following
form should then be displayed in a new window within CCS:

Switches: 15 Board Revision: 2 CPLD Revision: 2

The value displayed following the label Switches reflects the state of the four
DIP switches on the edge of the DSK circuit board. A value of 15 corresponds to
all four switches in the up position. Change the switches to (1110)2, that is, the first
three switches (0,1,2) up and the fourth switch (3) down. Click again on GEL→
Check DSK→QuickTest and verify that the value displayed is now 7 (“Switches: 7”).
You can set the value represented by the four user switches from 0 to 15. Programs
running on the DSK can test the state of the DIP switches and react accordingly.
The values displayed following the labels Board Revision and CPLD Revision
depend on the type and revision of the DSK circuit board.

Alternative Quick Test of DSK Using Code Supplied with This Book
1. Open/launch CCS from the icon on the desktop if not done already.
2. Select Debug→Connect and check that the symbol in the bottom left-hand
corner of the CCS window indicates connection to the DSK.
3. Select File→Load Program and load the file c:\CCStudio_v3.1\MyProjects\
sine8_LED\Debug\sine8_LED.out. This loads the executable file sine8_
LED.out into the digital signal processor. (This assumes that you have
already copied all the folders on the accompanying CD into the folder:
c:\CCStudio_v3.1\MyProjects.)
4. Select Debug→Run.

Check that the DSP is running. The word RUNNING should be displayed in the
bottom left-hand corner of the CCS window.

Press DIP switch #0 down. LED #0 should light and a 1-kHz tone should be
generated by the codec. Connect the LINE OUT (or the HEADPHONE) socket
on the DSK board to a speaker, an oscilloscope, or headphones and verify the gen-
eration of the 1-kHz tone. The four connectors on the DSK board for input and
Programming Examples to Test the DSK Tools 9

output (MIC, LINE IN, LINE OUT, and HEADPHONE) each use a 3.5-mm jack
audio cable. halt execution of program sine8_LED.out by selecting Debug→Halt.

1.5 PROGRAMMING EXAMPLES TO TEST THE DSK TOOLS

Three programming examples are introduced to illustrate some of the features of


CCS and the DSK board. The aim of these examples is to enable the reader to
become familiar with both the software and hardware tools that will be used
throughout this book. It is strongly suggested that you complete these three exam-
ples before proceeding to subsequent chapters. The examples will be described
assuming that a C6713 DSK is being used.

Example 1.1: Sine Wave Generation Using Eight Points with DIP Switch
Control (sine8_LED)

This example generates a sinusoidal analog output waveform using a table-lookup


method. More importantly, it illustrates some of the features of CCS for editing
source files, building a project, accessing the code generation tools, and running a
program on the C6713 processor. The C source file sine8_LED.c listed in Figure
1.2 is included in the folder sine8_LED.

Program Description
The operation of program sine8_LED.c is as follows. An array, sine_table, of
eight 16-bit signed integers is declared and initialized to contain eight samples of
exactly one cycle of a sinusoid. The value of sine_table[i] is equal to

1000 sin (2π i / 8) for i = 1, 2, 3, . . . , 7

Within function main(), calls to functions comm_poll(), DSK6713_LED_init(),


and DSK6713_DIP_init() initialize the DSK, the AIC23 codec onboard the DSK,
and the two multichannel buffered serial ports (McBSPs) on the C6713 processor.
Function comm_poll() is defined in the file c6713dskinit.c, and functions
DSK6713_LED_init() and DSK6713_DIP_init() are supplied in the board support
library (BSL) file dsk6713bsl.lib.
The program statement while(1) within the function main() creates an infinite
loop. Within that loop, the state of DIP switch #0 is tested and if it is pressed down,
LED #0 is switched on and a sample from the lookup table is output. If DIP switch
#0 is not pressed down then LED #0 is switched off. As long as DIP switch #0 is
pressed down, sample values read from the array sine_table will be output and
a sinusoidal analog output waveform will be generated via the left-hand channel
of the AIC23 codec and the LINE OUT and HEADPHONE sockets. Each time
a sample value is read from the array sine_table, multiplied by the value of
the variable gain, and written to the codec, the index, loopindex, into the array
10 DSP Development System

//sine8_LED.c sine generation with DIP switch control

#include "dsk6713_aic23.h" //codec support


Uint32 fs = DSK6713_AIC23_FREQ_8KHZ; //set sampling rate
#define DSK6713_AIC23_INPUT_MIC 0x0015
#define DSK6713_AIC23_INPUT_LINE 0x0011
Uint16 inputsource=DSK6713_AIC23_INPUT_MIC; //select input
#define LOOPLENGTH 8
short loopindex = 0; //table index
short gain = 10; //gain factor
short sine_table[LOOPLENGTH]=
{0,707,1000,707,0,-707,-1000,-707}; //sine values

void main()
{
comm_poll(); //init DSK,codec,McBSP
DSK6713_LED_init(); //init LED from BSL
DSK6713_DIP_init(); //init DIP from BSL
while(1) //infinite loop
{
if(DSK6713_DIP_get(0)==0) //if DIP #0 pressed
{
DSK6713_LED_on(); //turn LED #0 ON
output_left_sample(sine_table[loopindex++]*gain); //output
if (loopindex >= LOOPLENGTH) loopindex = 0; //reset index
}
else DSK6713_LED_off(0); //else turn LED #0 OFF
} //end of while(1)
} //end of main
FIGURE 1.2. Sine wave generation program using eight points with DIP switch control
(sine8_LED.c).

is incremented and when its value exceeds the allowable range for the array
(LOOPLENGTH-1), it is reset to zero.
Each time the function output_left_sample(), defined in source file
C6713dskinit.c, is called to output a sample value, it waits until the codec, initial-
ized by the function comm_poll() to output samples at a rate of 8 kHz, is ready for
the next sample. In this way, once DIP switch #0 has been pressed down it will be
tested at a rate of 8 kHz. The sampling rate at which the codec operates is set by
the program statement

Uint32 fs = DSK6713_AIC23_FREQ_8KHZ;

One cycle of the sinusoidal analog output waveform corresponds to eight output
samples and hence the frequency of the sinusoidal analog output waveform is equal
to the codec sampling rate (8 kHz) divided by eight, that is, 1 kHz.
Programming Examples to Test the DSK Tools 11

Creating a Project
This section illustrates how to create a project, adding the necessary files to generate
an executable file sine8_LED.out. As supplied on the CD, folder sine8_LED con-
tains a suitable project file named sine8_LED.pjt. However, for the purposes of
gaining familiarity with CCS, this section will illustrate how to create that project
file from scratch.

1. Delete the existing project file sine8_LED.pjt in folder c:\CCStudio_v3.1\


myprojects\sine8_LED. Do this from outside CCS. Remember, a copy of
the file sine8_LED.pjt still exists on the CD.
2. Launch CCS by double-clicking on its desktop icon.
3. Create a new project file sine8_LED.pjt by selecting Project→New
and typing sine8_LED as the project name, as shown in Figure 1.3. Set Target
to TMS320C67XX before clicking on Finish. The new project file will be
saved in the folder c:\CCStudio_v3.1\myprojects\sine8_LED. The .pjt
file stores project information on build options, source filenames, and
dependencies. The names of the files used by a project are displayed in the
Project View window, which, by default, appears at the left-hand side of the
Code Composer window.
4. Add the source file sine8_LED.c to the project. sine8_LED.c is the top level
C source file containing the definition of function main(). This source file is
stored in the folder sine8_LED and must be added to the project if it is to
be used to generate the executable file sine8_LED.out. Select Project→Add
Files to Project and look for Files of Type C Source Files (*.c, *.ccc). Open,

FIGURE 1.3. CCS Project Creation window for project sine8_LED.


12 DSP Development System

or double-click on, sine8_LED.c. It should appear in the Project View window


in the Source folder.
5. Add the source file c6713dskinit.c to the project. c6713dskinit.c con-
tains the function definitions for a number of low level routines including
comm._poll() and output_left_sample(). This source file is stored in the
folder c:\CCStudio_v3.1\myprojects\Support. Select Project→Add Files
to Project and look for Files of Type C Source Files (*.c, *.ccc). Open, or
double-click on, c6713dskinit.c. It should appear in the Project View
window in the Source folder.
6. Add the source file vectors__poll.asm to the project. vectors_poll.asm
contains the interrupt service table for the C6713. This source file is stored
in the folder c:\CCStudio_v3.1\myprojects\Support. Select Project→Add
Files to Project and look for Files of Type ASM Source Files (*.a*). Open, or
double-click on, vectors_poll.asm. It should appear in the Project View
window in the Source folder.
7. Add library support files rts6700.lib, dsk6713bsl.lib, and csl6713.lib
to the project. Three more times, select Project→Add Files to Project and
look for Files of Type Object and Library Files (*.o*, *.l*) The three library
files are stored in folders c:\CCStudio_v3.1\c6000\cgtools\lib, c:\
CCStudio_v3.1\c6000\dsk6713\lib, and c:\CCStudio_v3.1\c6000\csl\
lib, respectively. These are the run-time support (for C67x architecture),
board support (for C6713 DSK), and chip support (for C6713 processor)
library files.
8. Add the linker command file c6713dsk.cmd to the project. This file is stored
in the folder c:\CCStudio_v3.1\myprojects\Support. Select Project→Add
Files to Project and look for Files of Type Linker Command File (*.cmd;*.
lcf). Open, or double-click on, c6713dsk.cmd. It should then appear in the
Project View window.
9. No header files will be shown in the Project View window at this stage. Select-
ing Project→Scan All File Dependencies will rectify this. You should now be
able to see header files c6713dskinit.h, dsk6713.h, and dsk6713_aic23.
h, in the Project View window.
10. The Project View window in CCS should look as shown in Figure 1.4. The
GEL file dsk6713.gel is added automatically when you create the project.
It initializes the C6713 DSK invoking the board support library to use the
PLL to set the CPU clock to 225 MHz (otherwise the C6713 runs at 50 MHz
by default). Any of the files (except the library files) listed in the Project
View window can be displayed (and edited) by double-clicking on their
name in the Project View window. You should not add header or include files
to the project. They are added to the project automatically when you select
Scan All File Dependencies. (They are also added when you build the
project.)
Programming Examples to Test the DSK Tools 13

FIGURE 1.4. Project View window showing files added at step 10.

Verify from the Project View window that the project (.pjt) file, the linker
command (.cmd) file, the three library (.lib) files, the two C source (.c) files, and
the assembly (.asm) file have been added to the project.

Code Generation and Build Options


The code generation tools underlying CCS, that is, C compiler, assembler, and linker,
have a number of options associated with each of them. These options must be set
appropriately before attempting to build a project. Once set, these options will be
stored in the project file.

Setting Compiler Options


Select Project→Build Options and click on the Compiler tab. Set the following
options, as shown in Figures 1.5, 1.6, and 1.7. In the Basic category set Target Version
to C671x (-mv6710). In the Advanced category set Memory Models to Far (–mem_
FIGURE 1.5. CCS Build Options: Basic compiler settings.

FIGURE 1.6. CCS Build Options: Advanced compiler settings.

14
Programming Examples to Test the DSK Tools 15

FIGURE 1.7. CCS Build Options: Preprocessor compiler settings.

model:data=far). In the Preprocessor category set Pre-Define Symbol to CHIP_6713


and Include Search Path to c:\CCStudio_v3.1\C6000\dsk6713\include. Compiler
options are described in more detail in Ref. 28. Click on OK.

Setting Linker Options


Click on the Linker tab in the Build Options window, as shown in Figure 1.8. The
Output Filename should default to .\Debug\sine8_LED.out based on the name of
the project file and the Autoinit Model should default to Run-Time Autoinitializa-
tion. Set the following options (all in the Basic category). Set Library Search Path
to c:\CCStudio_v3.1\C6000\dsk6713\lib and set Include Libraries to rts6700.lib;
dsk6713bsl.lib;csl6713.lib. The map file can provide useful information for debug-
ging (memory locations of functions, etc.). The –c option is used to initialize vari-
ables at run time, and the –o option is to name the linked executable output file
sine8_LED.out. Click on OK.

Building, Downloading, and Running the Project


The project sine8_LED can now be built, and the executable file sine8_LED.out
can be downloaded to the DSK and run.
Another Random Scribd Document
with Unrelated Content
right of holding property for the town’s good.[415] The bondage
under which they lay to the sheriff[416] and tax-gatherer could only
be broken when they were given full powers to assess and collect all
their own taxes.[417] Vexed and impoverished by journeys to distant
courts for justice, harassed by the interference in their most private
affairs of some far-off governor, forced in every recurring emergency
to carry appeals for justice or petitions for favour to an alien power
separate from all their interests, they urged the claim that right
should be done to the burghers in their own courts and by their own
officers as of the very essence of any true liberty. “We are the
citizens of our lord the king,” said the burghers of Hereford, “and
have the custody of his city for us and for his heirs and for our heirs,
and we ought not to go out of our city for the recovering of our
debts, for divers dangers and misfortunes which might happen to
our wives and children; and if we ought to spend our goods and
chattels in parts afar off, by impleading and labouring for that, by
that means and the like we shall be impoverished; and being made
poor, we shall not have wherewith to keep the city, and so
disinheritance by such ways would easily fall upon our children.”[418]
And as the burghers claimed that each community should have
absolute control over its members for the peace and order of the
commonwealth, so they were resolute that no powerful patron,
within or without the borough, should on any plea whatever venture
to aid or “maintain” a townsman who had offended against the
municipal law, “because by such maintainers or protectors a
common contention might arise amongst us, and horrible
manslaughter be committed amongst us, and the loss of the liberty
or freedom of the city to the disinheritance of us and our children;
which God forbid that in our days by the defect of us, should happen
or fall out in such a manner.”[419] From the first they were forced to
look beyond the question of mere personal regard, seeing how
deeply legal forms of procedure affected their common life as a
separate society, and they had their grave reasons of state for
insisting that the older forms of administering justice in their courts
should be maintained, and trial by combat rejected and abolished
from among them, “by reason of perpetual enmity of us the parents
and of our children, which might turn to the ruin or perdition of the
city and other innumerable accident dangers.”[420] In the same way
they were driven to realize the necessity of having some share in
deciding on the laws by which they were to be governed, and which
might have the gravest results to their little state; as, for example,
when the people of Leicester petitioned for a charter from Henry the
Third to do away with the ancient usage of “borough English,” and
grant the right of inheritance to the eldest son, since owing to
defective heirs and their weakness, the town was falling into ruin
and dishonour.[421]
All these privileges and exemptions were matters of negociation
between the borough and the king or the lord of the manor to be
bought for money, or for political support, or for loans in time of
need.[422] The people everywhere simply won such advantages as
time and opportunity allowed, and secured benefits which were
measured by the grace of the king, or by the price they could afford
to pay, or by the show of resistance they could make to their lord.
Nor was there anything startling or revolutionary about the first
beginnings of independent municipal life. The town assemblies which
discussed and inaugurated a new constitution transacted their
business with a completeness and accuracy of methodical routine
which might kindle the sympathy of a Town Council of modern
Birmingham. In the organization of “meetings” the mediæval
Englishman seems to have had nothing to learn, and the doings of
the people of Ipswich when they got their first charter from King
John in 1200 carry us into the quiet atmosphere of a board-room
where shareholders and directors of some solid and old-established
company assemble for business with the decorum and punctuality of
venerable habit.[423] The charter granted those essential privileges
which were recognized by all boroughs as of the very first
importance—the right henceforward to deal in financial matters
directly with the Exchequer, and no longer act as a mere fragment of
the shire through the sheriff; to be free of tolls on trade throughout
the kingdom, and have a Guild Merchant with all its commercial
privileges; to carry out justice according to the ancient custom of the
borough; and to elect each year from among themselves officers to
rule over the town, who being thus appointed by common consent
could only be removed from office by the unanimous counsel of the
whole people. The charter was given on May 25, and in the following
month a general assembly of the burghers was summoned. At this
meeting they first elected the chief officers for the year, the bailiffs
and coroners, and then proceeded to decide by common counsel
that a body of twelve “Portmen” should be appointed to assist them;
and three days later these too were formally chosen through another
and more complicated system of election by a select body of citizens
named for the purpose. Having taken an oath faithfully to govern the
borough and maintain its liberties, and justly to render the
judgments of its courts, the new officers then caused all the
townsmen to stretch forth their hands towards the Book, and with
one voice solemnly swear from that hour to obey and assist them in
guarding the liberties of the town. Twelve days after this they met to
ordain the most necessary rules for the administration of the town.
Two months were then spent in drawing up “Ordinances” which
were finally solemnly read to the whole people assembled in the
churchyard, and received their unanimous consent. And lastly a
month later, on October 12, the organization of the Merchant Guild
for the regulation of trade was completed and its officers elected;
the newly made Common Seal[424] was inspected; and the
community ordered that a record of all their laws and free customs
should be written for perpetual remembrance in a roll to be called
Domesday. And thus with all the grave ceremony which befitted the
dignity of a new republic, Ipswich started on its independent career
as a free borough.
CHAPTER VII

BATTLE FOR FREEDOM

(1.) Towns on Royal Demesne

So auspicious a beginning of municipal life as was granted to


Ipswich did not however fall as a matter of course to the lot of every
English town, nor was political liberty by any means an inevitable
consequence of favourable commercial conditions, or necessarily
withheld from boroughs in a humbler way of trade. In a society
where all towns alike depended upon some lord of the manor who
owned the soil and exercised feudal rights over his tenants, that
which mainly determined for each community the measure of
independence it should win, and the price which its people should
pay for liberty, was the form of lordship to which it was subject. By
the decisive accidents of position and tenure the fate of the town
was fixed, rather than by the merits or exertions of the burghers.
First among the boroughs in number and importance were those
in “ancient demesne”—that is, boroughs which held directly from the
king, and were therefore reckoned as being a part of the national
property, such as Canterbury, York, Winchester, Southampton,
Yarmouth, Nottingham, Gloucester, and so on. A second group was
formed by the towns which belonged to a lay noble, like Morpeth,
Berkeley, or Leicester; or were held by him as a special grant from
the king, as Barnstaple or Liverpool. Finally there were the towns on
ecclesiastical estates, whether they were the property of a bishopric
like Lynn, which was under the Bishop of Norwich, Wells under the
Bishop of Wells, Romney and Hythe under the Archbishop of
Canterbury; or whether they owed suit and fealty to a convent, as
the towns of Reading and St. Albans, which belonged to the abbots
of those monasteries respectively, Fordwich to St. Augustine’s at
Canterbury, Weymouth to St. Swithun’s at Winchester.[425] In all
these various groups the towns were equally willing to relieve their
feudal superior, king or lord or bishop, of the cares of government,
and the only question was how far the king would go in supporting
these demands, or how far the noble and ecclesiastic could be
compelled to acquiesce in a re-distribution of feudal jurisdiction and
privileges in favour of traders and “mean” people.
Happily for the national wealth and freedom the great majority of
towns in England, and almost all those of importance, were part of
the royal demesne, and the king was lord of the soil. Fenced in by
privileges which had been devised to protect the interest of the King,
and which they gradually found means to transform into institutions
for the protection of their own interests, the burghers on ancient
demesne were bound into one fellowship by the inheritance of a
common tradition and common immunities;[426] and regarding their
towns as the very aristocracy among the boroughs, enjoyed a self-
conscious dignity such as the Great Powers of Europe might feel
towards the less favoured minor States. There is the ring of a
haughty spirit in the answer sent by the men of Hereford when the
people of Cardiff begged for a copy of their “customs” to help them
in deciding on the constitution of their own government. “The King’s
citizens of Hereford,” they say, “who have the custody of his city (in
regard that it is the principal city of all the market towns from the
sea even unto the bounds of the Severn) ought of ancient usage to
deliver their laws and customs to such towns when need requires,
yet in this case they are in no wise bound to do it, because they say
they are not of the same condition; for there are some towns which
hold of our Lord the King of England and his heirs without any
mesne lord; and to such we are bound, when and as often as need
shall be, to certify of our laws and customs, chiefly because we hold
by one and the same tenure; and nothing shall be taken of them in
the name of a reward, except only by our common town clerk for
the writing and his pains as they can agree. But there are other
market towns which hold of divers lords of the kingdom wherein are
both natives and rustics of ancient time, who pay to their lords
corporal service of divers kinds, with other services which are not
used among us, and who may be expelled out of those towns by
their lords, and may not inhabit in them or be restored to their
former state, but by the common law of England.[427] And chiefly
those and others that hold by such foreign services in such towns
are not of our condition; neither shall they have our laws and
customs but by way of purchase, to be performed to our Capital
Bailiff as they can agree between them, at the pleasure and to the
benefit of the city aforesaid.”[428]
I. Singular advantages, indeed, fell to the lot of towns thus
happily situated on the national estate. The King was a Lord of the
Manor too remote to have opportunity for overmuch meddling, and
too greatly occupied with affairs of state to concern himself with the
details of government in his numerous boroughs.[429] County
magnates might cling passionately to the right of holding local courts
as sources of power, and yet more important sources of wealth; but
such rights were of small consequence to a powerful sovereign, who
as supreme head of the law could call up criminals to his own
judgement seat from every court in the country.[430] Confidence of
supremacy made him careless to put it to the test by abrupt
assertions of authority, as private owners, apprehensive and
uncertain, might be tempted to do; and in his indifference to small
uses of power and devices for paltry gain, he held loosely to rights
that brought much trouble and little profit.[431] So long as his yearly
ferm was punctually paid,[432] he was ready to grant to the
townsfolk leave to gather into their own treasury the petty sums
collected at the borough or manor courts,[433] or to make their
mayor the king’s escheator; and while he thus won their gratitude
and friendship he lost nothing by his generosity. In surrendering
local claims for a fixed payment, he not only relieved himself of the
charge of salaries to a multitude of minor officials, but he had no
longer to suffer from the loss of fines and dues and forfeitures which
were nominally levied for the King, but which had a constant
tendency to find their way into the pockets of the town officers or
the tax-collectors rather than into his exchequer. In many cases,
moreover, he may have gained considerably by the price which he
demanded for his favours; and the royal accounts possibly give a
very inadequate record of the number of special gifts of money and
yearly annuities paid by boroughs to the King in return for liberties
granted to them.[434]
II. As lord of the manor, therefore, the King was a liberal master,
always ready to arrange a compromise with his tenants as to
vexatious feudal claims. But he was equally ready to listen to their
prayers for freedom from the control of officers of the Shire and the
Hundred. So long as it was to the benefit of the central authority to
break up and weaken provincial governments, to curtail the powers
of the sheriff, to confound ambitious designs of local magnates, and
shatter pretensions on the part of the nobles which might tend to
strengthen hereditary enemies of the crown, so long the
townspeople might count on the sovereign’s support in the struggle
for independence. In questions therefore that arose as to rival
jurisdictions, in claims put forward by a borough against
neighbouring lords for rights of navigation or pasturage or fishing, in
all disputes which were carried in the last resort to the arbitration of
the king, his sympathy, especially if a fitting “courtesy” was offered
by the burghers, was with his borough.[435] Powers won from local
governments or from feudal lords were divided between the King
and the municipality; and under shelter of the royal authority large
rights of local self-government were rapidly gathered into the
burghers’ hands. Functions once exercised by the bailiff of the
hundred and the sheriff of the county were handed over to the
mayor; he collected the fee-ferm, held the view of frankpledge,
levied taxes,[436] mustered the men-at-arms, and presided over civil
and criminal courts.
III. Nor was there any serious difficulty as to the exercise of the
sovereign rights of the crown. To the King it mattered little whether
he sent a special deputy direct from the court, or whether he
delegated powers to the mayor, and used him as an official
immediately responsible to the crown; while on the other hand such
a change meant much present solace to the townsfolk. A
compromise was therefore easily brought about between the
monarch and the people. The mayor was invariably appointed as the
King’s Clerk of the Market, the Measurer and Gauger at the King’s
Standard, the Manager of the King’s Assize; he became the
representative of the sovereign in the most important charges of
administration, as one of the King’s Justices[437] in the town, as
Admiral,[438] as Mayor of the Staple. Administrative changes such as
these left the power of the sovereign untouched and cost him
nothing; while on the other hand the central government was by this
means provided with a ready-made staff of trained officials,—a staff
which the King could not possibly have created,[439] nor paid out of
his empty exchequer even if he had been able to create it—but
which had become absolutely essential for carrying out the
supervision of local affairs at a time when such supervision was
growing more important every day, from the point of view both of
the King and of the people. The towns on their side, relieved by the
new system from miseries[440] under which they had suffered,
readily forgot distinctions between laws made by them and made for
them, so long as these were administered by officers of whom they
were allowed the election and control.[441]
IV. Finally if the towns suffered from the officers of the royal
household, a remedy was easily granted them. The sovereign found
no personal inconvenience in transferring the duties of these officers
to the governors of the boroughs themselves; and the mayor or
bailiff became the King’s Steward, and Marshal of the King’s
Household in the borough. In short, as the towns advanced to
independence, all manner of powers and responsibilities were
heaped together on their chief officer, with no clear discrimination
between his various and oddly mingled functions. Men did not pause
to ask which of his masters the mayor at any given moment was
serving, whether he was acting as head of the city government to
carry out the burghers’ will, or as the officer appointed by the
sovereign to execute his laws;[442] and nice questions as to the
exact division of authority which had really taken place were so
manifestly irrelevant in presence of the harmonious concentration of
all power in a single hand, that jealousies and suspicions on both
sides were allayed, to the great furtherance of peace and concord.
To the mediæval poet who drew a picture of Love as “the leader of
our Lord’s folk in Heaven,” standing as a “mean” or mediator of
peace, there was one obvious comparison—even “as the mayor is
between the King and the commons.”[443]
The history of the royal boroughs, therefore, so far as their
relations with the King are concerned, reduces itself into a long list
of favours asked and given. Frequent troubles of state no doubt
stimulated the generosity of sovereigns; and times of political
disturbance and revolution proved occasions when the towns rose
into independence through the necessities of kings, who confirmed
old franchises and granted new ones, and “right largely made
charters thereof, to the intent to have the more good-will and love in
their land.”[444] The civil wars under Henry the Second,[445] the
money difficulties of Richard and John, the troubled minority of
Henry the Third, the disorders under Edward the Second, the
commercial policy of Edward the Third, the political insecurity of
Henry the Fourth after his seizure of the throne, the financial needs
of Henry the Fifth, the tumults and fears of the reign of Henry the
Sixth, the anxiety of Edward the Fourth to conciliate the kingdom,—
all these were so many heaven-sent opportunities for the burghers
to win new instalments of local liberty; while the two periods of
reaction brought about by the fear of the Peasant Revolt under
Richard the Second, and the nervous apprehensions of Richard the
Third, were themselves made use of by the governing class in the
boroughs to confirm and tighten their authority. So monotonous
indeed is the record of the burghers on the royal demesne, all
moving together along the same well-beaten road to independence,
winning the same privileges, even winning them at the same time,
[446] that a brief statement of liberties secured by any single city will
serve to illustrate the general history of all.
Up to the time of Henry the Second Norwich enjoyed certain
liberties and privileges, but its citizens were practically feudal
servants of the King, who appointed their governors, took the profits
of their courts, and looked on the city as a private possession of his
own. Their true freedom began with the charter granted them in
1194 by Richard the First.[447] They were to have the customs of
London; the burgesses might not be summoned to answer any plea
outside the city; they were henceforth to elect their own Provost,
“such as may be fitting to us and to them;” and they were allowed
to hold their city at a ferm rent of £108 a year, which they
themselves, instead of the sheriff, should collect and pay to the
Exchequer. For the confirmation of their rights, “and for having the
city in their hand,” the Norwich people paid 200 marks.[448] From
this time the provost took the place of the officer formerly appointed
by the King, presided over the Borough Court in the Tolbooth and
possibly held the view of frankpledge, and paid the fines of the
courts into the city treasury. The sheriff of the county, however, still
held a higher court, the Curia Comitatus, within the enclosure of the
castle, where he exercised criminal jurisdiction, and jurors made the
presentments ordered by the assize of Clarendon.[449]
But this power of the sheriff only lingered on for a few years. In
1223 a new arrangement was made between the citizens and Henry
the Third. Norwich consisted of four distinct divisions which had
been naturally formed out of the four hamlets created by the first
settlers and which had by degrees become united into a single town:
—Conesford, where the earliest comers gathered round the ford over
the river, protected by the stream on one side, and on the other by
the mound on which the castle stood in later days; the Westwick,
whose name shews its later foundation, and which lay on the further
side of the fortifications, within the bend of the river; the Magna
Crofta or big field of the castle, lying below the entrenchments
midway between Conesford and Westwick, which was made at the
Conquest into a new ward, Mancroft Ward; and the Ward-over-the-
Water on the further bank of the river, somewhat cut off from the
rest of the town.[450] For the government of these “leets,” as the
divisions came to be called, it was decided in 1223 that the burghers
should elect four bailiffs, one for each district.[451] There was no
longer to be any provost, since the bailiffs were to take his place in
joint government of the town, and were further to take over the
criminal jurisdiction hitherto exercised by the sheriff in his court at
the castle. From this time therefore most of the social, commercial,
and criminal affairs of the city lay in the burghers’ own hands.
The four bailiffs, however, had still no control over the castle and
its entrenchments, nor over a wide reach of land that lay along the
river, stretching past Conesford and Mancroft and Westwick—land
owned by the prior and convent; nor had they any authority over the
cathedral, the priory, and the bishop’s palace that lay within
Westwick, nor over property owned by them or by other
ecclesiastical bodies which penetrated into the heart of the city;
while on the other hand tenants of castle and prior and bishop were
all making their profit out of the city trade, and enjoying its peace
and protection. Therefore the next claim of the burghers necessarily
was that the King should give to the municipality authority to tax for
the common expenses all inhabitants alike, under whatever lord they
held; and in 1229 they obtained a royal grant that all “who should
partake of the liberties which we have granted to the said citizens of
Norwich ... shall be taxed and give aid as the said citizens;” and that
“if anyone has withdrawn from their customs and scots, he shall
return to their society and custom, and follow their scot, so that no
one shall be quit therefrom.”[452] There was no trifling with the
municipal authority in this matter; in 1236 and 1237 when the
tenants of castle and prior attempted to resist the claim on their
moneys, the sheriff was ordered to summon them before him to
show by what right or warrant they claimed acquittance from
payments to the city treasury; and again in 1276, when the tenants
of the castle refused to pay their share of taxes, the case was
brought before the barons of the exchequer, and an order came
from Westminster that the sheriff was forthwith to levy the sum due
and hand it over to the city.[453]
Henry the Third granted many other favours “to our beloved
citizens of Norwich,” feeling perhaps the advantage of their
friendship amid the increasing troubles of his reign; and the
burghers of Norwich certainly, like those of Winchester, took sides
with him in the war against Simon de Montfort.[454] In 1253 they
had been allowed to enclose their city with a ditch.[455] In 1255
(twenty years before a general law was passed to this effect for all
Englishmen), they were freed from arrest for debt of which they
were not sureties or principal debtors. And in 1256 Henry granted a
charter which ordered that the “citizens shall answer at our
exchequer by their own hands for all debts and demands ... and that
no sheriff or other bailiff of ours shall henceforth enter the city
aforesaid to make distresses for any debts;” which decreed further
that all merchants who shared in the Norwich liberties and
merchandises were to pay the city taxes “wheresoever they shall
make their residences;” and which ordained lastly that “no guild
shall henceforth be held in the aforesaid city to the injury of the said
city.”[456] The sheriff was thus finally shut out from all land or
houses held by the citizens; and absent merchants were subjected
to their lot and scot.
From Edward the First the citizens in 1305 obtained the right to
hold the Leet of Newgate in Norwich, which the King had “lately
recovered against the Prior of Holy Trinity”; and further paid a fine
down, and promised to pay £10 yearly into the Exchequer for ever,
for a charter granting that they should not be impleaded outside the
city; that they should not be convicted by any foreigners but only by
their co-citizens, save in matters touching the King or the whole
commonalty; that the bailiffs should have power to assess tallages
and other reasonable aids “by the assent of the whole of the
commonalty, or of the greater part of the same” for the protection
and advantage of the city, and to make “reasonable distresses” for
the levying of these tallages as was done in other cities; and that
they should hold the Leet of Newgate which the Crown had “lately
recovered against the Prior of Holy Trinity.”[457] Further the burghers
remembered a trouble into which they had fallen in the case of a
thief who had stolen some cloth and brought much sorrow on the
city; for having fled to the church of St. George he finally escaped
out of it though the door was guarded by four parishes, who were all
fined for their lax vigilance; then being caught and condemned by
the bailiffs and commonalty he was condemned to be hung, but at
his burial found to be still alive, and the man who had cut him down
was thrown into prison; and lastly the bailiffs were accused of illegal
action in hanging him “without any man’s suit and without capture in
the act,” and of “taking up thieves and malefactors for trespasses
done outside the city and executing judgement on them in the city,”
and the city liberties had been seized into the King’s hands, and a
royal officer set to rule over them.[458] So the burghers in 1307
presented a petition that the right of infang theof and outfang theof,
which they had used at all times “whereof memory runneth not,”
might now be definitely inserted in their charter. Further, since the
sheriff “by malice” still found means on one excuse or another to
arrest a citizen from time to time—and this though the Norwich
people had the return of all manner of writs[459] so that neither the
sheriff nor any foreign bailiff had any right to meddle with them—
they required of the King that at their demand every citizen thus
seized should be delivered over to them out of the hands of the
alien. Likewise they prayed that so long as a burgher lived in the city
he should never be required to attend any foreign court whatever by
reason of any foreign tenure he might hold; and that no foreign
tenement should give the right to sheriffs or foreign bailiff to
summon him to be in juries or inquests outside the city. Lastly, as a
protection against any danger of forfeiting their franchise by failure
to pay the ferm rent, they asked permission for the corporation to
hold in perpetual possession certain lands and houses the profits of
which might be set apart for the rent.[460]
Under Edward the Third the sheriff of the county was deprived of
his last plea for interference within the city walls. Up to this time he
had still collected rents and taxes and done justice for the tenants of
the Castle Fee; and the ditches of the Castle and the Fee, thus freed
from city rule, had been made a sort of refuge for felons and
malefactors flying from the jurisdiction of the city officers. All this,
however, was in 1346 handed over to the bailiffs, and the sheriff was
in no wise to interfere.[461] Moreover, in consideration of the cost to
which the citizens had gone in enclosing the city, they were set free
for ever from the jurisdiction of the clerk of the market of the King’s
household.[462] Norwich was further given its own Admiral, who
sailed about in the “admiral’s barge,” and who held admiralty courts
and administered its law.[463] In 1331 it became a Staple town, and
its mayor was made a mayor of the Staple, with a salary of £20 and
a seal given by the king.[464]
Meanwhile the Norwich people had been gradually perfecting
their own internal system of government—a system which will be
described in a later chapter—and in the difficulties of Henry the
Fourth they found opportunity to complete their work. A sum of
£1,000 given to the King, besides heavy fines paid in bribes on all
sides, secured in 1403 a charter which finally guaranteed to them
the constitution of their choice.[465] Norwich was made into a county
of itself. A mayor was appointed, who was given supreme rights of
jurisship.” in the city, and received from the King himself a sword
which was to be carried before him with the point erect, along with
the gold or silver maces borne by the serjeants-at-mace. The four
bailiffs were replaced by two sheriffs, also elected by the burgesses,
who were charged with matters concerning the interests of the
crown which had formerly been the business of the bailiffs, and were
responsible for the yearly rent of the city. The mayor was appointed
the King’s escheator, and thus the last office which had been
reserved in alien hands was given over to the municipality. Finally in
token of the consummation of the municipal hopes the old seal of
the bailiffs was abolished to make way for a new city seal.
Norwich was but one among a number of boroughs whose
inhabitants quietly and steadily gathered to themselves the liberties
that made them free, for in the fellowship of towns holding of the
King under a uniform tenure throughout the “ancient demesne,” the
list of privileges granted to any one became the model for its
neighbours near and far.[466] With orderly progression, unbroken by
any of the violent and dramatic incidents that indicate a time of
conflict, all the bigger towns won by gradual instalments complete
local independence. Such changes of method as we observe are
simply changes made necessary by new national legislation, such as
the form of incorporation required after the Statute of Mortmain,
[467] or the right to elect Justices of the Peace when one power after

another had been given to these officers by law.[468] We do not


distinguish seasons of plentiful harvest and periods barren of all
growth; in one century as in another Kings stooped to accept the
“courtesies” offered, and granted the favours solicited. Nor do we
find records of advantages hastily given and timidly withdrawn; or,
until the reign of Richard the Third,[469] is there any suggestion of
anxiety on the part of Kings to check or limit the free action of the
boroughs.[470] Up to that time rulers of the state seem to have had
no apprehension of peril to public order, of jeopardy to trading
interests, of injury to the administration of justice, of possible
usurpations by the municipalities which might bring them into
collision with the ordered forces of the world; and for three hundred
years statesmen freely allowed the growth of municipal ambition,
and gave full scope for the developement of all the various systems
of local self-government. The full importance of these facts only
becomes clear when we turn to the history of the towns that were
under subjection to other lords than the nation itself; and compare
the peaceful negotiations by which matters were arranged between
the royal boroughs and the State, with the violence of feeling
aroused when the misgivings and alarms of private owners were
brought into the controversy.
CHAPTER VIII

Battle for Freedom

(2) Towns on Feudal Estates

On the King’s lands, as we have seen, the interests of the


monarch never came into collision with the interests of his burghers,
and the townsfolk found an easy way to liberty. From time to time
they presented a petition for freedom, brought their gifts to win the
sovereign’s favour, and joyfully carried back to their fellow citizens a
new charter of municipal privileges. But the condition of the towns
that belonged to noble or baron was doubly depressed from the
standpoint of their happier neighbours. Of secondary importance
alike in numbers, in wealth, or in influence, as compared to those on
royal demesne, they for the most part never emerged into any real
consequence; while their lord had every reason to oppose the
growth of independence in his boroughs, and lacked nothing for its
complete suppression but the requisite power. New franchises were
extorted from his weakness rather than won from his good will, and
where acquiescence in the town’s liberties was not irresistibly forced
on him his opposition was dogged and persevering.
The dispute was none the less intense because under the
conditions of English life the controversy between the town and the
feudal lord was limited within a very narrow field; for the burghers
saw well how the lord’s claims to supremacy might permanently
fetter an active community of traders, and on this point townspeople
fought with a pertinacity determined by the conviction that all their
hopes of prosperity depended on victory. To manufacturers and
merchants the rule of an alien governor was fatal; trade died away
before vexatious checks and arbitrary imposts, and enterprising
burghers hastened to forsake the town where prosperity was stunted
and liberty uncertain, and take up citizenship in a more thriving
borough. Success and emancipation went hand in hand; for the
effects of a maimed and imperfect freedom were always disastrous
and far-reaching, and there is not a single instance of an English
town which remained in a state of dependence and which was at the
same time prosperous in trade.
One or two instances will be enough to show the extent and
character of the traders’ claim for “liberties.” The burghers of Totnes,
who had been fined for having a Guild by Henry the Second, had no
sooner succeeded in securing its authorisation from John than they
at once made it a weapon of offence, and a formidable weapon too
with its roll of more than three hundred members, against their
lord’s control of the town market and of the shopkeepers. The Guild
claimed the right to admit non-residents to their company, so that
these might freely trade without paying any tribute to the lord for
one year, after that giving six pence annually; and pretended to have
authority to test weights and measures without orders from the
lord’s bailiff; to hold the assize of bread and ale and receive fines;
and apparently to deal out justice for petty offences. These
usurpations of his rights were discussed between the lord and his
tenants with riots and contentions, in which the lord proved
victorious in 1304, forcing the burghers to submit on every point in
which the Guild tried to bring in customs which lay beyond the
ancient rights of the community. They were forbidden to admit to
the Guild anyone who had not a house in the town, and non-
residents had to take oaths before his bailiff to pay a yearly fine to
the lord. No trial of weights and measures could take place till orders
had been issued to the Seneschal of the Guild by the lord’s bailiff;
when the trial came on bailiff and town provost sat beside him in the
Guildhall to hear the charges, and even then all false or suspected
measures were to be kept by the provost till the lord’s next court. On
the other hand the bailiff might hold a trial of measures whenever
he judged that he could do the business better. So also the assize of
bread was given to the lord’s bailiff sitting with the provost of the
town; all suspected bread and weights were to be seized by him, the
offenders to be fined in the lord’s court, all punishments by tumbril
or pillory inflicted by his orders, and all proceeds of fines given over
to him. Lastly when small thefts and riots were to be judged the
bailiff sat by the town officers and as many burgesses as chose to
come, and took his share in the proceedings—though occasionally in
his absence the town officers might act by common consent of the
community.[471]
Such was the comparative helplessness of a community which,
with all its tenacity of purpose, could neither urge custom nor
tradition on its side in pleading for independent rights. In the
borough of Barnstaple, on the other hand, which had been granted
by the King[472] to Sir John Cornwall and his wife the Countess of
Huntingdon, we have an instance of the immense advantages
possessed by a town which though now in private ownership,
inherited the tradition of privilege which its people had won as
tenants of ancient demesne.[473] In 1423 the Mayor, Aldermen, and
capital burgesses drew up a list of byelaws for the good government
of the borough, which apparently stirred the apprehensions of its
lords. For a few years later, reviving ancient traditions of feudal
authority in a suit against the borough, they complained that the
mayor and burgesses had of their own authority admitted as
“Burgesses of the Wynde” “foreign” merchants and victuallers who
merely visited the town; and had turned to their own use the fines
from denizens pertaining to their lord; that they had taken the
correction of bread and ale, and unlawfully seized fines and tolls;
that they would not suffer his officers to take custom after ancient
usage from the people of Wales for their merchandise; and that they
even seized fines belonging to him for heaps of rubbish in the
streets. Moreover they did not render the suit and service due to the
lord’s court from all the inhabitants of the borough, for without his
leave they themselves held a court every Monday, and instead of
coming to every court of the lord’s steward they did not come
oftener than twice a year; nor would they suffer the lord’s officers to
make attachments in the borough at the Nativity of Our Mother after
the ancient custom. In other words the townsfolk, just like the
people of Totnes two hundred years before, were bent on regulating
their trade and spending the money collected in their courts and
markets; but they were happier than they of Totnes in being able to
claim that all these so-called usurpations were ancient rights of the
burgesses, by virtue, as they said, of a charter granted by King
Athelstan 500 years before. As this charter however had unluckily
been “casualiter amissa,” the town had to fall back on the verdict of
an inquisition held about 1300 as to the usages and franchises to
which it was entitled, and the payments which were due by the
mayor and commonalty in place of old feudal services. Here the
Barnstaple men held their own successfully, and in 1445 they
secured a charter from Henry the Sixth, “for accommodation of the
burgesses in doing their business quietly,” which confirmed to them
the fullest rights of self-government.[474]
The struggle of the boroughs with their feudal lords was however
a matter of little significance in England, where since the Conquest
feudalism from the point of view of the noble had so unsatisfactory a
record. Fallen from the high estate of his brethren on the Continent,
despoiled of his might by one strong king after another, he saw
himself condemned to play in England a comparatively modest part,
and from his less exalted plane was even constrained to assume in
his relations to burghers and traders a conciliatory, almost at times a
deprecating tone, not because he was lacking in “a high and
pompous mind,” but simply because his fortunes had sunk low.
Hence the conflict in England was of a very different character from
the conflict abroad. Fashions of careful ceremonial indeed long
preserved the traditional sense of impassable barriers set between
the dignity of the great whose daily needs were supplied by the
labour of others, and the low estate of those who had to depend
upon their own toil. “Whensoever any nobleman or peer of the realm
passed through any parish, all the bells were accustomed to be rung
in honour of his person, and to give notice of the passage of such
eminency; and when their letters were upon any occasion read in
any assemblies, the commons present would move their bonnets in
token of reverence to their names and persons.” Burghers and
journeymen with an irreverent laugh at men “evermore strutting
who no store keep,”[475] gathered to see the noble go by “in his
robe of scarlet twelve yards wide, with pendent sleeves down on the
ground, and the furrur therein set amounting unto £20 or better,”
while a train of followers crowded after him anxiously holding up
with both hands out of the filth of the mediæval streets the wide
sleeves made to “slide on earth” by their sides, and eagerly watching
lest the ladies should forget to admire “the plaits behind;” and the
busy mockers of the market-place guessed that tailors and skinners
must soon carry their cloths and skins out into the fields if they
would find space enough to cut out robes like these.[476] But the
fine garments and leisurely state of the great folk, the hollow
ornaments of a vanquished feudalism, were matters of little
significance; the forces of the future lay rather with the crowd of
workers to right and left—with the men who watched the brave
procession sweep by, and then gathered in their Common House to
decree that any burgher who put on the livery of a lord, or accepted
his maintenance and protection, should be blotted out of the book of
burgesses, and driven from their market-place and assembly hall,
and “that he come not among them in their congregations.”[477]
For the moment, indeed, the noble class was as it were thrown
aside by the strong current of the national life, nor could the handful
of families that held half the soil of England and the lesser baronage
who followed in their train be recovered of their impotence, of their
impoverishment of intellect and decay of force, even by the greatest
landholder and the most typical member of their body, Warwick the
Kingmaker. Sated with possessions, forced into a position of
leadership mainly by the imposing list of his great relations and the
surprising number of his manors—a patriot who consecrated his
services to the cause of a faction and the unrestrained domination of
a family group of blood relations—a general who never got beyond
an already antiquated system of warfare, devoid according to public
rumour of personal courage, deserted in a crisis by the one
organised military force in the public service—a commander with all
the ready instincts of the common pirate—a statesman made after
an old ancestral pattern, who had learned his politics a couple of
centuries before his time, and to the last remained absolutely blind
to the great movements of his own day—an administrator who never
failed at a critical moment to put in jeopardy the most important
national interests—an agitator restless for revolution, but whose
influence in the national counsels was practically of no account when
there was a pause in mere fighting—it is thus that Warwick stands
before us, a consummate representative of his demoralized class.
The conditions under which the great landowners were living at
this time were indeed singularly unfavourable. With the new trade
they had comparatively little to do,[478] and the noble, with his
throng of dependents and his show of state, was really living from
hand to mouth on the harvests from his fields and the plunder he
got in war.[479] After the fashion of the time the treasure of the
family was hoarded up in his great oak chests; splendid robes, cloth
of gold, figured satins, Eastern damasks and Sicilian silks, velvets
and Flemish cloths, tapestries and fine linen, were heaped together
with rich furs of marten and beaver. Golden chains and collars of
“the old fashion” and “the new,” rings and brooches adorned with
precious stones, girdles of gold or silver gilt by famous foreign
makers, were stored away in his strong boxes, or in the safe rooms
of monasteries, along with ewers and goblets and basins of gold and
silver, pounced and embossed “with great large enamels” or covered
with silver of “Paris touch.”[480] But the owner of all this
unproductive treasure scarcely knew where to turn for a little ready
money. The produce of the estate sufficed for the needs of the
household, and if the lord was called away on the king’s service, or
had to attend Parliament, a supply of oats was carried for the horses
“to save the expenses of his purse”; and an army of servants rode
backwards and forwards continually to fetch provisions from fields
and ponds and salting tubs at home, so that he should never be
driven to buy for money from the baker or at the market.[481] The
crowd of dependents who swelled his train, easily content to win an
idle subsistence, a share of booty in time of war, “maintenance” in
the law courts, and protection from all enemies, either received no
pay at all, or accepted the most trifling sums—a few shillings a year
when they could get it, with a “livery” supplied like their food from
the estate.[482] For money which was scarce everywhere was
nowhere so scarce as in the houses of the landed proprietors, who
amid their extravagant display found one thing always lacking—a
few pounds to pay an old debt or buy a new coat. Sir John Paston,
the owner of broad estates in Norfolk, was forced more than once to
pawn his “gown of velvet and other gear” in London to get a few
marks; when it occurred to him to raise money on his father’s
funeral pall, he found his mother had been beforehand with him,
and had already put it in pawn. During an unwonted visit to
Westminster in 1449, the poor Lady of Berkeley wrote anxiously to
her husband, one of the greatest landowners in England, “At the
reverence of God send money, or else I must lay my horse to pledge
and come home on my feet”; and he managed to raise £15 to meet
her needs by pawning the mass book, chalices, and chasubles of his
chapel.[483] So also the Plumptons, in Yorkshire, were in perpetual
money difficulties; servants were unpaid, bills not met, debts of £2
10s. and £4 put off from term to term, and at last a friend who had
gone surety for a debt of £100 to a London merchant was arrested.
“Madam,” a poor tradesman writes to Lady Plumpton, “ye know well
I have no living but my buying and selling, and, Madam, I pray you
send me my money.” One of the family tried in vain to get a friend to
buy him some black velvet for a gown. “I pray you herein blame my
non-power, but not my will,” the friend answers from London, “for in
faith I might not do it but if I should run in papers of London, which
I never did yet, so I have lived poorly thereafter.”[484] When times
grew pressing the country families borrowed freely from their
neighbours and relations; no one, even the sister of the Kingmaker,
felt any hesitation in pleading poverty as a reason for being off a
bargain or asking for a loan;[485] and those who were in better case
lent readily in the hope of finding a like help themselves in case of
difficulty.[486] Year by year debts accumulated, till the owner’s death
allowed the creditors to open his coffers and scatter his treasured
stores, when the “array, plate, and stuff of the household and of the
chapel” scarcely sufficed to meet the legacies and bills, the charities
deferred, and the masses required for his soul’s safety.[487]
There were indeed instances in which the growing poverty of the
nobles opened an easy way for the emancipation of the towns, since
it was sometimes possible, under the pressure of poverty or
bankruptcy, to convince the lord of a borough, even though he had
but such a measure of good wit in his head

“As thou shouldest mete of a mist from morn till even,”[488]

that the balance of profit lay on the side of freedom. For to some
extent the difficulties of the landowners arose from the fact that on
their estates the commutation for feudal services, or dues to be
rendered for the holding of land, had been settled in early times
when money was scarce and demands for profit modest, and these
charges remained fixed when prices were rising and when the need
of ready money was keenly felt.[489] But while the lord could look for
no increase from his lands, a new source of profit had been opened
to him in the boroughs on his estate. He could find money surely
and easily by leasing out rights of trade, collection of tolls, and other
privileges to the townspeople. In the middle of the thirteenth
century the mayor and burgesses of Berkeley obtained from their
lord freedom from all kinds of toll which he either demanded or
might demand of them;[490] and in the fourteenth century he rented
to them the tolls of the wharfage and of the market, and received
larger profits from this transaction than he gained from all the rent
of the borough.[491]
The weakest corporation moreover had a persistence and
continuity of life which gave it incalculable advantages in the conflict
with individuals subject to all the chances and changes of mortality.
For the nobles indeed the fight with the town was in many ways an
unequal one. Driven hither and thither by urgent calls of war or of
the King’s business, the lord was scarcely ever at home to look to his
own affairs. In the frequent absences of the masters of Berkeley,
perpetually called away by “troubles of state,” when the King
summoned them to his aid whether for civil war or war of conquest,
[492] the neighbouring towns of Bristol and Gloucester found
opportunity to escape from their control; and the march of the baron
and his retainers from Berkeley was a subject of much greater
gladness to the townsmen of Bristol than to the lord of the castle
himself; for “the household and foreign accounts of this lord,” we are
told, “reveal a marvellous unwillingness in him to this Scottish war,
dispatching many letters and messages to the King, and other lords
and favourites about him, for excuses.”[493] When, as a reward for
his services, one of the Berkeleys was given the custody and
government of the town of Gloucester,[494] he was also charged with
the government of Berwick, and was moreover called away
whenever the King found himself in military difficulties; so that the
Gloucester burgesses cannot have had much to fear from him. The
care of the great estates, in fact, was constantly left to the women
of the house and to stewards, while the master, pressed by
ambition, or quite as often by the driving necessity of getting money,
was fighting in Wales or Scotland, or was looking for plunder in
France, or for place at court. For three generations the lands of the
Pastons in Norfolk were managed by the capable wives of absentee
landlords—of the judge who must have spent most of his time in
London or on circuit; of his son the sharp London lawyer; and of his
grandson, Sir John, the gay young soldier who hovered between
London and Calais, and whose only care for his property was to
press anxiously for its rents. The story of the Plumpton family was
much the same. One of the Plumptons spent his last years and died
in France; and no sooner did the young Sir William reach his
majority in 1426, than he also left his Yorkshire estates and set off
to join the French campaign.[495]
On the noble class too fell the heavy consequences of the
rebellions and civil wars of which they were the main supporters. If
the lord died in battle his estates might pass to a minor; if he died
on the scaffold they passed to the crown; or long imprisonment
might thwart his best laid plans for strengthening his hold over his
boroughs. The young Lord Maurice of Berkeley, for instance, was
drawn into rebellion against Edward the Second, and died in prison
four and a half years later. During the whole time that he held his
estates he was only in freedom for four months; and his eldest son,
who was imprisoned with him, was not set at liberty till some
months after his father’s death.[496] Meanwhile the towns were
always quick to make their profit in such times of disturbance and
revolution, as for example when the Earl of Devonshire was attainted
by Edward the Fourth after the battle of Towton for his support of
the Lancastrian cause, and the citizens of Exeter seized so
favourable an opportunity to claim the restitution of a suburb
stretching down to the riverside which the earls had held to
strengthen their hold on the navigation of the Exe.[497]
Nor was the lord’s position made more hopeful by the furious
feuds between noble and noble which distracted the provinces in the
fifteenth century, and the incessant lawsuits by which the
landowners sought to mend their fortunes. In 1463 James Lord of
Berkeley made an agreement with the Countess of Shrewsbury that
they would have no more battles at law; for he was then sixty-nine,
and she fifty-two, and neither of them since their ages of discretion
had “enjoyed any three months of freedom from lawsuits.”[498] Nor
did they wage their fight in the law-courts only, but carried on an
open war by which Gloucestershire had been distracted since 1421,
and which proved one of the most deadly of the many provincial
conflicts of the fifteenth century. Appeased at intervals to break out
again with renewed force, and with the usual incidents of hangings
and finings and imprisonments and ransomings, it finally culminated
in 1470 in a pitched battle on Nibley Green, where the Berkeleys
triumphantly maintained their cause at the head of about 1,000
fighting men, and Lord Lisle, the son of Lady Shrewsbury, who led
the enemy’s army, was killed. To country folk and traders this feud of
the nobles carried with it, we are told, “the ill-effects and
destructions of a petty war, wherein the borough town of Berkeley,
for her part, saw the burning and prostration of many of her ancient
houses, as her old rent which till that time was £22 by the year and
upwards, and by those devastations brought down to £11 and under,
where it sticketh to this day, without recovery of her ancient lustre or
greatness.”[499] Such a strife was by no means singular or without
parallel, and the histories of Norfolk, Yorkshire, Derbyshire, or
Lancashire have their records of similar outrages. Exeter was thrown
into alarm by a great fight on Clistheath in 1453 between the Earl of
Devon and Lord William Bonvil where many persons were grievously
wounded and much hurt done: “the occasion whereof was about a
dog; but great displeasure thereby came to the city, where presently
after the fight the Lord Bonvil sheltered himself, which the Earl took
amiss, thinking it had been so done by the city in some displeasure
to himself.”[500] The mere instinct of self-protection naturally drove
the towns to detach their interests from nobles whose alliance
brought disaster and ruin to simple traders, and in every borough
statute after statute forbidding the inhabitants to wear the
“livery”[501] of any lord whatever, testified to the determination of
the towns to cut off from the great people of the country round
every possibility of stirring up faction within their borders.
But if boroughs in the ownership of a private lord might secure
advantages through his poverty, his misfortune, or his weakness,
their position was one of essential inferiority as compared with
towns on the public demesne.[502] In the story of Liverpool we have
a curious illustration of the fortunes of a borough whose lot it was to
fall at one time into the charge of the state, and at another to be
thrown into the hands of a noble—and whose vicissitudes at last left
it in a sort of indeterminate condition where it owed a deferential
obedience to patrons or masters on every side.
Liverpool, which had been granted by Henry the Second to the
constable of Lancaster Castle, was resumed in 1207 by John, who
granted it a charter of trading privileges. A new charter of Henry the
Third, in 1229, gave it a guild merchant and hanse, with freedom
from toll, and the rights of a free borough; and on the very next day
after this grant Henry gave the lease of the fee-farm to the
burgesses for four years at £10 a year.[503] The true foundations of
municipal independence were thus laid. The town had its common
seal; one of its two bailiffs was apparently elected by the people,
and charged with the collecting of tolls for the ferm; and the busy
trade with Ireland at that time, and the later advantage of a secure
place of embarkation for troops, which became very important as
the harbour of Chester silted up, promised prosperity. In the same
year, however, the town was granted away by the King to the Earl of
Chester, then passed in 1232 to the Earl of Derby; and in 1266 was
given to Edmund Crouchback, Earl of Lancaster, and under the Lords
of Lancaster Liverpool remained till a century later, when in 1361 it
passed by marriage to John of Gaunt.
All hope of freedom for Liverpool died away under its new lords.
The grant of the ferm was not renewed for over a hundred years;
and at an enquiry of “Quo Warranto” in 1292 under Edward the First
“certain men of the Borough of Liverpool came for the commonalty,
and say that they have not at present a bailiff of themselves, but
have been accustomed to have, until Edmund the King’s brother
impeded them, and permits them not to have a free borough.”
Wherefore they claim only “that they may be quit of common fines
and amercements of the county, &c., and of toll, stallage, &c.,
through the whole kingdom,” for “as to the other liberties” which
they used to have “the aforesaid Edmund now has them.” They
quote charters, to show that their ancient liberties had been held
direct from the crown, and the court decided that “Edmund hath
usurped and occupied the aforesaid liberties,” and ordered him to
appear before it; but no action seems to have been taken against
him, and for forty years he and his successors went on themselves
collecting the tolls.[504] At last in 1356 the lord Henry allowed the
townsmen to elect a mayor every year, and the next year the first
Duke of Lancaster (father-in-law of John of Gaunt) leased the ferm
to the mayor and others to hold for the burgesses for ten years,[505]
and Liverpool was thus restored to the same position in which the
King had put it a hundred and thirty years earlier. But even now its
limited privileges rested simply on the will and caprice of the lord; he
might give the lease of the ferm with the right of collecting tolls for
the rent to the mayor, or an ex-mayor, or whomever he would; he
might grant it for a year, or for ten years, or he might take it all back
into his own hands. As a matter of fact questions of convenience and
profit seem to have made it advisable to leave the collections of
taxes mainly with the town officers. When John of Gaunt granted his
lease, at the request of the “honest and discreet men of the
burgesses” the articles were embodied in a patent “to ourselves, to
the mayor, and to the bailiffs,”[506] and in his time the lease was
commonly granted for ten years.[507]
However some of the evils of such a system might be mitigated
by the prudence of rulers bent on securing the utmost possible
profits from their subjects, there was no real guarantee of freedom
or security to the people. But when at the death of John of Gaunt in
1399, the Duchy of Lancaster was united to the crown, there was a
new gleam of hope. The ferm of Liverpool, like that of Leicester, was
now again paid to the King; an effort seems to have been made to
abolish the old uncertain[508] system, and in 1421 Henry V. granted
the fee-farm for one year to the corporation, while an inquiry was
held as to the value of the property and the terms of its tenure since
the time of John of Gaunt. The King’s death however stopped the
proceedings, and the rising fortunes of the town were extinguished
by the two great families who were from this time definitely settled
down on it.[509]
For Liverpool was now hemmed in between two rival fortresses.
Sir John Stanley with an army of followers was encamped in a great
square embattled fort, with subordinate towers and buildings
forming three sides of a quadrangle, the whole planted on the river
edge, and commanding both the town and the Mersey, where the
Stanleys’ ships were moored, and whence they set sail for their new
kingdom, the Isle of Man.[510] Sir Richard Molyneux, as hereditary
Constable, held the King’s castle a little further along the river, with
its area of fifty square acres defended by four towers, and
surrounded by a fosse thirty yards wide, much of which was cut in
the solid rock.[511] When a quarrel broke out in 1424 between the
lords of these rival fortresses, Stanley collected a multitude of people
in the town to the number of 2,000 or more, for he declared that Sir
Richard Molyneux “will come hither with great congregations, riots,
and great multitude of people to slay and beat the said Thomas
(Stanley), his men and his servants, the which he would withstand if
he might.” On the other hand Sir Richard had gathered his forces
near the West Derby fen, “and there on a mow within the said town
we saw the said Sir Richard with great congregations, rout and
multitude to the number of 1,000 men and more, arrayed in manner
as to go to battle, and coming in fast towards Liverpool town.” A
pitched battle was only prevented by the sheriff of the county, who
hastened to the rescue at the head of his forces, and succeeded in
seizing first Stanley in his tower, and then Molyneux as he rode
towards the town.[512]
Such scenes of riot and disorder were fatal to the prosperity and
municipal hopes of Liverpool; but there was no escape from their
unwelcome patrons. Both the great houses fought for York; and in
return Edward the Fourth granted to Stanley the borough of
Liverpool and other estates formerly belonging to the Duchy of
Lancaster; while Molyneux was made chief forester of West Derby,
steward of West Derby and Salford, and constable of Liverpool
castle. Richard the Third again gave to the Stanleys large grants in
Lancashire, and confirmed the Molyneux people in their offices,[513]
and Henry the Seventh favoured their claims. The lords were great
and important people in those days, and the little town of no
account. Its independence died away, and the troubles of the ferm
revived in their old bad form. The question of the lease was never
settled, but in any case it passed out of the hands of the
corporation. From 1495 it was for many years granted to David ap
Griffith, who when he became mayor in 1502 had it renewed to him.
Henry the Eighth leased it in 1525 and 1529 to his widow and son-
in-law for terms which were to expire in 1566. In 1537, however, it
was let to Thomas Holcraft, who sublet it to Sir William Molyneux.
The mayor and corporation under Edward the Sixth declared the
authority of the Molyneux family to be illegal, and claimed under the
old lease granted to Griffith. For many years they fought obstinately
in the case, holding perhaps that the house of their old mayor more
nearly represented the town and its interests than the house of
Molyneux; and one of them was thrown into prison for his resistance
under Mary.[514] The ferm was not finally granted to the corporation
till 1672; and Liverpool was for a couple of centuries so sorely tried
by the necessity of keeping well with the two great families that
overawed it as well as with the Chancellor of the Duchy of Lancaster,
[515] whether in the collecting of its scanty taxes or the choosing of
its burghers for Parliament, that the history of its civic developement
long remained of no importance.[516]
CHAPTER IX

Battle for Freedom

(3) Towns on Church Estates

The towns on ecclesiastical estates form a distinct group, whose


lot was materially different from boroughs on ancient demesne or on
feudal lands. All lay property was subject only to laws and customs
which had been ultimately determined by the necessities of social or
political expediency, and which, dealing with secular possessions for
secular purposes, were capable of being unmade as they had been
made. But the towns which were reckoned among ecclesiastical
estates lay under the special conditions that governed those estates,
where religious and supernatural influences had been forced into the
service of material wealth, and the attempt was made by spiritual
authority to fix fluctuating political conditions into perpetual
immutability. Prelates of the Church professed to rule with a double
title, not only as feudal lords of the soil, but as guardians of the
patrimony of S. Peter, holding property in trust for a great spiritual
corporation, and exercising an authority maintained by formidable
sanctions. If the watchwords of property are always impressive,
among lay folk they are still open, under sufficiently strong pressure,
to reasonable discussion; and it is admitted that temporal rights may
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookultra.com

You might also like