Amd 186 Proc - Carrier Log
Amd 186 Proc - Carrier Log
Amd 186 Proc - Carrier Log
User’s Manual
Order #21914B
© 1998 Advanced Micro Devices, Inc. All rights reserved.
Advanced Micro Devices, Inc. ("AMD") reserves the right to make changes in its products
without notice in order to improve design or performance characteristics.
The information in this publication is believed to be accurate at the time of publication, but AMD makes no representations or warranties with
respect to the accuracy or completeness of the contents of this publication or the information contained herein, and reserves the right to make
changes at any time, without notice. AMD disclaims responsibility for any consequences resulting from the use of the information included in this
publication.
This publication neither states nor implies any representations or warranties of any kind, including but not limited to, any implied warranty of
merchantability or fitness for a particular purpose. AMD products are not authorized for use as critical components in life support devices or
systems without AMD’s written approval. AMD assumes no liability whatsoever for claims associated with the sale or use (including the use of
engineering samples) of AMD products, except as provided in AMD’s Terms and Conditions of Sale for such products.
Trademarks
AMD, the AMD logo, and combinations thereof, Am186, Am188, Comm86, E86, SLAC, SmartDMA, and CodeKit are trademarks of Advanced
Micro Devices, Inc.
FusionE86 is a service mark of Advanced Micro Devices, Inc.
Product names used in this publication are for identification purposes only and may be trademarks of their respective companies.
IF YOU HAVE QUESTIONS, WE’RE HERE TO HELP YOU.
The AMD customer service network includes U.S. offices, international offices, and a
customer training center. Expert technical assistance is available from the AMD worldwide
staff of field application engineers and factory support staff to answer E86™ and Comm86™
family hardware and software development questions.
Frequently accessed numbers are listed below. Additional contact information is listed on
the back of this manual. AMD’s WWW site lists the latest phone numbers.
Technical Support
Answers to technical questions are available online, through e-mail, and by telephone.
Go to AMD’s home page at www.amd.com and follow the Service link for the latest AMD
technical support phone numbers, software, and Frequently Asked Questions.
For technical support questions on all E86 and Comm86 products, send e-mail to
epd.support@amd.com (in the US and Canada) or euro.tech@amd.com (in Europe and
the UK).
You can also call the AMD Corporate Applications Hotline at:
(800) 222-9323 Toll-free for U.S. and Canada
44-(0) 1276-803-299 U.K. and Europe hotline
WWW Support
For specific information on E86 and Comm86 products, access the AMD home page at
www.amd.com and follow the Embedded Processors link. These pages provide
information on upcoming product releases, overviews of existing products, information on
product support and tools, and a list of technical documentation. Support tools include
online benchmarking tools and CodeKit™ software—tested source code example
applications. Many of the technical documents are available online in PDF form.
Questions, requests, and input concerning AMD’s WWW pages can be sent via e-mail to
webmaster@amd.com.
Documentation and Literature Support
Data books, user’s manuals, data sheets, application notes, and product CDs are free with
a simple phone call. Internationally, contact your local AMD sales office for product literature.
To order literature, call:
(800) 222-9323 Toll-free for U.S. and Canada
(512) 602-5651 Direct dial worldwide
(512) 602-7639 Fax
Third-Party Support
AMD FusionE86SM partners provide an array of products designed to meet critical time-to-market
needs. Products and solutions available include emulators, hardware and software debuggers,
board-level products, and software development tools, among others. The WWW site and the
E86 Family Products Development Tools CD, order# 21058, describe these solutions. In
addition, mature development tools and applications for the x86 platform are widely
available in the general marketplace.
LIST OF FIGURES
LIST OF TABLES
Table 0-1 Documentation Conventions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxii
Table 1-1 Feature Comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
Table 2-1 Internal Processor Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
Table 2-2 Configuration Register Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
Table 2-3 Peripheral Register Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
Table 2-4 Segment Register Selection Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8
Table 2-5 Memory Addressing Mode Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
Table 3-1 Multiplexed Signal Trade-Offs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
Table 3-2 Multiplexed Signal Trade-Offs Ordered by PIO . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
Table 3-3 System Configuration Register Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4
Table 3-4 CPU and Internal Peripheral States Immediately Following Power-On Reset . . . . . 3-6
Table 3-5 Reset Configuration Pins (Pinstraps) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
Table 3-6 Signal Descriptions Table Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
Table 3-7 Signal Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10
Table 3-8 Programming Am186CC/CH/CU Microcontrollers Bus Width . . . . . . . . . . . . . . . . 3-31
Table 5-1 Chip Selects Multiplexed Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
Table 5-2 Chip Select Register Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
Table 5-3 Signal Function When UCS or LCS is Configured for DRAM. . . . . . . . . . . . . . . . . . 5-7
Table 6-1 DRAM Multiplexed Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Table 6-2 DRAM Controller Register Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-3
Table 6-3 DRAM Supported by the Am186CC/CH/CU Microcontrollers . . . . . . . . . . . . . . . . . 6-4
Table 6-4 Address Multiplexing Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
Table 6-5 Refresh Interval Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-6
Table 7-1 Interrupt Multiplexed Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-4
Table 7-2 Interrupt Controller Register Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5
Table 7-3 Interrupt Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-12
Table 7-4 Interrupt Channel Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-16
Table 7-5 Interrupt Channel Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-17
Table 8-1 DMA Multiplexed Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
Table 8-2 DMA Controller Register Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
Table 8-3 Am186CC Communications Controller DMA Channel Use . . . . . . . . . . . . . . . . . . . 8-8
Table 8-4 Am186CH HDLC Microcontroller DMA Channel Use . . . . . . . . . . . . . . . . . . . . . . . . 8-8
Table 8-5 Am186CU USB Microcontroller DMA Channel Use . . . . . . . . . . . . . . . . . . . . . . . . . 8-9
Table 8-6 General-Purpose DMA Data Transfers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-11
Table 8-7 General-Purpose DMA Request Source and Synchronization . . . . . . . . . . . . . . . 8-17
Table 8-8 Maximum DMA Transfer Rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-19
Table 8-9 Example Register Settings for UARTs and Circular Buffers . . . . . . . . . . . . . . . . . . 8-22
Table 8-10 Am186CC SmartDMA Channel Request Source and Synchronization . . . . . . . . . 8-27
Table 8-11 Am186CH SmartDMA Channel Request Source and Synchronization . . . . . . . . . 8-28
Table 8-12 Am186CU SmartDMA Channel Request Source and Synchronization . . . . . . . . . 8-28
Table 8-13 SmartDMA Transmit Channel Descriptor Format . . . . . . . . . . . . . . . . . . . . . . . . . . 8-39
Table 8-14 SmartDMA Receive Channel Descriptor Format . . . . . . . . . . . . . . . . . . . . . . . . . . 8-40
Table 9-1 PIO Multiplexed Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-3
Table 9-2 PIO Register Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5
Table 9-3 PIO Mode and PIO Direction Register Bit Settings. . . . . . . . . . . . . . . . . . . . . . . . . . 9-6
Table 9-4 PIO Set and PIO Clear Registers’ Effect on PIO Data Register . . . . . . . . . . . . . . . . 9-6
Table 10-1 Programmable Timer Multiplexed Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2
Table 10-2 Programmable Timers Register Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2
Table 10-3 Timer 0 and Timer 1 Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-4
Table 11-1 Watchdog Timer Multiplexed Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2
Table 11-2 Watchdog Timer Register Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-3
Table 12-1 Multiplexed Signal Trade-Offs for Serial Interfaces . . . . . . . . . . . . . . . . . . . . . . . . 12-2
Table 13-1 UARTs Multiplexed Signals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-3
Table 13-2 UARTs Register Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-4
Table 13-3 Baud Rate Table for UARTs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-15
Table 13-4 Examples of Autobaud Enhancement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-18
INTRODUCTION
COMM86 FAMILY
The Am186™CC communications controller, Am186CH HDLC microcontroller, and
Am186CU USB microcontroller, the first members of the AMD Comm86™ family, are cost-
effective, high-performance embedded microcontroller solutions for communications
applications. These highly integrated microcontrollers enable customers to save system
costs and increase performance over 8-bit microcontrollers and other 16-bit
microcontrollers.
All of these microcontrollers offer the advantages of the x86 development environment’s
widely available native development tools, applications, and system software. Additionally,
the microcontrollers use the industry-standard 186 instruction set that is part of the AMD
E86™ family, which continually offers instruction-set-compatible upgrades. Built into each
of the microcontrollers is a wide range of communications features required in many
communications applications.
PURPOSE OF THIS MANUAL
This manual describes the technical features and programming interface of the Am186CC,
Am186CH, and Am186CU microcontrollers.
Intended Audience
The Am186CC/CH/CU Microcontrollers User’s Manual, order #21914, is intended for
computer software and hardware engineers and system architects who are designing or
are considering designing systems based on one of these controllers.
Overview of this Manual
This manual is organized into the following chapters:
■ Chapter 1, “Architectural Overview,” provides an overview of the features of the
microcontrollers, including a block diagram and sample application diagrams.
■ Chapter 2, “Configuration Basics,” provides basic information about configuring the
microcontrollers, including discussions of the registers, memory organization, address
generation, I/O space, peripheral control block, instruction set, segments, data types,
and addressing modes.
■ Chapter 3, “System Overview,” contains descriptions of the microcontrollers’ system
configuration registers, initialization and processor reset, signals, bus interface, and
clock control.
■ Chapter 4, “Emulator Support,” describes the various features available in the
microcontrollers to facilitate the design and operation of In-Circuit Emulators, and
discusses common concerns shared among emulator developers.
■ Chapter 5, “Chip Selects,” describes the six chip selects provided for use with memory
devices and the eight provided for use with peripherals in either memory or I/O space.
■ Chapter 6, “DRAM Controller,” discusses the fully integrated DRAM controller that
provides a glueless interface to 40-, 50-, 60-, and 70-ns Extended Data Out (EDO)
DRAM.
CC CH ■ Chapter 15, “High-Level Data Link Control (HDLC),” provides a brief overview of HDLC
and describes how to configure the HDLC channels to support data movement in a
variety of applications.
CC CH ■ Chapter 16, “HDLC External Serial Interface Configuration (TSAs),” describes how to
use the time-division multiplex features to configure the HDLC external serial interfaces.
Each Time-Slot Assigner (TSA) can be programmed to select between raw DCE and
dedicated PCM Highway external interfaces, as well as to multiplex GCI/PCM Highway
data.
CC ■ Chapter 17, “General Circuit Interface (GCI),” discusses how to configure the GCI
controller for a GCI interface on HDLC Channel A, or multiplexed GCI/PCM Highway
interfaces to the other channels
CC CU ■ Chapter 18, “Universal Serial Bus (USB),” covers the highly flexible integrated USB
peripheral controller and how to implement a variety of microcontroller-based USB
peripheral devices for telephony, audio, or other high-end applications.
■ Appendix A, “Register Summary,” provides a summary of all the microcontroller
peripheral control block (PCB) registers, listed in offset order.
■ The Glossary provides definitions of significant terms used in this manual.
■ The Index contains extensive references to make it easier to find specific information.
RELATED DOCUMENTS
The following documents contain additional information that will be useful in designing an
embedded application based on the Am186CC/CH/CU microcontrollers.
AMD Documentation
In addition to this manual, the documentation set for the Am186CC/CH/CU microcontrollers
includes the following documents:
■ The Am186™CC Communications Controller Data Sheet, order #21915, the
Am186™CH HDLC Microcontroller Data Sheet, order #22024, and the Am186™CU
USB Microcontroller Data Sheet, order #22025, include complete pin lists, pin state
tables, timing and thermal characteristics, and package dimensions for their particular
microcontroller.
■ The Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916, fully
describes all the registers required to program the microcontrollers.
■ The Am186 and Am188 Family Instruction Set Manual, order #21267, provides a detailed
description and examples for each instruction included in the Am186 and Am188 family
instruction set.
■ Interfacing an Am186™CC Communications Controller to an AMD SLAC™ Device
Using the Enhanced SSI, order #21921, application note describes how to connect these
two devices. The same techniques can be used to connect the Am186CC microcontroller
to any SLAC device.
■ Am186™CC/CH/CU Communications Controller Customer Development Platform
Board Manual, order #22002, which describes a platform for silicon evaluation and
software development, as well as a router/ISDN terminal adapter module.
To order literature, contact the nearest AMD sales office or call the literature center at one
of the numbers on the back cover of this manual. In addition, many documents are available
in PDF form on the AMD web site. To access the AMD home page, go to www.amd.com.
Then follow the Embedded Processors link for information about E86 and Comm86
products.
Additional Information
CC CU The following non-AMD documents and sources provide additional information that may
be of interest to Am186CC and Am186CU microcontroller users:
■ Universal Serial Bus Specification, Revision 1.0, available from the USB web site at
http://www.usb.org.
■ Universal Serial Bus System Architecture, by Don Anderson, Mindshare, Inc., Addison
Wesley Developers Press, 1997.
DOCUMENTATION CONVENTIONS
Table 0-1 lists the documentation conventions used throughout this manual.
.
MICROCONTROLLER-SPECIFIC INFORMATION
This manual provides information that applies to all three of the Am186CC/CH/CU
microcontrollers as well as information that is specific to each controller. To help identify
controller-specific information, this manual uses icons in the margin and within tables and
figures. Table 0-1 illustrates these icons.
Some chapters apply only to one or two of the controllers. These chapters have a note at
the beginning of the chapter with the relevant icons next to the note.
One or more icons immediately following a heading indicates that the information under
that heading (up to the next heading) applies only to the indicated controllers.
Icons that appear other than at the beginning of the chapter or immediately following a
heading apply to the specific paragraph, list, figure, portion of figure, table, or table cell
indicated by the icon. If a paragraph, list, figure, or table does not have any accompanying
icons, the information applies to all of the microcontrollers covered by the chapter.
1 ARCHITECTURAL OVERVIEW
1.1 FEATURES
The Am186CC, Am186CH, and Am186CU microcontrollers, the first members of the AMD
Comm86™ family, are cost-effective, high-performance microcontroller solutions for
communications applications. These highly integrated microcontrollers enable customers
to save system costs and increase performance over 8-bit microcontrollers and other 16-bit
microcontrollers.
These microcontrollers offer the advantages of the x86 development environment’s widely
available native development tools, applications, and system software. Additionally, these
microcontrollers use the industry-standard 186 instruction set that is part of the AMD E86
family, which continually offers instruction-set-compatible upgrades. Use of this instruction
set ensures both backward and upward software compatibility.
AMD offers complete solutions with these microcontrollers. A customer development
platform board for silicon evaluation and software development is available. Reference
designs under development include a low-end router with Integrated Services Digital
Network (ISDN), Ethernet, USB, and Plain Old Telephone Service (POTS), as well as an
ISDN terminal adapter featuring USB. AMD and its FusionE86SM Partners offer boards,
schematics, drivers, protocol stacks, and routing software for these reference designs to
enable fast time to market.
1.2 Am186CC COMMUNICATIONS CONTROLLER
CC Built into the Am186CC microcontroller is a wide range of communications features required
in many communications applications, including High-level Data Link Control (HDLC) and
the Universal Serial Bus (USB). It includes the following distinctive characteristics:
■ Serial communications peripherals
– Four High-level Data Link Control (HDLC) channels
– USB peripheral controller
– Eight SmartDMA™ channels to support HDLC and USB
– Four independent Time Slot Assigners (TSAs)
– Physical interface for HDLC channels can be raw DCE, PCM Highway, or GCI (IOM-2)
– High-speed UART with autobaud
– UART
– Synchronous serial interface (SSI)
■ System peripherals
– Interrupt controller (36 maskable interrupts)
– Four general-purpose DMA channels
– 48 programmable I/O signals
– Three programmable 16-bit timers
– Hardware watchdog timer
■ Memory and Peripheral Interface
– Integrated DRAM controller
– Glueless interface to RAM/ROM/Flash memory (40-ns Flash memory required for
zero-wait-state operation at 50 MHz)
– Fourteen chip selects (6 memory, 8 peripheral)
– External bus mastering support
– Multiplexed and nonmultiplexed address/data bus
– Programmable bus sizing
– 8-bit boot option
1.2.1 Am186CH HDLC Microcontroller
CH The Am186CH HDLC microcontroller is a cost-reduced derivative of the Am186CC
microcontroller that is targeted towards cost-sensitive applications such as linecards and
digital phones. The Am186CH HDLC microcontroller is pin-compatible with the Am186CC
microcontroller and offers many of the same features, yet the Am186CH HDLC
microcontroller provides a cost-effective solution for communications devices that require
fewer HDLC channels and do not need GCI or USB. It includes the following distinctive
characteristics:
■ Serial communications peripherals
– Two High-level Data Link Control (HDLC) channels
– Four SmartDMA channels to support HDLC
– Two independent Time Slot Assigners (TSAs)
– Physical interface for HDLC channels can be raw DCE or PCM Highway
– High-speed UART with autobaud
– UART
– Synchronous serial interface (SSI)
■ System peripherals
– Interrupt controller (31 maskable interrupts)
– Four general-purpose DMA channels
– 48 programmable I/O signals
– Three programmable 16-bit timers
– Hardware watchdog timer
Feature CC CH CU
HDLC Channels 4 2 –
Time Slot Assigners (TSAs) 4 2 –
Raw DCE Interface ✔ ✔ –
PCM Highway Interface ✔ ✔ –
GCI (IOM-2) Interface ✔ – –
USB Peripheral Controller ✔ – ✔
SmartDMA Channels 8 (4 pair) 4 (2 pair) 4 (2 pair)
General-Purpose DMA Channels 4 4 4
High-Speed UART ✔ ✔ ✔
UART ✔ ✔ ✔
Synchronous Serial Interface (SSI) ✔ ✔ ✔
Internal Maskable Interrupts 19 14 13
External Maskable Interrupts 17 17 17
Programmable I/O Signals (PIOs) 48 48 48
16-Bit Timers 3 3 3
Hardware Watchdog Timer ✔ ✔ ✔
Integrated DRAM Controller ✔ ✔ ✔
Glueless Interface to RAM/ROM/Flash
✔ ✔ ✔
Memory
Memory Chip Selects 6 6 6
Peripheral Chip Selects 8 8 8
External Bus Mastering Support ✔ ✔ ✔
Multiplexed and Nonmultiplexed
✔ ✔ ✔
Address/Data Bus
Programmable Bus Sizing ✔ ✔ ✔
8-Bit Boot Option ✔ ✔ ✔
Physical
Interface
Glueless General-
Interface DRAM Timers Purpose Smart HDLC TSA Raw DCE
Controller (3) DMA (8)
to RAM/ROM DMA (4)
HDLC TSA PCM
Memory Peripherals System Peripherals Highway
Muxing
HDLC TSA
GCI (IOM-2)
HDLC TSA
Physical
Interface
Glueless General-
Interface DRAM Timers Purpose Smart HDLC TSA Raw DCE
Controller (3) DMA (4)
to RAM/ROM DMA (4) Muxing
PCM
HDLC TSA Highway
Memory Peripherals System Peripherals
Glueless General-
Interface DRAM Timers Purpose Smart
Controller (3) DMA (4)
to RAM/ROM DMA (4)
CH The Am186CH HDLC microcontroller supports five serial interfaces: two HDLC channels,
two UARTs, and an SSI. In addition, it supports the use of SmartDMA with the serial
interfaces.
CU The Am186CU USB microcontroller supports four serial interfaces: a USB peripheral
controller, two UARTs, and an SSI. In addition, it supports the use of SmartDMA with the
serial interfaces.
For an overview of the serial communications features, see Chapter 12, “Serial
Communications Overview.”
1.4.2.1 Universal Serial Bus (Chapter 18)
CC CU The Am186CC and Am186CU microcontrollers each include a highly flexible integrated
USB peripheral controller that lets designers implement a variety of microcontroller-based
USB peripheral devices for telephony, audio, and other high-end applications. This
integrated USB peripheral controller can provide a significant system-cost reduction
compared to platforms that require a separate USB peripheral controller.
The Am186CC and Am186CU microcontrollers act as USB peripheral devices. The USB
is a half-duplex, master/slave, polled bus. In other words, the microcontroller speaks on the
USB only in response to a request from the USB host, usually a personal computer. There
can be only one speaker on the USB at a time.
The USB controller does not support USB host or hub functions. However, the Am186CC
and Am186CU microcontrollers can be used to implement USB peripheral functions in a
device that also contains separate USB hub circuitry.
Use these microcontrollers in self-powered USB peripherals that use the full-speed
signalling rate of 12 Mbit/s; they do not support the USB low-speed rate of 1.5 Mbit/s. Each
microcontroller includes an integrated USB transceiver to minimize system device count
and cost, but an external transceiver can be used instead, if necessary.
CC CH The Am186CC microcontroller provides four HDLC channels and the Am186CH HDLC
microcontroller provides two HDLC channels. These channels support the HDLC, SDLC,
LAP-B, LAP-D, PPP, and V.120 protocols. The HDLC channels can also be used in
transparent mode to support V.110. Each HDLC channel can connect to an external serial
interface directly (non-multiplexed mode), or can pass through a TSA (multiplexed mode).
The flexible interface multiplexing arrangement allows each HDLC channel to have its own
external interface, to share a common PCM highway or other time division multiplexed
(TDM) bus with the other channels, or to work in some combination.
CC The Am186CC microcontroller supports raw DCE, PCM highway, and GCI interfaces.
CH The Am186CH HDLC microcontroller supports raw DCE and PCM highway interfaces.
Each HDLC channel’s independent TSA allows it to extract a subset of data from a TDM
bus. It can isolate the entire frame or as little as one bit per frame. The channel’s 12-bit
counter defines the start/stop bit times as the number of bits after frame synchronization.
The time slot can be an arbitrary number of bits up to 4096 bits. Start bit and stop bit times
identify the isolated portion of the TDM frame. Support of less than eight bits per time slot,
or bit slotting, allows isolation of from one to eight bits in a single time slot, providing a
convenient way to work with D-channel data. Each TDM bus can have up to 512 8-bit time
slots. Support of these features allows interoperation with PCM highway, E1, IOM-2, T1,
and other TDM buses.
To make the Am186CC and Am186CH microcontrollers attractive devices for use where
general HDLC capability is required, the HDLC channels support the following features:
■ Clear-to-Send (CTS) and Ready-to-Receive (RTR) hardware handshaking and auto-
enable operation
■ Collision detection for multidrop applications
■ Transparency mode
■ Address comparison on receive
■ Flag or mark idle operation
■ Two dedicated buffer descriptor ring SmartDMA channels per HDLC channel
■ Transmit and receive FIFOs
■ Full-duplex data transfer
CC CH Each TSA channel can support a burst data rate to or from the HDLC of up to 10 Mbit/s in
both raw DCE and PCM highway modes.
CC In addition to raw DCE and PCM highway, the Am186CC microcontroller can share its GCI
interface with up to two other channels. In GCI mode, the Am186CC microcontroller’s TSA
channels can support a burst data rate to or from the HDLC of up to 768 Kbit/s.
Total system data throughput is highly dependent on the amount of per-packet and per-
byte CPU processing, the rate at which packets are being sent, and other CPU activity.
When combined with the TSAs, the HDLC channels are suitable for use in a wide variety
of applications such as ISDN basic rate interface (BRI) and primary rate interface (PRI) B
and D channels, PCM highway, X.25, Frame Relay, and other proprietary Wide Area
Network (WAN) connections.
1.4.2.3 General Circuit Interface (Chapter 17)
CC The GCI is an interface specification developed jointly by Alcatel, Italtel, GPT, and Siemens.
This specification defines an industry-standard serial bus for interconnecting
telecommunications integrated circuits. The standard covers linecard, NT1, and terminal
architectures for ISDN applications. The Am186CC microcontroller supports the terminal
version of GCI.
The GCI interface provides a glueless connection between the Am186CC microcontroller
and GCI/IOM-2 based ISDN transceiver devices, such as the AMD Am79C30 or Am79C32.
The GCI interface provides a 4-pin connection to the transceiver device. The Am186CC
microcontroller also allows conversion of the GCI clock and GCI frame sync into a format
usable by PCM codecs, allowing the use of PCM codecs directly with GCI/IOM-2
transceivers. Additional GCI features include slave mode with pin reversal, Terminal
Interchip Communication (TIC) bus support for D channel arbitration and collision detection,
and support for one Monitor and two Command/Indicate channels.
1.4.2.4 SmartDMA Channels (Chapter 8)
Each of the Am186CC/CH/CU microcontrollers contain both SmartDMA channels and
general-purpose DMA channels (see “General-Purpose DMA Channels (Chapter 8)” on
page 1-10). The SmartDMA channels provide a faster method for moving data between
peripherals and memory with lower CPU utilization. SmartDMA transmits and receives data
across multiple memory buffers and a sophisticated buffer-chaining mechanism. These
channels work in pairs: transmitter and receiver. The transmit channels can transfer data
only from memory to a peripheral; the receive channels can transfer data only from a
peripheral to memory.
CH The Am186CH HDLC microcontroller provides a total of eight DMA channels: four
SmartDMA channels to support the two HDLC channels and four general-purpose DMA
channels.
CU The Am186CU USB microcontroller provides a total of eight DMA channels: four SmartDMA
channels to support USB endpoints A–D and four general-purpose DMA channels.
CC CU The USB peripheral controller in the Am186CC and Am186CU microcontrollers can also
request a general-purpose DMA transfer.
1.4.3.3 Programmable I/O Signals (Chapter 9)
Each of the Am186CC/CH/CU microcontrollers provides 48 user-programmable input/
output signals (PIOs). In the Am186CC microcontroller, each of these signals shares a pin
with at least one alternate function. In the Am186CH and Am186CU microcontrollers, most
but not all of the PIOs share a pin with alternate functions. If an application does not need
the alternate function, the associated PIO can be used by programming the PIO registers.
If a pin is enabled to function as a PIO signal, the alternate function is disabled and does
not affect the pin. A PIO signal can operate as an input or output, with or without internal
pullup or pulldown resistors (whether the resistors are pullup or pulldown depends on the
pin configuration and is not user-configurable), or as an open-drain output. In addition to
the three PIOs multiplexed with interrupt signals, eight other PIOs can be configured as
external interrupt sources. For more information about PIOs as interrupt sources, see
Chapter 7, “Interrupts.”
1.4.3.4 Programmable Timers (Chapter 10)
Each of the Am186CC/CH/CU microcontrollers has three 16-bit programmable timers.
Timers 0 and 1 are highly versatile and are each connected to two external pins (each one
has an input and an output). These two timers can count or time external events that drive
the timer input pins. Timers 0 and 1 can also generate nonrepetitive or variable-duty-cycle
waveforms on the timer output pins.
Timer 2 is not connected to any external pins. Software can use it to generate interrupts,
or poll it for real-time coding and time-delay applications. Software can also use Timer 2
as a prescaler to Timer 0 and Timer 1, or as a DMA request source (see Chapter 8, “DMA
Controller”).
The source clock for Timer 2 is one-fourth of the CPU clock frequency. Timers 0 and 1 can
use every fourth cycle of the CPU clock as a source, or they can be driven from the timer
input pins. When driven from a timer input pin, the timer is counting the “event” of an input
transition.
The microcontroller also provides a pulse width demodulation (PWD) option so that a
toggling input signal’s Low state and High state durations can be measured.
1.4.3.5 Hardware Watchdog Timer (Chapter 11)
Each of the Am186CC/CH/CU microcontrollers provides a full-featured watchdog timer,
which includes the ability to generate NMIs, reset the microcontroller (except for pinstraps),
and reset the system (assert RESOUT) when the time-out value is reached. The time-out
value is programmable and ranges from 210 to 226 processor clocks.
The watchdog timer is used to regain control when a system has failed due to a software
error or the failure of an external device to respond in the expected way. Software errors
can sometimes be resolved by recapturing control of the execution sequence through a
watchdog-timer-generated NMI. When an external device fails to respond, or responds
incorrectly, it may be necessary to reset the microcontroller or the entire system, including
external devices. The watchdog timer provides the flexibility to support both NMI and reset
generation.
1.4.4 Memory and Peripheral Interface
Each of the Am186CC/CH/CU microcontrollers includes the following memory and
peripheral interfaces.
1.4.4.1 System Interfaces and Clock Control (Chapter 3)
The microcontroller includes a bus interface to control all accesses to the peripheral control
block (PCB), memory-mapped and I/O-mapped external peripherals, and memory devices.
The bus interface accesses the internal peripherals through the PCB. The bus interface
features programmable bus sizing, separate byte/write enables, and the option to boot from
an 8-bit or 16-bit device.
The industry-standard 80C186 and 80C188 microcontrollers use a multiplexed address
and data (AD) bus. The address is present on the AD bus only during the t1 clock phase.
The microcontrollers also provide the multiplexed AD bus and in addition, provide a
nonmultiplexed address (A) bus. The A bus provides an address to the system for the
complete bus cycle (t1–t4).
The microcontroller operates with a VCC of 3.3 ± 0.3 V. All the digital signals are capable
of 5-V-tolerant I/O operation.
The processor supports clock rates from 25 MHz to 50 MHz. Commercial and industrial
temperature ratings are available. The CPU can run in 1x, 2x, or 4x mode.
CC CU The Am186CC and Am186CU microcontrollers provide separate crystal oscillator inputs
for the USB peripheral controller and the CPU. Flexibility is provided to run the entire device
from a 12- or 24-MHz crystal when the USB is in use. The CPU can run in 1x, 2x, or 4x
mode; the USB can run in 2x or 4x mode.
1.4.4.2 Dynamic Random Access Memory Support (Chapter 6)
To support DRAM, the microcontroller has a fully integrated DRAM controller that provides
a glueless interface to 25-ns to 70-ns Extended Data Out (EDO) DRAM (EDO DRAM is
sometimes called Hyper-Page Mode DRAM). The microcontroller can access up to two
banks of 4-Mbit (256 Kbit x 16 bit) DRAM. The microcontroller does not support Page Mode
DRAM, Fast Page Mode DRAM, Asymmetrical DRAM, or 8-bit wide DRAM. The
microcontroller provides zero-wait state operation at up to 50 MHz with 40-ns DRAM. This
capability allows designs requiring larger amounts of memory to save system cost over
SRAM designs by taking advantage of low DRAM costs.
The DRAM interface uses various chip select pins to implement the RAS/CAS interface
required by DRAMs. The microcontroller’s DRAM controller drives the RAS/CAS interface
appropriately during both normal memory accesses and refresh. The microcontroller
generates all required signals and does not require external logic.
The DRAM multiplexed address pins connect to the microcontroller’s odd address pins,
starting with A1 on the microcontroller connecting to MA0 on the DRAM. The correct row
and column address are generated on these odd address pins during a DRAM access.
The RAS pins are multiplexed with LCS or MCS3, allowing a DRAM bank to be present in
either high or low memory space. MCS2 and MCS1 function as the lower and upper CAS
pins, respectively, and define which byte of data in a 16-bit DRAM is being accessed.
The microcontroller supports the most common DRAM refresh option, CAS-Before-RAS.
All refresh cycles contain three wait states to support the DRAMs at various frequencies.
The DRAM controller never performs a burst access. All accesses are single accesses to
DRAM. If the PCS chip selects are decoded to be in the DRAM address range, PCS
accesses take precedence over the DRAM.
1.4.4.3 Chip Selects (Chapter 5)
The microcontroller provides six chip select outputs for use with memory devices and eight
more chip selects for use with peripherals in either memory or I/O space. The six memory
chip selects can address three memory ranges. Each peripheral chip select addresses a
256-byte block offset from a programmable base address.
The microcontroller can be programmed to sense a ready signal for each of the peripheral
or memory chip select lines. A bit in each chip select control register determines whether
the external ready signal is required or ignored.
In addition, the chip selects can control the number of wait states inserted in the bus cycle.
Although most memory and peripheral devices can be accessed with three or less wait
states, some slower devices cannot. This feature allows devices to use wait states to slow
down the bus.
The chip select lines are active for all memory and I/O cycles in their programmed areas,
whether the cycles are generated by the CPU or by the integrated DMA unit.
General enhancements over the original 80C186 include bus mastering (three-state)
support for all chip selects, and activation only when the associated register is written (not
when it is read).
1.4.5 In-Circuit Emulator Support (Chapter 4)
Because pins are an expensive resource, many play a dual role, and the programmer selects
PIO operation or an alternate function. However, a pin configured to be a PIO may also be
required for emulation support. Therefore, it is important that before a design is committed
to hardware, a user contact potential emulator suppliers for a list of emulator pin
requirements.
The Am186CC/CH/CU microcontrollers are designed to minimize conflicts. In most cases,
pin conflict is avoided. For example, if the ALE signal is required for multiplex bus support,
then it would not be programmed as PIO33. If the multiplexed AD bus is not used for address
determination, then ALE can be programmed as a PIO pin.
1.5 APPLICATIONS
The Am186CC/CH/CU microcontrollers, with their integrated communications features,
provide highly integrated, cost-effective solutions for a wide range of telecommunications
and networking applications.
CC ■ Digital Corded Phones: Typical digital telephone applications use up to three channels
of HDLC and may use USB for merged PC telephony applications.
CC CH ■ Industrial Control: Embedded x86 processors have long been used in the industrial
control market. These applications often require a robust, high-performance processor
solution with the capability to easily communicate with other parts of a system. The
Am186CC and Am186CH microcontrollers provide numerous interfaces to achieve this
communication, including the SSI interface, high-speed UART, and the HDLC channels,
which also can be used to create a multidrop backplane.
CC CU ■ USB Peripheral Devices: These devices will become more common as the PC market
embraces the USB protocol specified by the Microsoft™ Windows 98 operating system.
In addition to implementing communications device class systems such as an ISDN
terminal adapter, the USB peripheral controller makes the Am186CC and Am186CU
USB microcontrollers suitable for certain PC desktop applications such as a USB camera
interface, ink-jet printers, and scanners.
■ General Communications Applications: The Am186CC/CH/CU microcontrollers will
also find a home in general embedded applications, because many devices will
incorporate communications capability in the future. These microcontrollers are
especially attractive for 186 designs adding HDLC, USB, or both.
The block diagrams beginning on page 1-5 show some typical designs. Figure 1-4 shows
an ISDN terminal adapter. Figure 1-5 shows a low-end router. Figure 1-6 shows a 32-
channel linecard.
The ISDN terminal adapter features an S/T or U interface and either a high-speed UART
or USB connection for attaching the modem to the PC.
The ISDN-to-Ethernet low-end router features an S/T or U interface, two POTS lines, and
a 10-Mbit/s connection to the PC.
The 32-channel linecard design demonstrates a linecard application where 32 lines
terminate on the linecard.
2 CONFIGURATION BASICS
2.1 OVERVIEW
All members of the Am186 family, including the Am186CC/CH/CU microcontrollers, build
on the same core set of internal processor registers, instructions, and addressing modes.
All members are compatible with the original industry-standard 186 parts.
This chapter provides basic information about configuring the microcontrollers, including
discussions of the registers, memory organization, address generation, I/O space,
peripheral control block, instruction set, segments, data types, and addressing modes.
2.2 REGISTER SET
The microcontroller contains hundreds of configuration and control registers, both internal
and external to the processor. The instruction set contains instructions to access the internal
processor registers directly. Peripheral registers are external to the processor. However,
because the processor treats these peripheral registers either like memory or like I/O,
instructions with memory or I/O operands can access peripheral registers. This section
briefly describes these processor and peripheral registers. For detailed information on the
microcontroller peripheral registers, see the Am186™CC/CH/CU Microcontrollers Register
Set Manual, order #21916.
2.2.1 Processor Registers
The base architecture of the Am186CC/CH/CU microcontrollers has 14 registers, like all
members of the Am186 family. Table 2-1 lists these registers.
After the processor executes an instruction, the value of the flags can be set to 1, cleared
or reset to 0, unchanged, or undefined. The term undefined means that the flag value prior
to the execution of the instruction is not preserved, and that after the instruction is executed,
the value of the flag cannot be predicted.
15 7 0
Reserved
OF AF PF CF
DF Res Res Res
IF
TF
SF
ZF
The PCB base address can be set to any even 1-Kbyte boundary in memory or I/O space
(i.e., the lower 10 bits of the base address must be 0). RELOC resides in the last register
address of the PCB, at offset 03FEh. On an external or watchdog timer reset, the RELOC
register value is set to 20FCh, which maps the PCB to start at FC00h in I/O space. This
places the RELOC register at FFFEh. Appendix A, “Register Summary,” provides a
summary of PCB registers in offset order, including default address locations. For a
complete description of the RELOC register, see the Am186™CC/CH/CU Microcontrollers
Register Set Manual, order #21916.
A legacy feature on the Am186CC/CH/CU microcontrollers allows logical word writes to
the PCB registers to be performed as byte writes on the external bus. These writes transfer
16 bits of data to the PCB register even if an 8-bit register is named in the instruction. For
example, “out dx, al” writes the value of AX to the port address in DX. Reads to the PCB
registers should always be done as word reads. This feature eliminates the need for an
additional bus cycle when the same code is executed on an 8-bit Am188 device or when
the PCB overlaps an 8-bit address space. Unaligned reads and writes to the PCB result in
unpredictable behavior on the Am186CC/CH/CU microcontrollers.
Internal logic recognizes control block addresses and responds to bus cycles. During bus
cycles to internal registers, the bus controller signals the operation externally (i.e., the RD,
WR, status, address, and data lines are driven as in a normal bus cycle), but the data bus,
SRDY, and ARDY are ignored.
Table 2-3 lists the peripheral registers by functional groupings, along with the address offset
where the group begins. For detailed information about the peripheral registers, refer to the
Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916.
For example, if the segment register is loaded with 12A4h and the offset is 0022h, the
resultant address is 12A62h, as illustrated in Figure 2-3. To find the result:
1. The segment register contains 12A4h.
2. Shift the segment register left 4 places to produce 12A40h.
3. The offset is 0022h.
4. Add the shifted segment address (12A40h) to the offset (00022h). The result is 12A62h.
5. This address is placed on the pins of the microcontroller.
All instructions that address operands in memory must specify (implicitly or explicitly) a
16-bit segment value and a 16-bit offset value. The 16-bit segment values are contained in
one of the four internal segment registers (CS, DS, ES, and SS). For more information about
calculating the offset value, see “Addressing Modes” on page 2-9. For more information
about CS, DS, ES, and SS, see “Segments” on page 2-7.
In addition to 1 Mbyte of memory space, the Am186CC microcontroller provides 64K of I/O
space (see Figure 2-4). Note that the processor reserves 00000h to 003FFh in memory for
the interrupt vector table.
Shift 15 0
Left Segment Base
1 2 A 4
4 Bits Logical
15 0 Address
Offset
0 0 2 2
19 0
1 2 A 4 0
15 0
0 0 0 2 2
19 0
Physical Address
1 2 A 6 2
To Memory
Memory
1 Mbyte Space1
FFFFh
I/O
64 Kbyte
Space2
00000h 0000h
Notes:
1. 00000h–003FFh are reserved for the interrupt vector table.
2. 00F8h–00FFh are reserved.
In general, individual data elements must fit within defined segment limits. Figure 2-5
graphically represents the data types supported by the Am186CC/CH/CU microcontrollers.
Any carry from the 16-bit addition is ignored. Eight-bit displacements are sign-extended to
16-bit values.
Combinations of the above three address elements define the following six memory
addressing modes (see Table 2-5 for examples).
■ Direct Mode: The instruction contains the operand offset as an 8-bit or 16-bit
displacement element.
■ Register Indirect Mode: The operand offset is in one of the following registers: SI, DI,
BX, or BP.
■ Based Mode: The operand offset is the sum of an 8-bit or 16-bit displacement and the
contents of a base register (BX or BP).
■ Indexed Mode: The operand offset is the sum of an 8-bit or 16-bit displacement and
the contents of an index register (SI or DI).
■ Based Indexed Mode: The operand offset is the sum of the contents of a base register
and an index register.
■ Based Indexed Mode with Displacement: The operand offset is the sum of a base
register’s contents, an index register’s contents, and an 8-bit or 16-bit displacement.
3 SYSTEM OVERVIEW
3.1 OVERVIEW
This chapter contains descriptions of the Am186CC/CH/CU microcontrollers’ system
configuration registers, initialization and processor reset, signals, bus interface, and clock
control.
3.2 SYSTEM DESIGN
Table 3-1 shows the multiplexed signals and the trade-offs when selecting various functions.
Table 3-2 on page 3-3 shows the multiplexed signal information ordered by PIO signal.
USBSOF USBSCI
UCLK 22 — — PIO21
CC CU CC CU
USBSOF USBSCI
Clocks 22 Clocks UCLK Clocks — — PIO PIO21
CC CU CC CU
USBSCI USBSOF
22 UCLK — — PIO21
CC CU CC CU
When RES is asserted, the Reset Configuration (RESCON) register is set to the value
found on AD15–AD0. There is a one-to-one correspondence between address/data bus
signals and the RESCON register’s bits during reset (AD15 corresponds to bit 15 of the
RESCON register, and so on). When RES is deasserted, the RESCON register holds its
value. Software can read this value to determine the configuration information. For more
information, see “Initialization and Reset” on page 3-5.
The System Configuration (SYSCON) register is typically written once to establish the
proper modes of operation based on the system in which the part is operating. This register
performs the following functions:
■ Enables the data strobe timings on the DEN pin. When the DSDEN bit (bit 13) is set
to 1, data strobe bus mode is enabled, and the DS timing for reads and writes is identical
to the normal read cycle DEN timing. When the DSDEN bit is cleared to 0, the DEN
timing for both reads and writes is normal (i.e., like the original 80C186). The DEN pin
is renamed DS in data strobe bus mode. For more information, see “Bus Interface” on
page 3-28.
■ Enables Pulse Width Demodulation (PWD) mode. For more information about PWD
mode, see Chapter 10, “Programmable Timers.”
■ Disables memory and I/O addresses on the AD15–AD0 bus. For more information, see
“Bus Interface” on page 3-28.
■ Configures HDLC Channel C and D external interfaces. For more information, see
Chapter 15, “High-Level Data Link Control (HDLC).”
■ Disables CLKOUT and forces the pin to drive a zero externally. For more information,
see “Clock Control” on page 3-32.
The Processor Revision Level (PRL) register contains the processor revision level for the
device. Use this information when requesting support.
3.4 INITIALIZATION AND RESET
This document uses the following terms throughout:
■ External or power-on reset: A reset caused by asserting RES.
■ Internal reset: A reset initiated by the watchdog timer.
■ System reset: Resets the microcontroller (the CPU plus the internal peripherals) as
well as any external peripherals connected to RESOUT. An external reset always causes
a system reset; an internal reset can optionally cause a system reset.
Processor initialization or startup is accomplished by either an external reset or by an
internal reset initiated by the watchdog timer. Resets force the microcontroller to terminate
all execution and local bus activity. No instruction or bus activity occurs as long as the
processor is in reset.
In all resets, the multiplexed pins default to the signal as shown in Table 3-7 on page 3-10
(the signal name without brackets). Pins are latched on the deassertion of RES, and
therefore are not affected by an internal watchdog-timer-generated reset. These latched
pins include the reset configuration pins (pinstraps) shown in Table 3-5 on page 3-7 and
the RESCON register inputs.
After an external or internal reset has completed and an internal processing interval elapses,
the microcontroller begins execution with the instruction at physical location FFFF0h and
the watchdog timer starts counting (reset enables the watchdog timer). RES must be
asserted for at least 1 ms during power-up to allow the internal circuits to stabilize. If the
RES signal is asserted while the watchdog timer is performing a watchdog timer reset, the
external reset takes precedence.
The Am186CC/CH/CU microcontrollers also feature a Reset Out (RESOUT) signal, which
indicates that the microcontroller is being reset (either externally or internally) and can be
used as a system reset to reset any external peripherals connected to RESOUT.
During an external reset, RESOUT remains active (High) for two clocks after RES is
deasserted. The microcontroller exits reset and begins the first valid bus cycle
approximately 4.5 clocks after RES is deasserted.
With an internal reset, the watchdog timer reset duration, and therefore the duration of the
RESOUT signal, is 216 processor clocks. This duration allows sufficient time for external
devices to reach their reset state. For more information about internal resets, see
Chapter 11, “Watchdog Timer.”
Both external and internal resets set the registers to predefined values as shown in
Appendix A, “Register Summary,” with the exception of the RESCON and WDTCON
registers whose default values depend on the type of reset.
The Reset Configuration (RESCON) register latches system-configuration information that
is presented to the processor on the address/data bus (AD15–AD0) at the deassertion of
RES. The interpretation of this information is system-specific. The processor does not
impose any predetermined interpretation, but simply provides a means for communicating
this information to software. When the RES input is asserted, the contents of the AD bus
are written into the RESCON register. Note that the RESCON value is only sampled on an
external reset. The system can place configuration information on the AD bus using weak
external pullup or pulldown resistors, or using an external driver that is enabled during reset.
The processor does not drive the AD bus during reset. For example, the RESCON register
could be used to provide the software with the position of a configuration switch in the
system. By using weak external pullup and pulldown resistors on the AD bus, the system
could provide the microcontroller with a value corresponding to the position of a jumper
during reset.
For compatibility with future devices, always write reserved bits in registers with their reset
default values. The Am186™CC/CH/CU Microcontrollers Register Set Manual, order
#21916, defines the bits for all the registers.
Table 3-4 CPU and Internal Peripheral States Immediately Following Power-On Reset
CPU/Peripheral State
Am186 CPU Enabled, executes at address FFFF0h
Chip Selects UCS active, all other chip selects inactive
DRAM Controller Disabled
Disabled—only nonmaskable interrupts and traps can
Interrupt Controller
be taken
General-Purpose DMA and SmartDMA Channels Disabled
Programmable I/Os See Chapter 9, “Programmable I/O Signals”
Programmable Timers Disabled
Watchdog Timer Enabled with maximum time-out value (2 16 clocks)
UART and High-Speed UART Disabled
Synchronous Serial Interface (SSI) Disabled
High-level Data Link Control (HDLC) Channels CC CH Disabled
USB External Transceiver Enable asserted Low disables the internal USB trans-
{USBXCVR} ceiver and enables the pins needed to hook up an external transceiver. This pin has
S0
CC CU a pullup resistor that is active only during reset, so no external pullup is required as
long as the user ensures that this input is not driven Low during a power-on reset.
Notes:
1. A pinstrap is used to enable or disable features based on the state of the pin during an external reset. The pinstrap must be
held in its desired state for at least 4.5 clock cycles after the deassertion of RES. The pinstraps are sampled in an external
reset only (when RES is asserted), not during an internal watchdog timer-generated reset.
In addition, during a reset the state of the address and data bus
pins (AD15–AD0) is latched into the Reset Configuration
(RESCON) register. This feature can be used to provide software
with information about the external system at reset time.
Address Latch Enable indicates to the system that an address
appears on the address and data bus (AD15–AD0). The address
is guaranteed valid on the falling edge of ALE.
ALE [PIO33] O
WLB and WHB implement the functionality of BHE and AD0 for
high and low byte write enables, and they have timing
appropriate for use with the nonmultiplexed bus interface.
DEN
[DS] O When [DS] is asserted, addresses are valid. When [DS] is
[PIO30] asserted on writes, data is valid. When [DS] is asserted on reads,
data can be driven on the AD bus.
S1 — O 0 0 0 Reserved
0 0 1 Read data from I/O
S0 {USBXCVR} 0 1 0 Write data to I/O
0 1 1 Halt
1 0 0 Instruction fetch
1 0 1 Read data from memory
1 1 0 Write data to memory
1 1 1 None (passive)
RESOUT — O
During an external reset, RESOUT remains active (High) for two
clocks after RES is deasserted. The microcontroller exits reset
and begins the first valid bus cycle approximately 4.5 clocks after
RES is deasserted.
[USBSOF] UART Clock can be used instead of the processor clock as the
source clock for either the UART or the High-Speed UART. The
[UCLK] [USBSCI] STI
source clock for the UART and the High-Speed UART are
PIO21 selected independently and both can use the same source.
USB Controller Crystal Input (USBX1) and USB Controller
Crystal Output (USBX2) provide connections for a fundamental
— STI mode, parallel-resonant crystal used by the internal USB
USBX1 CC CU
oscillator circuit.
USBX2 CC CU — O
If the CPU crystal is used to generate the USB clock, USBX1
must be pulled down.
X1 — O CPU Crystal Input (X1) and CPU Crystal Output (X2) provide
connections for a fundamental mode, parallel-resonant crystal
used by the internal oscillator circuit. If an external oscillator is
X2 — STI used, inject the signal directly into X1 and leave X2 floating.
RSVD_75 CH —
On the Am186CH HDLC microcontroller, the RSVD_75 pin
RSVD_76 CH — should be tied externally to VSS.
RSVD_80 CH —
On the Am186CH HDLC microcontroller, pins RSVD_75,
RSVD_81 CH — RSVD_76, RSVD_80, RSVD_81, and RSVD_101–RSVD_104
RSVD_101 UTXDPLS and are reserved.
RSVD_102 UTXDMNS
— On the Am186CC and Am186CU microcontrollers, pins
RSVD_103 UXVOE RSVD_101–RSVD_104 are reserved unless pinstrap
RSVD_104 UXVRCV {USBXCVR} is sampled Low on the rising edge of RESET.
RSVD_116 CU —
On the Am186CU USB microcontroller, pins RSVD_119–
RSVD_117 CU — RSVD_116 are reserved.
RSVD_118 CU —
All other reserved pins should not be connected.
RSVD_119 CU —
POWER AND GROUND
VCC (15) CC CU Digital Power Supply pins supply power (+3.3 ± 0.3 V) to the
— STI
CH
microcontroller logic.
(16)
Analog Power Supply pin supplies power (+3.3 ± 0.3 V) to the
VCC _A (1) — STI
oscillators and PLLs.
VCC _USB (1) USB Power Supply pin supplies power (+3.3 ± 0.3 V) to the
— STI
CC CU USB block.
VSS (15) CC CU Digital Ground pins connect the microcontroller logic to the
— STI
CH system ground.
(16)
Analog Ground pin connects the oscillators and PLLs to the
VSS _A (1) — STI
system ground.
VSS _USB (1) CC CU — STI USB Ground pin connects the USB block to the system ground.
The following signals are also used by emulators: A19–A0, AD15–AD0, {ADEN}, ALE, ARDY, BHE, BSIZE8, CAS1–
CAS0, CLKOUT, {CLKSEL2}–{CLKSEL1}, HLDA, HOLD, LCS, MCS3–MCS0, NMI, {ONCE}, QS1–QS0, RAS1–
RAS0, RD, RES, RESOUT, S2–S0, S6, SRDY, UCS, {UCSX8}, WHB, WLB, WR. For more information, see
Chapter 4, “Emulator Support.”
CHIP SELECTS
Lower Memory Chip Select indicates to the system that a
memory access is in progress to the lower memory block. The
base address and size of the lower memory block are
LCS [RAS0] O
programmable up to 512 Kbyte. LCS can be configured for 8-bit
or 16-bit bus size. LCS is three-stated with a pullup resistor
during bus-hold or reset conditions.
Midrange Memory Chip Selects 0–3 indicate to the system
that a memory access is in progress to the corresponding region
of the midrange memory block. The base address and size of
[MCS0] {UCSX8} the midrange memory block are programmable. The midrange
PIO4 chip selects can be configured for 8-bit or 16-bit bus size. The
midrange chip selects are three-stated with pullup resistors
MCS1 [CAS1] during bus-hold or reset conditions.
O
MCS2 [CAS0] [MCS0] can be programmed as the chip select for the entire
middle chip select address range.
[MCS3] [RAS1]
PIO5 Unlike the UCS and LCS chip selects that operate relative to the
earlier timing of the nonmultiplexed A address bus, the MCS
outputs assert with the multiplexed AD address and data bus
timing.
UCS {ONCE} O
The UCS can be configured for an 8-bit or 16-bit bus size out of
reset. For additional information, see the {UCSX8} pin
description in Table 3-5 on page 3-7.
After reset, UCS is active for the 64-Kbyte memory range from
F0000h to FFFFFh, including the reset address of FFFF0h.
[MCS3] Row Address Strobe 1: When the upper chip select region is
[RAS1] O configured to DRAM, this pin provides the row address strobe
PIO5
signal to the upper DRAM bank.
INTERRUPTS
INT5–INT0 — STI Maskable Interrupt Requests 0–8 indicate to the
[INT6] PIO19 microcontroller that an external interrupt request has occurred.
If the individual pin is not masked, the microcontroller transfers
[INT7] PIO7 program execution to the location specified by the associated
interrupt vector in the microcontroller’s interrupt vector table.
[TMROUT0] PIO28 O Timer Outputs 0–1 supply the system with either a single pulse
or a continuous waveform with a programmable duty cycle.
[TMROUT1]–[TMROUT0] are three-stated during bus-hold or
[TMROUT1] PIO1 O reset conditions.
ASYNCHRONOUS SERIAL PORTS (UART AND HIGH-SPEED UART)
UART
DCE_RXD_D Receive Data UART is the asynchronous serial receive data
[RXD_U] [PCM_RXD_D] STI signal that supplies data from the asynchronous serial port to
PIO26 the microcontroller.
[DCE_TXD_D] Transmit Data UART is the asynchronous serial transmit data
[TXD_U] [PCM_TXD_D] O signal that supplies data to the asynchronous serial port from
PIO20 the microcontroller.
Clear-To-Send UART provides the Clear-to-Send signal from
the asynchronous serial port when hardware flow control is
enabled for the port. The [CTS_U] signal gates the transmission
[DCE_TCLK_D] of data from the serial port transmit shift register. When [CTS_U]
is asserted, the transmitter begins transmission of a frame of
[CTS_U] [PCM_FSC_D] STI
data, if any is available. If [CTS_U] is deasserted, the transmitter
PIO24 holds the data in the serial port transmit shift register. The value
of [CTS_U] is checked only at the beginning of the transmission
of the frame. [CTS_U] and [RTR_U] form the hardware
handshaking interface for the UART.
Ready-To-Receive UART provides the Ready-to-Receive
DCE_RCLK_D signal for the asynchronous serial port when hardware flow
control is enabled for the port. The [RTR_U] signal is asserted
[RTR_U] [PCM_CLK_D] O
when the associated serial port receive data register does not
PIO25 contain valid, unread data. [CTS_U] and [RTR_U] form the
hardware handshaking interface for the UART.
HIGH-SPEED UART
Receive Data High-Speed UART is the asynchronous serial
[RXD_HU] PIO16 STI receive data signal that supplies data from the high-speed serial
port to the microcontroller.
Transmit Data High-Speed UART is the asynchronous serial
TXD_HU — O transmit data signal that supplies data to the high-speed serial
port from the microcontroller.
DCE_RXD_A [GCI_DD_A] DCE Receive Data Channel A is the serial data input pin for
STI
CC CH [PCM_RXD_A] the channel A DCE interface.
DCE_TXD_A [GCI_DU_A] OD- DCE Transmit Data Channel A is the serial data output pin for
CC CH [PCM_TXD_A] O the channel A DCE interface.
DCE Receive Clock Channel A provides the receive clock to
the channel A DCE interface. If the same clock is to be used for
both transmit and receive, then this pin should be tied to the
DCE_RCLK_A [GCI_DCL_A]
STI DCE_TCLK_A pin externally.
CC CH [PCM_CLK_A]
The DCE function is the default at reset, so the board designer
is responsible for properly terminating the DCE_RCLK_A input.
DCE Transmit Clock Channel A provides the transmit clock to
the channel A DCE interface. If the same clock is to be used for
both transmit and receive, then this pin should be tied to the
DCE_TCLK_A [GCI_FSC_A]
STI DCE_RCLK_A pin externally.
CC CH [PCM_FSC_A]
The DCE function is the default at reset, so the board designer
is responsible for properly terminating the DCE_TCLK_A input.
[DCE_RXD_B] [PCM_RXD_B] DCE Receive Data Channel B is the serial data input pin for
STI
CC CH PIO36 the channel B DCE interface.
[DCE_TXD_B] [PCM_TXD_B] OD- DCE Transmit Data Channel B is the serial data output pin for
CC CH PIO37 O the channel B DCE interface.
DCE Receive Clock Channel B provides the receive clock to
[DCE_RCLK_B] [PCM_CLK_B] the channel B DCE interface. If the same clock is to be used for
STI
CC CH PIO40 both transmit and receive, this pin should be tied to the
[DCE_TCLK_B] pin externally.
DCE Transmit Clock Channel B provides the transmit clock to
[DCE_TCLK_B] [PCM_FSC_B] the channel B DCE interface. If the same clock is to be used for
STI
CC CH PIO41 both transmit and receive, this pin should be tied to the
[DCE_RCLK_B] pin externally.
DCE Clear-To-Send Channel B indicates to the channel B DCE
[DCE_CTS_B] [PCM_TSC_B] interface that an external serial interface is ready to receive data.
STI
CC CH PIO38 [DCE_CTS_B] and [DCE_RTR_B] provide the handshaking for
the channel B DCE interface.
DCE Ready-to-Receive Channel B indicates to an external
[DCE_RTR_B] serial interface that the internal channel B DCE interface is ready
PIO39 O
CC CH to accept data. [DCE_CTS_B] and [DCE_RTR_B] provide the
handshaking for the channel B DCE interface.
HDLC Channel C (DCE) CC
[PCM_RXD_C] DCE Receive Data Channel C is the serial data input pin for
[DCE_RXD_C] CC STI
PIO42 the channel C DCE interface.
[PCM_TXD_C] OD- DCE Transmit Data Channel C is the serial data output pin for
[DCE_TXD_C] CC
PIO43 O the channel C DCE interface.
DCE Receive Clock Channel C provides the receive clock to
[PCM_CLK_C] the channel C DCE interface. If the same clock is to be used for
[DCE_RCLK_C] CC STI
PIO22 both transmit and receive, this pin should be tied to the
[DCE_TCLK_C] pin externally.
DCE Transmit Clock Channel C provides the transmit clock to
[PCM_FSC_C] the channel C DCE interface. If the same clock is to be used for
[DCE_TCLK_C] CC STI
PIO23 both transmit and receive, this pin should be tied to the
[DCE_RCLK_C] pin externally.
DCE Clear-To-Send Channel C indicates to the channel C DCE
[PCM_TSC_C] interface that an external serial interface is ready to receive data.
[DCE_CTS_C] CC STI
PIO44 [DCE_CTS_C] and [DCE_RTR_C] provide the handshaking for
the channel C DCE interface.
[RXD_U] (UART)
DCE Receive Data Channel D is the serial data input pin for
DCE_RXD_D CC [PCM_RXD_D] STI
the channel D DCE interface.
PIO26
[TXD_U] (UART)
OD- DCE Transmit Data Channel D is the serial data output pin for
[DCE_TXD_D] CC [PCM_TXD_D]
O the channel D DCE interface.
PIO20
[RTR_U] (UART) DCE Receive Clock Channel D provides the receive clock to
the channel D DCE interface. If the same clock is to be used for
DCE_RCLK_D CC [PCM_CLK_D] STI
both transmit and receive, then this pin should be tied to the
PIO25 [DCE_TCLK_D] pin externally.
[CTS_U] (UART) DCE Transmit Clock Channel D provides the transmit clock to
the channel D DCE interface. If the same clock is to be used for
[DCE_TCLK_D] CC [PCM_FSC_D] STI
both transmit and receive, then this pin should be tied to the
PIO24 DCE_RCLK_D pin externally.
[CTS_HU] (High- DCE Clear-To-Send Channel D indicates to the channel D DCE
Speed UART) interface that an external serial interface is ready to receive data.
[DCE_CTS_D] CC STI
[PCM_TSC_D] [DCE_CTS_D] and [DCE_RTR_D] provide the handshaking for
PIO46 DCE Channel D.
DCE Ready-To-Receive Channel D indicates to an external
[RTR_HU] (High-
serial interface that the internal channel D DCE interface is ready
[DCE_RTR_D] CC Speed UART) O
to accept data. [DCE_CTS_D] and [DCE_RTR_D] provide the
PIO47 handshaking for the channel D DCE interface.
HDLC Channel A (PCM) CC CH
[PCM_RXD_A] DCE_RXD_A PCM Receive Data Channel A is the serial data input pin for
STI
CC CH [GCI_DD_A] the channel A PCM Highway interface.
[PCM_TXD_A] DCE_TXD_A O-
PCM Transmit Data Channel A is the serial data output pin for
LS-
CC CH [GCI_DU_A] the channel A PCM Highway interface.
OD
[PCM_CLK_A] DCE_RCLK_A PCM Clock is the single transmit and receive data clock pin for
STI
CC CH [GCI_DCL_A] the channel A PCM Highway interface.
[PCM_RXD_B] [DCE_RXD_B] PCM Receive Data Channel B is the serial data input pin for
STI
CC CH PIO36 the channel B PCM Highway interface.
[PCM_TXD_B] O-
[DCE_TXD_B] PCM Transmit Data Channel B is the serial data output pin for
LS-
CC CH PIO37 the channel B PCM Highway interface.
OD
[PCM_CLK_B] [DCE_RCLK_B] PCM Clock is the single transmit and receive data clock pin for
STI
CC CH PIO40 the channel B PCM Highway interface.
[DCE_RXD_C] PCM Receive Data Channel C is the serial data input pin for
[PCM_RXD_C] CC STI
PIO42 the channel C PCM Highway interface.
O-
[DCE_TXD_C] PCM Transmit Data Channel C is the serial data output pin for
[PCM_TXD_C] CC LS-
PIO43 the channel C PCM Highway interface.
OD
PCM Clock: For PCM Highway operation, [PCM_CLK_C] is the
[DCE_RCLK_C] single transmit and receive data clock input pin for the channel
[PCM_CLK_C] CC B C PCM Highway interface. [PCM_CLK_C] becomes a clock
PIO22
source output when the GCI to PCM Highway clock and frame
synchronization conversion are enabled.
PCM Frame Synchronization Clock: For PCM Highway
operation, [PCM_FSC_C] provides the Frame Synchronization
[DCE_TCLK_C] Clock input (usually 8 kHz) for the channel C PCM Highway
[PCM_FSC_C] CC B
PIO23 interface. [PCM_FSC_C] becomes a frame synchronization
source output when the GCI to PCM Highway clock and frame
synchronization conversion are enabled.
PCM Time Slot Control C enables an external buffer device
[DCE_CTS_C]
[PCM_TSC_C] CC OD when channel C PCM Highway data is present on the
PIO44 [PCM_TXD_C] output pin in PCM Highway mode.
HDLC Channel D (PCM) CC
[RXD_U] (UART)
PCM Receive Data Channel D is the serial data input pin for
[PCM_RXD_D] CC DCE_RXD_D STI
the channel D PCM Highway interface.
PIO26
[TXD_U] (UART) O-
PCM Transmit Data Channel D is the serial data output pin for
[PCM_TXD_D] CC [DCE_TXD_D] LS-
the channel D PCM Highway interface.
PIO20 OD
[RTR_U] (UART)
PCM Clock is the single transmit and receive data clock pin for
[PCM_CLK_D] CC DCE_RCLK_D STI
the channel D PCM Highway interface.
PIO25
DCE_RXD_A BO GCI Data Downstream is the serial data input pin for the channel
[GCI_DD_A] CC
[PCM_RXD_A] D A GCI interface.
DCE_TXD_A BO GCI Data Upstream is the serial data output pin for the channel
[GCI_DU_A] CC
[PCM_TXD_A] D A GCI interface.
DCE_RCLK_A GCI Data Clock is the single transmit and receive channel A
[GCI_DCL_A] CC STI GCI data clock input generated by an upstream device. The data
[PCM_CLK_A]
clock frequency must be twice the data rate.
GCI Frame Synchronization Clock provides the 8-kHz Frame
DCE_TCLK_A
[GCI_FSC_A] CC STI Synchronization Clock input for the channel A GCI interface
[PCM_FSC_A]
generated by an upstream device.
UNIVERSAL SERIAL BUS (USB) CC CU
USBD+ CC CU [UDPLS] B USB Differential Plus and USB Differential Minus form the
bidirectional electrical data interface for the USB port. The pins
form a differential pair that can be connected to a physical USB
USBD– CC CU [UDMNS] B connector without an external transceiver.
MA8–MA0
WE
Flash Memory
(x8 or x16)
WR WE
A19–A0 Address
OE
Data
CAS0 CAS0
CAS1 CAS1
RAS0 RAS0
UCS CS
RD OE
Flash Memory (x8 or x16)
A19–A0 Address
AD15–AD0 Data
Am186CC/CH/CU
Microcontroller
MCS0 CS
LCS OE
WLB WE
D7–D0
Data
Address
OE
x16 SRAM
CS
WE
WE
3.6.3 Operation
3.6.3.1 Address and Data Buses
The 80C186 and 80C188 microcontrollers use a multiplexed address and data (AD) bus.
The address is present on the AD bus only during the t1 clock phase. The Am186CC/CH/CU
microcontrollers provide the multiplexed AD bus and, in addition, provide a nonmultiplexed
address (A) bus. The A bus provides an address to the system for the complete bus cycle.
During refresh cycles, the AD bus is driven during the t1 phase and the values are three-
stated during the t2, t3, and t4 phases. The value driven on the A bus is undefined during
a refresh cycle.
The nonmultiplexed address bus (A19–A0) is valid one-half CLKOUT cycle in advance of
the address on the AD bus. When used with the modified UCS and LCS outputs and the
byte write enable signals, the A19–A0 bus provides a seamless interface to external SRAM,
DRAM, and Flash/EPROM memory systems.
For systems where power consumption is a concern, it is possible to disable the address
from being driven on the AD bus on the microcontroller during the normal address portion
of the bus cycle for accesses to RAS0, RAS1, upper (UCS), and lower (LCS) address
spaces. In this mode, the affected bus is placed in a high-impedance state during the
address portion of the bus cycle. This feature is enabled through the DA bits (bit 7) in the
Upper Memory Chip Select (UMCS) and Lower Memory Chip Select (LMCS) registers. In
addition, the DISMEM bit (bit 11, for memory addresses) and the DISIO bit (bit 10, for I/O
addresses) in the SYSCON register serve as global address disables to prevent address
bits from appearing on the AD15–AD0 bus. Setting the DISMEM bit overrides clearing the
DA bits.
When address disable is in effect, the number of signals that assert on the bus during all
normal bus cycles to the associated address space is reduced, thus decreasing power
consumption, reducing processor switching noise, and preventing bus contention with
memory devices and peripherals when operating at high clock rates. For more information
about chip selects, see Chapter 5, “Chip Selects.”
If the ADEN pin is asserted during processor reset, the values of the DA, DISMEM, and
DISIO bits are ignored and the address is driven on the AD bus for all accesses, thus
preserving the industry-standard 80C186 and 80C188 microcontrollers’ multiplexed
address bus and providing support for existing emulation tools.
For timing diagrams, see the data sheets for the Am186CC/CH/CU microcontrollers. For
more information about the registers, see the Am186™CC/CH/CU Microcontrollers
Register Set Manual, order #21916.
3.6.3.2 Programmable Bus Sizing
The 80C186 microcontroller provided a 16-bit wide data bus over its entire memory and
I/O address ranges, but did not allow accesses to an 8-bit wide bus. However, the data bus
width on the Am186CC/CH/CU microcontrollers is programmable through the Upper
Memory Chip Select (UMCS), Lower Memory Chip Select (LMCS), and PCS and MCS
Auxiliary (MPCS) registers. The USIZ bit (bit 5) in the UMCS register determines the width
of the data bus for memory accesses to the upper memory region and the LSIZ bit (bit 5)
in the LMCS register determines the width for the lower memory region. The OMSIZ bit
(bit 5) in the MPCS register specifies the width of the data bus for memory accesses to all
non-upper and non-lower memory regions (i.e., MCS space, PCS space in memory, and
the remaining memory space that does not reside in one of the enabled chip-select memory
regions). The IOSIZ bit (bit 5) in the MPCS register specifies the width of the data bus for
all I/O accesses. Table 3-8 shows how the bit settings affect bus size.
The width of the data access should not be modified while the processor is fetching
instructions from the associated address space or while the peripheral control block is
overlaid on the affected address space.
CC CU The Am186CC and Am186CU microcontrollers also include the Universal Serial Bus (USB)
clock with the following features:
■ One independent crystal-controlled oscillator that uses an external fundamental mode
crystal or oscillator to generate the USB input clock.
■ One internal PLL that generates the 48-MHz clock required for the USB from either a
24-MHz or 12-MHz input.
■ Single clock source operation possible by sharing the clock source between the system
and the USB.
CC CH The Am186CC and Am186CH microcontrollers also include the transmitter/receiver clocks
for each High-level Data Link Control (HDLC) channel.
CC In the Am186CC microcontroller, each HDLC channel receives its clock inputs directly from
the external communication clock pins (TCLK _X and RCLK_X) in all modes except in GCI
mode. In GCI mode the external GCI communication clocks (TCLK_A and RCLK_A) are
first converted to an internal clocking format (analogous to PCM Highway) before
presentation to the HDLC. The system clock must be at least the same frequency as any
HDLC clock. The Am186CC microcontroller supports the following clock frequencies:
■ HDLC DCE mode supports clocks up to 10 MHz.
■ HDLC PCM mode supports clocks up to 10 MHz.
■ HDLC GCI mode supports a 1.536-MHz clock input. (System clock must be at least
twice the GCI clock.)
CH In the Am186CH HDLC microcontroller, each HDLC channel receives its clock inputs
directly from the external communication clock pins (TCLK _X and RCLK_X) in all modes.
The system clock must be at least the same frequency as any HDLC clock. The Am186CH
HDLC microcontroller supports the following clock frequencies:
■ HDLC DCE mode supports clocks up to 10 MHz.
■ HDLC PCM mode supports clocks up to 10 MHz.
Am186CC/CH/CC Microcontroller
CPU Clock
1x
2x CLKOUT
PLL
X1 X2 4x
{CLKSEL2}–{CLKSEL1}
CC CU 48-MHz
USB Clock
USBX1 UXBX2 2x
PLL 4x
{USBSEL2}–{USBSEL1}
CC CU In the Am186CC and Am186CU microcontrollers, the USB PLL and USBX1 determine the
USB clock. USB requires the CPU clock to be 24 MHz or greater. Therefore, disable the
USB peripheral controller before slowing the CPU clock to less than 24 MHz. If USB is not
used, you can pull down USBX1.
CC CH In the Am186CC and Am186CH microcontrollers, the system clock must be at the same
or a greater frequency than the HDLC clock and UCLK (if using UCLK). Therefore, if
reducing the system clock frequency, disable these interfaces or run them at a lower
frequency.
CC In the Am186CC microcontroller, the system clock must be the same or twice the frequency
of the GCI clock. Therefore, if reducing the system clock frequency, disable the GCI interface
or run it at a lower frequency.
3.8 HARDWARE-RELATED CONSIDERATIONS
■ Pins latched on reset (pinstraps) are not resampled during a watchdog-timer reset.
■ If the external reset (RES) signal is asserted while the watchdog timer is performing a
watchdog-timer reset, the external reset takes precedence over the watchdog-timer
reset. This means that the RESOUT signal asserts as with any external reset and the
WDTCON register does not have the RSTFLAG bit set. In addition, the microcontroller
exits reset based on the external reset timing (i.e., 4.5 clocks after the deassertion of
RES rather than 216 clocks after the watchdog timer time-out occurred).
CC ■ On the Am186CC microcontroller, both an external and an internal reset selects full
HDLC with flow control for external interface D and sets HDLC Channel C for raw DCE
or PCM Highway mode.
4 EMULATOR SUPPORT
4.1 OVERVIEW
This chapter describes the various features available in the Am186CC/CH/CU
microcontrollers to facilitate the design and operation of an In-Circuit Emulator (ICE). Most
of the discussion centers around the operation of pins. Because different debug tool
manufacturers take different approaches to emulator implementation, restrictions imposed
by the use of one type of emulator may not apply to another. However, there are a number
of common concerns shared among ICE developers. This chapter discusses those
concerns.
4.2 SYSTEM DESIGN
The main issues to consider are multiplexed pin use and emulator connection.
4.2.1 Multiplexed Pins
Because pins are an expensive resource, many of the pins on the Am186CC/CH/CU
microcontrollers serve more than one purpose. These multiplexed pins enable the system
designer to select, by hardware or software means, the required operation of the pin. It can
often be difficult for an emulator to know the function of such multiplexed pins, particularly
if the system modifies pin operation on-the-fly. Therefore, before committing a design to
hardware, the system designer should contact potential emulator suppliers for a list of
emulator pin requirements.
Certain pins are critical for successful emulator operation; these are address pins, chip
selects, and memory access timing signals. It is important that these pins not be multiplexed
in such a way as to compromise the emulator operation. Fortunately, several pin functions
can be successfully multiplexed. Emulators generally do not monitor pins relating to input/
output (PIO) operation and on-chip peripherals.
The Am186CC/CH/CU microcontrollers were designed to minimize conflicts. In most cases,
pin conflict is avoided. For example, if the Address Latch Enable (ALE) signal is required
for multiplex bus support, then it is not programmed as PIO33. If the multiplexed AD bus is
used for data only (not addresses), then ALE can be programmed as a PIO pin and the
emulator will not require the ALE signal. However, an emulator is likely to always use the
de-multiplexed address, regardless of how the AD bus is programmed.
The following PIO signals are multiplexed with alternate signals that may be used by
emulators: PIO8, PIO15, PIO33, PIO34, and PIO35. Consider any emulator requirements
for the alternate signals before using these pins as PIOs.
4.2.2 Emulator Connection
Several package types present emulation problems. At the time of publication, the
Am186CC/CH/CU microcontrollers ship in 160-pin PQFP packages.
When a PQFP device is soldered to a board, it cannot be removed and replaced with an
emulator. In this situation, the CPU must be disabled somehow, and the emulator must be
connected to the CPU to duplicate its functionality. The Am186CC/CH/CU microcontrollers
do this with the On-Circuit Emulation (ONCE) mode. Placing the microcontroller in ONCE
mode causes the output pins to become three-state and inactive. This feature allows a
designer to clip an emulator pod over the target CPU, then use ONCE mode to disable the
target CPU and provide a connection to each of the PQFP processor pins. Be aware of any
horizontal and vertical areas required by the emulators’ physical attachment method, and
plan the board layout accordingly. One common mistake is to place connectors, switches,
or other board controls under an area that will be partially covered by the emulator target
board. Also consider the arrangement of Pin 1 versus the emulator attachment and plan
accordingly.
4.3 OPERATION
4.3.1 Usage
To use an emulator, the microcontroller must be put into ONCE mode. To enter ONCE
mode, use the ONCE reset configuration pin (pinstrap). ONCE is sampled on the rising
edge of RES. If the ONCE pin is asserted, the microcontroller enters ONCE mode.
Otherwise, it operates normally. In ONCE mode, all pins are three-stated and remain that
way until a subsequent reset occurs. To ensure the microcontroller does not inadvertently
enter ONCE mode, ONCE has a weak internal pullup resistor that is active only during an
external reset.
Note: Before using an emulator, ensure multiplexed pins are configured to reflect the use
of the emulator and not other functionality.
4.3.2 Emulator-Related Signals
4.3.2.1 A19–A0
To facilitate emulation, the Am186CC/CH/CU microcontrollers do not multiplex any of the
A19–A0 address pins. Therefore, these pins are always available for emulation.
4.3.2.2 AD15–AD0
The Am186CC/CH/CU microcontrollers do not multiplex any AD15–AD0 address/data pins
with other functionality, except that the value present on AD15–AD0 as the device comes
out of external reset is latched and saved internally to the Reset Configuration (RESCON)
register. Using this mechanism, a set of weak pullups and pulldowns can be put on the bus
to allow hardware to communicate configuration information to the software. Because this
is an input function, it should not interfere with the operation of the emulator. However, the
emulator should not interfere with the value present at reset, as software may be relying
on the value for proper operation.
4.3.2.3 {ADEN} / BHE
Deasserting ADEN on reset can prevent the multiplexed AD bus from providing address
information for lower (LCS) and upper (UCS) memory regions. Some older ICE designs
force ADEN active to force address information on the AD bus. System designers should
be aware if their emulator uses this operation and any conflicts this can cause with their
hardware.
186 processors use BHE along with A0 to determine the type and width of external bus
accesses. 188’s do not have BHE, because all data on a 188 is 8 bits wide and routed
through AD7–AD0. The Am186CC/CH/CU microcontrollers do not support a 188 version,
but do allow defining memory regions as 8-bit memory. When making accesses to 8-bit
wide memory regions, BHE cannot be used to derive any information about the access.
Use the BSIZE8 signal to determine the width of a memory region unambiguously.
186 processors also use BHE with A0 to denote refresh cycles to 16-bit DRAM (both
inactive). The Am186CC/CH/CU microcontrollers do not support 8-bit wide DRAM designs,
so using this mechanism to determine refresh cycles is reliable under all allowed DRAM
designs.
4.3.2.4 ALE
In multiplexed bus mode, ALE indicates that a valid address is on the AD bus. Some
emulators may require this signal. In most instances, an active chip select signal can also
be used to indicate a valid address.
4.3.2.5 ARDY and SRDY
If the target requires ready signals to operate, ARDY and SRDY cannot be used as PIOs.
Some emulators give the user control over the external ready target requirement. For
instance, ready may be required by the emulator to match overlay memory speeds to faster
target wait-state setups.
4.3.2.6 BHE
See “{ADEN}/BHE” on page 4-2.
4.3.2.7 BSIZE8
The absence of BHE for 8-bit memory regions when an emulator design uses 16-bit overlay
memory for a memory region defined as 8 bits wide poses problems for an emulator. The
emulator must know when memory accesses are targeted at 8-bit regions to correctly steer
the data between the low half of the data bus and the high half of the data bus. Although it
is possible to snoop all events that determine the memory width (chip select pulldowns
during reset, and UMCS, LMCS and MPCS register accesses), these methods can be
unreliable. The Am186CC/CH/CU microcontrollers’ BSIZE8 pin unambiguously signals the
intended size of the memory region during external bus cycles.
4.3.2.8 [CAS1–CAS0] and [RAS1–RAS0]
The on-chip DRAM controller can be configured to work with DRAM in the lower (LCS) or
upper (UCS) memory regions. The emulator needs to reconstruct the address used during
an access. The CAS signal can come too late for fast address generation. However, the
complete address appears on the A19–A0 bus during the RAS cycle. Additionally, because
the full address bus is nonmultiplexed, it is a simple task to identify an access to the DRAM
region.
CAS-before-RAS cycles could also be used to determine if an access is a refresh, but the
late arrival of the RAS signal makes this problematic.
The DRAM can only be accessed in 16-bit mode. This eliminates the problem of determining
object size due to dynamic bus sizing.
4.3.2.9 CLKOUT
The internal processor clock can be sent out on the CLKOUT pin. Emulators generally
require this.
4.3.2.10 LCS
The system uses LCS as a RAM chip select. Emulators use this to determine when RAM
accesses occur, and can intercept it for overlay memory purposes.
4.3.2.11 MCS3–MCS0
The system uses MCS1 and MCS2 as DRAM CAS strobes. MCS0 and MCS3 can be used
as extra memory chip selects. Emulators can use these to determine when accesses occur
to these memory spaces, and can intercept it for overlay memory purposes.
4.3.2.12 {ONCE}
ONCE is not a dedicated pin but rather a pinstrap option that allows an external emulator
to place a target device into On-Circuit Emulation mode. On reset of the microcontroller, if
the ONCE pinstrap is held low, all Am186CC/CH/CU pins enter a high-impedance state.
There is an internal pullup to prevent inadvertent assertion of ONCE.
4.3.2.13 QS1–QS0
The Am186CC/CH/CU microcontrollers provide information about the execution queue on
the Queue Status bus, QS1–QS0. These signals assist in disassembling trace buffer
information.
4.3.2.14 [RAS1–RAS0]
See “[CAS1–CAS0] and [RAS1–RAS0]” on page 4-3.
4.3.2.15 RD
The RD strobe can be intercepted by the emulator for use with overlay memory.
4.3.2.16 RES
The Am186 processor family provides a Schmitt trigger on the RES input to enable the
system designer to use an inexpensive RC circuit to provide system reset. The only
restriction on power-up is for RES to stay active (Low) for at least 1 ms. Systems that use
this feature introduced a problem for In-Circuit Emulators because emulators need to know
when the target processor comes out of reset. This can be difficult to determine when the
target is being placed in ONCE mode and the reset signal has a very slow rise time. Emulator
vendors solve this problem by providing a reset signal with a fast rise time. The hardware
designer must use this emulator-supplied reset instead of the standard RC reset circuit.
The Am186CC/CH/CU microcontrollers provide a RESOUT signal that unambiguously
indicates when the device has come out of reset, eliminating this problem. However, many
emulators still generate a target reset (in response to a user console command, for
instance), and therefore need a means to connect the emulator-supplied reset to the target
hardware.
Therefore, if ICE usage is required, be aware of the emulators’ reset requirements and take
them into consideration when designing the target hardware, typically by providing a
convenient means to allow the emulator-supplied reset to be the main system reset.
4.3.2.17 RESOUT
RESOUT is activated by the Am186CC/CH/CU microcontrollers in response to either RES
being held active, or a system reset being generated by the internal watchdog timer. During
reset, this pin is actively driven, regardless of the state of the ONCE mode pinstrap (in
contrast, all other output pins go to three-state if both RES and ONCE are active). When
RES is deasserted, RESOUT is driven inactive. This high-to-low edge on RESOUT is the
signal that latches the value of all pinstrap options. When ONCE is active and RES is
inactive, RESOUT is driven inactive (all other outputs are three-stated), and held Low for
one clock cycle. After this one-clock period, RESOUT is three-stated. This sequence of
events allows an attached emulator to determine with certainty that the device has entered
ONCE mode.
4.3.2.18 S2–S0
The S2–S0 bus indicates the type of memory cycle in progress.
4.3.2.19 S6
The S6 signal is active from t1–t4 on the microcontroller and signals a refresh or DMA
access.
4.3.2.20 SRDY
See “ARDY and SRDY” on page 4-3.
4.3.2.21 UCS
The system typically uses UCS as a FLASH or ROM chip select. Emulators use this to
determine when ROM accesses occur, and can intercept it for overlay memory purposes.
4.3.2.22 {UCSX8} and WLB
During processor reset, the UCSX8 pin configures the upper memory region for 8-bit
operation. The BSIZE8 signal unambiguously indicates the width of a memory region for a
given access.
4.3.2.23 WHB and WR
The emulator can intercept WHB and WR for use with overlay memory. Although most
emulators use S2–S0 to determine cycle type, some may use the WR signal to determine
when writes occur. This prevents the use of WR as a PIO when using the emulator.
4.3.2.24 WLB
See {UCSX8} and WLB .
4.3.2.25 WR
See “WHB and WR” .
4.3.3 Hardware-Related Considerations
■ Be sure to allow room for pucks and emulator heads on your target board.
■ The following PIO signals are multiplexed with alternate signals that may be used by
emulators: PIO8, PIO15, PIO33, PIO34, and PIO35. Consider any emulator
requirements for the alternate signals before using these pins as PIOs.
4.3.4 Comparison to Other Devices
■ Previous Am186 watchdog timer implementations required the application to disable the
watchdog timer to prevent watchdog time-outs while emulator code was executing. The
Am186CC/CH/CU watchdog timer does not have this limitation. A feature of the
watchdog timer allows ICE code to inhibit the count of the watchdog timer.
4.4 INITIALIZATION
On both external and internal reset, the following occurs:
■ Multiplexed pins used in emulation default to signals shown in Chapter 3, “System
Overview.”
5 CHIP SELECTS
5.1 OVERVIEW
Signals that allow the CPU to select specific memory or peripheral devices are called chip
selects.
The microcontroller provides six chip select outputs for use with memory devices (UCS,
LCS, and MCS3–MCS0) and eight chip selects for use with peripherals (PCS7–PCS0) in
either memory or I/O space. The six memory chip selects can be used to address three
memory ranges. Each peripheral chip select addresses a 256-byte block offset from a
programmable base address in memory or I/O.
The microcontroller can sense a ready signal for each of the memory or peripheral chip
select lines. The R2 bit in each of the memory chip select control registers determines
whether the external ready signal is required or ignored.
In addition, the R1–R0 bits in each of the memory chip select control registers control the
number of wait states inserted in the bus cycle. Although most memory and peripheral
devices can be accessed with three or fewer wait states, some slower devices cannot. This
feature allows devices to use externally generated wait states to slow down the bus.
Address and data bus size options and enabling or disabling the address bus during the
address phase of a bus cycle are configured on a chip select basis. UCS and LCS can also
be configured for DRAM support.
The chip select lines are active for all memory and I/O cycles in their programmed areas,
whether they are generated by the CPU or by the integrated DMA unit.
The UCS and LCS chip selects assert relative to the timing of the nonmultiplexed address
(A) bus; the MCS and PCS chip selects assert relative to the multiplexed address and data
(AD) bus. The timing for chip selects is shown in the data sheets for each of the Am186CC/
CH/CU microcontrollers.
The CAS0 and CAS1 signals can be used to perform byte writes in a manner similar to
WLB and WHB, respectively. That is, CAS0 corresponds to the low byte (WLB) and CAS1
corresponds to the high byte (WHB).
(CDRAM)
PCB_AD Refresh Value Control to 186
Write Data Refresh Enable Refresh
Control
Read Data Current Value
CS/DRAM (EDRAM)
RD Registers
WR DRAM Address
Control
BOOT_WIDTH Control from 186 (to PADS)
(from PADS)
DRAM Internal UCS UCS
Internal Chip Control Internal RAS0
Selects Decode LCS
MPCS
PACS
NMCS
LMCS
UMCS
Internal RAS1
Internal A19-A11
5.4 REGISTERS
Program the chip selects through the five 16-bit peripheral registers (see Table 5-2).
Appendix A summarizes the bits in all the registers. For a complete description of all the
peripheral registers, see the Am186™CC/CH/CU Microcontrollers Register Set Manual,
order #21916.
5.5 OPERATION
5.5.1 Usage
Note: Before using the chip selects, ensure multiplexed pins are configured to reflect the
use of the chip selects and not other functionality (see Table 5-1 on page 5-3).
Except for the UCS chip select, which is active on reset, chip selects are not activated until
the associated register is written (not when it is read). All these signals are three-stated
during a bus-hold condition and during reset to allow an external bus master to drive these
signals directly.
■ To use the Upper Memory Chip Select (UCS), configure the following UMCS register
options:
– Lower boundary of UCS (LB bit field)
– AD bus disable (DA bit)
– DRAM enable (UDEN bit)
– Data bus width (USIZ bit)
– External Ready mode (R2 bit)
– Wait state value (R1 and R0 bits)
UCS is active on reset.
■ To use the Lower Memory Chip Select (LCS), configure the following LMCS register
options:
– Upper boundary of LCS (UB bit field)
– AD bus disable (DA bit)
– DRAM enable (UDEN bit)
– Data bus width (LSIZ bit)
– External Ready mode (R2 bit)
– Wait state value (R1 and R0 bits)
LCS is activated when the LMCS register is written.
■ To use the Peripheral Chip Select (PCS), configure the following options in the PACS
and MPCS registers:
– Base address (BA bit field in PACS)
– External Ready mode (R2 bit in PACS)
– Wait state value (R0, R1, and R3 bits in PACS)
– PCS mapped to memory or I/O (MS bit in MPCS)
– Memory data bus width for all non-UCS and non-LCS memory (OMSIZ bit in MPCS)
– I/O data bus width (IOSIZ bit in MPCS)
The PCS chip selects are activated after both the PACS and MPCS registers are written.
■ To use the Midrange Memory Chip Select (MCS), configure the following options in the
MMCS and MPCS registers:
– Base address (BA[19–13] bit field in MMCS)
– MCS0-Only mode (MCS0_ONLY bit in MMCS)
– External Ready mode (R2 bit in MMCS)
– Wait state value (R1 and R0 bits in MMCS)
– MCS block size (M[6–0] bits in MPCS)
– Memory data bus width for all non-UCS and non-LCS memory (OMSIZ bit in MPCS)
The MCS chip selects are activated after both the MMCS and MPCS registers are written.
Note: To configure the bus width for memory that does not reside in the LCS or UCS chip-
select memory regions, program the OMSIZ bit in the MPCS register. To configure the bus
width for I/O space, program the IOSIZ bit in the MPCS register.
5.5.2 Selecting Memory and I/O Space
All the chip selects can refer to addresses in memory. Only the PCS chip selects can
reference I/O space. Figure 5-2 on page 5-6 shows which part of memory each chip select
can address. The MCS chip selects should not be configured to overlap with memory space
used by UCS, LCS, or PCS. Figure 5-3 on page 5-7 shows the I/O space PCS7–PCS0 can
select.
5.5.2.1 UCS
The Am186CC/CH/CU microcontrollers provide the UCS chip select for the top of the
1-Mbyte memory address space. The upper boundary is FFFFFh; the lower boundary is
programmable with the LB bit field in the UMCS register. The block size must be a multiple
of 64 Kbyte.
5.5.2.2 LCS
The LCS chip select is for the bottom of the 1-Mbyte memory address space. The lower
boundary is 00000h; the upper boundary is programmable with the UB bit field in the LMCS
register. The block size must be a multiple of 64 Kbyte.
5.5.2.3 MCS3–MCS0
MCS3–MCS0 provide for a user-locatable memory block. The base address can reside
anywhere in the 1-Mbyte memory address space as long as the base is an integer multiple
of the block size (0 is a valid multiple), and memory space is not already mapped to by
UCS, LCS (unless they are mapped to DRAM), or PCS.
The Am186CC/CH/CU microcontrollers also offer MCS0 Only mode. When the MCS0-
ONLY bit in the MMCS register is cleared (the default) and the MCS chip selects are enabled,
MCS3–MCS0 are each asserted over one fourth of the total block size. When this bit is set
and the MCS chip selects are enabled, MCS0 is asserted over the entire MCS address
range, and MCS3–MCS1 are still asserted over their individual address ranges. This means
the entire middle chip select range is selectable through MCS0; the remaining MCS pins
are available for other functions. This mode is useful if only one chip select is required or
if DRAM is selected. For more information, see “Selecting DRAM Using the Chip Selects”
on page 5-7.
The BA bit field in the MMCS register programs the base address; the M[6–0] bits in the
MPCS register program the total block size; the MCS0_ONLY bit in the MMCS register
enables MCS0 Only mode.
5.5.2.4 PCS7–PCS0
The Am186CC/CH/CU microcontrollers each provide eight chip selects for eight
contiguous, user-locatable, 256-byte address ranges within memory or I/O space. The base
address can reside anywhere in the 1-Mbyte memory address space as long as it is a
multiple of 2 Kbytes (0 is a valid multiple), and the memory space is not already mapped
to by UCS, LCS, or MCS. (The PCS address range can overlap the UCS or LCS address
ranges if they are mapped to DRAM.) The PCS chip selects can also access the 64-Kbyte
I/O space, as long as the base address is a multiple of 2 Kbytes.
The PCS chip selects are programmable with two registers. The BA bit field of the PACS
register sets the base address (0 is a valid address). If the chip selects are programmed
to reside in the CPU’s I/O space, bits BA[19–16] are forced to 0 by hardware, as the upper
bound of the CPU’s I/O space is 64 Kbytes. The MS bit in the MPCS register determines
whether PCS chip selects are mapped to memory or I/O space.
F0000h
E0000h
C0000h
64-, 128-, Base + 512K
8 Contiguous
256-, or Base + 256K 256-Byte
512-Kbyte
Address
Block Base + 128K Regions
8-, 16-, 32-, Base + 2047 bytes
1-Mbyte
64-, 128-, Base + 64K Base2
Memory 80000h 7FFFFh 256-, or
Space
64-, 128-, 512-Kbyte Base + 32K
256-, or Block
Base + 16K
512-Kbyte
Block Base + 8K
3FFFFh Base1
1FFFFh
0FFFFh
00000h 00000h 00000h 00000h
UCS Selectable LCS Selectable MCS3–MCS0 PCS7–PCS0
Selectable Selectable
Notes:
1. Base must be an integer multiple of the block size and can be anywhere in memory space from 00000h to FDFFFh,
as long as memory space is not already mapped to by UCS, LCS, or PCS.
2. Base must be a multiple of 2 Kbytes and PCS memory region must not be configured to overlap with MCS space
or non-DRAM LCS or UCS space.
8 Contiguous
256-Byte
64-Kbyte Address Base + 2047 bytes
I/O Space Regions
Base
0000h
PCS7–PCS0
Selectable
Table 5-3 Signal Function When UCS or LCS is Configured for DRAM
Signal Function
UCS configured for DRAM
MCS11 Acts as upper Column Address Strobe signal (CAS1)
MCS2 Acts as lower Column Address Strobe signal (CAS0)
MCS3 Acts as upper Row Address Strobe signal (RAS1)
UCS is held High. This means any memory device that uses UCS is disabled.
UCS This permits the user to disable a nonvolatile memory device providing boot-
up code and replace it with DRAM memory.
LCS configured for DRAM
LCS Acts as lower Row Address Strobe signal (RAS0)
MCS1 Acts as upper Column Address Strobe signal (CAS1)
MCS2 Acts as lower Column Address Strobe signal (CAS0)
Notes:
1. Even if MCS3–MCS1 can no longer be used as chip selects, the MCS0 signal can select the en-
tire middle chip select range when MCS Only mode is enabled. Also, the MCS3–MCS1 pins are
multiplexed with programmable I/O pins. To enable their DRAM functionality, the PIO Mode and Di-
rection registers must be cleared. For more information, see Chapter 9, “Programmable I/O Sig-
nals.”
PCS7–PCS0 can overlap any UCS or LCS space which has been configured for DRAM.
(Overlap of the PCS signals with UCS or LCS in non-DRAM mode is not recommended.)
Overlapping PCS with DRAM is fully supported as long as the PCS chip selects are
programmed for a greater or equal number of wait states than that of the DRAM.
Note: Because of how the DRAM access is terminated, it is illegal to allocate a PCS space
with fewer wait states than the DRAM it is overlapping.
If PCS overlaps LCS or UCS configured for DRAM, PCS access takes precedence over
the LCS or UCS access. The DRAM controller asserts RAS and stops the CAS signal from
asserting. This does not modify the contents of the DRAM, and the access continues as a
normal PCS access.
Overlapping the PCS chip selects with DRAM makes a 2-Kbyte block of the DRAM
inaccessible. In its place, the peripherals associated with the PCS can be accessed. This
is especially useful when the entire memory space is used with two banks of DRAM or a
bank of DRAM and a 512-Kbyte Flash memory.
5.5.4 Overlapping Chip Selects
Although programming the various chip selects on the Am186CC/CH/CU microcontrollers
so that multiple chip select signals are asserted for the same physical address is not
recommended, it may be unavoidable in some systems. Note that configuring PCS in I/O
space with LCS or any other chip select configured for memory address 0 is not considered
overlapping of the chip selects. Overlapping chip selects refers to configurations where
more than one chip select asserts for the same physical address. PCS overlaps are allowed
when UCS or LCS are configured for DRAM. For more information about this overlapping,
see “Selecting DRAM Using the Chip Selects” on page 5-7.
In systems where the chip selects must overlap, the chip selects whose assertions overlap
must have the same configuration for ready (external ready required or not required) and
for the number of wait states to be inserted into the cycle by the processor.
The peripheral control block (PCB) is accessed using internal signals. These internal signals
function as chip selects configured with zero wait states and no external ready. Therefore,
the PCB can reside at addresses that overlap external chip select signals if those external
chip selects are programmed to zero wait states with no external ready required.
When overlapping an additional chip select with either the LCS or UCS chip selects, note
that setting the Disable Address (DA) bit in the LMCS or UMCS register disables the address
from being driven on the AD bus for all accesses for which the associated chip select is
asserted, including any accesses for which multiple chip selects assert.
The MCS and PCS chip select pins can be configured as either chip selects or as PIO
inputs or outputs. However, the ready and wait state generation logic for these chip selects
is in effect regardless of their configurations as chip selects or PIOs. This means that if
these chip selects are enabled (by a write to the MMCS and MPCS registers for the MCS
chip selects, or by a write to the PACS and MPCS registers for the PCS chip selects), the
ready and wait state programming for these signals must agree with the programming for
any other chip selects with which their assertion would overlap if they were configured as
chip selects.
Failure to configure overlapping chip selects with the same ready and wait state
requirements may cause the processor to hang with the appearance of waiting for a ready
signal. This behavior can occur even in a system in which ready is always asserted (ARDY
or SRDY tied High).
■ The value of the MMCS register is set to 7FDBh and the MPCS register is set to 8183h,
which defaults MCS3–MCS0 each to 2 Kbytes with a total MCS block size of 8 Kbytes
at a base address of 3Fh, with external ready, and three wait states. However, the MCS
chip selects are not enabled until software writes to both the MMCS and MPCS registers.
■ Data bus widths are set as follows:
– LCS is 16 bits wide.
– Non-UCS and non-LCS memory (MCS, PCS, and the remaining memory that does
not reside in one of the enabled, memory chip-select regions) accesses are 16 bits
wide.
– All I/O accesses are 16 bits wide.
■ UCS is the inverse of the state of the UCSX8 that was latched on exiting external reset.
If UCSX8 is 0, UCS is 8 bits wide; if UCSX8 is 1, UCS is 16 bits wide. In either case,
UCS defaults to non-DRAM.
6 DRAM CONTROLLER
6.1 OVERVIEW
Dynamic Random Access Memory (DRAM) offers memory at moderate speed and low
cost. DRAM memory cells consist of one transistor and one capacitor. DRAM also uses a
multiplexed address bus in a row/column format, which results in a lower pin count and
smaller device package.
DRAM is volatile; that is, if the capacitors for the memory cells are not periodically recharged,
the contents of memory is lost. The process of periodically recharging the capacitors is
called refresh.
The DRAM controller’s purpose is to use the processor’s address, status, and control lines
to generate the multiplexed address strobes. The Row Address Strobe (RAS) and Column
Address Strobe (CAS) signals latch the row and column addresses inside the DRAM.
To support DRAM, the Am186CC/CH/CU microcontrollers each have a fully integrated
DRAM controller that provides a glueless interface to 40-ns, 50-ns, 60-ns, and 70-ns
Extended Data Out (EDO) DRAM (EDO DRAM is sometimes called Hyper-Page Mode
DRAM). Up to two banks of 4-Mbit (256 Kbit x 16 bit) DRAM can be accessed. Page Mode,
Fast Page Mode (FPM), Asymmetrical, and 8-bit wide DRAM are not supported.
The Am186CC/CH/CU microcontrollers support the most common DRAM refresh option,
CAS-Before-RAS. All refresh cycles contain three wait states to support the DRAMs at
various frequencies. The DRAM controller never performs a burst access. All accesses are
single accesses to DRAM. If the PCS chip selects are decoded to be in the DRAM address
range, PCS accesses take precedence over the DRAM.
Figure 6-1 Chip Selects and DRAM Block Diagram (Same as Figure 5-1)
(CDRAM)
PCB_AD Refresh Value Control to 186
Write Data Refresh Enable Refresh
Control
Read Data Current Value
CS/DRAM (EDRAM)
RD Registers
WR DRAM Address
Control
BOOT_WIDTH Control from 186 (to PADS)
(from PADS)
DRAM Internal UCS UCS
Internal Chip Control Internal RAS0
Selects Decode LCS
MPCS
PACS
NMCS
LMCS
UMCS
Internal RAS1
Internal A19-A11
6.4 REGISTERS
Table 6-2 lists the 16-bit peripheral registers that determine the operation of the DRAM
controller. You must also program the LDEN bit of the LMCS register and the UDEN bit of
the UMCS register for DRAM operation. Appendix A summarizes the bits in all the registers.
For a complete description of all the peripheral registers, see the Am186™CC/CH/CU
Microcontrollers Register Set Manual, order #21916.
6.5 OPERATION
6.5.1 Usage
Note: Before using the DRAM controller, ensure the multiplexed pins listed in Table 6-1 on
page 6-2 (PIOs, chip selects, and DRAM) are configured to reflect the use of the DRAM
controller and not other functionality.
To enable DRAM support for the Am186CC/CH/CU microcontrollers, use the following
process:
1. Configure the UCS or LCS chip selects for DRAM. For information, see “Selecting DRAM
Using the Chip Selects” on page 5-7.
2. Set the RC bit field in the CDRAM register to the DRAM refresh rate. This is the number
of CPU clocks between refresh cycles. All refresh cycles contain three wait states to
accommodate the various DRAMs supported. Note that changing the value of this field
after DRAM refresh has been enabled does not load the new value into the refresh
counter until the current counter value has reached 0.
3. Set the EN bit of the EDRAM register to 1 to enable DRAM refresh.
6.5.2 DRAM Supported
The Am186CC/CH/CU microcontrollers support one or two banks of 40-ns, 50-ns, 60-ns,
or 70-ns, 4-Mbit (256 Kbit x 16 bit), symmetrical Extended Data Out (EDO) DRAM (EDO
DRAM is sometimes called Hyper-Page Mode DRAM).
Eight-bit (byte-wide) DRAM is not supported, and the DRAM does not operate properly if
configured as an 8-bit area. However, it is still possible to perform byte accesses to 16-bit
DRAM. Simply perform a 16-bit read and choose the upper or lower byte as needed.
The Am186CC/CH/CU microcontrollers can boot from a nonvolatile memory device in UCS
space and later switch the UCS space to a DRAM. The microcontrollers also support an
8-bit UCS boot mode, which allows the user to boot from an 8-bit device and later switch
to 16-bit operation. It is not possible to boot from a 16-bit memory device and later switch
to an 8-bit device. See Chapter 5, “Chip Selects,” for details.
Table 6-3 shows the wait states used to support DRAM.
The user can re-enable UCS by clearing the UDEN bit in the UMCS register. Doing so
disables refreshing the upper bank of DRAM. If the data in the upper bank of DRAM does
not have to be retained, no special action is required. If the data in the upper bank of DRAM
must be retained, two options are available. The refresh control unit counter can be
monitored through the EDRAM register. When the counter reaches all zeros, a refresh
occurs. The user can then disable the upper bank of DRAM using the UDEN bit in the
UCMS register, access the UCS-connected device, and then re-enable the upper bank of
DRAM before the next refresh is scheduled to occur (usually 15.6 µs). This retains the data
in the upper bank of DRAM.
Alternatively, a software routine can conduct a read from all rows of the upper DRAM. Then
the UDEN bit can be switched to enable UCS and disable RAS1. The user then has the
total refresh time (usually 16 ms) before the DRAM must be re-enabled to retain its data.
After re-enabling the DRAM, the user should once again conduct reads on all the DRAM
row addresses before letting the refresh controller resume refreshing the DRAM.
6.5.4 Option to Overlap DRAM with PCS
The PCS7–PCS0 signals can overlap DRAM blocks with different wait states without
external or internal bus contention. The RAS0 or RAS1 signals assert along with the
appropriate PCS signal. The CAS0 and CAS1 signals do not assert, preventing the DRAM
from writing erroneously or driving the data bus during a read. The PCS signals must be
configured to have the same or greater number of wait states than the DRAM. In the case
of an overlap, the bus width during PCS accesses is 16 bits.
6.5.5 DRAM Refresh
6.5.5.1 DRAM Refresh Cycle
When DRAM refresh is enabled, it operates off the processor internal clock. The following
steps outline the refresh process:
1. The Refresh Control unit (RCU) checks the T bit field in the EDRAM register to see if
the counter = 0. If not, the clock decrements by 1 and the counter is checked again. This
process is repeated until the counter = 0.
2. When the refresh counter = 0, the counter reloads the value from the RC field of the
CDRAM register and starts again, simultaneously generating a CAS-before-RAS
request to the bus interface unit. The DRAM refresh process continues until the EN bit
in the EDRAM register is cleared.
3. The bus interface acknowledges the request. The refresh request stays active until the
bus becomes available.
4. When the bus is free, the bus interface runs a “dummy read” cycle. Note that the refresh
clock counter continues counting independent of when the bus interface services the
refresh request. If the HLDA signal is active when a refresh request is generated
(indicating a bus hold condition), then the microcontroller deactivates the HLDA signal
to perform a refresh cycle when the hold is negated. The circuit external bus master
must negate the HOLD signal for at least one clock to allow the refresh cycle to execute.
The refresh cycle has priority over all other bus cycles (CPU, DMA, and so on). Refresh
changes no bits and looks like a read cycle. The various cycles follow this priority ranking:
refresh (highest priority), HOLD, DMA, and CPU (lowest).
5. After the refresh cycle completes, the HLDA signal goes active and the controller
continues with whatever activity was occurring before the refresh.
6. The request is removed.
7 INTERRUPTS
7.1 OVERVIEW
An interrupt is a request to the CPU for service. CPUs receive interrupt requests from a
variety of sources, both internal and external. When the CPU receives a request, it stops
executing the current task, and if the new task is of higher priority, begins executing that
routine. At the end of the routine, the CPU returns to the original task.
Some interrupts can be disabled. These are called maskable interrupts. Nonmaskable
interrupts cannot be disabled.
The Am186CC/CH/CU microcontrollers feature an interrupt controller, which arranges the
maskable interrupt requests by priority and presents them one at a time to the CPU. In
addition to interrupts managed by the interrupt controller, the microcontroller supports eight
nonmaskable interrupts—an external or internal nonmaskable interrupt (NMI), a trace
interrupt, and software interrupts and exceptions.
The interrupt controller supports the maskable interrupt sources through the use of 15
channels. To make this possible, most interrupt channels support multiple interrupt sources.
These channels are programmable to support the external interrupt pins or various
peripheral devices that can be configured to generate interrupts. The maskable interrupt
sources include 17 external sources plus a number of internal sources.
CH The following Am186CH HDLC microcontroller peripherals can generate internal interrupts:
■ Three on-board timers (two of the timers can operate as pulse width modulators)
■ Two UARTs
■ Two HDLC channels
■ Two pairs of transmit/receive SmartDMA channels
■ Four general-purpose DMA channels
CH The following Am186CU USB microcontroller peripherals can generate internal interrupts:
■ Three on-board timers (two of the timers can operate as pulse width modulators)
■ Two UARTs
■ Two pairs of transmit/receive SmartDMA channels
■ Four general-purpose DMA channels
■ The USB peripheral controller
System configuration determines which of these devices and signals are available as
interrupt sources. In addition to these internal interrupts, nine interrupt signals and eight
PIOs can be configured as external interrupt sources.
An NMI can be generated externally or internally. An external NMI is generated with the
NMI signal. An internal NMI is generated by the microcontroller’s watchdog timer. For more
information on the watchdog timer, see Chapter 11, “Watchdog Timer.”
A trace interrupt is generated with the trace flag (TF bit) in the Processor Status Flags
(FLAGS) register. See Chapter 2, “Configuration Basics.”
Software can also generate interrupts and exceptions. A software interrupt is generated
with the INT or INTO instruction; a software exception is an interrupt resulting from an error
condition after executing any instruction. Software interrupt and exception sources are:
divide error exception, breakpoint interrupt, INTO detected overflow exception, array
bounds exception, unused opcode exception, and ESC opcode exception.
7.2 BLOCK DIAGRAM
Figure 7-1 shows how the microcontroller supports interrupts. The interrupt controller is the
interface between the execution unit and all the peripheral interrupt requests and external
interrupt signals. The watchdog timer can generate an NMI when a time-out value is
reached. Software can determine whether an NMI was generated externally or internally
by reading the RSTFLAG and EXRST bits in the Watchdog Timer Control (WDTCON)
register.
External NMI
Internal NMI
Watchdog Timer
Interrupt Sources
Timers (3)
CC HDLCs (4)
Priority
GCI (1)
SmartDMAs (4)
USB (1)
CH HDLCs (2)
SmartDMAs (2)
CU USB (1)
SmartDMAs (2)
Notes:
1. Software interrupt and traps are generated and resolved within the execution unit.
PIO151 WR WR
7.4 REGISTERS
Table 7-2 lists the registers used by the microcontroller for interrupts. In addition, the IF flag
in the Processor Status Flags (FLAGS) processor register is used to enable or disable
interrupts (see “Registers Used” on page 7-18). Appendix A summarizes the bits in all the
registers. For a complete description of all the peripheral registers, see the Am186™CC/
CH/CU Microcontrollers Register Set Manual, order #21916.
7.5 OPERATION
7.5.1 Usage
Note: Before using the interrupts, ensure multiplexed signals are configured to reflect the
use of the interrupts and not other functionality (see Table 7-1 on page 7-4).
7.5.1.1 Types of Interrupt Channels
The interrupt channels can be organized into five groups: Channel 0 (timers), Channel 1
(INT0 only), channels which support both an external and internal source (Channels 2, 3,
and 8–13), channels which support two internal sources (Channels 4–7), and Channel 14
(shared interrupts). Channel 1 is a straightforward, single interrupt channel. For a list of
interrupt types, see Table 7-3 on page 7-12. For a map of the interrupt channels, see
Table 7-4 on page 7-16. The following sections discuss the other groups.
7.5.1.1.1 Timer Interrupt Requests Channel
Interrupt Channel 0 supports the three timers. Each timer has a bit in its control register
that determines whether it is enabled to generate interrupt requests to the channel. The
timers share a single programmable priority set in the CH0CON register. In addition, the
three timers have relative priorities (see Table 7-3 on page 7-12). The Interrupt Controller
uses the relative priority to arbitrate between the timers when more than one has an interrupt
request pending. The channel logic determines which of the sources has the highest priority
pending request and generates the interrupt vector based on that request. In previous parts,
it could be confusing that all three interrupts required the same EOI (that of TMR0) even
though they had different vectors. This happened because for all other sources, the vector
number was identical with the EOI type. In the Am186CC/CH/CU microcontrollers, any of
the three vector numbers can be used for the EOI; however, all three function identically by
clearing the in-service bit for Channel 0. Table 7-3 on page 7-12 lists the EOI type for each
interrupt.
Channel 9 (supports general-purpose DMA0 and general-purpose DMA1 as well as INT4)
and Channel 10 (supports general-purpose DMA2 and general-purpose DMA3 as well as
INT5) have similar behavior to the timers in regard to their support of the two DMA channels.
7.5.1.1.2 External and Internal Interrupt Request Channels
At any given point in time, interrupt channels 2, 3, 8, 9, 10, 11, 12, and 13 all support either
an external or an internal source, but not both. The SRC bit in the CHxCON register
determines the source for Channels 2, 3, and 8–11. Channels 12 and 13 support the
external source until the PWD bit in the SYSCON register is set. For example, Channel 2
services the USB when the SRC bit is set, or INT1 when the SRC bit is cleared. The setting
or clearing of the SRC bit does not affect the vector generated, so INT1 and the USB share
the same interrupt vector. Because only one can be generating interrupts at a time, this is
unambiguous. All channels have a single programmable priority that is set in the CHxCON
register.
7.5.1.1.3 Two Internal Interrupts Request Channels
Channels 4, 5, 6, and 7 support two internal interrupts. There is no SRC bit in the CHxCON
registers for these channels because both sources on the channel can be active at the
same time. For example, channel 4 supports both HDLC_A and SMDA0. These sources
are programmed to either generate or mask their interrupt requests to the channel through
bits in the control registers of the individual peripherals. The channel logic distinguishes
between the different interrupt request sources and generates the vector based on the
source. The channel has a single programmable priority that is set in the CHxCON register.
In addition, the two sources for the channel have relative priorities (see Table 7-3 on
page 7-12). The Interrupt Controller uses the relative priorities to arbitrate between the two
sources when both have interrupt requests pending.
7.5.1.1.4 Shared Interrupt Request Channel
Channel 14 is the shared interrupt request channel. All sources on the shared channel have
the same interrupt vector and the same priority. Software must examine the Shared Request
(SHREQ) register to determine which source generated the interrupt. Note that software
must configure a PIO pin as a PIO input or output before using it as an interrupt source.
7.5.1.2 Using Maskable Interrupts
1. Before configuring the external interrupts INT8–INT0 and the PIO interrupts, clear the
IF flag in the FLAGS register (with the CLI instruction). However, most of the
microcontroller’s internal interrupts can be safely configured while maskable interrupts
are enabled (i.e., the IF flag is set). The IF flag is cleared, disabling maskable interrupts,
when the processor comes out of reset.
2. For PIO interrupts, program the associated PIO pin as a PIO input through the
PIOMODEx and PIODIRx registers.
3. For external interrupts INT8–INT0, program the polarity, active High vs. active Low,
through the INTPOL register.
4. Program the source and priority for the associated interrupt channel through the SRC
and PR bits in the CHxCON register.
Note: Do not perform Step 3 and Step 4 in a single write for edge-sensitive external
interrupts. In this case, the polarity transition may be latched and generate a spurious
interrupt request. Level-sensitive interrupts are not latched so any spurious request
disappears before external interrupts are enabled.
5. Specify the minimum priority required for an interrupt request to be recognized by setting
the PRI bits in the PRIMSK register.
6. Specify the priority for the interrupts generated on a channel by setting the PRI bits in
each of the CHxCON registers. The MSK (mask or enable) bit can be set concurrently.
7. Enable the desired interrupts by programming the CH bits in the IMASK register (if the
MSK bits were not configured in step 6). Because these bits are physically identical to
the MSK bits in each of the CHxCON registers, individual channels can be configured
with the associated CHxCON register.
Note: Do not write to the IMASK register while interrupts are enabled (the IF bit in the
FLAGS register is set). In this case, spurious interrupt requests may be generated, including
requests from devices whose interrupts were disabled both before and after the write to
the IMASK register. It is safe to write the MSK bits in the CHxCON registers while interrupts
are enabled.
8. Program the SHMASK register to enable the INT and PIO interrupts that share
Channel 14. The SHREQ interrupt request is generated if any shared interrupt is
asserted that is not masked off in the SHMASK register.
9. If interrupts are not enabled, enable interrupts by setting the IF flag in the FLAGS register
using the STI instruction.
7.5.1.3 Using Nonmaskable Interrupts
To generate an NMI, use the NMI signal or watchdog timer. To generate a trace interrupt,
set the TF bit in the FLAGS register. To generate a software interrupt, execute an Am186
instruction that generates an interrupt. This can be the INT or INTO instruction, or a software
exception caused by an instruction. For more information, see “Nonmaskable Interrupts”
on page 7-18.
7.5.2 Definitions of Interrupt Terms
The following definitions cover some of the terminology used in describing interrupts.
■ Interrupt Channel: The group of logic that is comprised of a control register, an in-
service bit, a request bit, and a mask bit.
■ Interrupt Source: Any source such as an on-chip peripheral (internal) or physical pin
(external) that can request an interrupt.
■ Interrupt Type: An eight-bit number assigned to each discrete interrupt, as listed in
Table 7-3 on page 7-12. Each interrupt type does not need a unique interrupt channel;
one interrupt channel can support more than one interrupt type. However, if one channel
supports two interrupt types, then those two types have the same level of programmable
priority.
■ Programmable Priority: Each channel has eight levels of programmable priority, which
are set in the Channel Control (CHxCON) register. Programmable priority determines
which interrupt to service when two interrupts are requested at the same time. An
interrupt service routine is interrupted by another interrupt request of equal or higher
programmable priority, as long as the IF flag in the FLAGS register is set. For more
information on setting the FLAGS register, see Chapter 2, “Configuration Basics.” If the
programmable priority levels are equal, the overall priority number is used to resolve
requests generated at the same time. The overall priority is not used to determine if a
pending interrupt can interrupt an already executing interrupt service routine (ISR).
■ Overall Priority: Each interrupt source has an overall priority number which is only used
to arbitrate between two interrupt sources that have priority requests pending with the
same programmable priority level. Overall priority is not used if the programmable priority
is sufficient to resolve the pending highest-priority request.
■ Interrupt Vector Address: This equals the interrupt type times four and is the location
in memory that stores the address of the interrupt service routine for each interrupt type.
■ Interrupt Vector Table: A memory area of 1 Kbyte beginning at address 00000h that
contains up to 256 four-byte interrupt vector addresses organized by segment/offset.
■ Maskable Interrupts: Maskable interrupts can be affected by programming and are
enabled and disabled by setting the IF flag in the FLAGS register.
■ Nonmaskable Interrupts: Nonmaskable interrupts cannot be affected by programming,
nor are they affected by the IF flag.
0008 (2 • 4)
Interrupt Vector EF 01
for Type 1 AB CD
0004 (1 • 4) Interrupt Vector
Interrupt Vector 12 34 Table Locations
for Type 0 56 78
0000 (0 • 4)
When an interrupt is taken, the type is multiplied by four and the processor fetches the
pointer to the interrupt service routine from that interrupt vector address. Table 7-3 on
page 7-12 shows a list of the types assigned to each interrupt source, as well as the interrupt
vector address and the overall priority. The first entries in the table are the nonmaskable
and software interrupt sources. The overall priority numbers are used only to resolve two
interrupts that have identical programmable priority requests pending. In these cases, the
type with the lowest overall priority number gets the highest priority. For overall priority
numbers with letters, the lower letter is considered of higher priority (e.g., 2A is a higher
priority than 2B).
3. The type and overall priority for the INT1–INT7 pins in this table assume that these pins are being serviced by
a dedicated channel; that is, they are not being serviced by channel 14. When the INT1–INT7 pins are being ser-
viced by Channel 14, they share type 1Eh, overall priority 15, as indicated by the last row in Table 7-3.
4. PWD is generated on the Low-to-High transition of the PWD input; the second PWD is generated on the High-
to-Low transition.
5. See the SHREQ register description in the Am186™CC/CH/CU Microcontrollers Register Set Manual, order
#21916, for information on the shared Channel 14.
The interrupt controller uses the peripheral registers listed in Table 7-2 on page 7-5 to
support generating a maskable interrupt. In addition, the FLAGS processor register contains
a flag to enable the interrupts and one to set the trace interrupt. For more information about
the interrupt registers, see “Registers Used” on page 7-18.
Of the maskable interrupts, 17 signals are provided for external interrupt sources: 9 interrupt
signals and 8 PIOs (the NMI signal is nonmaskable and is generally used for unusual events
like power failure). The interrupt types for these inputs are generated internally. Every
interrupt channel has an in-service bit. If a lower-priority device requests an interrupt while
the in-service bit (IS) is set for a high-priority interrupt, the interrupt controller does not
generate an interrupt. In addition, if another interrupt request occurs from the same interrupt
source while the in-service bit is set, the interrupt controller does not generate an interrupt.
This allows interrupt service routines operating with interrupts enabled to be suspended
only by interrupts of equal or higher priority than the in-service interrupt.
When an interrupt service routine completes, software must reset the proper in-service bit
by writing the EOI type to the EOI register. This is required to allow subsequent interrupts
from this interrupt source and to allow servicing of lower-priority interrupts. Software should
execute a write to the EOI register at the end of the interrupt service routine just before the
return from interrupt instruction.
7.5.5.5 Maskable Interrupt Block Diagram
Figure 7-3 shows a partial block diagram of how the sources and channels are used (see
Figure 7-1 on page 7-3 for another block diagram). The three timers share Channel 0 and
produce three separate types. The INT0 signal is dedicated to Channel 1. The GP DMA0
and GP DMA1 are MUXed with the INT4 signal onto Channel 9, and they produce up to
two separate types (only one type is generated if Channel 9 services the INT4 signal). The
INT4 signal is also connected to the Channel 14 shared interrupts through a mask register
and shares the same type as the rest of the Channel 14 shared interrupts.
15 Interrupt Channels
TIM0
TIM1 CH0 3 Types
TIM2
CH1
INT0 1 Type
GP DMA0
GP DMA1 CH9 2 Types
INT4
INT1-3,5-7
8 PIOs
MASK
Notes:
1. Channels 0 to 3 and 8 to 13 can have only one interrupt source active at a time (e.g., Channel 2 can only service
the INT1 signal or the USB at any one time). Channels 4 to 7 (shaded) can service up to two sources at once (e.g.,
Channel 4 can service the HDLC_A as well as SDMA0 interrupt requests). The peripherals that generate the inter-
rupts on channels 4 to 7 have the option of enabling or disabling their requests. Channel 14 (shaded) is provided to
allow a second channel to service interrupt requests from external signals. This is useful for systems that require a
large number of peripheral interrupts (e.g., if a system is using USB interrupts via Channel 2, the INT1 signal is able
to request an interrupt through Channel 14). Channel 14 can simultaneously service any source indicated in its col-
umn. For Channel 14, a register individually masks on or off the signals serviced by this channel so that individual
control of interrupt sources is possible.
2. For a complete description of Pulse Width Demodulation (PWD) mode, see Chapter 10, “Programmable Timers.”
5 HDLC Channel B CC CH
and —
SmartDMA Channel Pair 1 CC CH
6 HDLC Channel C CC
and —
SmartDMA Channel Pair 2 CC CU
7 HDLC Channel D CC
and —
SmartDMA Channel Pair 3 CC CU
8 INT3 GCI CC
Notes:
1. The PWD source is selected by setting the PWD bit in the SYSCON register.
2. The Shared Request source is controlled by the SHREQ and SHMASK registers. The following
sources can be enabled to use the Shared Request channel: PIO5, PIO15, PIO27, PIO29, PIO30,
PIO33, PIO34, and PIO35; and INT pins 7–1.
8 DMA CONTROLLER
8.1 OVERVIEW
Direct memory access (DMA) permits the transfer of data between memory and peripherals
without CPU involvement. With DMA transfers, the DMA controller becomes the bus master.
The arbitration for the bus is internal to the processor and is not visible externally. When
the DMA no longer has transfers pending (no internal or external DRQs are asserted) or a
higher priority event occurs, the DMA controller removes its request for the bus thus freeing
the bus for other types of cycles. The type of DMA transfer dictates how long the DMA
controller has control of the bus. However, because a DMA transfer is using the bus, the
processor can be slowed down if it also needs the bus.
Each of the Am186CC/CH/CU microcontrollers contains a DMA controller that provides
both SmartDMA channels and general-purpose DMA channels. The general-purpose DMA
channels can be used for data transfer between memory and I/O spaces (i.e., memory-to-
I/O or I/O-to-memory) or within the same space (i.e., memory-to-memory or I/O-to-I/O). In
addition, the general-purpose DMA controller supports data transfer between some internal
peripherals and memory or I/O.
The SmartDMA channels provide a method for transmission and reception of data across
multiple memory buffers and a sophisticated buffer-chaining mechanism. These channels
are always used in pairs: transmitter and receiver. The transmit channels can only transfer
data from memory to a peripheral; the receive channels can only transfer data from a
peripheral to memory.
CH The Am186CH HDLC microcontroller provides a total of eight DMA channels: four
SmartDMA channels (two transmit-receive pairs, 0 and 1) and four general-purpose DMA
channels. The SmartDMA channel pairs are dedicated to the two on-board HDLC channels.
On-chip peripherals that support general-purpose DMA are Timer 2, and the two
asynchronous serial ports (the UART and the High-Speed UART). External peripherals
support DMA transfers through the external DMA request signals. Each general-purpose
channel accepts a DMA request from one of three sources: the DMA request signals
(DRQ1–DRQ0), Timer 2, or the UARTs. (Note that Timer 2 acts only as a DMA request
source; no data is transferred to or from Timer 2.)
CU The Am186CU USB microcontroller also provides four SmartDMA channels (two transmit-
receive pairs, 2 and 3) and four general-purpose DMA channels. The SmartDMA channel
pairs support the USB endpoints A, B, C, or D. On-chip peripherals that support general-
purpose DMA are Timer 2, the two asynchronous serial ports (the UART and the High-
Speed UART), and the USB peripheral controller. External peripherals support DMA
transfers through the external DMA request signals. Each general-purpose channel accepts
a DMA request from one of four sources: the DMA request signals (DRQ1–DRQ0), Timer
2, the UARTs, or the USB peripheral controller. (Note that Timer 2 acts only as a DMA
request source; no data is transferred to or from Timer 2.)
Up to 64 Kbytes or 64 Kwords can be transferred to or from even or odd addresses on the
Am186CC/CH/CU microcontrollers. Two bus cycles (a minimum of eight clocks) are
necessary for each general-purpose DMA data transaction. For word transfers, both the
source and destination addresses must be configured as 16-bit addresses.
The SmartDMA channels only support byte transfers. Data is written or read from sequential
byte addresses in the memory buffers. The SmartDMA channels also feature fly-by DMA
transfers—what would typically take two cycles (a read and write) is moved in a single cycle
on the external processor bus; read and write are performed concurrently in one cycle.
The general-purpose DMA channels and the SmartDMA channels can be programmed so
that one channel/channel pair is always given priority over the other, or they can be
programmed to alternate cycles when both have DMA requests pending.
DMAREG
PCB Interface
Address
PCB Decode 20-Bit
Block ADD/SUB
SDMA3–0 STATUS
SDMA
TX_DMA3–0
Buffer Descriptor COUNT State Machine
TX_DMA3–0
Buffer Descriptor POINTER
TX_DMA3–0
CURRENT Buffer Descriptor
RX_DMA3–0
Buffer Descriptor COUNT
RX_DMA3–0
Buffer Descriptor POINTER
SDMA Control
Select DRQ11–DRQ0
UART/
High-Speed DRQ11–DRQ0 DMA
UART DRQ
Cycle
Select
Generator BIU
CC
CU Arbiter
USB
8.4 REGISTERS
The DMA controller is programmed through the use of registers: seven registers for each
general-purpose channel and nine for each pair of SmartDMA channels (see Table 8-2).
In addition, software can use the DMA Halt (DMAHLT) register (an Interrupt Controller
register) to halt DMA activity. Appendix A summarizes the bits in all the registers. For a
complete description of all the peripheral registers, see the Am186™CC/CH/CU
Microcontrollers Register Set Manual, order #21916.
DMA channel control registers can be changed while the channel is operating. Any changes
made during DMA operations affect the current DMA transfer.
All DMA registers except the GDxCON0 and GDxCON1 registers can be modified or
altered during any DMA activity. Any changes made to these registers are reflected
immediately in DMA operation.
8.5 OPERATION
The Am186CC/CH/CU microcontrollers contain two distinct types of DMA channels:
general-purpose DMA channels and SmartDMA channels. The SmartDMA channels are
further broken down into transmit and receive channels, which are used in pairs. The
microcontroller’s DMA channels can be used as shown in Table 8-3, Table 8-4, and Table
8-5. The discussion of general-purpose DMA channels begins in “General-Purpose DMA
Channels” on page 8-11; the discussion of SmartDMA channels begins in “SmartDMA
Channels” on page 8-26. In some cases, a hybrid between DMA processing and interrupt
processing is appropriate. This is described in “DMA and Interrupts” on page 8-10.
the CPU to respond quickly to the NMI request. Software can also inhibit DMA transfers by
setting the DHLT bit in the DMAHLT register.
Priorities for the general-purpose DMA channels are set through the GDxCON0 registers;
SmartDMA channel priorities are set with the SDxCON registers.
8.5.3 DMA Request Synchronization
Synchronized data transfers are either source or destination synchronized—either the
source of the data or the destination of the data generates a DRQ to request the data
transfer. Note that the terms source and destination are relative to the data movement. For
example, a UART receiver is source-synchronized; the UART is the source of the data and
the DRQ (see Figure 8-2).
DMA transfers can also be unsynchronized (i.e., DRQ is always asserted, and the transfer
takes place continually until the correct number of transfers has occurred).
For more information about general-purpose DMA channel synchronization, see “Setting
Synchronization” on page 8-17. For more information about SmartDMA channel
synchronization, see “SmartDMA Channel Request Source and Synchronization” on
page 8-27.
UART Transmitter
Serial Port Transmit Data
TXD (SPTXD) Register
or Circular Buffers” on page 8-20. This method helps guarantee data integrity by ensuring
that data is transferred to main memory whether or not the interrupt task can execute. The
DMA channel can be set to interrupt immediately on receipt of data by setting the Interrupt
(INT) and Terminal Count (TC) bits in the GDxCON0 register. The interrupt task is then a
relatively low priority because it does not have to pull the characters out of the UART before
they are overwritten by new data. (The effective UART FIFO size has been increased by
the DMA buffer size.) When the interrupt task has finished processing all the data in the
circular buffer (its read pointer is equal to the destination address), the interrupt can set TC
to cause another interrupt as soon as additional characters arrive.
Processing the received data within a low-priority interrupt routine means that flow-control
information, such as XONs and XOFFs, may not be seen as quickly. To alleviate this
condition, transmission can be done without using DMA (e.g., from within the same interrupt
routine, or by programming the interrupt code). In the latter, the interrupt code could program
the Transfer Count (GDxTC) register to send a maximum of n characters at a time, using
DMA, where '2 • n' is a value that does not overrun the far side's receive FIFO high-water
mark.
8.5.6 General-Purpose DMA Channels
The Am186CC/CH/CU microcontrollers each provide four general-purpose DMA channels,
which are similar to legacy Am186 general-purpose DMA channels. The four channels can
be used for data transfers as shown in Table 8-6.
Memory
External Peripherals
I/O
Notes:
1. Timer 2 acts as a DMA request source only; no data is transferred to or from Timer 2.
CC CU DMA channels on the Am186CC and Am186CU microcontrollers can also service
requests from the USB peripheral controller.
DMA channels can also be set to unsynchronized, which causes the DRQ to be
continuously asserted. This is used for memory-to-memory transfers.
2. The DMA controller reads a byte or word from the programmed source address, which
can be in I/O space or in memory, and then writes that byte or word to the programmed
destination address, which can also be in I/O space or memory. Unless the channel is
set to unsynchronized or to accept requests from Timer 2, the channel should be
programmed so that either reading from the source or writing to the destination clears
the request. For example, reading from the Serial Port Receive Data (SPRXD) register
clears a UART receive DMA request.
3. The source and destination address pointers are then adjusted by independently
programmable amounts. The adjustment increment for each pointer can be 0 (e.g., for
a peripheral address that does not change), +1, +2, –1, or –2. (Unpredictable results
may occur when the transfer size is a word (two bytes) and the adjustment increment is
1 or –1; when the transfer size is one byte and the adjustment increment is +2 or –2,
the high byte is ignored.) To implement circular buffers, the pointers can also wrap on
1-, 2-, 4-, 8-, 16-, 32-, or 64-Kbyte boundaries.
If neither of these conditions are met, hardware resets the ST bit without executing any
DMA transfers. Otherwise, the ST bit is reset by the hardware after executing one or more
transfers as discussed in the previous DMA cycle description. If a transfer is synchronized
and the TC bit is 0, DMA transfers continue as long as DMA requests are being made until
the ST bit is manually cleared. This mode is typically used with the address wrap option to
implement circular buffers (see “Using Buffer Queues or Circular Buffers” on page 8-20).
8.5.6.3 General-Purpose DMA Transfer Suspension
The following conditions suspend general-purpose DMA transfers:
■ Deassertion of DRQ
■ A bus hold condition
■ A refresh cycle by an NMI/watchdog timer interrupt
■ A pending DMA request of equal or higher priority
■ The DHLT bit in the DMAHLT register set to 1 by an NMI or by software
8.5.6.4 General-Purpose DMA Source and Destination Addresses
Each general-purpose DMA channel has a 20-bit source address and a 20-bit destination
address. The 20-bit addresses are split over two source registers (GDxSRCL and
GDxSRCH) and two destination registers (GDxDSTL and GDxDSTH), with the four most
significant bits (AD19–AD16) going into a separate register from the 16 low-order bits
(AD15–AD0). The address is specified as a 20-bit linear address, not as a segment:offset
pair. For example, for the segment C000h and offset 1000h, the linear address would be:
(C000h x 16) + 1000h = C1000h; therefore, the low register = 1000h and the high
register = 0Ch. To use a DMA channel, software must initialize all four address registers
for that channel.
The addresses can be individually incremented or decremented after each transfer. For
more information, see “Incrementing or Decrementing Addresses” on page 8-15.
The source and destination addresses can each be in either memory space or I/O space.
This is specified by programming the SM/IO bit in the GDxCON1 register. The AD19–AD16
bits are ignored when the address is in I/O space. Because the DMA channels can perform
transfers to or from odd addresses, there is no restriction on values for the destination and
source address registers. Higher transfer rates can be achieved if all word transfers are
performed to and from even addresses so that accesses can occur in single 16-bit bus
cycles. Word transfers to 8-bit address spaces are supported only when the source
decrement or increment is 2 bytes.
The Am186CC/CH/CU microcontrollers have the added feature of being able to transfer by
DMA to and from the UART and High-Speed UART.
CC CU The Am186CC and Am186CU microcontrollers can also transfer by DMA to and from USB
peripherals.
Transfering between DMA and peripherals is accomplished by programming the DMA
controller to perform transfers between a data buffer (located either in memory or I/O space)
and the peripheral data register. It is important to note that when a DMA channel is in use
by a peripheral, the corresponding external DMA request signal is deactivated. For a
discussion of using DMA and the on-chip peripherals, see “Selecting DMA Request
Sources” on page 8-15.
8.5.6.5 General-Purpose DMA Terminal Count
Each DMA channel has a 16-bit Transfer Count (GDxTC) register. Software must program
the GDxTC register with the desired number of transfers and set the Terminal Count (TC)
bit in the GDxCON0 register to 1 to enable terminal count. If terminal count is enabled, the
channel performs the requested number of transfers, decrementing the value in the GDxTC
register after each transfer. When the count reaches zero, the DMA transfer terminates.
If the TC bit is 0, the DMA controller decrements the value of GDxTC after each transfer
but does not terminate the transfer when the count reaches zero. The GDxTC register wraps
back to its maximum value and continues decrementing. If the current transfer is an
unsynchronized transfer, DMA terminates when the count reaches zero.
If the Auto Start (AST) bit in the GDxCON0 register is set, DMA resumes transferring every
time the GDxTC register is reloaded with a new value.
■ The DMA synchronization for the channel (“Setting Synchronization” on page 8-17)
■ Whether DMA transfers use buffer queues or circular buffers (see “Using Buffer Queues
or Circular Buffers” on page 8-20)
8.5.6.6.1 Generating Interrupts
The general-purpose DMA channels can generate an interrupt request when the terminal
count value in the GDxTC register reaches 0. To program this feature, set the INT bit in the
GDxCON0 register to 1.
8.5.6.6.2 Transferring Bytes or Words
The TS bit in the GDxCON0 register can enable either byte or word transfers.
8.5.6.6.3 Incrementing or Decrementing Addresses
The source and destination addresses can increment or decrement after each transfer, or
remain constant. Specify the action with the SINC and DINC bits in the GDxCON1 register.
The increment or decrement factor of the source and destination addresses are
programmed independently; however, both the source and destination have to be the same
size. Word transfers are only supported when the address is incremented or decremented
by 2 (an increment by one causes unpredictable results). Byte transfers can be incremented
or decremented by 1 or 2. When a byte transfer is incremented or decremented by 2, the
high byte is ignored.
Because the DMA controller stores addresses as 20-bit linear values, there are no segment
restrictions on the address increment and decrement. However, when using the circular
buffer feature, the address boundary is limited to the size of the buffer. For example, when
using a 1-Kbyte circular buffer, the address has to start at a 1-Kbyte boundary. For more
information, see “Using Buffer Queues or Circular Buffers” on page 8-20.
8.5.6.6.4 Selecting DMA Request Sources
The DSEL bit field in the GDxCON0 register sets the DMA request source for that channel.
As shown in Figure 8-3, the DMA request source can be an external DRQ signal, Timer 2,
UART receiver, UART transmitter, High-Speed UART receiver, or High-Speed UART
transmitter.
UART Receiver
UART Transmitter
DMA
High-Speed UART Receiver
DRQ
High-Speed UART Transmitter
CC USB Endpoint A
CU USB Endpoint B
USB Endpoint C
USB Endpoint D
CC CU Because USB can use either general-purpose DMA or SmartDMA channels, this is
discussed separately in “DMA and USB” on page 8-43.
8.5.6.6.5 Setting Synchronization
The DSEL bit field in the GDxCON0 register sets the DMA request source for that channel
(see “Selecting DMA Request Sources” on page 8-15). Unlike prior Am186 parts, this bit
also sets the synchronization. General-purpose DMA transfers can be unsynchronized,
source-synchronized, or destination-synchronized.
The source or destination device implies the synchronization type as shown in Table 8-7.
DMA synchronization affects the behavior of the DMA operation and system performance
as a whole. All DMA transfers observe the programmed ready and wait-state conditions for
any chip select active for that cycle.
DRQ must be deasserted before the end of the DMA transfer to prevent another DMA cycle
from occurring. The timing for the required deassertion depends on whether the transfer is
source-synchronized or destination-synchronized.
Unsynchronized Transfers
For unsynchronized DMA transfers, the DRQ signal is internally tied High. When initiated,
an unsynchronized DMA transfer begins immediately and consumes all bus cycles until the
terminal count value in the GDxTC register reaches 0. Unsynchronized DMA is generally
used for copying data between memory locations, between I/O locations, or between
memory and I/O locations. For example, unsynchronized DMA can initialize RAM during
start-up.
Source-Synchronized Transfers
Source-synchronized DMA transfers require either an internally generated DRQ (e.g., from
a UART receiver) or an external device that asserts the associated external DRQ signal for
a general-purpose DMA channel. In source synchronization, the device providing the data
asserts the DMA request.
Figure 8-4 shows a typical source-synchronized DMA transfer. When an external device is
asserting DRQ, the request must be deasserted at least four clock cycles before the end
of the transfer (at T1 of the deposit phase) to prevent another transfer from taking place. If
more transfers are not required, a source-synchronized transfer allows the source device
at least three clock cycles from the time it is acknowledged to deassert its DRQ line. Like
unsynchronized DMA transfers, source-synchronized DMA transfers have the capability of
consuming all bus cycles if the DRQ remains asserted for multiple transfers. An example
of this would be the emptying of a FIFO.
T1 T2 T3 T4 T1 T2 T3 T4
CLKOUT
Notes:
1. This source-synchronized transfer is not followed immediately by another DMA transfer,
because DRQ is deasserted at least four clock cycles before the end of the transfer.
2. This source-synchronized transfer is immediately followed by another DMA transfer, because
DRQ is not deasserted soon enough.
Destination-Synchronized Transfers
Destination-synchronized DMA transfers require either an internally generated DRQ (e.g.,
from a UART transmitter), or an external device that asserts the associated external DRQ
signal for a general-purpose channel. In destination synchronization, the device receiving
the data asserts the DMA request.
Figure 8-5 shows a typical destination-synchronized DMA transfer. The DMA controller
does not sample the DRQ line for a channel until four cycles after the end of the write phase
of a destination-synchronized DMA transfer. This delay allows the external device sufficient
time to remove its request if it does not want another transfer. The delay also allows other
devices access to the bus, including instruction or data fetches by the processor and other
DMA transfers (including transfers by lower priority DMA requests). If another device starts
a bus cycle during the DMA idle cycles, the entire bus cycle completes before giving the
bus back to the DMA. If no other bus activity is initiated, another DMA cycle begins.
Because the DMA controller relinquishes the bus after every destination-synchronized
transfer, the CPU can initiate a bus cycle. As a result, a complete bus cycle is often inserted
between destination-synchronized transfers. Table 8-8 shows the maximum DMA transfer
rates based on the different synchronization strategies.
T1 T2 T3 T4 T1 T2 T3 T4 TI TI TI TI T1
CLKOUT
DRQ
(First case) 1
DRQ
2
(Second case)
Notes:
1. This destination-synchronized transfer is not followed immediately by another DMA transfer,
because DRQ is deasserted during the four idle states.
2. This destination-synchronized transfer is immediately followed by another DMA transfer, because
DRQ is not deasserted soon enough.
Deasserting DRQ
In externally synchronized transfers, DRQ1 or DRQ0 must be deasserted before the end
of the DMA transfer to prevent another DMA cycle from occurring. The timing for the required
deassertion depends on whether the transfer is source-synchronized or destination-
synchronized.
A DMA request is not acknowledged from the same source for four processor clock cycles
after the end of the deposit cycle. In a source-synchronized DMA transfer, the DRQ signal
must be deasserted at least four clocks before the end of the transfer. If more transfers are
not required, a source-synchronized transfer allows the source device at least three clock
cycles from the time it is acknowledged to deassert its DRQ line. For more information, see
“DMA Acknowledge” on page 8-10.
Example of Using Buffer Queues and Circular Buffers with the UARTs
Note: This section discusses implementation tradeoffs for using the general-purpose DMA
channels. To have a concrete system to discuss, the integrated UART and High-Speed
UART are used as examples, but much of this information is applicable to using the general-
purpose DMA channels with other peripherals as well. In general, there are two distinct
ways that general-purpose DMA can be used: buffer queues and circular buffers. These
two techniques are discussed and contrasted below. In addition, these two methods can
be mixed (e.g., queues of messages for transmit and circular buffers for receive). A careful
analysis of the final system is required to determine the best method to use.
Many systems, especially those communicating with other equipment rather than with
human beings in interactive mode, transmit and receive messages in large blocks. These
messages can be forwarded to a host PC through the USB interface, or forwarded through
an ISDN line or other WAN setup using HDLC. With this sort of message protocol, it may
be advantageous under some circumstances to perform a DMA transfer directly to or from
a queue of buffers, rather than to or from a single circular buffer per direction.
Buffer queues are a viable way to transfer data to and from some devices with general-
purpose DMA. However, buffer queues are only useful for DMA with the UARTs under very
special circumstances.
The primary advantage to using DMA transfer straight from a queue of buffers is the
reduction of data motion. Transmission is relatively straightforward: the DMA channel is
programmed with the correct source address and transfer count for each buffer; and the
DMA channel is set up to stop transmitting and to interrupt when the end of the buffer is
reached. When the interrupt occurs, the buffer is freed, and the next buffer is set up to be
transferred out using DMA.
Reception is more difficult because it is not always known up front exactly how long the
incoming message is. Even if the message size is fixed, line errors can corrupt the perceived
length. For both reception and transmission, issues such as compression, transparency,
and CRC generation and checking mean that software must usually examine each character
individually. In this case, using a circular buffer is generally the best way to use DMA with
a UART (because each character is being read by software anyway, and the number of
characters to be transmitted is different than the number of characters in the original buffer),
although DMA is not necessarily the best way to transfer data to and from the UART.
The determination of whether to use DMA at all for this sort of protocol processing is
dependent on system loading and maximum UART baud rate. If CPU cycles are at a
premium (e.g., for data compression), it may be worthwhile to use DMA.
Many UART serial drivers use circular buffers for temporary storage of incoming and
outgoing characters. The primary drawback to using a circular buffer is that it doubles the
bus bandwidth required to handle each character received or transmitted. For example, if
a string is written out to a serial port, using a circular buffer requires four bus transactions
for each character (read it from the string, write it to the buffer, read it from the buffer, write
it to the transmit port), whereas without the buffer, two transactions would suffice (read the
character from the string, write it to the transmit port). Nevertheless, circular buffers are
popular because the alternative often requires more coding and is usually more error-prone
(e.g., a buffer containing a string could inadvertently be reused before the string is
completely transmitted).
For this reason, the Am186CC/CH/CU microcontrollers’ DMA has excellent circular buffer
support. With the general-purpose DMA channels, this is achieved by setting bits in the
GDxCON1 register to a nonzero value to select a buffer size between 1 and 64 Kbytes.
Software must ensure that this buffer is aligned on a multiple of its size. This is easily done
for statically allocated buffers with a good linker/locator; for dynamically allocated buffers,
the software must waste the size of one buffer. This waste can usually be reduced or
eliminated by allocating and deallocating additional buffers; this is highly dependent on the
operating system and memory allocation library.
Transmitting using DMA and circular buffers is easy and does not require interrupt support.
Note that using DMA for transmission for the UART is not required for data integrity reasons,
so DMA should only be used for UART transmissions if one of the following applies:
■ CPU throughput can be improved by reducing the time spent in the UART interrupt
handler.
■ Transmission throughput can be improved by reducing the latency between transmitted
characters. Note that it is easy to measure intercharacter latency to determine the
maximum possible improvement available by improving UART transmission.
Table 8-9 gives typical register values for using circular buffers with the UARTs.
Table 8-9 Example Register Settings for UARTs and Circular Buffers
General-Purpose DMA Value for Value for
Bit(s) in Register
Register Transmit DMA Receive DMA
Clear (is set by load of Set after all other fields
ST (Start/Stop)
GDxTC register) and UART set correctly
AST (Auto Start) Set Clear
TC (Terminal Count) Set Typically clear
Clear for single-tasking;
INT (Interrupt) Set
set for multitasking
GDxCON0
(Control 0) Depends on rest of
Depends on rest of
P (Relative Priority) system; higher than
system
transmit
0 for 8 bit, 1 for 9 bit or
TS (Transfer Size) 0 for 8 bit, 1 for 9 bit
extended status
(High-Speed) UART (High-Speed) UART
DSEL (DMA Request Select)
Transmitter Receiver
SM/IO (Source Address Space
Set (memory) Clear (I/O)
Select)
SAW (Source Address Wrap) Set to size of buffer Clear
SINC (Source Increment) 1 for 8 bit, 2 for 9 bit 0
GDxCON
(Control 1) DM/IO (Destination Address
Clear (I/O) Set (memory)
Space Select)
DAW (Destination Address Wrap) Clear Set to size of buffer
1 for 8 bit, 2 for 9 bit or
DINC (Destination Increment) 0
extended status
GDxSRCL Buffer address
DSA[15–0] (H)SPRXD
(Source Address Low) MOD 64K
Table 8-9 Example Register Settings for UARTs and Circular Buffers (Continued)
General-Purpose DMA Value for Value for
Bit(s) in Register
Register Transmit DMA Receive DMA
GDxSRCH
DSA[19–16] Buffer address DIV 64K 0
(Source Address High)
GDxDSTL Buffer address
DDA[15–0] (H)SPTXD
(Destination Address Low) MOD 64K
GDxDSTH
DDA[19–16] 0 Buffer address DIV 64K
(Destination Address High)
Set to total string length
GDxTC
TC whenever writes Set to high-water mark
(Transfer Count)
performed
When the DMA channel is initialized as shown in Table 8-9, transmitting a string is performed
as follows:
1. Copy the string from the source to the buffer at the current write pointer position, being
careful to take buffer wrap into account, and being careful not to overwrite data already
in the buffer which is not yet transmitted. (Whether or not data has been transmitted can
be easily determined by reading the DMA channel’s source address register and
comparing it against the write pointer position.) Calculate a new write pointer position,
and save it in memory to use for subsequent writes.
2. Stop the DMA (reset the ST bit) to ensure that the transfer count is stable.
3. Add the length of the new string to the Transfer Count (GDxTC) register. A read/modify/
write cycle adjusts the GDxTC register, and the write to the register automatically restarts
the DMA (if the AST bit is set).
Interrupts are required for transmit under the following conditions:
■ If the XON/XOFF protocol is used, the DMA must be shut off to transmit flow control
characters, and also to stop transmitting when an XOFF is received. One way this
protocol could work is that when DMA is to be stopped, the AST and ST bits can be
reset; when DMA is to be restarted, both these bits can be set again. If this technique
is used, steps 2 and 3 above (stopping DMA and updating transfer count) should be
performed as an atomic operation (i.e., with interrupts disabled) to avoid conflicts with
the XON/XOFF interrupt handler.
■ If a multitasking system is used, an attempt to write too much data to the buffer should
write as much as possible, and then block the task performing the write until additional
space is available. In this case, the GDxTC register should not be programmed with the
actual count of characters in the buffer, but instead be programmed with the lesser of
the actual count and the amount of space to wait for before restarting the blocked task.
Also, the interrupt bit should be set. When the interrupt occurs, the transfer count should
immediately be reprogrammed to the actual remaining buffer count to avoid delay in
transmission, and the blocked task should be marked as ready to run.
Reception Using Circular Buffers
For the UART, DMA reception using a circular buffer is potentially more useful than
transmission because transferring received characters into a circular buffer can help
improve data integrity. (Characters are never lost due to interrupt latency.)
Like basic transmission, basic reception using a circular buffer is simple. Software maintains
a read pointer into the buffer and can dynamically determine the number of characters
available for reading at any time by reading the destination address, subtracting the read
pointer from it, and dividing the result by the buffer size. The remainder of this division is
the number of bytes available for reading.
The difficulty again revolves around multitasking and flow control, with the added problem
of error handling.
Receive XON/XOFF Flow Control
XON/XOFF flow control with DMA is problematic because, in general, the received flow
control characters should not be stored in the buffer, and also because the characters
should typically be acted on immediately. This may make DMA impractical for implementing
XON/XOFF flow control with the UART. The High-Speed UART can be programmed to stop
using DMA and interrupt the CPU whenever a flow control character arrives, so that an
interrupt routine can act on the flow-control character and then restart the DMA operation.
Note that baud rate, system latency, and the depth of the FIFO must be considered when
determining if this is practical for a given implementation.
In addition to detecting and acting on flow-control characters in the data stream, the
receiving task must also detect when the circular buffer is getting full so that an XOFF can
be sent. This can be accomplished by programming the Transfer Count register with a value
that is the current room available in the buffer minus a constant high-water mark, and setting
the INT bit, but not the TC bit in the GDxCON0 register. This causes the DMA to interrupt
when there is room (buffer size minus high-water mark) in the buffer, and an XOFF can be
sent. The value chosen for the high-water mark should take into account far-end latency in
dealing with an XOFF, plus latency associated with sending the XOFF through the High-
Speed UART transmit FIFO, if it is enabled.
Receive Hardware Flow Control
Hardware flow control is simple if the connected device performs true hardware flow control
(i.e., stops transmitting on the next character boundary when RTR is dropped).
Some UARTs and systems perform pseudo-hardware flow control. In these UARTs, the
flow control signal can cause an interrupt, but may not stop characters already queued to
go out. In this case, the High-Speed UART’s receive FIFO may be sufficient to guarantee
that overruns do not occur.
If the UART is being used, or if the High-Speed UART’s receive FIFO is not large enough
to guarantee that the other side will stop quickly enough, then RTR should be performed
using a PIO, and an algorithm similar to the one described for receive XON/XOFF control
should be used, so that the far side is requested to stop sending before the DMA buffer is
actually full. The FIFO threshold is one half of the FIFO depth and is not programmable.
If the attached device is capable of real hardware flow control, then the TC bit in the
GDxCON0 register can be set, and the Transfer Count register can be programmed with
the amount of room left in the buffer. When DMA ceases, the hardware flow control signal
is automatically asserted.
Receive Multitasking
In a single-tasking system, received characters are held in the circular buffer until higher-
level code is ready for them. In a multitasking system, it may be desirable for receipt of
characters to cause an interrupt to signal that a task switch should take place. When DMA
is used with one of the UARTs on the Am186CC/CH/CU microcontrollers, the hardware is
typically programmed to cause interrupts under these two conditions:
■ After a programmed number of characters have been received.
To do this, the programmed transfer count is usually the lesser of this desired number
and the number required to implement proper flow control.
■ When no characters have been received for a certain period of time (signifying that the
other end has probably finished transmitting a message).
This is accomplished by interrupting on the UART IDLED bit in the (H)SPSTAT register,
which causes an interrupt when 40 bit times have gone by without detecting a start bit.
Receive Error Processing
Several kinds of errors and exceptional conditions can occur when receiving asynchronous
character data. Breaks, parity errors, and framing errors indicate an exceptional external
condition. Overrun errors indicate that data has been lost due to system latency. A character
match interrupt (High-Speed UART only) can indicate that an XON or XOFF has been
received.
The Am186CC/CH/CU microcontrollers offer great flexibility in dealing with these
exceptions. If the EXDRD bit in the UART’s Control 1 register is set, and the DMA is set up
to transfer a word for every character, exceptions can be stored in the circular buffer along
with the character that caused them. If the EXDRD bit is reset, exceptions that cause
interrupts cause DMA activity to stop until an interrupt task services the exception.
The decision of whether to set or clear the EXDRD bit depends on the intended usage. If
the target baud rate is high relative to system loading, setting the EXDRD bit can prevent
the loss of data due to interrupt latency. This is especially true when using the UART, or
when using the High-Speed UART without the FIFO. If break or address bit information is
to be stored with the character for later retrieval, setting the EXDRD bit is appropriate.
Setting this bit can complicate system software, especially if XON/XOFF flow control is
used, because the flow control characters are stored in the circular buffer. The system
software must find the character and perform the correct action immediately, and then ignore
the character when reading data out of the buffer later.
When using the FIFO on the High-Speed UART, these exceptions (break, parity error,
framing error, address bit, overrun error, and character match) are placed in the FIFO and
move with the associated data so that the software can match the exception with the correct
character. This means that a system programming error that keeps data from being pulled
out of the FIFO (e.g., misprogramming of the DMA) may keep interrupts from ever occurring.
For this reason, the High-Speed UART has an additional Overrun Error-Immediate (OERIM)
interrupt bit that is not placed in the FIFO. Software can monitor or interrupt on OERIM to
detect and correct this sort of system programming error.
Small or Misaligned Circular Buffers
If a circular buffer is smaller than 1K, is not aligned on a multiple of its size, or the size is
not a power of 2, the address wrap features of the DMA are not available. The DMA can
still be used to implement a circular buffer, but it requires more programming effort, and the
required interrupt could introduce unacceptable latency into the system. System software
must always use interrupts, set the TC bit, and carefully program the Transfer Count register
so that the address never exceeds the boundary of the buffer. Software must manually wrap
the buffer address back to the start of the buffer whenever an interrupt signifies the end of
the buffer. This is not too burdensome for UART transmit buffers because there is no hard
latency requirement for asynchronous transmission, but this could be a problem for receive
buffers if the interrupt latency could cause characters to be missed.
8.5.7 SmartDMA Channels
The Am186CC/CH/CU microcontrollers each contain SmartDMA channels, compatible with
the DMA in the AMD Am79C90 C-LANCE (Local Area Network Controller for Ethernet).
This LANCE-compatible buffer descriptor ring interface provides a method for transmission
and reception of data across multiple memory buffers. The ring descriptor interface also
provides a method for reporting status on multiple received and transmitted packets while
ensuring that status information is always correctly linked with the associated data.
Unlike the general-purpose DMA channels, which can be used for memory-to-memory or
I/O-to-I/O transfers, the SmartDMA channels are highly specialized. These channels must
be used in pairs. Each pair consists of a transmit channel and a receive channel. The
transmit channels transfer data from memory to a transmitting device (such as an HDLC
transmitter). Receive channels transfer data from a receiving device (such as an HDLC
receiver) to memory.
CC Four of the eight SmartDMA channels (two pairs) in the Am186CC microcontroller are
dedicated for use with the on-board HDLC channels. The remaining four SmartDMA
channels (two pairs) can support either the third or fourth HDLC channel or USB endpoints
A, B, C, or D.
CH The four SmartDMA channels (two pairs), SDMA0 and SDMA1, in the Am186CH HDLC
microcontroller support the two on-board HDLC channels.
CU The four SmartDMA channels (two pairs), SDMA2 and SDMA3, in the Am186CU USB
microcontroller support USB endpoints A, B, C, or D.
This section describes these SmartDMA channels.
8.5.7.1 SmartDMA Channels Introduction
With a traditional DMA controller, such as the general-purpose DMA, the typical mode of
operation is to DMA transfer a buffer of information (either filling a receive buffer, or emptying
a transmit buffer) and program the DMA controller to interrupt the CPU when the end of
the buffer is reached.
However, if the data rate is high relative to system loading and interrupt latency, data could
be lost before the interrupt service routine reinitializes the DMA controller to point to the
next buffer. For some peripherals, such as UARTs, this problem is easily solved by the
ability of the general-purpose DMA controller to manage a circular buffer. If such a circular
buffer is managed correctly, DMA is never halted to wait on CPU interrupt activity.
A circular buffer does not work as well for packet-oriented communications such as HDLC
and USB because of the requirement to delineate packet boundaries. Also, in a typical
system, each packet can be routed to a different destination, so the data would have to be
copied out of the circular buffer and into another peripheral’s circular buffer.
SmartDMA channels solve these problems by maintaining a circular queue of buffer
descriptors—a descriptor ring—rather than a circular data buffer. The hardware itself
updates a buffer descriptor when a full buffer is transferred, then automatically fetches the
next descriptor and starts transferring data to the new buffer. Because the hardware
performs this operation without software intervention, the latency is significantly lower than
if an interrupt task performed the same operation.
Software must still read and write the buffer descriptors, but the latency requirements are
greatly relaxed because multiple descriptors are queued at one time. The software can
take, on average, the time it takes to transmit or receive a buffer to update each descriptor,
and software can increase allowable latency even more by updating several descriptors at
the same time.
8.5.7.2 SmartDMA Channel Request Source and Synchronization
The SmartDMA channels support only specific, predetermined request sources. These
sources in turn determine the synchronization type for each channel. Synchronization type
for the SmartDMA channels is not programmable. The synchronization types are shown in
Table 8-10, Table 8-11, and Table 8-12.
The memory buffer addresses are taken from the buffer descriptor ring, as explained in
“SmartDMA Channel Memory Overview” on page 8-28.
CU In the Am186CU USB microcontroller, the DSEL bit must be programmed correctly for USB
support.
The SmartDMA channels support only byte transfers. The data is written or read from
sequential byte addresses in the memory buffers.
The owner semaphore (OWN) bit is a single-bit field in each buffer descriptor. This bit is
set by software when the buffer is valid—either it contains valid data for transmission or it
is available to be overwritten by the receiver. The SmartDMA controller never sets the OWN
bit.
Software must never clear the OWN bit while the SmartDMA controller is active—the
software should first stop the DMA operation by resetting the TXST or RXST bit in the
SDxCON register. (If the SmartDMA controller is already working on that buffer, clearing
the OWN bit has no effect; if the SmartDMA controller was going to get the buffer, it would
be in poll mode and wait until the buffer is available.) The SmartDMA controller clears the
OWN bit when it releases control of the buffer.
Some systems may need to have DMA transfer continue even if software has not kept up
with the DMA. This can be accomplished by setting the TXS0 bit in SDxCON for the transmit
DMA channel or the RXS0 bit in SDxCON for the receive DMA channel. Setting these bits
inhibits the associated SmartDMA channel from clearing the OWN bit after it is through
processing a buffer.
Note: Take care when setting these bits, because you may lose received data or transmit
stale data.
4 1
Buffer 1 (packet x)
Own=0 Own=0
3 2
Buffer 2 (packet x)
Buffer 4 (packet y)
Buffer
Transmit Buffer 1 Status/Config 1
Transmit Buffer 1 Byte Count
Transmit Buffer 1(Unused) Transmit
SmartDMA Channel Transmit Ring Address Data
Registers (SDxTRCAL and SDxTRAH) Transmit Buffer 2 Address
Transmit Buffer 2 Status/Config Buffer
2
Transmit Descriptor Ring Address Transmit Buffer 2 Byte Count
Transmit Buffer 2(Unused)
.
.
SmartDMA Channel Transmit Ring Count . Transmit
Registers (SDxTRCAL) Transmit Buffer N Address Data
Transmit Buffer N Status/Config Buffer
Number of entries (N) in N
transmit buffer descriptor ring Transmit Buffer N Byte Count
Transmit Buffer N (Unused)
Receive Data Buffer Queue
Receive Descriptor Ring Receive
Receive Buffer 1 Address Data
Receive Buffer 1 Status/Config Buffer
1
Receive Buffer 1 Byte Count
Receive Buffer 1 Message Count Receive
SmartDMA Channel Receive Ring Address Receive Buffer 2 Address Data
RECEIVER
Figure 8-6 shows a descriptor ring with four entries. When OWN = 1, the SmartDMA
channel owns the descriptor entry and can take data out or put data in the buffer. When
OWN = 0, software owns the descriptor entry and the SmartDMA channel cannot access
the buffer. This means in a transmit buffer, data is valid when OWN = 1; and in a receive
buffer, data is valid when OWN = 0 (subject to any status error bit settings).
Descriptor ring entries are always accessed in order. In a transmit, the hardware always
follows the software; in a receive, software follows the hardware. If a SmartDMA channel
reaches a buffer whose OWN bit is not 1, the SmartDMA enters poll mode and waits for
software to set the OWN bit. It does not advance past a buffer whose OWN bit is not set.
Keeping this in mind, the example in Figure 8-6 indicates the following for a transmit or a
receive.
8.5.7.3.1 Transmit Descriptor Ring
If Figure 8-6 is a transmit descriptor ring, then software wrote the complete packet x (which
spans buffers 1, 2, and 3 pointed to by descriptors 1, 2, and 3). After writing the complete
packet, software set the OWN bit in each of the three descriptors. The OWN bits should be
set in order, from the last descriptor in the packet to the first (3, then 2, then 1), to guarantee
correct transmission of the packet. The channel has already transmitted the data from buffer
1 and is currently processing buffer 2. While packet x is being transmitted, software is writing
data to buffer 4 for transmission of the next packet, packet y.
Microcontrollers Register Set Manual, order #21916. Even when the ring size is set
to 1, that entry is still interpreted as a descriptor, not as the memory buffer itself.
5. Point to the first buffer descriptor by clearing the SDxCBD register to 0.
Program the Interrupt Conditions
The interrupt conditions are typically configured only once.
1. Write the interrupt handler address to the vector table. See Chapter 7, “Interrupts.”
2. To generate an interrupt after transmitting the last byte of the packet, set the TEPI bit in
the SDxCON register to 1.
3. To generate an interrupt after detecting an unavailable buffer during transmission, set
the TBUI bit in the SDxCON register to 1.
4. To generate an interrupt after transmitting the last byte of the current buffer, set the TTCI
bit in the SDxCON register to 1. (Note that the TTCE bit in Word 2 of the transmit buffer
descriptor ring must also be set to 1.)
5. Program the priority of this channel relative to other channels during simultaneous
transfers using the P bit in the SDxCON register (this is typically configured only once).
A 00b is a low priority; a 01b, medium; and a 10b, high.
Software clears the status bits in SDxSTAT after receiving an interrupt. Software can
use the SDxCBD register to monitor the transmit and receive buffers. Software can also
use the SDxCTAD register to determine the address in memory where the DMA transmit
process was interrupted.
Add Data Buffers to the Transmit Descriptor Ring
To place a data buffer in an entry in the transmit buffer descriptor ring:
1. Find the first buffer descriptor for which the OWN bit is clear (bit = 0). This must be done
in a circular manner relative to the current buffer descriptor index. In systems where the
TXS0 or RXS0 bits are set, thereby inhibiting clearing of the OWN bits, software must
determine when it is safe to modify a descriptor ring entry.
2. Program the data buffer address.
a. Program the LADR bits in Word 0 to the low-order 16 address bits of the data buffer
pointed to by the descriptor.
b. Program the HADR bits in Word 1 to the high-order eight address bits of the data
buffer pointed to by the descriptor. The highest four bits of the address must be set to
0000b. These address bits do not exist on the Am186CC/CH/CU microcontrollers’
20-bit address but are provided for LANCE compatibility.
3. Program the data buffer size by setting the BCNT bits in Word 2 to the length in bytes
of the data buffer pointed to by the descriptor.
4. Initialize the transmit buffer descriptor ring entries.
a. Set to 1 the TTCE bit in Word 2 to enable interrupt on terminal count; or clear to 0 to
disable terminal count interrupt. (Note that the TTCI bit in the SDxCON register must
also be set to 1.)
b. Set to 1 the STP bit in Word 1 to indicate that this is the first buffer of the packet, or
clear to 0 if the buffer contains a continuation of a packet from another buffer.
c. Set to 1 the ENP bit in Word 1 to indicate that this is the last buffer of the packet, or
clear to 0 if the packet does not fit in one buffer and is continued in another.
d. Set to 1 the OWN bit in Word 1 to indicate the descriptor entry is owned by the
SmartDMA channel.
e. To force a poll of the OWN bit of the current buffer descriptor, set to 1 the POLL bit in
the SDxCON register. This has no effect if the SmartDMA is not currently waiting for
a buffer to become available.
CH In the Am186CH HDLC microcontroller, the DSEL bit in the SDxCON register must be
cleared to 0.
CU In the Am186CU USB microcontroller, the DSEL bit in the SDxCON register must be
set to 1.
Enable the Transmit Channel
Enable the transmit channel by setting the TXST bit in the SDxCON register to 1. At this
point, the SmartDMA transmit channel does not transmit any data because there are no
valid buffers in the descriptor ring. As transmit data becomes available, software should
modify entries in the ring to point to the data to be transmitted. Buffers are added to the
ring at the first ring location following the Current Transmit Buffer Descriptor value that has
an OWN bit set to 0.
8.5.7.4.2 Enabling the Receive Channel
To enable a SmartDMA receive channel, software must perform the following tasks:
1. Create the receive buffer descriptor ring.
2. Program the interrupt channel and configure the SmartDMA channel for interrupts.
3. Add data buffers to the ring.
4. Enable the receive channel.
5. Replace used data buffers.
Create the Receive Buffer Descriptor Ring
1. Disable the receive channel by clearing the RXST bit in the SDxCON register to 0.
2. Allocate the memory for the receive buffer descriptor ring (see “SmartDMA Channel
Descriptor Format” on page 8-38 for the descriptor ring data structure).
3. Set the OWN bit for each descriptor to 1 (owned by hardware).
4. Program the address and size of the receive buffer descriptor ring into the SmartDMA
channel registers.
a. Program the RRA bits in the SDxRRCAL register to the 12 low address bits
(bits 15–4) of the descriptor ring address, which is the start location in memory of the
buffer descriptor ring.
b. Program the RRA bits in the SDxRRAH register to the four high address bits (19–16)
of the descriptor ring address. Because the base address of the ring must be paragraph
aligned (aligned to a 16-byte physical memory boundary), address bits 3–0 are always
zeroes.
c. Program the RRC bits in the SDxRRCAL register to the number of entries in the receive
descriptor ring (the ring count). Valid values are 1, 2, 4, 8, 16, 32, 64, or 128 descriptors.
For information about 3-bit encoding, see the Am186™CC/CH/CU Microcontrollers
Register Set Manual, order #21916. Even when the ring size is set to 1, that entry is
still interpreted as a descriptor, not as the memory buffer itself.
5. Point to the first buffer descriptor by clearing the SDxCBD register to 0.
Program the Interrupt Conditions
The interrupt conditions are typically configured only once.
1. To generate an interrupt after receiving the last byte of the packet, set the REPI bit in
the SDxCON register to 1.
2. To generate an interrupt after detecting an unavailable buffer during reception, set the
RBUI bit in the SDxCON register to 1.
3. To generate an interrupt after receiving the last byte of the current buffer, set the RTCI
bit in the SDxCON register to 1. (Note that the RTCE bit in Word 2 of the transmit buffer
descriptor ring must also be set to 1.)
Add Data Buffers to the Receive Descriptor Ring
To place a data buffer in an entry in the receive buffer descriptor ring:
1. Find the first buffer descriptor for which the OWN bit is clear (bit = 0). This must be done
in a circular manner relative to the current buffer descriptor index. In systems where the
TXS0 or RXS0 bits are set, thereby inhibiting clearing of the OWN bits, software must
determine when it is safe to modify a descriptor ring entry.
2. Program the data buffer address.
a. Program the LADR bits in Word 0 to the low-order 16 address bits of the data buffer
pointed to by the descriptor.
b. Program the HADR bits in Word 1 to the high-order eight address bits of the data
buffer pointed to by the descriptor. The highest four bits of the address must be set to
0000b. These address bits do not exist on the Am186CC/CH/CU microcontrollers’
20-bit address but are provided for LANCE compatibility.
3. Program the data buffer size by setting the BCNT bits in Word 2 to the length in bytes
of the data buffer pointed to by the descriptor.
4. Initialize the receive buffer descriptor ring entries.
a. To enable interrupt on terminal count, set to 1 the RTCE bit in Word 2, or clear it to 0
to disable terminal count interrupt. (Note that the RTCI bit in the SDxCON register
must also be set to 1.)
b. Program the priority of this channel relative to other channels during simultaneous
transfers using the P bit in the SDxCON register. A 00b is a low priority; a 01b, medium;
and a 10b, high.
c. Set to 1 the OWN bit in Word 1 to indicate the descriptor entry is owned by the
SmartDMA channel.
d. To force a poll of the OWN bit of the current buffer descriptor, set to 1 the POLL bit in
the SDxCON register.
CH In the Am186CH HDLC microcontroller, the DSEL bit in the SDxCON register must be
cleared to 0.
CU In the Am186CU USB microcontroller, the DSEL bit in the SDxCON register must be
set to 1.
Software clears the status bits in SDxSTAT after receiving an interrupt. Software can use
the SDxCBD register to monitor the transmit and receive buffers. Software can also use
the SDxCRAD register to determine the address in memory where the DMA receive process
was interrupted.
Enable the Receive Channel
Enable the receive channel by setting the RXST bit in the SDxCON register to 1.
At this point, the SmartDMA receive channel is enabled. As received data is processed,
software should modify entries in the ring to point to empty data buffers. Buffers are added
to the ring at the first ring location following the Current Buffer Descriptor value that has an
OWN bit cleared to 0.
Replace Used Data Buffers
1. Program the new data buffer address.
a. Program the LADR bits in Word 0 to the low-order 16 address bits of the data buffer
pointed to by the descriptor.
b. Program the HADR bits in Word 1 to the high-order eight address bits of the data
buffer pointed to by the descriptor. The highest four bits of the address must be set to
0000b. These address bits do not exist on the Am186CC/CH/CU microcontrollers’
20-bit address but are provided for LANCE compatibility.
2. Set to 1 the OWN bit in Word 1 to indicate the descriptor entry is owned by the SmartDMA
channel.
3. To force a poll of the OWN bit of the current buffer descriptor, set to 1 the POLL bit in
the SDxCON register. This bit has no effect if the SmartDMA channel is not currently
waiting for a buffer to become available.
8.5.7.4.3 Enable the Peripheral Device
CC CH Details for configuring and enabling the HDLC peripheral device being used can be found
in Chapter 15, “High-Level Data Link Control (HDLC).”
CC CU Details for configuring and enabling the USB peripheral device being used can be found in
Chapter 18, “Universal Serial Bus (USB).”
The DMA should always be enabled before the requesting device is enabled. The DMA
should always be disabled after the requesting device is disabled.
8.5.7.5 SmartDMA Channel Cycle
This section and the following sections describe the procedure the SmartDMA controller
follows for both a transmit and a receive.
8.5.7.5.1 SmartDMA Transmit Channel Cycle
The flow diagram for the SmartDMA transmit channel is shown graphically in Figure 8-8 on
page 8-37 and discussed below.
1. When the transmit channel is first enabled, the SmartDMA controller enters initialization
mode.
2. The transmit channel reads the current descriptor and checks to see if the owner
semaphore (OWN) bit is set to 1.
If the OWN bit is 0, the software owns the current descriptor. In this case, the SmartDMA
transmit channel periodically polls the descriptor until the OWN bit becomes 1. The
transmit channel does not advance past a descriptor for which the OWN bit is 0. For
information about forcing a poll, see “SmartDMA Channel Descriptor Polling” on
page 8-41.
3. If the OWN bit is 1 in the current descriptor, the transmit channel checks to see if the
start-of-packet bit (STP) bit is set to 1.
If the STP bit is 0, the transmit channel enters Search-For-Start-of-Packet mode. This
mode simply clears the OWN bit in the current descriptor and advances to the next
descriptor ring entry. The transmit channel then returns to Initialization mode, repeating
these steps until it finds an entry with both the OWN and STP bits set to 1.
4. If the OWN and STP bits are both set to 1, the transmit channel reads the length of the
buffer from the descriptor ring (BCNT bits in Word 2) and programs that value into an
internal terminal count register. The address of the buffer associated with this descriptor
is read from the descriptor (LADR and HADR bits) into the SDxCTAD source address
register. The transmit channel then enters normal-transmit mode.
5. In transmit mode, the channel transmits one byte of data from the memory buffer to the
destination device for every DRQ. After each transfer, the source address in SDxCTAD
is incremented and the internal transfer count is decremented.
6. When the internal terminal count is reached, the transmit channel checks the end-of-
packet (ENP) bit.
a. If the ENP bit is 0 in the current descriptor, the transmit channel attempts to acquire
the next buffer. The transmit channel releases the current buffer by clearing the OWN
bit (unless the TXS0 bit is set). It then advances to the next descriptor in the ring. If
the OWN bit is 0 (the software owns the descriptor), the transmit channel periodically
polls the descriptor until OWN becomes 1. If an error condition occurs (e.g., a FIFO
underflow) before the transmit channel acquires the next descriptor, the error causes
the requesting transmit source to shut down and the SmartDMA channel to be
reprogrammed. If the transmit channel successfully acquires the next descriptor, the
new buffer address and terminal count are loaded into the appropriate internal
registers.
b. When the terminal count is reached for a buffer for which the ENP bit is set, the transmit
channel enters Transmit-End mode. In this mode, the transmit channel signals the
end-of-packet to the device by asserting an internal signal during the transfer of the
last data byte. The SmartDMA transmit channel waits for the packet to be sent
successfully, then advances the index to the next buffer.
If a complete packet is transmitted, the channel releases the current buffer by clearing
the OWN bit before attempting to advance to the next buffer. If a packet is incomplete
when the channel has reached terminal count on the buffer, it releases control of the
buffer and advances to the next buffer in the ring. If the TXS0 bit is set, the channel
moves to the next buffer without clearing the OWN bit.
Whenever a packet needs to be retransmitted, the transmit channel must be disabled
and the Current Buffer Descriptor (SDxCBD) register must be programmed with the
index of the buffer descriptor containing the STP bit for that packet. The transmit
channel does not report any status in the buffer descriptor other than clearing the
OWN bit.
Note: Before disabling the transmit channel, you should stop the HDLC channel.
Transmit byte
(TC>0) and decrement
count
Transmit data
5. If the terminal count reaches zero before the end-of-packet signal from the device is
asserted, the receiver closes the current buffer and enters Get-Next-Buffer mode. In this
mode, the receiver reads the next descriptor in the descriptor ring and determines if the
OWN bit is set. If the OWN bit is 0, the receiver remains in Get-Next-Buffer mode,
periodically polling the descriptor, until the OWN bit becomes set. When the OWN bit is
detected as set, the receiver loads the buffer address and terminal count from the new
descriptor and returns to normal-receive mode.
6. When the receiver detects the end-of-packet signal from the device, the receiver moves
to Receive-End mode. In Receive-End mode, the receiver reads the status information
from the device and writes it to the descriptor. The end-of-packet bit is set in the descriptor
and the OWN bit is cleared. If RXS0 is set, the EOP bit is set but the OWN bit not cleared.
7. The receiver advances the descriptor ring pointer and enters Initialize mode.
8.5.7.6 SmartDMA Channel Descriptor Format
Each entry in the descriptor ring consists of four 16-bit words. Table 8-13 shows the format
of the transmit descriptor ring; Table 8-14, the receive descriptor ring.
OWN=0
Search for
Initialize channel available buffer
OWN=1
OWN=1 Owner
semaphore
Owner bit set
semaphore
bit set
Receive byte
Write status, clear
and decrement
owner semaphore bit, (TC>0) count
and advance to next
descriptor. Receive data
In the simplest instance, a circular buffer can be formed by using a ring with a single
descriptor. The descriptor contains the starting address and length of the circular buffer,
and the STP and OWN bits must be set so that the DMA controller uses the buffer.
If code is to allow for adjustment of the buffer pointer (e.g., in case a USB isochronous
transfer has an error or is missing), then the ring should have two descriptors in it. Each
descriptor points to a portion of the physical buffer, and the DMA can be started at any
arbitrary point by adjusting the descriptors’ starting addresses and lengths, and setting the
SDxCBD registers to point to the correct descriptor.
8.5.8 DMA and USB
CC CU The integrated USB peripheral controller is the only Am186CC and Am186CU
microcontroller peripheral capable of using either general-purpose DMA or a SmartDMA
channel. Each of the four USB data endpoints is connected to a single SmartDMA channel,
and can be connected to any of the general-purpose DMA channels. DMA is a powerful
tool when used with the USB peripheral controller. In addition to providing increased
throughput and responsiveness to USB requests, it allows the use of larger packets, and
it enables the USB peripheral controller’s automatic rate control feature for isochronous
transfers based on the PCM highway frame clock or an external frame clock source.
For more information about using DMA with the USB peripheral controller, see Chapter 18,
“Universal Serial Bus (USB).”
8.5.9 Software-Related Considerations
Software must stop DMA operation before writing to the GDxCON1 register, or the results
are unpredictable. Stopping the SmartDMA channel has no effect while a request is pending
on the channel. Before stopping the channel, make sure the requesting peripheral (HDLC
channel or USB endpoint) is stopped.
8.5.10 Comparison to Other Devices
■ The general-purpose DMA channels are the same as on other Am186 controllers.
■ SmartDMA channels are compatible with the Am79C90 C-LANCE DMA.
8.6 INITIALIZATION
On both an internal and external reset, the following occurs:
■ All the general-purpose DMA and SmartDMA channel registers are cleared to 0.
■ Any DMA transfer in progress is aborted.
■ Multiplexed signal DRQ0 defaults to its PIO functionality.
9.1 OVERVIEW
The Am186CC/CH/CU microcontrollers provide 48 user-programmable input/output
signals (PIOs).
Many of these signals share a pin with at least one alternate function. If an application does
not need the alternate function, the associated PIO can be programmed through the PIO
registers.
If a pin is enabled to function as a PIO, the alternate function is disabled and does not affect
the pin. Conversely, the value of any pin configured as a PIO does not affect the alternate
function of the pin. When configured as a PIO, an appropriate default value for the signal
is sent to the associated device rather than the value on the pin.
A PIO can be configured to operate as an input or output, with or without internal pullup or
pulldown resistors (pullup or pulldown depends on the pin configuration and is not user-
configurable), or as an open-drain output. Additionally, eight PIOs can be configured as
external interrupt sources. For information on this interrupt functionality, see Chapter 7,
“Interrupts.”
Associated bits in the PIO Mode, PIO Direction, PIO Data, PIO Set, and PIO Clear registers
control each of the 48 PIOs. Because these registers are 16 bits wide, each PIO function
requires three registers (see Table 9-2). Two additional registers are provided for ease of
use.
9.2 BLOCK DIAGRAM
Figure 9-1 shows the PIO operation.
Mode Alternate
D Q
PIO Read Mode Function
Write Mode Data Out
Mode Register
Write
Set
Read Set
Data Read Clear
D S Q
Out Pad
PIO
Write Output
Data R VSS or VCC1
100K
Write
Clear Data
D Q In
PIO Read Data
Input
PIO Data
Register
PIO
Bus
Alternate 0 Default
Function Value2
Data In
Notes:
1. Depends on pullup or pulldown.
2. When the PIO is enabled, an appropriate default value is driven on the Alternate Function Data In.
DCE_CTS_A CC CH
PIO17 PIO17: input with pullup PIOMODE1[1]
PCM_TSC_A CC CH
PIO18 DCE_RTR_A CC CH PIO18: input with pullup PIOMODE1[2]
PIO19 INT6 PIO19: input with pullup PIOMODE1[3]
TXD_U/ DCE_TXD_D CC /
PIO20 PIO20: input with pullup PIOMODE1[4]
PCM_TXD_D CC
UCLK
PIO21 USBSOF CC CU PIO21: input with pullup PIOMODE1[5]
USBSCI CC CU
DCE_RCLK_C CC
PIO22 PIO22: input with pulldown PIOMODE1[6]
PCM_CLK_C CC
DCE_TCLK_C CC
PIO23 PIO23: input with pulldown PIOMODE1[7]
PCM_FSC_C CC
CTS_U
PIO24 DCE_TCLK_D CC PIO24: input with pullup PIOMODE1[8]
PCM_FSC_D CC
RTR_U
PIO25 DCE_RCLK_D CC PIO25: input with pullup PIOMODE1[9]
PCM_CLK_D CC
RXD_U
PIO26 DCE_RXD_D CC PIO26: input with pullup PIOMODE1[10]
PCM_RXD_D CC
PIO27 TMRIN0 PIO27: input with pullup PIOMODE1[11]
PIO28 TMROUT0 PIO28: input with pulldown PIOMODE1[12]
DCE_RXD_B CC CH
PIO36 PIO36: input with pullup PIOMODE2[4]
PCM_RXD_B CC CH
DCE_TXD_B CC CH
PIO37 PIO37: input with pullup PIOMODE2[5]
PCM_TXD_B CC CH
DCE_CTS_B CC CH
PIO38 PIO38: input with pullup PIOMODE2[6]
PCM_TSC_B CC CH
PIO39 DCE_RTR_B CC CH PIO39: input with pullup PIOMODE2[7]
DCE_RCLK_B CC CH
PIO40 PIO40: input with pullup PIOMODE2[8]
PCM_CLK_B CC CH
DCE_TCLK_B CC CH
PIO41 PIO41: input with pullup PIOMODE2[9]
PCM_FSC_B CC CH
DCE_RXD_C CC
PIO42 PIO42: input with pulldown PIOMODE2[10]
PCM_RXD_C CC
DCE_TXD_C CC
PIO43 PIO43: input with pulldown PIOMODE2[11]
PCM_TXD_C CC
DCE_CTS_C CC
PIO44 PIO44: input with pullup PIOMODE2[12]
PCM_TSC_C CC
PIO45 DCE_RTR_C CC PIO45: input with pullup PIOMODE2[13]
CTS_HU
PIO46 DCE_CTS_D CC PIO46: input with pullup PIOMODE2[14]
PCM_TSC_D CC
RTR_HU
PIO47 PIO47: input with pullup PIOMODE2[15]
DCE_RTR_D CC
9.4 REGISTERS
The 16 registers listed in Table 9-2 program the PIO signals. Appendix A summarizes the
bits in all the registers. For a complete description of all the peripheral registers, see the
Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916.
9.5 OPERATION
9.5.1 Usage
Note: Before using the PIOs, ensure multiplexed pins are configured to reflect the use of
PIO and not other functionality (see Table 9-1 on page 9-3).
To define a pin to be used as a PIO, use the following process:
1. Set the applicable bits in the PIO Mode and PIO Direction registers. To avoid changing
system PIO functionality unintentionally, it is good programming practice to do a read-
modify-write when setting these bits.
2. Manipulate data with the PIO Data, PIO Set, and PIO Clear registers.
9.5.2 Defining the PIO Signal as Input or Output
Table 9-3 shows how the bit settings for the PIO Mode and PIO Direction registers affect
signal function. The internal pullup and pulldown resistors each have a value of
approximately 10 KΩ.
Table 9-3 PIO Mode and PIO Direction Register Bit Settings
PIO PIO
Mode Mode Direction Pin Function
Register Register
Alternate operation with pullup/pulldown (PIO
Alternate Operation 0 0
functionality disabled)
0 1 PIO input with pullup/pulldown1
PIO 1 0 PIO output with pullup/pulldown1
1 1 PIO input without pullup/pulldown1
Notes:
1. The following PIO signals can be configured as interrupt sources in the interrupt controller’s
Shared Mask (SHMASK) register: PIO5, PIO15, PIO27, PIO29, PIO30, PIO33, PIO34, and PIO35.
Typically, these signals should be configured as inputs when used as an interrupt source. However,
if any of these signals is configured as both a PIO output and as an interrupt source, the PIO output
signal generates interrupts.
Table 9-4 PIO Set and PIO Clear Registers’ Effect on PIO Data Register
PIO Set Register Function PIO Clear Register Function
Written to Old New Written to Old New
PIO Set PIO Data PIO Data PIO Clear PIO Data PIO Data
Register Bit Register Bit Register Bit Register Bit Register Bit Register Bit
0 0 0 0 0 0
0 1 1 0 1 1
1 0 1 1 0 0
1 1 1 1 1 0
10 PROGRAMMABLE TIMERS
10.1 OVERVIEW
There are three 16-bit programmable timers in the Am186CC/CH/CU microcontrollers.
Timers 0 and 1 are identical and may be used to generate periodic external signals or
waveforms or to count or time external events. Each of these two timers has an input and
an output pin. Timer 2 is an internal timer which can be used to prescale Timers 0 and 1
to provide longer time-out periods, or to generate DMA requests for the general-purpose
DMA channels (see Chapter 8, “DMA Controller”). All three timers can be programmed to
generate periodic interrupts.
The source clock for Timer 2 is one-fourth of the CPU clock frequency (every fourth CPU
clock tick). The source clock for Timers 0 and 1 can be the timer input pin, Timer 2, or one-
fourth of the CPU clock,.
The microcontroller also provides a pulse width demodulation (PWD) option for measuring
the Low state and High state durations of a toggling input signal.
10.2 BLOCK DIAGRAM
Figure 10-1 shows the block diagram for the programmable timers.
CH0
TMRIN0 0 TMROUT0
1
Timer 0
DMA
Timer 2 Controller
TMRIN1 0
Timer 1 TMROUT1
1
Timers
Notes:
1. In PWD mode, the TMRIN0, TMRIN1 and INT7 pins can be used as PIOs. If INT7 is to be used as an external
interrupt in PWD mode, it must be programmed to use the shared interrupt channel (channel 14).
10.4 REGISTERS
The registers listed in Table 10-2 program the timers. Appendix A summarizes the bits in
all the registers. For a complete description of all the peripheral registers, see the
Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916.
10.5 OPERATION
10.5.1 Usage
Note: If Timer 0 or Timer 1 is being used without the associated TMRIN pin, the pin must
be held high or programmed as a PIO, otherwise the timer will not increment. Before using
the programmable timers, ensure multiplexed pins are configured to reflect the use of the
timers and not other functionality (see Table 10-1).
1. Clear the current count by writing zero to the TxCNT register.
2. Specify the timer maximum count by writing to the Timer Maxcount Compare (TxCMPy)
registers for the timer being used.
3. Specify the actions taken when the timer count reaches maximum by setting bits in the
corresponding Timer Mode and Control (TxCON) register.
4. Enable the timer by setting both the EN and INH bits in the corresponding Timer Mode
and Control (TxCON) register.
The timer count registers can be read or written at any time, regardless of whether the
corresponding timer is running. The timers count from their initial value to the programmed
compare value and then reset on the same clock. The value in the timer count register
never equals the compare value.
If the external pins are used (Timer 0 and Timer 1), the PIO Mode and PIO Direction bits
for these pins must be configured for alternate operation. These pins are configured as
PIOs at external and internal reset. For more information, see Chapter 9, “Programmable
I/O Signals.”
10.5.2 Timer 2
When enabled, Timer 2 increments the T2CNT register value at every fourth processor
clock. After the timer increments, the microcontroller compares the T2CNT value with the
value of the T2CMPA register. When the two values are equal, the microcontroller takes
the following actions:
■ Resets T2CNT to zero and sets the MC (Max Count reached) bit in the T2CON register.
■ If the INT bit is set in T2CON, generates an interrupt request. Software must clear the
MC bit.
■ Sends a pulse to Timer 0 and Timer 1 which can be used to increment those timers.
■ Sends a DMA request to the general-purpose DMA—the DMA may act on or ignore this
request depending on how it is programmed.
■ If the CONT (continuous mode) bit is zero, clears the EN (enable) bit and the timer stops
counting. If CONT is one, the timer remains enabled and continues counting.
Since the comparison is done after the count is incremented, if T2CNT and T2CMPA are
initially set to the same value, the comparison of T2CNT to T2CMPA will not be equal until
4 • 0FFFFh processor clocks after the counter is enabled.
10.5.3 Timer 0 and Timer 1
Timers 0 and 1 provide identical functionality. Unlike Timer 2, Timers 0 and 1 each have
an input and output pin associated with the timer. They can also use Timer 2 as a prescaler
providing a 32-bit time-out count.
Three bits in the control register and the external TMRIN pin control the way Timer 0 and
Timer 1 count:
■ When the EXT (external clock) bit is set, the TMRIN signal provides the clock for the
associated timer. In this mode, the timer count increments once for each low to high
transition on the TMRIN pin. The external clock speed cannot be greater than one fourth
of the processor clock. The timer output can take up to six clock cycles to respond to
the clock or gate input because of internal synchronization and pipelining of the timer
circuitry.
■ When the RTG (retrigger) bit is set, a low to high transition on TMRIN resets the value
in the timer’s current count register. The timer counts during both the high and low phases
of the TMRIN signal.
■ When the P (prescaler) bit is set, Timer 2 provides the clock for the associated timer.
The timer increments once each time Timer 2 reaches its maximum count.
Timers 0 and 1 provide two maximum count compare registers, TxCMPA and TxCMPB.
The setting of the ALT (alternate compare) bit determines whether one or both of these
compare registers are used. When ALT is zero, only TxCMPA is used. When ALT is one,
both compare registers are used.
When ALT is zero, the timer behaves as follows:
■ Each time the timer increments, it compares the value in TxCNT to the value in TxCMPA.
■ If the compare is not equal, the timer:
– Holds TMROUTx High.
■ If the compare is equal, the timer:
– Pulses TMROUTx Low for a single processor clock.
– Resets the TxCNT register to zero.
– Sets the MC (maxcount reached) bit. Software must clear the MC bit.
– If the INT bit is set in TxCON, the timer generates an interrupt request.
– If the CONT (continuous mode) bit is zero, the timer clears the EN (enable) bit and
the timer stops counting. If the CONT bit is one, the timer remains enabled and
continues counting.
When ALT is set and the timer is using TxCMPA (initial value after reset), the timer
behaves as follows:
■ The RIU (Register-In-Use) bit is zero (this is a read-only bit).
■ Holds the TMROUTx signal High (inverse of RIU).
■ Each time the timer increments, it compares the value in TxCNT to the value in TxCMPA.
■ If the compare is equal, the timer:
– Resets the TxCNT register to zero.
– Sets the MC (maxcount reached) bit. Software must clear the MC bit.
– If the INT bit is set in TxCON, the timer generates an interrupt request.
– Sets the RIU bit and performs the next compare against TxCMPB.
When ALT is set and the timer is using TxCMPB, the timer behaves as follows:
■ The RIU (Register-In-Use) bit is one (this is a read-only bit).
■ Holds the TMROUTx signal Low (inverse of RIU).
■ Each time the timer increments, it compares the value in TxCNT to the value in TxCMPB.
■ If the compare is equal, the timer:
– Resets the TxCNT register to zero.
– Sets the MC (maxcount reached) bit.
– If the INT bit is set in TxCOT, the timer generates an interrupt request. Software must
clear the MC bit.
– Clears the RIU bit and TMROUTx transitions to high.
– If the CONT (Continuous Mode) bit is zero, the timer clears the EN (Enable bit) and
the timer is disabled. If the CONT bit is set, the timer remains enabled and performs
the next compare against TxCMPA.
Because the comparison is done after the count is incremented, if TxCNT and TxCMPA
are set to the same value, the comparison of TxCNT to TxCMPA will not be equal until the
current count reaches its maximum value, wraps around through zero and counts to the
TxCMPA value. Setting TxCMPB to zero provides the maximum time-out for the second
phase of the timer.
Setting the ALT bit and using the two compare registers allows Timer 0 and Timer 1 to
generate waveforms on the associated TMROUT pins.
10.5.4 Requesting Interrupts
The INT bits in the T0CON, T1CON, and T2CON registers control interrupt request
generation when a maximum count is reached. The request remains asserted for as long
as the MC bit in the TxCON register is set. Software must clear this bit.
If the maximum count and compare registers are both set to 0000h, the timer associated
with that compare register counts from 0000h to FFFFh before requesting an interrupt. With
a 40-MHz clock, a timer configured this way interrupts every 6.5536 ms.
When the ALT bit is set for Timer 0 or Timer 1, the MC bit is set both when the timer reaches
the TxCMPA value and when the timer reaches the TxCMPB value. Software can
differentiate these two conditions by examining the RIU bit. The RIU bit is 1 when the
TxCMPA value is reached (timer is now comparing against TxCMPB). The RIU bit is 0 when
the TxCMPB value is reached (timer is now comparing against TxCMPA).
10.5.5 Software Polling
Software can poll the MC bit in the T0CON, T1CON, and T2CON registers to monitor timer
status rather than using interrupts. This bit must be cleared by software.
10.5.6 Generating Waveforms
When programmed to use both compare values (ALT bit in TxCON is 1), Timer 0 and Timer
1 can generate waveforms on the associated TMROUT pin. The TxCMPA value determines
the duration of the High phase of the output waveform. The TxCMPB value determines the
duration of the Low phase of the output waveform. For more information, see the timer
examples available on the AMD website at ftp.amd.com.
10.5.7 Pulse Width Demodulation
For many applications, such as bar-code reading, it is necessary to measure the width of
a signal in both its High and Low phases. The Am186CC/CH/CU microcontrollers provide
a pulse width demodulation (PWD) option to fulfill this need. The PWD bit in the System
Configuration (SYSCON) register enables the PWD option. Note that the Am186CC/CH/
CU microcontrollers do not support analog-to-digital conversion.
Figure 10-1 on page 10-1 shows the routing of signals when pulse width demodulation is
either enabled or disabled. The waveform for PWD mode is input on the INT8/PWD pin.
This pin is of type Schmitt trigger in both normal interrupt and PWD modes. Note that this
pin is multiplexed with PIO6 and defaults to the PIO function at external and internal reset.
In PWD mode, software uses Timer 0 and Timer 1 to measure the High and Low pulse
width of the input signal. Interrupt 8 (Channel 13, type 1dh) and interrupt 7 (Channel 12,
type 1ch) notify software of the transitions of the measured input signal.
Timer 0 starts its count on the Low-to-High transition on the PWD input and counts the High
signal duration. Timer 1 starts its count on the High-to-Low transition on the PWD input
and counts the Low signal duration. The Low-to-High transition of the PWD input generates
an interrupt request using Channel 13 (type 1dh). The High-to-Low transition of the PWD
input generates an interrupt request using Channel 12 (type 1ch).
Figure 10-2 shows the behavior of the PWD function for a typical input waveform.
As shown in Figure 10-1 on page 10-1, entering pulse width demodulation mode by setting
the PWD bit in the SYSCON register does not have any direct effect on the timer block
other than to reroute the TMRIN0 and TMRIN1 signals. The timers retain their full
functionality and programmability.
In the typical pulse width demodulation application, configure the T0CON and T1CON
registers with a write of C001h (EN + INH + CONT). The ISR for Channel 13 reads the
value in T1CNT to determine the length of the Low phase of the signal, and then resets the
T1CNT register to zero. The interrupt service routine (ISR) for Channel 12 reads the value
in T0CNT to determine the length of the High phase of the signal and then resets the T0CNT
register to zero. Set the TxCMPA compare value high enough to ensure that the signal
duration will not exceed the maximum count. The ISR should check the MC bit of the
associated timer to determine if the maximum count has been exceeded. If the MC bit is
set, software must then determine the appropriate response to this overflow situation. It
may be sufficient to add the TxCMPA register value to the TxCNT register value to generate
the correct signal duration.
10.5.7.1 Handling Short Signal Durations
In applications where the pulse width is short, it may be necessary to poll the interrupt
request bits in the interrupt request (REQST) register and jump to the ISR rather than
actually taking interrupts.
10.5.7.2 Handling Long Signal Durations
When the timers are configured for PWD (EN + INH + CONT), the maximum duration of
each phase of the input signal should not exceed 4 • TxCMPA processor clocks because
the timer increments every fourth processor clock in this configuration. To extend the
maximum measurable duration using PWD, software can enable timer interrupts, use Timer
2 as a prescaler, or both.
If the INT (interrupt) bit is set in either T0CON or T1CON, the associated timer generates
an interrupt request on Channel 0—type 08h for Timer 0 and type 09h for Timer 1. The ISR
for these interrupts should add the programmed maxcount (the value of the TxCMPA
register) to a memory location and clear the MC bit in the TxCON register each time the
interrupt is taken. The ISR for channel 13 (interrupt type 1dh) must add the value of the
Timer 1 memory location to the current T1CNT register to determine the duration of the
Low phase of the signal. The ISR for channel 12 (interrupt type 1ch) must add the value of
the Timer 0 memory location to the current T0CNT register to determine the duration of
the High phase of the signal. In both cases the calculated duration must be multiplied by
four to yield the total number of processor clocks.
If the P (prescaler) bit is set in either T0CON or T1CON, the associated timer increments
once for each Timer 2 time-out. This increases the maximum measurable duration to
4 • T2CMPA • TxCMPA. However, the precision of the measurement falls from within four
processor clocks of the actual value to within 4 • T2CMPA processor clocks of the actual
value. For this reason, the value of T2CMPA should be kept as small as possible. This
solution uses fewer processor cycles and has less of an effect on system performance than
the use of timer interrupts.
In applications where extremely long signals need to be measured, both the P bit and the
INT bit can be set either in T0CON or T1CON or both.
11 WATCHDOG TIMER
11.1 OVERVIEW
The Am186CC/CH/CU microcontrollers provide a full-featured watchdog timer that can
generate nonmaskable interrupts (NMIs), internal resets, and system resets when the time-
out value is reached. The time-out value is programmable and ranges from 210 to 226
processor clocks. Throughout this chapter, an external reset refers to a reset of the
microcontroller as initiated by the RES signal, which resets the CPU and the internal
peripherals. Internal reset refers to a reset initiated by the watchdog timer. System reset
refers to a reset of the external peripherals connected to the controller as initiated by the
RESOUT signal, which is pulled Low during an external reset and can be pulled Low during
an internal reset.
The watchdog timer provides a method to regain control when a system has failed due to
a software error or to the failure of an external device to respond in the expected way.
Software errors can sometimes be resolved by recapturing control of the execution
sequence through a watchdog-timer-generated NMI. When an external device fails to
respond, or responds incorrectly, it may be necessary to reset the controller or the entire
system, including external devices. The watchdog timer provides the flexibility to support
both NMI and reset generation. The watchdog timer is enabled at reset.
11.2 BLOCK DIAGRAM
Figure 11-1 shows a block diagram of the watchdog timer.
Systems that require a guaranteed recovery time from software or hardware errors should
use the watchdog timer.
Generation of the internal NMI signal on the first watchdog timer time-out can be useful in
systems where it may be possible to recover from glitches, corrupted data, or incorrect code
without resetting either the controller or the board. This is especially true where potential
data recovery is important. Such systems should have the NMI interrupt handler routine in
ROM to ensure that it has not been corrupted by runaway code. However, in most systems,
the interrupt table, which must be located at address 00000h, is located in RAM and so is
subject to corruption.
Generation of the RESOUT signal should be used in systems where a system hang may
be caused by incorrect behavior of an external device. The watchdog timer reset duration,
and therefore the duration of the RESOUT signal on a watchdog timer reset, is 216 processor
clocks. This allows sufficient time for external devices to reach their reset state.
The watchdog timer must function in all cases where either the software or external devices
have failed to respond appropriately. The watchdog timer has incorporated several features
to ensure that this is the case.
■ The watchdog timer is active after reset.
■ The watchdog timer’s default configuration after a power-on reset is to generate a reset
on the first time-out and to assert the RESOUT signal.
■ Software can disable the Watchdog Timer Control (WDTCON) register after reset and,
while it is disabled, it can be written any number of times. When software enables the
watchdog timer, the register becomes read-only except for two flag bits. This allows
bootup or monitor code to disable the watchdog timer until the system has been
configured.
■ Each single write to the watchdog timer must be preceded by writes of a keyed sequence.
Detection of the keyed sequence allows a single write to the WDTCON register.
■ The watchdog timer time-out counter can only be reset by the initial enabling write to
the WDTCON register or by writing a special key sequence to the WDTCON register.
These features guarantee that the watchdog timer is not affected by runaway code.
Software can determine whether an NMI or reset event was caused by an external source
or by the watchdog timer by reading the WDTCON register. The NMIFLAG bit is set when
the watchdog timer generates an NMI; the RSTFLAG bit is set when the watchdog timer
generates a reset. Software can clear, but not set, these bits.
11.4 REGISTERS
The register shown in Table 11-2, WDTCON, programs the watchdog timer. Figure 11-2
illustrates the rules for accessing the WDTCON register. Appendix A summarizes the bits
in all the registers. For a complete description of all the peripheral registers, see the
Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916.
ENA = 1
Timer enabled
(after external or internal
Write key plus Write key plus
reset); software can use
any value with any value with
write key to write any
ENA = 0 ENA = 1
value
Reset Reset
ENA = 0 ENA = 1
Timer disabled; Timer enabled;
software can use write software can use write key
key to write any value to clear RSTFLAG and
Write key plus NMIFLAG bits only
any value with
Write key plus ENA = 1 Write key plus
any value with RSTFLAG = 0 or
ENA = 0 NMIFLAG = 0 only
Notes:
Only one write is allowed to the WDTCON register after each write key sequence of 3333h followed by CCCCh.
11.5 OPERATION
11.5.1 Usage
1. Enable the watchdog timer by writing the keyed sequence of 3333h followed by CCCCh
to the WDTCON register address.
This sequence opens the WDTCON register for a single write. Any number of processor
cycles, including memory and I/O reads and writes, can be inserted between the two
halves of the key or between the key and the writing of data as long as they do not read
or write the WDTCON register. The write key sequence must be repeated for each single
write.
2. After enabling the watchdog timer, periodically reset it by writing the keyed sequence of
AAAAh followed by 5555h to the WDTCON register address.
As with the write key, any number of processor cycles, including memory and I/O reads
and writes, can be inserted between the two halves of the key as long as they do not
access the WDTCON register. The key itself resets the counter; no further writes are
necessary. Note that the clear-count key cannot be initiated while the write key is active.
This would result in the value of AAAAh being written to the WDTCON register.
11.5.2 Overview
Because the watchdog timer is enabled after reset, it is important for start-up code to
program the watchdog timer before the initial time-out period expires. The time-out period
after a watchdog timer reset is 226 clock cycles.
All writes to the WDTCON register must be preceded by the write key sequence. The write
key is a special two-write sequence to the WDTCON register address. The value of the key
is not written to the WDTCON register but is used by internal logic to open the register for
a single write. If a read-modify-write sequence is desired, the read must take place before
the key is written because a read of WDTCON resets the keyed sequence.
The system’s start-up code can either enable or disable the watchdog timer. When enabled,
the watchdog timer cannot be disabled until a reset occurs. If disabled, it can be enabled
later by software. The reset start-up code should check the WDTCON register to see if the
RSTFLAG bit is set. If set, then the last reset was due to a watchdog timer time-out. What
actions are taken is system dependent; however, possible actions include signaling another
device that there is a problem, performing a more extensive test of hardware systems, or
requesting reset of remote devices.
Debug monitor software (such as AMD’s E86MON™ software) can disable the watchdog
timer, allowing the user to interact with the monitor without having to refresh the watchdog
timer. The application code can then enable or disable the watchdog timer in its own start-
up routine.
In systems that program the watchdog timer to generate an NMI, the NMI service routine
should check the WDTCON register to see if the NMIFLAG bit is set. If this bit is set, it
indicates that an NMI due to a watchdog timer time-out occurred. Software should clear
this bit so that subsequent external NMIs are not confused with watchdog timer NMIs. What
actions are taken are system dependent; however, possible actions include examining the
state of the DMA controller to determine whether DMA usage is preventing instruction
execution, polling external devices for status, or re-execution of all or part of the system
start-up code.
Code that supports the watchdog timer should be divided into two parts. The main loop of
the application, or some section of code that is periodically executed but not interrupt driven,
should set a flag indicating that execution has passed through this code loop. A second
piece of code that is interrupt driven, typically a timer interrupt, should check the value of
the flag. If the flag is set, the interrupt service routine (ISR) should write the watchdog timer
clear-count key, resetting the time-out counter to zero. If the flag is not set, the ISR has
several options: wait for a watchdog timer time-out to let the reset or NMI code handle the
problem; attempt to determine what the problem is; or continue normal execution with the
expectation that the flag may be set at some later iteration. Because transfer of control to
an ISR does not require non-ISR code to be executing correctly, it is important that the ISR
code not reset the time-out counter unless the flag is set.
11.5.3 Hardware-Related Considerations
■ Pins that are latched on reset (pinstraps) are not resampled during a watchdog-timer
reset.
■ If the external reset (RES) signal is asserted while the watchdog timer is performing a
watchdog-timer reset, the external reset takes precedence over the watchdog-timer
reset. This means that the RESOUT signal asserts as with any external reset and the
WDTCON register does not have the RSTFLAG bit set. In addition, the part exits reset
based on the external reset timing (i.e., 4.5 clocks after the deassertion of RES rather
than 216 clocks after the watchdog timer time-out occurred).
12 SERIAL COMMUNICATIONS
OVERVIEW
12.1 OVERVIEW
The Am186CC/CH/CU microcontrollers support both asynchronous and synchronous
serial communications. These features are described in the chapters indicated in the bullets
below. The remainder of this chapter shows some of the trade-offs of using the various
serial communications features available on the microcontroller and provides a brief
overview of serial communications.
■ Two asynchronous serial ports, the Universal Asynchronous Receiver/Transmitter
(UART) and High-Speed UART, provide full-duplex, bidirectional data transfer in RS-232
format using several industry-standard protocols: CTS/RTR and 9-Data-Bit (multidrop).
The UART supports data transfer speeds of up to 115.2 Kbaud; the High-Speed UART
supports speeds up to 460 Kbaud. See Chapter 13, “Asynchronous Serial Ports
(UARTs).”
■ One synchronous serial port provides half-duplex, bidirectional data transfer using the
Synchronous Serial Interface (SSI). The microcontroller can operate as the master for
multiple slave peripheral devices. The SSI supports data transfer speeds of up to
25 Mbit/s with a 50-MHz CPU clock. See Chapter 14, “Synchronous Serial Port (SSI).”
CC CH ■ Four High-level Data Link Control (HDLC) channels on the Am186CC and Am186CH
microcontrollers provide 8-bit element (byte or character) or frame full-duplex
synchronous serial data transmission. The clock is provided by the Time Slot Assigner
(TSA) for that channel. For the most part, the TSA muxing logic controls the path data
takes from an HDLC to an external communication interface (or vice versa). External
interfaces supported are: raw Data Communications Equipment (DCE), Pulse Code
Modulation (PCM) Highway, and on the Am186CC microcontroller only, General Circuit
Interface (GCI). Each TSA channel can support a burst data rate to or from an HDLC
channel of up to 10 Mbit/s in both raw DCE and PCM highway modes, and up to 768
Kbit/s in GCI mode. See Chapter 15, “High-Level Data Link Control (HDLC),” Chapter 16,
“HDLC External Serial Interface Configuration (TSAs),” and Chapter 17, “General Circuit
Interface (GCI).”
CC CU ■ The Am186CC and Am186CU microcontrollers both provide a Universal Serial Bus
(USB) peripheral controller, which supports full-speed (12 Mbit/s) USB bulk,
isochronous, interrupt, and control transfers as defined in the Universal Serial Bus
Specification, Revision 1.0. The microcontroller acts as a USB peripheral device. The
USB is a half-duplex, master/slave, polled bus. In other words, the microcontroller only
transmits on the USB in response to a request from the USB host, usually a personal
computer. There can be only one transmitter on the USB at a time. See Chapter 18,
“Universal Serial Bus (USB).”
External
Interface Debug or Raw DCE Raw DCE Raw DCE Raw DCE
console External External External External
UART interface interface interface interface
D C B A
TSA Channels
External
Interface SSI to linecard External interface D is External interfaces External
voice ICs used for debug UART B and C are used as interface A for
PIOS linecard control
TSA Channels
GCI
External
Interface Optional USB SSI to Connection External interface D is External interfaces External
connection to POTS ICs to host PC used for debug UART B and C are used as interface
host PC (instead of and flow control for High- PIOS A
High-Speed UART Speed UART
connection)
TSA Channels
External Interface C
CLK
is used for converted GCI
GCI-to-PCM Highway FSC
frame sync and clock CLK FSC
12.3.3 FIFOs
Another way to reduce data overflow is to use a hardware FIFO (First In First Out data
buffer). A hardware FIFO queues up the bytes until the receiver is ready for them. A FIFO
is classified by its width and depth. The width specifies the number of bits in a word; the
depth, the number of those words that can be queued. So, a 9x16 FIFO can queue 16 9-bit
words before overflowing. FIFOs can also be useful when data arrives during an interrupt.
CC In the Am186CC microcontroller, FIFOs are available for the High-Speed UART, HDLC,
and USB ports.
CH In the Am186CH HDLC microcontroller, FIFOs are available for the High-Speed UART and
HDLC ports.
CU In the Am186CU USB microcontroller, FIFOs are available for the High-Speed UART and
USB ports.
12.3.4 Polled, Interrupt, and DMA Modes
Serial communications can occur in polled, interrupt, or DMA modes. Polled mode disables
interrupts and the DMA controller. The software loops on a status register, reading in all
wait situations. In interrupt mode, interrupts are enabled. Software does other tasks while
waiting for the interrupt. In DMA mode, hardware performs the entire transfer, with no
software intervention except for errors. For information about interrupts, see Chapter 7,
“Interrupts.” For information about DMA, see Chapter 8, “DMA Controller.”
In the Am186CC/CH/CU microcontrollers, the serial communications peripherals support
the three modes as follows:
■ The UART and High-Speed UART support polled, interrupt, and DMA modes.
■ The SSI only supports polled mode.
CC CH ■ In the Am186CC and Am186CH microcontrollers, the HDLC channels support polled,
interrupt, and DMA modes.
CC ■ In the Am186CC microcontroller, GCI supports polled and interrupt modes but not DMA
mode.
CC CU ■ In the Am186CC and Am186CU microcontrollers, USB supports polled, interrupt, and
DMA modes.
CC CH In the Am186CC and Am186CH microcontrollers, the HDLC channels support full-duplex
transfers.
13 ASYNCHRONOUS
SERIAL PORTS (UARTS)
13.1 OVERVIEW
The Am186CC/CH/CU microcontrollers each provide two independent asynchronous serial
ports: a Universal Asynchronous Receiver/Transmitter (UART) and a High-Speed UART.
The UARTs support the following features:
■ Up to 115.2 Kbaud rate (UART) or up to 460 Kbaud rate (High-Speed UART)
■ Automatic baudrate detection with enhancements to compensate for distortion of start
bit (High-Speed UART only)
■ 32-byte receive and 16-byte transmit FIFOs with threshold at half full (High-Speed UART
only)
■ Receive-character-matching for up to six characters including address-bit matching
(High-Speed UART only)
■ 7-, 8-, or 9-bit data transfers
■ Address bit generation and detection in 7- and 8-data-bit frames
■ Extended read and write modes that allow word-wide DMA transfers
■ Multidrop protocol (9-data-bit) support
■ Use of processor clock or external clock signal for generation of baud clock
■ Full-duplex operation
■ One or two stop bits
■ Even, odd, or no parity
■ Break generation and detection
■ Programmable to drive either High or Low on TXD line during break
■ Automatic hardware flow control using the clear-to-send/ready-to-receive (CTS/RTR)
protocol
■ DMA to and/or from the serial ports using the general-purpose DMA channels
■ Double-buffered transmit and receive
■ Individually maskable interrupt requests for the following conditions:
– Receive FIFO threshold reached (High-Speed UART only)
– Transmit FIFO threshold reached (High-Speed UART only)
– Receive FIFO overflow (High-Speed UART only)
– Receive data character match (High-Speed UART only)
– Transmit FIFO empty (High-Speed UART only)
– Break detected
– Received character with address bit set
– Receive data available
– Transmitter able to accept new data
– Framing error detected
The High-Speed UART interface has been designed so that code written to run on the
UART runs on the High-Speed UART with no modification other than adjusting the register
offsets. The High-Speed UART interface maintains all bits and bit positions in the UART
interface. The High-Speed Serial Port Status (HSPTAT) register contains additional status
bits, but these bits read as zeros unless the associated function is enabled. Code written
for the UART that writes zeros to reserved bits should run identically on the High-Speed
UART.
13.2 BLOCK DIAGRAM
Figure 13-1 shows the UART and High-Speed UART block diagram. Features specific to
the High-Speed UART are marked “High-Speed UART Only”. UART signal names begin
with “SP”; High-Speed UART signal names begin with “HSP”. Signals for both start with
“(H)SP.”
(H)SP_RXDRQ
Interrupt
Request
Generator
Interrupt Request
13.4 REGISTERS
The registers listed in Table 13-2 program the UARTs: 8 for the UART and 15 for the High-
Speed UART. Appendix A summarizes the bits in all the registers. For a complete description
of all the peripheral registers, see the Am186™CC/CH/CU Microcontrollers Register Set
Manual, order #21916.
CC In addition to these registers, the ITF4 bit field in the System Configuration (SYSCON)
register of the Am186CC microcontroller configures external interface 4 for the HDLC or
the UARTs.
CH CU In the Am186CH and Am186CU microcontrollers, the ITF4 bit field should be set to 10b.
13.5 OPERATION
13.5.1 Usage
Note: Before using the UARTs, ensure multiplexed pins are configured to reflect the use
of the UARTs and not other functionality (see Table 13-1 on page 13-3).
To use the UART and the High-Speed UART, software must program the bits described in
the following procedures. The procedures include transmit, receive, and autobaud mode
(High-Speed UART only). The High-Speed UART has the same basic registers as the UART
(plus some additional ones). These registers are named the same except for an H in front
of the High-Speed UART register name. Throughout this chapter, an “(H)” in front of the
register name indicates that both the UART and the High-Speed UART registers are being
described.
13.5.1.1 Transmit
This section describes the procedure for programming a transmit. To program a receive,
see page 13-6. To use autobaud mode, see page 13-7. Transfers can be done in Polled,
Interrupt, or DMA modes.
13.5.1.1.1 Initializing the Transmitter
Initialize the transmitter with the following steps:
1. Disable the UART by clearing the TMODE bit of the (H)SPCON0 register to 0.
Software can change interrupt masks without disabling the TMODE bit.
2. Set the baud rate with the (H)SPBDV register.
For information about detecting the baud rate automatically, see “Autobaud Mode (High-
Speed UART Only)” on page 13-7.
3. Set the applicable configuration options in the (H)SPCON1 register: break value,
extended write, external/internal clock, and FIFOs (High-Speed UART only). If software
enables FIFOs with the TFEN bit, it should also set the TFLUSH bit at the same time
(or before) to flush the FIFO.
4. Set the interrupts to be taken with the (H)SPIMSK register. Bits in this register are
second-level interrupt enables based on status bits in the (H)SPSTAT register. Set first-
level interrupt enables in the (H)SPCON0 register (see step 5). Note that corresponding
bits must be set in both registers for the interrupt to be taken. If software disables an
interrupt in (H)SPIMSK, it can still read the status from the (H)SPSTAT register.
5. Set the applicable configuration options in the (H)SPCON0 register—interrupts, breaks,
CTS/RTR hardware flow control, parity (odd, even, or none), address bit enable, number
of data bits in serial frame (7 or 8), and stop bit length (one or two)—and enable the
transmit by setting the TMODE bit to 1. All of these bits can be set simultaneously, but
the TMODE bit cannot be set before any of the other bits described in steps 2–5.
13.5.1.1.2 Transmitting Data
When the transmitter is initialized, to send data:
1. Verify that the THRE bit in the (H)SPSTAT register is set to 1 to ensure the transmit
register can be written without loss of data.
2. If FIFOs are being used (High-Speed UART only), instead of polling the THRE bit, verify
that the FIFO is not yet full (TTHRSH bit in the HSPSTAT register is set to 1).
3. To send an address bit with a particular frame when extended writes are disabled
(EXDWR in (H)SPCON1 is 0):
a. Verify that TEMT = 1 to ensure any other transmissions have completed (the
transmitter and the transmit shift register are both empty).
b. Set the transmit AB bit in the (H)SPCON0 register to 1 if this address bit should be
sent as the MSB of TDATA for this frame.
When extended writes are enabled, write the value of the address bit with the data. In
this situation, the value of TEMT does not matter.
4. Write data to the (H)SPTXD register (this sets the THRE bit to 0).
When extended writes and address bits are enabled, 9-bit data should be written to the
(H)SPTXD register. The first word should include the AB bit value (set the transmit AB
(AB) bit in the (H)SPTXD register to 1 followed by the address bits in the TDATA field).
Then the following words should contain AB = 0 and the data for the designated address
point.
Hardware stops writing to the (H)SPTXD register when TXDRQ goes to 0; when
TXDRQ = 1, hardware continues writing the data. In the case of DMA, the hardware
handles the data flow from the DMA unit to the SPTXD register automatically using an
internal DMA signal.
5. Wait for the TEMT bit in the (H)SPSTAT register to go to 1 to indicate the on-line transfer
has completed.
13.5.1.2 Receive
The procedure to program a receive is described below. To program a transmit, see
page 13-5. To use autobaud, see page 13-7. Transfers can be done in Polled, Interrupt, or
DMA modes.
13.5.1.2.1 Initializing the Receiver
The following procedure initializes the receiver. Before reconfiguring any options (including
the baud rate), disable any receives. To do this, check that RDR=0 and IDLED=1 in the
(H)SPSTAT register to ensure no data is in the receiver, and then clear the RMODE bit to 0.
Interrupt masks can be changed without disabling the receiver (clearing RMODE to 0).
13.5.1.2.2 Setting the Baud Rate with the (H)SPBDV Register
1. If character matching is desired (High-Speed UART only), load the High Speed Serial
Port Character Match (HSPM0, HSPM1, and HSPM2) registers with the characters to
be matched. Each match register contains two character fields. Note that 00h is a valid
value so if you do not want the 00h character to be matched, all six character fields
should be initialized, even if it is with the same value.
2. Set the applicable configuration options in the (H)SPCON1 register: break value,
extended read, external/internal clock, and, on the High-Speed UART only, FIFOs and
character matching. If FIFOs are enabled with the RFEN bit, the RFLUSH bit should
also be set at the same time (or before) to flush the FIFO. If comparing characters in
frames with address bits, the three MAB bits should be configured. Each MAB bit setting
(1 or 0) is used as the address bit for both characters in the corresponding match register.
As with the character match registers, all three bits should be set.
3. Set the interrupts to be taken with the (H)SPIMSK register. Bits in this register enable
interrupts based on interrupts set in the (H)SPCON0 register. Note that corresponding
bits must be set in both registers for the interrupt to be taken. If an interrupt is disabled
in (H)SPIMSK, the status can still be read.
4. Write all the bits in the (H)SPSTAT register to 0 to clear any status.
5. Set the applicable configuration options in the (H)SPCON0 register—interrupts, breaks,
CTS/RTR hardware flow control, parity (odd, even, or none), address bit enable, number
of data bits in serial frame (7 or 8), and stop bit length (one or two)—and enable the
receive by setting the RMODE bit in the (H)SPCON0 register to 1. All of these bits can
be set simultaneously but RMODE cannot be set before any of the other bits described
in steps 1–5.
13.5.2 Data
In asynchronous serial port communication, data is transmitted in frames. Each frame
begins with a start bit (Low) and ends with one or two stop bits (High). After the start bit is
transmitted, the data bits are transmitted serially, least significant bit first. Data can be 7 or
8 bits, plus an optional address bit. For more information, see “Address Bits” on page 13-9.
The data bits may be followed by an optional parity bit. A parity bit ensures there is an even
or odd number of bits in the transmission. The UARTs support even, odd, or no parity. Even
parity forces an even number of 1s in the data field by changing the parity bit as needed;
odd parity forces an odd number of 1s. Parity checking allows the detection of single bit
errors in each frame.
The UARTs also support transmission of either one or two stop bits. A second stop bit
increases the spacing between back-to-back serial frames and can be useful in reducing
frame errors due to clock frequency inconsistencies between devices. All these options are
configured by bits in the (H)SPCON0 register. The TXD line is always held High between
frames.
In asynchronous serial communication, an idle line can be differentiated from an active
receive line by the absence of start bits in the data stream. In other words, a transmission
of a data stream of FFh in N-8-1 mode (no parity, eight data bits, one stop bit) results in a
Low bit, the start bit, every tenth bit time. When the line is truly idle, there are no Low bits.
The UARTs set the IDLED bit in the (H)SPSTAT register when 40 bit times have elapsed
without a Low bit and there is unread data in the receiver.
Figure 13-2 shows the frame configuration and the bit stream sequence for the UARTs.
Figure 13-3 shows the timing for a transmission or a receive.
Serial Clock
TXD or RXD
idle start 0 1 0 1 1 1 0 0 parity stop idle
serial data
asynchronous serial frame
Asynchronous transmission of 03Ah as 8 bits of data (LSB first), even parity, one stop bit
The OER bit in the (H)SPSTAT status register is set to 1 when the receiver has a data
overrun error. When extended reads are enabled, the OER bit in the (H)SPRXD receive
data register is set to 1, and then a 1 is written to the OER bit in the status register.
When FIFOs are enabled, the OER bit in the receive data register is passed through the
FIFO with the last character of overrun data (i.e., the first data character after the overrun
loss). The OERIM bit was added to provide an immediate interrupt. This bit bypasses the
FIFO; OERIM is set immediately after the overflow occurs.
Both the OER and OERIM bits must be cleared by software.
13.5.2.2 Address Bits
When set, an address bit indicates that the present frame is a special frame. On the
microcontroller, address bit generation and detection are supported in 7- or 8-data-bit
frames. When the address bit is set, the other 7 or 8 bits of data in the frame are interpreted
as a code; which type of code depends on the configuration. All transmissions that follow
this address frame are directed as specified until another frame is received with the address
bit enabled and with a different code.
One possible use for the code following the address bit (resulting in its name) is for the
address of a slave peripheral device on a multidrop (also called multipoint) serial line, where
one master device is talking to multiple slave devices. Although named an address bit, this
bit actually behaves as an extended bit that may set an interrupt; the data bits that follow
the bit do not need to be used as an address. Another possible use is for encoded discrete
commands (e.g., sending a hang-up command to a modem). What the code is used for,
and how, is determined by software.
To use the address bit in the microcontroller, the ABEN and D7 bits in the (H)SPCON0
register must be configured. In addition, the transmit AB bit must be set for a transmit; the
received AB bit is set by hardware for a receive.
When the ABEN bit is set to 1, address bits are enabled. If the D7 bit is 0, serial frames
contain a low start bit, eight data bits, an optional address bit, then one or two High stop
bits (transmitted least significant bit first). If the D7 bit is set to 1, serial frames contain a
low start bit, seven data bits, an optional address bit, and one or two stop bits.
13.5.2.2.1 Transmitting with Address Bit Set
When ABEN is set in a transmit, the transmit AB field of the (H)SPCON0 register is sent
as the MSB bit after the 7 or 8 data bits in TDATA.
When extended writes are enabled (EXDWR = 1), the transmit AB bit in the (H)SPTXD
register is used instead. Because this register also contains the data to be transmitted, this
allows a single write to replace the two writes needed when extended writes are not enabled.
When extended writes are enabled, the (H)SPTXD register supports word-wide DMA
transfers.
When extended writes are not enabled, the value of the transmit AB field is sampled during
the transmission of the final data bit and is used to determine the value of the TXD signal
for one bit time following the last data bit and before the transmission of the stop bit. The
transmit AB field is cleared by the UARTs after reading its value. Because the transmit AB
bit is not double buffered, software that intends to send a frame with the address bit set
must wait until the transmitter is empty (TEMT=1) before setting the transmit AB bit and
writing the data for the next frame into the transmit data register.
frame. At the end of the receipt of a sequence of frames, software can examine the value
of the (H)SPSTAT register to determine if any significant status bits have been set. If the
accumulated status does not reflect action required by software, the status bytes can be
ignored, otherwise software can traverse the buffer searching for the status of interest and
its associated data byte.
The microcontroller’s general-purpose DMA channels support compression and
decompression of data streams in part to support the extended read and write features of
the serial ports. Status can be removed from a data stream through data compression using
the DMA. For more information, see Chapter 8, “DMA Controller.”
13.5.3 FIFOs (High-Speed UART Only)
The High-Speed UART provides a 32-byte FIFO for receive data and a 16-byte FIFO for
transmit data. The use of the FIFOs can be enabled or disabled by software. The FIFOs
can be operated in Polled or Interrupt mode, or they can be serviced using the general-
purpose DMA channels. The High-Speed UART status register provides the RTHRSH and
TTHRSH bits, which reflect the state of the receive and transmit FIFOs, respectively. When
the RTHRSH bit is set, the receive FIFO has reached its threshold value (i.e., the receive
FIFO is at least half full). When the THRSH bit is set, the transmit FIFO has reached its
threshold value (i.e., the transmit FIFO is at least half empty). The HSPIMSK register
contains bits that enable or disable interrupt generation based on the RTHRSH and
TTHRSH bits. In this case, interrupt generation on the RDR (Receive Data Ready) and
THRE (Transmit Holding Register Empty) bits should be disabled.
FIFOs are initialized to the empty condition on reset. For subsequent transfers, the transmit
FIFO and the receive FIFO should be flushed by software by setting the TFLUSH and
RFLUSH bits in the HSPCON1 register.
All transmit data is written to a single address, which is addressable as the transmit data
register (HSPTXD) in both FIFO and non-FIFO modes. When the FIFO is not full, the High-
Speed UART status register has the THRE bit set, indicating that data can be written to the
FIFO without overwriting previously written data.
Receive data is read from a single address, which is addressable as the High-Speed UART
Receive Data (HSPRXD) register in both FIFO and non-FIFO modes. When the FIFO is
not empty, valid data can be read from HSPRXD; this is indicated by the Receive Data
Ready (RDR) bit in the HSPSTAT status register. When the last bit of data has been removed
from the FIFO, the RDR bit reads 0.
The status associated with each of the FIFO entries can be determined by reading the
Serial Port Status (HSPSTAT) register before the associated data is read from the FIFO.
When a byte is read from the FIFO, the next received character and its status move to the
top of the FIFO and can be read from the receive data and status registers. The status must
be read before the data is read. Alternatively, extended reads can be enabled. Extended
reads allow status to be read with data as it moves to the top of the FIFO. Reading the
status using extended reads differs from what is shown in the serial port status register in
that it reflects the current frame only. The serial port status register functions normally during
extended reads and continues to reflect accumulated status and to generate interrupts
based on that status as configured.
13.5.3.1 Transmit FIFO
The transmit FIFO provides for up to 16 bytes of transmit data plus the value of the
associated address bit, if applicable.
When both the FIFO and a transmit have been enabled (with the TFEN and TMODE bits),
hardware immediately checks the Transmit FIFO Threshold Reached (TTHRSH) bit in the
status register. The transmit FIFO threshold value is set to half-empty (FIFO contains eight
bytes of data) and is not programmable. The High-Speed UART can be programmed to
generate a maskable interrupt when the transmit FIFO reaches the threshold value.
Software must clear the TTHRSH bit, but hardware can set it again immediately if the FIFO
contains less than eight entries.
FIFO underflow occurs when the transmit FIFO becomes completely empty. The High-
Speed UART can be programmed with the TEMT bit to generate an interrupt on FIFO
underflow.
13.5.3.2 Receive FIFO
The receive FIFO provides for up to 32 bytes of receive data along with status associated
for each byte, including special-character matching, framing and parity error flags, and the
value of the address bit, if applicable.
When both the receiver and the receive FIFO have been enabled, through the RMODE bit
for the receiver and the RFEN bit for the receive FIFO, the serial port hardware immediately
checks for a receive FIFO threshold reached condition. The receive FIFO threshold value
is not programmable and is set at half full or 16 bytes of data present in the FIFO. The High-
Speed UART can be programmed to generate a maskable interrupt when the receive FIFO
reaches the threshold value. Software must clear the RTHRSH bit, but hardware sets it
again immediately if the FIFO contains 17 or more entries.
As data moves to the top of the FIFO, the associated status is placed in the Serial Port
Status (HSPSTAT) register. Status bits are set by the hardware and must be cleared by
software. The serial port can be configured to generate an interrupt based on serial port
status. Each status bit is individually maskable. If an interrupting status condition is detected
in the serial port, DMA requests from the receiver are disabled. This allows the interrupt
service routine to read the data from the receiver (or to peek at the data through the
HSPRXDP register) and take appropriate action. Enabling extended reads allows the status
to be read in a word-wide read from the Serial Port Receive Data (HSPRXD) register. The
status data in the upper byte of an extended read reflects only the current frame. However,
the HSPSTAT register continues to be updated normally and set bits must be cleared by
software.
The IDLED bit in the HSPSTAT register indicates instances where the threshold is never
reached because less than 16 bytes of data were sent. The IDLED bit is set (and can be
used to generate an interrupt with the HSPIMSK register) when the receive data line has
been idle for 40 bit times and receive data is available. This bit must be cleared by software.
FIFO overflow occurs when the receive FIFO is completely full and another character is
received, resulting in the loss of data. In a FIFO overflow condition, the last location of the
FIFO is overwritten with the last byte received. The High-Speed UART can be programmed
to generate a maskable interrupt on FIFO overflow with the OERIM bit.
13.5.3.3 Using the FIFOs in Polled, Interrupt, or DMA Mode
The High-Speed UART FIFOs can be used in Polled, Interrupt, or DMA modes.
Interrupt and DMA modes are described in “Interrupt Sources” on page 13-19 and “Interface
to General-Purpose DMA Channels” on page 13-21. When in Polled mode, the High-Speed
UART behavior is similar to the non-FIFO mode.
In Polled mode, software reads the received data by reading the HSPRXD register. The
HSPSTAT register is updated with the status of the next frame after each read of the receive
data register. The new status is ORed with the previous status, possibly accumulating status
over multiple frames. For this reason, the status register must be read before the receive
data register to ensure that the status being read is for the current frame. Set status bits
must be cleared by software. When extended reads are enabled, the high byte of the
HSPRXD register contains the status associated with the current frame; however, status
continues to accumulate in the HSPSTAT register. The RDR bit is set when data is available
in the receive FIFO (the value of this bit can be read from the HSPSTAT register or from
the high-byte of an extended read). When the RDR bit is set, valid data is present in the FIFO.
If receive status interrupts are enabled, an interrupt can be generated at the time an error
is detected. The interrupt service routine must read data out of the FIFO until the data which
generated the interrupt reaches the top of the FIFO. At this point, the status register reports
the error condition.
Data to be transmitted is written to the Transmit Data register as in non-FIFO mode.
However, the transmit status reflects the disposition of the FIFO. When the FIFO is not full,
the Transmit Holding Register Empty (THRE) bit is set, indicating that the transmitter can
accept more data. When the FIFO is completely full, the THRE bit is 0. When the transmit
FIFO and the transmit shift register are completely empty, the Transmitter Empty (TEMT)
bit is set. At this point, the transmitter or FIFO can be disabled without loss of data.
13.5.4 CTS/RTR Hardware Flow Control
The microcontroller supports CTS/RTR hardware flow control. Each UART port is provided
with two data signals (TXD_U and RXD_U for the UART, and TXD_HU and RXD_HU for
the High-Speed UART) and two flow control signals (CTS_U and RTR_U for the UART, and
CTS_HU and RTR_HU for the High-Speed UART). Hardware flow control is enabled when
the FC bit in the (H)SPCON0 register is set to 1.
In the CTS/RTR protocol, the receiver asserts clear-to-send (CTS) whenever there is room
in the receiver for more data. The transmitting device should sample CTS before beginning
transmission of each frame. CTS is deasserted when the start bit is detected for the last
frame that can be read without data loss. When FIFOs are disabled, CTS is deasserted
after the start bit for each frame is detected and remains deasserted until the data is read
from the receive data register. When the receive FIFO is enabled, CTS is deasserted after
the start bit is received for the last frame that will fit in the FIFO.
The transmitter samples ready-to-receive (RTR) before transmitting the start bit of each
frame. The RTR signal is not sampled during frame transmission. This allows the receiving
device to deassert RTR any time before the end of the stop bit. The transmitter does not
begin transmitting the start bit for the next frame while RTR is deasserted.
The use of hardware flow control can eliminate the possibility of overrun errors—data loss
due to reception of new data before the last received data has been read. However, there
can be an adverse effect on data throughput. For example, in the case where there is no
receive FIFO, transmission of a second data frame cannot begin until the previous frame's
data has been read. Without hardware flow control, transmission of the next frame may
begin immediately, providing the receiver with one frame time to read the previous frame's
data without data loss. Use of FIFOs or DMA reduces the impact of hardware flow control
on data throughput.
In multidrop systems, typically using the address bit feature of the microcontroller's serial
ports, hardware flow control should not be enabled, or must be restricted to a single pair
of active UARTs.
Figure 13-4 illustrates the behavior of the RTR_U signal. Figure 13-5 illustrates the behavior
of the RTR_U signal with the FIFO. Note that the RTR_U signal is deasserted as soon as
the serial port begins receiving a character and is reasserted when the data is read from
the receive data register.
RXD_U
RXD_HU
RTR_HU
CC CU In the Am186CC and Am186CU microcontrollers, the USBSOF signal must not be enabled
at the same time as UCLK.
CPU Clock
Stage 1 Oversample Divide Baud clock
baud clock for
UCLK divisor oversampling
Figure 13-7 Worst Case % Error Per Bit vs. Baud Divisor Without Autobaud Enhancement
10
1 2 3 4 5 6 7 8 9 10 11 166 167
Baud Divisor
18 Questionable
Autobaud Detection
(Baud Divisors < 166)
Baud Rates (Kbaud)
16
14
12 Baud Divisor = 166
10
8
6 Guaranteed
Autobaud Detection
4 (Baud Divisors > 166)
2
20 25 30 35 40 45 50
Frequency (MHz)
The microcontroller also offers an enhancement to autobaud detection. Start bit width
distortion can result in calculation errors. In instances where there is some system
knowledge, baud divisor and threshold values can be programmed to allow for a 25–30%
distortion in the width of the start bit.This method greatly increases the probability that the
correct valid baud rate divisor is selected for higher baud rates, which are at highest risk.
The microcontroller method makes use of the fact that, in most cases, valid baud divisor
values used in a particular application are separated by several integers. Four High-Speed
Serial Port Autobaud registers are provided for this enhancement: HSPAB0, HSPAB1,
HSPAB2 and HSPAB3. Each register contains a divisor value and a threshold value. The
HSPAB3 register must contain the largest programmed divisor value and threshold value,
then HSPAB2, etc. When using fewer than four valid divisor values, software must clear the
unused HSPABx registers or leave them at their default values (00h).
When the registers have been programmed, the High-Speed UART compares the autobaud
calculated baud rate divisor to the threshold values and selects one of the programmed
valid baud rate divisors to use in subsequent data transfers. A calculated value less than
or equal to threshold 1 and greater than threshold 0 selects the divisor 1 value, and so on.
A value greater than threshold 3 uses the calculated divisor value. If the registers are not
programmed (are in reset state), the High-Speed UART uses the autobaud calculated baud
divisor value. Figure 13-9 illustrates this concept.
Table 13-4 shows two examples of using the autobaud registers to enhance autobaud
detection.
Calc. Divisor
ABTHRSH2
ABDIV2
ABTHRSH1
ABDIV1
ABTHRSH0
In autobaud mode, the receiver determines a value for the baud divisor register based on
the sampled duration of the start bit. The start bit duration in clocks is converted to a value
to be written to the baud divisor register by dividing by 16, as shown in “Programming the
Baud Rate” on page 13-15.
The configuration in example A does not support a baud rate of 57600 since this baud rate
is not represented in the table and requires a baud divisor less than that programmed in
HSPAB3. In general, any baud divisor below the maximum divisor programmed in the
HSPABx registers, which is not programmed in the ABDIV field for one of the HSPABx
registers, is unattainable for that system.
In example B, the HSPAB0 register is not being used. The value of the ABDIV field for
HSPAB3 is greater than the ABTHRSH field for that register. Although this is not the case
for most systems, it is possible for the replacement divisor to fall outside of the range of
sampled baud rates that generate that divisor.
13.5.6 Interrupt Sources
All UART and High-Speed UART interrupt sources require two interrupt enable bits to be
set before that source is enabled to generate interrupts.
The first level consists of three main interrupt enable bits in the (H)SPCON0 control register.
The Receive Interrupt Enable (RXIE) bit enables interrupts that indicate receive data is
available (the RDR bit in the status register is 1). The Receive Status Interrupt Enable
(RSIE) bit enables interrupts on the condition or status of the received data. The Transmit
Interrupt Enable (TXIE) bit enables interrupts based on the status of the transmit data
(whether the TEMT bit in the status register is 0 or 1).
The (H)SPIMSK register contains the second-level interrupt bits. Even if these bits are set
to 1, interrupts are disabled if the corresponding first-level enable bit is not also set to 1.
Table 13-5 shows the interrupt sources for the UARTs. All first-level enable bits default to
Off (0). The defaults for the second-level bits vary and are listed.
Note that when a receive status bit has generated an interrupt condition and extended reads
are disabled, receive DMA requests are inhibited.
frame 2
frame 1 frame 3
(sets break)
11111 0 0100 0000 0 0000 0000 0 001111 0 0000 0000 1 111111
line start data bits stop data bits stop line
idle bit and bit idle
start
bit sign.
In this stream, the leading 1’s are assumed to be an idle indication on the line. The first
Low bit is interpreted as the start bit of a frame, resulting in the first frame consisting of the
stream “0 0100 0000 0”, including start and stop bits. This is reported as a 02h character
with a framing error. The stop bit for the first frame also acts as the start bit for the next
frame, which is “0 0000 0000 0”. This is reported as a 00h character with a framing error
and a break character (the BRK bit is set to 1). Low bits following a break are ignored until
the line returns to the High state. Therefore, the next frame would be “0 0000 0000 1”, which
is a 00h character with no error status.
data in memory so that the association of status and data is not lost. This behavior is not
affected by enabling or disabling the receive FIFO on the High-Speed UART.
Unlike the other status interrupts that move through the receive FIFO with their associated
data, the OERIM bit provides immediate notification of an overrun error condition. Software
can determine where the overrun occurred since the OER status bit travels through the
FIFO with the associated data. The OERIM error bypasses the FIFO and does an immediate
interrupt.
When extended writes are enabled, the value of the address bit is written to the high byte
of the (H)SPTXD register. When extended writes are not enabled, the value of the address
bit is taken from the value of the transmit Address Bit (AB) field in the serial port control
register at the time that the data is written to the transmit holding register. This bit is cleared
after each transfer of the data out of the holding register into either the transmit shift register
or the High-Speed UART FIFO.
When extended reads are enabled, the value of the address bit is read from the high byte
of the (H)SPRXD register, and also sets the AB bit in the status register. When extended
reads are not enabled, the value of the received address bit is placed in the received Address
Bit (AB) field of the (H)SPSTAT status register and must be cleared by software. This means
that applications needing to send or receive a string of characters with the address bit
cleared can use DMA to transfer the data to or from the serial port. Applications that require
the address bit set, or a mixture of the bit set and cleared, may use the DMA but must take
an interrupt each time the address bit is set. This is true regardless of the use of the FIFO.
For information about the use of the CTS/RTR protocol with DMA, see “CTS/RTR Hardware
Flow Control” on page 13-13.
For more information about using the UARTs and DMA, see Chapter 8, “DMA Controller.”
13.5.10 Hardware-Related Considerations
The signals for the UART and flow-control for the High-Speed UART are multiplexed with
HDLC Channel D. For more information, see Table 13-1 on page 13-3.
13.5.11 Software-Related Considerations
■ Always program the configuration registers before setting the TMODE or RMODE bit to 1.
■ The most efficient data transfer operation (least software intervention, highest average
data transfer rate, and least opportunity for FIFO overrun) is when using FIFOs, DMA,
and CTS/RTR flow control.
■ In a multidrop system, hardware flow control must be enabled for only a single pair of
devices at any one time.
■ Always flush FIFOs before new data transfers.
■ The UARTs are multiplexed with HDLC. The Interface 4 Select (ITF4) bits in the System
Configuration (SYSCON) register must be configured for the UART interface.
14 SYNCHRONOUS
SERIAL PORT (SSI)
14.1 OVERVIEW
The Am186CC/CH/CU microcontrollers each include one synchronous serial port, which
uses the SSI to provide a half-duplex, bidirectional communications interface between the
microcontroller and other system components (i.e., integrated circuits). This interface is
typically used by the microcontroller to monitor the status of other system devices or to
configure these devices under software control. In a communications application, these
devices could be system components such as transceivers or audio coder-decoders
(codecs). The SSI supports data transfer speeds of up to 25 Mbit/s.
The SSI provides the following features:
■ Three I/O signals: SCLK, SDATA, and SDEN, multiplexed with PIOs
■ Programmable data order: Normal (least-significant bit first) or Reverse (most-
significant-bit first)
■ Programmable SSI clock divisor: Divides the CPU clock from 2 to 256 in power of 2
increments
■ Programmable polarity of the SCLK and SDEN signals
■ Bidirectional transmit/receive shift register
State SDATA
Status Control SCLK (feedback from PADS)
PADS
Internal SDEN SDEN
SDEN ENABLE
SCLK CLK
SDATA DATA
Am186CC/CH/CU
Microcontroller
PIO ENABLE
CLK
DATA_IN
DATA_OUT
14.4 REGISTERS
The registers listed in Table 14-2 program the SSI. Appendix A summarizes the bits in all
the registers. For a complete description of all the peripheral registers, see the Am186™CC/
CH/CU Microcontrollers Register Set Manual, order #21916.
14.5 OPERATION
14.5.1 Usage
Note: Before using the SSI port, ensure multiplexed pins are configured to reflect the use
of SSI and not other functionality (see Table 14-1 on page 14-2).
1. Set the ENHCTL bit in the SSSTAT register to 1 so that all bits in the SSCON register
are operational (unless Am186EM-backwards compatibility is required).
2. If using the SDEN signal, initialize the SSI port with the SSCON register: clock polarity
(CLKP bit), device polarity (DENP bit), transmit bit order—LSB or MSB first (MSBF bit),
and the CPU clock divisor (CLKEXP bit field).
If not using SDEN (but using a PIO output as an external enable), use the PIO Set and
PIO Clear registers to provide the external signal while using the DE1 bit of the SSCON
register to provide internal enable. Be sure the corresponding mask bit in the SHMASK
register is set to disable the interrupt.
3. Enable transmit or receive by setting the DE0 or DE1 bit in the SSCON register to 1.
4. Write data with the SSTXD1/SSTXD0 registers or read data with the SSRXD register
(this sets the Port Busy (PB) bit in the SSSTAT register to 1).
5. Wait for the DR/DT bit in the SSSTAT register to go to 0 to indicate the transmit or receive
has completed.
6. Disable the transmit or receive by clearing the DE0 or DE1 bit in the SSCON register to 0.
14.5.2 Master/Slave Configuration
Unlike the asynchronous serial ports described in Chapter 13, “Asynchronous Serial Ports
(UARTs),” the SSI port operates in a master/slave configuration, where the microcontroller
operates as the master port. All other devices that communicate with the microcontroller
through this interface are slave devices. The master initiates a transaction by transmitting
a single byte. This byte tells the slave device whether the transaction is a read or a write
and contains the device address. The microcontroller always drives the interface clock when
an active communication transaction is present on the interface. Slave devices cannot drive
this clock. Because PIOs can be used as external device enables, the microcontroller can
support a number of peripheral devices.
14.5.3 Signal Interface
The SSI port consists of three I/O signals: data (SDATA), clock (SCLK), and enable (SDEN).
The three SSI signals are multiplexed with three programmable I/O signals (PIO12–PIO10).
These pins are PIOs by default, and can be individually reconfigured as SSI pins with the
PIO Mode and PIO Direction registers.
14.5.3.1 SCLK
The SCLK output synchronizes transmit and receive operations between the master
(microcontroller) and slave (peripheral). Based on the selected polarity of the SCLK signal
in the SSCON register, SCLK is at a constant High (default) or Low (when inverted polarity
is selected) level when a transmit or receive operation is not active on the interface. SCLK
derives from the internal CPU clock divided by 2, 4, 8, 16, 32, 64, 128, or 256. Software
specifies the divisor with the CLKEXP bit field of the SSCON register. When a transfer is
started, the microcontroller toggles this clock for the entire transaction. Each individual
transaction transfers eight data bits.
The clock edge on which data is transmitted and received is programmable with the CLKP
bit in the SSCON register. In the default condition, data is transmitted on the SDATA pin on
the falling edge of the SCLK signal and is received (latched into the microcontroller) on the
rising edge of the SCLK signal. In the Inverted Clock mode, data is transmitted on the
SDATA pin on the rising edge of the SCLK signal and is received (latched into the
microcontroller) on the falling edge of the SCLK signal.
When no transmit or receive transaction is active on the SSI, the SDATA signal is three-
stated (although it has a weak keeper to hold the last value driven on the SDATA signal).
When data is transmitted on the SSI from the microcontroller to another device, the SDATA
signal is driven and is stable after the falling edge (rising edge if in the Inverted Clock mode)
of the SCLK signal, providing the appropriate setup and hold time for the receiving device
if that device latches this data on the rising edge (falling edge in the Inverted Clock mode)
of SCLK.
14.5.3.2 SDATA
When the microcontroller receives data from another device on the SSI, it latches the level
driven onto the SDATA signal by the transmitting device on the rising edge (falling edge if
in the inverted clock mode) of the SCLK signal. The transmitting device must meet the
required setup and hold times relative to this SCLK rising edge (falling edge if in the inverted
clock mode).
Software writes data to be transmitted on the SSI by the microcontroller to either of the two
SSI transmit registers (SSTXD0 or SSTXD1). The transmit registers are 16-bit registers
but only the lower eight bits can be written and the upper eight bits are ignored. When a
new value is written to one of the transmit registers, and software has previously enabled
SSI and the external device (see the description of the SDEN signal below), the SSI shifts
out the data written to the transmit register on SDATA.
To receive data from an external device, the microcontroller must initiate the receive
transaction by toggling the SCLK signal and sampling the SDATA input. A receive
transaction is initiated if the external device has been enabled (see the description of the
SDEN signal below) and software reads the SSI Receive Data (SSRXD) register. The
SSRXD register is a 16-bit register but only the lower eight bits contain valid data. If the
external device is enabled, reading the SSRXD register causes the SCLK signal to be
toggled, generating eight Low-to-High transitions (High-to-Low transitions if in the Inverted
Clock mode), and the level on the SDATA signal is latched eight times and stored in the
receive register bits. Note that the initial data read (activating the read cycle) should be
discarded.
The SSI data order is configurable with the MSBF bit in the SSCON register. Two modes
are available: Normal (LSB first) and Reverse (MSB first). A single configuration bit selects
the mode and the selected mode is common for transmit and receive operations.
In Normal mode, the least significant bit (LSB) of the transmit data byte is shifted out first.
For a receive operation, the SSI stores the first data bit received in the LSB of the receive
register and stores the last data bit received in the most significant bit (MSB) of the receive
register.
In Reverse mode, the most significant bit (MSB) of the transmit data byte is shifted out first.
For a receive operation, the SSI stores the first data bit received in the MSB of the receive
register and stores the last data bit received in the LSB of the receive register.
14.5.3.3 SDEN
The SDEN signal enables an external device for communication on the SSI bus. The
microcontroller asserts this signal, under software control, before it initiates the transmit or
receive operation to or from a device on the SSI. The DE0 bit controls the state of this
signal. Setting DE0 asserts the SDEN signal. Asserting SDEN enables the external device
to which this signal is connected for communication on the SSI. Writing the transmit register
or reading the receive register initiates a data transfer on the SSI.
Software can configure the SDEN signal to be active High or Low with the DENP bit in the
SSCON register.
For a receive operation, reading the SSRXD register when the synchronous serial data
enable bits DE0 and DE1 of the SSCON register are cleared returns the data in the register
to the CPU without generating a receive transaction on the SSI.
It is possible to support multiple devices connected to the SSI bus simultaneously. In one
scenario, it may be possible to connect all the devices to the SDEN signal and develop a
software protocol to manage individual device communication.
Alternatively, PIO signals can serve as external device enables in addition to the provided
SDEN signal. In this scenario, to communicate to one of the devices using a PIO as an SSI
enable signal, software must configure the pin as a PIO output, force the PIO to be asserted,
and then set the synchronous serial data enable bit (DE1) in the SSCON register. Setting
this bit and asserting the PIO enables the external device to which this PIO signal is
connected for communication on the SSI and writing the SSTXDx register or reading the
register initiates a data transfer. For a receive operation, reading the SSRXD register when
the DE1 and the DE0 bits are cleared returns the data in the receive register to the CPU
without causing a receive transaction to be generated on the SSI. Note that the DE0 and
DE1 bits can be set simultaneously to achieve proper receive/transmit operation.
14.5.3.4 SSI Transactions
In general, the SSI hardware provides software with a polled I/O mechanism to control its
operation. In addition to the transmit register, the receive register, and the control register,
one status register is provided. The SSI Mode/Status (SSSTAT) register provides software
with “busy”, “receive/transmit end”, and “error” status. These bits are called PB (busy), DR/
DT (receive/transmit end), and RE/TE (error). A write to either SSTXD1 or SSTXD0, or a
read to SSRXD while PB=1, sets the RE/TE bit and does not generate additional data
transfers.
For SSI transmit and receive transaction examples, see Figure 14-3–Figure 14-5.
Figure 14-3 SSI Multiple Transmit with SDEN as External Device Enable
SDEN
SCLK
LSB (Normal shift order) MSB
SDATA
Notes:
SDEN is configured to be active High in the scenario shown above.
Any PIOs used as SSI enables should be inactive while SDEN is active.
The SSI data order is configured to be in Normal mode (LSB first).
The SSI clock is configured to be in Normal mode.
Figure 14-4 SSI Multiple Transmit with PIO as External Device Enable
GPIO
SCLK
MSB(Reverse shift order)LSB
SDATA
Write Write
Write transmit transmit
Set transmit register register
register Clear
PIO DE1
DATA bit
bit
Set Clear
DE1 PIO
bit DATA
bit
Notes:
The SDEN signal should be inactive (DE0=0) while the PIO has enabled the receiving device.
The SSI data order is configured to be in Reverse mode (MSB first).
The SSI clock is configured to be in Inverted Clock mode.
Figure 14-5 SSI Single-Transmit, Multiple-Receive with SDEN as External Device Enable
SDEN
SCLK
■ Only one dedicated SSI enable pin is available. PIOs can be used for additional device
enables if they are required.
■ Software written for the Am186EM SSI that writes to the SSI status register does not
work on the Am186CC/CH/CU microcontrollers.
■ Only the /2 and /4 clock modes are available unless software sets the ENHCTL bit in
the SSSTAT register.
14.6 INITIALIZATION
On both external and internal reset, the following occurs:
■ SSSTAT is set to 0000h, which clears status and disables Enhanced Control mode.
■ SSCON is set to 0400h, which sets SCLK to active Low, SDEN to active High, the LSB
transmitted and received first, the clock divisor to 2, and disables SSI operation.
■ The SSTXD0, SSTDX1, and SSRXD registers are set to 0000h, which clears all data.
■ The multiplexed serial pins default to PIO functionality (see Table 14-1 on page 14-2).
15.1 OVERVIEW
In the Open Systems Interconnection (OSI) model, layer two is the data link layer. This layer
provides control between physical nodes: link initialization, flow control, and error control.
One protocol that performs this function is High-level Data Link Control (HDLC). In HDLC,
all transmissions are in frames. The ISO/IEC 3309 standard specifies this frame structure.
The Am186CC and Am186CH microcontrollers provide HDLC channels, which are used
to transmit and receive frames based on HDLC formats. As a layer 2 function, these
channels only transmit or receive the data; upper layers in the OSI model actually look at
the data.
An HDLC frame uses flags to determine the start and end of a frame.These flags provide
frame synchronization. One flag may be used as both an end flag for one frame and the
start flag for the next frame. Although the Am186CC and Am186CH microcontrollers do
not transmit such shared flags, they can receive and properly handle a shared flag.
As illustrated in Figure 15-1, an HDLC frame typically consists of a start flag, followed by
an address field, a control field, an information field, a frame checking sequencing (FCS)
field, and, finally, a closing flag. Frames maintain data transparency—a flag, mark, or abort
embedded in the data is not recognized—by bit stuffing and bit unstuffing. Bit stuffing (also
called zero-bit insertion) occurs when transmitting data; the transmitter inserts a 0 after five
consecutive 1s. Bit unstuffing (also called zero-bit deletion) occurs when receiving data;
between opening and closing flags, the receiver deletes any 0 received after five
consecutive 1s.
In the transmit direction (data is leaving the microcontroller), you can program the HDLC
controller to add the required frame checking sequencing field (CRC error detection bytes)
at the end of the frame, bit stuff the data as needed, and surround it with flags. (Cyclic
Redundancy Check (CRC) is a method for checking errors in transmitted data.)
In the receive direction (data is coming into the microcontroller), the HDLC controller
searches for flags to determine the start and stop of the frame, removes any bit stuffing,
and checks the CRC error detection bytes. The HDLC controller can also check the address
of the incoming frame and reject it if it has an incorrect address.
The microcontroller uses FIFOs in both directions (16-byte transmit and 32-byte receive)
to isolate the data requests from the system bus. The controller supports SmartDMA and
programmed I/O for filling or emptying the FIFOs.
Each HDLC channel can connect to an external serial interface directly (nonmultiplexed
mode) or can pass through a time slot assigner (multiplexed mode). An HDLC channel can
connect to a raw Data Communications Equipment (DCE) interface in nonmultiplexed mode,
to a Pulse Code Modulation (PCM) highway interface in multiplexed mode, or to a General
Circuit Interface (GCI) in multiplexed mode. Each HDLC channel has the same feature set
but separate connections to its associated time slot assigner. For more information about
how the HDLC channels can be connected externally, see Chapter 16, “HDLC External
Serial Interface Configuration (TSAs)”.
The HDLC channels support full-duplex data transfer at a rate of up to 10 Mbit/s in raw DCE
and PCM Highway modes, and up to 768 Kbit/s in GCI mode (system performance may
limit total throughput). The microcontroller contains internal PCB registers for configuring
the modes of operation, controlling the HDLC channels, monitoring and reporting status,
and moving data. Each HDLC channel consists of a transmitter, a receiver, and the interface
(programmed I/O or SmartDMA).
CC The Am186CC microcontroller provides four HDLC channels, A through D, which support
raw DCE, PCM highway, and GCI external interfaces.
CH The Am186CH HDLC microcontroller provides two HDLC channels, A and B, which support
raw DCE and PCM highway external interfaces.
15.2 BLOCK DIAGRAM
Figure 15-2 shows the block diagram for a single HDLC channel, including connections
with the TSA and GCI.
I/O
32 x 8 FIFO transmit clock Transmit CLK (A, B, C, D)
transmit data
Out Out
Control
PCB Bus Control
Registers Loopback
I/O I/O
Registers
Control
SmartDMA Bus SmartDMA PCB Bus
I/O CC
I/O Registers
txd
Monitor
Control
Channel
Monitor
data
txc
PAD Interface
IN 16 x 8 FIFO Time Slot
Transmit CLK_A
Control/
Status
Controller
I/O Receive DATA_A
Internal CTS TIC Bus Transmit DATA_A
Transmitter TIC Bus Control Controller
TIC Bus
Control
Control/Status
GCI
15-3
High-Level Data Link Control (HDLC)
15.4 REGISTERS
Table 15-2 lists the 25 unique registers that control a single HDLC channel. The x shown
in the register name can be A, B, C, or D, depending on the channel selected. The table
shows the offset for Channel A; for Channel B, add 40h to the offset shown. Both the
Am186CC and Am186CH microcontrollers support Channels A and B.
CC The Am186CC microcontroller also supports Channel C and D. Add 80h to the offset shown
for Channel C, and add C0h for Channel D.
In addition to the registers shown in Table 15-2, the System Configuration (SYSCON)
register, offset 03F0h, has two bit fields that configure HDLC: ITF4 (bits 9–8) and EXSYNC
(bit 7).
CC In the Am186CC microcontroller, the IFT4 bit field configures the interface of HDLC
Channel D. Setting the EXSYNC bit causes the clock and frame information to be driven
out of HDLC Channel C.
CH In the Am186CH HDLC microcontroller, there is no HDLC Channel D, but the ITF4 bit field
default value is 00b, specifying full HDLC with flow control. Therefore, software must change
the value of the ITF4 bit field to 10b before using the UART interface or High-Speed UART
with flow control.
Appendix A summarizes the bits in all the registers. For a complete description of all the
peripheral registers, see the Am186™CC/CH/CU Microcontrollers Register Set Manual,
order #21916.
15.5 OPERATION
15.5.1 Usage
Note: Before using the HDLC channels, configure the multiplexed pins for HDLC use (see
Table 15-1 on page 15-4). When using HDLC Channel D on the Am186CC microcontroller,
be sure to configure the ITF4 bit in the SYSCON register correctly.
The HDLC portion of the microcontroller is an extremely flexible serial communications
block that can be configured to support data movement in a variety of applications. When
initializing the HDLC channels for a particular operation, it is best to establish the Time Slot
Assigner and general HDLC functionality before beginning data reception or transmission.
Configure HDLC functionality through the HxCON, HxTCON0, HxTCON1, and HxRCON1
registers. Establish address matching through the address match registers and their
associated masks. Finally, enable the desired interrupts by setting the corresponding bits
in the appropriate mask registers.
To configure the HDLC channels, use the following procedure:
1. Configure the Time Slot Assigners (TSAs) as described in “Usage” on page 16-7.
2. Configure any required HDLC channel operating modes:
a. Configure the NRZI encoding, transparent mode, loop remote, loop local, or CRC type
by programming the HxCON register.
b. For transmissions, configure the flag idle, multidrop mode, automatic CTS, bit order,
clock invert, GCI (on the Am186CC microcontroller only), output drive, or transmit
delay by programming the HxTCON1 register.
3. Set the necessary transmit enables (HxTXON0 register) and receive enables
(HxRCON0 register) for each HDLC channel.
4. Do an HDLC reset. A reset flushes the FIFOs and clears all R/0 status bits, but does
not clear the R/W0 interrupt status registers.
5. Clear all pending interrupts by writing 0s to the INTSTS register.
15.5.2 Interface
The HDLC channels operate in one of two modes: SmartDMA data transfer or programmed
I/O. SmartDMA data transfer provides automated data movement to the transmit FIFO or
from the receive FIFO. Programmed I/O is intended for low data rates where processor
intervention is possible on a byte-by-byte basis.
15.5.2.1 SmartDMA Interface
Using the SmartDMA interface bypasses the HDLC status registers associated with data
handling (HxSTATE, HxISTAT0, HxISTAT1, HxRFS1, HxRFS2, HxRFS3, HxASBMSB,
HxASBLSB) because the SmartDMA interface automatically places all data and status to
and from the data buffers and buffer descriptors residing in memory. Some applications still
require additional status such as the link status. For more information about the SmartDMA
interface, see Chapter 8, “DMA Controller.”
15.5.2.2 Programmed I/O Interface
At the end of frame 1, software must read the status of frame 1 from the receive FIFO before
it can read any data from frame 2.
15.5.3 General HDLC Options
These options involve both the transmitter and the receiver. For transmitter-specific options,
see “HDLC Transmitter” on page 15-10; for receiver-specific options, see “HDLC Receiver”
on page 15-14.
■ Data Clocks: Each HDLC channel requires two clock sources: a transmit clock for the
transmit data, and a receive clock for the receive data.
■ HDLC Reset: To initiate HDLC reset, set the HRESET bit in the HxCON register to 1.
HDLC reset clears the HDLC channels and FIFOs and restores all status registers to
their default values. HDLC reset does not affect the user-programmed control bits.
■ NRZ/NRZI Data Encoding: The microcontroller supports both non-return to zero (NRZ)
and non-return to zero, invert on zero (NRZI) data formats. Specify the encoding format
with the NRZI bit of the HxCON register.
■ Transparent Mode: Transparent mode disables zero-bit insertion and deletion, CRC
generation and checking, abort generation, and opening/closing flag generation. The
HDLC controller transmits data exactly as it is loaded in the transmit FIFO. When the
FIFO is empty, the controller generates idles (mark or flag) and does not set the abort
bit. If CTS is deasserted in Transparent mode, the transmitter goes to the idle state.
Transparent mode also disables the receive byte counter; therefore, short frame and
long frame errors are not reported. Byte alignment is possible in all modes except raw
DCE. Additionally, alignment is not possible when the entire time-multiplexed bus is
allocated to a single TSA/HDLC channel. To enable Transparent mode, set the TRANSM
bit in the HxCON register to 1.
To use byte alignment when using Transparent mode with a time-multiplexed data format,
set, then clear, the HRESET bit in the HxCON register after configuring the TSA and
HDLC channels and establishing operation. The first byte received or transmitted may
be corrupted while the HDLC channel is performing the alignment. To mask this effect
on the transmit side, configure the transmitter to use mark idles and make the first
transmitted byte all 1s (FFh).
To maintain byte alignment, all time slot widths used must be a multiple of eight bits and
there must be at least one empty time slot. HDLC requires the unused time slot to properly
locate the byte boundary. If the transmit FIFO underflows, the transmitter loses byte
alignment.
■ Remote Loopback Mode: To enable Remote Loopback mode, set the LOOPR bit in
the HxCON register to 1. Remote Loopback disables the transmitter and echoes the
data received at the serial input out to the serial output. The receiver operates normally
in this mode.
■ Local Loopback Mode: To enable Local Loopback mode, set the LOOPL bit in the
HxCON register to 1. Local Loopback mode disconnects the serial input and connects
the serial output to the receiver input. The serial output can operate in three-state, open
drain, or totem pole mode.
■ CRC Type: The algorithm for CRC generation and checking can be CRC-CCIT, CRC-16,
or CRC-32. Specify the CRC type in the CRCTYPE field of the HxCON register.
■ Time Slot Assigner (TSA): Each HDLC channel is tightly coupled with a TSA, which
can operate in either multiplexed or nonmultiplexed (pass-through) mode. In multiplexed
mode, the TXCLK input becomes the synchronization input and the TSA connects the
receive clock to the transmit clock. In multiplexed mode, the TSA controller determines
when to enable and disable the HDLC clock. It also allows the user to reduce the number
of bits transmitted in a single 8-bit time slot. This reduction allows the transmission of
data from 64 Kbit/s down to 8 Kbit/s in 8 Kbit/s decrements. This feature allows the HDLC
channel to be used for LAP-D and reduced data mode LAP-B transmissions such as
56 Kbit/s.
15.5.4 HDLC Transmitter
The transmitter functions include:
■ Opening flag transmission
■ Data transparency (via zero insertion)
■ Generation and transmission of the CRC frame-check-sequence characters (if enabled)
■ Transmission of the closing flag.
Flag/Abort
Generator Parallel-to-Serial
Zero
Shift Register Insert Serial
From output
CPU NRZ/NRZI
Transmit
Encoder
FIFO Transparent Mode Path
End-of-Frame
Tag
■ Abort Generation: The HDLC transmitter sends an abort sequence (one 0 followed by
seven to 14 1s) whenever the FORABR bit of the HxTCON0 register is set to 1. The
transmitter continues sending an abort sequence as long as this bit is set; however, if
the send abort bit is set and cleared on two successive writes to the HDLC Command/
Control register, at least one abort character is sent. An abort is also sent if CTS is lost
while the transmitter is in-frame (and CTS is enabled) or if a transmit FIFO underflow
occurs (unless in Transparent mode). When in GCI (Am186CC microcontroller only) or
multidrop mode, only one abort is sent and then the transmitter is turned off.
■ Parallel-to-Serial Shift Register: The HDLC transmitter loads the output of the transmit
FIFO or the flag/abort generator one byte at a time into the parallel-to-serial shift register
and then shifts it out. Transmission of a flag or abort sequence bypasses the zero-bit-
insertion logic.
■ CRC Generator: The CRC or Frame Check Sequence (FCS) contains the generated
CRC code for the frame being transmitted. All data transmitted between the opening
and closing flags (excluding inserted 0s) is included in the CRC calculation. The
transmitter appends the calculated CRC to the end of the frame just before the closing
flag. The transmitter supports the CRC-CCITT, CRC-16, and CRC-32 algorithms,
selected in the CRCTYPE field of the HxCON register. You can disable CRC generation
by setting the CRCDIS bit of the HxTCON0 register to 1. When CRC is disabled, the
transmitter does not append the CRC bytes to the end of the frame. The disable option
may be changed at any time before the last byte is to be transmitted. This ability allows
programmed I/O to generate some frames with CRC and some without CRC.
■ Zero-Bit lnsertion: The zero-bit-insertion logic, also referred to as data transparency,
ensures that the remote receiver does not recognize a flag, mark-idle, or abort embedded
in the data. The zero-bit-insertion logic monitors the data stream between the opening
and closing flags of a frame and inserts a 0 after detecting five contiguous 1s. Zero-bit
insertion does not operate in Transparent mode or when generating flags, mark-idles,
or aborts.
■ Transmit Enable: When transmit is disabled, the transmitter waits for the current frame
to complete transmission (if there is one) and for status on that frame to be reported,
then sets the transmitter stopped bit and begins transmitting either flags or marks
depending on the selected idle condition. While transmit is disabled, the transmitter
continues to fill up its internal pipe and FIFO. If the transmit FIFO contains data when
transmit is enabled, the transmitter begins transmission within one bit time of when
external CTS is asserted. If the idle condition is flag-idle, the transmitter finishes the
current flag before starting transmission of data. If the idle condition is mark-idle and at
least 16 1s have been transmitted, the transmitter may not finish the current mark idle
sequence before starting data transmission. To disable transmit, clear the HTEN bit of
the HxTCON0 register.
■ Transmit-FIFO Enable: Normal operation requires both the Transmit Enable (HTEN)
and the Transmit FIFO Enable (TFIFOEN) bits of the HxTCON0 register to be set.
Clearing the TFIFOEN bit causes the transmit FIFO data to be flushed. To avoid possible
data loss, disable SmartDMA control before flushing the FIFO.
■ Output States: The serial data output pin on the DCE interface (DCE_TXD_x) supports
three-state (reset default), open drain, or totem pole operation under program control.
The output must be set to open drain for proper operation in multidrop mode. Specify
the output state in the ODRV field of the HxTCON1 register.
■ Transmitter Status: After transmitting a frame, the transmitter generates a maskable
interrupt. If an error occurs during transmission, the transmitter stops. Read the
transmitter status in the FABRST, CTSLST, TUFLO, TGOODF, and TSTOP bits of the
HxISTAT0 register.
■ Automatic CTS: When automatic CTS is enabled, the transmitter does not start
transmission until CTS is asserted. If the transmitter is transmitting (in-frame) and CTS
is deasserted, a lost CTS has occurred. A lost CTS halts transmission and generates
an abort and a maskable interrupt. If CTS is deasserted while the transmitter is in idle,
the transmitter does not respond. In multiplexed mode, the transmitter ignores CTS. If
CTS is deasserted in Transparent mode while transmitting, the transmitter begins
transmitting idles. When auto-enable CTS is disabled, the transmitter ignores the CTS
input. Auto-enable CTS must be disabled for Multidrop mode. To enable automatic CTS,
set the AUTOCTS bit of the HxTCON1 register to 1.
■ Multidrop Mode with Collision Detection: This mode requires the transmit data pin
to be physically tied, externally, to the CTS input pin. In addition, it requires the mark-
idle flag, disabled auto-enable CTS, and an open drain output. The HDLC channel delays
transmission until it sees a programmable number of consecutive 1s on the CTS input
pin. Specify the number of 1s to delay in the TDELAY field of the HxTCON1 register.
This feature provides some collision avoidance and a transmit priority based on the
number of 1s waited for before transmission. When transmission begins, the transmitter
samples the transmit data stream on the CTS input and internally compares it to what
is transmitted by the HDLC. Upon detecting a difference, the transmitter generates a
maskable interrupt (lost CTS), stops the data transmission, starts transmitting idle flags,
disables transmit, and flushes the transmit FIFO. To enable multidrop mode with collision
detection, set the MLTDRP bit of the HxTCON1 register to 1.
Figure 15-6 shows another typical transmit with auto-enable CTS enabled. At the end of
the closing flag, CTS is driven inactive. CTS is actually driven inactive at the same time as
the last bit of the byte before the flag, but it is not recognized until the next bit; therefore, a
lost CTS does not occur.
TCLK
TXD
CTS
TCLK
TXD
CTS
TCLK
TXD
CTS
Note: The HDLC receiver requires frames two bytes or longer. The HDLC transmitter
requires at least one byte of data surrounded by flags: the start flag, one byte of data, and
the end flag. A 2-byte CRC with no data also constitutes a valid transmission.
Byte Counter
FIFO
End-of-Frame
Detector Short Frame Det.
Address
Tag
Long Frame Det.
Flag/Abort Byte Clock
Detection
■ Short-Frame Counter: The HxSFCNT and HxSFCNTP registers indicate the total
number of short frames received. The HxSFCNT register clears when read; HxSFCNTP
does not. This count also includes all very short frames. If the counter rolls over, it
generates a maskable interrupt. This count does not include frames with mismatched
addresses.
■ CRC Checker: When the receiver detects the closing flag, it examines the 16-bit (or 32-
bit) CRC. If it detects an error, it reports a status bit to that effect. The receiver supports
the CRC-CCITT, CRC-16, and CRC-32 algorithms. The receiver always places the CRC
in the FIFO along with the rest of the frame data (that is, all data between flags is placed
in the FIFO). The CRC checker is always enabled, but software can ignore the CRC
error status (byte 3 of the status read from the HxRD register). Specify the CRC type in
the CRCTYPE field of the HxCON register.
■ Serial-to-Parallel Shift Register: Output from the zero-bit-deletion unit feeds into a 16-
bit shift register, which converts the serial stream into bytes. The receiver then feeds the
parallel output of the shift register to the receive FIFO one byte at a time.
■ Address Detection: The receiver uses address detection to determine whether to
receive the current frame. Each HDLC channel has four 16-bit matching address
registers (the HxA0–HxA3 registers) and four corresponding 16-bit matching address
mask registers (the HxA0MSK–HxA3MSK registers). The mask register determines
which of the first 16 data bits in the frame the receiver should compare to the
corresponding address register and which to ignore. If all unmasked bits of at least one
address match, the receiver accepts the frame; otherwise, it discards the frame and
starts looking for the next flag. The frame status byte contains information about which
address matched.
■ Mismatch-Address Counter: The HxMACNT and HxMACNTP registers keep count of
the number of frames that did not have an address match. The HxMACNT register clears
when read; HxMACNTP does not. Count rollover generates a maskable interrupt. The
receiver checks all frames two bytes or larger for an address match. The receiver does
not check the discarded very short frames.
■ Receive FIFO: The receive FIFO consists of a 32-byte FIFO buffer, end-of-frame logic,
and DMA-request logic. Read the receive FIFO at the HxRD register.
■ Receive-FIFO Interface: The receiver uses either programmed I/O or the DMA
controller to unload the receive FIFO. In programmed I/O mode, the RDATA1 bit of the
HxISTAT0 register indicates when data is ready to be read from the receive FIFO. Data
ready also generates a maskable interrupt. The REOF bit of the HxISTAT0 register (and
a maskable interrupt) indicate when the frame status from the last frame received is
available to be read from the receive FIFO and data is no longer ready to be read. The
next frame data is not available until that status bit is cleared. The SmartDMA interface
automatically moves the frame status to the buffer descriptors at the end of the frame.
■ Receive-FIFO Threshold: The receive FIFO supports thresholds of 1, 8, 16, or 32 bytes
under program control. Specify the receive FIFO threshold in the RTHRSH field of the
HxRCON0 register. The SmartDMA interface does not move data to memory until the
receive FIFO threshold is reached, indicated by the RTHRES bit of the HxISTAT0 register.
When the receive FIFO reaches the programmed threshold level, the data ready status
stays set until the receive FIFO is empty. At the end of a frame, the receive FIFO outputs
the remainder of the frame even if the receive FIFO threshold is not met.
■ Receive-Data Available: For programmed I/O, the RDATA1 bit of the HxISTAT0 register
indicates when there is a data byte presently available in the receive FIFO. This indication
is independent of the threshold selected. The receiver can optionally generate a data-
ready interrupt as well.
■ Receive End-of-Frame: For programmed I/O, the REOF bit of the HxISTAT0 register
indicates when any status bytes (that is, an end-of-frame) are present in the FIFO. This
indication is independent of the threshold selected. The receiver can optionally generate
a status ready interrupt as well.
■ Receive-FIFO Overflow: If the receive FIFO overflows, it halts reception of the current
frame, disables the receiver, deasserts RTR, and generates a maskable interrupt. The
controller puts the overflow status into the receive FIFO when space is available. The
ROFLO bit of the HxISTAT1 register indicates when a receive-FIFO overflow occurs.
■ Bit Residue: If the number of bits in a frame is not an integer multiple of eight, the
receiver rejects the frame and reports the error status in the third status byte read from
the HxRD register. The last byte reported of the frame may or may not contain the
incomplete last byte of the frame.
■ Receiver Enable: When the receiver is disabled, the receiver continues to receive the
current frame. When the current frame ends (including the closing flag), or immediately
if not in-frame, the receiver deasserts the Ready-to-Receive (RTR) signal, and generates
a maskable interrupt. After the RTR signal is deasserted, the receiver does not receive
any data. When the receiver is re-enabled, it asserts the RTR signal. After reasserting
the RTR signal, it does not receive any data until it detects a flag and goes to the in-
frame state. When the receiver is disabled in Transparent mode, it immediately deasserts
the RTR signal and stops reception. When the receiver is enabled in Transparent mode,
it immediately asserts the RTR signal and starts reception. Disable the receiver by
clearing the HREN bit of the HxRCON0 register to 0.
■ Receive Reject: When receive reject is enabled, the receiver immediately stops
reception of data and reports an error status if the event occurred while in-frame. The
RTR signal is not affected. When receive reject is disabled, the receiver starts looking
for a flag. To enable receive reject, set the RREJECT bit of the HxRCON0 register to 1.
■ Receiver Stop: When the receiver is stopped, the receiver immediately stops reception
of data and deasserts RTR. The receiver also generates an error status if the event
occurred while in-frame. To stop the receiver, set the RSTOP bit of the HxRCON0 register
to 1.
■ Link Status: The status of the receiver is reported through the link status. The possible
states are: flag idle, mark idle, abort, and in-frame. For each state, the receiver can
generate a maskable interrupt when it enters the state. After receiving a flag, a
continuous input of 1s goes directly to the mark-idle state without transitioning to the
abort state. After exiting reset and a valid state is identified, the receiver always reports
the last valid state detected. Read the link status in the RTRS, ABORTS MARKIS,
FLAGS, and FRAMES bits of the HxSTATE register. Read the interrupts for these states
in the HxISTAT1 register.
■ Receive Bit Order: The receiver supports the option of receiving data MSB first instead
of LSB first. To specify MSB first reception, set the RMSBF bit of the HxRCON0 register
to 1. This ability is typically used only in Transparent mode.
■ Transparent Mode: The receiver supports a Transparent mode that moves the data into
the FIFO exactly as it is received with no bit stuffing, flag/abort detection, or CRC support.
To achieve byte alignment, synchronize the receiver through an HDLC reset after
configuring the Time Slot Assigner (TSA) and the HDLC. Raw DCE mode does not
support byte alignment. Additionally, alignment is not possible when the entire time-
RCLK
RXD
RTR
4. Finally, set the SmartDMA TXST and POLL bits to restart the DMA and poll the current
descriptor. If step 3 was executed to back the DMA to the start of the packet, or if the
DMA was already at the start of the packet (e.g., if CTS was lost during transmission of
the first buffer in the packet), then the packet is resent. If step 3 was not executed, and
the current DMA descriptor does not have STP set, then the DMA controller clears the
OWN bit on the descriptor and reads in the next descriptor. The DMA controller repeats
this clearing of the OWN bit and stepping to the next descriptor until it encounters a
descriptor with the OWN bit clear, or a descriptor with the STP bit set.
In other words, if the current descriptor is not the first descriptor of a packet (STP bit
is 0) and step 3 is not executed, the DMA controller automatically starts up again at the
next packet boundary (next buffer with STP set), and it is up to higher-level end-to-end
protocols to notice that the current packet was not transmitted successfully and to
resend it.
15.5.6.2 HDLC Receiver
Under normal operation, when an HDLC packet is received, the SmartDMA interface stores
it in one or more buffers, setting the STP bit in the first buffer descriptor, clearing the status
bits in any middle buffer descriptors, setting the EOP (end-of-packet) and error bits, and
storing the total length in the last (or only) buffer descriptor.
Software must perform two tasks, which in some systems can be performed at the same
time:
■ Software must fill the buffer descriptors with pointers to available buffers and information
about their size, and set the OWN bits to make them available to the SmartDMA interface.
If software is late in performing this task, an RBU interrupt is generated. If software is
so late that data is lost, an HDLC ROFLO interrupt is generated. Software does not need
to enable these interrupts or poll for this status. If software enables these interrupts, it
does not need to take any action in response to the interrupts except to provide buffers
to the descriptor ring (and reset the interrupt status bit in order to enable subsequent
interrupts of the same kind) because the overflow status is reflected in the next packet
stored to the ring.
If software provides buffers in response to an RBU or HDLC ROFLO interrupt, the
software can also set the DMA POLL bit. Setting this bit causes the DMA controller to
notice that the OWN bit of the next buffer is set, sooner than the DMA controller may
have noticed it on its own. There is never any reason to set the POLL bit for the receive
buffer unless the DMA controller run out of empty buffers.
■ Software must examine the descriptors of buffers that have been received. Software
searches through the descriptor ring until it finds the first descriptor that either has the
OWN bit set, or has the EOP bit set, or until it gets to the last descriptor that it has made
available to the hardware. When software finds a descriptor with the OWN bit reset and
the EOP bit set, it knows it has found the end of a packet. Software then moves the
descriptors off the ring, and sends the buffers to a higher-level task. If the error bits are
set in the descriptor with the EOP, software could simply recycle the buffers to the next
free position in the ring, without sending them to the next layer.
15.5.7 Interrupts
All interrupts are individually maskable. Set the status bits in the HxISTAT0 and HxISTAT1
registers. Mask interrupts in the HxIMSK0 and HxIMSK1 registers.
15.5.7.1 Transmit Interrupts
The microcontroller provides the following transmit interrupts:
■ Transmit threshold reached
■ Data byte available
■ Abort sent
■ Lost CTS
■ Transmit FIFO underflow
■ Good frame transmitted
■ Transmitter stopped
15.5.7.2 Receive Interrupts
The microcontroller provides the following receive interrupts:
■ Receive threshold reached
■ Receive status available
■ Data byte available
■ Short frame counter rollover
■ Mismatch address counter rollover
■ Receive FIFO overflow
■ Flag idle state entered
■ Mark idle state entered
■ Abort state entered
■ In-frame state entered
■ RTR deasserted
■ Short frame detected
■ Very short frame detected
■ The receiver sets the One Receive Data Byte Available (RDATA1) bit in the HDLC
Channel Interrupt Status 0 (HxISTAT) register when the current byte available is data;
the RDATA1 bit does not reflect the entire FIFO contents. If the next byte is status and
the following byte is data, the receiver does not set RDATA1.
15.5.9 Software-Related Considerations
■ After setting the HREN bit to enable the receiver, the device software must reset the
HDLC FIFOs by setting the HRESET bit in the HxCON register. This clears any invalid
data in the receive FIFO that might be mistaken as the start of the data stream. Invalid
data is a concern when using Transparent mode (TRANSM = 1 in the HxCON register),
because in Transparent mode the receiver cannot rely on flag sequences to indicate the
start of valid data.
■ When the HDLC channel is disabled, the FIFO status reads as full.
CC ■ In the Am186CC microcontroller, HDLC Channel D is multiplexed with the UART and
with flow control on the High-Speed UART. The Interface 4 Select (ITF4) bits in the
System Configuration (SYSCON) register must be configured for the HDLC interface.
15.5.10 Comparison to Other Devices
In addition to HDLC, the HDLC channels support the SDLC, LAP-B, LAP-D, PPP, and v.120
communications protocols. The HDLC channels can also be used in transparent mode to
support the v.110 protocol.
The HDLC protocol is similar to these other bit-oriented protocols:
■ The Advanced Data Communication Control Procedures (ADCCP) developed by the
American National Standards Institute (ANSI X3.66) is virtually identical to the HDLC
protocol.
■ The Link Access Procedure Balanced (LAP-B), adopted by the International Telegraph
and Telephone Consultative Committee (CCITT) as part of its X.25 packet-switched
network standard, is a subset of HDLC.
■ Although not a standard, IBM’s Synchronous Data Link Control (SDLC) is in widespread
use. SDLC is a subset of HDLC, with some differences.
15.6 INITIALIZATION
On both external and internal reset, the following occurs:
■ The multiplexed HDLC signals default to the signals shown in Table 15-1 on page 15-4.
■ All HDLC registers default to 00h except the HxSTATE, HxTD, HxRD/HxRDP, and
HxRFSx registers.
CC ■ The ITF4 bit in the SYSCON register is cleared, which defaults external interface D to
HDLC with flow control.
CC ■ The EXSYNC bit in the SYSCON register is cleared, which configures HDLC Channel C
for raw DCE or PCM highway modes.
CC CH Note: Only the Am186CC and Am186CH microcontrollers support the TSAs.
16.1 OVERVIEW
Time Slot Assigners (TSAs) and muxing logic between the HDLC channels and the external
communications interfaces of the chip provide flexible data path control on the Am186CC
and Am186CH microcontrollers. This data path control, combined with flexible time slot
allocation, allows the microcontroller’s external data streams to take on a wide variety of
forms.
CC The Am186CC microcontroller supports raw DCE, PCM Highway, and General Circuit
Interface (GCI) external data streams.
CH The Am186CH HDLC microcontroller supports raw DCE and PCM Highway external data
streams.
CC In the Am186CC microcontroller, interface A not only allows for a dedicated DCE/PCM
HDLC path, but has the capability to multiplex GCI/PCM data from each of the remaining
nondedicated HDLC channels.
Depending on the application, each HDLC can communicate to the external world with or
without a TSA. Each TSA resides between a PCM Highway internal bus and an individual
HDLC channel. A TSA’s main function is to allow the transmission and reception of data to
and from an individual HDLC by providing the appropriate HDLC clock and clock enable
signals during its programmed time slot within an 8-KHz frame.
In nonmultiplexed mode (there is no time-division multiplexing), an individual external serial
bus interface connects directly to an individual HDLC for both transmission and reception.
Configuring the microcontroller’s muxing logic for a specific raw DCE data path uses
nonmultiplexed mode.
In multiplexed mode (there is time-division multiplexing), all HDLC data that enters or leaves
the microcontroller passes through a TSA. Configuring the microcontroller’s muxing logic
and TSAs for the multiplexed PCM Highway uses multiplexed mode. External interface A
is unique in that it allows multiple time slots, to and from each HDLC, to multiplex on and
off this single interface.
CC Configuring the Am186CC microcontroller’s muxing logic and TSAs for the GCI data path
also uses multiplexed mode.
Time Slot selection allows up to 156 8-bit time slots within a time-division multiplexed (TDM)
frame. Each TSA channel can support a burst data rate to or from the HDLC of up to 10
Mbit/s in DCE and PCM highway modes. In all modes of operation, each channel is capable
of supporting full-duplex communications. With a maximum data rate of 10 Mbit/s and an
8-KHz frame, each channel provides programmability to support a maximum of 156 time
slots per TDM frame. (Although the microcontroller supports up to 4096 bit positions, this
requires a lower frame synchronization (frame sync) or a higher, unguaranteed clock rate.)
CC In the Am186CC microcontroller, Time Slot selection also supports isolation of GCI B and
D channels on separate HDLC channels. Each TSA channel can support a burst data rate
to or from the HDLC of up to 768 Kbit/s in GCI mode.
The TSA controllers also generate control signals for programmable frame sync pulse
polarity and individual channel time slot control output, which is asserted for the duration
of the programmed time slot(s). The latter is routed externally for PCM Highway applications
and can be used in subscriber linecard applications where it is used as an enable for three-
state data buffering on the PCM Highway.
The TSA controllers support adjustable channel sizing with the ability to define time slot
start and stop points. This channel adjustment and placement feature is an essential factor
for the creation of a GCI frame. The adjustable sizing feature also allows the associated
HDLC channel to be used for ISDN LAP-D and reduced data mode X.25 LAP-B
transmissions.
For applications that do not use the entire allocated time slot but do require a defined polarity
for the remaining unused bit positions, the TSA controllers provide the option of adding
additional polarity bits (up to seven) to fill out the remaining bit positions.
Figure 16-1 Block Diagram For TSA Multiplexing (Am186CC Communications Controller)
CC RTR, CTS
Mux
DCE1 DCE1
HDLC TDM1 TDM1 External
A TSA Interface A
GCI
RTR, CTS
Mux
DCE2 DCE2
HDLC TDM2 TDM2 External
B TSA Interface B
RTR, CTS
Mux
DCE3 DCE3
GCI/PCM Hwy. Conversion External
HDLC
C TDM3 TDM3 Interface C
TSA
RTR, CTS
Mux
DCE4 DCE4
HDLC TDM4 TDM4 External
D TSA Interface D
Muxing Logic
Figure 16-2 Block Diagram For TSA Multiplexing (Am186CH HDLC Microcontroller)
CH RTR, CTS
Mux
DCE1 DCE1
HDLC TDM1 TDM1 External
A TSA Interface A
RTR, CTS
Mux
DCE2 DCE2
HDLC TDM2 TDM2 External
B TSA Interface B
Muxing Logic
Figure 16-3
HDLC
I/O
32 x 8 FIFO transmit clock Transmit CLK (A, B, C, D)
transmit data
Out Out
rxd Receive DATA (A, B, C, D)
PCB
Interface rxc Data Mux Transmit DATA (A, B, C, D)
Control
PCB Bus Control
Registers Loopback
I/O I/O
Registers
Control
SmartDMA Bus SmartDMA PCB Bus
I/O CC
I/O Registers
txd
Monitor
Control
Channel
Monitor
data
txc
PAD Interface
IN 16 x 8 FIFO Time Slot
Transmit CLK_A
Control/
Status
Controller
I/O Receive DATA_A
Internal CTS TIC Bus Transmit DATA_A
Transmitter TIC Bus Control Controller
TIC Bus
Control
Control/Status
GCI
HDLC External Serial Interface Configuration (TSAs)
PCM_TXD_A TDMDI
PCM_RXD_A TDMD0
PCM_FSC_A FS
PCM_CLK_A TDMCLK
Am186CC/CH
Microcontroller
PCM Codec
DXA
DRA
FS
PCLK
16.4 REGISTERS
Table 16-2 lists the three unique registers that program each individual TSA. The x shown
in the register name is A, B, C, or D, depending on the channel selected. The offset shown
is for Channel A; for Channel B, add 08h to the offset. Both the Am186CC and Am186CH
microcontrollers support Channels A and B.
CC The Am186CC microcontroller also supports Channels C and D. Add 10h to the offset for
Channel C and add 18h for Channel D.
Appendix A summarizes the bits in all the registers. For a complete description of all the
peripheral registers, see the Am186™CC/CH/CU Microcontrollers Register Set Manual,
order #21916.
2C0h TSxCON TSA Channel Configuration Configures and enables the TSA channel.
Defines the time slot start position for transmit
2C2h TSxSTART TSA Channel Bit Start Position
and receive data frames.
Defines the bit stop position for transmit and
2C4h TSxSTOP TSA Channel Bit Stop Position
receive data frames.
Notes:
1. The x shown in the register name can be A, B, C, or D, depending on the channel selected. The offset shown is
for Channel A; for Channel B, add 08h to the offset; Channel C, add 10h; Channel D, add 18h. Both the Am186CC
and Am186CH microcontrollers support Channels A and B. The Am186CC microcontroller also supports Channels
C and D.
16.5 OPERATION
16.5.1 Usage
Note: Before using the TSA channels, ensure multiplexed pins are configured to reflect the
use of the external interface desired and not other functionality (see Table 16-1 on
page 16-5).
Configure the Time Slot Assigner (TSA) controllers using the following process:
1. Define the bit start position for the transmitted or received data frame for each specific
TSA channel in the TSA Channel Bit Start Position (TSxSTART) register.
2. Define the bit stop position for the transmitted or received data frame for each specific
TSA channel in the TSA Channel Bit Stop Position (TSxSTOP) register.
3. Configure the operating modes for each specific TSA channel in the TSA Channel
Configuration (TSxCON) register—channel mode, channel frame sync pulse polarity,
and channel adjust bit drive level—and enable each TSA channel by setting the EN bit
to 1. These bits may be set simultaneously but EN cannot be set before steps 1–2.
The TSAs are now enabled for data transfers. For information about configuring HDLC
channels to begin transferring the data, see “Usage” on page 15-7.
Figure 16-5 on page 16-10 demonstrates the muxing logic for an ISDN basic-rate GCI
interface. The muxes at each stage level have been removed for clarity. In their place is the
end data path established after proper mux initialization. This figure illustrates the following:
1. Adjustable time slot size: eight bits for each GCI B channel and two bits for the GCI D
channel
2. Isolation of single time slots 0, 1, and 3
3. GCI B and D channel isolation
4. GCI support
5. Multiplexed mode for interface A (where multiple HDLC channels are multiplexed onto
one line)
Depending on whether you are transmitting or receiving, Figure 16-5 on page 16-10 can
be read: Stage 1, Stage 2, Stage 3; or Stage 3, Stage 2, Stage 1.
In Stage 1, the GCI controller extracts the GCI Monitor (Mon), Command/Indicate (C/I),
Intercommunication (IC), and Terminal Interchip Communication (TIC) channels. At the end
of stage 1, the HDLC data is multiplexed with the GCI channel data (the B1-, B2- and D-
channel ISDN data is present as well as the GCI Mon, C/I, IC, and TIC data).
In Stage 2, all channels are logically muxed onto one internal bus heading to and from
interface A. The GCI B and D channels are isolated.
In Stage 3, each HDLC clock is only active during the time slot for the channel it is to transmit
or receive. TSA A is configured to enable HDLC clocks for GCI channel D data. TSA B is
configured to enable clocks for GCI B2 channel data. TSA C is configured to enable clocks
for GCI B1 channel data.
B1 B2 D (2 bits: 10)
Stage 3 3a 4b 10
B2-channel sync
traffic T Frame Sync.
S Adjuster External Interface C
GCI Conv. to
HDLC
A PCM CLK and Sync
CLK
Channel B
HDLC_CLK B
B1-channel
traffic T
S
HDLC
A
Channel C
HDLC_CLK C
T
S External Interface D
PCM Highway
A
HDLC D
Controller D HDLC_CLK
CC In addition, the Am186CC microcontroller supports the GCI external data stream when
HDLC data passes through a TSA.
16.5.4.1 Raw DCE
Raw DCE is a synchronous serial bus generally used in modem and other high-speed serial
applications, and runs at up to 10 Mbit/s. The Am186CC and Am186CH microcontroller
implementation requires transmit (TCLK) and receive (RCLK) clock inputs, has receive
(RXD) and transmit data (TXD), and the Clear-To-Send (CTS) and Ready-To-Receive (RTR)
flow control signals.
16.5.4.2 PCM Highway
PCM Highway is a generic serial bus used to support a wide range of data rates (including
E1/T1) and runs at up to 10 Mbit/s. The Am186CC and Am186CH microcontroller
implementation is composed of data transmit (TXD), data receive (RXD), data clock (CLK),
frame sync clock (FSC), and time slot control (TSC) signals.
Each of the individual PCM Highway interfaces are pin-multiplexed with one or more of the
following serial bus interfaces: raw DCE and High-Speed UART.
CC In the Am186CC microcontroller, the individual PCM Highway interfaces are also pin-
multiplexed with GCI. A converted GCI frame sync and clock interface for the PCM codecs
is also multiplexed with one of the four PCM Highway interfaces. For a listing of all the pin
multiplexing, see Table 16-1 on page 16-5.
PCM channel configuration (e.g., channel size, channel length, channel placement, etc.)
is provided through proper TSA initialization.
16.5.4.2.1 PCM Highway Applications
The PCM Highway implementation features the following:
■ Every TSA can support a separate PCM physical interface simultaneously.
■ Each PCM interface is pin-multiplexed with other serial bus interfaces.
■ All of the HDLC channels can be routed to PCM Highway interface A.
■ Each HDLC channel supports PCM channel time slot selection, fully configurable
through the integrated TSAs.
CC ■ GCI clock and frame synchronization conversion and routing directly from the GCI to
the PCM Highway interface are supported for external codec applications. Data is routed
externally (with respect to the Am186CC microcontroller) directly from the codec to the
GCI transceiver device for this type of application.
■ Support for a time slot control signal that asserts for the duration of the programmed
time slots.
CC ■ Targets the following external codecs (see Table 16-3 on page 16-14):
– AMD Am79C02/03
– AMD Am79C031
– Motorola MC14555x
– National TP305x family
– National TP307x family
– AT&T T75xx family
– TI/Intel 291x family
CC ■ Targets the following external ISDN transceivers (ISDN requires three channels):
– AMD Am79C30A/32A S/T
– Lucent T7237 U
CC Note: The Am186CC microcontroller does not provide the PCM codec master clocks for
GCI applications.
16.5.4.2.2 GCI Frame Sync and Clock Conversion
CC To support a wide variety of external PCM codecs while in GCI mode, the microcontroller
divides down the GCI clock frequency (which is twice the GCI data rate) to match the PCM
data rate. In addition to a divided-down clock, a programmable one-clock-prior-to-data
frame sync (the programmability determines where the frame sync appears relative to a B
channel time slot) provides the needed flexibility to support the targeted PCM codecs (listed
previously). These two converted signals (converted GCI frame sync and converted GCI
clock) are an output on the Am186CC microcontroller’s external communication interface
C. All codec data movement is completely external to the microcontroller and is directly
routed between the PCM codec and the GCI bus. All external PCM codecs directly
connected to the GCI bus must meet all of the following conditions:
1. Be configured to output data on the rising edge of the converted clock and input data
on the falling edge of the converted clock (for GCI bus compatibility).
2. Be able to accept a one-clock-prior-to-data frame sync.
3. Be able to accept an active High frame sync.
4. Be capable of accepting a data clock frequency of 768 KHz.
Note: The Am186CC microcontroller only provides the PCM codec data/bit clock. The
Am186CC microcontroller does not provide the PCM codec master clock(s).
Figure 16-6 and Figure 16-7 illustrate both frame sync programmability and GCI conversion,
respectively.
CLK 7 0 1 2 3 4 5 6 7 0 1 2 3
CLK 7 0 1 2 3 4 5 6 7 0 1 2 3
DCL
CLK
FSC
Table 16-3 Timing Parameters Per Device (Supported PCM Codecs in GCI Mode)
Device Time (in ns)
CC Parameter 1
79C30 as Am79C02/ MC14555
Am186CC TP305x TP307x
Master 03/031 x
Min: 487 Min: 974 Min: 122
Clock Period
Max: 815 Max: 1630 Max: 7812
Min: 48
Clock High Pulse Width Min: 260 Min: 260 Min: 50 Min: 160 Min: 80
Max: 3890
Min: 48
Clock Low Pulse Width Min: 260 Min: 260 Min: 50 Min: 160 Min: 80
Max: 3890
Min: 25
Frame Sync Setup Time Min: 50 Min: 50 Max: Min: 50 Min: 50 Min: 30
clk prd-50
Min: 260
Frame Sync Hold Time Min: 50 Min: 50 Min: 50 Min: 100 Min: 30
(min PW)2
Min: 20
Min: 3/30ns Min: 0
Data Output Delay Max: 100 Data Typ: 60 Max: 80
Max: 80/150 Max: 140
movement Max: 140
occurs out- Min: 5/30
Data Output Hold Time Min: 70 Max: 80
side the Max: 80/150
Data Input Setup Time PW + 20 Am186CC Min: 25 Min: 0 Min: 50 Min: 30
Data Input Hold Time 50 Min: 5 Min: 50 Min: 50 Min: 15
Notes:
1. All loading is 150 pF.
2. One clock prior to frame sync is a full clock period, guaranteed to hold for a minimum pulse width Low.
16.5.4.3 GCI
CC The Am186CC microcontroller supports GCI, which is an industry-standard serial bus for
interconnecting telecommunications integrated circuits. For more information, see
Chapter 17, “General Circuit Interface (GCI).”
16.5.5 Software-Related Considerations
■ When using the TSAs in Transparent PCM Highway mode, the first byte of data
transferred must always contain a 1 as the first bit. If the first bit is a 0, the idle state
(mark idle) previous to the actual data stream is corrupted, which could falsely indicate
the start of actual data. This only applies when using Transparent mode.
16.5.6 Comparison to Other Devices
The Am186CC and Am186CH microcontrollers are similar to the AMD Am79C30 in clock
slave mode.
16.6 INITIALIZATION
On both external and internal reset, the following occurs:
■ All the TSA registers default to C0h, which disables the TSA channels (they must be
configured by software before being enabled).
■ The multiplexed signals default as shown in Table 16-1 on page 16-5.
17.1 OVERVIEW
The General Circuit Interface (GCI) is an interface specification developed jointly by Alcatel,
Italtel, GPT and Siemens. This specification (sometimes called IOM-2) defines an industry-
standard serial bus for interconnecting telecommunications integrated circuits. The
standard covers linecard, NT1, and terminal architectures for Integrated Services Digital
Network (ISDN) applications. The Am186CC microcontroller supports the terminal version
of GCI, which serves four main functions:
■ Connection of voice/data modules to an OSI Layer 1, GCI-SCIT (Special Circuit
Interface T) device (transceiver)
■ Programming and control of devices that do not have a microprocessor interface (e.g.,
a coder-decoder (codec) or a U-Interface transceiver)
■ Interchip communications between devices on the bus (e.g., a codec to a speech
encryption device)
■ Connection of multiple data link controllers to the D channel, including access arbitration
handled through the Terminal Interchip Communication (TIC) bus
Depending on the application, each HDLC can communicate to the external world with or
without a TSA. Each of the four HDLC channels can be programmed to select between raw
DCE and dedicated PCM Highway external interfaces.
The Am186CC microcontroller’s HDLC Channel A interfaces to the GCI controller block,
and allows multiplexed PCM Highway and GCI interfaces to the other three HDLC channels.
See Chapter 15, “High-Level Data Link Control (HDLC)” and Chapter 16, “HDLC External
Serial Interface Configuration (TSAs)” for more information. Full documentation on
GCI/IOM-2 is available in the AMD IOM-2 Interface Reference Guide, order #12576.
17.2 BLOCK DIAGRAM
Figure 17-1 shows the block diagram for a single HDLC channel, including connections
with the TSA and GCI.
Figure 17-1
HDLC
I/O
32 x 8 FIFO transmit clock Transmit CLK (A, B, C, D)
transmit data
Out Out
rxd Receive DATA (A, B, C, D)
PCB
Data Mux
Control
PCB Bus Control
Registers Loopback
I/O I/O
Registers
Control
SmartDMA Bus SmartDMA PCB Bus
I/O CC
I/O Registers
txd
Monitor
Control
Channel
Monitor
data
txc
PAD Interface
IN 16 x 8 FIFO Time Slot
Transmit CLK_A
Control/
Status
Controller
I/O Receive DATA_A
Internal CTS TIC Bus Transmit DATA_A
Transmitter TIC Bus Control Controller
TIC Bus
Control
Control/Status
GCI
General Circuit Interface (GCI)
GCI_DU_A SBIN
GCI_DD_A SBOUT
GCI_FSC_A SFS
GCI_DCL_A SCLK
PCM Codec
DXA
DRA
PCM_FSC_C FS
PCM_CLK_C PCLK
17.4 REGISTERS
The registers listed in Table 17-2 program the GCI. Appendix A summarizes the bits in all
the registers. For a complete description of all the peripheral registers, see the
Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916.
17.5 OPERATION
17.5.1 Usage
Note: Before using GCI, ensure multiplexed pins are configured to reflect the use of GCI
and not other functionality (see Table 17-1 on page 17-3).
1. To enable the GCI interface, software must set the MODE field of the TSACON register
to 10b. This is necessary whether or not TSA Channel A is being used.
2. If transmitting using the GCI, see “Transmitting Data” on page 17-6; if receiving, see
“Receiving Data” on page 17-7.
MEOMRQ bit being set, the GCI controller deactivates the outgoing MX bits in response
to incoming MR bits going inactive, and leaves them inactive.
17.5.1.2 Receiving Data
1. Configure the HDLC channels and time slot assigners to receive the data. For details,
see Chapter 15, “High-Level Data Link Control (HDLC),” and Chapter 16, “HDLC
External Serial Interface Configuration (TSAs).”
2. Configure the GCI channels:
a. If using the TIC bus access procedure, set the TICEN bits in the GTIC register. For
information about the TIC bus access procedure, see “TIC Bus Support” on
page 17-16.
b. If receiving Monitor channel data, set the applicable configuration options in the
GPCON register (the MCHEN, MCHSEL, and BRDIS bits).
c. If receiving IC channel data, set the applicable configuration options in the GPCON
register (the ICSEL and BRDIS bits).
d. For CI/1 channel data, set the applicable configuration option in the GPCON register
(the BRDIS bit).
e. If the bus is in a deactivated state, activate the bus by setting the GCIACT bit in the
GPCON register. For details, see “GCI Bus Deactivation/Activation” on page 17-9.
3. Set the interrupts to be taken with the GIMSK register. Bits in this register enable
interrupts based on interrupts set in the GISTAT register. If software disables an interrupt
in GIMSK, it can still read the interrupt status in the GISTAT register.
4. Wait for the DCLST bit in the GISTAT register to be set, indicating the data clock has
been started by the master clock device.
5. If the bus was in a deactivated state, turn off the GCI activation request by clearing the
GCIACT bit in the GPCON register.
6. For monitor channel transmission, on the first data available interrupt, software must set
the MCARV configuration bit to continue transmission. This bit holds off the remote
transmitter until software has determined the first byte is valid (the first byte is usually a
known address byte). If software fails to determine that the first byte is valid, then software
should abort reception (i.e., this message is for some other downstream device).
7. For monitor channel transmission, the MEOMRD interrupt is set to indicate that an end-
of-message (EOM) has been received by the monitor channel.
At the time the receiver sees the first byte, indicated by the inactive-to-active transition of
incoming MX bits, outgoing MR bits are by definition inactive. The GCI controller activates
outgoing MR bits in response to the activation of incoming MX bits, loads the data byte on
the bus into the Monitor Receive Data register, and generates a Monitor channel receive
data available interrupt. Outgoing MR bits remain active until the next byte is received or
an EOM is detected (incoming MX bits held inactive for two or more frames).
In subsequent receives, the GCI controller receives data into the buffer on each falling edge
of incoming MX bits, and generates a Monitor channel receive data available interrupt. Note
that the data was actually valid at the time the incoming MX bits became inactive, one frame
before becoming active (the Am186CC microcontroller performs a data integrity check to
confirm stable data for two frames). Outgoing MR bits are deactivated at the time data is
read and reactivated one frame later. The receipt of an EOM, which is incoming MX bits
remaining inactive for two or more frames, terminates the reception of data.
An abort is a signal from the receiver to the remote transmitter indicating that data has been
missed. The receiver sends an abort (indicated with the MTARD bit in the GISTAT register)
by holding MR bits inactive for two or more frames in response to MX bits going active.
Receiving an abort, indicated with the MRAD bit of the GISTAT register, generates a
transmitter interrupt.
The remote transmitter is held off until the Monitor Receive Data register is read, because
MR bits are held active until the receive byte is read. The transmitter does not start the next
transmission cycle until MR bits go inactive.
17.5.2 GCI Structure: Channels and Frames
Figure 17-3 illustrates the GCI terminal mode frame structure. The Am186CC
microcontroller also provides a second interface used with the GCI interface (discussed in
“GCI-to-PCM Converted Pin Interface” on page 17-14). This second interface allows an
external PCM codec to multiplex directly onto a GCI terminal frame B channel. For more
information, see the AMD IOM-2 Interface Reference Guide, order #12576.
FSC
MR
DD/ B1 B2 Mon0 D C/I0 MR MX IC1 IC2 Mon1 C/I1 MX TIC
DU
8-bits 8-bits 8-bits 4-bits 8-bits 8-bits 8-bits 6-bits 8-bits 8-bits 8-bits 8-bits
2-bits 2-bits 2-bits
Idle
Activation Downstream (clocks off)
Software sets (DU = Z)
Activation bit; (DD = Z)
DU output forced Low Deactivation
DU output forced to Z
DD output forced to Z
(DU = 0) Activation Upstream
(clocks off)
(DU = 0)
(clocks on)
Clocks stopped
by upstream
Software clears device
Activation bit
Active
(clocks on)
(DU = data)
17.5.4.1.1 Deactivation
The upstream device typically initiates deactivation. When the Am186CC microcontroller
receives the deactivation request over the C/I channel, it must respond by sending the
deactivation indication over the C/I channel. The upstream device then sends the
deactivation confirmation command over the C/I channel. The Am186CC microcontroller
detects that the clock has stopped (defined as no clock pulse received for 650 ns) and
forces itself to the deactivated state.
In the deactivated state, the microcontroller forces both the DU and DD signals to a high-
impedance state, and monitors the DCL input (by use of the DCLST bit in the GISTAT
register) for any rising edge that would indicate an activation request from the upstream
device.
17.5.4.1.2 Activation
Either the upstream or the downstream device can initiate activation. For the Am186CC
microcontroller to activate the interface, software must set the activation bit (GCIACT) of
the GPCON register. This forces the microcontroller to pull its data output pin (DU) Low,
causing the upstream device to start the GCI clocks. When the clocks are running, as
indicated by the DCLST status bit being set, the microcontroller must respond to the interrupt
by loading the proper C/I command response into the C/I0 transmit register, then clearing
the GCIACT bit. This releases the data output pin (DU) from being held Low and allows the
microcontroller to complete the activation procedure by sending the proper commands over
the C/I channel. The DCL clock remains active until the upstream device stops the clock.
When activation originates from the upstream device, the DCLST bit is set when the clocks
become active (DCL going High). The microcontroller begins normal GCI transmission/
reception as soon as DCL appears; no intervention from the controller is required. However,
the microcontroller must respond to the interrupt and perform the normal C/I channel
software handshakes before activation completes.
17.5.4.2 GCI Bus Reversal
In Terminal mode, a device may be required to transmit both upstream and downstream,
based on which GCI channel is being transmitted at any one time. As a result, the actual
data pins of the GCI interface need to be both inputs and outputs, changing direction based
on which channel is being transmitted at the time.
17.5.4.2.1 Downstream Versus Upstream
The following terms are used in GCI:
Downstream Direction: Data is output on GCI_DD_A by an upstream device and this data
is a GCI_DU_A input to the downstream device.
Upstream Direction: Data is output on GCI_DU_A by a downstream device and this data
is a GCI_DD_A input to the upstream device.
Downstream Device: Generates GCI_DU_A and terminates GCI_DD_A.
Upstream Device: Generates GCI_DD_A and terminates GCI_DU_A.
Because pin reversal is supported, a device on the GCI bus can be considered a
downstream device, an upstream device, or both. Figure 17-5 demonstrates the Am186CC
microcontroller as an GCI Subframe 0 downstream device (the transceiver, an upstream
device, outputs data on GCI_DD_A and the Am186CC microcontroller, the downstream
device, inputs data from GCI_DD_A).
Figure 17-5 also demonstrates the Am186CC microcontroller as a GCI Subframe 1
upstream device (the Am186CC microcontroller, an upstream device, outputs data on
GCI_DD_A and a downstream device, such as an GCI codec, inputs data from GCI_DD_A).
Devices which do not support pin reversal are fixed to transmit and receive in one direction
only.
For example, a line transceiver is always an upstream device communicating solely with
downstream devices (it transmits information on GCI_DD_A to downstream devices, and
receives information on GCI_DU_A from devices sending information upstream to this
upstream transceiver). Therefore, in this case, anything on the GCI bus is always considered
downstream from the upstream transceiver.
Note: In most documentation, where a reference point is not given, but upstream or
downstream are mentioned, the default reference point is almost always the transceiver:
that is, downstream (from the transceiver), upstream (to the transceiver), the upstream
(transceiver) device, and so on.
IC1,IC2,MON1,C/I1
Transceiver
B1,B2,D,MON0,C/I0,E(in),S/G(in),
BAC(out), TBA2–TBA0(out) DD DU
DD
Am186CC
DU
DD
Downstream
#1 DU
DD
Downstream
#2 DU
Notes:
E, S/G, BAC, and TBA2–TBA0 are bits on the TIC bus.
Transceiver
B1,B2,D,MON0,C/I0,IC1,IC2,
MON1,C/I1,E(in),S/G(in), BAC(out),
TBA2-0(out) DD DU
DD
Am186CC
DU
DD
Downstream
#1 DU
DD
Downstream
#2 DU
Notes:
E, S/G, BAC, and TBA2–TBA0 are bits on the TIC bus.
To access the monitor channel through Upstream Monitor Channel Collision Detection on
the first byte and Downstream Device Recognition on the first byte (these procedures are
used in Monitor Channel multidrop configurations), use the following procedures.
17.5.7.3.1 Upstream Monitor Channel Data Transmission
The address of the monitor message contained in the first monitor byte transmitted
determines the monitor channel access priority. The following hardware/software procedure
is followed:
1. Software configures the monitor channel for data transmission.
2. Hardware waits for the idle phase before transmitting the first byte of monitor data.
3. During the first byte transmitted, a per bit check occurs on each transmitted monitor bit.
If any bit mismatches, the transmitter immediately withdraws from the monitor channel
by setting all remaining monitor bits to 1 (thus allowing another device with higher priority
to gain control of the monitor channel), sets the monitor channel collision detection
interrupt, and reverts back to waiting for the idle condition.
Note: The collision detection interrupt is set on any monitor data transmit bit mismatch
(i.e., from the first byte transmitted to the last byte transmitted). Therefore, if software wishes
to differentiate how it services other byte collisions from first-byte collisions, it must maintain
this knowledge itself.
17.5.7.3.2 Downstream Monitor Channel Data Reception
Device recognition allows a downstream device to determine whether or not it is the intended
target for an initiated Monitor Channel message sent by an upstream device (the address
to be recognized is contained in the first byte of the monitor message). The following
hardware/software procedure is followed:
1. Hardware waits for the idle phase.
2. After detecting the idle phase, hardware waits for a valid first byte to be sent by an
upstream device.
3. After receiving the first byte, hardware indicates to software, through a data-available
interrupt, that the first byte has arrived.
4. Software determines whether or not the microcontroller was the intended target.
5. If a valid address is recognized (from the first byte), software indicates to the receiver
to continue with data reception by setting a valid address-compare bit. Otherwise,
software indicates to the receiver that it should not continue receiving data (through a
software-abort bit).
17.5.7.4 C/I Channel Operation
The C/I channel communicates real-time status information and maintenance commands.
Unlike the monitor channel, the Am186CC microcontroller supports both C/I channels
contained in GCI Subframe 0 and GCI Subframe 1 concurrently. Software reads the
received data from one of the C/I Receive Data (GCIRD0 or GCIRD1) registers. Software
writes C/I transmit data to one of the C/I Transmit Data (GCITD0 or GCITD1) registers. The
GCI controller monitors these two channels, and generates an interrupt any time the receive
data changes and is stable for two frames (GCI’s standard data integrity check). Data on
the C/I channel is continuously transmitted in each frame until new data is to be sent. In
this way, the C/I channel can be thought of as a set of static status lines that only change
when the status changes. For a list of C/I codes (for GCI Subframe 0 only), and further C/I
channel operation, refer to the AMD IOM-2 Interface Reference Guide, order #12576.
In the downstream direction (from the transceiver), the TIC bus on GCI Subframe 2 is used
for D and C/I0 channel access control in S/T interface terminals.
The TIC bus downstream has the format shown in Figure 17-8.
Bit Number 7 6 5 4 3 2 1 0
Bit Name E E S/G A/B 1 1 1 1
The availability of the S/T interface D-channel is indicated in bit 5 (Stop/Go bit) of the
downstream TIC bus. The Am186CC microcontroller GCI TIC bus controller checks the
Stop/Go bit to determine if it has access to the D-channel. If it does, it can start transmission
of an HDLC frame. If the TIC bus controller does not have access, it must halt the
transmission. Bits 7 and 6 are the D-channel Echo bits from the S-interface (reflecting back
the two D-channel bits of the current frame). The Am186CC microcontroller GCI TIC bus
controller compares the Echo bits with the sent D-channel bits to determine if a collision
has occurred. A D-channel collision is reported to an HDLC through an internal signal,
originating from the GCI TIC bus controller, whose function is similar to an external CTS
deassertion (a mechanism that stops HDLC transmission). The Am186CC microcontroller
does not use the A/B bit.
In the upstream direction (to the transceiver), the TIC bus on GCI Channel 2 is used for the
TIC bus access procedure, enabling the connection of several Layer 2 D-channel protocol
controllers to the GCI interface.
The TIC bus upstream has the format shown in Figure 17-9.
Bit Number 7 6 5 4 3 2 1 0
Bit Name 1 1 BAC TBA2 TBA1 TBA0 1 1
In the case where the S/G bit is 1, only the D-channel data is prevented from being
switched through the GCI bus (i.e., the C/I0 channel could request access to this already
established TIC bus and transmit its information). The TIC bus request remains
unaffected (for example, if the microcontroller has earned the right to the GCI TIC bus
it does not give up this bus and keeps BAC and the TIC address active while waiting for
GO). As soon as the S-interface D-channel is clear, signified by the S/G bit cleared (GO),
the controller commences with D-channel data transmission.
Note: When GCI TIC access is granted, BAC = 0, regardless of S/G. At this point, both
C/I0 and the HDLC controller have access to the GCI TIC bus (i.e., if C/I0 data needs to
be transmitted it does not have to arbitrate for the GCI TIC bus—TIC bus access has already
been established). To relinquish the GCI TIC bus after a C/I0 or D-channel transmission,
both the C/I0 request (a software request) and the HDLC controller request (a hardware
request) must be deasserted. The HDLC controller cannot transmit back-to-back frames.
Therefore, if C/I0 keeps the TIC bus open (the TIC bus established by the HDLC controller),
another HDLC transmission does not occur until after the C/I0 gives up the TIC bus and
BAC = 1 in two successive frames (i.e., the TIC bus cannot be accessed again for at least
one GCI frame—regardless of whether the HDLC controller request or the C/I0 request
established the TIC bus).
6. After the completed transmission of an HDLC frame, signified by the HDLC controller
deasserting the TIC bus controller’s RTS, the HDLC controller is withdrawn from the TIC
bus (BAC is set back to 1 in the following frame if a software TIC bus request has not
been made for C/I0 communication), and the HDLC controller is prevented from
accessing the TIC bus again for one GCI frame (i.e., the controller was moved into a
lower priority as mentioned earlier). This also applies even if a new HDLC frame is to
be transmitted in immediate succession. This gives all connected devices an equal
chance to access the TIC bus.
7. If a collision occurs at any time during the transmission of a D-channel HDLC frame, the
Am186CC microcontroller immediately ceases transmission (collision is signified to the
HDLC controller by deasserting CTS while in frame), returns to the D-channel monitoring
state (i.e., waits for another request to send and start over), and sends 1s over the
D-channel.
17.5.7.5.2 C/I0 Arbitration (Software Control)
Software controls the GCI Bus Accessed (BAC) bit through the Bus Access Request (BAR)
bit of the GCITDx register following a procedure very similar to the D-channel arbitration
scheme described above. This bit provides access to the C/I0 channel when TIC bus
support is enabled. Software should set the BAR bit whenever the microcontroller has C/I0
data available to transmit.
1. When BAR = 1, the TIC bus controller arbitrates access to the C/I0 channel.
2. The GCI TIC bus controller checks if the BAC bit is set to 1. If not, access is not currently
allowed—transmission is postponed. Only when BAC = 1 does the GCI TIC bus controller
continue with this access procedure. Otherwise, it remains in this state.
3. When BAC = 1, the GCI TIC bus controller, in the same frame, transmits the TIC bus
address (TBA2–TBA0) on the open drain output. On the TIC bus, binary 0s overwrite
binary 1s. Thus, low TIC bus addresses have higher priority.
4. After transmitting a TIC bus address bit, the GCI TIC bus controller reads back the value
to check whether its own address bit has been overwritten by a controller with higher
priority. This procedure continues until all three address bits are sent and confirmed—
thus granting access to the GCI TIC bus. In the event a bit is overwritten by an external
controller with higher priority, the GCI TIC bus controller withdraws immediately from the
bus by setting all remaining TIC bus address bits to 1. (This assures that the lowest
address has priority. If the remaining bits are not immediately set to 1, addresses such
as 101 and 011 would have equal priority.) If a bit is overwritten and an address mismatch
occurs, the TIC bus controller returns to step 2.
5. If access was granted, the C/I0 channel is in possession of the GCI TIC bus, and C/I0
communication can begin in the following GCI frame.
Note: When GCI TIC access is granted, BAC = 0—regardless of S/G. At this point, both
C/I0 and the HDLC controller have access to the GCI TIC bus (i.e., if the HDLC controller
needs to transmit D-channel data, it does not have to arbitrate for the GCI TIC bus—TIC
bus access has already been established). The HDLC controller does not have to arbitrate
for the GCI TIC bus, but it must wait for an asserted S/G from the transceiver before it
receives its internal CTS and can transmit, as stated in the previous section. To relinquish
the GCI TIC bus after a C/I0 or D-channel transmission, both the C/I0 request (a software
request) and the HDLC controller request (a hardware request) must be deasserted. When
the software request bit has been cleared (ending C/I0 transmission), the C/I0 channel is
not allowed back onto the same established TIC bus should it remain open for a HDLC
transmission. When the TIC bus is given up by the HDLC controller, neither the D-channel
nor the C/I0 channel is allowed access to the TIC bus again for at least one GCI frame.
6. After the completion of C/I0 data, software should remove its request by clearing its
request bit. When done, the C/I0 channel control is withdrawn from the TIC bus (BAC
is set back to 1 in the following frame as long as the HDLC controller has no D-channel
communication in progress) and the C/I0 channel is prevented from accessing the TIC
bus again for one GCI frame (i.e., the channel is moved into a lower priority as mentioned
earlier in this chapter). This gives all connected devices an equal chance to access the
TIC bus.
17.5.7.6 IC Channel Operation
The two IC channels have access to a single interrupt-driven microprocessor
transmit/receive buffer. A register bit determines which channel gets access to this buffer.
Because the data output is open-drain, the unused IC channel and all High bits of the
chosen IC channel are placed in a high-impedance state (unless driven by an HDLC channel
through a Time Slot Assigner).
17.5.8 Interrupts
The GCI controller can generate the following maskable interrupts (sharing one direct
processor interrupt line) using the GISTAT and GIMSK registers.
■ IC Buffer Available or Buffer Empty: Indicates that a byte of data has been received
on the IC channel, and that a new IC byte can be loaded for transmission.
■ GCI Timing Request: Response to GCI_DCL_A starting (going High) from the
deactivated state.
■ Change in C/I1 Channel Status: Indicates that the contents on the receive side of
C/I channel 1 have changed since the C/I Receive Data register was last read.
■ Change in C/I0 Channel Status: Indicates that the contents on the receive side of
C/I channel 0 have changed since the C/I Receive Data register was last read.
■ Monitor Channel Receive Abort Detected: Indicates an implied transmitter abort due
to out-of-sequence transmit handshake bits or handshake bit transmission errors.
■ Monitor Channel Collision Detected: Indicates that a collision has occurred on the
monitor channel during the transmission of a monitor byte.
■ Monitor Channel Transmit Abort Request Received: Indicates that an abort request
has been received on the monitor channel. This indicates that the receiver on the other
end of the Monitor channel has failed to receive the transmitted data correctly and is
requesting that the current transmission be discontinued and the data transmission be
repeated through software.
■ Monitor Channel End-of-Message Received: Indicates that an EOM has been
received on the monitor channel. This indicates that the message currently being
received has concluded.
■ Monitor Channel Transmit Buffer Available: Indicates that a new byte of data can be
loaded into the Monitor Transmit Data register.
■ Monitor Channel Receive Data Available: Indicates that a byte of data has been
received on the monitor channel and is available in the Monitor Receive Data register.
17.5.9 Software-Related Considerations
To enable the GCI interface, software must set the MODE bit field to 10b in the TSA
Channel A Configuration (TSACON) register. This is necessary regardless of whether TSA
Channel A is being used.
17.5.10 Comparison to Other Devices
The Am186CC microcontroller’s GCI interface is similar to the AMD Am79C30 in clock slave
mode.
17.6 INITIALIZATION
On external and internal reset, the following occurs:
■ The TSAs default to non-GCI mode.
■ The GCI signals default to alternate functionality as shown in Table 17-1 on page 17-3.
■ The EXSYNC bit of the SYSCON register is cleared, making the HDLC Channel C
interface available for raw DCE or PCM highway operation.
■ The MODE field of the TSxCON register is cleared, specifying raw DCE operation.
■ The GCIDEN bit of the HxTCON1 register is cleared, disabling GCI D-Channel control
of the HDLC channel.
■ The MCHEN bit of the GPCON register is cleared, disabling both monitor channels.
■ The MCHSEL bit of the GPCON register is cleared, selecting monitor channel 1.
■ The ICSEL bit of the GPCON register is cleared, selecting IC channel 1.
■ The BRDIS bit of the GPCON register is cleared, enabling bus reversal.
■ The MXBA bit of the GISTAT register is set, indicating that a new byte of data can be
loaded into the GMTD register.
■ All GCI interrupts enables are cleared to 0 in the GIMSK register, masking the interrupts.
■ The TICEN and ECHOEN bits are cleared to 0 in the GTIC register, disabling TIC bus
access and D-channel echo compares, respectively.
18.1 OVERVIEW
The Universal Serial Bus (USB) is an industry-standard bus architecture for computer
peripheral attachment. The USB provides a single interface for easy, plug-and-play, hot-
plug attachment of peripherals such as a keyboard, mouse, speakers, printers, scanners,
and communication devices. The USB allows simultaneous use of many different
peripherals with a combined transfer rate of up to 12 Mbit/s.
Both the Am186CC and Am186CU microcontrollers include a highly flexible integrated USB
peripheral controller that designers can use to implement a variety of microcontroller-based
USB peripheral devices for telephony, audio, or other high-end applications. These
microcontrollers can be used in self-powered USB peripherals that use the full-speed
signaling rate of 12 Mbit/s. They do not support the USB low-speed rate (1.5 Mbit/s). An
integrated USB transceiver is provided to minimize system device count and cost, but an
external transceiver can be used instead, if required.
The USB peripheral controller’s features meet or exceed all of the USB device class
resource requirements defined by the USB Specification, Version 1.0. This chapter refers
to this version of the USB specification throughout. Consult the USB specification for details
about overall USB system design. (At the time of this writing, the current USB specification
and related information can be obtained on the Web at www.usb.org.)
The USB controller does not support USB host or hub functions. However, the Am186CC
and Am186CU microcontrollers can be used to implement USB peripheral functions in a
device that also contains separate USB hub circuitry.
The integrated USB peripheral controller provides a very efficient and easy-to-use interface,
so that device software (or software) does not incur the overhead of managing low-level
USB protocol requirements. Each of the controller’s data endpoints is highly programmable
and flexible, allowing the device to adapt to any USB host request that is made during the
device configuration process. Because of the flexibility of the USB peripheral controller’s
endpoints, a design can allow its descriptors to be updated on-the-fly by the host’s device
driver, if necessary.
The USB peripheral controller hardware implements a number of USB standard commands
directly; the rest can be implemented in device software. In addition, the USB peripheral
controller provides a high degree of flexibility to help designers accommodate vendor- or
device-class-specific commands, as well as any new features that might be added in future
USB specifications.
The USB peripheral controller includes specialized hardware to support isochronous data
transfers. Using the microcontroller’s DMA features, isochronous transfers from an off-chip
peripheral can be automatically synchronized to the USB data rate with little or no CPU
overhead.
CC The Am186CC microcontroller also supports isochronous transfers from one of the
integrated HDLC channels.
The USB peripheral controller also includes robust error detection and management
features so the device software can manage transfers in any number of ways as required
by the application. The USB suspend/resume, reset, and remote wake-up features are also
supported.
18.2 BLOCK DIAGRAM
Figure 18-1 shows the block diagram for the USB peripheral controller.
Am186CC/CU Microcontroller
USBD+ USB
USBD– CPU, Memory Interface,
Transceiver and Other Peripheral Devices
External
Transceiver
Interface Control
Registers
General-
FIFO Purpose DMA
Buffers
SmartDMA
Channel
USBX1 USB
USBX2 Controller
CC
HDLC A
USBSCI/ PCM
USBSOF GCI
1.5 K-Ω pull up on USBD+ when VUSB is removed. The following system design issues
should be resolved to provide a robust self-powered USB device application:
On Connect:
■ Monitor VUSB to identify a powered USB host/hub.
■ Enable the 1.5 K-Ω pullup on USBD+ to signal a connect condition to the host/hub.
On Disconnect:
■ Monitor VUSB to identify power being removed from the USB host/hub.
■ Three-state USBD+/USBD– outputs.
■ Remove power from 1.5 K-Ω pull up.
Figure 18-2 illustrates a circuit diagram of an example application using the internal
transceiver. Figure 18-3 illustrates a circuit diagram of an example application using the
external transceiver.
D G
S
PIO_USB_DETECT
PIO_USB_VCC
D G
Am186CC/CU S
Microcontroller
Note: The USB specification requires a driver impedance between 29 Ω and 44 Ω on the
USBD+ and USBD– signals. For information about driver characteristics and selecting a
series resistor value, see the data sheets for the Am186CC and Am186CU microcontrollers.
D G
S
PIO_USB_DETECT
PIO_USB_VCC
D G
S
Am186CC/CU
Microcontroller
1 VUSB
R1
UTXDMNS[RSVRD_102] 2 USBD–
UTXDPLS[RSVRD_101] 3 USBD+
UXVOE[RSVRD_103] 4
R2 GND
UXVRCV[RSVRD_104]
UDMNS[USBD–]
UDPLS[USBD+]
If necessary, to enable interface signals for an external transceiver, disable the integrated
USB transceiver by asserting the USBXCVR pinstrap at reset (power-on or assertion of
RES). Table 18-1 on page 18-3 lists all USB signals, plus information about multiplexed
functions.
Note: Before using either the internal USB transceiver or the external USB transceiver
interface, software must set the PUP_XCVER bit in the USB Device Miscellaneous
Functions (USBMFR) register to power up the USB transceiver and enable the transceiver
interface.
18.3.1.3 USB Clock Source
The USB peripheral controller hardware requires a 48-MHz clock input for proper operation.
The USB peripheral controller can be driven directly from the primary system clock if the
primary system clock is operating at 48 MHz. Otherwise, use a dedicated USB clock source
so that the primary microcontroller system clock and the USB clock are independent of
each other. When the dedicated USB clock source is used, the only requirement is that the
primary system clock must be a minimum of 24 MHz when using the USB peripheral
controller.
To select the dedicated USB clock source, assert either the USBSEL2 or USBSEL1 pinstrap
during reset (power-on or assertion of RES). These pinstraps select either 4x or 2x PLL
operation, allowing the use of a 12-MHz or 24-MHz crystal, respectively, as the USB clock
input on pins USBX1 and USBX2. Table 18-2 lists the permutations of the USB PLL mode
pinstraps.
CC ■ The integrated HDLC controllers in the Am186CC microcontroller can use only the
SmartDMA channel. Consequently, if all four HDLC controllers are to be used with DMA
(for high-bandwidth HDLC connections), then the USB can use only general-purpose
DMA or no DMA.
■ Other integrated peripherals such as the UARTs and the external DMA request lines
can use only the general-purpose DMA channels.
■ For USB bulk endpoints, SmartDMA channels have advantages over general-purpose
DMA channels that can result in higher performance and lower software overhead,
especially when each transaction is relatively small. When most transactions are
relatively large, general-purpose DMAs may have a small performance advantage over
SmartDMA channels.
■ For USB isochronous endpoints with true streaming data, general-purpose DMAs are
slightly easier to use than SmartDMA channels.
■ Each USB data endpoint can only be connected to a single specific SmartDMA channel,
but can be connected to any general-purpose DMA channel. Because SmartDMA
channels are directional (either transmit or receive), a general-purpose DMA channel
must be used if more than 2 IN data endpoints or more than 2 OUT data endpoints are
desired.
For more about DMA and other I/O options, see “Handling USB Data” on page 18-18.
18.4 REGISTERS
The registers listed in Table 18-3 program the USB peripheral controller. There are four
general configuration registers, six miscellaneous control and status registers, ten registers
for the dedicated control and interrupt endpoints, and eight registers each for the four data
endpoints.
Appendix A summarizes the bits in all the registers. For a complete description of all the
peripheral registers, see the Am186™CC/CH/CU Microcontrollers Register Set Manual,
order #21916.
18.5 OPERATION
The Am186CC and Am186CU microcontrollers act as USB peripheral devices. The USB
is a half-duplex, master/slave, polled bus. In other words, the microcontroller only transmits
on the USB in response to a request from the USB host, usually a personal computer. There
can be only one transmitter on the USB at a time.
When the USB host addresses a peripheral, it also addresses a particular endpoint on that
device. Each endpoint is configured with a logical number that the USB host uses to address
that endpoint. No two endpoints can be configured with the same logical number.
The endpoint responds to the host’s requests, sending or receiving device data. In USB
nomenclature, data flowing from the host travels in the OUT direction, and data flowing to
the host travels in the IN direction. Because the Am186CC or Am186CU microcontroller
resides in a USB peripheral, its OUT endpoints receive data, and its IN endpoints transmit
data.
Each endpoint is supported by a first-in-first-out buffer (FIFO). The FIFO is a temporary
storage location for the data that is passed between the microcontroller’s CPU or memory
bus and the integrated USB peripheral controller.
The microcontroller supports six endpoints:
■ One dedicated control endpoint (Endpoint 0)
■ One dedicated interrupt endpoint
■ Four fully programmable data endpoints (named A–D)
The following sections describe the USB endpoints and explain how to use them.
18.5.1 Usage
This section briefly lists the tasks that software must perform to program the USB peripheral
controller for various applications. The following programming tasks do not cover all
possibilities. They are intended to provide a basic understanding of USB register usage.
The user should program the registers appropriately for each specific application.
Many of the subjects mentioned in the following lists are discussed more thoroughly
elsewhere in this chapter.
18.5.1.1 General USB Peripheral Controller Programming Issues
■ Always power up the transceiver (internal or external) by setting the PUP_XCVR bit in
the USB Device Miscellaneous Functions (USBMFR) register.
■ Always configure an endpoint’s definition registers before enabling the endpoint.
Changing the endpoint register values while the endpoint is enabled could result in
unpredictable behavior.
■ When using USB status bits as interrupt sources, be sure to program the interrupt
Channel 2 Control (CH2CON) register to enable the channel and select its internal
source (USB).
■ Refer to the Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916
for register default values and details about using each register field.
The host polls the interrupt endpoint once every 1 to 255 ms. Device software requests a
poll rate when it sets up the endpoint’s descriptor data structure, which the host obtains by
issuing a GET_DESCRIPTOR command during device configuration.
Note that the interrupt endpoint can only be used in non-DMA mode.
The following registers are used to configure the interrupt endpoint in response to
commands received from the USB host:
■ Interrupt Endpoint Definition 1 (IEPDEF1):
– Based on the SET_CONFIGURATION command, the device software should write
the EP_CFG field in the IEPDEF1 register.
– Based on the SET_INTERFACE command, the device software should write the
EP_INT and EP_ASET fields in the IEPDEF1 register.
– Based on the endpoint descriptor associated with the alternate setting, the device
software should write the EP_NUM field in the IEPDEF1 register.
■ Interrupt Endpoint Definition 2 (IEPDEF2):
Endpoint maximum packet value can be programmed to a value of 8 or 16.
■ Interrupt Endpoint Control/Status (IEPCTL):
– The endpoint enable bit (EP_EN) enables or disables the endpoint.
– Initial control of the data FIFO is assigned to software. Device software can therefore
write to the endpoint FIFO (IEPDAT). After writing to the FIFO, the software should
clear the ACT_REQ bit, thereby giving control back to the USB endpoint hardware
and allowing it to transmit the written data.
– Hardware sets the ACT_REQ bit after the endpoint has successfully sent a data packet
to the host and the packet has been acknowledged. To enable the ACT_REQ bit as
an interrupt source, set the INT_EP_ACT bit in the UIMASK1 register.
– There is a feature that allows the device software to update stale data if it has not
been transmitted. This is done by clearing the NOT_FLUSH bit, which causes the
hardware to revert control to the device software by setting the ACT_REQ bit. Note
that the ACT_REQ bit is set only if there is no active data transfer from this endpoint
to the host. Device software can verify if the ACT_REQ bit is set and if it is, can update
stale data by writing to the FIFO (IEPDAT).
18.5.1.4 Programming Data Endpoints
The USB peripheral controller provides four data endpoints.Two have 16-byte FIFOs, and
the other two have 64-byte FIFOs. Each data endpoint is individually programmable as to
direction (IN or OUT relative to the host), transfer type (bulk, isochronous, or interrupt), and
maximum packet size. The maximum packet size set for these endpoints can be greater
than the FIFO’s physical size if using a general-purpose DMA or SmartDMA channel. (Note
that the endpoints have differences in how they interface to the SmartDMA channels.) Legal
maximum packet sizes are any power of 2 between 8 and 64 for data endpoints configured
for bulk transfers, and any integer up to 1023 for data endpoints configured for isochronous
transfers.
The four endpoints are named A, B, C, and D. Where the following description applies to
any of them, an “x” is used in the register name in place of the endpoint name.
The following registers configure a data endpoint in response to commands received from
the USB host. For details on any of these registers, see the Am186™CC/CH/CU
Microcontrollers Register Set Manual, order #21916.
■ Endpoint Definition 1 (xEPDEF1):
– Based on the SET_CONFIGURATION command, the device software should write
the EP_CFG field in the xEPDEF1 register.
– Based on the SET_INTERFACE command, the device software should write the
EP_INT and EP_ASET fields in the xEPDEF1 register.
– The Endpoint number should be configured through the EP_NUM field in the xEPDEF1
register.
– Endpoint direction and Endpoint type should be configured through the EP_DIR and
EP_TYPE fields, respectively.
■ Endpoint Definition 2 (xEPDEF2):
FIFO size and endpoint maximum packet value fields can be programmed. The values
depend on the endpoint type selection. (Endpoint A and B FIFOs can be 8 or 16 bytes.
Endpoint C and D FIFOs can be 8, 16, 32, or 64 bytes.)
■ Endpoint Definition 3 (xEPDEF3):
– Based on application requirements, the appropriate interrupt mask and stop mask
fields are programmable.
– The MODE field can configure the endpoint. This determines how the endpoint
interfaces with system memory or another peripheral's data port.
– To enable the auto rate feature, use the AUTO_RATE_EN field. Note that this feature
only applies to an endpoint that is configured as an isochronous IN endpoint and
interfaces with a DMA mode. This feature requires additional programming in the
Isochronous Synchronization Control (ISCTL) register. For more information, see
“Isochronous Transfer Features” on page 18-24.
■ Endpoint Received Packet Size (xEPSIZ):
This is a status register that provides information on the size of the received packet (in
bytes) when the endpoint is configured for the OUT direction.
■ Endpoint Buffer Status (xEPBUFS):
This is a status register that provides information on the number of bytes, if any, is in the
endpoint FIFO.
■ Endpoint Data Port (xEPDAT):
Device software or the DMA controller uses this register to read/write to the endpoint
FIFO. A valid access to this register increments the address pointer.
■ Endpoint Receive Data Port Peek (xRCVPK):
Debug or emulator software uses this register to read the endpoint data FIFO without
advancing the address pointer. It is only applicable for the OUT direction.
5. Device software can clear the NOT_FLUSH bit in the AEPCTL register if it needs to
update stale data in the FIFO before the data is transmitted. This causes the USB
hardware to return control to software by setting the ACT_REQ bit. However, the
ACT_REQ bit is set only if there is no active data transfer from this endpoint to the host.
Device software can verify if the ACT_REQ bit is set and if it is, can update stale data
by writing to the FIFO (AEPDAT).
18.5.1.4.3 Endpoint C Configured as Bulk OUT, General-Purpose DMA Mode
1. Program the endpoint C registers:
– Set EP_TYPE = 10b (Bulk) and EP_DIR = 1 (OUT) in the CEPDEF1 register.
– Set MODE = 010b or 011b (general-purpose DMA) in the CEPDEF3 register. These
modes behave the same when used for an OUT endpoint.
– Set the appropriate interrupt mask bits in the UIMASK1 or UIMASK2 register. For
general-purpose DMA operation, enable the appropriate interrupt mask bits in the
CEPDEF3 register to allow the device software to be notified of the FIFO status. For
example, the FULL_PKT, SHORT_PKT, OTHER_ERROR, or BUFFER_ERROR
status bits could stop the hardware, requiring device software to take appropriate
action and then clear the ACT_REQ bit to let the hardware continue.
– Perform any additional programming of the definition registers that is required for the
specific application.
2. In the General-Purpose DMA Control 0 (GDxCON0) register for an available general-
purpose DMA channel, set DSEL = 11100b (USB Endpoint C, source-synchronized).
Make any other DMA channel configuration settings that are required, then set ST = 1
in the GDxCON0 register to enable the DMA channel. Enable the DMA channel before
enabling the DMA request source to avoid data loss or initial error conditions.
It is important to note that in DMA mode, the ACT_REQ bit no longer serves as a
semaphore lock for the data FIFO. The data FIFO now behaves as a circular FIFO with
simultaneous read/write capability. The ACT_REQ bit acts as a Stop/Go bit for the
hardware. For details, see the xEPCTL register description in the Am186™CC/CH/CU
Microcontrollers Register Set Manual, order #21916. If software sets the endpoint’s
ACT_REQ bit, the DMA transfer stops until software clears the bit again.
18.5.1.4.4 Endpoint C Configured as Bulk IN, General-Purpose DMA Mode with Terminal
Count Not Ignored
1. Program the Endpoint C registers:
– Set EP_TYPE = 10b (Bulk) and EP_DIR = 0 (IN) in the CEPDEF1 register.
– Set MODE = 011b (general-purpose DMA, terminal count not ignored) in the
CEPDEF3 register.
In this mode, when the terminal count for the general-purpose DMA channel reaches
zero, the byte of data written is marked as the last byte in the USB endpoint FIFO. If
the transfer size is an integer multiple of the maximum packet size, device software
can write a zero byte to the endpoint FIFO by clearing the NOT_ZERO bit in the
CEPCTL register and following that with a dummy write to the CEPDAT register. The
NOT_ZERO bit is set automatically when the data port is written.
– Set the appropriate interrupt mask bits in UIMASK1 or UIMASK2. For general-purpose
DMA operation, enable the appropriate interrupt mask bits in the CEPDEF3 register
to allow the device software to be notified of the FIFO status. For example, the
FULL_PKT, SHORT_PKT, OTHER_ERROR, or BUFFER_ERROR status bits could
stop the hardware, requiring device software to take appropriate action and then clear
the ACT_REQ bit to let the hardware continue.
– Perform any additional programming of the definition registers that is required for the
specific application.
2. In the General-Purpose DMA Control 0 (GDxCON0) register for an available general-
purpose DMA channel, set DSEL = 11101b (USB Endpoint C, destination
synchronized). Make any other DMA channel configuration settings that are required,
then set ST = 1 in the GDxCON0 register to enable the DMA channel. Enable the DMA
channel before enabling the DMA request source to avoid data loss or initial error
conditions.
It is important to note that in DMA mode, the ACT_REQ bit no longer serves as a
semaphore lock for the data FIFO. The data FIFO now behaves as a circular FIFO with
simultaneous read/write capability. The ACT_REQ bit acts as a Stop/Go bit for the
hardware. For details, see the xEPCTL register description in the Am186™CC/CH/CU
Microcontrollers Register Set Manual, order #21916. If software sets the endpoint’s
ACT_REQ bit, the DMA transfer stops until software clears the bit again.
18.5.2 Data Transmission and Data Types
For the Am186CC and Am186CU microcontrollers, all communication across the USB takes
place in Full-speed mode. USB bus transactions involve transmissions in up to three types
of packets: token, data, and handshake. The token packet contains information about the
type and direction of the transaction as well as the device address and which endpoint to
use. The data packet, if any, contains actual commands or data. There can be one data
packet, none, or more than one in a transaction. The format of a data packet varies according
to what type of endpoint is being used. The handshake packet contains information
regarding whether or not the transaction was completed successfully.
When beginning a transfer, the host issues a start-of-frame (SOF) packet. When the USB
peripheral controller decodes this packet, it indicates the start-of-frame in the USB Interrupt
Status 2 (UISTAT2) register. Also decoded in the start-of-frame packet is a time stamp,
which the USB peripheral controller places in the Time Stamp (TSTMP) register.
18.5.2.1 USB Suspend, Resume, and Remote Wakeup
A USB Suspend is indicated if traffic across the USB cable ceases for 3 ms or more. This
causes the USB peripheral controller to go into Suspend mode, which hardware indicates
by setting both the SUSP bit in the USB Device Miscellaneous Functions (USBMFR) register
and the USB_SUS bit in the USB Interrupt Status 2 (UISTAT2) register. The USB_SUS can
be enabled as an interrupt source by setting the corresponding bit in the UIMASK2 register.
When a USB Suspend is detected, software should take any necessary action and wait for
a USB Resume, which hardware indicates by clearing the SUSP bit in the USBMFR register
and by setting the USB_RES bit in the UISTAT2 register. USB_RES can also be enabled
as an interrupt source by setting the corresponding bit in the UIMASK2 register.
The Remote Wakeup feature is provided for peripheral devices that might need to wake up
the USB remotely. The device’s Remote Wakeup feature must be enabled by the host,
which does so by issuing an appropriate SET_FEATURE command to the device. This
automatically sets the RWAKE_EN bit in the USBMFR register.
If the RWAKE_EN bit is set and the controller is in USB Suspend mode, device software
can initiate a USB Resume by setting the RWAKE bit in the USBMFR register.
For the USB control endpoint, the system software is responsible for decoding and servicing
several of the USB standard commands and all device class or vendor specific commands.
Hardware is provided that allows the system software to detect incoming commands, and
respond appropriately. The hardware also allows the software to detect all command abort
scenarios.
18.5.3 Handling USB Data
The USB peripheral controller handles all of the low-level USB protocol requirements in
hardware. Data movement between device memory or other microcontroller peripherals
and the USB peripheral controller’s endpoints is managed by device software executing on
the microcontroller CPU.
The device software can use status polling or interrupts to handle FIFO data for any endpoint
(control, interrupt, and A–D). In addition, the data endpoints (A–D) support either general-
purpose DMA or SmartDMA channel transfers.
Device software sets up the method of operation for the endpoints by programming control
and definition registers. There are register bits to enable or disable interrupts that can be
generated as data transfers proceed, or the software can poll status bits to determine the
status of each endpoint. Registers for each data endpoint determine the DMA channels
used (if any), the endpoint’s direction (IN or OUT, relative to the host), and its type
(isochronous, bulk, or interrupt). These registers are also used to set up other information
used in the USB configuration process.
For control, interrupt, and bulk data transfers, USB guarantees correct data delivery with
automatic retry. Microcontroller hardware performs this task transparently to the software
except for data endpoints that have been configured to use DMA. When DMA is being used,
the device software is involved in error detection and recovery.
For isochronous data transfers, the USB specification calls for only a good-faith attempt at
delivery. Isochronous transfers call for real-time delivery of each packet, so damaged
packets cannot be retransmitted.
Special status and interrupt bits are provided for the control endpoint to indicate whether
the packet currently in that endpoint’s FIFO is a command that must be handled by device
software.
18.5.4 Polled I/O
In Polled I/O mode, no DMA channel is specified, and interrupts are disabled. The device
software must actively poll the USB status register to determine when it owns the endpoint’s
FIFO, and then it must write or read the endpoint’s Data Port register to fill or empty the FIFO.
An endpoint operates in this mode only when the maximum packet size has been
programmed to be less than or equal to the size of the FIFO. In this mode, the FIFO cannot
operate in a circular fashion as it does for DMA transfers (see page 18-19).
For a receive endpoint (OUT direction relative to the host), the USB peripheral controller
sets the endpoint’s ACT_REQ bit in the status register whenever the FIFO is full of valid
data, or when an end-of-packet event has occurred. If this bit is set, the software can empty
the FIFO the next time it polls this endpoint. The amount of valid data in the FIFO is indicated
by the endpoint’s Received Packet Size and Buffer Status registers. When software has
finished reading the FIFO, it must clear the ACT_REQ bit to release FIFO ownership to the
USB peripheral controller.
For a transmit endpoint (IN direction), the ACT_REQ bit is set if the FIFO is ready to be
filled with data. If this bit is set, software can fill the FIFO when it has data for that endpoint
to transmit, then it must clear the ACT_REQ bit to release the FIFO.
If an error occurs on a packet received by a bulk, control, or interrupt endpoint, the ACT_REQ
bit is not set. Instead, the FIFO is flushed, and the host retransmits the packet. If an error
occurs when the endpoint being addressed is isochronous, no retransmission can occur;
the data that was sent or received must be used as is.
18.5.5 Interrupt-Driven I/O
A single interrupt channel can be configured to alert software that the USB peripheral
controller requires attention. Interrupt mask fields allow the device software to enable the
events it is interested in, and the status registers show which events have occurred.
The interrupt mode of operation is very similar to the polled mode. It is an extension of the
polled mode in which the ACT_REQ bit is enabled to cause an interrupt. The device
software’s interrupt handler then polls the status bits to see which endpoint needs service.
Errors that occur in this mode are handled the same as in polled mode.
18.5.6 Using USB with DMA
Compared with polled or interrupt I/O, using DMA with USB gives the following benefits:
■ Improved Throughput: This is an important consideration, not only from the
microcontroller's perspective, but also from the USB host's perspective. If the
microcontroller is ready to receive or transmit data whenever the host wishes, it reduces
USB bus overhead due to retries.
■ Larger Packets: When the USB peripheral controller is used with DMA, there is no
restriction on packet size, other than that mandated by the USB specification (1023
bytes/packet for isochronous, 64 bytes/packet for bulk). When DMA is not used, packets
are restricted to the size of the endpoints' FIFO.
■ Automatic Rate Control: The microcontroller's Automatic Rate Control feature is only
available when using DMA. This feature allows the amount of data sent in an isochronous
IN packet to be controlled by the number of PCM highway frames or other external events
that occur in each USB frame.
However, using DMA with USB is more complicated than using polled or interrupt I/O. In
Polled or Interrupt mode, the USB hardware performs all error handling itself. The host is
notified only when a packet has been received or transmitted without errors. With DMA,
software is responsible for recovering from errors. This includes backing up DMA pointers,
taking into account the amount of data that has not yet been transferred to or from the
endpoint's FIFO, and so on. In addition, using DMA requires extra programming effort even
before exception handling is considered.
18.5.6.1 DMA Availability
DMA mode is only available for Endpoints A–D. In DMA mode, endpoints are programmed
to use the microcontroller’s general-purpose DMA or SmartDMA channels.
When used with a USB data endpoint, the general-purpose DMA channels allow the device
software to set up a single USB packet or an entire I/O request packet (IRP) to transfer
data automatically between memory and the endpoint’s FIFO. During the transfer, software
interaction is required only to handle FIFO and USB packet errors.
SmartDMA channel pairs 2 and 3 can be used with specific endpoints if they are configured
in the correct direction, as shown in Table 18-4. SmartDMA channels allow device software
to set up single or multiple USB packets, or single or multiple IRPs, to be moved
automatically between the endpoint’s FIFO and memory (or I/O), possibly using even less
overhead than general-purpose DMA. Software interaction is still required to handle FIFO
and USB packet errors.
USB data Endpoint D if configured as a USB IN endpoint1 SmartDMA Pair 3 Transmit Channel
Notes:
1. SmartDMA Channels 2 and 3 Transmit and Receive cannot be assigned to different peripherals. For example, if
SmartDMA Channel 2 Receive is assigned to USB data endpoint A, then SmartDMA Channel 2 Transmit can be
used for USB data endpoint B, but cannot be used with the HDLC controller on the Am186CC microcontroller.
Selection of what type (if any) of DMA to use for a particular type of USB data pipe should
take into account several issues:
■ SmartDMA channels may be better for some tasks. For example, SmartDMA channels
can transition from one FIFO to the next without incurring any interrupt overhead or
latency.
■ General-purpose DMA is simpler to program and understand for many tasks.
■ Each SmartDMA channel is only capable of operation in a single direction. Because
each endpoint is associated with a particular SmartDMA channel, a given system can
have a maximum of two endpoints for any direction (IN or OUT).
When selecting DMA channels to use, be sure to consider other microcontroller functions
(such as HDLC or UARTS) that might be using DMA. See “DMA Trade-Offs” on page 18-6.
18.5.6.2 DMA/FIFO Interaction
Unlike the polled I/O or interrupt methods, in DMA mode the maximum packet size can be
programmed to a value greater than the physical size of the FIFO. Because of this, the
protocol for filling or emptying a FIFO is different than when using polled I/O or interrupts.
The FIFO in the endpoint operates in a circular fashion while in DMA mode.
For a receive (OUT) endpoint, the USB peripheral controller issues a DMA request
whenever the FIFO is not empty. It continues to assert the DMA request until the FIFO is
empty. The USB peripheral controller detects that a receive transaction has completed;
either successfully or unsuccessfully. If a SmartDMA channel is configured to store packet
status to the FIFO descriptor, it handles packet errors automatically and places the error
status in the last three bytes sent. If general-purpose DMA is used, or if a SmartDMA
channel is configured to not store packet status in the FIFO descriptor, bits in the endpoint’s
status register can cause an interrupt when an error occurs.
For a transmit (IN) endpoint, a DMA request is asserted whenever the FIFO is not full. The
request assertion continues until the FIFO is full. Data bytes can be marked either as the
last byte of the transfer or as a null byte. If the endpoint is configured to use a general-
purpose DMA channel, it can indicate the last byte upon reaching the terminal count. If the
endpoint is configured to use a Smart DMA channel, information in the FIFO descriptor
indicates if a byte is the last byte or a null byte.
18.5.6.3 Setting Up DMA for USB
The USB peripheral controller gives the programmer a large degree of freedom in using
DMA with USB endpoints. In general, most methods of using DMA with USB fall into one
of three categories:
■ Undelimited Transfers are generally used for isochronous data that has no natural
boundaries, such as audio data. For these types of transfers, either the SmartDMA
channel or the general-purpose DMA serve equally well to transfer data into a circular
FIFO. In addition, SmartDMA control can transfer data to or from another peripheral,
such as the HDLC controller on the Am186CC microcontroller.
For undelimited IN (to the host) transfers, the amount of data transferred in each packet
is the endpoint’s maximum packet size unless Auto Rate control is enabled on the
endpoint. If Auto Rate control is enabled, the packet size can equal the number of
samples received during the previous frame multiplied by a programmable byte/sample
factor, if this value is less than the programmed maximum packet size.
■ Buffer-Per-Packet transfers can be used for either bulk transactions or nonstreaming
isochronous transfers. The amount of data transferred for each packet is determined by
the FIFO size. Buffer per packet transfers are required if SmartDMA is used with packet
status stored in the FIFO descriptor (MODE = 101b in the xEPDEF3 register).
■ Buffer-Per-I/O Request Packet (IRP) transfers are similar to buffer-per-packet transfers,
except that a DMA FIFO contains multiple packets. In general, Buffer-per-IRP is simpler
to program for the normal case, but error handling is more complicated because DMA
must be restarted in the middle of the FIFO. Buffer per IRP transfers are highly
recommended for IN endpoints using a SmartDMA channel.
18.5.6.4 Short Packets
Short packets typically delineate the end of a USB I/O request packet (IRP). For example,
if the maximum packet size is 64 bytes, and a FIFO that is 260 bytes is to be transferred,
four full-length packets are transferred followed by a packet that contains only four bytes.
This delineation is very useful because it provides an “out-of-band” indication of where one
information FIFO ends and the next one starts. In fact, it is so useful that USB specifically
allows for zero-length packets, to ensure that this delineation can be performed even when
the FIFO size is a multiple of the maximum packet size.
The SmartDMA channel is fully capable of sending and receiving zero-length packets. (On
receive, it simply stores the byte count provided by the USB peripheral controller, which is
zero, and on transmit, a special signal from the SmartDMA controller indicates that the
packet has no data.)
With general-purpose DMA, receiving a zero-length packet is exactly the same as receiving
any other short packet—the USB should be set to stop on receipt of a short packet, and
the software examines the received length. Sending a zero-length packet is performed
differently because no data is transferred through the DMA controller. To send a short packet
of one byte or greater, simply program the DMA controller to send the desired count, after
programming the USB peripheral controller’s DMA mode to 011. In this mode, when the
DMA controller sends the last byte, the packet is sent, even if the USB FIFO is not full.
To send a zero-byte packet in general-purpose DMA mode, you must clear the NOT_ZERO
bit in the xEPCTL register, and then write one byte (of any value) to the endpoint’s FIFO.
CC For example, assume the Am186CC microcontroller’s HDLC controller is storing audio data
in a circular FIFO, and the USB peripheral controller is pulling audio data out of the FIFO.
Because USB operation happens in (nominally) 8 sample bursts, and PCM highway
operation happens one sample at a time, if the FIFO pointers ever overlapped, old data
could be transmitted intermixed with the new data, and the audio would be garbled. Likewise,
if the pointers get too far apart, excessive delay is introduced in the audio.
During normal operation, the pointers should stay a relatively constant distance apart.
However, it is possible to miss a frame’s worth of data on the USB, because isochronous
transfers are not guaranteed. When this occurs, the best that software can do is to adjust
the DMA pointers to keep the error localized as a single glitch in the audio, rather than let
it accumulate and cause excessive delay, or cause garbled audio (by the pointers repeatedly
crossing each other). It is probably also a good idea for a missed OUT transaction for USB
(PCM highway pipes) to inject silence into the FIFO for the duration of the missed
transaction, to minimize the annoyance of the audio glitch.
Adjusting the pointers is very straightforward on a general-purpose DMA circular FIFO (e.g.,
stop the DMA, add a constant to the pointer, and restart the DMA), but is more complicated
on the SmartDMA channel. If a SmartDMA channel is being used for isochronous data, the
simplest thing to do is to set it up so that there are two descriptors in the ring. Each descriptor
points to a portion of the circular FIFO. When a pointer needs to be adjusted, the DMA is
stopped, the current location (low order 16 bits) of the memory pointer is read from the
DMA hardware, a new value is calculated by adding or subtracting the adjustment from the
memory pointer, and the FIFO descriptors are updated so that the next one executed covers
the portion of the FIFO from the new memory pointer to the end of the FIFO, and the other
descriptor covers the portion of the FIFO from the start of the FIFO to the new pointer. Then
the DMA is restarted.
Note that, because such an adjustment could make one FIFO very small (e.g. one byte),
it is important to use the feature that allows DMA OWN bits to be reset. Otherwise, DMA
effectively stops and requires software intervention each time through the FIFOs, and there
is a latency requirement to service both the descriptors within a very short time period.
18.5.7 Isochronous Transfer Synchronization
The isochronous transfer type is required by audio, telephony, or other applications that
need real-time streaming delivery to avoid distortion. The USB configuration process
ensures that the data pipe from the host to an isochronous endpoint has enough bandwidth
to transfer the endpoint's maximum packet size in every frame, but the design must also
synchronize the data so it is delivered at the correct rate.
Isochronous synchronization involves converting the data stream from its sample rate (for
example, the 44.1-KHz rate of an audio CD player) into packets delivered at the fixed USB
start-of-frame (SOF) rate of 1 KHz (1000 frames per second). The USB specification defines
three types of isochronous synchronization:
■ Asynchronous: The data sample clock and the USB frame rate are independent of
each other. It is up to the host’s device driver and device software to convert the data
rate as needed. For example, a receiving endpoint’s software (host or device) can provide
feedback so the transmitting endpoint’s software can adjust the amount of isochronous
data sent in each frame.
■ Synchronous: The data sample rate is synchronized with the USB SOF rate so the
same amount of isochronous data can be transmitted in every frame. There are two
ways to achieve this:
– Lock the data source sample clock to the USB SOF rate. For example, a design can
route the microcontroller’s USBSOF output through a PLL to drive the sample clock
of an external codec. For more about the USBSOF signal, see “Isochronous
Synchronization Signals” on page 18-6.
– Request USB master client capability (through the USB driver basic host interface)
and then adjust the USB SOF rate to keep it synchronized with the sample clock. Only
one device can be the master client at a time, so devices that use this method must
be able to operate asynchronously if master client capability is denied.
■ Adaptive: The data sample clock can be freely adjusted to receive or transmit data at
any rate within a given range. The microcontroller’s Auto Rate feature (described in the
following section) allows isochronous IN endpoints to implement adaptive
synchronization with a variety of input sources.
The type of synchronization to use for an isochronous endpoint depends on the design
requirements and capabilities of the peripheral device. All of these synchronization types
make use of USB peripheral controller features described in the following section.
18.5.8 Isochronous Transfer Features
The USB peripheral controller provides full support for the Isochronous transfer type while
minimizing system resource overhead. A USB peripheral device using the Am186CC or
Am186CU microcontroller can easily support the isochronous data transfer in the IN
direction as an asynchronous, synchronous, or adaptive synchronous data source. These
features combined with the other integrated communications devices and DMA controller
allow many different communications and audio devices to be built with this device. The
following microcontroller features are provided to support isochronous transfers:
■ Missing-SOF Detection: The USB peripheral controller implements an adaptive
missing-SOF detection mechanism. A missing SOF packet is detected when the current
USB frame length is six USB bit times greater than the last frame in which a SOF packet
was successfully received.
Hardware indicates a missing SOF by setting the UISTAT2 register’s MS_SOF bit, which
software can enable as an interrupt source by setting the corresponding bit in the
UIMASK2 register.
■ SOF Generation: Whenever an SOF is detected, hardware sets the UISTAT2 register’s
SOF_GEN bit, which software can enable as an interrupt source by setting the
corresponding bit in the UIMASK2 register.
The SOF is also reflected on the controller’s USBSOF output signal, which is used in
the first method (lock the sample clock) of synchronous isochronous synchronization,
as described in “Isochronous Transfer Synchronization” on page 18-23.
If a missing SOF is detected, the USB peripheral controller automatically generates an
internal SOF, which is reflected by the SOF_GEN bit and the USBSOF signal. This allows
synchronous isochronous endpoints to remain locked to the USB clock even when the
SOF packet is corrupted on the bus.
■ USB Frame Position Monitoring: This allows the device software to detect any
difference between the sample rate of a data source and the USB frame rate. This is
required for an Isochronous IN endpoint that uses the second method (request USB
master client capability) for synchronous isochronous synchronization, as described in
“Isochronous Transfer Synchronization” on page 18-23.
CC In the Am186CC microcontroller, the SAM_CLK_SEL field in the ISCTL register can
select a sample rate clock source: either the USBSCI signal (on the UCLK pin) or the
frame synchronization signal used for HDLC Channel A, PCM Highway, and GCI.
During each USB frame, the FPMCNT register latches the USB frame position bit counter
after a specific number of source clocks are counted on the sample input. The value
latched in the FPMCNT register is the number of USB bit times counted during the source
clock interval specified in the BCNT_LRATE field of the ISCTL register (1–64 source
clocks, programmable in powers of two). Device software can compare these two values
to determine whether the USB frame rate and the source sample clock are moving
relative to each other.
If the device is granted master client capability, it is able to use the USB Device basic
host interface (defined in the USB specification) to gradually increase or decrease the
USB SOF rate to correct any drift with respect to the data source’s sample rate.
Whenever FPMCNT is updated, hardware sets the UISTAT2 register’s POS_UP bit,
which software can enable as an interrupt source by setting the corresponding bit in the
UIMASK2 register.
■ Auto Rate: This allows the designer to implement adaptive synchronization on an
isochronous IN endpoint using general-purpose DMA or SmartDMA to handle an
arbitrary data source rate. The Auto Rate feature uses the data source’s sample rate
clock (frame rate) as an input to automatically control the number of data bytes sent to
the USB host during each transaction.
CC In the Am186CC microcontroller, the SAM_CLK_SEL field in the ISCTL register can
select a sample rate clock source: either the USBSCI signal (on the UCLK pin) or the
frame synchronization clock (FSC) signal used for HDLC Channel A, PCM Highway, and
GCI.
The BYTES_SAM field in ISCTL sets the number of bytes to move per source clock
sample (1, 2, or 4 bytes). Also make sure that the Max Packet Size programmed for the
endpoint is greater than or equal to the largest number of data bytes that the endpoint
might need to move during a USB transaction.
After the sample clock source and bytes per sample are selected, set the
AUTO_RATE_EN bit in the xEPDEF3 register (where x = A, B, C, or D) to enable auto
rate for the endpoint.
The specified number of bytes is transferred on each sample clock as long as data is
present in the endpoint’s FIFO, or is sequentially written to the FIFO as needed during
the transaction.
■ Start of Frame and Frame Number Monitoring: The USB peripheral controller
monitors the USB SOF packet and latches the frame number value into the Time Stamp
(TSTMP) register upon successfully receiving the SOF packet from the USB host.
Software can arm the Time Stamp Match (TSTMPM) register by writing a specific USB
frame number to it. Then, when the USB peripheral controller receives an SOF packet
with a number greater or equal to the written value, hardware sets the UISTAT2 register’s
TSTMP_M bit, which software can enable as an interrupt by setting the corresponding
bit in UIMASK2. The interrupt does not occur again until TSTMP_M is cleared in UISTAT2
and TSTMPM is written again.
This mechanism allows software to start a certain data pattern during a specific USB
frame, if required. This feature can be used for asynchronous USB data sources using
implicit data pattern generation.
18.5.9 Command Handling
The primary function of the device’s control endpoint is to accept and respond to commands
issued to it by the USB host. All of the USB standard, device class, and vendor specific
commands are issued to the control endpoint known as the device endpoint 0. The USB
peripheral controller hardware handles some of these commands without requiring that the
device software decode and specifically “handle” the command. Other commands are
received from the USB host and passed on to the device software for processing. These
commands and how they are handled are outlined in the following sections.
18.5.9.1 Commands Handled by Device Software
Table 18-5 on page 18-27 describes the commands that must be handled by the device
software.
When any command is received by the USB peripheral controller, hardware sets the
NEW_COMMAND bit in the CNTCTL register. If the device software must take some action,
the ACT_REQ bit is also set in the affected endpoint’s xEPCTL register.
The NEW_COMMAND bit and all of the ACT_REQ bits have mirror bits in the UISTAT1
register. (A mirror bit is set whenever the corresponding status bit is set.) Each mirror bit
can be enabled as an interrupt source by setting the corresponding bit in the UIMASK1
register.
The software is then required to decode the command data and either:
■ Accept subsequent data associated with the command (for OUT commands). When it
is finished handling an OUT command, software must clear the COMMAND_BUSY bit
in the CNTCTL register to indicate that it is ready to process more commands.
■ Return the appropriate data requested in the command (for IN commands). The USB
peripheral controller hardware automatically clears the COMMAND_BUSY bit in the
CNTCTL register when it finishes transmitting the requested data.
All of the low-level USB protocol processing is handled entirely in hardware (that is, all
handshake packets are accepted from or returned to the USB host automatically).
software clears the ACT_REQ bit when it has filled the FIFO with information to go to the
host, and hardware sets the ACT_REQ bit after the information has safely made it to the
host.
The host can send a new command at any time, so the NEW_COMMAND bit provides a
somewhat less “polite” method for the hardware to inform the software of who “owns” the
FIFO. When a SETUP packet is detected (before it is written to the FIFO), the hardware
clears the ACT_REQ bit, and sets the NEW_COMMAND bit, to show that the hardware
“stole” ownership from the software.
Because the software could be busy trying to update the FIFO and/or the ACT_REQ,
EP_NOT_STALLED, or COMMAND_BUSY bits, the host locks out accesses to the FIFO
and these bits whenever NEW_COMMAND is set. Attempts by software to read or write
the FIFO, or to alter these bits, fail silently.
When a command is received that software must handle, it is stored in the FIFO and then
the ACT_REQ bit is set to indicate that the FIFO contains valid data.
18.5.10.1 Data Transfer Using the Control Endpoint
The control endpoint can transfer data, but there are several potential problems.
At the end of control read data transfers, it is impossible for the software to know whether
the host accepted the most recent data sent, or whether it sent the status stage before
accepting the data. For USB commands, it is not an error for the host to terminate a
command early. For example, it can ask to read descriptors, and enter the status phase
before it has finished reading all the descriptors. This is problematic for data transfers, and
the only real way around it is for the host to transmit information in the SETUP packet that
describes where in the data stream it wishes to start reading.
At the end of control write data transfers, it is impossible for the software to know whether
the device successfully completed the status phase, or whether a new setup packet aborted
the status phase. As with the control read problem, this problem can be alleviated by the
host sending information in the command packet about where in the data stream this write
should start.
18.5.10.2 Control Endpoint Interrupts
The ACT_REQ bit and the NEW_COMMAND bit are reflected in the UISTAT1 register as
the CNT_EP_ACT and CNT_EP_NEW bits. Software can mask off these interrupts in the
UIMASK1 register. Most applications use only the CNT_EP_ACT interrupt, but some
applications may find it advantageous to use the CNT_EP_NEW interrupt. This interrupt is
useful if the system spawns a new task to deal with data transactions. In this case, the
software could use a CNT_EP_NEW interrupt to spawn the task dealing with the aborted
command.
18.5.11 Interrupt Endpoint Programming
The microcontroller's USB interface contains one interrupt endpoint. The purpose of an
interrupt endpoint is to allow small amounts of data to be transferred from the device to the
host. According to section 4.7.3 of the USB Specification, “A small, spontaneous data
transfer from a device is referred to as interrupt data. Such data can be presented for transfer
by a device at any time, and is delivered by the USB at a rate no slower than as is specified
by the device. Interrupt data typically consists of event notification, characters, or
coordinates that are organized as one or more bytes. An example of interrupt data is the
coordinates from a pointing device. Although an explicit timing rate is not required,
interactive data may have response time bounds that the USB must support.”
1–64 bytes
Max. Packet Size 8, 16, 32, or 1–1023 8, 16, 32, or 1–1023
(8 16, 32, or
(Endpoints C and D) 64 bytes bytes 64 bytes bytes
64 for bulk)
System Parameters
Polled I/O
Data Handling or Interrupt General-Purpose DMA SmartDMA Channel
Driven
FIFO Depth
8 or 16 bytes
(Endpoints A and B)
FIFO Depth
8, 16, 32, or 64 bytes
(Endpoints C and D)
Notes:
1. A 24-MHz processor clock is not fast enough for software to keep up with 1023-byte isochronous
IN or OUT packets using only an 8, 16, or 32-byte FIFO. If a 24-MHz processor clock is used and a
Max Packet Size of 1023 bytes is required for isochronous data, use endpoint C or D and set the
FIFO size to 64 bytes.
A REGISTER SUMMARY
Table A-1 on page A-2 provides a summary of all the Am186CC/CH/CU microcontrollers’
peripheral control block (PCB) registers, listed in offset order. The table includes the
following information for each register:
■ Abbreviated name
■ Register description page number
■ Relative offset from the PCB base (set in RELOC)
■ Default location in I/O space (equal to the default PCB base of FC00h plus the register’s
relative offset)
■ Default value at reset
■ Bit and field names and layout
An “x” in the default value column denotes a digit for which the default value is not defined.
A “?” indicates that the digit’s value depends on external inputs. If a digit contains both
undefined and external input bits, a “?” is used.
If more than one default value is given for a register, it contains one or more bits with
undefined defaults. In this case either value might be present.
If a group of registers is not supported on all the Am186CC/CH/CU microcontrollers, the
group heading indicates the controllers that support that group of registers. An exclamation
point (!) following a specific bit or register name indicates that additional controller-specific
information can be found in the individual register or bit description.
HATCON0 02h FC02h 0000h Res TTHRSH Res TFIFOEN FORABR HTEN IMSTART CRCDIS LBREAD LBNOW
HATCON1 04h FC04h 0000h Res FLAGIDL MLTDRP AUTOCTS TMSBF TXCINV GCIDEN ODRV TDELAY
HARCON0 06h FC06h 0000h Res RTHRSH RCPST RMSBF RXCINV RREJECT RSTOP HREN MINRL
0010h
Am186™CC/CH/CU Microcontrollers User’s Manual
HASTATE 0Ah FC0Ah Res CTSS RTRS ABORTS MARKIS FLAGS FRAMES
0030h
HAISTAT0 0Ch FC0Ch 0000h Res REOF RTHRES RDATA1 TTHRES TDATA1 Res FABRST CTSLST TUFLO TGOODF TSTOP
HAIMSK0 0Eh FC0Eh 0000h Res REOF RTHRES RDATA1 TTHRES TDATA1 Res FABRST CTSLST TUFLO TGOODF TSTOP
HAISTAT1 10h FC10h 0000h Res MAMC SFMC SHORT VSHORT RTRDES ROFLO ABORTE MARKIE FLAGE FRAMEE
HAIMSK1 12h FC12h 0000h Res MAMC SFMC SHORT VSHORT RTRDES ROFLO ABORTE MARKIE FLAGE FRAMEE
Register Summary
HARD 16h FC16h 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 RDATA
HARFS1 (16h) (FC16h) 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 FBCNT[7–0]
HARFS2 (16h) (FC16h) 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 FBCNT[15–8]
HARFS3 (16h) (FC16h) 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 FRAM FOFLO CRCE MTCH FABORT FLONG FSHORT
HARDP 18h FC18h 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 RDATA
! = See the register or bit description in the Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916, for controller-specific details.
Table A-1 Am186CC/CH/CU Microcontrollers Register Summary (Continued)
DEFAULT DEFAULT
NAME OFFSET
LOCATION VALUE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
HBTCON0 42h FC42h 0000h Res TTHRSH Res TFIFOEN FORABR HTEN IMSTART CRCDIS LBREAD LBNOW
HBTCON1 44h FC44h 0000h Res FLAGIDL MLTDRP AUTOCTS TMSBF TXCINV GCIDEN ODRV TDELAY
HBRCON0 46h FC46h 0000h Res RTHRSH RCPST RMSBF RXCINV RREJECT RSTOP HREN MINRL
0010h
HBSTATE 4Ah FC4Ah Res CTSS RTRS ABORTS MARKIS FLAGS FRAMES
Am186™CC/CH/CU Microcontrollers User’s Manual
0030h
HBISTAT0 4Ch FC4Ch 0000h Res REOF RTHRES RDATA1 TTHRES TDATA1 Res FABRST CTSLST TUFLO TGOODF TSTOP
HBIMSK0 4Eh FC4Eh 0000h Res REOF RTHRES RDATA1 TTHRES TDATA1 Res FABRST CTSLST TUFLO TGOODF TSTOP
HBISTAT1 50h FC50h 0000h Res MAMC SFMC SHORT VSHORT RTRDES ROFLO ABORTE MARKIE FLAGE FRAMEE
HBIMSK1 52h FC52h 0000h Res MAMC SFMC SHORT VSHORT RTRDES ROFLO ABORTE MARKIE FLAGE FRAMEE
Register Summary
HBRD 56h FC56h 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 RDATA
HBRFS1 (56h) (FC56h) 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 FBCNT[7–0]
HBRFS2 (56h) (FC56h) 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 FBCNT[15–8]
HBRFS3 (56h) (FC56h) 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 FRAM FOFLO CRCE MTCH FABORT FLONG FSHORT
HBRDP 58h FC58h 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 RDATA
! = See the register or bit description in the Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916, for controller-specific details.
A-3
Table A-1 Am186CC/CH/CU Microcontrollers Register Summary (Continued)
A-4
DEFAULT DEFAULT
NAME OFFSET
LOCATION VALUE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
HCTCON0 82h FC82h 0000h Res TTHRSH Res TFIFOEN FORABR HTEN IMSTART CRCDIS LBREAD LBNOW
HCTCON1 84h FC84h 0000h Res FLAGIDL MLTDRP AUTOCTS TMSBF TXCINV GCIDEN ODRV TDELAY
HCRCON0 86h FC86h 0000h Res RTHRSH RCPST RMSBF RXCINV RREJECT RSTOP HREN MINRL
0010h
HCSTATE 8Ah FC8Ah Res CTSS RTRS ABORTS MARKIS FLAGS FRAMES
Am186™CC/CH/CU Microcontrollers User’s Manual
0030h
HCISTAT0 8Ch FC8Ch 0000h Res REOF RTHRES RDATA1 TTHRES TDATA1 Res FABRST CTSLST TUFLO TGOODF TSTOP
HCIMSK0 8Eh FC8Eh 0000h Res REOF RTHRES RDATA1 TTHRES TDATA1 Res FABRST CTSLST TUFLO TGOODF TSTOP
HCISTAT1 90h FC90h 0000h Res MAMC SFMC SHORT VSHORT RTRDES ROFLO ABORTE MARKIE FLAGE FRAMEE
HCIMSK1 92h FC92h 0000h Res MAMC SFMC SHORT VSHORT RTRDES ROFLO ABORTE MARKIE FLAGE FRAMEE
Register Summary
HCRD 96h FC96h 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 RDATA
HCRFS1 (96h) (FC96h) 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 FBCNT[7–0]
HCRFS2 (96h) (FC96h) 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 FBCNT[15–8]
HCRFS3 (96h) (FC96h) 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 FRAM FOFLO CRCE MTCH FABORT FLONG FSHORT
HCRDP 98h FC98h 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 RDATA
! = See the register or bit description in the Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916, for controller-specific details.
Table A-1 Am186CC/CH/CU Microcontrollers Register Summary (Continued)
DEFAULT DEFAULT
NAME OFFSET
LOCATION VALUE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
HDTCON0 C2h FCC2h 0000h Res TTHRSH Res TFIFOEN FORABR HTEN IMSTART CRCDIS LBREAD LBNOW
HDTCON1 C4h FCC4h 0000h Res FLAGIDL MLTDRP AUTOCTS TMSBF TXCINV GCIDEN ODRV TDELAY
HDRCON0 C6h FCC6h 0000h Res RTHRSH RCPST RMSBF RXCINV RREJECT RSTOP HREN MINRL
0010h
HDSTATE CAh FCCAh Res CTSS RTRS ABORTS MARKIS FLAGS FRAMES
Am186™CC/CH/CU Microcontrollers User’s Manual
0030h
HDISTAT0 CCh FCCCh 0000h Res REOF RTHRES RDATA1 TTHRES TDATA1 Res FABRST CTSLST TUFLO TGOODF TSTOP
HDIMSK0 CEh FCCEh 0000h Res REOF RTHRES RDATA1 TTHRES TDATA1 Res FABRST CTSLST TUFLO TGOODF TSTOP
HDISTAT1 D0h FCD0h 0000h Res MAMC SFMC SHORT VSHORT RTRDES ROFLO ABORTE MARKIE FLAGE FRAMEE
HDIMSK1 D2h FCD2h 0000h Res MAMC SFMC SHORT VSHORT RTRDES ROFLO ABORTE MARKIE FLAGE FRAMEE
Register Summary
HDRD D6h FCD6h 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 RDATA
HDRFS1 (D6h) (FCD6h) 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 FBCNT[7–0]
HDRFS2 (D6h) (FCD6h) 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 FBCNT[15–8]
HDRFS3 (D6h) (FCD6h) 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 FRAM FOFLO CRCE MTCH FABORT FLONG FSHORT
HDRDP D8h FCD8h 00xxh STAT1A STAT0A STATNUM RTHRES RDATA1 TTHRES TDATA1 RDATA
! = See the register or bit description in the Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916, for controller-specific details.
A-5
Table A-1 Am186CC/CH/CU Microcontrollers Register Summary (Continued)
A-6
DEFAULT DEFAULT
NAME OFFSET
LOCATION VALUE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Register Summary
GD1DSTL 118h FD18h 0000h DDA[15–0]
GD1DSTH 11Ah FD1Ah 0000h Res DDA[19–16]
GD1TC 11Ch FD1Ch 0000h TC
! = See the register or bit description in the Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916, for controller-specific details.
Table A-1 Am186CC/CH/CU Microcontrollers Register Summary (Continued)
DEFAULT DEFAULT
NAME OFFSET
LOCATION VALUE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
GD3TC 13Ch FD3Ch 0000h TC
SD0STAT 14Ah FD4Ah 0000h Res TEP TBU TTC REP RBU RTC Res
SD0CBD 14Ch FD4Ch 0000h Res CRBD Res CTBD
SD0CTAD 14Eh FD4Eh 0000h CTAD
SD0CRAD 150h FD50h 0000h CRAD
Register Summary
SD1CON 158h FD58h 0000h Res TEPI TBUI TTCI REPI RBUI RTCI TXSO RXSO P POLL Res TXST RXST
SD1TRCAL 15Ah FD5Ah 0000h TRA[15–4] Res TRC
SD1TRAH 15Ch FD5Ch 0000h Res TRA[19–16]
SD1RRCAL 15Eh FD5Eh 0000h RRA[15–4] Res RRC
SD1RRAH 160h FD60h 0000h Res RRA[19–16]
SD1STAT 162h FD62h 0000h Res TEP TBU TTC REP RBU RTC Res
SD1CBD 164h FD64h 0000h Res CRBD Res CTBD
SD1CTAD 166h FD66h 0000h CTAD
SD1CRAD 168h FD68h 0000h CRAD
! = See the register or bit description in the Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916, for controller-specific details.
A-7
Table A-1 Am186CC/CH/CU Microcontrollers Register Summary (Continued)
A-8
DEFAULT DEFAULT
NAME OFFSET
LOCATION VALUE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SD2CRAD 180h FD80h 0000h CRAD
SD3STAT 192h FD92h 0000h Res TEP TBU TTC REP RBU RTC Res
SD3CBD 194h FD94h 0000h Res CRBD Res CTBD
SD3CTAD 196h FD96h 0000h CTAD
SD3CRAD 198h FD98h 0000h CRAD
Register Summary
D_EP_ D_EP_ C_EP_ C_EP_ B_EP_ B_EP_ A_EP_ A_EP_ OTHER_ INT_EP_ CNT_EP_ CNT_EP_
UISTAT1 1E0h FDE0h 0000h Res
STATINT ACT STATINT ACT STATINT ACT STATINT ACT INT ACT NEW ACT
D_EP_ D_EP_ C_EP_ C_EP_ B_EP_ B_EP_ A_EP_ A_EP_ INT_EP_ CNT_EP_ CNT_EP_
UIMASK1 1E2h FDE2h 0008h Res
STATINT ACT STATINT ACT STATINT ACT STATINT ACT
OI_UNM
ACT NEW ACT
UISTAT2 1E4h FDE4h 0000h USB_RST USB_SUS USB_RES Res TSTMP_M POS_UP SOF_GEN MS_SOF
UIMASK2 1E6h FDE6h 0000h USB_RST USB_SUS USB_RES Res TSTMP_M POS_UP SOF_GEN MS_SOF
USBMFR 1E8h FDE8h 0008h Res PUP_XCVER SUSP S_RES S_POWER DIS_XCVER RWAKE RWAKE_EN
! = See the register or bit description in the Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916, for controller-specific details.
Table A-1 Am186CC/CH/CU Microcontrollers Register Summary (Continued)
DEFAULT DEFAULT
NAME OFFSET
LOCATION VALUE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
NOT_
EP_NOT_ NOT_ NOT_ ISO_ ISO_ FULL_ SHORT_ OTHER_
AEPCTL 220h FE20h 0000h EP_EN
STALLED FLUSH
ACT_REQ STAT_INT Res
ZERO
LAST_ Res
START STOP
ISO_MS
PKT PKT
BUF_ERR
ERR
BYTE
Register Summary
AEPDEF1 22Ah FE2Ah 2006h EP_NUM EP_CFG Res EP_INT Res EP_ASET EP_DIR EP_TYPE
FIFO_
AEPDEF2 22Ch FE2Ch 0408h Res EP_MX_PCT
SIZE
AUTO_ ISO_MS_ FULL_PKT_ SHRT_PKT_ BUF_ERR_ OTH_ERR_ ISO_MS_ FULL_PKT_ SHRT_PKT_ BUF_ERR_ OTH_ERR_
AEPDEF3 22Eh FE2Eh 0018h Res RATE_EN IMSK IMSK IMSK IMSK IMSK
MODE SMSK SMSK SMSK SMSK SMSK
DEFAULT DEFAULT
NAME OFFSET
LOCATION VALUE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
! = See the register or bit description in the Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916, for controller-specific details.
A-9
Table A-1 Am186CC/CH/CU Microcontrollers Register Summary (Continued)
A-10
DEFAULT DEFAULT
NAME OFFSET
LOCATION VALUE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CEPDEF1 24Ah FE4Ah 4006h EP_NUM EP_CFG Res EP_INT Res EP_ASET EP_DIR EP_TYPE
CEPDEF2 24Ch FE4Ch 0C08h Res FIFO_SIZE EP_MX_PCT
AUTO_ ISO_MS_ FULL_PKT_ SHRT_PKT_ BUF_ERR_ OTH_ERR_ ISO_MS_ FULL_PKT_ SHRT_PKT_ BUF_ERR_ OTH_ERR_
CEPDEF3 24Eh FE4Eh 0018h Res RATE_EN IMSK IMSK IMSK IMSK IMSK
MODE SMSK SMSK SMSK SMSK SMSK
Register Summary
EP_NOT_ NOT_ NOT_ ISO_ ISO_ FULL_ SHORT_ OTHER_
DEPCTL 250h FE50h 0000h EP_EN
STALLED FLUSH
ACT_REQ STAT_INT Res
ZERO
LAST_ Res
START STOP
ISO_MS
PKT PKT
BUF_ERR
ERR
BYTE
DEFAULT DEFAULT
NAME OFFSET
LOCATION VALUE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
! = See the register or bit description in the Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916, for controller-specific details.
Table A-1 Am186CC/CH/CU Microcontrollers Register Summary (Continued)
DEFAULT DEFAULT
NAME OFFSET
LOCATION VALUE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
HSPRXDP 26Ch FE6Ch 0000h RDR THRE FER OER PER MATCH BRK AB RDATA
HSPBDV 26Eh FE6Eh 0000h BAUDDIV
HSPM0 270h FE70h 0000h MCHR1 MCHR0
HSPM1 272h FE72h 0000h MCHR3 MCHR2
HSPM2 274h FE74h 0000h MCHR5 MCHR4
HSPAB0 276h FE76h 0000h ABDIV0 ABTHRSH0
Register Summary
HSPAB1 278h FE78h 0000h ABDIV1 ABTHRSH1
HSPAB2 27Ah FE7Ah 0000h ABDIV2 ABTHRSH2
HSPAB3 27Ch FE7Ch 0000h ABDIV3 ABTHRSH3
! = See the register or bit description in the Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916, for controller-specific details.
A-11
Table A-1 Am186CC/CH/CU Microcontrollers Register Summary (Continued)
A-12
DEFAULT DEFAULT
NAME OFFSET
LOCATION VALUE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Register Summary
GCIRD1 2B6h FEB6h 003Fh Res CI1R
GCIRD1P 2B8h FEB8h 003Fh Res CI1P
GMTD 2BAh FEBAh 00FFh Res MON01T
GMRD 2BCh FEBCh 0000h Res MON01R
GMRDP 2BEh FEBEh 0000h Res MON01P
! = See the register or bit description in the Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916, for controller-specific details.
Table A-1 Am186CC/CH/CU Microcontrollers Register Summary (Continued)
DEFAULT DEFAULT
NAME OFFSET
LOCATION VALUE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Register Summary
CH1CON 302h FF02h 000Fh Res LTM MSK PR
CH2CON 304h FF04h 000Fh Res SRC ! LTM MSK PR
CH3CON 306h FF06h 000Fh Res SRC LTM MSK PR
CH4CON ! 308h FF08h 003Fh Res MSK PR
CH5CON ! 30Ah FF0Ah 003Fh Res MSK PR
CH6CON ! 30Ch FF0Ch 003Fh Res MSK PR
CH7CON ! 30Eh FF0Eh 003Fh Res MSK PR
CH8CON 310h FF10h 000Fh Res SRC ! LTM MSK PR
CH9CON 312h FF12h 000Fh Res SRC LTM MSK PR
CH10CON 314h FF14h 000Fh Res SRC LTM MSK PR
CH11CON 316h FF16h 000Fh Res SRC LTM MSK PR
CH12CON 318h FF18h 000Fh Res LTM MSK PR
CH13CON 31Ah FF1Ah 000Fh Res LTM MSK PR
CH14CON 31Ch FF1Ch 001Fh Res MSK PR
EOI 320h FF20h 0000h NSPEC Res S
POLL 322h FF22h 0000h IREQ Res S
POLLST 324h FF24h 0000h IREQ Res S
IMASK 326h FF26h FFFFh Res CH14 CH13 CH12 CH11 CH10 CH9 CH8 CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0
PRIMSK 328h FF28h 0007h Res PRM
DEFAULT DEFAULT
NAME OFFSET
LOCATION VALUE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
A-13
! = See the register or bit description in the Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916, for controller-specific details.
Table A-1 Am186CC/CH/CU Microcontrollers Register Summary (Continued)
A-14
DEFAULT DEFAULT
NAME OFFSET
LOCATION VALUE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
INSERV 32Ah FF2Ah 0000h Res CH14 CH13 CH12 CH11 CH10 CH9 CH8 CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0
REQST 32Ch FF2Ch 0000h Res CH14 CH13 CH12 CH11 CH10 CH9 CH8 CH7 CH6 CH5 CH4 CH3 CH2 CH1 CH0
INTSTS 32Eh FF2Eh 0000h Res DMA3 DMA2 DMA1 DMA0 TIM2 TIM1 TIM0
DMAHLT 330h FF30h 0000h DHLT Res
SHREQ 332h FF32h 0000h PIO35 PIO34 PIO33 PIO30 PIO29 PIO27 PIO15 PIO5 INT7 INT6 INT5 INT4 INT3 INT2 INT1 Res
SHMASK 334h FF34h FFFFh PIO35 PIO34 PIO33 PIO30 PIO29 PIO27 PIO15 PIO5 INT7 INT6 INT5 INT4 INT3 INT2 INT1 Res
INTPOL 336h FF36h FFFFh Res INT8 INT7 INT6 INT5 INT4 INT3 INT2 INT1 INT0
Am186™CC/CH/CU Microcontrollers User’s Manual
PIOPOL 338h FF38h FFFFh PIO35 PIO34 PIO33 PIO30 PIO29 PIO27 PIO15 PIO5 Res
Timer Registers
T0CON 340h FF40h 0000h EN INH INT RIU Res MC RTG P EXT ALT CONT
T0CNT 342h FF42h 0000h TC
T0CMPA 344h FF44h 0000h TC
T0CMPB 346h FF46h 0000h TC
Register Summary
T1CON 348h FF48h 0000h EN INH INT RIU Res MC RTG P EXT ALT CONT
T1CNT 34Ah FF4Ah 0000h TC
T1CMPA 34Ch FF4Ch 0000h TC
T1CMPB 34Eh FF4Eh 0000h TC
T2CON 350h FF50h 0000h EN INH INT Res MC Res CONT
T2CNT 352h FF52h 0000h TC
T2CMPA 354h FF54h 0000h TC
! = See the register or bit description in the Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916, for controller-specific details.
Table A-1 Am186CC/CH/CU Microcontrollers Register Summary (Continued)
DEFAULT DEFAULT
NAME OFFSET
LOCATION VALUE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Register Summary
47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
PIODIR2 3D6h FFD6h FFF1h PDIR47 PDIR46 PDIR45 PDIR44 PDIR43 PDIR42 PDIR41 PDIR40 PDIR39 PDIR38 PDIR37 PDIR36 PDIR35 PDIR34 PDIR33 PDIR32
PIODATA2 3D8h FFD8h ????h PDATA47 PDATA46 PDATA45 PDATA44 PDATA43 PDATA42 PDATA41 PDATA40 PDATA39 PDATA38 PDATA37 PDATA36 PDATA35 PDATA34 PDATA33 PDATA32
PIOSET2 3DAh FFDAh 0000h PSET47 PSET46 PSET45 PSET44 PSET43 PSET42 PSET41 PSET40 PSET39 PSET38 PSET37 PSET36 PSET35 PSET34 PSET33 PSET32
PIOCLR2 3DCh FFDCh 0000h PCLR47 PCLR46 PCLR45 PCLR44 PCLR43 PCLR42 PCLR41 PCLR40 PCLR39 PCLR38 PCLR37 PCLR36 PCLR35 PCLR34 PCLR33 PCLR32
Miscellaneous Registers
SYSCON 3F0h FFF0h 0000h Res DSDEN PWD DISMEM DISIO ITF4 ! EXSYNC ! Res DISCLK Res
PRL 3F4h FFF4h 4001h PRL
RELOC 3FEh FFFEh 20FCh DUAL Res M/IO R[19–10] Res
DEFAULT DEFAULT
NAME OFFSET
LOCATION VALUE 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
! = See the register or bit description in the Am186™CC/CH/CU Microcontrollers Register Set Manual, order #21916, for controller-specific details.
A-15
Register Summary
A break
During serial communications, a constant Low signal on
A bus the receive data line for one frame time or greater. In the
Nonmultiplexed address bus. Am186CC/CH/CU microcontrollers, this is reported as a
zero character with the framing error (FER) and break
ACK
(BRK) status bits set in the (H)SPSTAT register.
Acknowledgment.
BRI
AD bus
Basic rate interface.
Multiplexed address and data bus.
buffer
ADCCP
(1) A routine or storage space used to compensate for
Advanced data communication control procedures.
a difference in rate of data flow, or time of occurrence of
ADSL events, when transferring data from one device to
Asymmetrical digital subscriber line. See DSL. another. (2) A portion of storage space used to tempo-
rarily hold input or output data.
ANSI
American national standards institute. buffer queue
A block of memory to which data is written or from which
asynchronous data is read during a DMA transfer. Software specifies
Pertaining to two or more processes that do not depend the length and base address of the buffer queue. The
on the occurrence of specific events such as common DMA transfer writes data to each byte or word of the
timing signals. buffer queue until it reaches the end of the transfer or
the end of the buffer queue. Compare to circular buffer.
asynchronous transmission
Data transmission in which each information character buffer descriptor ring
is individually synchronized (usually by the use of start See descriptor ring.
and stop elements). Compare to synchronous transmis-
sion and isochronous transmission. bulk transfer
A nonperiodic data transmission process that typically
AT interface consists of large bursts of information. Bulk transmis-
A method of communicating with and controlling sion is typically used for a transfer that can use any
modems. Developed by Hayes Microcomputer Prod- available bandwidth and also can be delayed until band-
ucts, the AT Command Set has become a de facto width is available.
standard most modems are designed to use.
byte
A group of eight adjacent binary digits (bits).
B
bit stuffing
Adding bits to a transmitted message to round out a C
fixed frame or to break up a pattern of data bits that CCIT
could be misconstrued as control codes. Also called International telegraph and telephone consultative
zero-bit insertion. Compare to bit unstuffing. committee.
bit unstuffing circular buffer
Deleting bits from a received message to remove any A block of memory to which data is written or from which
bits added to round out a fixed frame or to break up a data is read during a DMA transfer. Software specifies
pattern of data bits that could be misconstrued as con- the length and base address of the circular buffer. The
trol codes. Also called zero-bit deletion. Compare to bit DMA transfer writes data to or reads data from each
stuffing. byte or word of the circular buffer. If the transfer reaches
the end of the buffer, the DMA control hardware points
back to the beginning of the buffer and continues writing data transparency
or reading data. Sometimes called a ring buffer. Com- A data stream that happens to contain a data sequence
pare to buffer queue. that is the same as a flag, mark, or abort sequence is
disguised during transmission so it is not misconstrued
CO as an actual flag, mark, or abort. See also bit stuffing
Central office. and bit unstuffing.
codec DCE
Coder-decoder. Also referred to as a compressor- Data communications equipment. Any device that con-
decompressor. Any technology used to encode (or com- nects a computer to a network, such as a modem. See
press) and decode (or decompress) data, which can be also raw DCE.
done with hardware, software, or any combination of the
two. Typically used for digital audio or video data default address
streams. An address defined by the USB specification and used
by a USB device when it is first powered on or reset. The
control endpoint default address is 00h.
A USB endpoint used to transfer USB commands and
device configuration data between the host and device. descriptor ring
The control endpoint is common to, and is required by, A block of memory that the CPU and software use to
all USB device class specifications. The control end- control and describe data buffers.
point features are not programmable. Compare to
interrupt endpoint and data endpoint. destination-synchronized transfer
See synchronized transfer.
CPU
Central processing unit. The control unit or micropro- device
cessor of a computer system. See USB device.
G I
GCI ICE
General circuit interface, also called IOM-2. One of the In-circuit emulator. A device for testing and program-
external interfaces supported by the Am186CC commu- ming an integrated circuit outside of any actual system
nications controller HDLC channels. GCI is an interface in which the device will be used.
specification developed jointly by Alcatel, Italtel, GPT,
and Siemens. This specification defines an industry internal peripherals
standard serial bus for interconnecting telecommunica- Components on a microcontroller integrated circuit
tions integrated circuits. The standard covers linecard, other than the embedded CPU that provide control over
NT1, and terminal architectures for Integrated Services some specific function. On the Am186CC/CH/CU
Digital Network (ISDN) applications. The Am186CC microcontrollers, internal peripherals would include but
communications controller supports the terminal ver- not be limited to the HDLC controller, the DMA control-
sion of GCI. GCI on the Am186CC communications ler, the USB peripheral controller, and the DRAM
controller supports polled and interrupt modes, but does controller. For lists of the internal peripherals in the
not support DMA mode. See IOM-2. Am186CC/CH/CU microcontrollers, see “Features” on
page 1-1.
general-purpose DMA
The term used to describe standard or typical DMA pro- internal reset
cessing as opposed to DMA processing using the The reset of the Am186CC communications controller
SmartDMA channels in the Am186CC/CH/CU micro- initiated by the watchdog timer. Compare to external
controllers. See also DMA and SmartDMA. reset and system reset.
interrupt
A command or signal that tells the processor to stop
H what it is doing and wait for further instruction. The inter-
half duplex rupt may require the processor to suspend its current
The ability of a serial communications connection to job and perform another function that is more pressing.
transmit data in both directions, but not at the same interrupt channel
time. Compare to full duplex. The group of logic that is comprised of a control register,
hardware interrupt an in-service bit, a request bit, and a mask bit. The inter-
Any one of the maskable interrupts, or an NMI or watch- rupt channel controls the behavior of a maskable
dog timer interrupt. When a hardware interrupt is interrupt.
generated, the IF flag is cleared unless in polled mode. interrupt endpoint
Compare to software interrupt. A USB endpoint used for small data transfers that in the
HDLC past have been interrupt-driven. The interrupt endpoint
High-level data link control. A very common bit-oriented is polled at a regular programmable interval to allow the
data link protocol (OSI layer 2) issued by ISO. Similar device to transfer interrupt data such as event notifica-
protocols are ADCCP, LAP-B, and SDLC. The tion, keyboard characters, and pointing device
Am186CC communications controller provides four coordinates to the host. Compare to control endpoint
HDLC channels. The HDLC channels support full- and data endpoint.
duplex transfers in polled, interrupt, and DMA modes. interrupt latency
HOLD latency The time period between an interrupt request and the
The time between a HOLD request and the HOLD servicing of the interrupt. See also latency, DMA
acknowledge. latency, and HOLD latency.
interrupt source
Any source (internal or external) that can request an
interrupt. This can be a physical pin, or an on-chip
peripheral.
interrupt transfer
One of four USB transfer types. Interrupt transfers have
L
the following characteristics: small data, nonperiodic, LANCE
low frequency, and bounded latency. They are device- Local area network controller for ethernet.
initiated communications typically used to notify the
LAP-B
host of device service needs.
Link access procedure, balanced.
interrupt type
LAP-D
An eight-bit number assigned to each discrete interrupt
Link access procedure, D channel.
(see Table 7-3 on page 7-12). Each interrupt type does
not need a unique interrupt channel; one interrupt chan- latency
nel can support more than one interrupt type. However, A time period for an event to cause another event. See
if two interrupt types are supported by one channel, also interrupt latency, DMA latency, and HOLD latency.
then those two types have the same level of program-
mable priority. LSB
Least significant bit.
interrupt vector address
Equals the interrupt type times four and is the location
in the interrupt vector table that stores the address of
the interrupt service routine for each interrupt type.
M
maskable interrupt
interrupt vector table An interrupt that can be enabled (unmasked) or dis-
A memory area of 1 Kbyte beginning at address 00h abled (masked) by setting or clearing a bit in the
that contains up to 256 four-byte interrupt vector appropriate mask register. Maskable interrupts as a
addresses. group are enabled and disabled by setting or clearing
the Interrupt-Enable Flag (IF) in the Processor Status
IOM-2 Flags (FLAGS) register. Nonmaskable interrupts are not
ISDN-oriented modular interface, revision 2. See GCI. affected by this bit setting.
ISDN message pipe
Integrated services digital network. A telecommunica- A pipe that transfers data using a request/data/status
tions network that allows for digital voice, video, and paradigm. The data has an imposed structure that
data transmissions. ISDN replaces the analog tele- allows requests to be reliably identified and
phone system with a fast and efficient digital communicated.
communications network. ISDN lines contain two chan-
nels: a B channel, which has a 64-Kbit/s data MSB
transmission rate, and a D channel, which has either a Most significant bit.
16-Kbit/s or 64-Kbit/s transmission rate. When the two
lines are used together, transmitted data can travel at multidrop
128 Kbit/s. A communication configuration in which more than two
stations share a transmission path. A typical multidrop
isochronous transmission configuration has a number of secondary devices (e.g.,
A data transmission process in which there is always an terminals) and a primary device (e.g., host computer) on
integral number of unit intervals between any two signif- the same path or line.
icant instants. Compare to synchronous transmission
and asynchronous transmission. multiplexed mode
The connection of an HDLC channel to an external
isochronous transfer interface through a TSA. In multiplexed mode, an HDLC
One of four USB transfer types. Isochronous transfers channel can be connected to a PCM highway or GCI
are used when working with isochronous data. Isochro- interface. Compare to nonmultiplexed mode.
nous transfers provide periodic, continuous
communication between host and device. multiplexed signal
A signal that shares a pin with at least one other signal.
ISR
Interrupt service routine. The software executed when multipoint
the interrupt processing unit receives an interrupt See multidrop.
request. The interrupt vector points to this code. mux
Abbreviation for multiplexer.
PCB
Peripheral control block. Each 16-bit read/write periph-
O eral register is in the internal 1-Kbyte peripheral control
odd parity block (PCB). Registers are physically located in the
See parity. peripheral devices they control, but they are addressed
as a single 1-Kbyte block. This block is located in either
ONCE memory or I/O space, at the location pointed to by the
On-circuit emulation. Peripheral Control Block Relocation (RELOC) register.
OSI Because the base address of the block can change, the
Open systems interconnection. An ISO standard for address of each register is specified as an offset from
worldwide communications that defines a framework for the RELOC register, rather than as an absolute
implementing protocols in seven layers. Control is address. The register address is found by adding the
passed from one layer to the next. offset to the base address to determine the physical
location in memory or I/O space.
overall priority
Each interrupt source has an overall priority number The PCB base address can be set to any even 1-Kbyte
that is used only to arbitrate between two interrupt boundary in memory or I/O space (i.e., the lower 10 bits
sources that have priority requests pending with the of the base address must be 0). The RELOC register
same programmable priority level. Overall priority is not resides in the last register address of the PCB, at offset
used if the programmable priority is sufficient to resolve 03FEh. At reset, the base of the PCB is set to FC00h in
the pending highest-priority request. I/O space. This places the RELOC register at FFFEh.
PCM
Pulse code modulation. A technique for converting ana-
P log signals into digital form that is widely used by the
PABX telephone companies in their T1 circuits. In North Amer-
Private automatic branch exchange. ica and Japan, PCM samples the analog waves 8,000
times per second and converts each sample into an 8-
packet bit number, resulting in a 64-Kbit/s data stream. The
A self-contained message unit transmitted through a sampling rate is twice the 4-KHz bandwidth required for
communications network. Typically, the transmitter a toll-quality conversation.
breaks a longer message into packets to avoid the net-
work performance degradation caused by long PCM highway
messages. A packet contains three parts: control infor- Pulse code modulation highway. One of the external
interfaces supported by the Am186CC communications
controller HDLC channels.
POTS RTR
Plain old telephone service. Ready-to-receive. See CTS/RTR.
PPP
Point to point protocol. S
PRI SCIT
Primary rate interface. Special circuit interface for terminals.
software exception
A software interrupt that occurs when an instruction T
causes a particular condition in the processor.
TDM
software interrupt Time-division multiplex. A method of transmitting multi-
An interrupt initiated by the INT or INTO software ple signals (data, voice, and/or video) simultaneously
instruction, or by a software exception. A software inter- over one communications medium by interleaving a
rupt does not affect the IF flag in the FLAGS register. piece of each signal one after another.
Compare to hardware interrupt.
TIC
source-synchronized transfer Terminal interchip communication.
See synchronized transfer.
top of FIFO
The memory address or register where the next item in
a first-in-first-out buffer can be read.
trace interrupt
The trace interrupt is the highest priority interrupt. It is a
U
software interrupt in that it is initiated by software, but UART
unlike other software interrupts, it does clears the IF Universal asynchronous receiver/transmitter. A device
flag. that provides full-duplex, bidirectional data transfer in
RS-232 format. The Am186CC/CH/CU microcontrollers
transparency have a UART that supports speeds up to 115.2 Kbaud
See data transparency. and a High-Speed UART that supports speeds up to
460 Kbaud. The UARTs support full-duplex transfers in
transparent mode
polled, interrupt, and DMA modes.
A mode of operation for an HDLC transmit channel that
transmits the data exactly as it appears in the FIFO. unsynchronized transfer
Transparent mode does no bit stuffing, no framing with A transfer of information in which the transmitter sends
flags, and does not support CRC. Transparent mode is data without regard for any signal or other indication
useful for transmitting raw data streams such as audio from the receiver. During an unsynchronized transfer in
data (for use with a codec or DSP). DMA operations, DRQ is always asserted; and the
transfer takes place continually until the correct number
transaction
of transfers occur. Compare to synchronized transfer.
The delivery of service to an endpoint. A transaction
consists of a token packet, an optional data packet, and USB
an optional handshake packet. Specific packets are Universal serial bus. USB is an industry standard exten-
allowed or required based on the transaction type. sion to the PC architecture that provides an easy-to-use
port for connecting up to 127 peripheral devices at
transceiver
transfer rates up to 12 Mbit/s. The USB specification
A transmitter/receiver that can send and accept
supports isochronous (real-time) data transfers for
information.
voice, audio, and compressed video; bulk data transfers
transfer for devices such as printers and terminal adapters; and
One or more bus transactions to move information interrupt data transfers for event-driven devices such as
between a software client and its function. pointing devices and keyboards.
V
very short frame
During an HDLC transfer, a frame containing less than
two bytes (zero or one) between the start and stop flags.
W
wait state
A pause in a microprocessor’s clock cycles that allows
for differences in speed between one component and
others in a computer (such as input/output devices or
RAM). Wait states are common in systems where the
microprocessor has a much higher clock speed than
other components, requiring the latter to play catch up.
During a wait state, the microprocessor idles for one or
more cycles while data comes in from RAM or other
components. Wait states also are not uncommon
between buses and devices connected to the bus.
WAN
Wide area network.
word
In the x86 environment, a group of 16 adjacent binary
digits (bits) or two bytes.
Z
zero-bit deletion
See bit unstuffing.
zero-bit insertion
See bit stuffing.
B BSIZE8 signal
description, 3-11
basic-rate GCI, 16-10 emulator support, 4-3
baud rate buffer
detection adding, 8-32, 8-34
description, 13-16 descriptor ring, creating, 8-31, 8-33
enhancement, 13-18 descriptor ring, definition, Glossary-1
error, 13-17 queues, using, 8-20
procedure, 13-7 replacing, 8-35
range, 13-17 buffer queue, definition, Glossary-1
programming, 13-15
buffer, definition, Glossary-1
setting, 13-6
table, UART, 13-15 bulk transfer, definition, Glossary-1
BEPBUFS register, 18-9 bus
address bus description, 3-10, 3-13
BEPCTL register, 18-9
bus status pins, 3-13
BEPDAT register, 18-9 data. See data bus.
BEPDEF1 register, 18-9 GCI. See GCI bus.
BEPDEF2 register, 18-9 system. See system bus.
BEPDEF3 register, 18-9 bus interface, signal list, 3-10
BEPSIZ register, 18-9 byte transfers, DMA, 8-15
BHE signal byte write enables, 3-31
description, 3-11 byte, definition, Glossary-1
emulator support, 4-2, 4-3
bit sampling, UART, 13-16
bit stuffing, definition, Glossary-1 C
bit unstuffing, definition, Glossary-1 C/I channel, GCI, 17-15
block diagram C/I0 arbitration, GCI, 17-18
Am186CC microcontroller, 1-5 CAS1–CAS0 signals
Am186CC/CH/CU microcontrollers, 1-4 description, 3-19
Am186CH HDLC microcontroller, 1-5 emulator support, 4-3
Am186CU USB microcontroller, 1-5
CCIT, definition, Glossary-1
chip select, 5-2
DMA, 8-3 CDRAM register, 6-3
DRAM, 6-2 CEPBUFS register, 18-9
GCI, 17-1 CEPCTL register, 18-9
HDLC, 15-2 CEPDAT register, 18-9
HDLC receiver, 15-15 CEPDEF1 register, 18-9
HDLC transmitter, 15-10
CEPDEF2 register, 18-9
interrupt, 7-2
interrupt (partial), 7-15 CEPDEF3 register, 18-9
maskable interrupt, 7-15 CEPSIZ register, 18-9
programmable I/O, 9-1 chip select
synchronous serial interface, 14-1 block diagram, 5-2
TSA, 16-3 comparison to other devices, 5-11
typical system, 3-29 configuring address and data buses, 5-9
UART, 13-2 DRAM signal functions, 5-7
USB, 18-2 hardware considerations, 5-10
watchdog timer, 11-1 I/O space, 5-7
BOUNDS exception interrupt, 7-20 I/O, selecting, 5-5
BRCVPK register, 18-9 initialization, 5-11
LCS signal, 5-5
break detection and generation, UART, 13-20
MCS3–MCS0 signals, 5-5
break, definition, Glossary-1 memory space, 5-6
breakpoint interrupt, 7-19 memory, selecting, 5-5
BRI, definition, Glossary-1 multiplexed signals, 5-3
initialization, 17-20
interface signals, 17-13
H
interrupts, 17-19 half duplex
monitor channel, 17-14 definition, Glossary-4
operation, 17-5 description, 12-8
overview, 1-8 handling USB data, 18-18
PCM highway conversion with ISDN, 12-5 hardware considerations
receiving data, 17-7 chip select, 5-10
registers, 17-5 DRAM, 6-6
signal conversion, 17-14 emulator support, 4-5
signal descriptions, 3-27 HDLC, 15-20
signals, 17-13 programmable I/O (PIO), 9-7
software considerations, 17-20 system, 3-34
structure, 17-8 UART, 13-22
TIC bus, 17-16 watchdog timer, 11-4
transmitting data, 17-6 hardware flow control
upstream monitor channel transmission, 17-15 DMA, 8-24
upstream TIC format, 17-16 overview, 12-6
usage, 17-5 UART, 13-13
with TSA, 16-14
hardware interrupt, definition, Glossary-4
GCI_DCL_A signal, 3-27
HDLC
GCI_DD_A signal, 3-27 block diagram, 15-2
GCI_DU_A signal, 3-27 comparison to other devices, 15-21
GCI_FSC_A signal, 3-27 control application, 12-4
GCIRD0 register, 17-5 CTS control, 15-14
GCIRD0P register, 17-5 definition, Glossary-4
frame, 15-1
GCIRD1 register, 17-5
general options, 15-9
GCIRD1P register, 17-5 hardware considerations, 15-20
GCITD0 register, 17-5 initialization, 15-21
GCITD1 register, 17-5 interface, 15-7
GDxCON0 register, 8-4, 8-5 interrupts, 15-20
GDxCON1 register, 8-4, 8-5 operation, 15-7
overview, 1-7
GDxDSTH register, 8-5
programmed I/O, 15-8
GDxDSTL register, 8-4, 8-5 receive interrupt, 15-20
GDxSRCH register, 8-4, 8-5 receiver, 15-14, 15-19
GDxSRCL register, 8-4, 8-5 receiver block diagram, 15-15
GDxTC register, 8-5 register summary, 15-6
general circuit interface. See GCI. RTR timing, 15-18
signal descriptions, 3-23
general-purpose DMA
software considerations, 15-21
See also DMA, general-purpose.
transmit interrupt, 15-20
definition, Glossary-4
transmitter, 15-10, 15-18
GICRD register, 17-5 transmitter block diagram, 15-10
GICRDP register, 17-5 usage, 15-7
GICTD register, 17-5 with SmartDMA channel, 15-18
GIMSK register, 17-5 High-Speed UART. See UART.
GISTAT register, 17-5 HLDA signal, 3-12
GMRD register, 17-5 HOLD latency, definition, Glossary-4
GMRDP register, 17-5 HOLD signal, 3-13
GMTD register, 17-5 host, definition, Glossary-4
GPCON register, 17-5 HSPAB0 register, 13-4
ground pins, 3-16 HSPAB1 register, 13-4
GTIC register, 17-5 HSPAB2 register, 13-4
R RES signal
description, 3-15
RAS1–RAS0 signals emulator support, 4-4
description, 3-19 RESCON register, 3-4
emulator support, 4-3, 4-4
reserved pins, 3-16
raw DCE
reset
definition, Glossary-7
definition, Glossary-7
description, 16-11
definition of types, 3-9
RD signal system, 3-5
description, 3-13 USB, 18-17
emulator support, 4-4
reset configuration pins
ready signal, chip select, 5-10 See pinstraps, 3-7
receive RESOUT signal
DMA description, 3-15
circular buffers, 8-23 emulator support, 4-4
descriptor ring, 8-31
resume, USB, 18-16
errors, 8-25
hardware flow control, 8-24 reversal, GCI bus, 17-12
multitasking, 8-25 ring
XON/XOFF flow control, 8-24 adding buffers, 8-32, 8-34
GCI, data, 17-7 buffer, definition, Glossary-7
HDLC interrupt, 15-20 create, 8-31, 8-33
programmed I/O, HDLC, 15-8 router, definition, Glossary-7
UART RSVD_x pins, 3-16
address bit, 13-10 RTFMCNT register, 18-7
bit sampling, 13-16
RTR
data, 13-7
definition, Glossary-7
description, 13-6
protocol overview, 12-7
FIFO, 13-12
timing, 15-18
special character matching, 13-21
UART flow control, 13-13
status and data, 13-10
RTR_HU signal
receiver
behavior, 13-14
definition, Glossary-7
description, 3-23
HDLC, 15-14, 15-19
RTR_U signal
refresh, 6-1
behavior, 13-14
refresh, DRAM, 6-5, 6-6 description, 3-22
register operands, CPU, 2-9 RTS, definition, Glossary-7
registers RXD_HU signal, 3-22
chip select, 5-3
RXD_U signal, 3-22
configuration, 2-4
CPU, 2-1, 2-2
DMA, 8-4
GCI, 17-5 S
interrupt, 7-4, 7-18 S2–S0 signals
processor, 2-1 description, 3-13
programmable I/O (PIO), 9-5 emulator support, 4-5
synchronous serial interface (SSI), 14-3 S6 signal
TSA, 16-7 description, 3-13
UART, 13-3 emulator support, 4-5
USB, 18-7 sample applications, 12-3
watchdog timer, 11-3
SCIT, definition, Glossary-7
remote wakeup, USB, 18-16
SCLK signal, 3-23
REQST register, 7-5
SDATA signal, 3-23
request, DMA, 8-17
SDEN signal, 3-23
SDLC, definition, Glossary-7
WLB signal
description, 3-14
emulator support, 4-5
word transfers, DMA, 8-15
word, definition, Glossary-10
worst-case error, autobaud, 13-17
WR signal
description, 3-14
emulator support, 4-5
X
X1 signal, 3-15
X2 signal, 3-15
XON/XOFF flow control, DMA receive, 8-24
Z
zero-bit deletion, definition, Glossary-10
zero-bit insertion, definition, Glossary-10