The MC68331, a highly-integrated 32-bit microcontroller, combines high-performance data manipulation capabilities with powerful peripheral subsystems. The MCU is built up from standard modules that
interface through a common intermodule bus (IMB). Standardization facilitates rapid development of
devices tailored for specific applications.
Freescale Semiconductor, Inc.
Order this document
by MC68331TS/D Rev. 2
MC68331
..
.
nc
The MCU incorporates a 32-bit CPU (CPU32), a system integration module (SIM), a general-purpose
timer (GPT), and a queued serial module (QSM).
The MCU can either synthesize an internal clock signal from an external reference or use an external
clock input directly. Operation with a 32.768-kHz reference frequency is standard. The maximum system clock speed is 20.97 MHz. Because MCU operation is fully static, register and memory contents
are not affected by a loss of clock.
High-density complementary metal-oxide semiconductor (HCMOS) architecture makes the basic power
consumption of the MCU low. Power consumption can be minimized by stopping the system clock. The
CPU32 instruction set includes a low-power stop (LPSTOP) command that efficiently implements this
capability.
Freescale Semiconductor, I
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Table 1 Ordering Information
..
.
nc
Package TypeTemperatureFrequency
(MHz)
132-Pin PQFP–40 to +85 ° C16 MHz2 pc traySPAKMC331CFC16
20 MHz2 pc traySPAKMC331CFC20
–40 to +105 ° C16 MHz2 pc traySPAKMC331VFC16
20 MHz2 pc traySPAKMC331VFC20
–40 to +125 ° C16 MHz2 pc traySPAKMC331MFC16
20 MHz2 pc traySPAKMC331MFC20
144-Pin QFP–40 to +85 ° C16 MHz2 pc traySPAKMC331CFV16
• Central Processing Unit (CPU32)
— Upward Object Code Compatible
— New Instructions for Controller Applications
— 32-Bit Architecture
— Virtual Memory Implementation
— Loop Mode of Instruction Execution
— Table Lookup and Interpolate Instruction
— Improved Exception Handling for Controller Applications
— Trace on Change of Flow
— Hardware Breakpoint Signal, Background Mode
— Fully Static Operation
• System Integration Module (SIM)
— External Bus Support
— Programmable Chip-Select Outputs
— System Protection Logic
— Watchdog Timer, Clock Monitor, and Bus Monitor
— System Protection Logic
— System Clock Based on 32.768-kHz Crystal for Low Power Operation
— Test/Debug Submodule for Factory/User Test and Development
• Queued Serial Module (QSM)
— Enhanced Serial Communication Interface (SCI), Universal Asynchronous Receiver Transmit-
— Queued Serial Peripheral Interface (QSPI): 80-Byte RAM, Up to 16 Automatic Transfers
— Dual Function I/O Ports
— Continuous Cycling, 8 to 16 Bits per Transfer
• General-Purpose Timer (GPT)
— Two 16-Bit Free-Running Counters With One Nine-Stage Prescaler
— Three Input Capture Channels
— Four Output Compare Channels
— One Input Capture/Output Compare Channel
— One Pulse Accumulator/Event Counter Input
— Two Pulse-Width Modulation Outputs
— Optional External Clock Input
The following figure is a map of the MCU internal addresses. Unimplemented blocks are mapped externally.
$YFF000
$YFF900
$YFF93F
GPT
..
.
nc
Freescale Semiconductor, I
$YFFA00
SIM
$YFFA7F
$YFFA80
$YFFAFF
$YFFC00
$YFFDFF
$YFFFFF
1.5 Intermodule Bus
The intermodule bus (IMB) is a standardized bus developed to facilitate both design and operation of
modular microcontrollers. It contains circuitry to support exception processing, address space partitioning, multiple interrupt levels, and vectored interrupts. The standardized modules in the MCU communicate with one another and with external components through the IMB. The IMB in the MCU uses 24
address and 16 data lines.
RESERVED
QSM
331 ADDRESS MAP
Figure 4 MCU Address Map
8MC68331TS/D
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
2 Signal Descriptions
2.1 Pin Characteristics
The following table shows MCU pins and their characteristics. All inputs detect CMOS logic levels. All
inputs can be put in a high-impedance state, but the method of doing this differs depending upon pin
function. Refer to Table 4 , for a description of output drivers. An entry in the discrete I/O column of Ta-
ble 2 indicates that a pin has an alternate I/O function. The port designation is given when it applies.
Refer to the MCU Block Diagram for information about port organization.
Address BusADDR[23:0]24-bit address bus
Address StrobeAS
AutovectorAVEC
Bus ErrorBERR
Bus GrantBG
Bus Grant AcknowledgeBGACK
BreakpointBKPT
Bus RequestBR
System ClockoutCLKOUTSystem clock output
Chip SelectsCS[10:0]
Table 6 MCU Signal Function
Indicates that a valid address is on the address bus
Requests an automatic vector during interrupt acknowledge
Indicates that a bus error has occurred
Indicates that the MCU has relinquished the bus
Indicates that an external device has assumed bus mastership
Signals a hardware breakpoint to the CPU
Indicates that an external device requires bus mastership
Select external devices at programmed addresses
MC68331TS/D11
For More Information On This Product,
Go to: www.freescale.com
..
.
nc
Freescale Semiconductor, I
Freescale Semiconductor, Inc.
Table 6 MCU Signal Function (Continued)
Signal NameMnemonicFunction
Boot Chip SelectCSBOOT
Data BusDATA[15:0]16-bit data bus
Data StrobeDS
Data and Size AcknowledgeDSACK[1:0]
Development Serial In, Out,
Clock
Crystal OscillatorEXTAL, XTAL Connections for clock synthesizer circuit reference;
Function CodesFC[2:0]Identify processor state and current address space
FreezeFREEZEIndicates that the CPU has entered background mode
HaltHALT
Input CaptureIC[3:1]When a specified transition is detected on an input capture pin, the
Input Capture 4/Output Compare 5IC4/OC5Can be configured for either an input capture or output compare
Instruction Pipeline IPIPE
Interrupt Request LevelIRQ[7:1]
Master In Slave OutMISOSerial input to QSPI in master mode;
Clock Mode SelectMODCLKSelects the source and type of system clock
Master Out Slave InMOSISerial output from QSPI in master mode;
Output CompareOC[5:1]Change state when the value of an internal GPT counter matches
Pulse Accumulator InputPAISignal input to the pulse accumulator
Port CPC[6:0]SIM digital output port signals
Auxiliary Timer Clock InputPCLKExternal clock dedicated to the GPT
Peripheral Chip SelectPCS[3:0]QSPI peripheral chip selects
Port EPE[7:0]SIM digital I/O port signals
Port FPF[7:0]SIM digital I/O port signals
Port QSPQS[7:0]QSM digital I/O port signals
Pulse-Width ModulationPWMA, PWMB Output for PWM
Quotient OutQUOTProvides the quotient bit of the polynomial divider
ResetRESET
Read-Modify-Write CycleRMC
Read/WriteR/W
SCI Receive DataRXDSerial input to the SCI
QSPI Serial ClockSCKClock output from QSPI in master mode;
SizeSIZ[1:0]Indicates the number of bytes to be transferred during a bus cycle
Slave SelectSS
Three-State ControlTSCPlaces all output drivers in a high-impedance state
SCI Transmit DataTXDSerial output from the SCI
External Filter CapacitorXFCConnection for external phase-locked loop filter capacitor
Chip select for external boot startup ROM
During a read cycle, indicates when it is possible for an external
device to place data on the data bus. During a write cycle, indicates that valid data is on the data bus.
Provide asynchronous data transfers and dynamic bus sizing
DSI, DSO,
DSCLK
, IFETCH Indicate instruction pipeline activity
Serial I/O and clock for background debugging mode
a crystal or an external oscillator can be used
Suspend external bus activity
value in an internal GPT counter is latched
Provides an interrupt priority level to the CPU
serial output from QSPI in slave mode
serial input to QSPI in slave mode
a value stored in a GPT control register
System reset
Indicates an indivisible read-modify-write instruction
Indicates the direction of data transfer on the bus
clock input to QSPI in slave mode
Causes serial transmission when QSPI is in slave mode;
causes mode fault in master mode
12MC68331TS/D
For More Information On This Product,
Go to: www.freescale.com
..
.
nc
Freescale Semiconductor, Inc.
Freescale Semiconductor, I
MC68331TS/D13
For More Information On This Product,
Go to: www.freescale.com
..
.
nc
Freescale Semiconductor, Inc.
3 System Integration Module
The system integration module (SIM) consists of five functional blocks that control system start-up, initialization, configuration, and external bus.
SYSTEM CONFIGURATION
XTAL
CLOCK SYNTHESIZER
SYSTEM PROTECTION
CHIP SELECTS
CLKOUT
EXTAL
MODCLK
CHIP SELECTS
EXTERNAL BUS
EXTERNAL BUS INTERFACE
RESET
FACTORY TEST
Figure 5 SIM Block Diagram
3.1 Overview
The system configuration and protection block controls MCU configuration and operating mode. The
block also provides bus and software watchdog monitors.
The system clock generates clock signals used by the SIM, other IMB modules, and external devices.
In addition, a periodic interrupt generator supports execution of time-critical control routines.
The external bus interface handles the transfer of information between IMB modules and external address space.
TSC
FREEZE/QUOT
300 S(C)IM BLOCK
Freescale Semiconductor, I
The chip-select block provides eleven general-purpose chip-select signals and a boot ROM chip-select
signal. Both general-purpose and boot ROM chip-select signals have associated base address registers and option registers.
The system test block incorporates hardware necessary for testing the MCU. It is used to perform factory tests, and its use in normal applications is not supported.
The SIM control register address map occupies 128 bytes. Unused registers within the 128-byte address space return zeros when read. The “Access” column in the SIM address map below indicates
which registers are accessible only at the supervisor privilege level and which can be assigned to either
the supervisor or user privilege level, according to the value of the SUPV bit in the SIMCR.
14MC68331TS/D
For More Information On This Product,
Go to: www.freescale.com
..
.
nc
Freescale Semiconductor, I
Freescale Semiconductor, Inc.
AccessAddress158 70
S$YFFA00SIM CONFIGURATION (SIMCR)
S$YFFA02FACTORY TEST (SIMTR)
S$YFFA04CLOCK SYNTHESIZER CONTROL (SYNCR)
S$YFFA06NOT USEDRESET STATUS REGISTER (RSR)
S$YFFA08MODULE TEST E (SIMTRE)
S$YFFA0ANOT USEDNOT USED
S$YFFA0CNOT USEDNOT USED
S$YFFA0ENOT USEDNOT USED
S/U$YFFA10NOT USEDPORT E DATA (PORTE0)
S/U$YFFA12NOT USEDPORT E DATA (PORTE1)
S/U$YFFA14NOT USEDPORT E DATA DIRECTION (DDRE)
S$YFFA16NOT USEDPORT E PIN ASSIGNMENT (PEPAR)
S/U$YFFA18NOT USEDPORT F DATA (PORTF0)
S/U$YFFA1ANOT USEDPORT F DATA (PORTF1)
S/U$YFFA1CNOT USEDPORT F DATA DIRECTION (DDRF)
S$YFFA1ENOT USEDPORT F PIN ASSIGNMENT (PFPAR)
S$YFFA20NOT USEDSYSTEM PROTECTION CONTROL
S$YFFA22PERIODIC INTERRUPT CONTROL (PICR)
S$YFFA24PERIODIC INTERRUPT TIMING (PITR)
S$YFFA26NOT USEDSOFTWARE SERVICE (SWSR)
S$YFFA28NOT USEDNOT USED
S$YFFA2ANOT USEDNOT USED
S$YFFA2CNOT USEDNOT USED
S$YFFA2ENOT USEDNOT USED
S$YFFA30TEST MODULE MASTER SHIFT A (TSTMSRA)
S$YFFA32TEST MODULE MASTER SHIFT B (TSTMSRB)
S$YFFA34TEST MODULE SHIFT COUNT (TSTSC)
S$YFFA36TEST MODULE REPETITION COUNTER (TSTRC)
S$YFFA38TEST MODULE CONTROL (CREG)
S/U$YFFA3ATEST MODULE DISTRIBUTED REGISTER (DREG)
$YFFA3CNOT USEDNOT USED
$YFFA3ENOT USEDNOT USED
S/U$YFFA40NOT USEDPORT C DATA (PORTC)
$YFFA42NOT USEDNOT USED
S$YFFA44CHIP-SELECT PIN ASSIGNMENT (CSPAR0)
S$YFFA46CHIP-SELECT PIN ASSIGNMENT (CSPAR1)
S$YFFA48CHIP-SELECT BASE BOOT (CSBARBT)
S$YFFA4ACHIP-SELECT OPTION BOOT (CSORBT)
S$YFFA4CCHIP-SELECT BASE 0 (CSBAR0)
S$YFFA4ECHIP-SELECT OPTION 0 (CSOR0)
S$YFFA50CHIP-SELECT BASE 1 (CSBAR1)
S$YFFA52CHIP-SELECT OPTION 1 (CSOR1)
S$YFFA54CHIP-SELECT BASE 2 (CSBAR2)
S$YFFA56CHIP-SELECT OPTION 2 (CSOR2)
S$YFFA58CHIP-SELECT BASE 3 (CSBAR3)
S$YFFA5ACHIP-SELECT OPTION 3 (CSOR3)
S$YFFA5CCHIP-SELECT BASE 4 (CSBAR4)
Table 7 SIM Address Map
(SYPCR)
MC68331TS/D15
For More Information On This Product,
Go to: www.freescale.com
..
.
nc
Freescale Semiconductor, Inc.
AccessAddress158 70
S$YFFA5ECHIP-SELECT OPTION 4 (CSOR4)
S$YFFA60CHIP-SELECT BASE 5 (CSBAR5)
S$YFFA62CHIP-SELECT OPTION 5 (CSOR5)
S$YFFA64CHIP-SELECT BASE 6 (CSBAR6)
S$YFFA66CHIP-SELECT OPTION 6 (CSOR6)
S$YFFA68CHIP-SELECT BASE 7 (CSBAR7)
S$YFFA6ACHIP-SELECT OPTION 7 (CSOR7)
S$YFFA6CCHIP-SELECT BASE 8 (CSBAR8)
S$YFFA6ECHIP-SELECT OPTION 8 (CSOR8)
S$YFFA70CHIP-SELECT BASE 9 (CSBAR9)
S$YFFA72CHIP-SELECT OPTION 9 (CSOR9)
S$YFFA74CHIP-SELECT BASE 10 (CSBAR10)
S$YFFA76CHIP-SELECT OPTION 10 (CSOR10)
$YFFA78NOT USED NOT USED
$YFFA7ANOT USEDNOT USED
$YFFA7CNOT USEDNOT USED
$YFFA7ENOT USEDNOT USED
Y = M111, where M is the logic state of the module mapping (MM) bit in the SIMCR.
Table 7 SIM Address Map (Continued)
3.2 System Configuration and Protection
This functional block provides configuration control for the entire MCU. It also performs interrupt arbitration, bus monitoring, and system test functions. MCU system protection includes a bus monitor, a
HALT monitor, a spurious interrupt monitor, and a software watchdog timer. These functions have been
made integral to the microcontroller to reduce the number of external components in a complete control
system.
Freescale Semiconductor, I
16MC68331TS/D
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
RESET STATUS
..
.
nc
Freescale Semiconductor, I
HALT MONITOR
BUS MONITOR
SPURIOUS INTERRUPT MONITOR
CLOCK
PRESCALER
9
2
Figure 6 System Configuration and Protection Block
3.2.1 System Configuration
The SIM controls MCU configuration during normal operation and during internal testing.
SIMCR —SIM Configuration Register
15
EXOFFFRZSW FRZBM0SLVEN0SHENSUPVMM00IARB
RESET:
0000DATA1100011001111
EXOFF —External Clock Off
141312111098765430
The SIM configuration register controls system configuration. It can be read or written at any time, except for the module mapping (MM) bit, which can be written only once.
0 = The CLKOUT pin is driven from an internal clock source.
1 = The CLKOUT pin is placed in a high-impedance state.
SOFTWARE WATCHDOG TIMER
PERIODIC INTERRUPT TIMER
RESET REQUEST
BERR
RESET REQUEST
IRQ[7:1]
300 SYS PROTECT BLOCK
$YFFA00
FRZSW —Freeze Software Enable
0 = When FREEZE is asserted, the software watchdog and periodic interrupt timer counters con-
tinue to run.
1 = When FREEZE is asserted, the software watchdog and periodic interrupt timer counters are dis-
abled, preventing interrupts during software debug.
FRZBM —Freeze Bus Monitor Enable
0 = When FREEZE is asserted, the bus monitor continues to operate.
1 = When FREEZE is asserted, the bus monitor is disabled.
MC68331TS/D17
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
SLVEN —Factory Test Mode Enabled
This bit is a read-only status bit that reflects the state of DATA11 during reset.
0 = IMB is not available to an external master.
1 = An external bus master has direct access to the IMB.
SHEN[1:0] —Show Cycle Enable
This field determines what the EBI does with the external bus during internal transfer operations. A
show cycle allows internal transfers to be externally monitored. The table below shows whether show
cycle data is driven externally, and whether external bus arbitration can occur. To prevent bus conflict,
external peripherals must not be enabled during show cycles.
The SUPV bit places the SIM global registers in either supervisor or user data space.
0 = Registers with access controlled by the SUPV bit are accessible from either the user or super-
visor privilege level.
1 = Registers with access controlled by the SUPV bit are restricted to supervisor access only.
MM —Module Mapping
0 = Internal modules are addressed from $7FF000 –$7FFFFF.
1 = Internal modules are addressed from $FFF000 –$FFFFFF.
IARB[3:0] —Interrupt Arbitration Field
Each module that can generate interrupt requests has an interrupt arbitration (IARB) field. Arbitration
between interrupt requests of the same priority is performed by serial contention between IARB field bit
values. Contention must take place whenever an interrupt request is acknowledged, even when there
is only a single pending request. An IARB field must have a non-zero value for contention to take place.
If an interrupt request from a module with an IARB field value of %0000 is recognized, the CPU processes a spurious interrupt exception. Because the SIM routes external interrupt requests to the CPU,
the SIM IARB field value is used for arbitration between internal and external interrupts of the same priority. The reset value of IARB for the SIM is %1111, and the reset IARB value for all other modules is
%0000, which prevents SIM interrupts from being discarded during initialization.
3.2.2 System Protection Control Register
The system protection control register controls system monitor functions, software watchdog clock
prescaling, and bus monitor timing. This register can be written only once following power-on or reset,
but can be read at any time.
This bit controls the value of the software watchdog prescaler.
0 = Software watchdog clock not prescaled
1 = Software watchdog clock prescaled by 512
SWT[1:0] —Software Watchdog Timing
This field selects the divide ratio used to establish software watchdog time-out period. The following table gives the ratio for each combination of SWP and SWT bits.
SWPSWT Ratio
000
001
010
011
100
101
110
111
9
2
11
2
13
2
15
2
18
2
20
2
22
2
24
2
HME —Halt Monitor Enable
0 = Disable halt monitor function
1 = Enable halt monitor function
BME —Bus Monitor External Enable
0 = Disable bus monitor function for an internal to external bus cycle.
1 = Enable bus monitor function for an internal to external bus cycle.
BMT[1:0] —Bus Monitor Timing
This field selects a bus monitor time-out period as shown in the following table.
BMT Bus Monitor Time-out Period
0064 System Clocks
0132 System Clocks
1016 System Clocks
118 System Clocks
3.2.3 Bus Monitor
The internal bus monitor checks for excessively long DSACK
and for excessively long DSACK or AVEC response times during interrupt acknowledge cycles. The
Freescale Semiconductor, I
monitor asserts BERR if response time is excessive.
DSACK and AVEC response times are measured in clock cycles. The maximum allowable response
time can be selected by setting the BMT field.
response times during normal bus cycles
The monitor does not check DSACK response on the external bus unless the CPU initiates the bus cycle. The BME bit in the SYPCR enables the internal bus monitor for internal to external bus cycles. If a
system contains external bus masters, an external bus monitor must be implemented and the internal
to external bus monitor option must be disabled.
3.2.4 Halt Monitor
The halt monitor responds to an assertion of HALT on the internal bus. A flag in the reset status register
(RSR) indicates that the last reset was caused by the halt monitor. The halt monitor reset can be inhibited by the HME bit in the SYPCR.
MC68331TS/D19
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
3.2.5 Spurious Interrupt Monitor
The spurious interrupt monitor issues BERR
knowledge cycle.
3.2.6 Software Watchdog
The software watchdog is controlled by SWE in the SYPCR. Once enabled, the watchdog requires that
a service sequence be written to SWSR on a periodic basis. If servicing does not take place, the watchdog times out and issues a reset. This register can be written at any time, but returns zeros when read.
if no interrupt arbitration occurs during an interrupt-ac-
..
.
nc
Freescale Semiconductor, I
SWSR —Software Service Register
15
NOT USED00000000
RESET:
Register shown with read value
Perform a software watchdog service sequence as follows:
1.Write $55 to SWSR.
2.Write $AA to SWSR.
Both writes must occur before time-out in the order listed, but any number of instructions can be executed between the two writes.
The watchdog clock rate is affected by SWP and SWT in SYPCR. When SWT[1:0] are modified, a
watchdog service sequence must be performed before the new time-out period takes effect.
The reset value of SWP is affected by the state of the MODCLK pin on the rising edge of reset, as shown
in the following table.
MODCLKSWP
3.2.7 Periodic Interrupt Timer
The periodic interrupt timer (PIT) generates interrupts of specified priorities at specified intervals. Timing
for the PIT is provided by a programmable prescaler driven by the system clock.
PICR — Periodic Interrupt Control Register
15
00000PIRQLPIV
RESET:
0000000000001111
1413121110870
This register contains information concerning periodic interrupt priority and vectoring. Bits [10:0] can be
read or written at any time. Bits [15:11] are unimplemented and always return zero.
876543210
00000000
01
10
$YFFA27
$YFFA22
PIRQL[2:0] —Periodic Interrupt Request Level
The following table shows what interrupt request level is asserted when a periodic interrupt is generated. If a PIT interrupt and an external IRQ
terrupt is serviced first. The periodic timer continues to run when the interrupt is disabled.
signal of the same priority occur simultaneously, the PIT in-
20MC68331TS/D
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
PIV[7:0] —Periodic Interrupt Vector
The bits of this field contain the vector generated in response to an interrupt from the periodic timer.
When the SIM responds, the periodic interrupt vector is placed on the bus.
The PITR contains the count value for the periodic timer. A zero value turns off the periodic timer. This
register can be read or written at any time.
PTP —Periodic Timer Prescaler Control
0 = Periodic timer clock not prescaled
1 = Periodic timer clock prescaled by a value of 512
The reset state of PTP is the complement of the state of the MODCLK signal during reset.
PITM[7:0] —Periodic Interrupt Timing Modulus Field
This is an 8-bit timing modulus. The period of the timer can be calculated as follows:
PIT Period = [(PITM)(Prescaler)(4)]/EXTAL
where
PIT Period = Periodic interrupt timer period
PITM = Periodic interrupt timer register modulus (PITR[7:0])
EXTAL Frequency = Crystal frequency
Prescale = 512 or 1 depending on the state of the PTP bit in the PITR
3.3 System Clock
The system clock in the SIM provides timing signals for the IMB modules and for an external peripheral
bus. Because MCU operation is fully static, register and memory contents are not affected when the
clock rate changes. System hardware and software support changes in the clock rate during operation.
The system clock signal can be generated in three ways. An internal phase-locked loop can synthesize
the clock from an internal or external frequency source, or the clock signal can be input from an external
source.
Following is a block diagram of the clock submodule.
MC68331TS/D21
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
..
.
nc
32.768 KHz
22
22 pF22 pF
V
SSI
EXTAL
1. MUST BE LOW-LEAKAGE CAPACITOR (INSULATION RESISTANCE 30,000 MΩ OR GREATER).
2. RESISTANCE AND CAPACITANCE BASED ON A TEST CIRCUIT CONSTRUCTED WITH A DAISHINKU DMX-38 32.768-kHz CRYSTAL.
SPECIFIC COMPONENTS MUST BE BASED ON CRYSTAL TYPE. CONTACT CRYSTAL VENDOR FOR EXACT CIRCUIT.
R4
330K
R3
10M
CRYSTAL
OSCILLATOR
V
SSI
XTALXFC PIN
PHASE
COMPARATOR
FEEDBACK DIVIDER
SYSTEM CLOCK CONTROL
LOW-PASS
FILTER
V
DDSYN
1
XFC
0.1µF
V
DDSYN
0.1µF
0.01µF
VCO
W
Y
X
V
SSI
SYSTEM
CLOCK
CLKOUT
SYS CLOCK
BLOCK 32KHZ
Figure 7 System Clock Block Diagram
3.3.1 Clock Sources
The state of the clock mode (MODCLK) pin during reset determines the clock source. When MODCLK
is held high during reset, the clock synthesizer generates a clock signal from either a crystal oscillator
or an external reference input. Clock synthesizer control register SYNCR determines operating frequency and various modes of operation. When MODCLK is held low during reset, the clock synthesizer is
disabled, and an external system clock signal must be applied. When the synthesizer is disabled, SYNCR control bits have no effect.
A reference crystal must be connected between the EXTAL and XTAL pins to use the internal oscillator.
Use of a 32.768-kHz crystal is recommended. These crystals are inexpensive and readily available. If
an external reference signal or an external system clock signal is applied through the EXTAL pin, the
XTAL pin must be left floating. External reference signal frequency must be less than or equal to max-
Freescale Semiconductor, I
imum specified reference frequency. External system clock signal frequency must be less than or equal
to maximum specified system clock frequency.
When an external system clock signal is applied (i.e., the PLL is not used), duty cycle of the input is
critical, especially at near maximum operating frequencies. The relationship between clock signal duty
cycle and clock signal period is expressed:
Minimum external clock period =
minimum external clock high/low time
50% — percentage variation of external clock input duty cycle
22MC68331TS/D
For More Information On This Product,
Go to: www.freescale.com
..
.
nc
Freescale Semiconductor, Inc.
3.3.2 Clock Synthesizer Operation
A voltage controlled oscillator (VCO) generates the system clock signal. A portion of the clock signal is
fed back to a divider/counter. The divider controls the frequency of one input to a phase comparator.
The other phase comparator input is a reference signal, either from the internal oscillator or from an
external source. The comparator generates a control signal proportional to the difference in phase between its two inputs. The signal is low-pass filtered and used to correct VCO output frequency.
The synthesizer locks when VCO frequency is identical to reference frequency. Lock time is affected by
the filter time constant and by the amount of difference between the two comparator inputs. Whenever
comparator input changes, the synthesizer must re-lock. Lock status is shown by the SLOCK bit in SYNCR.
The MCU does not come out of reset state until the synthesizer locks. Crystal type, characteristic frequency, and layout of external oscillator circuitry affect lock time.
The low-pass filter requires an external low-leakage capacitor, typically 0.1 µF, connected between the
XFC and V
V
and can be used to run the clock when the MCU is powered down. Use a quiet power supply as the
V
ternal bypass capacitors as close as possible to the V
is used to power the clock circuits. A separate power source increases MCU noise immunity
DDSYN
source, since PLL stability depends on the VCO, which uses this supply. Place adequate ex-
DDSYN
DDSYN
pins.
pin to ensure stable operating frequency.
DDSYN
When the clock synthesizer is used, control register SYNCR determines operating frequency and various modes of operation. SYNCR can be read only when the processor is operating at the supervisor
privilege level.
The SYNCR X bit controls a divide by two prescaler that is not in the synthesizer feedback loop. Setting
X doubles clock speed without changing VCO speed. There is no VCO relock delay. The SYNCR W bit
controls a 3-bit prescaler in the feedback divider. Setting W increases VCO speed by a factor of four.
The SYNCR Y field determines the count modulus for a modulo 64 down counter, causing it to divide
by a value of Y + 1. When either W or Y value changes, there is a VCO relock delay.
Clock frequency is determined by SYNCR bit settings as follows:
F
SYSTEM
In order for the device to perform correctly, the clock frequency selected by the W, X, and Y bits must
be within the limits specified for the MCU. The VCO frequency is twice the system clock frequency if X
= 1 or four times the system clock frequency if X = 0.
The reset state of SYNCR ($3F00) produces a modulus-64 count.
= F
REFERENCE
[4(Y + 1)(2
2W +X
)]
Freescale Semiconductor, I
3.3.3 Clock Control
The clock control circuits determine system clock frequency and clock operation under special circumstances, such as following loss of synthesizer reference or during low-power operation. Clock source is
determined by the logic state of the MODCLK pin during reset.
SYNCR —Clock Synthesizer Control Register $YFFA04
151413876543210
WXYEDIV00SLIMP SLOCK RSTEN STSIM STEXT
RESET:
00111111000UU000
MC68331TS/D23
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
When the on-chip clock synthesizer is used, system clock frequency is controlled by the bits in the upper
byte of SYNCR. Bits in the lower byte show status of or control operation of internal and external clocks.
The SYNCR can be read or written only when the CPU is operating at the supervisor privilege level.
W —Frequency Control (VCO)
This bit controls a prescaler tap in the synthesizer feedback loop. Setting the bit increases the VCO
speed by a factor of four. VCO relock delay is required.
X —Frequency Control Bit (Prescale)
This bit controls a divide by two prescaler that is not in the synthesizer feedback loop. Setting the bit
doubles clock speed without changing the VCO speed. There is no VCO relock delay.
Y[5:0] —Frequency Control (Counter)
The Y field controls the modulus down counter in the synthesizer feedback loop, causing it to divide by
a value of Y + 1. Values range from 0 to 63. VCO relock delay is required.
..
.
nc
Freescale Semiconductor, I
EDIV —E Clock Divide Rate
0 = ECLK frequency is system clock divided by 8.
1 = ECLK frequency is system clock divided by 16.
ECLK is an external M6800 bus clock available on pin ADDR23. Refer to 3.5 Chip Selects for more information.
SLIMP —Limp Mode Flag
0 = External crystal is VCO reference.
1 = Loss of crystal reference.
When the on-chip synthesizer is used, loss of reference frequency causes SLIMP to be set. The VCO
continues to run using the base control voltage. Maximum limp frequency is maximum specified system
clock frequency. X-bit state affects limp frequency.
SLOCK —Synthesizer Lock Flag
0 = VCO is enabled, but has not locked.
1 = VCO has locked on the desired frequency (or system clock is external).
The MCU maintains reset state until the synthesizer locks, but SLOCK does not indicate synthesizer
lock status until after the user writes to SYNCR.
RSTEN —Reset Enable
0 = Loss of crystal causes the MCU to operate in limp mode.
1 = Loss of crystal causes system reset.
STSIM —Stop Mode SIM Clock
0 = When LPSTOP is executed, the SIM clock is driven from the crystal oscillator and the VCO is
turned off to conserve power.
1 = When LPSTOP is executed, the SIM clock is driven from the VCO.
STEXT —Stop Mode External Clock
0 = When LPSTOP is executed, the CLKOUT signal is held negated to conserve power.
1 = When LPSTOP is executed, the CLKOUT signal is driven from the SIM clock, as determined by
the state of the STSIM bit.
3.4 External Bus Interface
The external bus interface (EBI) transfers information between the internal MCU bus and external devices. The external bus has 24 address lines and 16 data lines.
The EBI provides dynamic sizing between 8-bit and 16-bit data accesses. It supports byte, word, and
long-word transfers. Ports are accessed through the use of asynchronous cycles controlled by the data
transfer (SIZ1 and SIZ0) and data size acknowledge pins (DSACK1
may be required for a transfer to or from an 8-bit port.
and DSACK0). Multiple bus cycles
24MC68331TS/D
For More Information On This Product,
Go to: www.freescale.com
..
.
nc
Freescale Semiconductor, Inc.
Port width is the maximum number of bits accepted or provided during a bus transfer. External devices
must follow the handshake protocol described below. Control signals indicate the beginning of the cycle,
the address space, the size of the transfer, and the type of cycle. The selected device controls the length
of the cycle. Strobe signals, one for the address bus and another for the data bus, indicate the validity
of an address and provide timing information for data. The EBI operates in an asynchronous mode for
any port width.
To add flexibility and minimize the necessity for external logic, MCU chip-select logic can be synchronized with EBI transfers. Chip-select logic can also provide internally-generated bus control signals for
these accesses. Refer to 3.5 Chip Selects for more information.
3.4.1 Bus Control Signals
The CPU initiates a bus cycle by driving the address, size, function code, and read/write outputs. At the
beginning of the cycle, size signals SIZ0 and SIZ1 are driven along with the function code signals. The
size signals indicate the number of bytes remaining to be transferred during an operand cycle. They are
valid while the address strobe (AS
read/write (R/W) signal determines the direction of the transfer during a bus cycle. This signal changes
state, when required, at the beginning of a bus cycle, and is valid while AS is asserted. R/W only changes state when a write cycle is preceded by a read cycle or vice versa. The signal can remain low for two
consecutive write cycles.
) is asserted. The following table shows SIZ0 and SIZ1 encoding. The
Table 8 Size Signal Encoding
SIZ1SIZ0Transfer Size
01Byte
10Word
11Three Byte
00Long Word
3.4.2 Function Codes
The CPU32 automatically generates function code signals FC[2:0]. The function codes can be considered address extensions that automatically select one of eight address spaces to which an address applies. These spaces are designated as either user or supervisor, and program or data spaces. Address
space 7 is designated CPU space. CPU space is used for control information not normally associated
with read or write bus cycles. Function codes are valid while AS is asserted.
Table 9 CPU32 Address Space Encoding
FC2FC1FC0Address Space
000Reserved
Freescale Semiconductor, I
001User Data Space
010User Program Space
011Reserved
100Reserved
101Supervisor Data Space
110Supervisor Program Space
111CPU Space
3.4.3 Address Bus
Address bus signals ADDR[23:0] define the address of the most significant byte to be transferred during
a bus cycle. The MCU places the address on the bus at the beginning of a bus cycle. The address is
valid while AS is asserted.
MC68331TS/D25
For More Information On This Product,
Go to: www.freescale.com
..
.
nc
Freescale Semiconductor, Inc.
3.4.4 Address Strobe
AS is a timing signal that indicates the validity of an address on the address bus and the validity of many
control signals. It is asserted one-half clock after the beginning of a bus cycle.
3.4.5 Data Bus
Data bus signals DATA[15:0] make up a bidirectional, non-multiplexed parallel bus that transfers data
to or from the MCU. A read or write operation can transfer 8 or 16 bits of data in one bus cycle. During
a read cycle, the data is latched by the MCU 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
MCU places the data on the data bus one-half clock cycle after AS is asserted in a write cycle.
3.4.6 Data Strobe
Data strobe (DS) is a timing signal. For a read cycle, the MCU asserts DS to signal an external device
to place data on the bus. DS
DS signals an external device that data on the bus is valid. The MCU asserts DS one full clock cycle
after the assertion of AS during a write cycle.
3.4.7 Bus Cycle Termination Signals
During bus cycles, external devices assert the data transfer and size acknowledge signals (DSACK1
and DSACK0). During a read cycle, the signals tell the MCU to terminate the bus cycle and to latch data.
During a write cycle, the signals indicate that an external device has successfully stored data and that
the cycle can end. These signals also indicate to the MCU the size of the port for the bus cycle just completed. (Refer to 3.4.9 Dynamic Bus Sizing.)
is asserted at the same time as AS during a read cycle. For a write cycle,
The bus error (BERR) signal is also a bus cycle termination indicator and can be used in the absence
of DSACK1 and DSACK0 to indicate a bus error condition. It can also be asserted in conjunction with
these signals, provided it meets the appropriate timing requirements. The internal bus monitor can be
used to generate the BERR signal for internal and internal-to-external transfers. When BERR and HALT
are asserted simultaneously, the CPU takes a bus error exception.
Autovector signal (AVEC) can terminate external IRQ pin interrupt acknowledge cycles. AVEC indicates
that the MCU will internally generate a vector number to locate an interrupt handler routine. If it is continuously asserted, autovectors will be generated for all external interrupt requests. AVEC is ignored
during all other bus cycles.
3.4.8 Data Transfer Mechanism
The MCU 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 data transfer and size acknowledge
inputs (DSACK1 and DSACK0).
Freescale Semiconductor, I
3.4.9 Dynamic Bus Sizing
The MCU dynamically interprets the port size of the addressed device during each bus cycle, allowing
operand transfers to or from 8- and 16-bit ports. During an operand transfer cycle, the slave device signals its port size and indicates completion of the bus cycle to the MCU through the use of the DSACK0
and DSACK1 inputs, as shown in the following table.
Table 10 Effect of DSACK Signals
DSACK1DSACK0Result
11Insert Wait States in Current Bus Cycle
10Complete Cycle —Data Bus Port Size is 8 Bits
01Complete Cycle —Data Bus Port Size is 16 Bits
00Reserved
26MC68331TS/D
For More Information On This Product,
Go to: www.freescale.com
Loading...
+ 58 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.