09 Spru302b DMA TMS320C54XX
09 Spru302b DMA TMS320C54XX
09 Spru302b DMA TMS320C54XX
Reference Set
TI does not warrant or represent that any license, either express or implied, is granted under any TI
patent right, copyright, mask work right, or other TI intellectual property right relating to any
combination, machine, or process in which TI products or services are used. Information published by
TI regarding third-party products or services does not constitute a license from TI to use such products
or services or a warranty or endorsement thereof. Use of such information may require a license from
a third party under the patents or other intellectual property of the third party, or a license from TI under
the patents or other intellectual property of TI.
Reproduction of information in TI data books or data sheets is permissible only if reproduction is without
alteration and is accompanied by all associated warranties, conditions, limitations, and notices.
Reproduction of this information with alteration is an unfair and deceptive business practice. TI is not
responsible or liable for such altered documentation.
Resale of TI products or services with statements different from or beyond the parameters stated by
TI for that product or service voids all express and any implied warranties for the associated TI product
or service and is an unfair and deceptive business practice. TI is not responsible or liable for any such
statements.
Following are URLs where you can obtain information on other Texas Instruments products and
application solutions:
Products Applications
Amplifiers amplifier.ti.com Audio www.ti.com/audio
Data Converters dataconverter.ti.com Automotive www.ti.com/automotive
DSP dsp.ti.com Broadband www.ti.com/broadband
Interface interface.ti.com Digital Control www.ti.com/digitalcontrol
Logic logic.ti.com Military www.ti.com/military
Power Mgmt power.ti.com Optical Networking www.ti.com/opticalnetwork
Microcontrollers microcontroller.ti.com Security www.ti.com/security
Low Power Wire- www.ti.com/lpw Telephony www.ti.com/telephony
less
Video & Imaging www.ti.com/video
Wireless www.ti.com/wireless
Many device references are shown with an apostrophe ( ’ ) replacing the usual
alphanumeric prefix (ex. ’5420 instead of TMS320VC5420). Unless otherwise
specified, all references to the ’54x in this book apply to the TMS320VC54x.
This user’s guide describes the enhanced peripherals available on the ’5402,
’5410, and ’5420 devices, and explains their operations.
iii
Notational
Notational Conventions
Conventions // Information
InformationAbout
AboutCautions
Cautions
Notational Conventions
This book uses the following conventions.
- The TMS320C54x DSP can use either of two forms of the instruction set:
a mnemonic form or an algebraic form. This book uses the mnemonic form
of the instruction set. For information about the mnemonic form of the in-
struction set, see TMS320C54x DSP Reference Set, Volume 2: Mnemon-
ic Instruction Set. For information about the algebraic form of the instruc-
tion set, see TMS320C54x DSP Reference Set, Volume 3: Algebraic
Instruction Set.
The information in a caution is provided for your protection. Please read each
caution carefully.
iv
Related Documentation From Texas Instruments
vi
TechnicalArticles
Related Documentation from Texas Instruments / Technical Articles
Technical Articles
A wide variety of related documentation is available on digital signal processing.
These references fall into one of the following application categories:
- General-Purpose DSP
- Graphics/Imagery
- Speech/Voice
- Control
- Multimedia
- Military
- Telecommunications
- Automotive
- Consumer
- Medical
- Development Support
General-Purpose DSP:
1) Chassaing, R., Horning, D.W., “Digital Signal Processing with Fixed and
Floating-Point Processors” , CoED, USA, Volume 1, Number 1, pages 1-4,
March 1991.
2) Defatta, David J., Joseph G. Lucas, and William S. Hodgkiss, Digital Sig-
nal Processing: A System Design Approach, New York: John Wiley, 1988.
7) Jackson, Leland B., Digital Filters and Signal Processing, Hingham, MA:
Kluwer Academic Publishers, 1986.
8) Jones, D.L., and T.W. Parks, A Digital Signal Processing Laboratory Using
the TMS32010, Englewood Cliffs, NJ: Prentice-Hall, Inc., 1987.
10) Lin, K., G. Frantz, and R. Simar, Jr., “The TMS320 Family of Digital Signal
Processors,” Proceedings of the IEEE, USA, Volume 75, Number 9, pages
1143-1159, September 1987.
11) Lovrich, A., Reimer, J., “An Advanced Audio Signal Processor” , Digest of
Technical Papers for 1991 International Conference on Consumer Elec-
tronics, June 1991.
12) Magar, S., D. Essig, E. Caudel, S. Marshall and R. Peters, “An NMOS Digi-
tal Signal Processor with Multiprocessing Capability,” Digest of IEEE Inter-
national Solid-State Circuits Conference, USA, February 1985.
13) Oppenheim, Alan V., and R.W. Schafer, Digital Signal Processing, Engle-
wood Cliffs, NJ: Prentice-Hall, Inc., 1975 and 1988.
15) Papamichalis, P., and R. Simar, Jr., “The TMS320C30 Floating-Point Digi-
tal Signal Processor,” IEEE Micro Magazine, USA, pages 13-29, Decem-
ber 1988.
viii
Technical Articles
17) Parks, T.W., and C.S. Burrus, Digital Filter Design, New York, NY: John Wiley
and Sons, Inc., 1987.
18) Peterson, C., Zervakis, M., Shehadeh, N., “Adaptive Filter Design and
Implementation Using the TMS320C25 Microprocessor” , Computers in
Education Journal, USA, Volume 3, Number 3, pages 12-16, July-Sep-
tember 1993.
20) Rabiner, L.R. and B. Gold, Theory and Applications of Digital Signal Pro-
cessing, Englewood Cliffs, NJ: Prentice-Hall, Inc., 1975.
21) Simar, Jr., R., and A. Davis, “The Application of High-Level Languages to
Single-Chip Digital Signal Processors,” Proceedings of ICASSP 88, USA,
Volume D, page 1678, April 1988.
22) Simar, Jr., R., T. Leigh, P. Koeppen, J. Leach, J. Potts, and D. Blalock, “A
40 MFLOPS Digital Signal Processor: the First Supercomputer on a Chip,”
Proceedings of ICASSP 87, USA, Catalog Number 87CH2396-0, Volume 1,
pages 535-538, April 1987.
23) Simar, Jr., R., and J. Reimer, “The TMS320C25: a 100 ns CMOS VLSI Digi-
tal Signal Processor,” 1986 Workshop on Applications of Signal Processing
to Audio and Acoustics, September 1986.
24) Texas Instruments, Digital Signal Processing Applications with the TMS320
Family, 1986; Englewood Cliffs, NJ: Prentice-Hall, Inc., 1987.
25) Treichler, J.R., C.R. Johnson, Jr., and M.G. Larimore, A Practical Guide
to Adaptive Filter Design, New York, NY: John Wiley and Sons, Inc., 1987.
Graphics/Imagery:
Speech/Voice:
2) Gray, A.H., and J.D. Markel, Linear Prediction of Speech, New York, NY:
Springer-Verlag, 1976.
3) Frantz, G.A., and K.S. Lin, “A Low-Cost Speech System Using the
TMS320C17,” Proceedings of SPEECH TECH ’87, pages 25-29, April
1987.
8) Reimer, J.B. and K.S. Lin, “TMS320 Digital Signal Processors in Speech
Applications,” Proceedings of SPEECH TECH ’88, April 1988.
Control:
1) Ahmed, I., “16-Bit DSP Microcontroller Fits Motion Control System Applica-
tion,” PCIM, October 1988.
x
Technical Articles
5) Allen, C. and P. Pillay, “TMS320 Design for Vector and Current Control of
AC Motor Drives” , Electronics Letters, UK, Volume 28, Number 23, pages
2188-2190, November 1992.
10) Meshkat, S., and I. Ahmed, “Using DSPs in AC Induction Motor Drives,”
Control Engineering, February 1988.
11) Panahi, I. and R. Restle, “DSPs Redefine Motion Control” , Motion Control
Magazine, December 1993.
Multimedia:
Military:
Telecommunications:
10) Troullinos, G., and J. Bradley, “Split-Band Modem Implementation Using the
TMS32010 Digital Signal Processor,” Conference Records of Electro/86 and
Mini/Micro Northeast, USA, 14/1/1-21, May 1986.
Automotive:
xii
Technical Articles
Consumer:
1) Frantz, G.A., J.B. Reimer, and R.A. Wotiz, “Julie, The Application of DSP
to a Product,” Speech Tech Magazine, USA, September 1988.
3) Reimer, J.B., P.E. Nixon, E.B. Boles, and G.A. Frantz, “Audio Customiza-
tion of a DSP IC,” Digest of Technical Papers for 1988 International Con-
ference on Consumer Electronics, June 8-10 1988.
Medical:
Development Support:
Trademarks
HP-UX is a trademark of Hewlett-Packard Company.
320 Hotline On-line, TI, XDS510, and XDS510WS are trademarks of Texas
Instruments Incorporated.
xiv
Contents
Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
Provides an overview of the enhanced peripherals available on the ’5402, ’5410, and ’5420
devices.
1.1 Overview of the ’54x Enhanced Peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
1.1.1 Multi-channel Buffered Serial Ports (McBSPs) . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
1.1.2 Direct Memory Access (DMA) Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
1.1.3 Host Port Interfaces (HPI-8 and HPI-16) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
xv
Contents
xvi
Contents
A Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-1
Contents xvii
Figures
Figures
2−1 McBSP Internal Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
2−2 Serial Port Control Register 1 (SPCR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
2−3 Serial Port Control Register 2 (SPCR2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
2−4 Pin Control Register (PCR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12
2−5 Receive Control Register 1 (RCR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16
2−6 Receive Control Register 2 (RCR2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-17
2−7 Transmit Control Register 1 (XCR1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-19
2−8 Transmit Control Register 2 (XCR2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-20
2−9 Frame and Clock Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-28
2−10 Receive Data Clocking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-30
2−11 Dual-Phase Frame Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-30
2−12 Single-Phase Frame of Four 8-Bit Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-33
2−13 Single-Phase Frame of One 32-Bit Word . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-34
2−14 Data Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-34
2−15 Two-bit Data Delay Used to Discard Framing Bit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-35
2−16 AC97 Dual-Phase Frame Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-36
2−17 AC97 Bit Timing Near Frame-Synchronization Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-36
2−18 DX Enabler in Normal Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-37
2−19 DX Enabler in A-bis mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-37
2−20 McBSP Standard Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-38
2−21 Receive Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-39
2−22 Transmit Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-39
2−23 Maximum Frame Frequency Receive/Transmit (R/X)DATDLY = 0) . . . . . . . . . . . . . . . . . . 2-40
2−24 Maximum Packet Frequency Operation with 8-bit Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-41
2−25 Data Packing at Maximum Packet Frequency With (R/X)FIG=1 . . . . . . . . . . . . . . . . . . . . 2-42
2−26 Unexpected Frame Synchronization With (R/X)FIG=0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-43
2−27 Unexpected Frame Synchronization With (R/X)FIG = 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-43
2−28 Serial Port Receive Overrun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-45
2−29 Serial Port Receive Overrun Avoided . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-46
2−30 Response to Receive Frame-Synchronization Pulse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-47
2−31 Unexpected Receive Synchronization Pulse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-48
2−32 Transmit With Data Overwrite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-48
2−33 Transmit Empty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-49
2−34 Transmit Empty Avoided . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-50
2−35 Response to Transmit Frame Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-51
2−36 Unexpected Transmit Frame-Synchronization Pulse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-52
xviii
Figures
Contents xix
Figures
xx
Tables
Tables
2−1 McBSP Interface Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
2−2 McBSP Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
2−3 McBSP CPU Interrupts and DMA Event Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
2−4 Serial Port Control Register 1 (SPCR1) Bit-Field Descriptions . . . . . . . . . . . . . . . . . . . . . . 2-7
2−5 Serial Port Control Register 2 (SPCR2) Bit-Field Descriptions . . . . . . . . . . . . . . . . . . . . . . 2-10
2−6 Pin Control Register (PCR) Bit-Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12
2−7 Receive Control Register 1 (RCR1) Bit-Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . 2-16
2−8 Receive Control Register 2 (RCR2) Bit-Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . 2-17
2−9 Transmit Control Register 1 (XCR1) Bit-Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . 2-19
2−10 Transmit Control Register 2 (XCR2) Bit-Field Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . 2-20
2−11 Reset State of McBSP Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-23
2−12 RCR[1,2]/XCR[1,2] Bit-Fields Controlling Words per Frame and Bits per Word . . . . . . . 2-31
2−13 McBSP Receive/Transmit Frame Length (1,2) Configuration . . . . . . . . . . . . . . . . . . . . . . . 2-31
2−14 McBSP Receive/Transmit Word Length Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-32
2−15 Use of RJUST Field With 12-Bit Example Data 0xABC . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-52
2−16 Use of RJUST Field With 20-Bit Example Data 0xABCDE . . . . . . . . . . . . . . . . . . . . . . . . . 2-52
2−17 Sample Rate Generator Register 1 (SRGR1) Bit-Field Descriptions . . . . . . . . . . . . . . . . . 2-59
2−18 Sample Rate Generator Register 2 (SRGR2) Bit-Field Descriptions . . . . . . . . . . . . . . . . 2-60
2−19 Receive Clock Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-65
2−20 Transmit Clock Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-65
2−21 Receive Frame-Synchronization Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-67
2−22 Transmit Frame-Synchronization Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-68
2−23 Multichannel Control Register 1 (MCR1) Bit-Field Descriptions . . . . . . . . . . . . . . . . . . . . 2-73
2−24 Multichannel Control Register 2 (MCR2) Bit-Field Descriptions . . . . . . . . . . . . . . . . . . . . 2-75
2−25 Receive Channel Enable Register Partition A (RCERA) Bit-Field Descriptions . . . . . . . . 2-80
2−26 Receive Channel Enable Register Partition B (RCERB) Bit-Field Descriptions . . . . . . . . 2-81
2−27 Transmit Channel Enable Register Partition A (XCERA) Bit-Field Descriptions . . . . . . . 2-81
2−28 Transmit Channel Enable Register Partition B (XCERB) Bit-Field Descriptions . . . . . . . 2-82
2−29 Clock Stop Mode Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-88
2−30 Register Bit Values for SPI Mode Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-90
2−31 Register Bit Values for SPI Master Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-91
2−32 Register Bit Values for SPI Slave Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-92
2−33 McBSP Clock Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-95
2−34 Configuration of Pins as General Purpose I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-97
3−1 DMA Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
3−2 DMA Channel Priority and Enable Control (DMPREC) Register Bit/Field
Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8
Contents xxi
Tables
xxii
Examples
Examples
2−1 Resetting and Configuring the Transmitter While Receiver is Running . . . . . . . . . . . . . . . 2-26
3−1 Using Register Subaddressing Without Autoincrement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
3−2 Using Register Subaddressing With Autoincrement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
3−3 Data Sorting by Address Modification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-22
3−4 ABU Buffer Size Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-25
3−5 Wrap Address Calculation for a Single-Word Transfer With Indexed Addressing . . . . . . 3-26
3−6 Wrap Address Calculation for a Double-Word Transfer With Indexed Addressing . . . . . 3-26
3−7 ’5402/’5420 ABU Interrupt Example − Even Size Buffer With +1 Index . . . . . . . . . . . . . . 3-29
3−8 ’5402/’5420 ABU Interrupt Example − Odd Size Buffer With +1 Index . . . . . . . . . . . . . . . 3-29
3−9 ’5402/’5420 ABU Interrupt Example − Even Size Buffer With −1 Index . . . . . . . . . . . . . . . 3-30
3−10 ’5402/’5420 ABU Interrupt Example − Odd Size Buffer With −1 Index . . . . . . . . . . . . . . . 3-30
3−11 ’5410 ABU Interrupt Example − Even Size Buffer With +1 Index . . . . . . . . . . . . . . . . . . . . 3-31
3−12 ’5410 ABU Interrupt Example − Odd Size Buffer With +1 Index . . . . . . . . . . . . . . . . . . . . . 3-31
3−13 ’5410 ABU Interrupt Example − Even Size Buffer With −1 Index . . . . . . . . . . . . . . . . . . . . 3-32
3−14 ’5410 ABU Interrupt Example − Odd Size Buffer With −1 Index . . . . . . . . . . . . . . . . . . . . . 3-32
3−15 DMA Channel Transfer Rate Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-40
3−16 Program Memory to Data Memory Transfer Without Autoincremented
Subaddressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-46
3−17 Program Memory to Data Memory Transfer Using Autoincremented
Subaddressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-48
3−18 Program Memory to Data Memory Transfer With Autoinitialization . . . . . . . . . . . . . . . . . . 3-50
3−19 McBSP Data Transfer in ABU Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-52
3−20 McBSP Data Transfer in Double-Word Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-54
3−21 McBSP to Data Memory Transfer With Data Sorting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-56
6−1 DMA Channels 0 and 1 Configured for FIFO Transmit and Receive . . . . . . . . . . . . . . . . . . 6-4
Contents xxiii
Running Title—Attribute Reference
xxiv
Chapter 1
Introduction
The ’54x device is a fixed-point digital signal processor (DSP) in the TMS320
family. The central processing unit (CPU), with its modified Harvard architec-
ture, minimizes power consumption and adds a high degree of parallelism.
System performance is further enhanced by versatile addressing modes and
instruction sets. These and other characteristics allow the ’54x to meet the
specific needs of real-time embedded applications such as telecommunica-
tions.
All ’54x devices have general-purpose I/O pins (XF and BIO), a timer (two on
the ’5402), a clock generator, a software-programmable wait-state generator,
and a programmable bank-switching module. Different types and quantities of
serial ports, host-port interfaces, and clock generators are specific to the vari-
ous ’54x devices.
Topic Page
1-1
1.1 Overview of the ’54x Enhanced Peripherals
The sections that follow provide an overview of the enhanced peripherals
available on the ’54x.
1-2
Chapter 2
Depending on the specific device, the 54x digital signal processor provides
multiple high-speed, full-duplex, multichannel buffered serial ports (McBSPs)
that allow direct interface to other ’54x devices, codecs, and other devices in
a system. The ’5402 provides two, the ’5410 three, and the ’5420 six McBSPs.
They are based on the standard serial port interface found on other ’54x de-
vices.
This chapter describes the operation of the McBSPs, and includes register
definitions and timing diagrams.
Topic Page
2-1
2.1 McBSP Features
The McBSP is based on the standard serial port interface found on the
TMS320C2x, ’C20x, ’C5x, and ’C54x devices. The McBSP provides:
- Full-duplex communication
- A wide selection of data sizes including 8, 12, 16, 20, 24, and 32 bits
Note: Data sizes are referred to as word or serial word throughout this document and
can be 8, 12, 16, 20, 24, or 32 bits, in contrast to the true definition of word which is
32 bits.
2-2
2.2 McBSP General Description
The McBSP consists of a data path and a control path connected to external
devices by seven pins as shown in Figure 2−1.
McBSP
ÁÁÁÁÁÁÁÁÁÁÁÁÁ
Compand
ÁÁÁ ÁÁÁÁÁÁÁ
DR RSR RBR Expand DRR
ÁÁÁ ÁÁÁÁÁÁÁ
DX XSR Compress DXR
ÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁ SPCR
ÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁ
CLKX
ÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁ
CLKR RCR
Clock and 16-bit
ÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁ
FSX frame-sync peripheral
XCR
ÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁ
FSR generation bus
and control
ÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁ
CLKS SRGR
ÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁ PCR
ÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁ
MCR
ÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁ Multichannel RCER
ÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁ
selection
ÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁ
XCER
RINT
Interrupts to CPU
XINT
REVT
XEVT
Synchronization
events to DMA
REVTA
XEVTA
2-3
Data is communicated to devices interfacing the McBSP via the data transmit
(DX) pin for transmit and the data receive (DR) pin for receive. Control informa-
tion in the form of clocking and frame synchronization is communicated via
CLKX, CLKR, FSX, and FSR. The ’54x communicates with the McBSP through
16-bit-wide control registers accessible via the internal peripheral bus.
The CPU or the DMA controller reads the received data from the data receive
register (DRR[1,2]) and writes the data to be transmitted to the data transmit
register (DXR[1,2]). Data written to DXR[1,2] is shifted out to DX via the trans-
mit shift register (XSR[1,2]). Similarly, receive data on the DR pin is shifted into
the receive shift register (RSR[1,2]) and copied into the receive buffer register
(RBR[1,2]). RBR[1,2] is then copied to DRR[1,2], which can be read by the CPU
or the DMA controller. This allows simultaneous movement of internal and exter-
nal data communications.
DRR2, RBR2, RSR2, DXR2, and XSR2 registers are not utilized (written, read,
or shifted) if the receive/transmit word length, R/XWDLEN[1,2], is specified for
8-, 12-, or 16-bit mode.
The remaining registers accessible to the CPU configure the control mechanism
of the McBSP. These registers are listed in Table 2−2, McBSP Registers, on
page 2-5. The control block consists of internal clock generation, frame-syn-
chronization signal generation, and their control and multichannel selection.
This control block sends notification of important events to the CPU and DMA
controller via the two interrupt and four event signals shown in Table 2−3,
McBSP CPU Interrupts and DMA Event Synchronization, on page 2-6.
2-4
Table 2−2. McBSP Registers
Hex Address
Sub-
McBSP 0 McBSP 1 McBSP 2 Address Acronym Register Name{ Section
— — — RBR[1,2] McBSP receive buffer register 1 and 2 2.2
0039 0049 0035 0x0000 SPCR1x McBSP serial port control register 1 2.2.1
0039 0049 0035 0x0001 SPCR2x McBSP serial port control register 2 2.2.1
0039 0049 0035 0x0002 RCR1x McBSP receive control register 1 2.2.2
0039 0049 0035 0x0003 RCR2x McBSP receive control register 2 2.2.2
0039 0049 0035 0x0004 XCR1x McBSP transmit control register 1 2.2.2
0039 0049 0035 0x0005 XCR2x McBSP transmit control register 2 2.2.2
0039 0049 0035 0x0006 SRGR1x McBSP sample rate generator register 2.5.1.1
1
0039 0049 0035 0x0007 SRGR2x McBSP sample rate generator register 2.5.1.1
2
0039 0049 0035 0x000A RCERAx McBSP receive channel enable register 2.6.3.1
partition A
0039 0049 0035 0x000B RCERBx McBSP receive channel enable register 2.6.3.1
partition B
† RBR[1,2], RSR[1,2], and XSR[1,2] are not directly accessible via the CPU or DMA.
2-5
Table 2−2. McBSP Registers (Continued)
Hex Address
Sub-
McBSP 0 McBSP 1 McBSP 2 Address Acronym Register Name{ Section
0039 0049 0035 0x000C XCERAx McBSP transmit channel enable 2.6.3.1
register partition A
0039 0049 0035 0x000D XCERBx McBSP transmit channel enable 2.6.3.1
register partition B
0039 0049 0035 0x000E PCRx McBSP pin control register 2.2.1 &
2.9
† RBR[1,2], RSR[1,2], and XSR[1,2] are not directly accessible via the CPU or DMA.
2-6
In addition to the PCR being used to configure the McBSP pins as inputs or
outputs during normal serial port operation, it is used to configure the serial
port pins as general purpose inputs or outputs during receiver and/or transmit-
ter reset. This is described in section 2.9, McBSP Pins as General Purpose I/O,
on page 2-97.
7 6 5 4 3 2 1 0
DXENA ABIS RINTM RSYNCERR RFULL RRDY RRST
RW,+0 RW,+0 RW,+0 RW,+0 R,+0 R,+0 RW,+0{
Note: R = Read, W = Write, +0 = Value at reset
† R, +0 means read-only, reset value is 0. RW, +0 means read and write allowed, reset value is 0.
RJUST = 11 Reserved
2-7
Table 2−4. Serial Port Control Register 1 (SPCR1) Bit-Field Descriptions (Continued)
Bit Name Function Section
12−11 CLKSTP Clock Stop Mode 2.7
DXENA = 1 DX enabler is on
2-8
Table 2−4. Serial Port Control Register 1 (SPCR1) Bit-Field Descriptions (Continued)
Bit Name Function Section
RSYNCERR = 1 Synchronization error detected by McBSP.
0 RRST Receiver reset. This resets and enables the receiver. 2.3.1
2-9
Figure 2−3. Serial Port Control Register 2 (SPCR2)
15 14 13 12 11 10 9 8
reserved{ FREE SOFT
R,+0 RW,+0 RW,+0
7 6 5 4 3 2 1 0
FRST GRST XINTM XSYNCERR} XEMPTY XRDY XRST
RW,+0 RW,+0 RW,+0 RW,+0 R,+0 R,+0 RW,+0
Note: R = Read, W = Write, +0 = Value at reset
† Note: This and all reserved bit-fields have NO storage associated with them; however, they are always read as 0.
‡ CAUTION: Writing a 1 to this bit sets the error condition; thus, it is mainly used for testing purposes or if this operation is desired.
2-10
Table 2−5. Serial Port Control Register 2 (SPCR2) Bit-Field Descriptions (Continued)
Bit Name Function Section
5−4 XINTM Transmit Interrupt Mode 2.3.3
0 XRST Transmitter reset. This resets and enables the transmitter. 2.3.1
2-11
Figure 2−4. Pin Control Register (PCR)
15 14 13 12 11 10 9 8
reserved XIOEN RIOEN FSXM FSRM CLKXM CLKRM
R,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0
7 6 5 4 3 2 1 0
reserved CLKS_STAT DX_STAT DR_STAT FSXP FSRP CLKXP CLKRP
R,+0 R,+0 R,+0 R,+0 RW,+0 RW,+0 RW,+0 RW,+0
Note: R = Read, W = Write, +0 = Value at reset
13 XIOEN Transmit general purpose I/O mode only when XRST = 0 in SPCR[1,2] 2.9
XIOEN = 0 DX, FSX and CLKX are configured as serial port pins and
do not function as general-purpose I/Os.
12 RIOEN Receive general purpose I/O mode only when RRST = 0 in SPCR[1,2] 2.9
RIOEN = 0 DR, FSR, CLKR and CLKS are configured as serial port
pins and do not function as general-purpose I/Os.
RIOEN = 1 DR and CLKS pins are general purpose inputs; FSR and
CLKR are general purpose I/Os. These serial port pins do
not perform serial port operation. The CLKS pin is affected
by a combination of RRST and RIOEN signals of the
receiver.
2-12
Table 2−6. Pin Control Register (PCR) Bit-Field Descriptions (Continued)
Bit Name Function Section
11 FSXM Transmit Frame-Synchronization Mode 2.5.3.3
and 2.9
2-13
Table 2−6. Pin Control Register (PCR) Bit-Field Descriptions (Continued)
Bit Name Function Section
8 CLKRM Receiver Clock Mode 2.5.2.6
and 2.9
Case 1: Digital loop back mode not set (DLB = 0) in SPCR1
7 rsvd Reserved
6 CLKS_ STAT CLKS pin status. Reflects value on CLKS pin when selected as a general 2.9
purpose input.
5 DX_STAT DX pin status. Reflects value driven on to DX pin when selected as a 2.9
general purpose output.
2-14
Table 2−6. Pin Control Register (PCR) Bit-Field Descriptions (Continued)
Bit Name Function Section
1 CLKXP Transmit Clock Polarity 2.3.4.1
and 2.9
The operation of each bit-field is discussed in the sections listed in Table 2−7,
Receive Control Register 1 (RCR1) Bit-Field Description, on page 2-16;
Table 2−8, Receive Control Register 2 (RCR2) Bit-Field Description, on page
2-17; Table 2−9, Transmit Control Register 1 (XCR1) Bit-Field Description, on
page 2-19; and Table 2−10, Transmit Control Register 2 (XCR2) Bit-Field De-
scription, on page 2-20.
2-15
Figure 2−5. Receive Control Register 1 (RCR1)
15 14 8 7 5 4 0
rsvd RFRLEN1 RWDLEN1 reserved
R,+0 RW,+0 RW,+0 R,+0
Note: R = Read, W = Write, +0 = Value at reset
2-16
Figure 2−6. Receive Control Register 2 (RCR2)
15 14 8 7 5 4 3 2 1 0
RPHASE RFRLEN2 RWDLEN2 RCOMPAND RFIG RDATDLY
RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0
Note: R = Read, W = Write, +0 = Value at reset
2-17
Table 2−8. Receive Control Register 2 (RCR2) Bit-Field Descriptions (Continued)
Bit Name Function Section
4−3 RCOMPAND Receive companding mode. Modes other than 00b are only enabled 2.4
when the appropriate RWDLEN is 000b, indicating 8-bit data.
RDATDLY = 11 Reserved
2-18
Figure 2−7. Transmit Control Register 1 (XCR1)
15 14 8 7 5 4 0
rsvd XFRLEN1 XWDLEN1 rsvd
R,+0 RW,+0 RW,+0 R,+0
Note: R = Read, W = Write, +0 = Value at reset
2-19
Figure 2−8. Transmit Control Register 2 (XCR2)
15 14 8 7 5 4 3 2 1 0
XPHASE XFRLEN2 XWDLEN2 XCOMPAND XFIG XDATDLY
RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0
Note: R = Read, W = Write, +0 = Value at reset
2-20
Table 2−10. Transmit Control Register 2 (XCR2) Bit-Field Descriptions (Continued)
Bit Name Function Section
4−3 XCOMPAND Transmit companding mode. Modes other than 00b are only enabled 2.4
when the appropriate XWDLEN is 000b, indicating 8-bit data.
XDATDLY = 11 Reserved
2-21
2.3 Data Transmission and Reception Flow
As shown in Figure 2−1, McBSP Internal Block Diagram, on page 2-3, the re-
ceive operation is triple buffered and the transmit operation is double buffered.
Receive data arrives on DR and is shifted into RSR[1,2]. Once a full word (8-,
12-, 16-, 20-, 24-, or 32-bit) is received, RSR[1,2] is copied to the receive buffer
register, RBR[1,2], only if RBR[1,2] is not full. RBR[1,2] is then copied to
DRR[1,2], unless DRR[1,2] is not read by the CPU or DMA.
1) Device reset (RS = 0) places the receiver, transmitter and the sample rate
generator in reset. When the device reset is removed (RS = 1),
GRST = FRST = RRST = XRST = 0, keeping the entire serial port in the
reset state.
2) The serial port transmitter and receiver can be independently reset by the
RRST and XRST bits in the serial port control registers. The sample rate
generator is reset by the GRST bit in SPCR2.
Table 2−11, Reset State of McBSP Pins, on page 2-23 shows the state of
McBSP pins when the serial port is reset due to device reset and receiver/
transmitter reset (XRST = RRST = FRST = 0).
2-22
Table 2−11. Reset State of McBSP Pins
McBSP Device Reset
Pins Direction (RESET = 0) McBSP Reset
Receiver Reset (RRST = 0 and GRST = 1)
DR I Input Input
FSR I/O/Z Input Known state if Input; FSRP inactive state if output
DX O Hi-Impedance Hi-Impedance
FSX I/O/Z Input Known state if Input; FSXP inactive state if output
- Device reset or McBSP reset: When the McBSP is reset in any of the
above two ways, the state machine is reset to its initial state. This initial
state includes resetting all counters and status bits. The receive status bits
include RFULL, RRDY, and RSYNCERR. The transmit status bits include
XEMPTY, XRDY, and XSYNCERR.
- Device reset: When McBSP is reset due to device reset (device pin
RS = 0), the entire serial port including the transmitter, receiver, and the
sample rate generator is reset. All input-only pins and three-state pins
should be in a known state. The output-only pin, DX, is in the high-imped-
ance state. Since the sample rate generator is also reset (GRST = 0), the
sample rate generator clock, CLKG, is driven by the divide-by-2 CPU
clock, whereas the frame-sync signal, FSG, is not generated. For more in-
formation on sample rate generator reset, see section 2.5.1.2, Sample
Rate Generator Reset Procedure, on page 2-61. When the device is
pulled out of reset, the serial port remains in reset condition ([R/X]RST = 0
and FRST = 0) and in this condition the DR and DX pins may be used as
general purpose I/O as described in section 2.9, McBSP Pins as General
Purpose I/O, on page 2-97.
- McBSP reset: When the receive and transmitter reset bits, RRST and
XRST, are written with a zero, the respective portions of the McBSP are
reset and activity in the corresponding section of the serial port stops. All
input-only pins, such as DR and CLKS, and all other pins that are
2-23
configured as inputs, are in a known state. FS(R/X) is driven to its inactive
state (same as its polarity bit FS[R/X]) if it is an output. If CLK(R/X) is pro-
grammed as an output, it will be driven by CLKG, provided that GRST = 1.
Lastly, the DX pin will be in the high-impedance state when the transmitter
and/or the device is reset. During normal operation, the sample rate gen-
erator can be reset by writing a zero to GRST. GRST should be low only
when neither the transmitter nor the receiver is using the sample rate gen-
erator. In this case, the internal sample rate generator clock (CLKG) and
its frame-sync signal (FSG) are driven inactive low. When the sample rate
generator is not in the reset state (GRST = 1), pins FSR and FSX are in
an inactive state when RRST = 0 and XRST = 0, respectively, even if they
are outputs driven by FSG. This ensures that when only one portion of the
McBSP is in reset, the other portion can continue operation when
FRST = 1 and its frame sync is driven by FSG. For more information on
sample rate generator reset, see section 2.5.1.2, Sample Rate Generator
Reset Procedure, on page 2-61.
- Sample rate generator reset: As noted earlier, the sample rate generator
is reset when the device or its reset bit, GRST, is written with a zero. In the
case of device reset, the sample rate generator clock, CLKG, is driven by
a divide-by-2 CPU clock, whereas the frame-sync pulse, FSG, is driven
inactive low. If you want to reset the sample rate generator when neither
the transmitter nor the receiver is fed by CLKG and FSG, you can program
GRST in SRGR2 to zero. Here, CLKG and FSG are driven inactive-low.
When GRST = 1, CLKG comes up running as programmed in SRGR1.
Later, if FRST = 1, FSG is driven active-high after the programmed frame
period (FPER + 1) number of CLKG cycles has elapsed.
After device reset is complete (RS = 1), the serial port initialization procedure
is as follows:
2) Program only the McBSP configuration registers (and not the data regis-
ters) listed in Table 2−2, McBSP Registers, on page 2-5, as required
when the serial port is in reset state (XRST = RRST = FRST = 0).
3) Wait for two bit clocks. This is to ensure proper synchronization internally.
5) Set XRST = RRST= 1 to enable the serial port. Note that the value written
to SPCR[1,2] at this time should have only the reset bits changed to 1, and
the remaining bit-fields should have the same value as in step 2 above.
2-24
6) Set FRST = 1, if internally generated frame sync is required.
7) Wait two bit clocks for the receiver and transmitter to become active.
Alternatively, on either write (steps 1 and 5), the transmitter and receiver may
be placed in or taken out of reset individually by modifying the desired bit. Note
that the necessary duration of the active-low period of XRST or RRST is at
least two bit-clocks (CLKR/CLKX) wide.
The above procedure for reset initialization can be applied in general when the
receiver or transmitter has to be reset during its normal operation, and also
when the sample rate generator is not used for either operation.
Notes:
(a) The appropriate bit-fields in the serial port configuration registers,
SPCR[1,2], PCR, RCR[1,2], XCR[1,2], and SRGR[1,2], should only be modi-
fied by the user when the affected portion of the serial port is in reset.
(b) Data Transmit Register, DXR[1,2], should be loaded by the CPU or DMA
only when the transmitter is not in reset (XRST = 1). An exception to this rule
is during digital loop back mode described in section 2.4.1, Companding In-
ternal Data, on page 2-55.
(c) The multichannel selection registers, MCR, XCER[A/B], and RCER[A/B],
can be modified at any time as long as they are not being used by the current
block in the multichannel selection. See section 2.6.3.2 on page 2-82 for fur-
ther details in this case.
Example 2−1 shows values in the control registers that reset and configure the
transmitter while the receiver is running.
2-25
Example 2−1. Resetting and Configuring the Transmitter While Receiver is Running
SRGR1 = 0x0001 CPU clock drives the sample rate generator clock (CLKG)
SRGR2 = 0x2000 after a divide-by-2. A DXR[1,2]-to-XSR[1,2] copy generates
the transmit frame-sync signal.
XCR1 = 0x0840 Dual-phase frame; phase 1 has eight 16-bit words; phase 2
XCR2= 0x8421 has four 12-bit words, and 1-bit data delay
RRDY = 1 indicates that the RBR[1,2] contents have been copied to DRR[1,2]
and that the data can be read by the CPU or DMA. Once that data has been
read by either the CPU or DMA, RRDY is cleared to 0. Also, at device reset
or serial port receiver reset (RRST = 0), RRDY is cleared to 0 to indicate no
data has yet been received and loaded into DRR[1,2]. RRDY directly drives
the McBSP receive event to the DMA (REVT). Also, the McBSP receive inter-
rupt (RINT) to the CPU may be driven by RRDY, if RINTM = 00b in SPCR1.
XRDY = 1 indicates that the DXR[1,2] contents have been copied to XSR[1,2]
and that DXR[1,2] is ready to be loaded with a new data word. When the trans-
mitter transitions from reset to non-reset (XRST transitions from 0 to 1), XRDY
also transitions from 0 to 1 indicating that DXR[1,2] is ready for new data. Once
new data is loaded by the CPU or DMA, XRDY is cleared to 0. However, once
this data is copied from DXR[1,2] to XSR[1,2], XRDY transitions again from 0
to 1. Now once again, the CPU or DMA can write to DXR[1,2] although
2-26
XSR[1,2] has not been shifted out on DX yet. XRDY directly drives the transmit
synchronization event to the DMA (XEVT or XEVTA). In addition, the transmit
interrupt (XINT) to the CPU may also be driven by XRDY, if XINTM = 00b in
SPCR2.
2-27
The McBSP allows configuration of various parameters for data frame syn-
chronization. This can be done independently for receive and transmit, which
includes the following items:
- The data bit delay from frame synchronization to first data bit can be 0-,
1-, or 2-bit delays.
Á Á Á
Internal
Á Á Á
FS(R/X)
D(R/X) A1 A0 B7 B6 B5 B4 B3 B2 B1 B0
2-28
When FSR and FSX are outputs, implying that they are driven by the sample
rate generator, they are generated (transition to their active state) on the rising
edge of internal clock, CLK(R/X). Similarly, data on the DX pin is output on the
rising edge of internal CLKX. See section 2.3.4.6, on page 2-34, for further de-
tails.
FSRP, FSXP, CLKRP, and CLKXP configure the polarities of FSR, FSX, CLKR,
and CLKX signals as shown in Table 2−6, Pin Control Register (PCR) Bit-Field
Description, on page 2-12. All frame-sync signals (internal FSR, internal FSX)
that are internal to the serial port are active high. If the serial port is configured
for external frame synchronization (FSR/FSX are inputs to McBSP), and
FSRP = FSXP = 1, the external active-low frame-sync signals are inverted
before being sent to the receiver (internal FSR) and transmitter (internal FSX).
Similarly, if internal synchronization (FSR/FSX are output pins and
GSYNC = 0) is selected, the internal active-high sync signals are inverted, if
the polarity bit FS(R/X)P = 1, before being sent to the FS(R/X) pin.
Figure 2−41, on page 2-57 shows this inversion using XOR gates.
On the transmit side, the transmit clock polarity bit, CLKXP, sets the edge used
to shift and clock out transmit data. Note that data is always transmitted on the
rising edge of internal CLKX. If CLKXP=1, and external clocking is selected
(CLKXM = 0 and CLKX is an input), the external falling-edge triggered input
clock on CLKX is inverted to a rising-edge triggered clock before being sent
to the transmitter. If CLKXP = 1, and internal clocking selected (CLKXM = 1
and CLKX is an output pin), the internal (rising-edge triggered) clock, internal
CLKX, is inverted before being sent out on the CLKX pin.
Similarly, the receiver can reliably sample data that is clocked with a rising
edge clock (by the transmitter). The receive clock polarity bit, CLKRP, sets the
edge used to sample received data. Note that the receive data is always
sampled on the falling edge of internal CLKR. Therefore, if CLKRP = 1 and ex-
ternal clocking is selected (CLKRM = 0 and CLKR is an input pin), the external
rising edge triggered input clock on CLKR is inverted to a falling-edge before
being sent to the receiver. If CLKRP = 1, and internal clocking is selected
(CLKRM = 1), the internal falling edge triggered clock is inverted to a rising
edge before being sent out on the CLKR pin.
Note that CLKRP = CLKXP in a system where the same clock (internal or ex-
ternal) is used to clock the receiver and transmitter. The receiver uses the op-
posite edge as the transmitter to ensure valid setup and hold of data around
this edge. Figure 2−10 shows how data, clocked by an external serial device
using a rising edge, may be sampled by the McBSP receiver with the falling
edge of the same clock.
2-29
Figure 2−10. Receive Data Clocking
Internal
CLKR
Data setup
ÁÁ
Data hold
DR
ÁÁ B7 B6
ÁÁÁ
ÁÁ ÁÁÁ
ÁÁ
ÁÁÁÁ
ÁÁÁ
ÁÁÁÁÁ
ÁÁÁ
ÁÁÁÁ
ÁÁÁ
ÁÁÁÁÁÁ
ÁÁÁ
ÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁ
ÁÁ
Phase 2
Phase 1 word 1 Phase 2 word 3
Phase 1 word 2 word 1
word 2
CLK(R/X)
ÁÁÁÁÁ
ÁÁÁ
ÁÁ
ÁÁÁÁ
ÁÁÁ
ÁÁÁÁÁ
ÁÁÁ
ÁÁÁÁ
ÁÁÁ
ÁÁÁÁÁÁ
ÁÁÁ
ÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁ
ÁÁ
Á Á
FS(R/X)
D(R/X)
2-30
Table 2−12. RCR[1,2]/XCR[1,2] Bit-Fields Controlling Words per Frame and Bits per
Word
RCR[1,2]/XCR[1,2] Bit-Field Control
Serial Port Frame
McBSP0/1 Phase Words per Frame Bits per Word
Receive 1 RFRLEN1 RWDLEN1
For the example in Figure 2−11 on page 2-30, (R/X)WDLEN1 = 001b, and
(R/X)WDLEN2 = 000b.
2-31
Notes:
(a) If (R/X)PHASE = 0 indicating a single-phase frame, (R/X)WDLEN2 is not
used by the McBSP, and its value is a don’t care.
(b) If the specified word length is larger than 16 bits, D(X/R)R2 must be writ-
ten or read before D(X/R)R1.
001 12
010 16
011 20
100 24
101 32
110 reserved
111 reserved
The frame length and word length can be manipulated to effectively pack data.
For example, consider a situation where four 8-bit words are transferred in a
single-phase frame as shown in Figure 2−12. In this case:
- (R/X)FRLEN2 = X
In this case, four 8-bit data elements are transferred to and from the McBSP
by the CPU or DMA. Thus, four reads from DRR1 and four writes to DXR1 are
necessary for each frame.
2-32
Figure 2−12. Single-Phase Frame of Four 8-Bit Words
ÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁ
ÁÁÁÁ
ÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁ
ÁÁÁ
Word 1 Word 3
Word 2 Word 4
CLKR
ÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁ
ÁÁÁÁ
ÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁ
ÁÁÁ
Á Á
FSR
DR
Á Á
ÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁ
RSR1 to RBR1 copy
ÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
RSR1 to RBR1 copy
ÁÁÁ
RSR1 to RBR1 copy RSR1 to RBR1 copy
CLKX
FSX
ÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁ
DX Á
DXR1 to XSR1 copy DXR1 to XSR1 copy
Á
DXR1 to XSR1 copy DXR1 to XSR1 copy
The example in Figure 2−12 can also be treated as a data stream of a single-
phase frame consisting of one 32-bit data word, as shown in Figure 2−13. In
this case:
- (R/X)FRLEN2 = X
In this case, two 16-bit data words are transferred to and from the McBSP by
the CPU or DMA. Thus, two reads from DRR2 and DRR1 and two writes to
DXR2 and DXR1 are necessary for each frame. This results in only one-half
the number of transfers compared to the previous case. This manipulation re-
duces the percentage of bus time required for serial port data movement.
Note:
In this case, D(X/R)R2 must be written or read before D(X/R)R1.
2-33
Figure 2−13. Single-Phase Frame of One 32-Bit Word
ÁÁÁÁÁ
ÁÁÁÁÁÁÁÁ
ÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁ
Word 1
ÁÁÁÁÁ
CLKR
ÁÁÁÁÁÁÁÁ
ÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁ
Á ÁÁ
FSR
DR
ÁÁÁ
ÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
RBR1 to DRR1 copy RBR2 to DRR2 copy
CLKX
FSX
Á ÁÁ
DX
Á DXR1 to XSR1 copy
ÁÁ DXR2 to XSR2 copy
The start of a frame is defined by the first clock cycle in which frame synchro-
nization is found to be active. The beginning of actual data reception or trans-
mission with respect to the start of the frame can be delayed if required. This
delay is called data delay. RDATDLY and XDATDLY specify the data delay for
reception and transmission, respectively. The range of programmable data
delay is zero to two bit-clocks ([R/X]DATDLY = 00b −10b), as described in
Table 2−7, Receive Control Register 1 (RCR1) Bit-Field Description, on page
2-16, and Table 2−8, Receive Control Register 2 (RCR2) Bit-Field Description,
on page 2-17, and shown in Figure 2−14, Data Delay. Typically a 1-bit delay
is selected, since data often follows a one-cycle active frame-sync pulse.
CLK(R/X)
ÁÁ
FS(R/X)
ÁÁ
0−Bit Period
D(R/X) B7 B6 B5 B4 B3
Á
Data Delay 0
1−Bit Period
D(R/X)
Á B7 B6 B5 B4
Á
Data Delay 1
2−Bit Periods
D(R/X)
Data Delay 2
Á B7 B6 B5
2-34
Normally, frame-sync pulse is detected or sampled with respect to an edge of
serial clock internal CLK(R/X) (see section 2.3.4.1, Frame and Clock Opera-
tion, on page 2-28). Thus, on the following cycle or later (depending on data
delay value), data may be received or transmitted. However, in the case of
zero-bit data delay, the data must be ready for reception and/or transmission
on the same serial clock cycle. For reception, this problem is solved, since re-
ceive data is sampled on the first falling edge of CLKR where an active-high
internal FSR is detected. However, data transmission must begin on the rising
edge of the internal CLKX clock that generated the frame synchronization.
Therefore, the first data bit is assumed to be present in XSR1, and thus DX.
The transmitter then asynchronously detects the frame synchronization, FSX,
going active high, and immediately starts driving the first bit to be transmitted
on the DX pin.
Another common mode is a data delay of two. This configuration allows the
serial port to interface to different types of T1 framing devices where the data
stream is preceded by a framing bit. During reception of such a stream with
data delay of two bits (framing bit appears after one-bit delay and data appears
after 2-bit delay), the serial port essentially discards the framing bit from the
data stream as shown in Figure 2−15. In transmission, by delaying the first
transfer bit, the serial port essentially inserts a blank period (high-impedance
period) in place of the framing bit. Here, it is expected that the framing device
inserts its own framing bit or that the framing bit is generated by another de-
vice. Alternatively, you can pull up or pull down DX to achieve the desired
value.
CLKR
FSR
Á
2-bit periods
DR
2.3.4.7
Á
Multi-Phase Frame Example: AC97
Framing bit B7 B6 B5
Figure 2−16 shows an example of the Audio Codec ‘97 (AC97) standard which
uses the dual-phase frame feature. The first phase consists of a single 16-bit
word. The second phase consists of twelve 20-bit words. The phases are con-
figured as follows:
2-35
- (R/X)WDLEN1 = 010b, 16 bits per word in phase 1
- (R/X)FRLEN2 = 0001011b, 12 words per frame in phase 2
- (R/X)WDLEN2 = 011b, 20 bits per word in phase 2
- CLK(R/X)P = 0, receive data sampled on falling edge of internal CLKR;
transmit data clocked on rising edge of internal CLKX.
- FS(R/X)P = 0, active-high frame-sync signals
- (R/X)DATDLY = 01b, data delay of one bit-clock
FS(R/X)
Á
20 bits
D(R/X)
Á PxWy = Phase x Word y
Figure 2−16 shows the timing of AC97 near frame synchronization. First, no-
tice that the frame-sync pulse itself overlaps the first word. In McBSP opera-
tion, the inactive to active transition of the frame-synchronization signal actual-
ly indicates frame synchronization. For this reason, frame synchronization
may be high for an arbitrary number of bit-clocks. Only after the frame synchro-
nization is recognized to have gone inactive, and then active again, is the next
frame synchronization recognized.
Also, notice that there is a one-bit data delay in Figure 2−17. Regardless of the
data delay, transmission can occur without gaps. The last bit of the previous
(last) word in phase 2 is immediately followed by the first data bit of the first
word in phase 1 of the next data frame.
CLKR
FSR
ÁÁ
1-bit data delay
ÁÁ
DR P2W12B1 P2W12B0 P1W1B15 P1W1B14 P1W1B13 P1W1B12
PxWyBz = Phase x Word y Bit z
2-36
2.3.4.8 Delay Enable/Disable on the DX Pin
Figure 2−18 and Figure 2−19 show the timing of the DX pin when DXENA bit
is set to 1 to enable extra delay for turn-on time. This bit controls the high-im-
pedance (hi-Z) enable on the DX pin, not the data itself; so only the first bit will
be delayed in the normal mode. In the A-bis mode, any bit can be delayed since
any bit can go from hi-Z to valid. This bit should be set to avoid conflict when
tying the DX pins together.
FSX
DX
te
FSX
DX
te te te
2-37
2.3.5 McBSP Standard Operation
During a serial transfer, there are typically periods of serial port inactivity be-
tween packets or transfers. The receive and transmit frame-synchronization
pulse occurs for every serial transfer. When the McBSP is not in reset state and
has been configured for the desired operation, a serial transfer can be initiated
by programming (R/X)PHASE = 0, for a single-phase frame with required
number of words programmed in (R/X)FRLEN1. The number of words can
range from 1 to 128 ([R/X]FRLEN1 = 0x0 to 0x7F). The required serial word
length is set in the (R/X)WDLEN1 field in (R/X)CR1. If dual-phase is required
for the transfer, RPHASE = 1, (R/X)FRLEN[1,2] can be set to any value be-
tween 0x0 to 0x7F, which represents 1 to 128 words.
CLK(R/X)
Á Á Á ÁÁ
FS(R/X)
D(R/X) A1 A0 B7 B6 B5 B4 B3 B2 B1 B0 C7 C6 C5
2-38
word on the rising edge of clock, provided RBR[1,2] is not full with the previous
data. Then, an RBR[1,2]-to-DRR[1,2] copy activates the RRDY status bit to 1
on the following falling edge of CLKR. This indicates that the receive data reg-
ister (DRR[1,2]) is ready with the data to be read by the CPU or DMA. RRDY
is deactivated when DRR[1,2] is read by the CPU or DMA.
CLKR
Á ÁÁ Á Á
FSR
DR A1 A0 B7 B6 B5 B4 B3 B2 B1 B0 C7 C6 C5
RRDY
RBR1 to DRR1 copy(A) Read from DRR1(A) RBR1 to DRR1 copy(B) Read from DRR1(b)
Once transmit frame synchronization occurs, the value in the transmit shift
register, XSR[1,2], is shifted out and driven on the DX pin after the appropriate
data delay as set by XDATDLY. XRDY is activated on every DXR[1,2]-to-
XSR[1,2] copy on the following falling edge of CLKX, indicating that the data
transmit register (DXR[1,2]) is written with the next data to be transmitted.
XRDY is deactivated when DXR[1,2] is written by the CPU or DMA.
Figure 2−22 shows an example of a serial transmission. See section 2.3.7.4,
Transmit Empty: XEMPTY, on page 2-48, for transmit operation when trans-
mitter is pulled out of reset (XRST = 1).
CLKX
FSX
Á ÁÁ Á Á
DX A1
XRDY
A0
Á ÁÁ B7 B6 B5 B4 B3 B2 B1
Á
B0
Á C7 C6 C5
DXR1 to XSR1 copy(B) Write to DXR1(C) DXR1 to XSR1 copy(C) Write to DXR1
Bit−Clock Frequency
Frame Frequency +
Number of Bit−Clocks Between Frame Sync Signals
2-39
The frame frequency may be increased by decreasing the time between
frame-synchronization signals in bit clocks (limited only by the number of bits
per frame). As the frame transmit frequency is increased, the inactivity period
between the data packets for adjacent transfers decreases to zero. The mini-
mum time between frame synchronization is the number of bits transferred per
frame. The maximum frame frequency is defined as follows:
Bit−Clock Frequency
Maximum Frame Frequency +
Number of Bits Per Frame
CLK(R/X)
FS(R/X)
D(R/X) A2 A1 A0 B7 B6 B5 B4 B3 B2 B1 B0 C7 C6
Effectively, this permits a continuous stream of data; and thus, the frame-syn-
chronization pulses are essentially redundant. Theoretically, only an initial
frame-synchronization pulse is required to initiate a multipacket transfer. The
McBSP supports operation of the serial port in this fashion by ignoring the
successive frame-sync pulses. Data is clocked in to the receiver, or clocked
out of the transmitter, on every clock{. The frame ignore bit, (R/X)FIG, in
(R/X)CR can be programmed to ignore the successive frame-sync pulses until
the desired frame length or number of words is reached. This is explained in
section 2.3.6.1, Data Packing using Frame-Sync Ignore Bits, on page 2-41 .
† For (R/X)DATDLY=0, the first bit of data transmitted is asynchronous to internal CLKX.
2-40
2.3.6.1 Data Packing Using Frame-Sync Ignore Bits
Section 2.3.4.5, Data Packing using Frame Length and Word Length, on page
2-32, describes one method of changing the word length and frame length to
simulate 32-bit serial word transfers, thus requiring much less bus bandwidth.
This example works when there are multiple words per frame. Now consider
the case of the McBSP operating at maximum packet frequency as shown in
Figure 2−24. Here, each frame only has a single 8-bit word. This stream takes
one read and one write transfer for each 8-bit word. Figure 2−25 shows the
McBSP configured to treat this stream as a continuous 32-bit word. In this ex-
ample, (R/X)FIG is set to 1 to ignore subsequent frames after the first. Only
two read- or two write-transfers are needed every 32 bits. This configuration
effectively reduces the required bus bandwidth to one-half of the bandwidth
needed to transfer four 8-bit words.
Figure 2−24. Maximum Packet Frequency Operation With 8-bit Data
Word 1 Word 3
ÁÁÁÁÁ
ÁÁ ÁÁÁÁÁÁ
ÁÁÁÁ
ÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁ
ÁÁÁ
Word 2 Word 4
ÁÁÁÁÁÁ
Á ÁÁÁÁÁÁ
ÁÁÁÁ
ÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁ
ÁÁÁ
CLKR
FSR
Á Á
DR
Á Á
ÁÁÁÁÁÁ
Á ÁÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁ
RBR1 to DRR1 copy
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
RBR1 to DRR1 copy
ÁÁÁ
RBR1 to DRR1 copy RBR1 to DRR1 copy
CLKX
ÁÁÁÁÁÁ
Á ÁÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁ
Á Á
FSX
DX
ÁDXR1 to XSR1 copy DXR1 to XSR1 copy Á
DXR1 to XSR1 copy DXR1 to XSR1 copy
2-41
Figure 2−25. Data Packing at Maximum Packet Frequency With (R/X)FIG=1
Word 1
ÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
CLKR
Á Á
FSR Frame ignored Frame ignored Frame ignored
DR
Á Á
ÁÁÁÁÁ
ÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
RBR2 to DRR2 copy RBR1 to DRR1 copy
CLKX
FSX Frame ignored Frame ignored Frame ignored
Á Á
Á Á
DX
The previous section explained how frame ignore bits can be used to pack data
and efficiently use the bus bandwidth. (R/X)FIG bit can also be used to ignore
unexpected frame-sync pulses. Thus, any frame-sync pulse that occurs one
bit-clock earlier than the programmed data delay ([R/X]DATDLY) is considered
unexpected. Setting the frame ignore bits to one causes the serial port to ig-
nore these unexpected frame-sync signals.
In reception, if not ignored (RFIG = 0), an unexpected FSR pulse will discard
the contents of RSR[1,2] in favor of the new incoming data. Therefore, if
RFIG = 0, an unexpected frame-synchronization pulse aborts the current data
transfer, sets RSYNCERR in SPCR1 to 1, and begins the transfer of a new
data word. For further details, see section 2.3.7.2, Unexpected Receive Frame
Synchronization: RSYNCERR, on page 2-46. When RFIG = 1, reception con-
tinues, ignoring the unexpected frame-sync pulses.
In transmission (if not ignored [XFIG = 0]), an unexpected FSX pulse aborts
the present transmission, sets XSYNCERR to 1 in SPCR2 , and re-initiates
transmission of the current word that was aborted. For further details, see sec-
tion 2.3.7.5, Unexpected Transmit Frame Synchronization: XSYNCERR, on
page 2-50. When XFIG = 1, normal transmission continues with unexpected
frame-sync signals ignored.
2-42
Figure 2−26. Unexpected Frame Synchronization With (R/X)FIG=0
CLK(R/X)
ÁÁ
FS(R/X)
New data received
ÁÁ
DR A0 B7 B6 C7 C6 C5 C4 C3 C2 C1 C0 D7 D6
Current data re-transmitted
(R/X)SYNCERR
DX A0 B7 B6 B7 B6 B5 B4 B3 B2 B1 B0 C7
ÁÁ
C6
CLK(R/X)
Frame synchronization ignored
ÁÁ
FS(R/X)
D(R/X)
(R/X)SYNCERR
A0 B7 B6 B5 B4 B3 B2 B1 B0 C7 C6 C5
ÁÁ
C4
1) Receive Overrun (RFULL = 1). This occurs when DRR[1,2] has not been
read since the last RBR[1,2]-to-DRR[1,2] copy. Consequently, a new word
in RBR[1,2] will not be transferred to DRR[1,2], and RSR[1,2] is now full
with another new word shifted in from DR. Therefore, RFULL indicates an
error condition wherein any new data that may arrive at this time on DR
will replace the contents in RSR[1,2], and thus, the previous word is lost.
RSR[1,2] continues to be overwritten as long as new data arrives on DR
and DRR[1,2] is not read.
2-43
2) Unexpected Receive Frame Synchronization (RSYNCERR=1). This
can occur during reception when RFIG = 0 and an unexpected frame-
sync pulse occurs. An unexpected frame-sync pulse is defined as that
which occurs RDATDLY minus 1 bit-clock earlier than the first bit of the
next associated word. This causes the current data reception to abort and
restart. If new data has been copied into RBR[1,2] from RSR[1,2] since the
last RBR[1,2]-to-DRR[1,2] copy, this new data in RBR[1,2] will be lost. This
is because no RBR[1,2]-to-DRR[1,2] copy occurs as the reception has
been restarted.
3) Transmit Data Overwrite. Here the user overwrites data in DXR[1,2] be-
fore it is copied to XSR[1,2]. The data previously in DXR[1,2] is never
transferred on DX, since it never got copied to XSR[1,2].
These events are described in more detail in the sections that follow.
RFULL = 1 in SPCR1 indicates that the receiver has experienced overrun and
is in an error condition. RFULL is set when all of the following conditions are
met:
1) DRR[1,2] has not been read since the last RBR[1,2]-to-DRR[1,2] transfer
(RRDY = 1).
2-44
Data arriving on DR is continuously shifted into RSR[1,2]. Once a complete
word is shifted into RSR[1,2], an RSR[1,2]-to-RBR[1,2] transfer can occur only
if an RBR[1,2]-to-DRR[1,2] copy is complete. Therefore, if DRR[1,2] has not
been read by the CPU or DMA since the last RBR[1,2]-to-DRR[1,2] transfer
(RRDY = 1), an RBR[1,2]-to-DRR[1,2] copy will not take place until RRDY = 0.
At this time, new data arriving on the DR pin is shifted into RSR[1,2] and the
previous contents of RSR[1,2] is lost. This data loss occurs because comple-
tion of a serial-word reception triggers an RBR[1,2]-to-DRR[1,2] transfer only
when RRDY = 0. Note that after the receive portion starts running from reset,
a minimum of three words must be received before RFULL is set.
The data loss of the contents in RSR[1,2] can be avoided if DRR[1,2] is read
not later than two and one-half cycles before the end of the third word in
RSR[1,2].
Either of the following events clears the RFULL bit to 0 and allows subsequent
transfers to be read properly:
- Reading DRR[1,2]
Figure 2−28 shows the receive overrun condition. Because serial word A is not
read before the reception of serial word B is complete, B is not transferred to
DRR1 yet. Another new word C arrives and RSR1 is full with this data. DRR1
is finally read, but not earlier than two and one-half cycles before the end of
word C. Therefore, new data D overwrites the previous word C in RSR1. If
RFULL is still set after arrival of D, the next word can overwrite it, if DRR is not
read in time.
CLKR
ÁÁ ÁÁÁ ÁÁÁ
FSR
DR A1
RRDY
ÁÁ
A0 B7 B6 B5 B4 B3 B2 B1 B0
2-45
Figure 2−29 shows the case where RFULL is set, but the overrun condition is
averted by reading the contents of DRR1 at least two and one-half cycles be-
fore the next serial word C is completely shifted into RSR1. This ensures that
an RBR1-to-DRR1 copy of data B occurs before the next serial word (C) is
transferred from RSR1 to RBR1.
CLKR
Á Á ÁÁ Á
FSR
DR A1 A0 B7 B6 B5 B4 B3 B2 B1 B0 C7 C6 C5 C4 C3 C2 C1 C0
RBR1 to DRR1(B)
RRDY RBR1 to DRR1 copy(A)
No read from DRR1(A) No RBR1 to DRR1 copy(B) Read from DRR1(A)
RFULL
Figure 2−30 shows the decision tree that the receiver uses to handle all incom-
ing frame-synchronization pulses. The diagram assumes that the receiver has
been started, RRST = 1. Unexpected frame-sync pulses can originate from an
external source or from the internal sample rate generator. An unexpected
frame-sync pulse is defined as a sync pulse which occurs RDATDY bit-clocks
earlier than the last transmitted bit of the previous frame. Any one of four cases
can occur:
- Case 1: Unexpected internal FSR pulses with RFIG = 1. This case is dis-
cussed in section 2.3.6.2 on page 2-42 and shown in Figure 2−27 on page
2-43. In Case 1, receive frame-sync pulses are ignored and the reception
continues.
- Case 2: Normal serial port reception. There are three possible reasons
why a receive might NOT be in progress:
J The FSR is the first after RRST = 1.
J The FSR is the first after DRR[1,2] is read clearing an RFULL condi-
tion.
J The serial port is in the interpacket intervals. The programmed data
delay (RDATDLY) for reception may start during these interpacket in-
tervals for the first bit of the next word to be received. Thus, at maxi-
mum frame frequency, frame synchronization can still be received
RDATDLY bit-clocks before the first bit of the associated word.
For Case 2, reception continues normally since these are not unexpected
frame-sync pulses.
2-46
- Case 3: Unexpected receive frame synchronization with RFIG = 0 (unex-
pected frame not ignored). This case was shown in Figure 2−26 on page
2-43 for maximum frame frequency. Figure 2−31 on page 2-48 shows this
case during normal operation of the serial port, with time intervals between
packets. An unexpected frame-sync pulse is detected when it occurs at
or before RDATDLY minus 1 bit-clock before the last bit of the previous
word is received on the DR pin. In both cases, the RSYNCERR bit in
SPCR1 is set. RSYNCERR{ can be cleared only by a receiver reset or by
the user writing a 0 to this bit in SPCR1. You should note that if
RINTM = 11b in SPCR1, RSYNCERR drives the receive interrupt (RINT)
to the CPU.
ÁÁÁÁÁÁÁÁ
Figure 2−30. Response to Receive Frame-Synchronization Pulse
ÁÁÁÁÁÁÁÁ
Receive frame-sync
ÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁ Case 2:
ÁÁÁÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁ
Unexpected No
Normal Reception
frame-sync
ÁÁÁÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁ
Start receiving data
pulse
ÁÁÁÁÁÁÁÁ
?
Yes
ÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁ Case 3:
ÁÁÁÁÁÁÁÁÁ
Without Frame Ignore
ÁÁÁÁÁÁÁÁÁ
No Abort reception
RFIG=1 SET RSYNCERR
ÁÁÁÁÁÁÁÁÁ
? Start next reception
immediately
ÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁ Case 1:
ÁÁÁÁÁÁÁÁ
With Frame Ignore
Ignore frame pulse
ÁÁÁÁÁÁÁÁ
Receiver continues
running
† The RSYNCERR bit in SPCR1 is a read/write bit. Therefore, writing a 1 to it sets the error condi-
tion. Typically, writing a 0 is expected.
2-47
Figure 2−31. Unexpected Receive Synchronization Pulse
CLKR
Á Á ÁÁ
FSR
DR A1 A0 B7 B6 B5 B4 C7 C6 C5 C4 C3 C2 C1 C0
RBR1 to DRR1(B)
RRDY
RBR1 to DRR1 copy(A) Read from DRR1(A) RBR1 to DRR1 copy(C) Read from DRR1(C)
RSYNCERR
CLKX
Á Á ÁÁ ÁÁ
FSX
DX A1
XRDY
A0
Á ÁB7 B6 B5 B4 B3 B2 B1
ÁÁ
B0
ÁÁD7 D6 D5
1) During transmission. DXR[1,2] has not been loaded since the last
DXR[1,2]-to-XSR[1,2] copy, and all bits of the data word in XSR[1,2] have
been shifted out on DX.
2-48
(XEMPTY = 1) when the new word in DXR[1,2] is transferred to XSR[1,2]. In
the case of an internal frame generation, the transmitter regenerates a single
internal FSX initiated by a DXR[1,2]-to-XSR[1,2] copy (FSXM = 1 in the PCR
and FSGM=0 in SRGR2). Otherwise, the transmitter waits for the next frame
synchronization.
When the transmitter is taken out of reset (XRST = 1), it is in a transmit ready
(XRDY=1) and transmit empty (XEMPTY = 0) condition. If DXR[1,2] is loaded
by the CPU or DMA before internal FSX goes active high, a valid DXR[1,2]-to-
XSR[1,2] transfer occurs. This allows for the first word of the first frame to be
valid even before the transmit frame-sync pulse is generated or detected. Al-
ternatively, if a transmit frame sync is detected before DXR is loaded, zeros
will be output on DX.
CLKX
Á Á Á Á
FSX
DX A1
XRDY
Á
A0
ÁB7 B6
Write to DXR1(C)
XEMPTY
2-49
Figure 2−34. Transmit Empty Avoided
CLKX
ÁÁ Á ÁÁ ÁÁ
FSX
DX A1
XRDY
ÁÁ
A0
Á B7
Write to DXR1(C)
ÁÁ C7 C6 C5
XEMPTY
Figure 2−30 on page 2-47 shows the decision tree that the transmitter uses
to handle all incoming frame-synchronization signals. The diagram assumes
that the transmitter has been started (XRST = 1). An unexpected transmit
frame-sync pulse is defined as a sync pulse which occurs XDATDLY bit-clocks
earlier than the last transmit bit of the previous frame. Any one of three cases
can occur:
2-50
Figure 2−35. Response to Transmit Frame Synchronization
Transmit frame-sync
pulse occurs
No Case 2:
Unexpected Normal Transmission
frame-sync Start new transmit
pulse
?
Yes
Case 3:
Without Frame Ignore
No Abort transfer.
XFIG=1
? Set XSYNCERR.
Restart current
transfer
Yes
Case 1:
With Frame Ignore
Ignore frame pulse
Transmit stays
running
Note:
The XSYNCERR bit in SPCR2 is a read/write bit. Therefore, writing a 1 to
it sets the error condition. Typically, writing a 0 is expected.
2-51
Figure 2−36. Unexpected Transmit Frame-Synchronization Pulse
CLKX
Unexpected frame synchronization
Á ÁÁ Á
FSX
DX A1
XRDY
Á
A0
ÁÁ B7 B6 B5 B4 B7 B6 B5 B4 B3 B2
Á
B1 B0
DXR1 to XSR1 copy(B) Write to DXR1(C) DXR1 to XSR1 (C) Write to DXR1(D)
XSYNCERR
Table 2−15. Use of RJUST Field With 12-Bit Example Data 0xABC
Table 2−16. Use of RJUST Field With 20-Bit Example Data 0xABCDE
2-52
2.4 µ-LAW/A-LAW Companding Hardware Operation: (R/X)COMPAND
Companding (COMpress and exPAND) hardware allows compression and ex-
pansion of data in either µ-law or A-law format. The companding standard
employed in the United States and Japan is µ-law. The European companding
standard is referred to as A-law. The specification for µ-law and A-law log PCM
is part of the CCITT G.711 recommendation. A-law and µ-law allows 13 bits
and 14 bits of dynamic range, respectively. Any values outside this range will
be set to the most positive or most negative value. Thus, for companding to
work best, the data transferred to and from the McBSP via the CPU or DMA
must be at least 16-bit wide data.
The µ-law and A-law formats encode data into 8-bit code words. Companded
data is always 8-bits wide; therefore, the appropriate (R/X)WDLEN[1,2] must
be set to 0, indicating 8-bit wide serial data stream. If companding is enabled
and either phase of the frame does not have 8-bit word length, then compand-
ing continues as if the word length is eight bits.
2-53
Figure 2−37. Companding Flow
8 16 16
DR RSR RBR Expand RJUST DRR1 To CPU/DMA
8 16
DX XSR Compress DXR1 From CPU/DMA
15 2 1 0
When using A-law, the 13 data bits are left-justified in the register, with the re-
maining three low-order bits filled with zeros as shown in Figure 2−39.
15 3 2 0
2-54
2.4.1 Companding Internal Data
If the McBSP is otherwise unused (serial port X/R sections are reset), the com-
panding hardware can compand internal data. This can be used to:
Figure 2−40 shows two methods by which the McBSP can compand internal
data. Data paths for these two methods are used to indicate:
1) When both the transmit and receive sections of the serial port are reset,
DRR1 and DXR1 are internally connected through the companding logic.
Values from DXR1 are compressed, as selected by XCOMPAND, and
then expanded, as selected by RCOMPAND. Note that RRDY and XRDY
bits are not set. However, data is available in DRR1 within four CPU clocks
after being written to DXR1. The advantage of this method is its speed.
The disadvantage is that there is no synchronization available to the CPU
and DMA to control the flow. Note that DRR1 and DXR1 are internally con-
nected if the (X/R)COMPAND bits are set to 1xb, i.e., compand using A-
law or µ-law.
2) The McBSP is enabled in digital loop back mode with companding appro-
priately enabled by RCOMPAND and XCOMPAND. Receive and transmit
interrupts (RINT when RINTM = 0 and XINT when XINTM = 0) or synchro-
nization events (REVT and XEVT) allow synchronization of the CPU or
DMA to these conversions, respectively. Here, the time for this compand-
ing depends on the serial bit rate selected.
2-55
2.4.1.1 Bit Ordering
Normally, all transfers on the McBSP are sent and received with the MSB first.
However, certain 8-bit data protocols (that do not use companded data) re-
quire the LSB to be transferred first. By setting (R/X)COMPAND = 01b in
(R/X)CR2, the bit ordering of 8-bit words is reversed (LSB first) before being
sent to the serial port. Similar to companding, this feature is only enabled if the
appropriate (R/X)WDLEN[1,2] is set to 0, indicating 8-bit words are to be trans-
ferred serially. If either phase of the frame does not have an 8-bit word length,
the McBSP assumes the word length is eight bits, and LSB-first ordering is
done.
2-56
2.5 Programmable Clock and Framing
The McBSP has several means of selecting clocking and framing for both the
receiver and transmitter. Clocking and framing can be sent to both portions by
the sample rate generator. Each portion can select external clocking and/or
framing independently. Figure 2−41 shows a block diagram of the clock and
frame selection circuitry. The features that are enabled by this logic are ex-
plained in the sections that follow.
Internal Internal
CLKXP 0 CLKX FSX 0 DXR to XSR FSXP
Transmit transfer
1 1 0
1
CLKRM CLKRP FSRP FSRM and IGSYNC
CLKXM Internal FSXM
CLKR FSGM
CLKR pin Internal FSR pin
See inset See Inset
FSR
1 1
Receive
CLKRP 0 0 0 0 FSRP
1 1
DLB DLB Inset
CLKRM CLKG FSG FSRM (R/X)RST
Sample Internal Out
CPU clock rate Yyy
CLKS pin
generator
FSRG Internal Yyy is either internal CLKX,
internal CLKR, internal FSR, or
Internal FSX
2-57
2.5.1 Sample Rate Generator Clocking and Framing
The sample rate generator is composed of a three-stage clock divider that al-
lows programmable data clocks (CLKG) and framing signals (FSG) as shown
in Figure 2−42. CLKG and FSG are McBSP internal signals that can be pro-
grammed to drive receive and/or transmit clocking (CLKR/X) and framing
(FSR/X). The sample rate generator can be programmed to be driven by an
internal clock source or an internal clock derived from an external clock source.
The three stages of the sample rate generator circuit compute the following:
- Clock divide down (CLKGDV): The number of input clocks per data bit-
clock.
- Frame period divide down (FPER): The frame period in data bit-clocks.
- Frame width count down (FWID): The width of an active frame pulse in
data bit-clocks.
÷ ÷
CPU clock 1 CLKSRG Frame
CLKS Pulse FSG
0
CLKSP
CLKG
CLKSM
Frame pulse
detection
GSYNC and clock
FSR synchronization
2-58
2.5.1.1 Sample Rate Generator Register (SRGR [1,2])
2-59
Figure 2−44. Sample Rate Generator Register 2 (SRGR2)
15 14 13 12 11 0
GSYNC CLKSP CLKSM FSGM FPER
RW,+0 RW,+0 RW RW,+0 RW,+0
Note: R = Read, W = Write, +0 = Value at reset
2-60
Table 2−18. Sample Rate Generator Register 2 (SRGR2) Bit-Field Descriptions
(Continued)
Bit Name Function Section
12 FSGM Sample Rate Generator Transmit Frame-Synchronization Mode 2.5.3.3
Used when FSXM=1 in the PCR.
FSGM = 0 Transmit frame-sync signal (FSX) due to
DXR[1,2]-to-XSR[1,2] copy. When FSGM = 0, FPR and
FWID are ignored.
FSGM = 1 Transmit frame-sync signal driven by the sample rate
generator frame-sync signal, FSG.
11−0 FPER Frame Period. This field plus 1 determines when the next frame-sync signal 2.5.3.1
becomes active.
Range: 1 to 4096 CLKG periods.
6) Pull the receiver and/or transmitter out of reset ([R/X]RST = 1), if required.
8) After the required data acquisition set up is done (DXR[1/2]) is loaded with
data), FRST can be written with 1 if internally generated frame-sync pulse
2-61
is required. FSG is generated with an active-high edge after the pro-
grammed number of eight CLKG clocks have elapsed.
- The input clock to the sample rate generator can be either the CPU clock
or a dedicated external clock input (CLKS).
- The input clock (CPU clock or external clock CLKS) source to the sample
rate generator can be divided down by a programmable value (CLKGDV)
to drive CLKG. Regardless of the source to the sample rate generator, the
rising edge of CLKSRG (see Figure 2−42) generates CLKG and FSG
(also, see section 2.5.2.3).
The CLKSM bit in SRGR2 selects either the CPU clock (CLKSM = 1) or the
external clock input (CLKSM = 0), CLKS, as the source for the sample rate
generator input clock. Any divide periods are divide-downs calculated by the
sample rate generator and are timed by this input clock selection. When
CLKSM = 1, the minimum value of CLKGDV should be 1.
The first divider stage generates the serial data bit clock from the input clock.
This divider stage utilizes a counter that is preloaded by CLKGDV which con-
tains the divide ratio value. The output of this stage is the data bit-clock which
is output on sample rate generator output, CLKG, and serves as the input for
the second and third divider stages.
External clock (CLKS) is selected to drive the sample rate generator clock di-
vider by selecting CLKSM=0. In this case, the CLKSP bit in SRGR2 selects the
2-62
edge of CLKS on which sample rate generator data bit-clock (CLKG) and
frame-sync signal (FSG) are generated. Since the rising edge of CLKSRG
(see Figure 2−42) generates CLKG and FSG, the rising edge of CLKS when
CLKSP = 0, or the falling edge of CLKS when CLKSP = 1, causes the transi-
tion on the data bit-rate clock (CLKG) and frame sync (FSG).
When CLKS is selected to drive the sample rate generator (CLKSM = 0),
GSYNC can be used to configure the timing of CLKG relative to CLKS.
GSYNC = 1 ensures that the McBSP, and the external device that it is commu-
nicating to, are dividing down CLKS with the same phase relationship. If
GSYNC = 0, this feature is disabled and therefore CLKG runs freely and is not
re-synchronized. If GSYNC = 1, an inactive-to-active transition on FSR trig-
gers a resynchronization of CLKG and generation of FSG. CLKG always be-
gins with a high state after synchronization. Also, FSR is always detected at
the same edge of CLKS that generates CLKG, no matter how long the FSR
pulse is. Although an external FSR is provided, FSG can still drive internal re-
ceive frame synchronization when GSYNC = 1. Note that when GSYNC = 1,
FPER is a don’t care because the frame period is determined by the arrival of
the external frame-sync pulse.
Figure 2−45 and Figure 2−46 show the bit clock and frame-synchronization
operation with various polarities of CLKS and FSR. These figures assume
FWID = 0, for an FSG one CLKG wide.
Figure 2−45. CLKG Synchronization and FSG Generation When GSYNC = 1 and
CLKGDV = 1
CLKS (CLKSP=1)
CLKS (CLKSP=0)
FSR external
(FSRP=0)
FSR external
(FSRP=1)
CLKG
(No need to
resync)
CLKG
(needs resync)
FSG
2-63
Figure 2−46. CLKG Synchronization and FSG Generation When GSYNC = 1 and
CLKGDV = 3
CLKS (CLKSP=1)
CLKS (CLKSP=0)
FSR external
(FSRP=0)
FSR external
(FSRP=1)
CLKG
(No need to
resync)
CLKG
(needs resync)
FSG
Note that FPER is not programmed since it is determined by the arrival of the
next external frame-sync pulse. Figure 2−45 and Figure 2−46 show what hap-
pens to CLKG both when it is initially synchronized and GSYNC = 1, and when
it is not initially synchronized and GSYNC = 1.
When GSYNC = 1, the transmitter can operate synchronously with the receiv-
er, providing:
2) The sample rate generator clock should drive the transmit and receive bit
clock (CLK[R/X]M = 1 in SPCR[1,2]). Therefore, the CLK(R/X) pin should
not be driven by any other driving source.
Setting DLB = 1 in SPCR1 enables digital loop back mode. During DLB mode,
DR, FSR, and CLKR are internally connected through multiplexers to DX,
FSX, CLKX, respectively, as shown in Figure 2−41. DLB mode allows testing
of serial port code with a single DSP device. Figure 2−42 shows the multiplex-
ing of receiver control inputs during digital loop back mode.
2-64
2.5.2.6 Receive Clock Selection: DLB, CLKRM
Table 2−19 shows how the digital loop back bit (DLB) and the CLKRM bit in the
PCR can select the receiver clock. In digital loop back mode (DLB =1), the
transmitter clock drives the receiver. CLKRM determines whether the CLKR
pin is an input or an output.
DLB in CLKRM
SPCR1 in PCR Source of Receive Clock CLKR Pin
0 0 CLKR pin acts as an input driven by Input
external clock and inverted as determined
by CLKRP before being used.
1 1 Internal CLKX drives internal CLKR as Output. CLKR (same as transmit) inverted
selected and inverted as shown in as determined by CLKRP before being
Table 2−20. driven out.
Table 2−20 shows how the CLKXM bit in the PCR selects the transmit clock
and indicates whether the CLKX pin is an input or output.
CLKXM
in PCR Source of Transmit Clock CLKX Pin
0 External clock drives the CLKX input pin. CLKX is Input
inverted as determined by CLKXP before being used.
1 Sample rate generator clock, CLKG, drives transmit Output. CLKG inverted as determined by
clock CLKXP before being driven out on
CLKX.
2-65
2.5.3 Frame-Sync Signal Generation
- A frame pulse with a programmable period between sync pulses and pro-
grammable active width, using the sample rate generator register
(SRGR1).
- The transmit portion may trigger its own frame-sync signal generated by
a DXR[1,2]-to-XSR[1,2] copy. This causes a frame sync to occur on every
DXR1 to XSR1 copy. The data delays can be programmed as required;
however, maximum frame frequency cannot be achieved in this method
for data delays one and two. This limitation can be overcome by program-
ming the frame ignore bit (R/X)FIG = 1.
- Both the receive and transmit sections may independently select an exter-
nal frame synchronization on the FSR and FSX pins, respectively.
When the sample rate generator comes out of reset, FSG is in its inactive state.
Then, when FRST = 1 and FSGM = 1, a frame sync is generated. The frame
width value (FWID+1) is counted down on every CLKG cycle until it reaches
zero, when FSG goes low. Thus, the value of FWID + 1 determines an active
frame pulse width ranging from 1 to 256 data bit-clocks. At the same time, the
frame period value (FPER+1) is also counting down. When this value reaches
zero, FSG goes high, again indicating a new frame.
2-66
Figure 2−47. Programmable Frame Period and Width
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
CLKG
Frame period: (FPER+1) x CLKG
Frame width: (FWID + 1) x CLKG
FSG
Table 2−21 shows how you may select various sources to provide the receive
frame-synchronization signal. Note that in digital loop back mode (DLB = 1),
the transmit frame-sync signal is used as the receive frame-sync signal, and
that DR is connected to DX internally.
0 1 1 Internal FSR driven by sample rate Input. The external frame-sync input
generator Frame-Sync signal (FSG), on FSR is used to synchronize CLKG
FRST = 1 and generate FSG.
1 X 1 Internal FSX drives internal FSR and is Input. External FSR not used for frame
selected as shown in Table 2−22. synchronization but still used to
synchronize CLKG and generate FSG,
since GSYNC = 1.
1 1 0 Internal FSX drives internal FSR and is Output. Receive (same as transmit)
selected as shown in Table 2−22. frame synchronization inverted as
determined by FSRP before being
driven out.
2-67
2.5.3.3 Transmit Frame-Sync Signal Selection: FSXM, FSGM
Table 2−22 shows how you can select the source of transmit frame-synchro-
nization pulses. The three choices are:
FSXM FSGM
in in Source of Transmit Frame
PCR SRGR Synchronization FSX Pin
0 x External frame-sync input on FSX pin. This Input.
is inverted by FSXP before being used as
internal FSX.
1 1 Sample rate generator frame-sync signal Output. FSG inverted by FSXP before being
(FSG) drives internal FSX. FRST = 1 driven out on FSX pin.
2-68
2.5.4 Clocking Examples
The following sections provide clocking examples:
2.5.4.1 Double-Rate ST-BUS Clock
Figure 2−48 shows McBSP configuration to be compatible with the Mitel ST-
Bus. Note that this operation is running at maximum frame frequency.
- CLK(R/X)M = 1, internal CLK(R/X) generated internally by sample rate
generator
- GSYNC = 1, synchronize CLKG with external frame-sync signal input on
FSR. Note that CLKG is not synchronized until the frame-sync signal is ac-
tive. Also, note that FSR is regenerated internally to form a minimum pulse
width.
- CLKSM = 1, External clock (CLKS) drives the sample rate generator
- CLKSP = 1, falling edge of CLKS generates CLKG and thus internal
CLK(R/X)
- CLKGDV = 1, receive clock (shown as CLKR) is half of CLKS frequency
FSR external
ÁÁ
internal CLKR,
internal CLKS
ÁÁ
(first FSR)
DR, DX (first FSR) W1B7 W1B6 W1B5 W1B4 W1B3 W1B2 W1B1 W1B0 W2B7
DR, DX W32B0 W1B7 W1B6 W1B5 W1B4 W1B3 W1B2 W1B1 W1B0 W2B7
(subsequent FSR)
WxBy = Word x Bit y
2-69
2.5.4.2 Single-Rate ST-BUS Clock
This example is the same as the ST-BUS example except for the following:
- CLKSP = 0, rising edge of CLKS generates internal clocks CLKG and in-
ternal CLK(R/X).
CLKS
FSR external
Á
internal CLKX
Á
(first FSR)
DR, DX (first FSR) W1B7 W1B6 W1B5 W1B4 W1B3 W1B2 W1B1 W1B0 W2B7
The rising edge of CLKS is used to detect the external FSR. This external
frame-sync pulse is used to resynchronize internal McBSP clocks and gener-
ate frame-sync for internal use. Note that the internal frame sync is generated
so that it is wide enough to be detected on the falling edge of internal clocks.
2-70
2.5.4.3 Double-Rate Clock Example
This example is the same as the ST-BUS example except for the following:
- CLKGDV = 1, CLKG and thus internal CLKR and internal CLKX frequency
is half CLKS.
- GSYNC = 0, CLKS drives CLKG. CLKG runs freely and is not resynchro-
nized by FSR.
CLKS
Internal FS(R/X)
Internal CLK(R/X)
D(R/X) W32B0 W1B7 W1B6 W1B5 W1B4 W1B3 W1B2 W1B1 W1B0 W2B7
2-71
2.6 Multichannel Selection Operation
Multiple channels can be independently selected for the transmitter and re-
ceiver by configuring the McBSP with a single-phase frame. Each frame repre-
sents a time-division multiplexed (TDM) data stream. The number of words per
frame represented by (R/X)FRLEN1, denotes the number of channels avail-
able for selection.
When using TDM data streams, the CPU may need to process only a few of
them. Thus, to save memory and bus bandwidth, multichannel selection al-
lows independent enabling of particular channels for transmission and recep-
tion. Up to 32 channels can be enabled in an up-to-128-channel bit-stream.
- RRDY is not set to 1 upon reception of the last bit of the word.
- RBR[1,2] is not copied to DRR[1,2] upon reception of the last bit of the
word. Thus, RRDY is not set active. This feature also implies that no inter-
rupts or synchronization events are generated for this word.
- XEMPTY and XRDY similarly are not affected by the end of transmission
of the related serial word .
A transmit channel which is enabled can have its data masked or transmitted.
When masked, the DX pin will be forced to the high-impedance state even
though the transmit channel is enabled.
2-72
2.6.1 Multichannel Operation Control Registers
The following control registers are used in multichannel operation:
2-73
Table 2−23. Multichannel Control Register 1 (MCR1) Bit-Field Descriptions
(Continued)
Bit Name Function Section
4−2 RCBLK Receive Current Block 2.6.3.2
1 rsvd Reserved
2-74
Figure 2−52. Multichannel Control Register 2 (MCR2)
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RSVD XPBBLK XPABLK XCBLK XMCM
R,+0 RW,+0 RW,+0 R,+0 RW,+0
Note: R = Read, W = Write, +0 = Value at reset
2-75
Table 2−24. Multichannel Control Register 2 (MCR2) Bit-Field Descriptions
(Continued)
Bit Name Function Section
1−0 XMCM Transmit Multichannel Selection Enable 2.6.2
The number of channels enabled can be updated during the course of a frame
to allow any arbitrary group of channels to be enabled. This update is accom-
plished using an alternating scheme controlling two blocks (one odd-num-
bered and one even-numbered) of 16 contiguous channels each, at any given
time within the frame. One block belongs to Partition A and the other to Parti-
tion B.
2-76
Any two out of the eight 16-channel blocks may be selected, yielding a total
of 32 channels that can be enabled. The blocks are allocated on 16-channel
boundaries within the frame as shown in Figure 2−53. (R/X)PABLK and
(R/X)PBBLK fields in MCR[1,2] determine the blocks that get selected in parti-
tion A and B, respectively. This enabling is performed independently for trans-
mit and receive.
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
Partition B 16−31 48−63 80−95 112−127
FS(R/X)
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
Transmit data masking allows a channel enabled for transmit to have its DX
pin set to the high-impedance state during its transmit period. In systems
where symmetric transmit and receive provides software benefits, this feature
allows transmit channels to be disabled on a shared serial bus. A similar fea-
ture is not needed for receive, since multiple receptions cannot cause serial
bus contention.
Note:
DX is masked or driven to high-Impedance during (a) interpacket intervals,
(b) when a channel is masked regardless of whether it is enabled, or (c) when
a channel is disabled.
2-77
DXR[1,2]-to-XSR[1,2] copy occurs at their respective times. However, DX
will be driven only for those channels that are selected via XP(A/B)BLK
and XCER(A/B), and is placed in the high-impedance state otherwise. In
this case, if XINTM = 00b, the number of interrupts generated due to every
DXR1-to-XSR1 copy would equal the number of words in that frame
(XFRLEN1).
Figure 2−54 shows the activity on the McBSP pins for all the previously de-
scribed modes with the following conditions:
Please note that in the following illustrations, the arrows showing where the
various events occur are only sample indications. Wherever possible, there is
a time window in which these events can occur.
2-78
Figure 2−54. XMCM Operation
(a) XMCM = 00b
ÁÁ Á
Internal FSX
DX
XRDY
ÁÁ Á W0 W1 W2 W3
Write to DXR1(W3)
Write to DXR1(W1) DXR1 to XSR1 copy(W2)
DXR1 to XSR1 copy(W0) DXR1 to XSR1 copy(W3)
Write to DXR1(W2)
DXR1 to XSR1 copy(W1)
DX
XRDY
ÁÁ Á W1
Á Á W3
ÁÁ Á Á Á Á
Internal FSX
DX
XRDY
ÁÁ Á W1
Á Á W3
Á
Write to DXR1(W1) Write to DXR1(W3)
DXR1 to XSR1 copy(W2)
DXR1 to XSR1 copy(W0) DXR1 to XSR1 copy(W3)
Write to DXR1(W2)
DXR1 to XSR1 copy(W1)
(d) XMCM = 11b; RPABLK = 00b, XPABLK = X, RCERA = 1010b, XCERA = 1000b
Internal FS(R/X)
Á Á Á Á Á
Á Á Á Á Á
DR W1 W3
RRDY
Á Á Á
RBR1 to DRR1 copy (W3) RBR1 to DRR1 copy (W1)
Á Á Á
RBR1 to DRR1 (W3)
DX W3
XRDY
2-79
2.6.3.1 Channel Enable Registers: (R/X)CER(A/B)
(R/X)CERA and (R/X)CERB register fields shown in Table 2−25, Table 2−26,
Table 2−27, and Table 2−28 enable channels within the 16-channel-wide
blocks in partitions A and B, respectively. The (R/X)PABLK and (R/X)PBBLK
fields in the MCR select which 16-channel blocks get selected.
2-80
Figure 2−56. Receive Channel Enable Register Partition B (RCERB)
15 14 13 12 11 10 9 8
RDEB15 RCEB14 RCEB13 RCEB12 RCEB11 RCEB10 RCEB9 RCEB8
RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0
7 6 5 4 3 2 1 0
RCEB7 RCEB6 RCEB5 RCEB4 RCEB3 RCEB2 RCEB1 RCEB0
RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0
Note: R = Read, W = Write, +0 = Value at reset
15 14 13 12 11 10 9 8
XCEA15 XCEA14 XCEA13 XCEA12 XCEA11 XCEA10 XCEA9 XCEA8
RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0
7 6 5 4 3 2 1 0
XCEA7 XCEA6 XCEA5 XCEA4 XCEA3 XCEA2 XCEA1 XCEA0
RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0
Note: R = Read, W = Write, +0 = Value at reset
2-81
Figure 2−58. Transmit Channel Enable Register Partition B (XCERB)
15 14 13 12 11 10 9 8
XCEB15 XCEB14 XCEB13 XCEB12 XCEB11 XCEB10 XCEB9 XCEB8
RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0
7 6 5 4 3 2 1 0
XCEB7 XCEB6 XCEB5 XCEB4 XCEB3 XCEB2 XCEB1 XCEB0
RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0 RW,+0
Note: R = Read, W = Write, +0 = Value at reset
Note:
When changing the selection, the user must be careful not to affect the cur-
rently selected block.
The currently selected block is readable through the RCBLK and XCBLK fields
in MCR1 for receive and MCR2 for transmit, respectively. The associated
channel enable register cannot be modified if it is selected by the appropriate
(R/X)P(A/B)BLK register to point toward the current block. Similarly, the
(R/X)PABLK and (R/X)PBBLK fields in MCR[1,2] cannot be modified while
pointing to, or being changed to point to, the currently selected block. Note that
if the total number of channels is 16 or less, the current partition is always
pointed to. In this case, only a reset of the serial port can change enabling.
2-82
2.6.3.3 Update Interrupts
On the receiver, bits that are not enabled in the RCER(A/B) registers are ig-
nored and are not compacted in the receiver. Bits that are enabled are received
and compacted into a useful data word. When 16 useful-data bits have been
received, the received word is copied from RSR1 to DRR1 and the McBSP
generates an interrupt to the CPU. RCERA and RCERB alternate specifying
the receive masking pattern for each of the 16 receive clocks. Figure 2−59
shows an example bit sequence for the receiver.
2-83
Figure 2−59. A-bis Mode Receive Operation
RCERA 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
RCERB 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1
DR pin† 1 0 1 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 1 1 0 1 1 0 1 1 0 1 1 0 1 1
DRR1‡ − 0 − 1 − 1 − 1 − 0 − 1 0 − − 1 − − 1 − − 1 1 0 − − 0 − − 0 1 1 75E3h
† Data arriving on the DR pin
‡ Received data in DRR1
On the transmitter, only bits that are enabled in XCER(A/B) are transmitted out
from the DX pin. Bits that are not enabled are not transmitted and the DX pin
is in the high-impedance state during that clock cycle. XCERA and XCERB al-
ternate specifying the receive masking pattern for each 16 receive clocks.
When 16 useful bits have been shifted out, the McBSP generates an interrupt
to the CPU. Figure 2−60 shows an example bit sequence for the transmitter.
XCERB 0 0 1 1 0 0 0 1 1 0 0 0 1 1 0 0
DXR1§ 1 0 1 1 0 1 0 1 0 0 0 1 1 1 1 1 1 0 1 1 0 1 1 0 1 1 0 0 0 0 0 0
DX pin¶ z 0 1 1 0 1 z z z 0 0 z z 1 1 1 z z 1 1 z z z 0 1 z z z 0 0 z z
§ Data written to DXR1
¶ Data transmitted on the DX pin
Two special events, XEVTA (transmit A-bis event) and REVTA (receive A-bis
event), can be used by the DMA to load patterns into the (R/X)CER(A/B) regis-
ters. This capability is used for bit sequences that are longer than the 32 bits
covered by (R/X)CER(A/B). These two events are generated every 16 CLKR/
CLKX cycles.
- The initial pattern of bits that must be enabled is loaded into the
(R/X)CER(A/B) registers.
2-84
Two DMA channels (one for transmit, one for receive) are used to update the
pattern selection data to (R/X)CER(A/B) as the operation proceeds. One
16-word block in memory contains the bit pattern selections for the receiver.
Sixteen words of 16-bits each contain the entire receive selection pattern for
the 256-bit PCM link. On each REVTA event, the DMA copies new receive
selection pattern data from memory to RCER(A/B) and automatically toggles
its destination pointer from RCERA to RCERB, or vice versa, as necessary.
In other words, the DMA channel is initially set to RCERA as a destination. Af-
ter the first access to RCERA, the destination automatically toggles to
RCERB. After the next RCERB access, the destination automatically toggles
back to RCERA. Since the toggling between RCERA and RCERB is handled
automatically, you do not need to configure the DMA controller to modify the
destination address by other means. As the A-bis transfer proceeds, the re-
ceiver alternates using RCERA and RCERB to specify the enable pattern for
each group of 16 serial port clocks.
Another 16-word block in memory contains the bit pattern selections for the
transmitter. Sixteen words of 16-bits each contain the entire transmit selection
pattern for the 256-bit PCM link. On each XEVTA event, the DMA copies the
new transmit selection pattern data from memory to XCER(A/B) and automati-
cally toggles its destination pointer from XCERA to XCERB, or vice versa, as
necessary. In other words, the DMA channel is initially set to XCERA as a des-
tination. After the first access to XCERA, the destination automatically toggles
to XCERB. After the next XCERB access, the destination automatically
toggles back to XCERA. Since the toggling between XCERA and XCERB is
handled automatically, you do not need to configure the DMA controller to
modify the destination address by other means. As the A-bis transfer pro-
ceeds, the receiver alternates. The transmitter alternates using XCERA and
XCERB to specify the enable pattern for each group of 16 serial port clocks.
2-85
2.7 SPI Protocol: McBSP Clock Stop Mode
The SPI protocol is a master-slave configuration, with one master device and
one or more slave devices. The interface consists of the following four signals:
- Serial data input (also referred to as Master In − Slave Out, or MISO)
- Serial data output (also referred to as Master Out − Slave In, or MOSI)
- Shift-clock (also referred to as SCK)
- Slave-enable signal (also referred to as SS)
A typical SPI interface with a single slave device is shown in Figure 2−61.
SPI-compliant SPI-compliant
master slave
SCK SCK
MOSI MOSI
MISO MISO
SS SS
The clock stop mode of the McBSP provides compatibility with the SPI
protocol. When the McBSP is configured in clock stop mode, the transmitter
and receiver are internally synchronized, so that the McBSP functions as an
SPI master or slave device. The transmit clock signal (BCLKX) corresponds
to the serial clock signal (SCK) of the SPI protocol, while the transmit
frame-synchronization signal (BFSX) is used as the slave-enable signal (SS).
The receive clock signal (BCLKR) and receive frame-synchronization signal
(BFSR), are not used in the clock stop mode, since these signals are internally
connected to their transmit counterparts, BCLKX and BFSX.
2-86
When the McBSP is configured as a master, the transmit output signal (BDX)
is used as the MOSI signal of the SPI protocol, and the receive input signal
(BDR) is used as the MISO signal. An SPI interface with the McBSP used as
the master is shown in Figure 2−62.
McBSP-master SPI-compliant
slave
BCLKX SCK
BDX MOSI
BDR MISO
BFSX SS
Similarly, when the McBSP is configured as a slave, BDX is used as the MISO
signal and BDR is used as the MOSI signal. An SPI interface with the McBSP
used as a slave is shown in Figure 2−63.
McBSP-slave SPI-compliant
master
BCLKX SCK
BDX MISO
BDR MOSI
BFSX SS
2-87
2.7.1 Clock Stop Mode Configuration and Signal Descriptions
The CLKSTP bit-field of serial port control register 1 (SPCR1) and the CLKXP
bit of the pin configuration register (PCR) are used to configure the clock stop
mode. The CLKSTP bit-field enables clock stop mode and selects one of two
possible timing variations, while the CLKXP bit configures the polarity of the
BCLKX signal. Together, these bits provide four possible clock-stop mode con-
figurations, as shown in Table 2−29.
10 0 Low inactive state without delay: The McBSP transmits data on the rising edge of CLKX
and receive data on the falling edge of CLKR.
11 0 Low inactive state with delay: The McBSP transmits data one-half cycle ahead of the
rising edge of CLKX and receives data on the rising edge of CLKR.
10 1 High inactive state without delay: The McBSP transmits data on the falling edge of CLKX
and receives data on the rising edge of CLKR.
11 1 High inactive state with delay: The McBSP transmits data one-half cycle ahead of the
falling edge of CLKX and receives data on the falling edge of CLKR.
The CLKXM bit-field of the PCR designates the McBSP as a master or a slave
by configuring the BCLKX signal in output mode (master), or input mode
(slave). The timing diagrams for the four possible clock stop mode configura-
tions are shown in Figure 2−64 through Figure 2−67.
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
Á Á
BCLKX/SCK
BDX or BDR/MOSI
Á B7
Á B6 B5 B4 B3 B2 B1 B0
Á Á
(from master)†
Á Á
BDX or BDR/MISO
B7 B6 B5 B4 B3 B2 B1 B0
(from slave)‡
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
BFSX/SS
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
† If the McBSP is the SPI master (CLKXM = 1), MOSI = BDX. If the McBSP is the SPI slave (CLKXM = 0), MOSI = BDR.
‡ If the McBSP is the SPI master (CLKXM = 1), MISO = BDR. If the McBSP is the SPI slave (CLKXM = 0), MISO = BDX.
2-88
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
Figure 2−65. SPI Transfer With CLKSTP = 11b, and CLKXP = 0
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁ Á
BCLKX/SCK
BDX or BDR/MOSI
ÁÁ B7
ÁB6 B5 B4 B3 B2 B1 B0
ÁÁ Á
(from master)†
ÁÁ Á
BDX or BDR/MISO
B7 B6 B5 B4 B3 B2 B1 B0
(from slave)‡
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
BFSX/SS
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
† If the McBSP is the SPI master (CLKXM = 1), MOSI = BDX. If the McBSP is the SPI slave (CLKXM = 0), MOSI = BDR.
‡ If the McBSP is the SPI master (CLKXM = 1), MISO = BDR. If the McBSP is the SPI slave (CLKXM = 0), MISO = BDX.
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
BCLKX/SCK
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁ Á
ÁÁ Á
BDX or BDR/MOSI
(from master)†
B7 B6 B5 B4 B3 B2 B1 B0
BDX or BDR/MISO
ÁÁ Á
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
B7 B6 B5 B4 B3 B2 B1 B0
(from slave)‡
BFSX/SS
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
† If the McBSP is the SPI master (CLKXM = 1), MOSI = BDX. If the McBSP is the SPI slave (CLKXM = 0), MOSI = BDR.
‡ If the McBSP is the SPI master (CLKXM = 1), MISO = BDR. If the McBSP is the SPI slave (CLKXM = 0), MISO = BDX.
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁ Á
BCLKX/SCK
BDX or BDR/MOSI
ÁÁ ÁB6 B4 B3
ÁÁ Á
(from master)† B7 B5 B2 B1 B0
ÁÁ Á
BDX or BDR/MISO B7 B6 B5 B4 B3 B2 B1 B0
(from slave)‡
BFSX/SS ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
† If the McBSP is the SPI master (CLKXM = 1), MOSI=BDX. If the McBSP is the SPI slave (CLKXM = 0), MOSI = BDR.
‡ If the McBSP is the SPI master (CLKXM = 1), MISO=BDR. If the McBSP is the SPI slave (CLKXM = 0), MISO = BDX.
2-89
Notice that the frame-synchronization signal used in clock stop mode is active
throughout the entire transmission. The frame-synchronization waveform is
described in more detail in the next two sections. Although the timing diagrams
show 8-bit transfers, the packet length can be set to 8-, 12-, 16-, 20-, 24-, or
32-bits per packet. The packet length is selected by the receive word length
(RWDLEN1) in receive control register 1 (RCR1), and the transmit word length
(XWDLEN1) in transmit control register 1 (XCR1). Note that for clock stop
mode, the values of RWDLEN1 and XWDLEN1 must be set to the same value
since the McBSP transmit and receive circuits are synchronized to a single
clock. The bit-fields required to configure the McBSP as an SPI device are
shown in Table 2−30.
CLKXM 0 or 1 Configures the BCLKX signal as an input (slave) PCR Table 2−6,
or an output (master). page 2-12
RWDLEN1 000−101b Configures the receive packet length. Must be RCR1 Table 2−7,
equal to XWDLEN1. page 2-16
XWDLEN1 000−101b Configures the transmit packet length. Must be XCR1 Table 2−9,
equal to RWDLEN1. page 2-19
The McBSP can also provide a slave-enable signal (SS) on the BFSX pin. If
a slave-enable signal is required, the BFSX pin must be configured as an out-
2-90
put, and the frame generator must be configured so that a frame-synchroniza-
tion pulse is generated each time a packet is transmitted. The data delay pa-
rameters of the McBSP (XDATDLY and RDATDLY) must be set to 1 for proper
SPI master operation, since data delay values of 0 or 2 are undefined during
this mode. The polarity of the BFSX pin is programmable high or low; however,
in most cases the pin should be configured active-low.
In this configuration, the frame generator bit fields (FPER and FWID) in the
sample rate generator registers are overridden, and custom frame-synchro-
nization waveforms are not allowed. The resulting waveform produced on the
BFSX pin is shown in Figure 2−64 though Figure 2−67. The signal becomes
active before the first bit of a packet transfer, and remains active until the last
bit of the packet is transferred. After the packet transfer is complete, the BFSX
signal returns to the inactive state.
CLKSM 1 Sample rate clock derived from CPU clock. SRGR2 Table 2−18,
page 2-60
CLKGDV 1−255 Defines the divide factor for the sample rate clock. SRGR1 Table 2−17,
page 2-59
FSGM 0 The BFSX signal is activated for each packet trans- SRGR2 Table 2−18,
fer. page 2-60
XDATDLY 01b Provides correct setup time on the BFSX signal. XCR2 Table 2−10,
page 2-20
RDATDLY 01b Provides correct setup time on the BFSX signal. RCR2 Table 2−8,
page 2-17
2-91
2.7.3 McBSP Operation as an SPI Slave
When the McBSP is used as an SPI slave, the master clock and slave-enable
signals are generated externally by a master device. Accordingly, the BCLKX
and BFSX pins must be configured as inputs. The BCLKX pin is internally con-
nected to the BCLKR signal, so that both the transmit and receive circuits of
the McBSP are clocked by the external master clock. The BFSX pin is also in-
ternally connected to the BFSR signal, and no external signal connections are
required on the BCLKR and BFSR pins. An example of an SPI interface with
the McBSP used as the slave is shown in Figure 2−63.
Although the BCLKX signal is generated externally by the master and is asyn-
chronous to the McBSP, the sample rate generator of the McBSP must be en-
abled for proper SPI slave operation. The sample rate generator should be
programmed to its maximum rate of half the CPU clock rate. The internal sam-
ple rate clock is then used to synchronize the McBSP logic to the external mas-
ter clock and slave-enable signals.
The McBSP requires an active edge of the slave-enable signal on the BFSX
input for each transfer. This means that the master device must assert the
slave-enable signal at the beginning of each transfer, and deassert the signal
after the completion of each packet transfer; the slave-enable signal cannot
remain active between transfers. The data delay parameters of the McBSP
must be set to 0 for proper SPI slave operation, and values of 1 or 2 are unde-
fined during this mode of operation. The register bit values required to config-
ure the McBSP as a slave are listed in Table 2−32.
2-92
Bit Field Value Description Register Reference
XDATDLY 0 Must be 0 for SPI slave operation. XCR2 Table 2−10,
page 2-20
RDATDLY 0 Must be 0 for SPI slave operation. RCR2 Table 2−8,
page 2-17
1) Set the transmitter reset bit (XRST) in serial port control register 2
(SPCR2) to zero, to reset the transmitter. Set the receiver reset bit (RRST)
in serial port control register 1 (SPCR1) to zero, to reset the receiver.
(XRST=RRST=0)
2) Program the McBSP register fields shown in Table 2−30. Also program the
register fields shown in Table 2−31 or Table 2−32, depending on whether
the McBSP is the master or the slave. All other McBSP register fields can
be programmed to their default values.
3) Set the sample rate generator reset bit (GRST) in serial port control regis-
ter 2 (SPCR2) to one, to release the sample rate generator from reset.
Note that the value written to SPCR2 should have only the GRST bit
changed to one, and the remaining bit-fields should have the same values
written in Step 2.
(GRST=1)
4) Wait for the duration of two sample rate generator clock-periods for the
McBSP logic to stabilize.
2-93
(XRST=RRST=1)
2-94
b) DMA controller services the McBSP buffers. First, configure the DMA
controller and enable the channels that service the McBSP buffers.
Then set the XRST and RRST bit-fields to one, to enable the transmit-
ter and receiver. Note that the values written to SPCR1 and SPCR2
should have only the reset bits changed to one, and the remaining bit-
fields should have the same values written in Step 2.
(XRST=RRST=1)
6) Wait for the duration of two sample rate generator clock-periods for the
McBSP logic to stabilize.
2-95
2.8 Emulation FREE and SOFT Bits
FREE and SOFT are special emulation bits that determine the state of the seri-
al port clock when a breakpoint is encountered in the high-level language de-
bugger. If the FREE bit is set to one, then upon a software breakpoint, the clock
continues to run (free runs) and data still shifts out. When FREE = 1, the SOFT
bit is a don’t care. If the FREE bit is cleared to zero, then the SOFT bit takes
effect. If the SOFT bit is cleared to zero, then the clock stops immediately, thus
aborting a transmission. If the SOFT bit is set to one and a transmission is in
progress, the transmission continues until completion of the transfer, and then
the clock halts. These options are listed in Table 2−33.
0 1 Transmitter stops after completion of the current word. The receiver is not affected.
2-96
2.9 McBSP Pins as General Purpose I/O
Two conditions allow the serial port pins (CLKX, FSX, DX, CLKR, FSR, and
DR) to be used as general purpose I/O rather than serial port pins:
2) General purpose I/O is enabled for the related portion of the serial port;
(R/X)IOEN = 1 in the PCR.
Figure 2−4, Pin Control Register (PCR), on page 2-12, has bits that configure
each of the McBSP pins as general purpose inputs or outputs. Table 2−34
shows how this is achieved. In the case of FS(R/X), FS(R/X)M=0 configures
the pin as an input and FS(R/X)M = 1 configures that pin as an output. When
configured as an output, the value driven on FS(R/X) is the value stored in
FS(R/X)P. If configured as an input, FS(R/X)P becomes a read-only bit that re-
flects the status of that signal. CLK(R/X)M and CLK(R/X)P work similarly for
CLK(R/X). When the transmitter is selected as general purpose I/O, the value
of the DX_STAT bit in the PCR is driven onto DX. DR is always an input and
its value is held in the DR_STAT bit in the PCR. To configure CLKS as a general
purpose input, both the transmitter and receiver must be in reset state and
(R/X)IOEN = 1, because CLKS is always an input to the McBSP and affects
both transmit and receive operations.
2-97
Table 2−34. Configuration of Pins as General Purpose I/O
General Purpose I/O
Enabled by Selected as Output Value Selected as Input Value
Pin Setting Both Output Driven From Input Readable On
2-98
2.10 McBSP Operation in Power-Down Mode
’54x devices offer several power-down modes which allow all or part of the de-
vice to enter a dormant state, and consequently, dissipates considerably less
power than when running normally. Power-down modes may be invoked in
several ways, including executing the IDLE instruction or driving the HOLD in-
put low with the HM status bit set to one. The McBSP, like other peripherals,
can take the CPU out of IDLE using a transmit or receive interrupt.
In IDLE2 or IDLE3 modes, the internal device clocks provided to the peripher-
als are stopped. Consequently, some limitations are placed on operating the
McBSP in these modes. If external clock and frame-sync are provided, the
McBSP can continue to operate, and receive and transmit interrupts can be
used to exit the IDLE state. If either clocks or frame-syncs are internal (pro-
vided by the clock and frame-sync generator), the McBSP will stop in IDLE2/3
because there are no internal clocks available to operate the clock and frame-
sync generator.
In IDLE2/3, the internal clocks to the McBSP and the DMA controller are
started automatically when a transfer begins, and stopped after the transfer
is completed. This feature provides additional power savings since neither
module is active when no activity is occurring.
2-99
2.11 McBSP Programming Example Code
McBSP programming example code is presented in Chapter 3 as follows:
Example 3−19, McBSP Data Transfer in ABU Mode, is shown on page 3-53;
Example 3−20, McBSP Data Transfer in Double-Word Mode, is shown on
page 3-55; and Example 3−21, McBSP to Data Memory Transfer With Data
Sorting, is shown on page 3-57.
2-100
2-101
Chapter 3
Topic Page
3-1
3.1 DMA Overview
The direct memory access (DMA) controller transfers data between regions
in the memory map without intervention by the CPU. The DMA allows move-
ment to and from internal memory, internal peripherals, or external devices to
occur in the background of CPU operation. The DMA has six independent pro-
grammable channels allowing six different contexts for DMA operation. The
DMA controller also services requests from the host port interface peripherals
(HPI-8 or HPI-16) to utilize the DMA bus. Throughout this chapter, the abbrevi-
ation HPIx is used to denote either the HPI-8 or HPI-16.
- Read transfer. The DMA reads a data element from a source location in
memory. The source may be memory or a peripheral device, and may be
located in program, data, or I/O space.
- Write transfer. The DMA writes the data elements that were read during
a read transfer to its destination in memory location. The destination may
be memory or a peripheral device, and may be located in program, data,
or I/O space.
- Element transfer. The combined read and write transfer for a single data
element.
- Frame transfer. Each DMA channel has an independently programmable
number of elements per frame. In completing a frame transfer, the DMA
moves all elements in a single frame.
- Block Transfer. Each DMA channel also has an independently program-
mable number of frames per block. In completing a block transfer, the
DMA moves the total number of frames defined for the block.
3-2
- Programmable address generation. Each channel’s source and des-
tination address registers can have configurable indexes for each read
and write transfer. The address may remain constant, increment, decre-
ment, or be adjusted by a programmable value. These programmable val-
ues allow a separate index for the last transfer in a frame from the preced-
ing transfers, and can be used to achieve data sorting (discussed later in
this chapter).
- Full address range. The DMA can access the full extended address
range implemented on the device. The DMA access extends to the follow-
ing:
J On-chip memory
J On-chip peripherals
J External memory (selected devices). Access to certain areas of the
memory map may be restricted depending on the device. For more in-
formation, see Chapter 3, Memory, in the the user guide titled
TMS320C54x DSP, CPU and Peripherals, Reference Set Volume 1
(literature number SPRU131).
- Programmable width transfers. Each channel can be independently
configured to transfer in single-word mode (16-bit), or double-word mode
(32-bit). See section 3.2.3.3, DMA Sync Event and Frame Count Regis-
ters, on page 3-14.
- Autoinitialization. Once a block transfer is complete, a DMA channel
may automatically re-initialize itself for the next block transfer. See section
3.2.3.4, Transfer Mode Control Register, on page 3-18.
- Event synchronization. Each element transfer may be initiated by se-
lected events. See section 3.2.3.3, DMA Sync Event and Frame Count
Registers, on page 3-14.
- Interrupt generation. On completion of each frame transfer or block
transfer, each DMA channel can send an interrupt to the CPU. See section
3.2.2.2, Multiplexed Interrupt Control, on page 3-9.
3-3
3.2 DMA Operation and Configuration
The DMA configuration and operation is achieved by a set of memory-mapped
control registers. This scheme is similar to that used by other ’54x device pe-
ripherals. The DMA registers are memory-mapped using a register subad-
dressing scheme.
DMSDI
DMSDN
Subaddressed
registers
DMSA
3-4
The DMA controller provides two types of subbank access registers. The first,
DMSDI, is a subbank access register with automatic increment of the subad-
dress. This means that the subaddress will be incremented automatically after
each access. If the entire set of DMA configuration registers needs to be con-
figured, DMSDI provides a convenient means to set the subbank address
once and then postincrement it after each access until the entire set of regis-
ters has been configured. If a single register access is desired, or if there is a
need to prevent modification of the subaddress, DMSDN is used. DMSDN pro-
vides access to the subaddressed register without modifying the subaddress.
In this way, the entire register set used to program the DMA is contained in four
memory-mapped register locations.
3-5
Example 3−2 Using Register Subaddressing With Autoincrement (Continued)
STM #2000h,DMSDI ;write 2000h to DMDST5
STM #0010h,DMSDI ;write 10h to DMCTR5
STM #0002h,DMSDI ;write 2h to DMSFC5
STM #0000h,DMSDI ;write 0h to DMMCR5
The DMA registers are shown in Table 3−1. Only the channel priority and en-
able control register (DMPREC) is directly addressed. All other DMA registers
are subaddressed.
Table 3−1. DMA Registers
Address SubAddress Name Function
54h — DMPREC Channel Priority and Enable Control Register
55h — DMSA Subbank Address Register
56h — DMSDI Subbank Access Register With Autoincrement
57h — DMSDN Subbank Access Register Without Autoincrement
— 00h DMSRC0 Channel 0 Source Address Register
— 01h DMDST0 Channel 0 Destination Address Register
— 02h DMCTR0 Channel 0 Element Count Register
— 03h DMSFC0 Channel 0 Sync Select and Frame Count Register
— 04h DMMCR0 Channel 0 Transfer Mode Control Register
— 05h DMSRC1 Channel 1 Source Address Register
— 06h DMDST1 Channel 1 Destination Address Register
— 07h DMCTR1 Channel 1 Element Count Register
— 08h DMSFC1 Channel 1 Sync Select and Frame Count Register
— 09h DMMCR1 Channel 1 Transfer Mode Control Register
— 0Ah DMSRC2 Channel 2 Source Address Register
— 0Bh DMDST2 Channel 2 Destination Address Register
— 0Ch DMCTR2 Channel 2 Element Count Register
— 0Dh DMSFC2 Channel 2 Sync Select and Frame Count Register
— 0Eh DMMCR2 Channel 2 Transfer Mode Control Register
— 0Fh DMSRC3 Channel 3 Source Address Register
— 10h DMDST3 Channel 3 Destination Address Register
— 11h DMCTR3 Channel 3 Element Count Register
— 12h DMSFC3 Channel 3 Sync Select and Frame Count Register
— 13h DMMCR3 Channel 3 Transfer Mode Control Register
— 14h DMSRC4 Channel 4 Source Address Register
— 15h DMDST4 Channel 4 Destination Address Register
3-6
Table 3−1. DMA Registers (Continued)
Address SubAddress Name Function
— 16h DMCTR4 Channel 4 Element Count Register
— 17h DMSFC4 Channel 4 Sync Select and Frame Count Register
— 18h DMMCR4 Channel 4 Transfer Mode Control Register
— 19h DMSRC5 Channel 5 Source Address Register
— 1Ah DMDST5 Channel 5 Destination Address Register
— 1Bh DMCTR5 Channel 5 Element Count Register
— 1Ch DMSFC5 Channel 5 Sync Select and Frame Count Register
— 1Dh DMMCR5 Channel 5 Transfer Mode Control Register
— 1Eh DMSRCP Source Program Page Address (all channels)
— 1Fh DMDSTP Destination Program Page Address (all channels)
— 20h DMIDX0 Element Address Index Register 0
— 21h DMIDX1 Element Address Index Register 1
— 22h DMFRI0 Frame Address Index Register 0
— 23h DMFRI1 Frame Address Index Register 1
— 24h DMGSA Global Source Address Reload Register
— 25h DMGDA Global Destination Address Reload Register
— 26h DMGCR Global Element Count Reload Register
— 27h DMGFR Global Frame Count Reload Register
The channel priority and enable control (DMPREC) register controls several
functions of the overall operation of the DMA system including:
Figure 3−2. DMA Channel Priority and Enable Control (DMPREC) Register
15 14 13 8 7 6 5 0
FREE RSVD DPRC INTOSEL DE[5:0]
3-7
Table 3−2. DMA Channel Priority and Enable Control (DMPREC) Register Bit/Field
Descriptions
Reset
Bit Name Value Function
15 FREE 0 This bit controls the behavior of the DMA controller during emulation. When
FREE = 0, DMA transfers are suspended when the emulator stops. When
FREE = 1, DMA transfers continue even during emulation stop.
14 RSVD 0 Reserved. Values written to this field have no effect.
13 DPRC[5] 0 DMA channel 5 priority control bit.
DPRC[5] = 1 High priority
DPRC[5] = 0 Low priority
12 DPRC[4] 0 DMA channel 4 priority control bit.
DPRC[4] = 1 High priority
DPRC[4] = 0 Low priority
11 DPRC[3] 0 DMA channel 3 priority control bit.
DPRC[3] = 1 High priority
DPRC[3] = 0 Low priority
10 DPRC[2] 0 DMA channel 2 priority control bit.
DPRC[2] = 1 High priority
DPRC[2] = 0 Low priority
9 DPRC[1] 0 DMA channel 1 priority control bit.
DPRC[1] = 1 High priority
DPRC[1] = 0 Low priority
8 DPRC[0] 0 DMA channel 0 priority control bit.
DPRC[0] = 1 High priority
DPRC[0] = 0 Low priority
7−6 INTOSEL 0 Interrupt multiplex control bits. The INTOSEL bits control how the DMA
interrupts will be assigned in the interrupt vector table and IMR/IMF registers.
The effects of this field on the operation are device-specific (refer to Table 3−3,
Table 3−4, and Table 3−5.)
5 DE[5] 0 DMA channel 5 enable bit.
DE[5] = 1 Enables DMA channel 5
DE[5] = 0 Disables DMA channel 5
4 DE[4] 0 DMA channel 4 enable bit.
DE[4] = 1 Enables DMA channel 4
DE[4] = 0 Disables DMA channel 4
3-8
Table 3−2. DMA Channel Priority and Enable Control (DMPREC) Register Bit/Field
Descriptions (Continued)
Reset
Bit Name Value Function
3 DE[3] 0 DMA Channel 3 enable bit.
DE[3] = 1 Enables DMA channel 3
DE[3] = 0 Disables DMA channel 3
2 DE[2] 0 DMA Channel 2 enable bit.
DE[2] = 1 Enables DMA channel 2
DE[2] = 0 Disables DMA channel 2
1 DE[1] 0 DMA channel 1 enable bit.
DE[1] = 1 Enables DMA channel 1
DE[1] = 0 Disables DMA channel 1
0 DE[0] 0 DMA channel 0 enable bit.
DE[0] = 1 Enables DMA channel 0
DE[0] = 0 Disables DMA channel 0
Each of the six DMA channels can be independently enabled through the DE
field in the DMPREC. Bits 0−5 in this register correspond to each of the six
DMA channels, with bit 0 representing channel 0, bit 1 representing channel
1, etc. A logic 1 enables the associated channel, and a logic 0 disables the
channel.
Each enable bit can be reset by the DMA controller upon completion of a block
transfer. DMPREC can be polled to determine when a block transfer on a given
channel is complete. If the DMA controller and the CPU both attempt to change
the state of the DE field bits, the DMA controller has priority.
DMA events can trigger interrupts to the CPU upon completion of a transfer.
Due to a limited number of interrupts in the ’54x memory map, some DMA inter-
rupts are multiplexed with other peripheral interrupts on the device. The inter-
rupt functions available are controlled by the INTOSEL field (bits 7 and 6) in
DMPREC. The INTOSEL field can configure up to 6 interrupts to be assigned
to DMA interrupts, depending on the device being used.
3-9
Table 3−3. Multiplexed Interrupt Assignments for the ’5402
Interrupt
Number INTOSEL [1:0] Value
(IMR/IFR #) 00b 01b 10b 11b
6 Reserved Reserved DMA Channel 0 Interrupt Reserved
7 Timer 1 interrupt Timer 1 interrupt DMA Channel 1 Interrupt Reserved
10 McBSP 1 RINT DMA Channel 2 Interrupt DMA Channel 2 Interrupt Reserved
11 McBSP 1 XINT DMA Channel 3 Interrupt DMA Channel 3 Interrupt Reserved
Table 3−5. Multiplexed Interrupt Assignments for the ’5420 (each subsystem)
Interrupt
Number INTOSEL [1:0] Value
(IMR/IFR #) 00b 01b 10b 11b
4 McBSP 0 RINT McBSP 0 RINT McBSP 0 RINT Reserved
5 McBSP 0 XINT McBSP 0 XINT McBSP 0 XINT Reserved
6 McBSP 2 RINT McBSP 2 RINT DMA Channel 0 Interrupt Reserved
7 McBSP 2 XINT McBSP 2 XINT DMA Channel 1 Interrupt Reserved
10 McBSP 1 RINT DMA Channel 2 Interrupt DMA Channel 2 Interrupt Reserved
11 McBSP 1 XINT DMA Channel 3 Interrupt DMA Channel 3 Interrupt Reserved
3-10
Table 3−5. Multiplexed Interrupt Assignments for the ’5420 (each subsystem)
Interrupt
Number INTOSEL [1:0] Value
(IMR/IFR #) 00b 01b 10b 11b
12 DMA Channel 4 Interrupt DMA Channel 4 Interrupt DMA Channel 4 Interrupt Reserved
13 DMA Channel 5 Interrupt DMA Channel 5 Interrupt DMA Channel 5 Interrupt Reserved
3-11
3.2.2.3 DMA Channel Priority Control
Each DMA channel can be independently assigned low or high priority. All high
priority DMA channels are serviced before any low priority channels are servi-
ced. When multiple channels are enabled and assigned the same priority lev-
el, each of the enabled channels are serviced in a circular pattern.
Priority level for each channel is set in the 6-bit DPRC field of the DMPREC.
Each bit position is associated with a DMA channel. Bits 8 through 13 are asso-
ciated with channels 0 though 5, respectively. A logic 0 in the bit position as-
signs low priority to the associated channel. A logic 1 assigns high priority to
the associated channel.
3-12
The source and destination address registers are initialized prior to starting the
DMA transfer in software, and updated automatically during transfers by the
DMA controller. If necessary, the CPU can read either of these addresses dur-
ing transfers to monitor the status of the transfer. These registers can also be
written by the CPU during transfers. Changes to the address registers made
during block transfers are effective immediately and will affect the progress of
the transfer. Care should be taken to prevent unintentional writes to these reg-
isters during transfers.
The locations of the source and destination address registers for each channel
are shown in Table 3−1.
Each DMA Channel has a 16-bit element counter that keeps track of the num-
ber of DMA transfers to be performed. The element counter is initialized with
the 16-bit unsigned number contained in the DMA channel element count reg-
ister (DMCTRn) that represents the number of elements to be transferred. The
element count register should be initialized with one less than the desired num-
ber of element transfers. For example, if DMA channel 2 is to move nine data-
elements, DMCTR2 should be initialized to eight.
In autobuffering (ABU) mode, the contents of the DMCTRn contains the buffer
size. The DMCTRn is not decremented during transfers in this mode. ABU
mode is included in the DMA controller to perform the same function as the
autobuffering units of the ’54x buffered serial port (BSP). The McBSP, in con-
junction with the DMA in ABU mode, can mimic the BSP ABU operation. ABU
mode is discussed in more detail in section 3.2.3.5, Addressing Modes, on
page 3-22.
If the CPU and the DMA controller attempt to modify the element count register
at the same time, the CPU has priority.
The locations of the element count registers for each channel are shown in
Table 3−1.
3-13
3.2.3.3 DMA Sync Event and Frame Count Registers
The DMA sync event and frame count register (DMSFCn) serves three pur-
poses:
The structure of the DMSFCn is shown in Figure 3−3. The register locations
of the DMA sync event and frame count registers for each channel are shown
in Table 3−1.
Figure 3−3. DMA Sync Event and Frame Count (DMSFCn) Register
15 12 11 10 8 7 0
DSYN[3:0] DBLW rsvd Frame Count
Table 3−6. DMA Sync Event and Frame Count (DMSFCn) Register Bit/Field Descriptions
Reset
Bit Name Value Function
15−12 DSYN[3:0] 0 DMA sync event. Specifies which sync event is used to initiate DMA transfers
for the corresponding DMA channel. See the DMA Synchronization Events
section following this table for available sync events.
7−0 Frame 0 Frame count. Specifies the total number of frames to be transferred. See the
Count Frame Count section following Table 3−9 for more details.
3-14
If sync events are used, one sync event is required for each transfer. In single-
word mode, one sync event initiates one 16-bit single-word transfer. In double-
word mode, one sync event initiates one 32-bit double-word transfer (as two
16-bit transfers).
The types of sync events available depend on the ’54x device. Not all of the
sync events mentioned above are available on all devices. Table 3−6,
Table 3−7, Table 3−8, and Table 3−9 show the available sync events on each
device. The sync event is chosen by loading the DSYN field of the DMSFCn
with the appropriate value as shown in the Tables. Only one sync event can
be chosen for each DMA channel. The DSYN field is set to 0000h (no sync
event) on reset.
0011 Reserved
0100 Reserved
0111 Reserved
1000 Reserved
1001 Reserved
1010 Reserved
1011 Reserved
1100 Reserved
3-15
Table 3−8. DMA Sync Event Options on the ’5410
DSYN [3:0] value DMA Synchronization Mode
0000 No sync event (nonsynchronized operation)
1111 Reserved
3-16
Table 3−9. DMA Sync Event Options on the ’5420 (each subsystem)
DSYN [3:0] value DMA Synchronization Mode
0000 No sync event (nonsynchronized operation)
1001 Reserved
1010 Reserved
1011 Reserved
1100 Reserved
1101 Reserved
1110 Reserved
1111 Reserved
Double-Word Mode
DMA transfers can be configured as single-word 16-bit transfers, or double-
word 32-bit transfers. In double-word mode, each 32-bit transfer is considered
one element. Double-word transfers are implemented as two back-to-back
16-bit transfers, and administered by the DMA controller (including appropri-
ate address modification) without any intervention from the CPU. Double-word
mode is available with any of the address indexing modes. For a detailed dis-
cussion of address indexing modes, see section 3.2.3.5, Addressing Modes,
on page 3-22.
In double-word mode, the address of the second transfer is always the ad-
dress of the first transfer with the LSB inverted. If the first transfer address is
an even address, the second transfer will be to the next higher address. If the
first transfer address is an odd address, the second transfer will be directed
to the next lower address.
3-17
Double-word mode is configured by setting the DBLW bit in the DMSFCn. On
reset, DBLW is cleared (single-word mode).
Frame Count
The frame count is an 8-bit field in the DMSFCn that specifies the number of
frames to be included in a block transfer. The frame count should be initialized
to one less than the desired number of frames. For example, if the desired
number of frames to be transferred in a block is eight, the frame count field
should be initialized to seven. If only one frame is desired, the frame count field
should be set to zero. On reset, the frame count field is set to zero (single frame
operation). The maximum number of frames is 256.
The frame count field is decremented by the DMA controller upon the comple-
tion of each frame. Once the last frame is transferred, the frame count can be
reloaded with the contents of the DMA global frame count register (DMGFR),
if autoinitialization mode is enabled. For more information on autoinitialization,
see section 3.2.3.6, Autoinitialization, on page 3-28.
The element count and frame count can be used together to allow up to 65536
transfers. The total number of transfers is the product of the element count and
the frame count.
If the CPU and the DMA controller attempt to modify the frame count field at
the same time, the CPU has priority.
Table 3−10. DMA Transfer Mode Control (DMMCRn) Register Bit/Field Descriptions
Reset
Bit Name Value Function
15 AUTOINIT 0 DMA autoinitialization mode bit.
AUTOINIT = 0 Autoinitialization is disabled
AUTOINIT = 1 Autoinitialization is enabled
3-18
Table 3−10. DMA Transfer Mode Control (DMMCRn) Register Bit/Field Descriptions
(Continued)
Reset
Bit Name Value Function
14 DINM 0 DMA interrupt generation mask bit.
DINM = 0 No interrupt generated
DINM = 1 Interrupts generated based on IMOD bit
13 IMOD 0 DMA interrupt generation mode bit.
In ABU mode (CTMOD = 1):
IMOD = 0 Interrupt at buffer full only
IMOD = 1 Interrupt at half buffer full and buffer full
In multiframe mode (CTMOD = 0):
IMOD = 0 Interrupt at completion of block transfer
IMOD = 1 Interrupt at end of frame and end of block
3-19
Table 3−10. DMA Transfer Mode Control (DMMCRn) Register Bit/Field Descriptions
(Continued)
Reset
Bit Name Value Function
4-2 DIND 0 DMA destination address transfer index mode bit.
DIND = 000 No modification
DIND = 001 Postincrement
DIND = 010 Post-decrement
DIND = 011 Postincrement with index offset (DMIDX0)
DIND = 100 Postincrement with index offset (DMIDX1)
DIND = 101 Postincrement with index offset (DMIDX0 and DMFRI0)
DIND = 110 Postincrement with index offset (DMIDX1 and DMFRI1)
DIND = 111 Reserved
1-0 DMD 0 DMA Destination Address Space Select Bit.
DMD = 00 Program space
DMD = 01 Data space
DMD = 10 I/O space
DMD = 11 Reserved
3-20
Source and Destination Address Selection and Modification
Two fields in the DMMCRn, DMS and DMD, control the selection of the source
and destination address spaces for DMA transfers. DMS specifies whether the
source data comes from program space, data space, or I/O space. DMD speci-
fies whether the destination data goes to program space, data space, or I/O
space. Bit configurations for each of these modes is shown in Table 3−10.
In addition, the DMMCRn controls how addresses are modified for the source
and destination. The SIND field controls how the source addresses are in-
dexed as transfers proceed. The DIND field controls how destination address-
es are indexed as transfers proceed. The following options are available for
address modification:
- No modification (address remains constant for each transfer)
- Postincrement by 1
- Post-decrement by 1
- Postincrement by the offset value contained in the element index register
0 (DMIDX0)
- Postincrement by the offset value contained in the element index register
1 (DMIDX1)
- Postincrement by the offset values contained in the element index register
0 (DMIDX0) and the frame index register 0 (DMFRI0)
- Postincrement by the offset values contained in the element index register
0 (DMIDX1) and the frame index register 0 (DMFRI1)
The latter four modes utilize the element and frame index registers. The ele-
ment index registers (DMIDX0 and DMIDX1) are used to index the source and
destination addresses during transfers. The index contained in these registers
is used to modify the source or destination address following the transfer of
each element. DMIDX0 and DMIDX1 are not associated with either the source
or destination address. Either register can be used to index the source, des-
tination, or both.
The frame index registers (DMFRI0 and DMFRI1) are used to index the source
and destination addresses following completion of blocks (or frames) of ele-
ment transfers. When both element and frame indexes are used, the address
is modified by the element index after each transfer, and then modified by the
frame index at the end of each frame. This capability can be used to implement
circular buffers and sorting functions (see the related sections that follow).
DMFRI0 and DMFRI1 are not associated with either the source or destination
address. Either register can be used to index the source, destination, or both.
DMMCRn is a channel-context register, so each channel can be configured
separately. DMIDX0, DMIDX1, DMFRI0 and DMFRI1 are not channel-context
registers. These registers configure index options for the entire DMA system.
3-21
3.2.3.5 Addressing Modes
The CTMOD field in DMMCRn controls the operation of the DMA transfer
counter for each channel. In multiframe mode, the element and frame indexes
are used to modify the source and destination addresses following each trans-
fer. This mode is convenient for transferring data formatted as frames or
blocks. ABU mode is used to implement autobuffering functions. In this mode,
the element counter for each channel (DMCTRn) represents the buffer size
and is not modified during the transfers. Although the McBSP is mentioned
here as an example of a source/destination, any source/destination can be
used.
Multiframe Mode
In multiframe mode, the data transfers can be structured as multiple elements
in a frame, and multiple frames in a block. The element index registers
(DMIDX0, DMIDX1) are used to modify the addresses of elements within a
frame, and the frame-index registers (DMFRI0, DMFRI1) are used to modify
addresses following the completion of frames. The number of elements trans-
ferred per frame is determined by the channel element count (DMCTRn) regis-
ter and the number of frames transferred per block is determined by the chan-
nel-frame count (frame count field of the DMSFCn register). The two counters
are decremented following each element or frame transfer, respectively.
The element count is an unsigned 16-bit integer. The element count register
should be initialized with one less than the desired number of elements to be
transferred. The number of elements to be transferred per frame can be be-
tween 1 (0000h) and 65536 (FFFFh).
The frame count is an unsigned 8-bit integer. The frame count register should
be initialized with one less than the desired number of frames to be transferred.
The number of frames to be transferred per block can be between 1 (00h) and
256 (FFh). The total number of elements to be transferred is called the block
size, and is the product of the frame count and the element count.
All of the address indexing modes mentioned in the Source and Destination
Address Selection and Modification section are valid in multiframe mode, and
3-22
the indexing methods can be applied to the source and destination addresses
separately. The following describes the operation of each of the addressing
modes during multiframe operation:
For this example, assume a data stream where the data is structured as four
elements per frame, and four frames per block. The source data arrives in the
order shown on the left in Figure 3−5. It may be convenient to store or process
the data sorted by element number instead of frame number. This is achieved
by selecting sorting mode for the address modification, setting the destination
element index register to increment by four after each transfer, and setting the
elements and frame index to decrement by 11 after each frame. When the en-
tire block of 16 transfers has been completed, the data will be sorted by ele-
ment number instead of frame number as shown in Figure 3−5.
To configure the element index to increment by four, the signed value 0004h
is stored in the element index register. To configure the frame index to decre-
ment by 11, the signed value 0FFF5h (-11 decimal) is stored in the frame index
register.
3-23
The source and destination addresses are not updated after the last transfer
in the block. They contain the last source and destination address. The ele-
ment and frame counters both contain 0000h after the last transfer. The config-
uration of the DMA registers required to implement this example is shown in
Example 3−21, McBSP to Data Memory Transfer with Data Sorting, on page
3-57.
ABU Mode
3-24
During ABU mode operation, the element count register contains the buffer
size. The frame count register does not have a function in ABU mode. When
the address reaches the end of the buffer, it wraps back to the beginning auto-
matically. The number of transfers is not specified in this mode, so the address
wraps indefinitely until the DMA channel is disabled. The element count regis-
ter is interpreted as a 16-bit unsigned integer and valid buffer sizes range from
0002h to 0FFFFh. The buffer can be any size in this range and is not limited
to powers of two.
The buffer has a minimum address, called the base address, and a maximum
address. The difference between the base address and the maximum address
is the buffer size. Although the buffer size is not limited to powers of two, the
base address must be based on powers of two. The required location depends
on the buffer size. The base address must be located on an address boundary
that corresponds to one power-of-two higher than the most significant bit posi-
tion of the buffer size. The address boundaries for all available buffer sizes are
shown in Table 3−11. Circular buffers cannot cross 64k address boundaries.
Don’t care values in the table are indicated by X.
Table 3−11. ABU Buffer Examples
3-25
Example 3−4. ABU Buffer Size Examples
- For a buffer size of eight (decimal), the next higher power of two is 16, so
the buffer base address must be aligned with 16 word boundaries (ex.
0000h, 0010h, 0020h).
- For a buffer size of 5 (decimal), the next higher power of two is 8, so the
buffer base address must be aligned with 8 word boundaries (ex. 0000h,
0008h, 0010h, 0018h, 0020h).
- For a buffer size of 200 (decimal), the next higher power of two is 256, so
the buffer base address must be aligned with 256 word boundaries (ex.
0000h, 0100h, 0200h, 0300h).
The DMA transfer always starts at the addresses specified in the channel
source or destination address registers. The address register can point to any
location inside the defined range of the buffer. After each access, the appropri-
ate address register is modified according to the specified address indexing
mode. A limited set of address indexing modes are available for ABU mode
operation. Table 3−12 shows the modes available for ABU operation.
To configure the ABU mode properly, one side of the transfer (the source or
destination, but not both) must be configured with no address modification
(SIND/DIND=000b). The other side of the transfer must be configured with a
modified addressing mode. All legal combinations of SIND and DIND for ABU
mode are shown in Table 3−12. Use of combinations other than those shown
may cause unpredictable behavior.
001 Postincrement
010 Postdecrement
000 No modification 011 Postincrement with
index offset (DMIDX0)
100 Postincrement with
index offset (DMIDX1)
001 Postincrement
010 Postdecrement
011 Postincrement with 000 No modification
index offset (DMIDX0)
100 Postincrement with
index offset (DMIDX1)
3-26
As transfers proceed, the address in the circular buffer can be incremented or
decremented by one, or modified by the contents of one of the element index
registers (DMIDX0 or DMIDX1). If the DMA channel is configured for double-
word mode, the address is modified either by two, or by twice the index-offset
value. If the calculated next address for the buffer is greater than the maximum
buffer size, the address wraps to the base address. If a greater-than-one index
is used, the appropriate offset from the base address is calculated.
You should note that in double-word mode, the address of the second transfer
is always the address of the first transfer with the LSB inverted, regardless of
whether the maximum address has been crossed. The buffer wrap address
is always calculated with regard to the first transfer address of the double-word
transfer.
Example 3−5 shows the buffer wrap address calculated for a single-word
transfer with indexed addressing. Example 3−6 shows the buffer wrap ad-
dress calculated for a double-word transfer with indexed addressing.
Example 3−5. Wrap Address Calculation for a Single-Word Transfer With Indexed
Addressing
Buffer location: 0580h−059Eh
Current Address: 059Eh
Index: 2
Next Address: 0581h
Example 3−6. Wrap Address Calculation for a Double-Word Transfer With Indexed
Addressing
Buffer location: 0580h−059Eh
Current Address: 059Eh
Index: 2 (a total of + 4 since double-word mode)
Next Address: 0583h
Negative indexes can also be specified. In this case, the base address and the
maximum address calculation remains the same as described above. The ad-
dress is modified according to the negative address index. When the base ad-
dress is crossed, the address wraps to the maximum address. If an index of
less than -1 is being used, the appropriate offset from the maximum address
is calculated.
In ABU mode, interrupts can be configured to occur when the buffer is half full
or full. A detailed explanation of the interrupt operation is provided in section
3.2.3.7, Interrupt Generation, on page 3-28.
3-27
3.2.3.6 Autoinitialization
- DMSRCn is loaded with the contents of DMGSA, the global source ad-
dress register. DMGSA contains a 16-bit source address.
- DMDSTn is loaded with the contents of DMGDA, the global destination ad-
dress register. DMGDA contains a 16-bit destination address.
- DMCTRn is loaded with the contents of DMGCR, the global element count
register. DMGCR contains a 16-bit unsigned element count value.
- The frame count field of the DMSFCn is loaded with the contents of
DMGFR, the global frame count register. DMGFR contains an 8-bit un-
signed frame count value. The upper 8 bits of the DMGFR are reserved
and have no effect. The reserved bits are always read as zeros.
Two fields in the DMMCRn (DINM and IMOD) control how interrupts are han-
dled during DMA transfers. DINM is used to enable or disable a generation of
interrupts based on the completion of part or all of a transfer. If DINM = 0, inter-
rupts are disabled and no interrupt generation occurs. If DINM = 1, interrupt
generation is enabled and occurs based on the configuration of the IMOD bit.
The interrupt mask register (IMR) and the INTM bit in the CPU still control
whether an interrupt from the DMA is serviced. DINM enables the ability of the
DMA to generate an interrupt. For more information on operation of the IMR,
INTM, and interrupt processing, see the user’s guide titled TMS320C54x DSP,
CPU and Peripherals Reference Set, Volume 1 (literature number SPRU131).
3-28
Table 3−13. DMA Block Transfer Interrupt Generation Modes
MODE CTMOD DINM IMOD Interrupt Generation
ABU 1 1 0 At buffer full only
In ABU mode (CTMOD = 1), interrupts can be generated either when the entire
buffer has been transferred or when each half of the buffer has been transfer-
red. The half-buffer option can be used to emulate the operation of the buffered
serial port (BSP) on the ’548 and ’549 devices.
The logic that generates the interrupt is based on the calculated next address.
The determination of the half-buffer point depends on the ’54x DSP being
used. The half-buffer interrupt generation for each device is described in detail
in the sections that follow.
On the ’5402 and ’5420, the half-buffer interrupt is generated when the next
address is equal to or greater than the halfway point in the buffer (if positive
indexing is used), or when the next address is less than the halfway point when
negative indexing is being used. The interrupt point for odd and even size buff-
ers differ accordingly. The full-buffer interrupt is generated when the next ad-
dress wraps back to the base address (positive indexing), or back to the maxi-
mum address (negative indexing). The examples that follow illustrate when
the interrupts are generated in each case.
3-29
Example 3−7. ’5402/’5420 ABU Interrupt Example − Even Size Buffer With +1 Index
Buffer size = 8 Half-buffer = 4
0001h 0002h
0002h 0003h
0004h 0005h
0005h 0006h
0006h 0007h
Example 3−8. ’5402/’5420 ABU Interrupt Example − Odd Size Buffer With +1 Index
Buffer size = 7 Half-buffer = 3
0001h 0002h
0003h 0004h
0004h 0005h
0005h 0006h
3-30
Example 3−9. ’5402/’5420 ABU Interrupt Example − Even Size Buffer With −1 Index
Buffer size = 8 Half-buffer = 4
0006h 0005h
0005h 0004h
0003h 0002h
0002h 0001h
0001h 0000h
Example 3−10. ’5402/’5420 ABU Interrupt Example − Odd Size Buffer With −1 Index
Buffer size = 7 Half-buffer = 3
0005h 0004h
0004h 0003h
0002h 0001h
0001h 0000h
3-31
3.2.3.9 ’5410 Half-Buffer Interrupt Generation in ABU Mode
On the ’5410, the half-buffer interrupt is generated when the next address is
greater than the halfway point in the buffer if positive indexing is used, or when
the next address is less than the halfway point when negative indexing is used.
For odd and even size buffers, the interrupt point differs accordingly. The full-
buffer interrupt is generated when the next address wraps back to the base
address (positive indexing), or back to the maximum address (negative index-
ing). The examples that follow illustrate when interrupts are generated in each
case.
Example 3−11. ’5410 ABU Interrupt Example − Even Size Buffer With +1 Index
Buffer size = 8 Half-buffer = 4
0001h 0002h
0002h 0003h
0003h 0004h
0005h 0006h
0006h 0007h
Example 3−12. ’5410 ABU Interrupt Example − Odd Size Buffer With +1 Index
Buffer size = 7 Half-buffer = 3
Current Address Next Address Interrupt
0000h 0001h
0001h 0002h
0002h 0003h
0004h 0005h
0005h 0006h
3-32
Example 3−13. ’5410 ABU Interrupt Example − Even Size Buffer With −1 Index
Buffer size = 8 Half-buffer = 4
Current Address Next Address Interrupt
0007h 0006h
0006h 0005h
0005h 0004h
0003h 0002h
0002h 0001h
0001h 0000h
Example 3−14. ’5410 ABU Interrupt Example − Odd Size Buffer With −1 Index
Buffer size = 7 Half-buffer = 3
Current Address6 Next Address Interrupt
0006h 0005h
0005h 0004h
0004h 0003h
0002h 0001h
0001h 0000h
3-33
3.3 Extended Addressing
The DMA controller has the ability to perform transfers to and from the ex-
tended program memory space. Two subaddressed registers are employed
to provide this capability: the DMA source program page address register
(DMSRCP) and the DMA destination program page address register
(DMDSTP). These registers contain the extended program page number for
the source and destination locations, respectively. In each of these registers,
the least significant seven bits are used to store the extended address page
of the source and destination addresses, as shown in Figure 3−6 and
Figure 3−7. Following reset, DMSRCP and DMDSTP are initialized to 0000h,
or program page zero. The reserved bit locations are always read as zeros.
DMSRCP and DMDSTP are not channel specific. These registers control the
source and destination address pages in program memory for all DMA chan-
nels. In addition, the program page addresses stored in these registers are not
modified during source and destination address modifications. Consequently,
program space transfers cannot cross 64K page boundaries. If a program
page boundary is crossed during a transfer, the next transfer wraps to the
same page.
Not all ’54x devices support 128 pages of extended program memory. You
should consult the device-specific data sheet for detailed information on ex-
tended memory support.
3-34
3.4 DMA Memory Maps
This section provides DMA memory maps for the ’5402, ’5410, and ’5420 de-
vices.
Address Range
(Hex) Description
Program space 00 0000 0F FFFF Reserved
3-35
3.4.2 ’5410 DMA Memory Map
The ’5410 supports DMA accesses to internal and external memory. The DMA
memory map for the ’5410 is shown in Table 3−15. Memory regions marked
as reserved (shaded) are not accessible through the ’5410 DMA. The DMA
memory map is not affected by the MP/MC, DROM, or OVLY bits.
0036 RCERA2
0037 XCERA2
003A RCERA0
003B XCERA0
3-36
Table 3−15. ’5410 DMA Memory Map (Continued)
Address Range
(Hex) Description
003C 003F Reserved
004A RCERA1
004B XCERA1
3-37
Table 3−16. ’5420 DMA Memory Map
Address Range
(Hex) Description
Program space 00 0000 00 001F Reserved
00 0020 McBSP0 data receive register (DRR20)
00 0021 McBSP0 data receive register (DRR10)
00 0022 McBSP0 data transmit register (DXR20)
00 0023 McBSP0 data transmit register (DXR10)
00 0024 00 002F Reserved
00 0030 McBSP2 data receive register (DRR22)
00 0031 McBSP2 data receive register (DRR12)
00 0032 McBSP2 data transmit register (DXR22)
00 0033 McBSP2 data transmit register (DXR12)
00 0034 00 003F Reserved
00 0040 McBSP1 data receive register (DRR21)
00 0041 McBSP1 data receive register (DRR11)
00 0042 McBSP1 data transmit register (DXR21)
00 0043 McBSP1 data transmit register (DXR11)
00 0044 00 005F Reserved
00 0060 00 3FFF On-chip DARAM 0
00 4000 00 7FFF On-chip SARAM 1
00 8000 00 FFFF On-chip SARAM 2
01 0000 01 005F Reserved
01 0060 01 3FFF On-chip DARAM 0
01 4000 01 7FFF On-chip SARAM 1
01 8000 01 FFFF On-chip SARAM 3
02 0000 02 005F Reserved
02 0060 02 3FFF On-chip DARAM 0
02 4000 02 7FFF On-chip SARAM 1
02 8000 02 EFFF Reserved
02 F000 02 FFFF On-chip SARAM 4
3-38
Table 3−16. ’5420 DMA Memory Map (Continued)
Address Range
(Hex) Description
03 0000 03 005F Reserved
03 0060 03 3FFF On-chip DARAM 0
03 4000 03 7FFF On-chip SARAM 1
03 8000 03 FFFF Reserved
Data space 0000 001F Reserved
McBSP0 data receive register (DRR20)
3-39
3.5 DMA Transfer Latency
All 16-bit DMA transfers are composed of a read followed by a write. The time
to complete this activity depends on the source and destination locations, ex-
ternal interface conditions (such as wait states and bank-switching cycles), the
number of active DMA channels, and the activity level of the host port interface
(HPIx).
Internal Internal 4 4 4
3-40
Table 3−17 assumes the external interface is configured with no hardware or
software wait states and CLKOUT is in divide-by-1 mode (CLKOUT is equal
to CPU clock).
The transfer rate on a particular channel is affected by the activity on the other
channels. Since all high-priority channels are serviced first in a circular pattern,
the data rate on a particular channel is governed by the number of other chan-
nels that are active at the same priority level. So while the high-priority chan-
nels are still active, the maximum data rate on each high-priority channel is di-
vided by the total number of high-priority channels. The transfer rate on the
low-priority channels is zero until there is no high priority activity.
Example 3−15 illustrates such a situation.
Assuming channels 1, 2, 3, and 4 are enabled at the same time and none of
the channels wait for sync events, channels 1 and 2 are serviced first and
channels 3 and 4 wait until channels 1 and 2 are completed. The transfer rates
on each of the channels proceed as follows.
- DMA channel 1 data transfer rate = 25MWps/2 active channels = 12.5 MWps
- DMA channel 2 data transfer rate = 25MWps/2 active channels = 12.5 MWps
- DMA channel 3 data transfer rate = 0 due to priority
- DMA channel 4 data transfer rate = 0 due to priority
3-41
When channel 1 is completed but channel 2 is still active:
3-42
3.6 Enhanced Host Port Interface Access Through the DMA Controller
The enhanced host port interface (HPI-8 or HPI-16, depending on the DSP)
uses the DMA bus to gain access to on-chip memory. The HPI has a dedicated
port on the DMA controller and makes requests to use the DMA bus. The DMA
controller arbitrates these requests based on the current activity. When the
HPIx makes a request, the current DMA transfer in progress is completed and
the DMA controller grants the HPIx access to the DMA bus. All pending high-
and low-priority transfers are suspended until the HPIx releases the bus.
When the HPI releases the bus, the pending DMA transfers continue as be-
fore. For this reason, HPIx activity affects the transfer rates on the DMA chan-
nels.
Although the HPIx has a dedicated port on the DMA controller, it does not have
a dedicated channel. No channel context programming is required for the HPIx
to use the DMA bus. The HPIx is operated normally by the host, while access
to the internal buses is arbitrated by the DMA controller. Due to this arrange-
ment, use of the HPIx does not consume any of the available DMA channels.
For more information on the operation of the enhanced host port interfaces
(HPI-8 and HPI-16), refer to Chapter 4, Enhanced 8-Bit Host Port Interface
(HPI-8), and Chapter 5, Enhanced 16-Bit Host Port Interface (HPI-16).
3-43
Interprocessor FIFO Communication on the ’5420 / DMA Operation in Power-Down Mode
One method of exchanging data between the two subsystems uses the DMA
controller in conjunction with an on-chip first-in, first-out (FIFO) unit. The FIFO
is mapped to the DMA I/O space. Any access to DMA I/O space on the ’5420
writes to, or reads from, this FIFO. All addresses are mapped to the same FIFO
location. For this reason, the ’5420 DMA does not access I/O space in the
same manner as the other ’54x devices.
The DMA continues to operate while in all IDLE modes (IDLE1/2/3). When the
DMA is not running (not performing a transfer), the DMA controller automati-
cally stops its internal clocks to conserve power. When a transfer needs to be
performed, the clocks are switched on, the transfer is completed, and the
clocks are switched off again. This clock management operates in each of the
three IDLE modes.
In IDLE1 and IDLE2, the clock source to the DMA comes from the same source
used to generate the CPU and system clocks (either the PLL or a divided ver-
sion of the X2/CLKIN). In IDLE3, the PLL is stopped, and therefore, cannot be
used as a clock source for the DMA. In this case, X2/CLKIN is used directly
to clock the DMA controller. For this reason, a clock must always be present
at the X2/CLKIN pin for the DMA to operate in IDLE 3 mode.
When X2/CLKIN is used to clock the DMA in IDLE 3 mode, it is not multiplied
or divided. As a result, the speed of DMA transfers in IDLE 3 mode is affected
accordingly.
3-44
3.9 Programming Examples
Below are several DMA controller programming examples. Each example
contains a description of the desired operation and the code used to set up the
DMA controller. Only the configuration code is included − additional code such
as interrupt service routines are not included. For clarity, the code sections re-
fer to DMA register names. The addresses for these registers can be identified
in assembly code as shown on the facing page.
3-45
**************************************************
*
* 54x Register Definitions for the DMA Controller
*
**************************************************
DMPREC .set 0054h ;Channel Priority and Enable Control Register
DMSA .set 0055h ;Sub-bank Address Register
DMSDI .set 0056h ;Sub-bank Data Register with autoincrement
DMSDN .set 0057h ;Sub-bank Data Register without modification
DMSRC0 .set 00h ;Channel 0 Source Address Register
DMDST0 .set 01h ;Channel 0 Destination Address Register
DMCTR0 .set 02h ;Channel 0 Element Count Register
DMSFC0 .set 03h ;Channel 0 Sync Select and Frame Count Register
DMMCR0 .set 04h ;Channel 0 Transfer Mode Control Register
DMSRC1 .set 05h ;Channel 1 Source Address Register
DMDST1 .set 06h ;Channel 1 Destination Address Register
DMCTR1 .set 07h ;Channel 1 Element Count Register
DMSFC1 .set 08h ;Channel 1 Sync Select and Frame Count Register
DMMCR1 .set 09h ;Channel 1 Transfer Mode Control Register
DMSRC2 .set 0Ah ;Channel 2 Source Address Register
DMDST2 .set 0Bh ;Channel 2 Destination Address Register
DMCTR2 .set 0Ch ;Channel 2 Element Count Register
DMSFC2 .set 0Dh ;Channel 2 Sync Select and Frame Count Register
DMMCR2 .set 0Eh ;Channel 2 Transfer Mode Control Register
DMSRC3 .set 0Fh ;Channel 3 Source Address Register
DMDST3 .set 10h ;Channel 3 Destination Address Register
DMCTR3 .set 11h ;Channel 3 Element Count Register
DMSFC3 .set 12h ;Channel 3 Sync Select and Frame Count Register
DMMCR3 .set 13h ;Channel 3 Transfer Mode Control Register
DMSRC4 .set 14h ;Channel 4 Source Address Register
DMDST4 .set 15h ;Channel 4 Destination Address Register
DMCTR4 .set 16h ;Channel 4 Element Count Register
DMSFC4 .set 17h ;Channel 4 Sync Select and Frame Count Register
DMMCR4 .set 18h ;Channel 4 Transfer Mode Control Register
DMSRC5 .set 19h ;Channel 5 Source Address Register
DMDST5 .set 1Ah ;Channel 5 Destination Address Register
DMCTR5 .set 1Bh ;Channel 5 Element Count Register
DMSFC5 .set 1Ch ;Channel 5 Sync Select and Frame Count Register
DMMCR5 .set 1Dh ;Channel 5 Transfer Mode Control Register
DMSRCP .set 1Eh ;Source Program Page Address
DMDSTP .set 1Fh ;Destination Program Page Address
DMIDX0 .set 20h ;Element Address Index Register 0
DMIDX1 .set 21h ;Element Address Index Register 1
DMFRI0 .set 22h ;Frame Address Index Register 0
DMFRI1 .set 23h ;Frame Address Index Register 1
DMGSA .set 24h ;Global Source Address Reload Register
DMGDA .set 25h ;Global Destination Address Reload Register
DMGCR .set 26h ;Global Element Count Reload Register
DMGFR .set 27h ;Global Frame Count Reload Register
3-46
Example 3−16. Program Memory to Data Memory Transfer Without Autoincremented
Subaddressing
This example transfers a block of data from program space to data space via
direct memory access. The DMA controller is configured to perform 1000h
single-word transfers with both the source and destination addresses increm-
ented by one after each element transfer. The transfers are not associated with
any sync event (free-running). After the block transfer is complete (autoinitial-
ization is off), the DMA channel is disabled.
3-47
***********************************
stm DMSRCP,DMSA ;set source program page to 1
stm #1h,DMSDN
stm DMSRC0,DMSA ;set source program address to 8000
stm #8000h,DMSDN ; (lower 16-bit of 18000h)
stm DMDST0,DMSA ;set destination address to 3000
stm #3000h,DMSDN
stm DMCTR0 ,DMSA ;set for 1000h transfers
stm #(1000h−1) ,DMSDN
stm DMSFC0 ,DMSA
stm #0000000000000000b ,DMSDN
;0000~~~~~~~~~~~~ (DSYN) No sync event
;~~~~0~~~~~~~~~~~ (DBLW) Single-word mode
;~~~~~000~~~~~~~~ Reserved
;~~~~~~~~00000000 (Frame Count) Frame Count=0h (one frame)
stm DMMCR0 ,DMSA
stm #0000000100000101b ,DMSDN
;0~~~~~~~~~~~~~~~ (AUTOINIT) Autoinitialization disabled
;~0~~~~~~~~~~~~~~ (DINM) Interrupts masked
;~~0~~~~~~~~~~~~~ (IMOD) N/A
;~~~0~~~~~~~~~~~~ (CTMOD) Multi-frame mode
;~~~~0~~~~~~~~~~~ Reserved
;~~~~~001~~~~~~~~ (SIND) Post increment source address
;~~~~~~~~00~~~~~~ (DMS) Source in program space
;~~~~~~~~~~0~~~~~ Reserved
;~~~~~~~~~~~001~~ (DIND) Post increment destination address
;~~~~~~~~~~~~~~01 (DMD) Destination in data space
3-48
Example 3−17. Program Memory to Data Memory Transfer Using Autoincremented
Subaddressing
This example performs the same transfer as the previous example but uses
autoincremented subaddressing (the DSMBAI register) during the setup. This
subaddressing scheme allows the channel-context registers to be configured
using a single instruction instead of two, saving time and memory.
3-49
***********************************
stm DMSRCP,DMSA ;set source program page to 1
stm #1h,DMSDN
3-50
Example 3−18. Program Memory to Data Memory Transfer With Autoinitialization
This example transfers a block of data from program space to data space via
direct memory access. The DMA controller is configured to perform 1000h
single-word transfers per block, with both the source and destination address-
es incremented by one after each element transfer. The transfers are not asso-
ciated with any sync event (free-running). When the first block transfer is com-
pleted, the DMA channel is autoinitialized to begin again using the contents
of the global reload registers (DMGSA, DMGDA, DMGCR, DMGFR). The
global reload registers direct the destination to 02000h in data space, instead
of 03000h, on the first block transfer. The global reload registers can also be
used to autoinitialize the identical conditions as the first block transfer.
3-51
stm DMMCR4 ,DMSA
stm #1000000100000101b ,DMSDN
;1~~~~~~~~~~~~~~~ (AUTOINIT) Autoinitialization enabled
;~0~~~~~~~~~~~~~~ (DINM) Interrupts masked
;~~0~~~~~~~~~~~~~ (IMOD) N/A
;~~~0~~~~~~~~~~~~ (CTMOD) Multi-frame mode
;~~~~0~~~~~~~~~~~ Reserved
;~~~~~001~~~~~~~~ (SIND) Post increment source address
;~~~~~~~~00~~~~~~ (DMS) Source in program space
;~~~~~~~~~~0~~~~~ Reserved
;~~~~~~~~~~~001~~ (DIND) Post increment destination address
;~~~~~~~~~~~~~~01 (DMD) Destination in data space
stm #0000000000000000b,DMSDN
;00000000~~~~~~~~ Reserved
;~~~~~~~~00000000 Global Frame count
3-52
Example 3−19. McBSP Data Transfer in ABU Mode
This example transfers 16-bit words received on McBSP0 to data space via
the DMA controller. The destination is configured as a circular buffer. The ad-
dress in the destination buffer is incremented by one after each transfer. ABU
mode is used to implement the circular buffer. In ABU mode, the element count
register represents the buffer size, and the frame count is not used. Only the
DMA configuration is shown, which in this example, is to generate an interrupt
to the CPU when the 100h buffer is full. The interrupt service routine for this
interrupt is not shown in this example.
3-53
***********************************
stm DMSRC1,DMSA ;set source address to DRR10
stm DRR1_0,DMSDN
stm DMDST1,DMSA ;set destination address to 3000
stm #3000h,DMSDN
stm DMCTR1 ,DMSA ;set buffer size to 100h words
stm #100h ,DMSDN
stm DMSFC1 ,DMSA
stm #0001000000000000b ,DMSDN
;0001~~~~~~~~~~~~ (DSYN) McBSP0 receive sync event
;~~~~0~~~~~~~~~~~ (DBLW) Single-word mode
;~~~~~000~~~~~~~~ Reserved
;~~~~~~~~00000000 (Frame Count) Frame count is not
; relevant in ABU mode
3-54
Example 3−20. McBSP Data Transfer in Double-Word Mode
This example transfers 32-bit words received on McBSP0 to data space via
direct memory access in multi-frame mode. The DMA controller is configured
to automatically read DRR20 and DRR10 and transfer the data to sequential
locations starting at 03000h in data space.
3-55
***********************************
stm DMSRC1,DMSA ;set source address to DRR20
stm DRR2_0,DMSDN
stm DMDST1,DMSA ;set destination address to 3000
stm #3000h,DMSDN
stm DMCTR1 ,DMSA ;set buffer size to 50h words
stm #050h−1,DMSDN
3-56
Example 3−21. McBSP to Data Memory Transfer With Data Sorting
This example implements the sorting example shown in Figure 3−5 on page
3-24. Single words received on the McBSP0 are transferred to data memory
starting at address 03000h. The incoming data is structured as four frames of
four elements each. The DMA sorts the incoming data by modifying the des-
tination addresses with the element index register (DMIDX0) and the frame in-
dex register (DMFRI0). The resulting stored data is sorted by element number
instead of frame number.
3-57
***********************************
stm DMSRC1,DMSA ;set source address to DRR10
stm DRR1_0,DMSDN
stm DMDST1,DMSA ;set destination address to 3000
stm #3000h,DMSDN
stm DMCTR1 ,DMSA ;set elements per frame to 4h
stm #0004h−1 ,DMSDN
stm DMSFC1 ,DMSA
stm #0001000000000011b ,DMSDN
;0001~~~~~~~~~~~~ (DSYN) McBSP0 receive sync event
;~~~~0~~~~~~~~~~~ (DBLW) Single-word mode
;~~~~~000~~~~~~~~ Reserved
;~~~~~~~~00000011 (Frame Count) Frames per block = 4h−1
stm DMMCR1 ,DMSA
stm #0100000001010101b ,DMSDN
;0~~~~~~~~~~~~~~~ (AUTOINIT) Autoinitialization disabled
;~1~~~~~~~~~~~~~~ (DINM) DMA Interrupts enabled
;~~0~~~~~~~~~~~~~ (IMOD) Interrupt at complete block transfer
;~~~0~~~~~~~~~~~~ (CTMOD) Multi-frame mode
;~~~~0~~~~~~~~~~~ Reserved
;~~~~~000~~~~~~~~ (SIND) No modify on source address (DRR10)
;~~~~~~~~01~~~~~~ (DMS) Source in data space
;~~~~~~~~~~0~~~~~ Reserved
;~~~~~~~~~~~101~~ (DIND) Post increment destination address
; with DMIDX0 and DMFRI0
;~~~~~~~~~~~~~~01 (DMD) Destination in data space
stm DMIDX0,DMSA ;set element address index to +4
stm #0004h,DMSDN
***********************************
3-58
3-59
Chapter 4
The enhanced 8-bit host port interface, also referred to as HPI-8, is an im-
proved version of the standard 8-bit HPI designed to interface a host device
or host processor to the ’54x.
Topic Page
4.1 Introduction to the Enhanced 8-Bit Host Port Interface (HPI-8) . . . . 4-2
4.2 HPI-8 Basic Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-4
4.3 Details of HPI-8 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
4.4 Host Read/Write Access to HPI-8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15
4.5 DSPINT and HINT Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-24
4.6 Considerations for HPI-8 Transfers While Changing
Clock Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-25
4.7 Considerations in Idle Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-27
4.8 Effects of Reset on HPI-8 Operations . . . . . . . . . . . . . . . . . . . . . . . . . . 4-29
4.9 HPI-8 Data Pins as General Purpose I/O Pins
(Not Available on’5410) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-31
4-1
4.1 Introduction to the Enhanced 8-Bit Host Port Interface (HPI-8)
The HPI-8 is an 8-bit parallel port that interfaces a host device or host proces-
sor to the ’54x. Information is exchanged between the ’54x and the host device
through on-chip ’54x RAM.
The main differences between the enhanced 8-bit HPI and the standard 8-bit
HPI are listed in Table 4−1.
Table 4−1. Main Differences Between Enhanced 8-Bit HPI and Standard 8-Bit HPI
Enhanced 8-bit HPI (HPI-8) Standard 8-bit HPI
- Access to all on-chip RAM locations Access to only a fixed 2K portion of on-chip RAM
- Host accesses always synchronized to Host-only mode allows asynchronous host accesses
the’54x clock (no host-only mode)
- Both host and ’54x always have access to Host-only mode gives host exclusive access to RAM
on-chip RAM (no host-only mode)
The HPI-8 functions as a slave and enables the host processor to access the
on-chip memory of the ’54x. The interface consists of an 8-bit, bidirectional
data bus and various control signals. Sixteen bit transfers are accomplished
in two parts with the HBIL input designating high or low byte. The host commu-
nicates with the HPI-8 through dedicated address and data registers, which
the ’54x cannot directly access. The HPI control register, which is accessible
by both the host and the ’54x, includes bits for configuring the protocol and for
controlling communication (handshaking). A simple block diagram of the
HPI-8 is shown in Figure 4−1.
4-2
Figure 4−1. Host Port Interface Block Diagram
’54x data bus
’54x address bus
HPI-8
HPIC
register ’54x
16 on-chip
RAM
HD(7−0) HPID
register
16
DMA bus
HPIA
register
16
Interface HPI
control control
signals logic
The HPI-8 provides 16-bit data to the ’54x while maintaining the economical
8-bit external interface. Successive bytes transferred are automatically com-
bined into 16-bit words. When the host device performs a data transfer with
HPI-8 registers, the HPI-8 control logic automatically performs an access to
the internal ’54x RAM to complete the transaction. The ’54x can then access
the data within its memory space.
Both the ’54x and the host can access the entire on-chip RAM of the ’54x. The
’54x clock must be active for host accesses to occur, and the HPI-8 is not func-
tional while the ’54x device is in reset mode (except the ’5410 − see section
4.8.2, Access to HPI-8 During Reset (’5410 Only), on page 4-29). The host
accesses are synchronized to the ’54x clock internally to ensure proper ar-
bitration of the on-chip RAM accesses. In the case of a conflict between a ’54x
and a host cycle where both accesses involve the same memory location, the
host has access priority and the ’54x CPU waits one ’54x clock cycle.
4-3
4.2 HPI-8 Basic Functional Description
The external HPI-8 interface can connect to a variety of host devices with little
or no additional logic necessary. The 8-bit data bus (HD0 – HD7) exchanges
information with the host. The two control inputs (HCNTL0 and HCNTL1) indi-
cate which internal HPI-8 register is accessed. These inputs, along with HBIL,
are commonly driven by host address-bus bits or a function of these bits.
Figure 4−2 shows a simplified diagram of a connection between the HPI-8 and
a host device.
ÁÁÁÁÁÁÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
Host Device ’54x
ÁÁÁÁÁÁÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
8
Data HD0−HD7
ÁÁÁÁÁÁÁÁÁÁ Á ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ 2
ÁÁÁÁÁÁÁÁÁÁ Á ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
HCNTL0/1 (address)
Address Sampled by internal
ÁÁÁÁÁÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
Á
HBIL 1st/2nd
strobe or HAS
Read/write HR/W
ÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁ Á ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ HDS1
ÁÁÁÁÁÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
Á
Data strobe HDS2 Internal strobe (controls transfer)
ÁÁÁÁÁÁÁÁÁÁ ÁÁ ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
HCS
ÁÁÁÁÁÁÁÁÁÁ ÁÁ ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
Address latch HAS (Samples address and signals,
ÁÁÁÁÁÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
(if used) if used)
ÁÁÁÁÁÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
READY HRDY
ÁÁÁÁÁÁÁÁÁÁ
Á ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
Interrupt HINT
Using the HCNTL0/1 inputs, the host can specify an access to the HPI control
register (HPIC), the HPI address register (HPIA) (which serves as the pointer
into ’54x RAM), or the HPI data register (HPID). Because of the 16-bit word
structure of the ’54x, all HPI-8 transfers must consist of two consecutive bytes.
The dedicated HBIL pin indicates whether the first or second byte is trans-
ferred. An internal control register bit determines whether the first or second
byte is placed the most significant byte of a 16-bit word.
The HPID register can also be accessed with an optional automatic address
increment feature. The autoincrement feature provides a convenient way of
reading from, or writing to, consecutive word locations. In autoincrement
mode, the HPIA register is automatically incremented during consecutive
transfers. This feature is described further in section 4.3.3, Address Autoincre-
ment, on page 4-11.
4-4
The HPI-8 includes interrupt logic to facilitate software handshaking. The host
can interrupt the ’54x CPU by writing to a dedicated bit in the HPIC. Similarly,
the ’54x can use the HINT output pin to interrupt the host. The HINT output is
asserted when the ’54x writes to a dedicated bit in the HPIC. The host can also
acknowledge and clear HINT pin by writing to the HINT bit in the HPIC register.
Table 4−2 lists and describes the three registers that the HPI-8 utilizes for com-
munication between the host device and the ’54x CPU.
’54x
Name Address Description
HPIA — HPI address register. Directly accessible only by the host. Contains the address
in the ’54x on-chip RAM where the current access occurs.
HPIC 002Ch HPI control register. Directly accessible by either the host or by the ’54x. Contains
control and status bits for HPI-8 operations.
HPID — HPI data register. Directly accessible only by the host. Contains data that is read
from the ’54x on-chip memory if the current access is a read, or data that is written
to on-chip memory if the current access is a write.
The various strobe signals – data strobes (HDS1 and HDS2), read/write strobe
(HR/W), and the address strobe (HAS) – enable the HPI-8 to interface to a vari-
ety of host devices.
The HPI ready pin (HRDY) provides a convenient way to automatically adjust
the host access rate to the HPI-8 access rate. The HRDY pin allows insertion
of host wait states for hosts that support a ready input. This enables deferred
completion of host accesses when the host bus cycle times are faster than the
HPI-8 access rate.
4-5
4.3 Details of HPI-8 Operation
This section includes a detailed description of each HPI-8 external interface
pin function, as well as descriptions of the control register bit functions and the
HPI-8 memory map. The logical interface timings, HPI-8 initialization, and
read/write sequences are discussed in section 4.4, Host Read/Write Access
to HPI-8, on page 4-15.
Table 4−3 gives a detailed description of each HPI-8 external interface pin.
HBIL Address or control I Byte identification input. Identifies first or second byte of
lines transfer (but not most significant or least significant —
this is specified by the BOB bit in the HPIC register,
described later in this section). HBIL is low for the first
byte and high for the second byte.
HCNTL0, HCNTL1 Address or control I Host control inputs. These inputs select a host access to
lines the HPIA register, the HPI data latches (with optional
address increment), or the HPIC register.
HCS Address or control I Chip select. Serves as the enable input for the HPI-8 and
lines must be low during an access but may stay low between
accesses. HCS normally precedes HDS1 and HDS2, but
this signal also samples HCNTL0/1, HR/W, and HBIL if
HAS is not used and HDS1 or HDS2 is already low (this
is explained in further detail later in this section).
Figure 4−3, HPI Strobe and Select Logic, on page 4-8
shows the equivalent circuit of the HCS, HDS1, and
HDS2 inputs.
† I = Input, O = Output, Z = High-impedance
4-6
Table 4−3. HPI-8 Signal Names and Functions (Continued)
HPI Pin Host Pin State† Signal Function
HD0−HD7 Data bus I/O/Z Parallel bidirectional 3-state data bus. HD7 (MSB)
through HD0 (LSB) are placed in the high-impedance
state when the HPI is not active (HDSx OR HCS = 1) or
when EMU1/OFF is active-low. These pins can also be
used for general purpose input/output when the HPI-8 is
disabled. For more details on this feature, refer to section
4.9, HPI-8 Data Pins as General Purpose I/O Pins, on
page 4-31.
HDS1, HDS2 Read strobe and I Data strobe inputs. Control transfer of data during host
write strobe or access cycles. Also, when HAS is not used, these inputs
data strobe sample HBIL, HCNTL0/1, and HR/W when HCS is
already low (which is the case in normal operation).
Hosts with separate read and write strobes connect
those strobes to either HDS1 or HDS2. Hosts with a
single data strobe connect it to either HDS1 or HDS2,
connecting the unused pin high. Regardless of HDS
connections, HR/W is still required to determine direction
of transfer. Because HDS1 and HDS2 are internally
exclusive-NORed, hosts with a high true data strobe can
connect this to one of the HDS inputs with the other HDS
input connected low. Figure 4−3 on page 4-8 shows the
equivalent circuit of the HDS1, HDS2, and HCS inputs.
HINT Host interrupt O/Z Host interrupt output. Controlled by the HINT bit in the
input HPIC. Driven high when the ’54x is being reset. Placed
in high-impedance when EMU1/OFF is active-low.
HRDY Asynchronous O/Z HPI ready output. When high, indicates that the HPI-8 is
ready ready for a transfer to be performed. When low, indicates
that the HPI-8 is busy completing the internal portion of
the previous transaction. Placed in high-impedance
when EMU1/OFF is active-low. HCS enables HRDY; that
is, HRDY is always high when HCS is high.
HR/W Read/write strobe, I Read/write input. Hosts must drive HR/W high to read
address line, or HPI-8 and low to write HPI-8. Hosts without a read/write
multiplexed strobe can use an address line for this function.
address/data
† I = Input, O = Output, Z = High-impedance
The HCS input serves primarily as the enable input for the HPI-8, and the
HDS1 and HDS2 signals control the HPI-8 data transfer; however, the logic
with which these inputs are implemented allows their functions to be inter-
4-7
changed if desired. The equivalent circuit for these inputs is shown in
Figure 4−3.
Internal
HCS HPI strobe
HRDY Internal
HRDY signal
Figure 4−3 shows that the internal HPI strobe signal, which is used to control
transfers, is derived from all three input signals — HCS, HDS1, and HDS2.
Note that if HCS is used in place of HDS1 and HDS2 to control HPI-8 access
cycles, HRDY operation is affected (because HCS enables HRDY, and when
HCS is high, HRDY is forced high). It is also important to note that because
HDS1 and HDS2 are exclusive-NORed, driving both of these inputs low does
not constitute an enabled condition.
The falling edge of the internal strobe is used to sample the HCNTL0/1, HBIL,
and HR/W inputs whenever the HAS input is not used. Therefore, when HAS
is not used, the latest of HCS, HDS1, or HDS2 is the signal that actually con-
trols sampling of the HCNTL0/1, HBIL, and HR/W inputs. In addition to sam-
pling the control inputs, the internal strobe defines the boundaries of an HPI-8
cycle. This function of the internal strobe is described in section 4.4, Host
Read/Write Access to HPI-8, on page 4-15.
When using the HAS input to sample HCNTL0/1, HBIL, and HR/W, these sig-
nals can be removed earlier in an access cycle, thus allowing more time to
switch bus states from address to data information. This additional time facili-
tates interface to hosts with multiplexed address and data busses. In this type
of system, an address latch enable (ALE) signal is often provided and can be
used to drive the HAS input.
The two control pins (HCNTL0 and HCNTL1) indicate which internal HPI-8
register is accessed. Table 4−4 describes the HCNTL0/1 pin functions.
4-8
Table 4−4. HPI-8 Input Control Signals and Function Selection
HCNTL1 HCNTL0 Description
0 0 Host can read from or write to the HPI control register, HPIC.
0 1 Host can read from or write to the HPI data latches. HPIA is automatically
postincremented each time a read is performed, and preincremented each time a write
is performed.
1 0 Host can read from or write to the address register, HPIA. This register points to the ’54x
on-chip RAM.
1 1 Host can read from or write to the HPI data latches. HPIA is not affected.
8000h
Undefined
17FFFh
18000h On-chip SARAM2
1FFFFh (32K × 16 bits)
4-9
All on-chip RAM blocks—program RAM and data RAM—are mapped to one
contiguous address range within the HPI memory map. The addresses within
this memory map cannot be dynamically re-mapped by the user (that is, the
HPI-8 memory map is not affected by any programmable register bits).
After initializing the extended address bits, the host must clear the XHPIA bit
to regain access to the lower sixteen HPI address bits in the HPIA register. The
XHPIA bit must also be cleared to zero for proper operation of the autoincre-
ment feature. The autoincrement feature does not function properly when the
XHPIA bit is set to one.
It is important to note that neither the XHPIA nor the seven extended address
bits are initialized after reset, so the host should always initialize these bits af-
ter the ’54x is reset. The XHPIA bit is described in more detail in section 4.3.4,
HPI-8 Control Register Bits and Functions, on page 4-12.
4-10
4.3.3 Address Autoincrement
The HPI-8 address autoincrement feature provides a convenient way of ac-
cessing consecutive word locations in on-chip RAM. When the autoincrement
feature is enabled, the HPIA register is automatically incremented for each ac-
cess. Although the access times are not changed, performance is increased
because the host does not have to update the HPIA register between each
memory access. The autoincrement feature is enabled when the HCNTL0 pin
is set to one and the HCNTL1 pin is set to zero. Note that for devices with ex-
tended on-chip RAM, the XHPIA bit of the HPIC register must be set to one for
proper autoincrement operation.
4-11
4.3.4 HPI-8 Control Register Bits and Functions
The bits of the HPIC register control and monitor HPI-8 operation. These bits
are: BOB (selects first or second byte as most significant), DSPINT and HINT
(can be used to generate ’54x and host interrupts, respectively), XHPIA (used
by the host to access extended addresses), and HPIENA (indicates HPI-8 en-
abled or disabled status). Table 4−5 presents a detailed description of the
HPIC bit functions.
BOB 0 Byte-order bit. This bit determines the placement for the two bytes of a transfer. If
BOB = 1, the first byte of a transfer is least significant. If BOB = 0, the first byte is most
significant. This bit can only be accessed (written or read) by the host, and it must be
initialized before the first data or address register access.
DSPINT 0 Host-to-’54x interrupt. When the host writes a 1 to this bit, a ’54x interrupt is generated.
The bit can only be written to by the host, and is always read as 0 by both the host and
the ’54x. When the host writes to HPIC, both bytes must write the same value. For a
detailed description of the DSPINT function, see section 4.5 on page 4-24.
HINT 0 ’54x-to-host interrupt. This bit determines the state of the ’54x HINT output, which can
be used to interrupt the host. When the HINT bit is set to 1, the HINT output is driven low,
and when the bit is cleared to 0, the output is driven high. The HINT bit can only be set
by the ’54x, and it can only be cleared by the host. The host clears the bit by writing a
1 to it. For a detailed description of the HINT function, see section 4.5 on page 4-24.
XHPIA X Extended address enable. When XHPIA=1, host writes to the HPIA register are loaded
into the most significant bits HPIA[n:16]. If XHPIA=0, host writes to HPIA are loaded into
HPIA[15:0]. All n+1 address bits are incremented in the autoincrement mode. Reading
the HPIA register is performed in the same manner. Only the host has access to this bit.
HPIENA X HPI enable status bit. This bit latches the reset value of the HPIENA pin, and can be used
by the ’54x to determine if the HPI-8 is enabled or disabled. This bit is not affected by
writes, and is not available to the host.
Note: This bit is not available on all devices. For more details, see the specific HPIC
register diagrams that follow.
4-12
The HPIC is organized on the host side as a 16-bit register with the same high
and low byte contents (although access to certain bits is limited, as described
previously). The upper 8 bits of the HPIC are unused on the ’54x side. The host
accesses the HPIC register using the appropriate selection of HCNTL0/1, and
performs two consecutive byte accesses to the 8-bit HPI-8 data bus. When the
host writes to HPIC, both the first and second byte written must be the same
value. The ’54x accesses the HPIC as a memory-mapped register at address
002Ch in data memory space.
The layout of the HPIC bits is shown in Figure 4−5. In this figure, a zero is spe-
cified for a read operation to indicate that the bit is always read as zero; similar-
ly, an X specifies that the read value for this bit is indeterminate. For write op-
erations, a one is specified to indicate that the bit must only be written with a
one; an X is specified for a write operation to indicate that the bit can be written
with a zero or a one. Note that unused bits are reserved for future expansion
and it is recommended that they be written as zero, unless specified otherwise.
15−13 12 11 10 9 8 7−5 4 3 2 1 0
15−8 7 6−4 3 2 1 0
0 HPIENA‡ 0 HINT 0 X 0
15−4 3 2 1 0
X HINT X 1 X
X denotes bits that are unaffected by writes, or bits that can be read as either 1 or 0.
† This bit is only available on ’54x devices with on-chip RAM mapped in extended addresses.
‡ This bit is not available on the ’5410.
Because the ’54x can write to the HINT bit, which is read twice on the host inter-
face side, the first and second byte reads by the host may yield different data
if the ’54x changes the state of this bit in between the two host read operations.
The characteristics of host and ’54x HPIC read/write cycles are summarized
in Table 4−6.
4-13
Table 4−6. HPIC Host and ’54x Read/Write Characteristics
4-14
4.4 Host Read/Write Access to HPI-8
An HPI-8 transfer is composed of an external portion in which the host ex-
changes data with the HPI-8 registers, and an internal portion in which the
HPI-8 logic exchanges data between the registers and on-chip RAM. The ex-
ternal portion of the transfer always requires two bytes, regardless of the type
of access — HPIA, HPIC, or data access. During the external portion of the
transfer, the host drives the HBIL input low for the first byte, and then high for
the second byte. If the host breaks this sequence of first byte/second byte
(HBIL low/high) during an ongoing HPI-8 transfer, data may be lost and an un-
predictable operation may result. To recover from such a condition, the host
must repeat the access with the correct HBIL polarities for each byte.
Also for each byte, the host controls the duration of the access using the strobe
and select inputs — HDS1, HDS2, and HCS. The derivation of the internal HPI
strobe from these inputs is described in section 4.3, Details of HPI-8 Opera-
tion, on page 4-6. The falling edge of the HPI strobe marks the beginning of
the first or second byte of a transfer. This event usually occurs at the beginning
of the host bus cycle. The rising edge of the HPI strobe marks the end of the
first or second byte of an HPI transfer. This event usually occurs at the end of
the host bus cycle. During the exchange of the second byte, the rising edge
of the HPI strobe marks the end of the external portion of the cycle and initiates
the internal portion of the cycle. Consequently, the HPID value read during the
external portion of a memory read is the contents of the address specified in
the previous access. A typical HPI-8 access is shown in Figure 4−6.
4-15
Figure 4−6. HPI-8 Timing Diagram
Byte 1 Byte 2
HCNTL0/1 Valid Valid
HR/W
HBIL
HCS
HAS
(if used)
Á Á ÁÁ ÁÁ
HDS1,
HDS2
Á Á ÁÁ ÁÁ
Á Á Á ÁÁ Á ÁÁ
HD Valid Valid
read
HD
Á Á Á ÁÁ
Á Á Á ÁÁ
Valid Valid
write
Internal portion
HRDY External portion of transfer of transfer
Internal portion of previous transfer
The cycle begins with the host driving HCNTL0/1, HR/W, HBIL, and HCS, indi-
cating the type of transfer and whether the cycle is to be a read or write. Then
the host asserts the HAS signal (if used) followed by one of the data strobe
signals. If HRDY is not already high, it goes high when the previous internal
cycle is complete, allowing data to be transferred. Following the external HPI-8
cycle, HRDY goes low (HPI-8 not ready) and stays low while the internal por-
tion of the transfer is accomplished. HRDY then switches high again when the
internal portion of the cycle is complete. You should note, however, that HRDY
is always high when HCS is high.
4-16
4.4.1 Latency of HPI-8 Accesses
HPI-8 access time is composed of the time required for the external portion of
a transfer and the time required for the internal portion. The time required for
the external portion of an HPI-8 transfer is a fixed delay based on the setup
times, hold times, and buffer delay times of the various signal pins. The internal
delay of an HPI-8 transfer usually accounts for the majority of the access time
and is related to the ’54x clock frequency. This internal delay varies depending
on the type of access. An accurate analysis of the HPI-8 access time requires
consideration of both the internal and external delays. Because the HPI strobe
edges define the boundaries of an access, analysis of the timing requirements
for these signals is sufficient. The timing requirements for HDS1,2 are given
in the device-specific data sheets, and these timings incorporate both the ex-
ternal and internal delays of an HPI-8 access. The relationship between the
HPI-8 internal access delay and the ’54x clock rate is explained in the para-
graphs that follow.
- Write accesses to the HPIC register with the HINT and DSPINT bits written
as zeros
These accesses only exchange data between the host and the internal regis-
ters, so no additional internal access time is required. The HRDY signal is nev-
er driven low for these accesses, since another HPI-8 access can begin as
soon as the external portion of the access is complete.
Write accesses to the HPIC register with a one written to either the HINT or
DSPINT bits have a longer latency. These accesses require some time after
the external portion of the transfer completes for the internal interrupt logic of
the HPI-8 to perform its function. The HRDY signal is held low for approximate-
ly three ’54x clock cycles during the internal portion of these accesses.
The slowest and most common HPI-8 accesses are memory accesses. A write
access to the HPIA register, or a read/write access to the HPID register, initi-
ates an internal memory transfer that exchanges the desired data between the
HPID and the on-chip ’54x memory. This process requires several ’54x clock
cycles each time an HPI-8 memory access is made. The minimum time re-
quired for the internal portion of an HPI-8 memory transfer is five ’54x clock
cycles.
4-17
The maximum duration for the internal portion of an HPI-8 memory transfer de-
pends on several factors. The HPI-8 and direct memory access (DMA) control-
ler share the DMA bus for internal memory accesses, and only one of the mod-
ules can access the bus at a time. (For more details on the DMA controller, see
Chapter 3.) When HPI-8 accesses and DMA controller accesses contend for
bus usage, internal arbitration logic resolves the conflict. If the HPI-8 and DMA
controller initiate an access at the same time, the HPI-8 has priority and the
DMA controller transfer is postponed for one ’54x clock cycle. If the HPI-8
initiates an access while a DMA transfer is in progress, the HPI-8 access is
delayed (HRDY stays low) until the current word of the DMA transfer is com-
plete. This delay time, during which the host waits for the DMA controller, de-
pends on the type of DMA transfer in progress. The internal delay for each of
the HPI-8 access types are summarized in Table 4−7.
Because the HPI-8 access times vary by access type, the host should always
sample the HRDY output to adjust its bus cycle time for the varying HPI-8 rate.
This sampling can be accomplished by connecting HRDY to the host READY
input (if available) to generate host wait-states. Alternatively, the host bus
cycle time can be set to the slowest possible HPI-8 access time. The function
of HRDY for the various HPI-8 access types is summarized in Table 4−8.
4-18
Table 4−8. Wait-State Generation Conditions
HPIA No Yes
Due to the prefetch nature of internal HPI-8 accesses, special care must be
taken under certain conditions. During random (non-sequential) transfers, or
sequential accesses with a significant amount of time between them, it is pos-
sible for the ’54x to change the contents of the location being accessed during
the time between a host read and the previous host access. If this occurs, the
data read may be different from the actual memory contents being accessed.
Where this is of concern in a system, two reads from the same address, or an
address write prior to the read access, can be made to ensure that the most
recent data is read.
4-19
4.4.2 Access Sequence Examples
Before accessing data, the host must first initialize HPIC, in particular BOB (bit
0 and bit 8), and then the HPIA register. The initialization must occur in this or-
der because the state of BOB affects the HPIA register access.
On devices with extended on-chip RAM, the host should also initialize the
XHPIA bit of the HPIC before accessing the HPIA register. The XHPIA bit can
be initialized in the same write access to the HPIC that initializes BOB. By writ-
ing a one to the XHPIA bit, the host gains access to the seven extended HPI
addresses. The host then writes the HPIA register with the seven LSBs desig-
nating the value of the extended addresses (HPIA 16:22). When initializing the
extended HPI addresses, the same value should be written for the first and
second bytes of the access. After initializing the extended addresses, the host
must perform another access to the HPIC, writing a zero in the XHPIA bit to
regain access to the lower sixteen address bits in the HPIA register. The ex-
tended address feature is discussed in more detail in section 4.3.2. on page
4-10.
After initializing BOB, the host can then write to the HPIA register with the cor-
rect byte alignment. When the host writes to the HPIA, the on-chip ’54x
memory is automatically read and the contents at the given address are trans-
ferred to the two 8-bit data latches — the first and second bytes of the HPID
register.
Table 4−9 illustrates the sequence involved in initializing the BOB and XHPIA
bits of the HPIC and HPIA registers for an HPI-8 memory read. Note that the
first six rows of the table show the initialization of the extended address fea-
ture, which is only required for devices with extended on-chip RAM. In this ex-
ample, BOB is set to zero and a read is requested of the first on-chip memory
location (in this case 0060h) which contains FFFEh.
4-20
Table 4−9. Initialization of BOB and HPIA
HPID
In the example shown in Table 4−9, the BOB and XHPIA bits of HPIC are initial-
ized first; then the write access to the seven LSBs of the HPIA register initial-
izes the extended HPI address bits. The first and second bytes of this write ac-
cess must write the same values for proper initialization of the extended HPI
address bits. Notice that the write access to the HPIA register automatically
initiates an internal read access; however, the data read is indeterminate be-
cause the lower sixteen address bits are not yet initialized. These steps are
only required for devices with extended on-chip RAM.
4-21
Next, the host initializes the lower 16 address bits by writing a zero to the
XHPIA bit and writing the 16-bit address to the HPIA register. As before, writing
to the HPIA register automatically initiates an internal HPI-8 memory access.
This time, all address bits are initialized so the internal read retrieves the con-
tents of the specified memory location. The last line of Table 4−9 shows the
condition of the HPI-8 after the internal RAM read is complete. That is, after
a delay following the end of the HPIA register write, the read is completed and
the data is placed in the HPID register. The host must perform an additional
read of HPID to actually retrieve this data. The sequence involved in this ac-
cess is shown in Table 4−10.
In the access shown in Table 4−10, the data obtained from reading HPID is the
data from the read initiated in the previous cycle (the one shown in Table 4−9).
During this HPID read access, the contents of the first byte data latch are driv-
en on the HD pins when HBIL is low, and the contents of the second byte data
latch are driven on the HD pins when HBIL is high. The access performed in
Table 4−10 also initiates another read of location 0061h (because autoincre-
ment was specified in this access by setting HCNTL1/0 to 01). When autoin-
crement is selected, the increment occurs with each 16-bit word transferred
(not with each byte); therefore, as shown in Table 4−10, the HPIA is increm-
ented by one. The last line of Table 4−10 indicates that after some delay follow-
ing the read of the second byte, the contents of location 0061h (6ABCh) are
read and placed in the HPID register.
During a write access to the HPI, the first byte data latch is overwritten by the
data coming from the host while the HBIL pin is low, and the second byte data
latch is overwritten by the data coming from the host while the HBIL pin is high.
At the end of this write access, the bytes in both data latches are transferred
as a 16-bit word to the on-chip RAM at the address specified by the HPIA regis-
ter. The address is incremented prior to the memory write if autoincrement is
selected.
4-22
An HPI write access is illustrated in Table 4−11. In this example, autoincrement
is enabled and the HPIA register is incremented before the write occurs (prein-
cremented). Because the previous read access caused a postincrement of the
HPIA register, address 0061h is skipped. After the internal portion of the write
is completed, location 0062h of on-chip RAM contains 1234h. If a read of ad-
dress 0062h follows this write, the same data (1234h) is read back.
4-23
4.5 DSPINT and HINT Operation
The host and the ’54x can interrupt each other using bits in the HPIC register.
The sections that follow explain this process.
On the ’54x, the host-to-’54x interrupt vector address is xx64h. This interrupt
is located in bit nine of the IMR/IFR registers. Because the ’54x interrupt vec-
tors can be re-mapped into the on-chip RAM, the host can instruct the ’54x to
execute pre-programmed functions by initializing the DSPINT interrupt vector.
When the ’54x interrupts are re-mapped to on-chip RAM, the host can: 1) write
the opcode for a branch instruction at address xx64h, and 2) write the start ad-
dress of a function at address xx65h in the interrupt vector table prior to inter-
rupting the ’54x. When using this technique, care must be taken to prevent the
host from corrupting the other interrupt vectors.
4-24
4.6 Considerations for HPI-8 Transfers While Changing Clock Modes
Unlike the standard 8-bit HPI, the HPI-8 does not include an asynchronous
host-only mode (HOM). All HPI-8 transfers are synchronized to the ’54x clock.
This requires special considerations for HPI-8 transfers while changing clock
modes because a change in the ’54x clock frequency causes a change in the
HPI-8 access rate. For more information on changing the ’54x clock generator
modes, refer to TMS320C54x DSP Reference Set, Volume 1: CPU and Pe-
ripherals (literature number SPRU131). The relationship between the ’54x
clock rate and the HPI-8 access rate is described in section 4.4.1 on page 4-17.
When the ’54x clock mode is changed from PLL mode to DIV mode, the result-
ing clock rate is slower, and the HPI-8 access rate is also slower. In this case,
the host can use the HRDY output to generate wait-states and adjust to the
change in access rate. An example of HPI-8 accesses while changing from
multiply-by-1 (MULT1) clock mode to divide-by-2 (DIV2) clock mode is shown
in Figure 4−7.
CLKIN
CLKOUT
HDS1,2
HRDY
ÁÁ ÁÁÁÁ Byte 1
Á Byte 1
ÁÁÁ
HD[0:7]
Host
wait-
ÁÁ ÁÁÁÁ
Host
wait-
Host
wait-
Byte 2 Host
wait-
Host
wait-
HostÁ
wait-
Host
wait-
ÁÁÁByte 2
In the example shown in Figure 4−7, the difference in the ’54x clock frequency
before and after switching clock modes is only a factor of two, and the resulting
effect on HPI-8 access time is small. In this case, the host can compensate for
the change in access rate with one additional wait-state. When higher clock
multiply ratios are used, switching to a divide-by mode causes a significant de-
crease in the HPI-8 access rate, and several additional host wait-states may
be required.
4-25
When the ’54x clock generator is switched from a divide-by mode to a multiply
mode, the resulting ’54x clock rate and HPI-8 access rate are increased. In this
case, if host wait-states are generated using HRDY, then the host automatical-
ly reduces the number of wait-states in a similar manner to that shown in
Figure 4−7. If the resulting HPI-8 access rate is faster then the host bus cycle,
then no wait-states are required and the host bus-cycle time defines the new
access rate.
4-26
4.7 Considerations in IDLE Use
The HPI-8 allows the host to access on-chip RAM while the ’54x is in an IDLE
mode. The only requirement for HPI-8 access during these modes is that the
’54x input clock (CLKIN) must remain active. For more information on the IDLE
modes of the ’54x, refer to the TMS320C54x DSP Reference Set, Volume 1:
CPU and Peripherals (literature number SPRU131).
Because the IDLE1 and IDLE2 modes do not affect the ’54x clock, no special
considerations are required for HPI-8 transfers during these modes. However,
in some cases, you may wish to disable the PLL circuit prior to initiating these
power-down modes to further reduce power consumption. In these cases, the
HPI-8 access rate is affected and special considerations must be made. For
more information on considerations for HPI-8 usage during clock mode
changes, refer to section 4.6 on page 4-25.
The HPI-8 access rate is usually affected by the IDLE3 power-down mode
because this mode affects the internal clock generation circuitry of the ’54x.
When the ’54x enters the IDLE3 mode, the on-chip clock generator is disabled
and HPI-8 accesses are automatically synchronized to the input clock source
(CLKIN). The host can continue to access the HPI-8 while the ’54x is in the
IDLE3 mode as long as an active clock is applied to the ’54x CLKIN pin. HPI-8
accesses remain synchronized to CLKIN until the ’54x is taken out of IDLE3
mode. After the ’54x is taken out of IDLE3 mode by an interrupt source, HPI-8
accesses are automatically synchronized to the output of the ’54x clock gener-
ator. If the clock generator is configured in PLL mode, HPI-8 accesses remain
synchronized to the input source until the PLL lock timer counts down. For
more information on the ’54x clock generator and programmable lock timer,
refer to TMS320C54x DSP Reference Set, Volume 1: CPU and Peripherals
(literature number SPRU131).
When the ’54x enters the IDLE3 mode while a clock multiply ratio of one is se-
lected, the HPI-8 access rate remains the same (×1) during IDLE3. Also, if the
clock generator is configured in DIV (divider) mode when the ’54x enters
IDLE3, then the HPI-8 access rate is increased (×1) while the ’54x is in IDLE3.
In both of these cases, no special considerations are required because the
HPI-8 access rate is neither unaffected nor improved during IDLE3.
4-27
When the ’54x enters IDLE3 mode while a clock multiply ratio greater than one
is selected, the HPI-8 access rate is reduced. In this case, the host can use
the HRDY output to generate additional wait-states and adjust to the change
in access rate. An example of this case is shown in Figure 4−8.
PLL DISABLED
MULT2 clock mode MULT2 clock mode
CLKIN
CLKOUT
HDS1,2
In Figure 4−8 the clock generator is configured in PLL mode with a multiply ra-
tio of two when the ’54x enters IDLE3 mode. HPI-8 accesses are automatically
synchronized to the input clock source, and the host must insert an additional
wait-state for memory accesses based on the state of the HRDY pin. The fig-
ure also shows that HPI-8 accesses are automatically re-synchronized to the
faster clock after the ’54x is taken out of IDLE3 mode and the clock generator
stabilizes.
4-28
4.8 Effects of Reset on HPI-8 Operation
HPI-8 operation is affected when the ’54x device is reset. This section de-
scribes the effect of reset on the HPI-8 operation.
When HOM is used during reset, it is often convenient for the host to control
the ’5410 reset input. The sequence of events for resetting the ’5410 and
downloading a program to on-chip RAM while the ’5410 is in reset is summa-
rized in Table 4−12.
4-29
Table 4−12. HPI-8 Operation During RESET (’5410 only)
Host ’5410 Mode ’5410 CLK
Waits 6 ’5410 clock periods Running X Running
Brings RESET low and waits 4 clocks Goes into reset HOM Running
Writes program and/or data in on-chip RAM In reset HOM Stopped or running
Initially, the host stops accessing the HPI-8 at least six ’5410 clock periods be-
fore driving the ’5410 reset line low. The host then drives the ’5410 reset line
low and can start accessing the HPI-8 after a minimum of four ’5410 clock
periods. The HPI-8 mode is automatically set to HOM during reset, allowing
a high-speed program download. The ’5410 clock can even be stopped at this
time; however, the clock must be running when the reset line falls and rises for
proper reset operation of the ’5410.
Once the host has finished downloading into on-chip RAM, the host stops ac-
cessing the HPI-8 and drives the ’5410 reset line high. At least 20 ’5410 peri-
ods after the reset line rising edge, the host can again begin accessing the
HPI-8. This number of periods corresponds to the internal reset delay of the
’5410. The HPI-8 mode is automatically set to SAM upon exiting reset. If the
host writes a one to DSPINT while the ’5410 is in reset, the interrupt is lost
when the ’5410 comes out of reset. The ’5410 HPI-8 boot mode can then be
used to start execution from address 02000h.
4-30
4.9 HPI-8 Data Pins as General Purpose I/O Pins (Not Available on ’5410)
The 8-bit bidirectional data bus of the HPI-8 can be used as general-purpose
input/output (GPIO) pins. This feature is only available when the HPI-8 is dis-
abled; that is, when the HPIENA pin is driven low during reset. Two memory-
mapped registers are used to control the GPIO function of the HPI-8 data pins:
the general-purpose I/O control register (GPIOCR), and the general-purpose
I/O status register (GPIOSR). The GPIOCR is shown in Figure 4−9, and its bits
are described in Table 4−13.
The direction bits (DIRx) of the GPIOCR are used to configure HD0-HD7 as
inputs or outputs. The timer1 output bit (TOUT1) is available on devices that
include two timers to enable the timer1 output on the HINT pin. When the HPI-8
is enabled, the TOUT1 bit and DIRx bits are forced to zero, and the general
purpose I/O feature functions in input mode only.
Figure 4−9. General Purpose I/O Control Register (GPIOCR) MMR Address 003Ch
15 14 8
TOUT1† rsvd
R/W−0
7 6 5 4 3 2 1 0
DIR7 DIR6 DIR5 DIR4 DIR3 DIR2 DIR1 DIR0
R/W−0 R/W−0 R/W−0 R/W−0 R/W−0 R/W−0 R/W−0 R/W−0
† Only available on devices with a second on-chip timer.
Note: R = Read, W= Write
Table 4−13. General Purpose I/O Control Register (GPIOCR) Bit Functions
Reset
No. Name Value Function
15 TOUT1 0 Timer1 output enable bit. The TOUT1 bit enables or disables the timer1
output on the HINT pin. The timer1 output is only available when the HPI-8
is disabled. Note, this bit is reserved on devices that have only one timer.
7 DIR7 0 I/O pin 7 direction bit. DIR7 configures the HD7 pin as input or output.
4-31
Table 4−13. General Purpose I/O Control Register (GPIOCR) Bit Functions
(Continued)
Reset
No. Name Value Function
DIR7 = 1 The HD7 pin is configured as an output. When the HPI-8 is
enabled, this bit is forced to 0, and is not affected by writes.
6 DIR6 0 I/O pin 6 direction bit. DIR6 configures the HD6 pin as input or output.
5 DIR5 0 I/O pin 5 direction bit. DIR5 configures the HD5 pin as input or output.
4 DIR4 0 I/O pin 4 direction bit. DIR4 configures the HD4 pin as input or output.
3 DIR3 0 I/O pin 3 direction bit. DIR3 configures the HD3 pin as input or output.
2 DIR2 0 I/O pin 2 direction bit. DIR2 configures the HD2 pin as input or output.
1 DIR1 0 I/O pin 1 direction bit. DIR1 configures the HD1 pin as input or output.
0 DIR0 0 I/O pin 0 direction bit. DIR0 configures the HD0 pin as input or
output.
4-32
Table 4−13. General Purpose I/O Control Register (GPIOCR) Bit Functions
(Continued)
Reset
No. Name Value Function
DIR0 = 0 The HD0 pin is configured as an input.
The status of the GPIO pins (HDx, x=0:7) can be monitored using the bits of
the general purpose I/O status register (GPIOSR). When an HDx pin is config-
ured as an input (by writing a one to the DIRx bit of the GPIOCR), the corre-
sponding bit in the GPIOSR can be read to determine the logic value sensed
at the pin. Similarly, when an HDx pin is configured as an output, the logic value
to be driven by the pin is written to the corresponding bit in the GPIOSR. The
GPIOSR is shown in Figure 4−10, and its bits are described in Table 4−14.
Figure 4−10. General Purpose I/O Status Register (GPIOSR) MMR address 003Dh
15 8
rsvd
7 6 5 4 3 2 1 0
IO7 IO6 IO5 IO4 IO3 IO2 IO1 IO0
R/W−x R/W−x R/W−x R/W−x R/W−x R/W−x R/W−x R/W−x
Note: R = Read, W= Write
† Note, when the HD pins are configured as inputs, writes to the IOx bits have no effect.
Table 4−14. General Purpose I/O Status Register (GPIOSR) Bit Functions
Reset
No. NAME Value Function
15−8 rsvd 0 These pins are reserved, and unaffected by writes.
7 IO7 X IO7 - I/O pin 7 status bit. This bit reflects the logic level on the HD7 pin. When
the HD7 pin is configured as an input (DIR7 = 0 in the GPIOCR), the IO7 bit
latches the logic value of the pin (1 or 0). Writes to the IO7 bit have no effect
when the HD7 pin is configured as an input. When the HD7 pin is configured
as an output (DIR7 = 1 in GPIOCR), the HD7 pin is driven to the logic level
written in the IO7 bit (1 or 0).
IO7 = 0 The HD7 input is externally driven low, or the HD7 output is
internally driven low.
4-33
Table 4−14. General Purpose I/O Status Register (GPIOSR) Bit Functions
(Continued)
Reset
No. NAME Value Function
IO7 = 1 The HD7 input is externally driven high, or the HD7 output is
Internally driven high.
4-34
Table 4−14. General Purpose I/O Status Register (GPIOSR) Bit Functions
(Continued)
Reset
No. NAME Value Function
6 IO6 X IO6 - I/O pin 6 status bit. This bit reflects the logic level on the HD6 pin. When
the HD6 pin is configured as an input (DIR6 = 0 in the GPIOCR), the IO6 bit
latches the logic value of the pin (1 or 0). Writes to the IO6 bit have no effect
when the HD6 pin is configured as an input. When the HD6 pin is configured
as an output (DIR6 = 1 in GPIOCR), the HD6 pin is driven to the logic level
written in the IO6 bit (1 or 0).
IO6 = 0 The HD6 input is externally driven low, or the HD6 output is
internally driven low.
IO6 = 1 The HD6 input is externally driven high, or the HD6 output is
Internally driven high.
5 IO5 X IO5 - I/O pin 5 status bit. This bit reflects the logic level on the HD5 pin. When
the HD5 pin is configured as an input (DIR5 = 0 in the GPIOCR), the IO5 bit
latches the logic value of the pin (1 or 0). Writes to the IO5 bit have no effect
when the HD5 pin is configured as an input. When the HD5 pin is configured
as an output (DIR5 = 1 in GPIOCR), the HD5 pin is driven to the logic level
written in the IO5 bit (1 or 0).
IO5 = 0 The HD5 input is externally driven low, or the HD5 output is
internally driven low.
IO5 = 1 The HD5 input is externally driven high, or the HD5 output is
Internally driven high.
4 IO4 X IO4 - I/O pin 4 status bit. This bit reflects the logic level on the HD4 pin. When
the HD4 pin is configured as an input (DIR4 = 0 in the GPIOCR), the IO4 bit
latches the logic value of the pin (1 or 0). Writes to the IO4 bit have no effect
when the HD4 pin is configured as an input. When the HD4 pin is configured
as an output (DIR4 = 1 in GPIOCR), the HD4 pin is driven to the logic level
written in the IO4 bit (1 or 0).
IO4 = 0 The HD4 input is externally driven low, or the HD4 output is
internally driven low.
IO4 = 1 The HD4 input is externally driven high, or the HD4 output is
Internally driven high.
4-35
Table 4−14. General Purpose I/O Status Register (GPIOSR) Bit Functions
(Continued)
Reset
No. NAME Value Function
3 IO3 X IO3 - I/O pin 3 status bit. This bit reflects the logic level on the HD3 pin. When
the HD3 pin is configured as an input (DIR3 = 0 in the GPIOCR), the IO3 bit
latches the logic value of the pin (1 or 0). Writes to the IO3 bit have no effect
when the HD3 pin is configured as an input. When the HD3 pin is configured
as an output (DIR3 = 1 in GPIOCR), the HD3 pin is driven to the logic level
written in the IO3 bit (1 or 0).
IO3 = 0 The HD3 input is externally driven low, or the HD3 output is
internally driven low.
IO3 = 1 The HD3 input is externally driven high, or the HD3 output is
Internally driven high.
2 IO2 X IO2 - I/O pin 2 status bit. This bit reflects the logic level on the HD2 pin. When
the HD2 pin is configured as an input (DIR2 = 0 in the GPIOCR), the IO2 bit
latches the logic value of the pin (1 or 0). Writes to the IO2 bit have no effect
when the HD2 pin is configured as an input. When the HD2 pin is configured
as an output (DIR2 = 1 in GPIOCR), the HD2 pin is driven to the logic level
written in the IO2 bit (1 or 0).
IO2 = 0 The HD2 input is externally driven low, or the HD2 output is
internally driven low.
IO2 = 1 The HD2 input is externally driven high, or the HD2 output is
Internally driven high.
1 IO1 X IO1 - I/O pin 1 status bit. This bit reflects the logic level on the HD1 pin. When
the HD1 pin is configured as an input (DIR1 = 0 in the GPIOCR), the IO1 bit
latches the logic value of the pin (1 or 0). Writes to the IO1 bit have no effect
when the HD1 pin is configured as an input. When the HD1 pin is configured
as an output (DIR1 = 1 in GPIOCR), the HD1 pin is driven to the logic level
written in the IO1 bit (1 or 0).
IO1 = 0 The HD1 input is externally driven low, or the HD1 output is
internally driven low.
IO1 = 1 The HD1 input is externally driven high, or the HD1 output is
Internally driven high.
4-36
Table 4−14. General Purpose I/O Status Register (GPIOSR) Bit Functions
(Continued)
Reset
No. NAME Value Function
0 IO0 X IO0 - I/O pin 0 status bit. This bit reflects the logic level on the
HD0 pin. When the HD0 pin is configured as an input (DIR0 = 0
in the GPIOCR), the IO0 bit latches the logic value of the pin (1
or 0). Writes to the IO0 bit have no effect when the HD0 pin is
configured as an input. When the HD0 pin is configured as an
output (DIR0 = 1 in GPIOCR), the HD0 pin is driven to the logic
level written in the IO0 bit (1 or 0).
IO0 = 0 The HD0 input is externally driven low, or the HD0 output is
internally driven low.
IO0 = 1 The HD0 input is externally driven high, or the HD0 output is
Internally driven high.
.text
STM #0F0h, GPIOCR ;Configure HD0-3 as in, and
;HD4-7 as out.
. . .
LDM GPIOSR, A ;Get GPIOSR value.
AND #0Fh, A ;Mask off MSBs.
STLM A, AR3 ;Store value of HD0-3 in AR3.
STM #050h, GPIOSR ;Set HD4-7 to 0101b.
. . .
In this example, the four LSBs of the HPI data bus (HD0−3) are configured as
general purpose inputs, while the four MSBs (HD4−7) are configured as out-
puts. The status of HD0−3 is read and stored in AR3; then the HD4−7 MSBs
are set to 0101b.
4-37
Chapter 5
The enhanced 16-bit host port interface, also referred to as HPI-16, is an im-
proved version of the HPI designed to interface a variety of host processors
to the ’54x.
Topic Page
5-1
5.1 HPI-16 Operational Overview
The HPI uses a parallel bus interface that provides a host processor with ac-
cess to internal DSP memory. The HPI is used to transfer data between the
host and DSP allowing data buffering, real-time data logging, and message
processing.
The HPI-16 is an enhanced 16-bit version of the ‘54x 8-bit host port interface
that, like its predecessors, functions as a slave and allows the host processor
to access internal memory without DSP CPU intervention. It provides a full
16-bit bi-directional data bus that does not require byte identification. In addi-
tion, only one host transfer is required to complete the access.The HPI-16 was
designed to interface a wide variety of host processors to a TMS320 DSP.
- 16-bit address bus for direct connection to the host address bus (18-bit ad-
dress bus on the ’VC5420).
- Flexible interface that includes several strobe and control signals suitable
for a variety of 16-bit hosts.
- Memory accesses that are synchronized with the direct memory access
(DMA) controller providing access to the complete internal memory ad-
dress range.
There are two strobe inputs and an HPI select pin available for interfacing.
These three input pins control the strobing of the HPI peripheral. The internal
strobing logic, which is referred to as internal HSTRB throughout this chapter,
functions as the actual strobe signal to the HPI peripheral.
5-2
As illustrated in Figure 5−1, the strobing logic is a function of three key strobe
inputs — HCS, HDS1 and HDS2. The HCS, also known as the HPI chip select
pin, must be low during strobe activity on the HDS pins. If HCS remains high,
activity on the HDS pins is ignored and the HRDY pin goes high. The HRDY
signal provides feedback to the host regardless of whether the current transfer
is completed (HRDY goes high). Therefore, if the host is much slower than the
HPI access and HRDY is not needed, HCS and one HDS strobe input can be
tied together. This effectively chip-selects the HPI and provides the strobe si-
multaneously.
Internal
HCS HSTRB
HRDY Internal
HRDY signal
There are several ways to interface to a host, but all interfacing schemes fall
into two general modes of operation: multiplexed and non-multiplexed. Multi-
plexed operation allows the host processor to control the HPI operation via two
control signals called HCNTL0 and HCNTL1, while non-multiplexed mode per-
forms data read/writes using only the HPI address and data buses. The HPI
mode is hardware configurable using the HMODE pin. Multiplexed mode is se-
lected when HMODE = 0.
Some devices may or may not support HMODE. You should refer to the de-
vice-specific data sheet to determine if both modes are supported. Table 5−1
contains a list of all possible HPI-16 pins and a description of their functions.
5-3
Table 5−1. HPI-16 Pin Descriptions
HPI-16 I/O/Z
Signal State† Host Connection Signal Description
HMODE I Usually static and tied high or HPI mode select pin. The logic level of HMODE
low. determines the operational mode of the HPI. A logic
level 0 selects multiplexed mode (HCNTL0/1 are
required). Logic level 1 selects non-multiplexed mode.
This is a device-specific pin. To determine if HMODE is
supported, see the device-specific data sheet.
HAS I ALE − Address latch enable or Address strobe. Used only in multiplexed mode. Host
address strobe with multiplexed address/data buses connect this pin to
their ALE. The falling edge of this input signal is used
to latch the logic levels of the HR/W, HCNTL0, and
HCNTL1 pins. When used, the HAS signal must
precede an active strobe (HCS or HDS). Hosts with
separate address/data buses must tie this signal high.
As a result, the HR/W, HCNTL0, and HCNTL1 inputs
are latched on the falling edge of HDS when HCS = 0.
HCS I Address or select line HPI chip select. Serves as an HPI select input. HCS
must be low for the HPI module to be selected. HCS
may stay low between accesses. HCS normally
precedes an active HDS strobe, but can be connected
to an HDS for simultaneous select and strobe. For an
illustration of the internal HPI strobing logic, see
Figure 5−1.
HDS1 I Read strobe and write strobe HPI data strobe pins. Used for strobing data in/out of
HDS2 or any data strobe. the HPI module. The direction depends on the logic
level of HR/W signal. The HDS signals are also used to
latch control information (if HAS is tied high) on the
falling edge. During an HPID write access, data is
latched into the HPID register on the rising edge of
HDS. During read operations, these pins act as
output-enables of the data bus.
HR/W I R/W strobe HPI read/write signal. Indicates to the HPI on the falling
edge of HAS or HDS whether the current access is to
be a read or write operation. A logic 1 indicates the
transfer is a read-from-HPI operation, while a logic 0 is
a write-to-HPI.
† I = Input, O = Output, Z = High-impedance
5-4
Table 5−1. HPI-16 Pin Descriptions (Continued)
HPI-16 I/O/Z
Signal State† Host Connection Signal Description
HCNTL0 I Address or control lines. HPI access control inputs. The logic level of these pins
HCNTL1 is latched-in on the falling edge of HAS or HDS. The
four binary states of these pins determine the access
mode of the current transfer (i.e. HPIC, HPIDinc, HPIA,
and HPID).
HA[n:0] I Host address bus HPI address bus. The n+1pins must be connected to
the host address bus if the HPI is to operate in
non-multiplexed mode. However, these pins can be
tied to a logic level if the host has a multiplexed
address/data bus and uses the HCNTL0/1 pins in
multiplexed mode. The n value may vary depending on
the DSP address range. For example, the ’VC5420
DSP has an 18-bit address range (A17:A0); therefore,
n = 17.
HD[15:0] I/O/Z Host 16-bit data bus HPI data bus. The HPI data bus is 16-bits wide and
carries the data to/from the HPI module. These pins are
Hi-Z when EMU1/OFF is active-low or when there are
no read accesses occurring.
HRDY O/Z Asynchronous ready input. HPI ready signal. Logic level 1 indicates the current
transfer is complete. Logic level 0 indicates the HPI is
not ready for the next access. The host must wait until
HRDY goes high. The logic level can be
software-polled by reading the HRDY bit in the HPIC
register. The HRDY signal is forced high when HCS
goes high. The pin is Hi-Z when EMU1/OFF is
active-low.
HINT O/Z Host interrupt pin. Host Interrupt. The DSP can interrupt the host
processor by writing a 1 to the HINT bit of the HPIC
register. Before subsequent HINT interrupts can occur,
the host must clear previous interrupts by writing a 1 to
the HINT bit of the HPIC register. This pin is driven high
when the DSP is in reset. This pin is active-low and
inverted from the HINT bit value in the HPIC register.
The pin is Hi-Z when EMU1/OFF is active-low.
HPIRS I Control pin or tied high/low. HPI reset pin. Places the HPI module in reset. No HPI
accesses can occur, HD[15:0] are placed into the
high-impedance state.
This is a device-specific pin. To determine if HPIRS is
supported, see the device-specific data sheet.
† I = Input, O = Output, Z = High-impedance
5-5
Table 5−1. HPI-16 Pin Descriptions (Continued)
HPI-16 I/O/Z
Signal State† Host Connection Signal Description
HPIENA I Normally tied to VCC HPI enable. The HPIENA pin is used to completely
deselect the HPI by shutting the module off. Connecting
this pin to ground deactivates the HPI module and
consumes no power. Otherwise, this pin should be tied
to +VCC.
This is a device-specific pin. To determine if HPIENA is
supported, see the device-specific data sheet.
HPI16 I Usually static and pulled high HPI16 select pin. This pin allows the HPI to support
or low 8-bit host (0) or 16-bit hosts (1). For information on the
8-bit operation, see Chapter 4.
This is a device specific pin. To determine if HPI-16 is
supported, see the device-specific data sheet.
† I = Input, O = Output, Z = High-impedance
5-6
5.2 Multiplexed Mode
In multiplexed mode, the HPI operates with the HCNTL0/1 pins and is used
for hosts that require the use of host/DSP interrupts, or when the address and
data lines of the host are multiplexed. A host may control the HCNTL0/1 and
HR/W pins in two ways. The first case is when the host drives the HCNTL0/1
and HR/W pins with dedicated output or address pins. In this case, the
HCNTL0/1 and HR/W logic levels are latched on the falling edge of the host
driven strobe (HDS) signal. The second case is when a host has a multiplexed
address and data bus. Since there is no dedicated address bus, the host uses
the same bus to drive the control signals as it does for the data access. As a
result, the HCNTL0/1 and HR/W signals are latched using the HPI HAS signal
allowing time for the host to subsequently perform a write or read operation.
Figure 5−2 shows a typical block diagram of a host controlling the HPI in multi-
plexed mode using HAS.
HOST HPI-16
HD[15:0]
Data[15:0]
Internal memory
HPID[15:0]
HCNTL0 DMA
Access
Address HCNTL1 HPIA[17:0]
Mode
Inc Mode
HPIC[15:0]
ALE HAS
R/W HR/W
Data HDS1, HDS2, HCS
strobes DSPINT
HINT ’54x
IRQ CPU
HRDY
READY
Notice that Figure 5−2 shows only one data bus and no address bus. The
HCNTL and HR/W signals are driven by the host data bus and latched using
the address latch enable pin connection to HAS. Figure 5−2 and Table 5−2
illustrate how the HCNTL0/1 signals control the HPI. Higher data throughput
can be achieved by initializing the HPIA register once, and then performing
contiguous data memory accesses using the HPIA increment mode.
5-7
Table 5−2. HCNTL0/1 Modes
The HPIC register is accessible by the host processor and the DSP CPU.
Table 5−3 lists the bit-fields and a description of each.
Table 5−3. HPIC Bit Descriptions
Access By
Bit Host DSP Description
DSPINT R−0/W R−0 Host-to-DSP interrupt. The host can interrupt the DSP by writing a 1 to DSPINT.
This bit is always read as 0 by the host and DSP. DSP writes to this bit have no
effect.
HINT R/W−1 R/W−1 DSP-to-host interrupt. The DSP writes a 1 to the HINT bit to generate a host
interrupt.
The host interrupt HINT bit has an inverted logic level to the HINT pin. The host
must write a 1 to HINT to clear the HINT pin. Writing a 0 to the HINT bit by the host
or DSP has no effect.
HRDY R R The logic level of the HRDY pin appears in this field. The host and DSP can read
this bit for software polling of the HRDY pin. If HRDY = 0, the HPI-16 has not
completed the current data access.
5-8
Table 5−3. HPIC Bit Descriptions (Continued)
Access By
Bit Host DSP Description
FETCH R−0/W R−0 Host data fetch request. When a host writes a 1 to this bit, data located at the
current HPIA address is fetched and loaded into the HPID register. This bit is
always read as 0 by the host and DSP.
XHPIA R/W R Extended address enable. When XHPIA=1, host writes to the HPIA register are
loaded into the most significant bits, HPIA[n:16]. If XHPIA=0, host writes to HPIA
are loaded into HPIA[15:0]. All n+1 address bits are incremented in the
autoincrement mode. Reading the HPIA register is performed in the same
manner. Only the host has access to this bit.
The HPIA register contains the address where the next data access occurs.
The HPIA register is automatically incremented in the HCNTL0/1 = 10b mode.
The FETCH = 1 bit issues a request to read data pointed to by the HPIA regis-
ter. The FETCH bit can be used with the HRDY bit to perform software polling
to determine when the internal access is complete. The FETCH and HRDY
pins are useful when an update to the HPID register is desired. The FETCH
bit is always read as 0. Performing a FETCH does not increment the HPIA reg-
ister.
Interrupts between the host and DSP are possible by setting and polling
DSPINT and HINT bits in the HPIC register. The DSPINT bit, when set to 1 by
the host, posts an interrupt to the DSP CPU. The DSP can process this inter-
rupt if desired by enabling the interrupt in the CPU’s IMR register. The DSP can
post a host interrupt by writing a one to the HINT bit. In this case, the host must
also perform a write to the HINT bit to acknowledge the previous HINT request.
The DSPINT bit is always read as zero. Writing zeros to the HINT and DSPINT
bits has no effect.
The XHPIA bit logic level determines which address bits in the HPIA are initial-
ized. Because the data bus is 16 bits and the address reach is greater than 16
bits (18 bits on the ’VC5420), the XHPIA bit loads the lower 16 bits of the HPIA
when set to zero, and the extended address bits (>16) are loaded when
XHPIA = 1. Initialization of all address bits is recommended before performing
data accesses. XPIA must be changed in the same manner to read the con-
tents on the HPIA register.
5-9
5.2.1 Host Accesses With HAS
The host address strobe (HAS) is only valid in multiplexed mode. The HAS sig-
nal enables glueless interfacing for host processors with multiplexed address
and data buses. The falling edge of HAS is used to latch the HCNTL0/1 and
HR/W states into the HPI. First, the host latches the transfer mode in the HPI
by driving the HCNTL0/1 and HR/W pins to the desired access mode. HAS is
not gated by HCS; and therefore, allows time for the host to perform the subse-
quent access. The HAS signal may be brought high after the HDS is driven low,
indicating the data access is about to occur. HAS is not required to be high,
but must eventually transition high when there is a change in access type.
Figure 5−4 illustrates a write-access using HAS.
HCS
Internal
HSTRB
HAS
HR/W
HCNTL[1:0] 10b
HD[15:0] HPIA
HRDY
Latch access Latch HPIA
type using HAS address
5-10
5.2.2 Host Accesses Without HAS
In cases where the host processor has dedicated signals (or bit I/O) capable
of driving the HCNTL0/1 pins, the HAS signal is not required. These dedicated
signals can be directly connected to the HCNTL0/1 and HR/W pins. This sim-
plifies the access considerably because there is no setup and strobing of the
HCNTL0/1 data relative to HAS. For example, an HPIC read without using
HAS is performed by driving the HCNTL0/1 value (00) and then strobing the
HPI. After the falling edge of the internal HSTRB signal, the HPI drives the
HPIC register data onto the data bus. Figure 5−5 shows the read-access se-
quence without using the HAS signal.
HCS
Internal
HSTRB
HAS
HR/W
HCNTL[1:0] 00
HD[15:0] HPIC
HRDY
Latch access type using
internal HSTRB
5-11
5.2.3 Autoincrement Operation
All of the HPI peripherals include a feature designed to increase the data
throughput of the HPI. This feature, called autoincrement, is used to pre-fetch
data and point to the next higher data location (post-modified) after the current
access is complete. This feature automatically modifies the HPIA register so
that the host can perform consecutive HPI read/write transfers to a contiguous
memory space without having to modify the HPIA register contents. This fea-
ture is enabled when the HCNTL0/1 mode = 01b.
HCS
Internal
HSTRB
HR/W
HCNTL[1:0] 01 01
HRDY
DMA
active
HPIA
register HPIA HPIA + 1 HPIA + 2
HPID
register Valid 1 Valid 2
5-12
Figure 5−7. HPID Write Using Autoincrement
HCS
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
Internal
HSTRB
HR/W
ÁÁ
HCNTL[1:0]
ÁÁ 01 01
HRDY
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
DMA
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
active
HPIA
register HPIA HPIA + 1
HPID
register Valid 1 Valid 2
5-13
Due to the nature of pre-fetching, post-modified reads can cause invalid (old)
data to be read by the host CPU. This occurs when the DSP has updated the
next higher data location after the host has performed a read access. As a re-
sult of the post-modify and pre-fetch mechanism, the next data read by the
host will not have the updated data value. If both DSP and HOST are writing
to the same data locations, it is suggested that FETCH be performed before
reading the data. FETCH is performed by setting the FETCH bit in the HPIC
register. Subsequently, the HPIC register can be read to poll the HRDY bit be-
fore reading the data from the HPI. Figure 5−6 and Figure 5−7 show read and
write operations with the autoincrement feature. For the initial read (with auto-
increment) and for all reads without the autoincrement feature, the HRDY sig-
nal goes not-ready when the access begins (falling edge of internal HSTRB).
Subsequent reads in increment mode perform data pre-fetching, which in-
creases the HPI throughput.
Write operations are always performed on the rising edge of the internal
HSTRB signal. The increased throughput on write operations is realized when
making consecutive writes and using the not-ready state of HRDY to initiate
the next write operation. Since the host must transition and hold HSTRB high
for at least 10ns before making the next write, the hold time can be satisfied
while HRDY is not-ready. This is illustrated in Figure 5−7.
5-14
5.3 Non-Multiplexed Mode
In non-multiplexed mode, hosts with separate address and data buses can ac-
cess the HPI data (HPID) register by using the 16-bit bi-directional data bus
and the HPIA address register via the n-bit address bus. There is no HPIC reg-
ister in the non-multiplexed mode; therefore, no interrupts (DSPINT and HINT)
can be passed between the host and DSP. Due to the fact that a host address
bus is available to drive the HPIA, there is no need for the autoincrement fea-
ture, which precludes the necessity of the FETCH and XHPIA bits. Software
polling of the HRDY is not available, but the HRDY pin is fully functional and
capable of holding off a subsequent host access before the access is com-
pleted internally to the DSP. The HRDY pin functions as previously stated in
the multiplexed mode. Figure 5−8 illustrates how to interface to the HPI in non-
multiplexed mode.
ÎÎ
ÎÎ
ÎÎ
ÎÎ
HOST HPI-16
ÎÎ
HD[15:0]
memory
Data[15:0]
Internal
HPID[15:0]
ÎÎ
ÎÎ
DMA
HA[ n :0]
Address[n:0]
VCC
x
ÎÎ
ÎÎ
HCNTL0
x HCNTL1
HAS
R/W HR/W ’54X
Data strobes HDS1, HDS2, HCS CPU
HRDY
Ready
The HPI select pin (HCS) and strobe signals (HDS1 and HDS2) function as
stated in the multiplexed mode. The HAS, HCNTL0, and HCNTL1 pins are not
included because they have no function in the non-multiplexed mode.
5-15
Figure 5−9. HPID Read in Non-Multiplexed Mode
HCS
Internal
HSTRB
HR/W
Á Á
HD[15:0]
Á HPID contents
Á
HRDY
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
DMA
active
HPI HPI
not ready ready
5-16
Figure 5−10. HPID Write in Non-Multiplexed Mode
HCS
Internal
HSTRB
HR/W
HRDY
DMA
active
HPI
ready
5-17
5.4 HPI-16 Memory Map
Depending on the logic level of the HMODE pin, the HPI-16 peripheral can per-
form accesses to DSP memory (internal memory only on the ’VC5420 ) in mul-
tiplexed or non-multiplexed modes. As previously noted, multiplexed mode
uses the HPIA register for access to the memory map. Non-multiplexed mode
uses the n-bit HPI address bus to directly access the memory map. Both of
these modes are capable of accessing all DSP memory locations that are ac-
cessible via the DMA controller. Figure 5−11 shows the HPI memory map for
the ’VC5420, a device having an 18-bit address bus.
The HPI peripheral has no knowledge of any memory configuration bits con-
trolled by the CPU. For this reason, the values of the OVLY and DROM bits do
not affect the data location relative to the HPI. In the case of the ’VC5420, ac-
cesses to the internal DSP memory are always considered overlayed program
and data. There is no way to distinguish between program and data spaces.
I/O space is not accessible by the HPI.
You should refer to the device-specific data sheet for information on other HPI
memory maps and configurations.
5-18
5.5 HPI-16 and DMA Interaction
The HPI-16 operates with the DMA controller granting the host access to any
memory location (internal memory only on the ’VC5420). Each time the host
CPU request an access, the DMA finishes any current transfers and releases
the DMA bus to the HPI module. As a result, there are latencies associated
with HPI accesses due to other DMA activity. The host CPU can access the
DSP memory (writes) at the maximum rate of once every six DSP cycles, if no
other DMA channels are active. However, HPI throughput decreases to one
transfer every 10 cycles when there are two or more active DMA channels. The
HPI has the highest priority, including the CPU. As a result, the HPI is granted
access even if the CPU or other DMA channels are competing for the same
memory location. Figure 5−12 illustrates the HPI access sequence relative to
the DMA controller.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
DSP
CLK
DMACH0 W1 B R2 W2 B R3 W3
DMACH3 R1 W1 B R2 W2 B R2 W2
The HPI transfer latency increases if one or more DMA channels are active;
however, the HPI latency never increases beyond the latency of one active
DMA channel. The HPI bus grants are interlaced between the revolving DMA
channels. For this reason, data throughput on other DMA channels is sacri-
ficed if high HPI data rates are required. It should be noted that even without
HPI intervention, it is possible to lock out low priority DMA channels if all high
priority DMA channels are continuously serviced. You should refer to the de-
vice-specific data sheet for HPI read and write transfer latencies for the various
’54x devices.
5-19
The HPIA register is not susceptible to latencies due to DMA controller arbitra-
tion. Accesses to the HPIA register do not use the DMA bus because this regis-
ter is part of the HPI peripheral. HPIC register accesses have no latencies
when writing values that have the DSPINT and HINT bits set to zero. HRDY
is never driven low for these accesses because subsequent accesses can be-
gin immediately. However, writing a one to the DSPINT or HINT bits introduces
a latency due to the required access to the DSP CPU module. Consequently,
the HRDY signal is held low for three DSP clock cycles.
5-20
HPI-16 Operation During Reset / HPI-16 Operation During IDLEn
The host processor can place the DSP in reset by controlling the RS pin. In this
case, the host must complete any current memory access and wait six DSP
clock cycles before driving the RS pin low. During reset, the internal memory
is available to the host. To release the DSP from reset, the host can drive the
RS pin high, but is required to wait at least 20 DSP clock cycles before making
subsequent memory accesses.
An additional method for releasing the DSP from reset is to leave each core’s
RS pin high and cycle HPIRST low, then high. When this occurs, the host can
write to location 0x2F (any value), which will internally reset that particular
core.
The host processor can wake the DSP from IDLE 3 by writing a one to the
DSPINT bit of the HPIC register. Memory accesses during IDLE 3 are not sup-
ported.
5-21
5.8 Changes in DSP Clock Modes That Affect the HPI-16
As stated earlier, the HPI is synchronized to the DSP clock. The HPI can ac-
cess internal DSP memory every six DSP clock cycles. Therefore, changes to
the DSP clock mode affect the time required to complete memory accesses.
If the DSP clock is slowed, the HPI access rate is slowed proportionally.
For example, if the clock mode is changed from a PLL mode to a DIV mode,
the host can use the HRDY pin to effectively insert host wait-states. In
Figure 5−13, the relative timing for a change from multiply-by-1 to DIV mode
is shown. Notice that by using the HRDY pin, wait-states are effectively in-
serted to hold off the host until the current access is complete.
Figure 5−13. HPI-16 Operation During the PLL to DIV Clock Mode Change
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
DSP
CLK
HPI-16 S B R1 W1 S B R2 W2 S B R3 W3
HRDY
The effective HPI transfer rate is increased by changing the DSP clock to a
PLLxn multiply mode. In this case, fewer host wait-states are required. In fact,
as the multiplier mode is increased, it is possible that the HPI transfer rate will
exceed the latency of the host access rate. When this occurs, no host wait-
state is required.
5-22
Chapter 6
Interprocessor Communications
Topic Page
6-1
6.1 Communication Within Multi-Core DSPs
Multi-core (multi-CPU), multi-subsystem DSPs were introduced by Texas
Instruments in 1999. These devices are capable of doubling performance
either by executing duplicate application code on multiple cores or by running
one application that divides tasks between the cores. The subsystems, each
containing its own core, are independent of each other.
Dividing tasks between multiple cores requires data transfers and message
processing between the subsystems. The methods for implementing interpro-
cessor communications include:
- Use of FIFOs
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Core Core
ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎ
Sub- Sub-
system system
A B
ÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏ
ÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏ
ÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏ
ÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏ
ÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏ
ÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏÏ
6-2
6.2 The Bi-Directional FIFO
Communications between subsystems can be accomplished using the first-in,
first-out (FIFO) method described in this section. A second method is dis-
cussed in section 6.4 on page 6-10.
The FIFO peripheral consists of two uni-directional, 8-element-deep channels.
Each channel supports 16-bit data (element) transfers and is dedicated to
either transmit or receive operation. In the case of the ’VC5420, the FIFO is
shared by both subsystems. One FIFO channel is dedicated for transmission
of data from A to B, and the other channel is dedicated for data transmission
from B to A. The subsystem DMA controller that is transmitting data can write
eight words to the FIFO before the FIFO becomes full; however, if the receiving
subsystem reads from its receive channel simultaneously, the transmitting
subsystem can continue indefinitely.
Subsystem A Subsystem B
internal memory internal memory
space space
6-3
and transmit channels are configured and enabled. Example 6−1 shows DMA
channel information that is used to configure DMA channels 0 and 1 for FIFO
transmit and receive, respectively.
Example 6−1. DMA Channels 0 and 1 Configured for FIFO Transmit and Receive
Transmit − DMA channel 0
DMSRC0 = #200h −source address
DMDST0 = #xxxh −this is a don’t care
DMCTR0 = #0Fh −element count (buffer size)
DMSFC0 = #8000h −DMA sync mode
DMMCR0 = #0142h −DMA increment mode,
memory space information.
Location of source and internal FIFO Location of source and FIFO internal
destination memory destination memory
Memory address 200h don’t care Memory address don’t care 400h
DMA index mode (buffer post- no DMA index mode (buffer no post-
pointer increment mode) increment increment pointer increment mode) increment increment
Internal DMA sync event transmit FIFO Internal DMA sync event receive FIFO
not full not empty
6-4
Figure 6−3 illustrates the physical setup for the DMA configuration shown in
Table 6−1. Transfer buffers (located in either internal data or program space)
must be initialized so that the DMA can process the data stream without CPU
intervention. The data buffers have a total of 32 words (a 16-word receive buff-
er and a 16-word transmit buffer) and are located in internal memory at 200h
and 400h.
Subsystem A Subsystem B
DMA controller DMA controller
The FIFO is located in a shared DMA I/O space; that is, both subsystem’s DMA
share a common I/O space. As a result, the DMA memory space selection
must be configured as I/O space to access the FIFO. The memory space
selection is made in the DMMCR register.
The source/destination address that points to the FIFO is a don’t care, since
all writes and reads are from one FIFO memory location. Consequently, the
indexing mode for the FIFO side of the DMA should be configured for no-incre-
ment. The buffer size, also known as the element count in the DMCTR register,
is always programmed as buffer size-1. The element count is used for both
source and destination buffers.
Interrupts for DMA channels 0 and 1 are mapped to IMR bits 6 and 7. However,
in Example 6−1 and Table 6−1, no interrupts are programmed or enabled. To
enable interrupts, the DMA channels must be mapped to the IMR bits as
shown. In addition, the DMA must be programmed to generate interrupts at a
specific time while filling the FIFO.
6-5
Interrupts can be generated when the FIFO buffers become 50% or 100% full.
These interrupts are turned on in the DMA’s DMMCR register and enabled in
the CPU’s interrupt mask register (IMR). If an interrupt is generated on a half-
full buffer, the interrupt is generated when the receipt of the fourth word is com-
pleted. A full-buffer interrupt occurs after receipt of the eighth word is com-
pleted.
The latency to write a word to the FIFO is four CPU cycles. If the receive sub-
system immediately reads the word, it requires four additional CPU cycles to
read the data from the FIFO. Therefore, the maximum throughput is one 16-bit
word every eight CPU cycles. Additional latency can be incurred when the
DMA controller is processing other DMA channels or HPI transfers.
6-6
6.3 Accessing the HPI-16 From External Memory Space
The standard HPI, HPI-8, and HPI-16 peripherals are all designed to connect
to another DSP’s external memory space. Since the HPI is always a slave de-
vice, the master DSP must perform writes and reads to the external memory
space to strobe the HPI peripheral. On multi-core DSPs, this connection is
made internally. Figure 6−4 illustrates the internal connection between the ex-
ternal memory interface and the HPI-16 peripheral on the ’VC5420.
Subsystem
Master DMA controller
Slave
Subsystem DMA channel 0 Subsystem
DMA channel 1
DMA channel 2
subsystem Subsystem
CPU DMA channel 4
The HPI-16 is a 16-bit device capable of performing data accesses from inter-
nal memory space. Due to the 18-bit address bus, the HPI-16 can address the
full address range. The HPI-16 operates in non-multiplexed mode and is acti-
vated by strobing the HDS lines. The master device must perform an access
to the external memory. The external program/data memory interface signals
are mapped to the HPI-16 control pins.
6-7
The subsystems of the multi-core DSP share the HPI-16 peripheral and exter-
nal memory interface. Because of this, external arbitration logic is required if
direction of the communication (determined by the SELA/B pin) must be
changed. The HPI-16 must operate in the non-multiplexed mode requiring that
the HMODE pin be pulled high. The XIO pin must also be pulled high to enter
a special state where the EMIF pins are connected internally to the HPI-16
pins. Table 6−2 summarizes the operation for each pin configuration.
1 0 X 1 1
1 1 0 1 0
1 1 1 0 1
6-8
Due to the state of the XIO and HMODE pins, the master device must execute
from external memory. The slave subsystem is configured to operate in HPI
mode; therefore, all internal memory is enabled. As a result, the external
memory location that the master subsystem accesses is the location that is ac-
cessed on the slave subsystem.
6-9
6.4 Subsystem Communication Using McBSP
Even though the ’VC5420 multi-core DSP does not support McBSP-to-McBSP
communication by design, simply connecting a McBSP from each subsystem
externally provides a very robust interprocessor communication mechanism.
Figure 6−5 illustrates this external connection. There is only a 6-line connec-
tion required to implement the bi-directional/full-duplex communication chan-
nel. No master/slave configuration is required.
McBSP
peripheral
CLKX
FSX
DX
DR
FSR
CLKR
McBSP
peripheral
CLKX
FSX
DX
DR
FSR
CLKR
The transmit section of the McBSPs must provide a shift-clock and frame-sync
to the receive section of the other subsystem’s McBSP. Therefore, the McBSP
CLKX and FSX pins are configured as output signals. The CLKR and FSR pins
are configured as input signals.
The McBSP can be programmed to support many different data transfer
modes. The subsystem’s DMA controller can be used for autobuffering trans-
mit and receive data buffers. In addition, the McBSP peripheral can be pro-
grammed to generate CPU interrupts to indicate when certain conditions exist.
When used for interprocessor communications, the McBSP serial port is one
of the simplest forms of subsystem communication. The McBSP-to-McBSP
connection is not supported internally — it is the responsibility of the system
designer to implement the connections at the system board level.
6-10
6.5 Interprocessor Interrupts
If DMA, HPI, and McBSP interrupts do not provide enough flexibility, an addi-
tional interrupt called the interprocessor Interrupt is provided. This interrupt is
generated internally to notify the other subsystem of a certain event. To gener-
ate the interrupt, the CPU must write a one to the interprocessor interrupt re-
quest bit (IPIRQ) in the BSCR register. Each subsystem’s BSCR register con-
tains the IPIRQ bit. Furthermore, each subsystem can respond to the respec-
tive interrupt named IPINT.
The interrupting subsystem must write a one to the IPIRQ bit followed by a
zero. Consequently, the interrupted subsystem’s IFR register (IPINT bit) is up-
dated and the CPU processes the IPINT interrupt, if enabled in the IMR. The
interrupting subsystem may leave the IPIRQ bit set high indefinitely. This does
not generate multiple interrupts on the interrupted subsystem. The IFR flag
representing the IPINT interrupt is cleared automatically when the CPU pro-
cesses the associated interrupt service routine. The IPIRQ bit must be set to
zero before subsequent interrupts can be generated.
6-11
6-12
Chapter 7
Topic Page
7-1
7.1 Introduction to the Enhanced External Parallel Interface (XIO2)
The enhanced external parallel interface is available only on select ’54x de-
vices. Improvements to the ’VC5410’s external interface (XIO2) include:
- Simplification of bus sequences
The bus sequence on the ’VC5410 still maintains all of the same interface sig-
nals as on previous ’54x devices, but the signal sequence has been simplified.
Most external accesses now require three cycles composed of a leading cycle,
an active (read or write) cycle, and a trailing cycle.
The leading and trailing cycles provide additional immunity against bus con-
tention when switching between read and write operations. To maintain high-
speed read access, a consecutive read mode that performs single-cycle
reads, as on previous ’54x devices, is available.
7-2
7.2 Bus Sequences
Figure 7−1 shows the bus sequence for three cases: all I/O reads, memory
reads in non-consecutive mode, and single memory reads in consecutive
mode. The accesses shown always require three CLKOUT cycles to com-
plete.
Figure 7−1. Non-Consecutive Memory Read and I/O Read Bus Sequence
CLKOUT
A[22:0]
D[15:0] Read
R/W
MSTRB or IOSTRB
PS/DS/IS
Leading
cycle
Read
cycle
Trailing
cycle
7-3
Figure 7−2 shows the bus sequence for repeated memory reads in con-
secutive mode. The accesses shown require (2+n) CLKOUT cycles to com-
plete, where n is the number of consecutive reads performed.
CLKOUT
A[22:0]
R/W
MSTRB
PS/DS
Leading
cycle
Read
cycle
Read
cycle
Read
cycle
Trailing
cycle
7-4
Figure 7−3 shows the bus sequence for all memory and I/O writes. The ac-
cesses shown always require three CLKOUT cycles to complete.
CLKOUT
A[22:0]
D[15:0] Write
R/W
MSTRB or IOSTRB
PS/DS/IS
Leading
Cycle
Write
Cycle
Trailing
Cycle
7-5
7-6
Appendix
AppendixAA
Glossary
A
A-bis mode: In the A-bis mode (ABIS = 1), the McBSP can receive and
transmit up to 1024 bits on a PCM link.
AC97: Audio Codec ’97. A standard which uses a dual-phase frame feature
with the first phase consisting of a single 16-bit word, and the second
phase consisting of twelve 20-bit words.
Access mode: HPI access mode is determined by the logic levels of the
HCNTL0/1 pins. Access mode can be an HPIC access, HPIA access, or
HPID access with autoincrement.
ALE: address latch enable. Hosts that use a multiplexed address/data bus
may use this to latch address/control data. Usually connected to HAS.
AUTOINIT: DMA auto-initialization bit. This bit configures the channel to au-
tomatically initialize after a frame by loading from the global DMA regis-
ters. Located in the DMMCR register.
B
Bit Ordering: A feature that allows the LSB to be transferred to the serial
port first when companded data is not used.
BOB: HPI byte-order bit. Selects which byte is transferred first. Only on
HPI-8 HPI versions. Located in the HPIC register.
A-1
C
CLKG: programmable data clocks. Internal McBSP signals that can be pro-
grammed to drive receive and/or transmit clocking and framing.
CLKGDV: A programmable value that can be used to divide down the input
clock source to the sample rate generator.
CLKSM: clock source mode. The CLKSM bit in the SRGR2 selects either the
CPU clock (CLKSM = 1) or the external clock input (CLKSM = 0) CLKS,
as the source for the sample rate generator input clock.
CLKSP: clock polarity. The rising edge of CLKS when CLKSP = 0, or the fal-
ling edge of CLKS when CLKSP = 1, causes the transition on the data
bit-rate clock (CLKG) and frame sync (FSG).
CLKSRG: clock sample rate generator. The rising edge of CLKSRG gener-
ates clocking (CLKG) and framing (FSG).
CLKS_STAT: CLKS pin status bit. Indicates the logic level of the CLKS pin
when CLKS is configured as a general-purpose input.
CLKSTP: clock stop mode bit. This bit is located in the SPCR1 register and
is used to stop the serial port clock.
CTMOD: DMA transfer counter mode control bit. Selects multiframe or ABU
mode. Located in the DMMCR register.
A-2
D
DATDLY: data delay (R/X). A delay at the beginning of actual data reception
or transmission with respect to the start of the frame. The range of pro-
grammable data delay is 0 to 2 bit-clocks.
DE: DMA channel enable bit. Enables/disables the DMA channel operation.
Located in the DMPREC register.
DIND: DMA destination address transfer index mode bit. Offers several dif-
ferent indexing modes. Located in the DMMCR register.
DIR: direction bit. Selects the direction of a general-purpose I/O pin. Located
in the GPIOCR register.
DLB: digital loop-back mode. DLB mode allows testing of serial port code
with a single DSP device by internally connecting DR, FSR, and CLKR
through multiplexers to DX, FSX, and CLKX.
DMD: DMA destination address space select bit. Located in the DMMCR
register.
A-3
DMGDA: DMA global destination address reload register.
DMGFR: DMA global frame count reload register.
DMGSA: DMA global source address reload register.
DMIDX0: DMA element address index register 0.
DMIDX1: DMA element address index register 1.
DMMCR: DMA channel transfer mode control register.
DMPREC: DMA priority and enable control register.
DMS: DMA source address space select bit. Located in the DMMCR
register.
DMSA: The address register for DMA sub-addressed registers.
DMSDI: DMA sub-address data register with autoincrement.
DMSDN: DMA sub-address data register without autoincrement.
DMSFC: DMA channel sync select and frame count register.
DMSRC: DMA channel source address register.
DMSRCP: DMA source program page address (all channels).
DPRC: Configures the DMA channel priority level. Located in the DMPREC
register.
DR: data receive. Receives data from devices interfacing the McBSP.
DRR[1,2]: data receive register. Two 16-bit registers used to receive data
through the synchronous serial ports (McBSPs).
DSPINT: host port interface’s DSP CPU interrupt. The host can set this to in-
terrupt the DSP. Located in the HPIC register.
DSYN: DMA sync event control bits. Configures the DMA to synchronize to
a particular event. Located in the DMSFC register.
DX: data transmit. Communicates data to devices interfacing the McBSP.
DXENA: data transmit delay bit. When this bit is set, the transmitted data is
delayed.
DXR[1,2]: data transmit registers 1 and 2. Two 16-bit registers used to
transmit data through the synchronous serial ports (McBSPs).
DX_STAT: DX pin status bit. Indicates the logic level of the DX pin when DX
is configured as a general-purpose input.
A-4
E
Extended Software-Programmable Wait-State Generator: Extends
external bus cycles up to 14 machine cycles to interface with slower off-
chip memory and I/O devices.
F
FETCH: A bit located in the HPIC register that is used to fetch the data at the
current HPIA address.
FPER: frame period register. The FPER determines when the next frame-
sync signal becomes active.
FREE: free running mode. Disabled when FREE = 0, and enabled when
FREE = 1.
FRLEN (R/X)[1,2]: frame length. The number of serial words (8-, 12-, 16-,
20-, 24-, or 32-bit) transferred per frame. The length corresponds to the
number of words, or logical time slots, or channels per frame-synchro-
nization signal.
A-5
FSX: transmit frame synchronization. A McBSP interface signal.
FWID: frame width. An 8-bit down counter that controls the active width of
the frame-sync pulse.
G
general-purpose input/output pin (GPIO): Pins that can be used to supply
input signals from an external device or output signals to an external
device. These pins are not linked to specific uses; rather, they provide
input or output signals for a variety of purposes, and include the general-
purpose BIO input pin and XF output pin.
GRST: sample rate generator reset. The sample rate generator is reset by
the GRST bit in SPCR2 when GRST = 0, and pulled out of reset when
GRST = 1.
H
HINT: DSP-to-host interrupt. The DSP can interrupt the host by writing to this
bit. Located in the HPIC register.
HMODE: HPI mode. Valid for the 16-bit HPI only. Allows the HPI to operate
in multiplexed/non-multiplexed modes.
Host Port Interface (HPI-8): An enhanced 8-bit parallel port that interfaces
a host device or host processor to the ’54x. Information is exchanged
between the ’54x and the host device through all on-chip ’54x RAM.
Host Port Interface (HPI-16): An enhanced 16-bit version of the ’54x 8-bit
host port interface that provides a full 16-bit bi-directional data bus, which
does not require byte identification. Memory accesses are synchronized
with the direct memory access (DMA) controller providing access to the
complete internal memory address range.
HPIA: host port address register. A register that is loaded with the address
that points to the data location to access. Accessible only by the host.
A-6
HPIC: host port control register. A register used by the host and DSP.
Location of the HINT, XHPIA, DSPINT, BOB, and HPIENA bits.
HPID: host port data register. Only accessible by the host. Data passes
through this register when using the HPI.
HPIENA: HPI enable status bit. Allows the host to determine the logic level
of the HPIENA pin. Located in the HPIC register.
HRDY: A bit located in the HPIC register that is used for software polling of
the HRDY pin.
HSTRB: Internal strobe that controls the HPI peripheral. The internal
HSTRB signal is a function of external pins HDS1, HDS2, and HCS.
I
IMOD: DMA interrupt generation mode bit. Configures the interrupt to occur
on full/half-buffer boundaries. Located in the DMMCR register.
INTOSEL: interrupt multiplexed control bits. Determines which IFR bits will
be associated with the DMA interrupts. Located in the DMPREC register.
L
latency: The delay between when a condition occurs and when the device
reacts to the condition. Also, in a pipeline, the necessary delay between
the execution of two instructions to ensure that the values used by the
second instruction are correct.
A-7
M
Master: A device that takes control of a peripheral, bus, etc.
MSB: most significant bit. The highest order bit in a word.
N
Non-multiplexed mode: The HPI operates with separate address and data
buses.
P
Pin Control Register (PCR): Used to configure the McBSP pins as inputs
or outputs during normal serial port operation. Also used to configure the
serial port pins as general purpose inputs or outputs during receiver and/
or transmitter reset.
R
RBR[1,2]: receive buffer registers 1 and 2. Receives copied data from the
receive shift register (RSR).
A-8
RDATDLY: receive data delay bit. Delays reception of data for 0, 1, or 2 bits
of delay.
RFIG: receive frame ignore bit. Ignore subsequent FSRs after first.
RFRLEN1: receive frame length 1. Sets the receive frame length for first
phase.
RFRLEN2: receive frame length 2. Sets the receive frame length for second
phase.
RFULL: reception with overrun. Indicates that the receiver has experienced
overrun and is in an error condition.
RIOEN: receive section general-purpose I/O mode. The DX, FSX, and
CLKX pins are general-purpose I/Os.
RPHASE: receive phase bit. McBSP can be configured for one or two
phases.
RRDY: receive ready bit. Indicates the ready status of the McBSP receiver.
A-9
RRST: receive reset bit.
RSR[1,2]: receive shift registers 1 and 2. Receives shifted data from the DR
pin after the appropriate data delay.
rsvd: reserved.
RSYNCERR: unexpected receive frame synchronization. A sync pulse
which occurs RDATDLY minus 1 bit-clock earlier than the first bit of the
next associated word. This causes the current data reception to abort
and restart.
RWDLEN1: receive word length 1. Sets the receive word length for first
phase.
RWDLEN2: receive word length 2. Sets the receive word length for second
phase.
S
Sample Rate Generator: The sample rate generator is composed of a
three-stage clock divider that allows programmable data clocks (CLKG)
and framing signals (FSG), which are McBSP internal signals that can
be programmed to drive receive and/or transmit clocking (CLKR/X) and
framing (FSR/X). The sample rate generator can be programmed to be
driven by an internal clock source or an internal clock derived from an
external clock source.
Serial Port Control Register(SPCR[1,2]): Memory-mapped registers that
contains status and control bits for the serial-port interface.
SIND: DMA source address transfer index mode bit. Offers several different
indexing modes. Located in the DMMCR register.
Slave: A device that is controlled by another device.
SOFT: soft bit. SOFT mode is disabled when SOFT = 0, and enabled when
SOFT = 1.
Software-Programmable Wait-State Generator: See Extended Software-
Programmable Wait-State Generator.
SPCR[1,2]: serial port control registers 1 and 2.
SPSA: The address register for the McBSP sub-address registers.
SRGR[1,2]: sample rate generator registers 1 and 2.
Subsystem: Multi-core DSPs. Referred to as an independent system
consisting of a CPU, memory, and peripherals.
A-10
T
TDM Data Stream: Multiple channels can be independently selected for the
transmitter and receiver by configuring the McBSP with a single phase
frame. Each frame represents a time-division multiplexed (TDM) data
stream.
W
WDLEN(R/X)[1,2]: word length. 3-bit fields in the receive/transmit control
register that determine the word length in bits-per-word for the receiver
and transmitter for each phase of a frame.
X
XCBLK: transmit current block.
XEMPTY: transmit shift register (XSR[1,2]) empty. Indicates when the trans-
mitter has experienced underflow. When XSR[1,2] is empty, XEMPTY =
0. When XSR[1,2] is not empty, XEMPTY = 1.
XFIG: transmit frame ignore bit. Ignore subsequent FSXs after first.
XFRLEN1: transmit frame length 1. Sets the transmit frame length for first
phase.
XFRLEN2: transmit frame length 2. Sets the transmit frame length for
second phase.
XHPIA: extended HPIA. Select either the lower 16 bits or the most significant
bits to be accessed from the HPIA register. Located in the HPIC register.
A-11
XINTM: receive/transmit interrupt mode.
XIOEN: transmit section general-purpose I/O mode. The DX, FSX, and
CLKX pins are general-purpose I/Os.
XPHASE: transmit phase bit. McBSP can be configured for one or two
phases.
XRDY: transmit ready. Indicates the ready state of the McBSP transmitter.
When XRDY = 0, the transmitter is not ready. When XRDY = 1, the trans-
mitter is ready with data in DXR[1,2].
XRST: transmitter reset. This resets and enables the serial port transmitter.
Disables the transmitter and in reset state when XRST = 0, and enables
the transmitter when XRST = 1.
XWDLEN1: transmit word length 1. Sets the transmit word length for first
phase.
XWDLEN2: transmit word length 2. Sets the transmit word length for second
phase.
A-12
Appendix
AppendixBA
Revision History
Table B−1 lists the changes made since the previous version of this document.
B-1
B-2
Index
Index
Index-1
Index
Index-2
Index
Index-3
Index
Index-4
Index
Index-5
Index
Index-6
Index
Index-7
Index
Index-8
Index
HPI-8 operation during, ’5410 4-29 sample rate generator register 2 (SRGR2) 2-60
MP/MC bit levels at 6-8 bit-field descriptions 2-60
reset state of McBSP pins 2-23 SCK (shift clock) 2-86
REVT 2-26 Serial data input (Master In−Slave Out, or
definition A-9 MISO) 2-86
REVTA, definition A-9 serial data output (Master Out−Slave In, or
REVTA (receive A-bis event) 2-84 MOSI) 2-86
RFIG, definition A-9 serial port
configuration 2-6
RFRLEN(1,2) 2-31
exception conditions 2-43
RFRLEN1, definition A-9 receive overrun 2-45
RFRLEN2, definition A-9 receive overrun avoided 2-46
RFULL 2-44 reset 2-22
definition A-9 serial port control register (SPC)
RINT 2-26 DLB bit 2-7
definition A-9 RSRFULL bit 2-9
RIOEN 2-12 serial port control register (SPCR), definition A-10
definition A-9 Serial Port Control Register 1 (SPCR1)
RJUST, definition A-9 bit-field descriptions 2-7
RMCM, definition A-9 Figure 2-7
RPABLK, definition A-9 serial port control register 1 (SPCR1) 2-88
RPBBLK, definition A-9 serial port control register 2 (SPCR2) 2-93
bit-field descriptions 2-10
RPHASE, definition A-9
serial port control registers 2-6
RRDY 2-26
serial port interface 2-2
definition A-9
buffered serial ports 1-2
RRST, definition A-10
serial ports 1-2
RRST bit 2-93
shift clock (SCK) 2-86
RSR, definition A-10
SIND, definition A-10
rsvd, definition A-10
Single- Phase Frame, one 32-bit word 2-34
RSYNCERR 2-46
single-phase frame, four 8-bit words 2-33
definition A-10
single-rate clock example 2-70
RWDLEN(1,2) 2-31
single-rate ST-BUS clock 2-70
RWDLEN1 2-90
definition A-10 slave, definition A-10
RWDLEN2, definition A-10 slave enable signal (SS) 2-86
SOFT, definition A-10
SOFT bits 2-10, 2-95
S software-programmable wait-state generator,
definition A-10
sample rate generator 2-92
source and destination address, selection and
clocking and framing 2-58
modification 3-20
data bit clock rate (CLKGDV) 2-62
definition A-10 source and destination address registers,
diagram 2-58 DMA 3-11
reset procedures 2-61 SPCR, definition A-10
sample rate generator register 1 (SRGR1) 2-59 SPCR1, bit-field descriptions 2-7
bit-field descriptions 2-59 SPCR2, bit-field descriptions 2-10
Index-9
Index
Index-10
Index
Index-11
Index-12