MC68340UM
MC68340UM
µ MOTOROLA
Freescale Semiconductor, Inc...
MC68340
Integrated Processor with DMA
User’s Manual
Motorola reserves the right to make changes without further notice to any products herein to improve reliability, function or design. Motorola does not assume any
liability arising out of the application or use of any product or circuit described herein; neither does it convey any license under its patent rights nor the rights of
others. Motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other
applications intended to support or sustain life, or for any other application in which the failure of the Motorola product could create a situation where personal
injury or death may occur. Should Buyer purchase or use Motorola products for any such unintended or unauthorized application, Buyer shall indemnify and hold
Motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney
fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that
Motorola was negligent regarding the design or manufacture of the part. Motorola and the are registered trademarks of Motorola, Inc. Motorola, Inc. is an
Equal Opportunity/Affirmative Action Employer.
PREFACE
The complete documentation package for the MC68340 consists of the MC68340UM/AD,
MC68340 Integrated Processor with DMA User’s Manual, M68000PM/AD, MC68000
Family Programmer’s Reference Manual, and the MC68340P/D, MC68340 Integrated
Processor with DMA Product Brief.
The MC68340 Integrated with DMA Processor User’s Manual describes the programming,
capabilities, registers, and operation of the MC68340; the MC68000 Family Programmer’s
Reference Manual provides instruction details for the MC68340; and the MC68340
Integrated Processor with DMA Product Brief provides a brief description of the MC68340
Freescale Semiconductor, Inc...
capabilities.
68K FAX-IT
FAX 512-891-8593
The Motorola High-End Technical Publication Department provides a FAX number for you
to submit any questions and comments about this document. We welcome your
suggestions for improving our documentation or any questions concerning our products.
Please provide the part number and revision number (located in upper right-hand corner
on the cover), and the title of the document when submitting. When referring to items in
the manual please reference by the page number, paragraph number, figure number,
table number, and line number if needed. Reference the line number from the top of the
page.
When we receive a FAX between the hours of 7:30 AM and 5:00 PM EST, Monday
through Friday, we will respond within two hours. If the FAX is received after 5:00 PM or
on the weekend, we will respond within two hours on the first working day following receipt
of the FAX.
When sending a FAX, please provide your name, company, FAX number, and voice
number including area code (so we can talk to a real person if needed).
TABLE OF CONTENTS
Paragraph Page
Number Title Number
Section 1
Device Overview
1.1 M68300 Family..................................................................................................1-2
Freescale Semiconductor, Inc...
Section 2
Signal Descriptions
2.1 Signal Index.......................................................................................................2-2
2.2 Address Bus.......................................................................................................2-4
2.2.1 Address Bus (A23–A0) ................................................................................2-4
2.2.2 Address Bus (A31–A24)..............................................................................2-4
2.3 Data Bus (D15–D0)..........................................................................................2-4
2.4 Function Codes (FC3–FC0)............................................................................2-5
2.5 Chip Selects (CS3–CS0) ................................................................................2-5
2.6 Interrupt Request Level (IRQ7, IRQ6, IRQ5, IRQ3) ...................................2-6
Section 3
Bus Operation
3.1 Bus Transfer Signals........................................................................................3-1
3.1.1 Bus Control Signals .....................................................................................3-2
3.1.2 Function Code Signals................................................................................3-3
3.1.3 Address Bus (A31–A0) ................................................................................3-4
3.1.4 Address Strobe (AS)....................................................................................3-4
3.1.5 Data Bus (D15–D0)......................................................................................3-4
3.1.6 Data Strobe (DS)...........................................................................................3-4
3.1.7 Bus Cycle Termination Signals..................................................................3-4
3.1.7.1 Data Transfer and Size Acknowledge Signals
(DSACK1 and DSACK0).....................................................................3-4
3.1.7.2 Bus Error (BERR).......................................................................................3-5
3.1.7.3 Autovector (AVEC)....................................................................................3-5
3.2 Data Transfer Mechanism...............................................................................3-5
3.2.1 Dynamic Bus Sizing.....................................................................................3-5
3.2.2 Misaligned Operands...................................................................................3-7
3.2.3 Operand Transfer Cases.............................................................................3-7
3.2.3.1 Byte Operand to 8-Bit Port, Odd or Even (A0 = X) ..............................3-7
3.2.3.2 Byte Operand to 16-Bit Port, Even (A0 = 0)..........................................3-8
3.2.3.3 Byte Operand to 16-Bit Port, Odd (A0 = 1) ...........................................3-9
3.2.3.4 Word Operand to 8-Bit Port, Aligned.....................................................3-9
3.2.3.5 Word Operand to 16-Bit Port, Aligned...................................................3-10
3.2.3.6 Long-word Operand to 8-Bit Port, Aligned...........................................3-10
3.2.3.7 Long-Word Operand to 16-Bit Port, Aligned........................................3-12
3.2.4 Bus Operation................................................................................................3-14
3.2.5 Synchronous Operation with DSACK≈.....................................................3-14
3.2.6 Fast Termination Cycles..............................................................................3-15
3.3 Data Transfer Cycles........................................................................................3-16
3.3.1 Read Cycle.....................................................................................................3-16
3.3.2 Write Cycle.....................................................................................................3-18
3.3.3 Read-Modify-Write Cycle.............................................................................3-19
Section 4
System Integration Module
4.1 Module Overview..............................................................................................4-1
4.2 Module Operation.............................................................................................4-2
4.2.1 Module Base Address Register Operation...............................................4-2
4.2.2 System Configuration and Protection Operation....................................4-3
4.2.2.1 System Configuration ..............................................................................4-5
4.2.2.2 Internal Bus Monitor .................................................................................4-6
4.2.2.3 Double Bus Fault Monitor........................................................................4-6
4.2.2.4 Spurious Interrupt Monitor ......................................................................4-6
4.2.2.5 Software Watchdog..................................................................................4-6
4.2.2.6 Periodic Interrupt Timer ...........................................................................4-7
4.2.2.6.1 Periodic Timer Period Calculation.....................................................4-8
4.2.2.6.2 Using the Periodic Timer as a Real-Time Clock .............................4-9
4.2.2.7 Simultaneous Interrupts by Sources in the SIM40.............................4-9
4.2.3 Clock Synthesizer Operation......................................................................4-9
4.2.3.1 Phase Comparator and Filter .................................................................4-11
4.2.3.2 Frequency Divider ....................................................................................4-12
4.2.3.3 Clock Control.............................................................................................4-13
4.2.4 Chip Select Operation .................................................................................4-13
4.2.4.1 Programmable Features..........................................................................4-14
Section 5
CPU32
5.1 Overview.............................................................................................................5-1
5.1.1 Features..........................................................................................................5-2
5.1.2 Virtual Memory ..............................................................................................5-2
5.1.3 Loop Mode Instruction Execution ..............................................................5-3
Section 6
DMA Controller Module
6.1 DMA Module Overview....................................................................................6-2
6.2 DMA Module Signal Definitions.....................................................................6-4
6.2.1 DMA Request (DREQ≈)................................................................................6-4
6.2.2 DMA Acknowledge (DACK≈)......................................................................6-4
6.2.3 DMA Done (DONE≈).....................................................................................6-4
6.3 Transfer Request Generation .........................................................................6-4
6.3.1 Internal Request Generation.......................................................................6-4
6.3.1.1 Internal Request, Maximum Rate...........................................................6-5
6.3.1.2 Internal Request, Limited Rate ...............................................................6-5
6.3.2 External Request Generation .....................................................................6-5
6.3.2.1 External Burst Mode.................................................................................6-5
Section 7
Serial Module
7.1 Module Overview..............................................................................................7-2
7.1.1 Serial Communication Channels A and B...............................................7-3
7.1.2 Baud Rate Generator Logic ........................................................................7-3
7.1.3 Internal Channel Control Logic..................................................................7-3
7.1.4 Interrupt Control Logic .................................................................................7-3
Section 8
Timer Modules
8.1 Module Overview..............................................................................................8-1
8.1.1 Timer and Counter Functions.....................................................................8-2
8.1.1.1 Prescaler and Counter.............................................................................8-2
8.1.1.2 Timeout Detection.....................................................................................8-2
8.1.1.3 Comparator................................................................................................8-2
8.1.1.4 Clock Selection Logic..............................................................................8-3
8.1.2 Internal Control Logic...................................................................................8-3
8.1.3 Interrupt Control Logic .................................................................................8-4
8.2 Timer Modules Signal Definitions .................................................................8-4
8.2.1 Timer Input (TIN1, TIN2) ..............................................................................8-5
8.2.2 Timer Gate (TGATE1, TGATE2)................................................................8-6
8.2.3 Timer Output (TOUT1, TOUT2)...................................................................8-6
8.3 Operating Modes ..............................................................................................8-6
8.3.1 Input Capture/Output Compare..................................................................8-6
8.3.2 Square-Wave Generator.............................................................................8-8
Section 9
IEEE 1149.1 Test Access Port
9.1 Overview.............................................................................................................9-1
9.2 TAP Controller...................................................................................................9-2
9.3 Boundary Scan Register .................................................................................9-3
9.4 Instruction Register...........................................................................................9-9
9.4.1 EXTEST (000) ...............................................................................................9-10
9.4.2 SAMPLE/PRELOAD (001) ..........................................................................9-10
9.4.3 BYPASS (X1X, 101).....................................................................................9-11
9.4.4 HI-Z (100) .......................................................................................................9-11
9.5 MC68340 Restrictions......................................................................................9-11
9.6 Non-IEEE 1149.1 Operation...........................................................................9-12
Section 10
Applications
Section 11
Electrical Characteristics
11.1 Maximum Rating .............................................................................................11-1
11.2 Thermal Characteristics.................................................................................11-1
11.3 Power Considerations ...................................................................................11-2
11.4 AC Electrical Specification Definitions .......................................................11-2
11.5 DC Electrical Specifications .........................................................................11-5
11.6 AC Electrical Specifications Control Timing..............................................11-6
11.7 AC Timing Specifications..............................................................................11-8
11.8 DMA Module AC Electrical Specifications.................................................11-19
11.9 Timer Module Electrical Specifications ......................................................11-20
11.10 Serial Module Electrical Specifications......................................................11-22
11.11 IEEE 1149.1 Electrical Specifications.........................................................11-25
Section 12
Ordering Information and Mechanical Data
12.1 Standard MC68340 Ordering Information .................................................12-1
12.2 Pin Assignment ...............................................................................................12-2
12.2.1 144-Lead Ceramic Quad Flat Pack (FE Suffix).....................................12-2
12.2.2 145-Lead Plastic Pin Grid Array (RP Suffix) ..........................................12-4
12.3 Package Dimensions.....................................................................................12-6
12.3.1 FE Suffix .......................................................................................................12-6
12.3.2 RP Suffix.......................................................................................................12-7
Index
LIST OF ILLUSTRATIONS
Figure Page
Number Title Number
LIST OF TABLES
Table Page
Number Title Number
SECTION 1
DEVICE OVERVIEW
The MC68340 is a high-performance 32-bit integrated processor with direct memory
access (DMA), combining an enhanced M68000-compatible processor, 32-bit DMA, and
other peripheral subsystems on a single integrated circuit. The MC68340 CPU32 delivers
32-bit CISC processor performance from a lower cost 16-bit memory system. The
combination of peripherals offered in the MC68340 can be found in a diverse range of
Freescale Semiconductor, Inc...
SYSTEM
INTEGRATION
MODULE
(SIM40) CPU32 TWO-
68020– BASED CHANNEL
SYSTEM PROCESSOR SERIAL
PROTECTION I/O
CHIP SELECTS
AND
WAIT STATES
CLOCK
SYNTHESIZER INTERMODULE BUS
EXTERNAL
BUS
INTERFACE
BUS
ARBITRATION TWO-CHANNEL DMA TIMER TIMER
CONTROLLER
IEEE TEST
The primary features of the MC68340, illustrated in Figure 1-1, are as follows:
• High Functional Integration on a Single Piece of Silicon
• CPU32—MC68020-Derived 32-Bit Central Processor Unit
— Upward Object-Code Compatible with MC68000 and MC68010
— Additional MC68020 Instructions and Addressing Modes
— Unique Embedded Control Instructions
— Fast Two-Clock Register Instructions—10,045 Dhrystones
• Two-Channel Low-Latency DMA Controller for High-Speed Memory Transfers
— Single- or Dual-Address Transfers
— 32-Bit Addresses and Counters
— 8-, 16-, and 32-Bit Data Transfers
— 50 Mbyte/Sec Sustained Transfers (12.5 Mbyte/Sec Memory-to-Memory)
• Two-Channel Universal Synchronous/Asynchronous Receiver/Transmitter (USART)
— Baud Rate Generators
Freescale Semiconductor, Inc...
— Modem Control
— MC68681/MC2681 Compatible
— 9.8 Mbits/Sec Maximum Transfer Rate
• Two Independent Counter/Timers
— 16-Bit Counter
— Up to 8-Bit Prescaler
— Multimode Operation
— 80-ns Resolution
• System Integration Module Incorporates Many Functions Typically Relegated to
External PALs, TTL, and ASIC, such as:
— System Configuration — External Bus Interface
— System Protection — Periodic Interrupt Timer
— Chip Select and Wait State Generation — Interrupt Response
— Clock Generation — Bus Arbitration
— Dynamic Bus Sizing — IEEE 1149.1 Boundary Scan (JTAG)
— Up to 16 Discrete I/O Lines — Power-On Reset
• 32 Address Lines, 16 Data Lines
• Power Consumption Control
— Static HCMOS Technology Reduces Power in Normal Operation
— Low Voltage Operation at 3.3 V ±0.3 V (MC68340V only)
— Programmable Clock Generator Throttles Frequency
— Unused Peripherals Can Be Turned Off
— LPSTOP Provides an Idle State for Lowest Standby Current
• 0–16.78 MHz or 0–25.16 MHz Operation
• 144-Pin Ceramic Quad Flat Pack (CQFP) or 145-Pin Plastic Pin Grid Array (PGA)
As a low voltage part, the MC68340V can operate with a 3.3-V power supply. MC68340 is
used throughout this manual to refer to both the low voltage and standard 5-V parts since
both are functionally equivalent.
1.1.1 Organization
The M68300 family of integrated processors and controllers is built on an M68000 core
processor, an on-chip bus, and a selection of intelligent peripherals appropriate for a set of
applications. The CPU32 is a powerful central processor with nearly the performance of
the MC68020. A system integration module incorporates the external bus interface and
many of the smaller circuits that typically surround a microprocessor for address decoding,
wait-state insertion, interrupt prioritization, clock generation, arbitration, watchdog timing,
and power-on reset timing.
functions, such as UARTs and timers. Since each major function is designed in a
standalone module, each module might be found in many different M68300 family parts.
Driver software written for a module on one M68300 part can be used to run the same
module that appears on another part.
1.1.2 Advantages
By incorporating so many major features into a single M68300 family chip, a system
designer can realize significant savings in design time, power consumption, cost, board
space, pin count, and programming. The equivalent functionality can easily require 20
separate components. Each component might have 16–64 pins, totaling over 350
connections. Most of these connections require interconnects or are duplications. Each
connection is a candidate for a bad solder joint or misrouted trace. Each component is
another part to qualify, purchase, inventory, and maintain. Each component requires a
share of the printed circuit board. Each component draws power—often to drive large
buffers to get the signal to another chip. The cumulative power consumption of all the
components must be available from the power supply. The signals between the CPU and
a peripheral might not be compatible nor run from the same clock, requiring time delays or
other special design considerations.
In a M68300 family component, the major functions and glue logic are all properly
connected internally, timed with the same clock, fully tested, and uniformly documented.
Power consumption stays well under a watt, and a special standby mode drops current
well under a milliamp during idle periods. Only essential signals are brought out to pins.
The primary package is the surface-mount quad flat pack for the smallest possible
footprint; pin grid arrays are also available.
1.2.1 CPU32
The CPU32 is an M68000 family processor specially designed for use as a 32-bit core
processor and for operation over the intermodule bus (IMB). Designers used the
MC68020 as a model and included advances of the later M68000 family processors,
resulting in an instruction execution performance of 4 MIPS (VAX-equivalent) at 25.16
MHz.
The powerful and flexible M68000 architecture is the basis of the CPU32. MC68000
(including the MC68HC000 and the MC68EC000) and MC68010 user programs will run
unmodified on the CPU32. The programmer can use any of the eight 32-bit data registers
for fast manipulation of data and any of the eight 32-bit address registers for indexing data
in memory. The CPU32 can operate on data types of single bits, binary-coded decimal
(BCD) digits, and 8, 16, and 32 bits. Peripherals and data in memory can reside anywhere
Freescale Semiconductor, Inc...
in the 4-Gbyte linear address space. A supervisor operating mode protects system-level
resources from the more restricted user mode, allowing a true virtual environment to be
developed.
Flexible instructions for data movement, arithmetic functions, logical operations, shifts and
rotates, bit set and clear, conditional and unconditional program branches, and overall
system control are supported, including a fast 32 × 32 multiply and 32-bit conditional
branches. New instructions, such as table lookup and interpolate and low power stop,
support the specific requirements of embedded control applications. Many addressing
modes complement these instructions, including predecrement and postincrement, which
allow simple stack and queue maintenance and scaled indexed for efficient table
accesses. Data types and addressing modes are supported orthogonally by all data
operations and with all appropriate addressing modes. Position-independent code is easily
written.
The CPU32 is specially optimized to run with the MC68340's 16-bit data bus. Most
instructions execute in one-half the number of clocks compared to the original MC68000,
yielding an overall 1.6 times the performance of the same-speed MC68000 and measuring
10,045 Dhrystones/sec @ 25.16 MHz (6,742 Dhrystones/sec @ 16.78 MHz).
Like all M68000 family processors, the CPU32 recognizes interrupts of seven different
priority levels and allows the peripheral to vector the processor to the desired service
routine. Internal trap exceptions ensure proper instruction execution with good addresses
and data, allow operating system intervention in special situations, and permit instruction
tracing. Hardware signals can either terminate or rerun bad memory accesses before
instructions process data incorrectly.
The CPU32 offers the programmer full 32-bit data processing performance with complete
M68000 compatibility, yet with more compact code than is available with RISC
processors. The CPU32 is identical in all CPU32-based M68300 family products.
The processor communicates with these modules over the on-chip intermodule bus (IMB).
Freescale Semiconductor, Inc...
This backbone of the chip is similar to traditional external buses with address, data, clock,
interrupt, arbitration, and handshake signals. Because bus masters (like the CPU32 and
DMA), peripherals, and the SIM40 are all on the chip, the IMB ensures that
communication between these modules is fully synchronized and that arbitration and
interrupts can be handled in parallel with data transfers, greatly improving system
performance. Internal accesses across the IMB may be monitored from outside of the
chip, if desired.
1.3.1.1 EXTERNAL BUS INTERFACE. The external bus interface (EBI) handles the
transfer of information between the internal CPU32 or DMA controller and memory,
peripherals, or other processing elements in the external address space. Based on the
MC68030 bus, the external bus provides up to 32 address lines and 16 data lines.
Address extensions identify each bus cycle as CPU32 or DMA initiated, supervisor or user
privilege level, and instruction or data access. The data bus allows dynamic sizing for 8- or
16-bit bus accesses (plus 32 bits for DMA). Synchronous transfers from the CPU32 or the
DMA can be made in as little as two clock cycles. Asynchronous transfers allow the
memory system to signal the CPU32 or DMA when the transfer is complete and to note
the number of bits in the transfer. An external master can arbitrate for the bus using a
three-line handshaking interface.
1.3.1.3 CLOCK SYNTHESIZER. The clock synthesizer generates the clock signals used
by all internal operations as well as a clock output used by external devices. The clock
synthesizer can operate with an inexpensive 32768-Hz watch crystal or an external
oscillator for reference, using an internal phase-locked loop and voltage-controlled
oscillator. At any time, software can select clock frequencies from 131 kHz to 16.78 MHz
or 25.16 MHz, favoring either low power consumption or high performance. Alternately, an
external clock can drive the clock signal directly at the operating frequency. With its fully
static HCMOS design, it is possible to completely stop the system clock without losing the
contents of the internal registers.
1.3.1.4 CHIP SELECT AND WAIT STATE GENERATION. Four programmable chip
selects provide signals to enable external memory and peripheral circuits, providing all
handshaking and timing signals with up to 175-ns access times with a 25-MHz system
clock (265 ns @ 16.78 MHz). Each chip select signal has an associated base address and
an address mask that determine the addressing characteristics of that chip select.
Address space and write protection can be selected for each. The block size can be
selected from 256 bytes up to 4 Gbytes in increments of 2 n. Accesses can be preselected
for either 8- or 16-bit transfers. Fast synchronous termination or up to three wait states
can be programmed, whether or not the chip select signals are used. External
handshakes can also signal the end of a bus transfer. A system can boot from reset out of
8-bit-wide memory, if desired.
1.3.1.5 INTERRUPT HANDLING. Seven input signals are provided to trigger an external
interrupt, one for each of the seven priority levels supported. Seven separate outputs can
indicate the priority level of the interrupt being serviced. An input can direct the processor
to a default service routine, if desired. Interrupts at each priority level can be
preprogrammed to go to the default service routine. For maximum flexibility, interrupts can
be vectored to the correct service routine by the interrupting device.
1.3.1.6 DISCRETE I/O PINS. When not used for other functions, 16 pins can be
programmed as discrete input or output lines. Additionally, in other peripheral modules,
pins for otherwise unused functions can often be used for general input/output.
1.3.1.7 IEEE 1149.1 TEST ACCESS PORT. To aid in system diagnostics, the MC68340
includes dedicated user-accessible test logic that is fully compliant with the IEEE 1149.1
standard for boundary scan testability, often referred to as JTAG (Joint Test Action
Group).
In single-address mode, only one (the source or the destination) address is provided, and
a peripheral device such as a serial communications controller receives or supplies the
data. An external request must start a single-address transfer. In this mode, each channel
supports 32 bits of address and 8, 16, or 32 bits of data.
In dual-address mode, two bus transfers occur, one from a source device and the other to
a destination device. Dual-address transfers can be started by either an internal or
external request. In this mode, each channel supports 32 bits of address and 8 or 16 bits
of data (32 bits require external logic). The source and destination port size can be
selected independently; when they are different, the data will be packed or unpacked. An
8-bit disk interface can be read twice before the concatenated 16-bit result is passed into
memory.
Byte, word, and long-word counts up to 32 bits can be transferred. All addresses and
transfer counters are 32 bits. Addresses increment or remain constant, as programmed.
The DMA channels support two external request modes, burst transfer and cycle steal.
Internal requests can be programmed to occupy 25, 50, 75, or 100 percent of the data bus
bandwidth. Interrupts can be programmed to postpone DMA completion.
The DMA module can sustain a transfer rate of 12.5 Mbytes/sec in dual-address mode
and nearly 50 Mbytes/sec in single-address mode @ 25.16 MHz (8.4 and 33.3 Mbytes/sec
@ 16.78 MHz, respectively). The DMA controller arbitrates with the CPU32 for the bus in
parallel with existing bus cycles and is fully synchronized with the CPU32, eliminating all
delays normally associated with bus arbitration by allowing DMA bus cycles to butt
seamlessly with CPU bus cycles.
A 3.6864-MHz crystal drives the baud rate generators. Each transmit and receive channel
can be programmed for a different baud rate, or an external 1 × and 16× clock input can be
selected. Full modem support is provided with separate request-to-send (RTS) and clear-
to-send (CTS) signals for each channel. One channel also provides service request
signals. The two serial ports can sustain rates of 9.8 Mbps with a 25-MHz system clock in
1× mode, 612 kbps in 16× mode (6.5 Mbps and 410 kbps @ 16.78 MHz).
Freescale Semiconductor, Inc...
The MC68340 has two, identical, versatile, on-chip counter/timers as well as a simple
timer in the SIM40. These general-purpose counter/timers can be used for precisely timed
events without the errors to which software-based counters and timers are susceptible—
e.g., errors caused by dynamic memory refreshing, DMA cycle steals, and interrupt
servicing. The programmable timer operating modes are input capture, output compare,
square-wave generation, variable duty-cycle square-wave generation, variable-width
single-shot pulse generation, event counting, period measurement, and pulse-width
measurement.
Each timer consists of a 16-bit countdown counter with an 8-bit countdown prescaler for a
composite 24-bit resolution. The two timers can be externally cascaded for a maximum
count width of 48 bits. The counter/timer can be clocked by the internal system clock
generated by the SIM40 (÷2) or by an external clock input. Either the processor or external
stimuli can trigger the starting and stopping of the counter. When a counter reaches a
predetermined value, either an external output signal can be driven, or an interrupt can be
made to the CPU32. The finest resolution of the timer is 80 ns with a 25-MHz system
clock (125 ns @ 16.78 MHz).
requires only a 3.3-V power supply, reduces current consumption by 40–60% in all modes
of operation (as well as reducing noise emissions).
1.5 PHYSICAL
Freescale Semiconductor, Inc...
The MC68340 is available as 0–16.78 MHz and 0–25.16 MHz, 0°C to +70°C and -40°C to
+85°C, and 5.0 V ±5% and 3.3 V ±0.3 supply voltages (reduced frequencies at 3.3 V) .
Thirty-two power and ground leads minimize ground bounce and ensure proper isolation
of different sections of the chip, including the clock oscillator. A 144 pins are used for
signals and power. The MC68340 is available in a gull-wing ceramic quad flat pack
(CQFP) with 25.6-mil (0.001-in) lead spacing or a 15 × 15 plastic pin grid array (PPGA)
with 0.1-in pin spacing.
The highly integrated MC68340 is ideal as the central processor for CD-I players. It
provides the M68000 microprocessor code compatibility and DMA functions required by
the CD-I Green Book specification as well as many other useful on-chip functions for a
very cost-effective solution. The extra demands of full-motion video CD-I systems make
the best use of the MC68340 high performance. The MC68340 is CD-I compliant and has
been CD-I qualified. With its low voltage operation, the MC68340V is the only practical
choice for portable CD-I.
SECTION 2
SIGNAL DESCRIPTIONS
This section contains brief descriptions of the MC68340 input and output signals in their
functional groups as shown in Figure 2-1.
BKPT/DSCLK
IFETCH/DSI
Freescale Semiconductor, Inc...
IPIPE/DSO
FREEZE
A31/PORT A7/IACK7
SCLK
A30/PORT A6/IACK6
X2
X1
A29/PORT A5/IACK5
A28/PORT A4/IACK4 PORT A
A27/PORT A3/IACK3
A26/PORT A2/IACK2
A25/PORT A1/IACK1 RxDA
TMS
TDO
TCK
TDI
A24/PORT A0 TxDA
CPU32 TWO-CHANNEL CTSA
CORE SERIAL RxDB
I/O TxDB
CTSB
A23–A0 TEST
D15–D0
FC3–FC0
RESET
TxRDYA/OP6
BERR
EXTERNAL OUTPUT RxRDYA/FFULLA/OP4
HALT PORT RTSB/OP1
BUS
AS RTSA/OP0
INTERFACE SYSTEM
DS
INTEGRATION
R/W IMB
MODULE
SIZ1
SIZ0
DSACK1
DSACK0
BR
BG BUS
BGACK ARBITRATION
RMC
CLOCK
IRQ7/PORT B7
IRQ6/PORT B6
IRQ5/PORT B5
IRQ3/PORT B3
CS3/IRQ4/PORT B4 PORT B
CS2/IRQ2/PORT B2
DONE1
TGATE1
TOUT1
DACK1
DREQ1
TIN1
DACK2
DONE2
TGATE2
DREQ2
TOUT2
TIN2
CS1/IRQ1/PORT B1
CS0/AVEC
MODCK/PORT B0
Data Bus D15–D0 The 16-bit data bus used to transfer byte or word data I/O
Function Codes FC3–FC0 Identify the processor state and the address space of the Out
current bus cycle
Chip Select 3–1/ CS3–CS1 Enables peripherals at programmed addresses, interrupt Out/In/
Interrupt Request Level/ priority level to the CPU32, or parallel I/O port I/O
Port B4, B2, B1
Chip Select 0/Autovector CS0 Enables peripherals at programmed addresses or Out/In
requests an automatic vector
Bus Request BR Indicates that an external device requires bus mastership In
Bus Grant BG Indicates that current bus cycle is complete and the Out
MC68340 has relinquished the bus
Bus Grant Acknowledge BGACK Indicates that an external device has assumed bus In
mastership
Data and Size DSACK1, Provides asynchronous data transfers and dynamic bus In
Acknowledge DSACK0 sizing
Read-Modify-Write Cycle RMC Identifies the bus cycle as part of an indivisible read - Out
modify-write operation
Address Strobe AS Indicates that a valid address is on the address bus Out
Data Strobe DS During a read cycle, DS indicates that an external device Out
should place valid data on the data bus. During a write
cycle, DS indicates that valid data is on the data bus.
Size SIZ1, SIZ0 Indicates the number of bytes remaining to be transferred Out
for this cycle
Read/Write R/ W Indicates the direction of data transfer on the bus Out
Interrupt Request Level/ IRQ7, IRQ6, Provides an interrupt priority level to the CPU32 or In/I/O
Port B7, B6, B5, B3 IRQ5, IRQ3 becomes a parallel I/O port
Reset RESET System reset I/O
Halt HALT Suspends external bus activity I/O
Bus Error BERR Indicates an invalid bus operation is being attempted In
System Clock CLKOUT System clock out Out
Crystal Oscillator EXTAL, XTAL Connections for an external crystal or oscillator to the In, Out
internal oscillator circuit
External Filter Capacitor XFC Connection pin for an external capacitor to filter the circuit In
of the phase-locked loop
Transmit Data TxDA, TxDB Transmitter serial data output from the serial module Out
Clear-to-Send CTSA, CTSB Serial module clear-to-send inputs In
Request-to-Send/ RTSB, RTSA Channel request-to-send outputs or discrete outputs Out/Out
OP1, OP0
Serial Crystal Oscillator X1, X2 Connections for an external crystal to the serial module
internal oscillator circuit
Serial Clock SCLK External serial module clock input In
Transmitter Ready/OP6 T≈RDYA Indicates transmit buffer has a character or becomes a Out/Out
parallel output
Receiver Ready/ R≈RDYA Indicates receive buffer has a character, the receiver Out/Out/Out
FIFO Full/OP4 FIFO buffer is full or becomes a parallel output
DMA Request DRE Input that starts a DMA process In
Q2, DREQ1
DMA Acknowledge DACK2, Output that signals an access during DMA Out
DACK1
DMA Done DONE2, Bi-directional signal that indicates the last transfer I/O
DONE1
Timer Gate TGATE2, Counter enable input to timer In
TGATE1
Timer Input TIN2, TIN1 Time reference input to timer In
Timer Output TOUT2, Output waveform from timer Out
TOUT1
Test Clock TCK Provides a clock for IEEE 1149.1 test logic In
Test Mode Select TMS Controls test mode operations In
Test Data In TDI Shifts in instructions and test data In
Test Data Out TDO Shifts out instructions and test data Out
Synchronizer Power VCCSYN Quiet power supply to VCO; also used to control —
synthesizer mode after reset.
System Power Supply VCC , GND Power supply and ground to the MC68340 —
and Ground
NOTE
The terms assert and negate are used throughout this section
to avoid confusion when dealing with a mixture of active-low
and active-high signals. The term assert or assertion indicates
that a signal is active or true, independent of the level
represented by a high or low voltage. The term negate or
negation indicates that a signal is inactive or false.
The address bus consists of the following two groups. Refer to Section 3 Bus Operation
for information on the address bus and its relationship to bus operation.
A31–A24
These pins can function as the most significant eight address bits.
Port A7–A0
These eight pins can serve as a dedicated parallel I/O port. See Section 4 System
Integration Module for more information on programming these pins.
IACK7– IACK1
The MC68340 asserts one of these pins to indicate the level of an external interrupt
during an interrupt acknowledge cycle. Peripherals can use the IACK≈ signals instead
of monitoring the address bus and function codes to determine that an interrupt
acknowledge cycle is in progress and to obtain the current interrupt level.
last falling edge of the clock for that bus cycle. For a write cycle, all 16 bits of the data bus
are driven, regardless of the port width or operand size. The MC68340 places the data on
the data bus approximately one-half clock cycle after AS is asserted in a write cycle.
0 0 0 0 Reserved (Motorola)
0 0 0 1 User Data Space
0 0 1 0 User Program Space
0 0 1 1 Reserved (User )
0 1 0 0 Reserved (Motorola)
0 1 0 1 Supervisor Data Space
0 1 1 0 Supervisor Program Space
0 1 1 1 CPU Space
1 x x x DMA Space
CS3– CS0
The chip select output signals enable peripherals at programmed addresses. These
signals are inactive high (not high impedance) after reset. CS0 is the chip select for a
boot ROM containing the reset vector and initialization program. It functions as the boot
chip select immediately after reset.
instruction) resets external devices; the internal state of the CPU32 is not affected. The
on-chip modules are reset, except for the SIM40. However, the module configuration
register for each on-chip module is not altered. When asserted by the MC68340, this
signal is guaranteed to be asserted for a minimum of 512 clock cycles. Refer to Section 3
Bus Operation for a description of bus reset operation and Section 5 CPU32 for
information about the reset exception.
MODCK
The state of this active-high input signal during reset selects the source of the internal
system clock. If MODCK is high during reset, the internal voltage-controlled oscillator
(VCO) furnishes the system clock in crystal mode. If MODCK is low during reset, an
external clock source at the EXTAL pin furnishes the system clock output in external
clock mode.
Port B0
This pin can be used as a port B parallel I/O.
IFETCH
This active-low output signal indicates when the CPU32 is performing an instruction
word prefetch and when the instruction pipeline has been flushed.
DSI
This development serial input signal helps to provide serial communications for
background debug mode.
IPIPE
This active-low output signal is used to track movement of words through the instruction
pipeline.
DSO
This development serial output signal helps to provide serial communications for
background debug mode.
BKPT
Freescale Semiconductor, Inc...
This active-low input signal is used to signal a hardware breakpoint to the CPU32.
DSCLK
This development serial clock input helps to provide serial communications for
background debug mode.
RTSB, RTSA
When used for this function, these signals function as the request-to-send outputs.
OP1, OP0
When used for this function, these outputs are controlled by the value of bit 1 and bit 0,
respectively, in the output port data registers.
T≈RDYA
When used for this function, this signal reflects the complement of the status of bit 2 of
the channel A status register. This signal can be used to control parallel data flow by
acting as an interrupt to indicate when the transmitter contains a character.
OP6
When used for this function, this output is controlled by bit 6 in the output port data
registers.
R≈RDYA
When used for this function, this signal reflects the complement of the status of bit 1 of
the interrupt status register. This signal can be used to control parallel data flow by
acting as an interrupt to indicate when the receiver contains a character.
FFULLA
When used for this function, this signal reflects the complement of the status of bit 1 of
the interrupt status register. This signal can be used to control parallel data flow by
acting as an interrupt to indicate when the receiver FIFO is full.
OP4
When used for this function, this output is controlled by bit 4 in the output port data
registers.
SECTION 3
BUS OPERATION
This section provides a functional description of the bus, the signals that control it, and the
bus cycles provided for data transfer operations. It also describes the error and halt
conditions, bus arbitration, and reset operation. Operation of the external bus is the same
whether the MC68340 or an external device is the bus master; the names and
descriptions of bus cycles are from the viewpoint of the bus master. For exact timing
Freescale Semiconductor, Inc...
The MC68340 architecture supports byte, word, and long-word operands allowing access
to 8- and 16-bit data ports through the use of asynchronous cycles controlled by the
SIZ1/SIZ0 outputs and DSACK1/DSACK0 inputs. The MC68340 requires word and long-
word operands to be located in memory on word boundaries. The only type of transfer that
can be performed to an odd address is a single-byte transfer, referred to as an odd-byte
transfer. For an 8-bit port, multiple bus cycles may be required for an operand transfer due
to either misalignment or a word or long-word operand.
Furthermore, for all inputs, the MC68340 latches the level of the input during a sample
window around the falling edge of the clock signal. This window is illustrated in Figure 3-1,
where t su and t h are the input setup and hold times, respectively. To ensure that an input
signal is recognized on a specific falling edge of the clock, that input must be stable during
the sample window. If an input makes a transition during the window time period, the level
recognized by the MC68340 is not predictable; however, the MC68340 always resolves
the latched level to either a logic high or low before using it. In addition to meeting input
setup and hold times for deterministic operation, all input signals must obey the protocols
described in this section.
t su
th
CLKOUT
Freescale Semiconductor, Inc...
EXT
SAMPLE WINDOW
NOTE
The terms assert and negate are used throughout this section
to avoid confusion when dealing with a mixture of active-low
and active-high signals. The term assert or assertion indicates
that a signal is active or true independent of the level
represented by a high or low voltage. The term negate or
negation indicates that a signal is inactive or false.
designated as CPU space to allow the CPU32 to acquire specific control information not
normally associated with read or write bus cycles. FC3–FC0 are valid while AS is
asserted.
Function codes (see Table 3-2) can be considered as extensions of the 32-bit address
that can provide up to 16 different 4-Gbyte address spaces. Function codes are
automatically generated by the CPU32 to select address spaces for data and program at
both user and supervisor privilege levels, a CPU address space for processor functions,
and an alternate master address space. User programs access only their own program
and data areas to increase protection of system integrity and can be restricted from
accessing other information. The S-bit in the CPU32 status register is set for supervisor
accesses and cleared for user accesses to provide differentiation. Refer to 3.4 CPU
Space Cycles for more information.
from the MC68340. A read or write operation may transfer 8 or 16 bits of data (one or two
bytes) in one bus cycle. During a read cycle, the data is latched by the MC68340 on the
last falling edge of the clock for that bus cycle. For a write cycle, all 16 bits of the data bus
are driven, regardless of the port width or operand size. The MC68340 places the data on
the data bus approximately one-half clock cycle after AS is asserted in a write cycle.
Additionally, the system integration module (SIM40) chip select address mask register can
be programmed to internally generate DSACK1 and DSACK0 for external accesses,
eliminating logic required to generate these signals. However, if external DSACK≈ signals
are returned earlier than indicated by the DD bits in the chip select address mask register,
the cycle will terminate sooner than programmed. Refer to Section 4 System Integration
Module for additional information. The SIM40 can alternatively be programmed to
generate a fast termination cycle, providing a two-cycle external access. Refer to 3.2.6
Fast Termination Cycles for additional information on these cycles.
3.1.7.2 BUS ERROR (BERR). This signal is also a bus cycle termination indicator and
can be used in the absence of DSACK≈ to indicate a bus error condition. BERR can also
be asserted in conjunction with DSACK≈ to indicate a bus error condition, provided it
meets the appropriate timing described in this section and in Section 11 Electrical
Characteristics. Additionally, BERR and HALT can be asserted together to indicate a
retry termination. Refer to 3.5 Bus Exception Control Cycles for additional information
on the use of these signals.
The internal bus monitor can be used to generate an internal bus error signal for internal
and internal-to-external transfers. If the bus cycles of an external bus master are to be
monitored, external BERR generation must be provided since the internal bus error
monitor has no information about transfers initiated by an external bus master.
acknowledge cycles, indicating that the MC68340 should internally generate a vector
(autovector) number to locate an interrupt handler routine. AVEC can be generated either
externally or internally by the SIM40 (see Section 4 System Integration Module for
additional information). AVEC is ignored during all other bus cycles.
For example, if the MC68340 is executing an instruction that reads a long-word operand
from a 16-bit port, the MC68340 latches the 16 bits of valid data and runs another bus
cycle to obtain the other 16 bits. The operation from an 8-bit port is similar, but requires
four read cycles. The addressed device uses DSACK≈ to indicate the port width. For
instance, a 16-bit device always returns DSACK≈ for a 16-bit port (regardless of whether
the bus cycle is a byte or word operation).
Dynamic bus sizing requires that the portion of the data bus used for a transfer to or from
a particular port size be fixed. A 16-bit port must reside on data bus bits 15–0, and an 8-bit
port must reside on data bus bits 15–8. This requirement minimizes the number of bus
cycles needed to transfer data to 8- and 16-bit ports and ensures that the MC68340
correctly transfers valid data.
The MC68340 always attempts to transfer the maximum amount of data on all bus cycles;
Freescale Semiconductor, Inc...
for a word operation, it always assumes that the port is 16 bits wide when beginning the
bus cycle. The bytes of operands are designated as shown in Figure 3-2. The most
significant byte of a long-word operand is OP0, and OP3 is the least significant byte. The
two bytes of a word-length operand are OP0 (most significant) and OP1. The single byte
of a byte-length operand is OP0. These designations are used in the figures and
descriptions that follow.
Figure 3-2 shows the required organization of data ports on the MC68340 bus for both
8- and 16-bit devices. The four bytes shown in Figure 3-2 are connected through the
internal data bus and data multiplexer to the external data bus. The data multiplexer
establishes the necessary connections for different combinations of address and data
sizes. The multiplexer takes the two bytes of the 16-bit bus and routes them to their
required positions. The positioning of bytes is determined by the SIZ1/SIZ0 and A0
outputs. The SIZ1/SIZ0 outputs indicate the number of bytes to be transferred during the
current bus cycle (see Table 3-1). The number of bytes transferred during a read or write
bus cycle is equal to or less than the size indicated by the SIZ1/SIZ0 outputs, depending
on port width. For example, during the first bus cycle of a long-word transfer to a word
port, the size outputs indicate that four bytes are to be transferred although only two bytes
are moved on that bus cycle.
The address line A0 also affects the operation of the data multiplexer. During an operand
transfer, A31–A1 indicate the word base address of that portion of the operand to be
accessed, and A0 indicates the byte offset from the base (i.e., either odd or even byte).
Figure 3-2 lists the bytes required on the data bus for read cycles. The entries shown as
OPn are portions of the requested operand that are read or written during that bus cycle
and are defined by SIZ1/SIZ0 and A0 for the bus cycle.
NOTES:
1. Operands in parentheses are ignored by the MC68340 during read cycles.
2. A 3-byte to byte transfer does occur as the second byte transfer of a long-word to byte port transfer.
At most, each bus cycle can transfer a word of data aligned on a word boundary. If the
MC68340 transfers a long-word operand over a 16-bit port, the most significant operand
word is transferred on the first bus cycle, and the least significant operand word is
transferred on a following bus cycle.
The CPU32 restricts all operands (both data and instructions) to be aligned. That is, word
and long-word operands must be located on a word or long-word boundary, respectively.
The only type of transfer that can be performed to an odd address is a single-byte
transfer, referred to as an odd-byte transfer. If a misaligned access is attempted, the
CPU32 generates an address error exception, and enters exception processing. Refer to
Section 5 CPU32 for more information on exception processing.
3.2.3.1 BYTE OPERAND TO 8-BIT PORT, ODD OR EVEN (A0 = X). The MC68340
drives the address bus with the desired address and the SIZx pins to indicate a single-
byte operand.
For a read operation, the slave responds by placing data on bits 15–8 of the data bus,
asserting DSACK0 and negating DSACK1 to indicate an 8-bit port. The MC68340 then
reads the operand byte from bits 15–8 and ignores bits 7–0.
For a write operation, the MC68340 drives the single-byte operand on both bytes of the
data bus because it does not know the port size until the DSACK≈ signals are read. The
slave device reads the byte operand from bits 15–8 and places the operand in the
specified location. The slave then asserts DSACK0 to terminate the bus cycle.
Freescale Semiconductor, Inc...
3.2.3.2 BYTE OPERAND TO 16-BIT PORT, EVEN (A0 = 0). The MC68340 drives the
address bus with the desired address and the SIZx pins to indicate a single-byte operand.
For a read operation, the slave responds by placing data on bits 15–8 of the data bus and
asserting DSACK1 to indicate a 16-bit port. The MC68340 then reads the operand byte
from bits 15–8 and ignores bits 7–0.
For a write operation, the MC68340 drives the single-byte operand on both bytes of the
data bus because it does not know the port size until the DSACK≈ signals are read. The
slave device reads the operand from bits 15–8 of the data bus and uses the address to
place the operand in the specified location. The slave then asserts DSACK1 to terminate
the bus cycle.
3.2.3.3 BYTE OPERAND TO 16-BIT PORT, ODD (A0 = 1). The MC68340 drives the
address bus with the desired address and the SIZx pins to indicate a single-byte operand.
For a read operation, the slave responds by placing data on bits 7–0 of the data bus and
asserting DSACK1 to indicate a 16-bit port. The MC68340 then reads the operand byte
from bits 7–0 and ignores bits 15–8.
Freescale Semiconductor, Inc...
For a write operation, the MC68340 drives the single-byte operand on both bytes of the
data bus because it does not know the port size until the DSACK≈ signals are read. The
slave device reads the operand from bits 7–0 of the data bus and uses the address to
place the operand in the specified location. The slave then asserts DSACK1 to terminate
the bus cycle.
3.2.3.4 WORD OPERAND TO 8-BIT PORT, ALIGNED. The MC68340 drives the address
bus with the desired address and the SIZx pins to indicate a word operand.
For a read operation, the slave responds by placing the most significant byte of the
operand on bits 15–8 of the data bus and asserting DSACK0 to indicate an 8-bit port. The
MC68340 reads the most significant byte of the operand from bits 15–8 and ignores bits
7–0. The MC68340 then decrements the transfer size counter, increments the address,
and reads the least significant byte of the operand from bits 15–8 of the data bus.
For a write operation, the MC68340 drives the word operand on bits 15–0 of the data bus.
The slave device then reads the most significant byte of the operand from bits 15–8 of the
data bus and asserts DSACK0 to indicate that it received the data but is an 8-bit port.
The MC68340 then decrements the transfer size counter, increments the address, and
writes the least significant byte of the operand to bits 15–8 of the data bus.
3.2.3.5 WORD OPERAND TO 16-BIT PORT, ALIGNED. The MC68340 drives the
address bus with the desired address and the size pins to indicate a word operand.
For a read operation, the slave responds by placing the data on bits 15–0 of the data bus
and asserting DSACK1 to indicate a 16-bit port. When DSACK1 is asserted, the
MC68340 reads the data on the data bus and terminates the cycle.
Freescale Semiconductor, Inc...
For a write operation, the MC68340 drives the word operand on bits 15–0 of the data bus.
The slave device then reads the entire operand from bits 15–0 of the data bus and asserts
DSACK1 to terminate the bus cycle.
3.2.3.6 LONG-WORD OPERAND TO 8-BIT PORT, ALIGNED. The MC68340 drives the
address bus with the desired address and the SIZx pins to indicate a long-word operand.
For a read operation, shown in Figure 3-3, the slave responds by placing the most
significant byte of the operand on bits 15–8 of the data bus and asserting DSACK0 to
indicate an 8-bit port. The MC68340 reads the most significant byte of the operand (byte
0) from bits 15–8 and ignores bits 7–0. The MC68340 then decrements the transfer size
counter, increments the address, initiates a new cycle, and reads byte 1 of the operand
from bits 15–8 of the data bus. The MC68340 repeats the process of decrementing the
transfer size counter, incrementing the address, initiating a new cycle, and reading a byte
to transfer the remaining two bytes.
For a write operation, shown in Figure 3-4, the MC68340 drives the two most significant
bytes of the operand on bits 15–0 of the data bus. The slave device then reads only the
most significant byte of the operand (byte 0) from bits 15–8 of the data bus and asserts
DSACK0 to indicate reception and an 8-bit port. The MC68340 then decrements the
transfer size counter, increments the address, and writes byte 1 of the operand to bits
15–8 of the data bus. The MC68340 continues to decrement the transfer size counter,
increment the address, and write a byte to transfer the remaining two bytes to the slave
device.
S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4
CLKOUT
A31–A0
FC3–FC0
Freescale Semiconductor, Inc...
R/W
AS
DS
SIZ0
4 BYTES 3 BYTES 2 BYTES 1 BYTE
SIZ1
DSACK0
DSACK1
D7–D0
S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4
CLKOUT
A31–A0
FC3–FC0
R/W
AS
DS
Freescale Semiconductor, Inc...
SIZ0
4 BYTES 3 BYTES 2 BYTES 1 BYTE
SIZ1
DSACK0
DSACK1
3.2.3.7 LONG-WORD OPERAND TO 16-BIT PORT, ALIGNED. Figure 3-5 shows both
long-word and word read and write timing to a 16-bit port.
S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4
CLKOUT
A31–A0
FC3–FC0
R/W
AS
DS
Freescale Semiconductor, Inc...
SIZ0
4 BYTES 2 BYTES 2 BYTES 4 BYTES 2 BYTES 2 BYTES
SIZ1
DSACK0
DSACK1
WORD
LONG WORD READ WORD READ LONG WORD WRITE TO WRITE TO
FROM 16-BIT BUS FROM 16-BIT BUS 16-BIT BUS 16-BIT BUS
Figure 3-5. Long-Word and Word Read and Write Timing—16-Bit Port
The MC68340 drives the address bus with the desired address and drives the SIZx pins to
indicate a long-word operand. For a read operation, the slave responds by placing the two
most significant bytes of the operand on bits 15–0 of the data bus and asserting DSACK1
to indicate a 16-bit port. The MC68340 reads the two most significant bytes of the operand
(bytes 0 and 1) from bits 15–0. The MC68340 then decrements the transfer size counter
by 2, increments the address by 2, initiates a new cycle, and reads bytes 2 and 3 of the
operand from bits 15–0 of the data bus.
For a write operation, the MC68340 drives the two most significant bytes of the operand
on bits 15–0 of the data bus. The slave device then reads the two most significant bytes of
the operand (bytes 0 and 1) from bits 15–0 of the data bus and asserts DSACK1 to
indicate reception and a 16-bit port. The MC68340 then decrements the transfer size
counter by 2, increments the address by 2, and writes bytes 2 and 3 of the operand to bits
15–0 of the data bus.
cycle.
DSACK≈ can be asserted before the data from a slave device is valid on a read cycle.
The length of time that DSACK≈ may precede data must not exceed a specified value in
any asynchronous system to ensure that valid data is latched into the MC68340. (See
Section 11 Electrical Characteristics for timing parameters.) Note that no maximum
time is specified from the assertion of AS to the assertion of DSACK≈ . Although the
MC68340 can transfer data in a minimum of three clock cycles when the cycle is
terminated with DSACK≈ , the MC68340 inserts wait cycles in clock-period increments
until DSACK≈ is recognized. BERR and/or HALT can be asserted after DSACK≈ is
asserted. BERR and or HALT must be asserted within the time specified after DSACK≈ is
asserted in any asynchronous system. If this maximum delay time is violated, the
MC68340 may exhibit erratic behavior.
If a system asserts DSACK≈ for the required window around the falling edge of S2 and
obeys the proper bus protocol by maintaining DSACK≈ (and/or BERR/ HALT) until and
throughout the clock edge that negates AS (with the appropriate asynchronous input hold
time), no wait states are inserted. The bus cycle runs at its maximum speed for bus cycles
terminated with DSACK≈ (three clocks per cycle). When BERR (or BERR and HALT) is
asserted after DSACK≈, BERR (and HALT) must meet the appropriate setup time prior to
the falling clock edge one clock cycle after DSACK≈ is recognized. This setup time is
critical, and the MC68340 may exhibit erratic behavior if it is violated. When operating
synchronously, the data-in setup and hold times for synchronous cycles may be used
instead of the timing requirements for data relative to DS.
enable (FTE) can provide a two-clock external bus transfer. Since the chip select circuits
are driven from the system clock, the bus cycle termination is inherently synchronized with
the system clock. Refer to Section 4 System Integration Module for more information on
chip selects.When fast termination is selected, the DD bits of the corresponding address
mask register are overridden. Fast termination can only be used with zero wait states. To
use the fast termination option, an external device should be fast enough to have data
ready, within the specified setup time, by the falling edge of S4. Figure 3-6 shows the
DSACK≈ timing for a read with two wait states, followed by a fast termination read and
write. When using the fast termination option, DS is asserted only in a read cycle, not in a
write cycle.
S0 S1 S2 S3 SW SW* SW SW* S4 S5 S0 S1 S4 S5 S0 S1 S4 S5 S0
CLKOUT
AS
DS
R/W
DSACKx
D15–D0
The address bus and data bus are parallel, nonmultiplexed buses. The bus master moves
data on the bus by issuing control signals, and the bus uses a handshake protocol to
ensure correct movement of the data. In all bus cycles, the bus master is responsible for
de-skewing all signals it issues at both the start and end of the cycle. In addition, the bus
master is responsible for de-skewing the acknowledge and data signals from the slave
Freescale Semiconductor, Inc...
devices. The following paragraphs define read, write, and read-modify-write cycle
operations. Each bus cycle is defined as a succession of states that apply to the bus
operation. These states are different from the MC68340 states described for the CPU32.
The clock cycles used in the descriptions and timing diagrams of data transfer cycles are
independent of the clock frequency. Bus operations are described in terms of external bus
states.
SLAVE
BUS MASTER
ADDRESS DEVICE
1. DECODE ADDRESS
2. PLACE DATA ON D15–D0
ACQUIRE DATA 3. DRIVE DSACKx SIGNALS
1. LATCH DATA
2. NEGATE AS AND DS TERMINATE CYCLE
State 0—The read cycle starts in state 0 (S0). During S0, the MC68340 places a valid
address on A31–A0 and valid function codes on FC3–FC0. The function codes select the
address space for the cycle. The MC68340 drives R/ W high for a read cycle. SIZ1/SIZ0
become valid, indicating the number of bytes requested for transfer.
State 1—One-half clock later, in state 1 (S1), the MC68340 asserts AS indicating a valid
address on the address bus. The MC68340 also asserts DS during S1. The selected
device uses R/ W, SIZ1 or SIZ0, A0, and DS to place its information on the data bus. One
or both of the bytes (D15–D8 and D7–D0) are selected by SIZ1/SIZ0 and A0.
State 2—As long as at least one of the DSACK≈ signals is recognized on the falling edge
of S2 (meeting the asynchronous input setup time requirement), data is latched on the
falling edge of S4, and the cycle terminates.
Freescale Semiconductor, Inc...
State 3—If DSACK≈ is not recognized by the start of state 3 (S3), the MC68340 inserts
wait states instead of proceeding to states 4 and 5. To ensure that wait states are
inserted, both DSACK1 and DSACK0 must remain negated throughout the asynchronous
input setup and hold times around the end of S2. If wait states are added, the MC68340
continues to sample DSACK≈ on the falling edges of the clock until one is recognized.
State 4—At the falling edge of state 4 (S4), the MC68340 latches the incoming data and
samples DSACK≈ to get the port size.
State 5—The MC68340 negates AS and DS during state 5 (S5). It holds the address valid
during S5 to provide address hold time for memory systems. R/ W , SIZ1 and SIZ0, and
FC3–FC0 also remain valid throughout S5. The external device keeps its data and
DSACK≈ signals asserted until it detects the negation of AS or DS (whichever it detects
first). The device must remove its data and negate DSACK≈ within approximately one
clock period after sensing the negation of AS or DS . DSACK≈ signals that remain
asserted beyond this limit may be prematurely detected for the next bus cycle.
ADDRESS DEVICE
1. NEGATE DS AND AS
2. REMOVE DATA FROM D15–D0 TERMINATE CYCLE
1. NEGATE DSACKx
State 0—The write cycle starts in S0. During S0, the MC68340 places a valid address on
A31–A0 and valid function codes on FC3–FC0. The function codes select the address
space for the cycle. The MC68340 drives R/W low for a write cycle. SIZ1/SIZ0 become
valid, indicating the number of bytes to be transferred.
State 1—One-half clock later during S1, the MC68340 asserts AS, indicating a valid
address on the address bus.
State 2—During S2, the MC68340 places the data to be written onto D15–D0, and
samples DSACK≈ at the end of S2.
State 3—The MC68340 asserts DS during S3, indicating that data is stable on the data
bus. As long as at least one of the DSACK≈ signals is recognized by the end of S2
(meeting the asynchronous input setup time requirement), the cycle terminates one clock
later. If DSACK≈ is not recognized by the start of S3, the MC68340 inserts wait states
instead of proceeding to S4 and S5. To ensure that wait states are inserted, both
DSACK1 and DSACK0 must remain negated throughout the asynchronous input setup
and hold times around the end of S2. If wait states are added, the MC68340 continues to
sample DSACK≈ on the falling edges of the clock until one is recognized. The selected
device uses R/W, SIZ1/SIZ0, and A0 to latch data from the appropriate byte(s) of D15–D8
and D7–D0. SIZ1/SIZ0 and A0 select the bytes of the data bus. If it has not already done
so, the device asserts DSACK≈ to signal that it has successfully stored the data.
State 5—The MC68340 negates AS and DS during S5. It holds the address and data valid
during S5 to provide address hold time for memory systems. R/ W, SIZ1/SIZ0, and FC3–
FC0 also remain valid throughout S5. The external device must keep DSACK≈ asserted
until it detects the negation of AS or DS (whichever it detects first). The device must
negate DSACK≈ within approximately one clock period after sensing the negation of AS
or DS . DSACK≈ signals that remain asserted beyond this limit may be prematurely
detected for the next bus cycle.
S0 S2 S4 S0 S2 S4 S0
CLK OUT
A31–A30
FC3–FC0
SIZ1–SIZ0
R/W
RMC
AS
DS
DSACKx
D15–D0
READ WRITE
INDIVISIBLE
CYCLE
State 1—One-half clock later during S1, the MC68340 asserts AS indicating a valid
address on the address bus. The MC68340 also asserts DS during S1.
State 2—The selected device uses R/W, SIZ1/SIZ0, A0, and DS to place information on
the data bus. Either or both of the bytes (D15–D8 and D7–D0) are selected by SIZ1/SIZ0
and A0. Concurrently, the selected device may assert DSACK≈.
State 3—As long as at least one of the DSACK≈ signals is recognized by the end of S2
(meeting the asynchronous input setup time requirement), data is latched on the next
Freescale Semiconductor, Inc...
falling edge of the clock, and the cycle terminates. If DSACK≈ is not recognized by the
start of S3, the MC68340 inserts wait states instead of proceeding to S4 and S5. To
ensure that wait states are inserted, both DSACK1 and DSACK0 must remain negated
throughout the asynchronous input setup and hold times around the end of S2. If wait
states are added, the MC68340 continues to sample the DSACK≈ signals on the falling
edges of the clock until one is recognized.
State 4—At the end of S4, the MC68340 latches the incoming data.
State 5—The MC68340 negates AS and DS during S5. If more than one read cycle is
required to read in the operand(s), S0–S5 are repeated for each read cycle. When
finished reading, the MC68340 holds the address, R/W, and FC3–FC0 valid in preparation
for the write portion of the cycle. The external device keeps its data and DSACK≈ signals
asserted until it detects the negation of AS or DS (whichever it detects first). The device
must remove the data and negate DSACK≈ within approximately one clock period after
sensing the negation of AS or DS. DSACK≈ signals that remain asserted beyond this limit
may be prematurely detected for the next portion of the operation.
Idle States—The MC68340 does not assert any new control signals during the idle states,
but it may internally begin the modify portion of the cycle at this time. S0–S5 are omitted if
no write cycle is required. If a write cycle is required, R/W remains in the read mode until
S0 to prevent bus conflicts with the preceding read portion of the cycle; the data bus is not
driven until S2.
State 0—The MC68340 drives R/ W low for a write cycle. Depending on the write operation
to be performed, the address lines may change during S0.
State 1—In S1, the MC68340 asserts AS, indicating a valid address on the address bus.
State 2—During S2, the MC68340 places the data to be written onto D15–D0.
State 3—The MC68340 asserts DS during S3, indicating stable data on the data bus. As
long as at least one of the DSACK≈ signals is recognized by the end of S2 (meeting the
asynchronous input setup time requirement), the cycle terminates one clock later. If
DSACK≈ is not recognized by the start of S3, the MC68340 inserts wait states instead of
proceeding to S4 and S5. To ensure that wait states are inserted, both DSACK1 and
DSACK0 must remain negated throughout the asynchronous input setup and hold times
around the end of S2. If wait states are added, the MC68340 continues to sample
DSACK≈ on the falling edges of the clock until one is recognized. The selected device
uses R/ W, DS, SIZ1/SIZ0, and A0 to latch data from the appropriate section(s) of D15–D8
and D7–D0. SIZ1/SIZ0 and A0 select the data bus sections. If it has not already done so,
the device asserts DSACK≈ when it has successfully stored the data.
State 5—The MC68340 negates AS and DS during S5. It holds the address and data valid
during S5 to provide address hold time for memory systems. R/ W and FC3–FC0 also
remain valid throughout S5. If more than one write cycle is required, states S0–S5 are
repeated for each write cycle. The external device keeps DSACK≈ asserted until it detects
Freescale Semiconductor, Inc...
the negation of AS or DS (whichever it detects first). The device must remove its data and
negate DSACK≈ within approximately one clock period after sensing the negation of AS
or DS.
3 0 31 19 16 0
BREAKPOINT 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 BKPT# T 0
ACKNOWLEDGE
3 0 31 19 16 0
LOW-POWER
0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
STOP BROADCAST
MODULE BASE 3 0 31 19 16 0
ADDRESS 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
REGISTER ACCESS
3 0 31 19 16 0
INTERRUPT
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 LEVEL 1
ACKNOWLEDGE
CPU SPACE
TYPE FIELD
ports) to replace the BKPT instruction in the internal instruction pipeline and then begins
execution of that instruction.
When the CPU32 acknowledges a BKPT pin assertion (hardware breakpoint) with
background mode disabled, the CPU32 performs a word read from CPU space, type 0, at
an address corresponding to all ones on A4–A2 (BKPT#7), and the T-bit (A1) is set. If this
bus cycle is terminated by BERR, the MC68340 performs hardware breakpoint exception
processing. If this bus cycle is terminated by DSACK≈, the MC68340 ignores data on the
data bus and continues execution of the next instruction.
NOTE
The BKPT pin is sampled on the same clock phase as data
and is latched with data as it enters the CPU32 pipeline. If
BKPT is asserted for only one bus cycle and a pipeline flush
occurs before BKPT is detected by the CPU32, BKPT is
ignored. To ensure detection of BKPT by the CPU32, BKPT
can be asserted until a breakpoint acknowledge cycle is
recognized.
The breakpoint operation flowchart is shown in Figure 3-11. Figures 3-12 and 3-13 show
the timing diagrams for the breakpoint acknowledge cycle with instruction opcodes
supplied on the cycle and with an exception signaled, respectively.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Freescale Semiconductor, Inc...
— — — — — — — — — — — — — I2 I1 I0
PROCESSOR
ACKNOWLEDGE BREAKPOINT
(A) (B)
S0 S1 S2 S3 S4 S5 S0 S1 S2 S3 S4 S5 S0 S1 S2 S3 S4 S5 S0
CLKOUT
A31–A20
A15–A5,A0
Freescale Semiconductor, Inc...
SIZ0
SIZ1
AS
DS
R/W
DSACKx
D7–D0
D15–D8
BERR
HALT
BKPT
FETCHED
INSTRUCTION
BREAKPOINT EXECUTION
BREAKPOINT READ
OCCURS ACKNOWLEDGE
INSTRUCTION WORD FETCH
S0 S1 S2 S3 S4 S5 S0 S1 S2 S3 S4 S5 S0 S1 S2 S3 S4 S5 S0
CLKOUT
A31–A20
A15–A5, A0
Freescale Semiconductor, Inc...
SIZ0
SIZ1
AS
DS
R/W
DSACKx
D7–D0
D15–D8
BERR
HALT
BKPT
EXCEPTION
BREAKPOINT STACKING
BREAKPOINT READ ACKNOWLEDGE
OCCURS BUS ERROR ASSERTED
peripheral device signals the CPU32 (with IRQ7–IRQ1) that the device requires service
and the internally synchronized value on these signals indicates a higher priority than the
interrupt mask in the status register. The second case occurs when a transition has
occurred in the case of a level 7 interrupt. A recognized level 7 interrupt must be removed
for one clock cycle before a second level 7 can be recognized. The third case occurs if,
upon returning from servicing a level 7 interrupt, the request level stays at 7 and the
processor mask level changes from 7 to a lower level, a second level 7 is recognized. The
CPU32 takes an interrupt exception for a pending interrupt within one instruction boundary
(after processing any other pending exception with a higher priority). The following
paragraphs describe the types of interrupt acknowledge bus cycles that can be executed
as part of interrupt exception processing.
The interrupt acknowledge cycle is a read cycle. It differs from the read cycle described in
3.3.1 Read Cycle in that it accesses the CPU address space. Specifically, the differences
are as follows:
1. FC3–FC0 are set to $7 (FC3/FC2/FC1/FC0 = 0111) for CPU address space.
2. A3, A2, and A1 are set to the interrupt request level, and the IACK≈ strobe
corresponding to the current interrupt level is asserted. (Either the function codes
and address signals or the IACK≈ strobes can be monitored to determine that an
interrupt acknowledge cycle is in progress and the current interrupt level.)
3. The CPU32 space type field (A19–A16) is set to $F (interrupt acknowledge).
4. Other address signals (A31–A20, A15–A4, and A0) are set to one.
5. The SIZ0/SIZ1 and R/ W signals are driven to indicate a single-byte read cycle.
The responding device places the vector number on the least significant byte
Freescale Semiconductor, Inc...
of its data port (for an 8-bit port, the vector number must be on D15–D8; for a
16-bit port, the vector must be on D7–D0) during the interrupt acknowledge cycle.
The cycle is then terminated normally with DSACK≈.
Figure 3-14 is a flowchart of the interrupt acknowledge cycle; Figure 3-15 shows the
timing for an interrupt acknowledge cycle terminated with DSACK≈.
1. SYNCHRONIZE IRQ7–IRQ1
2. COMPARE IRQ1–IRQ7 TO MASK LEVEL AND
WAIT FOR INSTRUCTION TO COMPLETE
3. PLACE INTERRUPT LEVEL ON A3–A1;
TYPE FIELD (A19–A16) = $F
4. SET R/W TO READ
5. SET FC3–FC0 TO 0111
6. DRIVE SIZE PINS TO INDICATE A ONE-BYTE
TRANSFER
7. ASSERT AS AND DS
PROVIDE VECTOR NUMBER
8. ASSERT THE CORRESPONDING IACKx STROBE.
1. NEGATE DSACKx
S0 S2 S4 S0 0–2 CLOCKS* S1 S2 S4 S0 S2
CLKOUT
A31–A4
A0
SIZ0 1 BYTE
SIZ1
R/W
AS
DS
D7–D0
D15–D8
IRQ7–IRQ1
IACK7–IACK1 READ
CYCLE INTERNAL WRITE
ARBITRATION STACK
IACK CYCLE
data will be ignored if AVEC is asserted before or at the same time as the DSACK≈
signals. The vector number supplied in an autovector operation is derived from the
interrupt level of the current interrupt. When AVEC is asserted instead of DSACK≈ during
an interrupt acknowledge cycle, the MC68340 ignores the state of the data bus and
internally generates the vector number (the sum of the interrupt level plus 24 ($18)).
AVEC is multiplexed with CS0. The FIRQ bit in the SIM40 module configuration register
controls whether the AVEC /CS0 pin is used as an autovector input or as CS0 (refer to
Section 4 System Integration Module for additional information). AVEC is only sampled
during an interrupt acknowledge cycle. During all other cycles, AVEC is ignored.
Additionally, AVEC can be internally generated for external devices by programming the
autovector register. Seven distinct autovectors can be used, corresponding to the seven
levels of interrupt available with signals IRQ7–IRQ1. Figure 3-16 shows the timing for an
autovector operation.
Freescale Semiconductor, Inc...
S0 S2 S4 S0 0–2 CLOCKS* S1 S2 S4 S0 S2
CLKOUT
A31–A4
A0
Freescale Semiconductor, Inc...
SIZ0
1 BYTE
SIZ1
R/W
AS
DS
DSACKx
D15–D0
AVEC
IRQ7–IRQ1
IACK7–IACK1
WRITE
CYCLE INTERNAL
STACK
READ ARBITRATION
IACK
CYCLE
* Internal Arbitration may take between 0–2 clocks.
The MC68340 provides BERR when no device responds by asserting DSACK≈ / AVEC
within an appropriate period of time after the MC68340 asserts AS . This mechanism
allows the cycle to terminate and the MC68340 to enter exception processing for the error
condition. HALT is also used for bus exception control. This signal can be asserted by an
external device for debugging purposes to cause single bus cycle operation, or, in
Freescale Semiconductor, Inc...
combination with BERR, a retry of a bus cycle in error. To properly control termination of a
bus cycle for a retry or a bus error condition, DSACK≈, BERR, and HALT can be asserted
and negated with the rising edge of the MC68340 clock. This assures that when two
signals are asserted simultaneously, the required setup and hold time for both is met for
the same falling edge of the MC68340 clock. This or an equivalent precaution should be
designed into the external circuitry to provide these signals. Alternatively, the internal bus
monitor could be used. The acceptable bus cycle terminations for asynchronous cycles
are summarized in relation to DSACK≈ assertion as follows (case numbers refer to Table
3-4):
• Normal Termination: DSACK≈ is asserted; BERR and HALT remain negated (case 1).
• Halt Termination: HALT is asserted at the same time as or before DSACKx, and
BERR remains negated (case 2).
• Bus Error Termination: BERR is asserted in lieu of, at the same time as, or before
DSACK≈ (case 3) or after DSACK≈ (case 4), and HALT remains negated; BERR is
negated at the same time as or after DSACK≈.
• Retry Termination: HALT and BERR are asserted in lieu of, at the same time as, or
before DSACK≈ (case 5) or after DSACK≈ (case 6); BERR is negated at the same
time as or after DSACK≈, and HALT may be negated at the same time as or after
BERR.
Table 3-4 lists various combinations of control signal sequences and the resulting bus
cycle terminations. To ensure predictable operation, BERR and HALT should be negated
according to the specifications given in Section 11 Electrical Characteristics. DSACK≈
BERR, and HALT may be negated after AS. If DSACK≈ or BERR remain asserted into S2
of the next bus cycle, that cycle may be terminated prematurely.
EXAMPLE B: A system uses error detection and correction on RAM contents. The
designer may:
1. Delay DSACK≈ until data is verified and assert BERR and HALT simultaneously to
indicate to the MC68340 to automatically retry the error cycle (case 5), or if data is
valid, assert DSACK≈ (case 1).
2. Delay DSACK≈ until data is verified and assert BERR with or without DSACK≈ if
data is in error (case 3). This initiates exception processing for software handling of
the condition.
3. Return DSACK≈ prior to data verification; if data is invalid, BERR is asserted on the
next clock cycle (case 4). This initiates exception processing for software handling of
the condition.
4. Return DSACK≈ prior to data verification; if data is invalid, assert BERR and HALT
Freescale Semiconductor, Inc...
on the next clock cycle (case 6). The memory controller can then correct the RAM
prior to or during the automatic retry.
The instruction prefetch mechanism requests instruction words from the bus controller
before it is ready to execute them. If a bus error occurs on an instruction fetch, the
MC68340 does not take the exception until it attempts to use that instruction word. Should
an intervening instruction cause a branch or should a task switch occur, the bus error
Freescale Semiconductor, Inc...
exception does not occur. The bus error condition is recognized during a bus cycle in any
of the following cases:
• DSACK≈ and HALT are negated, and BERR is asserted.
• HALT and BERR are negated, and DSACK≈ is asserted. BERR is then asserted
within one clock cycle ( HALT remains negated).
When the MC68340 recognizes a bus error condition, it terminates the current bus cycle in
the normal way. Figure 3-17 shows the timing of a bus error for the case in which
DSACK≈ is not asserted. Figure 3-18 shows the timing for a bus error that is asserted
after DSACK≈. Exceptions are taken in both cases. Refer to Section 5 CPU32 for details
of bus error exception processing.
In the second case, in which BERR is asserted after DSACK≈ is asserted, BERR must be
asserted within the time specified for purely asynchronous operation, or it must be
asserted and remain stable during the sample window around the next falling edge of the
clock after DSACK≈ is recognized. If BERR is not stable at this time, the MC68340 may
exhibit erratic behavior. BERR has priority over DSACK≈ . In this case, data may be
present on the bus, but it may not be valid. This sequence can be used by systems that
have memory error detection and correction logic and by external cache memories.
S0 S2 SW SW S4 S0 S2 S4
CLKOUT
A31–A0
Freescale Semiconductor, Inc...
FC3–FC0
R/W
AS
DS
DSACKx
D15–D0
BERR
S0 S2 S4 S0 S2 S4
CLKOUT
A31–A0
FC3–FC0
R/W
AS
Freescale Semiconductor, Inc...
DS
DSACKx
D15–D0
BERR
S0 S2 SW SW S4 S0 S2 S4
CLKOUT
A31–A0
FC3–FC0
R/W
AS
Freescale Semiconductor, Inc...
DS
DSACKx
D15–D0 DATA
IGNORED
BERR
HALT
The MC68340 retries any read or write cycle of a read-modify-write operation separately;
RMC remains asserted during the entire retry sequence. Asserting BR along with BERR
and HALT provides a relinquish and retry operation. The MC68340 does not relinquish the
bus during a read-modify-write operation. Any device that requires the MC68340 to give
up the bus and retry a bus cycle during a read-modify-write cycle must assert only BERR
and BR (HALT must not be included). The bus error handler software should examine the
read-modify-write bit in the special status word (see Section 5 CPU32) and take the
appropriate action to resolve this type of fault when it occurs.
S0 S2 S4 S0 S2 S4
CLKOUT
A31–A0
FC3–FC0
R/W
AS
DS
Freescale Semiconductor, Inc...
DSACKx
D15–D10
BERR
HALT
When the MC68340 completes a bus cycle with HALT asserted, D15–D0 is placed in the
high-impedance state, and bus control signals are negated (not high-impedance state);
the A31–A0, FCx, SIZx, and R/W signals remain in the same state. The halt operation has
no effect on bus arbitration (see 3.6 Bus Arbitration). When bus arbitration occurs while
the MC68340 is halted, the address and control signals are also placed in the high-
impedance state. Once bus mastership is returned to the MC68340, if HALT is still
asserted, the A31–A0, FCx, SIZx, and R/ W signals are again driven to their previous
states. The MC68340 does not service interrupt requests while it is halted.
S0 S2 S4 S0 S2 S4 S0
CLKOUT
A31–A0
FC3–FC0
R/W
Freescale Semiconductor, Inc...
AS
DS
DSACKx
D15–D10
HALT
BR
BG
BGACK
For example, the MC68340 attempts to stack several words containing information about
the state of the machine while processing a bus error exception. If a bus error exception
occurs during the stacking operation, the second error is considered a double bus fault.
When a double bus fault occurs, the MC68340 halts and asserts HALT. Only a reset
operation can restart a halted MC68340. However, bus arbitration can still occur (see 3.6
Bus Arbitration). A second bus error or address error that occurs after exception
processing has completed (during the execution of the exception handler routine or later)
does not cause a double bus fault. A bus cycle that is retried does not constitute a bus
error or contribute to a double bus fault. The MC68340 continues to retry the same bus
cycle as long as the external hardware requests it.
Reset can also be generated internally by the halt monitor (see Section 5 CPU32).
the MC68340 or an external device. One or more of the external devices on the bus can
have the capability of becoming bus master for the external bus, but not the MC68340
internal bus. Bus arbitration is the protocol by which an external device becomes bus
master; the bus controller in the MC68340 manages the bus arbitration signals so that the
MC68340 has the lowest priority. External devices that need to obtain the bus must assert
the bus arbitration signals in the sequences described in the following paragraphs.
Systems having several devices that can become bus master require external circuitry to
assign priorities to the devices so that, when two or more external devices attempt to
become bus master at the same time, the one having the highest priority becomes bus
master first. The sequence of the protocol is as follows:
1. An external device asserts BR.
2. The MC68340 asserts BG to indicate that the bus is available.
3. The external device asserts BGACK to indicate that it has assumed bus mastership.
NOTE
The MC68340 does not place CS3–CS0 in a high-impedance
state after reset or when the bus is granted to an external
master.
BR may be issued any time during a bus cycle or between cycles. BG is asserted in
response to BR. To guarantee operand coherency, BG is only asserted at the end of an
operand transfer. Additionally, BG is not asserted until the end of a read-modify-write
operation (when RMC is negated) in response to a BR signal. When the requesting device
receives BG and more than one external device can be bus master, the requesting device
should begin whatever arbitration is required. When the external device assumes bus
mastership, it asserts BGACK and maintains BGACK during the entire bus cycle (or
cycles) for which it is bus master. The following conditions must be met for an external
device to assume mastership of the bus through the normal bus arbitration procedure: 1) it
must have received BG through the arbitration process, and 2) BGACK must be inactive,
indicating that no other bus master has claimed ownership of the bus.
Figure 3-22 is a flowchart showing bus arbitration for a single device. This technique
allows processing of bus requests during data transfer cycles. Refer to Figures 3-23 and
3-24 for bus arbitration timing diagrams.
BR is negated at the time that BGACK is asserted. This type of operation applies to a
system consisting of the MC68340 and one device capable of bus mastership. In a system
having a number of devices capable of bus mastership, BR from each device can be wire-
ORed to the MC68340. In such a system, more than one bus request could be asserted
simultaneously. BG is negated a few clock cycles after the transition of BGACK. However,
if bus requests are still pending after the negation of BG, the MC68340 asserts another BG
within a few clock cycles after it was negated. This additional assertion of BG allows
external arbitration circuitry to select the next bus master before the current bus master
has finished using the bus. The following paragraphs provide additional information about
the three steps in the arbitration process. Bus arbitration requests are recognized during
Freescale Semiconductor, Inc...
normal processing, HALT assertion, and a CPU32 halt caused by a double bus fault.
1. ASSERT BG
ACKNOWLEDGE BUS MASTERSHIP
RE-ARBITRATE OR RESUME
PROCESSOR OPERATION 1. NEGATE BGACK
CLKOUT
A31–A0
D15–D0
AS
BR
BG
Freescale Semiconductor, Inc...
BGACK
S0 S1 S2 S3 S4 S5
CLKOUT
A31–A0
D15–D0
AS
DS
R/W
DSACK0,
DSACK1
BR
BG
BGACK
bus cycles, the MC68340 does not release the bus until the entire transfer is complete.
Therefore, assertion of BG is subject to the following constraints:
• The minimum time for BG assertion after BR is asserted depends on internal
synchronization (see Section 11 Electrical Characteristics).
• During an external operand transfer, the MC68340 does not assert BG until after
the last cycle of the transfer (determined by SIZx and DSACK≈).
• During an external operand transfer, the MC68340 does not assert BG as long as
RMC is asserted.
• If the show cycle bits SHEN1–SHEN0 = 01, the MC68340 does not assert BG to
an external master.
Once an external device receives the bus and asserts BGACK, it should negate BR. If BR
remains asserted after BGACK is asserted, the MC68340 assumes that another device is
requesting the bus and prepares to issue another BG.
State changes occur on the next rising edge of the clock after the internal signal is valid.
The BG signal transitions on the falling edge of the clock after a state is reached during
Freescale Semiconductor, Inc...
which G changes. The bus control signals (controlled by T) are driven by the MC68340
immediately following a state change, when bus mastership is returned to the MC68340.
State 0, in which G and T are both negated, is the state of the bus arbiter while the
MC68340 is bus master. R and A keep the arbiter in state 0 as long as they are both
negated.
The MC68340 does not allow arbitration of the external bus during the RMC sequence.
For the duration of this sequence, the MC68340 ignores the BR input. If mastership of the
bus is required during an RMC operation, BERR must be used to abort the RMC sequence.
After reset, show cycles are disabled and must be enabled by writing to the SHEN bits in
the module configuration register (see 4.3.2.1 Module Configuration Register (MCR)).
When show cycles are disabled, the A31–A0, FCx, SIZx, and R/ W signals continue to
reflect internal bus activity. However, AS and DS are not asserted externally, and the
external data bus remains in a high-impedance state. When show cycles are enabled, DS
indicates address strobe timing and the external data bus contains data. The following
paragraphs are a state-by-state description of show cycles, and Figure 3-26 illustrates a
show cycle timing diagram. Refer to Section 11 Electrical Characteristics for specific
timing information.
RA + B
GTV
AB
STATE 0
RA
RAB
RA
Freescale Semiconductor, Inc...
G TV
RA
STATE 3
R+A
G TV
STATE 2
R A +A
G TV
R
R
STATE 5
RA
G TV
RA
STATE 6
RA
State 0—During state 0, the A31–A0 and FCx become valid, R/ W is driven to indicate a
show read or write cycle, and the SIZx pins indicate the number of bytes to transfer.
During a read, the addressed peripheral is driving the data bus, and the user must take
care to avoid bus conflicts.
State 41—One-half clock cycle later, DS (rather than AS ) is asserted to indicate that
address information is valid.
State 42—No action occurs in state 42. The bus controller remains in state 42 (wait states
will be inserted) until the internal read cycle is complete.
State 43—When DS is negated, show data is valid on the next falling edge of the system
clock. The external data bus drivers are enabled so that data becomes valid on the
external bus as soon as it is available on the internal bus.
Freescale Semiconductor, Inc...
State 0—The A31–A0, FCx, R/W , and SIZx pins change to begin the next cycle. Data
from the preceding cycle is valid through state 0.
CLKOUT
A31–A0,
FC2–FC0,
SIZ1–SIZ0
R/W
AS, CS
DS
D15–D0
BKPT
Asynchronous reset sources indicate a catastrophic failure, and the reset controller logic
immediately resets the system. Resetting the MC68340 causes any bus cycle in progress
to terminate as if DSACK≈ or BERR had been asserted. In addition, the MC68340
appropriately initializes registers for a reset exception. Asynchronous reset sources
include power-up, software watchdog, double bus fault resets, and execution of the
RESET instruction.
Freescale Semiconductor, Inc...
If an external device drives RESET low, RESET should be asserted for at least 590 clock
periods to ensure that the MC68340 resets. The reset control logic holds reset asserted
internally until the external RESET is released. When the reset control logic detects that
external RESET is no longer being driven, it drives both internal and external reset low for
an additional 512 cycles to guarantee this length of reset to the entire system. Figure 3-27
shows the RESET timing.
1 CLOCK
RESET
590 CLOCK 512 CLOCK
If reset is asserted from any other source, the reset control logic asserts RESET for 328
input clock periods plus 512 output clock periods, and until the source of reset is negated.
After any internal reset occurs, a 14-cycle rise time is allowed before testing for the
presence of an external reset. If no external reset is detected, the CPU32 begins its vector
fetch.
Figure 3-28 is a timing diagram of the power-up reset operation, showing the relationships
between RESET, V CC , and bus signals. During the reset period, the entire bus three-
states except for non-three-statable signals, which are driven to their inactive state. Once
RESET negates, all control signals are driven to their inactive state, the data bus is in read
mode, and the address bus is driven. After this, the first bus cycle for RESET exception
processing begins.
CLKOUT
VCO
LOCK
VCC
328 × 512 × ≤ 14 CLOCKS
TCLKIN TCLKOUT
RESET
BUS
CYCLES
ADDRESS AND
BUS STATE 1 2 3 4
CONTROL SIGNALS
UNKNOWN
THREE-STATED
NOTES:
Freescale Semiconductor, Inc...
When a RESET instruction is executed, the MC68340 drives the RESET signal for 512
clock cycles. The SIM40 registers and the module control registers in each internal
peripheral module (DMA, timers, and serial modules) are not affected. All other peripheral
module registers are reset the same as for a hardware reset. The external devices
connected to the RESET signal are reset at the completion of the RESET instruction.
SECTION 4
SYSTEM INTEGRATION MODULE
The MC68340 system integration module (SIM40) consists of several functions that
control the system start-up, initialization, configuration, and the external bus with a
minimum of external devices. It also provides the IEEE 1149.1 boundary scan capabilities.
The SIM40 includes the following functions:
Freescale Semiconductor, Inc...
The system configuration and protection function controls system configuration and
provides various monitors and timers, including the internal bus monitor, double bus fault
monitor, spurious interrupt monitor, software watchdog timer, and the periodic interrupt
timer.
The clock synthesizer generates the clock signals used by the SIM40 and the other on-
chip modules, as well as CLKOUT used by external devices.
The programmable chip select function provides four chip select signals that can enable
external memory and peripheral circuits, providing all handshaking and timing signals.
Each chip select signal has an associated base address register and an address mask
register that contain the programmable characteristics of that chip select. Up to three wait
states can be programmed by setting bits in the address mask register.
The external bus interface (EBI) handles the transfer of information between the internal
CPU32 and memory, peripherals, or other processing elements in the external address
space. See Section 3 Bus Operation for further information.
The MC68340 dynamically interprets the port size of an addressed device during each
bus cycle, allowing operand transfers to or from 8-, 16-, and 32-bit ports. The device
signals its port size and indicates completion of the bus cycle through the use of the
DSACK≈ inputs. Dynamic bus sizing allows a programmer to write code that is not bus-
width specific. For a discussion on dynamic bus sizing, see Section 3 Bus Operation.
The MC68340 includes dedicated user-accessible test logic that is fully compliant with the
IEEE 1149.1 Standard Test Access Port and Boundary Scan Architecture . Problems
associated with testing high-density circuit boards have led to the development of this
standard under the sponsorship of the IEEE Test Technology Committee and Joint Test
Freescale Semiconductor, Inc...
Action Group (JTAG). The MC68340 implementation supports circuit-board test strategies
based on this standard. Refer to Section 9 IEEE 1149.1 Test Access Port for additional
information.
NOTE
The terms assert and negate are used throughout this section
to avoid confusion when dealing with a mixture of active-low
and active-high signals. The term assert or assertion indicates
that a signal is active or true independent of the level
represented by a high or low voltage. The term negate or
negation indicates that a signal is inactive or false.
The location of the internal registers is fixed by writing the desired base address of the
4-Kbyte block to the MBAR using the MOVES instruction to address $0003FF00 in CPU
space. The source function code (SFC) and destination function code (DFC) registers
contain the address space values (FC3–FC0) for the read or write operand of the MOVES
instruction (see Section 5 CPU32 or M68000PM/AD, Programmer’s Reference Manual ).
Therefore, the SFC or DFC register must indicate CPU space (FC3–FC0 = $7), using the
MOVEC instruction, before accessing MBAR. The offset from the base address is shown
above each register diagram.
$FFFFFFFF
$XXXXXFFF $FFF
MC68340
$7BF
RELOCATABLE DMA
MODULE
$780
BLOCK
$XXXXX000 $721
SERIAL PORTS
$700
.
$67F
TIMER MODULES
$600
$07F
Freescale Semiconductor, Inc...
SIM 40
MBAR $000
($0003FF00
FC=0111)
RAM
(TYPICAL)
$00000000
All M68000 family members are designed to provide maximum system safeguards. As an
extension of the family, the MC68340 promotes the same basic concepts of safeguarded
design present in all M68000 members. In addition, many functions that normally must be
provided by external circuits are incorporated in this device. The following features are
provided in the system configuration and protection function:
Reset Status
The reset status register provides the user with information on the cause of the most
recent reset. The possible causes of reset include: external, power-up, software
watchdog, double bus fault, loss of clock, and RESET instruction.
frame during an RTE instruction. This function can be disabled. See Section 3 Bus
Operation for more information.
Software Watchdog
The software watchdog asserts reset or a level 7 interrupt (as selected by the system
protection and control register) if the software fails to service the software watchdog for
a designated period of time (i.e., because it is trapped in a loop or lost). There are eight
selectable timeout periods. This function can be disabled.
Figure 4-2 shows a block diagram of the system configuration and protection function.
MODULE
CONFIGURATION
RESET
STATUS
HALT
DOUBLE BUS
RESET
FAULT MONITOR
REQUEST
BUS BERR
MONITOR
Freescale Semiconductor, Inc...
SPURIOUS
INTERRUPT MONITOR
SOFTWARE SOFTWARE
CLOCK RESET
WATCHDOG
REQUEST or
29 IRQ7
PRESCALER
PERIODIC IRQ7-IRQ1
INTERRUPT TIMER
The configuration of port B is controlled by the combination of the FIRQ bit in the MCR
and the port B pin assignment register (PPARB). Port B pins can function as dedicated I/O
lines, chip selects, interrupts, or autovector input.
For debug purposes, internal bus accesses can be shown on the external bus. This
function is called show cycles. The SHEN1, SHEN0 bits in the MCR control show cycles.
Bus arbitration can be either enabled or disabled during show cycles.
Arbitration for servicing interrupts is controlled by the value programmed into the interrupt
arbitration (IARB) field of the MCR. Each module that generates interrupts, including the
SIM40, has an IARB field. The value of the IARB field allows arbitration during an IACK
cycle among modules that simultaneously generate the same interrupt level. No two
modules should share the same IARB value. The IARB must contain a value other than $0
for all modules that can generate interrupts; interrupts with IARB = 0 are discarded as
extraneous. The SIM40 arbitrates for both its own interrupts and externally generated
interrupts.
There are eight arbitration levels for access to the intermodule bus (IMB). The SIM40 is
fixed at the highest level (above the programmable level 7), and the CPU32 is fixed at the
lowest level (below level 0). The direct memory access (DMA) module is the only other
module that can become bus master and arbitrate for the bus. It must be initialized with a
level other than 0 or 7.
The AVR contains bits that correspond to external interrupt levels that require an
autovector response. The SIM40 supports up to seven discrete external interrupt
requests. If the bit corresponding to an interrupt level is set in the AVR, the SIM40 returns
an autovector in response to the IACK cycle servicing that external interrupt request.
Otherwise, external circuitry must either return an interrupt vector or assert the external
AVEC signal.
4.2.2.2 INTERNAL BUS MONITOR. The internal bus monitor continually checks for the
Freescale Semiconductor, Inc...
bus cycle termination response time by checking the DSACK≈, BERR, and HALT status or
the AVEC status during an IACK cycle. The monitor initiates a bus error if the response
time is excessive. The bus monitor feature cannot be disabled for internal accesses to an
internal module. The internal bus monitor cannot check the DSACK≈ response on the
external bus unless the MC68340 is the bus master. The BME bit in the system protection
control register (SYPCR) enables the internal bus monitor for internal-to-external bus
cycles. If the system contains external bus masters whose bus cycles must be monitored,
an external bus monitor must be implemented. In this case, the internal-to-external bus
monitor option must be disabled.
The bus cycle termination response time is measured in clock cycles, and the maximum-
allowable response time is programmable. The bus monitor response time period ranges
from 8 to 64 system clocks (see Table 4-8). These options are provided to allow for
different response times of peripherals that might be used in the system.
4.2.2.3 DOUBLE BUS FAULT MONITOR. A double bus fault is caused by a bus error or
address error during the exception processing sequence. The double bus fault monitor
responds to an assertion of HALT on the internal bus. Refer to Section 3 Bus Operation
for more information. The DBF bit in the reset status register (RSR) indicates that the last
reset was caused by the double bus fault monitor. The double bus fault monitor reset can
be enabled by the DBFE bit in the SYPCR.
4.2.2.4 SPURIOUS INTERRUPT MONITOR. The spurious interrupt monitor issues BERR
if no interrupt arbitration occurs during an IACK cycle. Normally, during an IACK cycle,
one or more internal modules recognize that the CPU32 is responding to interrupt
request(s) and arbitrate for the privilege of returning a vector or asserting AVEC . (The
SIM40 reports and arbitrates for externally generated interrupts.) This feature cannot be
disabled.
interrupt (as programmed by the SWRI bit in the SYPCR). The address of the interrupt
service routine for the software watchdog interrupt is stored in the software interrupt vector
register (SWIV). Figure 4-3 shows a block diagram of the software watchdog as well as
the clock control circuits for the periodic interrupt timer.
The watchdog clock rate is determined by the SWP bit in the periodic interrupt timer
register (PITR) and the SWT bits in the SYPCR. See Table 4-7 for a list of watchdog
timeout periods.
The software watchdog service sequence consists of the following steps: 1) write $55 to
the software service register (SWSR) and 2) write $AA to the SWSR. Both writes must
occur in the order listed prior to the watchdog timeout, but any number of instructions or
accesses to the SWSR can be executed between the two writes.
Freescale Semiconductor, Inc...
PITR
SWP
PTP
FREEZE
. PITCLK PIT
CLOCK .4 MODULUS COUNTER INTERRUPT
CLOCK MUX
EXTAL PRESCALER (2 9 )
DISABLE PRECLK
RESET
SWCLK
15 STAGE DIVIDER CHAIN (215 )
LPSTOP
29 2 11 213 215
4.2.2.6 PERIODIC INTERRUPT TIMER. The periodic interrupt timer consists of an 8-bit
modulus counter that is loaded with the value contained in the PITR (see Figure
4-3). The modulus counter is clocked by a signal derived from the EXTAL input pin unless
an external frequency source is used. When an external frequency source is used
(MODCK low during reset), the default state of the prescaler control bits (SWP and PTP)
in the PITR is changed to enable both prescalers.
Either clock source (EXTAL or EXTAL ÷ 512) is divided by 4 before driving the modulus
counter (PITCLK). When the modulus counter value reaches zero, an interrupt is
generated. The level of the generated interrupt is programmed into the PIRQL bits in the
periodic interrupt control register (PICR). During the IACK cycle, the SIM40 places the
periodic interrupt vector, programmed into the PIV bits in the PICR, onto the internal bus.
The value of bits 7–0 in the PITR is then loaded again into the modulus counter, and the
counting process starts over. If a new value is written to the PITR, this value is loaded into
the modulus counter when the current count is completed.
4.2.2.6.1 Periodic Timer Period Calculation. The period of the periodic timer can be
calculated using the following equation:
Solving the equation using a crystal frequency of 32.768-kHz with the prescaler disabled
gives:
This gives a range from 122 µs, with a PITR value of $01 (00000001 binary), to 31.128
ms, with a PITR value of $FF (11111111 binary).
Solving the equation with the prescaler enabled (PTP=1 in the PITR) gives the following
values:
This gives a range from 62.5 ms, with a PITR value of $01, to 15.94 s, with a PITR value
of $FF.
For fast calculation of periodic timer period using a 32.768-kHz crystal, the following
equations can be used:
4.2.2.6.2 Using the Periodic Timer as a Real-Time Clock. The periodic interrupt timer
can be used as a real-time clock interrupt by setting it up to generate an interrupt with a
one-second period. Rearranging the periodic timer period equation to solve for the desired
count value:
Therefore, when using a 32.768-kHz crystal, the PITR should be loaded with a value of
Freescale Semiconductor, Inc...
In crystal mode (see Figure 4-4), the clock synthesizer can operate from the on-chip PLL
and VCO, using a parallel resonant crystal connected between the EXTAL and XTAL pins,
or an external oscillator connected to EXTAL as a reference frequency source. The
oscillator circuit is shown in Figure 4-5. A 32.768-kHz watch crystal provides an
inexpensive reference, but the reference crystal or external oscillator frequency can be
any frequency in the range specified in Section 11 Electrical Characteristics. When
using crystal mode, the system clock frequency is programmable (using the W, X, and Y
bits in the SYNCR) over the range specified in Section 11 Electrical Characteristics
(see Table 4-2.).
VDDSYN
XFC 1 0.1 µF
20 pF 20 pF
330 K
20 M 0.1 µF
CRYSTAL MUX
OSCILLATOR PHASE LOW-PASS 1
VCO
COMPARATOR FILTER
CLKOUT
Freescale Semiconductor, Inc...
÷2 0
SEL
÷64 MUX 0
1 ÷4
MODULUS
DIVIDER X
0 ÷8
SEL
6
$3F 0
FEEDBACK DIVIDER
Y W
60 kΩ
EXTAL XTAL
. 60 kΩ
A separate power pin (VCCSYN ) is used to allow the clock circuits to run with the rest of
the device powered down and to provide increased noise immunity for the clock circuits.
The source for VCCSYN should be a quiet power supply with adequate external bypass
capacitors placed as close as possible to the VCCSYN pin to ensure a stable operating
frequency. Figure 4-4 shows typical values for the bypass and PLL external capacitors.
The crystal manufacturer's documentation should be consulted for specific
recommendations for external components.
To use an external clock source (see Figure 4-6), the operating clock frequency can be
driven directly into the EXTAL pin (the XTAL pin must be left floating for this case). This
approach results in a system clock and CLKOUT that are the same as the input signal
frequency, but not tightly coupled to it. To enable this mode, MODCK must be held low
during reset, and VCCSYN held at 0 V while the chip is in operation.
VCCSYN
XFC 1 0.1 µF
EXTERNAL
CLOCK
CRYSTAL
OSCILLATOR PHASE LOW-PASS
VCO
COMPARATOR FILTER
2 FEEDBACK
DIVIDER
NOTES:
1. Must be low-leakage capacitor.
2. External mode uses this path only.
Alternatively, an external clock signal can be directly driven into EXTAL (with XTAL left
floating) using the on-chip PLL. This configuration results in an internal clock and
CLKOUT signal of the same frequency as the input signal, with a tight skew between the
external clock and the internal clock and CLKOUT signals. To enable this mode, MODCK
must be held low during reset, and V CCSYN should be connected to a quiet 5-V source.
If an input signal loss for either of the clock modes utilizing the PLL occurs, chip operation
can continue in limp mode with the VCO running at approximately one-half the operating
speed (affected by the value of the X-bit in the SYNCR), using an internal voltage
reference. The SLIMP bit in the SYNCR indicates that a loss of input signal reference has
been detected. The RSTEN bit in the SYNCR controls whether an input signal loss causes
a system reset or causes the device to operate in limp mode. The SLOCK bit in the
SYNCR indicates when the VCO has locked onto the desired frequency or if an external
clock is being used.
4.2.3.1 PHASE COMPARATOR AND FILTER. The phase comparator takes the output of
the frequency divider and compares it to an external input signal reference. The result of
this compare is low-pass filtered and used to control the VCO. The comparator also
detects when the external crystal or oscillator stops running to initiate the limp mode for
the system clock.
The PLL requires an external low-leakage filter capacitor, typically in the range from 0.01
to 0.1 µF, connected between the XFC and VCCSYN pins. The XFC capacitor should
provide 50-MΩ insulation but should not be electrolytic. Smaller values of the external filter
capacitor provide a faster response time for the PLL, and larger values provide greater
frequency stability. For external clock mode without PLL, the XFC pin can be left open.
4.2.3.2 FREQUENCY DIVIDER. The frequency divider circuits divide the VCO frequency
down to the reference frequency for the phase comparator. The frequency divider consists
of 1) a 2-bit prescaler controlled by the W-bit in the SYNCR and 2) a 6-bit modulo
downcounter controlled by the Y-bits in the SYNCR.
Freescale Semiconductor, Inc...
Several factors are important to the design of the system clock. The resulting system clock
frequency must be within the limits specified for the device. The frequency of the system
clock is given by the following equation:
The maximum VCO frequency limit must also be observed. The VCO frequency is given
by the following equation:
Since clearing the X-bit causes the VCO to run at twice the system frequency, the VCO
upper frequency limit must be considered when programming the SYNCR. Both the
system clock and VCO frequency limits are given in Section 11 Electrical
Characteristics. Table 4-2 lists some frequencies available from various combinations of
SYNCR bits with a reference frequency of 32.768-KHz.
4.2.3.3 CLOCK CONTROL. The clock control circuits determine the source used for both
internal and external clocks during special circumstances, such as low-power stop
(LPSTOP) execution.
Table 4-3 summarizes the clock activity during LPSTOP in crystal mode operation. Any
clock in the off state is held low. The STEXT and STSIM bits in the SYNCR control clock
activity during LPSTOP. Refer to 4.2.6 Low-Power Stop for additional information.
4.2.4.1 PROGRAMMABLE FEATURES. The chip select function supports the following
programmable features:
The block size, starting from the specified base address, can vary in size from 256
bytes up to 4 Gbytes in 2n increments. The specified base address must be on a
multiple of the the block size. The block size is specified in the address mask register.
Internal DSACK≈ Generation for External Accesses with Programmable Wait States
DSACK≈ can be generated internally with up to three wait states for a particular device
using the DD bits in the address mask register.
4.2.4.2 GLOBAL CHIP SELECT OPERATION. Global chip select operation allows
address decode for a boot ROM before system initialization occurs. CS0 is the global chip
select output, and its operation differs from the other external chip select outputs following
reset. When the CPU32 begins fetching after reset, CS0 is asserted for every address
until the V-bit is set in the CS0 base address register.
NOTE
If an access matches multiple chip selects, the lowest
numbered chip select will have priority. For example, if CS0
and CS2 "overlap" for a certain range, CS0 will assert when
accessing the "overlapped" address range, and CS2 will not.
Global chip select provides a 16-bit port with three wait states, which allows a boot ROM
to be located in any address space and still provide the stack pointer and program counter
values at $00000000 and $00000004, respectively. Global chip select does not provide
write protection and responds to all function codes. While CS0 is a global chip select, no
other chip select (CS1, CS2, CS3 ) can be used. CS0 operates in this manner until the
V-bit is set in the CS0 base address register, which will then allow the use of CS3–CS1.
Provided the desired address range is first loaded into the CS0 base address register,
Freescale Semiconductor, Inc...
CS0 can be programmed to continue decode for a range of addresses after the V-bit is
set, After the V-bit is set for CS0, global chip select can only be restarted with a system
reset.
A system can use an 8-bit boot ROM if an external 8-bit DSACK≈ that responds in two or
less wait states is generated. The 8-bit DSACK≈ must respond in two or less wait states
so that the global chip select, which responds with three wait states, will not be used. See
Section 10 Applications for a detailed discussion.
MODCK/PORT B0
IRQ7/PORT B7
IRQ6/PORT B6
INTERRUPT IRQ5/PORT B5
PORT IRQ3/PORT B3
Freescale Semiconductor, Inc...
LOGIC IRQ4/PORT B4
IRQ2/PORT B2
IRQ1/PORT B1
CS3/IRQ4/PORT B4
AVEC
CS2/IRQ2/PORT B2
FULL IRQ
MUX CS1/IRQ1/PORT B1
CS3 CS0/AVEC
CHIP- CS2
SELECT CS1
MODULE CS0
FIRQ
The number of wait states programmed into the internal wait state generation logic by a
chip select can be used even though the pin is not used as a C S ≈ signal. The
programmed number of wait states in the CS≈ signal applies to the port B pins configured
as IRQ≈ or I/O pins. This is done by programming the chip select with the number of wait
states to be added, as though it were to be used. The DD1/DD0 and PS1/PS0 bits in the
chip select address mask register must be set to add the desired number of wait states
(the V-bit in the module base address register should be set).
Table 4-3). LPSTOP disables the clock to the software watchdog in the low state. The
software watchdog remains stopped until the LPSTOP mode ends; it begins to run again
on the next rising clock edge.
NOTE
When the CPU32 executes the STOP instruction (as opposed
to LPSTOP), the software watchdog continues to run. If the
software watchdog is enabled, it issues a reset or interrupt
when timeout occurs.
The periodic interrupt timer does not respond to an LPSTOP instruction; thus, it can be
used to exit LPSTOP as long as the interrupt request level is higher than the CPU32
interrupt mask level. To stop the periodic interrupt timer while in LPSTOP, the PITR must
be loaded with a zero value before LPSTOP is executed. The bus monitor, double bus
fault monitor, and spurious interrupt monitor are all inactive during LPSTOP.
The STP bit in the MCR of each on-chip module (DMA, timers, and serial modules) should
be set prior to executing the LPSTOP instruction. Setting the STP bit stops all clocks
within each of the modules, except for the clock from the IMB. The clock from the IMB
remains active to allow the CPU32 access to the MCR of each module. The system clock
stops on the low phase of the clock and remains stopped until the STP bit is cleared by
the CPU32 or until reset. For more information, see the description of the MCR STP bit for
each module.
If an external device requires additional time to prepare for entry into LPSTOP mode,
entry can be delayed by asserting HALT (see 3.4.2 LPSTOP Broadcast Cycle ).
4.2.7 Freeze
FREEZE is asserted by the CPU32 if a breakpoint is encountered with background mode
enabled. Refer to Section 5 CPU32 for more information on the background mode. When
FREEZE is asserted, the double bus fault monitor and spurious interrupt monitor continue
to operate normally. However, the software watchdog, the periodic interrupt timer and the
internal bus monitor will be affected. When FREEZE is asserted, setting the FRZ1 bit in
the MCR disables the software watchdog and periodic interrupt timer, and setting the
FRZ0 bit in the MCR disables the bus monitor.
For the registers discussed in the following pages, the number in the upper right-hand
corner indicates the offset of the register from the address stored in the module base
Freescale Semiconductor, Inc...
address register. The numbers on the top line of the register represent the bit position in
the register. The second line contains the mnemonic for the bit. The numbers below the
register represent the bit values after a hardware reset. The access privilege is indicated
in the lower right-hand corner.
NOTE:
A CPU32 RESET instruction will not affect any of the SIM40
registers.
ADDR FC 15 8 7 0
000 S MODULE CONFIGURATION REGISTER (MCR) SYSTEM
PROTECTION
BA31 BA30 BA29 BA28 BA27 BA26 BA25 BA24 BA23 BA22 BA21 BA20 BA19 IBA18 BA17 BA16
RESET:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BA15 BA14 BA13 BA12 0 0 AS8 AS7 AS6 AS5 AS4 AS3 AS2 AS1 AS0 V
RESET
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
V—Valid Bit
This bit indicates when the contents of the MBAR are valid. The base address value is
not used; therefore, all internal module registers are not accessible until the V-bit is set.
1 = Contents are valid.
0 = Contents are not valid.
NOTE
An access to this register does not affect external space since
the cycle is not run externally.
Register D0 will contain the value of MBAR. MBAR can be read using the following code:
Address $0003FF00 in CPU space (MBAR) will be loaded with the value $FFFFF001.
Freescale Semiconductor, Inc...
This value will set the base address of the internal registers to $FFFFF. MBAR can be
written to using the following code:
4.3.2.1 MODULE CONFIGURATION REGISTER (MCR). The MCR, which controls the
SIM40 configuration, can be read or written at any time.
MCR $000
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 FRZ1 FRZ0 FIRQ 0 0 SHEN1 SHEN0 SUPV 0 0 0 IARB3 IARB2 IARB1 IARB0
RESET:
0 1 1 0 0 0 0 0 1 0 0 0 1 1 1 1
Supervisor Only
transfer operations (see Table 4-6). A show cycle allows internal transfers to be
externally monitored. The address, data, and control signals (except for AS) are driven
externally. DS is used to signal address strobe timing for show cycles. Data is valid on
the next falling clock edge after DS is negated. However, data is not driven externally,
and AS and DS are not asserted externally for internal accesses unless show cycles
are enabled.
If external bus arbitration is disabled, the EBI will not recognize an external bus request
until arbitration is enabled again. To prevent bus conflicts, external peripherals must not
attempt to initiate cycles during show cycles with arbitration disabled.
value of $0 prevents arbitration and causes all SIM40 interrupts, including external
interrupts, to be discarded as extraneous.
4.3.2.2 AUTOVECTOR REGISTER (AVR). The AVR contains bits that correspond to
external interrupt levels that require an autovector response. Setting a bit allows the
SIM40 to assert an internal AVEC during the IACK cycle in response to the specified
interrupt request level. This register can be read and written at any time.
AVR $006
7 6 5 4 3 2 1 0
RESET:
0 0 0 0 0 0 0 0
Supervisor Only
Freescale Semiconductor, Inc...
NOTE:
The IARB field in the MCR must contain a value other than $0
for the SIM40 to autovector for external interrupts.
4.3.2.3 RESET STATUS REGISTER (RSR). The RSR contains a bit for each reset source
to the SIM40. A set bit indicates the last type of reset that occurred, and only one bit can
be set in the register. The RSR is updated by the reset control logic when the SIM40
comes out of reset. This register can be read at any time; a write has no effect. For more
information, see Section 3 Bus Operation.
RSR $007
7 6 5 4 3 2 1 0
Supervisor Only
EXT—External Reset
1 = The last reset was caused by an external signal driving RESET.
POW—Power-Up Reset
1 = The last reset was caused by the power-up reset circuit.
Bits 3, 0—Reserved
SYS—System Reset
1 = The last reset was caused by the CPU32 executing a RESET instruction. The
system reset does not load a reset vector or affect any internal CPU32 registers,
SIM40 configuration registers, or the MCR in each internal peripheral module
(DMA, timers, and serial modules). It will, however, reset external devices and all
other registers in the peripheral modules.
4.3.2.4 SOFTWARE INTERRUPT VECTOR REGISTER (SWIV). The SWIV contains the
8-bit vector that is returned by the SIM40 during an IACK cycle in response to an interrupt
Freescale Semiconductor, Inc...
generated by the software watchdog. This register can be read or written at any time. This
register is set to the uninitialized vector, $0F, at reset.
SWIV $020
7 6 5 4 3 2 1 0
RESET:
0 0 0 0 1 1 1 1
Supervisor Only
SYPCR $021
7 6 5 4 3 2 1 0
RESET:
0 0 0 0 0 0 0 0
Supervisor Only
divide count
EXTAL frequency
The software watchdog timeout period, listed in Table 4-7, gives the formula to derive the
software watchdog timeout for any clock frequency. The timeout periods are listed for a
32.768-kHz crystal used with the VCO and for a 16.777-MHz external oscillator.
4.3.2.6 PERIODIC INTERRUPT CONTROL REGISTER (PICR). The PICR contains the
interrupt level and the vector number for the periodic interrupt request. This register can
be read or written at any time. Bits 15–11 are unimplemented and always return zero; a
write to these bits has no effect.
PICR $022
Freescale Semiconductor, Inc...
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 PIRQL2 PIRQL1 PIRQL0 PIV7 PIV6 PIV5 PIV4 PIV3 PIV2 PIV1 PIV0
RESET:
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
Supervisor Only
Bits 15–11—Reserved
NOTE:
Use caution with a level 7 interrupt encoding due to the
SIM40's interrupt servicing order. See 4.2.2.7 Simultaneous
Interrupts by Sources in the SIM40 for the servicing order.
4.3.2.7 PERIODIC INTERRUPT TIMER REGISTER (PITR). The PITR contains control for
prescaling the software watchdog and periodic timer as well as the count value for the
periodic timer. This register can be read or written at any time. Bits 15–10 are not
implemented and always return zero when read. A write does not affect these bits.
PITR $024
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Freescale Semiconductor, Inc...
0 0 0 0 0 0 SWP PTP PITR7 PITR6 PITR5 PITR4 PITR3 PITR2 PITR1 PITR0
RESET:
0 0 0 0 0 0 MODCK MODCK 0 0 0 0 0 0 0 0
Supervisor Only
Bits 15–10—Reserved
4.3.2.8 SOFTWARE SERVICE REGISTER (SWSR). The SWSR is the location to which
the software watchdog servicing sequence is written. The software watchdog can be
enabled or disabled by the SWE bit in the SYPCR. SWSR can be written at any time, but
returns all zeros when read.
SWSR $027
7 6 5 4 3 2 1 0
RESET:
0 0 0 0 0 0 0 0
Supervisor Only
produces an operating frequency of 8.39 MHz when the PLL is referenced to a 32.768-
kHz reference signal. The system frequency is controlled by the frequency control bits in
the upper byte of the SYNCR as follows:
SYNCR $004
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RESET:
0 0 1 1 1 1 1 1 0 0 0 U U 0 0 0
Bits 7–5—Reserved
Bit 7 is reserved for factory testing.
SLIMP—Limp Mode
1 = A loss of input signal reference has been detected, and the VCO is running at
approximately one-half the maximum speed (affected by the X-bit ), determined
from an internal voltage reference.
0 = External input signal frequency is at VCO reference.
SLOCK—Synthesizer Lock
1 = VCO has locked onto the desired frequency (or system clock is driven
externally).
0 = VCO is enabled, but has not yet locked.
RSTEN—Reset Enable
1 = Loss of input signal causes a system reset.
Freescale Semiconductor, Inc...
0 = Loss of input signal causes the VCO to operate at a nominal speed without
external reference (limp mode), and the device continues to operate at that
speed.
4.3.4.1 BASE ADDRESS REGISTERS. There are four 32-bit base address registers in
the chip select function, one for each chip select signal.
BA31 BA30 BA29 BA28 BA27 BA26 BA25 BA24 BA23 BA22 BA21 BA20 BA19 BA18 BA17 BA16
RESET:
U U U U U U U U U U U U U U U U
Supervisor Only
Base Address 2 $046, $04E, $056, $05E
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
BA15 BA14 BA13 BA12 BA11 BA10 BA9 BA8 BFC3 BFC2 BFC1 BFC0 WP FTE NCS V
RESET:
U U U U U U U U U U U U U U 0 0
Freescale Semiconductor, Inc...
WP—Write Protect
This bit can restrict write accesses to the address range in a base address register. An
attempt to write to the range of addresses specified in a base address register that has
this bit set returns BERR.
1 = Only read accesses are allowed.
0 = Either read or write accesses are allowed.
FTE—Fast-Termination Enable
This bit causes the cycle to terminate early with an internal DSACK≈, giving a fast two-
clock external access. When clear, all external cycles are at least three clocks. If fast
termination is enabled, the DD bits of the corresponding address mask register are
overridden (see Section 3 Bus Operation).
1 = Fast termination cycle enabled (termination determined by PS bits).
0 = Fast termination cycle disabled (termination determined by DD and PS bits).
V—Valid Bit
This bit indicates that the contents of its base address register and address mask
register pair are valid. The programmed chip selects do not assert until the V-bit is set.
A reset clears the V-bit in each base address register, but does not change any other
bits in the base address and address mask registers ( CS0 is a special case, see 4.2.4.2
Freescale Semiconductor, Inc...
4.3.4.2 ADDRESS MASK REGISTERS. There are four 32-bit address mask registers in
the chip select function, one for each chip select signal.
AM31 AM30 AM29 AM28 AM27 AM26 AM25 AM24 AM23 AM22 AM21 AM20 AM19 AM18 AM17 AM16
RESET:
U U U U U U U U U U U U U U U U
Supervisor Only
Address Mask 2 $042, $04A, $052, $05A
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
AM15 AM14 AM13 AM12 AM11 AM10 AM9 AM8 FCM3 FCM2 FCM1 FCM0 DD1 DD0 PS1 PS0
RESET:
U U U U U U U U U U U U U U U U
NOTE:
The port size field must be programmed for an internal
DSACK ≈ response and the FTE bit in the base address
register must be cleared for the DDx bits to have significance.
Freescale Semiconductor, Inc...
NOTE
If an access matches multiple chip selects, the lowest
numbered chip select will have priority. For example, if CS0
Freescale Semiconductor, Inc...
and CS2 "overlap" for a certain range, CS0 will assert when
accessing the "overlapped" address range, and CS2 will not.
PPARA1 $015
7 6 5 4 3 2 1 0
RESET:
1 1 1 1 1 1 1 1
Supervisor Only
PPARA2 $017
7 6 5 4 3 2 1 0
RESET:
0 0 0 0 0 0 0 0
Supervisor Only
Freescale Semiconductor, Inc...
The IACK ≈ signals are asserted if a bit in PPARA2 is set and the CPU32 services an
external interrupt at the corresponding level. IACK ≈ signals have the same timing as
address strobes.
NOTE:
Upon reset, port A is configured as an input port.
4.3.5.3 PORT A DATA DIRECTION REGISTER (DDRA). DDRA controls the direction of
the pin drivers when the pins are configured as I/O. Any set bit configures the
corresponding pin as an output. Any cleared bit configures the corresponding pin as an
input. This register affects only pins configured as discrete I/O. This register can be read
or written at any time.
DDRA $013
7 6 5 4 3 2 1 0
RESET:
0 0 0 0 0 0 0 0
Supervisor/User
4.3.5.4 PORT A DATA REGISTER (PORTA). PORTA affects only pins configured as
discrete I/O. A write to PORTA is stored in the internal data latch, and if any port A pin is
configured as an output, the value stored for that bit is driven on the pin. A read of PORTA
returns the value at the pin only if the pin is configured as discrete input. Otherwise, the
value read is the value stored in the internal data latch. This register can be read or written
at any time.
PORTA $011
7 6 5 4 3 2 1 0
P7 P6 P5 P4 P3 P2 P1 P0
RESET:
U U U U U U U U
Supervisor/User
4.3.5.5 PORT B PIN ASSIGNMENT REGISTER (PPARB). PPARB controls the function
of each port B pin. Any set bit defines the corresponding pin to be an IRQ≈ input or CS≈
as defined in Table 4-5. Any cleared bit defines the corresponding pin to be a discrete I/O
pin (or CS ≈ if the FIRQ bit of the MCR is zero) controlled by the port B data and data
direction registers. The MODCK signal has no function after reset. PPARB is configured to
all ones at reset to provide for MODCK, IRQ7, IRQ6, IRQ5, IRQ3, and CS3– CS0. This
register can be read or written at any time.
PPARB $01F
7 6 5 4 3 2 1 0
RESET:
1 1 1 1 1 1 1 1
Freescale Semiconductor, Inc...
Supervisor Only
4.3.5.6 PORT B DATA DIRECTION REGISTER (DDRB). DDRB controls the direction of
the pin drivers when the pins are configured as I/O. Any set bit configures the
corresponding pin as an output; any cleared bit configures the corresponding pin as an
input. This register affects only pins configured as discrete I/O. This register can be read
or written at any time.
DDRB $01D
7 6 5 4 3 2 1 0
RESET:
0 0 0 0 0 0 0 0
Supervisor/User
4.3.5.7 PORT B DATA REGISTER (PORTB, PORTB1). This is a single register that can
be accessed at two different addresses. This register affects only those pins configured as
discrete I/O. A write is stored in the internal data latch, and if any port B pin is configured
as an output, the value stored for that bit is driven on the pin. A read of this register
returns the value stored in the register only if the pin is configured as a discrete output.
Otherwise, the value read is the value of the pin. This register can be read or written at
any time.
P7 P6 P5 P4 P3 P2 P1 P0
RESET:
U U U U U U U U
Supervisor/User
4.4.1 Startup
RESET is asserted by the MC68340 during the time in which V CC is ramping up, the VCO
is locking onto the frequency, and the MC68340 is going through the reset operation. After
RESET is negated, four bus cycles are run, with global CS0 being asserted to fetch the
32-bit supervisor stack pointer (SSP) and the 32-bit program counter (PC) from the boot
ROM. Until programmed differently, CS0 is a global, 16-bit-wide, three-wait-state chip
select. CS0 can be programmed to continue decode for a range of addresses after the
V-bit is set, provided the desired address range is first loaded into the CS0 base address
Freescale Semiconductor, Inc...
register. After the V-bit is set for CS0 , global chip select can only be restarted with a
system reset.
After the SSP and the PC are fetched, the module base address register (MBAR) should
be initialized, and the MBAR V-bit should be set (CPU space address $0003FF00) with
the desired base address for the internal modules.
System Protection Control Register (SYPCR) (Note that this register can only be written
once after reset.)
• Enable the software watchdog, if desired (SWE bit).
• If the watchdog is enabled, select whether a system reset or a level 7 interrupt is
desired at timeout (SWRI bit).
• If the watchdog is enabled, select the timeout period (SWTx bits).
• Enable the double bus fault monitor, if desired (DBFE bit).
• Enable the external bus monitor, if desired (BME bit).
• Select timeout period for bus monitor (BMTx bits).
• If using the software watchdog, program the vector number for a software watchdog
interrupt.
***************************************************************************
* MC68340 basic SIM40 register initialization example code:
* This code is used to initialize the MC68340's internal SIM40 registers,
* providing basic functions for operation.
* It includes chip select programming for external devices.
* This code would be programmed beginning at offset $0 into ROM which is
* relocated to address $60000 by the initialization code.
* The SSP_VEC and RST_VEC vectors used to initialize the system stack
* pointer and initial PC, respectively, are located at offset $0 after
* reset.
Freescale Semiconductor, Inc...
***************************************************************************
* equates
***************************************************************************
SSP_INIT EQU $10000 Stack pointer initial value - top of RAM
MBAR EQU $0003FF00 Address of Module Base Address Reg.
MODBASE EQU $FFFFF000 Default Module Base address value
****************************************
* SIM40 register offsets from MBAR base address
MCR EQU $00
SYNCR EQU $04
SYPCR EQU $21
CSAM0 EQU $40
CSBAR0 EQU $44
CSAM1 EQU $48
CSBAR1 EQU $4c
CSAM2 EQU $50
CSBAR2 EQU $54
CSAM3 EQU $58
CSBAR3 EQU $5c
***************************************************************************
* Reset vectors
* These two vectors should be located at addresses $0 and $4 after a processor
* hardware reset.
***************************************************************************
ORG $60000
SSP_VEC DC.L SSP_INIT Supervisor stack pointer - initial value
RST_VEC DC.L INIT340 Reset vector pointing to initialization code
***************************************************************************
* Initialization code
***************************************************************************
***************************************************************************
* Set up default module base address value
MOVEQ.L #7,D0 MBAR is in CPU space
MOVEC.L D0,DFC load DFC to indicate CPU space
MOVE.L #MODBASE+1,D0 Set address/valid bit
MOVES.L D0,MBAR write to MBAR
Freescale Semiconductor, Inc...
***************************************************************************
* Set up system protection register:
* Software watchdog disabled, double bus fault monitor disabled, bus
* monitor BERR after 16 clocks.
MOVE.B #6,SYPCR+MODBASE
***************************************************************************
* Clock synthesizer control register:
* Switch from 8.3 to 16.7 MHZ
MOVE.W #$7F00,SYNCR+MODBASE X-bit doubles the default speed
***************************************************************************
* Module configuration register:
* When FREEZE is asserted, software watchdog and periodic interrupt timer
* are disabled, bus monitor is enabled. Port B = 4 IRQs, 4 chip selects.
* Show Cycles enabled, external arbitration enabled. Supervisor/user
* SIM registers unrestricted, Interrupt Arbitration at priority $F
MOVE.W #$420F,MCR+MODBASE
***************************************************************************
* Now, set up Address masks and base addresses for the chip selects:
LEA CSAM0+MODBASE,A0 Point to CS0 addr. mask location.
MOVEQ #7,D Set up a loop counter.
LEA CSAM0$,A1 Point to addr mask memory location.
LOOP MOVE.L (A1)+,(A0)+ Init. addr mask and base addr reg
DBRA D0,LOOP
***************************************************************************
* Data table for chip select initialization
***************************************************************************
***************************************************************************
END
SECTION 5
CPU32
The CPU32, the first-generation instruction processing module of the M68300 family, is
based on the industry-standard MC68000 core processor. It has many features of the
MC68010 and MC68020 as well as unique features suited for high-performance processor
applications. The CPU32 provides a significant performance increase over the MC68000
CPU, yet maintains source-code and binary-code compatibility with the M68000 family.
Freescale Semiconductor, Inc...
5.1 OVERVIEW
The CPU32 is designed to interface to the intermodule bus (IMB), allowing interaction with
other IMB submodules. In this manner, integrated processors can be developed that
contain useful peripherals on chip. This integration provides high-speed accesses among
the IMB submodules, increasing system performance.
Another advantage of the CPU32 is low power consumption. The CPU32 is implemented
in high-speed complementary metal-oxide semiconductor (HCMOS) technology, providing
low power use during normal operation. During periods of inactivity, the LPSTOP
instruction can be executed, shutting down the CPU32 and other IMB modules, greatly
reducing power consumption.
As processor applications become more complex and programs become larger, high-level
language (HLL) will become the system designer's choice in programming languages.
HLL aids in the rapid development of complex algorithms with less error and is readily
portable. The CPU32 instruction set will efficiently support HLL.
5.1.1 Features
Features of the CPU32 are as follows:
• Fully Upward Object-Code Compatible with M68000 Family
• Virtual Memory Implementation
• Loop Mode of Instruction Execution
• Fast Multiply, Divide, and Shift Instructions
• Fast Bus Interface with Dynamic Bus Port Sizing
• Improved Exception Handling for Embedded Control Applications
• Additional Addressing Modes
— Scaled Index
Freescale Semiconductor, Inc...
A block diagram of the CPU32 is shown in Figure 5-1. The major blocks depicted operate
in a highly independent fashion that maximizes concurrences of operation while managing
the essential synchronization of instruction execution and bus operation. The bus
controller loads instructions from the data bus into the decode unit. The sequencer and
control unit provide overall chip control, managing the internal buses, registers, and
functions of the execution unit.
CPU32 uses instruction restart, which requires that only a small portion of the internal
machine state be saved. After correcting the page fault, the machine state is restored, and
the instruction is refetched and restarted. This process is completely transparent to the
application program.
SEQUENCER
CONTROL INSTRUCTION
UNIT PREFETCH
AND
DECODE
Freescale Semiconductor, Inc...
DATA BUS 16
BUS BUS CONTROL
EXECUTION CONTROL
UNIT
ADDRESS
32
BUS
ONE-WORD INSTRUCTION
DBcc
DBcc DISPLACEMENT
$FFFC = 4
The loop mode is entered when the DBcc instruction is executed and the loop
displacement is –4. Once in loop mode, the processor performs only the data cycles
associated with the instruction and suppresses all instruction fetches. The termination
condition and count are checked after each execution of the data operations of the looped
instruction. The CPU32 automatically exits the loop mode on interrupts or other
exceptions.
The address of an interrupt exception vector is derived from an 8-bit vector number and
the VBR. The vector numbers for some exceptions are obtained from an external device;
other numbers are supplied automatically by the processor. The processor multiplies the
vector number by 4 to calculate the vector offset, which is added to the VBR. The sum is
the memory address of the vector. All exception vectors are located in supervisor data
space, except the reset vector, which is located in supervisor program space. Only the
initial reset vector is fixed in the processor's memory map; once initialization is complete,
there are no fixed assignments. Since the VBR provides the base address of the vector
table, the vector table can be located anywhere in memory; it can even be dynamically
relocated for each task that is executed by an operating system. Refer to 5.5 Exception
Processing for additional details.
31 0
VECTOR BASE REGISTER (VBR)
Exception processing saves the most volatile portion of the current context by pushing it
on the supervisor stack. This context is organized in a format called the exception stack
frame. This information always includes the SR and PC context of the processor when the
exception occurred. To support generic handlers, the processor places the vector offset in
the exception stack frame. The processor also marks the frame with a frame format. The
format field allows the return-from-exception (RTE) instruction to identify what information
is on the stack so that it may be properly restored.
• Absolute
• Immediate
Included in the register indirect addressing modes are the capabilities to postincrement,
predecrement, and offset. The PC relative mode also has index and offset capabilities. In
addition to these addressing modes, many instructions implicitly specify the use of the SR,
SP and/or PC. Addressing is explained fully in the M68000PM/AD, M68000 Family
Programmer’s Reference Manual .
The CPU32 has eight 32-bit data registers, seven 32-bit address registers, a 32-bit PC,
separate 32-bit SSP and USP, a 16-bit SR, two alternate function code registers, and a
32-bit VBR (see Figures 5-3 and 5-4).
31 16 15 8 7 0
D0
D1
D2
D3 DATA REGISTERS
D4
D5
D6
D7
31 16 15
A0
A1
Freescale Semiconductor, Inc...
A2
A3 ADDRESS REGISTERS
A4
A5
A6
31 16 15 0
A7 USER STACK POINTER
(USP)
31 0
PC PROGRAM COUNTER
15 8 7 0
0 CCR CONDITION CODE
REGISTER
31 16 15 0
A7' (SSP) SUPERVISOR STACK
POINTER
15 8 7 0
(CCR) SR STATUS REGISTER
31 0
PC PROGRAM COUNTER
31 3 2 0
SFC ALTERNATE FUNCTION
DFC CODE REGISTERS
5.2.2 Registers
Registers D7–D0 are used as data registers for bit, byte (8-bit), word (16-bit), long-word
(32-bit), and quad-word (64-bit) operations. Registers A6 to A0 and the USP and SSP are
address registers that may be used as software SPs or base address registers. Register
A7 (shown as A7 and A7' in Figures 5-3 and 5-4) is a register designation that applies to
the USP in the user privilege level and to the SSP in the supervisor privilege level. In
addition, address registers may be used for word and long-word operations. All of the 16
general-purpose registers (D7–D0, A7–A0) may be used as index registers.
The PC contains the address of the next instruction to be executed by the CPU32. During
instruction execution and exception processing, the processor automatically increments
the contents of the PC or places a new value in the PC, as appropriate.
Freescale Semiconductor, Inc...
The SR (see Figure 5-5) contains condition codes, an interrupt priority mask (three bits),
and three control bits. Condition codes reflect the results of a previous operation. The
codes are contained in the low byte (CCR) of the SR. The interrupt priority mask
determines the level of priority an interrupt must have to be acknowledged. The control
bits determine trace mode and privilege level. At user privilege level, only the CCR is
available. At supervisor privilege level, software can access the full SR.
The VBR contains the base address of the exception vector table in memory. The
displacement of an exception vector is added to the value in this register to access the
vector table.
Alternate source and destination function code registers (SFC and DFC) contain 3-bit
function codes. The CPU32 generates a function code each time it accesses an address.
Specific codes are assigned to each type of access. The codes can be used to select
eight dedicated 4-Gbyte address spaces. The MOVEC instruction can use registers SFC
and DFC to specify the function code of a memory address.
USER BYTE
SYSTEM BYTE (CONDITION CODE REGISTER)
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
T1 T0 S 0 0 I2 I1 I0 0 0 0 X N Z V C
SUPERVISOR/USER ZERO
STATE
OVERFLOW
CARRY
The CPU32 instructions include machine functions for all the following operations:
• Data Movement
• Arithmetic Operations
• Logical Operations
Freescale Semiconductor, Inc...
The large instruction set encompasses a complete range of capabilities and, combined
with the enhanced addressing modes, provides a flexible base for program development.
The CPU32 can be thought of as an intermediate member of the M68000 family. Object
code from an MC68000 or MC68010 may be executed on the CPU32, and many of the
instruction and addressing mode extensions of the MC68020 are also supported.
5.3.1.1 NEW INSTRUCTIONS. Two instructions have been added to the M68000
instruction set for use in embedded control applications: LPSTOP and table lookup and
interpolation (TBL).
5.3.1.1.2 Table Lookup and Interpolation (TBL). To maximize throughput for real-time
applications, reference data is often precalculated and stored in memory for quick access.
The storage of sufficient data points can require an inordinate amount of memory. The
TBL instruction uses linear interpolation to recover intermediate values from a sample of
data points, and thus conserves memory.
When the TBL instruction is executed, the CPU32 looks up two table entries bounding the
desired result and performs a linear interpolation between them. Byte, word, and long-
word operand sizes are supported. The result can be rounded according to a round-to-
nearest algorithm or returned unrounded along with the fractional portion of the calculated
result (byte and word results only). This extra precision can be used to reduce cumulative
error in complex calculations. See 5.3.4 Using the TBL Instructions for examples.
15 0
OPERATION WORD
(ONE WORD, SPECIFIES OPERATION AND MODES)
SPECIAL OPERAND SPECIFIERS
(IF ANY, ONE OR TWO WORDS)
IMMEDIATE OPERAND OR SOURCE ADDRESS
EXTENSION
(IF ANY, ONE TO THREE WORDS)
DESTINATION EFFECTIVE ADDRESS EXTENSION
(IF ANY, ONE TO THREE WORDS)
Besides the operation code, which specifies the function to be performed, an instruction
defines the location of every operand for the function. Instructions specify an operand
location in one of three ways:
• Register Specification A register field of the instruction contains the number of
the register.
• Effective Address An effective address field of the instruction contains
address mode information.
• Implicit Reference The definition of an instruction implies the use of
specific registers.
The register field within an instruction specifies the register to be used. Other fields within
the instruction specify whether the register is an address or data register and how it is to
be used. The M68000PM/AD, M68000 Family Programmer’s Reference Manual , contains
Freescale Semiconductor, Inc...
The complete range of instruction capabilities combined with the addressing modes
described previously provide flexibility for program development. All CPU32 instructions
are summarized in Table 5-2.
Freescale Semiconductor, Inc...
5.3.3.1 CONDITION CODE REGISTER. The CCR portion of the SR contains five bits that
indicate the result of a processor operation. Table 5-3 lists the effect of each instruction on
these bits. The carry bit and the multiprecision extend bit are separate in the M68000
Family to simplify programming techniques that use them. Refer to Table 5-7 as an
example.
Z = Z Λ R∂ Λ ... Λ R0
AND, ANDI, EOR, EORI, — * * 0 0
MOVEQ, MOVE, OR,
ORI, CLR, EXT, NOT,
TAS, TST
CHK — * U U U
CHK2, CMP2 — U ? U ? Z = (R = LB) V (R = UB)
C = (LB < UB) Λ (IR < LB) V (R > UB) V
(UB < LB) Λ (R > UB) Λ (R < LB)
SUB, SUBI, SUBQ * * * ? ? V = S∂ Λ Dm Λ R∂ V Sm Λ D∂ Λ Rm
C = Sm Λ D∂ V Rm Λ D∂ V Sm Λ Rm
SUBX * * ? ? ? V = S∂ Λ Dm Λ R∂ V Sm Λ D∂ Λ Rm
C = Sm Λ D∂ V Rm Λ D∂ V Sm Λ Rm
Z = Z Λ R∂ Λ ... Λ R0
CMP, CMPI, CMPM — * * ? ? V = S∂ Λ Dm Λ R∂ V Sm Λ D∂ Λ Rm
C = Sm Λ D∂ V Rm Λ D∂ V Sm Λ Rm
DIVS, DIVU — * * ? 0 V = Division Overflow
MULS, MULU — * * ? 0 V = Multiplication Overflow
SBCD, NBCD * U ? U ? C = Decimal Borrow
Z = Z Λ R∂ Λ ... Λ R0
NEG * * * ? ? V = Dm Λ Rm
C = Dm V Rm
NEGX * * ? ? ? V = Dm Λ Rm
C = Dm V Rm
Z = Z Λ R∂ Λ ... Λ R0
ASL * * * ? ? V = Dm Λ (D∂ – 1 V ... V D∂ – r ) V D∂ Λ
(Dm–1 V ... + Dm – r)
C = D∂ – r + 1
ASL (r = 0) — * * 0 0
LSL, ROXL * * * 0 ? C = Dm – r + 1
LSR (r = 0) — * * 0 0
ROXL (r = 0) — * * 0 ? C=X
ROL — * * 0 ? C = Dm – r + 1
ROL (r = 0) — * * 0 0
ASR, LSR, ROXR * * * 0 ? C = Dr – 1
ASR, LSR (r = 0) — * * 0 0
ROXR (r = 0) — * * 0 ? C=X
V = Boolean OR Rm = NOT Rm
5.3.3.2 DATA MOVEMENT INSTRUCTIONS. The MOVE instruction is the basic means of
transferring and storing address and data. MOVE instructions transfer byte, word, and
long-word operands from memory to memory, memory to register, register to memory,
and register to register. Address movement instructions (MOVE or MOVEA) transfer word
and long-word operands and ensure that only valid address manipulations are executed.
In addition to the general MOVE instructions, there are several special data movement
instructions—move multiple registers (MOVEM), move peripheral data (MOVEP), move
quick (MOVEQ), exchange registers (EXG), load effective address (LEA), push effective
address (PEA), link stack (LINK), and unlink stack (UNLK). Table 5-4 is a summary of the
data movement operations.
5.3.3.4 LOGIC INSTRUCTIONS. The logical operation instructions (AND, OR, EOR, and
NOT) perform logical operations with all sizes of integer data operands. A similar set of
immediate instructions (ANDI, ORI, and EORI) provide these logical operations with all
sizes of immediate data. The test (TST) instruction arithmetically compares the operand
with zero, placing the result in the CCR. Table 5-6 summarizes the logical operations.
5.3.3.5 SHIFT AND ROTATE INSTRUCTIONS. The arithmetic shift instructions, ASR and
ASL, and logical shift instructions, LSR and LSL, provide shift operations in both
directions. The ROR, ROL, ROXR, and ROXL instructions perform rotate (circular shift)
operations, with and without the extend bit. All shift and rotate operations can be
performed on either registers or memory.
Register shift and rotate operations shift all operand sizes. The shift count may be
specified in the instruction operation word (to shift from 1 to 8 places) or in a register
(modulo 64 shift count).
Memory shift and rotate operations shift word-length operands one bit position only. The
SWAP instruction exchanges the 16-bit halves of a register. Performance of shift/rotate
instructions is enhanced so that use of the ROR and ROL instructions with a shift count of
eight allows fast byte swapping. Table 5-7 is a summary of the shift and rotate operations.
To specify conditions for change in program control, condition codes must be substituted
for the letters "cc" in conditional program control opcodes. Condition test mnemonics are
given below. Refer to 5.3.3.10 Condition Tests for detailed information on condition
codes.
CC — Carry clear LS — Low or same
CS — Carry set LT — Less than
EQ — Equal MI — Minus
F — False* NE — Not equal
GE — Greater or equal PL — Plus
GT — Greater than T — True
HI — High VC — Overflow clear
Freescale Semiconductor, Inc...
5.3.3.10 CONDITION TESTS. Conditional program control instructions and the TRAPcc
instruction execute on the basis of condition tests. A condition test is the evaluation of a
logical expression related to the state of the CCR bits. If the result is 1, the condition is
true. If the result is 0, the condition is false. For example, the T condition is always true,
and the EQ condition is true only if the Z-bit condition code is true. Table 5-12 lists each
condition test.
The following examples show how to compress tables and use fewer interpolation levels
between table entries. Example 1 (see Figure 5-7) demonstrates TBL for a 257-entry
table, allowing up to 256 interpolation levels between entries. Example 2 (see Figure 5-8)
reduces table length for the same data to four entries. Example 3 (see Figure 5-9)
demonstrates use of an 8-bit independent variable with an instruction.
Two additional examples show how TBLSN can reduce cumulative error when multiple
table lookup and interpolation operations are used in a calculation. Example 4
demonstrates addition of the results of three table interpolations. Example 5 illustrates use
of TBLSN in surface interpolation.
5.3.4.1 TABLE EXAMPLE 1: STANDARD USAGE. The table consists of 257 word
entries. As shown in Figure 5-7, the function is linear within the range 32768 ≤ X ≤ 49152.
Table entries within this range are as given in Table 5-13 .
Y
DEPENDENT VARIABLE
The table instruction is executed with the following bit pattern in Dx:
31 16 15 0
NOT USED 1 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0
5.3.4.2 TABLE EXAMPLE 2: COMPRESSED TABLE. In Example 2 (see Figure 5-8), the
data from Example 1 has been compressed by limiting the maximum value of the
Freescale Semiconductor, Inc...
Y
DEPENDENT VARIABLE
NOTE
Extreme table compression with many levels of interpolation is
possible only with highly linear functions. The table entries
within the range of interest are listed in Table 5-14.
Since the table is reduced from 257 to 5 entries, independent variable X must be scaled
appropriately. In this case the scaling factor is 64, and the scaling is done by a single
instruction:
LSR.W #6,Dx
31 16 15 0
Freescale Semiconductor, Inc...
NOT USED 0 0 0 0 0 0 1 0 1 0 0 0 1 1 1 0
INDEPENDENT VARIABLE
Y
Freescale Semiconductor, Inc...
The first column is the value passed to the subroutine, the second column is the value
expected by the table instruction, and the third column is the result returned by the
subroutine.
31 16 15 0
NOT USED 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 1
Since X is an 8-bit value, the upper four bits are used as a table offset and the lower four
bits are used as an interpolation fraction. The following results are obtained from the
subroutine:
If the 8-bit value for X were used directly by the table instruction, interpolation would be
incorrectly performed between entries 0 and 1. Data must be shifted to the left four places
before use:
LSL.W #4, Dx
The new range for X is 0 ≤ X ≤ 4096; however, since a left shift fills the least significant
digits of the word with zeros, the interpolation fraction can only have one of 16 values.
First, the results of each TBL are rounded with the TBLS round-to-nearest-even algorithm.
The following values would be returned by TBLS:
TBL # 1 0010 0000 .
TBL # 2 0011 1111 .
TBL # 3 0000 0001 .
0010 0000 .
0011 1111 .
0000 0001 .
0110 0000 .
Freescale Semiconductor, Inc...
Now, using the same TBL results, the sum is first calculated and then rounded according
to the same algorithm:
0010 0000 . 0111 0000
0011 1111 . 0111 0000
0000 0001 . 0111 0000
0110 0001 . 0101 0000
Rounding yields:
0110 0001 .
The second result is preferred. The following code sequence illustrates how addition of a
series of table interpolations can be performed without loss of precision in the intermediate
results:
L0:
TBLSN.B 〈ea〉, Dx
TBLSN.B 〈ea〉, Dx
TBLSN.B 〈ea〉, Dl
ADD.L Dx, Dm Long addition avoids problems with carry
ADD.L Dm, Dl
ASR.L #8, Dl Move radix point
BCC.B L1 Fraction MSB in carry
ADDQ.B #1, Dl
L1: . . .
5.3.4.5 Table Example 5: Surface Interpolations. The various forms of table can be
used to perform surface (3D) TBLs. However, since the calculation must be split into a
series of 2D TBLs, the possibility of losing precision in the intermediate results is possible.
The following code sequence, incorporating both TBLS and TBLSN, eliminates this
possibility.
L0:
MOVE.W Dx, Dl Copy entry number and fraction number
TBLSN.B 〈ea〉, Dx
TBLSN.B 〈ea〉, Dl
TBLS.W Dx:Dl, Dm Surface interpolation, with round
ASR.L #8, Dm Read just the result
BCC.B L1 No round necessary
ADDQ.B #1, Dl Half round up
Freescale Semiconductor, Inc...
L1: . . .
Before execution of this code sequence, Dx must contain fraction and entry numbers for
the two TBL, and Dm must contain the fraction for surface interpolation. The 〈ea〉 fields in
the TBLSN instructions point to consecutive columns in a 3D table. The TBLS size
parameter must be word if the TBLSN size parameter is byte, and must be long word if
TBLSN is word. Increased size is necessary because a larger number of significant digits
is needed to accommodate the scaled fractional results of the 2D TBL.
The UNLK instruction removes a stack frame from the end of the list by loading an
address into the SP and pulling the value at that address from the stack. When the
instruction operand is the address of the link address at the bottom of a stack frame, the
effect is to remove the stack frame from both the stack and the linked list.
When the processor fetches instructions and operands or executes instructions, it is in the
normal processing state. The stopped condition, which the processor enters when a
STOP or LPSTOP instruction is executed, is a variation of the normal state in which no
further bus cycles are generated.
Background state is an alternate operational mode used for system debugging. Refer to
5.6 Development Support for more information.
and the filling of the instruction pipeline caused by an exception. Exception processing
ends when execution of an exception handler routine begins. Refer to 5.5 Exception
Processing for comprehensive information.
A catastrophic system failure occurs if the processor detects a bus error or generates an
address error while in the exception processing state. This type of failure halts the
processor. For example, if a bus error occurs during exception processing caused by a
bus error, the CPU32 assumes that the system is not operational and halts.
The halted condition should not be confused with the stopped condition. After the
processor executes a STOP or LPSTOP instruction, execution of instructions can resume
when a trace, interrupt, or reset exception occurs.
In a typical system, most programs execute at the user level. User programs can access
only their own code and data areas and are restricted from accessing other information.
The operating system executes at the supervisor privilege level, has access to all
resources, performs the overhead tasks for the user level programs, and coordinates their
activities.
All exception processing is performed at the supervisor level. All bus cycles generated
during exception processing are supervisor references, and all stack accesses use the
SSP.
Instructions that have important system effects can only be executed at supervisor level.
For instance, user programs are not permitted to execute STOP, LPSTOP, or RESET
instructions. To prevent a user program from gaining privileged access, except in a
controlled manner, instructions that can alter the S-bit in the SR are privileged. The TRAP
#n instruction provides controlled user access to operating system services.
5.4.2.2 USER PRIVILEGE LEVEL. If the S-bit in the SR is cleared, the processor
executes instructions at the user privilege level. The bus cycles for an instruction executed
at the user privilege level are classified as user references, and the values of the function
codes on FC2–FC0 specify user address spaces. While the processor is at the user level,
Freescale Semiconductor, Inc...
implicit references to the system SP and explicit references to address register seven (A7)
refer to the USP.
To return to user access level, a system routine must execute one of the following
instructions: MOVE to SR, ANDI to SR, EORI to SR, ORI to SR, or RTE. These
instructions execute only at supervisor privilege level and can modify the S-bit of the SR.
After these instructions execute, the instruction pipeline is flushed, then refilled from the
appropriate address space.
The RTE instruction causes a return to a program that was executing when an exception
occurred. When RTE is executed, the exception stack frame saved on the supervisor
stack can be restored in either of two ways.
If the frame was generated by an interrupt, breakpoint, trap, or instruction exception, the
SR and PC are restored to the values saved on the supervisor stack, and execution
resumes at the restored PC address, with access level determined by the S-bit of the
restored SR.
If the frame was generated by a bus error or an address error exception, the entire
processor state is restored from the stack.
CAUTION
Because there is no protection on the 64 processor-defined
vectors, external devices can access vectors reserved for
internal purposes. This practice is strongly discouraged.
All exception vectors, except the reset vector, are located in supervisor data space. The
reset vector is located in supervisor program space. Only the initial reset vector is fixed in
the processor memory map. When initialization is complete, there are no fixed
assignments. Since the VBR stores the vector table base address, the table can be
located anywhere in memory. It can also be dynamically relocated for each task executed
by an operating system.
Each vector is assigned an 8-bit number. Vector numbers for some exceptions are
obtained from an external device; others are supplied by the processor. The processor
Freescale Semiconductor, Inc...
multiplies the vector number by 4 to calculate vector offset, then adds the offset to the
contents of the VBR. The sum is the memory address of the vector.
Sources of external exception include interrupts, breakpoints, bus errors, and reset
requests. Interrupts are peripheral device requests for processor action. Breakpoints are
used to support development equipment. Bus error and reset are used for access control
and processor restart.
5.5.1.2 EXCEPTION PROCESSING SEQUENCE. For all exceptions other than a reset
exception, exception processing occurs in the following sequence. Refer to 5.5.2.1 Reset
for details of reset processing.
As exception processing begins, the processor makes an internal copy of the SR. After
the copy is made, the processor state bits in the SR are changed—the S-bit is set,
establishing supervisor access level, and bits T1 and T0 are cleared, disabling tracing. For
reset and interrupt exceptions, the interrupt priority mask is also updated.
Next, the exception number is obtained. For interrupts, the number is fetched from CPU
space $F (the bus cycle is an interrupt acknowledge). For all other exceptions, internal
logic provides a vector number.
Next, current processor status is saved. An exception stack frame is created and placed
on the supervisor stack. All stack frames contain copies of the SR and the PC for use by
RTE. The type of exception and the context in which the exception occurs determine what
other information is stored in the stack frame.
Finally, the processor prepares to resume normal execution of instructions. The exception
vector offset is determined by multiplying the vector number by 4, and the offset is added
to the contents of the VBR to determine displacement into the exception vector table. The
exception vector is loaded into the PC. If no other exception is pending, the processor will
resume normal execution at the new address in the PC.
5.5.1.3 EXCEPTION STACK FRAME. During exception processing, the most volatile
portion of the current context is saved on the top of the supervisor stack. This context is
organized in a format called the exception stack frame.
The exception stack frame always includes the contents of SR and PC at the time the
exception occurred. To support generic handlers, the processor also places the vector
offset in the exception stack frame and marks the frame with a format code. The format
field allows an RTE instruction to identify stack information so that it can be properly
Freescale Semiconductor, Inc...
restored.
The general form of the exception stack frame is illustrated in Figure 5-10. Although some
formats are peculiar to a particular M68000 Family processor, format 0000 is always legal
and always indicates that only the first four words of a frame are present. See 5.5.4
CPU32 Stack Frames for a complete discussion of exception stack frames.
15 0
SP STATUS REGISTER
STACKING ORDER
PROGRAM COUNTER LOW
5.5.1.4 MULTIPLE EXCEPTIONS. Each exception has been assigned a priority based on
its relative importance to system operation. Priority assignments are shown in Table 5-17.
Group 0 exceptions have the highest priorities; group 4 exceptions have the lowest
priorities. Exception processing for exceptions that occur simultaneously is done by
priority, from highest to lowest.
When the CPU32 completes exception processing, it is ready to begin either exception
processing for a pending exception or execution of a handler routine. Priority assignment
governs the order in which exception processing occurs, not the order in which exception
handlers are executed.
As a general rule, when simultaneous exceptions occur, the handler routines for lower
priority exceptions are executed before the handler routines for higher priority exceptions.
For example, consider the arrival of an interrupt during execution of a TRAP instruction,
while tracing is enabled. Trap exception processing (2) is done first, followed immediately
by exception processing for the trace (4.1), and then by exception processing for the
interrupt (4.3). Each exception places a new context on the stack. When the processor
resumes normal instruction execution, it is vectored to the interrupt handler, which returns
to the trace handler that returns to the trap handler.
There are special cases to which the general rule does not apply. The reset exception will
always be the first exception handled since reset clears all other exceptions. It is also
possible for high-priority exception processing to begin before low-priority exception
processing is complete. For example, if a bus error occurs during trace exception
processing, the bus error will be processed and handled before trace exception
processing is completed.
After initial instruction prefetches, normal program execution begins at the address in the
PC. The reset exception does not save the value of either the PC or the SR.
If a bus error or address error occurs during reset exception processing sequence, a
double bus fault occurs, the processor halts, and the HALT signal is asserted to indicate
the halted condition.
Execution of the RESET instruction does not cause a reset exception nor does it affect
any internal CPU register. The SIM40 registers and the MCR in each internal peripheral
module (DMA, timers, and serial modules) are not affected. All other internal peripheral
module registers are reset the same as for a hardware reset. The external devices
connected to the RESET signal are reset at the completion of the RESET instruction.
ENTRY
1 ➧S
0 ➧ T0,T1
$7 ➧ I2:I0
$0 ➧ VBR
.✎
Freescale Semiconductor, Inc...
FETCH VECTOR # 0
FETCH VECTOR # 1
PREFETCH 3 WORDS
BUS ERROR/
ADDRESS
OTHERWISE BEGIN
ERROR
INSTRUCTION
EXECUTION (DOUBLE BUS FAULT)
ASSERT HALT
EXIT
EXIT
5.5.2.2 BUS ERROR. A bus error exception occurs when an assertion of the BERR signal
is acknowledged. The BERR signal can be asserted by one of three sources:
When the aborted bus cycle is an instruction prefetch, the processor will not initiate
exception processing unless the prefetched information is used. For example, if a branch
instruction flushes an aborted prefetch, that word is not accessed, and no exception
Freescale Semiconductor, Inc...
occurs.
When the aborted bus cycle is a data access, the processor initiates exception processing
immediately, except in the case of released operand writes. Released write bus errors are
delayed until the next instruction boundary or until another operand access is attempted.
Exception processing for bus error exceptions follows the regular sequence, but context
preservation is more involved than for other exceptions because a bus exception can be
initiated while an instruction is executing. Several bus error stack format organizations are
utilized to provide additional information regarding the nature of the fault.
If a bus error occurs during exception processing for a bus error, an address error, a reset,
or while the processor is loading stack information during RTE execution, the processor
halts. This simplifies isolation of catastrophic system failure by preventing processor
interaction with stacks and memory. Only assertion of RESET can restart a halted
processor.
5.5.2.3 ADDRESS ERROR. Address error exceptions occur when the processor attempts
to access an instruction, word operand, or long-word operand at an odd address. The
effect is much the same as an internally generated bus error. The exception processing
sequence is the same as that for bus error, except that the vector number refers to the
address error exception vector.
Address error exception processing begins when the processor attempts to use
information from the aborted bus cycle. If the aborted cycle is a data space access,
exception processing begins when the processor attempts to use the data, except in the
case of a released operand write. Released write exceptions are delayed until the next
instruction boundary or attempted operand access.
If an address error occurs during exception processing for a bus error, another address
error, or a reset, the processor halts.
5.5.2.4 INSTRUCTION TRAPS. Traps are exceptions caused by instructions. They arise
from either processor recognition of abnormal conditions during instruction execution or
from use of specific trapping instructions. Traps are generally used to handle abnormal
Freescale Semiconductor, Inc...
The TRAP instruction, which always forces an exception, is useful for implementing
system calls for user programs. The TRAPcc, TRAPV, CHK, and CHK2 instructions force
exceptions when a program detects a run-time error. The DIVS and DIVU instructions
force an exception if a division operation is attempted with a divisor of zero.
Exception processing for traps follows the regular sequence. If tracing is enabled when an
instruction that causes a trap begins execution, a trace exception will be generated by the
instruction, but the trap handler routine will not be traced (the trap exception will be
processed first, then the trace exception).
The vector number for the TRAP instruction is internally generated—part of the number
comes from the instruction itself. The trap vector number, PC value, and a copy of the SR
are saved on the supervisor stack. The saved PC value is the address of the instruction
that follows the instruction that generated the trap. For all instruction traps other than
TRAP, a pointer to the instruction causing the trap is also saved in the fifth and sixth
words of the exception stack frame.
The MC68000 and MC68008 can detect an illegal instruction inserted at a breakpoint
when the processor fetches from the illegal instruction exception vector location. Since the
VBR on the CPU32 allows relocation of exception vectors, the exception vector address is
not a reliable indication of a breakpoint. CPU32 breakpoint support is provided by
extending the function of a set of illegal instructions ($4848–$484F).
When a breakpoint instruction is executed, the CPU32 performs a read from CPU space
$0, at a location corresponding to the breakpoint number. If this bus cycle is terminated by
BERR, the processor performs illegal instruction exception processing. If the bus cycle is
terminated by DSACK≈, the processor uses the data returned to replace the breakpoint in
the instruction pipeline and begins execution of that instruction. See Section 3 Bus
Operation for a description of CPU space operations.
If the bus cycle terminates normally, instruction execution continues with the next
instruction, as if no breakpoint request occurred. If the bus cycle is terminated by BERR,
the CPU begins exception processing. Data returned during this bus cycle is ignored.
Exception processing follows the regular sequence. Vector number 12 (offset $30) is
Freescale Semiconductor, Inc...
internally generated. The PC of the currently executing instruction, the PC of the next
instruction to execute, and a copy of the SR are saved on the supervisor stack.
5.5.2.7 FORMAT ERROR. The processor checks certain data values for control
operations. The validity of the stack format code and, in the case of a bus cycle fault
format, the version number of the processor that generated the frame are checked during
execution of the RTE instruction. This check ensures that the program does not make
erroneous assumptions about information in the stack frame.
If the format of the control data is improper, the processor generates a format error
exception. This exception saves a four-word format exception frame and then vectors
through vector table entry number 14. The stacked PC is the address of the RTE
instruction that discovered the format error.
Word patterns with bits 15–12 = 1010 (referred to as A-line opcodes) are unimplemented
instructions. A separate exception vector (vector 10, offset $28) is given to unimplemented
instructions to permit efficient emulation.
Word patterns with bits 15–12 = 1111 (referred to as F-line opcodes) are used for M68000
family instruction set extensions. They can generate an unimplemented instruction
exception caused by the first extension word of the instruction or by the addressing mode
extension word. A separate F-line emulation vector (vector 11, offset $2C) is used for the
exception vector.
All unimplemented instructions are reserved for use by Motorola for enhancements and
extensions to the basic M68000 architecture. Opcode pattern $4AFC is defined to be
illegal on all M68000 family members. Those customers requiring the use of an
unimplemented opcode for synthesis of "custom instructions," operating system calls, etc.,
should use this opcode.
Exception processing for illegal and unimplemented instructions is similar to that for traps.
The instruction is fetched and decoding is attempted. When the processor determines that
execution of an illegal instruction is being attempted, exception processing begins. No
registers are altered.
Exception processing follows the regular sequence. The vector number is generated to
refer to the illegal instruction vector or in the case of an unimplemented instruction, to the
corresponding emulation vector. The illegal instruction vector number, current PC, and a
Freescale Semiconductor, Inc...
copy of the SR are saved on the supervisor stack, with the saved value of the PC being
the address of the illegal or unimplemented instruction.
Exception processing follows the regular sequence. The vector number (8) is generated to
reference the privilege violation vector. Privilege violation vector offset, current PC, and
SR are saved on the supervisor stack. The saved PC value is the address of the first word
of the instruction causing the privilege violation.
When T1–T0 = 00, tracing is disabled, and instruction execution proceeds normally (see
Table 5-18).
Exception processing for trace starts at the end of normal processing for the traced
instruction and before the start of the next instruction. Exception processing follows the
regular sequence; tracing is disabled so that the trace exception itself is not traced. A
vector number is generated to reference the trace exception vector. The address of the
instruction that caused the trace exception, the trace exception vector offset, the current
PC, and a copy of the SR are saved on the supervisor stack. The saved value of the PC is
the address of the next instruction to be executed.
If an instruction forces an exception, the forced exception is processed before the trace
exception.
executed. If tracing is on, trace exception processing must be emulated so that the trace
exception handler can account for the emulated instruction.
Tracing also affects normal operation of the STOP and LPSTOP instructions. If either
instruction begins execution with T1 set, a trace exception will be taken after the
instruction loads the SR. Upon return from the trace handler routine, execution will
continue with the instruction following STOP (LPSTOP), and the processor will not enter
the stopped condition.
5.5.2.11 INTERRUPTS. There are seven levels of interrupt priority and 192 assignable
interrupt vectors within each exception vector table. Careful use of multiple vector tables
and hardware chaining will permit a virtually unlimited number of peripherals to interrupt
the processor.
Interrupt recognition and subsequent processing are based on internal interrupt request
signals ( IRQ7 – IRQ1 ) and the current priority set in SR priority mask I2–I0. Interrupt
request level zero (IRQ7– IRQ1 negated) indicates that no service is requested. When an
interrupt of level one through six is requested via IRQ6– IRQ1, the processor compares
the request level with the interrupt mask to determine whether the interrupt should be
processed. Interrupt requests are inhibited for all priority levels less than or equal to the
current priority. Level seven interrupts are nonmaskable.
IRQ7– IRQ1 are synchronized and debounced by input circuitry on consecutive rising
edges of the processor clock. To be valid, an interrupt request must be held constant for
at least two consecutive clock periods.
Interrupt requests do not force immediate exception processing, but are left pending. A
pending interrupt is detected between instructions or at the end of exception processing—
all interrupt requests must be held asserted until they are acknowledged by the CPU. If
the priority of the interrupt is greater than the current priority level, exception processing
begins.
Exception processing occurs as follows. First, the processor makes an internal copy of the
SR. After the copy is made, the processor state bits in the SR are changed—the S-bit is
set, establishing supervisor access level, and bits T1 and T0 are cleared, disabling
tracing. Priority level is then set to the level of the interrupt, and the processor fetches a
vector number from the interrupting device (CPU space $F). The fetch bus cycle is
classified as an interrupt acknowledge, and the encoded level number of the interrupt is
placed on the address bus.
If the response to the interrupt acknowledge bus cycle is a bus error, the interrupt is taken
to be spurious, and the spurious interrupt vector number (24) is generated.
The exception vector number, PC, and SR are saved on the supervisor stack. The saved
value of the PC is the address of the instruction that would have executed if the interrupt
had not occurred.
Freescale Semiconductor, Inc...
Priority level 7 interrupt is a special case. Level 7 interrupts are nonmaskable interrupts
(NMI). Level 7 requests are transition sensitive to eliminate redundant servicing and
resultant stack overflow. Transition sensitive means that the level 7 input must change
state before the CPU will detect an interrupt.
An NMI is generated each time the interrupt request level changes to level 7 (regardless
of priority mask value), and each time the priority mask changes from 7 to a lower number
while the request level remains at 7.
Many M68000 peripherals provide for programmable interrupt vector numbers to be used
in the system interrupt request/acknowledge mechanism. If the vector number is not
initialized after reset and if the peripheral must acknowledge an interrupt request, the
peripheral should return the uninitialized interrupt vector number (15).
See Section 3 Bus Operation for detailed information on interrupt acknowledge cycles.
5.5.2.12 RETURN FROM EXCEPTION. When exception stacking operations for all
pending exceptions are complete, the processor begins execution of the handler for the
last exception processed. After the exception handler has executed, the processor must
restore the system context in existence prior to the exception. The RTE instruction is
designed to accomplish this task.
When RTE is executed, the processor examines the stack frame on top of the supervisor
stack to determine if it is valid and determines what type of context restoration must be
performed. See 5.5.4 CPU32 Stack Frames for a description of stack frames.
For a normal four-word frame, the processor updates the SR and PC with data pulled from
the stack, increments the SSP by 8, and resumes normal instruction execution. For a six-
word frame, the SR and PC are updated from the stack, the active SSP is incremented by
12, and normal instruction execution resumes.
For a bus fault frame, the format value on the stack is first checked for validity. In addition,
the version number on the stack must match the version number of the processor that is
attempting to read the stack frame. The version number is located in the most significant
byte (bits 15–8) of the internal register word at location SP + $14 in the stack frame. The
validity check ensures that stack frame data will be properly interpreted in multiprocessor
systems.
If a format error occurs during RTE execution, the processor creates a normal four-word
fault stack frame below the frame that it was attempting to use. If a bus error occurs, a
Freescale Semiconductor, Inc...
bus-error stack frame will be created. The faulty stack frame remains intact, so that it may
be examined and repaired by an exception handler or used by a different type of
processor (e.g., MC68010, MC68020, or future M68000 processor) in a multiprocessor
system.
The stack contents are identified by the special status word (SSW). In addition to
identifying the fault type represented by the stack frame, the SSW contains the internal
processor state corresponding to the fault.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
TP MV 0 TR B1 B0 RR RM IN RW LG SIZ FUNC
The TP field defines the class of the faulted bus operation. Two bus error exception
frame types are defined. One is for faults on prefetch and operand accesses, and the
other is for faults during exception frame stacking:
0 = Operand or prefetch bus fault
1 = Exception processing bus fault
MV is set when the operand transfer portion of the MOVEM instruction is in progress at
the time of a bus fault. If a prefetch bus fault occurs while prefetching the MOVEM
opcode and extension word, both the MV and IN bits will be set.
0 = MOVEM was not in progress when fault occurred
1 = MOVEM was in progress when fault occurred
TR indicates that a trace exception was pending when a bus error exception was
processed. The instruction that generated the trace will not be restarted upon return
Freescale Semiconductor, Inc...
from the exception handler. This includes MOVEM and released write bus errors
indicated by the assertion of either MV or RR in the SSW.
0 = Trace not pending
1 = Trace pending
B1 indicates that a breakpoint exception was pending on channel 1 (external breakpoint
source) when a bus error exception was processed. Pending breakpoint status is
stacked, regardless of the type of bus error exception.
0 = Breakpoint not pending
1 = Breakpoint pending
B0 indicates that a breakpoint exception was pending on channel 0 (internal breakpoint
source) when the bus error exception was processed. Pending breakpoint status is
stacked, regardless of the type of bus error exception.
0 = Breakpoint not pending
1 = Breakpoint pending
RR will be set if the faulted bus cycle was a released write. A released write is one that
is overlapped. If the write is completed (rerun) in the exception handler, the RR bit
should be cleared before executing RTE. The bus cycle will be rerun if the RR bit is set
upon return from the exception handler.
0 = Faulted cycle was read, RMW, or unreleased write
1 = Faulted cycle was a released write
Faulted RMW bus cycles set the RM bit. RM is ignored during unstacking.
0 = Faulted cycle was non-RMW cycle
1 = Faulted cycle was either the read or write of an RMW cycle
Instruction prefetch faults are distinguished from operand (both read and write) faults by
the IN bit. If IN is cleared, the error was on an operand cycle; if IN is set, the error was
on an instruction prefetch. IN is ignored during unstacking.
0 = Operand
1 = Prefetch
Read and write bus cycles are distinguished by the RW bit. Read bus cycles will set this
bit, and write bus cycles will clear it. RW is reloaded into the bus controller if the RR bit
is set during unstacking.
0 = Faulted cycle was an operand write
1 = Faulted cycle was a prefetch or operand read
The LG bit indicates an original operand size of long word. LG is cleared if the original
operand was a byte or word—SIZ will indicate original (and remaining) size. LG is set if
the original was a long word—SIZ will indicate the remaining size at the time of fault. LG
is ignored during unstacking.
0 = Original operand size was byte or word
1 = Original operand size was long word
The SSW SIZ field shows operand size remaining when a fault was detected. This field
Freescale Semiconductor, Inc...
does not indicate the initial size of the operand, nor does it necessarily indicate the
proper status of a dynamically sized bus cycle. Dynamic sizing occurs on the external
bus and is transparent to the CPU. Byte size is shown only when the original operand
was a byte. The field is reloaded into the bus controller if the RR bit is set during
unstacking. The SIZ field is encoded as follows:
00—Long word
01—Byte
10—Word
11—Unused, reserved
The function code for the faulted cycle is stacked in the FUNC field of the SSW, which is
a copy of FC2–FC0 for the faulted bus cycle. This field is reloaded into the bus
controller if the RR bit is set during unstacking. All unused bits are stacked as zeros and
are ignored during unstacking. Further discussion of the SSW is included in 5.5.3.1
Types of Faults.
5.5.3.1.1 Type I—Released Write Faults. CPU32 instruction pipelining can cause a final
instruction write to overlap the execution of a following instruction. A write that is
overlapped is called a released write. A released write fault occurs when a bus error or
some other fault occurs on the released write.
Released write faults are taken at the next instruction boundary. The stacked PC is that of
the next unexecuted instruction. If a subsequent instruction attempts an operand access
while a released write fault is pending, the instruction is aborted and the write fault is
acknowledged. This action prevents stale data from being used by the instruction.
The SSW for a released write fault contains the following bit pattern:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 0
0 0 0 TR B1 B0 1 0 0 0 LG SIZ FUNC
TR, B1, and B0 are set if the corresponding exception is pending when the bus error
exception is taken. Status regarding the faulted bus cycle is reflected in the LG, SIZ, and
FUNC fields.
The remainder of the stack contains the PC of the next unexecuted instruction, the current
SR, the address of the faulted memory location, and the contents of the data buffer that
was to be written to memory. This data is written on the stack in the format depicted in
Figure 5-15. When a released write fault exception handler executes, the machine will
complete the faulted write and then continue executing instructions wherever the PC
Freescale Semiconductor, Inc...
indicates.
5.5.3.1.2 Type II—Prefetch, Operand, RMW, and MOVEP Faults. The majority of bus
error exceptions are included in this category—all instruction prefetches, all operand
reads, all RMW cycles, and all operand accesses resulting from execution of MOVEP
(except the last write of a MOVEP Rn,〈ea〉 or the last write of MOVEM, which are type I
faults). The TAS, MOVEP, and MOVEM instructions account for all operand writes not
considered released.
All type II faults cause an immediate exception that aborts the current instruction. Any
registers that were altered as the result of an EA calculation (i.e., postincrement or
predecrement) are restored prior to processing the bus cycle fault.
The SSW for faults in this category contains the following bit pattern:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 0
0 0 0 0 B1 B0 0 RM IN RW LG SIZ FUNC
The trace pending bit is always cleared, since the instruction will be restarted upon return
from the handler. Saving a pending exception on the stack causes a trace exception to be
taken prior to restarting the instruction. If the exception handler does not alter the stacked
SR trace bits, the trace is requeued when the instruction is started.
The breakpoint pending bits are stacked in the SSW, even though the instruction is
restarted upon return from the handler. This avoids problems with bus state analyzer
equipment that has been programmed to breakpoint only the first access to a specific
location or to count accesses to that location. If this response is not desired, the exception
handler can clear the bits before return. The RM, IN, RW, LG, FUNC, and SIZ fields all
reflect the type of bus cycle that caused the fault. If the bus cycle was an RMW, the RM bit
will be set, and the RW bit will show whether the fault was on a read or write.
5.5.3.1.3 Type III—Faults During MOVEM Operand Transfer. Bus faults that occur as a
result of MOVEM operand transfer are classified as type III faults. MOVEM instruction
prefetch faults are type II faults.
Type III faults cause an immediate exception that aborts the current instruction. None of
the registers altered during execution of the faulted instruction are restored prior to
execution of the fault handler. This includes any register predecremented as a result of the
effective address calculation or any register overwritten during instruction execution. Since
postincremented registers are not updated until the end of an instruction, the register
retains its pre-instruction value unless overwritten by operand movement.
The SSW for faults in this category contains the following bit pattern:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 0
Freescale Semiconductor, Inc...
0 1 0 TR B1 B0 RR 0 IN RW LG SIZ FUNC
MV is set, indicating that MOVEM should be continued from the point where the fault
occurred upon return from the exception handler. TR, B1, and B0 are set if a
corresponding exception is pending when the bus error exception is taken. IN is set if a
bus fault occurs while prefetching an opcode or an extension word during instruction
restart. RW, LG, SIZ, and FUNC all reflect the type of bus cycle that caused the fault. All
write faults have the RR bit set to indicate that the write should be rerun upon return from
the exception handler.
The remainder of the stack frame contains sufficient information to continue MOVEM with
operand transfer following a faulted transfer. The address of the next operand to be
transferred, incremented or decremented by operand size, is stored in the faulted address
location ($08). The stacked transfer counter is set to 16 minus the number of transfers
attempted (including the faulted cycle). Refer to Figure 5-12 for the stacking format.
5.5.3.1.4 Type IV—Faults During Exception Processing. The fourth type of fault occurs
during exception processing. If this exception is a second address or bus error, the
machine halts in the double bus fault condition. However, if the exception is one that
causes a four- or six-word stack frame to be written, a bus cycle fault frame is written
below the faulted exception stack frame.
The SSW for a fault within an exception contains the following bit pattern:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 0
1 0 0 TR B1 B0 0 0 0 1 LG SIZ FUNC
TR, B1, and B0 are set if a corresponding exception is pending when the bus error
exception is taken.
The contents of the faulted exception stack frame are included in the bus fault stack
frame. The pre-exception SR and the format/vector word of the faulted frame are stacked.
The type of exception can be determined from the format/vector word. If the faulted
exception stack frame contains six words, the PC of the instruction that caused the initial
exception is also stacked. This data is placed on the stack in the format shown in Figure
5-13. The return address from the initial exception is stacked for RTE .
5.5.3.2 CORRECTING A FAULT. There are two ways to complete a faulted released write
bus cycle. The first is to use a software handler. The second is to rerun the bus cycle via
RTE.
Type II fault handlers must terminate with RTE, but specific requirements must also be
met before an instruction is restarted.
There are three varieties of type III operand fault recovery. The first is completion of an
instruction in software. The second is conversion to type II with restart via RTE. The third
is continuation from the fault via RTE.
Freescale Semiconductor, Inc...
5.5.3.2.1 Type I—Completing Released Writes via Software. To complete a bus cycle
in software, a handler must first read the SSW function code field to determine the
appropriate address space, access the fault address pointer on the stack, and then
transfer data from the stacked image of the output buffer to the fault address.
Because the CPU32 has a 16-bit internal data bus, long operands require two bus
accesses. A fault during the second access of a long operand causes the LG bit in the
SSW to be set. The SIZ field indicates remaining operand size. If operand coherency is
important, the complete operand must be rewritten. After a long operand is rewritten, the
RR bit must be cleared. Failure to clear the RR bit can cause the RTE instruction to rerun
the bus cycle. Following rewrite, it is not necessary to adjust the PC (or other stack
contents) before executing RTE.
5.5.3.2.2 Type I—Completing Released Writes via RTE. An exception handler can use
the RTE instruction to complete a faulted bus cycle. When RTE executes, the fault
address, data output buffer, PC, and SR are restored from the stack. Any pending
breakpoint or trace exceptions, as indicated by TR, B1, and B0 in the stacked SSW, are
requeued during SSW restoration. The RR bit in the SSW is checked during the
unstacking operation; if it is set, the RW, FUNC, and SIZ fields are restored and the
released write cycle is rerun.
To maintain long-word operand coherence, stack contents must be adjusted prior to RTE
execution. The fault address must be decremented by 2 if LG is set and SIZ indicates a
remaining byte or word. SIZ must be set to long. All other fields should be left unchanged.
The bus controller uses the modified fault address and SIZ field to rerun the complete
released write cycle.
Manipulating the stacked SSW can cause unpredictable results because RTE checks only
the RR bit to determine if a bus cycle must be rerun. Inadvertent alteration of the control
bits could cause the bus cycle to be a read instead of a write or could cause access to a
different address space than the original bus cycle. If the rerun bus cycle is a read,
returned data will be ignored.
5.5.3.2.3 Type II—Correcting Faults via RTE. Instructions aborted because of a type II
fault are restarted upon return from the exception handler. A fault handler must establish
safe restart conditions. If a fault is caused by a nonresident page in a demand-paged
virtual memory configuration, the fault address must be read from the stack, and the
appropriate page retrieved. An RTE instruction terminates the exception handler. After
unstacking the machine state, the instruction is refetched and restarted.
Read the MOVEM opcode and extension from locations pointed to by stackframe PC and
PC + 2. The EA need not be recalculated since the next operand address is saved in the
stack frame. However, the opcode EA field must be examined to determine how to update
the address register and PC when the instruction is complete.
Adjust the mask to account for operands already transferred. Subtract the stacked
operand transfer count from 16 to obtain the number of operands transferred. Scan the
mask using this count value. Each time a set bit is found, clear it and decrement the
counter. When the count is zero, the mask is ready for use.
Adjust the operand address. If the predecrement addressing mode is in effect, subtract the
operand size from the stacked value; otherwise, add the operand size to the stacked
value.
B. Rerun Instruction
Scan the mask for set bits. Read/write the selected register from/to the operand address
as each bit is found.
As each operand is transferred, clear the mask bit and increment (decrement) the operand
address. When all bits in the mask are cleared, all operands have been transferred.
If TR is set in the stacked SSW, create a six-word stack frame and execute the trace
handler. If either B1 or B0 is set in the SSW, create another six-word stack frame and
execute the hardware breakpoint handler.
exceptions, will be restarted upon return from the exception handler. When a fault occurs
after an operand has transferred, that transfer is not "undone". However, these memory
locations are accessed a second time when the instruction is restarted. If a register used
in an EA calculation is overwritten before a fault occurs, an incorrect EA is calculated upon
instruction restart.
5.5.3.2.6 Type III—Correcting Faults via RTE. The preferred method of MOVEM bus
fault recovery is to correct the cause of the fault and then execute an RTE instruction
without altering the stack contents.
The RTE recognizes that MOVEM was in progress when a fault occurred, restores the
appropriate machine state, refetches the instruction, repeats the faulted transfer, and
continues the instruction.
Freescale Semiconductor, Inc...
MOVEM is the only instruction continued upon return from an exception handler. Although
the instruction is refetched, the EA is not recalculated, and the mask is rescanned the
same number of times as before the fault; modifying the code prior to RTE can cause
unexpected results.
5.5.3.2.7 Type IV—Correcting Faults via Software. Bus error exceptions can occur
during exception processing while the processor is fetching an exception vector or while it
is stacking. The same stack frame and SSW are used in both cases, but each has a
distinct fault address. The stacked faulted exception format/vector word identifies the type
of faulted exception and the contents of the remainder of the frame. A fault address
corresponding to the vector specified in the stacked format/vector word indicates that the
processor could not obtain the address of the exception handler.
A bus error exception handler should execute RTE after correcting a fault. RTE restores
the internal machine state, fetches the address of the original exception handler, recreates
the original exception stack frame, and resumes execution at the exception handler
address.
If the fault is intractable, the exception handler should rewrite the faulted exception stack
frame at SP + $14 + $06 and then jump directly to the original exception handler. The
stack frame can be generated from the information in the bus error frame: the pre-
exception SR (SP + $0C), the format/vector word (SP + $0E), and, if the frame being
written is a six-word frame, the PC of the instruction causing the exception (SP + $10).
The return PC value is available at SP + $02.
A stacked fault address equal to the current SP may indicate that, although the first
exception received a bus error while stacking, the bus error exception stacking
successfully completed. This occurrence is extremely improbable, but the CPU32
supports recovery from it. Once the exception handler determines that the fault has been
corrected, recovery can proceed as described previously. If the fault cannot be corrected,
move the supervisor stack to another area of memory, copy all valid stack frames to the
new stack, create a faulted exception frame on top of the stack, and resume execution at
the exception handler address.
5.5.4.1 FOUR-WORD STACK FRAME. This stack frame is created by interrupt, format
error, TRAP #n, illegal instruction, A-line and F-line emulator trap, and privilege violation
exceptions. Depending on the exception type, the PC value is either the address of the
next instruction to be executed or the address of the instruction that caused the exception
(see Figure 5-12).
15 0
SP ⇒ STATUS REGISTER
+$02 PROGRAM COUNTER HIGH
Freescale Semiconductor, Inc...
5.5.4.2 SIX-WORD STACK FRAME. This stack frame (see Figure 5-13) is created by
instruction-related traps, which include CHK, CHK2, TRAPcc, TRAPV, and divide-by-zero,
and by trace exceptions. The faulted instruction PC value is the address of the instruction
that caused the exception. The next PC value (the address to which RTE returns) is the
address of the next instruction to be executed.
15 0
SP ⇒ STATUS REGISTER
+$02 NEXT INSTRUCTION PROGRAM COUNTER HIGH
NEXT INSTRUCTION PROGRAM COUNTER LOW
+$06 0 0 1 0 VECTOR OFFSET
+$08 FAULTED INSTRUCTION PROGRAM COUNTER HIGH
FAULTED INSTRUCTION PROGRAM COUNTER LOW
Hardware breakpoints also utilize this format. The faulted instruction PC value is the
address of the instruction executing when the breakpoint was sensed. Usually this is the
address of the instruction that caused the breakpoint, but, because released writes can
overlap following instructions, the faulted instruction PC may point to an instruction
following the instruction that caused the breakpoint. The address to which RTE returns is
the address of the next instruction to be executed.
5.5.4.3 BUS ERROR STACK FRAME. This stack frame is created when a bus cycle fault
is detected. The CPU32 bus error stack frame differs significantly from the equivalent
stack frames of other M68000 Family members. The only internal machine state required
in the CPU32 stack frame is the bus controller state at the time of the error and a single
register.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
TP MV 0 TR B1 B0 RR RM IN RW LG SIZ FUNC
The bus error stack frame is 12 words in length. There are three variations of the frame,
each distinguished by different values in the SSW TP and MV fields.
An internal transfer count register appears at location SP + $14 in all bus error stack
frames. The register contains an 8-bit microcode revision number, and, for type III faults,
an 8-bit transfer count. Register format is shown in Figure 5-14.
15 8 7 0
MICROCODE REVISION NUMBER TRANSFER COUNT
Freescale Semiconductor, Inc...
The microcode revision number is checked before a bus error stack frame is restored via
RTE. In a multiprocessor system, this check ensures that a processor using stacked
information is at the same revision level as the processor that created it.
The transfer count is ignored unless the MV bit in the stacked SSW is set. If the MV bit is
set, the least significant byte of the internal register is reloaded into the MOVEM transfer
counter during RTE execution.
For faults occurring during normal instruction execution (both prefetches and non-MOVEM
operand accesses) SSW TP, MV = 00. Stack frame format is shown in Figure 5-15.
Faults that occur during the operand portion of the MOVEM instruction are identified by
SSW TP, MV = 01. Stack frame format is shown in Figure 5-16.
When a bus error occurs during exception processing, SSW TP, MV = 10. The frame
shown in Figure 5-17 is written below the faulting frame. Stacking begins at the address
pointed to by SP – 6 (SP value is the value before initial stacking on the faulted frame).
The frame can have either four or six words, depending on the type of error. Four-word
stack frames do not include the faulted instruction PC (the internal transfer count register
is located at SP + $10 and the SSW is located at SP + $12).
The fault address of a dynamically sized bus cycle is the address of the upper byte,
regardless of the byte that caused the error.
15 0
SP ⇒ STATUS REGISTER
+$02 RETURN PROGRAM COUNTER HIGH
RETURN PROGRAM COUNTER LOW
+$06 1 1 0 0 VECTOR OFFSET
+$08 FAULTED ADDRESS HIGH
FAULTED ADDRESS LOW
+$0C DBUF HIGH
DBUF LOW
Freescale Semiconductor, Inc...
15 0
SP ⇒ STATUS REGISTER
+$02 RETURN PROGRAM COUNTER HIGH
RETURN PROGRAM COUNTER LOW
+$06 1 1 0 0 VECTOR OFFSET
+$08 FAULTED ADDRESS HIGH
FAULTED ADDRESS LOW
+$0C DBUF HIGH
DBUF LOW
+$10 CURRENT INSTRUCTION PROGRAM COUNTER HIGH
CURRENT INSTRUCTION PROGRAM COUNTER LOW
+$14 INTERNAL TRANSFER COUNT REGISTER
+$16 0 1 SPECIAL STATUS WORD
15 0
SP ⇒ STATUS REGISTER
+$02 NEXT INSTRUCTION PROGRAM COUNTER HIGH
NEXT INSTRUCTION PROGRAM COUNTER LOW
+$06 1 1 0 0 VECTOR OFFSET
+$08 FAULTED ADDRESS HIGH
FAULTED ADDRESS LOW
+$0C PRE-EXCEPTION STATUS REGISTER
FAULTED EXCEPTION FORMAT/VECTOR WORD
+$10 FAULTED INSTRUCTION PROGRAM COUNTER HIGH (SIX WORD FRAME ONLY)
FAULTED INSTRUCTION PROGRAM COUNTER LOW (SIX WORD FRAME ONLY)
+$14 INTERNAL TRANSFER COUNT REGISTER
+$16 1 0 SPECIAL STATUS WORD
Freescale Semiconductor, Inc...
Breakpoint Instruction—An emulator can insert software breakpoints into target code to
indicate when a breakpoint occurs. On the MC68010, MC68020, MC68030, and CPU32,
this function is provided via illegal instructions ($4848–$484F) that serve as breakpoint
instructions. See 5.5.2.5 Software Breakpoints for more information.
BDM incorporates a full set of debug options—registers can be viewed and/or altered,
memory can be read or written, and test features can be invoked.
IN-CIRCUIT
EMULATOR
TARGET
SYSTEM
.. . TARGET
MCU
By contrast, an integrated debugger supports use of a bus state analyzer (BSA) for in-
circuit emulation. The processor remains in the target system (see Figure 5-19), and the
interface is simplified. The BSA monitors target processor operation and the on-chip
debugger controls the operating environment. Emulation is much closer to target
hardware; thus, many interfacing problems (i.e., limitations on high-frequency operation,
AC and DC parametric mismatches, and restrictions on cable length) are minimized.
TARGET
SYSTEM
memory access. Off-chip address comparators will not detect breakpoints on internal
accesses unless show cycles are enabled. Breakpoints on prefetched instructions, which
are flushed from the pipeline before execution, are not acknowledged, but operand
breakpoints are always acknowledged. Acknowledged breakpoints can initiate either
exception processing or BDM. See 5.5.2.6 Hardware Breakpoints for more information.
exception conditions. While in BDM, the CPU32 ceases to fetch instructions via the
parallel bus and communicates with the development system via a dedicated, high-speed,
SPI-type serial command interface.
SERIAL
INTERFACE
IPIPE/DSO
MICROCODE SEQUENCER
IFETCH/DSI
IRC IRB IR
BERR
FREEZE
. . ...
EXECUTION
UNIT ADDRESS BUS
BDM operation is enabled when BKPT is asserted (low) at the rising edge of RESET. BDM
remains enabled until the next system reset. A high BKPT on the trailing edge of RESET
disables BDM. BKPT is relatched on each rising transition of RESET . BKPT is
synchronized internally and must be held low for at least two clock cycles prior to negation
of RESET.
BDM enable logic must be designed with special care. If hold time on BKPT (after the
trailing edge of RESET) extends into the first bus cycle following reset, this bus cycle could
be tagged with a breakpoint. Refer to Section 3 Bus Operation for timing information.
5.6.2.2 BDM SOURCES. When BDM is enabled, any of several sources can cause the
transition from normal mode to BDM. These sources include external BKPT hardware, the
BGND instruction, a double bus fault, and internal peripheral breakpoints. If BDM is not
enabled when an exception condition occurs, the exception is processed normally. Table
Freescale Semiconductor, Inc...
5-19 summarizes the processing of each source for both enabled and disabled cases. As
depicted in the table, the BKPT instruction never causes a transition into BDM.
5.6.2.2.1 External BKPT Signal. Once enabled, BDM is initiated whenever assertion of
BKPT is acknowledged. If BDM is disabled, a breakpoint exception (vector $0C) is
acknowledged. The BKPT input has the same timing relationship to the data strobe trailing
edge as does read cycle data. There is no breakpoint acknowledge bus cycle when BDM
is entered.
5.6.2.2.3 Double Bus Fault. The CPU32 normally treats a double bus fault (two bus faults
in succession) as a catastrophic system error and halts. When this condition occurs during
initial system debug (a fault in the reset logic), further debugging is impossible until the
problem is corrected. In BDM, the fault can be temporarily bypassed so that its origin can
be isolated and eliminated.
5.6.2.3 ENTERING BDM. When the processor detects a BKPT or a double bus fault or
decodes a BGND instruction, it suspends instruction execution and asserts the FREEZE
output. FREEZE assertion is the first indication that the processor has entered BDM. Once
FREEZE has been asserted, the CPU enables the serial communication hardware and
awaits a command.
The CPU writes a unique value indicating the source of BDM transition into temporary
register A (ATEMP) as part of the process of entering BDM. A user can poll ATEMP and
determine the source (see Table 5-20) by issuing a read system register command
(RSREG). ATEMP is used in most debugger commands for temporary storage—it is
imperative that the RSREG command be the first command issued after transition into
BDM.
A double bus fault during initial SP/PC fetch sequence is distinguished by a value of
$FFFFFFFF in the current instruction PC. At no other time will the processor write an odd
value into this register.
5.6.2.5 BDM REGISTERS. BDM processing uses three special-purpose registers to track
program context during development. A description of each register follows.
5.6.2.5.1 Fault Address Register (FAR). The FAR contains the address of the faulting
bus cycle immediately following a bus or address error. This address remains available
until overwritten by a subsequent bus cycle. Following a double bus fault, the FAR
contains the address of the last bus cycle. The address of the first fault (if one occurred) is
not visible to the user.
5.6.2.5.2 Return Program Counter (RPC). The RPC points to the location where fetching
will commence after transition from BDM to normal mode. This register should be
accessed to change the flow of a program under development. Changing the RPC to an
odd value will cause an address error when normal mode prefetching begins.
5.6.2.5.3 Current Instruction Program Counter (PCC). The PCC holds a pointer to the
first word of the last instruction executed prior to transition into BDM. Due to instruction
pipelining, the instruction pointed to may not be the instruction which caused the
transition. An example is a breakpoint on a released write. The bus cycle may overlap as
many as two subsequent instructions before stalling the instruction sequencer. A BKPT
asserted during this cycle will not be acknowledged until the end of the instruction
executing at completion of the bus cycle. PCC will contain $00000001 if BDM is entered
via a double bus fault immediately out of reset.
ENTER (BDM)
IF RESULTS = YES
"NOT READY"
NO
CONTINUE
5.6.2.6 RETURNING FROM BDM. BDM is terminated when a resume execution (GO) or
call user code (CALL) command is received. Both GO and CALL flush the instruction
pipeline and prefetch instructions from the location pointed to by the RPC.
The return PC and the memory space referred to by the SR SUPV bit reflect any changes
made during BDM. FREEZE is negated prior to initiating the first prefetch. Upon negation
of FREEZE, the serial subsystem is disabled, and the signals revert to IPIPE and IFETCH
functionality.
5.6.2.7 SERIAL INTERFACE. Communication with the CPU32 during BDM occurs via a
dedicated serial interface, which shares pins with other development features. The BKPT
signal becomes the DSCLK; DSI is received on IFETCH , and DSO is transmitted on
IPIPE.
The serial interface uses a full-duplex synchronous protocol similar to the serial peripheral
interface (SPI) protocol. The development system serves as the master of the serial link
since it is responsible for the generation of DSCLK. If DSCLK is derived from the CPU32
system clock, development system serial logic is unhindered by the operating frequency of
the target processor. Operable frequency range of the serial clock is from DC to one-half
the processor system clock frequency.
The serial interface operates in full-duplex mode—i.e., data is transmitted and received
simultaneously by both master and slave devices. In general, data transitions occur on the
falling edge of DSCLK and are stable by the following rising edge of DSCLK. Data is
transmitted MSB first and is latched on the rising edge of DSCLK.
The serial data word is 17 bits wide—16 data bits and a status/control (S/C) bit.
Freescale Semiconductor, Inc...
16 15 0
S/C DATA FIELD
Command and data transfers initiated by the development system should clear bit 16. The
current implementation ignores this bit; however, Motorola reserves the right to use this bit
for future enhancements.
5.6.2.7.1 CPU Serial Logic. CPU serial logic, shown in the left-hand portion of Figure 5-
22, consists of transmit and receive shift registers and of control logic that includes
synchronization, serial clock generation circuitry, and a received bit counter.
Both DSCLK and DSI are synchronized to on-chip clocks, thereby minimizing the chance
of propagating metastable states into the serial state machine. Data is sampled during the
high phase of CLKOUT. At the falling edge of CLKOUT, the sampled value is made
available to internal logic. If there is no synchronization between CPU32 and development
system hardware, the minimum hold time on DSI with respect to DSCLK is one full period
of CLKOUT.
DSI
SERIAL IN PARALLEL IN
PARALLEL OUT SERIAL OUT
DSO
PARALLEL IN SERIAL IN
SERIAL OUT PARALLEL OUT
Freescale Semiconductor, Inc...
16
DSCLK
CONTROL CONTROL SERIAL
LOGIC LOGIC CLOCK
The serial state machine begins a sequence of events based on the rising edge of the
synchronized DSCLK (see Figure 5-23). Synchronized serial data is transferred to the
input shift register, and the received bit counter is decremented. One-half clock period
later, the output shift register is updated, bringing the next output bit to the DSO signal.
DSO changes relative to the rising edge of DSCLK and does not necessarily remain
stable until the falling edge of DSCLK.
One clock period after the synchronized DSCLK has been seen internally, the updated
counter value is checked. If the counter has reached zero, the receive data latch is
updated from the input shift register. At this same time, the output shift register is reloaded
with the “not ready/come again” response. Once the receive data latch has been loaded,
the CPU is released to act on the new data. Response data overwrites the “not ready”
response when the CPU has completed the current operation.
Data written into the output shift register appears immediately on the DSO signal. In
general, this action changes the state of the signal from a high (“not ready” response
status bit) to a low (valid data status bit) logic level. However, this level change only
occurs if the command completes successfully. Error conditions overwrite the “not ready”
response with the appropriate response that also has the status bit set.
CLKOUT
FREEZE
DSCLK
DSI
SAMPLE
WINDOW
INTERNAL
SYNCHRONIZED
Freescale Semiconductor, Inc...
DSCLK
INTERNAL
SYNCHRONIZED
DSI
DSO
.
CLKOUT
A user can use the state change on DSO to signal hardware that the next serial transfer
may begin. A timeout of sufficient length to trap error conditions that do not change the
state of DSO should also be incorporated into the design. Hardware interlocks in the CPU
prevent result data from corrupting serial transfers in progress.
5.6.2.7.2 Development System Serial Logic. The development system, as the master of
the serial data link, must supply the serial clock. However, normal and BDM operations
could interact if the clock generator is not properly designed.
Breakpoint requests are made by asserting BKPT to the low state in either of two ways.
The primary method is to assert BKPT during a single bus cycle for which an exception is
desired. Another method is to assert BKPT , then continue to assert it until the CPU32
responds by asserting FREEZE. This method is useful for forcing a transition into BDM
when the bus is not being monitored. Each method requires a slightly different serial logic
design to avoid spurious serial clocks.
Figure 5-24 represents the timing required for asserting BKPT during a single bus cycle.
SHIFT_CLK
FORCE_BGND
BKPT_TAG
BKPT
. . .... .. . . . . .. . . . .
FREEZE
Figure 5-25 depicts the timing of the BKPT/FREEZE method. In both cases, the serial
clock is left high after the final shift of each transfer. This technique eliminates the
possibility of accidentally tagging the prefetch initiated at the conclusion of a BDM session.
As mentioned previously, all timing within the CPU is derived from the rising edge of the
Freescale Semiconductor, Inc...
SHIFT_CLK
FORCE_BGND
BKPT_TAG
BKPT
. . .... .. . . . . .. . . . .. .
FREEZE
Figure 5-26 represents a sample circuit providing for both BKPT assertion methods. As
the name implies, FORCE_BGND is used to force a transition into BDM by the assertion
of BKPT. FORCE_BGND can be a short pulse or can remain asserted until FREEZE is
asserted. Once asserted, the set-reset latch holds BKPT low until the first SHIFT_CLK is
applied.
BKPT_TAG
SHIFT_CLK
...
BKPT/DSCLK
S1 Q
RESET S2
FORCE_BGND R Q
BKPT_TAG should be timed to the bus cycles since it is not latched. If extended past the
assertion of FREEZE, the negation of BKPT_TAG appears to the CPU32 as the first
DSCLK.
DSCLK, the gated serial clock, is normally high, but it pulses low for each bit to be
transferred. At the end of the seventeenth clock period, it remains high until the start of the
next transmission. Clock frequency is implementation dependent and may range from DC
to the maximum specified frequency. Although performance considerations might dictate a
hardware implementation, software solutions can be used provided serial bus timing is
maintained.
5.6.2.8 COMMAND SET. The following paragraphs describe the command set available in
BDM.
5.6.2.8.1 Command Format. The following standard bit format is utilized by all BDM
commands.
15 10 9 8 7 6 5 4 3 2 0
Freescale Semiconductor, Inc...
R/W Field
The R/W field specifies the direction of operand transfer. When the bit is set, the
transfer is from CPU to development system. When the bit is cleared, data is written to
the CPU or to memory from the development system.
Operand Size
For sized operations, this field specifies the operand data size. All addresses are
expressed as 32-bit absolute values. The size field is encoded as listed in Table 5-22.
Register Field:
In most commands, this field specifies the register number for operations performed on
an address or data register.
represents a single 17-bit transfer across the bus. The top half in each diagram
corresponds to the data transmitted by the development system to the CPU; the bottom
half corresponds to the data returned by the CPU in response to the development system
commands. Command and result transactions are overlapped to minimize latency.
The cycle in which the command is issued contains the development system command
mnemonic (in this example, read memory location). During the same cycle, the CPU
responds with either the lowest order results of the previous command or with a command
complete status (if no results were required).
During the second cycle, the development system supplies the high-order 16 bits of the
memory address. The CPU returns a "not ready" response unless the received command
was decoded as unimplemented, in which case the response data is the illegal command
encoding. If an illegal command response occurs, the development system should
retransmit the command.
NOTE
The “not ready” response can be ignored unless a memory bus
cycle is in progress. Otherwise, the CPU can accept a new
serial transfer with eight system clock periods.
In the third cycle, the development system supplies the low-order 16 bits of a memory
address. The CPU always returns the “not ready” response in this cycle. At the completion
of the third cycle, the CPU initiates a memory read operation. Any serial transfers that
begin while the memory access is in progress return the “not ready” response.
Results are returned in the two serial transfer cycles following the completion of memory
access. The data transmitted to the CPU during the final transfer is the opcode for the
following command. Should a memory access generate either a bus or address error, an
error status is returned in place of the result data.
NONSERIAL-RELATED ACTIVITY
SEQUENCE TAKEN IF
OPERATION HAS NOT
COMPLETED
NEXT
READ COMMAND
READ (LONG) MS ADDR LS ADDR XXX CODE
MEMORY
??? "NOT READY" "NOT READY" "NOT READY"
LOCATION
XXX NEXT CMD XXX
XXX NEXT CMD
"ILLEGAL" "NOT READY" MS RESULT LS RESULT
Freescale Semiconductor, Inc...
5.6.2.8.3 Command Set Summary. The BDM command set is summarized in Table 5-23.
Subsequent paragraphs contain detailed descriptions of each command.
space accessed.
Dump Memory Block DUMP Used in conjunction with the READ command to dump large blocks
of memory. An initial READ is executed to set up the starting
address of the block and to retrieve the first result. Subsequent
operands are retrieved with the DUMP command.
Fill Memory Block FILL Used in conjunction with the WRITE command to fill large blocks of
memory. An initial WRITE is executed to set up the starting
address of the block and to supply the first operand. Subsequent
operands are written with the FILL command.
Resume Execution GO The pipeline is flushed and refilled before resuming instruction
execution at the return PC.
Call User Code CALL Current PC is stacked at the location of the current SP. Instruction
execution begins at user patch code.
Reset Peripherals RST Asserts RESET for 512 clock cycles. The CPU is not reset by this
command. Synonymous with the CPU RESET instruction.
No Operation NOP NOP performs no operation and may be used as a null command.
5.6.2.8.4 Read A/D Register (RAREG/RDREG). Read the selected address or data
register and return the results via the serial interface.
Command Format:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 0 0 0 0 1 1 0 0 0 A/D REGISTER
Command Sequence:
Operand Data:
None
Result Data:
The contents of the selected register are returned as a long-word value. The data is
returned most significant word first.
5.6.2.8.5 Write A/D Register (WAREG/WDREG). The operand (long-word) data is written
to the specified address or data register. All 32 bits of the register are altered by the write.
Command Format:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 0
0 0 1 0 0 0 0 0 1 0 0 0 A/D REGISTER
Command Sequence:
Freescale Semiconductor, Inc...
Operand Data:
Long-word data is written into the specified address or data register. The data is
supplied most significant word first.
Result Data:
Command complete status ($0FFFF) is returned when register write is complete.
5.6.2.8.6 Read System Register (RSREG). The specified system control register is read.
All registers that can be read in supervisor mode can be read in BDM. Several internal
temporary registers are also accessible.
Command Format:
15 14 13 12 11 10 9 8 7 6 5 4 3 0
0 0 1 0 0 1 0 0 1 0 0 0 REGISTER
Command Sequence:
Operand Data:
None
Result Data:
Always returns 32 bits of data, regardless of the size of the register being read. If the
register is less than 32 bits, the result is returned zero extended.
Register Field:
The system control register is specified by the register field (see Table 5-24).
5.6.2.8.7 Write System Register (WSREG). Operand data is written into the specified
system control register. All registers that can be written in supervisor mode can be written
in BDM. Several internal temporary registers are also accessible.
Command Format:
15 14 13 12 11 10 9 8 7 6 5 4 3 0
0 0 1 0 0 1 0 0 1 0 0 0 REGISTER
Command Sequence:
Operand Data:
The data to be written into the register is always supplied as a 32-bit long word. If the
register is less than 32 bits, the least significant word is used.
Result Data:
“Command complete” status is returned when register write is complete.
Register Field:
The system control register is specified by the register field (see Table 5-24). The FAR
is a read-only register—any write to it is ignored.
5.6.2.8.8 Read Memory Location (READ). Read the sized data at the memory location
specified by the long-word address. Only absolute addressing is supported. The SFC
register determines the address space accessed. Valid data sizes include byte, word, or
long word.
Command Format:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 1 1 0 0 1 OP SIZE 0 0 0 0 0 0
Freescale Semiconductor, Inc...
Command Sequence:
Operand Data:
The single operand is the long-word address of the requested memory location.
Result Data:
The requested data is returned as either a word or long word. Byte data is returned in
the least significant byte of a word result, with the upper byte cleared. Word results
return 16 bits of significant data; long-word results return 32 bits.
A successful read operation returns data bit 16 cleared. If a bus or address error is
encountered, the returned data is $10001.
5.6.2.8.9 Write Memory Location (WRITE). Write the operand data to the memory
location specified by the long-word address. The DFC register determines the address
space accessed. Only absolute addressing is supported. Valid data sizes include byte,
word, and long word.
Command Format:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 1 1 0 0 0 OP SIZE 0 0 0 0 0 0
Command Sequence:
WRITE
WRITE (B/W) MS ADDR LS ADDR DATA XXX
MEMORY
??? "NOT READY" "NOT READY" "NOT READY" LOCATION "NOT READY"
XXX
BERR/AERR
NEXT CMD
"NOT READY"
XXX
BERR/AERR
NEXT CMD
"NOT READY"
Operand Data:
Two operands are required for this instruction. The first operand is a long-word absolute
address that specifies a location to which the operand data is to be written. The second
operand is the data. Byte data is transmitted as a 16-bit word, justified in the least
significant byte; 16- and 32-bit operands are transmitted as 16 and 32 bits, respectively.
Result Data:
Successful write operations return a status of $0FFFF. Bus or address errors on the
write cycle are indicated by the assertion of bit 16 in the status message and by a data
pattern of $0001.
5.6.2.8.10 Dump Memory Block (DUMP). DUMP is used in conjunction with the READ
command to dump large blocks of memory. An initial READ is executed to set up the
starting address of the block and to retrieve the first result. Subsequent operands are
retrieved with the DUMP command. The initial address is incremented by the operand size
(1, 2, or 4) and saved in a temporary register. Subsequent DUMP commands use this
address, increment it by the current operand size, and store the updated address back in
the temporary register.
NOTE
The DUMP command does not check for a valid address in the
temporary register—DUMP is a valid command only when
preceded by another DUMP or by a READ command.
Otherwise, the results are undefined. The NOP command can
be used for intercommand padding without corrupting the
address pointer.
Freescale Semiconductor, Inc...
The size field is examined each time a DUMP command is given, allowing the operand
size to be altered dynamically.
Command Format:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 1 1 1 0 1 OP SIZE 0 0 0 0 0 0
Command Sequence:
READ
DUMP (LONG) XXX
MEMORY
??? "NOT READY"
LOCATION
NEXT CMD
RESULT
READ
DUMP (LONG) XXX
MEMORY
??? "NOT READY"
LOCATION
NEXT CMD NEXT CMR
MS RESULT LS RESULT
Operand Data:
None
Result Data:
Requested data is returned as either a word or long word. Byte data is returned in the
least significant byte of a word result. Word results return 16 bits of significant data;
long-word results return 32 bits. Status of the read operation is returned as in the READ
command: $0xxxx for success, $10001 for bus or address errors.
5.6.2.8.11 Fill Memory Block (FILL). FILL is used in conjunction with the WRITE
command to fill large blocks of memory. An initial WRITE is executed to set up the starting
address of the block and to supply the first operand. Subsequent operands are written
with the FILL command. The initial address is incremented by the operand size (1, 2, or 4)
Freescale Semiconductor, Inc...
and is saved in a temporary register. Subsequent FILL commands use this address,
increment it by the current operand size, and store the updated address back in the
temporary register.
NOTE
The FILL command does not check for a valid address in the
temporary register—FILL is a valid command only when
preceded by another FILL or by a WRITE command.
Otherwise, the results are undefined. The NOP command can
be used for intercommand padding without corrupting the
address pointer.
The size field is examined each time a FILL command is given, allowing the operand size
to be altered dynamically.
Command Format:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 1 1 1 0 0 OP SIZE 0 0 0 0 0 0
Command Sequence:
WRITE
FILL (B/W) MS DATA LS DATA XXX
MEMORY
??? "NOT READY" "NOT READY" LOCATION "NOT READY"
WRITE
FILL (LONG) DATA XXX
MEMORY
??? "NOT READY" LOCATION "NOT READY"
Freescale Semiconductor, Inc...
Operand Data:
A single operand is data to be written to the memory location. Byte data is transmitted
as a 16-bit word, justified in the least significant byte; 16- and 32-bit operands are
transmitted as 16 and 32 bits, respectively.
Result Data:
Status is returned as in the WRITE command: $0FFFF for a successful operation and
$10001 for a bus or address error during write.
5.6.2.8.12 Resume Execution (GO). The pipeline is flushed and refilled before normal
instruction execution is resumed. Prefetching begins at the return PC and current privilege
level. If either the PC or SR is altered during BDM, the updated value of these registers is
used when prefetching commences.
NOTE
The processor exits BDM when a bus error or address error
occurs on the first instruction prefetch from the new PC—the
error is trapped as a normal mode exception. The stacked
value of the current PC may not be valid in this case,
depending on the state of the machine prior to entering BDM.
For address error, the PC does not reflect the true return PC.
Instead, the stacked fault address is the (odd) return PC.
Command Format:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0
Command Sequence:
GO NORMAL
??? MODE
Operand Data:
None
Result Data:
None
Freescale Semiconductor, Inc...
5.6.2.8.13 Call User Code (CALL). This instruction provides a convenient way to patch
user code. The return PC is stacked at the location pointed to by the current SP. The
stacked PC serves as a return address to be restored by the RTS command that
terminates the patch routine. After stacking is complete, the 32-bit operand data is loaded
into the PC. The pipeline is flushed and refilled from the location pointed to by the new
PC, BDM is exited, and normal mode instruction execution begins.
NOTE
If a bus error or address error occurs during return address
stacking, the CPU returns an error status via the serial
interface and remains in BDM.
Command Format:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
Command Sequence:
PREFETCH NORMAL
STARTED MODE
Operand Data:
The 32-bit operand data is the starting location of the patch routine, which is the initial
PC upon exiting BDM.
Result Data:
None
As an example, consider the following code segment. It outputs a character from the
MC68340 serial module channel A.
BDM and the CALL command can be used to patch the code as follows:
5.6.2.8.14 Reset Peripherals (RST). RST asserts RESET for 512 clock cycles. The CPU
is not reset by this command. This command is synonymous with the CPU RESET
instruction.
Command Format:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
Command Sequence:
NEXT CMD
"CMD COMPLETE"
Operand Data:
None
Result Data:
The “command complete” response ($0FFFF) is loaded into the serial shifter after
negation of RESET.
5.6.2.8.15 No Operation (NOP). NOP performs no operation and may be used as a null
command where required.
Command Format:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Command Sequence:
Operand Data:
None
Result Data:
The “command complete” response ($0FFFF) is returned during the next shift
operation.
5.6.3.1 INSTRUCTION FETCH (IFETCH ) . IFETCH indicates which bus cycles are
accessing data to fill the instruction pipeline. IFETCH is pulse-width modulated to
multiplex two indications on a single pin. Asserted for a single clock cycle, IFETCH
indicates that the data from the current bus cycle is to be routed to the instruction pipeline.
Freescale Semiconductor, Inc...
IFETCH held low for two clock cycles indicates that the instruction pipeline has been
flushed. The data from the bus cycle is used to begin filling the empty pipeline. Both user
and supervisor mode fetches are signaled by IFETCH.
Proper tracking of bus cycles via IFETCH on a fast bus requires a simple state machine.
On a two-clock bus, IFETCH may signal a pipeline flush with associated prefetch followed
immediately by a second prefetch. That is, IFETCH remains asserted for three clocks, two
clocks indicating the flush/fetch and a third clock signaling the second fetch. These two
operations are easily discerned if the tracking logic samples IFETCH on the two rising
edges of CLKOUT, which follow the AS ( DS during show cycles) falling edge. Three-clock
and slower bus cycles allow time for negation of the signal between consecutive
indications and do not experience this operation.
5.6.3.2 INSTRUCTION PIPE (IPIPE ) . The internal instruction pipeline can be modeled as
a three-stage FIFO (see Figure 5-28). Stage A is an input buffer—data can be used out of
stages B and C. IPIPE signals advances of instructions in the pipeline.
Instruction register A (IRA) holds incoming words as they are prefetched. No decoding
takes place in the buffer. Instruction register B (IRB) provides initial decoding of the
opcode and decoding of extension words; it is a source of immediate data. Instruction
register C (IRC) supplies residual opcode decoding during instruction execution.
I I I
DATA
R R R
BUS
A
. B C
EXTENSION OPCODES
WORDS RESIDUAL
Assertion of IPIPE for a single clock cycle indicates the use of data from IRB. Regardless
of the presence of valid data in IRA, the contents of IRB are invalidated when IPIPE is
asserted. If IRA contains valid data, the data is copied into IRB (IRA ⇒ IRB), and the IRB
stage is revalidated.
Assertion of IPIPE for two clock cycles indicates the start of a new instruction and
subsequent replacement of data in IRC. This action causes a full advance of the pipeline
(IRB ⇒ IRC and IRA ⇒ IRB). IRA is refilled during the next instruction fetch bus cycle.
Data loaded into IRA propagates automatically through subsequent empty pipeline stages.
Signals that show the progress of instructions through IRB and IRC are necessary to
accurately monitor pipeline operation. These signals are provided by IRA and IRB validity
bits. When a pipeline advance occurs, the validity bit of the stage being loaded is set, and
the validity bit of the stage supplying the data is negated.
Freescale Semiconductor, Inc...
Because instruction execution is not timed to bus activity, IPIPE is synchronized with the
system clock, not the bus. Figure 5-29 illustrates the timing in relation to the system clock.
IR IR IR
.. . IR
IR IR IRB IRC IR IR IRB IRC
CLKOUT
IPIPE
IPIPE should be sampled on the falling edge of the clock. The assertion of IPIPE for a
single cycle after one or more cycles of negation indicates use of the data in IRB (advance
of IRA into IRB). Assertion for two clock cycles indicates that a new instruction has started
(IRB ⇒ IRC and IRA ⇒ IRB transfers have occurred). Loading IRC always indicates that
an instruction is beginning execution—the opcode is loaded into IRC by the transfer.
In some cases, instructions using immediate addressing begin executing and initiate a
second pipeline advance simultaneously at the same time. IPIPE will not be negated
between the two indications, which implies the need for a state machine to track the state
of IPIPE. The state machine can be resynchronized during periods of inactivity on the
signal.
5.6.3.3 OPCODE TRACKING DURING LOOP MODE. IPIPE and IFETCH continue to
work normally during loop mode. IFETCH indicates all instruction fetches up through the
point that data begins recirculating within the instruction pipeline. IPIPE continues to
signal the start of instructions and the use of extension words even though data is being
recirculated internally. IFETCH returns to normal operation with the first fetch after exiting
loop mode.
An assembly language programmer or compiler writer can use the information in this
section to predict the performance of the CPU32. Additionally, timing for exception
processing is included so that designers of multitasking or real-time systems can predict
task-switch overhead, maximum interrupt latency, and similar timing parameters.
Instruction timing is given in clock cycles to eliminate clock frequency dependency.
Freescale Semiconductor, Inc...
Stage A of the instruction pipeline is a buffer. Prefetches completed on the bus before
stage B empties are temporarily stored in this buffer. Instruction words (instruction
operation words and all extension words) are decoded at stage B. Residual decoding and
execution occur in stage C.
Each pipeline stage has an associated status bit that shows whether the word in that
stage was loaded with data from a bus cycle that terminated abnormally.
5.7.1.3 BUS CONTROLLER RESOURCES. The bus controller consists of the instruction
prefetch controller, the write pending buffer, and the microbus controller. These three
resources transact all reads, writes, and instruction prefetches required for instruction
execution.
The bus controller and microsequencer operate concurrently. The bus controller can
perform a read or write or schedule a prefetch while the microsequencer controls EA
calculation or sets condition codes.
The microsequencer can also request a bus cycle that the bus controller cannot perform
immediately. When this happens, the bus cycle is queued, and the bus controller runs the
cycle when the current cycle is complete.
STAGE STAGE
CONTROL STORE B
C
Freescale Semiconductor, Inc...
CONTROL LOGIC
EXECUTION UNIT
PROGRAM DATA
DATA
COUNTER BUS
SECTION
SECTION
WRITE-PENDING PREFETCH
BUFFER CONTROLLER
ADDRESS
BUS
MICROBUS
CONTROLLER
BUS CONTROL
SIGNALS
priority, many instruction words would be flushed unused, and necessary operand cycles
would be delayed. To maximize available bus bandwidth, the CPU32 will schedule a
prefetch only when the next instruction is not a change-of-flow instruction and when there
is room in the pipeline for the prefetch.
5.7.1.3.2 Write Pending Buffer. The CPU32 incorporates a single-operand write pending
buffer. The buffer permits the microsequencer to continue execution after a request for a
write cycle is queued in the bus controller. The time needed for a write at the end of an
instruction can overlap the head cycle time for the following instruction, thus reducing
overall execution time. Interlocks prevent the microsequencer from overwriting the buffer.
5.7.1.3.3 Microbus Controller. The microbus controller performs bus cycles issued by
the microsequencer. Operand accesses always have priority over instruction prefetches.
Word and byte operands are accessed in a single CPU-initiated bus cycle, although the
Freescale Semiconductor, Inc...
external bus interface may be required to initiate a second cycle when a word operand is
sent to a byte-sized external port. Long operands are accessed in two bus cycles, most
significant word first.
The instruction pipeline is capable of recognizing instructions that cause a change of flow.
It informs the bus controller when a change of flow is imminent, and the bus controller
refrains from starting prefetches that would be discarded due to the change of flow.
Each instruction contributes to the total overlap time. The portion of execution time at the
end of instruction A that can overlap the beginning of instruction B is called the tail of
instruction A. The portion of execution time at the beginning of instruction B that can
overlap the end of instruction A is called the head of instruction B. The total overlap time
between instructions A and B is the smaller tail of A and the head of B.
INSTRUCTION A
INSTRUCTION B
INSTRUCTION C
OVERLAP OVERLAP
The execution time attributed to instructions A, B, and C after considering the overlap is
illustrated in Figure 5-32. The overlap time is attributed to the execution time of the
completing instruction. The following equation shows the method for calculating the
overlap time:
INSTRUCTION A
INSTRUCTION B
INSTRUCTION C
Freescale Semiconductor, Inc...
OVERLAP OVERLAP
PERIOD PERIOD
(ABSORBED BY (ABSORBED BY
INSTRUCTION A) INSTRUCTION B)
5.7.1.5 EFFECTS OF WAIT STATES. The CPU32 access time for on-chip peripherals is
two clocks. While two-clock external accesses are possible when the bus is operated in a
synchronous mode, a typical external memory speed is three or more clocks.
All instruction times listed in this section are for word access only (unless an explicit
exception is given), and are based on the assumption that both instruction fetches and
operand cycles are to a two-clock memory. Any time a long access is made, time for the
additional bus cycle(s) must be added to the overall execution time. Wait states due to
slow external memory must be added to the access time for each bus cycle.
To trace instruction execution time by monitoring the external bus, note that the order of
operand accesses for a particular instruction sequence is always the same provided bus
speed is unchanged and the interleaving of instruction prefetches with operands within
each sequence is identical.
analyzed. To derive the actual instruction execution times for an instruction sequence, the
instruction times listed in the tables must be adjusted to account for overlap.
where:
The number of cycles for the instruction (CN) can include one or two EA calculations in
addition to the raw number in the cycles column. In these cases, calculate overall
instruction time as if it were for multiple instructions, using the following equation:
where:
COP1 − min (TOP1 , HEA2 ) + 〈CEA〉2 − min (TEA2 , HOP2 ) + C OP2 − min (TOP2 , HEA3 ) + . . .
Every instruction must prefetch to replace itself in the instruction pipe. Usually, these
prefetches occur during or after an instruction. A prefetch is permitted to begin in the first
clock of any indexed EA mode operation.
Additionally, a prefetch for an instruction is permitted to begin two clocks before the end of
an instruction provided the bus is not being used. If the bus is being used, then the
prefetch occurs at the next available time when the bus would otherwise be idle.
5.7.1.7 EFFECTS OF NEGATIVE TAILS. When the CPU32 changes instruction flow, the
instruction decode pipeline must begin refilling before instruction execution can resume.
Refilling forces a two-clock idle period at the end of the change-of-flow instruction. This
idle period can be used to prefetch an additional word on the new instruction path.
Because of the stipulation that each instruction must prefetch to replace itself, the concept
of negative tails has been introduced to account for these free clocks on the bus.
On a two-clock bus, it is not necessary to adjust instruction timing to account for the
potential extra prefetch. The cycle times of the microsequencer and bus are matched, and
no additional benefit or penalty is obtained. In the instruction execution time equations, a
zero should be used instead of a negative number.
Negative tails are used to adjust for slower fetches on slower buses. Normally, increasing
the length of prefetch bus cycles directly affects the cycle count and tail values found in
the tables.
In the following equations, negative tail values are used to negate the effects of a slower
bus. The equations are generalized, however, so that they may be used on any speed bus
Freescale Semiconductor, Inc...
ELSE
where:
NEW_TAIL/NEW_CYCLE is the adjusted tail/cycle at the slower speed
OLD_TAIL/OLD_CYCLE is the value listed in the instruction timing tables
NEW_CLOCK is the number of clocks per cycle at the slower speed
Note that many instructions listed as having negative tails are change-of-flow instructions
and that the bus speed used in the calculation is that of the new instruction stream.
Instructions
MOVE.W A1, (A0) +
ADDQ.W #1, (A0)
CLR.W $30 (A1)
1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8
CLOCK
happens when a branch instruction is executed for both the taken and not-taken cases.
(see Figures 5-34 and 5-35). The instruction stream is for a simple limit check with the
variable already in a data register.
Instructions
MOVEQ #7, D1
CMP.L D1, D0
BLE.B NEXT
MOVE.L D1, (A0)
1 2 3 4 5 6 7 8 9 0 1 2 3 4
CLOCK
1 2 3 4 5 6 7 8 9 0 1 2 3 4
CLOCK
5.7.2.3 TIMING EXAMPLE 3—NEGATIVE TAILS. This example (see Figure 5-36) shows
how to use negative tail figures for branches and other change-of-flow instructions. In this
example, bus speed is assumed to be four clocks per access. Instruction three is at the
branch destination.
Although the CPU32 has a two-word instruction pipeline, internal delay causes minimum
branch instruction time to be three bus cycles. The negative tail is a reminder that an extra
two clocks are available for prefetching a third word on a fast bus; on a slower bus, there
is no extra time for the third word.
Instructions
MOVEQ #7, D1
BRA.W FARAWAY
MOVE.L D1, D0
1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
CLOCK
The following assumptions apply to the times shown in the subsequent tables.
—A 16-bit data bus is used for all memory accesses.
—Memory access times are based on two clock bus cycles with no wait states.
—The instruction pipeline is full at the beginning of the instruction and is refilled by
the end of the instruction.
Three values are listed for each instruction and addressing mode:
Cycles: Four numbers per entry, three contained in parentheses. The outer number is the
minimum number of cycles required for the instruction to complete. Numbers
within the parentheses represent the number of bus accesses performed by the
instruction. The first number is the number of operand read accesses performed
by the instruction. The second number is the number of instruction fetches
performed by the instruction, including all prefetches that keep the instruction and
the instruction pipeline filled. The third number is the number of write accesses
performed by the instruction.
Paragraph 5.7.3.5 Arithmetic/Logic Instructions shows that the instruction has a head =
0, a tail = 0, and cycles = 2 (0/1/0). However, in indexed, address register indirect
addressing mode, additional time is required to fetch the EA. Paragraph 5.7.3.1 Fetch
Effective Address gives addressing mode data. For (d 8 , An, Xn.Sz ∗ Scale), head = 4,
tail = 2, cycles = 8 (2/1/0). Because this example is for a long access and the fetch EA
table lists data for word accesses, add two clocks to the tail and to the number of cycles
(“X” in table notation) to obtain head = 4, tail = 4, cycles = 10 (2/1/0).
Assuming that no trailing write exists from the previous instruction, EA calculation requires
six clocks. Replacement fetch for the EA occurs during these six clocks, leaving a head of
four. If there is no time in the head to perform a prefetch due to a previous trailing write,
then additional time to perform the prefetches must be allotted in the middle of the
instruction or after the tail.
8 (2 /1 /0)
Memory read requires two bus cycles at two clocks each. This read time, implied in the tail
figure for the EA, cannot be overlapped with the instruction because the instruction has a
head of zero. An additional two clocks are required for the ADD instruction itself. The total
is 6 + 4 + 2 = 12 clocks. If bus cycles take more time (i.e., the memory is off-chip), add an
appropriate number of clocks to each memory access.
The instruction sequence MOVE.L D0, (A0) followed by LSL.L #7, D2 provides an
example of overlapped execution. The MOVE instruction has a head of zero and a tail of
four because it is a long write. The LSL instruction has a head of four. The trailing write
from the MOVE overlaps the LSL head completely. Thus, the two-instruction sequence
has a head of zero and a tail of zero, and a total execution of 8 rather than 12 clocks.
5.7.3.1 FETCH EFFECTIVE ADDRESS. The fetch EA table indicates the number of clock
periods needed for the processor to calculate and fetch the specified EA. The total
number of clock cycles is outside the parentheses. The numbers inside parentheses
(r/p/w) are included in the total clock cycle number. All timing data assumes two-clock
reads and writes.
(xxx).W 1 3 5(X/1/0) 1
(xxx).L 1 5 7(X/2/0) 1
#〈data〉.B 1 1 3(0/1/0) 1
#〈data〉.W 1 1 3(0/1/0) 1
#〈data〉.L 1 3 5(0/2/0) 1
(d 8,An,Xn.Sz × Sc) or (d8,PC,Xn.Sz × Sc) 4 2 8(X/1/0) 1,2,3,4
(0) (All Suppressed) 2 2 6(X/1/0) 1,4
(d 16 ) 1 3 7(X/2/0) 1,4
(d 32 ) 1 5 9(X/3/0) 1,4
(An) 1 1 5(X/1/0) 1,2,4
(Xm.Sz × Sc) 4 2 8(X/1/0) 1,2,4
(An,Xm.Sz × Sc) 4 2 8(X/1/0) 1,2,3,4
(d 16 ,An) or (d16 ,PC) 1 3 7(X/2/0) 1,3,4
(d 32 ,An) or (d32 ,PC) 1 5 9(X/3/0) 1,3,4
(d 16 ,An,Xm) or (d16 ,PC,Xm) 2 2 8(X/2/0) 1,3,4
(d 32 ,An,Xm) or (d32 ,PC,Xm) 1 3 9(X/3/0) 1,3,4
(d 16 ,An,Xm.Sz × Sc) or (d16 ,PC,Xm.Sz × Sc) 2 2 8(X/2/0) 1,2,3,4
(d 32 ,An,Xm.Sz × Sc) or (d32 ,PC,Xm.Sz × Sc) 1 3 9(X/3/0) 1,2,3,4
X = There is one bus cycle for byte and word operands and two bus cycles for long-word operands.
For long-word bus cycles, add two clocks to the tail and to the number of cycles.
NOTES:
1. The read of the EA and replacement fetches overlap the head of the operation by the amount
specified in the tail.
2. Size and scale of the index register do not affect execution time.
3. The PC may be substituted for the base address register An.
4. When adjusting the prefetch time for slower buses, extra clocks may be subtracted from the
head until the head reaches zero, at which time additional clocks must be added to both the tail
and cycle counts.
5.7.3.3 MOVE INSTRUCTION. The MOVE instruction table indicates the number of clock
periods needed for the processor to calculate the destination EA and to perform a MOVE
or MOVEA instruction. For entries with CEA or FEA, refer to the appropriate table to
calculate that portion of the instruction time.
Destination EAs are divided by their formats (see 5.3.4.4 Effective Address Encoding
Summary). The total number of clock cycles is outside the parentheses. The numbers
inside parentheses (r/p/w) are included in the total clock cycle number. All timing data
assumes two-clock reads and writes.
When using this table, begin at the top and move downward. Use the first entry that
matches both source and destination addressing modes.
Freescale Semiconductor, Inc...
The numbers inside parentheses (r/p/w) are included in the total clock cycle number. All
timing data assumes two-clock reads and writes.
OR Dn, Dm 0 0 2(0/1/0)
OR 〈FEA〉, Dn 0 0 2(0/1/0)
OR Dn, 〈FEA 〉 0 3 5(0/1/x)
SUB(A) Rn, Rm 0 0 2(0/1/0)
SUB(A) 〈FEA〉, Rn 0 0 2(0/1/0)
SUB Dn, 〈FEA 〉 0 3 5(0/1/x)
CMP(A) Rn, Rm 0 0 2(0/1/0)
CMP(A) 〈FEA〉, Rn 0 0 2(0/1/0)
CMP2 (Save) * 〈FEA〉, Rn 1 1 3(0/1/0)
CMP2 (Op) 〈FEA〉, Rn 2 0 16-18(X/1/0)
MUL(su).W 〈FEA〉, Dn 0 0 26(0/1/0)
MUL(su).L (Save) * 〈FEA〉, Dn 1 1 3(0/1/0)
MUL(su).L (Op) 〈FEA〉, Dl 2 0 46-52(0/1/0)
MUL(su).L (Op) 〈FEA〉, Dn:Dl 2 0 46(0/1/0)
DIVU.W 〈FEA〉, Dn 0 0 32(0/1/0)
DIVS.W 〈FEA〉, Dn 0 0 42(0/1/0)
DIVU.L (Save)* 〈FEA〉, Dn 1 1 3(0/1/0)
DIVU.L (Op) 〈FEA〉, Dn 2 0 <46(0/1/0)
DIVS.L (Save) * 〈FEA〉, Dn 1 1 3(0/1/0)
DIVS.L (Op) 〈FEA〉, Dn 2 0 <62(0/1/0)
TBL(su) Dn:Dm, Dp 26 0 28-30(0/2/0)
TBL(su) (Save) * 〈CEA〉, Dn 1 1 3(0/1/0)
TBL(su) (Op) 〈CEA〉, Dn 6 0 33-35(2X/1/0)
TBLSN Dn:Dm, Dp 30 0 30-34(0/2/0)
TBLSN (Save)* 〈CEA〉, Dn 1 1 3(0/1/0)
TBLSN (Op) 〈CEA〉, Dn 6 0 35-39(2X/1/0)
ADDQ 0 3 5(0/1/x)
SUBQ #, Rn 0 0 2(0/1/0)
SUBQ #, 〈FEA〉 0 3 5(0/1/x)
ADDI #, Rn 0 0 2(0/1/0)∗
ADDI #, 〈FEA〉 0 3 5(0/1/x) ∗
ANDI #, Rn 0 0 2(0/1/0)∗
ANDI #, 〈FEA〉 0 3 5(0/1/x) ∗
EORI #, Rn 0 0 2(0/1/0)∗
EORI #, 〈FEA〉 0 3 5(0/1/x) ∗
ORI #, Rn 0 0 2(0/1/0)∗
ORI #, 〈FEA〉 0 3 5(0/1/x) ∗
SUBI #, Rn 0 0 2(0/1/0)∗
SUBI #, 〈FEA〉 0 3 5(0/1/x) ∗
CMPI #, Rn 0 0 2(0/1/0)∗
CMPI #, 〈FEA〉 0 3 5(0/1/x) ∗
X = There is one bus cycle for byte and word operands and two bus cycles for long-
word operands. For long-word bus cycles, add two clocks to the tail and to the
number of cycles.
∗ = An # fetch EA time must be added for this instruction: 〈FEA〉 +〈FEA 〉 + 〈OPER〉
ASd #, Dm 4 0 6(0/1/0) —
ASd 〈FEA〉 0 2 6(0/1/1) —
ROd Dn, Dm −2 0 (0/1/0) 1
ROd #, Dm 4 0 6(0/1/0) —
ROd 〈FEA〉 0 2 6(0/1/1) —
ROXd Dn, Dm −2 0 (0/1/0) 2
ROXd #, Dm −2 0 (0/1/0) 3
ROXd 〈FEA〉 0 2 6(0/1/1) —
d = Direction (left or right)
NOTES:
1. Head and cycle times can be derived from the following table or calculated as follows:
Max (3 + (n/4) + mod(n,4) + mod (((n/4) + mod (n,4) + 1,2), 6)
2. Head and cycle times are calculated as follows: (count ≤ 63): max (3 + n + mod (n + 1,2), 6).
3. Head and cycle times are calculated as follows: (count ≤ 8): max (2 + n + mod (n,2), 6).
5.7.3.12 CONTROL INSTRUCTIONS. The control instruction table indicates the number
of clock periods needed for the processor to perform the specified operation on the given
addressing mode. Footnotes indicate when to account for the appropriate EA times. The
total number of clock cycles is outside the parentheses. The numbers inside parentheses
(r/p/w) are included in the total clock cycle number. All timing data assumes two-clock
reads and writes.
Interrupt 0 −2 30(3/2/4)∗
RESET 0 0 518(0/1/0)
STOP 2 0 12(0/1/0)
LPSTOP 3 −2 25(0/3/1)
Divide-by-Zero 0 −2 36(2/2/6)
Trace 0 −2 36(2/2/6)
TRAP # 4 −2 29(2/2/4)
ILLEGAL 0 −2 25(2/2/4)
A-line 0 −2 25(2/2/4)
F-line (First word illegal) 0 −2 25(2/2/4)
F-line (Second word illegal) ea = Rn 1 −2 31(2/3/4)
F-line (Second word illegal) ea ≠ Rn (Save) 1 1 3(0/1/0)
F-line (Second word illegal) ea ≠ Rn (Op) 4 −2 29(2/2/4)
Privileged 0 −2 25(2/2/4)
TRAPcc (trap) 2 −2 38(2/2/6)
TRAPcc (no trap) 2 0 4(0/1/0)
TRAPcc.W (trap) 2 −2 38(2/2/6)
TRAPcc.W (no trap) 0 0 4(0/2/0)
TRAPcc.L (trap) 0 −2 38(2/2/6)
TRAPcc.L (no trap) 0 0 6(0/3/0)
TRAPV (trap) 2 −2 38(2/2/6)
TRAPV (no trap) 2 0 4(0/1/0)
∗ = Minimum interrupt acknowledge cycle time is assumed to be three clocks.
NOTE: The F-line (second word illegal) operation involves a save step which other
operations do not have. To calculate the total operation time, calculate the save, the
calculate EA, and the operation execution times, and combine in the order
listed, using the equations given in 5.7.1.6 Instruction Execution Time
Calculation.
5.7.3.14 SAVE AND RESTORE OPERATIONS. The save and restore operations table
indicates the number of clock periods needed for the processor to perform the specified
state save or return from exception. Complete execution times and stack length are given.
No additional tables are needed to calculate total effective execution time for these
instructions. The total number of clock cycles is outside the parentheses. The numbers
inside parentheses (r/p/w) are included in the total clock cycle number. All timing data
assumes two-clock reads and writes.
SECTION 6
DMA CONTROLLER MODULE
The direct memory access (DMA) controller module provides for high-speed transfer
capability to/from an external peripheral or for memory-to-memory data transfer. The DMA
module, shown in Figure 6-1, provides two channels that allow byte, word, or long-word
operand transfers. These transfers can be either single or dual address and to either on-
or off-chip devices. The DMA contains the following features:
Freescale Semiconductor, Inc...
DMA
INTERRUPT HANDSHAKE
DMA CHANNEL 1
ARBITRATION SIGNALS
SLAVE BIU
I
M
B
MASTER BIU
DMA
BUS DMA CHANNEL 2 HANDSHAKE
ARBITRATION SIGNALS
.
The MC68340 DMA module consists of two, independent, programmable channels. The
term DMA is used throughout this section to reference either channel 1 or channel 2 since
the two are functionally equivalent. Each channel has independent request, acknowledge,
and done signals. However, both channels cannot own the bus at the same time.
Therefore, it is impossible to implicitly address both DMA channels at the same time. The
MC68340 on-chip peripherals do not support the single-address transfer mode.
Freescale Semiconductor, Inc...
The DMA controller supports single- and dual-address transfers. In single-address mode,
a channel supports 32 bits of address and 32 bits of data. Only an external request can be
used to start a transfer in the single-address mode. The DMA provides address and
control signals during a single-address transfer. The requesting device either sends or
receives data to or from the specified address (see Figure 6-2). In dual-address mode, a
channel supports 32 bits of address and 16 bits of data. The dual-address transfers can
be started by either the internal request mode or by an external device using the request
signal. In this mode, two bus transfers occur, one from a source device and the other to a
destination device (see Figure 6-3). In dual-address mode, operands are packed or
unpacked according to port sizes and addresses.
Any operation involving the DMA will follow the same basic steps: channel initialization,
data transfer, and channel termination. In the channel initialization step, the DMA channel
registers are loaded with control information, address pointers, and a byte transfer count.
The channel is then started. During the data transfer step, the DMA accepts requests for
operand transfers and provides addressing and bus control for the transfers. The channel
termination step occurs after operation is complete. The channel indicates the status of
the operation in the channel status register.
DMA
DMA
MEMORY PERIPHERAL
PERIPHERAL
.
DMA
Freescale Semiconductor, Inc...
PERIPHERAL MEMORY
MEMORY
DMA
MEMORY
...
NOTE
The terms assertion and negation are used throughout this
section to avoid confusion when dealing with a mixture of
active-low and active-high signals. The term assert or assertion
indicates that a signal is active or true, independent of the level
represented by a high or low voltage. The term negate or
negation indicates that a signal is inactive or false.
6.3.1.1 INTERNAL REQUEST, MAXIMUM RATE. Internal generation using 100% of the
internal bus always has a transfer request pending for the channel until the transfer is
complete. As soon as the channel is started, the DMA will arbitrate for the internal bus and
begin to transfer data when it becomes bus master. If no exceptions occur, all operands in
the data block will be transferred in one burst so that the DMA will use 100% of the
available bus bandwidth.
6.3.1.2 INTERNAL REQUEST, LIMITED RATE. To guarantee that the DMA will not use
all of the available bus bandwidth during a transfer, internal requests can be generated
according to the amount of bus bandwidth allocated to the DMA. There are three
programmed constants in the CCR used to monitor the bus activity and allow the DMA to
use a percentage of the bus bandwidth. Options are 25%, 50%, and 75% of 1024 clock
periods. See Table 6-5 for more information.
Freescale Semiconductor, Inc...
The generation of the request from the source or destination is specified by the ECO bit of
the CCR. The external requests can be for either single- or dual-address transfers.
6.3.2.1 EXTERNAL BURST MODE. For external devices that require very high data
transfer rates, the burst request mode allows the DMA channel to use all of the bus
bandwidth under control of the external device. In burst mode, the DREQ≈ input to the
DMA is level sensitive and is sampled at certain points to determine when a valid request
is asserted by the device. The device requests service by asserting DREQ≈ and leaving it
asserted. In response, the DMA arbitrates for the bus and performs an operand transfer.
During each operand transfer, the DMA asserts DMA acknowledge (DACK≈) to indicate to
the device that a request is being serviced. DACK≈ is asserted on the cycle of either the
source or destination device, depending on which one generated the request as
programmed by the CCR ECO bit.
To allow more than one transfer to be recognized, DREQ≈ must meet the asynchronous
setup and hold times while DACK≈ is asserted in the DMA bus cycle. Upon completion of
a request, DREQ≈ should be held asserted (bursting) into the following DMA bus cycle to
allow another transfer to occur. The recognized request will immediately be serviced. If
DREQ≈ is negated before DACK≈ is asserted, a new request is not recognized, and the
DMA channel releases ownership of the bus.
6.3.2.2 EXTERNAL CYCLE STEAL MODE. For external devices that generate a pulsed
signal for each operand to be transferred, the cycle steal request mode uses the DREQ≈
signal as a falling-edge-sensitive input. The DREQ≈ pulse generated by the device must
be asserted during two consecutive falling edges of the clock to be recognized as valid.
The DMA channel responds to cycle steal requests the same as all other requests.
However, if subsequent DREQ≈ pulses are generated before DACK≈ is asserted in
response to each request, they are ignored. If DREQ≈ is asserted after the DMA channel
asserts DACK≈ for the previous request but before DACK≈ is negated, then the new
request is serviced before bus ownership is released. If a new request is not generated by
the time DACK≈ is negated, the bus is released.
6.3.2.3 EXTERNAL REQUEST WITH OTHER MODULES. The DMA controller can be
externally connected to the serial module and used in conjunction with the serial module
to send or receive data. The DMA takes the place of a separate service routine for
accessing or storing data that is sent or received by the serial module. Using the DMA
Freescale Semiconductor, Inc...
also lowers the CPU32 overhead required to handle the data transferred by the serial
module. Figure 6-4 shows the external connections required for using the DMA with the
serial module.
DREQ1 TxRDYA
DREQ2 RxRDYA
For serial receive, the DMA reads data from the serial receive buffer (RB) register (when
the serial module has filled the buffer on input) and writes data to memory. For serial
transmit, the DMA reads data from memory and writes data to the serial transmit buffer
(TB) register. Only dual-address mode can be used with the serial module. The MC68340
on-chip peripherals do not support single-address transfers.
The timer modules can be used with the DMA in a similar manner. By connecting TOUTx
to DREQ≈, the timer can request a DMA transfer.
place in one bus cycle, where only the memory is explicitly addressed. The DMA bus
cycle may be either a read or a write cycle. The DMA provides the address and control
signals required for the operation. The requesting device either sends or receives data to
or from the specified address. Only external requests can be used to start a transfer when
the single-address mode is selected. An external device uses DREQ≈ to request a
transfer.
information.
If external 32-bit devices and a 32-bit bus are used with the MC68340, the DMA can
control 32-bit transfers between devices that use the 32-bit bus in single-address mode
only. External logic is required to complete a 32-bit (long-word) transfer. If both byte and
word devices are used on an external bus, then an external multiplexer must be used to
correctly transfer data. The SIZx and A0 signals can be used to control this external
multiplexer.
6.4.1.1 SINGLE-ADDRESS READ. During the single-address source (read) cycle, the
DMA controls the transfer of data from memory to a device. The memory selected by the
address specified in the source address register (SAR), the source function codes in the
function code register (FCR), and the source size in the CCR provides the data and
control signals on the data bus. This bus cycle operates like a normal read bus cycle. The
DMA control signals (DACK≈ and DONE≈) are asserted in the source (read) cycle. See
Figures 6-5 and 6-6 for timing diagrams single-address read for external burst and cycle
steal modes.
S0 S2 S4 S0 S2 S4 S0 S2 S4 S0
CLKOUT
A31–A0
FC3–FC0
SIZ1–SIZ0
Freescale Semiconductor, Inc...
AS
DS
R/W
D15–D0
DSACKx
DREQx
DONEx
(INPUT)
.....
DACKx
DONEx
(OUTPUT)
NOTE:
1. Timing to generate more than one DMA request.
2. DACKx and DONEx (DMA control signals) are asserted in the source (read) DMA cycle.
3. DREQx must be asserted while DACKx is asserted and meet the setup and hold times for
more than one DMA transfer to be recognized.
CPU CYCLE CPU CYCLE DMA READ CPU CYCLE DMA READ
S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4
CLKOUT
MOTOROLA
A31–A0
FC3–FC0
SIZ1–SIZ0
AS
DS
R/W
D15–D0
DSACKx
DREQx
Go to: www.freescale.com
(INPUT)
DONEx
(OUTPUT)
NOTE:
1. DREQx must be active for two consecutive clocks for a DMA request to be recognized.
2. To cause another DMA transfer, DREQx is asserted after DACKx is asserted and before DACKx is negated.
3. DACKx and DONEx (DMA control signals) are asserted in the source (read) DMA cycle.
6-9
Freescale Semiconductor, Inc.
S0 S2 S4 S0 S2 S4 S0 S2 S4 S0
CLKOUT
Freescale Semiconductor, Inc...
A31–A0
FC3–FC0
SIZ1-SIZ0
AS
DS
R/W
D15–D0
DSACKx
DREQx
DONEx
(INPUT)
.
DACKx
DONEx
(OUTPUT)
NOTE:
1. Timing to generate more than one DMA request.
2. DACKx and DONEx (DMA control signals) are asserted in the source (read) DMA cycle.
2. DREQx must be asserted while DACKx is asserted, and meet the setup and hold times for
more than one DMA transfer to be recognized.
CPU CYCLE CPU CYCLE DMA WRITE CPU CYCLE DMA WRITE
S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4
CLKOUT
MOTOROLA
A31–A0
FC3–FC0
SIZ1-SIZ0
AS
DS
R/W
D15–D0
DSACKx
DREQx
Go to: www.freescale.com
DONEx
(INPUT)
DONEx
(OUTPUT)
NOTE:
1. DREQx must be active for two consecutive clocks for a DMA request to be recognized.
2. To cause another DMA transfer, DREQx is asserted after DACKx is asserted and before DACKx is negated.
3. DACKx and DONEx (DMA control signals) are asserted in the destination (write) DMA cycle.
6-11
Freescale Semiconductor, Inc.
Each DMA channel can each be programmed to operate in the dual-address transfer
mode. In this mode, the operand is read from the source address specified in the SAR and
placed in the DHR. The operand read may take up to four bus cycles to complete because
of differences in operand sizes of the source and destination. The operand is then written
to the address specified in the DAR. This transfer may also be up to four bus cycles long.
In this manner, various combinations of peripheral, memory, and operand sizes may be
Freescale Semiconductor, Inc...
The dual-address transfers can be started by either the internal request mode or by an
external device using the DREQ≈ input signal. When the external device uses DREQ≈, the
channel can be programmed to operate in either burst transfer mode or cycle steal mode.
6.4.2.1 DUAL-ADDRESS READ. During the dual-address read cycle, the DMA reads data
from a device or memory into the internal DHR. The device or memory is selected by the
address specified in the SAR, the source function codes in the FCR, and the source size
in the CCR. Data is read from the memory or peripheral and placed in the DHR when the
bus cycle is terminated. When the complete operand has been read, the SAR is
incremented by 0, 1, 2, or 4, according to the size and increment information specified by
the SSIZE and SAPI bits of the CCR. The DMA control signals (DACK≈ and DONE≈) are
asserted in the source (read) cycle when the source device makes a request. See Figures
6-9 and 6-10 for timing diagrams of dual-address read for external burst and cycle steal
modes.
CPU CYCLE DMA READ DMA WRITE DMA READ DMA WRITE CPU CYCLE
S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4
CLKOUT
MOTOROLA
A31–A0
FC3–FC0
SIZ1–SIZ0
AS
DS
R/W
D15–D0
DSACKx
DREQx
Go to: www.freescale.com
DONEx
(INPUT)
DONEx
(OUTPUT)
NOTE:
1. Timing to generate more than one DMA transfer.
2. DACKx and DONEx (DMA control signals) are asserted in the source (read) DMA cycle.
3. DREQx must be asserted while DACKx is asserted and meet the setup and hold times for more than one DMA transfer to be recognized.
4. DONEx (input) can be asserted in either the read or write DMA bus cycle to indicate that the next DMA transfer will be the last one.
6-13
Figure 6-9. Dual-Address Read Timing (External Burst–Source Requesting)
Freescale Semiconductor, Inc...
CPU CYCLE CPU CYCLE DMA READ DMA WRITE CPU CYCLE DMA READ DMA WRITE
6-14
S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4
CLKOUT
A31–A0
FC3–FC0
SIZ1–SIZ0
AS
DS
R/W
D15–D0
DSACKx
DREQx
Go to: www.freescale.com
DACKx
DONEx
(OUTPUT)
NOTE
1. DREQx must be active for two consecutive clocks for a DMA request to be recognized.
2. To cause another DMA transfer, the DREQx is asserted after DACKx is asserted and before DACKx is negated.
3. DACKx and DONEx (DMA control signals) are asserted in the source (read) DMA cycle.
4. DONEx (input) can be asserted in either the read or write DMA bus cycle to indicate that the next DMA transfer will be the last one.
6.4.2.2 DUAL-ADDRESS WRITE. During the dual-address write cycle, the DMA writes
data to a device or memory from the internal DHR. The data in the DHR is written to the
device or memory selected by the address in the DAR, the destination function codes in
MOTOROLA
Freescale Semiconductor, Inc.
the FCR, and the size in the CCR. When the complete operand is written, the DAR is
incremented by 0, 1, 2, or 4, according to the increment and size information specified by
the DAPI and DSIZE bits of the CCR, and the byte transfer count register (BTC) is
decremented by the number of bytes transferred. If the BTC is equal to zero and there
were no errors, the CSR DONE bit is set, and the DONE≈ signal for the DMA handshake
is asserted. The DMA control signals (DACK≈ and DONE≈) are asserted in the destination
(write) cycle when the destination device makes a request. See Figures 6-11 and 6-12 for
timing diagrams of dual-address write for external burst and cycle steal modes.
Freescale Semiconductor, Inc...
CPU CYCLE DMA READ DMA WRITE DMA READ DMA WRITE CPU CYCLE
6-16
S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4
CLKOUT
A31–A0
FC3–FC0
SIZ1–SIZ0
AS
DS
R/W
D15–D0
DSACKx
DONEx
Go to: www.freescale.com
(INPUT)
DONEx
(OUTPUT)
NOTE:
1. Timing to generate more than one DMA transfer.
2. DACKx and DONEx (DMA control signals) are asserted in the destination (write) DMA cycle.
3. DREQx must be asserted while DACKx is asserted and meet the setup and hold times for more than one DMA transfer to be recognized.
4. DONEx (input) can be asserted in either the read or write DMA bus cycle to indicate that the next DMA transfer will be the last one.
MOTOROLA
Figure 6-11. Dual-Address Write Timing (External Burst–Destination Requesting)
Freescale Semiconductor, Inc...
CPU CYCLE CPU CYCLE DMA READ DMA WRITE CPU CYCLE DMA READ DMA WRITE
S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4 S0 S2 S4
CLKOUT
MOTOROLA
A31–A0
FC3–FC0
SIZ1–SIZ0
AS
DS
R/W
D15–D0
DSACKx
DREQx
Go to: www.freescale.com
DONEx
(INPUT)
DONEx
(OUTPUT)
NOTE:
1. DREQx must be active for two consecutive clocks for a DMA request to be recognized.
2. To cause another DMA transfer, DREQx is asserted after DACKx is asserted and before DACKx is negated.
3. DACKx and DONEx (DMA control signals) are asserted in the destination (write) DMA cycle.
4. DONEx (Input) can be asserted in either the read or write DMA bus cycle to indicate that the next DMA transfer will be the last one.
6-17
Figure 6-12. Dual-Address Write Timing (Cycle Steal–Destination Requesting)
Freescale Semiconductor, Inc.
For internal request generation as soon as the CCR STR bit is set, the DMA channel
arbitrates for the bus and begins to transfer data when it becomes bus master. For
external request generation, the STR bit must be set and a DREQ≈ signal must be
asserted before the channel arbitrates for the bus and begins a transfer.
Freescale Semiconductor, Inc...
The SAR is loaded with the source (read) address. If the transfer is from a peripheral
device to memory, the source address is the location of the peripheral data register. If the
transfer is from memory to a peripheral device or memory to memory, the source address
is the starting address of the data block. This address may be any byte address. In the
single-address mode with the destination (write) device requesting mode of operation, this
register is not used.
The DAR should contain the destination (write) address. If the transfer is from a peripheral
device to memory or memory to memory, the DAR is loaded with the starting address of
the data block to be written. If the transfer is from memory to a peripheral device, the DAR
is loaded with the address of the peripheral data register. This address may be any byte
address. In the single-address mode with the source (read) device requesting mode of
operation, this register is not used.
The manner in which the SAR and DAR change after each cycle depends upon the values
in the CCR SSIZE and DSIZE fields and SAPI and DAPI bits, and the starting address in
the SAR and DAR. If programmed to increment, the increment value is 1, 2, or 4 for byte,
word, or long-word operands, respectively. If the address register is programmed to
remain unchanged (no count), the register is not incremented after the operand transfer.
The SAR and DAR are incremented if a bus error terminates the transfer. Therefore,
either the SAR or the DAR contain the next address after the one that caused the bus
error.
The BTC must be loaded with the number of byte transfers that are to occur. This register
is decremented by 1, 2, or 4 at the end of each transfer. The FCR must be loaded with the
Freescale Semiconductor, Inc...
source and destination function codes. Although these function codes may not be used in
the address decode for the memory or peripheral, they are provided if needed. The CSR
must be cleared for channel startup.
Once the channel has been initialized, it is started by writing a one to the STR bit in the
CCR. Programming the channel for internal request causes the channel to request the bus
and start transferring data immediately. If the channel is programmed for external request,
DREQ≈ must be asserted before the channel requests the bus. The DREQ≈ input is
ignored until the channel is started, since the channel does not recognize transfer
requests until it is active.
If any fields in the CCR are modified while the channel is active, that change is effective
immediately. To avoid any problems with changing the setup for the DMA channel, a zero
should be written to the STR bit in the CCR to halt the DMA channel at the end of the
current bus cycle.
6.6.2.2 EXTERNAL REQUEST TRANSFERS. In single-address mode, only one bus cycle
is run for each request. Since the operand size must be equal to the device port size in
single-address mode, the number of normally terminated bus cycles executed during a
transfer operation is always equal to the value programmed into the corresponding size
field of the CCR. The sequencing of the address bus follows the programming of the CCR
and address register (SAR or DAR) for the channel.
Each operand transfer in dual-address mode requires from two to five bus cycles in
response to each operand transfer request. If the source and destination operands are the
same size, two cycles will transfer the complete operand. If the source and destination
operands are different sizes, the number of cycles will vary. If the source is a long-word
and the destination is a byte, there would be one bus cycle for the read and four bus
cycles for the write. Once the DMA channel has started a dual-address operand transfer, it
must complete that transfer before releasing ownership of the bus or servicing a request
for another channel of equal or higher priority, unless one of the bus cycles is terminated
with a bus error during the transfer.
6.6.3.1 CHANNEL TERMINATION. The channel operation can be terminated for several
reasons: the BTC is decremented to zero, a peripheral device asserts DONE≈ during an
operand transfer, the STR bit is cleared in the CCR, a bus cycle is terminated with a bus
error, or a reset occurs.
6.6.3.3 FAST TERMINATION OPTION. Using the system integration module (SIM40) chip
select logic, the fast termination option (Figure 6-13) can be employed to give a fast bus
access of two clock cycles rather than the standard three-cycle access time for external
requests. The fast termination option is described in Section 3 Bus Operation and
Section 4 System Integration Module.
S0 S2 S4 S0 S4 S0 S2 S4 S0 S2
CLKOUT
A31–A0
FC3–FC0
SIZ1–SIZ0
AS
DS
Freescale Semiconductor, Inc...
R/W
D15–D0
DSACKx
DREQx
DACKx
DONEx
(OUTPUT)
NOTE:
1. To cause another DMA transfer, DREQx is asserted after DACKx is asserted and before
DACKx is negated.
2. DACKx and DONEx (DMA control signals) are asserted in the source (read) DMA cycle.
If the fast termination option is used with external burst request mode (Figure 6-14), an
extra DMA cycle may result on every burst transfer. Normally, DREQ≈ is negated when
DACK≈ is returned. In the burst mode with fast termination selected, a new cycle starts
even if DREQ≈ is negated simultaneously with DACK≈ assertion.
CPU CYCLE DMA READ DMA WRITE CPU CYCLE DMA READ DMA WRITE
S0 S2 S4 S0 S4 S0 S4 S0 S2
... . S4 S0 S4 S0 S4 S0
CLKOUT
A31–A0
FC3–FC0
SIZ1–SIZ0
AS
DS
Freescale Semiconductor, Inc...
R/W
D15–D0
DSACKx
DREQx
DACKx
DONEx
(OUTPUT)
NOTE
1. To cause another DMA transfer, the DREQx is asserted after DACKx is asserted and before DACKx is negated.
2. DACKx and DONEx (DMA control signals) are asserted in the source (read) DMA cycle.
Unimplemented memory locations return logic zero when accessed. All registers support
both byte and word transfers.
ADDRESS FC
CH1 CH2 15 8 7 0
780 7A0 S MODULE CONFIGURATION REGISTER (MCR)
782 7A2 S RESERVED
784 7A4 S INTERRUPT REGISTER
786 7A6 S/U RESERVED
788 7A8 S/U CHANNEL CONTROL REGISTER
78A 7AA S/U CHANNEL STATUS REGISTER FUNCTION CODE REGISTER
78C 7AC S/U SOURCE ADDRESS REGISTER MSBs
78E 7AE S/U SOURCE ADDRESS REGISTER LSBs
790 7B0 S/U DESTINATION ADDRESS REGISTER MSBs
792 7B2 S/U DESTINATION ADDRESS REGISTER LSBs
794 7B4 S/U BYTE TRANSFER COUNTER MSBs
Freescale Semiconductor, Inc...
In the registers discussed in the following paragraphs, the numbers in the upper right-
hand corner indicate the offset of the register from the base address specified by the
module base address register (MBAR) in the SIM40. The first number is the offset for
channel 1; the second number is the offset for channel 2. The numbers above the register
represent the bit position in the register. The register contains the mnemonic for the bit.
The value of these bits after a hardware reset is shown below the register. The access
privilege is shown in the lower right-hand corner.
NOTE
A CPU32 RESET instruction will not affect the MCR but will
reset all other registers in the DMA module as though a
hardware reset occurred. The term DMA is used to reference
either channel 1 or channel 2, since the two are functionally
equivalent.
RESET:
0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
Supervisor Only
STP—Stop Bit
1 = Setting the STP bit stops all clocks within the DMA module except for the clock
from the IMB. The clock from the IMB remains active to allow the CPU32 access
to the MCR. The clock stops on the low phase of the clock and remains stopped
until the STP bit is cleared by the CPU32 or a hardware reset. Accesses to DMA
module registers while in stop mode produce a bus error. The DMA module
Freescale Semiconductor, Inc...
should be disabled in a known state before setting the STP bit. The STP bit
should be set prior to executing the LPSTOP instruction to reduce overall power
consumption.
0 = The channel operates in normal mode.
NOTE
The DMA module uses only one STP bit for both channels. A
read or write to either MCR accesses the same STP control bit.
FRZ1, FRZ0—Freeze
These bits determine the action taken when the FREEZE signal is asserted on the IMB
when the CPU32 has entered background debug mode. The DMA module negates BR
and keeps it negated until FREEZE is negated or reset. Table 6-1 lists the action taken
for each bit combination.
NOTE
The DMA module uses only one set of FRZx bits for both
channels. A read or write to either MCR accesses the same
FRZx control bits.
SE—Single-Address Enable
This bit is implemented for future MC683xx family compatibility.
1 = In single-address mode, the external data bus is driven during a DMA transfer.
0 = In single-address mode, the external data bus remains in a high-impedance state
during a DMA transfer (used for intermodule DMA).
In dual-address mode, the SE bit has no effect.
Bit 11—Reserved
vacates the bus and negates BR until the interrupt service level is less than or equal to
the interrupt service mask level.
NOTE
When the CPU32 status register (SR) interrupt priority mask
bits I2–I0 are at a higher level than the DMA ISM bits, the DMA
channel will not start. The channel will begin operation when
the level of the SR I2–I0 bits is less than or equal to the level of
the DMA ISM bits.
SUPV—Supervisor/User
The value of this bit has no effect on registers permanently defined as supervisor-only
access.
1 = The DMA channel registers defined as supervisor/user reside in supervisor data
space and are only accessible from supervisor programs.
0 = The DMA channel registers defined as supervisor/user reside in user data space
and are accessible from either supervisor or user programs.
MAID—Master Arbitration ID
These bits establish bus arbitration priority level among modules that have the capability
of becoming bus master. For the MC68340, the MAID bits are used to arbitrate between
DMA channel 1 and channel 2. If both channels are programmed with the same MAID
level, channel 1 will have priority. These bits are implemented for future MC683xx
Family compatibility. In the MC68340, only the SIM and the DMA can be bus masters.
However, future versions of the MC683xx Family may incorporate other modules that
may also be bus masters. For these devices, the MAID bits will be required. For the
MAID bits, zero is the lowest priority and seven is the highest priority.
The reset value of the IARB field is $0, which prevents the DMA module from arbitrating
during the interrupt acknowledge cycle. The system software should initialize the IARB
field to a value from $F (highest priority) to $1 (lowest priority).
NOTE
The DMA module uses only one set of IARB bits for both
channels. A read or write to either MCR accesses the same
IARB control bits.
supervisor mode and while the DMA module is enabled (i.e., the STP bit in the MCR is
cleared).
0 0 0 0 0 INTL INTV
RESET:
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
Supervisor Only
Bits 15–11—Reserved
INTB INTN INTE ECO SAPI DAPI SSIZE DSIZE REQ BB S/D STR
RESET:
U U U U U U U U U U U U U U U 0
INTB—Interrupt Breakpoint
Setting the interrupt breakpoint bit sets the BRKP bit in the CSR. The logic AND of INTB
and BRKP generates an interrupt request.
1 = Enables an IRQ≈ when a breakpoint is recognized and the channel is the bus
master.
Freescale Semiconductor, Inc...
0 = Does not enable an IRQ≈ when a breakpoint is recognized and the channel is
the bus master.
INTN—Interrupt Normal
1 = Enables an IRQ≈ when the channel finishes a transfer without an error condition
(CSR DONE bit is set).
0 = Does not enable an IRQ≈ when the channel finishes a transfer without an error
condition.
INTE—Interrupt Error
1 = Enables an IRQ≈ when the channel encounters an error on source read (CSR
BES bit is set), destination write (CSR BED bit is set), or configuration for
channel setup (CSR CONF bit is set).
0 = Does not enable an IRQ≈ when the channel encounters an error on source read,
destination write, or configuration for channel setup.
0 = The SAR is not incremented during operand transfer. The address that is written
into the SAR points to a peripheral device and is used for the complete data
transfer.
S/D—Single-/Dual-Address Transfer
1 = The DMA channel runs single-address transfers from a peripheral to memory or
from memory to a peripheral. The destination holding register is not used for
these transfers because the data is transferred directly into the destination
location. The MC68340 on-chip peripherals do not support single-address
transfers.
0 = The DMA channel runs dual-address transfers.
STR—Start
This bit is cleared by a hardware/software reset, writing a logic zero, or setting one of
the following CSR bits: DONE, BES, BED, CONF, or BRKP. The STR bit cannot be set
when the CSR IRQ bit is set. The DMA channel cannot be started until the CSR DONE,
BES, BED, CONF, and BRKP bits are cleared.
Freescale Semiconductor, Inc...
NOTE
If any fields in the CCR are modified while the channel is
active, that change is effective immediately. To avoid any
problems with changing the setup for the DMA channel, a zero
should be written to the STR bit in the CCR to halt the DMA
channel at the end of the current bus cycle.
RESET
0 0 0 0 0 0 0 0
Supervisor/User
IRQ—Interrupt Request
This bit is the logical OR of the DONE, BES, BED, CONF, and BRKP bits and is cleared
when they are all cleared. IRQ is positioned to allow conditional testing as a signed
binary integer. The state of this bit is not affected by the interrupt enable bits in the
CCR. The STR bit in the CCR cannot be set when this bit is set; all error status bits,
except the BRKP bit, must be cleared before the STR bit can be set.
1 = An interrupt condition has occurred.
0 = An interrupt condition has not occurred.
DONE—DMA Done
1 = The DMA channel has terminated normally.
0 = The DMA channel has not terminated normally. This bit is cleared by writing a
Freescale Semiconductor, Inc...
CONF—Configuration Error
A configuration error results when either the SAR or the DAR contains an address that
does not match the port size specified in the CCR and the BTC register does not match
the larger port size or is zero.
1 = The CCR STR bit is set, and a configuration error is present.
0 = The CCR STR bit is set, and no configuration error exists. This bit is cleared by
writing a logic one or by a hardware reset. Writing a zero has no effect.
BRKP—Breakpoint
1 = The breakpoint signal was set during a DMA transfer.
0 = The breakpoint signal was not set during a DMA transfer. This bit is cleared by
writing a logic one or by a hardware reset. Writing a zero has no effect.
Bits 1, 0—Reserved
NOTE
The CSR is cleared by writing $7C to its location. The DMA
channel cannot be started until the CSR DONE, BES, BED,
CONF and BRKP bits are cleared.
SFC DFC
RESET:
U U U U U U U U
This field can be used to specify the source access to a certain address space type.
The source function code bits are defined in Table 6-6.
NOTE
Although FC3 can be set for DMA transfers to distinguish the
source or destination space from other data or program
spaces, it is not required to be set. Since the CPU32 currently
has only 3-bit SFC and DFC capability, it cannot emulate
FC3 = 1 at this time. However, it is recommended that FC3 be
set to one to distinguish DMA or CPU access during debug.
A31 A30 A29 A28 A27 A26 A25 A24 A23 A22 A21 A20 A19 A18 A17 A16
RESET:
U U U U U U U U U U U U U U U U
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Freescale Semiconductor, Inc...
RESET:
U U U U U U U U U U U U U U U U
During the DMA read cycle, the SAR drives the address on the address bus. This register
can be programmed to increment (CCR SAPI bit set) or remain constant (CCR SAPI bit
cleared) after each operand transfer.
The register is incremented using unsigned arithmetic and will roll over if overflow occurs.
For example, if the register contains $FFFFFFFF and is incremented by 1, it will roll over
to $00000000. This register is incremented by 1, 2, or 4, depending on the size of the
operand and the memory starting address. If the operand size is byte, then the register is
always incremented by 1. If the operand size is word and the starting address is even-
word aligned, then the register is incremented by 2. If the operand size is long word and
the address is even-word aligned, then the register is incremented by 4. The SAR value
must be aligned to an even-word boundary if the transfer size is word or long word;
otherwise, the CSR CONF bit is set, and the transfer does not occur.
When read, this register always contains the next source address. If a bus error
terminates the transfer, this register contains the next source address that would have
been run had the error not occurred.
A31 A30 A29 A28 A27 A26 A25 A24 A23 A22 A21 A20 A19 A18 A17 A16
RESET:
U U U U U U U U U U U U U U U U
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RESET:
U U U U U U U U U U U U U U U U
During the DMA write cycle, this register drives the address on the address bus. This
register can be programmed to increment (CCR DAPI bit set) or remain constant (CCR
Freescale Semiconductor, Inc...
The register is incremented using unsigned arithmetic and will roll over if overflow occurs.
For example, if a register contains $FFFFFFFF and is incremented by 1, it will roll over to
$00000000. This register can be incremented by 1, 2, or 4, depending on the size of the
operand and the starting address. If the operand size is byte, the register is always
incremented by 1. If the operand size is word and the starting address is even-word
aligned, the register is incremented by 2. If the operand size is long word and the address
is even-word aligned, the register is incremented by 4. The DAR value must be aligned to
an even-word boundary if the transfer size is word or long word; otherwise, the CSR
CONF bit is set, and the transfer does not occur.
When read, this register always contains the next destination address. If a bus error
terminates the transfer, this register contains the next destination address that would have
been run had the error not occurred.
A31 A30 A29 A28 A27 A26 A25 A24 A23 A22 A21 A20 A19 A18 A17 A16
RESET:
U U U U U U U U U U U U U U U U
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RESET:
U U U U U U U U U U U U U U U U
If the operand size is byte, then the register is always decremented by 1. If the operand
size is word and the starting count is even word, the register is decremented by 2. If the
operand size is word and the byte count is not a multiple of 2, the CSR CONF bit is set,
and a transfer does not occur. If the operand size is long word and the count is even long
word, then the register is decremented by 4. If the operand size is long word and the byte
count is not a multiple of 4, the CSR CONF bit is set, and a transfer does not occur. If the
STR bit is set with a zero count in the BTC, the CONF bit is set, and the STR bit is
cleared.
Freescale Semiconductor, Inc...
When read, this register always contains the count for the next access. If a bus error
terminates the transfer, this register contains the count for the next access that would
have been run had the error not occurred.
SOURCE/DESTINATION DESTINATION/SOURCE
.. ..... ..... ..... ... .
BYTE0
BYTE0 BYTE1
BYTE1
BYTE0
BYTE1
BYTE0 BYTE1 BYTE2 BYTE3
BYTE2
BYTE3
BYTE0 BYTE1
BYTE0 BYTE1 BYTE2 BYTE3
BYTE2 BYTE3
For normal transfers aligned with the size and address, only two bus cycles are required
for each transfer: a read from the source and a write to the destination.
• Select the direction of transfer if in single-address mode (ECO bit), or select which
device generates requests if in dual-address mode.
• Select external burst request mode or external cycle steal request mode (REQ field).
• Set the S/D bit for signal-address transfer.
• If using internal request, select the amount of bus bandwidth to be used by the DMA
(BB field).
• Clear the S/D bit for dual-address transfer.
***************************************************************************
* MC68340 basic DMA channel register initialization example code.
* This code is used to initialize the 68340's internal DMA channel
* registers, providing basic functions for operation.
* The code sets up channel 1 for external burst request generation,
* single-address mode, long word size transfers.
* Control signals are asserted on the DMA read cycle.
***************************************************************************
Example 1: External Burst Request Generation, Single-Address Transfers.
***************************************************************************
* SIM40 equates
***************************************************************************
MBAR EQU $0003FF00 Address of SIM40 Module Base Address Reg.
MODBASE EQU $FFFFF000 SIM40 MBAR address value
***************************************************************************
* DMA Channel 1 equates
DMACH1 EQU $780 Offset from MBAR for channel 1 regs
DMAMCR1 EQU $0 MCR for channel 1
***************************************************************************
***************************************************************************
* Initialize DMA Channel 1
***************************************************************************
Freescale Semiconductor, Inc...
***************************************************************************
END
***************************************************************************
***************************************************************************
* DMA Channel 1 equates
DMACH1 EQU $780 Offset from MBAR for channel 1 regs
DMAMCR1 EQU $0 MCR for channel 1
***************************************************************************
***************************************************************************
* Initialize DMA Channel 1
***************************************************************************
LEA MODBASE+DMACH1,A0 Pointer to channel 1
* Clear the DONE, BES, BED, CONF and BRKP bits to allow channel to startup.
MOVE.B #$7C,DMACSR1(A0)
***************************************************************************
END
***************************************************************************
***************************************************************************
* DMA Channel 1 equates
DMACH1 EQU $780 Offset from MBAR for channel 1 regs
Freescale Semiconductor, Inc...
***************************************************************************
***************************************************************************
* Initialize DMA Channel 1
***************************************************************************
LEA MODBASE+DMACH1,A0 Pointer to channel 1
MOVE.W #$0742,DMAINT1(A0)
***************************************************************************
END
***************************************************************************
***************************************************************************
* DMA Channel 1 equates
DMACH1 EQU $780 Offset from MBAR for channel 1 regs
DMAMCR1 EQU $0 MCR for channel 1
***************************************************************************
***************************************************************************
* Initialize DMA Channel 1
***************************************************************************
LEA MODBASE+DMACH1,A0 Pointer to channel 1
* Source size is byte, destination size is word. REQ is external cycle steal.
* dual-address transfers, start the DMA transfers.
MOVE.W #$1DB1,DMACCR1(A0)
***************************************************************************
END
***************************************************************************
SECTION 7
SERIAL MODULE
The MC68340 serial module is a dual universal asynchronous/synchronous
receiver/transmitter that interfaces directly to the CPU32 processor via the intermodule
bus (IMB). The serial module, shown in Figure 7-1, consists of the following major
functional areas:
Freescale Semiconductor, Inc...
CTSA
RTSA
RxDA
TxDA
SERIAL COMMUNICATIONS RxRDYA
..... ..... .
X1
BAUD RATE X2
GENERATOR LOGIC
SCLK
INTERNAL CHANNEL
CONTROL LOGIC
INTERRUPT CONTROL
LOGIC
The transmitter accepts parallel data from the IMB, converts it to a serial bit stream,
inserts the appropriate start, stop, and optional parity bits, then outputs a composite serial
data stream on the channel transmitter serial data output (TxDx). Refer to 7.3.2.1
Transmitter for additional information.
The receiver accepts serial data on the channel receiver serial data input (RxDx), converts
it to parallel format, checks for a start bit, stop bit, parity (if any), or break condition, and
transfers the assembled character onto the IMB during read operations. Refer to 7.3.2.2
Freescale Semiconductor, Inc...
The baud rate generator operates from the oscillator or external TTL clock input and is
capable of generating 19 commonly used data communication baud rates ranging from 50
to 76.8k by producing internal clock outputs at 16 times the actual baud rate. Refer to 7.2
Serial Module Signal Definitions and 7.3.1 Baud Rate Generator for additional
information.
The external clock input (SCLK), which bypasses the baud rate generator, provides a
synchronous clock mode of operation when used as a divide-by-1 clock and an
asynchronous clock mode when used as a divide-by-16 clock. The external clock input
allows the user to use SCLK as the only clock source for the serial module if multiple baud
rates are not required.
currently active interrupt conditions. The interrupt enable register (IER) is programmable
to mask any events that can cause an interrupt.
The programming model is slightly altered. The supervisor/user block in the MC68340
closely follows the MC68681. The supervisor-only block has the following changes:
• The interrupt vector register is moved from supervisor/user to supervisor only at a
new address.
• MR2A and MR2B are moved from a hidden address location to a location at the
Freescale Semiconductor, Inc...
The timer/counter is eliminated as well as all associated command and status registers.
The XTAL_RDY bit in the ISR should be polled until it is cleared to prevent an unstable
frequency from being applied to the baud rate generator. The following code is an
example:
if (XTAL_RDY==0)
begin
write CSR
end
else
begin
wait
jump loop
end
NOTE
The terms assertion and negation are used throughout this
section to avoid confusion when dealing with a mixture of
active-low and active-high signals. The term assert or assertion
indicates that a signal is active or true, independent of the level
represented by a high or low voltage. The term negate or
negation indicates that a signal is inactive or false.
ADDRESS BUS
X1
INTERNAL BAUD RATE X2
CONTROL GENERATOR
CONTROL LOGIC LOGIC
INTERFACE
SCLK
SIGNALS
S
IMB
E
R
I
A
DATA CHANNEL A
DATA BUS L
DATA BUS
D15–D0 D7–D0
MUX
M FOUR-CHARACTER RxDA
O RECEIVE BUFFER
D
U
INTERFACE SIGNALS
TWO-CHARACTER TxDA
L
Freescale Semiconductor, Inc...
TRANSMIT BUFFER
EXTERNAL
E
RTSA
I CTSA
N
TxRDYA
T
E RxRDYA
..... ..... . ..
R
N
A CHANNEL B
L
FOUR-CHARACTER RxDB
B
RECEIVE BUFFER
U
S
TWO-CHARACTER TxDB
TRANSMIT BUFFER
RTSB
CTSB
7.2.8.1 RTSA . When used for this function, this signal can be programmed to be
automatically negated and asserted by either the receiver or transmitter. When connected
to the clear-to-send ( CTS≈) input of a transmitter, this signal can be used to control serial
data flow.
7.2.8.2 OP0. When used for this function, this output is controlled by bit 0 in the output
port data register (OP).
7.2.9.1 RTSB . When used for this function, this signal can be programmed to be
automatically negated and asserted by either the receiver or transmitter. When connected
to the CTS≈ input of a transmitter, this signal can be used to control serial data flow.
7.2.9.2 OP1. When used for this function, this output is controlled by bit 1 in the OP.
7.2.12.1 T≈RDYA. When used for this function, this signal reflects the complement of the
status of bit 2 of the channel A status register (SRA). This signal can be used to control
parallel data flow by acting as an interrupt to indicate when the transmitter contains a
character.
7.2.12.2 OP6. When used for this function, this output is controlled by bit 6 in the OP.
7.2.13.1 R≈RDYA. When used for this function, this signal reflects the complement of the
status of bit 1 of the ISR. This signal can be used to control parallel data flow by acting as
an interrupt to indicate when the receiver contains a character.
7.2.13.2 FFULLA. When used for this function, this signal reflects the complement of the
status of bit 1 of the ISR. This signal can be used to control parallel data flow by acting as
an interrupt to indicate when the receiver FIFO is full.
7.2.13.3 OP4. When used for this function, this output is controlled by bit 4 in the OP.
7.3 OPERATION
The following paragraphs describe the operation of the baud rate generator, transmitter
and receiver, and other functional operating modes of the serial module.
BAUD RATE
GENERATOR LOGIC
CRYSTAL
OSCILLATOR EXTERNAL
INTERFACE
..... ..... . ... .
X1
BAUD RATE
X2
GENERATOR
SCLK
CLOCK
SELECTORS
CHANNEL A EXTERNAL
INTERFACE
TRANSMIT
TRANSMIT HOLDING REGISTER W
BUFFER (TBA) TxDA
(2 REGISTERS) TRANSMIT SHIFT REGISTER
Freescale Semiconductor, Inc...
FIFO
RECEIVER HOLDING REGISTER 1 R
CHANNEL B
TRANSMIT
TRANSMIT HOLDING REGISTER W
BUFFER (TBB) TxDB
(2 REGISTERS) TRANSMIT SHIFT REGISTER
NOTE:
R/W = READ/WRITE
R = READ
W = WRITE
..... ..... . ... . . .
7.3.2.1 TRANSMITTER. The transmitters are enabled through their respective command
registers (CR) located within the serial module. The serial module signals the CPU32
when it is ready to accept a character by setting the transmitter-ready bit (TxRDY) in the
channel's status register (SR). Functional timing information for the transmitter is shown in
Figure 7-5.
The transmitter converts parallel data from the CPU32 to a serial bit stream on TxDx. It
automatically sends a start bit followed by the programmed number of data bits, an
optional parity bit, and the programmed number of stop bits. The least significant bit is
sent first. Data is shifted from the transmitter output on the falling edge of the clock
source.
C1 IN
TRANSMISSION
Freescale Semiconductor, Inc...
TxDx C1 C2 C3 BREAK C4 C6
TRANSMITTER
ENABLED
TxRDY
(SR2)
CS W W W W W W W W
C1 C2 C3 START C4 STOP C5 C6
BREAK BREAK NOT
TRANSMITTED
CTS1
NOTES:
1. TIMING SHOWN FOR MR2(4) = 1
2. TIMING SHOWN FOR MR2(5) = 1
3. C N = TRANSMIT CHARACTER
4. W = WRITE
Following transmission of the stop bits, if a new character is not available in the transmitter
holding register, the TxDx output remains high ('mark' condition), and the transmitter
empty bit (TxEMP) in the SR is set. Transmission resumes and the TxEMP bit is cleared
when the CPU32 loads a new character into the transmitter buffer (TB). If a disable
command is sent to the transmitter, it continues operating until the character in the
transmit shift register, if any, is completely sent out. If the transmitter is reset through a
software command, operation ceases immediately (refer to 7.4.1.7 Command Register
(CR)). The transmitter is re-enabled through the CR to resume operation after a disable or
software reset.
7.3.2.2 RECEIVER. The receivers are enabled through their respective CRs located within
the serial module. Functional timing information for the receiver is shown in Figure 7-6.
The receiver looks for a high-to-low (mark-to-space) transition of the start bit on RxDx.
When a transition is detected, the state of RxDx is sampled each 16× clock for eight
clocks, starting one-half clock after the transition (asynchronous operation) or at the next
rising edge of the bit time clock (synchronous operation). If RxDx is sampled high, the
start bit is invalid, and the search for the valid start bit begins again. If RxDx is still low, a
valid start bit is assumed, and the receiver continues to sample the input at one-bit time
intervals, at the theoretical center of the bit, until the proper number of data bits and parity,
if any, is assembled and one stop bit is detected. Data on the RxDx input is sampled on
the rising edge of the programmed clock source. The least significant bit is received first.
The data is then transferred to a receiver holding register, and the RxRDY bit in the
appropriate SR is set. If the character length is less than eight bits, the most significant
unused bits in the receiver holding register are cleared.
After the stop bit is detected, the receiver immediately looks for the next start bit.
However, if a nonzero character is received without a stop bit (framing error) and RxDx
remains low for one-half of the bit period after the stop bit is sampled, the receiver
operates as if a new start bit is detected. The parity error (PE), framing error (FE), overrun
error (OE), and received break (RB) conditions (if any) set error and break flags in the
appropriate SR at the received character boundary and are valid only when the RxRDY bit
in the SR is set.
If a break condition is detected (RxDx is low for the entire character including the stop bit),
a character of all zeros is loaded into the receiver holding register, and the RB and
RxRDY bits in the SR are set. The RxDx signal must return to a high condition for at least
one-half bit time before a search for the next start bit begins.
RxD C1 C2 C3 C4 C5 C6 C7 C8
RECEIVER
ENABLED
RxRDY
(SR0)
FFULL
(SR1)
Freescale Semiconductor, Inc...
RxRDYA
CS
R R R R R R R R
STATUS DATA STATUS DATA STATUS DATA STATUS DATA
C1 C2 C3 C4
C5
OVERRUN LOST
(SR4)
1
RTS RESET BY COMMAND
OPR(0) = 1
NOTES:
1. Timing shown for MR1(7) = 1
2. Timing shown for OPCR(4) = 1 and MR1(6) = 0
3. R = Read
4. CN = Received Character
The receiver detects the beginning of a break in the middle of a character if the break
persists through the next character time. When the break begins in the middle of a
character, the receiver places the damaged character in the receiver first-in-first-out
(FIFO) stack and sets the corresponding error conditions and RxRDY bit in the SR. Then,
if the break persists until the next character time, the receiver places an all-zero character
into the receiver FIFO and sets the corresponding RB and RxRDY bits in the SR.
7.3.2.3 FIFO STACK. The FIFO stack is used in each channel's receiver buffer logic. The
stack consists of three receiver holding registers. The receive buffer consists of the FIFO
and a receiver shift register connected to the RxDx (refer to Figure 7-4). Data is
assembled in the receiver shift register and loaded into the top empty receiver holding
register position of the FIFO. Thus, data flowing from the receiver to the CPU32 is
quadruple buffered.
In addition to the data byte, three status bits, PE, FE, and RB, are appended to each data
character in the FIFO; OE is not appended. By programming the ERR bit in the channel's
mode register (MR1), status is provided in character or block modes.
The RxRDY bit in the SR is set whenever one or more characters are available to be read
by the CPU32. A read of the receiver buffer produces an output of data from the top of the
FIFO stack. After the read cycle, the data at the top of the FIFO stack and its associated
status bits are 'popped', and new data can be added at the bottom of the stack by the
receiver shift register. The FIFO-full status bit (FFULL) is set if all three stack positions are
filled with data. Either the RxRDY or FFULL bit can be selected to cause an interrupt.
Freescale Semiconductor, Inc...
In either mode, reading the SR does not affect the FIFO. The FIFO is 'popped' only when
the receive buffer is read. The SR should be read prior to reading the receive buffer. If all
three of the FIFO's receiver holding registers are full when a new character is received,
the new character is held in the receiver shift register until a FIFO position is available. If
an additional character is received during this state, the contents of the FIFO are not
affected. However, the character previously in the receiver shift register is lost, and the OE
bit in the SR is set when the receiver detects the start bit of the new overrunning
character.
If the FIFO stack contains characters and the receiver is disabled, the characters in the
FIFO can still be read by the CPU32. If the receiver is reset, the FIFO stack and all
receiver status bits, corresponding output ports, and interrupt request are reset. No
additional characters are received until the receiver is re-enabled.
The channel's transmitter and receiver should both be disabled when switching between
modes. The selected mode is activated immediately upon mode selection, regardless of
whether a character is being received or transmitted.
7.3.3.1 AUTOMATIC ECHO MODE. In this mode, the channel automatically retransmits
the received data on a bit-by-bit basis. The local CPU32-to-receiver communication
continues normally, but the CPU32-to-transmitter link is disabled. While in this mode,
Freescale Semiconductor, Inc...
received data is clocked on the receiver clock and retransmitted on TxDx. The receiver
must be enabled, but the transmitter need not be enabled.
Since the transmitter is not active, the SR TxEMP and TxRDY bits are inactive, and data
is transmitted as it is received. Received parity is checked, but not recalculated for
transmission. Character framing is also checked, but stop bits are transmitted as received.
A received break is echoed as received until the next valid start bit is detected.
7.3.3.2 LOCAL LOOPBACK MODE. In this mode, TxDx is internally connected to RxDx.
This mode is useful for testing the operation of a local serial module channel by sending
data to the transmitter and checking data assembled by the receiver. In this manner,
correct channel operations can be assured. Also, both transmitter and CPU32-to-receiver
communications continue normally in this mode. While in this mode, the RxDx input data
is ignored, the TxDx is held marking, and the receiver is clocked by the transmitter clock.
The transmitter must be enabled, but the receiver need not be enabled.
7.3.3.3 REMOTE LOOPBACK MODE. In this mode, the channel automatically transmits
received data on the TxDx output on a bit-by-bit basis. The local CPU32-to-transmitter link
is disabled. This mode is useful in testing receiver and transmitter operation of a remote
channel. While in this mode, the receiver clock is used for the transmitter.
Since the receiver is not active, received data cannot be read by the CPU32, and the error
status conditions are inactive. Received parity is not checked and is not recalculated for
transmission. Stop bits are transmitted as received. A received break is echoed as
received until the next valid start bit is detected.
Rx RxDx
INPUT
CPU
DISABLED DISABLED TxDx
Tx OUTPUT
DISABLED RxDx
Rx
INPUT
CPU
DISABLED TxDx
Tx OUTPUT
Freescale Semiconductor, Inc...
CPU
RxD C1 C2 C3 C4 C5 C6 C7 C8
RECEIVER
ENABLED
RxRDY
(SR0)
FFULL
(SR1)
Freescale Semiconductor, Inc...
RxRDYA
CS
R R R R R R R R
STATUS DATA STATUS DATA STATUS DATA STATUS DATA
C1 C2 C3 C4
C5
OVERRUN LOST
(SR4)
1
RTS RESET BY COMMAND
OPR(0) = 1
NOTES:
1. Timing shown for MR1(7) = 1
2. Timing shown for OPCR(4) = 1 and MR1(6) = 0
3. R = Read
4. CN = Received Character
A transmitted character from the master station consists of a start bit, a programmed
number of data bits, an address/data (A/D) bit flag, and a programmed number of stop
bits. The A/D bit identifies the type of character being transmitted to the slave station. The
character is interpreted as an address character if the A/D bit is set or as a data character
if the A/D bit is cleared. The polarity of the A/D bit is selected by programming bit 2 of the
MR1. The MR1 should be programmed before enabling the transmitter and loading the
corresponding data bits into the transmit buffer.
In multidrop mode, the receiver continuously monitors the received data stream,
regardless of whether it is enabled or disabled. If the receiver is disabled, it sets the
RxRDY bit and loads the character into the receiver holding register FIFO stack provided
the received A/D bit is a one (address tag). The character is discarded if the received A/D
bit is a zero (data tag). If the receiver is enabled, all received characters are transferred to
the CPU32 via the receiver holding register stack during read operations.
In either case, the data bits are loaded into the data portion of the stack while the A/D bit
is loaded into the status portion of the stack normally used for a parity error (SR bit 5).
Framing error, overrun error, and break detection operate normally. The A/D bit takes the
place of the parity bit; therefore, parity is neither calculated nor checked. Messages in this
mode may still contain error detection and correction information. One way to provide
error detection, if 8-bit characters are not required, is to use software to calculate parity
and append it to the 5-, 6-, or 7-bit character.
This section describes the operation of the IMB during read, write, and interrupt
acknowledge cycles to the serial module. All serial module registers must be accessed as
bytes.
7.3.5.1 READ CYCLES. The serial module is accessed by the CPU32 with no wait states.
The serial module responds to byte reads. Reserved registers return logic zero during
reads.
7.3.5.2 WRITE CYCLES. The serial module is accessed by the CPU32 with no wait
states. The serial module responds to byte writes. Write cycles to read-only registers and
reserved registers complete in a normal manner without exception processing; however,
the data is ignored.
NOTE
All serial module registers are only accessible as bytes. The
contents of the mode registers (MR1 and MR2), clock-select
register (CSR), and the auxiliary control register (ACR) bit 7
should only be changed after the receiver/transmitter is issued
a software RESET command—i.e., channel operation must be
disabled. Care should also be taken if the register contents are
changed during receiver/transmitter operations, as undesirable
results may be produced.
In the registers discussed in the following pages, the numbers in the upper right-hand
corner indicate the offset of the register from the base address specified in the module
base address register (MBAR) in the SIM40. The numbers above the register description
Freescale Semiconductor, Inc...
represent the bit position in the register. The register description contains the mnemonic
for the bit. The values shown below the register description are the values of those
register bits after a hardware reset. A value of U indicates that the bit value is unaffected
by reset. The read/write status and the access privilege are shown in the last line.
NOTE
A CPU32 RESET instruction will not affect the MCR, but will
reset all the other serial module registers as though a
hardware reset had occurred. The module is enabled when the
STP bit in the MCR is cleared. The module is disabled when
the STP bit in the MCR is set.
714 S/U INPUT PORT CHANGE REGISTER (IPCR) AUXILIARY CONTROL REGISTER (ACR)
715 S/U INTERRUPT STATUS REGISTER (ISR) INTERRUPT ENABLE REGISTER (IER)
716 S/U DO NOT ACCESS3 DO NOT ACCESS3
717 S/U DO NOT ACCESS3 DO NOT ACCESS3
718 S/U MODE REGISTER 1B (MR1B) MODE REGISTER 1B (MR1B)
719 S/U STATUS REGISTER B (SRB) CLOCK-SELECT REGISTER B (CSRB)
71A S/U DO NOT ACCESS3 COMMAND REGISTER B (CRB)
71B S/U RECEIVER BUFFER B (RBB) TRANSMITTER BUFFER B (TBB)
71C S/U DO NOT ACCESS3 DO NOT ACCESS3
71D S/U INPUT PORT REGISTER (IP) OUTPUT PORT CONTROL REGISTER (OPCR)
71E S/U DO NOT ACCESS3 OUTPUT PORT (OP)4 BIT SET
71F S/U DO NOT ACCESS3 OUTPUT PORT (OP)4 BIT RESET
720 S/U MODE REGISTER 2A (MR2A) MODE REGISTER 2A (MR2A)
721 S/U MODE REGISTER 2B (MR2B) MODE REGISTER 2B (MR2B)
NOTES:
1. S = Register permanently defined as supervisor-only access
2. S/U = Register programmable as either supervisor or user access
3. A read or write to these locations currently has no effect.
4. Address-triggered commands
7.4.1.1 MODULE CONFIGURATION REGISTER (MCR). The MCR controls the serial
module configuration. This register can be either read or written when the module is
enabled and is in the supervisor state. The MCR is not affected by a CPU32 RESET
instruction. Only the MCR can be accessed when the module is disabled (i.e., the STP bit
in the MCR is set).
MCR $700
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RESET:
0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
NOTE
The serial module should be disabled (i.e., the STP bit in the
MCR is set) before executing the LPSTOP instruction to obtain
the lowest power consumption. The X1/X2 oscillator will
continue to run during LPSTOP if STP = 0.
FRZ1–FRZ0—Freeze
These bits determine the action taken when the FREEZE signal is asserted on the IMB
when the CPU32 has entered background debug mode. Table 7-1 lists the action taken
for each combination of bits.
SUPV—Supervisor/User
The value of this bit has no affect on registers permanently defined as supervisor only.
1 = The serial module registers, which are defined as supervisor or user, reside in
supervisor data space and are only accessible from supervisor programs.
0 = The serial module registers, which are defined as supervisor or user, reside in
user data space and are accessible from either supervisor or user programs.
interrupt at the same priority level. No two modules can share the same IARB value.
The reset value of the IARB field is $0, which prevents this module from arbitrating
during the interrupt acknowledge cycle. The system software should initialize the IARB
field to a value from $F (highest priority) to $1 (lowest priority).
7.4.1.2 INTERRUPT LEVEL REGISTER (ILR). The ILR contains the priority level for the
serial module interrupt request. When the serial module is enabled (i.e., the STP bit in the
MCR is cleared), this register can be read or written to at any time while in supervisor
mode.
ILR $704
7 6 5 4 3 2 1 0
RESET:
0 0 0 0 0 0 0 0
Bits 7–3—Reserved
7.4.1.3 INTERRUPT VECTOR REGISTER (IVR). The IVR contains the 8-bit vector
number of the interrupt. When the serial module is enabled (i.e., the STP bit in the MCR is
cleared), this register can be read or written to at any time while in supervisor mode.
IVR $705
7 6 5 4 3 2 1 0
RESET:
0 0 0 0 1 1 1 1
7.4.1.4 MODE REGISTER 1 (MR1). MR1 controls some of the serial module
configuration. This register can be read or written at any time when the serial module is
enabled (i.e., the STP bit in the MCR is cleared).
RESET:
0 0 0 0 0 0 0 0
Read/Write Supervisor/User
R/F—Receiver-Ready Select
1 = Bit 5 for channel B and bit 1 for channel A in the ISR reflect the channel FIFO full
status. These ISR bits are set when the receiver FIFO is full and are cleared
when a position is available in the FIFO.
0 = Bit 5 for channel B and bit 1 for channel A in the ISR reflect the channel receiver-
ready status. These ISR bits are set when a character has been received and are
cleared when the CPU32 reads the receive buffer.
ERR—Error Mode
This bit controls the meaning of the three FIFO status bits (RB, FE, and PE) in the SR
for the channel.
1 = Block mode—The values in the channel SR are the accumulation (i.e., the logical
OR) of the status for all characters coming to the top of the FIFO since the last
reset error status command for the channel was issued. Refer to 7.4.1.7
Command Register (CR) for more information on serial module commands.
0 = Character mode—The values in the channel SR reflect the status of the
character at the top of the FIFO.
NOTE
ERR = 0 must be used to get the correct A/D flag information
when in multidrop mode.
Freescale Semiconductor, Inc...
PM1–PM0—Parity Mode
These bits encode the type of parity used for the channel (see Table 7-2). The parity bit
is added to the transmitted character, and the receiver performs a parity check on
incoming data. These bits can alternatively select multidrop mode for the channel.
PT—Parity Type
This bit selects the parity type if parity is programmed by the parity mode bits, and if
multidrop mode is selected, it configures the transmitter for data character transmission
or address character transmission. Table 7-2 lists the parity mode and type or the
multidrop mode for each combination of the parity mode and the parity type bits.
7.4.1.5 STATUS REGISTER (SR). The SR indicates the status of the characters in the
FIFO and the status of the channel transmitter and receiver. This register can only be read
when the serial module is enabled (i.e., the STP bit in the MCR is cleared).
7 6 5 4 3 2 1 0
RESET:
0 0 0 0 0 0 0 0
RB—Received Break
1 = An all-zero character of the programmed length has been received without a stop
bit. The RB bit is only valid when the RxRDY bit is set. Only a single FIFO
position is occupied when a break is received. Further entries to the FIFO are
inhibited until the channel RxDx returns to the high state for at least one-half bit
time, which is equal to two successive edges of the internal or external 1× clock
or 16 successive edges of the external 16× clock.
The received break circuit detects breaks that originate in the middle of a
received character. However, if a break begins in the middle of a character, it
must persist until the end of the next detected character time.
0 = No break has been received.
FE—Framing Error
1 = A stop bit was not detected when the corresponding data character in the FIFO
was received. The stop-bit check is made in the middle of the first stop-bit
position. The bit is valid only when the RxRDY bit is set.
0 = No framing error has occurred.
PE—Parity Error
1 = When the with parity or force parity mode is programmed in the MR1, the
corresponding character in the FIFO was received with incorrect parity. When the
multidrop mode is programmed, this bit stores the received A/D bit. This bit is
valid only when the RxRDY bit is set.
0 = No parity error has occurred.
OE—Overrun Error
1 = One or more characters in the received data stream have been lost. This bit is
set upon receipt of a new character when the FIFO is full and a character is
already in the shift register waiting for an empty FIFO position. When this occurs,
the character in the receiver shift register and its break detect, framing error
status, and parity error, if any, are lost. This bit is cleared by the reset error status
command in the CR.
0 = No overrun has occurred.
TxEMP—Transmitter Empty
1 = The channel transmitter has underrun (both the transmitter holding register and
transmitter shift registers are empty). This bit is set after transmission of the last
stop bit of a character if there are no characters in the transmitter holding register
Freescale Semiconductor, Inc...
awaiting transmission.
0 = The transmitter buffer is not empty. The transmitter holding register is loaded by
the CPU32, or the transmitter is disabled. The transmitter is enabled/disabled by
programming the TCx bits in the CR.
TxRDY—Transmitter Ready
This bit is duplicated in the ISR; bit 0 for channel A and bit 4 for channel B.
1 = The transmitter holding register is empty and ready to be loaded with a character.
This bit is set when the character is transferred to the transmitter shift register.
This bit is also set when the transmitter is first enabled. Characters loaded into
the transmitter holding register while the transmitter is disabled are not
transmitted and are lost.
0 = The transmitter holding register was loaded by the CPU32, or the transmitter is
disabled.
FFULL—FIFO Full
1 = A character was transferred from the receiver shift register to the receiver FIFO
and the transfer caused the FIFO to become full (all three FIFO holding register
positions are occupied).
0 = The CPU32 has read the receiver buffer and one or more FIFO positions are
available. Note that if there is a character in the receiver shift register because
the FIFO is full, this character will be moved into the FIFO when a position is
available, and the FIFO will remain full.
RxRDY—Receiver Ready
1 = A character has been received and is waiting in the FIFO to be read by the
CPU32. This bit is set when a character is transferred from the receiver shift
register to the FIFO.
0 = The CPU32 has read the receiver buffer, and no characters remain in the FIFO
after this read.
7.4.1.6 CLOCK-SELECT REGISTER (CSR). The CSR selects the baud rate clock for the
channel receiver and transmitter. This register can only be written when the serial module
is enabled (i.e., the STP bit in the MCR is cleared).
NOTE
This register should only be written after the external crystal is
stable (XTAL_RDY bit of the ISR is zero).
RESET:
0 0 0 0 0 0 0 0
0 1 0 0 300 300
0 1 0 1 600 600
0 1 1 0 1200 1200
0 1 1 1 1050 2000
1 0 0 0 2400 2400
1 0 0 1 4800 4800
1 0 1 0 7200 1800
1 0 1 1 9600 9600
1 1 0 0 38.4k 19.2k
1 1 0 1 76.8k 38.4k
1 1 1 0 SCLK/16 SCLK/16
1 1 1 1 SCLK/1 SCLK/1
RESET:
0 0 0 0 0 0 0 0
MISC3–MISC0—Miscellaneous Commands
These bits select a single command as listed in Table 7-6.
0 1 1 0 Start Break
0 1 1 1 Stop Break
1 0 0 0 Assert RTS
1 0 0 1 Negate RTS
1 0 1 0 No Command
1 0 1 1 No Command
1 1 0 0 No Command
1 1 0 1 No Command
1 1 1 0 No Command
1 1 1 1 No Command
Reset Receiver—The reset receiver command resets the channel receiver. The receiver
is immediately disabled, the FFULL and RxRDY bits in the SR are cleared, and the
receiver FIFO pointer is reinitialized. All other registers are unaltered. This command
should be used in lieu of the receiver disable command whenever the receiver
configuration is changed because it places the receiver in a known state.
Reset Transmitter—The reset transmitter command resets the channel transmitter. The
transmitter is immediately disabled, and the TxEMP and TxRDY bits in the SR are
cleared. All other registers are unaltered. This command should be used in lieu of the
transmitter disable command whenever the transmitter configuration is changed
because it places the transmitter in a known state.
Reset Error Status—The reset error status command clears the channel's RB, FE, PE,
and OE bits (in the SR). This command is also used in the block mode to clear all error
bits after a data block is received.
Reset Break-Change Interrupt—The reset break-change interrupt command clears the
delta break (DBx) bits in the ISR.
Start Break—The start break command forces the channel's TxDx low. If the transmitter
is empty, the start of the break conditions can be delayed up to one bit time. If the
transmitter is active, the break begins when transmission of the character is complete. If
a character is in the transmitter shift register, the start of the break is delayed until the
character is transmitted. If the transmitter holding register has a character, that
character is transmitted after the break. The transmitter must be enabled for this
command to be accepted. The state of the CTS≈ input is ignored for this command.
Stop Break—The stop break command causes the channel's TxDx to go high (mark)
within two bit times. Characters stored in the transmitter buffer, if any, are transmitted.
Assert RTS—The assert RTS command forces the channel's RTS≈ output low.
Negate RTS—The negate RTS command forces the channel's RTS≈ output high.
Freescale Semiconductor, Inc...
TC1–TC0—Transmitter Commands
These bits select a single command as listed in Table 7-7.
No Action Taken—The no action taken command causes the transmitter to stay in its
current mode. If the transmitter is enabled, it remains enabled; if disabled, it remains
disabled.
Transmitter Enable—The transmitter enable command enables operation of the
channel's transmitter. The TxEMP and TxRDY bits in the SR are also set. If the
transmitter is already enabled, this command has no effect.
Transmitter Disable—The transmitter disable command terminates transmitter operation
and clears the TxEMP and TxRDY bits in the SR. However, if a character is being
transmitted when the transmitter is disabled, the transmission of the character is
completed before the transmitter becomes inactive. If the transmitter is already
disabled, this command has no effect.
Do Not Use—Do not use this bit combination because the result is indeterminate.
RC1–RC0—Receiver Commands
These bits select a single command as listed in Table 7-8.
No Action Taken—The no action taken command causes the receiver to stay in its
current mode. If the receiver is enabled, it remains enabled; if disabled, it remains
Freescale Semiconductor, Inc...
disabled.
Receiver Enable—The receiver enable command enables operation of the channel's
receiver. If the serial module is not in multidrop mode, this command also forces the
receiver into the search-for-start-bit state. If the receiver is already enabled, this
command has no effect.
Receiver Disable—The receiver disable command disables the receiver immediately.
Any character being received is lost. The command has no effect on the receiver status
bits or any other control register. If the serial module is programmed to operate in the
local loopback mode or multidrop mode, the receiver operates even though this
command is selected. If the receiver is already disabled, this command has no effect.
Do Not Use—Do not use this bit combination because the result is indeterminate.
7.4.1.8 RECEIVER BUFFER (RB). The receiver buffer contains three receiver holding
registers and a serial shift register. The channel's RxDx pin is connected to the serial shift
register. The holding registers act as a FIFO. The CPU32 reads from the top of the stack
while the receiver shifts and updates from the bottom of the stack when the shift register
has been filled (see Figure 7-4). This register can only be read when the serial module is
enabled (i.e., the STP bit in the MCR is cleared).
RESET:
0 0 0 0 0 0 0 0
7.4.1.9 TRANSMITTER BUFFER (TB). The transmitter buffer consists of two registers,
the transmitter holding register and the transmitter shift register (see Figure 7-4). The
holding register accepts characters from the bus master if the TxRDY bit in the channel's
SR is set. A write to the transmitter buffer clears the TxRDY bit, inhibiting any more
characters until the shift register is ready to accept more data. When the shift register is
empty, it checks to see if the holding register has a valid character to be sent (TxRDY bit
cleared). If there is a valid character, the shift register loads the character and reasserts
the TxRDY bit in the channel's SR. Writes to the transmitter buffer when the channel's SR
TxRDY bit is clear and when the transmitter is disabled have no effect on the transmitter
buffer. This register can only be written when the serial module is enabled (i.e., the STP
bit in the MCR is cleared).
RESET:
0 0 0 0 0 0 0 0
7.4.1.10 INPUT PORT CHANGE REGISTER (IPCR). The IPCR shows the current state
and the change-of-state for the CTSA and CTSB pins. This register can only be read
when the serial module is enabled (i.e., the STP bit in the MCR is cleared).
IPCR $714
7 6 5 4 3 2 1 0
RESET:
0 0 0 0 0 0 U U
Bits 7, 6, 3, 2—Reserved
COSB, COSA—Change-of-State
1 = A change-of-state (high-to-low or low-to-high transition), lasting longer than 25–
50 µs when using a crystal as the sampling clock or longer than one or two
periods when using SCLK, has occurred at the corresponding CTS≈ input (MCR
ICCS bit controls selection of the sampling clock for clear-to-send operation).
When these bits are set, the ACR can be programmed to generate an interrupt to
the CPU32.
0 = The CPU32 has read the IPCR. No change-of-state has occurred. A read of the
IPCR also clears the ISR COS bit.
7.4.1.11 AUXILIARY CONTROL REGISTER (ACR). The ACR selects which baud rate is
used and controls the handshake of the transmitter/receiver. This register can only be
written when the serial module is enabled (i.e., the STP bit in the MCR is cleared).
ACR $714
7 6 5 4 3 2 1 0
RESET:
0 0 0 0 0 0 0 0
7.4.1.12 INTERRUPT STATUS REGISTER (ISR). The ISR provides status for all potential
interrupt sources. The contents of this register are masked by the IER. If a flag in the ISR
is set and the corresponding bit in IER is also set, the IRQ≈ output is asserted. If the
corresponding bit in the IER is cleared, the state of the bit in the ISR has no effect on the
output. This register can only be read when the serial module is enabled (i.e., the STP bit
in the MCR is cleared).
NOTE
The IER does not mask reading of the ISR. True status is
provided regardless of the contents of IER. The contents of
ISR are cleared when the serial module is reset.
ISR $715
7 6 5 4 3 2 1 0
RESET:
0 0 0 0 1 0 0 0
COS—Change-of-State
1 = A change-of-state has occurred at one of the CTS≈ inputs and has been
selected to cause an interrupt by programming bit 1 and/or bit 0 of the ACR.
0 = The CPU32 has read the IPCR.
DBB—Delta Break B
1 = The channel B receiver has detected the beginning or end of a received break.
0 = The CPU32 has issued a channel B reset break-change interrupt command.
Refer to 7.4.1.7 Command Register (CR) for more information on the reset
break-change interrupt command.
0 = If programmed as receiver ready, the CPU32 has read the receiver buffer. After
this read, if more characters are still in the FIFO, the bit is set again after the
FIFO is 'popped'. If programmed as FIFO full, the CPU32 has read the receiver
buffer. If a character is waiting in the receiver shift register because the FIFO is
full, the bit will be set again when the waiting character is loaded into the FIFO.
DBA—Delta Break A
1 = The channel A receiver has detected the beginning or end of a received break.
0 = The CPU32 has issued a channel A reset break-change interrupt command.
Refer to 7.4.1.7 Command Register (CR) for more information on the reset
break-change interrupt command.
7.4.1.13 INTERRUPT ENABLE REGISTER (IER). The IER selects the corresponding bits
in the ISR that cause an interrupt output ( IRQ≈). If one of the bits in the ISR is set and the
corresponding bit in the IER is also set, the IRQ≈ output is asserted. If the corresponding
bit in the IER is zero, the state of the bit in the ISR has no effect on the IRQ≈ output. The
IER does not mask the reading of the ISR. The ISR XTAL_RDY bit cannot be enabled to
generate an interrupt. This register can only be written when the serial module is enabled
(i.e., the STP bit in the MCR is cleared).
IER $715
7 6 5 4 3 2 1 0
RESET:
0 0 0 0 0 0 0 0
COS—Change-of-State
1 = Enable interrupt
0 = Disable interrupt
DBB—Delta Break B
1 = Enable interrupt
0 = Disable interrupt
Bit 3—Reserved
DBA—Delta Break A
1 = Enable interrupt
0 = Disable interrupt
Freescale Semiconductor, Inc...
7.4.1.14 INPUT PORT (IP). The IP register shows the current state of the CTS≈ inputs.
This register can only be read when the serial module is enabled (i.e., the STP bit in the
MCR is cleared).
IP $71D
7 6 5 4 3 2 1 0
0 0 0 0 0 0 CTSB CTSA
RESET:
0 0 0 0 0 0 U U
NOTE
These bits have the same function and value of the IPCR bits 1
and 0.
OPCR $71D
7 6 5 4 3 2 1 0
RESET:
0 0 0 0 0 0 0 0
NOTE
Freescale Semiconductor, Inc...
7.4.1.16 OUTPUT PORT DATA REGISTER (OP). The bits in the OP register are set by
performing a bit set command (writing to offset $71E) and are cleared by performing a bit
reset command (writing to offset $71F). This register can only be written when the serial
module is enabled (i.e., the STP bit in the MCR is cleared).
Freescale Semiconductor, Inc...
Bit Set
OP $71E
7 6 5 4 3 2 1 0
RESET:
0 0 0 0 0 0 0 0
NOTE
OP bits 7, 5, 3, and 2 are not pinned out on the MC68340;
thus, changing these bits has no effect.
RESET:
0 0 0 0 0 0 0 0
NOTE
OP bits 7, 5, 3, and 2 are not pinned out on the MC68340;
thus, changing these bits has no effect.
7.4.1.17 MODE REGISTER 2 (MR2). MR2 controls some of the serial module
configuration. This register can be read or written at any time the serial module is enabled
(i.e., the STP bit in the MCR is cleared).
RESET:
0 0 0 0 0 0 0 0
Read/Write Supervisor/User
CM1–CM0—Channel Mode
These bits select a channel mode as listed in Table 7-9. See 7.3.3 Looping Modes for
more information on the individual modes.
Freescale Semiconductor, Inc...
TxRTS—Transmitter Ready-to-Send
This bit controls the negation of the RTSA or RTSB signals. The output is normally
asserted by setting OP0 or OP1 and negated by clearing OP0 or OP1 (see 7.4.1.15
Output Port Control Register (OPCR)).
1 = In applications where the transmitter is disabled after transmission is complete,
setting this bit causes the particular OP bit to be cleared automatically one bit
time after the characters, if any, in the channel transmit shift register and the
transmitter holding register are completely transmitted, including the programmed
number of stop bits. This feature is used to automatically terminate transmission
of a message. If both the receiver and the transmitter in the same channel are
programmed for RTS control, RTS control is disabled for both since this is an
incorrect configuration.
0 = Clearing this bit has no effect on the transmitter RTS≈.
TxCTS—Transmitter Clear-to-Send
1 = Enables clear-to-send operation. The transmitter checks the state of the CTS≈
input each time it is ready to send a character. If CTS≈ is asserted, the character
is transmitted. If CTS≈ is negated, the channel TxDx remains in the high state,
and the transmission is delayed until CTS≈ is asserted. Changes in CTS≈ while
a character is being transmitted do not affect transmission of that character. If
both TxCTS and TxRTS are enabled, TxCTS controls the operation of the
transmitter.
0 = The CTS≈ has no effect on the transmitter.
sixteenth bit, are programmable for character lengths of six, seven, and eight bits. For a
character length of five bits, one and one-sixteenth to two bits are programmable in
increments of one-sixteenth bit. In all cases, the receiver only checks for a high
condition at the center of the first stop-bit position—i.e., one bit time after the last data
bit or after the parity bit, if parity is enabled.
If an external 1× clock is used for the transmitter, MR2 bit 3 = 0 selects one stop bit, and
MR2 bit 3 = 1 selects two stop bits for transmission.
7.4.2 Programming
The basic interface software flowchart required for operation of the serial module is shown
in Figure 7-10. The routines are divided into three categories:
• Serial Module Initialization
• I/O Driver
• Interrupt Handling
A or channel B, the respective receivers and transmitters are enabled. The CHCHK
routine performs the actual channel checks as called from the SINIT routine. When called,
SINIT places the specified channel in the local loopback mode and checks for the
following errors:
• Transmitter Never Ready
• Receiver Never Ready
• Parity Error
• Incorrect Character Received
7.4.2.2 I/O DRIVER EXAMPLE. The I/O driver routines consist of INCH, OUTCH, and
POUTCH. INCH is the terminal input character routine and gets a character from the
channel A receiver and places it in the lower byte of register D0. OUTCH is used to send
the character in the lower byte of register D0 to the channel A transmitter. POUTCH sends
the character in the lower byte of D0 to the channel B transmitter.
7.4.2.3 INTERRUPT HANDLING. The interrupt handling routine consists of SIRQ, which
is executed after the serial module generates an interrupt caused by a channel A change-
in-break (beginning of a break). SIRQ then clears the interrupt source, waits for the next
change-in-break interrupt (end of break), clears the interrupt source again, then returns
from exception processing to the system monitor.
SERIAL MODULE
ENABLA
SINIT
INITIATE: ANY
ERRORS IN Y
CHANNEL A
CHANNEL B CHANNEL A
?
Freescale Semiconductor, Inc...
INTERRUPTS
N
CHK1
ENABLE CHANNEL
POINT TO CHANNEL A A'S RECEIVER
ENABLB
SAVE CHANNEL A
STATUS
CHK2 ANY
ERRORS IN Y
CHANNEL B
?
POINT TO CHANNEL B
SINITR
SAVE CHANNEL B
STATUS
RETURN
CHCHK
CHCHK
PLACE CHANNEL IN
LOCAL LOOPBACK
MODE
Freescale Semiconductor, Inc...
ENABLE CHANNEL'S
TRANSMITTER CLEAR
CHANNEL
STATUS WORD
TxCHK
N
IS Y WAITED Y
TRANSMITTER SET TRANSMITTER-
TOO LONG NEVER-READY FLAG
READY ?
?
N
SNDCHR
SEND CHARACTER
TO TRANSMITTER
RxCHK
N
HAS
RECEIVER N WAITED Y SET RECEIVER-
RECEIVED TOO LONG NEVER-READY FLAG
CHARACTER ?
?
Y
A B
A B
FRCHK RSTCHN
DISABLE CHANNEL'S
HAVE N TRANSMITTER
FRAMING ERROR
?
Y
RESTORE CHANNEL
TO ORIGINAL MODE
SET FRAMING
ERROR FLAG
Freescale Semiconductor, Inc...
PRCHK RETURN
HAVE N
PARITY ERROR
?
SET PARITY
ERROR FLAG
A
CHRCHK
GET CHARACTER
FROM RECEIVER
SAME Y
AS CHARACTER
TRANSMITTED
?
SET INCORRECT
CHARACTER FLAG
SIRQ INCH
ABRKI
WAS DOES
IRQx CAUSED N CHANNEL A N
Freescale Semiconductor, Inc...
ABRKI1
HAS RETURN
END-OF-BREAK N
IRQx ARRIVED
YET
?
Y
CLEAR CHANGE-IN-
BREAK STATUS BIT
REMOVE BREAK
CHARACTER FROM
RECEIVER FIFO
REPLACE RETURN
ADDRESS ON SYSTEM
STACK AND MONITOR
WARM START ADDRESS
SIRQR
RTE
OUTCH POUCH
IS IS
CHANNEL A N CHANNEL B N
TRANSMITTER TRANSMITTER
READY READY
? ?
Freescale Semiconductor, Inc...
Y Y
WAS WAS
CHARACTER A N CHARACTER A N
CARRIAGE CARRIAGE
RETURN RETURN
? ?
Y Y
OUTCHI POUCHI
IS IS
CHANNEL A N CHANNEL B N
TRANSMITTER TRANSMITTER
READY READY
? ?
Y Y
OUTCHR POUTCHR
RETURN RETURN
NOTE
The serial module registers can only be accessed by byte operations.
***************************************************************
* Serial module equates
SERIAL EQU $700 Offset from MBAR for serial module regs
MCRH EQU $0 serial MCR high byte
MCRL EQU $1 serial MCR low byte
***************************************************************************
Freescale Semiconductor, Inc...
***************************************************************************
* Initialize Serial channel A
***************************************************************************
LEA MODBASE+SERIAL,A0 Pointer to serial channel A
* RESET RECEIVER/TRANSMITTER
MOVE.B #$20,CRA(A0) Issue reset receiver command
MOVE.B #$30,CRA(A0) Issue reset transmitter command
* MODE REGISTER 1
MOVE.B #$93,MR1A(A0) 8 bits, no parity, auto RTS control
* MODE REGISTER 2
MOVE.B #$07,MR2A(A0) Normal, 1 stop bit
* ENABLE PORT
MOVE.B #$45,CRA(A0) Reset error status, enable RX & TX
***************************************************************************
END
Freescale Semiconductor, Inc...
***************************************************************************
SECTION 8
TIMER MODULES
Each MC68340 timer module contains a counter/timer (timer 1 and timer 2) as shown in
Figure 8-1. Each timer interfaces directly to the CPU32 via the intermodule bus (IMB).
Each timer consists of the following major areas:
• A General-Purpose Counter/Timer
Freescale Semiconductor, Inc...
TIMER 1 TIMER 2
TIN1 TIN2
TOUT1 TOUT2
TIMER 1 TIMER 2
TGATE1 TGATE2
INTERRUPT INTERRUPT
CONTROL CONTROL
LOGIC LOGIC
IMB IMB
INTERFACE INTERFACE
— Pulse-Width Measurement
— Period Measurement
— Event Counting
• Seven Maskable Interrupt Conditions Based on Programmable Events
The timer can perform virtually any application traditionally assigned to timers and
counters. The timer can be used to generate timed events that are independent of the
timing errors to which real-time programmed microprocessors are susceptible—for
Freescale Semiconductor, Inc...
example, those of dynamic memory refreshing, DMA cycle steals, and interrupt servicing.
The timer has several functional areas: an 8-bit countdown prescaler, a 16-bit
downcounter, timeout logic, compare logic, and clock selection logic. Figure 8-2 shows a
functional diagram of the timer module.
8.1.1.1 PRESCALER AND COUNTER. The counter can be driven directly by the selected
clock or the prescaler output. Both the counter and prescaler are updated on the falling
edge of the clock. During reset, the prescaler is set to $FF, and the counter is set to
$0000. The counter is loaded with a programmed value on the first falling edge of the
counter clock after the timer is enabled and again when a timeout occurs (counter reaches
$0000). The prescaler and counter can be used as one 24-bit counter by enabling the
prescaler and selecting the divide-by-256 prescaler output. Refer to 8.4 Register
Description for additional information on how to program the timer.
8.1.1.2 TIMEOUT DETECTION. Timeout is achieved when all 16 stages of the counter
transition to zero, a counter value of $0000. Timeout is a defined counter event which
triggers specific actions depending upon the programmed mode of operation. Refer to 8.3
Operating Modes for descriptions of the individual modes.
8.1.1.3 COMPARATOR. The comparator block compares the value in the 16-bit compare
register (COM) with the output of the 16-bit counter. When an exact match is detected,
bits in the status register (SR) are set to indicate this condition. When in the input
capture/output compare mode, a match is a defined counter event that can affect the
output of the timer (TOUTx). Refer to 8.3.1 Input Capture/Output Compare for additional
information on this mode.
TIMER
EXTERNAL
INTERFACE
MODULE CONFIGURATION REGISTER
INTERRUPT REGISTER
CONTROL REGISTER
STATUS REGISTER
PRELOAD 1 REGISTER
I TIN
Freescale Semiconductor, Inc...
COUNTER
16-BIT CLOCK
MUX MUX
COUNTER 8-BIT
PRESCALER
TOUT
COUNTER REGISTER TIMEOUT
8.1.1.4 CLOCK SELECTION LOGIC. The clock selection logic consists of two
multiplexers that select the clocks applied to the prescaler and counter. The first
multiplexer (labeled clock logic in Figure 8-2) selects between the clock input to the timer
(TINx) or one-half the frequency of the system clock (CLKOUT). This output of the first
multiplexer (called selected clock) is applied to both the 8-bit prescaler and the second
multiplexer. The second multiplexer selects the clock for the 16-bit counter, which is either
the selected clock or the 8-bit prescaler output.
NOTE
The terms assertion and negation are used throughout this
Freescale Semiconductor, Inc...
TIMER 1
TIN1
CLOCK
LOGIC TGATE1
PRESCALER
EXTERNAL
INTERFACE
SIGNALS
COUNTER
OUTPUT TOUT1
CONTROL
Freescale Semiconductor, Inc...
INTERRUPT
CONTROL
I
M
B TIMER 2
TIN2
CLOCK
LOGIC TGATE2
PRESCALER
EXTERNAL
INTERFACE
SIGNALS
COUNTER
OUTPUT TOUT2
CONTROL
INTERRUPT
CONTROL
for at least one system clock period plus the sum of the setup and hold times for TINx.
Refer to Section 11 Electrical Characteristics, for additional information.
This output drives the various output waveforms generated by the timer. The initial level
and transitions can be programmed by the output control (OC) bits in the CR.
The timer is enabled when the counter prescaler enable (CPE) and SWRx bits in the CR
are set. Once enabled, the counter enable (ON) bit in the SR is set, and the next falling
edge of the counter clock causes the counter to be loaded with the value in the preload 1
register (PREL1).
The TGATE≈ signal functions differently in this mode than it does in the other modes.
TGATE≈ does not enable or disable the counter/prescaler input clock; instead, it is used
to disable shadowing. Normally, the counter is decremented on the falling edge of the
counter clock, and the CNTR is updated on the next rising edge of the system clock; thus,
the CNTR shadows the actual value of the counter. The timer gate interrupt (TG) bit in the
SR must be cleared for shadowing to occur. TGATE≈ is used to set the TG bit and disable
shadowing. If the timing gate is enabled (TGE bit of the CR is set), the TG bit is set by the
rising edge of TGATE≈. Shadowing is disabled until the TG bit is cleared by writing a one
to its location in the SR. See Figure 8-4 for a depiction of this mode. If the timing gate is
disabled (CR TGE bit is cleared), TGATE≈ has no effect on the operation of the timer;
thus the input capture function is inoperative. At all times, the TGATE≈ level bit (TGL) in
the SR reflects the level of the TGATE≈ signal.
COUNTER
CLOCK
COUNTER 0 0 0 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1 1 0 0 8 8 7 7
COUNTER 0 0 0 0 8 8 7 7 6 6 6 6 6 6 6 3 2 2 1 1 0 0 8 8 8
REGISTER
TGATE
TOUT
ENABLE TC SET TIMEOUT TC SET
Since the counter is not affected by TGATE≈ , it continues to decrement on the falling
edge of the counter clock and load from the PREL1 at timeout, regardless of the value of
TGATE≈.
When the counter counts down to the value contained in the COM, this condition is
reflected by setting the timer compare (TC) and compare (COM) bits in the SR. TOUTx
responds as selected by the OCx bits in the CR. The output level (OUT) bit in the SR
reflects the value on TOUTx. Shadowing does not affect this operation.
If the counter counts down to $0000, a timeout is detected, causing the SR timeout
interrupt (TO) bit to be set and the SR COM bit to be cleared. On the next falling edge of
the counter clock after the timeout is detected, the value in PREL1 is again loaded into the
counter. TOUTx responds as selected by the CR OCx bits.
This mode can be used as a pulse-width modulator by programming the CR OCx bits to
zero mode or one mode. The value in the PREL1 specifies the frequency, and the COM
determines the pulse width. The pulse widths can be changed by writing a new value to
the COM.
Periodic interrupt generation can be accomplished by enabling the TO, TG, and/or TC bits
in the SR to generate interrupts by programming the IE bits of the CR. When enabled, the
programmed IRQ≈ signal is asserted whenever the specified bits are set.
TOUTx signal transitions can be controlled by writing new values into the COM. Caution
must be exercised when accessing the COM. If it were to be accessed simultaneously by
the compare logic and by a write, the old compare value may actually get compared to the
counter value.
The timer is enabled by setting the SWR and CPE bits in the CR and, if TGATE≈ is
programmed to control the enabling and disabling of the counter (TGE bit set in the CR),
then asserting TGATE≈. When the timer is enabled, the ON bit in the SR is set. On the
next falling edge of the counter clock, the counter is loaded with the value stored in the
PREL1 (N). With each successive falling edge of the counter clock, the counter
decrements. The time between enabling the timer and the first timeout can range from N
to N + 1 periods. When TGATE≈ is used to enable the timer, the enabling of the timer is
asynchronous; however, if timing is carefully considered, the time to the first timeout can
be known. For additional details on timing, see Section 11 Electrical Characteristics.
TOUTx behaves as a square wave when the OCx bits of the CR are programmed for
toggle mode. A timeout occurs every N + 1 periods (allowing for the zero cycle), resulting
in a change of state on TOUTx (see Figure 8-5). The SR OUT bit reflects the level of
TOUTx. If this mode is used to generate periodic interrupts, TOUTx may be enabled if a
square wave is also desired.
COUNTER
CLOCK
COUNTER 0 0 3 2 1 0 3 2 1 0 3 2 1 0 3
TOUT N+1
N: N + 1 N+1
If TGATE≈ is negated when it is enabled to control the timer (TGE = 1), the prescaler and
counter are disabled. Additionally, the SR TG bit is set, indicating that TGATE≈ was
negated. The SR ON bit is cleared, indicating that the timer is disabled. If TGATE≈ is
reasserted, the timer is re-enabled and begins counting from the value attained when
TGATE≈ was negated. The SR ON bit is set again.
If TGATE≈ is disabled (TGE = 0), TGATE≈ has no effect on the operation of the timer. In
this case, the counter begins counting on the falling edge of the counter clock immediately
after the SWR and CPE bits in the CR are set. The TG bit of the SR cannot be set. At all
times, TGL in the SR reflects the level of TGATE≈.
If the counter counts down to the value stored in the COM register, then the COM and TC
bits in the SR are set. The counter continues counting down to timeout. At this time, the
SR TO bit is set, and the SR COM bit is cleared. The next falling edge of the counter clock
after timeout causes the value in PREL1 to be loaded back into the counter, and the
counter begins counting down from this value.
Freescale Semiconductor, Inc...
The period of the square-wave generator can be changed dynamically by writing a new
value into the PREL1. Caution must be used because, if PREL1 is accessed
simultaneously by the counting logic and a CPU32 write, the old PREL1 value may
actually get loaded into the counter at timeout.
Periodic interrupt generation can be accomplished by enabling the TO, TG, and/or TC bits
in the SR to generate interrupts by programming the CR IE bits. When enabled, the
programmed IRQ≈ signal is asserted whenever the specified bits are set.
The timer is enabled by setting both the SWR and CPE bits in the CR and, if TGATE≈ is
enabled (CR TGE bit is set), then asserting TGATE≈. When the timer is enabled, the ON
bit in the SR is set. On the next falling edge of the counter clock, the counter is loaded
with the value stored in the PREL1 register (N1). With each successive falling edge of the
counter clock, the counter decrements. The time between enabling the timer and the first
timeout can range from N1 to N1+1 periods. When TGATE≈ is used to enable the timer,
the enabling of the timer is asynchronous; however, if timing is carefully considered, the
time to the first timeout can be known. For additional details on timing, see the Section 11
Electrical Characteristics.
If the counter counts down to the value stored in the COM register, the COM and timer
compare interrupt (TC) bits in the SR are set. The counter continues counting down to
timeout. At this time, the TO bit in the SR is set, and the COM bit is cleared. The next
falling edge of the counter clock after timeout causes the value in PREL2 (N2) to be
loaded into the counter, and the counter begins counting down from this value. Each
successive timeout causes the counter to be loaded alternately with the values from
PREL1 and PREL2.
TOUTx behaves as a variable duty-cycle square wave when the CR OC bits are
programmed for toggle mode. The second timeout occurs after N2 + 1 periods (allowing
for the zero cycle), resulting in a change of state on TOUTx. The third timeout occurs after
N1 + 1 periods, resulting in a change of state on TOUTx, and so on (see Figure 8-6). The
OUT bit in the SR reflects the level of TOUTx.
COUNTER
CLOCK
COUNTER 0 0 4 3 2 1 0 2 1 0 4 3 2 1 0 2 1 0
Freescale Semiconductor, Inc...
N2 + 1 N2 + 1
TOUT N1: N1 + 1 N1 + 1
ENABLE TIMEOUT TIMEOUT TIMEOUT TIMEOUT
If TGATE≈ is negated when it is enabled (TGE = 1), the prescaler and counter are
disabled. Additionally, the TG bit of the SR is set, indicating that TGATE≈ was negated.
The ON bit of the SR is cleared, indicating that the timer is disabled. If TGATE≈ is
reasserted, the timer is re-enabled and begins counting from the value attained when
TGATE≈ was negated. The ON bit is set again.
If TGATE≈ is not enabled (TGE = 0), TGATE≈ has no effect on the operation of the timer.
In this case, the counter would begin counting on the falling edge of the counter clock
immediately after the SWR and CPE bits in the CR are set. The SR TG bit cannot be set.
At all times, the TGL bit in the SR reflects the level of TGATE≈.
The duty cycle of the waveform generated on TOUTx can be dynamically changed by
writing new values into PREL1 and/or PREL2. If PREL1 or PREL2 is being accessed
simultaneously by the counter logic and a CPU32 write, the old preload value may actually
get loaded into the counter at timeout. If at timeout, the counting logic was accessing
PREL2 and the CPU32 was writing to PREL1 (or visa versa), there would be no
unexpected results.
The timer is enabled by setting both the SWR and CPE bits in the CR and, if TGATE≈ is
enabled (TGE bit in the CR is set), then asserting TGATE≈. When the timer is enabled,
the ON bit in the SR is set. On the next falling edge of the counter clock, the counter is
loaded with the value stored in the PREL1 register (N1). With each successive falling
edge of the counter clock, the counter decrements. The time between enabling the timer
and the first timeout can range from N1 to N1 + 1 periods. When TGATE≈ is used to
enable the counter, the enabling of the timer is asynchronous; however, if timing is
carefully considered, the time to the first timeout can be known. For additional details on
timing, see Section 11 Electrical Characteristics.
If the counter counts down to the value stored in the COM, the COM and TC bits in the SR
are set. The counter continues counting down to timeout. At this time, the SR TO bit is set
and the SR COM bit is cleared. The next falling edge of the counter clock after timeout
causes the value in PREL2 (N2) to be loaded into the counter, and the counter begins
Freescale Semiconductor, Inc...
counting down from this value. After the second timeout, the selected clock is held high,
disabling the prescaler and counter. Additionally, the SR ON and COM bits are cleared.
TOUTx behaves as a variable-width pulse when the OCx bits of the CR are programmed
for toggle mode. TOUTx is a logic zero between the time that the timer is enabled and the
first timeout. When this event occurs, TOUTx transitions to a logic one. The second
timeout occurs after N2 + 1 periods (allowing for the zero cycle), resulting in TOUTx
returning to a logic zero (see Figure 8-7). The OUT bit in the SR reflects the level of
TOUTx.
COUNTER
CLOCK
COUNTER 0 0 2 1 0 5 4 3 2 1 0
TOUT N2 + 1
N1: N1 + 1
If TGATE≈ is negated when it is enabled (TGE = 1), the prescaler and counter are
disabled. Additionally, the SR TG bit is set, indicating that TGATE≈ was negated. The SR
ON bit is cleared, indicating that the timer is disabled. If TGATE≈ is reasserted, the timer
is re-enabled and begins counting from the value attained when TGATE≈ was negated.
The ON bit is set again.
If TGATE≈ is not enabled (TGE = 0), TGATE≈ has no effect on the operation of the timer.
In this case, the counter would begin counting on the falling edge of the counter clock
immediately after the SWR and CPE bits in the CR are set. The SR TG bit cannot be set.
At all times, the TGL bit in the SR reflects the level of TGATE≈.
The width of the pulse generated on TOUTx (the value in PREL2) can be changed while
the counter is counting down from the value in PREL1. Caution must be used because, if
PREL2 is accessed simultaneously by the counting logic and a CPU32 write, the old
PREL2 value may actually get loaded into the counter at timeout.
of TGATE≈ have no effect on the counter. This mode can be selected by programming
the CR MODEx bits to 100.
The timer is enabled by setting the SWR, CPE, and TGE bits in the CR. Asserting
TGATE≈ starts the counter. When the timer is enabled, the SR ON bit is set. On the next
falling edge of the counter clock, the counter is loaded with the value $FFFF. With each
successive falling edge of the counter clock, the counter decrements. The PREL1 and
PREL2 registers are not used in this mode.
When TGATE≈ is negated, the SR TG bit is set, the ON bit is negated, and the prescaler
and counter are disabled. Subsequent transitions on TGATE≈ do not re-enable the
counter. The TGL bit in the SR reflects the level of TGATE≈ at all times.
COUNTER
CLOCK
COUNTER 0 f f f f f f
f f f f f f
f f f f f f
f e d c b b
ENABLE
START STOP NO EFFECT
COUNTING COUNTING
If the counter counts down to the value stored in the COM register, the COM and TC bits
in the SR are set. If the counter counts down to $0000, a timeout is detected. This sets the
SR TO, and the clears the COM bit. At timeout, the next falling edge of the counter clock
causes the counter to reload with $FFFF. TOUTx transitions at timeout or is disabled as
programmed by the CR OCx bits. The SR OUT bit reflects the level on TOUTx.
To determine the number of cycles counted, the value in the CNTR must be read,
inverted, and incremented by 1 (the first count is $FFFF which, in effect, includes a count
of zero). The counter counts in a true 216 fashion. For measuring pulses of even greater
duration, the value in the POx bits in the SR is readable and can be thought of as an
extension of the least significant bits in the CNTR.
NOTE
Once the timer has been enabled, do not clear the SR TG bit
until the pulse has been measured and TGATE≈ has been
negated.
Freescale Semiconductor, Inc...
The timer is enabled by setting the SWR, CPE, and the TGE bits in the CR. The assertion
of TGATE≈ starts the counter. When the timer is enabled, the SR ON bit is set. On the
next falling edge of the counter clock, the counter is loaded with the value of $FFFF. With
each successive falling edge of the counter clock, the counter decrements. The PREL1
and PREL2 registers are not used in this mode.
The first negation of TGATE≈ is ignored, but on the second assertion of TGATE≈, the SR
TG bit is set, the SR ON bit is negated, and the prescaler and counter are disabled.
Subsequent transitions on TGATE≈ do not re-enable the counter. See Figure 8-9 for a
depiction of this mode. The SR TGL bit reflects the level of TGATE≈ at all times.
COUNTER
CLOCK
COUNTER 0 f f f f f f f f
f f f f f f f f
f f f f f f f f
f e d c b a 9 9
TGATE
If the counter counts down to the value stored in the COM register, the COM and TC bits
in the SR are set. If the counter counts down to $0000, a timeout is detected. This sets the
SR TO bit, and clears the SR COM bit. At timeout, the next falling edge of the counter
clock reloads the counter with $FFFF. TOUTx transitions at timeout or is disabled as
programmed by the OCx bits of the CR, and the OUT bit in the SR reflects the level on
TOUTx.
To determine the number of cycles counted, the value in the CNTR must be read,
inverted, and incremented by 1 (the first count is $FFFF which, in effect, includes a count
of zero). The counter counts in a true 216 fashion. For measuring pulses of even greater
duration, the value in the POx bits in the SR are readable and can be thought of as an
extension of the least significant bits in the CNTR.
NOTE
Once the timer has been enabled, do not clear the SR TG bit
until the pulse has been measured and TGATE≈ has been
negated.
COUNTER
CLOCK
COUNTER 0 f f f f f 0 0 0 0 0 0 f f
f f f f f 0 0 0 0 0 0 f f
f f f f f 0 0 0 0 0 0 f f
f e d c b 2 1 1 1 1 0 f e
TGATE
The timer is enabled by setting the SWR and CPE bits in the CR and, if TGATE≈ is
enabled (TGE bit of the CR is set), then asserting TGATE≈. When the timer is enabled,
the SR ON bit is set. On the next falling edge of the counter clock, the counter is loaded
with the value of $FFFF. With each successive falling edge of the counter clock, the
counter decrements. The PREL1 and PREL2 registers are not used in this mode.
If TGATE≈ is not enabled (CR TGE bit is cleared), then TGATE≈ does not start or stop
the timer or affect the TG bit of the SR. In this case, the counter would begin counting on
the falling edge of the counter clock immediately after the SWR and CPE bits in the CR
are set.
If TGATE≈ is enabled (CR TGE bit is set), then the assertion of TGATE≈ starts the
counter. The negation of TGATE≈ disables the counter, sets the SR TG bit, and clears the
ON bit in the SR. If TGATE≈ is reasserted, the timer resumes counting from where it was
stopped, and the ON bit is set again. Further assertions and negations of TGATE≈ have
the same effect. The TGL bit in the SR reflects the level of TGATE≈ at all times.
If the counter counts down to the value stored in the COM register, the COM and TC bits
in the SR are set. If the counter counts down to $0000, a timeout is detected. This event
sets the TO in the SR and clears the COM bit. At timeout, the next falling edge of the
counter clock reloads the counter with $FFFF. TOUTx transitions at timeout or is disabled
as programmed by the CR OC bits. The SR OUT bit reflects the level on TOUTx.
To determine the number of cycles counted, the value in the CNTR must be read,
inverted, and incremented by 1 (the first count is $FFFF which, in effect, includes a count
of zero). The counter counts in a true 216 fashion. For measuring pulses of even greater
duration, the value in the POx bits in the SR are readable and can be thought of as an
extension of the least significant bits in the CNTR.
TGATE≈ can be used as a simple input port when the CR is configured as follows:
CR
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SWR IE2 IE1 IE0 TGE PCLK CPE CLK POT2 POT1 POT0 MODE2 MODE1 MODE0 OC1 OC0
X-Don’t care
Freescale Semiconductor, Inc...
When TGATE≈ is asserted, the SR ON bit is set. When TGATE≈ is negated, the ON bit is
cleared. The value of the TGL bit in the SR reflects the level of TGATE≈. TGATE≈ can
also be used as an input port that generates interrupts on a low-to-high transition of
TGATE≈ when the CR is configured as follows:
CR
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SWR IE2 IE1 IE0 TGE PCLK CPE CLK POT2 POT1 POT0 MODE2 MODE1 MODE0 OC1 OC0
TGATE≈ AS AN INPUT/INTERRUPT
X X 1 X 1 X 1 X X X X 1 1 1 X X
When TGATE≈ is negated, the SR TG bit is set, and the programmed IRQx signal is
asserted to the CPU32. The TG bit can only be cleared by writing a one to this bit position.
The value of the SR TGL bit reflects the level of TGATE≈.
Additionally, TOUTx can be used as a simple output port when the CR is configured as
follows:
CR
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SWR IE2 IE1 IE0 TGE PCLK CPE CLK POT2 POT1 POT0 MODE2 MODE1 MODE0 OC1 OC0
SWR must be a zero to change the value of TOUTx. Changing the value of the CR OCx
bits determines the level of TOUTx as shown in Table 8-1.
A read of the SR while in this mode always shows the TO, TC, and COM bits cleared, and
the PO bits as $FF. The SR OUT bit always indicates the level on the TOUTx pin.
8.3.9.1 READ CYCLES. The timer is accessed with no wait states. The timer responds to
byte, word, and long-word reads, and 16 bits of valid data are returned. Read cycles from
reserved registers return logic zero.
8.3.9.2 WRITE CYCLES. The timer is accessed with no wait states. The timer responds to
byte, word, and long-word writes. Write cycles to read-only registers and bits as well as
reserved registers complete in a normal manner without exception processing; however,
the data is ignored.
TIMER 1 TIMER 2 FC 15 0
$600 $640 S MODULE CONFIGURATION REGISTER (MCR)
$602 $642 S RESERVED
$604 $644 S INTERRUPT REGISTER (IR)
$606 $646 S/U CONTROL REGISTER (CR)
$608 $648 S/U STATUS/PRESCALER REGISTER (SR)
$60A $64A S/U COUNTER REGISTER (CNTR)
$60C $64C S/U PRELOAD 1 REGISTER (PREL1)
$60E $64E S/U PRELOAD 2 REGISTER (PREL2)
$610 $650 S/U COMPARE REGISTER (COM)
$612-$63F $652-$67F S/U RESERVED
Freescale Semiconductor, Inc...
In the registers discussed in the following paragraphs, the numbers in the upper right-
hand corner indicate the offset of the register from the base address specified by the
module base address register (MBAR) in the SIM40. The first number is the offset for
timer 1; the second number is the offset for timer 2. The numbers on the top line of the
register represent the bit position in the register. The register contains the mnemonic for
the bit. The value of these bits after a hardware reset is shown below the register. The
access privilege is shown in the lower right-hand corner.
NOTE
A CPU32 RESET instruction will not affect the MCR, but will
reset all other registers in the timer modules as though a
hardware reset occurred.
The term 'timer' is used to reference either timer 1 or timer 2, since the two are functionally
equivalent.
RESET:
0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
Supervisor Only
STP—Stop bit
1 = Setting the STP bit stops all clocks within the timer module except for the clock
from the IMB. The clock from the IMB remains active to allow the CPU32 access
to the MCR. The clock stops on the low phase of the clock and remains stopped
until the STP bit is cleared by the CPU32 or a hardware reset. Accesses to timer
module registers while in stop mode produce a bus error. The timer module
should be disabled in a known state prior to setting the STP bit; otherwise,
unpredictable results may occur. The STP bit should be set prior to executing the
LPSTOP instruction to reduce overall power consumption.
0 = The timer operates in normal mode.
FRZ1, FRZ0—Freeze
These bits determine the action taken when the FREEZE signal is asserted on the IMB,
Freescale Semiconductor, Inc...
when the CPU32 has entered background debug mode. Table 8-2 lists the action taken
for each bit combination.
SUPV—Supervisor/User
The value of this bit has no effect on registers permanently defined as supervisor-only
access.
1 = The timer registers defined as supervisor/user reside in supervisor data space
and are only accessible from supervisor programs.
0 = The timer registers defined as supervisor/user reside in user data space and are
accessible from either supervisor or user programs.
IR $604, $644
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 IL2 IL1 IL0 IVR7 IVR6 IVR5 IVR4 IVR3 IVR2 IVR1 IVR0
RESET:
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
Supervisor Only
Bits 15–11—Reserved
Freescale Semiconductor, Inc...
CR $606, $646
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SWR IE2 IE1 IE0 TGE PCLK CPE CLK POT2 POT1 POT0 MODE2 MODE1 MODE0 OC1 OC0
RESET:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Supervisor/User
SWR—Software Reset
1 = Removes the software reset.
0 = A software reset is performed by first clearing this bit and then clearing the TO,
TG, and TC bits in the SR. The prescaler is loaded with $FF, the counter is set to
$0000, and the SR COM bit is cleared. When this bit is zero, the timer is
disabled.
IE2–IE0—Interrupt Enable
These bits determine which sources of interrupts, TO, TG, and TC, are enabled to
generate an interrupt request to the CPU32. Table 8-3 lists which interrupts are enabled
for all bit combinations.
1 1 0 TO and TG Enabled
1 1 1 TO, TG, and TC Enabled
CLK—Clock
1 = The selected clock is taken from the TINx input.
0 = The selected clock is one-half the system clock's frequency.
The TOUTx of one timer can be fed externally into the TINx input of the other timer,
resulting in a 32-bit counter if the prescalers are not used and a 48-bit counter if they
are used.
1 1 0 Divide by 64
1 1 1 Divide by 128
0 0 0 Divide by 256
MODE2–MODE0—Operation Mode
These bits select one of the eight modes of operation for the timer as listed in Table 8-5.
Refer to 8.3 Operating Modes for more information on the individual modes.
OC1–OC0—Output Control
These bits select the conditions under which TOUTx changes (see Table 8-6). These
bits may have a different effect when in the input capture/output compare mode.
Caution should be used when modifying the OC bits near timer events.
Toggle Mode—If the timer is disabled (SWR = 0) when this encoding is programmed,
TOUTx is immediately set to zero. If the timer is enabled (SWR = 1), timeout events
(counter reaches $0000) toggle TOUTx. In the input capture/output compare mode,
TOUTx is immediately set to zero if the timer is disabled (SWR = 0). If the timer is
enabled (SWR = 1), timer compare events toggle TOUTx. (Timer compare events occur
when the counter reaches the value stored in the COM.)
Zero Mode—If the timer is disabled (SWR = 0) when this encoding is programmed,
TOUTx is immediately set to zero. If the timer is enabled (SWR = 1), TOUTx will be set
to zero at the next timeout. In the input capture/output compare mode, TOUTx is
immediately set to zero if the timer is disabled (SWR = 0). If the timer is enabled (SWR
= 1), TOUTx will be set to zero at timeouts and set to one at timer compare events. If
Freescale Semiconductor, Inc...
the COM is $0000, TOUTx will be set to zero at the timeout/timer compare event.
One Mode—If the timer is disabled (SWR = 0) when this encoding is programmed,
TOUTx is immediately set to one. If the timer is enabled (SWR = 1), TOUTx will be set
to one at the next timeout. In the input capture/output compare mode, TOUTx is
immediately set to one if the timer is disabled (SWR = 0). If the timer is enabled (SWR =
1), TOUTx will be set to one at timeouts and set to zero at timer compare events. If the
COM is $0000, TOUTx will be set to one at the timeout/timer compare event.
SR $608, $648
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
IRQ TO TG TC TGL ON OUT COM PO7 PO6 PO5 PO4 PO3 PO2 PO1 PO0
Supervisor/User
TO—Timeout Interrupt
1 = The counter has transitioned from $0001 to $0000, and the counter has rolled
over. This bit does not affect the programmed IRQ≈ signal if the IE2 bit in the CR
is cleared.
0 = This bit is cleared by the timer whenever the RESET signal is asserted on the
IMB, regardless of the mode of operation. This bit may also be cleared by writing
a one to it. Writing a zero to this bit does not alter its contents. This bit is not
affected by disabling the timer (SWR = 0).
TGL—TGATE≈ Level
1 = The TGATE≈ signal is negated.
0 = The TGATE≈ signal is asserted.
ON—Counter Enabled
1 = This bit is set whenever the SWR and CPE bits are set in the CR. If the CR TGE
bit is set, TGATE≈ must also be asserted (except in the input capture/output
compare mode) since this signal then controls the enabling and disabling of the
counter. If all these conditions are met, the counter is enabled and begins
counting down.
0 = The counter is not enabled and does not begin counting down.
OUT—Output Level
1 = TOUTx is a logic one.
0 = TOUTx is a logic zero, or the pin is three-stated.
COM—Compare Bit
This bit is used to indicate when the counter output value is at or between the value in
the COM and $0000 (timeout).
1 = This bit is set when the counter output equals the value in the COM.
0 = This bit is cleared when a timeout occurs, the COM register is accessed (read or
write), the timer is reset with the SWR bit, or the RESET signal is asserted on the
IMB. This bit is cleared regardless of the state of the TC bit.
This bit can be used to indicate when a write to the PREL1 or PREL2 registers will not
cause a problem during a counter reload at timeout. To ensure that the write to the
PREL register is recognized at timeout, the latency between the read of the COM bit
and the write to the PREL register must be considered.
PO7–PO0—Prescaler Output
These bits show the levels on each of the eight output taps of the prescaler. These
values are updated every time that the system clock goes high and a read cycle of this
byte in the SR is not in progress.
Freescale Semiconductor, Inc...
CNT15 CNT14 CNT13 CNT12 CNT11 CNT10 CNT9 CNT8 CNT7 CNT6 CNT5 CNT4 CNT3 CNT2 CNT1 CNT0
RESET:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Supervisor/User
All 24 bits of the prescaler and the counter may be obtained by one long-word read at the
address of the SR, since the CNTR is contiguous to it. Any changes in the prescaler value
due to the two cycles necessary to perform a long-word read should be considered. If this
latency presents a problem, the TGATE≈ signal may be used to disable the decrement
function while the reads are occurring.
PR1-15 PR1-14 PR1-13 PR1-12 PR1-11 PR1-10 PR1-9 PR1-8 PR1-7 PR1-6 PR1-5 PR1-4 PR1-3 PR1-2 PR1-1 PR1-0
RESET:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Supervisor/User
For some modes of operation, this register is also used to reload the counter one falling
clock edge after a timeout occurs. Refer to 8.3 Operating Modes for more information on
the individual modes.
variable-width single-shot pulse generator modes. When in either of these modes, the
value in PREL1 is loaded into the counter on the first falling edge of the counter clock after
the counter is enabled. After timeout, the value in PREL2 is loaded into the counter. This
register can be be read and written when the timer module is enabled (i.e., the STP bit in
the MCR is cleared). However, a write to this register must be completed before timeout
for the new value to be reliably loaded into the counter.
PR2-15 PR2-14 PR2-13 PR2-12 PR2-11 PR2-10 PR2-9 PR2-8 PR2-7 PR2-6 PR2-5 PR2-4 PR2-3 PR2-2 PR2-1 PR2-0
RESET:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Supervisor/User
8.4.8 Compare Register (COM)
The COM can be used in any mode. When the 16-bit counter reaches the value in the
COM, the TC and COM bits in the SR are set. In the input capture/output compare mode,
a compare event can be programmed to set, clear, or toggle TOUTx. The register can be
be read and written when the timer module is enabled (i.e., the STP bit in the MCR is
cleared).
COM15 COM14 COM13 COM12 COM11 COM10 COM9 COM8 COM7 COM6 COM5 COM4 COM3 COM2 COM1 COM0
RESET:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Supervisor/User
The COM can be used to produce an interrupt when the SR TC bit has been enabled to
produce an interrupt and the counter counts down to a preselected value. The COM can
also be used to indicate that the timer is approaching timeout.
***************************************************************************
* MC68340 basic timer module register initialization example code.
* This code is used to initialize the 68340's internal timer module
Freescale Semiconductor, Inc...
***************************************************************************
***************************************************************************
* Initialize Timer1
***************************************************************************
LEA MODBASE+TIMER1,A0 Pointer to timer1 module
* Disable timer1
CLR.W CR1(A0)
* Initialize preload 1 to 3
MOVE.W #$0003,PRLD11(A0)
Freescale Semiconductor, Inc...
* Control register 1:
* Enable timer1, no interrupts are enabled, TGATE signal has no effect.
* Use the selected clock for the counter clock, and enable it.
* Selected clock is 1/2 system's freq. Square-wave generation, toggle TOUT.
MOVE.W #$8205,CR1(A0)
***************************************************************************
END
***************************************************************************
***************************************************************************
* MC68340 basic timer module register initialization example code.
* This code is used to initialize the 68340's internal timer module
* registers, providing basic functions for operation.
* It sets up timer1 for pulse-width measurement. In this mode, the number
* of clock cycles during a particular event are counted. The event is
* defined by the assertion and negation of TGATE.
***************************************************************************
***************************************************************************
* equates
***************************************************************************
MBAR EQU $0003FF00 Address of SIM40 Module Base Address Reg.
MODBASE EQU $FFFFF000 SIM40 MBAR address value
***************************************************************************
* Timer1 module equates
TIMER1 EQU $600 Offset from MBAR for timer1 module regs
MCR1 EQU $0 MCR for timer1
***************************************************************************
***************************************************************************
* Initialize Timer1
***************************************************************************
LEA MODBASE+TIMER1,A0 Pointer to timer1 module
Freescale Semiconductor, Inc...
* Disable timer1
CLR.W CR1(A0)
* Allow TGATE to negate and assert so that an accurate count will result.
* If SR1 TGL bit=1, continue looping. TGATE is negated.
LOOP1 BTST.B #$3,SR1(A0)
BNE.B LOOP1
* If TGL bit=0, continue looping. TGATE is asserted.
LOOP2 BTST.B #$3,SR1(A0)
BEQ.B LOOP2
* Control register 1:
* Enable timer1, no interrupts are enabled, TGATE signal used to control
* the counter. Use the selected clock for the counter clock, and enable it.
* Selected clock is 1/2 system's freq. Pulse-width measurement,
* disable TOUT.
MOVE.W #$8A10,CR1(A0)
END
***************************************************************************
SECTION 9
IEEE 1149.1 TEST ACCESS PORT
The MC68340 includes dedicated user-accessible test logic that is fully compatible with
the IEEE 1149.1 Standard Test Access Port and Boundary Scan Architecture. Problems
associated with testing high-density circuit boards have led to development of this
proposed standard under the sponsorship of the Test Technology Committee of IEEE and
the Joint Test Action Group (JTAG). The MC68340 implementation supports circuit-board
Freescale Semiconductor, Inc...
The test logic includes a test access port (TAP) consisting of four dedicated signal pins, a
16-state controller, an instruction register, and two test data registers. A boundary scan
register links all device signal pins into a single shift register. The test logic, implemented
using static logic design, is independent of the device system logic. The MC68340
implementation provides the following capabilities:
a. Perform boundary scan operations to test circuit-board electrical continuity
b. Sample the MC68340 system pins during operation and transparently shift
out the result in the boundary scan register
c. Bypass the MC68340 for a given circuit-board test by effectively reducing the
boundary scan register to a single bit
d. Disable the output drive to pins during circuit-board testing
NOTE
Certain precautions must be observed to ensure that the IEEE
1149.1 test logic does not interfere with nontest operation. See
9.6 Non-IEEE 1149.1 Operation for details.
9.1 OVERVIEW
NOTE
This description is not intended to be used without the
supporting IEEE 1149.1 document.
The discussion includes those items required by the standard and provides additional
information specific to the MC68340 implementation. For internal details and applications
of the standard, refer to the IEEE 1149.1 document.
An overview of the MC68340 implementation of IEEE 1149.1 is shown in Figure 9-1. The
MC68340 implementation includes a 16-state controller, a 3-bit instruction register, and
two test registers (a 1-bit bypass register and a 132-bit boundary scan register). This
implementation includes a dedicated TAP consisting of the following signals:
TCK — a test clock input to synchronize the test logic
TMS — a test mode select input (with an internal pullup resistor) that is sampled on
the rising edge of TCK to sequence the TAP controller's state machine
TDI — a test data input (with an internal pullup resistor) that is sampled on the
rising edge of TCK.
TDO — a three-state test data output that is actively driven in the shift-IR and shift-
DR controller states. TDO changes on the falling edge of TCK.
132 0
BOUNDARY SCAN REGISTER
(133 BITS)
M
TDI U
X
BYPASS
DECODER
M
U
2 0 TDO
X
TMS
TCK TAP
CTLR
TEST LOGIC
1 RESET
1 1 1
RUN-TEST/IDLE SELECT-DR_SCAN SELECT-IR_SCAN
0
0 0
1 1
CAPTURE-DR CAPTURE-IR
0
0
SHIFT-DR 0 SHIFT-IR 0
Freescale Semiconductor, Inc...
1 1
1 EXIT1-IR
EXIT1-DR
0 0
PAUSE-DR 0 PAUSE-IR 0
1 1
0 0 EXIT2-IR
EXIT2-DR
1 1
1 1
0 0
All MC68340 bidirectional pins, except the open-drain I/O pins (DONE1, DONE2, HALT,
and RESET), have a single register bit for pin data and an associated control bit in the
boundary scan register. All open drain I/O pins have two register bits, input and output, for
pin data and no associated control bit. To ensure proper operation, the open-drain pins
require external pullups. Twenty-three control bits in the boundary scan register define the
output enable signal for associated groups of bidirectional and three-state pins. The
control bits and their bit positions are listed in Table 9-1.
Boundary scan bit definitions are shown in Table 9-2. The first column in Table 9-2 defines
the bit's ordinal position in the boundary scan register. The shift register bit nearest TDO
(i.e., first to be shifted out) is defined as bit 0; the last bit to be shifted out is 131.
The second column references one of the five MC68340 cell types depicted in Figures
9-3–9-7, which describe the cell structure for each type.
The third column lists the pin name for all pin-related bits or defines the name of
bidirectional control register bits. The active level of the control bits (i.e., output driver on)
is defined by the last digit of the cell type listed for each control bit. For example, the
active-high level for irq7.ctl (bit 52) is logic zero since the cell type is IO.Ctl0. The active
level for ab.ctl (bit 83) is logic one, since the cell type is IO.Ctl1. IO.Ctl0 (see Figure 9-6)
differs from IO.Ctl1 (see Figure 9-5) by an inverter in the output enable path.
The fourth column lists the pin type: TS-Output indicates a three-state output pin, I/O
indicates a bidirectional pin, and OD-I/O denotes an open-drain bidirectional pin. An open-
drain output pin has two states: off (high impedance) and logic zero.
The last column indicates the associated boundary scan register control bit for
bidirectional, three-state, and open-drain output pins.
Bidirectional pins include a single scan bit for data (IO.Cell) as depicted in Figure 9-7.
These bits are controlled by one of the two bits shown in Figures 9-5 and 9-6. The value of
the control bit determines whether the bidirectional pin is an input or an output. One or
more bidirectional data bits can be serially connected to a control bit as shown in Figure 9-
8. Note that, when sampling the bidirectional data bits, the bit data can be interpreted only
after examining the IO control bit to determine pin direction.
1 – EXTEST TO NEXT
0 – OTHERWISE SHIFT DR CELL
G1
DATA FROM
SYSTEM 1 TO OUTPUT
LOGIC MUX BUFFER
1
G1
1
MUX 1D
Freescale Semiconductor, Inc...
1 1D
C1
C1
1 – EXTEST
0 – OTHERWISE TO NEXT
CELL
G1
INPUT
1 PIN
MUX
1
G1
1
1D 1D MUX
1
C1 C1
1 – EXTEST TO NEXT
0 – OTHERWISE CELL
G1
OUTPUT
CONTROL 1 TO OUTPUT
FROM
SYSTEM MUX ENABLE
LOGIC 1 (1 = DRIVE)
G1
1
MUX 1D
1 1D
C1
C1
Freescale Semiconductor, Inc...
1 – EXTEST TO NEXT
0 – OTHERWISE CELL
FIG. 9-4
G1
OUTPUT
CONTROL
FROM 1 TO OUTPUT
SYSTEM MUX ENABLE
LOGIC (1 = DRIVE)
1
G1
1
MUX 1D
1 1D
C1
C1
1 – EXTEST TO NEXT
0 – OTHERWISE SHIFT DR CELL
G1
OUTPUT
FROM
1 TO OUTPUT
SYSTEM DRIVER
LOGIC MUX
1
G1 G1
1 1
MUX MUX 1D
1 1 1D
C1
C1
Freescale Semiconductor, Inc...
TO NEXT CELL
OUTPUT IO.CTL0
ENABLE OR
IO.CTL1
* EN
I/O
OUTPUT PIN
DATA
IO.CELL
INPUT
DATA
TO NEXT
BIDIRECTIONAL
PIN
NOTE: More than one lO.Cell could be serially connected and controlled by a single IO.Ctlx cell.
includes a 3-bit instruction register without parity, consisting of a shift register with three
parallel outputs. Data is transferred from the shift register to the parallel outputs during the
update-IR controller state. The three bits are used to decode the four unique instructions
listed in Table 9-3.
The parallel output of the instruction register is reset to all ones in the test-logic-reset
controller state. Note that this preset state is equivalent to the BYPASS instruction.
0 0 1 SAMPLE/PRELOAD
X 1 X BYPASS
1 0 0 HI-Z
1 0 1 BYPASS
During the capture-IR controller state, the parallel inputs to the instruction shift register are
loaded with the standard 2-bit binary value (01) into the two least significant bits and the
loss-of-crystal (LOC) status signal into bit 2. The parallel outputs, however, remain
unchanged by this action since an update-IR signal is required to modify them.
The LOC status bit of the instruction register indicates whether an internal clock is
detected when operating with a crystal clock source. The LOC bit is clear when a clock is
detected and set when it is not. The LOC bit is always clear when an external clock is
used. The LOC bit can be used to detect faulty connectivity when a crystal is used to clock
the device.
By using the TAP, the register is capable of a) scanning user-defined values into the
output buffers, b) capturing values presented to input pins, c) controlling the direction of
bidirectional pins, and d) controlling the output drive of three-state output pins. For more
details on the function and uses of EXTEST, please refer to the IEEE 1149.1 document.
NOTE
Since there is no internal synchronization between the IEEE
1149.1 clock (TCK) and the system clock (CLKOUT), the user
must provide some form of external synchronization to achieve
meaningful results.
circumventing the 132-bit boundary scan register. This instruction is used to enhance test
efficiency when a component other than the MC68340 becomes the device under test.
SHIFT DR G1
0 1
MUX 1D
FROM TDI 1 TO TDO
C1
CLOCK DR
When the bypass register is selected by the current instruction, the shift-register stage is
set to a logic zero on the rising edge of TCK in the capture-DR controller state. Therefore,
the first bit to be shifted out after selecting the bypass register will always be a logic zero.
The MC68340 includes on-chip circuitry to detect the initial application of power to the
device. Power-on reset (POR), the output of this circuitry, is used to reset both the system
and IEEE 1149.1 logic. The purpose for applying POR to the IEEE 1149.1 circuitry is to
avoid the possibility of bus contention during power-on. The time required to complete
device power-on is power-supply dependent. However, the IEEE 1149.1 TAP controller
remains in the test-logic-reset state while POR is asserted. The TAP controller does not
respond to user commands until POR is negated.
The MC68340 features a low-power stop mode that uses a CPU instruction called
LPSTOP. The interaction of the IEEE 1149.1 interface with LPSTOP mode is as follows:
1. Leaving the TAP controller test-logic-reset state negates the ability to achieve
minimal power consumption, but does not otherwise affect device functionality.
2. The TCK input is not blocked in LPSTOP mode. To consume minimal power, the
Freescale Semiconductor, Inc...
SECTION 10
APPLICATIONS
This section provides guidelines for using the MC68340. Minimum system-configuration
requirements and memory interface information are discussed.
One of the powerful features of the MC68340 is the small number of external components
needed to create an entire system. The information contained in the following paragraphs
details a simple high-performance MC68340 system (see Figure 10-1). This system
configuration features the following hardware:
• Processor Clock Circuitry
• Reset Circuitry
• SRAM Interface
• ROM Interface
• Serial Interface
CLOCK SRAM
CIRCUITRY
MC68340
SERIAL ROM
INTERFACE
330 k 4.7 pF
XTAL
EXTAL
10 pF
The circuit shown in Figure 10-3 is the typical circuit recommended by Statek Corporation,
for 32768 kHz crystal, part number CX-IV. It is recommended to start with these values,
Freescale Semiconductor, Inc...
but parameter values may need to be adjusted to compensate for variables in layout.
470 k 10 pF
XTAL
EXTAL
20 pF
A separate power pin (V CCSYN ) is used to allow the clock circuits to operate with the rest
of the device powered down and to provide increased noise immunity for the clock circuits.
The source for V CCSYN should be a quiet power supply, and external bypass capacitors
(see Figure 10-4) should be placed as close as possible to the V CCSYN pin to ensure a
stable operating frequency.
Additionally, the PLL requires that an external low-leakage filter capacitor, typically in the
range of 0.01 to 0.1 µF, be connected between the XFC and VCCSYN pins. The XFC
capacitor should provide 50-MΩ insulation but should not be electrolytic. For external
clock mode without PLL, the XFC pin can be left open. Smaller values of the external filter
capacitor provide a faster response time for the PLL, and larger values provide greater
frequency stability. Figure 10-4 depicts examples of both an external filter capacitor and
bypass capacitors for V CCSYN .
VCCSYN
VCCSYN
XFC
Because it is optional, reset circuitry is not shown in Figure 10-1. The MC68340 holds
itself in reset after power-up and asserts RESET to the rest of the system. If an external
reset pushbutton switch is desired, an external reset circuit is easily constructed by using
open-collector cross-coupled NAND gates to debounce the output from the switch.
A15-A1 SIZ0
A0 UWE
AS . . . .
... ... ... ...
MCM6206-35 MCM6206-35
MC68340 R/W R/W
LWE
CE CE
E E
.. ..
R/W .. ..
D7-D0 D15-D8
D15-D0 CS
The SRAM interface shown in Figure 10-5 is a two-clock interface at 16.78-MHz operating
frequency. The MCM6206C-35 memories provide an access time of 15 ns when the chip
enable (E) input is low. If buffers are required to reduce signal loading or if slower and less
expensive memories are desired, a three-clock cycle can be used. In the circuit shown in
Figure 10-5, additional memories can be used provided the MC68340 specification for
load capacitance on the chip-select (CS≈) signal is not exceeded. (Address buffers may
be needed, however.)
MC68340
A16–A1
Freescale Semiconductor, Inc...
16-BIT
D15–D0 ROM
CS0 CE
CE
15 pF
X1
3.6864 MHz
X2
5 pF
MC68340
CONNECTOR
Rx1
RxDx R
RS 232
Tx1
TxDx T
MC145407
VCC
C1+ C2+
10 µF 10 µF
C1- C1-
VSS C2+
10 µ F 10 µ F
Freescale Semiconductor, Inc...
GND C2-
'393
CLKOUT CP Q0
Q1 DSACK0
Q2
CS0 MR Q3
The `393 is a falling edge-triggered counter; thus, CS0 is stable during the time in which it
is being clocked. CS0 acts as the asynchronous reset—i.e., when it is asserted, the `393
is allowed to count. The falling edge of S2 provides the first counting edge. Q1 does not
transition on this falling edge, but transitions to a logic one on the subsequent edge.
DSACK0 is Q1 inverted; thus, on the next falling edge, DSACK0 is seen as asserted,
indicating an 8-bit port. When CS0 is negated, Q1 is again held in reset and DSACK0 is
negated. The timing diagram in Figure 10-9 illustrates this operation.
S0 S1 S2 SW SW SW SW S3 S4 S5 S0 S1 S2
CLKOUT
CS0
Q1
DSACK0
The two time paths that are critical in an MC68340 application using the CS≈ signals are
shown in Figure 10-10. The first path is the time from address valid to when data must be
available to the processor; the second path is the time from CS≈ asserted to when data
must be available to the processor.
S0 S1 S4 S5 S0
CLKOUT
t6
A31–A0
t9
CS
t 27
t CSDV
D15–D0
t ADV
As shown in the diagram, an equation for the address access time, t ADV , can be
developed as follows:
where:
tcyc = system CLKOUT period
Nc = number of clocks per bus cycle
ts6 = CLKOUT high to address valid = 30 ns maximum at 16.78 MHz
ts27 = data-in valid to CLKOUT low setup = 5 ns minimum at 16.78 MHz
An equation for the chip select access time, tCSDV, can be developed as follows:
Using these equations, the memory access times at 16.78 MHz are shown in Table 10-1.
See Section 11 Electrical Characteristics for more timing information.
Freescale Semiconductor, Inc...
The values can be used to determine how many clock cycles an access will take, given
the access time of the memory devices and any delays through buffers or external logic
that may be needed.
CLKOUT
td
OUTPUTS
t su th
ASYNCHRONOUS
INPUTS
For outputs that are referenced to a clock edge, the propagation delay (td ) does not
change as the frequency changes. For instance, specification 6 in the electrical
characteristics, shown in Section 11 Electrical Characteristics, shows that address,
function code, and size information is valid 3 to 30 ns after the rising edge of S0. This
specification does not change even if the device frequency is less than 16.78 MHz.
Additionally, the relationship between the asynchronous inputs and the clock edge, as
shown in Figure 10-11, does not change as frequency changes.
A second type of specification indicates the minimum amount of time a signal will be
asserted. This type of specification is illustrated in Figure 10-12.
T/2 N
CLKOUT
td
OUTPUT
tw
Freescale Semiconductor, Inc...
where:
The following calculation uses a 16.78-MHz part, specification 14, AS width asserted, at
12.5 MHz as an example:
tw = 100 ns
N=3
Tf'/2 = 80/2 = 40 ns
Tf/2 = 60/2 = 30 ns
td = 30 ns maximum
therefore:
The third type of specification used is a skew between two outputs (see Figure 10-13).
T/2
CLKOUT
td1
OUTPUT1
t d2
OUTPUT2
ts
where:
ts' = the frequency-adjusted skew
ts = the skew at full speed
N = the number of full one-half clock periods in ts, if any
Tf'/2 = one-half the new clock period
Tf/2 = one-half the clock period at full speed
td1 = the propagation time for the first output from the clock edge
therefore:
In this manner, new specifications for lower frequencies can be derived for an MC68340.
DEVICE D15-D8
Freescale Semiconductor, Inc...
B
R/W T/R MEMORY
A0 74F245
MC68340
SIZ1 OE
A
SIZ0
D7-D0
During even-byte accesses, the data is transferred directly on D15–D8. However, during
odd-byte accesses, the data must be routed on D15–D8 for the 8-bit device and on D7–
D0 for the 16-bit memory.
The following figures show how different variables affect typical power consumption at
5 V. Figure 10-15 shows how system activity affects current drain. Figure 10-16 shows
how voltage affects current drain at some typical operating temperatures. Figure 10-17
shows how system clock frequency affects current drain.
120
Typical values
32KHz xtal
16.78 MHz
24 ° C
90 93
Freescale Semiconductor, Inc...
81
73
I cc (mA)
60 66
62
42
30
.06
0
INITIALIZATION MAX SERIAL +TIMER 1 +TIMER 2 +DMA +LPSTOP
CURRENT OFF OFF OFF OFF
120
0° C
24° C
100
Typical values 100° C
Icc (mA)
32KHz xtal
16.78 MHz
peak current
80
Freescale Semiconductor, Inc...
60
4 5 5.5
VCC (V)
120
90
Icc (mA)
60 Typical values
32KHz xtal
peak current
24° C
30
0
0 2 4 6 8 10 12 14 16
Pd ≈ V2 × f + dc
Table 10-2 shows typical electrical characteristics for both the MC68340 and MC68340V.
Advantage Benefit
Lower Supply Voltage Fewer Batteries
Fewer Batteries Less Weight
Smaller Size
Lower Current Drain Extended Battery Life
Less Heat Generated No Fan
No Fan Noise
Less EMF Radiation Easier FCC Certification
Less Crosstalk
Closer PCB Traces
High Functional Integration All-In-One 3.3 V Part:
Processor
Peripherals
Glue Logic
SECTION 11
ELECTRICAL CHARACTERISTICS
This section contains detailed information on power considerations, DC/AC electrical
characteristics, and AC timing specifications of the MC68340. Refer to Section 12
Ordering Information and Mechanical Data for specific part numbers corresponding to
Freescale Semiconductor, Inc...
The following ratings define a range of conditions in which the device will operate without
being damaged. However, sections of the device may not operate normally while being
exposed to the electrical extremes.
where:
TA = Ambient Temperature, °C
θJA = Package Thermal Resistance, Junction-to-Ambient, °C/W
PD = PINT + PI/O
PINT = ICC x VCC, Watts—Chip Internal Power
PI/O = Power Dissipation on Input and Output Pins—User Determined
Freescale Semiconductor, Inc...
PD = K ÷ (TJ + 273°C)
K = P D • (TA + 273°C) + θ JA • P D2
where K is a constant pertaining to the particular part. K can be determined from equation
(3) by measuring P D (at thermal equilibrium) for a known TA. Using this value of K, the
values of PD and T J can be obtained by solving Equations (1) and (2) iteratively for any
value of T A.
Note that the testing levels used to verify conformance to the AC specifications do not
affect the guaranteed DC operation of the device as specified in the DC electrical
characteristics.
The MC68340V low voltage parts can operate up to 8.39 MHz or 16.78 MHz with a 3.3 V
±0.3 V supply. Separate part numbers are used to distinguish the operation of the parts
according to the supply voltage. Refer to Section 12 Ordering Information and
Mechanical Data for the part numbering schemes. MC68340 is used throughout this
section to refer to the 16.78- or 25.16-MHz parts at 5.0 V ±5%. MC68340V is used
throughout this section to refer to the 8.39- or 16.78-MHz parts at 3.3 V ±0.3 V.
NOTE
The electrical specifications in this section for the MC68340
25.16 MHz at 5.0 V ±5% and the 3.3 V ±0.3 V specifications for
both the 8.39- and 16.78-MHz parts are preliminary.
Freescale Semiconductor, Inc...
2.0 V 2.0 V
CLKOUT
0.8 V 0.8 V
A
B
2.0 V 2.0 V
OUTPUTS(1) VALID VALID
OUTPUT n OUTPUT n+1 A
0.8 V 0.8 V
B
2.0 V 2.0 V
VALID VALID
OUTPUTS(2) OUTPUT n OUTPUT n+1
0.8 V 0.8 V
Freescale Semiconductor, Inc...
C D
2.0 V 2.0 V
VALID
INPUTS(3)
INPUT
0.8 V 0.8 V
C D
DRIVE
2.0 V 2.0 V TO 2.4 V
VALID
INPUTS(4) INPUT
0.8 V 0.8 V DRIVE
TO 0.5 V
2.0 V
ALL SIGNALS(5)
0.8 V
E
F
2.0 V
0.8 V
NOTES:
1. This output timing is applicable to all parameters specified relative to the rising edge of the clock.
2. This output timing is applicable to all parameters specified relative to the falling edge of the clock.
3. This input timing is applicable to all parameters specified relative to the rising edge of the clock.
4. This input timing is applicable to all parameters specified relative to the falling edge of the clock.
5. This timing is applicable to all parameters specified relative to the assertion/negation of another signal.
LEGEND:
A. Maximum output delay specification.
B. Minimum output hold time.
C. Minimum input setup time specification.
D. Minimum input hold time specification.
E. Signal valid to signal valid specification (maximum or minimum).
F. Signal valid to signal invalid specification (maximum or minimum).
11.5 DC ELECTRICAL SPECIFICATIONS (See notes (a), (b), (c), and (d) corresponding to part
operation, GND = 0 Vdc, TA = 0 to 70°C; see numbered notes)
10. For external clock w/PLL mode operation, the minimum CLKOUT pulse width is based on a 50% duty cycle.
11. For external clock mode, there is a 10–40 ns skew between the input clock signal and the output CLKOUT signal
from the MC68340. Clock skew is measured from the rising edges of the clock signals.
12. For external clock mode w/PLL, there is a 5 ns skew between the input clock signal and the output CLKOUT
signal from the MC68340. Clock skew is measured from the rising edges of the clock signals.
Freescale Semiconductor, Inc...
11.7 AC TIMING SPECIFICATIONS (See notes (a), (b), (c), and (d) corresponding to part operation,
GND = 0 Vdc, TA = 0 to 70°C; see numbered notes; see Figures 11-2–11-11)
3.3 V or
3.3 V 5.0 V 5.0 V
8.39 MHz 16.78 MHz 25.16 MHz
Num. Characteristic Symbol Min Max Min Max Min Max Unit
6 CLKOUT High to Address, FC, SIZ, RMC Valid t CHAV 0 60 0 30 0 20 ns
7 CLKOUT High to Address, Data, FC, SIZ, RMC t CHAZx 0 120 0 60 0 40 ns
High Impedance
8 CLKOUT High to Address, FC, SIZ, RMC t CHAZn 0 — 0 — 0 — ns
Invalid
99 CLKOUT Low to AS, DS, CS, IFETCH, IPIPE, t CLSA 3 60 3 30 3 20 ns
Freescale Semiconductor, Inc...
IACK≈ Asserted
9A2 AS to DS or CS Asserted (Read) t STSA –30 30 –15 15 –6 6 ns
11 Address, FC, SIZ, RMC Valid to AS, CS (and t AVSA 30 — 15 — 10 — ns
DS Read) Asserted
12 CLKOUT Low to AS, DS, CS, IFETCH, t CLSN 3 60 3 30 3 20 ns
IPIPE, IACK≈ Negated
13 AS, DS, CS, IACK≈ Negated to Address, FC, t SNAI 30 — 15 — 10 — ns
SIZ Invalid (Address Hold)
14 AS, CS (and DS Read) Width Asserted t SWA 200 — 100 — 70 — ns
14A DS Width Asserted (Write) t SWAW 90 — 45 — 30 — ns
14B AS, CS, IACK≈ (and DS Read) Width Asserted t SWDW 80 — 40 — 30 — ns
(Fast Termination Cycle)
153 AS, DS, CS Width Negated t SN 80 — 40 — 30 — ns
16 CLKOUT High to AS, DS, R/ W High Impedance t CHSZ — 120 — 60 — 40 ns
17 AS, DS, CS Negated to R/W High t SNRN 30 — 15 — 10 — ns
18 CLKOUT High to R/W High t CHRH 0 60 0 30 0 20 ns
20 CLKOUT High to R/W Low t CHRL 0 60 0 30 0 20 ns
219 R/ W High to AS, CS Asserted t RAAA 30 — 15 — 10 — ns
22 R/ W Low to DS Asserted (Write) t RASA 140 — 70 — 47 — ns
23 CLKOUT High to Data-Out Valid t CHDO — 60 — 30 — 20 ns
24 Data-Out Valid to Negating Edge of AS, CS, t DVASN 30 — 15 — 10 — ns
(Fast Termination Write)
25 DS, CS, Negated to Data-Out Invalid (Data-Out t SNDOI 30 — 15 — 10 — ns
Hold)
26 Data-Out Valid to DS Asserted (Write) t DVSA 30 — 15 — 10 — ns
27 Data-In Valid to CLKOUT Low (Data Setup) t DICL 10 — 5 — 5 — ns
27A Late BERR, HALT, BKPT Asserted to CLKOUT t BELCL 40 — 20 — 10 — ns
Low (Setup Time)
28 AS, DS Negated to DSACK≈, BERR, HALT t SNDN 0 160 0 80 0 50 ns
Negated
294 DS, CS Negated to Data-In Invalid (Data-In t SNDI 0 — 0 — 0 — ns
Hold)
29A4 DS, CS Negated to Data-In High Impedance t SHDI — 120 — 60 — 40 ns
(a) The electrical specifications in this document for both the 8.39 and 16.78 MHz @ 3.3 V ±0.3 V are preliminary
and apply only to the appropriate MC68340V low voltage part.
(b) The 16.78-MHz specifications apply to the MC68340 @ 5.0 V ±5% operation.
(c) The 25.16 MHz @ 5.0 V ±5% electrical specifications are preliminary.
(d) For extended temperature parts T A = –40 to +85°C. These specifications are preliminary.
1. All AC timing is shown with respect to 0.8 V and 2.0 V levels unless otherwise noted.
2. This number can be reduced to 5 ns if strobes have equal loads.
3. If multiple chip selects are used, the CS width negated (#15) applies to the time from the negation of a heavily
loaded chip select to the assertion of a lightly loaded chip select.
4. These hold times are specified with respect to DS or CS on asynchronous reads and with respect to CLKOUT on
fast termination reads. The user is free to use either hold time for fast termination reads.
5. If the asynchronous setup time (#47) requirements are satisfied, the DSACK≈ low to data setup time (#31) and
DSACK≈ low to BERR low setup time (#48) can be ignored. The data must only satisfy the data-in to CLKOUT
low setup time (#27) for the following clock cycle: BERR must only satisfy the late BERR low to CLKOUT low
setup time (#27A) for the following clock cycle.
6. To ensure coherency during every operand transfer, BG will not be asserted in response to BR until after cycles
of the current operand transfer are complete and RMC is negated.
7. In the absence of DSACK≈, BERR is an asynchronous input using the asynchronous setup time (#47).
8. Specification #47A for 16.78 MHz @ 3.3 V ±0.3V will be 8 ns.
9. During interrupt acknowledge cycles up to two wait states may be inserted by the processor between states S0
and S1.
S0 S1 S2 S3 S4 S5
CLKOUT
6 8
SIZ1–SIZ0
FC3–FC0
A31–A0
RMC
11
Freescale Semiconductor, Inc...
14
AS
9 12
13
DS
9A
CS
21 20
18
R/W
46
47A 28
DSACK0
DSACK1
29
31
D15–D0
29A
27
BERR
48 27A
HALT
9 12 12
IFETCH
47A 47B
ASYNCHRONOUS
INPUTS
27A
BKPT
NOTE: All timing is shown with respect to 0.8V and 2.0V levels.
S0 S1 S2 S3 S4 S5
CLKOUT
6 8
A31–A0
FC3–FC0
SIZ1–SIZ0
11
15
14
AS
Freescale Semiconductor, Inc...
9 12
9 13
DS
CS
20 22 14A 17
R/W
46
DSACK0
47A 28
DSACK1
55 25
53
D15–D0
23
54
26
BERR
48 27A
HALT
BKPT
NOTE: All timing is shown with respect to 0.8-V and 2.0-V levels.
S0 S1 S4 S5 S0
CLKOUT
6 8
A31–A0
Freescale Semiconductor, Inc...
FC3–FC0
SIZ1–SIZ0
9
14B
AS
12
DS
CS
18
46A
R/W
27
30
D15–D0
27A 30A
BKPT
S0 S1 S4 S5 S0
CLKOUT
6 8
A31–A0
Freescale Semiconductor, Inc...
FC3–FC0
SIZ1–SIZ0
12
AS
9
14B
DS
CS
20
46A
R/W
23 18
24
D15-D0
27A 25
BKPT
S0 S1 S2 S3 S4 S5
CLKOUT
A31–A0
7
D15–D0
Freescale Semiconductor, Inc...
AS
16
DS
R/W
DSACK0
DSACK1
47A
BR
35 39A
BG
33 34
BGACK
37
CLKOUT
A31–A0
D15–D0
AS
47A 47A
BR
35 37
Freescale Semiconductor, Inc...
BG
33 47A
34
BGACK
CLKOUT
6 8
A31–A0
18
R/W
20
AS
12
9 15
DS
72
70 71
D15–D0
27A
BKPT
S0 0–2 CLOCKS * S1 S2 S3 S4 S5
CLKOUT
6 8
SIZ1–SIZ0
FC3–FC0
Freescale Semiconductor, Inc...
A31–A0,
11 14
AS
13
9
12
DS
9A
IACKx
18 21 20
R/W
46
31A
28
DSACK0
47A
DSACK1 31
29
D15-D0
29A
27
* Up to two wait states may be inserted by the processor between states S0 and S1.
CLKOUT
FREEZE 83
82
BKPT/DSCLK
Freescale Semiconductor, Inc...
85
81
80
IFETCH/DSI
84
IPIPE/DSO
CLKOUT
86
FREEZE
87
IFETCH/DSI
88 89
11.8 DMA MODULE AC ELECTRICAL SPECIFICATIONS (See notes (a), (b), (c), and
(d) corresponding to part operation, GND = 0 Vdc, TA = 0 to 70°C; see Figure 11-12)
CPU_CYCLE
(DMA REQUEST) DMA_CYCLE
S0 S1 S2 S3 S4 S5 S0 S1 S2 S3 S4 S5
CLKOUT
4 5 1
DONE (INPUT)
DREQ 6
3 8
AS
1 2
DACK
DONE
(OUTPUT)
1
11.9 TIMER MODULE ELECTRICAL SPECIFICATIONS (See notes (a), (b), (c), and (d)
corresponding to part operation, GND = 0 Vdc, TA = 0 to 70°C; see Figures 11-13 and 11-14)
CLKOUT
2 2
TIN
TGATE
3 3
CLKOUT
4 5
TIN
6 7
TGATE
TOUT
11.10 SERIAL MODULE ELECTRICAL SPECIFICATIONS (See notes (a), (b), (c), and
(d) corresponding to part operation, GND = 0 Vdc, TA = 0 to 70°C; see numbered notes; see Figures 11-15–11-18)
3.3 V or
3.3 V 5.0 V 5.0 V
8.39 MHz 16.78 MHz 25.16 MHz
Num. Characteristic Symbol Min Max Min Max Min Max Unit
1 CLKOUT Cycle Time t cyc 119.2 — 59.6 — 40 — ns
2 Clock Rise or Fall Time t rf — 20 — 10 — 5 ns
32 Clock Input (X1 or SCLK ) Synchronizer Setup t CS 15 — 8, 5 — 5 — ns
Time
4 Clock Input (X1 or SCLK ) Synchronizer Hold t CH 30 — 15 — 8 — ns
Time
Freescale Semiconductor, Inc...
5 TxD Data Valid from CLKOUT High t VLD 0.5 t cyc Max
6 X1 Cycle Time t X1 2.25 t cyc Min
7 X1 High or Low Time t X1HL 0.55 t cyc + 0.75(tCS + t CH ) Min
8 SCLK High or Low Time, Asynchronous (16x) t AHL t cyc + t CS + t CH Min
Mode
91 SCLK High Time, Synchronous (1x) Mode t SH t cyc (Gx) + tCS (Gx) + tCH (Gx) Min
10 SCLK Low Time, Synchronous (1x) Mode t SL greater of Min
({1.5tcyc (Tx) + t CS (Tx) + t VLD (Tx)} +
0.5tcyc (Rx) + t CS (Rx) + t CH (Rx)})
or
t SH
11 TxD Data Valid from SCLK Low, Synchronous tT × D 1.5tcyc (Tx) + Max
(1x) Mode t CS (Tx) + t VLD (Tx)
12 RxD Setup Time to SCLK High, Synchronous tR × S 0.5tcyc (Rx) + t CS (Rx) + t CH (Rx) Min
(1x) Mode
13 RxD Hold Time from SCLK High, Synchronous tR × H 0.5tcyc (Rx) + t CS (Rx) + t CH (Rx) Min
(1x) Mode
NOTES:
(a) The electrical specifications in this document for both the 8.39 and 16.78 MHz @ 3.3 V ±0.3 V are preliminary
and apply only to the appropriate MC68340V low voltage part.
(b) The 16.78-MHz specifications apply to the MC68340 @ 5.0 V ±5% operation.
(c) The 25.16 MHz @ 5.0 V ±5% electrical specifications are preliminary.
(d) For extended temperature parts T A = –40 to +85°C. These specifications are preliminary.
1. Asynchronous operation numbers take into account a receiver and transmitter operating at different clock
frequencies. (Rx) refers to receiver value. (Tx) refers to transmitter value. (Gx) refers to the value that is greater,
either receiver or transmitter.
2. Specification #3 for 16.78 MHz @ 3.3 V ±0.3 V will be 8 ns.
CLKOUT
TxD
2 2
X1
7 7
2 2
SCLK (16x)
8 8
10 9
2 2
SCLK (1x)
11
TxD
13
12
RxD
11.11 IEEE 1149.1 ELECTRICAL SPECIFICATIONS ( See notes (a), (b), (c), and (d)
corresponding to part operation, GND = 0 Vdc, TA = 0 to 70°C; see Figures 11-19–11-21)
3.3 V or
3.3 V 5.0 V 5.0 V
8.39 MHz 16.78 MHz 25.16 MHz
Num. Characteristic Min Max Min Max Min Max Unit
TCK Frequency of Operation 0 8.39 0 16.78 0 25 MHz
1 TCK Cycle Time in Crystal Mode 119.2 — 59.6 — 40 — ns
2 TCK Clock Pulse Width Measured at 1.5 V 56 — 28 — 18 — ns
3 TCK Rise and Fall Times 0 10 0 5 0 3 ns
6 Boundary Scan Input Data Setup Time 32 — 16 — 10 — ns
Freescale Semiconductor, Inc...
2 2
VIH
TCK
VIL
3 3
VIH
TCK
VIL
6 7
DATA
INPUTS INPUT DATA VALID
DATA
OUTPUTS OUTPUT DATA VALID
Freescale Semiconductor, Inc...
DATA
OUTPUTS
DATA
OUTPUTS OUTPUT DATA VALID
VIH
TCLK
VIL
10 11
TDI
INPUT DATA VALID
TMS
12
13
TDO
12
SECTION 12
ORDERING INFORMATION AND MECHANICAL DATA
This section contains ordering information, pin assignments and package dimensions of
the MC68340.
Supply
Voltage Package Type Frequency (MHz) Temperature Order Number
5.0 V Ceramic Quad Flat Pack 0 – 16.78 0°C to +70°C MC68340FE16
FE Suffix 0 – 16.78 –40°C to +85°C MC68340CFE16
0 – 25 0°C to +70°C MC68340FE25
5.0 V Plastic Pin Grid Array 0 – 16.78 0°C to +70°C MC68340RP16
RP Suffix 0 – 16.78 –40°C to +85°C MC68340CRP16
0 – 25 0°C to +70°C MC68340RP25
DSACK0
DSACK1
GND
GND
GND
GND
VCC
GND
VCC
VCC
A30
D15
A25
D14
D13
D12
VCC
A29
A27
A26
D11
A31
A28
A24
D10
D4
D3
A0
D9
D8
D7
D1
D6
D2
D0
D5
144 127 126 109
RMC 1 108 CS0
R/W CS1
SIZ1 CS2
SIZ0 IRQ3
DS CS3
AS GND
BGACK VCC
Freescale Semiconductor, Inc...
BG IRQ5
BR IRQ6
BERR IRQ7
HALT DONE2
RESET DACK2
GND DREQ2
CLKOUT DONE1
VCC DACK1
XFC DREQ1
VCC X1
EXTAL 18 TOP VIEW 91 GND
VCCSYN 19 MC68340 90 VCC
XTAL X2
GND SCLK
MODCK CTSB
VCC RTSB
IPIPE TxDB
IFETCH RxDB
BKPT RxRDYA
FREEZE TxRDYA
TIN1 CTSA
TOUT1 RTSA
TGATE1 GND
TCK VCC
TMS TxDA
.
TDI RxDA
TDO TIN2
VCC TOUT2
GND 36 73 TGATE2
37 54 55 72
GND
GND
GND
GND
FC2
FC1
GND
FC0
A6
A17
FC3
A15
A22
A9
A21
A7
A20
VCC
A19
VCC
A11
VCC
VCC
A4
A3
A5
A10
A2
A1
A16
A12
A23
A14
A13
A8
A18
The VCC and GND pins are separated into groups to help electrically isolate the output
drivers for different functions of the MC68340. These groups are shown in the following
table for the FE suffix package.
Q
FC1 FC3 TDI TCK TIN1 FREEZE IPIPE MODCK EXTAL XFC RESET BERR BR AS SIZ1
P
A23 FC2 TDO TMS TOUT1 BKPT V CC XTAL VCC CLKOUT HALT BGACK DS R/W RMC
N
A22 FC0 GND VCC TGATE1 IFETCH GND VCCSYN V CC
. GND BG SIZ0 GND DSACK1 DSACK0
M
A20 GND VCC VCC A0 A3O
L
A18 A19 A21 A31 A29 A28
Freescale Semiconductor, Inc...
K
A16 A17 VCC GND VCC A27
J
A14 A15 GND A25 A24 A26
H BOTTOM
VIEW GND D14 D15
A12 A13 GND
G
A11 GND VCC GND D12 D13
F
A10 A9 A8 VCC D11 D10
E
A7 A6 A5 D7 D8 D9
D
A4 VCC GND NC GND D5 D6
C
A3 A2 TGATE2 V CC GND TxDB V CC GND DACK1 IRQ7 GND CS2 D1 VCC D4
B
A1 TOUT2 TxDA RTSA TxRDYA RTSB X2 X1 DONE1 DONE2 VCC CS3 CS1 D0 D3
A
TIN2 RxDA CTSA RxRDYA RxDB CTSB SCLK DREQ1 DREQ2 DACK2 IRQ6 IRQ5 IRQ3 CS0 D2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
The V CC and GND pins are separated into groups to help electrically isolate the different
output drivers of the MC68340. These groups are shown in the following table for the RP
suffix package.
FE SUFFIX PACKAG X
CERAMIC QFP
CASE 863A-01
PIN ONE INDEN
TOP VIEW
TRIMMED, FORMED DISCRET
SHOWING DATUM FEATUR
Freescale Semiconductor, Inc...
A/B
Q K
0.50M T X Y S Z S Y
S
M
C
J
M
W
∩ 0.10144X
T SEATING PLANE
H D 144X G
0.20M T X-Y ZS
0.20M T Z S X-Y S
12.3.2 RP Suffix
C
B
A
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
B PIN L
A-1
M 145 PL
K
MILLIMETERS INCHES
DIM MIN MAX MIN MAX
A 39.37 39.88 1.550 1.570
B 39.37 39.88 1.550 1.570
C 22.75 22.97 0.895 0.905
D 22.75 22.97 0.895 0.905
G 2.54 BASIC 0.100 BASIC
K 2.92 3.43 0.115 0.135
L 1.02 1.52 0.040 0.060
M 0.43 0.55 0.017 0.022
S 4.32 4.95 0.170 0.195
V 35.56 BASIC 1.400 BASIC
.. . . .
INDEX
During DMA Transfers, 6-18, 6-20, 6-31, Compare Register, 8-2, 8-12, 8-26–8-27
6-33–6-35 Compressed Tables, 5-31–5-32
Grant Acknowledge Signal, 3-40–3-44 Condition Code Register, 5-10, 5-14, 5-20–5-21
Request Signal, 2-7, 3-37, 3-40–3-44, 6-25 Condition Codes, 5-10, 5-26–5-27
State Diagram, 3-45 Condition Test Instructions, 5-20–5-21, 5-29
Bypass Register, 9-11 Conditional Branch Instruction Timing Table, 5-110
Byte CONF Bit, 6-20, 6-30–6-31, 6-37–6-38
Transfer Counter, 6-15, 6-19–6-20, 6-34–6-35, Configuration Code (Modules)
6-37–6-38 SIM40, 4-38–4-40
DMA, 6-38–6-45
Serial, 7-47–4-49
— C — Timer, 8-28–8-31
Control Instruction Timing Table, 5-111
Calculate Effective Address Instruction Timing Table, Control Register, 8-4, 8-20–8-23
5-100 COS Bit, 7-31–7-32, 7-34
Calculating Frequency Adjusted Output, 10-7,–10-9 Counter
CALL Command, 5-68, 5-84–5-85 Clock, 8-3
Freescale Semiconductor, Inc...
Fetch Effective Address Instruction Timing Table, 5-99 IL Bits, 7-21, 7-46, 8-20, 8-27
FFULL Bit, 7-25 IMB, 6-19, 7-1, 8-1
FFULLA Signal, 7-7 Immediate Arithmetic/Logical Instruction Timing
Fill Memory Block Command, 5-82 Table, 5-105
FIRQ Bit, 4-5, 4-16, 4-22, 4-35–4-36 IN Bit, 5-53, 5-56, 5-61
FORCE_BGND, 5-72 Input Port, 7-35
Format Error Exception, 5-47, 5-52 Change Register, 7-31
Four-Word Stack Frame, 5-51, 5-60 Instruction
Framing Error, 7-11, 7-24 Cycles, 5-97
Freeze Operation, 4-17, 6-24, 7-20, 8-19 Execution Overlap, 5-91–5-92, 5-94–5-95
FREEZE Signal, 2-10, 4-3, 4-17, 4-22–4-23, 4-36, Execution Time Calculation, 5-92–5-93
5-66–5-68, 5-71–5-72 Fetch Signal, 2-19
Frequency Adjusted Signal Heads, 5-91–5-94, 5-97
Skew, 10-9 Pipe Signal, 2-10
Width, 10-8 Pipeline Operation, 5-89–5-90, 5-93
Frequency Divider, 4-12 Register, 9-9–9-10
FRZ Bits, 4-17–4-18, 4-21–4-22, 4-36, 6-24, 7-20, Stream Timing Examples, 5-94–5-97
Freescale Semiconductor, Inc...
— J — — N —
Pin Assignment Register 1, 4-15, 4-33, 4-37 Read-Modify-Write Signal, 2-8, 3-19–3-21, 3-40,
Pin Assignment Register 2, 4-15, 4-34, 4-37 3-42–3-43, 3-45
Pins Read/Write Signal, 2-7, 3-2
Functions, 4-15 Real-Time Clock, 4-9
Assignment Encoding, 4-15, 4-34 Receive Data Signal, 2-11
Port B Received Break, 7-11, 7-24, 7-33
Configuration, 4-5, 4-16 Receiver, 7-9, 7-11
Data Direction Register, 4-35 Baud Rates, 7-26
Data Register, 4-35 Buffer, 7-11–7-12, 7-25, 7-30
Functions, 4-16 Disable Command, 7-30
Pin Assignment Register, 4-16, 4-35, 4-37 Enable Command, 7-30
Pins FIFO, 7-12–7-13, 7-17, 7-22–7-23, 7-25, 7-33–7-34
Functions, 2-6, 2-9, 4-16 Holding Registers, 7-9, 7-11
Pin Assignment Encoding, 4-16, 4-35 Ready Signal, 2-12
Port Size, 4-14, 6-31 Shift Register, 7-9, 7-12
Port Width, 3-1, 3-7 Timing, 7-12
POT Bits, 8-22, 8-28 Register
Freescale Semiconductor, Inc...
R≈RDYA Signal, 7-7, 7-36 Interrupt Vector Register, 4-7, 4-24, 4-36
RxRDYB Bit, 7-33, 7-35 Operation, 4-4, 4-6, 4-17, 4-27
RxRTS Bit, 7-22, 7-47 Service Register, 4-7, 4-28
Service Routine, 4-7, 4-25
Timeout, 4-25
— S — Watchdog, 4-1, 4-4, 4-6
Watchdog Clock Rate, 4-7
S/D Bit, 6-30, 6-37 Source Address Register, 6-7, 6-12, 6-18–6-19,
SAPI Bits, 6-12, 6-19, 6-28, 6-37 6-28, 6-33, 6-37, 6-38
Save and Restore Operations Timing Table, 5-113 Special Status Word, 5-45, 5-52
SB Bits, 7-39, 7-47 Special-Purpose MOVE Instruction Timing Table,
SCLK Signal, 7-3, 7-6, 7-8, 7-20 5-101–5-102
SE Bit, 6-25, 6-36 Spurious Interrupt, 3-29
Selected Clock, 8-3, 8-21 Monitor, 4-1, 4-4, 4-6, 4-17,
Serial Square-Wave Generation, 8-6, 8-8–8-9
Clock Signal, 2-11 SRAM Interface, 10-3
Command Control, 7-27 SSIZE Bits, 6-12, 6-19, 6-29, 6-37
Freescale Semiconductor, Inc...
— Y —
— Z —