CP3BT26 Reprogrammable Connectivity Processor with
Bluetooth®, USB, and CAN Interfaces
1.0General Description
The CP3BT26 connectivity processor combines high performance with the massive integration needed for embedded
Bluetooth applications. A powerful RISC core with on-chip
SRAM and Flash memory provides high computing bandwidth, hardware communications peripherals provide highI/O bandwidth, and an external bus provides system expandability.
On-chip communications peripherals include: Bluetooth
Lower Link Controller, Universal Serial Bus (USB) 1.1 node,
CAN, Microwire/Plus, SPI, ACCESS.bus, quad UART, 12-bit
A/D converter, and Advanced Audio Interface (AAI). Additional on-chip peripherals include Random Number Generator (RNG), DMA controller, CVSD/PCM conversion
module, Timing and Watchdog Unit, Versatile Timer Unit,
Multi-Function Timer, and Multi-Input Wake-Up (MIWU)
unit.
Bluetooth hand-held devices can be both smaller and lower
in cost for maximum consumer appeal. The low voltage and
advanced power-saving modes achieve new design points
in the trade-off between battery size and operating time for
handheld and portable applications.
In addition to providing the features needed for the next generation of embedded Bluetooth products, the CP3BT26 is
backed up by the software resources designers need for
rapid time-to-market, including an operating system, Bluetooth protocol stack implementation, peripheral drivers, reference designs, and an integrated development
environment. Combined with a Bluetooth radio transceiver
such as National’s LMX5252, the CP3BT26 provides a complete Bluetooth system solution.
National Semiconductor offers a complete and industryproven application development environment for CP3BT26
applications, including the IAR Embedded Workbench,
iSYSTEM winIDEA and iC3000 Active Emulator, Bluetooth
Development Board, Bluetooth Protocol Stack, and Application Software.
CP3BT26 Connectivity Processor with Bluetooth and Dual CAN Interfaces
Block Diagram
Clock Generator
12 MHz and 32 kHz
Oscillator
CR16C
CPU Core
Bus
Interface
Unit
GPIO
PLL and Clock
256K Bytes
Flash
Program
Memory
DMA
Controller
Audio
Interface
Generator
8K Bytes
Flash
Data
Peripheral
Bus
Controller
Microwiire/
SPI
Power-on-Reset
32K Bytes
Static
RAM
Interrupt
Control
Unit
Quad UART
CAN 2.0B
Controller
CPU Core Bus
CVSD/PCM
Peripheral Bus
ACCESS
.bus
Converter
Timer Unit
Versatile
RF Interface
Protocol
Core
Powe r
Manage-
ment
Muti-Func-
tion Timer
Bluetooth Lower
Link Controller
1K Byte
Sequencer RAM
4.5K Bytes
Data RAM
Timing and
Watchdog
Unit
Multi-Input
Wake-Up
Serial
Debug
Interface
Random
Number
Generator
8-Channel
12-bit ADC
USB
Bluetooth is a registered trademark of Bluetooth SIG, Inc. and is used under license by National Semiconductor.
TRI-STATE is a registered trademark of National Semiconductor Corporation.
Fully static RISC processor core, capable of operating
from 0 to 24 MHz with zero wait/hold states
Minimum 41.7 ns instruction cycle time with a 24-MHz in-
ternal clock frequency, based on a 12-MHz external input
47 independently vectored peripheral interrupts
On-Chip Memory
256K bytes reprogrammable Flash program memory
8K bytes Flash data memory
32K bytes of static RAM data memory
Addresses up to 12M bytes of external memory
Broad Range of Hardware Communications Peripherals
Bluetooth Lower Link Controller (LLC) including a shared
4.5K byte Bluetooth RAM and 1K byte Bluetooth Sequencer RAM
Universal Serial Bus (USB) 1.1 full-speed node
ACCESS.bus serial bus (compatible with Philips I
CAN interface with 15 message buffers conforming to
Advanced Audio Interface (AAI) to connect to external 8/
13-bit PCM Codecs as well as to ISDN-Controllers
through the IOM-2 interface (slave only)
CVSD/PCM converter supporting one bidirectional audio
connection
General-Purpose Hardware Peripherals
12-bit A/D Converter (ADC)
Dual 16-bit Multi-Function Timer (MFT)
Versatile Timer Unit with four subsystems (VTU)
Four-channel DMA controller
Timing and Watchdog Unit
Random Number Generator peripheral
Extensive Power and Clock Management Support
On-chip Phase Locked Loop
Support for multiple clock options
Dual clock and reset
2
C bus)
CP3BT26
Power-down modes
Flexible I/O
Up to 54 general-purpose I/O pins (shared with on-chip
I/O port operation at 2.5V to 3.3V
Core logic operation at 2.5V
On-chip power-on reset
Temperature Range
-40°C to +85°C (Industrial)
Packages
LQFP-128, LQFP-144
Complete Development Environment
Pre-integrated hardware and software support for rapid
prototyping and production
Integrated environment
Project manager
Multi-file C source editor
High-level C source debugger
Comprehensive, integrated, one-stop technical support
Bluetooth Protocol Stack
Applications can interface to the high-level protocols or
directly to the low-level Host Controller Interface (HCI)
Transport layer support allows HCI command-based in-
terface over UART port
Baseband (Link Controller) hardware minimizes the
bandwidth demand on the CPU
Link Manager (LM)
Logical Link Control and Adaptation Protocol (L2CAP)
Service Discovery Protocol (SDP)
RFCOMM Serial Port Emulation Protocol
All packet types, piconet, and scatternet functionality
supported
CP3BT26 Connectivity Processor Selection Guide
NSID
CP3BT26G18NEP24-40° to +85°C256832054LQFP-128
CP3BT26G18NEPNOPB24-40° to +85°C256832054LQFP-128
CP3BT26G18NEPX24-40° to +85°C256832054LQFP-128
CP3BT26G18NEPXNOPB24-40° to +85°C256832054LQFP-128
CP3BT26Y98NEP24-40° to +85°C2568322348LQFP-144
CP3BT26Y98NEPNOPB24-40° to +85°C2568322348LQFP-144
CP3BT26Y98NEPX24-40° to +85°C2568322348LQFP-144
CP3BT26Y98NEPXNOPB24-40° to +85°C2568322348LQFP-144
NEP - Erased part (Bluetooth device address in Information Block 1); X - Tape and reel; NOPB - No lead solder
Speed
(MHz)
Temp. Range
Program
Flash
(Kbytes)
Data
Flash
(Kbytes)
SRAM
(Kbytes)
External
Address
Lines
I/Os
Package
Type
3www.national.com
Page 4
3.0Device Overview
The CP3BT26 connectivity processor is a complete microcomputer with all system timing, interrupt logic, program
CP3BT26
memory, data memory, and I/O ports included on-chip, making it well-suited to a wide range of embedded applications.
The block diagram on page 1 shows the major on-chip components of the CP3BT26 devices.
3.1CR16C CPU CORE
The CP3BT26 device implements the CR16C CPU core
module. The high performance of the CPU core results from
the implementation of a pipelined architecture with a twobytes-per-cycle pipelined system bus. As a result, the CPU
can support a peak execution rate of one instruction per
clock cycle.
For more information, please refer to the CR16C Programmer’s Reference Manual (document number 424521772101, which may be downloaded from National’s web site at
http://www.national.com).
3.2MEMORY
The CP3BT26 devices support a uniform linear address
space of up to 16 megabytes. Three types of on-chip memory occupy specific regions within this address space, along
with any external memory:
256K bytes of Flash program memory
8K bytes of Flash data memory
32K bytes of static RAM
Up to 12M bytes of external memory (144-pin devices)
The 256K bytes of Flash program memory are used to store
the application program, Bluetooth protocol stack, and realtime operating system. The Flash memory has security features to prevent unintentional programming and to prevent
unauthorized access to the program code. This memory
can be programmed with an external programming unit or
with the device installed in the application system (in-system programming).
The 8K bytes of Flash data memory are used for non-volatile storage of data entered by the end-user, such as configuration settings.
The 32K bytes of static RAM are used for temporary storage
of data and for the program stack and interrupt stack. Read
and write operations can be byte-wide or word-wide, depending on the instruction executed by the CPU.
Up to 12M bytes of external memory can be added on an
external bus. The external bus is only available on devices
in 144-pin packages.
For Flash program and data memory, the device internally
generates the necessary voltages for programming. No additional power supply is required.
3.3INPUT/OUTPUT PORTS
The device has up to 54 software-configurable I/O pins, organized into seven ports called Port B, Port C, Port E, Port
G, Port H, Port I, and Port J. Each pin can be configured to
operate as a general-purpose input or general-purpose output. In addition, many I/O pins can be configured to operate
as inputs or outputs for on-chip peripheral modules such as
the UART, timers, or Microwire/SPI interface.
The I/O pin characteristics are fully programmable. Each pin
can be configured to operate as a TRI-STATE output, pushpull output, weak pull-up input, or high-impedance input.
3.4BUS INTERFACE UNIT
The Bus Interface Unit (BIU) controls access to internal/external memory and I/O. It determines the configured parameters for bus access (such as the number of wait states for
memory access) and issues the appropriate bus signals for
each requested access.
The BIU uses a set of control registers to determine how
many wait states and hold states are used when accessing
Flash program memory and the I/O area. At start-up, the
configuration registers are set for slowest possible memory
access. To achieve fastest possible program execution, appropriate values must be programmed. These settings vary
with the clock frequency and the type of off-chip device being accessed.
3.5INTERRUPT CONTROL UNIT (ICU)
The ICU receives interrupt requests from internal and external sources and generates interrupts to the CPU. An interrupt is an event that temporarily stops the normal flow of
program execution and causes a separate interrupt handler
to be executed. After the interrupt is serviced, CPU execution continues with the next instruction in the program following the point of interruption.
Interrupts from the timers, UARTs, Microwire/SPI interface,
and Multi-Input Wake-Up, are all maskable interrupts; they
can be enabled or disabled by software. There are 47
maskable interrupts, assigned to 47 linear priority levels.
The highest-priority interrupt is the Non-Maskable Interrupt
), which is generated by a signal received on the NMI
(NMI
input pin.
3.6MULTI-INPUT WAKE-UP
The two Multi-Input Wake-Up (MIWU) modules can be used
for two purposes: to provide inputs for waking up (exiting)
from the Halt, Idle, or Power Save mode, and to provide general-purpose edge-triggered maskable interrupts to the level-sensitive interrupt control unit (ICU) inputs. Each 16channel module generates four programmable interrupts to
the ICU, for a total of 8 ICU inputs generated from 32 MIWU
inputs. Channels can be individually enabled or disabled,
and programmed to respond to positive or negative edges.
www.national.com4
Page 5
3.7BLUETOOTH LLC
The integrated hardware Bluetooth Lower Link Controller
(LLC) complies to the Bluetooth Specification Version 1.1
and integrates the following functions:
4.5K-byte dedicated Bluetooth Data RAM
1K-byte dedicated Bluetooth Sequencer RAM
Support of all Bluetooth 1.1 packet types
Support for fast frequency hopping of 1600 hops/s
Access code correlation and slot timing recovery circuit
Power Management Control Logic
BlueRF-compatible interface (mode 2/3) to connect with
National’s LMX5252 and other RF transceiver chips
3.8USB
The CR16 USB node is a Universal Serial Bus (USB) Node
controller compatible with USB Specification 1.1. It integrates the required USB transceiver, the Serial Interface Engine (SIE), and USB endpoint FIFOs. A total of seven
endpoint pipes are supported: one bidirectional pipe for the
mandatory control EP0 and an additional six pipes for unidirectional endpoints to support USB interrupt, bulk, and isochronous data transfers.
3.9CAN INTERFACE
The CAN module contains a Full CAN 2.0B class, CAN serial bus interface for applications that require a high-speed
(up to 1 Mbits per second) or a low-speed interface with
CAN bus master capability. The data transfer between CAN
and the CPU is established by 15 memory-mapped message buffers, which can be individually configured as receive or transmit buffers. An incoming message is filtered by
two masks, one for the first 14 message buffers and another
one for the 15th message buffer to provide a basic CAN
path. A priority decoder allows any buffer to have the highest or lowest transmit priority. Remote transmission requests can be processed automatically by automatic
reconfiguration to a receiver after transmission or by automated transmit scheduling upon reception. In addition, a
time stamp counter (16-bits wide) is provided to support
real-time applications.
The CAN module is a fast core bus peripheral, which allows
single-cycle byte or word read/write access. A set of diagnostic features (such as loopback, listen only, and error
identification) support the development with the CAN module and provide a sophisticated error management tool.
The CAN receiver can trigger a wake-up condition out of the
low-power modes through the Multi-Input Wake-Up module.
3.10QUAD UART
Four UART modules support a wide range of programmable
baud rates and data formats, parity generation, and several
error detection schemes. The baud rate is generated onchip, under software control. One UART channel supports
hardware flow control, DMA, and USART capability (synchronous mode).
The UARTs offer a wake-up condition from the low-power
modes using the Multi-Input Wake-Up module.
CP3BT26
3.11ADVANCED AUDIO INTERFACE
The audio interface provides a serial synchronous, full-duplex interface to CODECs and similar serial devices. Transmit and receive paths operate asynchronously with respect
to each other. Each path uses three signals for communication: shift clock, frame synchronization, and data.
When the receiver and transmitter use separate shift clocks
and frame sync signals, the interface operates in its asynchronous mode. Alternatively, the transmit and receive path
can share the same shift clock and frame sync signals for
synchronous mode operation.
3.12CVSD/PCM CONVERSION MODULE
The CVSD/PCM module performs conversion between
CVSD data and PCM data, in which the CVSD encoding is
as defined in the Bluetooth specification and the PCM data
can be 8-bit µ-Law, 8-bit A-Law, or 13-bit to 16-bit Linear.
3.1312-BIT ANALOG TO DIGITAL
CONVERTER
This device contains an 8-channel, multiplexed input, successive approximation, 12-bit Analog-to-Digital Converter. It
supports both Single Ended and Differential modes of operation.
The integrated 12-bit ADC provides the following features:
8-channel, multiplexed input
4 differential channels
Single-ended and differential external filtering capability
12-bit resolution; 11-bit accuracy
15-microsecond conversion time
Support for 4-wire touchscreen applications
External start trigger
Programmable start delay after start trigger
Poll or interrupt on done
The ADC is compatible with 4-wire resistive touchscreen
applications and is intended to provide the resolution necessary to support handwriting recognition. Low-ohmic touchscreen drivers are provided internally on the ADC[3:0] pins.
Pendown detection is also provided.
The ADC provides several options for the voltage reference
source. The positive reference can be ADVCC (internal),
VREFP, ADC0, or ADC3. The negative reference can be
ADVCC (internal), ADC1, or ADC2.
Two specific analog channel selection modes are supported. These are as follows:
Allow any specific channel to be selected at one time.
The A/D Converter performs the specific conversion requested and stops.
Allow any differential channel pair to be selected at one
time. The A/D Converter performs the specific differential
conversion requested and stops.
In both Single-Ended and Differential modes, there is the
capability to connect the analog multiplexer output and A/D
converter input to external pins. This provides the ability to
externally connect a common filter/signal conditioning circuit for the A/D Converter.
5www.national.com
Page 6
3.14RANDOM NUMBER GENERATOR
RNG peripheral for use in Trusted Computer Peripheral Applications (TCPA) to improve the authenticity, integrity, and
privacy of Internet-based communication and commerce.
CP3BT26
3.15MICROWIRE/SPI
The Microwire/SPI (MWSPI) interface module supports synchronous serial communications with other devices that
conform to Microwire or Serial Peripheral Interface (SPI)
specifications. It supports 8-bit and 16-bit data transfers.
The Microwire interface allows several devices to communicate over a single system consisting of four wires: serial in,
serial out, shift clock, and slave enable. At any given time,
the Microwire interface operates as the master or a slave.
The Microwire interface supports the full set of slave select
for multi-slave implementation.
In master mode, the shift clock is generated on-chip under
software control. In slave mode, a wake-up out of a lowpower mode may be triggered using the Multi-Input WakeUp module.
3.16ACCESS.BUS INTERFACE
The ACCESS.bus interface module (ACB) is a two-wire serial interface compatible with the ACCESS.bus physical layer. It is also compatible with Intel’s System Management
Bus (SMBus) and Philips’ I
configured as a bus master or slave, and it can maintain bidirectional communications with both multiple master and
slave devices.
The ACCESS.bus receiver can trigger a wake-up condition
out of the low-power modes through the Multi-Input WakeUp module.
2
C bus. The ACB module can be
3.17MULTI-FUNCTION TIMER
The Multi-Function Timer (MFT) module contains a pair of
16-bit timer/counter registers. Each timer/counter unit can
be configured to operate in any of the following modes:
— Processor-Independent Pulse Width Modulation
(PWM) mode: Generates pulses of a specified width
and duty cycle and provides a general-purpose timer/
counter.
— Dual Input Capture mode: Measures the elapsed time
between occurrences of external event and provides
a general-purpose timer/counter.
— Dual Independent Timer mode: Generates system
timing signals or counts occurrences of external
events.
— Single Input Capture and Single Timer mode: Pro-
vides one external event counter and one system timer.
3.18TIMING AND WATCHDOG MODULE
The Timing and Watchdog Module (TWM) contains a RealTime timer and a Watchdog unit. The Real-Time Clock Timing function can be used to generate periodic real-time
based system interrupts. The timer output is one of 16 inputs to the Multi-Input Wake-Up module which can be used
to exit from a power-saving mode. The Watchdog unit is designed to detect the application program getting stuck in an
infinite loop resulting in loss of program control or “runaway”
programs. When the watchdog triggers, it resets the device.
The TWM is clocked by the low-speed System Clock.
3.19VERSATILE TIMER UNIT
The Versatile Timer Unit (VTU) module contains four independent timer subsystems, each operating in either dual 8bit PWM configuration, as a single 16-bit PWM timer, or a
16-bit counter with two input capture channels. Each of the
four timer subsystems offer an 8-bit clock prescaler to accommodate a wide range of frequencies.
3.20TRIPLE CLOCK AND RESET
The Triple Clock and Reset module generates a high-speed
main System Clock from an external crystal network. It also
provides the main system reset signal and a power-on reset
function.
This module generates a slow System Clock (32.768 kHz)
from an optional external crystal network. The Slow Clock is
used for operating the device in a low-power mode. The
32.768 kHz external crystal network is optional, because
the low speed System Clock can be derived from the highspeed clock by a prescaler. Also, two independent clocks divided down from the high speed clock are available on output pins.
The Triple Clock and Reset module provides the clock signals required for the operation of the various CP3BT26 onchip modules. From external crystal networks, it generates
the Main Clock, which can be scaled up to 24 MHz from an
external 12 MHz input clock, and a 32.768 kHz secondary
System Clock. The 12 MHz external clock is primarily used
as the reference frequency for the on-chip PLL. The clock
for modules which require a fixed clock rate (e.g. the Bluetooth LLC and the CVSD/PCM transcoder) is also generated through prescalers from the 12 MHz clock. The PLL may
be used to drive the high-speed System Clock through a
prescaler. Alternatively, the high speed System Clock can
be derived directly from the 12 MHz Main Clock.
In addition, this module generates the device reset by using
reset input signals coming from an external reset and various on-chip modules.
www.national.com6
Page 7
3.21POWER MANAGEMENT
The Power Management Module (PMM) improves the efficiency of the device by changing the operating mode and
power consumption to match the required level of activity.
The device can operate in any of four power modes:
— Active: The device operates at full speed using the
high-frequency clock. All device functions are fully operational.
— Power Save: The device operates at reduced speed
using the Slow Clock. The CPU and some modules
can continue to operate at this low speed.
— Idle: The device is inactive except for the Power Man-
agement Module and Timing and Watchdog Module,
which continue to operate using the Slow Clock.
— Halt: The device is inactive but still retains its internal
state (RAM and register contents).
3.22DMA CONTROLLER
The Direct Memory Access Controller (DMAC) can speed
up data transfer between memory and I/O devices or between two memories, relative to data transfers performed directly by the CPU. A method called cycle-stealing allows the
CPU and the DMAC to share the CPU bus efficiently. The
DMAC implements four independent DMA channels. DMA
requests from a primary and a secondary source are recognized for each DMA channel, as well as a software DMA request issued directly by the CPU. Table 1 shows the DMA
channel assignment on the CP3BT26 architecture. The following on-chip modules can assert a DMA request to the
DMAC:
•CR16C (Software DMA request)
•USB
•USART
•Advanced Audio Interface
•CVSD/PCM Converter
Table 1 shows how the four DMA channels are assigned
to the modules listed above.
CP3BT26
In the normal mode of operation, the interface only transfers
one word at a periodic rate. In the network mode, the interface transfers multiple words at a periodic rate. The periodic
rate is also called a data frame and each word within one
frame is called a slot. The beginning of each new data frame
is marked by the frame sync signal.
3.23SERIAL DEBUG INTERFACE
The Serial Debug Interface module (SDI module) provides
a JTAG-based serial link to an external debugger, for example running on a PC. In addition, the SDI module integrates
an on-chip debug module, which allows the user to set up to
eight hardware breakpoints on instruction execution and
data transfer. The SDI module can act as a CPU bus master
to access all memory mapped resources, such as RAM and
peripherals. Therefore it also allows for fast program code
download into the on-chip Flash program memory using the
JTAG interface.
3.24DEVELOPMENT SUPPORT
In addition to providing the features needed for the next generation of embedded Bluetooth products, the CP3BT26 devices are backed up by the software resources designers
need for rapid product development, including an operating
system, Bluetooth protocol stack implementation, peripheral drivers, reference designs, and an integrated development environment. Combined with National’s LMX5251
Bluetooth radio transceiver, the CP3BT26 devices provide a
total Bluetooth system solution.
National Semiconductor offers a complete and industryproven application development environment for CP3BT26
applications, including the IAR Embedded Workbench,
iSYSTEM winIDEA and iC3000 Active Emulator, Bluetooth
Development Board, Bluetooth Protocol Stack, and Application Software. See your National Semiconductor sales representative for current information on availability and
features of emulation equipment and evaluation boards.
Table 1 DMA Channel Assignment
Channel
0
1
2
3
The interface can handle data words of either 8- or 16-bit
length and data frames can consist of up to four slots.
Some pins may be enabled as general-purpose I/O-port
pins or as alternate functions associated with specific peripherals or interfaces. These pins may be individually configured as port pins, even when the associated peripheral or
interface is enabled. Table 2 describes the device signals for
the LQFP-128 package. Table 3 describes the device signals for the LQFP-144 package.
www.national.com8
Figure 1. CP3BT26 Device SIgnals
Page 9
Table 2 CP3BT26 LQFP-128 Signal Descriptions
CP3BT26
NamePinsI/OPrimary Function
X1CKI1
X1CKO1
X2CKI1
X2CKO1
RESET1
ENV01
ENV11
ENV21
TMS1
TCK1
TDI1
TDO1
Input12 MHz Oscillator InputBBCLKBB reference clock for the RF Interface
Output 12 MHz Oscillator OutputNoneNone
Input32 kHz Oscillator InputNoneNone
Output 32 kHz Oscillator OutputNoneNone
InputChip general resetNoneNone
I/O
I/O
I/O
Input
Input
Input
Output JTAG Test Data OutputNoneNone
Special mode select input with
internal pull-up during reset
Special mode select input with
internal pull-up during reset
Special mode select input with
internal pull-up during reset
JTAG Test Mode Select
(with internal weak pull-up)
JTAG Test Clock Input
(with internal weak pull-up)
JTAG Test Data Input
(with internal weak pull-up)
Alternate
Name
PLLCLKPLL Clock Output
CPUCLKCPU Clock Output
SLOWCLK Slow Clock Output
NoneNone
NoneNone
NoneNone
Alternate Function
RDY
VCC6
GND6
IOVCC15
IOGND14
AVC C1
AGND
ADVCC1
ADGND
RFDATA
SCL
SDA
D-1
D+1
UVCC1
UGND
Output NEXUS Ready OutputNoneNone
1
Input
InputCore GroundNoneNone
Input2.5
InputI/O GroundNoneNone
InputPLL Analog Power SupplyNoneNone
1InputPLL Analog GroundNoneNone
InputADC Analog Power SupplyNoneNone
1InputADC Analog GroundNoneNone
1I/OBluetooth RX/TX Data Pin NoneNone
1I/OACCESS.bus ClockNoneNone
1I/OACCESS.bus Serial DataNoneNone
I/OUSB D- Upstream PortNoneNone
I/OUSB D+ Upstream PortNoneNone
Input3.3V USB Transceiver SupplyNoneNone
1InputUSB Transceiver GroundNoneNone
2.5V Core Logic
Power Supply
NoneNone
–3.3V I/O Power SupplyNoneNone
ADC0
ADC1
ADC2
1I/OADC Input Channel 0TSX+Touchscreen X+ contact
1I/OADC Input Channel 1TSY+Touchscreen Y+ contact
1I/OADC Input Channel 2TSX-Touchscreen X- contact
9www.national.com
Page 10
NamePinsI/OPrimary Function
Alternate
Name
Alternate Function
CP3BT26
ADC3
ADC4
ADC5
ADC6
ADC7
VREFP
PB[7:0]
PC[7:0]
PE0
PE1
PE2
PE3
PE4
PE5
PF0
PF1
PF2
1I/OADC Input Channel 3TSY-Touchscreen Y- contact
1I/OADC Input Channel 4MUXOUT0 Analog Multiplexer Output 0
1I/OADC Input Channel 5MUXOUT1 Analog Multiplexer Output 1
1InputADC Input Channel 6NoneNone
1InputADC Input Channel 7ADCINADC Input (in MUX mode)
1InputADC Positive Voltage ReferenceNoneNone
8I/OGeneric I/ONoneNone
8I/OGeneric I/ONoneNone
1I/OGeneric I/ORXD0UART Channel 0 Receive Data Input
1I/OGeneric I/OTXD0UART Channel 0 Transmit Data Output
The CP3BT26 uses the CR16C third-generation 16-bit
CompactRISC processor core. The CPU implements a Reduced Instruction Set Computer (RISC) architecture that allows an effective execution rate of up to one instruction per
clock cycle. For a detailed description of the CPU16C architecture, see the CompactRISC CR16C Programmer’s Ref-erence Manual which is available on the National
Semiconductor web site (http://www.nsc.com).
The CR16C CPU core includes these internal registers:
General-purpose registers (R0-R13, RA, and SP)
Dedicated address registers (PC, ISP, USP, and INT-
BASE)
Processor Status Register (PSR)
Configuration Register (CFG)
The R0-R11, PSR, and CFG registers are 16 bits wide. The
R12, R13, RA, SP, ISP and USP registers are 32 bits wide.
The PC register is 24 bits wide. Figure 2 shows the CPU
registers.
Dedicated Address Registers
31
ISPH
USPH
INTBASEH
15
23
PC
ISPL
USPL
INTBASEL
Processor Status Register
15
PSR
Configuration Register
15
CFG
0
0
0
31
Figure 2. CPU Registers
Some register bits are designated as “reserved.” Software
must write a zero to these bit locations when it writes to the
register. Read operations from reserved bit locations return
undefined values.
5.1GENERAL-PURPOSE REGISTERS
The CompactRISC CPU features 16 general-purpose registers. These registers are used individually as 16-bit operands or as register pairs for operations on addresses
greater than 16 bits.
General-purpose registers are defined as R0 through
R13, RA, and SP.
Registers are grouped into pairs based on the setting of
the Short Register bit in the Configuration Register
(CFG.SR). When the CFG.SR bit is set, the grouping of
register pairs is upward-compatible with the architecture
of the earlier CR16A/B CPU cores: (R1,R0), (R2,R1) ...
(R11,R10), (R12_L, R11), (R13_L, R12_L), (R14_L,
R13_L) and SP. (R14_L, R13_L) is the same as
(RA,ERA).
General-Purpose Registers
150
R0
R1
R2
R3
R4
R5
R6
R7
R8
R9
R10
R11
R12
R13
RA
SP
DS004
CP3BT26
When the CFG.SR bit is clear, register pairs are grouped
in the manner used by native CR16C software: (R1,R0),
(R2,R1) ... (R11,R10), (R12_L, R11), R12, R13, RA, SP.
R12, R13, RA, and SP are 32-bit registers for holding addresses greater than 16 bits.
With the recommended calling convention for the architecture, some of these registers are assigned special hardware
and software functions. Registers R0 to R13 are for generalpurpose use, such as holding variables, addresses, or index
values. The SP register holds a pointer to the program runtime stack. The RA register holds a subroutine return address. The R12 and R13 registers are available to hold base
addresses used in the index addressing mode.
If a general-purpose register is specified by an operation
that is 8 bits long, only the lower byte of the register is used;
the upper part is not referenced or modified. Similarly, for
word operations on register pairs, only the lower word is
used. The upper word is not referenced or modified.
5.2DEDICATED ADDRESS REGISTERS
The CR16C has four dedicated address registers to implement specific functions: the PC, ISP, USP, and INTBASE
registers.
5.2.1Program Counter (PC) Register
The 24-bit value in the PC register points to the first byte of
the instruction currently being executed. CR16C instructions are aligned to even addresses, therefore the least significant bit of the PC is always 0. At reset, the PC is
initialized to 0 or an optional predetermined value. When a
warm reset occurs, value of the PC prior to reset is saved in
the (R1,R0) general-purpose register pair.
5.2.2Interrupt Stack Pointer (ISP)
The 32-bit ISP register points to the top of the interrupt
stack. This stack is used by hardware to service exceptions
(interrupts and traps). The stack pointer may be accessed
as the ISP register for initialization. The interrupt stack can
be located anywhere in the CPU address space. The ISP
cannot be used for any purpose other than the interrupt
stack, which is used for automatic storage of the CPU registers when an exception occurs and restoration of these
registers when the exception handler returns. The interrupt
stack grows downward in memory. The least significant bit
and the 8 most significant bits of the ISP register are always
0.
5.2.3User Stack Pointer (USP)
The USP register points to the top of the user-mode program stack. Separate stacks are available for user and supervisor modes, to support protection mechanisms for
multitasking software. The processor mode is controlled by
the U bit in the PSR register (which is called PSR.U in the
shorthand convention). Stack grow downward in memory. If
the USP register points to an illegal address (any address
greater than 0x00FF_FFFF) and the USP is used for stack
access, an IAD trap is taken.
15www.national.com
Page 16
5.2.4Interrupt Base Register (INTBASE)
The INTBASE register holds the address of the dispatch table for exceptions. The dispatch table can be located anywhere in the CPU address space. When loading the
CP3BT26
INTBASE register, bits 31 to 24 and bit 0 must written with 0.
5.3PROCESSOR STATUS REGISTER (PSR)
The PSR provides state information and controls operating
modes for the CPU. The format of the PSR is shown below.
1512 11 10 9 8 7 6 5 4 3 2 1 0
ReservedIP E 0 N Z F 0 U L T C
CThe Carry bit indicates whether a carry or bor-
row occurred after addition or subtraction.
0 – No carry or borrow occurred.
1 – Carry or borrow occurred.
TThe Trace bit enables execution tracing, in
which a Trace trap (TRC) is taken after every
instruction. Tracing is automatically disabled
during the execution of an exception handler.
– Tracing disabled.
0
1 – Tracing enabled.
LThe Low bit indicates the result of the last
comparison operation, with the operands interpreted as unsigned integers.
– Second operand greater than or equal to
0
first operand.
1 – Second operand less than first operand.
UThe User Mode bit controls whether the CPU
is in user or supervisor mode. In supervisor
mode, the SP register is used for stack operations. In user mode, the USP register is used
instead. User mode is entered by executing
the Jump USR instruction. When an exception
is taken, the exception handler automatically
begins execution in supervisor mode. The
USP register is accessible using the Load
Processor Register (LPR/LPRD) instruction in
supervisor mode. In user mode, an attempt to
access the USP register generates a UND
trap.
– CPU is executing in supervisor mode.
0
– CPU is executing in user mode.
1
FThe Flag bit is a general condition flag for sig-
nalling exception conditions or distinguishing
the results of an instruction, among other
thing uses. For example, integer arithmetic instructions use the F bit to indicate an overflow
condition after an addition or subtraction operation.
ZThe Zero bit is used by comparison opera-
tions. In a comparison of integers, the Z bit is
set if the two operands are equal. If the operands are unequal, the Z bit is cleared.
– Source and destination operands un-
0
equal.
1 – Source and destination operands equal.
NThe Negative bit indicates the result of the last
comparison operation, with the operands interpreted as signed integers.
– Second operand greater than or equal to
0
first operand.
1 – Second operand less than first operand.
EThe Local Maskable Interrupt Enable bit en-
ables or disables maskable interrupts. If this
bit and the Global Maskable Interrupt Enable
(I) bit are both set, all interrupts are enabled.
If either of these bits is clear, only the nonmaskable interrupt is enabled. The E bit is set
by the Enable Interrupts (EI) instruction and
cleared by the Disable Interrupts (DI) instruction.
– Maskable interrupts disabled.
0
1 – Maskable interrupts enabled.
PThe Trace Trap Pending bit is used together
with the Trace (T) bit to prevent a Trace (TRC)
trap from occurring more than once for one instruction. At the beginning of the execution of
an instruction, the state of the T bit is copied
into the P bit. If the P bit remains set at the end
of the instruction execution, the TRC trap is
taken.
– No trace trap pending.
0
– Trace trap pending.
1
IThe Global Maskable Interrupt Enable bit is
used to enable or disable maskable interrupts.
If this bit and the Local Maskable Interrupt Enable (E) bit are both set, all maskable interrupts are taken. If either bit is clear, only the
non-maskable interrupt is taken. Unlike the E
bit, the I bit is automatically cleared when an
interrupt occurs and automatically set upon
completion of an interrupt handler.
– Maskable interrupts disabled.
0
1 – Maskable interrupts enabled.
Bits Z, C, L, N, and F of the PSR are referenced from assembly language by the condition code in conditional
branch instructions. A conditional branch instruction may
cause a branch in program execution, based on the value of
one or more of these PSR bits. For example, one of the
Bcond instructions, BEQ (Branch EQual), causes a branch
if the PSR.Z bit is set.
On reset, bits 0 through 11 of the PSR are cleared, except
for the PSR.E bit, which is set. On warm reset, the values of
each bit before reset are copied into the R2 general-purpose register. Bits 4 and 8 of the PSR have a constant value
of 0. Bits 12 through 15 are reserved. In general, status bits
are modified only by specific instructions. Otherwise, status
bits maintain their values throughout instructions which do
not implicitly affect them.
www.national.com16
Page 17
5.4CONFIGURATION REGISTER (CFG)
The CFG register is used to enable or disable various operating modes and to control optional on-chip caches. Because the CP3BT26 does not have cache memory, the
cache control bits in the CFG register are reserved. All CFG
bits are cleared on reset.
1510 987 6 52 1 0
ReservedSR ED 0 0Reserved0 0
EDThe Extended Dispatch bit selects whether
the size of an entry in the interrupt dispatch table (IDT) is 16 or 32 bits. Each entry holds the
address of the appropriate exception handler.
When the IDT has 16-bit entries, and all exception handlers must reside in the first 128K
of the address space. The location of the IDT
is held in the INTBASE register, which is not
affected by the state of the ED bit.
– Interrupt dispatch table has 16-bit entries.
0
1 – Interrupt dispatch table has 32-bit entries.
SRThe Short Register bit enables a compatibility
mode for the CR16B large model. In the
CR16C core, registers R12, R13, and RA are
extended to 32 bits. In the CR16B large model, only the lower 16 bits of these registers are
used, and these “short registers” are paired
together for 32-bit operations. In this mode,
the (RA, R13) register pair is used as the extended RA register, and address displacements relative to a single register are
supported with offsets of 0 and 14 bits in place
of the index addressing with these displacements.
– 32-bit registers are used.
0
1 – 16-bit registers are used (CR16B mode).
CP3BT26
17www.national.com
Page 18
5.5ADDRESSING MODES
The CR16C CPU core implements a load/store architecture, in which arithmetic and logical instructions operate on
register operands. Memory operands are made accessible
CP3BT26
in registers using load and store instructions. For efficient
implementation of I/O-intensive embedded applications, the
architecture also provides a set of bit operations that operate on memory operands.
The load and store instructions support these addressing
modes: register/pair, immediate, relative, absolute, and index addressing. When register pairs are used, the lower bits
are in the lower index register and the upper bits are in the
higher index register. When the CFG.SR bit is clear, the 32bit registers R12, R13, RA, and SP are also treated as register pairs.
References to register pairs in assembly language use parentheses. With a register pair, the lower numbered register
pair must be on the right. For example,
jump (r5, r4)
load $4(r4,r3), (r6,r5)
load $5(r12), (r13)
The instruction set supports the following addressing
modes:
Register/Pair
Mode
Immediate
Mode
Relative Mode In relative mode, the operand is ad-
In register/pair mode, the operand is held
in a general-purpose register, or in a general-purpose register pair. For example,
the following instruction adds the contents of the low byte of register r1 to the
contents of the low byte of r2, and places
the result in the low byte register r2. The
high byte of register r2 is not modified.
ADDB R1, R2
In immediate mode, the operand is a con-
stant value which is encoded in the instruction. For example, the following
instruction multiplies the value of r4 by 4
and places the result in r4.
MULW $4, R4
dressed using a relative value (displacement) encoded in the instruction. This
displacement is relative to the current
Program Counter (PC), a general-purpose register, or a register pair.
In branch instructions, the displacement
is always relative to the current value of
the PC Register. For example, the following instruction causes an unconditional
branch to an address 10 ahead of the
current PC.
BR *+10
In another example, the operand resides
in memory. Its address is obtained by
adding a displacement encoded in the instruction to the contents of register r5.
The address calculation does not modify
the contents of register r5.
LOADW 12(R5), R6
The following example calculates the ad-
dress of a source operand by adding a
displacement of 4 to the contents of a
register pair (r5, r4) and loads this operand into the register pair (r7, r6). r7 receives the high word of the operand, and
r6 receives the low word.
LOADD 4(r5, r4), (r7, r6)
Index ModeIn index mode, the operand address is
calculated with a base address held in either R12 or R13. The CFG.SR bit must
be clear to use this mode.
For relative mode operands, the mem-
ory address is calculated by adding
the value of a register pair and a displacement to the base address. The
displacement can be a 14 or 20-bit unsigned value, which is encoded in the
instruction.
For absolute mode operands, the
memory address is calculated by adding a 20-bit absolute address encoded
in the instruction to the base address.
In the following example, the operand address is the sum of the displacement 4,
the contents of the register pair (r5,r4),
and the base address held in register r12.
The word at this address is loaded into
register r6.
LOADW [r12]4(r5, r4), r6
Absolute Mode In absolute mode, the operand is located
in memory, and its address is encoded in
the instruction (normally 20 or 24 bits).
For example, the following instruction
loads the byte at address 4000 into the
lower 8 bits of register r6.
LOADB 4000, r6
For additional information on the addressing modes, see the
CompactRISC CR16C Programmer's Reference Manual.
www.national.com18
Page 19
5.6STACKS
A stack is a last-in, first-out data structure for dynamic storage of data and addresses. A stack consists of a block of
memory used to hold the data and a pointer to the top of the
stack. As more data is pushed onto a stack, the stack grows
downward in memory. The CR16C supports two types of
stacks: the interrupt stack and program stacks.
5.6.1Interrupt Stack
The processor uses the interrupt stack to save and restore
the program state during the exception handling. Hardware
automatically pushes this data onto the interrupt stack before entering an exception handler. When the exception
handler returns, hardware restores the processor state with
data popped from the interrupt stack. The interrupt stack
pointer is held in the ISP register.
5.6.2Program Stack
The program stack is normally used by software to save and
restore register values on subroutine entry and exit, hold local and temporary variables, and hold parameters passed
between the calling routine and the subroutine. The only
hardware mechanisms which operate on the program stack
are the PUSH, POP, and POPRET instructions.
5.6.3User and Supervisor Stack Pointers
To support multitasking operating systems, support is provided for two program stack pointers: a user stack pointer
and a supervisor stack pointer. When the PSR.U bit is clear,
the SP register is used for all program stack operations. This
is the default mode when the user/supervisor protection
mechanism is not used, and it is the supervisor mode when
protection is used.
When the PSR.U bit is set, the processor is in user mode,
and the USP register is used as the program stack pointer.
User mode can only be entered using the JUSR instruction,
which performs a jump and sets the PSR.U bit. User mode
is exited when an exception is taken and re-entered when
the exception handler returns. In user mode, the LPRD instruction cannot be used to change the state of processor
registers (such as the PSR).
5.7INSTRUCTION SET
Table 4 lists the operand specifiers for the instruction set,
and Table 5 is a summary of all instructions. For each instruction, the table shows the mnemonic and a brief description of the operation performed.
In the mnemonic column, the lower-case letter “i” is used to
indicate the type of integer that the instruction operates on,
either “B” for byte or “W” for word. For example, the notation
ADDi for the “add” instruction means that there are two
forms of this instruction, ADDB and ADDW, which operate
on bytes and words, respectively.
Similarly, the lower-case string “cond” is used to indicate the
type of condition tested by the instruction. For example, the
notation Jcond represents a class of conditional jump instructions: JEQ for Jump on Equal, JNE for Jump on Not
Equal, etc. For detailed information on all instructions, see
the CompactRISC CR16C Programmer's Reference Manu-al.
Table 4 Key to Operand Specifiers
Operand SpecifierDescription
absAbsolute address
disp
imm
IpositionBit position in memory
RbaseBase register (relative mode)
RdestDestination register
RindexIndex register
RPbase, RPbasexBase register pair (relative mode)
RPdestDestination register pair
RPlinkLink register pair
RpositionBit position in register
Displacement (numeric suffix
indicates number of bits)
Immediate operand (numeric suf-
fix indicates number of bits)
CP3BT26
Rproc16-bit processor register
Rprocd32-bit processor register
RPsrcSource register pair
RPtargetTarget register pair
Rsrc, Rsrc1, Rsrc2Source register
19www.national.com
Page 20
Table 5 Instruction Set Summary
CP3BT26
MnemonicOperandsDescription
MOViRsrc/imm, RdestMove
MOVXBRsrc, RdestMove with sign extension
MOVZBRsrc, RdestMove with zero extension
MOVXWRsrc, RPdestMove with sign extension
MOVZWRsrc, RPdestMove with zero extension
MOVDimm, RPdestMove immediate to register-pair
RPsrc, RPdestMove between register-pairs
ADD[U]iRsrc/imm, RdestAdd
ADDCiRsrc/imm, RdestAdd with carry
ADDDRPsrc/imm, RPdestAdd with RP or immediate.
MACQWaRsrc1, Rsrc2, RPdestMultiply signed Q15:
RPdest := RPdest + (Rsrc1 × Rsrc2)
MACSWaRsrc1, Rsrc2, RPdestMultiply signed and add result:
RPdest := RPdest + (Rsrc1 × Rsrc2)
MACUWaRsrc1, Rsrc2, RPdestMultiply unsigned and add result:
RPsrc, (Rindex)disp(RPbasex)Store (register pair index relative)
RPsrc, (Rindex)absStore (absolute index relative)
STOR IMMimm4, disp(Rbase)Store unsigned 4-bit immediate value extended to operand
imm4, disp(RPbase)
imm4, (Rindex)disp(RPbasex)
imm4, abs
imm4, (Rindex)abs
LOADMimm3Load 1 to 8 registers (R2-R5, R8-R11) from memory
length in memory
starting at (R0)
LOADMPimm3Load 1 to 8 registers (R2-R5, R8-R11) from memory
STORMSTORM imm3Store 1 to 8 registers (R2-R5, R8-R11) to memory starting
www.national.com22
starting at (R1, R0)
at (R2)
Page 23
Table 5 Instruction Set Summary
MnemonicOperandsDescription
STORMPimm3Store 1 to 8 registers (R2-R5, R8-R11) to memory starting
at (R7,R6)
DIDisable maskable interrupts
EIEnable maskable interrupts
EIWAITEnable maskable interrupts and wait for interrupt
NOPNo operation
WAITWait for interrupt
CP3BT26
23www.national.com
Page 24
6.0Memory
The CP3BT26 supports a uniform 16M-byte linear address
space. Table 6 lists the types of memory and peripherals
CP3BT26
that occupy this memory space. Unlisted address ranges
Table 6 CP3BT26 Memory Map
are reserved and must not be read or written. The BIU
zones are regions of the address space that share the same
control bits in the Bus Interface Unit (BIU).
Start
Address
00 0000h03 FFFFh256K
04 0000h0C FFFFh576KReserved
0D 0000h0D 1FFFh8KOn-chip Flash Data Memory
0D 2000h0D FFFFh56KReserved
0E 0000h0E 7FFFh32KSystem RAMN/A
0E 8000h0E 91FFh4.5KBluetooth Data RAM
0E 9200h0E E7FFh21.5KReserved
0E E800h0E EBFFh1KBluetooth Lower Link Controller Sequencer RAM
0E EC00h0E EFFFh1KReserved
0E F000h0E F13Fh320CAN Buffers and Registers
0E F140h0E F17Fh64Reserved
0E F180h0E F1FFh128Bluetooth Lower Link Controller Registers
0E F200h0F FFFFh67KReserved
10 0000h3F FFFFh3072KReserved
End
Address
Size in
Bytes
DescriptionBIU Zone
On-chip Flash Program Memory, including Boot
Memory
Static Zone 0
(mapped internally
in IRE and ERE
mode; mapped to
the external bus in
DEV mode)
40 0000h7F FFFFh4096KExternal Memory Zone 1Static Zone 1
80 0000hFE FFFFh8128KExternal Memory Zone 2Static Zone 2
FF 0000hFF F1FFh61952Reserved
FF F200hFF F5FFh1KPeripherals and Other I/O PortsN/A
FF FC00hFF FFFFh1KPeripherals and Other I/O PortsN/A
6.1OPERATING ENVIRONMENT
The operating environment controls whether external memory is supported and whether the reset vector jumps to a
code space intended to support In-System Programming
(ISP). Up to 12M of external memory space is available.
The operating mode of the device is controlled by the states
on the ENV[2:0] pins at reset and the states of the EMPTY
bits in the Protection Word, as shown in Table 7. Internal
pullups on the ENV[2:0] pins select IRE mode or ISP mode
if these pins are allowed to float.
When ENV[2:0] = 111b, IRE mode is selected unless the
EMPTY bits in the Protection word indicate that the program
flash memory is empty (unprogrammed), in which case ISP
mode is selected. When ENV[2:0] = 011b, ERE mode is selected unless the EMPTY bits indicate that the program
flash memory is empty, in which case ISP mode is selected.
When ENV[2:0] = 110b, ISP mode is selected without regard to the states of the EMPTY bits. See Section 8.4.2 for
more details.
In the DEV environment, the on-chip flash memory is disabled, and the corresponding region of the address space
is mapped to external memory. DEVINT mode is equivalent
to DEV mode but maps static memory zone 0 to the on-chip
memory.
www.national.com24
Page 25
Table 7 Operating Environment Selection
ENV[2:0] EMPTYOperating Environment
111NoInternal ROM enabled (IRE) mode
011NoExternal ROM enabled (ERE) mode
000N/ADevelopment (DEV) mode
001N/A
110N/AIn-System-Programming (ISP) mode
111YesIn-System-Programming (ISP) mode
011YesIn-System-Programming (ISP) mode
Development (DEVINT) mode with
internal memory
6.2BUS INTERFACE UNIT (BIU)
The BIU controls the interface between the CPU core bus
and those on-chip modules which are mapped into BIU
zones. These on-chip modules are the flash program memory and the I/O zone. The BIU controls the configured parameters for bus access (such as the number of wait states
for memory access) and issues the appropriate bus signals
for the requested access.
6.3BUS CYCLES
There are four types of data transfer bus cycles:
Normal read
Fast read
Early write
Late write
The type of data cycle used in a particular transaction depends on the type of CPU operation (a write or a read), the
type of memory or I/O being accessed, and the access type
programmed into the BIU control registers (early/late write
or normal/fast read).
For read operations, a basic normal read takes two clock cycles, and a fast-read bus cycle takes one clock cycle. Normal read bus cycles are enabled by default after reset.
For write operations, a basic late-write bus cycle takes two
clock cycles, and a basic early-write bus cycle takes three
clock cycles. Early-write bus cycles are enabled by default
after reset. However, late-write bus cycles are needed for
ordinary write operations, so this configuration must be
changed by software (see Section 6.4.1).
In certain cases, one or more additional clock cycles are
added to a bus access cycle. There are two types of additional clock cycles for ordinary memory accesses, called internal wait cycles (TIW) and hold (T
A wait cycle is inserted in a bus cycle just after the memory
address has been placed on the address bus. This gives the
accessed memory more time to respond to the transaction
request.
A hold cycle is inserted at the end of a bus cycle. This holds
the data on the data bus for an extended number of clock cycles.
hold
) cycles.
6.4BIU CONTROL REGISTERS
The BIU has a set of control registers that determine how
many wait cycles and hold cycles are to be used for accessing memory. During initialization of the system, these registers should be programmed with appropriate values so that
the minimum allowable number of cycles is used. This number varies with the clock frequency.
There are five BIU control registers, as listed in Table 8.
These registers control the bus cycle configuration used for
accessing the various on-chip memory types.
Table 8 Bus Control Registers
NameAddressDescription
BCFGFF F900hBIU Configuration Register
IOCFGFF F902h
SZCFG0FF F904h
SZCFG1FF F906h
SZCFG2FF F908h
6.4.1BIU Configuration Register (BCFG)
The BCFG register is a byte-wide, read/write register that
selects early-write or late-write bus cycles. At reset, the register is initialized to 07h. The register format is shown below.
73210
Reserved11EWR
EWRThe Early Write bit controls write cycle timing.
– Late-write operation (2 clock cycles to
0
write).
– Early-write operation.
1
At reset, the BCFG register is initialized to 07h, which selects early-write operation. However, late-write operation is
required for normal device operation, so software must
change the register value to 06h. Bits 1 and 2 of this register
must always be set when writing to this register.
I/O Zone Configuration
Register
Static Zone 0
Configuration Register
Static Zone 1
Configuration Register
Static Zone 2
Configuration Register
CP3BT26
25www.national.com
Page 26
6.4.2I/O Zone Configuration Register (IOCFG)
The IOCFG register is a word-wide, read/write register that
controls the timing and bus characteristics of accesses to
the 256-byte I/O Zone memory space (FF FB00h to FF
CP3BT26
FBFFh). The registers associated with Port B and Port C reside in the I/O memory array. At reset, the register is initialized to 069Fh. The register format is shown below.
7654320
BWReservedHOLDWAIT
151098
ReservedIPST Res.
WAITThe Memory Wait Cycles field specifies the
number of TIW (internal wait state) clock cycles added for each memory access, ranging
from 000 binary for no additional TIW wait cycles to 111 binary for seven additional TIW
wait cycles.
HOLDThe Memory Hold Cycles field specifies the
number of T
memory access, ranging from 00b for no
T
cycles to 11b for three T
hold
cles.
BWThe Bus Width bit defines the bus width of the
IO Zone.
– 8-bit bus width.
0
1 – 16-bit bus width (default)
IPSTThe Post Idle bit controls whether an idle cycle
follows the current bus cycle, when the next
bus cycle accesses a different zone. No idle
cycles are required for on-chip accesses.
– No idle cycle (recommended).
0
1 – Idle cycle.
clock cycles used for each
hold
hold
clock cy-
6.4.3Static Zone 0 Configuration Register (SZCFG0)
The SZCFG0 register is a word-wide, read/write register
that controls the timing and bus characteristics of Zone 0
memory accesses. Zone 0 is used for the on-chip flash
memory (including the boot area, program memory, and
data memory).
At reset, the register is initialized to 069Fh. The register format is shown below.
7654320
BWWBR RBEHOLDWAIT
1512111098
ReservedFRE IPRE IPST Res.
WAITThe Memory Wait field specifies the number
of TIW (internal wait state) clock cycles added
for each memory access, ranging from 000b
for no additional TIW wait cycles to 111b for
seven additional TIW wait cycles. These bits
are ignored if the SZCFG0.FRE bit is set.
HOLDThe Memory Hold field specifies the number
of T
access, ranging from 00b for no T
to 11b for three T
are ignored if the SZCFG0.FRE bit is set.
RBEThe Read Burst Enable enables burst cycles
on 16-bit reads from 8-bit bus width regions of
the address space. Because the flash program memory is required to be 16-bit bus
width, the RBE bit is a don’t care bit. This bit
is ignored when the SZCFG0.FRE bit is set.
0
1 – Burst read enabled.
WBRThe Wait on Burst Read bit controls if a wait
state is added on burst read transaction. This
bit is ignored, when SZCFG0.FRE bit is set or
when SZCFG0.RBE is clear.
0
1 – One TBW on burst read cycles.
BWThe Bus Width bit controls the bus width of the
zone. The flash program memory must be
configured for 16-bit bus width.
0
1
FREThe Fast Read Enable bit controls whether
fast read bus cycles are used. A fast read operation takes one clock cycle. A normal read
operation takes at least two clock cycles.
0
1
IPSTThe Post Idle bit controls whether an idle cycle
follows the current bus cycle, when the next
bus cycle accesses a different zone. No idle
cycles are required for on-chip accesses.
0
1
clock cycles used for each memory
hold
clock cycles. These bits
hold
– Burst read disabled.
– No TBW on burst read cycles.
– 8-bit bus width.
– 16-bit bus width (required).
– Normal read cycles.
– Fast read cycles.
– No idle cycle (recommended).
– Idle cycle inserted.
hold
cycles
www.national.com26
Page 27
IPREThe Preliminary Idle bit controls whether an
idle cycle is inserted prior to the current bus
cycle, when the new bus cycle accesses a different zone. No idle cycles are required for onchip accesses.
– No idle cycle (recommended).
0
– Idle cycle inserted.
1
6.4.4Static Zone 1 Configuration Register (SZCFG1)
The SZCFG1 register is a word-wide, read/write register
that controls the timing and bus characteristics for off-chip
accesses selected with the SEL1
At reset, the register is initialized to 069Fh. The register format is shown below.
7654320
BWWBR RBEHOLDWAIT
output signal.
IPSTThe Post Idle bit controls whether an idle cycle
follows the current bus cycle, when the next
bus cycle accesses a different zone.
– No idle cycle.
0
1 – Idle cycle inserted.
IPREThe Preliminary Idle bit controls whether an
idle cycle is inserted prior to the current bus
cycle, when the new bus cycle accesses a different zone.
– No idle cycle.
0
1
– Idle cycle inserted.
6.4.5Static Zone 2 Configuration Register (SZCFG2)
The SZCFG2 register is a word-wide, read/write register
that controls the timing and bus characteristics for off-chip
accesses selected with the SEL2 output signal.
At reset, the register is initialized to 069Fh. The register format is shown below.
CP3BT26
1512111098
ReservedFRE IPRE IPST Res.
WAITThe Memory Wait field specifies the number
of TIW (internal wait state) clock cycles added
for each memory access, ranging from 000b
for no additional TIW wait cycles to 111b for
seven additional TIW wait cycles. These bits
are ignored if the SZCFG1.FRE bit is set.
HOLDThe Memory Hold field specifies the number
of T
access, ranging from 00b for no T
to 11b for three T
are ignored if the SZCFG1.FRE bit is set.
RBEThe Read Burst Enable enables burst cycles
on 16-bit reads from 8-bit bus width regions of
the address space. This bit is ignored when
the SZCFG1.FRE bit is set or the
SZCFG1.BW is clear.
0
1
WBRThe Wait on Burst Read bit controls if a wait
state is added on burst read transaction. This
bit is ignored, when SZCFG1.FRE bit is set or
when SZCFG1.RBE is clear.
0
1
BWThe Bus Width bit controls the bus width of the
zone.
0
1
FREThe Fast Read Enable bit controls whether
fast read bus cycles are used. A fast read operation takes one clock cycle. A normal read
operation takes at least two clock cycles.
0
1
clock cycles used for each memory
hold
clock cycles. These bits
hold
– Burst read disabled.
– Burst read enabled.
– No TBW on burst read cycles.
– One TBW on burst read cycles.
– 8-bit bus width.
– 16-bit bus width.
– Normal read cycles.
– Fast read cycles.
hold
cycles
7654320
BWWBR RBEHOLDWAIT
1512111098
ReservedFRE IPRE IPST Res.
WAITThe Memory Wait field specifies the number
of TIW (internal wait state) clock cycles added
for each memory access, ranging from 000b
for no additional TIW wait cycles to 111b for
seven additional TIW wait cycles. These bits
are ignored if the SZCFG2.FRE bit is set.
HOLDThe Memory Hold field specifies the number
of T
access, ranging from 00b for no T
to 11b for three T
are ignored if the SZCFG2.FRE bit is set.
RBEThe Read Burst Enable enables burst cycles
on 16-bit reads from 8-bit bus width regions of
the address space. This bit is ignored when
the SZCFG2.FRE bit is set or the
SZCFG2.BW is clear.
0
1
WBRThe Wait on Burst Read bit controls if a wait
state is added on burst read transaction. This
bit is ignored, when SZCFG2.FRE bit is set or
when SZCFG2.RBE is clear.
0
1
BWThe Bus Width bit controls the bus width of the
zone.
0
1
clock cycles used for each memory
hold
clock cycles. These bits
hold
– Burst read disabled.
– Burst read enabled.
– No TBW on burst read cycles.
– One TBW on burst read cycles.
– 8-bit bus width.
– 16-bit bus width.
hold
cycles
27www.national.com
Page 28
FREThe Fast Read Enable bit controls whether
fast read bus cycles are used. A fast read operation takes one clock cycle. A normal read
CP3BT26
IPSTThe Post Idle bit controls whether an idle cycle
IPREThe Preliminary Idle bit controls whether an
operation takes at least two clock cycles.
– Normal read cycles.
0
1 – Fast read cycles.
follows the current bus cycle, when the next
bus cycle accesses a different zone.
– No idle cycle.
0
1
– Idle cycle inserted.
idle cycle is inserted prior to the current bus
cycle, when the new bus cycle accesses a different zone.
– No idle cycle.
0
1 – Idle cycle inserted.
6.5WAIT AND HOLD STATES
The number of wait cycles and hold cycles inserted into a
bus cycle depends on whether it is a read or write operation,
the type of memory or I/O being accessed, and the control
register settings.
6.5.1Flash Program/Data Memory
When the CPU accesses the Flash program and data memory (address ranges 000000h
0E1FFFh), the number of added wait and hold cycles depends on the type of access and the BIU register settings.
In fast-read mode (SZCFG0.FRE=1), a read operation is a
single cycle access. This limits the maximum CPU operating frequency to 24 MHz.
For a read operation in normal-read mode
(SZCFG0.FRE=0), the number of inserted wait cycles is
specified in the SZCFG0.WAIT field. The total number of
wait cycles is the value in the WAIT field plus 1, so it can
range from 1 to 8. The number of inserted hold cycles is
specified in the SCCFG0.HOLD field, which can range from
0 to 3.
For a write operation in fast read mode (SZCFG0.FRE=1),
the number of inserted wait cycles is 1. No hold cycles are
used.
For a write operation normal read mode (SZCFG0.FRE=0),
the number of wait cycles is equal to the value written to the
SZCFG0.WAIT field plus 1 (in the late write mode) or 2 (in
the early write mode). The number of inserted hold cycles is
equal to the value written to the SCCFG0.HOLD field, which
can range from 0 to 3.
6.5.2RAM Memory
Read and write accesses to on-chip RAM is performed within a single cycle, without regard to the BIU settings. The
RAM address is in the range of 0E 0000h
8000h–0E 91FFh.
–03FFFFh and 0E0000h–
–0E 7FFFh and 0E
www.national.com28
6.5.3Access to Peripherals
When the CPU accesses on-chip peripherals in the range of
0E F000h
cycle and one preliminary idle cycle is used. No hold cycles
are used. The IOCFG register determines the access timing
for the address range FF FB00h
–0E F1FFh and FF 0000h–FF FBFFh, one wait
–FF FBFFh.
Page 29
7.0System Configuration Registers
The system configuration registers control and provide status for certain aspects of device setup and operation, such
as indicating the states sampled from the ENV[2:0] inputs.
The system configuration registers are listed in Table 9.
Table 9 System Configuration Registers
NameAddressDescription
MCFGFF F910h
MSTATFF F914h
7.1MODULE CONFIGURATION REGISTER
(MCFG)
The MCFG register is a byte-wide, read/write register that
selects the clock output features of the device.
At reset, the register bits are cleared except for the
USB_ENABLE bit, which is set. Initialization software must
write a specific value to this register to enable the SCLK,
MCLK, output pin function.
The register must be written in active mode only, not in power save, HALT, or IDLE mode. However, the register contents are preserved during all power modes.
The MCFG register format is shown below.
Module Configuration
Register
Module Status
Register
USB_ENABLE
MISC_IO_SPEED
MEM_IO_SPEED
The USB_ENABLE bit can be used to force
an external USB transceiver into its low-power
mode. The power mode is dependent on the
USB controller status, the USB_ENABLE bit
in the Function Word (see Section 8.4.1), and
the USB_ENABLE bit in the MCFG register.
0
1 – Transceiver power mode dependent on
The MISC_IO_SPEED bit controls the slew
rate of the output drivers for the ENV[2:0],
RDY
noise, the slow slew rate is recommended.
0 – Fast slew rate.
1
The MEM_IO_SPEED bit controls the slew
rate of the output drivers for the A[22:0], RD,
SEL[2:0]
PC[7:0] pins. Memory speeds for the
CP3BT26 are characterized with fast slew
rate. Slow slew rate reduces the available
memory access time by 5 ns.
0
1
CP3BT26
– External USB transceiver forced into low-
power mode.
USB controller status and programming
of the Function Word. (This is the state of
the USB_ENABLE bit after reset.)
, RFDATA, and TDO pins. To minimize
– Slow slew rate.
, SELIO, WR[1:0], PB[7:0], and
– Fast slew rate.
– Slow slew rate.
76543210
MEM_IO
Res.
_SPEED
EXIOEThe EXIOE bit controls whether the external
PLLCLKOE
MCLKOEThe MCLKOE bit controls whether the Main
SCLKOEThe SCLKOE bit controls whether the Slow
MISC_IO
_SPEED
bus is enabled in the IRE environment for implementing the I/O Zone (FF FB00h
FBFFh).
– External bus disabled.
0
1 – External bus enabled.
The PLLCLKOE bit controls whether the PLL
clock is driven on the ENV0/PLLCLK pin.
– ENV0/PLLCLK pin is high impedance.
0
– PLL clock driven on the ENV0/PLLCLK
1
pin.
Clock is driven on the ENV1/CPUCLK pin.
– ENV1/CPUCLK pin is high impedance.
0
– Main Clock is driven on the ENV1/CPU-
1
CLK pin.
Clock is driven on the ENV2/SLOWCLK pin.
– ENV2/SLOWCLK pin is high impedance.
0
– Slow Clock is driven on the ENV2/SLOW-
1
CLK pin.
USB
_ENABLE
SCLKOEMCLKOEPLLCLKOEEXI
OE
–FF
29www.national.com
Page 30
7.2MODULE STATUS REGISTER (MSTAT)
The MSTAT register is a byte-wide, read-only register that
indicates the general status of the device. The MCFG register format is shown below.
CP3BT26
7654320
ISPRST WDRST Res.
OENV2:0The Operating Environment bits hold the
states sampled from the ENV[2:0] input pins
at reset. These states are controlled by external hardware at reset and are held constant in
the register until the next reset.
PGMBUSY The Flash Programming Busy bit is automati-
cally set when either the program memory or
the data memory is being programmed or
erased. It is clear when neither of the memories is busy. When this bit is set, software must
not attempt to program or erase either of
these two memories. This bit is a copy of the
FMBUSY bit in the FMSTAT register.
– Flash memory is not busy.
0
1 – Flash memory is busy.
DPGMBUSY
WDRSTThe Watchdog Reset bit indicates that a
ISPRSTThe Software ISP Reset bit indicates that a
The Data Flash Programming Busy indicates
that the flash data memory is being erased or
a pipelined programming sequence is currently ongoing. Software must not attempt to perform any write access to the flash program
memory at this time, without also polling the
FSMSTAT.FMFULL bit in the flash memory interface. The DPGMBUSY bit is a copy of the
FMBUSY bit in the FSMSTAT register.
– Flash data memory is not busy.
0
– Flash data memory is busy.
1
Watchdog timer reset has occurred. Write a 1
to this bit to clear it. Power-on reset also
clears this bit.
– No Watchdog timer reset has occurred
0
– A Watchdog timer reset has occurred
1
software ISP reset has occurred since the bit
was last cleared. This bit is cleared by a
SWRESET(CLR) sequence or a power-on reset.
– No software ISP reset has occurred since
0
– A software ISP reset has occurred since
1
DPGMBUSY
since this bit was last cleared.
since this bit was last cleared.
this bit was last cleared.
this bit was last cleared.
PGMBUSY
OENV2:0
7.3SOFTWARE RESET REGISTER
(SWRESET)
The SWRESET register is a byte-wide, write-only register
which provides a mechanism for software to initiate a reset
into ISP mode without regard to the status of the EMPTY
bits in the flash protection word. This form of reset is only allowed when all of the following conditions are true:
The device is in IRE or ERE mode
BOOTAREA is defined (has a value other than 1111b) in
the Protection Word (see Section 8.4.2 for more details).
ISPE is set in the flash protection word, indicating that
there is ISP code in the flash
To initiate a reset under these conditions, it is necessary to
write the value E1h to the SWRESET register, followed within 127 clock cycles by the value 3Eh. The reset then follows
immediately. This sequence is called SWRESET(ISP).
Once the device has been reset into ISP mode by SWRESET(ISP), any subsequent reset (other than internal or external power-on reset) will cause the part to reset into ISP
mode because the EMPTY bits in the Protection Word continue to be ignored.
A second set of special values written to the SWRESET register will cause a reset out of ISP mode (whether or not the
device is currently in ISP mode). This can be used as a simple software reset. In this case, no conditions are checked.
To initiate reset out of ISP mode, write the value E1h to the
SWRESET register, followed within 127 clock cycles by the
value 0Eh. The reset then follows immediately. This sequence is called SWRESET(CLR). This reset also cancels
the effect of any previous SWRESET(ISP), so subsequent
resets will check the EMPTY bits to determine whether to
enter ISP mode.
The ISP reset behaves similarly to the Watchdog reset, for
example, if the flash interface is busy when reset is asserted, the reset to the clock module is delayed until the flash
operations are completed.
www.national.com30
Page 31
8.0Flash Memory
The flash memory consists of the flash program memory
and the flash data memory. The flash program memory is
further divided into the Boot Area and the Code Area.
A special protection scheme is applied to the lower portion
of the flash program memory, called the Boot Area. The
Boot Area always starts at address 0 and ranges up to a
programmable end address. The maximum boot area address which can be selected is 00 77FFh. The intended use
of this area is to hold In-System-Programming (ISP) routines or essential application routines. The Boot Area is always protected against CPU write access, to avoid
unintended modifications.
The Code Area is intended to hold the application code and
constant data. The Code Area begins with the next byte after the Boot Area. Table 10 summarizes the properties of
the regions of flash memory mapped into the CPU address
space.
Table 10 Flash Memory Areas
AreaAddress Range
Boot
Area
Code
Area
Data
Area
–BOOTAREA - 1YesNo
0
BOOTAREA–03 FFFFhYes
0E 0000h
–0E 1FFFhYes
8.1FLASH MEMORY PROTECTION
The memory protection mechanisms provide both global
and section-level protection. Section-level protection
against CPU writes is applied to individual 8K-byte sections
of the flash program memory and 512-byte sections of the
flash data memory. Section-level protection is controlled
through read/write registers mapped into the CPU address
space. Global write protection is applied at the device level,
to disable flash memory writes by the CPU. Global write protection is controlled by the encoding of bits stored in the
flash memory array.
8.1.1Section-Level Protection
Each bit in the Flash Memory Write Enable (FM0WER and
FM1WER) registers enables or disables write access to a
corresponding section of flash program memory. Write access to the flash data memory is controlled by the bits in the
Flash Slave Memory Write Enable (FSM0WER) register. By
Read
Access
Write Access
Write access
only if section
write enable
bit is set and
global write
protection is
disabled.
Write access
only if section
write enable
bit is set and
global write
protection is
disabled.
default (after reset) all bits in the FM0WER, FM1WER, and
FSM0WER registers are cleared, which disables write access by the CPU to all sections. Write access to a section is
enabled by setting the corresponding write enable bit. After
completing a programming or erase operation, software
should clear all write enable bits to protect the flash program
memory against any unintended writes.
8.1.2Global Protection
The WRPROT field in the Protection Word controls global
write protection. The Protection Word is located in a special
flash memory outside of the CPU address space. If a majority of the bits in the 3-bit WRPROT field are clear, write protection is enabled. Enabling this mode prevents the CPU
from writing to flash memory.
The RDPROT field in the Protection Word controls global
read protection. If a majority of the bits in the 3-bit RDPROT
field are clear, read protection is enabled. Enabling this
mode prevents reading by an external debugger through the
serial debug interface or by an external flash programmer.
CPU read access is not affected by the RDPROT bits.
8.2FLASH MEMORY ORGANIZATION
Each of the flash memories are divided into main blocks and
information blocks. The main blocks hold the code or data
used by application software. The information blocks hold
factory parameters, protection settings, and other devicespecific data. The main blocks are mapped into the CPU address space. The information blocks are accessed indirectly
through a register-based interface. Separate sets of registers are provided for accessing flash program memory (FM
registers) and flash data memory (FSM registers). The flash
program memory consists of two main blocks and two data
blocks, as shown in Table 11. The flash data memory consists of one main block and one information block.
Table 11 Flash Memory Blocks
NameAddress RangeFunction
Main Block 0
Information
Block 0
Main Block 1
Information
Block 1
Main Block 2
Information
Block 2
00 0000h
(CPU address space)
(address register)
02 0000h
(CPU address space)
(address register)
0D 0000h
(CPU address space)
(address register)
000h
080h
000h
–01 FFFFh
–07Fh
–03 FFFFh
–0FFh
–0D 1FFFh
–07Fh
Flash Program
Memory
Function Word,
Factory
Parameters
Flash Program
Memory
Protection Word,
User Data
Flash Data
Memory
User Data
CP3BT26
31www.national.com
Page 32
8.2.1Main Block 0 and 1
Main Block 0 and Main Block 1 hold the 256K-byte program
space, which consists of the Boot Area and Code Area.
Each block consists of sixteen 8K-byte sections. Write ac-
CP3BT26
cess by the CPU to Main Block 0 and Main Block 1 is controlled by the corresponding bits in the FM0WER and
FM1WER registers, respectively. The least significant bit in
each register controls the section at the lowest address.
8.2.2Information Block 0
Information Block 0 contains 128 bytes, of which one 16-bit
word has a dedicated function, called the Function Word.
The Function Word resides at address 07Eh. It controls the
power mode of an external USB transceiver. The remaining
Information Block 0 locations are used to hold factory parameters.
Software only has read access to Information Block 0
through a register-based interface. The Function Word and
the factory parameters are protected against CPU writes.
Table 12 shows the structure of Information Block 0.
Table 12 Information Block 0
Name
Function
Word
Other (Used
for Factory
Parameters)
8.2.3Information Block 1
Information Block 1 contains 128 bytes, of which one 16-bit
word has a dedicated function, called the Protection Word.
The Protection Word resides at address 0FEh. It controls
the global protection mechanisms and the size of the Boot
Area. The Protection Word can be written by the CPU, however the changes only become valid after the next device reset. The remaining Information Block 1 locations can be
used to store other user data. Erasing Information Block 1
also erases Main Block 1. Table 13 shows the structure of
the Information Block 1.
Name
Protection
Word
Other
(User Data)
Address
Range
–07Fh
07Eh
–07Dh
000h
Table 13 Information Block 1
Address
Range
–0FFh
0FEh
–0FDh
080h
Read
Access
Ye sN o
Read
Access
Ye s
Write Access
Write Access
Write access only
if section write
enable bit is set
and global write
protection is dis-
abled.
8.2.4Main Block 2
Main Block 2 holds the 8K-byte data area, which consists of
sixteen 512-byte sections. Write access by the CPU to Main
Block 2 is controlled by the corresponding bits in the
FSM0WER register. The least significant bit in the register
controls the section at the lowest address.
8.2.5Information Block 2
Information Block 2 contains 128 bytes, which can be used
to store user data. The CPU can always read Information
Block 2. The CPU can write Information Block 2 only when
global write protection is disabled. Erasing Information
Block 2 also erases Main Block 2.
8.3FLASH MEMORY OPERATIONS
Flash memory programming (erasing and writing) can be
performed on the flash data memory while the CPU is executing out of flash program memory. Although the CPU can
execute out of flash data memory, it cannot erase or write
the flash program memory while executing from flash data
memory. To erase or write the flash program memory, the
CPU must be executing from the on-chip static RAM or offchip memory.
An erase operation is required before programming. An
erase operation sets all of the bits in the erased region. A
programming operation clears selected bits.
The programming mechanism is pipelined, so that a new
write request can be loaded while a previous request is in
progress. When the FMFULL bit in the FMSTAT or FSMSTAT register is clear, the pipeline is ready to receive a new
request. New requests may be loaded after checking only
the FMFULL bit.
8.3.1Main Block Read
Read accesses from flash program memory can only occur
when the flash program memory is not busy from a previous
write or erase operation. Read accesses from the flash data
memory can only occur when both the flash program memory and the flash data memory are not busy. Both byte and
word read operations are supported.
8.3.2Information Block Read
Information block data is read through the register-based interface. Only word read operations are supported and the
read address must be word-aligned (LSB = 0). The following
steps are used to read from an information block:
1. Load the word address in the Flash Memory Information Block Address (FMIBAR) or Flash Slave Memory
Information Block Address (FSMIBAR) register.
2. Read the data word by reading out the Flash Memory
Information Block Data (FMIBDR) or Flash Slave Memory Information Block Data (FSMIBDR) register.
www.national.com32
Page 33
8.3.3Main Block Page Erase
A flash erase operation sets all of the bits in the erased region. Pages of a main block can be individually erased if
their write enable bits are set. This method cannot be used
to erase the boot area, if defined. Each page in Main Block
0 and 1 consists of 1024 bytes (512 words). Each page in
Main Block 2 consists of 512 bytes (256 words). To erase a
page, the following steps are performed:
1. Verify that the Flash Memory Busy (FMBUSY) bit in the
FMSTAT or FSMSTAT register is clear.
2. Prevent accesses to the flash memory while erasing is
in progress.
3. Set the Page Erase (PER) bit in the FMCTRL or FSMCTRL register.
4. Write to an address within the desired page.
5. Wait until the FMBUSY bit becomes clear again.
6. Check the Erase Error (EERR) bit in the FMSTAT or
FSMSTAT register to confirm successful erase of the
page.
7. Repeat steps 4 through 6 to erase additional pages.
8. Clear the PER bit.
8.3.4Main Block Module Erase
A module erase operation can be used to erase an entire
main block. All sections within the block must be enabled for
writing. If a boot area is defined in the block, it cannot be
erased. The following steps are performed to erase a main
block:
1. Verify that the Flash Memory Busy (FMBUSY) bit in the
FMSTAT or FSMSTAT register is clear.
2. Prevent accesses to the flash memory while erasing is
in progress.
3. Set the Module Erase (MER) bit in the FMCTRL or
FSMCTRL register.
4. Write to any address within the desired main block.
5. Wait until the FMBUSY bit becomes clear again.
6. Check the Erase Error (EERR) bit in the FMSTAT or
FSMSTAT register to confirm successful erase of the
block.
7. Clear the MER bit.
8.3.5Information Block Module Erase
Erasing an information block also erases the corresponding
main block. If a boot area is defined in the main block, neither block can be erased. Page erase is not supported for
information blocks. The following steps are performed to
erase an information block:
1. Verify that the Flash Memory Busy (FMBUSY) bit in the
FMSTAT or FSMSTAT register is clear.
2. Prevent accesses to the flash memory while erasing is
in progress.
3. Set the Module Erase (MER) bit in the FMCTRL or
FSMCTRL register.
4. Load the FMIBAR or FSMIBAR register with any address within the block, then write any data to the FMIBDR or FSMIBDR register.
5. Wait until the FMBUSY bit becomes clear again.
6. Check the Erase Error (EERR) bit in the FMSTAT or
FSMSTAT register to confirm successful erase of the
block.
7. Clear the MER bit.
CP3BT26
8.3.6Main Block Write
Writing is only allowed when global write protection is disabled. Writing by the CPU is only allowed when the write enable bit is set for the sector which contains the word to be
written. The CPU cannot write the Boot Area. Only wordwide write access to word-aligned addresses is supported.
The following steps are performed to write a word:
1. Verify that the Flash Memory Busy (FMBUSY) bit in the
FMSTAT or FSMSTAT register is clear.
2. Prevent accesses to the flash memory while the write
is in progress.
3. Set the Program Enable (PE) bit in the FMCTRL or
FSMCTRL register.
4. Write a word to the desired word-aligned address. This
starts a new pipelined programming sequence. The
FMBUSY bit becomes set while the write operation is in
progress. The FMFULL bit in the FMSTAT or FSMSTAT
register becomes set if a previous write operation is still
in progress.
5. Wait until the FMFULL bit becomes clear.
6. Repeat steps 4 and 5 for additional words.
7. Wait until the FMBUSY bit becomes clear again.
8. Check the programming error (PERR) bit in the FMSTAT or FSMSTAT register to confirm successful programming.
9. Clear the Program Enable (PE) bit.
8.3.7Information Block Write
Writing is only allowed when global write protection is disabled. Writing by the CPU is only allowed when the write enable bit is set for the sector which contains the word to be
written. The CPU cannot write Information Block 0. Only
word-wide write access to word-aligned addresses is supported. The following steps are performed to write a word:
1. Verify that the Flash Memory Busy (FMBUSY) bit in the
FMSTAT or FSMSTAT register is clear.
2. Prevent accesses to the flash memory while the write
is in progress.
3. Set the Program Enable (PE) bit in the FMCTRL or
FSMCTRL register.
4. Write the desired target address into the FMIBAR or
FSMIBAR register.
5. Write the data word into the FMIBDR or FSMIBDR register. This starts a new pipelined programming sequence. The FMBUSY bit becomes set while the write
operation is in progress. The FMFULL bit in the FMSTAT or FSMSTAT register becomes set if a previous
write operation is still in progress.
6. Wait until the FMFULL bit becomes clear.
7. Repeat steps 4 through 6 for additional words.
8. Wait until the FMBUSY bit becomes clear again.
9. Check the programming error (PERR) bit in the FMSTAT or FSMSTAT register to confirm successful programming.
10. Clear the Program Enable (PE) bit.
33www.national.com
Page 34
8.4INFORMATION BLOCK WORDS
Two words in the information blocks are dedicated to hold
settings that affect the operation of the system: the Function
Word in Information Block 0 and the Protection Word in In-
CP3BT26
formation Block 1.
8.4.1Function Word
The Function Word resides in the Information Block 0 at address 07Eh. At reset, the Function Word is copied into the
FMAR0 register.
Table 14 lists all possible boot area encodings.
Table 14 Boot Area Encodings
BOOT
AREA
1111No Boot Area defined00 0000h
11102K bytes00 0800h
Size of the Boot
Area
Code Area
Start
Address
1510
ReservedUSB_ENABLE
USB_ENABLE
8.4.2Protection Word
The Protection Word resides in Information Block 1 at address 0FEh. At reset, the Protection Word is copied into the
FMAR1 register.
151312109764310
WRPROT RDPROT ISPE EMPTYBOOTAREA
BOOTAREA The BOOTAREA field specifies the size of the
The USB_ENABLE bit can be used to force
an external USB transceiver into its low-power
mode. The power mode is dependent on the
USB controller status, the USB_ENABLE bit
in the MCFG register (see Section 7.1), and
the USB_ENABLE bit in the Function Word.
– External USB transceiver forced into low-
0
power mode.
1 – Transceiver power mode dependent on
USB controller status and programming
of the Function Word.
Boot Area. The Boot Area starts at address 0
and ends at the address specified by this field.
The inverted bits of the BOOTAREA field
count the number of 2048-byte blocks to be
reserved as the Boot Area. The maximum
Boot Area size is 30K bytes (address range 0
to 77FFh). The end of the Boot Area defines
the start of the Code Area. If the device starts
in ISP mode and there is no Boot Area defined
(encoding 1111b), the device is kept in reset.
11014K bytes00 1000h
11006K bytes00 1800h
10118K bytes00 2000h
101010K bytes00 2800h
100112K bytes00 3000h
100014K bytes00 3800h
011116K bytes00 4000h
011018K bytes00 4800h
010120K bytes00 5000h
010022K bytes00 5800h
001124K bytes00 6000h
001026K bytes00 6800h
000128K bytes00 7000h
000030K bytes00 7800h
EMPTYThe EMPTY field indicates whether the flash
program memory has been programmed or
should be treated as blank. If a majority of the
three EMPTY bits are clear, the flash program
memory is treated as programmed. If a majority of the EMPTY bits are set, the flash program memory is treated as empty. If the
ENV[1:0] inputs (see Section 6.1) are sampled high at reset and the EMPTY bits indicate
the flash program memory is empty, the device will begin execution in ISP mode. The device enters ISP mode without regard to the
EMPTY status if ENV0 is driven low and
ENV1 is driven high.
ISPEThe ISPE field indicates whether the Boot
Area is used to hold In-System-Programming
routines or user application routines. If a majority of the three ISPE bits are set, the Boot
Area is intended to store ISP routines. If majority of the ISPE bits are clear, the Boot Area
holds user application routines. Table 15 summarizes all possible EMPTY, ISPE, and Boot
Area settings and the corresponding start-up
operation for each combination. In DEV
mode, the EMPTY bit settings are ignored and
the CPU always starts executing from address
0.
www.national.com34
Page 35
CP3BT26
Table 15 CPU Reset Behavior
EMPTYISPEBoot Area Start-Up Operation
Device starts in IRE/
Not EmptyISPDefined
Not EmptyISP
Not EmptyNo ISP Don’t Care
EmptyISPDefined
EmptyISP
EmptyNo ISP Don’t Care
RDPROTThe RDPROT field controls the global read
protection mechanism for the on-chip flash
program memory. If a majority of the three
RDPROT bits are clear, the flash program
memory is protected against read access
from the serial debug interface or an external
flash programmer. CPU read access is not affected by the RDPROT bits. If a majority of the
RDPROT bits are set, read access is allowed.
WRPROTThe WRPROT field controls the global write
protection mechanism for the on-chip flash
program memory. If a majority of the three
WRPROT bits are clear, the flash program
memory is protected against write access
from any source and read access from the serial debug interface. If a majority of the WRPROT bits are set, write access is allowed.
Not
Defined
Not
Defined
ERE mode from
Code Area start
address
Device starts in IRE/
ERE mode from
Code Area start
address
Device starts in IRE/
ERE mode from
address 0
Device starts in ISP
mode from Code
Area start address
Device starts in ISP
mode and is kept in
its reset state
8.5FLASH MEMORY INTERFACE
REGISTERS
There is a separate interface for the program flash and data
flash memories. The same set of registers exist in both interfaces. In most cases they are independent of each other,
but in some cases the program flash interface controls the
interface for both memories, as indicated in the following
sections. Table 16 lists the registers.
Table 16 Flash Memory Interface Registers
Program
Memory
FMIBAR
FF F940h
FMIBDR
FF F942h
FM0WER
FF F944h
FM1WER
FF F946h
FMCTRL
FF F94Ch
FMSTAT
FF F94Eh
FMPSR
FF F950h
FMSTART
FF F952h
FMTRAN
FF F954h
FMPROG
FF F956h
FMPERASE
FF F958h
FMMERASE0
FF F95Ah
FMEND
FF F95Eh
FMMEND
FF F960h
FMRCV
FF F962h
Data
Memory
FSMIBAR
FF F740h
FSMIBDR
FF F742h
FSM0WER
FF F744h
N/A
FSMCTRL
FF F74Ch
FSMSTAT
FF F74Eh
FSMPSR
FF F750h
FSMSTART
FF F752h
FSMTRAN
FF F754h
FSMPROG
FF F756h
FSMPERASE
FF F758h
FSMMERASE0
FF F75Ah
FSMEND
FF F75Eh
FSMMEND
FF F760h
FSMRCV
FF F762h
Description
Flash Memory
Information Block
Address Register
Flash Memory
Information Block
Address Register
Flash Memory 0
Write Enable Register
Flash Memory 1
Write Enable Register
Flash Memory
Control Register
Flash Memory
Status Register
Flash Memory
Prescaler Register
Flash Memory Start
Time Reload Register
Flash Memory
Transition Time
Reload Register
Flash Memory
Programming Time
Reload Register
Flash Memory Page
Erase Time Reload
Register
Flash Memory Module
Erase Time Reload
Register 0
Flash Memory End
Time Reload Register
Flash Memory Module
Erase End Time
Reload Register
Flash Memory
Recovery Time
Reload Register
FMAR0
FF F964h
FMAR1
FF F966h
FMAR2
FF F968h
FSMAR0
FF F764h
FSMAR1
FF F766h
FSMAR2
FF F768h
Flash Memory
Auto-Read Register 0
Flash Memory
Auto-Read Register 1
Flash Memory
Auto-Read Register 2
35www.national.com
Page 36
8.5.1Flash Memory Information Block Address
Register (FMIBAR/FSMIBAR)
The FMIBAR register specifies the 8-bit address for read or
write access to an information block. Because only word ac-
CP3BT26
cess to the information blocks is supported, the least significant bit (LSB) of the FMIBAR must be 0 (word-aligned). The
hardware automatically clears the LSB, without regard to
the value written to the bit. The FMIBAR register is cleared
after device reset. The CPU bus master has read/write access to this register.
15870
ReservedIBA
IBAThe Information Block Address field holds the
word-aligned address of an information block
location accessed during a read or write
transaction. The LSB of the IBA field is always
clear.
8.5.2Flash Memory Information Block Data Register
(FMIBDR/FSMIBDR)
The FMIBDR register holds the 16-bit data for read or write
access to an information block. The FMIBDR register is
cleared after device reset. The CPU bus master has read/
write access to this register.
150
IBD
IBDThe Information Block Data field holds the
data word for access to an information block.
For write operations the IBD field holds the
data word to be programmed into the information block location specified by the IBA address. During a read operation from an
information block, the IBD field receives the
data word read from the location specified by
the IBA address.
The FM0WER register controls section-level write protection for the first half of the flash program memory. The
FMS0WER registers controls section-level write protection
for the flash data memory. Each data block is divided into 16
8K-byte sections. Each bit in the FM0WER and FSM0WER
registers controls write protection for one of these sections.
The FM0WER and FSM0WER registers are cleared after
device reset, so the flash memory is write protected after reset. The CPU bus master has read/write access to this registers.
150
FM0WE
FM0WEnThe Flash Memory 0 Write Enable n bits con-
trol write protection for a section of a flash
memory data block. The address mapping of
the register bits is shown below.
The FM1WER register controls write protection for the second half of the program flash memory. The data block is divided into 16 8K-byte sections. Each bit in the FM1WER
register controls write protection for one of these sections.
The FM1WER register is cleared after device reset, so the
flash memory is write protected after reset. The CPU bus
master has read/write access to this registers.
150
FM1WE
www.national.com36
FM1WEnThe Flash Memory 1 Write Enable n bits con-
trol write protection for a section of a flash
memory data block. The address mapping of
the register bits is shown below.
BitLogical Address Range
002 0000h
1
–14. . .
1503 E000h–03 FFFFh
–02 1FFFh
Page 37
8.5.5Flash Data Memory 0 Write Enable Register
(FSM0WER)
The FSM0WER register controls write protection for the
flash data memory. The data block is divided into 16 512byte sections. Each bit in the FSM0WER register controls
write protection for one of these sections. The FSM0WER
register is cleared after device reset, so the flash memory is
write protected after reset. The CPU bus master has read/
write access to this registers.
150
FSM0WE
FSM0WEn The Flash Data Memory 0 Write Enable n bits
control write protection for a section of a flash
memory data block. The address mapping of
the register bits is shown below.
BitLogical Address Range
00E 0000h
1–14. . .
150E 1E00h–0E 1FFFh
8.5.6Flash Memory Control Register (FMCTRL/
FSMCTRL)
This register controls the basic functions of the Flash program memory. The register is clear after device reset. The
CPU bus master has read/write access to this register.
76543 2 10
MER PER PE IENPROG DISVRF Res. CWD LOWPRW
LOWPRWThe Low Power Mode controls whether flash
program memory is operated in low-power
mode, which draws less current when data is
read. This is accomplished be only accessing
the flash program memory during the first half
of the clock period. The low-power mode must
not be used at System Clock frequencies
above 25 MHz, otherwise a read access may
return undefined data. This bit must not be
changed while the flash program memory is
busy being programmed or erased.
– Normal mode.
0
– Low-power mode.
1
CWDThe CPU Write Disable bit controls whether
the CPU has write access to flash memory.
This bit must not be changed while FMBUSY
is set.
– The CPU has write access to the flash
0
memory
1 – An external debugging tool is the current
“owner” of the flash memory interface, so
write accesses by the CPU are inhibited.
–0E 01FFh
DISVRFThe Disable Verify bit controls the automatic
verification feature. This bit must not be
changed while the flash program memory is
busy being programmed or erased.
– New flash program memory contents are
0
automatically verified after programming.
– Automatic verification is disabled.
1
IENPROGThe Interrupt Enable for Program bit is clear
after reset. The flash program and data memories share a single interrupt channel but have
independent interrupt enable control bits.
– No interrupt request is asserted to the
0
ICU when the FMFULL bit is cleared.
1 – An interrupt request is made when the
FMFULL bit is cleared and new data can
be written into the write buffer.
PEThe Program Enable bit controls write access
of the CPU to the flash program memory. This
bit must not be altered while the flash program
memory is busy being programmed or erased.
The PER and MER bits must be clear when
this bit is set.
– Programming the flash program memory
0
by the CPU is disabled.
– Programming the flash program memory
1
is enabled.
PERThe Page Erase Enable bit controls whether a
a valid write operation triggers an erase operation on a 1024-byte page of flash memory.
Page erase operations are only supported for
the main blocks, not the information blocks. A
page erase operation on an information block
is ignored and does not alter the information
block. When the PER bit is set, the PE and
MER bits must be clear. This bit must not be
changed while the flash program memory is
busy being programmed or erased.
– Page erase mode disabled. Write opera-
0
tions are performed normally.
– A valid write operation to a word location
1
in program memory erases the page that
contains the word.
MERThe Module Erase Enable bit controls wheth-
er a valid write operation triggers an erase operation on an entire block of flash memory. If
an information block is written in this mode,
both the information block and its corresponding main block are erased. When the MER bit
is set, the PE and PER bits must be clear. This
bit must not be changed while the flash program memory is busy being programmed or
erased.
– Module erase mode disabled. Write oper-
0
ations are performed normally.
– A valid write operation to a word location
1
in a main block erases the block that contains the word. A valid write operation to a
word location in an information block
erases the block that contains the word
and its associated main block.
CP3BT26
37www.national.com
Page 38
8.5.7Flash Memory Status Register (FMSTAT/
FSMSTAT)
This register reports the currents status of the on-chip Flash
memory. The FLSR register is clear after device reset. The
CP3BT26
CPU bus master has read/write access to this register.
7543 2 10
Reserved DERR FMFULL FMBUSY PERR EERR
EERRThe Erase Error bit indicates whether an error
has occurred during a page erase or module
(block) erase. After an erase error occurs,
software can clear the EERR bit by writing a 1
to it. Writing a 0 to the EERR bit has no effect.
Software must not change this bit while the
flash program memory is busy being programmed or erased.
– The erase operation was successful.
0
1 – An erase error occurred.
PERRThe Program Error bit indicates whether an
error has occurred during programming. After
a programming error occurs, software can
clear the PERR bit by writing a 1 to it. Writing
a 0 to the PERR bit has no effect. Software
must not change this bit while the flash program memory is busy being programmed or
erased.
– The programming operation was suc-
0
cessful.
– A programming error occurred.
1
FMBUSYThe Flash Memory Busy bit indicates whether
the flash memory (either main block or information block) is busy being programmed or
erased. During that time, software must not
request any further flash memory operations.
If such an attempt is made, the CPU is
stopped as long as the FMBUSY bit is active.
The CPU must not attempt to read from program memory (including instruction fetches)
while it is busy.
– Flash memory is ready to receive a new
0
erase or programming request.
– Flash memory busy with previous erase
1
or programming operation.
FMFULLThe Flash Memory Buffer Full bit indicates
whether the write buffer for programming is
full or not. When the buffer is full, new erase
and write requests may not be made. The
IENPROG bit can be enabled to trigger an interrupt when the buffer is ready to receive a
new request.
– Buffer is ready to receive new erase or
0
write requests.
– Buffer is full. No new erase or write re-
1
quests can be accepted.
DERRThe Data Loss Error bit indicates that a buffer
overrun has occurred during a programming
sequence. After a data loss error occurs, software can clear the DERR bit by writing a 1 to
it. Writing a 0 to the DERR bit has no effect.
Software must not change this bit while the
flash program memory is busy being programmed or erased.
The FMPSR register is a byte-wide read/write register that
selects the prescaler divider ratio. The CPU must not modify
this register while an erase or programming operation is in
progress (FMBUSY is set). At reset, this register is initialized to 04h if the flash memory is idle. The CPU bus master
has read/write access to this register.
7540
ReservedFTDIV
FTDIVThe prescaler divisor scales the frequency of
the System Clock by a factor of (FTDIV + 1).
8.5.9Flash Memory Start Time Reload Register
(FMSTART/FSMSTART)
The FMSTART/FSMSTART register is a byte-wide read/
write register that controls the program/erase start delay
time. Software must not modify this register while a program/erase operation is in progress (FMBUSY set). At reset, this register is initialized to 18h if the flash memory is
idle. The CPU bus master has read/write access to this register.
70
FTSTART
FTSTARTThe Flash Timing Start Delay Count field gen-
erates a delay of (FTSTART + 1) prescaler
output clocks.
www.national.com38
Page 39
8.5.10Flash Memory Transition Time Reload
Register (FMTRAN/FSMTRAN)
The FMTRAN/FMSTRAN register is a byte-wide read/write
register that controls some program/erase transition times.
Software must not modify this register while program/erase
operation is in progress (FMBUSY set). At reset, this register is initialized to 30h if the flash memory is idle. The CPU
bus master has read/write access to this register.
70
FTTRAN
FTTRANThe Flash TIming Transition Count field spec-
ifies a delay of (FTTRAN + 1) prescaler output
clocks.
8.5.11Flash Memory Programming Time Reload
Register (FMPROG/FSMPROG)
The FMPROG/FSMPROG register is a byte-wide read/write
register that controls the programming pulse width. Software must not modify this register while a program/erase
operation is in progress (FMBUSY set). At reset, this register is initialized to 16h if the flash memory is idle. The CPU
bus master has read/write access to this register.
70
FTPROG
FTPROGThe Flash Timing Programming Pulse Width
field specifies a programming pulse width of
8 × (FTPROG + 1) prescaler output clocks.
8.5.12Flash Memory Page Erase Time Reload
Register (FMPERASE/FSMPERASE)
The FMPERASE/FSMPERASE register is a byte-wide
read/write register that controls the page erase pulse width.
Software must not modify this register while a program/
erase operation is in progress (FMBUSY set). At reset, this
register is initialized to 04h if the flash memory is idle. The
CPU bus master has read/write access to this register.
70
FTPER
8.5.13Flash Memory Module Erase Time Reload
Register 0 (FMMERASE0/FSMMERASE0)
The FMMERASE0/FSMMERASE0 register is a byte-wide
read/write register that controls the module erase pulse
width. Software must not modify this register while a program/erase operation is in progress (FMBUSY set). At reset, this register is initialized to EAh if the flash memory is
idle. The CPU bus master has read/write access to this register.
70
FTMER
FTMERThe Flash Timing Module Erase Pulse Width
field specifies a module erase pulse width of
4096 × (FTMER + 1) prescaler output clocks.
8.5.14Flash Memory End Time Reload Register
(FMEND/FSMEND)
The FMEND/FSMEND register is a byte-wide read/write
register that controls the delay time after a program/erase
operation. Software must not modify this register while a
program/erase operation is in progress (FMBUSY set). At
reset, this register is initialized to 18h when the flash memory on the chip is idle. The CPU bus master has read/write
access to this register.
70
FTEND
FTENDThe Flash Timing End Delay Count field spec-
ifies a delay of (FTEND + 1) prescaler output
clocks.
8.5.15Flash Memory Module Erase End Time Reload
Register (FMMEND/FSMMEND)
The FMMEND/FSMMEND register is a byte-wide read/write
register that controls the delay time after a module erase operation. Software must not modify this register while a program/erase operation is in progress (FMBUSY set). At
reset, this register is initialized to 3Ch if the flash memory is
idle. The CPU bus master has read/write access to this register.
CP3BT26
FTPERThe Flash Timing Page Erase Pulse Width
field specifies a page erase pulse width of
4096 × (FTPER + 1) prescaler output clocks.
70
FTMEND
FTMENDThe Flash Timing Module Erase End Delay
Count field specifies a delay of 8 × (FTMEND
+ 1) prescaler output clocks.
39www.national.com
Page 40
8.5.16Flash Memory Recovery Time Reload Register
(FMRCV/FSMRCV)
The FMRCV/FSMRCV register is a byte-wide read/write
register that controls the recovery delay time between two
CP3BT26
flash memory accesses. Software must not modify this register while a program/erase operation is in progress (FMBUSY set). At reset, this register is initialized to 04h if the
flash memory is idle. The CPU bus master has read/write
access to this register.
70
FTRCV
FTRCVThe Flash Timing Recovery Delay Count field
specifies a delay of (FTRCV + 1) prescaler
output clocks.
The FMAR0/FSMAR0 register contains a copy of the Function Word from Information Block 0. The Function Word is
sampled at reset. The contents of the FMAR0 register are
used to enable or disable special device functions. The CPU
bus master has read-only access to this register. The
FSMAR0 register has the same value as the FMAR0 register
1510
ReservedUSB_ENABLE
USB_ENABLE
The USB_ENABLE bit can be used to force
an external USB transceiver into its low-power
mode. The USB power mode is dependent on
the USB controller status, the USB_ENABLE
bit in the MCFG register (see Section 7.1),
and the USB_ENABLE bit in the Function
Word.
– External USB transceiver forced into low-
0
power mode.
– Transceiver power mode dependent on
1
USB controller status and programming
of the Function Word.
The FMAR1 register contains a copy of the Protection Word
from Information Block 1. The Protection Word is sampled
at reset. The contents of the FMAR1 register define the current Flash memory protection settings. The CPU bus master has read-only access to this register. The FSMAR1
register has the same value as the FMAR1 register. The format is the same as the format of the Protection Word (see
Section 8.4.2).
The FMAR2 register is a word-wide read-only register,
which is loaded during reset. It is used to build the Code
Area start address. At reset, the CPU executes a branch,
using the contents of the FMAR2 register as displacement.
The CPU bus master has read-only access to this register.
The FSMAR2 register has the same value as the FMAR2
register.
CADR10:0The Code Area Start Address (bits 10:0) con-
CADR14:11 The Code Area Start Address (bits 14:11) are
CADR15The Code Area Start Address (bits 15) con-
70
CADR7:0
151411108
CADR15
CADR14:11CADR10:8
tains the lower 11 bits of the Code Area start
address. The CADR10:0 field has a fixed value of 0.
loaded during reset with the inverted value of
BOOTAREA3:0.
tains the upper bit of the Code Area start address. The CADR15 field has a fixed value of
0.
www.national.com40
Page 41
9.0DMA Controller
5
The DMA Controller (DMAC) has a register-based programming interface, as opposed to an interface based on I/O
control blocks. After loading the registers with source and
destination addresses, as well as block size and type of operation, a DMAC channel is ready to respond to DMA transfer requests. A request can only come from on-chip
peripherals or software, not external peripherals. On receiving a DMA transfer request, if the channel is enabled, the
DMAC performs the following operations:
1. Arbitrates to become master of the CPU bus.
2. Determines priority among the DMAC channels, one
clock cycle before T1 of the DMAC transfer cycle. (T1
is the first clock cycle of the bus cycle.) Priority among
the DMAC channels is fixed in descending order, with
Channel 0 having the highest priority.
3. Executes data transfer bus cycle(s) selected by the values held in the control registers of the channel being
serviced, and according to the accessed memory address. The DMAC acknowledges the request during the
bus cycle that accesses the requesting device.
4. If the transfer of a block is terminated, the DMAC does
the following:
Updates the termination bits.
Generates an interrupt (if enabled).
Goes to step 6.
5. If DMRQ
ous”, returns to step 3.
6. Returns mastership of the CPU bus to the CPU.
Each DMAC channel can be programmed for direct (flyby)
or indirect (memory-to-memory) data transfers. Once a
DMAC transfer cycle is in progress, the next transfer request
is sampled when the DMAC acknowledge is de-asserted,
then on the rising edge of every clock cycle.
The configuration of either address freeze or address update (increment or decrement) is independent of the number of transferred bytes, transfer direction, or number of
bytes in each DMAC transfer cycle. All these can be configured for each channel by programming the appropriate control registers.
Each DMAC channel has eight control registers. DMAC
channels are described hereafter with the suffix n, where n
= 0 to 3, representing the channel number in the registernames.
n is still active, and the Bus Policy is “continu-
Table 17 DMA Channel Assignment
ChannelPeripheral
Transaction
Register
0 (Primary)USBR/WRX/TX FIFO
0 (Secondary)UART0RRXBUF
1 (Primary)UART0WTXBUF
1 (Secondary)ReservedN/AN/A
2 (Primary)Audio InterfaceR ARDR0
2 (Secondary)
CVSD/PCM
Transcoder
RPCMOUT
3 (Primary)Audio InterfaceWATDR0
3 (Secondary)
CVSD/PCM
Transcoder
WPCMIN
9.2TRANSFER TYPES
The DMAC uses two data transfer modes, Direct (Flyby)
and Indirect (Memory-to-Memory). The choice of mode depends on the required bus performance and whether direct
mode is available for the transfer. Indirect mode must be
used when the source and destination have differing bus
widths, when both the source and destination are in memory, and when the destination does not support direct mode.
9.2.1Direct (Flyby) Transfers
In direct mode each data item is transferred using a single
bus cycle, without reading the data into the DMAC. It provides the fastest transfer rate, but it requires identical source
and destination bus widths. The DMAC cannot use Direct
cycles between two memory devices. One of the devices
must be an I/O device that supports the Direct (Flyby) mechanism, as shown in Figure 3.
Bus State
T1T1T2Tidle
CLK
DMRQ[3:0]
CP3BT26
9.1CHANNEL ASSIGNMENT
Table 17 shows the assignment of the DMA channels to different tasks. Four channels can be shared by a primary and
an secondary function. However, only one source at a time
can be enabled. If a channel is used for memory block transfers, other resources must be disabled.
ADDRADCA
MACK[3:0]
DS00
Figure 3. Direct DMA Cycle Followed by a CPU Cycle
41www.national.com
Page 42
Direct mode supports two bus policies: intermittent and continuous. In intermittent mode, the DMAC gives bus mastership back to the CPU after every cycle. In continuous mode,
the DMAC remains bus master until the transfer is complet-
CP3BT26
ed. The maximum bus throughput in intermittent mode is
one transfer for every three System Clock cycles. The maximum bus throughput in continuous mode is one transfer for
every clock cycle.
The I/O device which made the DMA request is called the
implied I/O device. The other device can be either memory
or another I/O device, and is called the addressed device.
Because only one address is required in direct mode, this
address is taken from the corresponding ADCAn counter.
The DMAC channel generates either a read or a write bus
cycle, as controlled by the DMACNTLn.DIR bit.
When the DMACNTLn.DIR bit is clear, a read bus cycle
from the addressed device is performed, and the data is
written to the implied I/O device. When the DMACNTLn.DIR
bit is set, a write bus cycle to the addressed device is performed, and the data is read from the implied I/O device.
The configuration of either address freeze or address update (increment or decrement) is independent of the number of transferred bytes, transfer direction, or number of
bytes in each DMAC transfer cycle. All these can be configured for each channel by programming the appropriate control register.
Whether 8 or 16 bits are transferred in each cycle is selected by the DMACNTLn.TCS register bit. After the data item
has been transferred, the BLTCn counter is decremented by
one. The ADCAn counter is updated according to the INCA
and ADA fields in the DMACNTLn register.
9.2.2Indirect (Memory-To-Memory) Transfers
In indirect (memory-to-memory) mode, data transfers use
two consecutive bus cycles. The data is first read into a temporary register, and then written to the destination in the following cycle. This mode is slower than the direct (flyby)
mode, but it provides support for different source and destination bus widths. Indirect mode must be used for transfers
between memory devices.
If an intermittent bus policy is used, the maximum throughput is one transfer for every five clock cycles. If a continuous
bus policy is used, maximum throughput is one transfer for
every two clock cycles.
When the DMACNTLn.DIR bit is 0, the first bus cycle reads
data from the source using the ADCAn counter, while the
second bus cycle writes the data into the destination using
the ADCBn counter. When the DMACNTLn.DIR bit is set,
the first bus cycle reads data from the source using the ADCBn counter, while the second bus cycle writes the data into
the destination addressed by the ADCAn counter.
The number of bytes transferred in each cycle is taken from
the DMACNTLn.TCS register bit. After the data item has
been transferred, the BLTCn counter is decremented by
one. The ADCAn and ADCBn counters are updated according to the INCA, INCB, ADA, and ADB fields in the
DMACNTLn register.
9.3OPERATION MODES
The DMAC operates in three different block transfer modes:
single transfer, double buffer, and auto-initialize.
9.3.1Single Transfer Operation
This mode provides the simplest way to accomplish a single
block data transfer.
Initialization
1. Write the block transfer addresses and byte count into
the corresponding ADCAn, ADCBn, and BLTCn
counters.
2. Clear the DMACNTLn.OT bit to select non-auto-initialize mode. Clear the DMASTAT.VLD bit by writing a 1 to
it.
3. Set the DMACNTLn.CHEN bit to activate the channel
and enable it to respond to DMA transfer requests.
Termination
When the BLTCn counter reaches 0:
1. The transfer operation terminates.
2. The DMASTAT.TC and DMASTAT.OVR bits are set, and
the DMASTAT.CHAC bit is cleared.
3. An interrupt is generated if enabled by the
DMACNTLn.ETC or DMACNTLn.EOVR bits.
The DMACNTLn.CHEN bit must be cleared before loading
the DMACNTLn register to avoid prematurely starting a new
DMA transfer.
9.3.2Double Buffer Operation
This mode allows software to set up the next block transfer
while the current block transfer proceeds.
Initialization
1. Write the block transfer addresses and byte count into
the ADCAn, ADCBn, and BLTCn counters.
2. Clear the DMACNTLn.OT bit to select non-auto-initialize mode. Clear the DMASTAT.VLD bit by writing a 1 to
it.
3. Set the DMACNTLn.CHEN bit. This activates the channel and enables it to respond to DMA transfer requests.
4. While the current block transfer proceeds, write the addresses and byte count for the next block into the
ADRAn, ADRBn, and BLTRn registers. The BLTRn register must be written last, because it sets the DMASTAT.VLD bit which indicates that all the parameters for
the next transfer have been updated.
Continuation/Termination
When the BLTCn counter reaches 0:
1. The DMASTAT.TC bit is set.
2. An interrupt is generated if enabled by the
DMACNTLn.ETC bit.
3. The DMAC channel checks the value of the VLD bit.
If the DMASTAT.VLD bit is set:
1. The channel copies the ADRAn, ADRBn, and BLTRn
values into the ADCAn, ADCBn, and BLTCn registers.
2. The DMASTAT.VLD bit is cleared.
3. The next block transfer is started.
www.national.com42
Page 43
If the DMASTAT.VLD bit is clear:
1. The transfer operation terminates.
2. The channel sets the DMASTAT.OVR bit.
3. The DMASTAT.CHAC bit is cleared.
4. An interrupt is generated if enabled by the
DMACNTLn.EOVR bit.
The DMACNTLn.CHEN bit must be cleared before loading
the DMACNTLn register to avoid prematurely starting a new
DMA transfer.
Note: The ADCBn and ADRBn registers are used only in
indirect (memory-to-memory) transfer. In direct (flyby)
mode, the DMAC does not use them and therefore does not
copy ADRBn into ADCBn.
9.3.3Auto-Initialize Operation
This mode allows the DMAC to continuously fill the same
memory area without software intervention.
Initialization
1. Write the block addresses and byte count into the ADCAn, ADCBn, and BLTCn counters, as well as the
ADRAn, ADRBn, and BLTRn registers.
2. Set the DMACNTLn.OT bit to select auto-initialize
mode.
3. Set the DMACNTLn.CHEN bit to activate the channel
and enable it to respond to DMA transfer requests.
Continuation
When the BLTCn counter reaches 0:
1. The contents of the ADRAn, ADRBn, and BLTRn registers are copied to the ADCAn, ADCBn, and BLTCn
counters.
2. The DMAC channel checks the value of the DMASTAT.TC bit.
If the DMASTAT.TC bit is set:
1. The DMASTAT.OVR bit is set.
2. A level interrupt is generated if enabled by the
DMACNTLn.EOVR bit.
3. The operation is repeated.
If the DMASTAT.TC bit is clear:
1. The DMASTAT.TC bit is set.
2. A level interrupt is generated if enabled by the
DMACNTLn.ETC bit.
3. The DMAC operation is repeated.
Termination
The DMA transfer is terminated when the
DMACNTLn.CHEN bit is cleared.
9.4SOFTWARE DMA REQUEST
In addition to the hardware requests from I/O devices, a
DMA transfer request can also be initiated by software. A
software DMA transfer request must be used for block copying between memory devices.
When the DMACNTLn.SWRQ bit is set, the corresponding
DMA channel receives a DMA transfer request. When the
DMACNTLn.SWRQ bit is clear, the software DMA transfer
request of the corresponding channel is inactive.
For each channel, use the software DMA transfer request
only when the corresponding hardware DMA request is inactive and no terminal count interrupt is pending. Software
can poll the DMASTAT.CHAC bit to determine whether the
DMA channel is already active. After verifying the DMASTATn.CHAC bit is clear (channel inactive), check the DMASTATn.TC (terminal count) bit. If the TC bit is clear, then no
terminal count condition exists and therefore no terminal
count interrupt is pending. If the channel is not active and no
terminal count interrupt is pending, software may request a
DMA transfer.
9.5DEBUG MODE
When the FREEZE signal is active, all DMA operations are
stopped. They will start again when the FREEZE signal
goes inactive. This allows breakpoints to be used in debug
systems.
9.6DMA CONTROLLER REGISTER SET
There are four identical sets of DMA controller registers, as
listed in Table 18.
Table 18 DMA Controller Registers
NameAddressDescription
ADCA0FF F800h
ADRA0FF F804h
ADCB0FF F808h
ADRB0FF F80Ch
BLTC0FF F810h
BLTR0FF F814hBlock Length Register
DMACNTL0FF F81ChDMA Control Register
DMASTAT0FF F81EhDMA Status Register
ADCA1FF F820h
ADRA1FF F824h
ADCB1FF F828h
ADRB1FF F82Ch
BLTC1FF F830h
BLTR1FF F834hBlock Length Register
DMACNTL1FF F83ChDMA Control Register
DMASTAT1FF F83EhDMA Status Register
Device A Address
Counter Register
Device A Address
Register
Device B Address
Counter Register
Device B Address
Register
Block Length
Counter Register
Device A Address
Counter Register
Device A Address
Register
Device B Address
Counter Register
Device B Address
Register
Block Length
Counter Register
CP3BT26
43www.national.com
Page 44
NameAddressDescription
CP3BT26
ADCA2FF F840h
ADRA2FF F844h
ADCB2FF F848h
Table 18 DMA Controller Registers
Device A Address
Counter Register
Device A Address
Register
Device B Address
Counter Register
9.6.2Device A Address Register (ADRAn)
The Device A Address register is a 32-bit, read/write register. It holds the 24-bit starting address of either the next
source data block, or the next destination data area, according
to the DIR bit in the DMACNTLn register. The upper 8 bits of
the ADRAn register are reserved and always clear.
3124230
ReservedDevice A Address
ADRB2FF F84Ch
BLTC2FF F850h
BLTR2FF F854hBlock Length Register
DMACNTL2FF F85ChDMA Control Register
DMASTAT2FF F85EhDMA Status Register
ADCA3FF F860h
ADRA3FF F864h
ADCB3FF F868h
ADRB3FF F86Ch
BLTC3FF F870h
BLTR3FF F874hBlock Length Register
DMACNTL3FF F87ChDMA Control Register
DMASTAT3FF F87EhDMA Status Register
Device B Address
Register
Block Length
Counter Register
Device A Address
Counter Register
Device A Address
Register
Device B Address
Counter Register
Device B Address
Register
Block Length
Counter Register
9.6.3Device B Address Counter Register (ADCBn)
The Device B Address Counter register is a 32-bit, read/
write register. It holds the current 24-bit address of either the
source data item, or the destination location, according to
the DIR bit in the CNTLn register. The ADCBn register is updated after each transfer cycle by INCB field of the
DMACNTLn register according to ADB bit of the
DMACNTLn register. In direct (flyby) mode, this register is
not used.
served and always clear.
9.6.4Device B Address Register (ADRBn)
The Device B Address register is a 32-bit, read/write register. It holds the 24-bit starting address of either the next
source data block or the next destination data area, according to the DIR bit in the CNTLn register. In direct (flyby)
mode, this register is not used.
CRBn register are reserved and always clear.
The upper 8 bits of the ADCBn register are re-
3124230
ReservedDevice B Address Counter
The upper 8 bits of the AD-
3124230
ReservedDevice B Address
9.6.1Device A Address Counter Register (ADCAn)
The Device A Address Counter register is a 32-bit, read/
write register. It holds the current 24-bit address of either the
source data item or the destination location, depending on
the state of the DIR bit in the CNTLn register. The ADA bit
of DMACNTLn register controls whether to adjust the pointer in the ADCAn register by the step size specified in the
INCA field of DMACNTLn register. The upper 8 bits of the
ADCAn register are reserved and always clear.
3124230
ReservedDevice A Address Counter
www.national.com44
9.6.5Block Length Counter Register (BLTCn)
The Block Length Counter register is a 16-bit, read/write
register. It holds the current number of DMA transfers to be
executed in the current block. BLTCn is decremented by one
after each transfer cycle. A DMA transfer may consist of 1 or
2 bytes, as selected by the DMACNTLn.TCS bit.
150
Block Length Counter
Note: 0000h is interpreted as 216-1 transfer cycles.
Page 45
9.6.6Block Length Register (BLTRn)
The Block Length register is a 16-bit, read/write register. It
holds the number of DMA transfers to be performed for the
next block. Writing this register automatically sets the DMASTAT.VLD bit.
150
Block Length
16
Note: 0000h is interpreted as 2
9.6.7DMA Control Register (DMACNTLn)
The DMA Control register n is a word-wide, read/write register that controls the operation of DMA channel n. This register is cleared at reset. Reserved bits must be written with
0.
76543210
BPCOTDIRINDTCS EOVR ETC CHEN
1514131211 1098
Res.INCBADBINCAADA SWRQ
CHENThe Channel Enable bit must be set to enable
any DMA operation on this channel. Writing a
1 to this bit starts a new DMA transfer even if
it is currently a 1. If all DMACNTLn.CHEN bits
are clear, the DMA clock is disabled to reduce
power.
– Channel disabled.
0
1 – Channel enabled.
ETCIf the Enable Interrupt on Terminal Count bit is
set, it enables an interrupt when the DMASTAT.TC bit is set.
– Interrupt disabled.
0
– Interrupt enabled.
1
EOVRIf the Enable Interrupt on OVR bit is set, it en-
ables an interrupt when the DMASTAT.OVR
bit is set.
– Interrupt disabled.
0
– Interrupt enabled.
1
TCSThe Transfer Cycle Size bit specifies the num-
ber of bytes transferred in each DMA transfer
cycle. In direct (fly-by) mode, undefined results occur if the TCS bit is not equal to the addressed memory bus width.
– Byte transfers (8 bits per cycle).
0
1
– Word transfers (16 bits per cycle).
IND The Direct/Indirect Transfer bit specifies the
transfer type.
– Direct transfer (flyby).
0
– Indirect transfer (memory-to-memory).
1
-1 transfer cycles.
DIRThe Transfer Direction bit specifies the direc-
tion of the transfer relative to Device A.
– Device A (pointed to by the ADCAn regis-
0
ter) is the source. In Fly-By mode a read
transaction is initialized.
– Device A (pointed to by the ADCAn regis-
1
ter) is the destination. In Fly-By mode a
write transaction is initialized.
OTThe Operation Type bit specifies the operation
mode of the DMA controller.
– Single-buffer mode or double-buffer mode
0
enabled.
– Auto-Initialize mode enabled.
1
BPCThe Bus Policy Control bit specifies the bus
policy applied by the DMA controller. The operation mode can be either intermittent (cycle
stealing) or continuous (burst).
– Intermittent operation. The DMAC chan-
0
nel relinquishes the bus after each transaction, even if the request is still asserted.
– Continuous operation. The DMAC chan-
1
nel n uses the bus continuously as long
as the request is asserted. This mode can
only be used for software DMA requests.
For hardware DMA requests, the BPC bit
must be clear.
SWRQThe Software DMA Request bit is written with
a 1 to initiate a software DMA request. Writing
a 0 to this bit deactivates the software DMA
request. The SWRQ bit must only be written
when the DMRQ signal for this channel is inactive (DMASTAT.CHAC = 0).
– Software DMA request is inactive.
0
1 – Software DMA request is active.
ADAIf the Device A Address Control bit is set, it en-
ables updating the Device A address.
0 – ADCAn address unchanged.
1 – ADCAn address incremented or decre-
mented, according to INCA field of
DMACNTLn register.
INCAThe Increment/Decrement ADCAn field spec-
ifies the step size for the Device A address increment/decrement.
00 – Increment ADCAn register by 1.
01 – Increment ADCAn register by 2.
10 – Decrement ADCAn register by 1.
11 – Decrement ADCAn register by 2.
ADBIf the Device B Address Control bit is set, it en-
ables updating the Device B Address.
– ADCBn address unchanged.
0
– ADCBn address incremented or decre-
1
mented, according to INCB field of
DMACNTLn register.
INCBThe Increment/Decrement ADCBn field spec-
ifies the step size for the Device B address increment/decrement.
00 – Increment ADCBn register by 1.
01 – Increment ADCBn register by 2.
10 – Decrement ADCBn register by 1.
11 – Decrement ADCBn register by 2.
CP3BT26
45www.national.com
Page 46
9.6.8DMA Status Register (DMASTAT)
The DMA status register is a byte-wide, read register that
holds the status information for the DMA channel n. This
register is cleared at reset. The reserved bits always return
CP3BT26
zero when read. The VLD, OVR and TC bits are sticky (once
set by the occurrence of the specific condition, they remain
set until explicitly cleared by software). These bits can be individually cleared by writing 1 to the bit positions in the DMASTAT register to be cleared. Writing 0 to these bits has no
effect
743 2 10
ReservedVLD CHAC OVRTC
TCThe Terminal Count bit indicates whether the
transfer was completed by a terminal count
condition (BLTCn Register reached 0).
– Terminal count condition did not occur.
0
1 – Terminal count condition occurred.
OVRThe behavior of the Channel Overrun bit de-
pends on the operation mode (single buffer,
double buffer, or auto-initialize) of the DMA
channel.
In double-buffered mode (DMACNTLn.OT =
0):
The OVR bit is set when the present transfer
is completed (BLTCn = 0), but the parameters
for the next transfer (address and block
length) are not valid (DMASTAT.VLD = 0).
In auto-initialize mode (DMACNTLn.OT = 1):
The OVR bit is set when the present transfer
is completed (BLTCn = 0), and the DMASTAT.TC bit is still set.
In single-buffer mode:
Operates in the same way as double-buffer
mode. In single-buffered mode, the DMASTAT.VLD bit should always be clear, so it will
also be set when the DMASTAT.TC bit is set.
Therefore, the OVR bit can be ignored in this
mode.
CHACThe Channel Active bit continuously indicates
the active or inactive status of the channel,
and therefore, it is read only. Data written to
the CHAC bit is ignored.
– Channel inactive.
0
1
– Indicates that the channel is active
(CHEN bit in the CNTLn register is 1 and
BLTCn > 0)
VLDThe Transfer Parameters Valid bit specifies
whether the transfer parameters for the next
block to be transferred are valid. Writing the
BLTRn register automatically sets this bit. The
bit is cleared in the following cases:
The present transfer is completed and the
ADRAn, ADRBn (indirect mode only), and
BLTR registers are copied to the ADCAn,
ADCBn (indirect mode only), and BLTCn
registers.
Writing 1 to the VLD bit.
www.national.com46
Page 47
10.0Interrupts
The Interrupt Control Unit (ICU) receives interrupt requests
from internal and external sources and generates interrupts
to the CPU. Interrupts from the timers, UARTs, Microwire/
SPI interface, and Multi-Input Wake-Up module are all
maskable interrupts. The highest-priority interrupt is the
Non-Maskable Interrupt (NMI), which is triggered by a falling
edge received on the NMI
The priorities of the maskable interrupts are hardwired and
therefore fixed. The implemented interrupts are named
IRQ0 through IRQ47, in which IRQ0 has the lowest priority
and IRQ47 has the highest priority. (IRQ0 is not implemented, so IRQ1 is the lowest priority interrupt that normally may
occur.)
10.1NON-MASKABLE INTERRUPTS
The Interrupt Control Unit (ICU) receives the external NMI
input and generates the NMI signal driven to the CPU. The
NMI input is an asynchronous input with Schmitt trigger
characteristics and an internal synchronization circuit,
therefore no external synchronizing circuit is needed. The
pin triggers an exception on its falling edge.
NMI
10.1.1Non-Maskable Interrupt Processing
The CPU performs an interrupt acknowledge bus cycle
when beginning to process a non-maskable interrupt.
At reset, NMI interrupts are disabled and must remain disabled until software initializes the interrupt table, interrupt
base register (INTBASE), and the interrupt mode. The external NMI
LCK bit and will remain enabled until a reset occurs.
Alternatively, the external NMI interrupt can be enabled by
setting the EXNMI.EN bit and will remain enabled until an interrupt event or a reset occurs.
interrupt is enabled by setting the EXNMI.EN-
10.2MASKABLE INTERRUPTS
The ICU receives level-triggered interrupt request signals
from 47 sources and generates a vectored interrupt to the
CPU when required. Priority among the implemented interrupt sources (named IRQ1 through IRQ47) is fixed.
The maskable interrupts are globally enabled and disabled
by the E bit in the PSR register. The EI and DI instructions
are used to set (enable) and clear (disable) this bit. The global maskable interrupt enable bit (I bit in the PSR) must also
be set before any maskable interrupts are taken.
Each interrupt source can be individually enabled or disabled under software control through the ICU interrupt enable registers and also through interrupt enable bits in the
peripherals that request the interrupts. The ICU supports
IRQ0, but in the CP3BT26 it is not connected to any interrupt source.
input pin.
10.2.1Maskable Interrupt Processing
Interrupt vector numbers are always positive, in the range
10h to 3Fh. The IVCT register contains the interrupt vector
of the enabled and pending interrupt with the highest priority. The interrupt vector 10h corresponds to IRQ0 and the
lowest priority, while the vector 3Fh corresponds to IRQ47
and the highest priority. The CPU performs an interrupt acknowledge bus cycle on receiving a maskable interrupt request from the ICU. During the interrupt acknowledge cycle,
a byte is read from address FF FE00h (IVCT register). The
byte is used as an index into the Dispatch Table to determine the address of the interrupt handler.
Because IRQ0 is not connected to any interrupt source, it
would seem that the interrupt vector would never return the
value 10h. If it does return a value of 10h, the entry in the
dispatch table should point to a default interrupt handler that
handles this error condition. One possible condition for this
to occur is deassertion of the interrupt before the interrupt
acknowledge cycle.
10.3INTERRUPT CONTROLLER REGISTERS
Table 19 lists the ICU registers.
Table 19 Interrupt Controller Registers
NameAddressDescription
IVCTFF FE00h
NMISTATFF FE02h
EXNMIFF FE04h
ISTAT0FF FE0Ah
ISTAT1FF FE0Ch
ISTAT2FF FE20h
IENAM0FF FE0Eh
IENAM1FF FE10h
IENAM2FF FE22h
Interrupt Vector
Register
Non-Maskable
Interrupt Status
Register
External NMI Trap
Control and Status
Register
Interrupt Status
Register 0
Interrupt Status
Register 1
Interrupt Status
Register 2
Interrupt Enable and
Mask Register 0
Interrupt Enable and
Mask Register 1
Interrupt Enable and
Mask Register 2
CP3BT26
47www.national.com
Page 48
10.3.1Interrupt Vector Register (IVCT)
The IVCT register is a byte-wide read-only register which reports the encoded value of the highest priority maskable interrupt that is both asserted and enabled. The valid range is
CP3BT26
from 10h to 3Fh. The register is read by the CPU during an
interrupt acknowledge bus cycle, and INTVECT is valid during that time. It may contain invalid data while INTVECT is
updated.
10.3.3External NMI Trap Control and Status Register
(EXNMI)
The EXNMI register is a byte-wide read/write register. It indicates the current value of the NMI
NMI interrupt trap generation based on a falling edge of the
pin. TST, EN and ENLCK are cleared on reset. When
NMI
writing to this register, all reserved bits must be written with
0 for the device to function properly
pin and controls the
765 0
00INTVECT
INTVECTThe Interrupt Vector field indicates the highest
priority interrupt which is both asserted and
enabled.
10.3.2Non-Maskable Interrupt Status Register
(NMISTAT)
The NMISTAT register is a byte-wide read-only register. It
holds the status of the current pending Non-Maskable Interrupt (NMI) requests. On the CP3BT26, the external NMI
put is the only source of NMI interrupts. The NMISTAT
register is cleared on reset and each time its contents are
read.
710
ReservedEXT
EXTThe External NMI request bit indicates wheth-
er an external non-maskable interrupt request
has occurred. Refer to the description of the
EXNMI register below for additional details.
– No external NMI request.
0
– External NMI request has occurred.
1
in-
73210
ReservedENLCKPINEN
ENThe EXNMI trap enable bit is one of two bits
that can be used to enable NMI interrupts.
The bit is cleared by hardware at reset and
whenever the NMI interrupt occurs (EXNMI.EXT set). It is intended for applications
where the NMI
nested NMI traps are not desired. For these
applications, the EN bit needs to be re-enabled before exiting the trap handler. When
used this way, the ENLCK bit should never be
set. The EN bit can be set and cleared by software (software can set this bit only if EXNMI.EXT is cleared), and should only be set
after the interrupt base register and the interrupt stack pointer have been set up.
– NMI interrupts not enabled by this bit (but
0
may be enabled by the ENLCK bit).
– NMI interrupts enabled.
1
PINThe PIN bit indicates the state (non-inverted)
on the NMI input pin. This bit is read-only, data
written into it is ignored.
– NMI pin not asserted.
0
1 – NMI pin asserted.
ENLCKThe EXNMI trap enable lock bit is used to per-
manently enable NMI interrupts. Only a device reset can clear the ENLCK bit. This
allows the external NMI feature to be enabled
after the interrupt base register and the interrupt stack pointer have been set up. When the
ENLCK bit is set, the EN bit is ignored.
– NMI interrupts not enabled by this bit (but
0
may be enabled by the EN bit).
– NMI interrupts enabled.
1
input toggles frequently but
www.national.com48
Page 49
10.3.4Interrupt Enable and Mask Register 0 (IENAM0)
The IENAM0 register is a word-wide read/write register
which holds bits that individually enable and disable the
maskable interrupt sources IRQ1 through IRQ15. The register is initialized to FFFFh at reset.
CP3BT26
10.3.7Interrupt Status Register 0 (ISTAT0)
The ISTAT0 register is a word-wide read-only register. It indicates which maskable interrupt inputs to the ICU are active. These bits are not affected by the state of the
corresponding IENA bits.
1510
IENARes.
IENAEach Interrupt Enable bit enables or disables
the corresponding interrupt request IRQ1
through IRQ15, for example IENA15 controls
IRQ15. Because IRQ0 is not used, IENA0 is
ignored.
– Interrupt is disabled.
0
1 – Interrupt is enabled.
10.3.5Interrupt Enable and Mask Register 1 (IENAM1)
The IENAM1 register is a word-wide read/write register
which holds bits that individually enable and disable the
maskable interrupt sources IRQ16 through IRQ31. The register is initialized to FFFFh at reset.
150
IENA
IENAEach Interrupt Enable bit enables or disables
the corresponding interrupt request IRQ16
through IRQ31, for example IENA31 controls
IRQ31.
– Interrupt is disabled.
0
1 – Interrupt is enabled.
10.3.6Interrupt Enable and Mask Register 2 (IENAM2)
The IENAM2 register is a word-wide read/write register
which holds bits that individually enable and disable the
maskable interrupt sources IRQ32 through IRQ47. The register is initialized to FFFFh at reset.
1510
ISTRes.
ISTThe Interrupt Status bits indicate if a
maskable interrupt source is signalling an interrupt request. IST15:1 correspond to IRQ15
to IRQ1 respectively. Because the IRQ0 interrupt is not used, bit 0 always reads back 0.
– Interrupt is not active.
0
1 – Interrupt is active.
10.3.8Interrupt Status Register 1 (ISTAT1)
The ISTAT1 register is a word-wide read-only register. It indicates which maskable interrupt inputs into the ICU are active. These bits are not affected by the state of the
corresponding IENA bits.
150
IST
ISTThe Interrupt Status bits indicate if a
maskable interrupt source is signalling an interrupt request. IST31:16 correspond to
IRQ31 to IRQ16, respectively.
– Interrupt is not active.
0
1 – Interrupt is active.
10.3.9Interrupt Status Register 2 (ISTAT2)
The ISTAT2 register is a word-wide read-only register. It indicates which maskable interrupt inputs into the ICU are active. These bits are not affected by the state of the
corresponding IENA bits.
150
IENA
IENAEach Interrupt Enable bit enables or disables
the corresponding interrupt request IRQ32
through IRQ47, for example IENA47 controls
IRQ47.
– Interrupt is disabled.
0
1
– Interrupt is enabled.
150
IST
ISTThe Interrupt Status bits indicate if a
maskable interrupt source is signalling an interrupt request. IST47:32 correspond to
IRQ47 to IRQ32, respectively.
– Interrupt is not active.
0
1
– Interrupt is active.
49www.national.com
Page 50
10.4MASKABLE INTERRUPT SOURCES
Table 20 shows the interrupts assigned to various on-chip
maskable interrupts. The priority of simultaneous maskable
interrupts is linear, with IRQ47 having the highest priority.
CP3BT26
Table 20 Maskable Interrupts Assignment
IRQ NumberDescription
IRQ47TWM (Timer 0)
IRQ46Bluetooth LLC 0
IRQ45Bluetooth LLC 1
IRQ44Bluetooth LLC 2
IRQ43Bluetooth LLC 3
IRQ42Bluetooth LLC 4
IRQ41Bluetooth LLC 5
IRQ40USB Interface
IRQ39DMA Channel 0
IRQ38DMA Channel 1
IRQ37DMA Channel 2
IRQ36DMA Channel 3
IRQ35CAN
IRQ34Advanced Audio Interface (AAI)
IRQ33UART0 RX
IRQ32CVSD/PCM Converter
IRQ31ACCESS.bus
IRQ30TA (Timer input A)
IRQ29TB (Timer input B)
IRQ28VTUA (VTU Interrupt Request 1)
IRQ27VTUB (VTU Interrupt Request 2)
IRQ26VTUC (VTU Interrupt Request 3)
IRQ25VTUD (VTU Interrupt Request 4)
IRQ NumberDescription
IRQ14Reserved
IRQ13ADC (Done)
IRQ12MIWU Interrupt 0
IRQ11MIWU Interrupt 1
IRQ10MIWU Interrupt 2
IRQ9MIWU Interrupt 3
IRQ8MIWU Interrupt 4
IRQ7MIWU Interrupt 5
IRQ6MIWU Interrupt 6
IRQ5MIWU Interrupt 7
IRQ4Reserved
IRQ3Random Number Generator (RNG)
IRQ2Reserved
IRQ1Flash Program/Data Memory
IRQ0Reserved
All reserved interrupt vectors should point to default or error
interrupt handlers.
10.5NESTED INTERRUPTS
Nested NMI interrupts are always enabled. Nested
maskable interrupts are disabled by default, however an interrupt handler can allow nested maskable interrupts by setting the I bit in the PSR. The LPR instruction is used to set
the I bit.
Nesting of specific maskable interrupts can be allowed by
disabling interrupts from sources for which nesting is not allowed, before setting the I bit. Individual maskable interrupt
sources can be disabled using the IENAM0 and IENAM1
registers.
Any number of levels of nested interrupts are allowed, limited only by the available memory for the interrupt stack.
IRQ24Microwire/SPI RX/TX
IRQ23UART0 TX
IRQ22UART0 CTS
IRQ21Reserved
IRQ20UART1 RX
IRQ19UART1 TX
IRQ18UART2 RX
IRQ17UART2 TX
IRQ16UART3 RX
IRQ15UART3 TX
www.national.com50
Page 51
11.0Triple Clock and Reset
The Triple Clock and Reset module generates a 12 MHz
Main Clock and a 32.768 kHz Slow Clock from external
crystal networks or external clock sources. It provides various clock signals for the rest of the chip. It also provides the
main system reset signal, a power-on reset function, Main
TWM (Invalid Watchdog Service)
Flash Interface (Program/Erase Busy)
External Reset
Reset
Power-On-Reset
Module (POR)
Clock prescalers to generate two additional low-speed
clocks, and a 32-kHz oscillator start-up delay.
Figure 4 is block diagram of the Triple Clock and Reset module.
Reset
Module
Device Reset
Stretched
Reset
CP3BT26
X1CKI
X1CKO
Main Clock
X2CKI
X2CKO
High Frequency
Oscillator
Low Frequency
Oscillator
Stop Main Osc.
Preset
Start-Up-Delay
14-Bit Timer
4-Bit Aux1
Prescaler
4-Bit Aux2
Prescaler
Div.
by 2
Slow Clock Prescaler
8-Bit
Prescaler
Start-Up-Delay
8-Bit Timer
Preset
Mux
Time-out
Fast Clock
Prescaler
4-Bit
Prescaler
Mux
Stop Main Osc
Good Main Clock
Auxiliary Clock 1
Auxiliary Clock 2
Slow Clock
Slow Clock
Select
Good Slow Clock
Stop Slow Osc
Bypass
32 kHz Osc
System Clock
PLL
(x3, x4, or x5)
Mux
Stop PLL
Figure 4. Triple Clock and Reset Module
51www.national.com
Fast Clock
Select
PLL Clock
Bypass PLL
Good PLL Clock
Stop PLL
DS006
Page 52
11.1EXTERNAL CRYSTAL NETWORK
An external crystal network is connected to the X1CKI and
X1CKO pins to generate the Main Clock, unless an external
clock signal is driven on the X1CKI pin. A similar external
CP3BT26
crystal network may be used at pins X2CKI and X2CKO for
the Slow Clock. If an external crystal network is not used for
the Slow Clock, the Slow Clock is generated by dividing the
fast Main Clock.
The crystal network you choose may require external components different from the ones specified in this datasheet.
In this case, consult with National’s engineers for the component specifications
The crystals and other oscillator components must be
placed close to the X1CKI/X1CKO and X2CKI/X2CKO device input pins to keep the printed trace lengths to an absolute minimum.
Figure 5 shows the external crystal network for the X1CKI
and X1CKO pins. Figure 6 shows the external crystal network for the X2CKI and X2CKO pins. Table 21 shows the
component specifications for the main crystal network, and
Table 22 shows the component specifications for the 32.768
kHz crystal network.
X1CKI
12 MHz
Crystal
C1
C2
X1CKO
GND
Figure 5. Main Clock External Crystal Network
X2CKI
C1
DS189
32.768 kHz
Crystal
C2
X2CKO
GND
Figure 6. Slow Clock External Crystal Network
Table 21 Component Values of the High Frequency Crystal Circuit
ComponentParametersValuesTolerance
CrystalResonance Frequency
Ty pe
Max. Serial Resistance
Max. Shunt Capacitance
Load Capacitance
12 MHz ± 20 ppm
AT- Cu t
50 Ω
7 pF
22 pF
N/A
Capacitor C1, C2Capacitance22 pF20%
DS215
www.national.com52
Page 53
Table 22 Component Values of the Low Frequency Crystal Circuit
ComponentParametersValuesTolerance
CP3BT26
CrystalResonance Frequency
Ty p e
Maximum Serial Resistance
Maximum Shunt Capacitance
Load Capacitance
Min. Q factor
Capacitor C1, C2Capacitance25 pF20%
Choose capacitor component values in the tables to obtain
the specified load capacitance for the crystal when combined with the parasitic capacitance of the trace, socket, and
package (which can vary from 0 to 8 pF). As a guideline, the
load capacitance is:
C1 C2×
---------------------
CL
C1 C2+
C2 > C1
C1 can be trimmed to obtain the desired load capacitance.
The start-up time of the 32.768 kHz oscillator can vary from
one to six seconds. The long start-up time is due to the high
Q value and high serial resistance of the crystal necessary
to minimize power consumption in Power Save mode.
Cparasitic+=
11.2MAIN CLOCK
The Main Clock is generated by the 12-MHz high-frequency
oscillator or driven by an external signal (typically the
LMX5252 RF chip). It can be stopped by the Power Management Module to reduce power consumption during periods of reduced activity. When the Main Clock is restarted, a
14-bit timer generates a Good Main Clock signal after a
start-up delay of 32,768 clock cycles. This signal is an indicator that the high-frequency oscillator is stable.
The Stop Main Osc signal from the Power Management
Module stops and starts the high-frequency oscillator.
When this signal is asserted, it presets the 14-bit timer to
3FFFh and stops the high-frequency oscillator. When the
signal goes inactive, the high-frequency oscillator starts and
the 14-bit timer counts down from its preset value. When the
timer reaches zero, it stops counting and asserts the Good
Main Clock signal.
11.3SLOW CLOCK
The Slow Clock is necessary for operating the device in reduced power modes and to provide a clock source for modules such as the Timing and Watchdog Module.
The Slow Clock operates in a manner similar to the Main
Clock. The Stop Slow Osc signal from the Power Management Module stops and starts the low-frequency (32.768
kHz) oscillator. When this signal is asserted, it presets a 6bit timer to 3Fh and disables the low-frequency oscillator.
When the signal goes inactive, the low-frequency oscillator
starts, and the 6-bit timer counts down from its preset value.
When the timer reaches zero, it stops counting and asserts
the Good Slow Clock signal, which indicates that the Slow
Clock is stable.
For systems that do not require a reduced power consumption mode, the external crystal network may be omitted for
the Slow Clock. In that case, the Slow Clock can be synthesized by dividing the Main Clock by a prescaler factor. The
prescaler circuit consists of a fixed divide-by-2 counter and
a programmable 8-bit prescaler register. This allows a
choice of clock divisors ranging from 2 to 512. The resulting
Slow Clock frequency must not exceed 100 kHz.
A software-programmable multiplexer selects either the
prescaled Main Clock or the 32.768 kHz oscillator as the
Slow Clock. At reset, the prescaled Main Clock is selected,
ensuring that the Slow Clock is always present initially. Selection of the 32.768 kHz oscillator as the Slow Clock disables the clock prescaler, which allows the CLK1 oscillator
to be turned off, which reduces power consumption and radiated emissions. This can be done only if the module detects a toggling low-speed oscillator. If the low-speed
oscillator is not operating, the prescaler remains available
as the Slow Clock source.
11.4PLL CLOCK
The PLL Clock is generated by the PLL from the 12 MHz
Main Clock by applying a multiplication factor of ×3, ×4, or
×5. The USB interface is clocked directly by the PLL Clock
and requires a 48 MHz clock, so a ×4 scaling factor must be
used if the USB interface is active.
To enable the PLL:
1. Set the PLL multiplication factor in PRFSC.MODE.
2. Clear the PLL power-down bit CRCTRL.PLLPWD.
3. Clear the high-frequency clock select bit CRCTRL.FCLK.
4. Read CRCTRL.FCLK, and go back to step 3 if not clear.
The CRCTRL.FCLK bit will be clear only after the PLL has
stabilized, so software must repeat step 3 until the bit is
clear. The clock source can be switched back to the Main
Clock by setting the CRCTRL.FCLK bit.
The PRSFC register must not be modified while the System
Clock is derived from the PLL Clock. The System Clock
must be derived from the low-frequency oscillator clock
while the MODE field is modified.
32.768 kHz
Parallel
N-Cut or XY-bar
40 kΩ
2 pF
12.5 pF
40000
N/A
53www.national.com
Page 54
11.5SYSTEM CLOCK
The System Clock drives most of the on-chip modules, including the CPU. Typically, it is driven by the Main Clock, but
it can also be driven by the PLL. In either case, the clock sig-
CP3BT26
nal is passed through a programmable divider (scale factors
from ÷1 to ÷16).
rise time. The time constant also should exceed the stabilization time for the high-frequency oscillator.
11.9CLOCK AND RESET REGISTERS
Table 23 lists the clock and reset registers.
Table 23 Clock and Reset Registers
11.6AUXILIARY CLOCKS
Auxiliary Clock 1 and Auxiliary Clock 2 are generated from
Main Clock for use by certain peripherals. Auxiliary Clock 1
is available for the Bluetooth controller and the Advanced
Audio Interface. Auxiliary Clock 2 is available for the CVSD/
PCM transcoder and the 12-bit ADC. The Auxiliary clocks
may be configured to keep these peripherals running when
the System Clock is slowed down or suspended during lowpower modes.
11.7POWER-ON RESET
The Power-On Reset circuit generates a system reset signal
at power-up and holds the signal active for a period of time
to allow the crystal oscillator to stabilize. The circuit detects
a power turn-on condition, which presets a 14-bit timer driven by Main Clock to a value of 3FFFh. This preset value is
defined in hardware and not programmable. Once oscillation starts and the clock becomes active, the timer starts
counting down. When the count reaches zero, the 14-bit
timer stops counting and the internal reset signal is deactivated (unless the RESET
pin is held low).
The circuit sets a power-on reset bit on detection of a poweron condition. The CPU can read this bit to determine whether a reset was caused by a power-up or by the RESET
input.
Note: The Power-On Reset circuit cannot be used to detect
a drop in the supply voltage.
11.8EXTERNAL RESET
The active-low RESET input can be used to reset the device
at any time. When the signal goes low, it generates an internal system reset signal that remains active until the RESET
signal goes high again. There is no internal pullup on this input, so it must be driven or pulled high externally for proper
device operation.
If the VCC power supply has slow rise-time. it may be necessary to use an external reset circuit to insure proper device initialization. Figure 7 shows an example of an external
reset circuit.
IOVCC
IOVCC
R
C
Figure 7. External Reset Circuit
The value of R should be less than 50K ohms. The RC time
constant of the circuit should be 5 times the power supply
CP3BT2x
RESET
GND
DS216
NameAddressDescription
CRCTRLFF FC40h
PRSFCFF FC42h
PRSSCFF FC44h
PRSACFF FC46h
Clock and Reset
Control Register
High Frequency Clock
Prescaler Register
Low Frequency Clock
Prescaler Register
Auxiliary Clock
Prescaler Register
11.9.1Clock and Reset Control Register (CRCTRL)
The CRCTRL register is a byte-wide read/write register that
controls the clock selection and contains the power-on reset
status bit. At reset, the CRCTRL register is initialized as described below:
76543210
Reserved POR ACE2 ACE1 PLLPWD FCLK SCLK
SCLKThe Slow Clock Select bit controls the clock
source used for the Slow Clock.
– Slow Clock driven by prescaled Main
0
Clock.
1 – Slow Clock driven by 32.768 kHz oscilla-
tor.
FCLKThe Fast Clock Select bit selects between the
12 MHz Main Clock and the PLL as the source
used for the System Clock. After reset, the
Main Clock is selected. Attempting to switch to
the PLL while the PLLPWD bit is set (PLL is
turned off) is ignored. Attempting to switch to
the PLL also has no effect if the PLL output
clock has not stabilized.
– The System Clock prescaler is driven by
0
the output of the PLL.
1 – The System Clock prescaler is driven by
the 12-MHz Main Clock. This is the default after reset.
PLLPWDThe PLL Power-Down bit controls whether the
PLL is active or powered down (Stop PLL signal asserted). When this bit is set, the on-chip
PLL stays powered-down. Otherwise it is powered-up or it can be controlled by the Power
Management Module, respectively. Before
software can power-down the PLL in Active
mode by setting the PLLPWD bit, the FCLK bit
must be set. Attempting to set the PLLPWD
bit while the FCLK bit is clear is ignored. The
www.national.com54
Page 55
FCLK bit cannot be cleared until the PLL clock
has stabilized. After reset this bit is set.
0 – PLL is active.
– PLL is powered down.
1
ACE1When the Auxiliary Clock Enable bit is set and
a stable Main Clock is provided, the Auxiliary
Clock 1 prescaler is enabled and generates
the first Auxiliary Clock. When the ACE1 bit is
clear or the Main Clock is not stable, Auxiliary
Clock 1 is stopped. Auxiliary Clock 1 is used
as the clock input for the Bluetooth LLC and
the Advanced Audio Interface. After reset this
bit is clear.
– Auxiliary Clock 1 is stopped.
0
– Auxiliary Clock 1 is active if the Main
1
Clock is stable.
ACE2When the Auxiliary Clock Enable 2 bit is set
and a stable Main Clock is provided, the Auxiliary Clock 2 prescaler is enabled and generates Auxiliary Clock 2. When the ACE2 bit is
clear or the Main Clock is not stable, the Auxiliary Clock 2 is stopped. Auxiliary Clock 2 is
used as the clock input for the CVSD/PCM
transcoder and the A/D converter. After reset
this bit is clear.
– Auxiliary Clock 2 is stopped.
0
– Auxiliary Clock 2 is active if the Main
1
Clock is stable.
PORPower-On-Reset - The Power-On-Reset bit is
set when a power-turn-on condition has been
detected. This bit can only be cleared by software, not set. Writing a 1 to this bit will be ignored, and the previous value of the bit will be
unchanged.
– Software cleared this bit.
0
– Software has not cleared his bit since the
1
last reset.
11.9.2High Frequency Clock Prescaler Register
(PRSFC)
The PRSFC register is a byte-wide read/write register that
holds the 4-bit clock divisor used to generate the high-frequency clock. In addition, the upper three bits are used to
control the operation of the PLL. The register is initialized to
4Fh at reset (except in PROG mode
76430
ResMODEFCDIV
FCDIVThe Fast Clock Divisor specifies the divisor
used to obtain the high-frequency System
Clock from the PLL or Main Clock. The divisor
is (FCDIV + 1).
MODEThe PLL MODE field specifies the operation
mode of the on-chip PLL. After reset the
MODE bits are initialized to 100b, so the PLL
is configured to generate a 48-MHz clock.
This register must not be modified when the
System Clock is derived from the PLL Clock.
The System Clock must be derived from the
.)
low-frequency oscillator clock while the
MODE field is modified.
Output
MODE2:0
000ReservedReserved
001ReservedReserved
010ReservedReserved
01136 MHz3× Mode
10048 MHz4× Mode
10160 MHz5× Mode
110ReservedReserved
111ReservedReserved
11.9.3Low Frequency Clock Prescaler Register
(PRSSC)
The PRSSC register is a byte-wide read/write register that
holds the clock divisor used to generate the Slow Clock from
the Main Clock. The register is initialized to B6h at reset.
70
SCDIVThe Slow Clock Divisor field specifies a divi-
sor to be used when generating the Slow
Clock from the Main Clock. The Main Clock is
divided by a value of (2 × (SCDIV + 1)) to obtain the Slow Clock. At reset, the SCDIV register is initialized to B6h, which generates a
Slow Clock rate of 32786.89 Hz. This is about
0.5% faster than a Slow Clock generated from
an external 32768 Hz crystal network.
11.9.4Auxiliary Clock Prescaler Register (PRSAC)
The PRSAC register is a byte-wide read/write register that
holds the clock divisor values for prescalers used to generate the two auxiliary clocks from the Main Clock. The register is initialized to FFh at reset.
7430
ACDIV2ACDIV2
ACDIV1The Auxiliary Clock Divisor 1 field specifies
the divisor to be used for generating Auxiliary
Clock 1 from the Main Clock. The Main Clock
is divided by a value of (ACDIV1 + 1).
ACDIV2 The Auxiliary Clock Divisor 2 field specifies
the divisor to be used for generating Auxiliary
Clock 2 from the Main Clock. The Main Clock
is divided by a value of (ACDIV2 + 1).
Frequency
(from 12 MHz
input clock)
SCDIV
Description
CP3BT26
55www.national.com
Page 56
12.0Power Management
The Power Management Module (PMM) improves the efficiency of the CP3BT26 by changing the operating mode
CP3BT26
(and therefore the power consumption) according to the required level of device activity. The device implements four
power modes:
Active
Power Save
Idle
Halt
Table 24 summarizes the differences between power
modes: the state of the high-frequency oscillator (on or off),
the System Clock source (clock used by most modules),
and the clock source used by the Timing and Watchdog
Module (TWM). The high-frequency oscillator generates the
12-MHz Main Clock, and the low-frequency oscillator generates a 32.768 kHz clock. The Slow Clock can be driven by
the 32.768 kHz clock or a scaled version of the Main Clock.
Table 24 Power Mode Operating Summary
Mode
ActiveOnMain Clock Slow Clock
Power Save On or OffSlow Clock Slow Clock
IdleOn or OffNoneSlow Clock
HaltOffNoneNone
The low-frequency oscillator continues to operate in all four
modes and power must be provided continuously to the device power supply pins. In Halt mode, however, Slow Clock
does not toggle, and as a result, the TWM timer and Watchdog Module do not operate. For the Power Save and Idle
modes, the high-frequency oscillator can be turned on or off
under software control, as long as the low-frequency oscillator is used to drive Slow Clock.
Table 25 shows the clock sources used by the CP3BT26 device modules and their behavior in each power mode.
Module
CPUOnOn/OffOffOffSystem
MIWUOnOnActive ActiveSystem
PMMOnOnOnActive Slow Clock
TWMOnOnOnOffSlow Clock
USBOn/Off On/Off On/OffOffPLL Clock
BluetoothOn/Off On/Off On/OffOffAux 1 Clock
AAIOn/Off On/Off On/OffOffAux 1 Clock
CVSD/PCM On/Off On/Off On/OffOffAux 2 Clock
ADCOn/Off On/Off On/OffOff*Aux 2 Clock
All OthersOn/Off On/OffOffOffSystem
High-Frequency
Oscillator
Table 25 Module Activity Summary
Power Mode
Active
Power
Save
System
Clock
IdleHalt
TWM Clock
Clock
Source
* The Analog/Digital Converter (ADC) module is not automatically disabled by entering Halt mode, however its clock
is stopped so no conversions may be performed in Halt
mode. For maximum power savings, software must disable
the ADC module before entering Halt mode.
A module shown as On/Off in Table 25 may be enabled or
disabled by software. A module shown as Active continues
to operate even while its clock is suspended, which allows
wake-up events to be processed during Idle and Halt
modes.
The Random Number Generator (RNG) module has two oscillators which operate independently of the rest of the system. For maximum power savings, software must disable
these oscillators.
12.1ACTIVE MODE
In Active mode, the high-frequency oscillator is active and
generates the 12-MHz Main Clock. The 32.768 kHz oscillator is active and may be used to generate the Slow Clock.
The PLL can be active or inactive, as required. Most on-chip
modules are driven by the System Clock. The System Clock
can be the PLL Clock after a programmable divider or the
12-MHz Main Clock. The activity of peripheral modules is
controlled by their enable bits.
Power consumption can be reduced in this mode by selectively disabling modules and by executing the WAIT instruction. When the WAIT instruction is executed, the CPU stops
executing new instructions until it receives an interrupt signal. After reset, the CP3BT26 is in Active Mode.
12.2POWER SAVE MODE
In Power Save mode, Slow Clock is used as the System
Clock which drives the CPU and most on-chip modules. If
Slow Clock is driven by the 32.768 kHz oscillator and no onchip module currently requires the 12-MHz Main Clock, software can disable the high-frequency oscillator to further reduce power consumption. Auxiliary Clocks 1 and 2 can be
turned off under software control before switching to a reduced power mode, or they may remain active as long as
Main Clock is also active. If the system does not require the
PLL output clock, the PLL can be disabled. Alternatively, the
Main Clock and the PLL can also be controlled by the Hardware Clock Control function, if enabled. The clock architecture is described in Section 11.0.
The Bluetooth LLC can either be switched to the 32 kHz
clock internally in the module, or it remains running off Auxiliary clock 1 as long as the Main Clock and Auxiliary Clock
1 are enabled.
In Power Save mode, some modules are disabled or their
operation is restricted. Other modules, including the CPU,
continue to function normally, but operate at a reduced clock
rate. Details of each module’s activity in Power Save mode
are described in each module’s descriptions.
It is recommended to keep CPU activity at a minimum by executing the WAIT instruction to guarantee low power consumption in the system.
www.national.com56
Page 57
12.3IDLE MODE
In Idle mode, the System Clock is disabled and therefore the
clock is stopped to most modules of the device. The PLL
and the high-frequency oscillator may be disabled as controlled by register bits. The low-frequency oscillator remains
active. The Power Management Module (PMM) and the
Timing and Watchdog Module (TWM) continue to operate
off the Slow Clock. Auxiliary Clocks 1 and 2 can be turned
off under software control before switching to a power saving mode, or they remain active as long as Main Clock is
also active. Alternatively, the 12 MHz Main Clock and the
PLL can also be controlled by the Hardware Clock Control
function, if enabled.
The Bluetooth LLC can either be switched to the Slow Clock
internally in the module or it remains running off the Auxiliary Clock 1 as long as the Main Clock and Auxiliary Clock 1
are enabled.
12.4HALT MODE
In Halt mode, all the device clocks, including the System
Clock, Main Clock, and Slow Clock, are disabled. The highfrequency oscillator and PLL are turned off. The low-frequency oscillator continues to operate, however its circuitry
is optimized to guarantee lowest possible power consumption. This mode allows the device to reach the absolute minimum power consumption without losing its state (memory,
registers, etc.).
12.5HARDWARE CLOCK CONTROL
The Hardware Clock Control (HCC) mechanism gives the
Bluetooth Lower Link Controller (LLC) individual control
over the high-frequency oscillator and the PLL. The Bluetooth LLC can enter a Sleep mode for a specified number of
low-frequency clock cycles. While the Bluetooth LLC is in
Sleep mode and the CP3BT26 is in Power Save or Idle
mode, the HCC mechanism may be used to control whether
the high-frequency oscillator, PLL, or both units are disabled.
Altogether, three mechanisms control whether the high-frequency oscillator is active, and four mechanisms control
whether the PLL is active:
HCC Bits: The HCCM and HCCH bits in the PMMCR
register may be used to disable the high-frequency oscillator and PLL, respectively, in Power Save and Idle
modes when the Bluetooth LLC is in Sleep mode.
Disable Bits: The DMC and DHC bits in the PMMCR
register may be used to disable the high-frequency oscillator and PLL, respectively, in Power Save and Idle
modes. When used to disable the high-frequency oscillator or PLL, the DMC and DHC bits override the HCC
mechanism.
Power Management Mode: Halt mode disables the
high-frequency oscillator and PLL. Active Mode enables
them. The DMC and DHC bits and the HCC mechanism
have no effect in Active or Halt mode.
PLL Power Down Bit: The PLLPWD bit in the CRCTRL
register can be used to disable the PLL in all modes. This
bit does not affect the high-frequency oscillator.
12.6POWER MANAGEMENT REGISTERS
Table 26 lists the power management registers.
Table 26 Power Management Registers
NameAddressDescription
PMMCRFF FC60h
PMMSRFF FC62h
12.6.1Power Management Control Register (PMMCR)
The Power Management Control/Status Register (PMMCR)
is a byte-wide, read/write register that controls the operating
power mode (Active, Power Save, Idle, or Halt) and enables
or disables the high-frequency oscillator in the Power Save
and Idle modes. At reset, the non-reserved bits of this register are cleared. The format of the register is shown below.
76543210
HCCH HCCM DHC DMC WBPSM HALT IDLE PSM
PSMIf the Power Save Mode bit is clear and the
WBPSM bit is clear, writing 1 to the PSM bit
causes the device to start the switch to Power
Save mode. If the WBPSM bit is set when the
PSM bit is written with 1, entry into Power
Save mode is delayed until execution of a
WAIT instruction. The PSM bit becomes set
after the switch to Power Save mode is complete. The PSM bit can be cleared by software, and it can be cleared by hardware when
a hardware wake-up event is detected.
– Device is not in Power Save mode.
0
1 – Device is in Power Save mode.
IDLEThe Idle Mode bit indicates whether the de-
vice has entered Idle mode. The WBPSM bit
must be set to enter Idle mode. When the
IDLE bit is written with 1, the device enters
IDLE mode at the execution of the next WAIT
instruction. The IDLE bit can be set and
cleared by software. It is also cleared by the
hardware when a hardware wake-up event is
detected.
– Device is not in Idle mode.
0
1
– Device is in Idle mode.
Power Management
Control Register
Power Management
Status Register
CP3BT26
57www.national.com
Page 58
HALTThe Halt Mode bit indicates whether the de-
vice is in Halt mode. Before entering Halt
mode, the WBPSM bit must be set. When the
CP3BT26
WBPSMWhen the Wait Before Power Save Mode bit is
DMCThe Disable Main Clock bit may be used to
HALT bit is written with 1, the device enters
the Halt mode at the execution of the next
WAIT instruction. When in HALT mode, the
PMM stops the System Clock and then turns
off the PLL and the high-frequency oscillator.
The HALT bit can be set and cleared by software. The Halt mode is exited by a hardware
wake-up event. When this signal is set high,
the oscillator is started. After the oscillator has
stabilized, the HALT bit is cleared by the hardware.
– Device is not in Halt mode.
0
1 – Device is in Halt mode.
clear, a switch from Active mode to Power
Save mode only requires setting the PSM bit.
When the WBPSM bit is set, a switch from Active mode to Power Save, Idle, or Halt mode is
performed by setting the PSM, IDLE or HALT
bit, respectively, and then executing a WAIT
instruction. Also, if the DMC or DHC bits are
set, the high-frequency oscillator and PLL
may be disabled only after a WAIT instruction
is executed and the Power Save, Idle, or Halt
mode is entered.
– Mode transitions may occur immediately.
0
– Mode transitions are delayed until the
1
next WAIT instruction is executed.
disable the high-frequency oscillator in Power
Save and Idle modes. In Active mode, the
high-frequency oscillator is enabled without
regard to the DMC value. In Halt mode, the
high-frequency oscillator is disabled without
regard to the DMC value. The DMC bit is
cleared by hardware when a hardware wakeup event is detected.
– High-frequency oscillator is only disabled
0
in Halt mode or when disabled by the
HCC mechanism.
– High-frequency oscillator is also disabled
1
in Power Save and Idle modes.
DHCThe Disable High-Frequency (PLL) Clock bit
and the CRCTRL.PLLPWD bit may be used to
disable the PLL in Power Save and Idle
modes. When the DHC bit is clear (and PLLPWD = 0), the PLL is enabled in these modes.
If the DHC bit is set, the PLL is disabled in
Power Save and Idle mode. In Active mode
with the CRCTRL.PLLPWD bit set, the PLL is
enabled without regard to the DHC value. In
Halt mode, the PLL is disabled without regard
to the DMC value. The DHC bit is cleared by
hardware when a hardware wake-up event is
detected.
– PLL is disabled only by entering Halt
0
mode or setting the CRCTRL.PLLPWD
bit.
– PLL is also disabled in Power Save or Idle
1
mode.
HCCMThe Hardware Clock Control for Main Clock
bit may be used in Power Save and Idle
modes to disable the high-frequency oscillator
conditionally, depending on whether the Bluetooth LLC is in Sleep mode. The DMC bit must
be clear for this mechanism to operate. The
HCCM bit is automatically cleared when the
device enters Active mode.
– High-frequency oscillator is disabled in
0
Power Save or Idle mode only if the DMC
bit is set.
– High-frequency oscillator is also disabled
1
if the Bluetooth LLC is idle.
HCCHThe Hardware Clock Control for High-Fre-
quency (PLL) bit may be used in Power Save
and Idle modes to disable the PLL conditionally, depending on whether the Bluetooth LLC
is in Sleep mode. The DHC bit and the CRCTRL.PLLPWD bit must be clear for this mechanism to operate. The HCCH bit is
automatically cleared when the device enters
Active mode.
– PLL is disabled in Power Save or Idle
0
mode only if the DMC bit or the CRCTRL.PLLPWD bit is set.
– PLL is also disabled if the Bluetooth LLC
1
is idle.
www.national.com58
Page 59
12.6.2Power Management Status Register (PMMSR)
The Management Status Register (PMMR) is a byte-wide,
read/write register that provides status signals for the various clocks. The reset value of PMSR register bits 0 to 2 depend on the status of the clock sources monitored by the
PMM. The upper 5 bits are clear after reset. The format of
the register is shown below.
73210
ReservedOHC OMC OLC
OLCThe Oscillating Low Frequency Clock bit indi-
cates whether the low-frequency oscillator is
producing a stable clock. When the low-frequency oscillator is unavailable, the PMM will
not switch to Power Save, Idle, or Halt mode.
– Low-frequency oscillator is unstable, dis-
0
abled, or not oscillating.
– Low-frequency oscillator is available.
1
OMCThe Oscillating Main Clock bit indicates
whether the high-frequency oscillator is producing a stable clock. When the high-frequency oscillator is unavailable, the PMM will not
switch to Active mode.
– High-frequency oscillator is unstable, dis-
0
abled, or not oscillating.
– High-frequency oscillator is available.
1
OHCThe Oscillating High Frequency (PLL) Clock
bit indicates whether the PLL is producing a
stable clock. Because the PMM tests the stability of the PLL clock to qualify power mode
state transitions, a stable clock is indicated
when the PLL is disabled. This removes the
stability of the PLL clock from the test when
the PLL is disabled. When the PLL is enabled
but unstable, the PMM will not switch to Active
mode.
– PLL is enabled but unstable.
0
– PLL is stable or disabled (CRCTRL.PLL-
1
PWD = 0).
12.7SWITCHING BETWEEN POWER MODES
Switching from a higher to a lower power consumption
mode is performed by writing an appropriate value to the
Power Management Control/Status Register (PMMCR).
Switching from a lower power consumption mode to the Active mode is usually triggered by a hardware interrupt.
Figure 8 shows the four power consumption modes and the
events that trigger a transition from one mode to another.
Some of the power-up transitions are based on the occurrence of a wake-up event. An event of this type can be either
a maskable interrupt or a non-maskable interrupt (NMI). All
of the maskable hardware wake-up events are monitored by
the Multi-Input Wake-Up (MIWU) Module, which is active in
all modes. Once a wake-up event is detected, it is latched
until an interrupt acknowledge cycle occurs or a reset is applied.
A wake-up event causes a transition to the Active mode and
restores normal clock operation, but does not start execution of the program. It is the interrupt handler associated
with the wake-up source (MIWU or NMI) that causes program execution to resume.
Active Mode
Power Save Mode
Idle Mode
Halt Mode
HW Event
HW Event
HW Event
DS008
CP3BT26
12.7.1Active Mode to Power Save Mode
A transition from Active mode to Power Save mode is performed by writing a 1 to the PMMCR.PSM bit. The transition
to Power Save mode is either initiated immediately or at execution of the next WAIT instruction, depending on the state
of the PMMCR.WBPSM bit.
For an immediate transition to Power Save mode (PMMCR.WBPSM = 0), the CPU continues to operate using the
low-frequency clock. The PMMCR.PSM bit becomes set
when the transition to the Power Save mode is completed.
For a transition at the next WAIT instruction (PMMCR.WBPSM = 1), the CPU continues to operate in Active
mode until it executes a WAIT instruction. At execution of
the WAIT instruction, the device enters the Power Save
mode, and the CPU waits for the next interrupt event. In this
case, the PMMCR.PSM bit becomes set when it is written,
even before the WAIT instruction is executed.
59www.national.com
Page 60
12.7.2Entering Idle Mode
Entry into Idle mode is performed by writing a 1 to the PMMCR.IDLE bit and then executing a WAIT instruction. The
PMMCR.WBPSM bit must be set before the WAIT instruc-
CP3BT26
tion is executed. Idle mode can be entered only from the Active or Power Save mode.
12.7.3Disabling the High-Frequency Clock
When the low-frequency oscillator is used to generate the
Slow Clock, power consumption can be reduced further in
the Power Save or Idle mode by disabling the high-frequency oscillator. This is accomplished by writing a 1 to the PMMCR.DHC bit before executing the WAIT instruction that
puts the device in the Power Save or Idle mode. The highfrequency clock is turned off only after the device enters the
Power Save or Idle mode.
The CPU operates on the low-frequency clock in Power
Save mode. It can turn off the high-frequency clock at any
time by writing a 1 to the PMMCR.DHC bit. The high-frequency oscillator is always enabled in Active mode and always disabled in Halt mode, without regard to the
PMMCR.DHC bit setting.
Immediately after power-up and entry into Active mode,
software must wait for the low-frequency clock to become
stable before it can put the device in Power Save mode. It
should monitor the PMMSR.OLC bit for this purpose. Once
this bit is set, Slow Clock is stable and Power Save mode
can be entered.
12.7.4Entering Halt Mode
Entry into Halt mode is accomplished by writing a 1 to the
PMMCR.HALT bit and then executing a WAIT instruction.
The PMMCR.WBPSM bit must be set before the WAIT instruction is executed. Halt mode can be entered only from
Active or Power Save mode.
12.7.5Software-Controlled Transition to Active Mode
A transition from Power Save mode to Active mode can be
accomplished by either a software command or a hardware
wake-up event. The software method is to write a 0 to the
PMMCR.PSM bit. The value of the register bit changes only
after the transition to the Active mode is completed.
If the high-frequency oscillator is disabled for Power Save
operation, the oscillator must be enabled and allowed to stabilize before the transition to Active mode. To enable the
high-frequency oscillator, software writes a 0 to the PMMCR.DMC bit. Before writing a 0 to the PMMCR.PSM bit,
software must first monitor the PMMSR.OMC bit to determine when the oscillator has stabilized.
12.7.6Wake-Up Transition to Active Mode
A hardware wake-up event switches the device directly from
Power Save, Idle, or Halt mode to Active mode. Hardware
wake-up events are:
Non-Maskable Interrupt (NMI)
Valid wake-up event on a Multi-Input Wake-Up channel
When a wake-up event occurs, the on-chip hardware performs the following steps:
1. Clears the PMMCR.DMC bit, which enables the highfrequency clock (if it was disabled).
2. Waits for the PMMSR.OMC bit to become set, which indicates that the high-frequency clock is operating and
is stable.
3. Clears the PMMCR.DHC bit, which enables the PLL.
4. Waits for the PMMSR.OHC bit to become set.
5. Switches the device into Active mode.
12.7.7Power Mode Switching Protection
The Power Management Module has several mechanisms
to protect the device from malfunctions caused by missing
or unstable clock signals.
The PMMSR.OHC, PMMSR.OMC, and PMMSR.OLC bits
indicate the current status of the PLL, high-frequency oscillator, and low-frequency oscillator, respectively. Software
can check the appropriate bit before switching to a power
mode that requires the clock. A set status bit indicates an
operating, stable clock. A clear status bit indicates a clock
that is disabled, not available, or not yet stable. (Except in
the case of the PLL, which has a set status bit when disabled.)
During a power mode transition, if there is a request to
switch to a mode with a clear status bit, the switch is delayed
until that bit is set by the hardware.
When the system is built without an external crystal network
for the low-frequency clock, Main Clock is divided by a prescaler factor to produce the low-frequency clock. In this situation, Main Clock is disabled only in the Halt mode, and
cannot be disabled for the Power Save or Idle mode.
Without an external crystal network for the low-frequency
clock, the device comes out of Halt or Idle mode and enters
Active mode with Main Clock driving Slow Clock.
Note: For correct operation in the absence of a low-frequency crystal, the X2CKI pin must be tied low (not left floating) so that the hardware can detect the absence of the
crystal.
www.national.com60
Page 61
13.0Multi-Input Wake-Up
The Multi-Input Wake-Up (MIWU) unit consists of two identical 16-channel modules. Each module can assert a wakeup signal for exiting from a low-power mode, and each can
assert an interrupt request on any of four Interrupt Control
Unit (ICU) channels assigned to that module. The modules
operate independently, so each may assert an interrupt request to the ICU. Together, these modules provide 32 MIWU
input channels and 8 interrupt request outputs.
Each 16-channel module monitors its inputs for a softwareselectable trigger condition. On detection of a trigger condition, the module generates an interrupt request and if enabled, a wake-up request. A wake-up request can be used
by the power management unit to exit the Halt, Idle, or Power Save mode and return to the Active mode. An interrupt
request generates an interrupt to the CPU, which allows an
interrupt handler to respond to MIWU events.
The wake-up event only activates the clocks and CPU, but
does not by itself initiate execution of any code. It is the interrupt request asserted by the MIWU that gets the CPU to
start executing code, by jumping to the corresponding inter-
CP3BT26
rupt handler. Therefore, setting up the MIWU interrupt handler is essential for any wake-up operation.
Each 16-channel module has four interrupt requests that
can be routed to the ICU as shown in Figure 9. Each of the
16 channels can be programmed to activate one of these
four interrupt requests.
The 32 MIWU channels are named WUI0 through WUI31,
as shown in Table 27.
Each channel can be configured to trigger on rising or falling
edges, as determined by the setting in the WK0EDG or
WK1EDG register. Each trigger event is latched into the
WK0PND or WK1PND register. If a trigger event is enabled
by its respective bit in the WK0ENA or WK1ENA register, an
active wake-up/interrupt signal is generated. Software can
determine which channel has generated the active signal by
reading the WK0PND or WK1PND register.
The MIWU is active at all times, including the Halt mode. All
device clocks are stopped in this mode. Therefore, detecting
an external trigger condition and the subsequent setting of
the pending bit are not synchronous to the System Clock.
The WK0EDG register is a word-wide read/write register
that controls the edge sensitivity of the MIWU channels. The
WK0EDG register is cleared upon reset, which configures
all channels to be triggered on rising edges. The register format is shown below.
CP3BT26
13.1.4Wake-Up 1 Enable Register (WK1ENA)
The WK1ENA register is a word-wide read/write register
that individually enables or disables wake-up events from
the MIWU channels. The WK1ENA register is cleared upon
reset, which disables all wake-up/interrupt channels. The
register format is shown below.
150
WKED
WKEDThe Wake-Up Edge Detection bits control the
edge sensitivity for MIWU channels. The
WKED15:0 bits correspond to the WUI15:0
channels, respectively.
– Triggered on rising edge (low-to-high
0
transition).
1 – Triggered on falling edge (high-to-low
transition).
13.1.2Wake-Up 1 Edge Detection Register (WK1EDG)
The WK1EDG register is a word-wide read/write register
that controls the edge sensitivity of the MIWU channels. The
WK1EDG register is cleared upon reset, which configures
all channels to be triggered on rising edges. The register format is shown below.
150
WKED
WKEDThe Wake-Up Edge Detection bits control the
edge sensitivity for MIWU channels. The
WKED15:0 bits correspond to the WUI31:16
channels, respectively.
– Triggered on rising edge (low-to-high
0
transition).
1 – Triggered on falling edge (high-to-low
transition).
13.1.3Wake-Up Enable Register (WK0ENA)
The WK0ENA register is a word-wide read/write register
that individually enables or disables wake-up events from
the MIWU channels. The WK0ENA register is cleared upon
reset, which disables all wake-up/interrupt channels. The
register format is shown below.
150
WKEN
150
WKEN
WKENThe Wake-Up Enable bits enable and disable
the MIWU channels. The WKEN15:0 bits correspond to the WUI31:16 channels, respectively.
– MIWU channel wake-up events disabled.
0
1 – MIWU channel wake-up events enabled.
13.1.5Wake-Up Interrupt Enable Register (WK0IENA)
The WK0IENA register is a word-wide read/write register
that enables and disables interrupts from the MIWU channels. The register format is shown below.
150
WKIEN
WKIENThe Wake-Up Interrupt Enable bits control
whether MIWU channels generate interrupts.
The WKIEN15:0 bits correspond to the
WUI15:0 channels, respectively.
The WK1IENA register is a word-wide read/write register
that enables and disables interrupts from the MIWU channels. The register format is shown below.
150
WKIEN
WK1IENThe Wake-Up Interrupt Enable bits control
whether MIWU channels generate interrupts.
The WKIEN15:0 bits correspond to the
WUI31:16 channels, respectively.
– Interrupt disabled.
0
– Interrupt enabled.
1
WKENThe Wake-Up Enable bits enable and disable
the MIWU channels. The WKEN15:0 bits correspond to the WUI15:0 channels, respectively.
– MIWU channel wake-up events disabled.
0
– MIWU channel wake-up events enabled.
1
63www.national.com
Page 64
13.1.7Wake-Up Interrupt Control Register 1
(WK0ICTL1)
The WK0ICTL1 register is a word-wide read/write register
that selects the interrupt request signal for the associated
CP3BT26
MIWU channels WUI7:0. At reset, the WK0ICTL1 register is
cleared, which selects MIWU Interrupt Request 0 for all
eight channels. The register format is shown below.
13.1.9Wake-Up Interrupt Control Register 2
(WK0ICTL2)
The WK0ICTL2 register is a word-wide read/write register
that selects the interrupt request signal for the associated
MIWU channels WUI15:8. At reset, the WK2ICTL2 register
is cleared, which selects MIWU Interrupt Request 0 for all
eight channels. The register format is shown below.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
WKIN
WKIN
WKIN
WKIN
WKIN
WKIN
TR7
TR6
TR5
TR4
TR3
WKINTRThe Wake-Up Interrupt Request Select fields
select which of the four MIWU interrupt requests are activated for the corresponding
channel.
00 – Selects MIWU interrupt request 0.
01 – Selects MIWU interrupt request 1.
10 – Selects MIWU interrupt request 2.
11 – Selects MIWU interrupt request 3.
13.1.8Wake-Up 1 Interrupt Control Register 1
(WK1ICTL1)
The WK1ICTL1 register is a word-wide read/write register
that selects the interrupt request signal for the associated
MIWU channels WUI23:16. At reset, the WK1ICTL1 register
is cleared, which selects MIWU Interrupt Request 4 for all
eight channels. The register format is shown below.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
WKIN
WKIN
WKIN
WKIN
WKIN
WKIN
TR23
TR22
TR21
TR20
TR19
TR2
TR18
WKIN
TR1
WKIN
TR17
WKIN
TR0
WKIN
TR16
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
WKIN
WKIN
WKIN
WKIN
WKIN
WKIN
WKIN
WKIN
TR15
TR14
TR13
TR12
TR11
TR10
WKINTRThe Wake-Up Interrupt Request Select fields
select which of the four MIWU interrupt requests are activated for the corresponding
channel.
00 – Selects MIWU interrupt request 0.
01 – Selects MIWU interrupt request 1.
10 – Selects MIWU interrupt request 2.
11 – Selects MIWU interrupt request 3.
13.1.10 Wake-Up 1 Interrupt Control Register 2
(WK1ICTL2)
The WK1ICTL2 register is a word-wide read/write register
that selects the interrupt request signal for the associated
MIWU channels WUI31:24. At reset, the WK1ICTL2 register
is cleared, which selects MIWU Interrupt Request 4 for all
eight channels. The register format is shown below.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
WKIN
WKIN
WKIN
WKIN
WKIN
WKIN
TR31
TR30
TR29
TR28
TR27
TR26
TR9
WKIN
TR25
TR8
WKIN
TR24
WKINTRThe Wake-Up Interrupt Request Select fields
select which of the four MIWU interrupt requests are activated for the corresponding
channel.
00 – Selects MIWU interrupt request 4.
01 – Selects MIWU interrupt request 5.
10 – Selects MIWU interrupt request 6.
11 – Selects MIWU interrupt request 7.
WKINTRThe Wake-Up Interrupt Request Select fields
select which of the four MIWU interrupt requests are activated for the corresponding
channel.
00 – Selects MIWU interrupt request 4.
01 – Selects MIWU interrupt request 5.
10 – Selects MIWU interrupt request 6.
11 – Selects MIWU interrupt request 7.
www.national.com64
Page 65
13.1.11 Wake-Up Pending Register (WK0PND)
The WK0PND register is a word-wide read/write register in
which the Multi-Input Wake-Up module latches any detected trigger conditions. The CPU can only write a 1 to any bit
position in this register. If the CPU attempts to write a 0, it
has no effect on that bit. To clear a bit in this register, the
CPU must use the WK0PCL register. This implementation
prevents a potential hardware-software conflict during a
read-modify-write operation on the WK0PND register.
This register is cleared upon reset. The register format is
shown below.
150
WKPD
WKPDThe Wake-Up Pending bits indicate which
MIWU channels have been triggered. The
WKPD15:0 bits correspond to the WUI15:0
channels. Writing 1 to a bit sets it.
– Trigger condition did not occur.
0
1 – Trigger condition occurred.
13.1.12 Wake-Up 1 Pending Register (WK1PND)
The WK1PND register is a word-wide read/write register in
which the Multi-Input Wake-Up module latches any detected trigger conditions. The CPU can only write a 1 to any bit
position in this register. If the CPU attempts to write a 0, it
has no effect on that bit. To clear a bit in this register, the
CPU must use the WK1PCL register. This implementation
prevents a potential hardware-software conflict during a
read-modify-write operation on the WK1PND register.
This register is cleared upon reset. The register format is
shown below.
150
WKPD
13.1.13 Wake-Up Pending Clear Register (WK0PCL)
The WK0PCL register is a word-wide write-only register that
lets the CPU clear bits in the WKPND register. Writing a 1
to a bit position in the WKPCL register clears the corresponding bit in the WKPND register. Writing a 0 has no effect. Do not modify this register with instructions that access
the register as a read-modify-write operand, such as the bit
manipulation instructions.
Reading this register location returns undefined data.
Therefore, do not use a read-modify-write sequence (such
as the SBIT instruction) to set individual bits. Do not attempt
to read the register, then perform a logical OR on the register value. Instead, write the mask directly to the register address. The register format is shown below.
150
WKCL
WKCLWriting 1 to a bit clears it.
– Writing 0 has no effect.
0
1 – Writing 1 clears the corresponding bit in
the WKPD register.
13.1.14 Wake-Up 1 Pending Clear Register (WK1PCL)
The WK1PCL register is a word-wide write-only register that
lets the CPU clear bits in the WK1PND register. Writing a 1
to a bit position in the WK1PCL register clears the corresponding bit in the WK1PND register. Writing a 0 has no effect. Do not modify this register with instructions that access
the register as a read-modify-write operand, such as the bit
manipulation instructions.
Reading this register location returns undefined data.
Therefore, do not use a read-modify-write sequence (such
as the SBIT instruction) to set individual bits. Do not attempt
to read the register, then perform a logical OR on the register value. Instead, write the mask directly to the register address. The register format is shown below.
CP3BT26
WKPDThe Wake-Up Pending bits indicate which
MIWU channels have been triggered. The
WKPD15:0 bits correspond to the WUI31:15
channels. Writing 1 to a bit sets it.
– Trigger condition did not occur.
0
1
– Trigger condition occurred.
150
WKCL
WKCLWriting 1 to a bit clears it.
– Writing 0 has no effect.
0
– Writing 1 clears the corresponding bit in
1
the WK1PD register.
65www.national.com
Page 66
13.2PROGRAMMING PROCEDURES
To set up and use the Multi-Input Wake-Up function, use the
following procedure. Performing the steps in the order
shown will prevent false triggering of a wake-up condition.
CP3BT26
This same procedure should be used following a reset because the wake-up inputs are left floating, resulting in unknown data on the input pins.
1. Clear the WK0ENA and WK1ENA registers to disable
the MIWU channels.
2. Write the WK0EDG and WK1EDG registers to select
the desired type of edge sensitivity (clear for rising
edge, set for falling edge).
3. Set all bits in the WK0PCL and WK0PCL registers to
clear any pending bits in the WK0PND and WK1PND
registers.
4. Set up the WK0ICTL1, WK1ICTL1, WK0ICTL2, and
WK1ICTL2 registers to define the interrupt request signal used for each channel.
5. Set the bits in the WK0ENA and WK1ENA registers
corresponding to the wake-up channels to be activated.
To change the edge sensitivity of a wake-up channel, use
the following procedure. Performing the steps in the order
shown will prevent false triggering of a wake-up/interrupt
condition.
1. Clear the WK0ENA or WK1ENA bit associated with the
input to be reprogrammed.
2. Write the new value to the corresponding bit position in
the WK0EDG or WK1EDG register to reprogram the
edge sensitivity of the input.
3. Set the corresponding bit in the WK0PCL or WK1PCL
register to clear the pending bit in the WK0PND or
WK1PND register.
4. Set the same WK0ENA or WK1ENA bit to re-enable the
wake-up function.
www.national.com66
Page 67
14.0Input/Output Ports
Each device has up to 54 software-configurable I/O pins, organized into 8-bit ports (not all bits are used in some ports).
The ports are named Port B, Port C, Port E, Port F, Port G,
Port H, and Port J.
In addition to their general-purpose I/O capability, the I/O
pins of Ports E, F, G, H, and J have alternate functions for
use with on-chip peripheral modules such as the UART or
the Multi-Input Wake-Up unit. The alternate functions of all
I/O pins are shown in Table 94.
Ports B and C are used as the 16-bit data bus when an external bus is enabled (144-pin devices only). This alternate
function is selected by enabling the DEV or ERE operating
environments, not by programming the port registers.
The I/O pin characteristics are fully programmable. Each pin
can be configured to operate as a TRI-STATE output, pushpull output, weak pull-up input, or high-impedance input.
CP3BT26
Different pins within the same port can be individually configured to operate in different modes.
Figure 10 is a diagram showing the I/O port pin logic. The
register bits, multiplexers, and buffers allow the port pin to
be configured into the various operating modes. The output
buffer is a TRI-STATE buffer with weak pull-up capability.
The weak pull-up, if used, prevents the port pin from going
to an undefined state when it operates as an input.
To reduce power consumption, input buffers configured for
general-purpose I/O are only enabled when they are read.
When configured for an alternate function, the input buffers
are enabled continuously. To minimize power consumption,
input signals to enabled buffers must be held within 0.2 volts
of the VCC or GND voltage.
The electrical characteristics and drive capabilities of the input and output buffers are described in Section 30.0.
PxALTS Register
PxALT Register
PxWKPU Register
Alt. A Device Direction
Alt. B Device Direction
PxDIR Register
Alt. A Device Data Outout
Alt. B Device Data Outout
PxDOUT Register
Alt. A Data Input
PxDIN Register
Alt. B Data Input
Data In Read Strobe
DQ
DQ
DQ
DQ
DQ
VCC
Weak Pull-Up Enable
Output Enable
Pin
Data Out
Data In
1
Analog Input
14.1PORT REGISTERS
Each port has an associated set of memory-mapped registers used for controlling the port and for holding the port data:
DS190
Figure 10. I/O Port Pin Logic
PxALT: Port alternate function register
PxALTS: Port alternate function select register
PxDIR: Port direction register
PxDIN: Port data input register
PxDOUT: Port data output register
PxWPU: Port weak pull-up register
PxHDRV: Port high drive strength register
67www.national.com
Page 68
Table 29 Port Registers
CP3BT26
NameAddressDescription
PBALTFF FB00h
PBDIRFF FB02hPort B Direction Register
PBDINFF FB04hPort B Data Input Register
PBDOUTFF FB06hPort B Data Output Register
PBWPUFF FB08h
PBHDRVFF FB0Ah
PBALTSFF FB0Ch
PCALTFF FB10h
PCDIRFF FB12hPort C Direction Register
PCDINFF FB14hPort C Data Input Register
PCDOUTFF FB16hPort C Data Output Register
PCWPUFF FB18h
PCHDRVFF FB1Ah
PCALTSFF FB1Ch
PEALTFF FCC0h
PEDIRFF FCC2hPort E Direction Register
PEDINFF FCC4hPort E Data Input Register
PEDOUTFF FCC6hPort E Data Output Register
PEWPUFF FCC8h
PEHDRVFF FCCAh
PEALTSFF FCCCh
PFALTFF FCE0h
PFDIRFF FCE2hPort F Direction Register
Por t B Alternate
Function Register
Port B Weak Pull-Up
Register
Port B High Drive
Strength Register
Port B Alternate Function
Select Register
Port C Alternate
Function Register
Port C Weak Pull-Up
Register
Port C High Drive
Strength Register
Port C Alternate Function
Select Register
Por t E Alternate
Function Register
Port E Weak Pull-Up
Register
Port E High Drive
Strength Register
Port E Alternate Function
Select Register
Port F Alternate
Function Register
Table 29 Port Registers
NameAddressDescription
PFHDRVFF FCEAh
PFALTSFF FCECh
PGALTFF F300h
PGDIRFF F302hPort G Direction Register
PGDINFF F304hPort G Data Input Register
PGDOUTFF F306hPort G Data Output Register
PGWPUFF F308h
PGHDRVFF F30Ah
PGALTSFF F30Ch
PHALTFF F320h
PHDIRFF F322hPort H Direction Register
PHDINFF F324hPort H Data Input Register
PHDOUTFF F326hPort H Data Output Register
PHWPUFF F328h
PHHDRVFF F32Ah
PHALTSFF F32Ch
PJALTFF F340h
PJDIRFF F342hPort J Direction Register
PJDINFF F344hPort J Data Input Register
PJDOUTFF F346hPort J Data Output Register
PJWPUFF F348h
PJHDRVFF F34Ah
PJALTSFF F34Ch
Port F High Drive
Strength Register
Port F Alternate Function
Select Register
Port G Alternate
Function Register
Port G Weak Pull-Up
Register
Port G High Drive
Strength Register
Port G Alternate Function
Select Register
Port H Alternate
Function Register
Port H Weak Pull-Up
Register
Port H High Drive
Strength Register
Port H Alternate Function
Select Register
Port J Alternate
Function Register
Port J Weak Pull-Up
Register
Port J High Drive
Strength Register
Port J Alternate Function
Select Register
PFDINFF FCE4hPort F Data Input Register
PFDOUTFF FCE6hPort F Data Output Register
PFWPUFF FCE8h
www.national.com68
Port F Weak Pull-Up
Register
In the descriptions of the ports and port registers, the lowercase letter “x” represents the port designation, either B, C,
E, F, G, H, or J. For example, “PxDIR register” means any
one of the port direction registers: PBDIR, PCDIR, PEDIR,
PFDIR, PGDIR, PHDIR, or PJDIR.
Page 69
All of the port registers are byte-wide read/write registers,
except for the port data input registers, which are read-only
registers. Each register bit controls the function of the corresponding port pin. For example, PGDIR.2 (bit 2 of the
PGDIR register) controls the direction of port pin PG2.
14.1.1Port Alternate Function Register (PxALT)
The PxALT registers control whether the port pins are used
for general-purpose I/O or for their alternate function. Each
port pin can be controlled independently.
A clear bit in the alternate function register causes the corresponding pin to be used for general-purpose I/O. In this
configuration, the output buffer is controlled by the direction
register (PxDIR) and the data output register (PxDOUT).
The input buffer is visible to software as the data input register (PxDIN).
A set bit in the alternate function register (PxALT) causes
the corresponding pin to be used for its peripheral I/O function. When the alternate function is selected, the output
buffer data and TRI-STATE configuration are controlled by
signals from the on-chip peripheral device.
A reset operation clears the port alternate function registers, which initializes the pins as general-purpose I/O ports.
This register must be enabled before the corresponding alternate function is enabled.
70
PxALT
PxALTThe PxALT bits control whether the corre-
sponding port pins are general-purpose I/O
ports or are used for their alternate function by
an on-chip peripheral.
– General-purpose I/O selected.
0
1 – Alternate function selected.
14.1.2Port Direction Register (PxDIR)
The port direction register (PxDIR) determines whether
each port pin is used for input or for output. A clear bit in this
register causes the corresponding pin to operate as an input, which puts the output buffer in the high-impedance
state. A set bit causes the pin to operate as an output, which
enables the output buffer.
A reset operation clears the port direction registers, which
initializes the pins as inputs.
70
PxDIR
PxDIRThe PxDIR bits select the direction of the cor-
responding port pin.
– Input.
0
– Output.
1
14.1.3Port Data Input Register (PxDIN)
The data input register (PxDIN) is a read-only register that
returns the current state on each port pin. The CPU can
read this register at any time even when the pin is configured as an output.
70
PxDIN
PxDINThe PxDIN bits indicate the state on the cor-
responding port pin.
– Pin is low.
0
1 – Pin is high.
14.1.4Port Data Output Register (PxDOUT)
The data output register (PxDOUT) holds the data to be
driven on output port pins. In this configuration, writing to
the register changes the output value. Reading the register
returns the last value written to the register.
A reset operation leaves the register contents unchanged.
At power-up, the PxDOUT registers contain unknown values.
70
PxDOUT
PxDOUTThe PxDOUT bits hold the data to be driven
on pins configured as outputs in general-purpose I/O mode.
– Drive the pin low.
0
1 – Drive the pin high.
14.1.5Port Weak Pull-Up Register (PxWPU)
The weak pull-up register (PxWPU) determines whether the
port pins have a weak pull-up on the output buffer. The pullup device, if enabled by the register bit, operates in the general-purpose I/O mode whenever the port output buffer is
disabled. In the alternate function mode, the pull-ups are always disabled.
A reset operation clears the port weak pull-up registers,
which disables all pull-ups.
70
PxWPU
PxWPUThe PxWPU bits control whether the weak
pull-up is enabled.
– Weak pull-up disabled.
0
– Weak pull-up enabled.
1
CP3BT26
69www.national.com
Page 70
14.1.6Port High Drive Strength Register (PxHDRV)
The PxHDRV register is a byte-wide, read/write register that
controls the slew rate of the corresponding pins. The high
drive strength function is enabled when the corresponding
CP3BT26
bits of the PxHDRV register are set. In both GPIO and alternate function modes, the drive strength function is enabled
by the PxHDRV registers. At reset, the PxHDRV registers
are cleared, making the ports low speed.
70
PxHDRV
Table 30 Alternate Function Select
Port PinPxALTS = 0PxALTS = 1
PF7SRDTIO8
PG0RFSYNCReserved
PG1RFCEReserved
PG2BTSEQ1SRCLK
PG3SCLKReserved
PG4SDATReserved
PxHDRVThe PxHDRV bits control whether output pins
are driven with slow or fast slew rate.
– Slow slew rate.
0
1 – Fast slew rate.
14.1.7Port Alternate Function Select Register
(PxALTS)
The PxALTS register selects which of two alternate functions are selected for the port pin. These bits are ignored
unless the corresponding PxALT bits are set. Each port pin
can be controlled independently.
70
PxALTS
PxALTSThe PxALTS bits select among two alternate
functions. Table 30 shows the mapping of the
PxALTS bits to the alternate functions. Unused PxALTS bits must be clear.
Table 30 Alternate Function Select
Port PinPxALTS = 0PxALTS = 1
PE0UART0 RXD0Reserved
PE1UART0 TXD0Reserved
PE2UART0 RTSReserved
PG5SLE
PG6WUI10BTSEQ2
PG7TABTSEQ3
PH0UART1 RXD1WUI11
PH1UART1 TXD1WUI12
PH2UART2 RXD2WUI13
PH3UART2 TXD2WUI14
PH4UART3 RXD3WUI15
PH5UART3 TXD3WUI16
PH6CANRXWUI17
PH7CANTXReserved
PJ0WUI18Reserved
PJ1WUI19Reserved
PJ2WUI20Reserved
PJ3WUI21Reserved
PJ4WUI22Reserved
PJ5WUI23Reserved
PJ6WUI24Reserved
PJ7ASYNCWUI9
Reserved
PE3UART0 CTS
PE4UART0 CKXTB
PE5SRFSNMI
PF0MSKTIO1
PF1MDIDOTIO2
PF2MDODITIO3
PF3MWCS
PF4SCKTIO5
PF5SFSTIO6
PF6STDTIO7
www.national.com70
Reserved
TIO4
Page 71
14.2OPEN-DRAIN OPERATION
A port pin can be configured to operate as an inverting
open-drain output buffer. To do this, the CPU must clear the
bit in the data output register (PxDOUT) and then use the
port direction register (PxDIR) to set the value of the port
pin. With the direction register bit set (direction = out), the
value zero is forced on the pin. With the direction register bit
clear (direction = in), the pin is placed in the TRI-STATE
mode. If desired, the internal weak pull-up can be enabled
to pull the signal high when the output buffer is in TRISTATE mode.
CP3BT26
71www.national.com
Page 72
15.0Bluetooth Controller
The integrated hardware Bluetooth Lower Link Controller
(LLC) complies to the Bluetooth Specification Version 1.1
CP3BT26
and integrates the following functions:
4.5K-byte dedicated Bluetooth data RAM
1K-byte dedicated Bluetooth Sequencer RAM
Support of all Bluetooth 1.1 packet types
Support for fast frequency hopping of 1600 hops/s
Access code correlation and slot timing recovery circuit
Power Management Control Logic
BlueRF-compatible interface to connect with National’s
LMX5252 and other RF transceiver chips
For a detailed description of the interface to the LMX5252,
consult the LMX5252 data sheet which is available from the
National Semiconductor wireless group. National provides
software libraries for using the Bluetooth LLC. Documentation for the software libraries is also available from National
Semiconductor.
15.1RF INTERFACE
The CP3BT26 interfaces to the LMX5251 or LMX5252 radio
chips though the RF interface.
Figure 11 shows the interface between the CP3BT26 and
the LMX5251 radio chip.
VCC
IOVCCVDD_DIG_IN
RFDATA
PG0/RFSYNC
CP3BT26LMX5251
PG1/RFCE
PG3/SCLK
PG4/SDAT
PG5/SLECCB_LATCH
X1CKI/BBCLK
Figure 11. LMX5251 Interface
TX_RX_DATA
TX_RX_SYNC
CE
CCB_CLOCK
CCB_DATA
BBP_CLOCK
DS316
Figure 12 shows the interface between the CP3BT26 and
the LMX5252 radio chip.
+2.8V
IOVCCVCC
RFDATA
PG1/RFCE
CP3BT26LMX5252
PG2/BTSEQ1
PG3/SCLK
PG4/SDAT
PG5/SLEBDEN#
X1CKI/BBCLK
BBDATA_1
BXTLEN
BPKTCTL
BDCLK
BDDATA
BRCLK
DS320
Figure 12. LMX5252 Interface
The CP3BT26 implements a BlueRF-compatible interface,
which may be used with other RF transceiver chips.
15.1.1RF Interface Signals
The RF interface signals are grouped as follows:
Modem Signals (BBCLK, RFDATA, and RFSYNC)
Control Signal (RFCE)
Serial Interface Signals (SCLK, SDAT, and SLE
)
Bluetooth Sequencer Status Signals (BTSEQ1,
BTSEQ2, and BTSEQ2)
X1CKI/BBCLK
The X1CKI/BBCLK pin is the input signal for the 12-MHz
clock signal. The radio chip uses this signal internally as the
12× oversampling clock and provides it externally to the
CP3BT26 for use as the Main Clock.
RFDATA
The RFDATA signal is the multiplexed Bluetooth data receive and transmit signal. The data is provided at a bit rate
of 1 Mbit/s with 12× oversampling, synchronized to the 12
MHz BBCLK. The RFDATA signal is a dedicated RF interface pin. This signal is driven to a logic high level after reset.
RFSYNC
In receive mode (data direction from the radio chip to the
CP3BT26), the RFSYNC signal acts as the frequency correction/DC compensation circuit control output to the radio
chip. The RFSYNC signal is driven low throughout the correlation phase and driven high when synchronization to the
received access code is achieved.
In transmit mode (data direction from the CP3BT26 to the
radio chip), the RFSYNC signal enables the RF output of
the radio chip. When the RFSYNC pin is driven high, the RF
www.national.com72
Page 73
transmitter circuit of the radio chip is enabled, corresponding to the settings of the power control register in the radio
chip.
The RFSYNC signal is the alternate function of the generalpurpose I/O pin PG0. At reset, this pin is in TRI-STATE
mode. Software must enable the alternate function of the
PG0 pin to give control over this signal to the RF interface.
RFCE
The RFCE signal is the chip enable output to the external
RF chip. When the RFCE signal is driven high, the RF chip
power is controlled by the settings of its power control registers. When the RFCE signal is driven low, the RF chip is
powered-down. However, the serial interface is still operational and the CP3BT26 can still access the RF chip internal
control registers.
The RFCE signal is the alternate function of the generalpurpose I/O pin PG1. At reset, this pin is in TRI-STATE
mode. Software must enable the alternate function of the
PG1 pin to give control over this signal to the RF interface.
During Bluetooth power-down phases, the CP3BT26 provides a mechanism to reduce the power consumption of an
external RF chip by driving the RFCE signal of the RF interface to a logic low level. This feature is available when the
Power Management Module of the CP3BT26 has enabled
the Hardware Clock Control mechanism. (However, the current version of the radio chip does not implement a powerreduction mode.)
SCLK
The SCLK signal is the serial interface shift clock output.
The CP3BT26 always acts as the master of the serial interface and therefore always provides the shift clock. The
SCLK signal is the alternate function of the general-purpose
I/O pin PG3. At reset, this pin is in TRI-STATE mode. Software must enable the alternate function of the PG3 pin to
give control over this signal to the RF interface.
SDAT
The SDAT signal is the multiplexed serial data receive and
transmit path between the radio chip and the CP3BT26.
The SDAT signal is the alternate function of the general-purpose I/O pin PG4. At reset, this pin is in TRI-STATE mode.
Software must enable the alternate function of the PG4 pin
to give control over this signal to the RF interface.
BTSEQ[3:1]
The BTSEQ[3:1] signals indicate internal states of the Bluetooth sequencer, which are used for interfacing to some external devices.
15.2SERIAL INTERFACE
The radio chip register set can be accessed by the
CP3BT26 through the serial interface. The serial interface
uses three pins of the RF interface: SDAT, SCLK, and SLE
The serial interface of the CP3BT26 always operates as the
master, providing the shift clock (SCLK) and load enable
) signal to the radio chip. The radio chip always acts as
(SLE
the slave.
A 25-bit shift protocol is used to perform read/write accesses to the radio chip internal registers. The complete protocol
is comprised of the following sections:
3-bit Header Field
Read/Write Bit
5-bit Address Field
16-bit Data Field
Header
The 3-bit header contains the fixed data 101b (except for
Fast Write Operations).
Read/Write Bit
The header is followed by the read/write control bit (R/W). If
the Read/Write bit is clear, a write operation is performed
and the 16-bit data portion is copied into the addressed radio chip register.
Address
The address field is used to select one of the radio chip internal registers.
Data
The data field is used to transfer data to or from a radio chip
register. The timing is modified for reads, to transfer control
over the data signal from the CP3BT26 to the radio chip.
Figure 13 shows the serial interface protocol format.
150
Data[15:0]
CP3BT26
.
SLE
The SLE pin is the serial load enable output of the serial interface of the CP3BT26.
During write operations (to the radio chip registers), the data
received by the shift register of the radio chip is copied into
the address register on the next rising edge of SCLK after
the SLE
During read operations (read from the registers), the radio
chip releases the SDAT line on the next rising edge of SCLK
after the SLE
SLE
PG5. At reset, this pin is in TRI-STATE mode. Software must
enable the alternate function of the PG5 pin to give control
over this signal to the RF interface.
signal goes high.
signal goes high.
is the alternate function of the general-purpose I/O pin
2422212016
Header[2:0]R/WAddress[4:0]
Figure 13. Serial Interface Protocol Format
Data is transferred on the serial interface with the most significant bit (MSB) first.
73www.national.com
Page 74
Write Operation
When the R/W bit is clear, the 16 bits of the data field are
shifted out of the CP3BT26 on the falling edge of SCLK.
Data is sampled by the radio chip on the rising edge of
CP3BT26
SCLK. When SLE
is high, the 16-bit data are copied into the
radio chip register on the next rising edge of SCLK. The
data is loaded in the appropriate radio chip register depending on the state of the four address bits, Address[4:0].
Figure 14 shows the timing for the write operation.
SDAT
used to address the write-only registers of the radio chip.
Fast writes load the same physical register as the corresponding normal write operation.
For the power control and CMOS output registers of the RF
chip, it is only necessary to transmit a total of 8 bits (3 address bits and 5 data bits), because the remaining eight bits
are unused.
While the FW bit is set, normal Read/Write operations are
still valid and may be used to access non-time-critical control registers. Figure 16 shows the timing for a 16-bit Fast-
D0D14A0A1A2A3A4WH0H1H2D15
Write transaction, and Figure 17 shows the timing for an 8bit Fast-Write transaction.
SCLK
SLE
DS012
Figure 14. Serial Interface Write Timing
Read Operation
When the R/W bit is set, data is shifted out of the radio chip
on the rising edge of SCLK. Data is sampled by the
CP3BT26 on the falling edge of SCLK. On reception of the
read command (R/W = 1), the radio chip takes control of the
serial interface data line. The received 16-bit data is loaded
by the CP3BT26 after the first falling edge of SCLK when
is high. When SLE is high, the radio chip releases the
SLE
SDAT line again on the next rising edge of SCLK. The
CP3BT26 takes control of the SDAT line again after the following rising edge of SCLK. Which radio chip register is
read, depends on the state of the four address bits, Address[4:0]. The transfer is always 16 bits, without regard to
the actual size of the register. Unimplemented bits contain
undefined data. Figure 15 shows the timing for the read operation.
SDAT Floating
Master drives SDAT
SDAT
SCLK
SLE
Slave drives SDAT
D0D1A0A1A2A3A4RH0H1H2D15
DS013
Figure 15. Serial Interface Read Timing
Fast-Write Operation
An enhanced serial interface mode including fast write capability is enabled when the FW bit in the radio chip is set.
This bit activates a mode with decreased addressing and
control overhead, which allows fast loading of time-critical
registers during normal operation. When the FW bit is set,
the 3-bit header may have a value other than 101b, and it is
SDAT
SCLK
SLE
D8 D7 D6D1 D0D9D10D11D12A0A1A2
DS014
Figure 16. Serial Interface 16-bit Fast-Write Timing
SDAT
SCLK
SLE
D8D9D10D11D12A0A1A2
DS015
Figure 17. Serial Interface 8-bit Fast-Write Timing
32-Bit Write Operation
On the LMX5252, a 32-bit register is loaded by writing to the
same register address twice. The first write loads the high
word (bits 31:16), and the second write loads the low word
(bits 15:0). The two writes must be separated by at least two
clock cycles. For a 4-MHz clock, the minimum separation
time is 500 ns.
The value read from a 32-bit register is a counter value, not
the contents of the register. The counter value indicates
which words have been written. If the high word has been
written, the counter reads as 0000h. If both words have
been written, the counter reads as 0001h. The value returned by reading a 32-bit register is independent of the
contents of the register.
Figure 18 and Figure 19 show the timing for 32-bit register
writing and reading.
The order for accessing the registers is from high to low: 17,
15, 14, 12, 11, 10, 9, 8, 7, 6, 5, 4, 2, and 1. These registers
must be written during the initialization of the LMX5252.
An example of a 32-bit write is shown in Table 31. In this example, the 32-bit value FFFF DC04h is written to register
address 0Ah. In cycle 1, the high word (FFFFh) is written. In
the first part of cycle 2, the CP3BT26 drives the header, R/
W bit, and register address for a read cycle. In the second
part of cycle 2, the LMX5252 drives the counter value. The
Table 31 Example of 32-Bit Write with Interleaved Reads
DS322
DS323
counter value is 0, which indicates one word has been written. In cycle 3, the low word (DC04h) is written. In the first
part of cycle 4, the CP3BT26 drives the header, R/W bit,
and register address for a read cycle. In the second part of
cycle 4, the LMX5252 drives the counter value. The counter
value is 1, which indicates two words have been written.
CycleSerial Data on SDATDescription
101 0 01010 1111111111111111
1
101 1 01010
2
0000000000000000
101 0 01010 1101110000000100
3
101 1 01010
4
0000000000000001
Write cycle driven by CP3BT26. Data is FFFFh. Address is 0Ah.
First part of read cycle driven by CP3BT26. Address is 0Ah.
Second part of read cycle driven by LMX5252. Counter value is 0.
Write cycle driven by CP3BT26. Data is DC04h. Address is 0Ah.
First part of read cycle driven by CP3BT26. Address is 0Ah.
Second part of read cycle driven by LMX5252. Counter value is 1.
75www.national.com
Page 76
15.3LMX5251 POWER-UP SEQUENCE
To power-up a Bluetooth system based on the CP3BT26
and LMX5251 devices, the following sequence must be performed:
CP3BT26
1. Apply VDD to the LMX5251.
2. Apply IOVCC and VCC to the CP3BT26.
3. Drive the RESET# pin of the LMX5251 high a minimum
of 2 ms after the LMX5251 and CP3000 supply rails are
powered up. This resets the LMX5251 and CP3BT26.
4. After internal Power-On Reset (POR) of the CP3BT26,
the RFDATA pin is driven high. The RFCE, RFSYNC,
and SDAT pins are in TRI-STATE mode. Internal pullup/pull-down resistors on the CCB_CLOCK (SCLK),
CCB_DATA (SDAT), CCB_LATCH (SLE
TX_RX_SYNC (RFSYNC) inputs of the LMX5251 pull
these signals to states required during the power-up
sequence.
5. When the RFDATA pin is driven high, the LMX5251 enables its oscillator. After an oscillator start-up delay, the
LMX5251 drives a stable 12-MHz BBP_CLOCK
(BBCLK) to the CP3BT26.
6. The Bluetooth baseband processor on the CP3BT26
now directly controls the RF interface pins and drives
the logic levels required during the power-up phase.
When the RFCE pin is driven high, the LMX5251
switches from “power-up” to “normal” mode and disables the internal pull-up/pull-down resistors on its RF
interface inputs.
7. In “normal” mode, the oscillator of the LMX5251 is controlled by the RFCE signal. Driving RFCE high enables
the oscillator, and the LMX5251 drives its BBP_CLOCK
(BBCLK) output.
), and
15.4LMX5252 POWER-UP SEQUENCE
A Bluetooth system based on the CP3BT26 and LMX5252
devices has the following states:
Off—When the LMX5252 enters Off mode, all configura-
tion data is lost. In this state, the LMX5252 drives BPOR
low.
Power-Up—When the power supply is on and the
LMX5252 RESET# input is high, the LMX5252 starts up
its crystal oscillator and enters Power-Up mode. After the
crystal oscillator is settled, the LMX5252 sends four
clock cycles on BRCLK (BBCLK) before driving BPOR
high.
RF Init—The baseband controller on the CP3BT26 now
drives RFCE high and takes control of the crystal oscillator. The baseband performs all the needed initialization
(such as writing the registers in the LMX5252 and crystal
oscillator trim).
Idle—The baseband controller on the CP3BT26 drives
RFDATA low when the initialization is ready. The
LMX5252 is now ready to start transmitting, receiving, or
enter Sleep mode.
Sleep—The LMX5252 can be forced into Sleep mode at
any time by driving RFCE low. All configuration settings
are kept, only the Bluetooth low power clock is running
(B3k2).
Wait XTL—When RFCE goes high, the crystal oscillator
becomes operational. When it is stable, the LMX5252
enters Idle mode and drives BRCLK (BBCLK).
Any State
RESET# = Low or
Power is cycled
VDD
LMX5251
VCC
CP3000
IOVCC
RESET#
RESET
RFCE
BBCLK
RFDATA
RFSYNC
SDAT
SCLK
SLE
CP3000
LMX5251
CP3000
t
PTOR
Low
Low
High
Low
Low
Low
LMX5251
Oscillator
Start-Up
Power-Up Mode
CP3000
Initialization
LMX5251
Initialization
LMX5251 in Normal ModeLMX5251 in
Figure 20. LMX5251 Power-Up Sequence
High
Standby
Active
DS016
Wait for
Crystal Osc.
To Stabilize
RFCE = High
RFDATA = Don't Care
Write Registers
Off
RESET# = High and
Power is On
Power-Up
Crystal Osc. Stable
RF Init
Wait for
Crystal Osc.
To Stabilize
Idle
Any State
After RF Init
RFCE = Low
Sleep
RFCE = High
Wait XTL
Crystal Osc. Stable
DS324
Figure 21. LMX5252 Power States
The power-up sequence for a Bluetooth system based on
the CP3BT26 and LMX5252 devices is shown in Figure 22.
www.national.com76
Page 77
RESET
RFDATA
RFCE
BBCLK
BPOR
B3k2
SLE
SCLK
SDAT
t1
t2
t5
t3
t4
DS321
Figure 22. LMX5252 Power-Up Sequence
15.5BLUETOOTH SLEEP MODE
The Bluetooth controller is capable of putting itself into a
sleep mode for a specified number of Slow Clock cycles. In
this mode, the controller clocks are stopped internally. The
only circuitry which remains active are two counters
(counter N and counter M) running at the Slow Clock rate.
These counters determine the duration of the sleep mode.
The sequence of events when entering the LLC sleep mode
is as follows:
1. The current Bluetooth counter contents are read by the
CPU.
2. Software “estimates” the Bluetooth counter value after
leaving the sleep mode.
3. The new Bluetooth counter value is written into the
Bluetooth counter register.
4. The Bluetooth sequencer RAM is updated with the
code required by the Bluetooth sequencer to enter/exit
Sleep mode.
5. The Bluetooth sequencer RAM and the Bluetooth LLC
registers are switched from the System Clock domain
to the local 12 MHz Bluetooth clock domain. At this
point, the Bluetooth sequencer RAM and Bluetooth
LLC registers cannot be updated by the CPU, because
the CPU no longer has access to the Bluetooth LLC.
6. Hardware Clock Control (HCC) is enabled, and the
CP3BT26 enters a power-saving mode (Power Save or
Idle mode). While in Power Save mode, the Slow Clock
is used as the System Clock. While in Idle mode, the
System Clock is turned off.
7. The Bluetooth sequencer checks if HCC is enabled. If
HCC is enabled, the sequencer asserts HCC to the
PMM. On the next rising edge of the low-frequency
clock, the 1MHz clock and the 12 MHz clock are
stopped locally within the Bluetooth LLC. At this point,
the Bluetooth sequencer is stopped.
8. The M-counter starts counting. After M + 1 Slow Clock
cycles, the HCC signal to the PMM is deasserted.
9. The PMM restarts the 12 MHz Main Clock (and the
PLL, if required). The N-counter starts counting. After
N + 1 Slow Clock cycles, the Bluetooth clocks (1 MHz
and 12 MHz) are turned on again. The Bluetooth sequencer starts operating.
10. The Bluetooth sequencer waits for the completion of
the sleep mode. When completed, the Bluetooth sequencer asserts a wake-up signal to the MIWU (see
Section 13.0).
11. The PMM switches the System Clock to the high-frequency clock and the CP3BT26 enters Active mode
again. HCC is disabled. The Bluetooth sequencer RAM
and Bluetooth LLC registers are switched back from the
local 12 MHz Bluetooth clock to the System Clock. At
this point, the Bluetooth sequencer RAM and Bluetooth
LLC registers are once again accessible by the CPU. If
enabled, an interrupt is issued to the CPU.
CPU
System Clock
HCC
BT LCC Clock
HCC
12 MHz
Main Clock
1 MHz/12 MHz
BT Clock
Sequencer
Active
Power Save
Active
Stopped/Slow
Enabled
Disabled
System Clock
Main Clock
Asserted
Deasserted
Active
Stopped
Active
Stopped
Active
Stopped
Prepare for
Sleep Mode
CPU
Start-up
N
M
CPU Handles
Wake-Up IRQ
from MIWU
DS017
Figure 23. Bluetooth Sleep Mode Sequence
15.6BLUETOOTH GLOBAL REGISTERS
Table 32 shows the memory map of the Bluetooth LLC global registers.
Table 32 Memory Map of Bluetooth Global Registers
Address
(offset from 0E F180h)
–0048hGlobal LLC Configuration
0000h
Description
0049h–007FhUnused
15.7BLUETOOTH SEQUENCER RAM
The sequencer RAM is a 1K memory-mapped section of
RAM that contains the sequencer program. This RAM can
be read and written by the CPU in the same way as the Static RAM space and can also be read by the sequencer in the
Bluetooth LLC. Arbitration between these devices is performed in hardware.
CP3BT26
77www.national.com
Page 78
15.8BLUETOOTH SHARED DATA RAM
The shared data RAM is a 4.5K memory-mapped section of
RAM that contains the link control data, RF programming
look-up table, and the link payload. This RAM can be read
CP3BT26
and written in the same way as the Static RAM space and
can also be read by the sequencer in the Bluetooth LLC. Arbitration between these devices is performed in hardware.
Table 33 shows the memory map of the Bluetooth LLC
shared Data RAM.
Table 33 Memory Map of Bluetooth Shared RAM
Address
(offset from 0E 8000h)
h–01D9h
0000
–01FFhUnused
01DAh
0200h–023FhLink Control 0
0240h–027FhLink Control 1
0280h–02BFhLink Control 2
02C0h–02FFhLink Control 3
0300h–033FhLink Control 4
0340h–037FhLink Control 5
0380h–03BFhLink Control 6
03C0h–03FFhLink Control 7
0400h–11FFhLink Payload 0–6
Description
RF Programming
Look-up Table
www.national.com78
Page 79
16.012-Bit Analog to Digital Converter
The integrated 12-bit ADC provides the following features:
8-input analog multiplexer
8 single-ended channels or 4 differential channels
External filtering capability
12-bit resolution with 11-bit accuracy
Sign bit
CP3BT26
15-microsecond conversion time
Support for resistive touchscreen interface
Internal or external start trigger
Programmable start delay after start trigger
Poll or interrupt on done
ADC0/TSX+
ADC1/TSY-
ADC2/TSX-
ADC3/TSY+
ADC4
ADC7
ASYNC
Pen-Down Detector
DRV
DRV
DRV
DRV
TOUCH_CFG
TRIGGER
MUXOUT0
ADC_DIV
Input
Multi-
plexer
MUX_CFG
DELAY1
MUXOUT1 ADCIN
+
-
CLKDIV
ADC2ADC0AVCCADC1VREFPADC3AGND
PREF_CFGNREF_CFG
Int/Ext
Multiplexer
ADCIN
ADC Clock
Start
+
-
Clock
DELAY2
12-BIT ADC
Control
ADC
SEQUENCER
VREFNVREFP
Result
4-Word
FIFO
12
Pen Down
Done
Wake-Up
(WUI30)
Interrupt
(IRQ13)
ADC_CONTROL
ADC_DELAY1
System
Clock
Auxiliary
Clock 2
CLKSEL
Figure 24. Analog to Digital Converter Block Diagram
16.1FUNCTIONAL DESCRIPTION
The ADC module consists of a 12-bit ADC converter and associated state machine, together with analog multiplexers to
set up signal paths for sampling and voltage references, logic to control triggering of the converter, and a bus interface.
16.1.1Data Path
Up to 8 GPIO pins may be configured as 8 singled-ended
analog inputs or 4 differential pairs. Analog/digital data
passes through four main blocks in the ADC module between the input pins and the CPU bus:
Input Multiplexer—an analog multiplexer that selects
among the input channels.
Internal/External Multiplexer—an analog multiplexer
that selects between the output of the Input Multiplexer
and the ADCIN external analog input.
ADC_DELAY2
ADCRESLT
System
Bus
Interface
DS183
12-Bit ADC—receives the output of the Internal/External
Multiplexer and performs the analog to digital conversion.
ADCRESLT Register—makes conversion results from
the 12-Bit ADC available to the on-chip bus. The ADCRESLT register includes the software-visible end of a 4word FIFO used to queue conversion results.
The configuration of the analog signal paths is controlled by
fields in the ADCGCR register. The Input Multiplexer is controlled by the MUX_CFG field. The Internal/External Multiplexer is controlled by the ADCIN bit. The analog
multiplexers for selecting the voltage references used by the
ADC are controlled by the PREF_CFG and NREF_CFG
fields. The low-ohmic drivers used for interface to resistive
touchscreens are controlled by the TOUCH_CFG field.
79www.national.com
Page 80
The output of the Input Multiplexer is available externally as
the MUXOUT0 and MUXOUT1 signals. In single-ended
mode, only MUXOUT0 is used. In differential mode,
MUXOUT0 is the positive side and MUXOUT1 is the nega-
CP3BT26
tive side. The MUXOUT0 and MUXOUT1 outputs and the
ADCIN external analog input are provided so that external
signal conditioning circuits (such as filters) may be applied
to the analog signals before conversion. The MUXOUT0,
MUXOUT1, and ADCIN signals are alternate functions of
GPIO pins used by the Input Multiplexer, so the number of
available analog input channels is reduced when these signals are used.
16.1.2Operation
The TRIGGER block may be configured to initiate a conversion from either of these sources:
External ASYNC Input—an edge on the ASYNC input
triggers a conversion. This input may be configured to be
sensitive to rising or falling edges, as controlled by the
POL bit in the ADCCNTRL register.
ADCSTART Register—writing any value to the ADC-
START register triggers a conversion.
The TRIGGER block incorporates a glitch filter to suppress
transient spikes on the ASYNC input. The TRIGGER block
will recognize ASYNC pulse widths of 10 ns or greater.
Once a trigger event has been recognized, no further triggering is recognized until the conversion is completed.
When the ASYNC input is selected as the trigger source, it
may be configured for automatic or non-automatic mode, as
controlled by the AUTO bit in the ADCCNTRL register:
Automatic Mode—a conversion is triggered by any
qualified edge on the ASYNC input (unless a conversion
is already in progress).
Non-Automatic Mode—before a conversion may be
triggered from the ASYNC input, software must “prime”
the TRIGGER block by writing the ADCSTART register.
Once the TRIGGER block is primed, a conversion is triggered by any qualified edge on the ASYNC input. After
the conversion is completed, no additional trigger events
will be recognized until software once again primes the
TRIGGER block by writing the ADCSTART register.
Once a trigger event is recognized, the DELAY1 block waits
for a programmable delay specified in the ADC_DELAY1
field of the ADCSCDLY register. Then, it asserts the Start
signal to the ADC SEQUENCER block.
When the Start signal is received, the ADC SEQUENCER
block initiates the conversion in the 12-Bit ADC. After the
conversion is complete, the result is loaded into the FIFO,
and the Done signal is asserted.
The ADCRESLT register includes the software-visible end
of a 4-word FIFO, which allows up to 4 conversion results to
be queued for reading. Reading the ADCRESLT register unloads the FIFO. If the FIFO overflows, a bit is set in the ADCRESLT register, and the most recent conversion data is
lost.
The Done signal is visible to software as the ADC_DONE bit
in the ADCRESLT register. The Done signal is also an input
to the interrupt controller (IRQ13). The interrupt will be asserted whenever the FIFO is not empty (but will deassert for
one system clock after the ADCRESLT register is read). Total conversion time is around 15 microseconds.
The Done signal is also an input to the Multi-Input Wake-Up
unit (WUI30). The MIWU input is asserted whenever the
FIFO is not empty (but will deassert for one system clock after the ADCRESLT register is read). The wake-up output is
provided so that the ADC module can bring the system out
of a power-saving mode when a conversion operation is
completed. It asserts earlier than the interrupt output. In the
pen-down detection mode of the ADC, the wake-up output
is ORed with the ADC pen-down detector output, to wake up
on a pen-down event.
16.1.3ADC Clock Generation
The DELAY2 block generates ADC Clock, which is the clock
used internally by the ADC module. ADC Clock is derived
from either:
System Clock—a programmable divider is available to
generate the 12 MHz clock required by the ADC from the
System Clock.
Auxiliary Clock 2—may be used to perform conversions
when the System Clock is slowed down or suspended in
low-power modes.
The DELAY2 block receives the clock source selected by
the CLKSEL bit of the ADCACR register and adds a number
of asynchronous incremental delay units specified in the
ADC_DELAY2 field of the ADCSCDLY register. This delayed clock (ADC Clock) then drives the TRIGGER, 12-BIT
ADC, and ADC SEQUENCER blocks. ADC Clock also
drives the ADC_DIV clock divider, which generates the
clock which drives the DELAY1 block.
Because the ADCRESLT FIFO is driven by System Clock
(not ADC Clock), a conversion result will not propagate to
the output of the FIFO when the System Clock is suspended.
16.1.4ADC Voltage References
The 12-BIT ADC block has positive and negative voltage
reference inputs, VREFP and VREFN. In single-ended
mode, only VREFP is used. An analog multiplexer allows
selecting an external VREFP pin, the analog supply voltage
AVCC, or the analog inputs ADC0 or ADC1 as the positive
voltage reference, as controlled by the PREF_CFG field of
the ADCGCR register. Another analog multiplexer allows
selecting the analog ground AGND or the analog inputs
ADC2 or ADC3 as the negative voltage reference, as controlled by the NREF_CFG field of the ADCGCR register.
16.1.5Pen-Down Detector
A pen-down detector is provided on the ADC0 (TSX+) input
of the ADC. It consists of a Schmitt-trigger receiver, with a
minimum Vil of 0.7V. When pen-down detect mode is enabled by loading 101b into the TOUCH_CFG field of the ADCGCR register, the output of this detector is visible to
software in the PEN_DOWN bit of the ADCRESLT register,
and this output is ORed with the Done signal to become the
wake-up input (WUI30) to the Multi-Input Wake-Up unit.
www.national.com80
Page 81
16.2TOUCHSCREEN INTERFACE
The ADC provides an interface for 4-wire resistive touchscreens with the resolution necessary for applications such
as signature analysis. A typical touchscreen configuration is
shown in Figure 25.
TSX+/ADC0
CP3BT26
16.2.1Touchscreen Driver Configuration
An equivalent circuit for the touchscreen interface is shown
in Figure 26.
VCC
TSY+/ADC1
TSX-/ADC2
TSY-/ADC3
MUXOUT0
ADCIN
DS186
Figure 25. Touchscreen Interface
A touchscreen consists of two resistive plates normally separated from each other. The TSX+ and TSX- signals are
connected to opposite ends of the X plate, while the TSY+
and TSY- signals are connected to the Y plate. If the pen is
down, the plates will be shorted together at the point of pen
contact. The location of the pen is sensed by driving one
end of a plate to VCC, driving the opposite end to ground,
and sensing the voltage at the point of pen contact using the
other plate. This is done twice, once for each coordinate.
An external RC low-pass filter is used to remove noise coupled to the touchscreen signals from the display drivers.
Ω6Ω
6
TSY
+
TSX+
To ADC
TSX-
TSY
6Ω6Ω
X Plate
RX1
A
RX2
-
Y Plate
RY1
RZ
B
RY2
DS187
Figure 26. Touchscreen Driver Equivalent Circuit
Low-ohmic drivers are provided to pull the TSX+ and TSY+
signals to VCC and the TSX- and TSY- signals to GND. The
on-resistance of these drivers is specified to be 6 ohms.
Two measurements are used to produce one (x,y) position
coordinate pair. To measure the x-coordinate, the TSX+ signal is pulled to VCC, the TSX- signal is pulled to GND, and
the TSY+ and TSY- signals are undriven. A voltage divider
is formed across the X plate, with the center tap of the divider being the point of pen contact, represented in Figure 26
by node A. With TSY+ and TSY- undriven, the voltage at
node A can be measured by sampling either of the TSY+ or
TSY- signals. This voltage will be proportional to the position
of the pen contact on the X plate.
The position of the pen contact on the Y plate is measured
similarly, by driving the TSY+ signal to VCC, the TSY- signal
to GND, and leaving the TSX+ and TSX- signals undriven.
The voltage at node B can be sampled from either the TSX+
or TSX- signals. The TOUCH_CFG field of the ADCGCR
register specifies the configuration of the drivers, with 010b
used to sample node A and 001b used to sample node B.
Typically, two consecutive measurements are made of each
coordinate so that any interference coupled from the LCD
column drivers is averaged out.
The plate-to-plate resistance is shown in Figure 26 as RZ.
This measurement is used as an indication of the force of
pen contact. When 100b is loaded into the TOUCH_CFG
field, the TSY+ signal is pulled to VCC and the TSX- signal
is pulled to GND, to support measuring RZ.
81www.national.com
Page 82
16.2.2Measuring Pen Force
Figure 27 shows equivalent circuits for the driver modes
used to measure the X, Y, and Z coordinates, in which Z represents pen force. In this discussion, the ohmic resistance
CP3BT26
of the drivers is neglected (see Section 16.2.3), and series
resistance between the node of interest and the ADC is ignored because it has no significant effect.
VCC
VCC
VCC
RY1
Solving for RY1, the resistance is:
RY1RYP1
×=
2047
B
-------------
–
Now that the resistance values RX2 and RY1 are known, it
is possible to calculate the value of the plate-to-plate contact resistance, RZ, given the value measured at node C on
the TSX+ input in Sample Z mode. Node C is a tap in a resistor-divider network composed of three resistors, such
that:
In the following examples, the ADC is assumed to operate
in single-ended mode to produce conversion values between 0 and 2047, however the same principles could be
extended to differential mode to recover the full range of the
ADC.
In Sample X mode, the X plate is driven between VCC and
ground, so that a value measured at node A on the TSY+ or
TSY- inputs is the center tap of a resistor-divider network.
The end-to-end resistance RXP of the X plate is:
RXPRX1 RX2+=
The value measured at node A is proportional to the ratio
between the resistance to ground and the resistance of the
X plate:
A
------------2047
RX2
-------------=
RXP
Solving for RX2, the resistance is:
A
-------------
RX2RXP
×=
2047
Similarly, in Sample Y mode the value measured at node B
on the TSX+ or TSX- inputs is proportional to the ratio between the resistance to ground and the resistance RYP of
the Y plate:
B
------------2047
RY2
-------------=
RYP
Because end-to-end resistance RYP of the Y plate is:
RYPRY1 RY2+=
The previous equation can be rewritten as:
B
------------2047
RYP RY1–
-------------------------------=
RYP
Solving for RZ, the resistance is:
2047 C–
RZRX2
-----------------------
×
C
RY1–=
The resistance RZ is proportional to the force of pen contact.
16.2.3Compensation for Driver Resistance
Plate resistances between opposite electrodes range from
100 ohms to 1k ohm. Because of the 6-ohm driver resistance, some significant voltage drop will be experienced between, for example, TSX- and AGND. A 200-ohm plate will
drop:
6
-----------------------------
200 6 6++
AVCC AGND–()×
With a 2.5V supply, this is 70 mV. A 12-bit ADC has 4096
possible values, so each value covers a range of 610 µV at
2.5V. A voltage drop of 70 mV across each of the low-ohmic
drivers reduces the number of available ADC values by:
70 mV 2×
--------------------------
610 uV
230=
This effective loss of resolution can be handled in a number
of ways.
1. The voltages on, for example, TSY+ and TSY- can be
sampled before sampling TSX+ and TSX-. Then, scaling can be applied in software to convert the samples
to the full (4096-bit) range. This technique will not recover any resolution, however it is worthy of some consideration because touchscreen data is typically
passed to two applications:
Signature Analysis—only the raw data is required. No
absolute positioning is necessary.
Screen Overlay—for example, for cursor positioning.
In this application, a scaling or calibration is performed
to correctly overlay the touchscreen coordinates onto
the display. Because of this calibration, it is not even
necessary to sample TSY+ and TSY-.
2. The ADC has a positive voltage reference input which
can be internally connected to the TSY+ terminal. This
means that the number of available ADC values is increased to:
70 mV
4096
--------------------
–3981=
610 uV
Software scaling could be applied to this value if required (as with technique 1, above), but no additional
resolution is achieved.
www.national.com82
Page 83
3. By extension, the ADC negative voltage reference can
be internally connected to the TSY- terminal, to recover
the full 4096 values.
The Global Configuration Register (ADCGCR) provides the
flexibility to implement any of these techniques.
16.3ADC OPERATION IN POWER-SAVING
MODES
To reduce the level of switching noise in the environment of
the ADC, it is possible to operate the CP3BT26 in low-power
modes, in which the System Clock is slowed or switched off.
Under these conditions, Auxiliary Clock 2 can be selected
as the clock source for the ADC module, however conversion results cannot be read by the system while the System
Clock is suspended. The expected operation in power-saving modes is therefore:
1. ADC is configured and a conversion is primed or triggered.
2. A power-saving mode is entered.
3. ADC conversion completes and a wake-up signal is asserted to the MIWU unit.
4. Device wakes up and processes the conversion result.
To conserve power, the ADC should be disabled before entering a low-power mode if its function is not required.
16.5ADC REGISTER SET
Table 34 lists the ADC registers.
Table 34 ADC Registers
NameAddressDescription
ADCGCRFF F3C0h
ADCACRFF F3C2h
ADCCNTRLFF F3C4h
ADCSTARTFF F3C6h
ADCSCDLYFF F3C8h
ADCRESLTFF F3CAhADC Result Register
ADC Global
Configuration Register
ADC Auxiliary
Configuration Register
ADC Conversion
Control Register
ADC Start Conversion
Register
ADC Start Conversion
Delay Register
CP3BT26
16.4FREEZE
The ADC module provides support for an In-System Emulator by means of a special FREEZE input. When FREEZE is
asserted the module will exhibit the following specific behavior:
The automatic clear-on-read function of the result regis-
ter (ADCRESLT) is disabled.
The FIFO is updated as usual, and an interrupt for a
completed conversion can be asserted.
83www.national.com
Page 84
16.5.1ADC Global Configuration Register (ADCGCR)
The ADCGCR register controls the basic operation of the interface. The CPU bus master has read/write access to the
ADCGCR register. After reset this register is set to 0000h.
CP3BT26
MUX_CFG The Multiplexer Configuration field and the
DIFF bit configure the analog circuits of the
ADC module, as shown in Table 35.
Table 35 MUX_CFG Operation
8765432 10
TOUCH_CFGMUX_CFGDIFF ADCIN CLKEN
1514131211 10 9
MUXOUTEN INTEN Res.NREF_CFG PREF_CFG
CLKENThe Clock Enable bit controls whether the
ADC module is running. When this bit is clear,
all ADC clocks are disabled, the ADC analog
circuits are in a low-power state, and ADC
registers (other than the ADCGCR and AGCACR registers) are not writeable. Clearing
this bit reinitializes the ADC state machine
and cancels any pending trigger event. When
this bit is set, the ADC clocks are enabled and
the ADC analog circuits are powered up. The
converter is operational within 0.25 µs of being enabled.
0 – ADC disabled.
1 – ADC enabled.
ADCINThe ADCIN bit selects the source of the ADC
input. When the bit is clear, the source is the
8-channel Input Multiplexer. When the bit is
set, the source is the ADCIN pin.
0 – ADC input is from 8-channel multiplexer.
1 – ADC input is from ADCIN pin.
DIFFThe Differential Operation Mode bit and the
MUX_CFG field configure the analog circuits
of the ADC module. When this bit is clear, the
ADC module operates in single-ended mode.
When this bit is set, the ADC operates in differential mode. See Table 35 .
0 – Single-ended mode.
1 – Differential mode.
Table 36 TOUCH_CFG Modes
TOUCH_CFG
Channels
Channel
MUX_CFG
000001
001110
010223
011332
100445
101554
110667
111776
For best noise immunity in touchscreen applications, channel 2 should be used for sampling the X plate voltage, and channel 1
should be used for sampling the Y plate voltage.
The Touchscreen Configuration field controls
the configuration of the low-ohmic drivers for
the TSX+, TSX-, TSY+, and TSY- signals, as
shown in Table 36. When TOUCH_CFG is
101b, the pen-down detector is enabled. The
output of the pen-down detector is visible to
software in the PEN_DOWN bit of the ADSRESLT register, and it is ORed with the
Done signal to generate the wake-up signal
WUI30 passed to the MIWU unit.
Selected,
(DIFF = 0)
Selected
(DIFF = 1)
+-
TOUCH_CFGADC0/TSX+ADC1/TSY+ADC2/TSX-ADC3/TSY-Mode
000InactiveInactiveInactiveInactiveNone
001InactiveDriven HighInactiveDriven LowSample Y
010Driven HighInactiveDriven LowInactiveSample X
011Driven HighInactiveInactiveDriven Low
100InactiveDriven HighDriven LowInactiveSample Z (2)
The ADCACR register is used to control the clock configuration and report the status of the ADC module. The CPU
bus master has read/write access to the ADCACR register.
After reset, this register is clear.
151413123210
CNVT TRGPRMReservedCLKDIV CLKSEL
11ADC1
NREF_CFG The Negative Voltage Reference Configura-
tion field specifies the source of the ADC negative voltage reference, according to the
following table:
NREF_CFGNREF source
00Internal (AGND)
01Reserved
10ADC2
11ADC3
MUXOUTEN
INTENThe Interrupt Enable bit controls whether the
The MUXOUT Enable bit controls whether the
output of the Input Multiplexer is available externally. In single-ended mode, the
MUXOUT0 pin is active and the MUXOUT1
pin is disabled (TRI-STATE). In differential
mode, both MUXOUT0 and MUXOUT1 are
active.
0 – MUXOUT0 and MUXOUT1 disabled.
1 – MUXOUT0 and MUXOUT1 enabled.
ADC interrupt (IRQ13) is enabled. When enabled, the interrupt request is asserted when
valid data is available in the ADCRESLT register. This bit has no effect on the wake_up
signal to the MIWU unit (WUI30).
0 – IRQ13 disabled.
1 – IRQ13 enabled.
CLKSELThe Clock Select bit selects the clock source
used by the DELAY2 block to generate the
ADC clock.
0 – ADC clock derived from System Clock.
1 – ADC clock derived from Auxiliary Clock 2.
CLKDIVThe Clock Divisor field specifies the divisor
applied to System Clock to generate the 12
MHz clock required by the ADC module. Only
the System Clock is affected by this divisor.
The divisor is not used when Auxiliary Clock 2
is selected as the clock source.
CLKDIVClock Divisor
001
012
104
11Reserved
PRMThe ADC Primed bit is a read-only bit that in-
dicates the ADC has been primed to perform
a conversion by writing to the ADCSTART register. The bit is cleared after the conversion is
completed.
0 – ADC has not been primed.
1 – ADC has been primed.
TRGThe ADC Triggered bit is a read-only bit that
indicates the ADC has been triggered. The bit
is set during any pre-conversion delay. The bit
is cleared after the conversion is completed.
0 – ADC has not been triggered.
1 – ADC has been triggered.
CNVTThe ADC Conversion bit is a read-only bit that
indicates the ADC has been primed to perform a conversion, a valid internal or external
trigger event has occurred, any pre-conversion delay has expired, and the ADC conversion is in progress. The bit is cleared after the
conversion is completed.
0 – ADC is not performing a conversion.
1 – ADC conversion is in progress.
85www.national.com
Page 86
16.5.3ADC Conversion Control Register
(ADCCNTRL)
The ADCCNTRL register specifies the trigger conditions for
an ADC conversion.
CP3BT26
153210
ReservedAUTO EXT POL
POLThe ASYNC Polarity bit specifies the polarity
of edges which trigger ADC conversions.
0 – ASYNC input is sensitive to rising edges.
1 – ASYNC input is sensitive to falling edges.
EXTThe External Trigger bit selects whether con-
versions are triggered by writing the ADCSTART register or activity on the ASYNC
input.
0 – ADC conversions triggered by writing to
the ADCSTART register.
1 – ADC conversions triggered by qualified
edges on ASYNC input.
AUTOThe Automatic bit controls whether automatic
mode is enabled, in which any qualified edge
on the ASYNC input is recognized as a trigger
event. When automatic mode is disabled, the
ADC module must be “primed” before a qualified edge on the ASYNC input can trigger a
conversion. To prime the ADC module, software must write the ADCSTART register with
any value before an edge on the ASYNC input
is recognized as a trigger event. After the conversion is completed, the ASYNC input will be
ignored until software again writes the ADCSTART register. The AUTO bit is ignored
when the EXT bit is 0.
0 – Automatic mode disabled.
1 – Automatic mode enabled.
16.5.4ADC Start Conversion Register (ADCSTART)
The ADCSTART register is a write-only register used by
software to initiate an ADC conversion. Writing any value to
this register will cause the ADC to initiate a conversion or
prime the ADC to initiate a conversion, as controlled by the
ADCCNTRL register.
The ADCSCDLY register controls critical timing parameters
for the operation of the ADC module.
151413540
ADC_DIVADC_DELAY1ADC_DELAY2
ADC_DELAY2
ADC_DELAY1
ADC_DIVThe ADC Clock Divisor field specifies the divi-
The ADC Delay 2 field specifies the delay be-
tween the ADC module clock source (either
System Clock after a programmable divider or
Auxiliary Clock 2) and the ADC clock. The
range of effective values for this field is 0 to
20. Values above 20 produce the same delay
as 20, which is about 42 ns.
The ADC Delay 1 field specifies the number of
clock periods by which the trigger event will be
delayed before initiating a conversion. The
timebase for this delay is the ADC clock (12
MHz) divided by the ADC_DIV divisor. The
ADC_DELAY1 field has 9 bits, which corresponds to a maximum delay of 511 clock periods.
sor applied to the ADC clock (12 MHz) to generate the clock used to drive the DELAY1
block. A field value of n results in a division ratio of n+1. With a module clock of 12 MHz, the
maximum delay which can be provided by
ADC_DIV and ADC_DELAY settings is:
1
--------------------
12 MHz
4×511×170 us=
www.national.com86
Page 87
16.5.6ADC Result Register (ADCRESLT)
The ADCRESLT register includes the software-visible end
of a 4-word FIFO. Conversion results are loaded into the
FIFO from the 12-bit ADC and unloaded when software
reads the ADCRESLT register. The ADCRESLT register is
read-only. With the exception of the PEN_DOWN bit, the
fields in this register are cleared when the register is read.
110
ADC_RESULT
15141312
ADC_DONE ADC_OFLW PEN_DOWNSIGN
ADC_RESULT
SIGNThe Sign bit indicates whether the - input has
The ADC Result field holds a 12-bit value for
the conversion result. If the ADC_DONE bit is
clear, there is no valid result in this field, and
the field will have a value of 0. The
ADC_RESULT field and the SIGN bit together
form the software-visible end of the ADC
FIFO.
a voltage greater than the + input (differential
mode only). For example if ADCGCR.MUX_CFG is 000b, ADC0 is the + input and ADC1 is the - input. If the voltage on
ADC0 is greater than the voltage on ADC1,
the SIGN bit will be 0; if the voltage on ADC0
is less than the voltage on ADC1, the SIGN bit
will be 1. In single-ended mode, this bit always
reads as 0.
0 – In differential mode, + input has a voltage
greater than the - input. In single-ended
mode, this bit is always 0.
1 – In differential mode, - input has a voltage
greater than the + input.
PEN_DOWN
ADC_OFLW The ADC FIFO Overflow bit indicates whether
ADC_DONE The ADC Done bit indicates when an ADC
The Pen-Down bit indicates whether a pen-
down condition is being sensed. To enable
pen-down detection, the TOUCH_CFG field of
the ADCGCR register must be loaded with
101b. When pen-down detection is enabled
and a pen-down condition is sensed, the
PEN_DOWN bit is set. This bit is not carried
through the FIFO, so its value represents the
current status of the pen-down detector.
When pen-down detection is enabled, the signal from the pen-down detector is ORed with
the Done signal to generate the wake-up signal (WUI30) passed to the MIWU unit. If pendown detection is not enabled, this bit reads
as 0.
0 – No pen-down condition is sensed, or pen-
down detection is disabled.
1 – Pen-down condition is sensed.
the 4-word FIFO behind the ADCRESLT register has overflowed. When this occurs, the
most recent conversion result is lost. This bit
is cleared when the ADCRESLT register is
read.
0 – FIFO overflow has not occurred.
1 – FIFO overflow has occurred.
conversion has completed. When this bit is
set, the data in the ADC_RESULT field is valid. When this bit is clear, there is no valid data
in the ADC_RESULT field. The Done bit is
cleared when the ADCRESLT register is read,
but if there are queued conversion results in
the FIFO, the Done bit will become set again
after one System Clock period.
0 – No ADC conversion has completed since
the ADCRESLT register was last read.
1 – An ADC conversion has completed since
the ADCRESLT register was last read.
CP3BT26
87www.national.com
Page 88
17.0Random Number Generator (RNG)
The RNG unit is a hardware “true random” number generator. When enabled, this unit provides up to 800 random bits
CP3BT26
per second. The bits are available for reading from a 16-bit
register.
The RNG unit includes two oscillators which operate independently of the System Clock:
Fast Oscillator—a 24 MHz oscillator which drives a lin-
ear feedback shift register (LFSR).
Slow Oscillator—an unstable oscillator which drives a
flip-flop for sampling the pseudorandom bitstream from
the LFSR. This oscillator operates at approximately 115
kHz, but it does not have a fixed frequency.
By sampling the pseudorandom bitstream at random intervals, a random bitstream is synthesized. This bitstream is
clocked into a 16-bit shift register. A programmable clock divider generates the clock signal for the shift register from the
System Clock.
When a new 16-bit word of random data is available, it is
loaded into the RNGD register. If enabled, an interrupt request (IRQ3) is asserted when the word is available for
reading. When software reads the RNGD register, the register is cleared and the interrupt request is deasserted.
The RNGCST register provides control and status bits for
the RNG module:
RNG Enable—enables or disables the RNG oscillators.
Interrupt Mask—enables or disables the interrupt when
a new word of random data becomes available.
Data Valid—indicates whether a new word is available.
17.1FREEZE
The RNG module provides support for an In-System Emulator by means of a special FREEZE input. When FREEZE
is asserted, the automatic clear-on-read function of the
RNDGD register is disabled.
System
Clock
RNGCST
Enable
Fast Osc.
(~24 MHz)
Slow Osc.
(~115 kHz)
(Unstable)
D
31-Bit LFSR
Clock
RNGDIVH/RNGDIVL
Sample Strobe
Divider
Sample
Flip-Flop
Clock
Figure 28. RNG Module Block Diagram
DQQ
16-Bit Shift Register
Clock
RNGD
System
Bus
DS185
www.national.com88
Page 89
17.2RANDOM NUMBER GENERATOR
REGISTER SET
Table 34 lists the RNG registers.
Table 37 RNG Registers
NameAddressDescription
RNGCSTFF F280h
RNGDFF F282hRNG Data Register
RNG Control and
Status Register
CP3BT26
17.2.2RNG Data Register (RNGD)
The RNGD register holds random data generated by the
RNG module. After reading the register, it is cleared and the
DVALID bit of the RNGCST register is cleared. When a new
word of valid (random) data becomes available in the RNGD
register, the DVALID bit is set and (if enabled) and interrupt
request is asserted.
150
RNGD15:0
RNGDIVHFF F284h
RNGDIVLFF F286h
17.2.1RNG Control and Status Register (RNGCST)
The RNGCST register provides control and status bits for
the RNG module. This register is cleared at reset.
156542 1 0
ReservedIMSKReservedDVALID RNGE
RNGEThe Random Number Generator Enable bit
enables the operation of the RNG. When this
bit is clear, the RNG module is disabled, and
both RNG oscillators are suspended.
0 – RNG module disabled.
1 – RNG module enabled.
DVALIDThe Data Valid bit indicates whether valid
(random) data is available in the RNGD register. This bit is cleared when the RNGD register is read.
0 – RNGD register holds invalid data.
1 – RNGD register holds valid data.
IMASKThe Interrupt Mask bit controls whether an in-
terrupt request (IRQ3) will be asserted when
valid (random) data is available in the RNGD
register.
0 – RNG interrupt disabled.
1 – RNG interrupt enabled.
RNG Divisor Register
High
RNG Divisor Register
Low
17.2.3RNG Divisor Register High (RNGDIVH)
This register holds the two most significant bits of the
RNGDIV clock divisor. See the description of the RNGDIVL
register.
15210
ReservedRNGDIV17:16
17.2.4RNG Divisor Register Low (RNGDIVL)
This register holds the 16 least significant bits the RNGDIV
clock divisor.
150
RNGDIV15:0
The RNGDIV clock divisor is used to generate the sampling
strobe for loading random bits into the shift register. The divisor is applied to the System Clock source. The maximum
frequency after division is 800 Hz. For example, a System
Clock frequency of 24 MHz would require an RNGDIV value
of 30,000 (7530h) or greater. The default RNGDIV value is
0000 83D6h.
89www.national.com
Page 90
18.0USB Controller
The CR16 USB node is an integrated USB node controller
that features enhanced DMA support with many automatic
CP3BT26
data handling features. It is compatible with USB specification versions 1.0 and 1.1.
It integrates the required USB transceiver, a Serial Interface
Engine (SIE), and USB endpoint (EP) FIFOs. Seven endpoint pipes are supported: one for the mandatory control
endpoint and six to support interrupt, bulk, and isochronous
endpoints. Each endpoint pipe has a dedicated FIFO, 8
bytes for the control endpoint and 64 bytes for the other endpoints.
18.1FUNCTIONAL STATES
18.1.1Line Condition Detection
At any given time, the CR16 USB node is in one of the following states
Table 38 State Descriptions
StateDescriptions
NodeOperationalNormal operation
NodeSuspendDevice operation suspend due to
USB inactivity
NodeResumeDevice wake-up from suspended
state
NodeReset Device reset
The NodeSuspend, NodeResume, or NodeReset line condition causes a transition from one operating state to another. These conditions are detected by specialized hardware
and reported in the Alternate Event (ALTEV) register. If interrupts are enabled, an interrupt is generated on the occurrence of any of the specified conditions.
In addition to the dedicated input to the ICU for generating
interrupts on these USB state changes, a wake-up signal is
sent to the MIWU (see Section 13.0) when any activity is detected on the USB, if the bus was in the Idle state and the
USB node is in the NodeSuspend state. The MIWU can be
programmed to generate an edge-triggered interrupt when
this occurs.
NodeOperational
This is the normal operating state of the node. In this state,
the node is configured for operation on the USB.
NodeSuspend
A USB node is expected to enter NodeSuspend state when
3 ms have elapsed without any detectable bus activity. The
CR16 USB node looks for this event and signals it by setting
the SD3 bit in the ALTEV register, which causes an interrupt, to be generated (if enabled). Software should respond
by putting the CR16 USB node in the NodeSuspend state.
The CR16 USB node can resume normal operation under
software control in response to a local event in the device. It
can wake up the USB bus via a NodeResume, or when detecting a resume command on the USB bus, which signals
an interrupt to the CPU.
NodeResume
If the host has enabled remote wake-ups from the node, the
CR16 USB node can initiate a remote wake-up.
Once software detects the event, which wakes up the bus,
it releases the CR16 USB node from NodeSuspend state by
initiating a NodeResume on the USB using the NFSR register. The node software must ensure at least 5 ms of Idle
on the USB. While in NodeResume state, a constant “K” is
signalled on the USB. This should last for at least 1 ms and
no more than 5 ms, after which the USB host should continue sending the NodeResume signal for at least an additional 20 ms, and then completes the NodeResume operation
by issuing the End Of Packet (EOP) sequence.
To successfully detect the EOP, software must enter the
USB NodeOperational state by setting the NFSR register.
If no EOP is received from the host within 100 ms, software
must re-initiate NodeResume.
NodeReset
When detecting a NodeResume or NodeReset signal while
in NodeSuspend state, the CR16 USB node can signal this
to the CPU by generating an interrupt.
USB specifications require that a device must be ready to
respond to USB tokens within 10 ms after wake-up or reset.
www.national.com90
Page 91
18.2ENDPOINT OPERATION
18.2.1Address Detection
Packets are broadcast from the host controller to all nodes
on the USB network. Address detection is implemented in
hardware to allow selective reception of packets and to permit optimal use of CPU bandwidth. One function address
with seven different endpoint combinations is decoded in
parallel. If a match is found, then that particular packet is received into the FIFO; otherwise it is ignored.
The incoming USB Packet Address field and Endpoint field
are extracted from the incoming bit stream. Then the address field is compared to the Function Address register
(FADR). If a match is detected, the Endpoint field is compared to all of the Endpoint Control registers (EPCn) in parallel. A match then causes the payload data to be received
or transmitted using the respective endpoint FIFO.
18.2.2Transmit and Receive Endpoint FIFOs
The CR16 USB node uses a total of seven transmit and receive FIFOs: one bidirectional transmit and receive FIFO for
the mandatory control endpoint, three transmit FIFOs, and
three receive FIFOs. As shown in Table 39, the bidirectional
FIFO for the control endpoint is 8 bytes deep. The additional
unidirectional FIFOs are 64 bytes each for both transmit and
receive. Each FIFO can be programmed for one exclusive
USB endpoint, used together with one globally decoded
USB function address. Software must not enable both transmit and receive FIFOs for endpoint zero at any given time.
Table 39 Endpoint FIFO Sizes
TX FIFORX FIFO
Endpoint
Number
Size
(Bytes)
Name
Size
(Bytes)
Name
CP3BT26
USB Packet
ADDR FieldEndpoint Field
FADR Register
Match
EPC0 Register
EPC1 Register
EPC2 Register
EPC3 Register
EPC4Register
EPC5 Register
Match
Receive/
Transmit FIFO0
Transmit FIFO1
Receive FIFO1
Transmit FIFO2
Receive FIFO2
Transmit FIFO3
0 FIFO0 (bidirectional, 8 bytes)
164TXFIFO1--
2--64RXFIFO1
364TXFIFO2--
4--64RXFIFO2
564TXFIFO3--
6--64RXFIFO3
If two endpoints in the same direction are programmed with
the same endpoint number and both are enabled, data is received or transmitted to/from the endpoint with the lower
number, until that endpoint is disabled for bulk or interrupt
transfers, or becomes full or empty for ISO transfers. For example, if receive EP2 and receive EP4 both use endpoint 5
and are both isochronous, the first OUT packet is received
into EP2 and the second OUT packet into EP4, assuming
no software interaction in between. For ISO endpoints, this
allows implementing a ping-pong buffer scheme together
with the frame number match logic.
Endpoints in different directions programmed with the same
endpoint number operate independently.
EPC6 Register
Figure 29. USB Function Address/Endpoint Decoding
Receive FIFO3
DS049
91www.national.com
Page 92
Bidirectional Control Endpoint FIFO0 Operation
FIFO0 should be used for the bidirectional control endpoint
0. It can be configured to receive data sent to the default ad-
dress with the DEF bit in the EPC0 register. Isochronous
CP3BT26
transfers are not supported for the control endpoint.
The Endpoint 0 FIFO can hold a single receive or transmit
packet with up to 8 bytes of data. Figure 30 shows the basic
operation in both receive and transmit direction.
Note: The actual current operating state is not directly visible to software.
The Transmit FIFOs for endpoints 1, 3, and 5 support bulk,
interrupt, and isochronous USB packet transfers larger than
the actual FIFO size. Therefore, software must update the
FIFO contents while the USB packet is transmitted on the
bus. Figure 31 illustrates the operation of the transmit
FIFOs.
FLUSH (Resets TXRP and TXWP)
FLUSH Bit, TXC0 RegisterFLUSH Bit, RXC0 Register
TXFILL
TXWAIT
TX_EN Bit,
TXC0
Register
IN Token
Write to TXD0
TX_EN Bit,
TXC0 Register
(Zero-Length
Packet)
TX
IDLE
Transmission
Done
FIFO0 Empty
(All Data Read)
RX_EN Bit,
RXC0 Register
SETUP
To ke n
OUT or
SETUP
To ke n
RXWAIT
RX
DS050
Figure 30. Endpoint 0 Operation
A packet written to the FIFO is transmitted if an IN token for
the respective endpoint is received. If an error condition is
detected, the packet data remains in the FIFO and transmission is retried with the next IN token.
The FIFO contents can be flushed to allow response to an
OUT token or to write new data into the FIFO for the next IN
token.
If an OUT token is received for the FIFO, software is informed that the FIFO has received data only if there was no
error condition (CRC or STUFF error). Erroneous receptions are automatically discarded.
- 1
TX FIFO n
0X0TFnS
TXRP
+
+
TXFL = TXWP
TXWP
- TXRP
+
TCOUNT = TXRP
- TXWP (= TFnS - TXFL)
DS051
Figure 31. Transmit FIFO Operation
TFnSThe Transmit FIFO n Size is the total number
of bytes available within the FIFO.
TXRPThe Transmit Read Pointer is incremented ev-
ery time the Endpoint Controller reads from
the transmit FIFO. This pointer wraps around
to zero if TFnS is reached. TXRP is never incremented beyond the value of the write
pointer TXWP. An underrun condition occurs if
TXRP equals TXWP and an attempt is made
to transmit more bytes when the LAST bit in
the TXCMDx register is not set.
TXWPThe Transmit Write Pointer is incremented ev-
ery time software writes to the transmit FIFO.
This pointer wraps around to zero if TFnS is
reached. If an attempt is made to write more
bytes to the FIFO than actual space available
(FIFO overrun), the write to the FIFO is ignored. If so, TCOUNT is checked for an indication of the number of empty bytes
remaining.
TXFLThe Transmit FIFO Level indicates how many
bytes are currently in the FIFO. A FIFO warning is issued if TXFL decreases to a specific
value. The respective WARNn bit in the FWR
register is set if TXFL is equal to or less than
the number specified by the TFWL bit in the
TXCn register.
TCOUNTThe Transmit FIFO Count indicates how many
empty bytes can be filled within the transmit
FIFO. This value is accessible by software in
the TXSn register.
The Receive FIFOs for endpoints 2, 4, and 6 support bulk,
interrupt, and isochronous USB packet transfers larger than
the actual FIFO size. If the packet length exceeds the FIFO
size, software must read the FIFO contents while the USB
packet is being received on the bus. Figure 32 shows the
detailed behavior of receive FIFOs.
FLUSH (Resets RXRP and RXWP)
CP3BT26
18.3USB CONTROLLER REGISTERS
The CR16 USB node has a set of memory-mapped registers that can be read/written from the CPU bus to control the
USB interface. Some register bits are reserved; reading
from these bits returns undefined data. Reserved register
bits must always be written with 0.
Table 40 USB Controller Registers
NameAddressDescription
MCNTRLFF FD80hMain Control Register
RXRP
+
+
RCOUNT = RXWP
RXWP
+
- RXRF
DS052
RXFL = RXRP
- 1
0X0RFnS
RX FIFO n
- RXWP (= RFnS - RCOUNT)
Figure 32. Receive FIFO Operation
RFnSThe Receive FIFO n Size is the total number
of bytes available within the FIFO.
RXRPThe Receive Read Pointer is incremented
with every read by software from the receive
FIFO. This pointer wraps around to zero if
RFnS is reached. RXRP is never incremented
beyond the value of RXWP. If an attempt is
made to read more bytes than are actually
available (FIFO underrun), the last byte is
read repeatedly.
RXWPThe Receive Write Pointer is incremented ev-
ery time the Endpoint Controller writes to the
receive FIFO. This pointer wraps around to
zero if RFnS is reached. An overrun condition
occurs if RXRP equals RXWP and an attempt
is made to write an additional byte.
RXFLThe Receive FIFO Level indicates how many
more bytes can be received until an overrun
condition occurs with the next write to the
FIFO. A FIFO warning is issued if RXFL decreases to a specific value. The respective
WARNn bit in the FWR register is set if RXFL
is equal to or less than the number specified
by the RFWL bit in the RXCn register.
RCOUNTThe Receive FIFO Count indicates how many
bytes can be read from the receive FIFO. This
value is accessible by software via the RXSn
register.
NFSRFF FD8Ah
Node Functional State
Register
MAEVFF FD8ChMain Event Register
ALTEVFF FD90h
Alternate Event
Register
MAMSKFF FD8EhMain Mask Register
ALTMSKFF FD92h
TXEVFF FD94h
TXMSKFF FD96h
RXEVFF FD98h
RXMSKFF FD9Ah
Alternate Mask
Register
Transmit Event
Register
Transmit Mask
Register
Receive Event
Register
Receive Mask
Register
NAKEVFF FD9ChNAK Event Register
NAKMSKFF FD9EhNAK Mask Register
FWEVFF FDA0h
FWMSKFF FDA2h
FNHFF FDA4h
FNLFF FDA6h
FARFF F D 8 8h
FIFO Warning Event
Register
FIFO Warning Mask
Register
Frame Number High
Byte Register
Frame Number Low
Byte Register
Function Address
Register
DMACNTRLFF FDA8hDMA Control Register
DMAEVFF FDAAhDMA Event Register
DMAMSKFF FDAChDMA Mask Register
MIRFF FDAEhMirror Register
DMACNTFF FDB0hDMA Count Register
DMAERRFF FDB2hDMA Error Register
93www.national.com
Page 94
Table 40 USB Controller Registers
Table 40 USB Controller Registers
NameAddressDescription
CP3BT26
EPC0FF FDC0h
EPC1FF FDD0h
EPC2FF FDD8h
EPC3FF FDE0h
EPC4FF FDDE8h
EPC5FF FDF0h
EPC6FF FDF8h
TXS0FF FDC4h
TXS1FF FDD4h
TXS2FF FDE4h
TXS3FF FDF4h
TXC0FF FDC6h
TXC1FF FDD6
Endpoint Control 0
Register
Endpoint Control 1
Register
Endpoint Control 2
Register
Endpoint Control 3
Register
Endpoint Control 4
Register
Endpoint Control 5
Register
Endpoint Control 6
Register
Transmit Status 0
Register
Transmit Status 1
Register
Transmit Status 2
Register
Transmit Status 3
Register
Transmit Command 0
Register
Transmit Command 1
Register
NameAddressDescription
RXS3FF FDFCh
RXC0FF FDCEh
RXC1FF FDDEh
RXC2FF FDEEh
RXC3FF FDFEh
RXD0FF FDCAh
RXD1FF FDDAh
RXD2FF FDEAh
RXD3FF FDFAh
18.3.1Main Control Register (MCNTRL)
The MCNTRL register controls the main functions of the
CR16 USB node. The MCNTRL register provides read/write
access from the CPU bus. Reserved bits must be written
with 0, and they return 0 when read. It is clear after reset.
743210
ReservedNATReservedUSBEN
Receive Status 3
Register
Receive Command 0
Register
Receive Command 1
Register
Receive Command 2
Register
Receive Command 3
Register
Receive Data 0
Register
Receive Data 2
Register
Receive Data 2
Register
Receive Data 3
Register
TXC2FF FDE6h
TXC3FF FDF6h
TXD0FF FDC2h
TXD1FF FDD2h
TXD2FF FDE2h
TXD3FF FDF2h
RXS0FF FDCCh
RXS1FF FDDCh
RXS2FF FDECh
www.national.com94
Transmit Command 2
Register
Transmit Command 3
Register
Transmit Data 0
Register
Transmit Data 1
Register
Transmit Data 2
Register
Transmit Data 3
Register
Receive Status 0
Register
Receive Status 1
Register
Receive Status 2
Register
USBENThe USB Enable controls whether the USB
module is enabled. If the USB module is disabled, the 48 MHz clock within the USB node
is stopped, all USB registers are initialized to
their reset state, and the USB transceiver forces SE0 on the bus to prevent the hub from detected the USB node. The USBEN bit is clear
after reset.
0 – The USB module is disabled.
1 – The USB module is enabled.
Page 95
NATThe Node Attached indicates that this node is
ready to be detected as attached to USB.
When clear, the transceiver forces SE0 on the
USB node controller to prevent the hub (to
which this node is connected) from detecting
an attach event. After reset or when the USB
node is disabled, this bit is cleared to give the
device time before it must respond to commands. After this bit has been set, the device
no longer drives the USB and should be ready
to receive Reset signaling from the hub.
0 – Node not ready to be detected as at-
tached.
1 – Node ready to be detected as attached.
Table 41 USB Functional States
NFSNode StateDescription
This is the USB Reset state. This is entered upon a module reset or by software upon
detection of a USB Reset. Upon entry, all endpoint pipes are disabled. DEF in the Endpoint
00NodeReset
Control 0 (EPC0) register and AD_EN in the Function Address (FAR) register should be
cleared by software on entry to this state. On exit, DEF should be reset so the device
responds to the default address.
18.3.2Node Functional State Register (NFSR)
The NFSR register reports and controls the current functional state of the USB node. The NFSR register provides
read/write access. It is clear after reset.
7 210
NFSThe Node Functional State bits set the node
CP3BT26
ReservedNFS
state, as shown in Table 41. Software should
initiate all required state transitions according
to the respective status bits in the Alternate
Event (ALTEV) register.
In this state, resume “K” signalling is generated. This state should be entered by software to
01NodeResume
10NodeOperational This is the normal operational state for operation on the USB bus.
11NodeSuspend
initiate a remote wake-up sequence by the device. The node must remain in this state for at
least 1 ms and no more than 15 ms.
Suspend state should be entered by software on detection of a Suspend event while in
Operational state. While in Suspend state, the transceivers operate in their low-power
suspend mode. All endpoint controllers and the bits TX_EN, LAST, and RX_EN are reset,
while all other internal states are frozen. On detection of bus activity, the RESUME bit in the
ALTEV register is set. In response, software can cause entry to NodeOperational state.
95www.national.com
Page 96
18.3.3Main Event Register (MAEV)
The Main Event Register summarizes and reports the main
events of the USB transactions. This register provides readonly access. The MAEV register is clear after reset.
CP3BT26
76543210
INTR RX_EV ULD NAK FRAME TX_EV ALT WARN
WARNThe Warning Event bit indicates whether one
of the unmasked bits in the FIFO Warning
Event (FWEV) register has been set. This bit
is cleared by reading the FWEV register.
0 – No warning event occurred.
1 – A warning event has occurred.
ALTThe Alternate Event bit indicates whether one
of the unmasked ALTEV register bits has
been set. This bit is cleared by reading the ALTEV register.
0 – No alternate event has occurred.
1 – An alternate event has occurred.
TX_EVThe Transmit Event bit indicates whether any
of the unmasked bits in the Transmit Event
(TXEV) register (TXFIFOn or TXUNDRNn) is
set. Therefore, it indicates that an IN transaction has been completed. This bit is cleared
when all the TX_DONE bits and the TXUNDRN bits in each Transmit Status (TXSn) register are cleared.
0 – No transmit event has occurred.
1 – A transmit event has occurred.
FRAMEThe Frame Event bit indicates whether the
frame counter has been updated with a new
value, due to receipt of a valid SOF packet on
the USB or to an artificial update if the frame
counter was unlocked or a frame was missed.
This bit is cleared when the register is read.
0 – The frame counter has not been updated.
1 – Frame counter has been updated.
NAKThe Negative Acknowledge Event indicates
whether one of the unmasked NAK Event
(NAKEV) register bits has been set. This bit is
cleared when the NAKEV register is read.
0 – No unmasked NAK event has occurred.
1 – An unmasked NAK event has occurred.
ULThe Unlocked/Locked Detected bit is set
when the frame timer has either entered unlocked condition from a locked condition, or
has re-entered a locked condition from an unlocked condition as determined by the UL bit
in the Frame Number (FNH or FNL) register.
This bit is cleared when the register is read.
0 – Frame timer has not entered an unlocked
condition from a locked condition or reentered a locked condition from an unlocked condition.
1 – Frame timer has either entered an un-
locked condition from a locked condition
or re-entered a locked condition from an
unlocked condition.
RX_EVThe Receive Event bit is set if any of the un-
masked bits in the Receive Event (RXEV) register is set. It indicates that a SETUP or OUT
transaction has been completed. This bit is
cleared when all of the RX_LAST bits in each
Receive Status (RXSn) register and all RXOVRRN bits in the RXEV register are cleared.
0 – No receive event has occurred.
1 – A receive event has occurred.
INTRThe Master Interrupt Enable bit is hardwired
to 0 in the Main Event (MAEV) register; bit 7
in the Main Mask (MAMSK) register is the
Master Interrupt Enable.
0 – USB interrupts disabled.
1 – USB interrupts enabled.
18.3.4Main Mask Register (MAMSK)
The MAMSK register masks out events reported in the
MAEV registers. A set bit enables the interrupts for the respective event in the MAEV register. If the corresponding bit
is clear, interrupt generation for this event is disabled. This
register provides read/write access. The MAMSK register is
clear after reset.
76543210
INTR RX_EV ULD NAK FRAME TX_EV ALT WARN
18.3.5Alternate Event Register (ALTEV)
The ALTEV register summarizes and reports the further
events in the USB node. This register provides read-only access. The ALTEV register is clear after reset.
76543210
RESUME RESET SD5 SD3 EOP DMA Reserved
DMAThe DMA Event bit indicates that one of the
unmasked bits in the DMA Event (DMAEV)
register has been set. The DMA bit is readonly and clear, when the DMAEV register is
cleared.
0 – No DMA event has occurred.
1 – A DMA event has occurred.
EOPThe End of Packet bit indicates whether a val-
id EOP sequence has been detected on the
USB. It is used when this device has initiated a
Remote wake-up sequence to indicate that the
Resume sequence has been acknowledged
and completed by the host. This bit is cleared
when the register is read.
0 – No EOP sequence detected.
1 – EOP sequence detected.
www.national.com96
Page 97
SD3The Suspend Detect 3 ms bit is set after 3 ms
of IDLE have been detected on the upstream
port, indicating that the device should be suspended. The suspend occurs under software
control by writing the suspend value to the
Node Functional State (NFSR) register. This
bit is cleared when the register is read.
0 – No 3 ms in IDLE has been detected.
1 – 3 ms in IDLE has been detected.
SD5The Suspend Detect 5 ms bit is set after 5 ms
of IDLE have been detected on the upstream
port, indicating that this device is permitted to
perform a remote wake-up operation. The resume may be initiated under software control
by writing the resume value to the NFSR register. This bit is cleared when the register is
read.
0 – No 5 ms in IDLE has been detected.
1 – 5 ms in IDLE has been detected.
RESETThe Reset bit is set when 2.5 µs of SEO have
been detected on the upstream port. In response, the functional state should be reset
(NFS in the NFSR register is set to RESET),
where it must remain for at least 100 µs. The
functional state can then return to Operational
state. This bit is cleared when the register is
read.
0 – No 2.5 µs in SEO have been detected.
1 – 2.5 µs in SEO have been detected.
RESUMEThe Resume bit indicates whether resume
signalling has been detected on the USB
when the device is in Suspend state (NFS in
the NFSR register is set to SUSPEND), and a
non-IDLE signal is present on the USB, indicating that this device should begin its wakeup sequence and enter Operational state. Resume signalling can only be detected when
the 48 MHz PLL clock is enabled to the USB
controller. This bit is cleared when the register
is read.
0 – No resume signalling detected.
1 – Resume signalling detected.
18.3.6Alternate Mask Register (ALTMSK)
A set bit in the ALTMSK register enables automatic setting
of the ALT bit in the MAEV register when the respective
event in the ALTEV register occurs. Otherwise, setting
MAEV.ALT bit is disabled. The ALTMSK register is clear after reset. It provides read/write access from the CPU bus.
CP3BT26
18.3.7Transmit Event Register (TXEV)
The TXEV register reports the current status of the FIFOs,
used by the three Transmit Endpoints. The TXEV register is
clear after reset. It provides read-only access.
7430
TXUDRRNTXFIFO
TXFIFOThe Transmit FIFO n bits are copies of the
TX_DONE bits from the corresponding Transmit Status registers (TXSn). A bit is set when
the IN transaction for the corresponding transmit endpoint n has been completed. These
bits are cleared when the corresponding
TXSn register is read.
TXUDRRN The Transmit Underrun n bits are copies of the
respective TX_URUN bits from the corresponding Transmit Status registers (TXSn).
Whenever any of the Transmit FIFOs underflows, the respective TXUDRRN bit is set.
These bits are cleared when the corresponding Transmit Status register is read.
Note: Since Endpoint 0 implements a store
and forward principle, an underrun condition
for FIFO0 cannot occur. This results in the
TXUDRRN0 bit always being read as 0.
18.3.8Transmit Mask Register (TXMSK)
The TXMSK register is used to select the bits of the TXEV
registers, which causes the TX_EV bit in the MAEV register
to be set. When a bit is set and the corresponding bit in the
TXEV register is set, the TX_EV bit in the MAEV register is
set. When clear, the corresponding bit in the TXEV register
does not cause TX_EV to be set. The TXMSK register provides read/write access. It is clear after reset.
7430
TXUDRRNTXFIFO
76543210
RESUME RESET SD5 SD3 EOP DMA Reserved
97www.national.com
Page 98
18.3.9Receive Event Register (RXEV)
The RXEV register reports the current status of the FIFO,
used by the three Receive Endpoints. The RXEV register is
clear after reset. It provides read-only access from the CPU
CP3BT26
bus.
18.3.11 NAK Event Register (NAKEV)
A bit in the NAKEV register is set when a Negative Acknowledge (NAK) was generated by the corresponding endpoint.
The NAKEV register provides read-only access from the
CPU bus. It is clear after reset.
7430
RXOVRRNRXFIFO
RXFIFOThe Receive FIFO n are set whenever either
RX_ERR or RX_LAST in the respective Receive Status registers (RXSn) are set. Reading the corresponding RXSn register
automatically clears these bits. The CR16
USB node discards all packets for Endpoint 0
received with errors. This is necessary in case
of retransmission due to media errors, ensuring that a good copy of a SETUP packet is
captured. Otherwise, the FIFO may potentially
be tied up, holding corrupted data and unable
to receive a retransmission of the same packet (the RXFIFO0 bit only reflects the value of
RX_LAST for Endpoint 0). If data streaming is
used for the receive endpoints (EP2, EP4 and
EP6), software must check the respective
RX_ERR bits to ensure the packets received
are not corrupted by errors.
RXOVRRN The Receive Overrun n bits are set when an
overrun condition is indicated in the corresponding receive FIFO n. They are cleared
when the register is read. Software must
check the respective RX_ERR bits that packets received for the other receive endpoints
(EP2, EP4 and EP6) are not corrupted by errors, as these endpoints support data streaming (packets which are longer than the actual
FIFO depth).
18.3.10 Receive Mask Register (RXMSK)
The RXMSK register is used to select the bits of the RXEV
register, which cause the RX_EV bit in the MAEV register to
be set. When set and the corresponding bit in the RXEV
register is set, RX_EV bit in the MAEV register is set. When
clear, the corresponding bit in the RXEV register does not
cause the RX_EV bit to be set. The RXMSK register provides read/write access. This register is clear after reset.
7430
OUTIN
INThe IN n bits are set when a NAK handshake
is generated for an enabled address/endpoint
combination (AD_EN in the Function Address, FAR, register is set and EP_EN in the
Endpoint Control, EPCx, register is set) in response to an IN token. These bits are cleared
when the register is read.
OUTThe OUT n bits are set when a NAK hand-
shake is generated for an enabled address/
endpoint combination (AD_EN in the FAR register is set and EP_EN in the EPCx register is
set) in response to an OUT token. These bits
are not set if NAK is generated as result of an
overrun condition. They are cleared when the
register is read.
18.3.12 NAK Mask Register (NAKMSK)
The NAKMSK register is used to select the bits of the NAKEV register, which cause the NAK bit in the MAEV register
to be set. When set and the corresponding bit in the NAKEV
register is set, the NAK bit in the MAEV register is set. When
cleared, the corresponding bit in the NAKEV register does
not cause NAK to be set. The NAKMSK register provides
read/write access. It is clear after reset.
7430
OUTIN
7430
RXOVRRNRXFIFO
www.national.com98
Page 99
18.3.13 FIFO Warning Event Register (FWEV)
The FWEV register signals whether a receive or transmit
FIFO has reached its warning limit. It reports the status for
all FIFOs, except for the Endpoint 0 FIFO, as no warning
limit can be specified for this FIFO. The FWEV register provides read-only access from the CPU bus. It is clear after reset.
754310
RXWARN3:1Res.TXWARN3:1Res.
TXWARN3:1
RXWARN3:1
18.3.14 FIFO Warning Mask Register (FWMSK)
The FWMSK register selects which FWEV bits are reported
in the MAEV register. A set FWMSK bit with the corresponding bit in the FWEV register set, causes the WARN bit in the
MAEV register to be set. When clear, the corresponding bit
in the FWEV register does not cause WARN to be set. The
FWMSK register provides read/write access. This register is
clear after reset.
754310
RXWARN3:1Res.TXWARN3:1Res.
The Transmit Warning n bits are set when the
respective transmit endpoint FIFO reaches
the warning limit, as specified by the TFWL
bits of the respective TXCn register, and
transmission from the respective endpoint is
enabled. These bits are cleared when the
warning condition is cleared by either writing
new data to the FIFO when the FIFO is
flushed, or when transmission is done, as indicated by the TX_DONE bit in the TXSn register.
The Receive Warning n bits are set when the
respective receive endpoint FIFO reaches the
warning limit, as specified by the RFWL bits of
the respective EPCx register. These bits are
cleared when the warning condition is cleared
by either reading data from the FIFO or when
the FIFO is flushed.
18.3.15 Frame Number High Byte Register (FNH)
The FNH register contains the three most significant bits
(MSB) of the current frame counter as well as status and
control bits for the frame counter. This register is loaded with
C0h after reset. It provides access from the CPU bus as described below.
FN10:8The Frame Number field holds the three most
RFCThe Reset Frame Count bit is used to reset
ULThe Unlock Flag bit indicates that at least two
CP3BT26
7654320
MFULRFCReservedFN10:8
significant bits (MSB) of the current frame
number, received in the last SOF packet. If a
valid frame number is not received within
12060 bit times (Frame Length Maximum, FLMAX, with tolerance) of the previous change,
the frame number is incremented artificially. If
two successive frames are missed or are incorrect, the current FN is frozen and loaded
with the next frame number from a valid SOF
packet. If the frame number low byte was read
by software before reading the FNH register,
software actually reads the contents of a buffer register which holds the value of the three
frame number bits of this register when the
low byte was read. Therefore, the correct sequence to read the frame number is: FNL,
FNH. Read operations to the FNH register,
without first reading the Frame Number Low
Byte (FNL) register directly, read the actual
value of the three MSBs of the frame number.
The FN bits provide read-only access. On reset, the FN bits are cleared.
the frame number to 000h. This bit always
reads as 0. Due to the synchronization elements the frame counter reset actually occurs
a maximum of 3 USB clock cycles (12 MHz)
plus 2.5 CPU clock cycles after the write to the
RFC bit.
0 – Writing 0 has no effect.
1 – Writing 1 resets the frame counter.
frames were received without an expected
frame number, or that no valid SOF was received within 12060 bit times. If this bit is set,
the frame number from the next valid SOF
packet is loaded in FN. The UL bit provides
read-only access. After reset, this bit is set.
This bit is set by the hardware and is cleared
by reading the FNH register.
0 – No condition indicated.
1 – At least two frames were received without
an expected frame number, or no valid
SOF was received within 12060 bit times.
99www.national.com
Page 100
MFThe Missed SOF bit is set when the frame
number in a valid received SOF does not
match the expected next value, or when an
CP3BT26
18.3.16 Frame Number Low Byte Register (FNL)
The FNL register holds the low byte of the frame number, as
described above. To ensure consistency, reading this low
byte causes the three frame number bits in the FNH register
to be locked until this register is read. The correct sequence
to read the frame number is: FNL first, followed by FNH.
This register provides read-only access. After reset, the
FNL register is clear.
SOF is not received within 12060 bit times.
The MF bit provides read-only access. On reset, this bit is set. This bit is set by the hardware and is cleared by reading the FNH
register.
0 – No condition indicated.
1 – The frame number in a valid SOF does
not match the expected next value, or no
valid SOF was received within 12060 bit
times.
18.3.18 Control Register (DMACNTRL)
The DMACNTRL register controls the main DMA functions
of the CR16 USB node. The DMACTRL register provides
read/write access. This register is clear after reset.
7654320
DENIGNRXTGLDTGL ADMA DMODDSRC
DSRCThe DMA Source bit field holds the binary-en-
coded value that specifies which of the endpoints, 1 to 6, is enabled for DMA support. The
DSRC bits are cleared on reset. Table 42
summarizes the DSRC bit settings.
Table 42 DSRC Bit Description
DSRCEndpoint Number
0001
0012
70
FN7:0
Note: If the frame counter is updated due to a receipt of a
valid SOF or an artificial update (i.e. missed frame or unlocked/locked detect), it will take the synchronization elements a maximum of 2.5 CPU clock cycles to update the
FNH and FNL registers.
18.3.17 Function Address Register (FAR)
The Function Address Register specifies the device function address. The different endpoint numbers are set for
each endpoint individually using the Endpoint Control registers. The FAR register provides read/write access. After reset, this register is clear. If the DEF bit in the Endpoint
Control 0 register is set, Endpoint 0 responds to the default
address.
760
AD_ENAD
ADThe Address field holds the 7-bit function ad-
dress used to transmit and receive all tokens
addressed to this device.
AD_ENThe Address Enable bit controls whether the
AD field is used for address comparison. If
not, the device does not respond to any token
on the USB bus.
0 – The device does not respond to any token
on the USB bus.
1 – The AD field is used for address compar-
ison.
0103
0114
1005
1016
11xReserved
DMODThe DMA Mode bit specifies when a DMA re-
quest is issued. If clear, a DMA request is issued on transfer completion. For transmit
endpoints EP1, EP3, and EP5, the data is
completely transferred, as indicated by the
TX_DONE bit (to fill the FIFO with new transmit data). For receive endpoints EP2, EP4,
and EP6, this is indicated by the RX_LAST bit.
When the DMOD bit is set, a DMA request is
issued when the respective FIFO warning bit
is set. The DMOD bit is cleared after reset.
0 – DMA request is issued on transfer com-
pletion.
1 – DMA request is issued when the respec-
tive FIFO warning bit is set.
ADMAThe Automatic DMA bit enables Automatic
DMA (ADMA) and automatically enables the
selected receive or transmit endpoint. Before
ADMA mode can be enabled, the DEN bit in
the DMA Control (DMACNTRL) register must
be cleared. ADMA mode functions until any bit
in the DMA Event (DMAEV) register is set, except for NTGL. To initiate ADMA mode, all bits
in the DMAEV register must be cleared, except for NTGL.
0 – Automatic DMA disabled.
1 – Automatic DMA enabled.
www.national.com100
Loading...
+ 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.