HD6437050 HD64F7050 HD64F7051
HD6437050 HD64F7050 HD64F7051
HD6437050 HD64F7050 HD64F7051
32
SH7051F-ZTAT™
Hardware Manual
HD6437050
HD64F7050
HD64F7051
Rev. 5.00
Revision Date: Jan 06, 2006
Keep safety first in your circuit designs!
1. Renesas Technology Corp. puts the maximum effort into making semiconductor products better and
more reliable, but there is always the possibility that trouble may occur with them. Trouble with
semiconductors may lead to personal injury, fire or property damage.
Remember to give due consideration to safety when making your circuit designs, with appropriate
measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of nonflammable material or
(iii) prevention against any malfunction or mishap.
The CPU has a RISC-type instruction set. Most instructions can be executed in one state (one
system clock cycle), which greatly improves instruction execution speed. In addition, the 32-bit
internal architecture enhances data processing power. With this CPU, it has become possible to
assemble low-cost, high-performance/high-functionality systems even for applications such as
real-time control, which could not previously be handled by microcontrollers because of their
high-speed processing requirements.
In addition, the SH7050 series includes on-chip peripheral functions necessary for synchronous
configuration, such as large-capacity ROM and RAM, a direct memory access controller
(DMAC), timers, a serial communication interface (SCI), A/D converter, interrupt controller
(INTC), and I/O ports.
ROM and SRAM can be directly connected by means of an external memory access support
function, greatly reducing system cost.
There are versions of on-chip ROM: mask ROM and flash memory. The flash memory can be
programmed with a programmer that supports SH7050 series programming, and can also be
programmed and erased by software.
This hardware manual describes the SH7050 series hardware. Refer to the programming manual
for a detailed description of the instruction set.
Related Manual
Please consult your Renesas sales representative for details of development environment system.
Section 1 Overview
1.1 Features
The SH7050 series is a single-chip RISC microcontroller that integrates a RISC CPU core using
an original Renesas architecture with peripheral functions required for system configuration.
The CPU has a RISC-type instruction set. Most instructions can be executed in one state (one
system clock cycle), which greatly improves instruction execution speed. In addition, the 32-bit
internal architecture enhances data processing power. With this CPU, it has become possible to
assemble low-cost, high-performance/high-functionality systems even for applications such as
real-time control, which could not previously be handled by microcontrollers because of their
high-speed processing requirements.
In addition, the SH7050 series includes on-chip peripheral functions necessary for synchronous
configuration, such as large-capacity ROM and RAM, a direct memory access controller
(DMAC), timers, a serial communication interface (SCI), A/D converter, interrupt controller
(INTC), and I/O ports.
ROM and SRAM can be directly connected by means of an external memory access support
function, greatly reducing system cost.
TM
There are versions of on-chip ROM: mask ROM and F-ZTAT (Flexible Zero Turn Around
Time) with flash memory. The flash memory can be programmed with a programmer that supports
SH7050 series programming, and can also be programmed and erased by software. This enables
the chip to be programmed on the user side while mounted on a board.
Item Features
CPU • Original Renesas architecture
• 32-bit internal architecture
• General register machine
Sixteen 32-bit general registers
Three 32-bit control registers
Four 32-bit system registers
• RISC-type instruction set
Fixed 16-bit instruction length for improved code efficiency
Load-store architecture (basic operations are executed between
registers)
Delayed unconditional/conditional branch instructions reduce pipeline
disruption during branches
C-oriented instruction set
• Instruction execution time: Basic instructions execute in one state
(50 ns/instruction at 20 MHz operation)
• Address space: Architecture supports 4 Gbytes
• On-chip multiplier: Multiply operations (32 bits × 32 bits → 64 bits) and
multiply-and-accumulate operations (32 bits × 32 bits + 64 bits → 64 bits)
executed in two to four states
• Five-stage pipeline
Item Features
Operating states • Operating modes
Single-chip mode
8/16-bit bus expanded mode (area 0 only set by mode pins)
• Mode with on-chip ROM
• Mode with no on-chip ROM
• Processing states
Power-on reset state
Program execution state
Exception handling state
Bus-released state
Power-down state
• Power-down state
Sleep mode
Software standby mode
Hardware standby mode
Interrupt • Nine external interrupt pins (NMI, IRQ0 to IRQ7)
controller (INTC)
• 66 internal interrupt sources
(ATU × 44, SCI × 12, DMAC × 4, A/D × 2, WDT × 1, UBC × 1, CMT × 2)
• 16 programmable priority levels
User break • Requests an interrupt when the CPU or DMAC generates a bus cycle with
controller (UBC) specified conditions
• Simplifies configuration of an on-chip debugger
Clock pulse • On-chip clock pulse generator (maximum operating frequency: 20 MHz)
generator
• On-chip clock-multiplication PLL circuit (×1, ×2, ×4)
(CPG/PLL)
External input frequency range: 4 to 10 MHz
Item Features
Bus state • Supports external memory access (SRAM and ROM directly connectable)
controller (BSC)
8/16-bit external data bus
• External address space divided into four areas, with the following
parameters settable for each area:
Bus size (8 or 16 bits)
Number of wait cycles
Chip select signals (CS0 to CS3) output for each area
• Wait cycles can be inserted using an external WAIT signal
• External access in minimum of two cycles
• Provision for idle cycle insertion to prevent bus collisions
(between external space read and write cycles, etc.)
Direct memory • DMA transfer possible for the following devices:
access controller
External memory, external I/O, external memory, on-chip supporting
(DMAC)
(4 channels) modules (excluding DMAC, UBC, BSC)
• DMA transfer requests by external pins, on-chip SCI, on-chip A/D
converter, on-chip ATU
• Cycle stealing or burst transfer
• Relative channel priorities can be set
• Channels 0 and 1: Selection of dual or single address mode transfer,
external requests possible
Channels 2 and 3: Dual address mode transfer and internal requests only
• Source address reload function (channel 2 only)
• Can be switched between direct address transfer mode and indirect
address transfer mode (channel 3 only)
Direct address transfer mode: Transfers the data at the transfer source
address to the transfer destination address
Indirect address transfer mode: Regards the data at the transfer source
address as an address, and transfers the data at that address to the
transfer destination address
Item Features
Advanced timer • Built-in two-stage prescaler
unit (ATU)
• Total of 18 counters: ten free-running counters, eight down-counters
• Maximum 34 pulse inputs or outputs can be processed
Four 32-bit input capture inputs
Eight 16-bit one-shot pulse outputs
Eighteen 16-bit input capture inputs/output compare outputs
Four 16-bit PWM outputs
One 16-bit input capture input (no pin)
Advanced pulse • Maximum eight pulse outputs
controller (APC)
Watchdog timer • Can be switched between watchdog timer and interval timer function
(WDT)
• Internal reset, external signal, or interrupt generated by counter overflow
(1 channel)
Serial • Selection of asynchronous or synchronous mode
communication
• Simultaneous transmission/reception (full-duplex) capability
interface (SCI)
(3 channels) • Built-in dedicated baud rate generator
• Multiprocessor communication function
A/D converter • 10-bit resolution
• Sixteen channels
Two sample-and-hold circuit function units
(independent operation of 12 channels and 4 channels)
Selection of single mode or scan mode
• Can be activated by external trigger or ATU compare-match
• ADEND output at end of A/D conversion (A/D1 module only)
Compare-match • Selection of 4 counter input clocks
timer (CMT)
• A compare-match interrupt can be requested independently for each
(2 channels)
channel
I/O ports • Total of 118 pins (multiplex ports): 102 input/output, 16 input
Input or output can be specified bit by bit
Item Features
Large-capacity Model
on-chip memory Memory
SH7050 SH7051
Mask ROM 128 kB — —
Flash memory — 128 kB 256 kB
RAM 6 kB 6 kB 10 kB
PC6/CS2/IRQ6/ADEND
PF9/CS3/IRQ7/PULS5
PF4/BREQ/PULS7
PF5/BACK/PULS6
PB11/A21/POD
PC2/WAIT
PC1/WRH
PB10/A20
PA15/A15
PA14/A14
PA13/A13
PA12/A12
PA11/A11
PA10/A10
PC0/WRL
PC5/CS1
PC4/CS0
PB9/A19
PB8/A18
PB7/A17
PB6/A16
PC3/RD
PA9/A9
PA8/A8
PA7/A7
PA6/A6
PA5/A5
PA4/A4
PA3/A3
PA2/A2
PA1/A1
PA0/A0
RES
Port/control signals Port/address signals
HSTBY
MD3
MD2
MD1
MD0 PD15/D15
NMI PD14/D14
WDTOVF PD13/D13
ROM (flash/mask) RAM PD12/D12
PD11/D11
Port/data signals
PD10/D10
CK PD9/D9
EXTAL PD8/D8
XTAL Clock pulse PD7/D7
PLLVCC generator PD6/D6
Direct memory PD5/D5
PLLVSS
CPU access PD4/D4
PLLCAP
controller PD3/D3
VCC (×15)
Multiplier (4 channels) PD2/D2
VSS (×15)
AVref PD1/D1
AVCC (×2) PD0/D0
Interrupt
AVSS (×2) Bus state controller
controller
FWE (NC*)
PG0/ADTRG/IRQOUT
PG1/SCK0
Serial communi-
PH15/AN15 Advanced timer PG2/TxD0
cation interface
PH14/AN14 unit PG3/RxD0
(3 channels)
PH13/AN13 PG4/SCK1
PH12/AN12 PG5/TxD1
PH11/AN11 Compare-match PG6/RxD1
A/D Watchdog
PH10/AN10 timer PF8/SCK2/PULS4
converter timer
PH9/AN9 (2 channels) Port PG7/TxD2
PH8/AN8 PG8/RxD2
PH7/AN7 PF0/IRQ0
Port
PH6/AN6 PF1/IRQ1
PH5/AN5 PF2/IRQ2
PH4/AN4 PF3/IRQ3
PH3/AN3 PG14/IRQ4/TIOA5
Port Port PG15/IRQ5/TIOB5
PH2/AN2
PH1/AN1 PF7/DREQ0/PULS3
PH0/AN0 PF6/DACK0/PULS2
PC14/TOH10
PC13/TOG10
PC12/TOF10/DRAK1
PC11/TOE10/DRAK0
PC10/TOD10
PC9/TOC10
PC8/TOB10
PC7/TOA10
PG13/TIOD4
PG12/TIOC4
PG11/TIOB4
PG10/TIOA4
PG9/TIOD3
PE14/TIOC3
PE13/TIOB3
PE12/TIOA3
PE7/TIOB2
PE6/TIOA2
PE5/TIOF1
PE4/TIOE1
PE3/TIOD1
PE2/TIOC1
PE1/TIOB1
PE0/TIOA1
PE11/TID0
PE10/TIC0
PE9/TIB0
PE8/TIA0
PB5/TCLKB
PB4/TCLKA
PB0/TO6 PF5/DREQ1/PULS1
PB1/TO7 PF4/DACK1/PULS0
PB2/TO8
PB3/TO9
1.3.1
PB9/A19
PB8/A18
PB7/A17
VSS
PB6/A16
VCC
PA15/A15
PA14/A14
PA13/A13
PA12/A12
PA11/A11
VSS
PA10/A10
VCC
PA9/A9
PA8/A8
PA7/A7
PA6/A6
PA5/A5
VSS
PA4/A4
VCC
PA3/A3
PA2/A2
PA1/A1
PA0/A0
PB5/TCLKB
VSS
PB4/TCLKA
VCC
PB3/TO9
PB2/TO8
PB1/TO7
PB0/TO6
PG15/IRQ5/TIOB5
VSS
PG14/IRQ4/TIOA5
PG13/TIOD4
PG12/TIOC4
PG11/TIOB4
PG10/TIOA4
PG9/TIOD3
42
41
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
REJ09B0273-0500
PB10/A20 43 168 PG8/RxD2
Section 1 Overview
PRQP0168JA-A
PE3/TIOD1 69 142 AVCC
VSS 70 141 PH4/AN4
PE4/TIOE1 71 140 PH3/AN3
VCC 72 139 PH2/AN2
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
CK
VSS
VSS
VSS
VSS
VCC
VCC
VCC
VCC
NMI
RES
MD3
MD2
MD1
MD0
XTAL
EXTAL
HSTBY
PD0/D0
PD1/D1
PD2/D2
PD3/D3
PD4/D4
PD5/D5
PD6/D6
PD7/D7
PD8/D8
PD9/D9
PLLVSS
PLLVCC
PLLCAP
PF0/IRQ0
PF1/IRQ1
PF2/IRQ2
PF3/IRQ3
PD10/D10
PD11/D11
PD12/D12
PD13/D13
PD14/D14
PD15/D15
FWE (NC*)
Section 1 Overview
Section 2 CPU
The sixteen 32-bit general registers (Rn) are numbered R0–R15. General registers are used for
data processing and address calculation. R0 is also used as an index register. Several instructions
have R0 fixed as their only usable register. R15 is used as the hardware stack pointer (SP). Saving
and recovering the status register (SR) and program counter (PC) in exception processing is
accomplished by referencing the stack using R15. Figure 2.1 shows the general registers.
31 0
R0*1
R1
R2
R3
R4
R5
R6
R7
R8
R9
R10
R11
R12
R13
R14
R15, SP (hardware stack pointer)*2
The 32-bit control registers consist of the 32-bit status register (SR), global base register (GBR),
and vector base register (VBR). The status register indicates processing states. The global base
register functions as a base address for the indirect GBR addressing mode to transfer data to the
registers of on-chip peripheral modules. The vector base register functions as the base address of
the exception processing vector area (including interrupts). Figure 2.2 shows a control register.
31 9 8 7 6 5 4 32 1 0
SR M Q I3 I2 I1 I0 ST SR: Status register
System registers consist of four 32-bit registers: high and low multiply and accumulate registers
(MACH and MACL), the procedure register (PR), and the program counter (PC). The multiply
and accumulate registers store the results of multiply and accumulate operations. The procedure
register stores the return address from the subroutine procedure. The program counter stores
program addresses to control the flow of the processing. Figure 2.3 shows a system register.
31 0
Multiply and accumulate (MAC)
MACH registers high and low (MACH,
MACL MACL): Stores the results of
multiply and accumulate operations.
Register operands are always longwords (32 bits). When the memory operand is only a byte (8
bits) or a word (16 bits), it is sign-extended into a longword when loaded into a register (figure
2.4).
31 0
Longword
Memory data formats are classified into bytes, words, and longwords. Byte data can be accessed
from any address, but an address error will occur if you try to access word data starting from an
address other than 2n or longword data starting from an address other than 4n. In such cases, the
data accessed cannot be guaranteed. The hardware stack area, referred to by the hardware stack
pointer (SP, R15), uses only longword data starting from address 4n because this area holds the
program counter and status register (figure 2.5).
Address m + 1 Address m + 3
Address m Address m + 2
31 23 15 7 0
Byte Byte Byte Byte
Address 2n Word Word
Address 4n Longword
Byte (8 bit) immediate data resides in an instruction code. Immediate data accessed by the MOV,
ADD, and CMP/EQ instructions is sign-extended and handled in registers as longword data.
Immediate data accessed by the TST, AND, OR, and XOR instructions is zero-extended and
handled as longword data. Consequently, AND instructions with immediate data always clear the
upper 24 bits of the destination register.
Word or longword immediate data is not located in the instruction code, but instead is stored in a
memory table. An immediate data transfer instruction (MOV) accesses the memory table using the
PC relative addressing mode with displacement.
All instructions are RISC type. This section details their functions.
16-Bit Fixed Length: All instructions are 16 bits long, increasing program code efficiency.
One Instruction per Cycle: The microprocessor can execute basic instructions in one cycle using
the pipeline system. Instructions are executed in 50 ns at 20 MHz.
Data Length: Longword is the standard data length for all operations. Memory can be accessed in
bytes, words, or longwords. Byte or word data accessed from memory is sign-extended and
handled as longword data. Immediate data is sign-extended for arithmetic operations or zero-
extended for logic operations. It also is handled as longword data (table 2.2).
Load-Store Architecture: Basic operations are executed between registers. For operations that
involve memory access, data is loaded to the registers and executed (load-store architecture).
Instructions such as AND that manipulate bits, however, are executed directly in memory.
Delayed Branch Instructions: Unconditional branch instructions are delayed. Executing the
instruction that follows the branch instruction and then branching reduces pipeline disruption
during branching (table 2.3). There are two types of conditional branch instructions: delayed
branch instructions and ordinary branch instructions.
T Bit: The T bit in the status register changes according to the result of the comparison, and in
turn is the condition (true/false) that determines if the program will branch. The number of
instructions that change the T bit is kept to a minimum to improve the processing speed (table
2.4).
Immediate Data: Byte (8 bit) immediate data resides in instruction code. Word or longword
immediate data is not input via instruction codes but is stored in a memory table. An immediate
data transfer instruction (MOV) accesses the memory table using the PC relative addressing mode
with displacement (table 2.5).
Absolute Address: When data is accessed by absolute address, the value already in the absolute
address is placed in the memory table. Loading the immediate data when the instruction is
executed transfers that value to the register and the data is accessed in the indirect register
addressing mode (table 2.6).
16-Bit/32-Bit Displacement: When data is accessed by 16-bit or 32-bit displacement, the pre-
existing displacement value is placed in the memory table. Loading the immediate data when the
instruction is executed transfers that value to the register and the data is accessed in the indirect
indexed register addressing mode (table 2.7).
Addressing Instruction
Mode Format Effective Addresses Calculation Equation
Direct register Rn The effective address is register Rn. (The operand —
addressing is the contents of register Rn.)
Indirect register @Rn The effective address is the content of register Rn. Rn
addressing
Rn Rn
Addressing Instruction
Mode Format Effective Addresses Calculation Equation
Indirect register @(disp:4, The effective address is Rn plus a 4-bit Byte: Rn +
addressing with Rn) displacement (disp). The value of disp is zero- disp
displacement extended, and remains the same for a byte Word: Rn +
operation, is doubled for a word operation, and is disp × 2
quadrupled for a longword operation.
Longword: Rn
Rn + disp × 4
1/2/4
Indirect indexed @(R0, Rn) The effective address is the Rn value plus R0. Rn + R0
register
addressing Rn
+ Rn + R0
R0
Indirect GBR @(disp:8, The effective address is the GBR value plus an Byte: GBR +
addressing with GBR) 8-bit displacement (disp). The value of disp is zero- disp
displacement extended, and remains the same for a byte opera- Word: GBR +
tion, is doubled for a word operation, and is disp × 2
quadrupled for a longword operation.
Longword:
GBR GBR + disp ×
4
disp + GBR
(zero-extended) + disp × 1/2/4
×
1/2/4
Addressing Instruction
Mode Format Effective Addresses Calculation Equation
Indirect indexed @(R0, The effective address is the GBR value plus the R0. GBR + R0
GBR addressing GBR)
GBR
+ GBR + R0
R0
Indirect PC @(disp:8, The effective address is the PC value plus an 8-bit Word: PC +
addressing with PC) displacement (disp). The value of disp is zero- disp × 2
displacement extended, and is doubled for a word operation, and Longword:
quadrupled for a longword operation. For a PC &
longword operation, the lowest two bits of the PC H'FFFFFFFC
value are masked. + disp × 4
PC
(for longword)
&
PC + disp × 2
H'FFFFFFFC or
+
PC & H'FFFFFFFC
disp + disp × 4
(zero-extended)
×
2/4
Addressing Instruction
Mode Format Effective Addresses Calculation Equation
PC relative disp:8 The effective address is the PC value sign-extended PC + disp × 2
addressing with an 8-bit displacement (disp), doubled, and
added to the PC value.
PC
disp + PC + disp × 2
(sign-extended)
×
disp + PC + disp × 2
(sign-extended)
×
PC
+ PC + Rn
Rn
Immediate #imm:8 The 8-bit immediate data (imm) for the TST, AND, —
addressing OR, and XOR instructions are zero-extended.
#imm:8 The 8-bit immediate data (imm) for the MOV, ADD, —
and CMP/EQ instructions are sign-extended.
#imm:8 The 8-bit immediate data (imm) for the TRAPA —
instruction is zero-extended and is quadrupled.
Table 2.9 lists the instruction formats for the source operand and the destination operand. The
meaning of the operand depends on the instruction code. The symbols are used as follows:
Source Destination
Instruction Formats Operand Operand Example
0 format — — NOP
15 0
xxxx xxxx xxxx xxxx
Source Destination
Instruction Formats Operand Operand Example
nm format mmmm: Direct nnnn: Direct ADD Rm,Rn
15 0 register register
xxxx nnnn mmmm xxxx mmmm: Direct nnnn: Indirect MOV.L Rm,@Rn
register register
mmmm: Indirect MACH, MACL MAC.W
post-increment @Rm+,@Rn+
register
(multiply/
accumulate)
nnnn*: Indirect
post-increment
register
(multiply/
accumulate)
mmmm: Indirect nnnn: Direct MOV.L @Rm+,Rn
post-increment register
register
mmmm: Direct nnnn: Indirect MOV.L Rm,@-Rn
register pre-decrement
register
mmmm: Direct nnnn: Indirect MOV.L
register indexed register Rm,@(R0,Rn)
md format mmmmdddd: R0 (Direct MOV.B
15 0 indirect register register) @(disp,Rm),R0
xxxx xxxx mmmm dddd with
displacement
nd4 format R0 (Direct nnnndddd: MOV.B
15 0 register) Indirect register R0,@(disp,Rn)
xxxx xxxx nnnn dddd with displacement
Source Destination
Instruction Formats Operand Operand Example
d format dddddddd: R0 (Direct MOV.L
15 0 Indirect GBR register) @(disp,GBR),R0
xxxx xxxx dddd dddd with
displacement
R0(Direct dddddddd: MOV.L
register) Indirect GBR with R0,@(disp,GBR)
displacement
dddddddd: PC R0 (Direct MOVA
relative with register) @(disp,PC),R0
displacement
— dddddddd: PC BF label
relative
d12 format — dddddddddddd: BRA label
15 0 PC relative (label = disp +
xxxx dddd dddd dddd PC)
Operation No. of
Classification Types Code Function Instructions
Data transfer 5 MOV Data transfer, immediate data transfer, 39
peripheral module data transfer, structure
data transfer
MOVA Effective address transfer
MOVT T bit transfer
SWAP Swap of upper and lower bytes
XTRCT Extraction of the middle of registers connected
Arithmetic 21 ADD Binary addition 33
operations ADDC Binary addition with carry
ADDV Binary addition with overflow check
CMP/cond Comparison
DIV1 Division
DIV0S Initialization of signed division
DIV0U Initialization of unsigned division
DMULS Signed double-length multiplication
DMULU Unsigned double-length multiplication
DT Decrement and test
EXTS Sign extension
EXTU Zero extension
MAC Multiply/accumulate, double-length
multiply/accumulate operation
MUL Double-length multiply operation
MULS Signed multiplication
MULU Unsigned multiplication
NEG Negation
NEGC Negation with borrow
SUB Binary subtraction
SUBC Binary subtraction with borrow
SUBV Binary subtraction with underflow
Operation No. of
Classification Types Code Function Instructions
Logic 6 AND Logical AND 14
operations NOT Bit inversion
OR Logical OR
TAS Memory test and bit set
TST Logical AND and T bit set
XOR Exclusive OR
Shift 10 ROTL One-bit left rotation 14
ROTR One-bit right rotation
ROTCL One-bit left rotation with T bit
ROTCR One-bit right rotation with T bit
SHAL One-bit arithmetic left shift
SHAR One-bit arithmetic right shift
SHLL One-bit logical left shift
SHLLn n-bit logical left shift
SHLR One-bit logical right shift
SHLRn n-bit logical right shift
Branch 9 BF Conditional branch, conditional branch with 11
delay (Branch when T = 0)
BT Conditional branch, conditional branch with
delay (Branch when T = 1)
BRA Unconditional branch
BRAF Unconditional branch
BSR Branch to subroutine procedure
BSRF Branch to subroutine procedure
JMP Unconditional branch
JSR Branch to subroutine procedure
RTS Return from subroutine procedure
Operation No. of
Classification Types Code Function Instructions
System 11 CLRMAC MAC register clear 31
control CLRT T bit clear
LDC Load to control register
LDS Load to system register
NOP No operation
RTE Return from exception processing
SETT T bit set
SLEEP Shift into power-down mode
STC Storing control register data
STS Storing system register data
TRAPA Trap exception handling
Total: 62 142
Table 2.11 shows the format used in tables 2.12 to 2.17, which list instruction codes, operation,
and execution states in order by classification.
Execu-
tion
Instruction Instruction Code Operation Cycles T Bit
MOV #imm,Rn 1110nnnniiiiiiii #imm → Sign extension → 1 —
Rn
MOV.W @(disp,PC),Rn 1001nnnndddddddd (disp × 2 + PC) → Sign 1 —
extension → Rn
MOV.L @(disp,PC),Rn 1101nnnndddddddd (disp × 4 + PC) → Rn 1 —
MOV Rm,Rn 0110nnnnmmmm0011 Rm → Rn 1 —
MOV.B Rm,@Rn 0010nnnnmmmm0000 Rm → (Rn) 1 —
MOV.W Rm,@Rn 0010nnnnmmmm0001 Rm → (Rn) 1 —
MOV.L Rm,@Rn 0010nnnnmmmm0010 Rm → (Rn) 1 —
MOV.B @Rm,Rn 0110nnnnmmmm0000 (Rm) → Sign extension → 1 —
Rn
MOV.W @Rm,Rn 0110nnnnmmmm0001 (Rm) → Sign extension → 1 —
Rn
MOV.L @Rm,Rn 0110nnnnmmmm0010 (Rm) → Rn 1 —
MOV.B Rm,@–Rn 0010nnnnmmmm0100 Rn–1 → Rn, Rm → (Rn) 1 —
MOV.W Rm,@–Rn 0010nnnnmmmm0101 Rn–2 → Rn, Rm → (Rn) 1 —
MOV.L Rm,@–Rn 0010nnnnmmmm0110 Rn–4 → Rn, Rm → (Rn) 1 —
MOV.B @Rm+,Rn 0110nnnnmmmm0100 (Rm) → Sign extension → 1 —
Rn,Rm + 1 → Rm
MOV.W @Rm+,Rn 0110nnnnmmmm0101 (Rm) → Sign extension → 1 —
Rn,Rm + 2 → Rm
MOV.L @Rm+,Rn 0110nnnnmmmm0110 (Rm) → Rn,Rm + 4 → Rm 1 —
MOV.B R0,@(disp,Rn) 10000000nnnndddd R0 → (disp + Rn) 1 —
MOV.W R0,@(disp,Rn) 10000001nnnndddd R0 → (disp × 2 + Rn) 1 —
MOV.L Rm,@(disp,Rn) 0001nnnnmmmmdddd Rm → (disp × 4 + Rn) 1 —
MOV.B @(disp,Rm),R0 10000100mmmmdddd (disp + Rm) → Sign 1 —
extension → R0
MOV.W @(disp,Rm),R0 10000101mmmmdddd (disp × 2 + Rm) → Sign 1 —
extension → R0
MOV.L @(disp,Rm),Rn 0101nnnnmmmmdddd (disp × 4 + Rm) → Rn 1 —
MOV.B Rm,@(R0,Rn) 0000nnnnmmmm0100 Rm → (R0 + Rn) 1 —
Execu-
tion
Instruction Instruction Code Operation Cycles T Bit
MOV.W Rm,@(R0,Rn) 0000nnnnmmmm0101 Rm → (R0 + Rn) 1 —
MOV.L Rm,@(R0,Rn) 0000nnnnmmmm0110 Rm → (R0 + Rn) 1 —
MOV.B @(R0,Rm),Rn 0000nnnnmmmm1100 (R0 + Rm) → Sign 1 —
extension → Rn
MOV.W @(R0,Rm),Rn 0000nnnnmmmm1101 (R0 + Rm) → Sign 1 —
extension → Rn
MOV.L @(R0,Rm),Rn 0000nnnnmmmm1110 (R0 + Rm) → Rn 1 —
MOV.B R0,@(disp,GBR) 11000000dddddddd R0 → (disp + GBR) 1 —
MOV.W R0,@(disp,GBR) 11000001dddddddd R0 → (disp × 2 + GBR) 1 —
MOV.L R0,@(disp,GBR) 11000010dddddddd R0 → (disp × 4 + GBR) 1 —
MOV.B @(disp,GBR),R0 11000100dddddddd (disp + GBR) → Sign 1 —
extension → R0
MOV.W @(disp,GBR),R0 11000101dddddddd (disp × 2 + GBR) → Sign 1 —
extension → R0
MOV.L @(disp,GBR),R0 11000110dddddddd (disp × 4 + GBR) → R0 1 —
MOVA @(disp,PC),R0 11000111dddddddd disp × 4 + PC → R0 1 —
MOVT Rn 0000nnnn00101001 T → Rn 1 —
SWAP.B Rm,Rn 0110nnnnmmmm1000 Rm → Swap the bottom two 1 —
bytes → Rn
SWAP.W Rm,Rn 0110nnnnmmmm1001 Rm → Swap two 1 —
consecutive words → Rn
XTRCT Rm,Rn 0010nnnnmmmm1101 Rm: Middle 32 bits of 1 —
Rn → Rn
Execu-
tion
Instruction Instruction Code Operation Cycles T Bit
ADD Rm,Rn 0011nnnnmmmm1100 Rn + Rm → Rn 1 —
ADD #imm,Rn 0111nnnniiiiiiii Rn + imm → Rn 1 —
ADDC Rm,Rn 0011nnnnmmmm1110 Rn + Rm + T → Rn, 1 Carry
Carry → T
ADDV Rm,Rn 0011nnnnmmmm1111 Rn + Rm → Rn, 1 Overflow
Overflow → T
CMP/EQ #imm,R0 10001000iiiiiiii If R0 = imm, 1 → T 1 Comparison
result
CMP/EQ Rm,Rn 0011nnnnmmmm0000 If Rn = Rm, 1 → T 1 Comparison
result
CMP/HS Rm,Rn 0011nnnnmmmm0010 If Rn≥Rm with 1 Comparison
unsigned data, 1 → T result
CMP/GE Rm,Rn 0011nnnnmmmm0011 If Rn ≥ Rm with signed 1 Comparison
data, 1 → T result
CMP/HI Rm,Rn 0011nnnnmmmm0110 If Rn > Rm with 1 Comparison
unsigned data, 1 → T result
CMP/GT Rm,Rn 0011nnnnmmmm0111 If Rn > Rm with signed 1 Comparison
data, 1 → T result
CMP/PL Rn 0100nnnn00010101 If Rn > 0, 1 → T 1 Comparison
result
CMP/PZ Rn 0100nnnn00010001 If Rn ≥ 0, 1 → T 1 Comparison
result
CMP/STR Rm,Rn 0010nnnnmmmm1100 If Rn and Rm have 1 Comparison
an equivalent byte, result
1→T
DIV1 Rm,Rn 0011nnnnmmmm0100 Single-step division 1 Calculation
(Rn/Rm) result
DIV0S Rm,Rn 0010nnnnmmmm0111 MSB of Rn → Q, MSB 1 Calculation
of Rm → M, M ^ Q → T result
DIV0U 0000000000011001 0 → M/Q/T 1 0
Execu-
tion
Instruction Instruction Code Operation Cycles T Bit
DMULS.L Rm,Rn 0011nnnnmmmm1101 Signed operation of 2 to 4* —
Rn × Rm → MACH,
MACL 32 × 32 → 64 bit
DMULU.L Rm,Rn 0011nnnnmmmm0101 Unsigned operation of 2 to 4* —
Rn × Rm → MACH,
MACL 32 × 32 → 64 bit
DT Rn 0100nnnn00010000 Rn – 1 → Rn, when Rn 1 Comparison
is 0, 1 → T. When Rn result
is nonzero, 0 → T
EXTS.B Rm,Rn 0110nnnnmmmm1110 A byte in Rm is sign- 1 —
extended → Rn
EXTS.W Rm,Rn 0110nnnnmmmm1111 A word in Rm is sign- 1 —
extended → Rn
EXTU.B Rm,Rn 0110nnnnmmmm1100 A byte in Rm is zero- 1 —
extended → Rn
EXTU.W Rm,Rn 0110nnnnmmmm1101 A word in Rm is zero- 1 —
extended → Rn
MAC.L @Rm+,@Rn+ 0000nnnnmmmm1111 Signed operation of 3/ —
(Rn) × (Rm) + MAC → (2 to 4)*
MAC 32 × 32 + 64 →
64 bit
MAC.W @Rm+,@Rn+ 0100nnnnmmmm1111 Signed operation of 3/(2)* —
(Rn) × (Rm) + MAC →
MAC 16 × 16 + 64 →
64 bit
MUL.L Rm,Rn 0000nnnnmmmm0111 Rn × Rm → MACL, 2 to 4* —
32 × 32 → 32 bit
MULS.W Rm,Rn 0010nnnnmmmm1111 Signed operation of 1 to 3* —
Rn × Rm → MAC
16 × 16 → 32 bit
MULU.W Rm,Rn 0010nnnnmmmm1110 Unsigned operation of 1 to 3* —
Rn × Rm → MAC
16 × 16 → 32 bit
NEG Rm,Rn 0110nnnnmmmm1011 0–Rm → Rn 1 —
NEGC Rm,Rn 0110nnnnmmmm1010 0–Rm–T → Rn, Borrow 1 Borrow
→T
Execu-
tion
Instruction Instruction Code Operation Cycles T Bit
SUB Rm,Rn 0011nnnnmmmm1000 Rn–Rm → Rn 1 —
SUBC Rm,Rn 0011nnnnmmmm1010 Rn–Rm–T → Rn, 1 Borrow
Borrow → T
SUBV Rm,Rn 0011nnnnmmmm1011 Rn–Rm → Rn, 1 Overflow
Underflow → T
Note: * The normal minimum number of execution cycles. (The number in parentheses is the
number of cycles when there is contention with following instructions.)
Execu-
tion
Instruction Instruction Code Operation Cycles T Bit
AND Rm,Rn 0010nnnnmmmm1001 Rn & Rm → Rn 1 —
AND #imm,R0 11001001iiiiiiii R0 & imm → R0 1 —
AND.B #imm,@(R0,GBR) 11001101iiiiiiii (R0 + GBR) & imm → 3 —
(R0 + GBR)
NOT Rm,Rn 0110nnnnmmmm0111 ~Rm → Rn 1 —
OR Rm,Rn 0010nnnnmmmm1011 Rn | Rm → Rn 1 —
OR #imm,R0 11001011iiiiiiii R0 | imm → R0 1 —
OR.B #imm,@(R0,GBR) 11001111iiiiiiii (R0 + GBR) | imm → 3 —
(R0 + GBR)
TAS.B @Rn 0100nnnn00011011 If (Rn) is 0, 1 → T; 1 → 4 Test
MSB of (Rn)* result
TST Rm,Rn 0010nnnnmmmm1000 Rn & Rm; if the result is 1 Test
0, 1 → T result
TST #imm,R0 11001000iiiiiiii R0 & imm; if the result is 1 Test
0, 1 → T result
TST.B #imm,@(R0,GBR) 11001100iiiiiiii (R0 + GBR) & imm; if 3 Test
the result is 0, 1 → T result
XOR Rm,Rn 0010nnnnmmmm1010 Rn ^ Rm → Rn 1 —
XOR #imm,R0 11001010iiiiiiii R0 ^ imm → R0 1 —
XOR.B #imm,@(R0,GBR) 11001110iiiiiiii (R0 + GBR) ^ imm → 3 —
(R0 + GBR)
Note: * The on-chip DMAC bus cycles are not inserted between the read and write cycles of
TAS instruction execution. However, bus release due to BREQ is carried out.
Execu-
tion
Instruction Instruction Code Operation Cycles T Bit
ROTL Rn 0100nnnn00000100 T ← Rn ← MSB 1 MSB
ROTR Rn 0100nnnn00000101 LSB → Rn → T 1 LSB
ROTCL Rn 0100nnnn00100100 T ← Rn ← T 1 MSB
ROTCR Rn 0100nnnn00100101 T → Rn → T 1 LSB
SHAL Rn 0100nnnn00100000 T ← Rn ← 0 1 MSB
SHAR Rn 0100nnnn00100001 MSB → Rn → T 1 LSB
SHLL Rn 0100nnnn00000000 T ← Rn ← 0 1 MSB
SHLR Rn 0100nnnn00000001 0 → Rn → T 1 LSB
SHLL2 Rn 0100nnnn00001000 Rn<<2 → Rn 1 —
SHLR2 Rn 0100nnnn00001001 Rn>>2 → Rn 1 —
SHLL8 Rn 0100nnnn00011000 Rn<<8 → Rn 1 —
SHLR8 Rn 0100nnnn00011001 Rn>>8 → Rn 1 —
SHLL16 Rn 0100nnnn00101000 Rn<<16 → Rn 1 —
SHLR16 Rn 0100nnnn00101001 Rn>>16 → Rn 1 —
Exec.
Instruction Instruction Code Operation Cycles T Bit
BF label 10001011dddddddd If T = 0, disp × 2 + PC → PC; if T = 3/1* —
1, nop
BF/S label 10001111dddddddd Delayed branch, if T = 0, disp × 2 + 3/1* —
PC → PC; if T = 1, nop
BT label 10001001dddddddd If T = 1, disp × 2 + PC → PC; if T = 3/1* —
0, nop
BT/S label 10001101dddddddd Delayed branch, if T = 1, disp × 2 + 2/1* —
PC → PC; if T = 0, nop
BRA label 1010dddddddddddd Delayed branch, disp × 2 + PC → 2 —
PC
BRAF Rm 0000mmmm00100011 Delayed branch, Rm + PC → PC 2 —
BSR label 1011dddddddddddd Delayed branch, PC → PR, disp × 2 2 —
+ PC → PC
BSRF Rm 0000mmmm00000011 Delayed branch, PC → PR, 2 —
Rm + PC → PC
JMP @Rm 0100mmmm00101011 Delayed branch, Rm → PC 2 —
JSR @Rm 0100mmmm00001011 Delayed branch, PC → PR, 2 —
Rm → PC
RTS 0000000000001011 Delayed branch, PR → PC 2 —
Note: * One state when it does not branch.
Exec.
Instruction Instruction Code Operation Cycles T Bit
CLRT 0000000000001000 0→T 1 0
CLRMAC 0000000000101000 0 → MACH, MACL 1 —
LDC Rm,SR 0100mmmm00001110 Rm → SR 1 LSB
LDC Rm,GBR 0100mmmm00011110 Rm → GBR 1 —
LDC Rm,VBR 0100mmmm00101110 Rm → VBR 1 —
LDC.L @Rm+,SR 0100mmmm00000111 (Rm) → SR, Rm + 4 → Rm 3 LSB
LDC.L @Rm+,GBR 0100mmmm00010111 (Rm) → GBR, Rm + 4 → Rm 3 —
LDC.L @Rm+,VBR 0100mmmm00100111 (Rm) → VBR, Rm + 4 → Rm 3 —
LDS Rm,MACH 0100mmmm00001010 Rm → MACH 1 —
LDS Rm,MACL 0100mmmm00011010 Rm → MACL 1 —
LDS Rm,PR 0100mmmm00101010 Rm → PR 1 —
LDS.L @Rm+,MACH 0100mmmm00000110 (Rm) → MACH, Rm + 4 → Rm 1 —
LDS.L @Rm+,MACL 0100mmmm00010110 (Rm) → MACL, Rm + 4 → Rm 1 —
LDS.L @Rm+,PR 0100mmmm00100110 (Rm) → PR, Rm + 4 → Rm 1 —
NOP 0000000000001001 No operation 1 —
RTE 0000000000101011 Delayed branch, stack area 4 —
→ PC/SR
SETT 0000000000011000 1→T 1 1
SLEEP 0000000000011011 Sleep 3* —
STC SR,Rn 0000nnnn00000010 SR → Rn 1 —
STC GBR,Rn 0000nnnn00010010 GBR → Rn 1 —
STC VBR,Rn 0000nnnn00100010 VBR → Rn 1 —
STC.L SR,@–Rn 0100nnnn00000011 Rn–4 → Rn, SR → (Rn) 2 —
STC.L GBR,@–Rn 0100nnnn00010011 Rn–4 → Rn, GBR → (Rn) 2 —
STC.L VBR,@–Rn 0100nnnn00100011 Rn–4 → Rn, BR → (Rn) 2 —
STS MACH,Rn 0000nnnn00001010 MACH → Rn 1 —
STS MACL,Rn 0000nnnn00011010 MACL → Rn 1 —
STS PR,Rn 0000nnnn00101010 PR → Rn 1 —
Exec.
Instruction Instruction Code Operation Cycles T Bit
STS.L MACH,@–Rn 0100nnnn00000010 Rn–4 → Rn, MACH → (Rn) 1 —
STS.L MACL,@–Rn 0100nnnn00010010 Rn–4 → Rn, MACL → (Rn) 1 —
STS.L PR,@–Rn 0100nnnn00100010 Rn–4 → Rn, PR → (Rn) 1 —
TRAPA #imm 11000011iiiiiiii PC/SR → stack area, (imm) 8 —
→ PC
Note: * The number of execution cycles before the chip enters sleep mode: The execution
cycles shown in the table are minimums. The actual number of cycles may be
increased when (1) contention occurs between instruction fetches and data access, or
(2) when the destination register of the load instruction (memory → register) and the
register used by the next instruction are the same.
The CPU has five processing states: reset, exception processing, bus release, program execution
and power-down. Figure 2.6 shows the transitions between the states.
RES = 0
HSTBY = 1
Power-on reset state
RES = 1
Bus request
cleared
Bus request NMI interrupt
generated source occurs
Exception Exception
Bus release state processing processing
source occurs ends
Power-down state
From any state when
RES = 0 and HSTBY = 0
Reset State: The CPU resets in the reset state. When the RES pin level goes low, a power-on reset
results. When the RES pin is high and MRES is low, a manual reset will occur.
Exception Processing State: The exception processing state is a transient state that occurs when
exception processing sources such as resets or interrupts alter the CPU’s processing state flow.
For a reset, the initial values of the program counter (PC) (execution start address) and stack
pointer (SP) are fetched from the exception processing vector table and stored; the CPU then
branches to the execution start address and execution of the program begins.
For an interrupt, the stack pointer (SP) is accessed and the program counter (PC) and status
register (SR) are saved to the stack area. The exception service routine start address is fetched
from the exception processing vector table; the CPU then branches to that address and the program
starts executing, thereby entering the program execution state.
Program Execution State: In the program execution state, the CPU sequentially executes the
program.
Power-Down State: In the power-down state, the CPU operation halts and power consumption
declines. The SLEEP instruction places the CPU in the sleep mode or the software standby mode.
This state has two modes: sleep mode and standby mode.
Bus Release State: In the bus release state, the CPU releases access rights to the bus to the device
that has requested them.
Pin Settings
Operating On-Chip Area 0
Mode No. FWE MD3 MD2 MD1 MD0 Mode Name ROM Bus Width
Mode 0 0 * * 0 0 MCU expanded mode Disabled 8 bits
Mode 1 0 0 1 16 bits
Mode 2 0 1 0 Enabled Set by BCR1
Mode 3 0 1 1 MCU single-chip mode Enabled —
Mode 16 1 0 0 Boot mode Enabled Set by BCR1
Mode 17 1 0 1 —
Mode 18 1 1 0 User program mode Enabled Set by BCR1
Mode 19 1 1 1 —
Mode 13 0/1 1 1 0 1 Writer mode
Note: * Pins MD3 and MD2 set the clock operating mode. For details of the clock mode
settings, see section 4.2, Clock Operating Modes.
There are two normal operating modes: single-chip mode and expanded mode.
Modes in which the flash memory can be programmed are boot mode and user program mode (the
two on-board programming modes) and writer mode in which programming is performed with an
EPROM programmer (a type which supports programming of this device).
4.1 Overview
The clock pulse generator (CPG) supplies clock pulses inside the SH7050 series chip and to
external devices. The SH7050 series CPG consists of an oscillator circuit and a PLL multiplier
circuit. There are two methods of generating a clock with the CPG: by connecting a crystal
resonator, or by inputting an external clock. The oscillator circuit oscillates at the same frequency
as the input clock. A chip operating frequency of 1, 2, or 4 times the oscillator frequency can be
selected by means of the PLL multiplier circuit.
The CPG is halted in software standby mode and hardware standby mode.
CPG
EXTAL
Oscillator circuit
XTAL
PLLCAP f×4
Frequency
Frequency divider circuit
MD3 division
selection f×2
MD2 circuit
Frequency
divider circuit
f×1
CK
(system clock)
Internal clock
The pins relating to the clock pulse generator are shown in table 4.1.
Clock mode selection is possible in operating modes 0 to 3 and 16 to 19. In this case, do not set
both the MD3 and MD2 pin to 1. In programmer mode, the clock operating mode cannot be
changed.
The relationship between the mode pins and the clock operating mode is shown in table 4.2.
For the chip operating frequency, a frequency of 1, 2, or 4 times the input frequency can be
selected as the internal clock by means of the on-chip PLL circuit. The system clock (CK pin)
output frequency is the same as that of the internal clock.
Rev. 5.00 Jan 06, 2006 page 55 of 818
REJ09B0273-0500
Section 4 Clock Pulse Generator (CPG)
The MD3 and MD2 pins should not be changed while the chip is operating, as normal operation
will not be possible in this case.
Circuit Configuration: Figure 4.2 shows the example of connecting a crystal resonator. Use the
damping resistance (Rd) shown in table 4.3. An AT-cut parallel-resonance type crystal resonator
should be used. Load capacitors (CL1, CL2) must be connected as shown in the figure.
The clock pulses generated by the crystal resonator and internal oscillator are sent to the PLL
multiplier circuit, where a multiplied frequency is selected and supplied inside the SH7050 chip
and to external devices.
The crystal manufacturer should be consulted concerning the compatibility between the crystal
and the chip.
CL2
EXTAL
CL1
XTAL
Rd
Frequency (MHz)
Parameter 4 8 10
Rd (Ω) 500 200 0
Crystal Oscillator: Figure 4.3 shows an equivalent circuit of the crystal oscillator. Use a crystal
oscillator with the characteristics listed in table 4.4.
L CL Rs
EXTAL XTAL
C0
Frequency (MHz)
Parameter 4 8 10
Rs max (Ω) 120 80 60
C0 max (pF) 7 7 7
An example of external clock input connection is shown in figure 4.4. When the external clock is
stopped in standby mode, ensure that it goes high.
When the XTAL pin is placed in the open state, the parasitic capacitance should be 10 pF or less.
Even when an external clock is input, provide for a wait of at least the oscillation settling time
when powering on or exiting standby mode in order to secure the PLL settling time.
Open XTAL
• To prevent induction from interfering with correct oscillation, do not route any signal lines
near the oscillator circuitry.
• When designing the board, place the crystal oscillator and its load capacitors as close as
possible to the XTAL and EXTAL pins.
Figures 4.5 show the precautions regarding oscillator block board settings.
Crossing of signal
lines prohibited
CL1
XTAL
CL2
EXTAL
PLL Oscillation Power Supply: Place oscillation stabilization capacitor C1 and resistor R1 close
to the PLL and CAP pin, and ensure that no other signal lines cross this line. Supply the C1
ground from PLLVSS.
Separate PLLVCC and PLLVSS from the other VCC and VSS lines at the board power supply source,
and be sure to insert bypass capacitors CPB and CB close to the pins.
R1 C1
PLLCAP
Rp
PLLVCC
CPB
PLLVSS
VCC
CB
VSS
Recommended values
CPB, CB: 0.1 µF
Rp: 200 Ω
R1: 3 kΩ
C1: 470 pF (laminated ceramic)
PLLVSS
PLLCAP
PLLVCC
EXTAL
MD3
XTAL
VSS
5.1 Overview
Exception processing is started by four sources: resets, address errors, interrupts and instructions
and have the priority shown in table 5.1. When several exception processing sources occur at once,
they are processed according to the priority shown.
Notes: 1. Delayed branch instructions: JMP, JSR, BRA, BSR, RTS, RTE, BF/S, BT/S, BSRF,
BRAF.
2. Instructions that rewrite the PC: JMP, JSR, BRA, BSR, RTS, RTE, BT, BF, TRAPA,
BF/S, BT/S, BSRF, BRAF.
The exception processing sources are detected and begin processing according to the timing
shown in table 5.2.
Table 5.2 Timing of Exception Source Detection and the Start of Exception Processing
Before exception processing begins running, the exception processing vector table must be set in
memory. The exception processing vector table stores the start addresses of exception service
routines. (The reset exception processing table holds the initial values of PC and SP.)
All exception sources are given different vector numbers and vector table address offsets, from
which the vector table addresses are calculated. During exception processing, the start addresses of
the exception service routines are fetched from the exception processing vector table, which
indicated by this vector table address.
Table 5.3 shows the vector numbers and vector table address offsets. Table 5.4 shows how vector
table addresses are calculated.
Vector
Exception Sources Numbers Vector Table Address Offset
Power-on reset PC 0 H'00000000–H'00000003
SP 1 H'00000004–H'00000007
(Reserved by system) 2 H'00000008–H'0000000B
(Reserved by system) 3 H'0000000C–H'0000000F
General illegal instruction 4 H'00000010–H'00000013
(Reserved by system) 5 H'00000014–H'00000017
Slot illegal instruction 6 H'00000018–H'0000001B
(Reserved by system) 7 H'0000001C–H'0000001F
(Reserved by system) 8 H'00000020–H'00000023
CPU address error 9 H'00000024–H'00000027
DMAC address error 10 H'00000028–H'0000002B
Interrupts NMI 11 H'0000002C–H'0000002F
User break 12 H'00000030–H'00000033
(Reserved by system) 13 H'00000034–H'00000037
: :
31 H'0000007C–H'0000007F
Trap instruction (user vector) 32 H'00000080–H'00000083
: :
63 H'000000FC–H'000000FF
Vector
Exception Sources Numbers Vector Table Address Offset
Interrupts IRQ0 64 H'00000100–H'00000103
IRQ1 65 H'00000104–H'00000107
IRQ2 66 H'00000108–H'0000010B
IRQ3 67 H'0000010C–H'0000010F
IRQ4 68 H'00000110–H'00000113
IRQ5 69 H'00000114–H'00000117
IRQ6 70 H'00000118–H'0000011B
IRQ7 71 H'0000011C–H'0000011F
On-chip peripheral module* 72 H'00000120–H'00000124
: :
255 H'000003FC–H'000003FF
Note: * The vector numbers and vector table address offsets for each on-chip peripheral
module interrupt are given in section 6, Interrupt Controller, and table 6.3, Interrupt
Exception Processing Vectors and Priorities.
5.2 Resets
When the RES pin is driven low, the LSI does a power-on reset. To reliably reset the LSI, the RES
pin should be kept at low for at least the duration of the oscillation settling time when applying
power or when in standby mode (when the clock circuit is halted) or at least 20 tcyc (when the
clock circuit is running). During power-on reset, CPU internal status and all registers of on-chip
peripheral modules are initialized. See Appendix B, Pin Status, for the status of individual pins
during the power-on reset status.
In the power-on reset status, power-on reset exception processing starts when the RES pin is first
driven low for a set period of time and then returned to high. The CPU will then operate as
follows:
1. The initial value (execution start address) of the program counter (PC) is fetched from the
exception processing vector table.
2. The initial value of the stack pointer (SP) is fetched from the exception processing vector table.
3. The vector base register (VBR) is cleared to H'00000000 and the interrupt mask bits (I3–I0) of
the status register (SR) are set to H'F (1111).
4. The values fetched from the exception processing vector table are set in the program counter
(PC) and SP and the program begins executing.
Be certain to always perform power-on reset processing when turning the system power on.
Address errors occur when instructions are fetched or data read or written, as shown in table 5.5.
Bus Cycle
Bus
Type Master Bus Cycle Description Address Errors
Instruction CPU Instruction fetched from even address None (normal)
fetch Instruction fetched from odd address Address error occurs
Instruction fetched from other than on-chip None (normal)
peripheral module space*
Instruction fetched from on-chip peripheral Address error occurs
module space*
Instruction fetched from external memory space Address error occurs
when in single chip mode
Data CPU or Word data accessed from even address None (normal)
read/write DMAC Word data accessed from odd address Address error occurs
Longword data accessed from a longword None (normal)
boundary
Longword data accessed from other than a Address error occurs
long-word boundary
Byte or word data accessed in on-chip None (normal)
peripheral module space*
Longword data accessed in 16-bit on-chip None (normal)
peripheral module space*
Longword data accessed in 8-bit on-chip Address error occurs
peripheral module space*
External memory space accessed when in Address error occurs
single chip mode
Note: * See section 8, Bus State Controller.
When an address error occurs, the bus cycle in which the address error occurred ends. When the
executing instruction then finishes, address error exception processing starts up. The CPU operates
as follows:
5.4 Interrupts
Table 5.6 shows the sources that start up interrupt exception processing. These are divided into
NMI, user breaks, IRQ and on-chip peripheral modules.
Number of
Type Request Source Sources
NMI NMI pin (external input) 1
User break User break controller 1
IRQ IRQ0–IRQ7 (external input) 8
On-chip peripheral module Direct memory access controller (DMAC) 4
Advanced timer unit (ATU) 44
Compare match timer (CMT) 2
A/D converter 2
Serial communications interface (SCI) 12
Watchdog timer (WDT) 1
Each interrupt source is allocated a different vector number and vector table offset. See section 6,
Interrupt Controller, and table 6.3, Interrupt Exception Processing Vectors and Priorities, for more
information on vector numbers and vector table address offsets.
The interrupt priority order is predetermined. When multiple interrupts occur simultaneously
(overlap), the interrupt controller (INTC) determines their relative priorities and starts up
processing according to the results.
The priority order of interrupts is expressed as priority levels 0–16, with priority 0 the lowest and
priority 16 the highest. The NMI interrupt has priority 16 and cannot be masked, so it is always
accepted. The user break interrupt priority level is 15. IRQ interrupts and on-chip peripheral
module interrupt priority levels can be set freely using the INTC’s interrupt priority level setting
registers A through H (IPRA to IPRH) as shown in table 5.7. The priority levels that can be set are
0–15. Level 16 cannot be set.
When an interrupt occurs, its priority level is ascertained by the interrupt controller (INTC). NMI
is always accepted, but other interrupts are only accepted if they have a priority level higher than
the priority level set in the interrupt mask bits (I3–I0) of the status register (SR).
When an interrupt is accepted, exception processing begins. In interrupt exception processing, the
CPU saves SR and the program counter (PC) to the stack. The priority level value of the accepted
interrupt is written to SR bits I3–I0. For NMI, however, the priority level is 16, but the value set in
I3–I0 is H'F (level 15). Next, the start address of the exception service routine is fetched from the
exception processing vector table for the accepted interrupt, that address is jumped to and
execution begins.
Exception processing can be triggered by trap instructions, general illegal instructions, and illegal
slot instructions, as shown in table 5.8.
When a TRAPA instruction is executed, trap instruction exception processing starts up. The CPU
operates as follows:
An instruction placed immediately after a delayed branch instruction is said to be placed in a delay
slot. When the instruction placed in the delay slot is undefined code, illegal slot exception
processing starts up when that undefined code is decoded. Illegal slot exception processing also
starts up when an instruction that rewrites the program counter (PC) is placed in a delay slot. The
processing starts when the instruction is decoded. The CPU handles an illegal slot instruction as
follows:
When undefined code placed anywhere other than immediately after a delayed branch instruction
(i.e., in a delay slot) is decoded, general illegal instruction exception processing starts up. The
CPU handles general illegal instructions the same as illegal slot instructions. Unlike processing of
illegal slot instructions, however, the program counter value stored is the start address of the
undefined code.
Exception Source
Point of Occurrence Address Error Interrupt
Immediately after a delayed branch instruction*
1
Not accepted Not accepted
Immediately after an interrupt-disabled instruction*
2
Accepted Not accepted
Notes: 1. Delayed branch instructions: JMP, JSR, BRA, BSR, RTS, RTE, BF/S, BT/S, BSRF,
BRAF
2. Interrupt-disabled instructions: LDC, LDC.L, STC, STC.L, LDS, LDS.L, STS, STS.L
When an instruction placed immediately after a delayed branch instruction (delay slot) is decoded,
neither address errors nor interrupts are accepted. The delayed branch instruction and the
instruction located immediately after it (delay slot) are always executed consecutively, so no
exception processing occurs during this period.
SR 32 bits
Trap instruction
Address of instruction
SP after TRAPA instruction 32 bits
SR 32 bits
SR 32 bits
Interrupt
Address of instruction
SP after executed instruction 32 bits
SR 32 bits
SR 32 bits
The value of the stack pointer must always be a multiple of four. If it is not, an address error will
occur when the stack is accessed during exception processing.
The value of the vector base register must always be a multiple of four. If it is not, an address error
will occur when the stack is accessed during exception processing.
When the stack pointer is not a multiple of four, an address error will occur during stacking of the
exception processing (interrupts, etc.) and address error exception processing will start up as soon
as the first exception processing is ended. Address errors will then also occur in the stacking for
this address error exception processing. To ensure that address error exception processing does not
go into an endless loop, no address errors are accepted at that point. This allows program control
to be shifted to the address error exception service routine and enables error processing.
When an address error occurs during exception processing stacking, the stacking bus cycle (write)
is executed. During stacking of the status register (SR) and program counter (PC), the SP is –4 for
both, so the value of SP will not be a multiple of four after the stacking either. The address value
output during stacking is the SP value, so the address where the error occurred is itself output.
This means the write data stacked will be undefined.
6.1 Overview
The interrupt controller (INTC) ascertains the priority of interrupt sources and controls interrupt
requests to the CPU. The INTC has registers for setting the priority of each interrupt which can be
used by the user to order the priorities in which the interrupt requests are processed.
6.1.1 Features
• 16 levels of interrupt priority: By setting the eight interrupt-priority level registers, the
priorities of IRQ interrupts and on-chip peripheral module interrupts can be set in 16 levels for
different request sources.
• NMI noise canceler function: NMI input level bits indicate the NMI pin status. By reading
these bits with the interrupt exception service routine, the pin status can be confirmed, enabling
it to be used as a noise canceler.
• Notification of interrupt occurrence can be reported externally (IRQOUT pin). For example, it
is possible to request bus rights if an external bus master is informed that a peripheral module
interrupt has occurred when the LSI has released the bus rights.
IRQOUT
NMI
IRQ0
IRQ1
IRQ2
Input CPU/ Priority
IRQ3 control DMAC ranking
IRQ4 request judg- Com-
IRQ5 judg- ment parator
Interrupt
IRQ6 ment request
IRQ7
SR
(Interrupt request) I3 I2 I1 I0
UBC
(Interrupt request)
DMAC CPU
(Interrupt request)
ATU
(Interrupt request)
CMT
(Interrupt request)
SCI
(Interrupt request)
A/D
(Interrupt request)
WDT
DTER
ISR
IPRA–IPRH
Internal bus
Bus
Module bus
interface
INTC
UBC: User break controller ICR: Interrupt control register
DMAC: Direct memory access controller ISR: IRQ ststus register
CMT: Compare match timer DTER: DTC enable register
SCI: Serial communication interface IPRA–IPRH: Interrupt priority level setting
A/D: A/D converter registers A to H
WDT: Watchdog timer SR: Status register
The INTC has the 10 registers shown in table 6.2. These registers set the priority of the interrupts
and control external interrupt input signal detection.
The NMI interrupt has priority 16 and is always accepted. Input at the NMI pin is detected by
edge. Use the NMI edge select bit (NMIE) in the interrupt control register (ICR) to select either
the rising or falling edge. NMI interrupt exception processing sets the interrupt mask level bits
(I3–I0) in the status register (SR) to level 15.
A user break interrupt has a priority of level 15, and occurs when the break condition set in the
user break controller (UBC) is satisfied. User break interrupt requests are detected by edge and are
held until accepted. User break interrupt exception processing sets the interrupt mask level bits
(I3–I0) in the status register (SR) to level 15. For more information about the user break interrupt,
see Section 7, User Break Controller.
IRQ interrupts are requested by input from pins IRQ0–IRQ7. Set the IRQ sense select bits
(IRQ0S–IRQ7S) of the interrupt control register (ICR) to select low level detection or falling edge
detection for each pin. The priority level can be set from 0 to 15 for each pin using the interrupt
priority registers A and B (IPRA–IPRB).
When IRQ interrupts are set to low level detection, an interrupt request signal is sent to the INTC
during the period the IRQ pin is low level. Interrupt request signals are not sent to the INTC when
the IRQ pin becomes high level. Interrupt request levels can be confirmed by reading the IRQ
flags (IRQ0F–IRQ7F) of the IRQ status register (ISR).
When IRQ interrupts are set to falling edge detection, interrupt request signals are sent to the
INTC upon detecting a change on the IRQ pin from high to low level. IRQ interrupt request
detection results are maintained until the interrupt request is accepted. Confirmation that IRQ
interrupt requests have been detected is possible by reading the IRQ flags (IRQ0F–IRQ7F) of the
IRQ status register (ISR), and by writing a 0 after reading a 1, IRQ interrupt request detection
results can be withdrawn.
In IRQ interrupt exception processing, the interrupt mask bits (I3–I0) of the status register (SR)
are set to the priority level value of the accepted IRQ interrupt.
On-chip peripheral module interrupts are interrupts generated by the following on-chip peripheral
modules:
A different interrupt vector is assigned to each interrupt source, so the exception service routine
does not have to decide which interrupt has occurred. Priority levels between 0 and 15 can be
assigned to individual on-chip peripheral modules in interrupt priority registers C–H (IPRC–
IPRH).
On-chip peripheral module interrupt exception processing sets the interrupt mask level bits (I3–I0)
in the status register (SR) to the priority level value of the on-chip peripheral module interrupt that
was accepted.
Table 6.3 lists interrupt sources and their vector numbers, vector table address offsets and interrupt
priorities.
Each interrupt source is allocated a different vector number and vector table address offset. Vector
table addresses are calculated from vector numbers and address offsets. In interrupt exception
processing, the exception service routine start address is fetched from the vector table indicated by
the vector table address. See table 5.4, Calculating Exception Processing Vector Table Addresses.
IRQ interrupts and on-chip peripheral module interrupt priorities can be set freely between 0 and
15 for each pin or module by setting interrupt priority registers A–H (IPRA–IPRH). The ranking
of interrupt sources for IPRC–IPRH, however, must be the order listed under Priority within IPR
Setting Range in table 6.3 and cannot be changed. A power-on reset assigns priority level 0 to IRQ
interrupts and on-chip peripheral module interrupts. If the same priority level is assigned to two or
more interrupt sources and interrupts from those sources occur simultaneously, their priority order
is the default priority order indicated at the right in table 6.3.
Interrupt Vector
Interrupt Priority
Vector Table Priority Corre- within IPR
Vector Address (Initial sponding Setting Default
Interrupt Source No. Offset Value) IPR (Bits) Range Priority
NMI 11 H'0000002C to 16 — — High
H'0000002F ↑
User 12 H'00000030 to 15 — —
break H'00000033
IRQ0 64 H'00000100 to 0 to 15 (0) IPRA —
H'00000103 (15–12)
IRQ1 65 H'00000104 to 0 to 15 (0) IPRA —
H'00000107 (11–8)
IRQ2 66 H'00000108 to 0 to 15 (0) IPRA —
H'0000010B (7–4)
IRQ3 67 H'0000010C to 0 to 15 (0) IPRA —
H'0000010F (3–0)
IRQ4 68 H'00000110 to 0 to 15 (0) IPRB —
H'00000113 (15–12)
IRQ5 69 H'00000114 to 0 to 15 (0) IPRB —
H'00000117 (11–8)
IRQ6 70 H'00000118 to 0 to 15 (0) IPRB —
H'0000011B (7–4)
IRQ7 71 H'0000011C to 0 to 15 (0) IPRB —
H'0000011F (3–0)
DMAC0 DEI0 72 H'00000120 to 0 to 15 (0) IPRC High
H'00000123 (15–12) ↑
DMAC1 DEI1 74 H'00000128 to 0 to 15 (0) ↓
H'0000012B Low
DMAC2 DEI2 76 H'00000130 to 0 to 15 (0) IPRC High
H'00000133 (11–8) ↑
DMAC3 DEI3 78 H'00000138 to 0 to 15 (0) ↓ ↓
H'0000013B Low Low
Interrupt Vector
Interrupt Priority
Vector Table Priority Corre- within IPR
Vector Address (Initial sponding Setting Default
Interrupt Source No. Offset Value) IPR (Bits) Range Priority
ATU0 ATU01 ITV 80 H'00000140 to 0 to 15 (0) IPRC — High
H'00000143 (7–4) ↑
ATU02 ICI0A 84 H'00000150 to 0 to 15 (0) IPRC ↑ 1
H'00000153 (3–0)
ICI0B 85 H'00000154 to 2
H'00000157
ICI0C 86 H'00000158 to 3
H'0000015B
ICI0D 87 H'0000015C to ↓ 4
H'0000015F
ATU03 OVIO 88 H'00000160 to 0 to 15 (0) IPRD —
H'00000163 (15–12)
ATU1 ATU11 IMI1A 92 H'00000170 to 0 to 15 (0) IPRD ↑ 1
H'00000173 (11–8)
IMI1B 93 H'00000174 to 2
H'00000177
IMI1C 94 H'00000178 to ↓ 3
H'0000017B
ATU12 IMI1D 96 H'0000180 to 0 to 15 (0) IPRD ↑ 1
H'00000183 (7–4)
IMI1E 97 H'00000184 to 2
H'00000187
IMI1F 98 H'00000188 to ↓ 3
H'0000018B
ATU13 OV11 100 H'00000190 to 0 to 15 (0) IPRD —
H'00000193 (3–0)
ATU2 IMI2A 104 H'000001A0 to 0 to 15 (0) IPRE ↑ 1
H'000001A3 (15–12)
IMI2B 105 H'000001A4 to 2
H'000001A7
↓
OV12 106 H'000001A8 to ↓ 3 Low
H'000001AB
Interrupt Vector
Interrupt Priority
Vector Table Priority Corre- within IPR
Vector Address (Initial sponding Setting Default
Interrupt Source No. Offset Value) IPR (Bits) Range Priority
ATU3 ATU31 IMI3A 108 H'000001B0 to 0 to 15 (0) IPRE ↑ 1 High
H'000001B3 (11–8) ↑
IMI3B 109 H'000001B4 to 2
H'000001B7
IMI3C 110 H'000001B8 to 3
H'000001BB
IMI3D 111 H'000001BC to ↓ 4
H'000001BF
ATU32 OV13 112 H'000001C0 to 0 to 15 (0) IPRE —
H'000001C3 (7–4)
ATU4 ATU41 IMI4A 116 H'000001D0 to 0 to 15 (0) IPRE ↑ 1
H'000001D3 (3–0)
IMI4B 117 H'000001D4 to 2
H'000001D7
IMI4C 118 H'000001D8 to 3
H'000001DB
IMI4D 119 H'000001DC to ↓ 4
H'000001DF
ATU42 OV14 120 H'000001E0 to 0 to 15 (0) IPRF —
H'000001E3 (15–12)
ATU5 IMI5A 124 H'000001F0 to 0 to 15 (0) IPRF ↑ 1
H'000001F3 (11–8)
IMI5B 125 H'000001F4 to 2
H'000001F7
OV15 126 H'000001F8 to ↓ 3
H'000001FB
ATU6 CMI6 128 H'00000200 to 0 to 15 (0) IPRF ↑ 1
H'00000203 (7–4)
ATU7 CMI7 129 H'00000204 to 2
H'00000207
ATU8 CMI8 130 H'00000208 to 3
H'0000020B
↓
ATU9 CMI9 131 H'0000020C to ↓ 4 Low
H'0000020F
Interrupt Vector
Interrupt Priority
Vector Table Priority Corre- within IPR
Vector Address (Initial sponding Setting Default
Interrupt Source No. Offset Value) IPR (Bits) Range Priority
ATU10 ATU101 OSI10A 132 H'00000210 to 0 to 15 (0) IPRF ↑ 1 High
H'00000213 (3–0) ↑
OSI10B 133 H'00000214 to 2
H'00000217
OSI10C 134 H'00000218 to ↓ 3
H'0000021B
ATU102 OSI10D 136 H'00000220 to 0 to 15 (0) IPRG ↑ 1
H'00000223 (15–12)
OSI10E 137 H'00000224 to 2
H'00000227
OSI10F 138 H'00000228 to ↓ 3
H'0000022B
ATU103 OSI10G 140 H'00000230 to 0 to 15 (0) IPRG ↑ 1
H'00000233 (11–8)
OSI10H 141 H'00000234 to ↓ 2
H'00000237
CMT0 CMTI0 144 H'00000240 to 0 to 15 (0) IPRG ↑ 1
H'00000243 (7–4)
A/D0 ADI0 145 H'00000244 to ↓ 2
H'00000247
CMT1 CMT11 148 H'00000250 to 0 to 15 (0) IPRG ↑ 1
H'00000253 (3–0)
A/D1 ADI1 149 H'00000254 to ↓ 2
H'00000257
SCI0 ERI0 152 H'00000260 to 0 to 15 (0) IPRH ↑ 1
H'00000263 (15–12)
RXI0 153 H'00000264 to 2
H'00000267
TXI0 154 H'00000268 to 3
H'0000026B
↓
TEI0 155 H'0000026C to ↓ 4 Low
H'0000026F
Interrupt Vector
Interrupt Priority
Vector Table Priority Corre- within IPR
Vector Address (Initial sponding Setting Default
Interrupt Source No. Offset Value) IPR (Bits) Range Priority
SCI1 ERI1 156 H'00000270 to 0 to 15 (0) IPRH ↑ 1 High
H'00000273 (11–8) ↑
RXI1 157 H'00000274 to 2
H'00000277
TXI1 158 H'00000278 to 3
H'0000027B
TEI1 159 H'0000027C to ↓ 4
H'0000027F
SCI2 ERI2 160 H'00000280 to 0 to 15 (0) IPRH ↑ 1
H'00000283 (7–4)
RXI2 161 H'00000284 to 2
H'00000287
TXI2 162 H'00000288 to 3
H'0000028B
TEI2 163 H'0000028C to ↓ 4
H'0000028F
↓
WDT ITI 164 H'00000290 to 0 to 15 (0) IPRH — Low
H'00000293 (3–0)
Interrupt priority registers A–H (IPRA–IPRH) are 16-bit readable/writable registers that set
priority levels from 0 to 15 for IRQ interrupts and on-chip peripheral module interrupts.
Correspondence between interrupt request sources and each of the IPRA–IPRH bits is shown in
table 6.4.
Bit: 15 14 13 12 11 10 9 8
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bits
Register 15–12 11–8 7–4 3–0
Interrupt priority register A IRQ0 IRQ1 IRQ2 IRQ3
Interrupt priority register B IRQ4 IRQ5 IRQ6 IRQ7
Interrupt priority register C DMAC0, 1 DMAC2, 3 ATU01 ATU02
Interrupt priority register D ATU03 ATU11 ATU12 ATU13
Interrupt priority register E ATU2 ATU31 ATU32 ATU41
Interrupt priority register F ATU42 ATU5 ATU6–9 ATU101
Interrupt priority register G ATU102 ATU103 CMT0, A/D0 CMT1, A/D1
Interrupt priority register H SCI0 SCI1 SCI2 WDT
As indicated in table 6.4, four IRQ pins or groups of 4 on-chip peripheral modules are allocated to
each register. Each of the corresponding interrupt priority ranks are established by setting a value
from H'0 (0000) to H'F (1111) in each of the four-bit groups 15–12, 11–8, 7–4 and 3–0. Interrupt
priority rank becomes level 0 (lowest) by setting H'0, and level 15 (highest) by setting H'F. If
multiple on-chip peripheral modules are assigned to same bit (DMAC0 and DMAC1, DMAC2
and DMAC3, ATU6 to ATU9, CMT0 and A/D0, and CMT1 and A/D1), those multiple modules
are set to the same priority rank.
IPRA–IPRH are initialized to H'0000 by a power-on reset. They are not initialized in standby
mode.
The ICR is a 16-bit register that sets the input signal detection mode of the external interrupt input
pin NMI and IRQ0 –IRQ7 and indicates the input signal level to the NMI pin. A power-on reset
and hardware standby mode initialize ICR but the software standby mode does not.
Bit: 15 14 13 12 11 10 9 8
NMIL — — — — — — NMIE
Initial value: * 0 0 0 0 0 0 0
R/W: R R R R R R R R/W
Bit: 7 6 5 4 3 2 1 0
IRQ0S IRQ1S IRQ2S IRQ3S IRQ4S IRQ5S IRQ6S IRQ7S
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Note: * When NMI input is high: 1; when NMI input is low: 0
Bit 15—NMI Input Level (NMIL): Sets the level of the signal input at the NMI pin. This bit can
be read to determine the NMI pin level. This bit cannot be modified.
Bits 14 to 9—Reserved: These bits always read as 0. The write value should always be 0.
Bits 7 to 0—IRQ0–IRQ7 Sense Select (IRQ0S–IRQ7S): These bits set the IRQ0–IRQ7
interrupt request detection mode.
The ISR is a 16-bit register that indicates the interrupt request status of the external interrupt input
pins IRQ0–IRQ7. When IRQ interrupts are set to edge detection, held interrupt requests can be
withdrawn by writing a 0 to IRQnF after reading an IRQnF = 1.
A power-on reset initializes ISR but the standby mode does not.
Bit: 15 14 13 12 11 10 9 8
— — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
IRQ0F IRQ1F IRQ2F IRQ3F IRQ4F IRQ5F IRQ6F IRQ7F
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bits 15 to 8—Reserved: These bits always read as 0. The write value should always be 0.
Bits 7 to 0—IRQ0–IRQ7 Flags (IRQ0F–IRQ7F): These bits display the IRQ0–IRQ7 interrupt
request status.
Bits 7-0:
IRQ0F–IRQ7F Detection Setting Description
0 Level detection No IRQn interrupt request exists.
Clear conditions: When IRQn input is high level
Edge detection No IRQn interrupt request was detected. (initial value)
Clear conditions:
1. When a 0 is written after reading IRQnF = 1 status
2. When IRQn interrupt exception processing has been
executed
1 Level detection An IRQn interrupt request exists.
Set conditions: When IRQn input is low level
Edge detection An IRQn interrupt request was detected.
Set conditions: When a falling edge occurs at an IRQn
input
IRQnS
(0: level, 1: edge) ISR.IRQnF
level
selector
RESIRQn R
The sequence of interrupt operations is explained below. Figure 6.3 is a flowchart of the
operations.
1. The interrupt request sources send interrupt request signals to the interrupt controller.
2. The interrupt controller selects the highest priority interrupt in the interrupt requests sent,
following the priority levels set in interrupt priority level setting registers A–H (IPRA–IPRH).
Lower-priority interrupts are ignored. They are held pending until interrupt requests designated
as edge-detect type are accepted. For IRQ interrupts, however, withdrawal is possible by
accessing the IRQ status register (ISR). See section 6.2.3, IRQ Interrupts, for details. Interrupts
held pending due to edge detection are cleared by a power-on reset or a manual reset. If two of
these interrupts have the same priority level or if multiple interrupts occur within a single
module, the interrupt with the highest default priority or the highest priority within its IPR
setting range (as indicated in table 6.3) is selected.
3. The interrupt controller compares the priority level of the selected interrupt request with the
interrupt mask bits (I3–I0) in the CPU’s status register (SR). If the request priority level is
equal to or less than the level set in I3–I0, the request is ignored. If the request priority level is
higher than the level in bits I3–I0, the interrupt controller accepts the interrupt and sends an
interrupt request signal to the CPU.
4. When the interrupt controller accepts an interrupt, a low level is output from the IRQOUT pin.
5. The CPU detects the interrupt request sent from the interrupt controller when it decodes the
next instruction to be executed. Instead of executing the decoded instruction, the CPU starts
interrupt exception processing (figure 6.5).
6. SR and PC are saved onto the stack.
7. The priority level of the accepted interrupt is copied to the interrupt mask level bits (I3 to I0) in
the status register (SR).
8. When the accepted interrupt is sensed by level or is from an on-chip peripheral module, a high
level is output from the IRQOUT pin. When the accepted interrupt is sensed by edge, a high
level is output from the IRQOUT pin at the point when the CPU starts interrupt exception
processing instead of instruction execution as noted in (5) above. However, if the interrupt
controller accepts an interrupt with a higher priority than one it is in the midst of accepting, the
IRQOUT pin will remain low level.
9. The CPU reads the start address of the exception service routine from the exception vector
table for the accepted interrupt, jumps to that address, and starts executing the program there.
This jump is not a delay branch.
Program
execution state
No
Interrupt?
Yes
No
NMI?
Yes No
User break?
Yes Level 15 No
interrupt?
IRQOUT = low level*1
Yes
Level 14 No
Save SR to stack interrupt?
Yes I3 to I0 ≤ No
level 14? Yes Level 1
Save PC to stack interrupt?
No Yes I3 to I0 ≤
Copy accept-interrupt level 13? Yes
level to I3 to I0
No Yes I3 to I0 =
IRQOUT = high level*2 level 0?
Reads exception No
vector table
Branches to exception
service routine
Address
4n–4 SR 32 bits
4n
Notes: 1. PC: Start address of the next instruction (return destination instruction)
after the executing instruction
2. Always be certain that SP is a multiple of 4
Number of States
NMI, Peripheral
Item Module IRQ Notes
DMAC active judgment 0 or 1 1 1 state required for interrupt
signals for which DMAC
activation is possible
Compare identified inter- 2 3
rupt priority with SR mask
level
Wait for completion of X (≥ 0) The longest sequence is for
sequence currently being interrupt or address-error
executed by CPU exception processing (X = 4
+ m1 + m2 + m3 + m4). If an
interrupt-masking instruction
follows, however, the time
may be even longer.
Time from start of interrupt 5 + m1 + m2 + m3 Performs the PC and SR
exception processing until saves and vector address
fetch of first instruction of fetch.
exception service routine
starts
Interrupt Total: 7 + m1 + m2 + m3 8 + m1 + m2 + m3
response Minimum: 10 11 0.50 to 0.55 µs at 20 MHz
time
Maximum: 12 + 2 (m1 + m2 + 12 + 2 (m1 + m2 + 0.95 µs at 20 MHz*
m3) + m4 m3) + m4
Note: m1–m4 are the number of states needed for the following memory accesses.
m1: SR save (longword write)
m2: PC save (longword write)
m3: Vector address read (longword read)
m4: Fetch first instruction of interrupt service routine
* When m1 = m2 = m3 = m4 = 1
Interrupt acceptance
5 + m1 + m2 + m3
1 3 3 m1 m2 1 m3 1
IRQ
Instruction (instruction F D E E M M E M E E
replaced by interrupt
exception processing)
Overrun fetch F
Interrupt service routine
F D E
start instruction
Among interrupt sources, those designated as DMAC activating sources are masked and not input
to the INTC. The masking condition is listed below:
Mask condition = DME • (DE0 • source selection 0 + DE1 × source selection 1 + DE2 •
source selection 2 + DE3 • source selection 3)
interrupt source
DMAC
Interrupt request flag
(generated by DMAC)
clear
interrupt request
6.6.1 Handling CPU Interrupt Sources, but Not DMAC Activating Sources
1. Either do not select the DMAC as a source, or clear the DME bit to 0.
2. Activating sources are applied to the CPU when interrupts occur.
3. The CPU clears interrupt sources with its interrupt processing routine and performs the
necessary processing.
6.6.2 Handling DMAC Activating Sources but Not CPU Interrupt Sources
1. Select the DMAC as a source and set the DME bit to 1. CPU interrupt sources are masked
regardless of the interrupt priority level register settings.
2. Activating sources are applied to the DMAC when interrupts occur.
3. The DMAC clears activating sources at the time of data transfer.
7.1 Overview
The user break controller (UBC) provides functions that simplify program debugging. Break
conditions are set in the UBC and a user break interrupt is generated according to the conditions of
the bus cycle generated by the CPU, DMAC, or DTC. This function makes it easy to design an
effective self-monitoring debugger, enabling the chip to easily debug programs without using a
large in-circuit emulator.
7.1.1 Features
Bus
Module bus
interface
Internal bus
UBBR UBAMRH UBARH
UBAMRL UBARL
User break
interrupt Interrupt request
generating
circuit
UBC
Interrupt controller
The UBC has the five registers shown in table 7.1. Break conditions are established using these
registers.
Initial Access
Name Abbr. R/W Value Address* Size
User break address register H UBARH R/W H'0000 H'FFFF8600 8, 16, 32
User break address register L UBARL R/W H'0000 H'FFFF8602 8, 16, 32
User break address mask register H UBAMRH R/W H'0000 H'FFFF8604 8, 16, 32
User break address mask register L UBAMRL R/W H'0000 H'FFFF8606 8, 16, 32
User break bus cycle register UBBR R/W H'0000 H'FFFF8608 8, 16, 32
Note: * In register access, three cycles are required for byte access and word access, and six
cycles for longword access.
UBARH:
Bit: 15 14 13 12 11 10 9 8
UBARH UBA31 UBA30 UBA29 UBA28 UBA27 UBA26 UBA25 UBA24
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
UBARH UBA23 UBA22 UBA21 UBA20 UBA19 UBA18 UBA17 UBA16
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
UBARL:
Bit: 15 14 13 12 11 10 9 8
UBARL UBA15 UBA14 UBA13 UBA12 UBA11 UBA10 UBA9 UBA8
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
UBARL UBA7 UBA6 UBA5 UBA4 UBA3 UBA2 UBA1 UBA0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
The user break address register (UBAR) consists of user break address register H (UBARH) and
user break address register L (UBARL). Both are 16-bit readable/writable registers. UBARH
stores the upper bits (bits 31 to 16) of the address of the break condition, while UBARL stores the
lower bits (bits 15 to 0). UBARH and UBARL are initialized by a power on reset to H'0000. They
are not initialized in software standby mode.
UBARH Bits 15 to 0—User Break Address 31 to 16 (UBA31 to UBA16): These bits store the
upper bit values (bits 31 to 16) of the address of the break condition.
UBARL Bits 15 to 0—User Break Address 15 to 0 (UBA15 to UBA0): These bits store the
lower bit values (bits 15 to 0) of the address of the break condition.
UBAMRH:
Bit: 15 14 13 12 11 10 9 8
UBAMRH UBM31 UBM30 UBM29 UBM28 UBM27 UBM26 UBM25 UBM24
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
UBAMRH UBM23 UBM22 UBM21 UBM20 UBM19 UBM18 UBM17 UBM16
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
UBAMRL:
Bit: 15 14 13 12 11 10 9 8
UBAMRL UBM15 UBM14 UBM13 UBM12 UBM11 UBM10 UBM9 UBM8
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
UBAMRL UBM7 UBM6 UBM5 UBM4 UBM3 UBM2 UBM1 UBM0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
The user break address mask register (UBAMR) consists of user break address mask register H
(UBAMRH) and user break address mask register L (UBAMRL). Both are 16-bit
readable/writable registers. UBAMRH designates whether to mask any of the break address bits
established in the UBARH, and UBAMRL designates whether to mask any of the break address
bits established in the UBARL. UBAMRH and UBAMRL are initialized by a power on reset to
H'0000. They are not initialized in software standby mode.
UBAMRH Bits 15 to 0—User Break Address Mask 31 to 16 (UBM31 to UBM16): These bits
designate whether to mask any of the break address 31 to 16 bits (UBA31 to UBA16) established
in the UBARH.
UBAMRL Bits 15 to 0—User Break Address Mask 15 to 0 (UBM15 to UBM0): These bits
designate whether to mask any of the break address 15 to 0 bits (UBA15 to UBA0) established in
the UBARL.
Bit: 15 14 13 12 11 10 9 8
— — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
CP1 CP0 ID1 ID0 RW1 RW0 SZ1 SZ0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
User break bus cycle register (UBBR) is a 16-bit readable/writable register that selects from
among the following four break conditions:
UBBR is initialized by a power on reset to H'0000. It is not initialized in software standby mode.
Bits 15 to 8—Reserved: These bits always read as 0. The write value should always be 0.
Bits 7 and 6—CPU Cycle/Peripheral Cycle Select (CP1, CP0): These bits designate break
conditions for CPU cycles or peripheral cycles (DMA cycles).
Bits 5 and 4—Instruction Fetch/Data Access Select (ID1, ID0): These bits select whether to
break on instruction fetch and/or data access cycles.
Bits 3 and 2—Read/Write Select (RW1, RW0): These bits select whether to break on read
and/or write cycles.
Bits 1 and 0—Operand Size Select (SZ1, SZ0): These bits select operand size as a break
condition.
7.3 Operation
The flow from setting of break conditions to user break interrupt exception processing is described
below:
1. The user break addresses are set in the user break address register (UBAR), the desired masked
bits in the addresses are set in the user break address mask register (UBAMR) and the breaking
bus cycle type is set in the user break bus cycle register (UBBR). If even one of the three
groups of the UBBR’s CPU cycle/peripheral cycle select bits (CP1, CP0), instruction
fetch/data access select bits (ID1, ID0), and read/write select bits (RW1, RW0) is set to 00 (no
user break interrupt is generated), no user break interrupt will be generated even if all other
conditions are in agreement. When using user break interrupts, always be certain to establish
bit conditions for all of these three groups.
2. The UBC uses the method shown in figure 7.2 to judge whether set conditions have been
fulfilled. When the set conditions are satisfied, the UBC sends a user break interrupt request
signal to the interrupt controller (INTC).
3. The interrupt controller checks the accepted user break interrupt request signal’s priority level.
The user break interrupt has priority level 15, so it is accepted only if the interrupt mask level
in bits I3–I0 in the status register (SR) is 14 or lower. When the I3–I0 bit level is 15, the user
break interrupt cannot be accepted but it is held pending until user break interrupt exception
processing can be carried out. Consequently, user break interrupts within NMI exception
service routines cannot be accepted, since the I3–I0 bit level is 15. However, if the I3–I0 bit
level is changed to 14 or lower at the start of the NMI exception service routine, user break
interrupts become acceptable thereafter. Section 6, Interrupt Controller, describes the handling
of priority levels in greater detail.
4. The INTC sends the user break interrupt request signal to the CPU, which begins user break
interrupt exception processing upon receipt. See Section 6.4, Interrupt Operation, for details on
interrupt exception processing.
UBARH/UBARL UBAMRH/UBAMRL
32
32
Internal address 32
bits 31–0 32 32
CP1 CP0
CPU cycle
DMA cycle
ID1 ID0
Read cycle
Write cycle
SZ1 SZ0
Byte size
Word size
Longword size
On-chip memory (on-chip ROM and/or RAM) is always accessed as 32 bits in 1 bus cycle.
Therefore, 2 instructions can be retrieved in 1 bus cycle when fetching instructions from on-chip
memory. At such times, only 1 bus cycle is generated, but by setting the start addresses of both
instructions in the user break address register (UBAR) it is possible to cause independent breaks.
In other words, when wanting to effect a break using the latter of two addresses retrieved in 1 bus
cycle, set the start address of that instruction in UBAR. The break will occur after execution of the
former instruction.
Break on Instruction Fetch (Before Execution): The program counter (PC) value saved to the
stack in user break interrupt exception processing is the address that matches the break condition.
The user break interrupt is generated before the fetched instruction is executed. If a break
condition is set in an instruction fetch cycle placed immediately after a delayed branch instruction
(delay slot), or on an instruction that follows an interrupt-disabled instruction, however, the user
break interrupt is not accepted immediately, but the break condition establishing instruction is
executed. The user break interrupt is accepted after execution of the instruction that has accepted
the interrupt. In this case, the PC value saved is the start address of the instruction that will be
executed after the instruction that has accepted the interrupt.
Break on Data Access (CPU/Peripheral): The program counter (PC) value is the top address of
the next instruction after the last instruction executed before the user break exception processing
started. When data access (CPU/peripheral) is set as a break condition, the place where the break
will occur cannot be specified exactly. The break will occur at the instruction fetched close to
where the data access that is to receive the break occurs.
A user break interrupt will occur before the instruction at address H'00000404. If it is possible for
the instruction at H'00000402 to accept an interrupt, the user break exception processing will be
executed after execution of that instruction. The instruction at H'00000404 is not executed. The
PC value saved is H'00000404.
A user break interrupt does not occur because the instruction fetch cycle is not a write cycle.
A user break interrupt does not occur because the instruction fetch was performed for an even
address. However, if the first instruction fetch address after the branch is an odd address set by
these conditions, user break interrupt exception processing will be done after address error
exception processing.
A user break interrupt occurs when word data is written into address H'00123456.
A user break interrupt does not occur because the word access was performed on an even address.
A user break interrupt occurs when longword data is read from address H'0076BCDC.
A user break interrupt does not occur because no instruction fetch is performed in the DMA/CTC
cycle.
Two instructions are simultaneously fetched from on-chip memory. If a break condition is set on
the second of these two instructions but the contents of the UBC break condition registers are
changed so as to alter the break condition immediately after the first of the two instructions is
fetched, a user break interrupt will still occur when the second instruction is fetched.
When a conditional branch instruction or TRAPA instruction causes a branch, instructions are
fetched and executed as follows:
2. When branching with a delayed conditional instruction: BT/S and BF/S instructions
Instruction fetch order: Corresponding instruction fetch → next instruction fetch (delay
slot) → overrun fetch of instruction after next → branch destination instruction fetch
Instruction execution order: Corresponding instruction execution → delay slot instruction
execution → branch destination instruction execution
When a conditional branch instruction or TRAPA instruction causes a branch, the branch
destination will be fetched after the next instruction or the one after that does an overrun fetch.
However, because the instruction that is the object of the break first breaks after a definite
instruction fetch and execution, the kind of overrun fetch instructions noted above do not
become objects of a break. If data access breaks are also included with instruction fetch breaks
as break conditions, a break occurs because the instruction overrun fetch is also regarded as
becoming a data break.
If a user break is set for the fetch of a particular instruction, and exception handling with higher
priority than a user break is in contention and is accepted in the decode stage for that instruction
(or the next instruction), user break exception handling may not be performed after completion of
the higher-priority exception handling routine (on return by RTE).
When a branch instruction with no delay slot (including exception handling) jumps to the jump
destination instruction on execution of the branch, a user break will not be generated even if a user
break condition has been set for the first jump destination instruction fetch.
8.1 Overview
The bus state controller (BSC) divides up the address spaces and outputs control for various types
of memory. This enables memories like SRAM, and ROM to be linked directly to the LSI without
external circuitry.
8.1.1 Features
Internal bus
Bus interface
On-chip
memory RAMER
control unit
WCR1
Wait
WAIT
Module bus
control unit
WCR2
BCR1
Area
CS0–CS3
control unit
BCR2
RD
Memory
control unit
WRH, WRL
BSC
The BSC has eight registers. These registers are used to control wait states, bus width, and
interfaces with memories like ROM and SRAM, as well as refresh control. The register
configurations are listed in table 8.2.
All registers are 16 bits. All BSC registers are all initialized by a power-on reset, but are not by a
manual reset. Values are maintained in standby mode.
Figure 8.2 shows the address format used by the SH7050 series.
Output address:
Output from the address pins
CS space selection:
Decoded, outputs CS0 to CS3 when A31 to A24 = 00000000
Space selection:
Not output externally; used to select the type of space
On-chip ROM space or CS0 to CS3 space when 00000000 (H'00)
DRAM space when 00000001 (H'01)
Reserved (do not access) when 00000010 to 11111110 (H'01 to H'FE)
On-chip peripheral module space or on-chip RAM space when 11111111 (H'FF)
• A31 to A24 are used to select the type of space and are not output externally.
• Bits A23 and A22 are decoded and output as chip select signals (CS0 to CS3) for the
corresponding areas when bits A31 to A24 are 00000000.
• A21 to A0 are output externally.
Bit: 15 14 13 12 11 10 9 8
— — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
— — — — A3SZ A2SZ A1SZ A0SZ
Initial value: 0 0 0 0 1 1 1 1
R/W: R R R R R/W R/W R/W R/W
BCR1 is a 16-bit read/write register that specifies the bus size of the CS spaces.
Write bits 15–0 of BCR1 during the initialization stage after a power-on reset, and do not change
the values thereafter. In on-chip ROM effective mode, do not access any of the CS spaces until
after completion of register initialization. In on-chip ROM ineffective mode, do not access any CS
space other than CS0 until after completion of register initialization.
BCR1 is initialized to H'000F by a power-on reset and in hardware standby mode. It is not
initialized in software standby mode.
Bits 15–4—Reserved: These bits always read as 0. The write value should always be 0.
Bit 3—CS3 Space Size Specification (A3SZ): Specifies the CS3 space bus size. A 0 setting
specifies byte (8-bit) size, and a 1 setting specifies word (16-bit) size.
Bit 2—CS2 Space Size Specification (A2SZ): Specifies the CS2 space bus size. A 0 setting
specifies byte (8-bit) size, and a 1 setting specifies word (16-bit) size.
Bit 1—CS1 Space Size Specification (A1SZ): Specifies the CS1 space bus size. A 0 setting
specifies byte (8-bit) size, and a 1 setting specifies word (16-bit) size.
Bit 0—CS0 Space Size Specification (A0SZ): Specifies the CS0 space bus size A 0 setting
specifies byte (8-bit) size, and a 1 setting specifies word (16-bit) size.
Bit: 15 14 13 12 11 10 9 8
IW31 IW30 IW21 IW20 IW11 IW10 IW01 IW00
Initial value: 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
CW3 CW2 CW1 CW0 SW3 SW2 SW1 SW0
Initial value: 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
BCR2 is a 16-bit read/write register that specifies the number of idle cycles and CS signal assert
extension of each CS space.
BCR2 is initialized by a power-on reset and in hardware standby mode to H'FFFF. It is not
initialized by software standby mode.
Bits 15–8—Idles between Cycles (IW31, IW30, IW21, IW20, IW11, IW10, IW01, IW00):
These bits specify idle cycles inserted between consecutive accesses when the second one is to a
different CS area after a read. Idles are used to prevent data conflict between ROM (and other
memories, which are slow to turn the read data buffer off), fast memories, and I/O interfaces. Even
when access is to the same area, idle cycles must be inserted when a read access is followed
immediately by a write access. The idle cycles to be inserted comply with the area specification of
the previous access. Refer to section 10.6, Waits between Access Cycles, for details.
IW31, IW30 specify the idle between cycles for CS3 space; IW21, IW20 specify the idle between
cycles for CS2 space; IW11, IW10 specify the idle between cycles for CS1 space and IW01, IW00
specify the idle between cycles for CS0 space.
Bits 7–4—Idle Specification for Continuous Access (CW3, CW2, CW1, CW0): The
continuous access idle specification makes insertions to clearly delineate the bus intervals by once
negating the CSn signal when doing consecutive accesses of the same CS space. When a write
immediately follows a read, the number of idle cycles inserted is the larger of the two values
specified by IW and CW. Refer to section 8.4, Waits between Access Cycles, for details.
CW3 specifies the continuous access idles for CS3 space; CW2 specifies the continuous access
idles for CS2 space; CW1 specifies the continuous access idles for CS1 space and CW0 specifies
the continuous access idles for CS0 space.
Bits 3–0—CS CS Assert Extension Specification (SW3, SW2, SW1, SW0): The CS assert cycle
extension specification is for making insertions to prevent extension of the RD signal or WRx
signal assert period beyond the length of the CSn signal assert period. Extended cycles insert one
cycle before and after each bus cycle, which simplifies interfaces with external devices and also
has the effect of extending write data hold time. Refer to section 8.3.3 CS Assert Period Extension
for details.
SW3 specifies the CS assert extension for CS3 space access; SW2 specifies the CS assert
extension for CS2 space access; SW1 specifies the CS assert extension for CS1 space access and
SW0 specifies the CS assert extension for CS0 space access.
Bit: 15 14 13 12 11 10 9 8
W33 W32 W31 W30 W23 W22 W21 W20
Initial value: 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
W13 W12 W11 W10 W03 W02 W01 W00
Initial value: 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
WCR1 is a 16-bit read/write register that specifies the number of wait cycles (0–15) for each CS
space.
WCR1 is initialized by a power-on reset and in hardware standby mode to H'FFFF. It is not
initialized by software standby mode.
Bits 15–12—CS3 Space Wait Specification (W33, W32, W31, W30): Specifies the number of
waits for CS3 space access.
Bits 11–8—CS2 Space Wait Specification (W23, W22, W21, W20): Specifies the number of
waits for CS2 space access.
Bits 7–4—CS1 Space Wait Specification (W13, W12, W11, W10): Specifies the number of
waits for CS1 space access.
Bits 3–0—CS0 Space Wait Specification (W03, W02, W01, W00): Specifies the number of
waits for CS0 space access.
Bit: 15 14 13 12 11 10 9 8
— — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
— — — — DSW3 DSW2 DSW1 DSW0
Initial value: 0 0 0 0 1 1 1 1
R/W: R R R R R/W R/W R/W R/W
WCR2 is a 16-bit read/write register that specifies the number of access cycles for DRAM space
and CS space for DMA single address mode transfers.
Do not perform any DMA single address transfers before WCR2 is set.
WCR2 is initialized by a power-on reset and in hardware standby mode to H'000F. It is not
initialized by software standby mode.
Bits 15–4—Reserved: These bits always read as 0. The write value should always be 0.
Bits 3–0—CS Space DMA Single Address Mode Access Wait Specification (DSW3, DSW2,
DSW1, DSW0): Specifies the number of waits for CS space access (0–15) during DMA single
address mode accesses. These bits are independent of the W bits of the WCR1.
Bit: 15 14 13 12 11 10 9 8
— — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
— — — — — RAMS RAM1 RAM0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R/W R/W R/W
The RAM emulation register (RAMER) is a 16-bit readable/writable register that selects the RAM
area to be used when emulating realtime programming of flash memory.
RAMER is initialized to H'0000 by a power-on reset and in hardware standby mode. It is not
initialized in software standby mode.
Note: To ensure correct operation of the RAM emulation function, the ROM for which RAM
emulation is performed should not be accessed immediately after this register has been
modified. Operation cannot be guaranteed if such an access is made.
Bits 15 to 3—Reserved: Only 0 should be written to these bits. Operation cannot be guaranteed if
1 is written.
Bit 2—RAM Select (RAMS): Used together with bits 1 and 0 to designate the RAM area (table
8.5 and table 8.6).
When 1 is written to this bit, all flash memory blocks are write/erase-protected.
Bits 1 and 0—RAM Area Specification (RAM1, RAM0): These bits are used together with the
RAMS bit to designate the RAM area (tables 8.5 and 8.6).
Table 8.5 RAM Area Setting Method (128 kB ROM/6 kB RAM Version)
Table 8.6 RAM Area Setting Method (256 kB ROM/10 kB RAM Version)
Figure 8.3 shows the basic timing of ordinary space access. Ordinary access bus cycles are
performed in 2 states.
T1 T2
CK
Address
CSn
RD
Read
Data
WRx
Write
Data
The number of wait states inserted into ordinary space access states can be controlled using the
WCR settings (figure 8.4).
T1 TW T2
CK
Address
CSn
RD
Read
Data
WRx
Write
Data
Figure 8.4 Wait Timing of Ordinary Space Access (Software Wait Only)
When the wait is specified by software using WCR, the wait input WAIT signal from outside is
sampled. Figure 8.5 shows the WAIT signal sampling. The WAIT signal is sampled at the clock
rise one cycle before the clock rise when Tw state shifts to T2 state. When using external waits, use
a WCR setting of 1 state or more when extending CS assertion, and 2 states or more otherwise.
T1 TW TW TW0 T2
CK
Address
CSn
RD
Read
Data
WRx
Write
Data
WAIT
Figure 8.5 Wait State Timing of Ordinary Space Access (Wait States from Software Wait 2
State + WAIT Signal)
Idle cycles can be inserted to prevent extension of the RD signal or WRx signal assert period
beyond the length of the CSn signal assert period by setting the SW3–SW0 bits of BCR2. This
allows for flexible interfaces with external circuitry. The timing is shown in figure 8.6. Th and Tf
cycles are added respectively before and after the ordinary cycle. Only CSn is asserted in these
cycles; RD and WRx signals are not. Further, data is extended up to the Tf cycle, which is
effective for gate arrays and the like, which have slower write operations.
Th T1 T2 Tf
CK
Address
CSn
RD
Read
Data
WRx
Write
Data
To enable detection of bus cycle starts, waits can be inserted between access cycles during
continuous accesses of the same CS space by negating the CSn signal once.
For the two cases of write cycles after read cycles, and read cycles for a different area after read
cycles, waits are inserted so that the number of idle cycles specified by the IW31 to IW00 bits of
the BCR2 and the DIW of the DCR occur. When idle cycles already exist between access cycles,
only the number of empty cycles remaining beyond the specified number of idle cycles are
inserted.
Figure 8.7 shows an example of idles between cycles. In this example, 1 idle between CSn space
cycles has been specified, so when a CSm space write immediately follows a CSn space read
cycle, 1 idle cycle is inserted.
T1 T2 Tidle T1 T2
CK
Address
CSn
CSm
RD
WRx
Data
IW31 and IW30 specify the number of idle cycles required after a CS3 space read either to read
other external spaces, or for this LSI, to do write accesses. In the same manner, IW21 and IW20
specify the number of idle cycles after a CS2 space read, IW11 and IW10, the number after a CS1
space read, and IW01 and IW00, the number after a CS0 space read.
DIW specifies the number of idle cycles required, after a DRAM space read either to read other
external spaces (CS space), or for this LSI, to do write accesses.
0 to 3 cycles can be specified for CS space, and 0 to 1 cycle for DRAM space.
For consecutive accesses of the same CS space, waits are inserted so that the number of idle cycles
designated by the CW3 to CW0 bits of the BCR2 occur. However, for write cycles after reads, the
number of idle cycles inserted will be the larger of the two values defined by the IW and CW bits.
When idle cycles already exist between access cycles, waits are not inserted. Figure 8.8 shows an
example. A continuous access idle is specified for CSn space, and CSn space is consecutively
write accessed.
T1 T2 Tidle T1 T2
CK
Address
CSn
RD
WRx
Data
Figure 8.8 Same Space Consecutive Access Idle Cycle Insertion Example
Bus right request from external device > DMAC > CPU
Therefore, an external device that generates a bus request is given priority even if the request is
made during a DMAC burst transfer.
A bus request by an external device should be input at the BREQ pin. The signal indicating that
the bus has been released is output from the BACK pin.
BREQ = Low
BREQ accepted Bus right request
Strobe pin:
high-level output
BACK = Low
Bus right release
response
32k × 8 bit
SH705x ROM
CSn CE
RD OE
A0–A14 A0–A14
D0–D7 I/O0–I/O7
256k × 16 bit
SH705x ROM
CSn CE
RD OE
A0
A1–A18 A0–A17
D0–D15 I/O0–I/O15
128k × 8 bit
SH705x SRAM
CSn CE
RD OE
A0–A16 A0–A16
WRL WE
D0–D7 I/O0–I/O7
128k × 8 bit
SH705x SRAM
CSn CS
RD OE
A0
A1ÐA17 A0ÐA16
WRH WE
D8–D15 I/O0–I/O7
WRL
D0–D7
CS
OE
A0–A16
WE
I/O0–I/O7
9.1 Overview
The SH7050 series includes an on-chip four-channel direct memory access controller (DMAC).
The DMAC can be used in place of the CPU to perform high-speed data transfers among external
devices equipped with DACK (transfer request acknowledge signal), external memories, memory-
mapped external devices, and on-chip peripheral modules (except for the DMAC, DTC, BSC, and
UBC). Using the DMAC reduces the burden on the CPU and increases operating efficiency of the
LSI as a whole.
9.1.1 Features
• Four channels
• Four GB of address space in the architecture
• Byte, word, or longword selectable data transfer unit
• 16 MB (6,777,216 maximum) transfers
• Single or dual address mode. Dual address mode can be direct or indirect address transfer.
Single address mode: Either the transfer source or transfer destination (peripheral device) is
accessed by a DACK signal while the other is accessed by address. One transfer unit of
data is transferred in each bus cycle.
Dual address mode: Both the transfer source and transfer destination are accessed by
address. Dual address mode can be direct or indirect address transfer.
• Direct access: Values set in a DMAC internal register indicate the accessed address for
both the transfer source and transfer destination. Two bus cycles are required for one
data transfer.
• Indirect access: The value stored at the location pointed to by the address set in the
DMAC internal transfer source register is used as the address. Operation is otherwise
the same as direct access. This function can only be set for channel 3.
• Channel function: Transfer modes that can be set are different for each channel. (Dual address
mode indirect access can only be set for channel 1. Only direct access is possible for the other
channels).
Channel 0: Single or dual address mode. External requests are accepted.
Channel 1: Single or dual address mode. External requests are accepted.
Channel 2: Dual address mode only. Source address reload function operates every fourth
transfer.
Rev. 5.00 Jan 06, 2006 page 135 of 818
REJ09B0273-0500
Section 9 Direct Memory Access Controller (DMAC)
Channel 3: Dual address mode only. Direct address transfer mode and indirect address
transfer mode selectable.
• Reload function: Enables automatic reloading of the value set in the first source address
register every fourth DMA transfer. This function can be executed on channel 2 only.
• Transfer requests: There are three DMAC transfer activation requests, as indicated below.
External request: From two DREQ pins. DREQ can be detected either by falling edge or by
low level. External requests can only be received on channels 0 or 1.
Requests from on-chip peripheral modules: Transfer requests from on-chip modules such
as SCI or A/D. These can be received by all channels.
Auto-request: The transfer request is generated automatically within the DMAC.
• Selectable bus modes: Cycle-steal mode or burst mode
• Two types of DMAC channel priority ranking:
Fixed priority mode: Always fixed
Round robin mode: Sets the lowest priority level for the channel that received the execution
request last
• CPU can be interrupted when the specified number of data transfers are complete.
DMAC module
Circuit
On-chip ROM SARn
control
Register DARn
On-chip RAM
control
Internal bus
peripheral
module Activation
control
CHCRn
DMAOR
DREQ0, DREQ1
ATU Request
SCI0–SCI2 priority
A/D converter 0, 1 control
DEIn
DACK0, DACK1
DRAK0, DRAK1
External
ROM Bus interface
External
RAM
Table 9.2 summarizes the DMAC registers. DMAC has a total of 17 registers. Each channel has
four control registers. One other control register is shared by all channels. There are two channel 0
dedicated registers, ISAR and IDAR, which preserve different initial transfer source and
destination addresses than those of the SAR0 and DAR0. There is also an IAR used by the indirect
address mode.
DMA source address registers 0–3 (SAR0–SAR3) are 32-bit read/write registers that specify the
source address of a DMA transfer. These registers have a count function, and during a DMA
transfer, they indicate the next source address. In single-address mode, SAR values are ignored
when a device with DACK has been specified as the transfer source.
Specify a 16-bit boundary when performing 16-bit data transfers, and a 32-bit boundary when
performing 32-bit data transfers. Operation cannot be guaranteed if any other addresses are set.
The initial value after power-on resets and in software standby mode is undefined.
Bit: 31 30 29 28 27 26 25 24
Initial value: — — — — — — — —
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 23 22 21 … … 2 1 0
… …
Initial value: — — — … … — — —
R/W: R/W R/W R/W … … R/W R/W R/W
DMA destination address registers 0–3 (DAR0–DAR3) are 32-bit read/write registers that specify
the destination address of a DMA transfer. These registers have a count function, and during a
DMA transfer, they indicate the next destination address. In single-address mode, DAR values are
ignored when a device with DACK has been specified as the transfer destination.
Specify a 16-bit boundary when performing 16-bit data transfers, and a 32-bit boundary when
performing 32-bit data transfers. Operation cannot be guaranteed if any other addresses are set.
Bit: 31 30 29 28 27 26 25 24
Initial value: — — — — — — — —
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 23 22 21 … … 2 1 0
… …
Initial value: — — — … … — — —
R/W: R/W R/W R/W … … R/W R/W R/W
DMA transfer count registers 0–3 (DMATCR0–DMATCR3) are 24-bit read/write registers that
specify the transfer count for the channel (byte count, word count, or longword count). Specifying
a H'000001 gives a transfer count of 1, while H'000000 gives the maximum setting, 16,777,216
transfers.
The upper 8 bits of DMATCR always read 0. The write value, also, should always be 0.
Bit: 31 30 29 28 27 26 25 24
— — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 23 22 21 20 19 18 17 16
Initial value: — — — — — — — —
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Initial value: — — — — — — — —
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Initial value: — — — — — — — —
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
DMA channel control registers 0–3 (CHCR0–CHCR3) is a 32-bit read/write register where the
operation and transmission of each channel is designated. Bits 31–21 and bit 7 should always read
0. The written value should also be 0. They are initialized to 0 by a power-on reset and in standby
mode.
Bit: 31 30 29 28 27 26 25 24
— — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 23 22 21 20 19 18 17 16
— — — DI RO RL AM AL
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
DM1 DM0 SM1 SM0 RS3 RS2 RS1 RS0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
— DS TM TS1 TS0 IE TE DE
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/(W)* R/W
Notes: 1. TE bit: Allows only 0 write after reading 1.
2. The DI, RO, RL, AM, AL, or DS bit may be absent, depending on the channel.
Bit 20—Direct/Indirect (DI): Specifies either direct address mode operation or indirect address
mode operation for channel 3 source address. This bit is valid only in CHCR3. It always reads 0
for CHCR0–CHCR2, and cannot be modified.
Bit 19—Source Address Reload (RO): Selects whether to reload the source address initial value
during channel 2 transfer. This bit is valid only for channel 2. It always reads 0 for CHCR0,
CHCR1, and CHCR3, and cannot be modified.
Bit 18—Request Check Level (RL): Selects whether to output DRAK notifying external device
of DREQ received, with active high or active low. This bit is valid only for CHCR0 and CHCR1.
It always reads 0 for CHCR2 and CHCR3, and cannot be modified.
Bit 17—Acknowledge Mode (AM): In dual address mode, selects whether to output DACK in
the data write cycle or data read cycle. In single address mode, DACK is always output
irrespective of the setting of this bit. This bit is valid only for CHCR0 and CHCR1. It always reads
as 0 for CHCR2 and CHCR3, and cannot be modified.
Bit 16—Acknowledge Level (AL): Specifies whether to set DACK (acknowledge) signal output
to active high or active low. This bit is valid only with CHCR0 and CHCR1. It always reads as 0
for CHCR2 and CHCR3, and cannot be modified.
Bits 15 and 14—Destination Address Mode 1, 0 (DM1 and DM0): These bits specify
increment/decrement of the DMA transfer source address. These bit specifications are ignored
when transferring data from an external device to address space in single address mode.
Bits 13 and 12—Source Address Mode 1, 0 (SM1 and SM0): These bits specify
increment/decrement of the DMA transfer source address. These bit specifications are ignored
when transferring data from an external device to address space in single address mode.
When the transfer source is specified at an indirect address, specify in source address register 3
(SAR3) the actual storage address of the data you want to transfer as the data storage address
(indirect address).
During indirect address mode, SAR3 obeys the SM1/SM0 setting for increment/decrement. In this
case, SAR3’s increment/decrement is fixed at +4/–4 or 0, irrespective of the transfer data size
specified by TS1 and TS0.
Bits 11–8—Resource Select 3–0 (RS3–RS0): These bits specify the transfer request source.
DREQ Select (DS): Sets the sampling method for the DREQ pin in external request mode
Bit 6—DREQ
to either low-level detection or falling-edge detection. This bit is valid only with CHCR0 and
CHCR1. For CHCR2 and CHCR3, this bit always reads as 0 and cannot be modified.
Even with channels 0 and 1, when specifying an on-chip peripheral module or autorequest as the
transfer request source, this bit setting is ignored. The sampling method is fixed at falling-edge
detection in cases other than auto-request.
Bit 6: DS Description
0 Low-level detection (initial value)
1 Falling-edge detection
Bit 5—Transfer Mode (TM): Specifies the bus mode for data transfer.
Bit 5: TM Description
0 Cycle steal mode (initial value)
1 Burst mode
Bits 4 and 3—Transfer Size 1, 0 (TS1, TS0): Specifies size of data for transfer.
Bit 2—Interrupt Enable (IE): When this bit is set to 1, interrupt requests are generated after the
number of data transfers specified in the DMATCR (when TE = 1).
Bit 2: IE Description
0 Interrupt request not generated after DMATCR-specified transfer count
(initial value)
1 Interrupt request enabled on completion of DMATCR specified number
of transfers
Bit 1—Transfer End (TE): This bit is set to 1 after the number of data transfers specified by the
DMATCR. At this time, if the IE bit is set to 1, an interrupt request is generated.
If data transfer ends before TE is set to 1 (for example, due to an NMI or address error, or clearing
of the DE bit or DME bit of the DMAOR) the TE is not set to 1. With this bit set to 1, data transfer
is disabled even if the DE bit is set to 1.
Bit 1: TE Description
0 DMATCR-specified transfer count not ended (initial value)
Clear condition: 0 write after TE = 1 read, Power-on reset, standby
mode
1 DMATCR specified number of transfers completed
Bit 0: DE Description
0 Operation of the corresponding channel disabled (initial value)
1 Operation of the corresponding channel enabled
Transfer mode is entered if this bit is set to 1 when auto-request is specified (RS3–RS0 settings).
With an external request or on-chip module request, when a transfer request occurs after this bit is
set to 1, transfer is enabled. If this bit is cleared during a data transfer, transfer is suspended.
If the DE bit has been set, but TE = 1, then if the DME bit of the DMAOR is 0, and the NMI or
AE bit of the DMAOR is 1, transfer enable mode is not entered.
The DMAOR is a 16-bit read/write register that specifies the transfer mode of the DMAC. Bits
15–10 and bits 7–3 of this register always read as 0 and cannot be modified.
Register values are initialized to 0 by a power-on reset and in software standby mode.
Bit: 15 14 13 12 11 10 9 8
— — — — — — PR1 PR0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R/W R/W
Bit: 7 6 5 4 3 2 1 0
— — — — — AE NMIF DME
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R/(W)* R/(W)* R
Note: * 0 write only is valid after 1 is read at the AE and NMIF bits.
Bits 9–8—Priority Mode 1 and 0 (PR1 and PR0): These bits determine the priority level of
channels for execution when transfer requests are made for several channels simultaneously.
Bit 2—Address Error Flag (AE): Indicates that an address error has occurred during DMA
transfer. If this bit is set during a data transfer, transfers on all channels are suspended. The CPU
cannot write a 1 to the AE bit. Clearing is effected by 0 write after 1 read.
Bit 2: AE Description
0 No address error, DMA transfer enabled (initial value)
Clearing condition: Write AE = 0 after reading AE = 1
1 Address error, DMA transfer disabled
Setting condition: Address error due to DMAC
Bit 1—NMI Flag (NMIF): Indicates input of an NMI. This bit is set irrespective of whether the
DMAC is operating or suspended. If this bit is set during a data transfer, transfers on all channels
are suspended. The CPU is unable to write a 1 to the NMIF. Clearing is effected by 0 write after 1
read.
Bit 0—DMAC Master Enable (DME): This bit enables activation of the entire DMAC. When
the DME bit and DE bit of the CHCR for the corresponding channel are set to 1, that channel is
transfer-enabled. If this bit is cleared during a data transfer, transfers on all channels are
suspended.
Even when the DME bit is set, when the TE bit of the CHCR is 1, or its DE bit is 0, transfer is
disabled in the case of an NMI of the DMAOR or when AE = 1.
9.3 Operation
When there is a DMA transfer request, the DMAC starts the transfer according to the
predetermined channel priority order; when the transfer end conditions are satisfied, it ends the
transfer. Transfers can be requested in three modes: auto-request, external request, and on-chip
peripheral module request. Transfer can be in either the single address mode or the dual address
mode, and dual address mode can be either direct or indirect address transfer mode. The bus mode
can be either burst or cycle steal.
After the DMA source address registers (SAR), DMA destination address registers (DAR), DMA
transfer count register (DMATCR), DMA channel control registers (CHCR), and DMA operation
register (DMAOR) are set to the desired transfer conditions, the DMAC transfers data according
to the following procedure:
Start
Initial settings
(SAR, DAR, TCR, CHCR, DMAOR)
Yes
Transfer request No *2
occurs?*1
Bus mode,
Yes *3 transfer request mode,
DREQ detection selection
Transfer (1 transfer unit); system
DMATCR – 1 → DMATCR, SAR and DAR
updated
Does
No No
DMATCR = 0? NMIF = 1, AE = 1,
DE = 0, or DME
= 0?
Yes Yes
DEI interrupt request (when IE = 1) Transfer aborted
Does
NMIF = 1, AE = 1, No
DE = 0, or DME
= 0?
Yes
Transfer ends Normal end
Notes: 1. In auto-request mode, transfer begins when NMIF, AE, and TE are all 0,
and the DE and DME bits are set to 1.
2. DREQ = level detection in burst mode (external request) or cycle-steal
mode.
3. DREQ = edge detection in burst mode (external request), or auto-request
mode in burst mode.
DMA transfer requests are usually generated in either the data transfer source or destination, but
they can also be generated by devices and on-chip peripheral modules that are neither the source
nor the destination. Transfers can be requested in three modes: auto-request, external request, and
on-chip peripheral module request. The request mode is selected in the RS3–RS0 bits of the DMA
channel control registers 0–3 (CHCR0–CHCR3).
Auto-Request Mode: When there is no transfer request signal from an external source, as in a
memory-to-memory transfer or a transfer between memory and an on-chip peripheral module
unable to request a transfer, the auto-request mode allows the DMAC to automatically generate a
transfer request signal internally. When the DE bits of CHCR0–CHCR3 and the DME bit of the
DMAOR are set to 1, the transfer begins (so long as the TE bits of CHCR0–CHCR3 and the
NMIF and AE bits of DMAOR are all 0).
External Request Mode: In this mode a transfer is performed at the request signal (DREQ) of an
external device. Choose one of the modes shown in table 9.3 according to the application system.
When this mode is selected, if the DMA transfer is enabled (DE = 1, DME = 1, TE = 0, NMIF = 0,
AE = 0), a transfer is performed upon a request at the DREQ input. Choose to detect DREQ by
either the falling edge or low level of the signal input with the DS bit of CHCR0–CHCR3 (DS = 0
is level detection, DS = 1 is edge detection). The source of the transfer request does not have to be
the data transfer source or destination.
On-Chip Peripheral Module Request Mode: In this mode a transfer is performed at the transfer
request signal (interrupt request signal) of an on-chip peripheral module. As indicated in table 9.4,
there are ten transfer request signals: five from the multifunction timer pulse unit (MTU), which
are compare match or input capture interrupts; the receive data full interrupts (RxI) and transmit
data empty interrupts (TxI) of the two serial communication interfaces (SCI); and the A/D
conversion end interrupt (ADI) of the A/D converter. When DMA transfers are enabled (DE = 1,
DME = 1, TE = 0, NMIF = 0, AE = 0), a transfer is performed upon the input of a transfer request
signal.
The transfer request source need not be the data transfer source or transfer destination. However,
when the transfer request is set by RxI (transfer request because SCI’s receive data is full), the
transfer source must be the SCI’s receive data register (RDR). When the transfer request is set by
TxI (transfer request because SCI’s transmit data is empty), the transfer destination must be the
SCI’s transmit data register (TDR). Also, if the transfer request is set to the A/D converter, the
data transfer destination must be the A/D converter register.
Table 9.4 Selecting On-Chip Peripheral Module Request Modes with the RS Bits
In order to output a transfer request from an on-chip peripheral module, set the relevant interrupt
enable bit for each module, and output an interrupt signal.
When an on-chip peripheral module’s interrupt request signal is used as a DMA transfer request
signal, interrupts for the CPU are not generated.
When a DMA transfer is conducted corresponding with one of the transfer request signals in table
9.4, it is automatically discontinued. In cycle steal mode this occurs in the first transfer, and in
burst mode with the last transfer.
When the DMAC receives simultaneous transfer requests on two or more channels, it selects a
channel according to a predetermined priority order, either in a fixed mode or in round robin
mode. These modes are selected by priority bits PR1 and PR0 in the DMA operation register
(DMAOR).
Fixed Mode: In these modes, the priority levels among the channels remain fixed.
These are selected by settings of the PR1 and PR0 bits of the DMA operation register (DMAOR).
Round Robin Mode: In round robin mode, each time the transfer of one transfer unit (byte, word
or long word) ends on a given channel, that channel receives the lowest priority level (figure 9.3).
The priority level in round robin mode immediately after a reset is CH0 > CH1 > CH2 > CH3.
Transfer on channel 0
Initial priority setting CH0 > CH1 > CH2 > CH3 Channel 1 is given the lowest
priority.
Priority after transfer CH1 > CH2 > CH3 > CH0
Transfer on channel 1
Initial priority setting CH0 > CH1 > CH2 > CH3 When channel 1 is given the
lowest priority, the priority
of channel 0, which was
above channel 1, is also shifted
simultaneously.
Priority after transfer CH2 > CH3 > CH0 > CH1
Transfer on channel 2
Initial priority setting CH0 > CH1 > CH2 > CH3 When channel 2 receives the
lowest priority, the priorities
of channel 0 and 1, which
were above channel 2, are also
shifted simultaneously. Immedi-
Priority after transfer CH3 > CH0 > CH1 > CH2 ately thereafter, if there is a transfer
request for channel 1 only, channel
1 is given the lowest priority,
Priority after transfer and the priorities of channels 3
due to issue of a transfer CH2 > CH3 > CH0 > CH1 and 0 are simultaneously
request for channel 1 shifted down.
only.
Transfer on channel 3
Initial priority setting CH0 > CH1 > CH2 > CH3 No change in priority.
Priority after transfer CH0 > CH1 > CH2 > CH3
Figure 9.4 shows the example of changes in priority levels when transfer requests are issued
simultaneously for channels 0 and 3, and channel 1 receives a transfer request during a transfer on
channel 0. The DMAC operates in the following manner under these circumstances:
Issued for
channels 0 and 3 Channel 0 0>1>2>3
3 transfer begins
Issued for channel 1
Change of
priority
1.3 Channel 0 1>2>3>0
transfer ends
Channel 1
transfer begins
Change of
priority
3 Channel 1 2>3>0>1
transfer ends
Channel 3
transfer begins
None Change of
priority
Channel 3 0>1>2>3
transfer ends
The DMAC supports the transfers shown in table 9.5. It can operate in the single address mode, in
which either the transfer source or destination is accessed using an acknowledge signal, or dual
address mode, in which both the transfer source and destination addresses are output. The dual
address mode consists of a direct address mode, in which the output address value is the object of
a direct data transfer, and an indirect address mode, in which the output address value is not the
object of the data transfer, but the value stored at the output address becomes the transfer object
address. The actual transfer operation timing varies with the bus mode. The DMAC has two bus
modes: cycle-steal mode and burst mode.
Transfer Destination
Memory-
External Mapped On-Chip
Transfer Device with External External On-Chip Peripheral
Source DACK Memory Device Memory Module
External Not available Single address Single address Not available Not available
device with mode mode
DACK
External Single address Dual address Dual address Dual address Dual address
memory mode mode mode mode mode
Memory- Single address Dual address Dual address Dual address Dual address
mapped mode mode mode mode mode
external
device
On-chip Not available Dual address Dual address Dual address Dual address
memory mode mode mode mode
On-chip Not available Dual address Dual address Dual address Dual address
peripheral mode mode mode mode
module
Note: The dual address mode includes direct address mode and indirect address mode.
Single Address Mode: In the single address mode, both the transfer source and destination are
external; one (selectable) is accessed by a DACK signal while the other is accessed by an address.
In this mode, the DMAC performs the DMA transfer in 1 bus cycle by simultaneously outputting a
transfer request acknowledge DACK signal to one external device to access it while outputting an
address to the other end of the transfer. Figure 9.5 shows a transfer between an external memory
and an external device with DACK in which the external device outputs data to the data bus while
that data is written in external memory in the same bus cycle.
External device
with DACK
DACK
DREQ
: Data flow
Two types of transfers are possible in the single address mode: (a) transfers between external
devices with DACK and memory-mapped external devices, and (b) transfers between external
devices with DACK and external memory. The only transfer requests for either of these is the
external request (DREQ). Figure 9.6 shows the DMA transfer timing for the single address mode.
CK
CSn
Data that is output from the external
D15–D0
device with DACK
DACK DACK signal to external devices with
DACK (active low)
WRH
WR signal to external memory space
WRL
CK
CSn
Figure 9.6 Example of DMA Transfer Timing in the Single Address Mode
Dual address mode is used for access of both the transfer source and destination by address.
Transfer source and destination can be accessed either internally or externally. Dual address mode
is subdivided into two other modes: direct address transfer mode and indirect address transfer
mode.
Direct Address Transfer Mode: Data is read from the transfer source during the data read cycle,
and written to the transfer destination during the write cycle, so transfer is conducted in two bus
cycles. At this time, the transfer data is temporarily stored in the DMAC. With the kind of external
memory transfer shown in figure 9.7, data is read from one of the memories by the DMAC during
a read cycle, then written to the other external memory during the subsequent write cycle. Figure
9.8 shows the timing for this operation.
DMAC
SAR Memory
Address bus
Data bus
DAR
Transfer source
module
Transfer destination
Data buffer
module
The SAR value is taken as the address, and data is read from the transfer source
module and stored temporarily in the DMAC.
DMAC
SAR Memory
Address bus
Data bus
DAR
Transfer source
module
Transfer destination
Data buffer
module
CK
CSn
D15–D0
RD
WRH, WRL
DACK
Note: Transfer between external memories with DACK are output during read
cycle.
Indirect Address Transfer Mode: In this mode the memory address storing the data you actually
want to transfer is specified in DMAC internal transfer source address register (SAR3). Therefore,
in indirect address transfer mode, the DMAC internal transfer source address register value is read
first. This value is stored once in the DMAC. Next, the read value is output as the address, and the
value stored at that address is again stored in the DMAC. Finally, the subsequent read value is
written to the address specified by the transfer destination address register, ending one cycle of
DMAC transfer.
In indirect address mode (figure 9.9), transfer destination, transfer source, and indirect address
storage destination are all 16-bit external memory locations, and transfer in this example is
conducted in 16-bit or 8-bit units. Timing for this transfer example is shown in figure 9.10.
In indirect address mode, one NOP cycle (figure 9.10) is required until the data read as the indirect
address is output to the address bus. When transfer data is 32-bit, the third and fourth bus cycles
each need to be doubled, giving a required total of six bus cycles and one NOP cycle for the whole
operation.
SAR3 Memory
Address bus
DAR3
Data bus
Transfer source
Temporary module
buffer
Transfer destination
Data
module
buffer
The SAR value is taken as the address, memory data is read, and the value is stored in the
temporary buffer. Since the value read at this time is used as the address, it must be 32 bits.
SAR3 Memory
Data bus
Temporary module
buffer
Data Transfer destination
buffer module
The value in the temporary buffer is taken as the address, and data is read from the
transfer source module to the data buffer.
SAR3 Memory
Address bus
DAR3
Transfer source
Data bus
Temporary module
buffer
Transfer destination
Data
module
buffer
The DAR3 value is taken as the address, and the value in the data buffer is written to the
transfer destination module.
Note: Memory, transfer source, and transfer destination modules are shown here.
In practice, connection can be made anywhere there is address space.
CK
CSn
Internal
address Transfer source Indirect
address ∗1
NOP
bus address
Internal
Transfer source address ∗2
Transfer Transfer
data bus data data
DMAC
indirect Indirect
address address
buffer
DMAC Transfer
data data
buffer
RD
WRH,
WRL
Notes: 1. The internal address bus is controlled by the port and does not change.
2. DMAC does not fetch value until 32-bit data is read from the internal data
bus.
Figure 9.10 Dual Address Mode and Indirect Address Transfer Timing Example 1
Figure 9.11 shows an example of timing in indirect address mode when transfer source and
indirect address storage locations are in internal memory, the transfer destination is an on-chip
peripheral module with 2-cycle access space, and transfer data is 8-bit.
Since the indirect address storage destination and the transfer source are in internal memory, these
can be accessed in one cycle. The transfer destination is 2-cycle access space, so two data write
cycles are required. One NOP cycle is required until the data read as the indirect address is output
to the address bus.
CK
Internal Transfer Transfer
address Indirect
source NOP destination
bus address
address address
Internal
Indirect Transfer
data NOP Transfer data
address data
bus
DMAC
indirect Indirect
address address
buffer
DMAC
data Transfer data
buffer
Figure 9.11 Dual Address Mode and Indirect Address Transfer Timing Example 2
Select the appropriate bus mode in the TM bits of CHCR0–CHCR3. There are two bus modes:
cycle steal and burst.
Cycle-Steal Mode: In the cycle steal mode, the bus right is given to another bus master after each
one-transfer-unit (byte, word, or longword) DMAC transfer. When the next transfer request
occurs, the bus rights are obtained from the other bus master and a transfer is performed for one
transfer unit. When that transfer ends, the bus right is passed to the other bus master. This is
repeated until the transfer end conditions are satisfied.
The cycle steal mode can be used with all categories of transfer destination, transfer source and
transfer request. Figure 9.12 shows an example of DMA transfer timing in the cycle steal mode.
Transfer conditions are dual address mode and DREQ level detection.
DREQ
Bus cycle CPU CPU CPU DMAC DMAC CPU DMAC DMAC CPU CPU
Read Write Read Write
Burst Mode: Once the bus right is obtained, the transfer is performed continuously until the
transfer end condition is satisfied. In the external request mode with low level detection of the
DREQ pin, however, when the DREQ pin is driven high, the bus passes to the other bus master
after the bus cycle of the DMAC that currently has an acknowledged request ends, even if the
transfer end conditions have not been satisfied.
Figure 9.13 shows an example of DMA transfer timing in the burst mode. Transfer conditions are
single address mode and DREQ level detection.
DREQ
Bus cycle CPU CPU CPU DMAC DMAC DMAC DMAC DMAC DMAC CPU
9.3.8 Relationship between Request Modes and Bus Modes by DMA Transfer Category
Table 9.6 shows the relationship between request modes and bus modes by DMA transfer
category.
Table 9.6 Relationship of Request Modes and Bus Modes by DMA Transfer Category
Bus*
6
Address Request Transfer Usable
Mode Transfer Category Mode Mode Size (Bits) Channels
Single External device with DACK and External B/C 8/16/32 0,1
external memory
External device with DACK and External B/C 8/16/32 0, 1
memory-mapped external device
Any* 0–3*
1 5
Dual External memory and external memory B/C 8/16/32
Any* 0–3*
1 5
External memory and memory-mapped B/C 8/16/32
external device
Any* 0–3*
1 5
Memory-mapped external device and B/C 8/16/32
memory-mapped external device
Any* 0–3*
1 5
External memory and on-chip memory B/C 8/16/32
Any* B/C* 8/16/32* 0–3*
2 3 4 5
External memory and on-chip
peripheral module
Any* 0–3*
1 5
Memory-mapped external device and B/C 8/16/32
on-chip memory
Any* B/C* 8/16/32* 0–3*
2 3 4 5
Memory-mapped external device and
on-chip peripheral module
Any* 0–3*
1 5
On-chip memory and on-chip memory B/C 8/16/32
Any* B/C* 8/16/32* 0–3*
2 3 4 5
On-chip memory and on-chip
peripheral module
Any* B/C* 8/16/32* 0–3*
2 3 4 5
On-chip peripheral module and on-
chip peripheral module
Notes: 1. External request, auto-request or on-chip peripheral module request enabled. However,
in the case of on-chip peripheral module request, it is not possible to specify the SCI or
A/D converter for the transfer request source.
2. External request, auto-request or on-chip peripheral module request possible. However,
if transfer request source is also the SCI or A/D converter, the transfer source or
transfer destination must be the SCI or A/D converter.
3. When the transfer request source is the SCI, only cycle steal mode is possible.
4. Access size permitted by register of on-chip peripheral module that is the transfer
source or transfer destination.
5. When the transfer request is an external request, channels 0 and 1 only can be used.
6. B: Burst, C: Cycle steal
When a given channel is transferring in burst mode, and a transfer request is issued to channel 0,
which has a higher priority ranking, transfer on channel 0 begins immediately. If the priority level
setting is fixed mode (CH0 > CH1), channel 1 transfer is continued after transfer on channel 0 are
completely ended, whether the channel 0 setting is cycle steal mode or burst mode.
When the priority level setting is for round robin mode, transfer on channel 1 begins after transfer
of one transfer unit on channel 0, whether channel 0 is set to cycle steal mode or burst mode.
Thereafter, bus right alternates in the order: channel 1 > channel 0 > channel 1 > channel 0.
Whether the priority level setting is for fixed mode or round robin mode, since channel 1 is set to
burst mode, the bus right is not given to the CPU. An example of round robin mode is shown in
figure 9.14.
9.3.10 Number of Bus Cycle States and DREQ Pin Sample Timing
Number of States in Bus Cycle: The number of states in the bus cycle when the DMAC is the
bus master is controlled by the bus state controller (BSC) just as it is when the CPU is the bus
master. The bus cycle in the dual address mode is controlled by wait state control register 1
(WCR1) while the single address mode bus cycle is controlled by wait state control register 2
(WCR2). For details, see section 8.3.2, Wait State Control.
DREQ Pin Sampling Timing and DRAK Signal: In external request mode, the DREQ pin is
sampled by either falling edge or low-level detection. When a DREQ input is detected, a DMAC
bus cycle is issued and DMA transfer effected, at the earliest, after three states. However, in burst
mode when single address operation is specified, a dummy cycle is inserted for the first bus cycle.
In this case, the actual data transfer starts from the second bus cycle. Data is transferred
continuously from the second bus cycle. The dummy cycle is not counted in the number of
transfer cycles, so there is no need to recognize the dummy cycle when setting the TCR.
DREQ sampling from the second time begins from the start of the transfer one bus cycle prior to
the DMAC transfer generated by the previous sampling.
DRAK is output once for the first DREQ sampling, irrespective of transfer mode or DREQ
detection method. In burst mode, using edge detection, DREQ is sampled for the first cycle only,
so DRAK is also output for the first cycle only. Therefore, the DREQ signal negate timing can be
ascertained, and this facilitates handshake operations of transfer requests with the DMAC.
Cycle Steal Mode Operations: In cycle steal mode, DREQ sampling timing is the same
irrespective of dual or single address mode, or whether edge or low-level DREQ detection is used.
For example, DMAC transfer begins (figure 9.15), at the earliest, three cycles from the first
sampling timing. The second sampling begins at the start of the transfer one bus cycle prior to the
start of the DMAC transfer initiated by the first sampling (i.e., from the start of the CPU(3)
transfer). At this point, if DREQ detection has not occurred, sampling is executed every cycle
thereafter.
As in figure 9.16, whatever cycle the CPU transfer cycle is, the next sampling begins from the
start of the transfer one bus cycle before the DMAC transfer begins.
Figure 9.15 shows an example of output during DACK read and figure 9.16 an example of output
during DACK write.
CPU(2)
CPU(1)
CK
DREQ
DRAK
cycle
DACK
Bus
Figure 9.15 Cycle Steal, Dual Address and Level Detection (Fastest Operation)
CK
DRAK
Bus DMAC
Section 9 Direct Memory Access Controller (DMAC)
DACK
Note: With cycle-steal and dual address operation, sampling timing is the same
whether DREQ detection is by level or by edge.
Figure 9.16 Cycle Steal, Dual Address and Level Detection (Normal Operation)
Section 9 Direct Memory Access Controller (DMAC)
Figures 9.17 and 9.18 show cycle steal mode and single address mode. In this case, transfer begins
at earliest three cycles after the first DREQ sampling. The second sampling begins from the start
of the transfer one bus cycle before the start of the first DMAC transfer. In single address mode,
the DACK signal is output during the DMAC transfer period.
DMAC
CPU
DMAC
CPU
DMAC
CPU
CPU
CPU
CK
DREQ
DRAK
cycle
DACK
Bus
Figure 9.17 Cycle Steal, Single Address and Level Detection (Fastest Operation)
CPU
DMAC
CPU
DMAC
CPU
CPU
CPU
CK
DREQ
DRAK
cycle
DACK
Bus
Figure 9.18 Cycle Steal, Single Address and Level Detection (Normal Operation)
Burst Mode, Dual Address, and Level Detection: DREQ sampling timing in burst mode with
dual address and level detection is virtually the same as that of cycle steal mode.
For example, DMAC transfer begins (figure 9.19), at the earliest, three cycles after the timing of
the first sampling. The second sampling also begins from the start of the transfer one bus cycle
before the start of the first DMAC transfer. In burst mode, as long as transfer requests are issued,
DMAC transfer continues. Therefore, the “transfer one bus cycle before the start of the DMAC
transfer” may be a DMAC transfer.
In burst mode, the DACK output period is thesame as that of cycle steal mode. Figure 9.20 shows
the normal operation of this burst mode.
DMAC(R)
CPU
DMAC(R) DMAC(W) DMAC(R) DMAC(W) DMAC(R) DMAC(W)
CPU
CPU
CPU
CK
DREQ
DRAK
cycle
DACK
Bus
Figure 9.19 Burst Mode, Dual Address and Level Detection (Fastest Operation)
DMAC(R)
DMAC(R) DMAC(W)
DMAC(W)
DMAC(R)
CPU
CPU
CPU
CK
DREQ
DRAK
cycle
DACK
Bus
Figure 9.20 Burst Mode, Dual Address and Level Detection (Normal Operation)
Burst Mode, Single Address, and Level Detection: DREQ sampling timing in burst mode with
single address and level detection is shown in figures 9.21 and 9.22.
In burst mode with single address and level detection, a dummy cycle is inserted as one bus cycle,
at the earliest, three cycles after timing of the first sampling. Data during this period is undefined,
and the DACK signal is not output. Nor is the number of DMAC transfers counted. The actual
DMAC transfer begins after one dummy bus cycle output.
The dummy cycle is not counted either at the start of the second sampling (transfer one bus cycle
before the start of the first DMAC transfer). Therefore, the second sampling is not conducted from
the bus cycle starting the dummy cycle, but from the start of the CPU(3) bus cycle.
Thereafter, as long the DREQ is continuously sampled, no dummy cycle is inserted. DREQ
sampling timing during this period begins from the start of the transfer one bus cycle before the
start of DMAC transfer, in the same way as with cycle steal mode.
As with the four samplings in figure 9.21, once DMAC transfer is interrupted, a dummy cycle is
again inserted at the start as soon as DMAC transfer is resumed.
The DACK output period in burst mode is the same as in cycle steal mode.
CPU(4) Dummy
DMAC
4th sampling
DMAC
3rd sampling
DMAC
2nd sampling
CPU(1)
CK
DREQ
DRAK
cycle
DACK
Bus
Figure 9.21 Burst Mode, Single Address and Level Detection (Fastest Operation)
DMAC
DMAC
DMAC
Dummy
CPU
CPU
CPU
CK
DREQ
DRAK
cycle
DACK
Bus
Figure 9.22 Burst Mode, Single Address and Level Detection (Normal Operation)
Burst Mode, Dual Address, and Edge Detection: In burst mode with dual address and edge
detection, DREQ sampling is conducted only on the first cycle.
In figure 9.23, DMAC transfer begins, at the earliest, three cycles after the timing of the first
sampling. Thereafter, DMAC transfer continues until the end of the data transfer count set in the
TCR. DREQ sampling is not conducted during this period. Therefore, DRAK is output on the first
cycle only.
When DMAC transfer is resumed after being halted by a NMI or address error, be sure to reinput
an edge request. The remaining transfer restarts after the first DRAK output.
The DACK output period in burst mode is the same as in cycle steal mode.
DREQ
DRAK
cycle
DACK
Bus
Burst Mode, Single Address, and Edge Detection: In burst mode with single address and edge
detection, DREQ sampling is conducted only on the first cycle. In figure 9.24, a dummy cycle is
inserted, at the earliest, three cycles after the timing for the first sampling. During this period, data
is undefined, and DACK is not output. Nor is the number of DMAC transfers counted. Thereafter,
DMAC transfer continues until the data transfer count set in the TCR has ended. DREQ sampling
is not conducted during this period. Therefore, DRAK is output on the first cycle only.
When DMAC transfer is resumed after being halted by a NMI or address error, be sure to reinput
an edge request. DRAK is output once, and the remaining transfer restarts after output of one
dummy cycle.
The DACK output period in burst mode is the same as in cycle steal mode.
DMAC
DMAC
DMAC
DMAC
Dummy
CPU
CPU
CPU
CK
DREQ
DRAK
cycle
DACK
Bus
Channel 2 has a source address reload function. This returns to the first value set in the source
address register (SAR2) every four transfers by setting the RO bit of CHCR2 to 1. Figure 9.25
illustrates this operation. Figure 9.26 is a timing chart for reload ON mode, with burst mode,
autorequest, 16-bit transfer data size, SAR2 increment, and DAR2 fixed mode.
DMAC
Address bus
Reload signal SAR2
Reload control
(initial value)
Reload
signal
SAR2
4th count
CK
Internal
SAR2 DAR2 SAR2+2 DAR2 SAR2+4 DAR2 SAR2+6 DAR2 SAR2 DAR2
address bus
Internal
SAR2 data SAR2+2 data SAR2+4 data SAR2+6 data SAR2 data
data bus
1st channel 2 2nd channel 2 3rd channel 2 4th channel 2 5th channel 2
transfer transfer transfer transfer transfer
SAR2 output SAR2+2 output SAR2+4 output SAR2+6 output SAR2 output
DAR2 output DAR2 output DAR2 output DAR2 output DAR2 output
After SAR2+6 output, SAR2 is reloaded Bus right is returned one time in four
The reload function can be executed whether the transfer data size is 8, 16, or 32 bits.
DMATCR2, which specifies the number of transfers, is decremented by 1 at the end of every
single-transfer-unit transfer, regardless of whether the reload function is on or off. Therefore,
when using the reload function in the on state, a multiple of 4 must be specified in DMATCR2.
Operation will not be guaranteed if any other value is set. Also, the counter which counts the
occurrence of four transfers for address reloading is reset by clearing of the DME bit in DMAOR
or the DE bit in CHCR2, setting of the transfer end flag (the TE bit in CHCR2), NMI input, and
setting of the AE flag (address error generation in DMAC transfer), as well as by a reset and in
software standby mode, but SAR2, DAR2, DMATCR2, and other registers are not reset.
Consequently, when one of these sources occurs, there is a mixture of initialized counters and
uninitialized registers in the DMAC, and incorrect operation may result if a restart is executed in
this state. Therefore, when one of the above sources, other than TE setting, occurs during use of
the address reload function, SAR, DAR2, and DMATCR2 settings must be carried out before re-
execution.
The DMA transfer ending conditions vary for individual channels ending and for all channels
ending together.
Individual Channel Ending Conditions: There are two ending conditions. A transfer ends when
the value of the channel’s DMA transfer count register (TCR) is 0, or when the DE bit of the
channel’s CHCR is cleared to 0.
• When DMATCR is 0: When the DMATCR value becomes 0 and the corresponding channel's
DMA transfer ends, the transfer end flag bit (TE) is set in the CHCR. If the IE (interrupt
enable) bit has been set, a DMAC interrupt (DEI) is requested of the CPU.
• When DE of CHCR is 0: Software can halt a DMA transfer by clearing the DE bit in the
channel’s CHCR. The TE bit is not set when this happens.
Conditions for Ending All Channels Simultaneously: Transfers on all channels end when the
NMIF (NMI flag) bit or AE (address error flag) bit is set to 1 in the DMAOR, or when the DME
bit in the DMAOR is cleared to 0.
• When the NMIF or AE bit is set to 1 in DMAOR: When an NMI interrupt or DMAC address
error occurs, the NMIF or AE bit is set to 1 in the DMAOR and all channels stop their
transfers. The DMAC obtains the bus rights, and if these flags are set to 1 during execution of
a transfer, DMAC halts operation when the transfer processing currently being executed ends,
and transfers the bus right to the other bus master. Consequently, even if the NMIF or AE bits
are set to 1 during a transfer, the DMA source address register (SAR), designation address
register (DAR), and transfer count register (TCR) are all updated. The TE bit is not set. To
resume the transfers after NMI interrupt or address error processing, clear the appropriate flag
bit to 0. To avoid restarting a transfer on a particular channel, clear its DE bit to 0.
When the processing of a one unit transfer is complete. In a dual address mode direct address
transfer, even if an address error occurs or the NMI flag is set during read processing, the
transfer will not be halted until after completion of the following write processing. In such a
case, SAR, DAR, and TCR values are updated. In the same manner, the transfer is not halted in
dual address mode indirect address transfers until after the final write processing has ended.
• When DME is cleared to 0 in DMAOR: Clearing the DME bit to 0 in the DMAOR aborts the
transfers on all channels. The TE bit is not set.
The space addressed by the DMAC is 3-cycle space. Therefore, when the CPU becomes the bus
master and accesses the DMAC, a minimum of three basic clock (CLK) cycles are required for
one bus cycle. Also, since the DMAC is located in word space, while a word-size access to the
DMAC is completed in one bus cycle, a longword-size access is automatically divided into two
word accesses, requiring two bus cycles (six basic clock cycles). These two bus cycles are
executed consecutively; a different bus cycle is never inserted between the two word accesses.
This applies to both write accesses and read accesses.
9.4.1 Example of DMA Transfer between On-Chip SCI and External Memory
In this example, on-chip serial communication interface channel 0 (SCI0) received data is
transferred to external memory using the DMAC channel 3.
Table 9.7 indicates the transfer conditions and the setting values of each of the registers.
Table 9.7 Transfer Conditions and Register Set Values for Transfer between On-chip SCI
and External Memory
9.4.2 Example of DMA Transfer between External RAM and External Device with
DACK
In this example, an external request, serial address mode transfer with external memory as the
transfer source and an external device with DACK as the transfer destination is executed using
DMAC channel 1.
Table 9.8 indicates the transfer conditions and the setting values of each of the registers.
Table 9.8 Transfer Conditions and Register Set Values for Transfer between External
RAM and External Device with DACK
9.4.3 Example of DMA Transfer between A/D Converter and Internal Memory (Address
Reload On)
In this example, the on-chip A/D converter channel 0 is the transfer source and internal memory is
the transfer destination, and the address reload function is on.
Table 9.9 indicates the transfer conditions and the setting values of each of the registers.
Table 9.9 Transfer Conditions and Register Set Values for Transfer between A/D
Converter and Internal Memory
When address reload is on, the SAR value returns to its initially established value every four
transfers. In the above example, when a transfer request is input from the A/D converter, the byte
size data is first read in from the H'FFFF85F0 register of AD1 and that data is written to the
internal address H'FFFFE800. Because a byte size transfer was performed, the SAR and DAR
values at this point are H'FFFF85F1 and H'FFFFE801, respectively. Also, because this is a burst
transfer, the bus rights remain secured, so continuous data transfer is possible.
When four transfers are completed, if the address reload is off, execution continues with the fifth
and sixth transfers and the SAR value continues to increment from H'FFFF85F3 to H'FFFF85F4 to
H'FFFF85F5 and so on. However, when the address reload is on, the DMAC transfer is halted
upon completion of the fourth one and the bus right request signal to the CPU is cleared. At this
time, the value stored in SAR is not H'FFFF85F3 to H'FFFF85F4, but H'FFFF85F3 to
H'FFFF85F0, a return to the initially established address. The DAR value always continues to be
decremented regardless of whether the address reload is on or off.
The DMAC internal status, due to the above operation after completion of the fourth transfer, is
indicated in Table 9.10 for both address reload on and off.
To execute transfers after the fifth one when the address reload is on, make the transfer request
source issue another transfer request signal.
9.4.4 Example of DMA Transfer between External Memory and SCI1 Send Side
(Indirect Address On)
In this example, DMAC channel 3 is used, an indirect address designated external memory is the
transfer source and the SCI1 sending side is the transfer destination.
Table 9.11 indicates the transfer conditions and the setting values of each of the registers.
Table 9.11 Transfer Conditions and Register Set Values for Transfer between External
Memory and SCI1 Sending Side
When indirect address mode is on, the data stored in the address established in SAR is not used as
the transfer source data. In the case of indirect addressing, the value stored in the SAR address is
read, then that value is used as the address and the data read from that address is used as the
transfer source data, then that data is stored in the address designated by the DAR.
In the table 9.11 example, when a transfer request from the TDR1 of SCI1 is generated, a read of
the address located at H'00400000, which is the value set in SAR3, is performed first. The data
H'00450000 is stored at this H'00400000 address, and the DMAC first reads this H'00450000
value. It then uses this read value of H'00450000 as an address and reads the value of H'55 that is
stored in the H'00450000 address. It then writes the value H'55 to the address H'FFFF81B3
designated by DAR3 to complete one indirect address transfer.
With indirect addressing, the first executed data read from the address established in SAR3 always
results in a longword size transfer regardless of the TS0, TS1 bit designations for transfer data
size. However, the transfer source address fixed and increment or decrement designations are as
according to the SM0, SM1 bits. Consequently, despite the fact that the transfer data size
designation is byte in this example, the SAR3 value at the end of one transfer is H'00400004. The
write operation is exactly the same as an ordinary dual address transfer write operation.
10.1 Overview
The SH7050 series has an on-chip advanced timer unit (ATU) with one 32-bit timer channel and
nine 16-bit timer channels.
10.1.1 Features
Overall block Diagram ATU Block Diagram: Figure 10.1 shows an overall block diagram of
the ATU.
Interrupts
TCLKA
I/O interrupt
Clock selection
TCLKB IC/OC control Inter-module
control connection
signals
External pins
Counter and register control,
and comparator
Inter-module
address bus
TSTR
Bus interface
........
Inter-module
Module data bus data bus
Legend:
TSTR: Timer start register (16 bits)
Interrupts:
ITV0–ITV3, OV10–OV15, IC10A –IC10D, IMI1A–IMI1F, IMI2A, IMI2B, IMI3A–IMI3D,
IMI4A–IMI4D, IMI5A, IMI5B, CMI6–CMI9, OSI10A–OSI10H
External pins:
TIA0–TID0, TIOA1–TIOF1, TIOA2, TIOIB2, TIOA3–TIOD3, TIOA4–TIOD3, TIOA5, TIOB5,
TO6–TO9, TOA10–TOH10
Inter-module connection signals:
Signals to A/D converter, signals to direct memory access controller (DMAC),
signals to advanced pulse controller (APC)
Block Diagram of Channel 0: Figure 10.2 shows a block diagram of ATU channel 0.
OVI0
ITV
TSTR Clock ICI0A
TGSR control IRQER control
selection ICI0B
ICI0C
ICI0D
TIA0
Control logic TIB0
φ/m
TIC0
1 ≤ m ≤ 32 TID0
TRG1A
TCNT0H
TCNT0L
ICR0CH
ICR0CH
ICR0DH
ICR0AH
ICR0BH
TIOR0A
ICR0DL
ICR0AL
ICR0BL
TSRAH
TSRAL
ITVRR
TIERA
TGSR
Legend:
TSTR: Timer start register (16 bits)
TIOR0A: Timer I/O control register 0A (8 bits)
TGSR: Trigger selection register (8 bits)
TSRA: Timer status register A (8 bits)
TIERA: Timer interrupt enable register A (8 bits)
ITVRR: Interval interrupt request register (8 bits)
TCNT0: Free-running counter 0 (16 bits)
ICR0: Input capture register 0 (16 bits)
Interrupts:
OVI0: Overflow interrupt 0
ITV: Interval interrupt
ICI0: Input capture interrupt 0
Inter-channel connection signal:
TRG1A: Channel 1/GR1A compare-match signal
Block Diagram of Channel 1: Figure 10.3 shows a block diagram of ATU channel 1.
OVI1
IMIA
IMIB
IMIC
TSTR Clock selection Comparator IMID
IMIE
IMIF
TIOA1
TCLKA TIOB1
TCLKB TIOC1
TIOD1
TIOE1
φ/(m·2n) Control logic TIOF1
1 ≤ m ≤ 32 TRG0A
0≤n≤5 TRG1A
OFF1A–1F
TIOR1C
TIOR1A
TIOR1B
TCNT1
TIERB
OSBR
GR1C
GR1D
GR1A
GR1B
GR1E
TSRB
GR1F
TCR1
Legend:
TSTR: Timer start register (16 bits) TIERB: Timer interrupt enable register B (8 bits)
TCR1: Timer control register 1 (8 bits) TCNT1: Free-running counter 1 (16 bits)
TIOR1: Timer I/O control register 1 (8 bits) GR1: General register 1 (16 bits)
TSRB: Timer status register B (8 bits) OSBR: Offset base register (16 bits)
Interrupts:
OVI1: Overflow interrupt 1
IMI1: Input capture/compare-match interrupt 1
Inter-channel connection signals:
OFF1: Offset compare-match signal
TRG0A: Channel 0/ICR0A input signal
TRG1A: Channel 1/GR1A compare-match signal
Block Diagram of Channel 2: Figure 10.4 shows a block diagram of ATU channel 2.
APCHIGH
APCLOW
TSTR
Clock selection Comparator OVI2
IMI2A
TCLKA IMI2B
TCLKB
TIOA2
TIOB2
φ/(m·2n) Control logic
1 ≤ m ≤ 32 OFF2A–2B
0≤n≤5
TIOR2A
TCNT2
TIERC
TSRC
GR2A
GR2B
TCR2
Legend:
TSTR: Timer start register (16 bits)
TCR2: Timer control register 2 (8 bits)
TIOR2A: Timer I/O control register 2 (8 bits)
TSRC: Timer status register C (8 bits)
TIERC: Timer interrupt enable register C (8 bits)
TCNT2: Free-running counter 2 (16 bits)
GR2: General register 2 (16 bits)
Interrupts:
OVI2: Overflow interrupt 2
IMI2: Input capture/compare-match interrupt 2
Inter-channel connection signal:
OFF2: Offset compare-match signal
Inter-module connection signals:
APCHIGH: GR2B compare-match signal
APCLOW: GR2A compare-match signal
Block Diagram of Channels 3 and 4: Figure 10.5 shows a block diagram of ATU channels 3 and
4.
TSTR OVI3/4
IMI3A/4A
Clock selection Comparator IMI3B/4B
IMI3C/4C
TCLKA IMI3D/4D
TCLKB
TIOA3/4
TIOB3/4
φ/(m·2n) Control logic
TIOC3/4
TIOD3/4
1 ≤ m ≤ 32
0≤n≤5
TIOR3A/4A
TIOR3B/4B
TIERDH/L*
TSRDH/L*
GR3C/4C
GR3D/4D
GR3A/4A
GR3B/4B
TCNT3/4
TCR3/4
TMDR*
Legend:
TSTR: Timer start register (16 bits)
TMDR: Timer mode register (8 bits)
TCR: Timer control register (8 bits)
TIOR: Timer I/O control register (8 bits)
TSRD: Timer status register D (8 bits)
TIERD: Timer interrupt enable register D (8 bits)
TCNT: Free-running counter (16 bits)
GR: General register (16 bits)
Interrupts:
OVI: Overflow interrupt
IMI: Input capture/compare-match interrupt
Block Diagram of Channel 5: Figure 10.6 shows a block diagram of ATU channel 5.
TSTR
Clock selection Comparator OVI5
IMI5A
TCLKA IMI5B
TCLKB
TIOA5
φ/(m·2n) Control logic TIOB5
1 ≤ m ≤ 32
0≤n≤5
CTIOR5A
TIERDL*
TSRDL*
TMDR*
TCNT5
GR5A
GR5B
TCR5
Legend:
TSTR: Timer start register (16 bits)
TMDR: Timer mode register (8 bits)
TCR5: Timer control register 5 (8 bits)
TIOR5A: Timer I/O control register 5A (8 bits)
TSRDL: Timer status register DL (8 bits)
TIERDL: Timer interrupt enable register DL (8 bits)
TCNT5: Free-running counter 5 (16 bits)
GR5: General register 5 (16 bits)
Interrupts:
OVI5: Overflow interrupt 5
IMI5: Input capture/compare-match interrupt 5
Block Diagram of Channels 6 to 9: Figure 10.7 shows a block diagram of ATU channels 6 to 9.
1 ≤ m ≤ 32
0≤n≤5
TCNT6–9
CYLR6–9
TCR6–9
DTR6–9
BFR6–9
TIERE
TSRE
Legend:
TCR: Timer control register (8 bits)
TSRE: Timer status register E (8 bits)
TIERE: Timer interrupt enable register E (8 bits)
TCNT: Free-running counter (16 bits)
CYLR: Cycle register (16 bits)
BFR: Buffer register (16 bits)
DTR: Duty register (16 bits)
Interrupt:
CMI: Cycle compare-match interrupt
Block Diagram of Channel 10: Figure 10.8 shows a block diagram of ATU channel 10.
OSI10A–H
OFF1A–F
OFF2A–B Clock selection Comparator TOA10
TOB10
TOC10
TOD10
TOE10
φ/(m·2n) Control logic TOF10
TOG10
1 ≤ m ≤ 32 TOH10
0≤n≤5
DCNT10G
DCNT10C
DCNT10D
DCNT10H
DCNT10A
DCNT10B
DCNT10E
DCNT10F
TCR10
TIERF
TCNR
DSTR
TSRF
Legend:
TCR10: Timer control register 10 (8 bits)
TIERF: Timer interrupt enable register F (8 bits)
TSRF: Timer status register F (8 bits)
DSTR: Down-count start register (8 bits)
TCNR: Timer connection register (8 bits)
DCNT10: Down-counter 10 (16 bits)
Interrupt:
OSI10: One-shot pulse interrupt 10
Inter-channel connection signal:
OFF: Offset compare-match signal
Channel 10.9 shows the connections between channels and between modules in the ATU.
DMAC activation
(input capture)
Channel 0 TRG0A
Trigger output
MUX
TIA0 ICR0AH ICR0AL (synchronous capture)
TCNT0 TIB0 ICR0BH ICR0BL
Internal CLK TCNT0H TCNT0L TIC0 ICR0CH ICR0CL
MUX
TID0 ICR0DH ICR0DL
Internal CLK
MUX
Compare-match signal
transmission to advanced
pulse controller (APC)
DMAC
CYLR6 activation
Internal CLK TCNT6 TO6 DTR6 (compare-
BFR6 match)
Channel 6
Figure 10.10 shows the first and second prescaler stages in the ATU. The output of the first
prescaler stage is input to channel 0. Either the output of the second prescaler stage or an external
clock can be input to channels 1 to 10, and an additional external clock (TCLKA or TCLKB) can
be input to channels 1 to 5.
φ/m (1 ≤ m ≤ 32) can be set as the output of the first prescaler stage (φ'), the setting being made in
prescaler control register 1 (PSCR1).
φ/2 (0 ≤ n ≤ 5) can be set as the output of the second prescaler stage (φ"), the setting being made
n
φ"
TCR6 Channel 6
φ"
TCR7 Channel 7
Table 10.2 shows the pin configuration of the ATU. When these external pin functions are used,
the pin function controller (PFC) should also be set in accordance with the ATU settings. For
details, see section 16, Pin Function Controller.
Abbrevia- Initial
Channel Name tion R/W Value Address Access Size
Common Prescaler register 1 PSCR1 R/W H'00 H'FFFF82E9 8 bits
Timer start register TSTR R/W H'0000 H'FFFF82EA 16 bits
0 Trigger selection register TGSR R/W H'00 H'FFFF8280 8 bits
Timer I/O control register 0A TIOR0A R/W H'00 H'FFFF8281 8 bits
Interval interrupt request ITVRR R/W H'00 H'FFFF8282 8 bits
register
R/(W)* H'00
1
Timer status register AH TSRAH H'FFFF8283 8 bits
Timer interrupt enable TIERA R/W H'00 H'FFFF8284 8 bits
register A
R/(W)* H'00
1
Timer status register AL TSRAL H'FFFF8285 8 bits
Free-running counter 0H TCNT0H R/W H'0000 H'FFFF8288 32 bits
Free-running counter 0L TCNT0L R/W H'0000
Input capture register 0AH ICR0AH R H'0000 H'FFFF828C 32 bits
Input capture register 0AL ICR0AL R H'0000
Input capture register 0BH ICR0BH R H'0000 H'FFFF8290 32 bits
Input capture register 0BL ICR0BL R H'0000
Input capture register 0CH ICR0CH R H'0000 H'FFFF8294 32 bits
Input capture register 0CL ICR0CL R H'0000
Input capture register 0DH ICR0DH R H'0000 H'FFFF8298 32 bits
Input capture register 0DL ICR0DL R H'0000
1 Timer control register 1 TCR1 R/W H'00 H'FFFF82C0 8 bits 16 bits
Timer I/O control register 1A TIOR1A R/W H'00 H'FFFF82C1 8 bits
Timer I/O control register 1B TIOR1B R/W H'00 H'FFFF82C2 8 bits 16 bits
Timer I/O control register 1C TIOR1C R/W H'00 H'FFFF82C3 8 bits
Timer interrupt enable TIERB R/W H'00 H'FFFF82C4 8 bits
register B
R/(W)* H'00
1
Timer status register B TSRB H'FFFF82C5 8 bits
Free-running counter 1 TCNT1 R/W H'0000 H'FFFF82D0 16 bits
Abbrevia- Initial
Channel Name tion R/W Value Address Access Size
1 General register 1A GR1A R/W H'FFFF H'FFFF82D2 16 bits
General register 1B GR1B R/W H'FFFF H'FFFF82D4 16 bits
General register 1C GR1C R/W H'FFFF H'FFFF82D6 16 bits
General register 1D GR1D R/W H'FFFF H'FFFF82D8 16 bits
General register 1E GR1E R/W H'FFFF H'FFFF82DA 16 bits
General register 1F GR1F R/W H'FFFF H'FFFF82DC 16 bits
Offset base register OSBR R H'0000 H'FFFF82DE 16 bits
2 Timer control register 2 TCR2 R/W H'00 H'FFFF82C6 8 bits 16 bits
Timer I/O control register 2A TIOR2A R/W H'00 H'FFFF82C7 8 bits
Timer interrupt enable TIERC R/W H'00 H'FFFF82C8 8 bits
register C
R/(W)* H'00
1
Timer status register C TSRC H'FFFF82C9 8 bits
Free-running counter 2 TCNT2 R/W H'0000 H'FFFF82CA 16 bits
General register 2A GR2A R/W H'FFFF H'FFFF82CC 16 bits
General register 2B GR2B R/W H'FFFF H'FFFF82CE 16 bits
3–5 Timer mode register TMDR R/W H'00 H'FFFF8200 8 bits
Timer interrupt enable TIERDH R/W H'00 H'FFFF8202 8 bits
register DH
R/(W)* H'00
1
Timer status register DH TSRDH H'FFFF8203 8 bits
Timer interrupt enable TIERDL R/W H'00 H'FFFF8204 8 bits
register DL
R/(W)* H'00
1
Timer status register DL TSRDL H'FFFF8205 8 bits
3 Timer I/O control register 3A TIOR3A R/W H'00 H'FFFF8208 8 bits 16 bits
Timer I/O control register 3B TIOR3B R/W H'00 H'FFFF8209 8 bits
Free-running counter 3 TCNT3 R/W H'0000 H'FFFF820E 16 bits
General register 3A GR3A R/W H'FFFF H'FFFF8210 16 bits
General register 3B GR3B R/W H'FFFF H'FFFF8212 16 bits
General register 3C GR3C R/W H'FFFF H'FFFF8214 16 bits
General register 3D GR3D R/W H'FFFF H'FFFF8216 16 bits
Timer control register 3 TCR3 R/W H'00 H'FFFF8206 8 bits 16 bits
4 Timer control register 4 TCR4 R/W H'00 H'FFFF8207 8 bits
Abbrevia- Initial
Channel Name tion R/W Value Address Access Size
4 Timer I/O control register 4A TIOR4A R/W H'00 H'FFFF820A 8 bits 16 bits
Timer I/O control register 4B TIOR4B R/W H'00 H'FFFF820B 8 bits
Free-running counter 4 TCNT4 R/W H'0000 H'FFFF8218 16 bits
General register 4A GR4A R/W H'FFFF H'FFFF821A 16 bits
General register 4B GR4B R/W H'FFFF H'FFFF821C 16 bits
General register 4C GR4C R/W H'FFFF H'FFFF821E 16 bits
General register 4D GR4D R/W H'FFFF H'FFFF8220 16 bits
5 Timer control register 5 TCR5 R/W H'00 H'FFFF820C 8 bits 16 bits
Timer I/O control register 5A TIOR5A R/W H'00 H'FFFF820D 8 bits
Free-running counter 5 TCNT5 R/W H'0000 H'FFFF8222 16 bits
General register 5A GR5A R/W H'FFFF H'FFFF8224 16 bits
General register 5B GR5B R/W H'FFFF H'FFFF8226 16 bits
6–9 Timer interrupt enable TIERE R/W H'00 H'FFFF8240 8 bits
register E
R/(W)* H'00
1
Timer status register E TSRE H'FFFF8241 8 bits
6 Free-running counter 6 TCNT6 R/W H'0001 H'FFFF8246 16 bits
Cycle register 6 CYLR6 R/W H'FFFF H'FFFF8248 16 bits
Buffer register 6 BFR6 R/W H'FFFF H'FFFF824A 16 bits
Duty register 6 DTR6 R/W H'FFFF H'FFFF824C 16 bits
Timer control register 6 TCR6 R/W H'00 H'FFFF8243 8 bits 16 bits
7 Timer control register 7 TCR7 R/W H'00 H'FFFF8242 8 bits
Free-running counter 7 TCNT7 R/W H'0001 H'FFFF824E 16 bits
Cycle register 7 CYLR7 R/W H'FFFF H'FFFF8250 16 bits
Buffer register 7 BFR7 R/W H'FFFF H'FFFF8252 16 bits
Duty register 7 DTR7 R/W H'FFFF H'FFFF8254 16 bits
8 Free-running counter 8 TCNT8 R/W H'0001 H'FFFF8256 16 bits
Cycle register 8 CYLR8 R/W H'FFFF H'FFFF8258 16 bits
Buffer register 8 BFR8 R/W H'FFFF H'FFFF825A 16 bits
Duty register 8 DTR8 R/W H'FFFF H'FFFF825C 16 bits
Timer control register 8 TCR8 R/W H'00 H'FFFF8245 8 bits 16 bits
9 Timer control register 9 TCR9 R/W H'00 H'FFFF8244 8 bits
Abbrevia- Initial
Channel Name tion R/W Value Address Access Size
9 Free-running counter 9 TCNT9 R/W H'0001 H'FFFF825E 16 bits
Cycle register 9 CYLR9 R/W H'FFFF H'FFFF8260 16 bits
Buffer register 9 BFR9 R/W H'FFFF H'FFFF8262 16 bits
Duty register 9 DTR9 R/W H'FFFF H'FFFF8264 16 bits
10 Timer control register 10 TCR10 R/W H'00 H'FFFF82E0 8 bits 16 bits
Timer connection register TCNR R/W H'00 H'FFFF82E1 8 bits
Timer interrupt enable TIERF R/W H'00 H'FFFF82E2 8 bits
register F
R/(W)* H'00
1
Timer status register F TSRF H'FFFF82E3 8 bits
R/(W)* H'00
2
Down-count start register DSTR H'FFFF82E5 8 bits
Down-counter 10A DCNT10A R/W H'FFFF H'FFFF82F0 16 bits
Down-counter 10B DCNT10B R/W H'FFFF H'FFFF82F2 16 bits
Down-counter 10C DCNT10C R/W H'FFFF H'FFFF82F4 16 bits
Down-counter 10D DCNT10D R/W H'FFFF H'FFFF82F6 16 bits
Down-counter 10E DCNT10E R/W H'FFFF H'FFFF82F8 16 bits
Down-counter 10F DCNT10F R/W H'FFFF H'FFFF82FA 16 bits
Down-counter 10G DCNT10G R/W H'FFFF H'FFFF82FC 16 bits
Down-counter 10H DCNT10H R/W H'FFFF H'FFFF82FE 16 bits
Notes: 1. Only 0 can be written after reading 1, to clear flags.
2. Only 1 can be written, to set flags.
8-bit registers, and 16-bit registers and counters, are accessed in two cycles, but since the
data bus is 16 bits wide, 32-bit registers and counters are accessed in four cycles.
The timer start register (TSTR) is a 16-bit register. The ATU has one TSTR register.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
— — — — — — STR9 STR8 STR7 STR6 STR5 STR4 STR3 STR2 STR1 STR0
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R R R R R R R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
TSTR is a 16-bit readable/writable register that starts and stops the free-running counter (TCNT)
in channels 0 to 9.
TSTR is initialized to H'0000 by a power-on reset, and in hardware standby mode and software
standby mode.
Bits 15 to 10—Reserved: These bits are always read as 0, and should only be written with 0.
Bit 9—Counter Start 9 (STR9): Starts and stops free-running counter 9 (TCNT9).
Bit 9:
STR7 Description
0 TCNT9 is halted (Initial value)
1 TCNT9 counts
Bit 8—Counter Start 8 (STR8): Starts and stops free-running counter 8 (TCNT8).
Bit 8:
STR8 Description
0 TCNT8 is halted (Initial value)
1 TCNT8 counts
Bit 7—Counter Start 7 (STR7): Starts and stops free-running counter 7 (TCNT7).
Bit 7:
STR7 Description
0 TCNT7 is halted (Initial value)
1 TCNT7 counts
Bit 6—Counter Start 6 (STR6): Starts and stops free-running counter 6 (TCNT6).
Bit 6: Description
STR6
0 TCNT6 is halted (Initial value)
1 TCNT6 counts
Bit 5—Counter Start 5 (STR5): Starts and stops free-running counter 5 (TCNT5).
Bit 5:
STR5 Description
0 TCNT5 is halted (Initial value)
1 TCNT5 counts
Bit 4—Counter Start 4 (STR4): Starts and stops free-running counter 4 (TCNT4).
Bit 4:
STR4 Description
0 TCNT4 is halted (Initial value)
1 TCNT4 counts
Bit 3—Counter Start 3 (STR3): Starts and stops free-running counter 3 (TCNT3).
Bit 3:
STR3 Description
0 TCNT3 is halted (Initial value)
1 TCNT3 counts
Bit 2—Counter Start 2 (STR2): Starts and stops free-running counter 2 (TCNT2).
Bit 2:
STR2 Description
0 TCNT2 is halted (Initial value)
1 TCNT2 counts
Bit 1—Counter Start 1 (STR1): Starts and stops free-running counter 1 (TCNT1).
Bit 1:
STR1 Description
0 TCNT1 is halted (Initial value)
1 TCNT1 counts
Bit 0—Counter Start 0 (STR0): Starts and stops free-running counter 0 (TCNT0).
Bit 0:
STR0 Description
0 TCNT0 is halted (Initial value)
1 TCNT0 counts
The timer mode register (TMDR) is an 8-bit register. The ATU has one TDR register.
Bit: 7 6 5 4 3 2 1 0
— — — — — T5PWN T4PWN T3PWN
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R/W R/W R/W
TMDR is an 8-bit readable/writable register that specifies whether channels 3 to 5 are used in
input capture/output compare mode or PWM mode.
TMDR is initialized to H'00 by a power-on reset, and in hardware standby mode and software
standby mode.
Bits 7 to 3—Reserved: These bits are always read as 0, and should only be written with 0.
Bit 2—PWM Mode 5 (T5PWM): Selects whether channel 5 operates in input capture/output
compare mode or PWM mode.
Bit 2:
T5PWM Description
0 Channel 5 operates in input capture/output compare mode (Initial value)
1 Channel 5 operates in PWM mode
When bit T5PWM is set to 1 to select PWM mode, pin TIOA5 becomes a PWM output pin,
general register 5B (GR5B) functions as a cycle register, and general register 5A (GR5A) as a
duty register.
Bit 1—PWM Mode 4 (T4PWM): Selects whether channel 4 operates in input capture/output
compare mode or PWM mode.
Bit 1:
T4PWM Description
0 Channel 4 operates in input capture/output compare mode (Initial value)
1 Channel 4 operates in PWM mode
When bit T4PWM is set to 1 to select PWM mode, pins TIOA4 to TIOC4 become PWM output
pins, general register 4D (GR4D) functions as a cycle register, and general registers 4A to 4C
(GR4A to GR4C) as duty registers.
Bit 0—PWM Mode 3 (T3PWM): Selects whether channel 3 operates in input capture/output
compare mode or PWM mode.
Bit 0:
T3PWM Description
0 Channel 3 operates in input capture/output compare mode (Initial value)
1 Channel 3 operates in PWM mode
When bit T3PWM is set to 1 to select PWM mode, pins TIOA3 to TIOC3 become PWM output
pins, general register 3D (GR3D) functions as a cycle register, and general registers 3A to 3C
(GR3A to GR3C) as duty registers.
Prescaler register 1 (PSCR1) is an 8-bit register. The ATU has one PSCR1 register.
Bit: 7 6 5 4 3 2 1 0
— — — PSCE PSCD PSCC PSCB PSCA
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R/W R/W R/W R/W R/W
PSCR1 is an 8-bit readable/writable register that enables the first-stage counter clock φ' input to
each free-running counter (TCNT0 to TCNT9) and down-counter (DCNT10A to DCNT10H) to be
set to any value from φ/1 to φ/32.
Input counter clock φ' is determined by setting PSCA to PSCE: φ' is φ/1 when the set value is
H'00, and φ/32 when H'1F.
PSCR1 is initialized to H'00 by a power-on reset, and in hardware standby mode and software
standby mode.
The internal clock φ' set with this register can undergo further second-stage scaling to create clock
φ" for channels 1 to 10, the setting being made in the timer control register (TCR).
The timer control registers (TCR) are 8-bit registers. The ATU has ten TCR registers. one for each
channel.
Channel Abbreviation Function
1 TCR1 Internal clock/external clock selection
2 TCR2 When internal clock is selected: Further scaling of clock φ' scaled
with PSCR1, to create φ"
3 TCR3
When external clock is selected: Selection of 2 external clocks,
4 TCR4
selection of input edge
5 TCR5
6 TCR6 Further scaling of clock φ' scaled with PSCR1, to create φ"
7 TCR7 (internal clock only)
8 TCR8
9 TCR9
10 TCR10 Further scaling of clock φ' scaled with PSCR1, to create φ"
(internal clock only)
Each TCR is an 8-bit readable/writable register that selects whether an internal clock or external
clock is used for channels 1 to 5.
When an internal clock is selected, TCR selects the value of φ" further scaled from clock φ' scaled
with prescaler register 1 (PSCR1). Scaled clock φ" can be selected, for channels 1 to 10 only, from
φ', φ'/2, φ'/4, φ'/8, φ'/16, and φ'/32 (only φ' is available for channel 0). Edge detection is performed
on the rising edge.
When an external clock is selected (channels 1 to 5 only), TCR selects whether TCLKA or
TCLKB is used, and also performs edge selection.
Each TCR is initialized to H'00 by a power-on reset, and in hardware standby mode and software
standby mode.
Bit: 7 6 5 4 3 2 1 0
— — CKEG1 CKEG0 — CKSEL2 CKSEL1 CKSEL0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R/W R/W R R/W R/W R/W
Bits 7 and 6—Reserved: These bits are always read as 0, and should only be written with 0.
Bits 5 and 4—Clock Edge 1 and 0 (CKEG1, CKEG0): These bits select external clock input
edges when an external clock is used.
Bit 5: Bit 4:
CKEG1 CKEG0 Description
0 0 Rising edges counted (Initial value)
1 Falling edges counted
1 0 Both rising and falling edges counted
1 External clock count disabled
Bit 3—Reserved: This bit is always read as 0, and should only be written with 0.
Bits 2 to 0—Clock Select 2 to 0 (CKSEL2 to CKSEL0): These bits select whether an internal
clock or external clock is used.
When an internal clock is selected, scaled clock φ" is selected from φ', φ'/2, φ'/4, φ'/8, φ'/16, and
φ'/32.
Bit: 7 6 5 4 3 2 1 0
— — — — — CKSEL2 CKSEL1 CKSEL0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R/W R/W R/W
Bits 7 to 3—Reserved: These bits are always read as 0, and should only be written with 0.
Bits 2 to 0—Clock Select 2 to 0 (CKSEL2 to CKSEL0): These bits select clock φ", scaled from
the internal clock source, from φ', φ'/2, φ'/4, φ'/8, φ'/16, and φ'/32.
Bit: 7 6 5 4 3 2 1 0
— CKSEL CKSEL CKSEL — CKSEL CKSEL CKSEL
2A 1A 0A 2B 1B 0B
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R R/W R/W R/W
Bit 7—Reserved: This bit is always read as 0, and should only be written with 0.
Bits 6 to 4—Clock Select 2A to 0A (CKSEL2A to CKSEL0A): These bits select clock φ",
scaled from the internal clock source, for DCNT10A to DCNT10F in channel 10, from φ', φ'/2,
φ'/4, φ'/8, φ'/16, and φ'/32. DCNT10A to DCNT10F all count on the same synchronous clock.
Bit 3—Reserved: This bit is always read as 0, and should only be written with 0.
Bits 2 to 0—Clock Select 2B to 0B (CKSEL2B to CKSEL0B): These bits select clock φ", scaled
from the internal clock source, for DCNT10G and DCNT10H in channel 10, from φ', φ'/2, φ'/4,
φ'/8, φ'/16, and φ'/32. DCNT10G and DCNT10H count on the same synchronous clock.
The timer I/O control registers (TIOR) are 8-bit registers. The ATU has ten TIOR registers, one
for channel 0, three for channel 1, one for channel 2, two each for channels 3 and 4, and one for
channel 5.
Each TIOR is an 8-bit readable/writable register used to select the functions of dedicated input
capture registers and general registers.
For dedicated input capture registers (ICR), TIOR performs edge detection setting.
For general registers (GR), TIOR selects use as an input capture register or output compare
register, and performs edge detection setting. For channels 3 to 5, TIOR also selects enabling or
disabling of free-running counter (TCNT) clearing.
Each TIOR is initialized to H'00 by a power-on reset, and in hardware standby mode and software
standby mode.
Timer I/O control register 0A (TIOR0A) is an 8-bit register. Channel 1 has one TIOR register.
Bit: 7 6 5 4 3 2 1 0
IO0D1 IO0D0 IO0C1 IO0C0 IO0B1 IO0B0 IO0A1 IO0A0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
TIOR0A specifies edge detection for input capture registers ICR0A to ICR0D.
Bits 7 and 6—I/O Control 0D1 and 0D0 (IO0D1, IO0D0): These bits select input capture
register 0D (ICR0D) edge detection.
Bit 7: Bit 6:
IO0D1 IO0D0 Description
0 0 Input capture disabled (Initial value)
1 Input capture in ICR0D on rising edge
1 0 Input capture in ICR0D on falling edge
1 Input capture in ICR0D on both rising and falling edges
Bits 5 and 4—I/O Control 0C1 and 0C0 (IO0C1, IO0C0): These bits select input capture
register 0C (ICR0C) edge detection.
Bit 5: Bit 4:
IO0C1 IO0C0 Description
0 0 Input capture disabled (Initial value)
1 Input capture in ICR0C on rising edge
1 0 Input capture in ICR0C on falling edge
1 Input capture in ICR0C on both rising and falling edges
Bits 3 and 2—I/O Control 0B1 and 0B0 (IO0B1, IO0B0): These bits select input capture
register 0B (ICR0B) edge detection.
Bit 3: Bit 2:
IO0B1 IO0B0 Description
0 0 Input capture disabled (Initial value)
1 Input capture in ICR0B on rising edge
1 0 Input capture in ICR0B on falling edge
1 Input capture in ICR0B on both rising and falling edges
Bits 1 and 0—I/O Control 0A1 and 0A0 (IO0A1, IO0A0): These bits select input capture
register 0A (ICR0A) and offset base register (OSBR) edge detection.
Bit 1: Bit 0:
IO0A1 IO0A0 Description
0 0 Input capture disabled (Initial value)
1 Input capture in ICR0A on rising edge
1 0 Input capture in ICR0A on falling edge
1 Input capture in ICR0A on both rising and falling edges
Timer I/O control register 1A to 1C and 2A (TIOR1A to TIOR1C, TIOR2A) are 8-bit registers.
There are four TIOR registers, three for timer 1 and one for timer 2.
TIOR1A
Bit: 7 6 5 4 3 2 1 0
— IO1B2 IO1B1 IO1B0 — IO1A2 IO1A1 IO1A0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R R/W R/W R/W
TIOR1B
Bit: 7 6 5 4 3 2 1 0
— IO1D2 IO1D1 IO1D0 — IO1C2 IO1C1 IO1C0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R R/W R/W R/W
TIOR1C
Bit: 7 6 5 4 3 2 1 0
— IO1F2 IO1F1 IO1F0 — IO1E2 IO1E1 IO1E0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R R/W R/W R/W
Registers TIOR0A to TIOR1C specify whether general registers GR1A to GR1F are used as input
capture or compare-match registers, and also perform edge detection and output value setting.
Each TIOR is initialized to H'00 by a power-on reset, and in hardware standby mode and software
standby mode.
TIOR2A
Bit: 7 6 5 4 3 2 1 0
— IO2B2 IO2B1 IO2B0 — IO2A2 IO2A1 IO2A0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R R/W R/W R/W
TIOR2A specifies whether general registers GR2A and GR2B are used as input capture or
compare-match registers, and also performs edge detection and output value setting.
TIOR2A is initialized to H'00 by a power-on reset, and in hardware standby mode and software
standby mode.
Bit 7—Reserved: This bit is always read as 0, and should only be written with 0.
Bits 6 to 4—I/O Control 1B2 to 1B0, 1D2 to 1D0, 1F2 to 1F0, 2B2 to 2B0 (IO1B2 to IO1B0,
IO1D2 to IO1D0, IOF12 to IO1F0, IO2B2 to IO2B0): These bits select the general register
(GR) function.
Bit 3—Reserved: This bit is always read as 0, and should only be written with 0.
Bits 2 to 0—I/O Control 1A2 to 1A0, 1C2 to 1C0, 1E2 to 1E0, 2A2 to 2A0 (IO1A2 to IO1A0,
IO1C2 to IO1C0, IO1E2 to IO1E0, IO2A2 to IO2A0): These bits select the general register
(GR) function.
Timer I/O Control Registers 3A, 3B, 4A, 4B, 5A (TIOR3A, TO0R3B, TIOR4A, TIOR4B,
TIOR5A)
Timer I/O control registers 3A, 3B, 4A, 4B, and 5A (TIOR3A, TO0R3B, TIOR4A, TIOR4B,
TIOR5A) are 8-bit registers. There are five TIOR registers, two each for channels 3 and 4, and one
for channel 5.
TIOR3A
Bit: 7 6 5 4 3 2 1 0
CCI3B IO3B2 IO3B1 IO3B0 CCI3A IO3A2 IO3A1 IO3A0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
TIOR3B
Bit: 7 6 5 4 3 2 1 0
CCI3D IO3D2 IO3D1 IO3D0 CCI3C IO3C2 IO3C1 IO3C0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
TIOR3A and TIOR3B are 8-bit readable/writable registers. When bit 0 of TMDR is 0, they
specify whether general registers GR3A to GR3D are used as input capture or compare-match
registers, and also perform edge detection and output value setting. Also, when bit 0 of TMDR is
0, they select enabling or disabling of free-running counter (TCNT3) clearing.
Each TIOR is initialized to H'00 by a power-on reset, and in hardware standby mode and software
standby mode.
TIOR4A
Bit: 7 6 5 4 3 2 1 0
CCI4B IO4B2 IO4B1 IO4B0 CCI4A IO4A2 IO4A1 IO4A0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
TIOR4B
Bit: 7 6 5 4 3 2 1 0
CCI4D IO4D2 IO4D1 IO4D0 CCI4C IO4C2 IO4C1 IO4C0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
TIOR4A and TIOR4B are 8-bit readable/writable registers. When bit 1 of TMDR is 0, they
specify whether general registers GR4A to GR4D are used as input capture or compare-match
registers, and also perform edge detection and output value setting. Also, when bit 1 of TMDR is
0, they select enabling or disabling of free-running counter (TCNT4) clearing.
Each TIOR is initialized to H'00 by a power-on reset, and in hardware standby mode and software
standby mode.
TIOR5A
Bit: 7 6 5 4 3 2 1 0
CCI5B IO5B2 IO5B1 IO5B0 CCI5A IO5A2 IO5A1 IO5A0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
TIOR5A is initialized to H'00 by a power-on reset, and in hardware standby mode and software
standby mode.
Bit 7—Clear Counter Enable Flag 3B, 3D, 4B, 4D, 5B (CCI3B, CCI3D, CCI4B, CCI4D,
CCI5B): These bits select enabling or disabling of free-running counter (TCNT) clearing.
Bit 7:
CCIxx Description
0 TCNT clearing disabled (Initial value)
1 TCNT cleared on GR compare-match
Bits 6 to 4—I/O Control 3B2 to 3B0, 3D2 to 3D0, 4B2 to 4B0, 4D2 to 4D0, 5B2 to 5B0 (IO3B2
to IO3B0, IO3D2 to IO3D0, IO4B2 to IO4B0, IO4D2 to IO4D0, IO5B2 to IO5B0): These bits
select the general register (GR) function.
Bit 3—Clear Counter Enable Flag 3A, 3C, 4A, 4C, 5A (CCI3A, CCI3C, CCI4A, CCI4C,
CCI5A): These bits select enabling or disabling of free-running counter (TCNT) clearing.
Bit 3:
CCIxx Description
0 TCNT clearing disabled (Initial value)
1 TCNT cleared on GR compare-match
Bits 2 to 0—I/O Control 3A2 to 3A0, 3C2 to 3C0, 4A2 to 4A0, 4C2 to 4C0, 5A2 to 5A0
(IO3A2 to IO3A0, IO3C2 to IO3C0, IO4A2 to IO4A0, IO4C2 to IO4C0, IO5A2 to IO5A0):
These bits select the general register (GR) function.
The trigger selection register (TGSR) is an 8-bit register. The ATU has one TGSR register.
Bit: 7 6 5 4 3 2 1 0
— — — — — TRG0D — TRG0A
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R/W R R/W
TGSR is an 8-bit readable/writable register that selects an input pin (TIOA, TIOD) or the
compare-match output signal (TGR1A) from the channel 1 general register (GR1A) as the channel
0 input capture register (ICR0A, ICR0D) input trigger.
TGSR is initialized to H'00 by a power-on reset, and in hardware standby mode and software
standby mode.
Bits 7 to 3—Reserved: These bits are always read as 0, and should only be written with 0.
Bit 2—ICR0D Input Trigger (TRG0D): Selects whether a pin (TIOD) or the channel 1
compare-match signal (TRG1A) is to be used as the channel 0 input capture register (ICR0D)
input trigger.
Bit 2:
TRG0D Description
0 Input pin (TIOD) used as input trigger (Initial value)
1 Channel 1 compare-match signal (TRG1A) used as input trigger
Bit 1—Reserved: This bit is always read as 0, and should only be written with 0.
Bit 0—ICR0A Input Trigger (TRG0A): Selects whether a pin (TIOA) or the channel 1
compare-match signal (TRG1A) is to be used as the channel 0 input capture register (ICR0A)
input trigger.
Bit 0:
TRG0A Description
0 Input pin (TIOA) used as input trigger (Initial value)
1 Channel 1 compare-match signal (TRG1A) used as input trigger
The timer status registers (TSR) are 8-bit registers. The ATU has eight TSR registers: two for
channel 0, one each for channels 1 and 2, two for channels 3 to 5, one for channels 6 to 9, and one
for channel 10.
The TSR registers are 8-bit readable/writable registers containing flags that indicate free-running
counter (TCNT) overflow, channel 0 input capture or interval interrupt generation, general register
input capture or compare-match, channel 6 to 9 compare-matches, down-counter underflow.
Each flag is an interrupt source, and issues an interrupt request to the CPU if the interrupt is
enabled by the corresponding bit in the timer interrupt enable register (TIER).
Each TSR is initialized to H'00 by a power-on reset, and in hardware standby mode and software
standby mode.
Bit: 7 6 5 4 3 2 1 0
— — — — IIF3 IIF2 IIF1 IIF0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R/(W)* R/(W)* R/(W)* R/(W)*
Note: * Only 0 can be written, to clear the flag.
Bits 7 to 4—Reserved: These bits are always read as 0, and should only be written with 0.
Bit 3—Interval Interrupt Flag (IIF3): Status flag that indicates the generation of an interval
interrupt.
Bit 3:
IIF3 Description
0 [Clearing condition] (Initial value)
When IIF3 is read while set to 1, then 0 is written in IIF3
1 [Setting condition]
When 1 is generated by AND of ITVE3 in ITVRR and bit 13 of TCNT0L
Bit 2—Interval Interrupt Flag (IIF2): Status flag that indicates the generation of an interval
interrupt.
Bit 2:
IIF2 Description
0 [Clearing condition] (Initial value)
When IIF2 is read while set to 1, then 0 is written in IIF2
1 [Setting condition]
When 1 is generated by AND of ITVE2 in ITVRR and bit 12 of TCNT0L
Bit 1—Interval Interrupt Flag (IIF1): Status flag that indicates the generation of an interval
interrupt.
Bit 1:
IIF1 Description
0 [Clearing condition] (Initial value)
When IIF1 is read while set to 1, then 0 is written in IIF1
1 [Setting condition]
When 1 is generated by AND of ITVE1 in ITVRR and bit 11 of TCNT0L
Bit 0—Interval Interrupt Flag (IIF0): Status flag that indicates the generation of an interval
interrupt.
Bit 0:
IIF0 Description
0 [Clearing condition] (Initial value)
When IIF0 is read while set to 1, then 0 is written in IIF0
1 [Setting condition]
When 1 is generated by AND of ITVE0 in ITVRR and bit 10 of TCNT0L
Bit: 7 6 5 4 3 2 1 0
— — — OVF0 ICF0D ICF0C ICF0B ICF0A
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R/(W)* R/(W)* R/(W)* R/(W)* R/(W)*
Note: * Only 0 can be written, to clear the flag.
Bits 7 to 5—Reserved: These bits are always read as 0, and should only be written with 0.
Bit 4—Overflow Flag (OVF0): Status flag that indicates TCNT0 overflow.
Bit 4:
OVF0 Description
0 [Clearing condition] (Initial value)
When OVF0 is read while set to 1, then 0 is written in OVF0
1 [Setting condition]
When the TCNT0 value overflows (from H'FFFFFFFF to H'00000000)
Bit 3—Input Capture Flag (ICF0D): Status flag that indicates ICR0D input capture.
Bit 3:
ICF0D Description
0 [Clearing condition] (Initial value)
When ICF0D is read while set to 1, then 0 is written in ICF0D
1 [Setting condition]
When the TCNT0 value is transferred to the input capture register (ICR0D) by an input
capture signal
Bit 2—Input Capture Flag (ICF0C): Status flag that indicates ICR0C input capture.
Bit 2:
ICF0C Description
0 [Clearing condition] (Initial value)
When ICF0C is read while set to 1, then 0 is written in ICF0C
1 [Setting condition]
When the TCNT0 value is transferred to the input capture register (ICR0C) by an input
capture signal
Bit 1—Input Capture Flag (ICF0B): Status flag that indicates ICR0B input capture.
Bit 1:
ICF0B Description
0 [Clearing condition] (Initial value)
When ICF0B is read while set to 1, then 0 is written in ICF0B
1 [Setting condition]
When the TCNT0 value is transferred to the input capture register (ICR0B) by an input
capture signal
Bit 0—Input Capture Flag (ICF0A): Status flag that indicates ICR0A input capture.
Bit 0:
ICF0A Description
0 [Clearing condition] (Initial value)
When ICF0A is read while set to 1, then 0 is written in ICF0A
1 [Setting condition]
When the TCNT0 value is transferred to the input capture register (ICR0A) by an input
capture signal
TSRB indicates the status of channel 1 input capture, compare-match, and overflow.
Bit: 7 6 5 4 3 2 1 0
— OVF1 IMF1F IMF1E IMF1D IMF1C IMF1B IMF1A
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)*
Note: * Only 0 can be written, to clear the flag.
Bit 7—Reserved: This bit is always read as 0, and should only be written with 0.
Bit 6—Overflow Flag (OVF1): Status flag that indicates TCNT1 overflow.
Bit 6:
OVF1 Description
0 [Clearing condition]) (Initial value)
When OVF1 is read while set to 1, then 0 is written in OVF1
1 [Setting condition]
When the TCNT1 value overflows (from H'FFFF to H'0000)
Bit 5—Input Capture/Compare-Match Flag (IMF1F): Status flag that indicates GR1F input
capture or compare-match.
Bit 5:
IMF1F Description
0 [Clearing condition] (Initial value)
When IMF1F is read while set to 1, then 0 is written in IMF1F
1 [Setting conditions]
• When the TCNT1 value is transferred to GR1F by an input capture signal while
GR1F is functioning as an input capture register
• When TCNT1 = GR1F while GR1F is functioning as an output compare register
Bit 4—Input Capture/Compare-Match Flag (IMF1E): Status flag that indicates GR1E input
capture or compare-match.
Bit 4:
IMF1E Description
0 [Clearing condition] (Initial value)
When IMF1E is read while set to 1, then 0 is written in IMF1E
1 [Setting conditions]
• When the TCNT1 value is transferred to GR1E by an input capture signal while
GR1E is functioning as an input capture register
• When TCNT1 = GR1E while GR1E is functioning as an output compare register
Bit 3—Input Capture/Compare-Match Flag (IMF1D): Status flag that indicates GR1D input
capture or compare-match.
Bit 3:
IMF1D Description
0 [Clearing condition] (Initial value)
When IMF1D is read while set to 1, then 0 is written in IMF1D
1 [Setting conditions]
• When the TCNT1 value is transferred to GR1D by an input capture signal while
GR1D is functioning as an input capture register
• When TCNT1 = GR1D while GR1D is functioning as an output compare register
Bit 2—Input Capture/Compare-Match Flag (IMF1C): Status flag that indicates GR1C input
capture or compare-match.
Bit 2:
IMF1C Description
0 [Clearing condition] (Initial value)
When IMF1C is read while set to 1, then 0 is written in IMF1C
1 [Setting conditions]
• When the TCNT1 value is transferred to GR1C by an input capture signal while
GR1C is functioning as an input capture register
• When TCNT1 = GR1C while GR1C is functioning as an output compare register
Bit 1—Input Capture/Compare-Match Flag (IMF1B): Status flag that indicates GR1B input
capture or compare-match.
Bit 1:
IMF1B Description
0 [Clearing condition] (Initial value)
When IMF1B is read while set to 1, then 0 is written in IMF1B
1 [Setting conditions]
• When the TCNT1 value is transferred to GR1B by an input capture signal while
GR1B is functioning as an input capture register
• When TCNT1 = GR1B while GR1B is functioning as an output compare register
Bit 0—Input Capture/Compare-Match Flag (IMF1A): Status flag that indicates GR1A input
capture or compare-match.
Bit 0:
IMF1A Description
0 [Clearing condition] (Initial value)
When IMF1A is read while set to 1, then 0 is written in IMF1A
1 [Setting conditions]
• When the TCNT1 value is transferred to GR1A by an input capture signal while
GR1A is functioning as an input capture register
• When TCNT1 = GR1A while GR1A is functioning as an output compare register
TSRC indicates the status of channel 2 input capture, compare-match, and overflow.
Bit: 7 6 5 4 3 2 1 0
— — — — — OVF2 IMF2B IMF2A
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R/(W)* R/(W)* R/(W)*
Note: * Only 0 can be written, to clear the flag.
Bits 7 to 3—Reserved: These bits are always read as 0, and should only be written with 0.
Bit 2—Overflow Flag (OVF2): Status flag that indicates TCNT2 overflow.
Bit 2:
OVF2 Description
0 [Clearing condition] (Initial value)
When OVF2 is read while set to 1, then 0 is written in OVF2
1 [Setting condition]
When the TCNT2 value overflows (from H'FFFF to H'0000)
Bit 1—Input Capture/Compare-Match Flag (IMF2B): Status flag that indicates GR2B input
capture or compare-match.
Bit 1:
IMF2B Description
0 [Clearing condition] (Initial value)
When IMF2B is read while set to 1, then 0 is written in IMF2B
1 [Setting conditions]
• When the TCNT2 value is transferred to GR2B by an input capture signal while
GR2B is functioning as an input capture register
• When TCNT2 = GR2B while GR2B is functioning as an output compare register
Bit 0—Input Capture/Compare-Match Flag (IMF2A): Status flag that indicates GR2A input
capture or compare-match.
Bit 0:
IMF2A Description
0 [Clearing condition] (Initial value)
When IMF2A is read while set to 1, then 0 is written in IMF2A
1 [Setting conditions]
• When the TCNT2 value is transferred to GR2A by an input capture signal while
GR2A is functioning as an input capture register
• When TCNT2 = GR2A while GR2A is functioning as an output compare register
TSRDH indicates the status of channel 3 input capture, compare-match, and overflow.
Bit: 7 6 5 4 3 2 1 0
— — — OVF3 IMF3D IMF3C IMF3B IMF3A
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R/(W)* R/(W)* R/(W)* R/(W)* R/(W)*
Note: * Only 0 can be written, to clear the flag.
Bits 7 to 5—Reserved: These bits are always read as 0, and should only be written with 0.
Bit 4—Overflow Flag (OVF3): Status flag that indicates TCNT3 overflow.
Bit 4:
OVF3 Description
0 [Clearing condition] (Initial value)
When OVF3 is read while set to 1, then 0 is written in OVF3
1 [Setting condition]
When the TCNT3 value overflows (from H'FFFF to H'0000)
Bit 3—Input Capture/Compare-Match Flag (IMF3D): Status flag that indicates GR3D input
capture or compare-match.
Bit 3:
IMF3D Description
0 [Clearing condition] (Initial value)
When IMF3D is read while set to 1, then 0 is written in IMF3D
1 [Setting conditions]
• When the TCNT3 value is transferred to GR3D by an input capture signal while
GR3D is functioning as an input capture register
• When TCNT3 = GR3D while GR3D is functioning as an output compare register
Bit 2—Input Capture/Compare-Match Flag (IMF3C): Status flag that indicates GR3C input
capture or compare-match.
Bit 2:
IMF3C Description
0 [Clearing condition] (Initial value)
When IMF3C is read while set to 1, then 0 is written in IMF3C
1 [Setting conditions]
• When the TCNT3 value is transferred to GR3C by an input capture signal while
GR3C is functioning as an input capture register
• When TCNT3 = GR3C while GR3C is functioning as an output compare register
Bit 1—Input Capture/Compare-Match Flag (IMF3B): Status flag that indicates GR3B input
capture or compare-match.
Bit 1:
IMF3B Description
0 [Clearing condition]) (Initial value)
When IMF3B is read while set to 1, then 0 is written in IMF3B
1 [Setting conditions]
• When the TCNT3 value is transferred to GR3B by an input capture signal while
GR3B is functioning as an input capture register
• When TCNT3 = GR3B while GR3B is functioning as an output compare register
Bit 0—Input Capture/Compare-Match Flag (IMF3A): Status flag that indicates GR3A input
capture or compare-match.
Bit 0:
IMF3A Description
0 [Clearing condition] (Initial value)
When IMF3A is read while set to 1, then 0 is written in IMF3A
1 [Setting conditions]
• When the TCNT3 value is transferred to GR3A by an input capture signal while
GR3A is functioning as an input capture register
• When TCNT3 = GR3A while GR3A is functioning as an output compare register
TSRDL indicates the status of channel 4 and 5 input capture, compare-match, and overflow.
Bit: 7 6 5 4 3 2 1 0
OVF4 IMF4D IMF4C IMF4B IMF4A OVF5 IMF5B IMF5A
Initial value: 0 0 0 0 0 0 0 0
R/W: R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)*
Note: * Only 0 can be written, to clear the flag.
Bit 7—Overflow Flag (OVF4): Status flag that indicates TCNT4 overflow.
Bit 7:
OVF4 Description
0 [Clearing condition] (Initial value)
When OVF4 is read while set to 1, then 0 is written in OVF4
1 [Setting condition]
When the TCNT4 value overflows (from H'FFFF to H'0000)
Bit 6—Input Capture/Compare-Match Flag (IMF4D): Status flag that indicates GR4D input
capture or compare-match.
Bit 6:
IMF4D Description
0 [Clearing condition]) (Initial value)
When IMF4D is read while set to 1, then 0 is written in IMF4D
1 [Setting conditions]
• When the TCNT4 value is transferred to GR4D by an input capture signal while
GR4D is functioning as an input capture register
• When TCNT4 = GR4D while GR4D is functioning as an output compare register
Bit 5—Input Capture/Compare-Match Flag (IMF4C): Status flag that indicates GR4C input
capture or compare-match.
Bit 5:
IMF4C Description
0 [Clearing condition] (Initial value)
When IMF4C is read while set to 1, then 0 is written in IMF4C
1 [Setting conditions]
• When the TCNT4 value is transferred to GR4C by an input capture signal while
GR4C is functioning as an input capture register
• When TCNT4 = GR4C while GR4C is functioning as an output compare register
Bit 4—Input Capture/Compare-Match Flag (IMF4B): Status flag that indicates GR4B input
capture or compare-match.
Bit 4:
IMF4B Description
0 [Clearing condition] (Initial value)
When IMF4B is read while set to 1, then 0 is written in IMF4B
1 [Setting conditions]
• When the TCNT4 value is transferred to GR4B by an input capture signal while
GR4B is functioning as an input capture register
• When TCNT4 = GR4B while GR4B is functioning as an output compare register
Bit 3—Input Capture/Compare-Match Flag (IMF4A): Status flag that indicates GR4A input
capture or compare-match.
Bit 3:
IMF4A Description
0 [Clearing condition] (Initial value)
When IMF4A is read while set to 1, then 0 is written in IMF4A
1 [Setting conditions]
• When the TCNT4 value is transferred to GR4A by an input capture signal while
GR4A is functioning as an input capture register
• When TCNT4 = GR4A while GR4A is functioning as an output compare register
Bit 2—Overflow Flag (OVF5): Status flag that indicates TCNT5 overflow.
Bit 2:
OVF5 Description
0 [Clearing condition] (Initial value)
When OVF5 is read while set to 1, then 0 is written in OVF5
1 [Setting condition]
When the TCNT5 value overflows (from H'FFFF to H'0000)
Bit 1—Input Capture/Compare-Match Flag (IMF5B): Status flag that indicates GR5B input
capture or compare-match.
Bit 1:
IMF5B Description
0 [Clearing condition] (Initial value)
When IMF5B is read while set to 1, then 0 is written in IMF5B
1 [Setting conditions]
• When the TCNT5 value is transferred to GR5B by an input capture signal while
GR5B is functioning as an input capture register
• When TCNT5 = GR5B while GR5B is functioning as an output compare register
Bit 0—Input Capture/Compare-Match Flag (IMF5A): Status flag that indicates GR5A input
capture or compare-match.
Bit 0:
IMF5A Description
0 [Clearing condition] (Initial value)
When IMF5A is read while set to 1, then 0 is written in IMF5A
1 [Setting conditions]
• When the TCNT5 value is transferred to GR5A by an input capture signal while
GR5A is functioning as an input capture register
• When TCNT5 = GR5A while GR5A is functioning as an output compare register
Bit: 7 6 5 4 3 2 1 0
— CMF6 — CMF7 — CMF8 — CMF9
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/(W)* R R/(W)* R R/(W)* R R/(W)*
Note: * Only 0 can be written, to clear the flag.
Bit 7—Reserved: This bit is always read as 0, and should only be written with 0.
Bit 6—Cycle Register Compare-Match Flag (CMF6): Status flag that indicates CYLR6
compare-match.
Bit 6:
CMF6 Description
0 [Clearing conditions] (Initial value)
• When CMF6 is read while set to 1, then 0 is written in CMF6
• When cleared by the DMAC after data transfer when used as a
DMAC activation source
1 [Setting condition]
When TCNT6 = CYLR6
Bit 5—Reserved: This bit is always read as 0, and should only be written with 0.
Bit 4—Cycle Register Compare-Match Flag (CMF7): Status flag that indicates CYLR7
compare-match.
Bit 4:
CMF7 Description
0 [Clearing condition]) (Initial value)
When CMF7 is read while set to 1, then 0 is written in CMF7
1 [Setting condition]
When TCNT7 = CYLR7
Bit 3—Reserved: This bit is always read as 0, and should only be written with 0.
Bit 2—Cycle Register Compare-Match Flag (CMF8): Status flag that indicates CYLR8
compare-match.
Bit 2:
CMF8 Description
0 [Clearing condition] (Initial value)
When CMF8 is read while set to 1, then 0 is written in CMF8
1 [Setting condition]
When TCNT8 = CYLR8
Bit 1—Reserved: This bit is always read as 0, and should only be written with 0.
Bit 0—Cycle Register Compare-Match Flag (CMF9): Status flag that indicates CYLR9
compare-match.
Bit 0:
CMF9 Description
0 [Clearing condition] (Initial value)
When CMF9 is read while set to 1, then 0 is written in CMF9
1 [Setting condition]
When TCNT9 = CYLR9
Bit: 7 6 5 4 3 2 1 0
OSF10H OSF10G OSF10F OSF10E OSF10D OSF10C OSF10B OSF10A
Initial value: 0 0 0 0 0 0 0 0
R/W: R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)*
Note: * Only 0 can be written, to clear the flag.
Bit 7—One-Shot Pulse Flag (OSF10H): Status flag that indicates a DCNT10H one-shot pulse.
Bit 7:
OSF10H Description
0 [Clearing condition]) (Initial value)
When OSF10H is read while set to 1, then 0 is written in OSF10H
1 [Setting condition]
When the down-counter (DCNT10H) value underflows
Bit 6—One-Shot Pulse Flag (OSF10G): Status flag that indicates a DCNT10G one-shot pulse.
Bit 6:
OSF10G Description
0 [Clearing condition] (Initial value)
When OSF10G is read while set to 1, then 0 is written in OSF10G
1 [Setting condition]
When the down-counter (DCNT10G) value underflows
Bit 5—One-Shot Pulse Flag (OSF10F): Status flag that indicates a DCNT10F one-shot pulse.
Bit 5:
OSF10F Description
0 [Clearing condition] (Initial value)
When OSF10F is read while set to 1, then 0 is written in OSF10F
1 [Setting condition]
When the down-counter (DCNT10F) value underflows
Bit 4—One-Shot Pulse Flag (OSF10E): Status flag that indicates a DCNT10E one-shot pulse.
Bit 4:
OSF10E Description
0 [Clearing condition] (Initial value)
When OSF10E is read while set to 1, then 0 is written in OSF10E
1 [Setting condition]
When the down-counter (DCNT10E) value underflows
Bit 3—One-Shot Pulse Flag (OSF10D): Status flag that indicates a DCNT10D one-shot pulse.
Bit 3:
OSF10D Description
0 [Clearing condition]) (Initial value)
When OSF10D is read while set to 1, then 0 is written in OSF10D
1 [Setting condition]
When the down-counter (DCNT10D) value underflows
Bit 2—One-Shot Pulse Flag (OSF10C): Status flag that indicates a DCNT10C one-shot pulse.
Bit 2:
OSF10C Description
0 [Clearing condition] (Initial value)
When OSF10C is read while set to 1, then 0 is written in OSF10C
1 [Setting condition]
When the down-counter (DCNT10C) value underflows
Bit 1—One-Shot Pulse Flag (OSF10B): Status flag that indicates a DCNT10B one-shot pulse.
Bit 1:
OSF10B Description
0 [Clearing condition] (Initial value)
When OSF10B is read while set to 1, then 0 is written in OSF10B
1 [Setting condition]
When the down-counter (DCNT10B) value underflows
Bit 0—One-Shot Pulse Flag (OSF10A): Status flag that indicates a DCNT10A one-shot pulse.
Bit 0:
OSF10A Description
0 [Clearing condition] (Initial value)
When OSF10A is read while set to 1, then 0 is written in OSF10A
1 [Setting condition]
When the down-counter (DCNT10A) value underflows
The timer interrupt enable registers (TIER) are 8-bit registers. The ATU has seven TIER registers:
one each for channels 0, 1, and 2, two for channels 3 to 5, one for channels 6 to 9, and one for
channel 10.
5
6 TIERE Controls cycle register compare-match interrupt request
7 enabling/disabling.
8
9
10 TIERF Controls underflow interrupt request enabling/disabling.
The TIER registers are 8-bit readable/writable registers that control enabling/disabling of free-
running counter (TCNT) overflow interrupt requests, channel 0 input capture interrupt requests,
interval interrupt requests, general register and dedicated input capture register input
capture/compare-match interrupt requests, channel 6 to 9 compare-match interrupt requests, and
down-counter (DCNT) underflow interrupt requests.
Each TIER is initialized to H'00 by a power-on reset, and in hardware standby mode and software
standby mode.
TIERA controls enabling/disabling of channel 0 input capture and overflow interrupt requests.
Bit: 7 6 5 4 3 2 1 0
— — — OVE0 ICE0D ICE0C ICE0B ICE0A
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R/W R/W R/W R/W R/W
Bits 7 to 5—Reserved: These bits are always read as 0, and should only be written with 0.
Bit 4—Overflow Interrupt Enable (OVE0): Enables or disables OVI0 requests when the
overflow flag (OVF0) in TSR is set to 1.
Bit 4:
OVE0 Description
0 OVI0 interrupt requested by OVF0 is disabled (Initial value)
1 OVI0 interrupt requested by OVF0 is enabled
Bit 3—Input Capture Interrupt Enable (ICE0D): Enables or disables ICI0D requests when the
input capture flag (ICF0D) in TSR is set to 1.
Bit 3:
ICE0D Description
0 ICI0D interrupt requested by ICF0D is disabled (Initial value)
1 ICI0D interrupt requested by ICF0D is enabled
Bit 2—Input Capture Interrupt Enable (ICE0C): Enables or disables ICI0C requests when the
input capture flag (ICF0C) in TSR is set to 1.
Bit 2:
ICE0C Description
0 ICI0C interrupt requested by ICF0C is disabled (Initial value)
1 ICI0C interrupt requested by ICF0C is enabled
Bit 1—Input Capture Interrupt Enable (ICE0B): Enables or disables ICI0B requests when the
input capture flag (ICF0B) in TSR is set to 1.
Bit 1:
ICE0B Description
0 ICI0B interrupt requested by ICF0B is disabled (Initial value)
1 ICI0B interrupt requested by ICF0B is enabled
Bit 0—Input Capture Interrupt Enable (ICE0A): Enables or disables ICI0A requests when the
input capture flag (ICF0A) in TSR is set to 1.
Bit 0:
ICE0A Description
0 ICI0A interrupt requested by ICF0A is disabled (Initial value)
1 ICI0A interrupt requested by ICF0A is enabled
Bit: 7 6 5 4 3 2 1 0
— OVE1 IME1F IME1E IME1D IME1C IME1B IME1A
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/W R/W
Bit 7—Reserved: This bit is always read as 0, and should only be written with 0.
Bit 6—Overflow Interrupt Enable (OVE1): Enables or disables interrupt requests by OVF1 in
TSR when OVF1 is set to 1.
Bit 6:
OVE1 Description
0 OVI1 interrupt requested by OVF1 is disabled (Initial value)
1 OVI1 interrupt requested by OVF1 is enabled
Bit 5:
IME1F Description
0 IMI1F interrupt requested by IMF1F is disabled (Initial value)
1 IMI1F interrupt requested by IMF1F is enabled
Bit 4:
IME1E Description
0 IMI1E interrupt requested by IMF1E is disabled (Initial value)
1 IMI1E interrupt requested by IMF1E is enabled
Bit 3:
IME1D Description
0 IMI1D interrupt requested by IMF1D is disabled (Initial value)
1 IMI1D interrupt requested by IMF1D is enabled
Bit 2:
IME1C Description
0 IMI1C interrupt requested by IMF1C is disabled (Initial value)
1 IMI1C interrupt requested by IMF1C is enabled
Bit 1:
IME1B Description
0 IMI1B interrupt requested by IMF1B is disabled (Initial value)
1 IMI1B interrupt requested by IMF1B is enabled
Bit 0:
IME1A Description
0 IMI1A interrupt requested by IMF1A is disabled (Initial value)
1 IMI1A interrupt requested by IMF1A is enabled
Bit: 7 6 5 4 3 2 1 0
— — — — — OVE2 IME2B IME2A
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R/W R/W R/W
Bits 7 to 3—Reserved: These bits are always read as 0, and should only be written with 0.
Bit 2—Overflow Interrupt Enable (OVE2): Enables or disables interrupt requests by OVF2 in
TSR when OVF2 is set to 1.
Bit 2:
OVE2 Description
0 OVI2 interrupt requested by OVF2 is disabled (Initial value)
1 OVI2 interrupt requested by OVF2 is enabled
Bit 1:
IME2B Description
0 IMI2B interrupt requested by IMF2B is disabled (Initial value)
1 IMI2B interrupt requested by IMF2B is enabled
Bit 0:
IME2A Description
0 IMI2A interrupt requested by IMF2A is disabled (Initial value)
1 IMI2A interrupt requested by IMF2A is enabled
Bit: 7 6 5 4 3 2 1 0
— — — OVE3 IME3D IME3C IME3B IME3A
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R/W R/W R/W R/W R/W
Bits 7 to 5—Reserved: These bits are always read as 0, and should only be written with 0.
Bit 4—Overflow Interrupt Enable (OVE3): Enables or disables interrupt requests by OVF3 in
TSR when OVF3 is set to 1.
Bit 4:
OVE3 Description
0 OVI3 interrupt requested by OVF3 is disabled (Initial value)
1 OVI3 interrupt requested by OVF3 is enabled
Bit 3:
IME3D Description
0 IMI3D interrupt requested by IMF3D is disabled (Initial value)
1 IMI3D interrupt requested by IMF3D is enabled
Bit 2:
IME3C Description
0 IMI3C interrupt requested by IMF3C is disabled (Initial value)
1 IMI3C interrupt requested by IMF3C is enabled
Bit 1:
IME3B Description
0 IMI3B interrupt requested by IMF3B is disabled (Initial value)
1 IMI3B interrupt requested by IMF3B is enabled
Bit 0:
IME3A Description
0 IMI3A interrupt requested by IMF3A is disabled (Initial value)
1 IMI3A interrupt requested by IMF3A is enabled
Bit: 7 6 5 4 3 2 1 0
OVE4 IME4D IME4C IME4B IME4A OVE5 IME5B IME5A
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit 7—Overflow Interrupt Enable (OVE4): Enables or disables interrupt requests by OVF4 in
TSR when OVF4 is set to 1.
Bit 7:
OVE4 Description
0 OVI4 interrupt requested by OVF4 is disabled (Initial value)
1 OVI4 interrupt requested by OVF4 is enabled
Bit 6:
IME4D Description
0 IMI4D interrupt requested by IMF4D is disabled (Initial value)
1 IMI4D interrupt requested by IMF4D is enabled
Bit 5:
IME4C Description
0 IMI4C interrupt requested by IMF4C is disabled (Initial value)
1 IMI4C interrupt requested by IMF4C is enabled
Bit 4:
IME4B Description
0 IMI4B interrupt requested by IMF4B is disabled (Initial value)
1 IMI4B interrupt requested by IMF4B is enabled
Bit 3:
IME4A Description
0 IMI4A interrupt requested by IMF4A is disabled (Initial value)
1 IMI4A interrupt requested by IMF4A is enabled
Bit 2—Overflow Interrupt Enable (OVE5): Enables or disables interrupt requests by OVF5 in
TSR when OVF5 is set to 1.
Bit 2:
OVE5 Description
0 OVI5 interrupt requested by OVF5 is disabled (Initial value)
1 OVI5 interrupt requested by OVF5 is enabled
Bit 1:
IME5B Description
0 IMI5B interrupt requested by IMF5B is disabled (Initial value)
1 IMI5B interrupt requested by IMF5B is enabled
Bit 0:
IME5A Description
0 IMI5A interrupt requested by IMF5A is disabled (Initial value)
1 IMI5A interrupt requested by IMF5A is enabled
Bit: 7 6 5 4 3 2 1 0
— CME6 — CME7 — CME8 — CME9
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/W R R/W R R/W R R/W
Bit 7—Reserved: This bit is always read as 0, and should only be written with 0.
Bit 6:
CME6 Description
0 CMI6 interrupt requested by CMF6 is disabled (Initial value)
1 CMI6 interrupt requested by CMF6 is enabled
Bit 5—Reserved: This bit is always read as 0, and should only be written with 0.
Bit 4:
OME7 Description
0 CMI7 interrupt requested by CMF7 is disabled (Initial value)
1 CMI7 interrupt requested by CMF7 is enabled
Bit 3—Reserved: This bit is always read as 0, and should only be written with 0.
Bit 2:
CME8 Description
0 CMI8 interrupt requested by CMF8 is disabled (Initial value)
1 CMI8 interrupt requested by CMF8 is enabled
Bit 1—Reserved: This bit is always read as 0, and should only be written with 0.
Bit 0:
CME9 Description
0 CMI9 interrupt requested by CMF9 is disabled (Initial value)
1 CMI9 interrupt requested by CMF9 is enabled
Bit: 7 6 5 4 3 2 1 0
OSE10H OSE10G OSE10F OSE10E OSE10D OSE10C OSE10B OSE10A
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit 7—One-Shot Pulse Interrupt Enable (OSE10H): Enables or disables interrupt requests by
OSF10H in TSR when OSF10H is set to 1.
Bit 7:
OSE10H Description
0 OSI10H interrupt requested by OSF10H is disabled (Initial value)
1 OSI10H interrupt requested by OSF10H is enabled
Bit 6—One-Shot Pulse Interrupt Enable (OSE10G): Enables or disables interrupt requests by
OSF10G in TSR when OSF10G is set to 1.
Bit 6:
OSE10G Description
0 OSI10G interrupt requested by OSF10G is disabled (Initial value)
1 OSI10G interrupt requested by OSF10G is enabled
Bit 5—One-Shot Pulse Interrupt Enable (OSE10F): Enables or disables interrupt requests by
OSF10F in TSR when OSF10F is set to 1.
Bit 5:
OSE10F Description
0 OSI10F interrupt requested by OSF10F is disabled (Initial value)
1 OSI10F interrupt requested by OSF10F is enabled
Bit 4—One-Shot Pulse Interrupt Enable (OSE10E): Enables or disables interrupt requests by
OSF10E in TSR when OSF10E is set to 1.
Bit 4:
OSE10E Description
0 OSI10E interrupt requested by OSF10E is disabled (Initial value)
1 OSI10E interrupt requested by OSF10E is enabled
Bit 3—One-Shot Pulse Interrupt Enable (OSE10D): Enables or disables interrupt requests by
OSF10D in TSR when OSF10D is set to 1.
Bit 3:
OSE10D Description
0 OSI10D interrupt requested by OSF10D is disabled (Initial value)
1 OSI10D interrupt requested by OSF10D is enabled
Bit 2—One-Shot Pulse Interrupt Enable (OSE10C): Enables or disables interrupt requests by
OSF10C in TSR when OSF10C is set to 1.
Bit 2:
OSE10C Description
0 OSI10C interrupt requested by OSF10C is disabled (Initial value)
1 OSI10C interrupt requested by OSF10C is enabled
Bit 1—One-Shot Pulse Interrupt Enable (OSE10B): Enables or disables interrupt requests by
OSF10B in TSR when OSF10B is set to 1.
Bit 1:
OSE10B Description
0 OSI10B interrupt requested by OSF10B is disabled (Initial value)
1 OSI10B interrupt requested by OSF10B is enabled
Bit 0—One-Shot Pulse Interrupt Enable (OSE10A): Enables or disables interrupt requests by
OSF10A in TSR when OSF10A is set to 1.
Bit 0:
OSE10A Description
0 OSI10A interrupt requested by OSF10A is disabled (Initial value)
1 OSI10A interrupt requested by OSF10A is enabled
The interval interrupt request register (ITVRR) is an 8-bit register. The ATU has one ITVRR
register in channel 0.
Bit: 7 6 5 4 3 2 1 0
ITVAD3 ITVAD2 ITVAD1 ITVAD0 ITVE3 ITVE2 ITVE1 ITVE0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
ITVRR is an 8-bit readable/writable register used for channel 0 interval interrupt bit setting.
ITVRR is initialized to H'00 by a power-on reset, and in hardware standby mode and software
standby mode.
Bit 7—A/D Converter Interval Activation Bit 3 (ITVAD3): A/D converter activation setting bit
corresponding to bit 13 in free running counter 0L (TCNT0L). The rise of bit 13 in TCNT0L is
ANDed with ITVAD3, and the result is output to the A/D converter as an activation signal.
Bit 7:
ITVAD3 Description
0 A/D converter activation by ATU is disabled (Initial value)
1 A/D converter activation by ATU is enabled
Bit 6—A/D Converter Interval Activation Bit 2 (ITVAD2): A/D converter activation setting bit
corresponding to bit 12 in TCNT0L. The rise of bit 12 in TCNT0L is ANDed with ITVAD2, and
the result is output to the A/D converter as an activation signal.
Bit 6:
ITVAD2 Description
0 A/D converter activation by ATU is disabled (Initial value)
1 A/D converter activation by ATU is enabled
Bit 5—A/D Converter Interval Activation Bit 1 (ITVAD1): A/D converter activation setting bit
corresponding to bit 11 in TCNT0L. The rise of bit 11 in TCNT0L is ANDed with ITVAD1, and
the result is output to the A/D converter as an activation signal.
Bit 5:
ITVAD1 Description
0 A/D converter activation by ATU is disabled (Initial value)
1 A/D converter activation by ATU is enabled
Bit 4—A/D Converter Interval Activation Bit 0 (ITVAD0): A/D converter activation setting bit
corresponding to bit 10 in TCNT0L. The rise of bit 10 in TCNT0L is ANDed with ITVAD0, and
the result is output to the A/D converter as an activation signal.
Bit 4:
ITVAD0 Description
0 A/D converter activation by ATU is disabled (Initial value)
1 A/D converter activation by ATU is enabled
Bit 3—Interval Interrupt Bit 3 (ITVE3): Interrupt controller (INTC) interval interrupt setting
bit corresponding to bit 13 in TCNT0L. The rise of bit 13 in TCNT0L is ANDed with ITVE3, the
result is stored in IIF3 in the timer status register (TSRAH), and an interrupt request is sent to
INTC.
Bit 3:
ITVE3 Description
0 ATU interval interrupt generation is disabled (Initial value)
1 Generation of interval interrupt to INTC is enabled
Bit 2—Interval Interrupt Bit 2 (ITVE2): INTC interval interrupt setting bit corresponding to bit
12 in TCNT0L. The rise of bit 12 in TCNT0L is ANDed with ITVE2, the result is stored in IIF2 in
TSRAH, and an interrupt request is sent to INTC.
Bit 2:
ITVE2 Description
0 ATU interval interrupt generation is disabled (Initial value)
1 Generation of interval interrupt to INTC is enabled
Bit 1—Interval Interrupt Bit 1 (ITVE1): INTC interval interrupt setting bit corresponding to bit
11 in TCNT0L. The rise of bit 11 in TCNT0L is ANDed with ITVE1, the result is stored in IIF1 in
TSRAH, and an interrupt request is sent to INTC.
Bit 1
ITVE1 Description
0 ATU interval interrupt generation is disabled (Initial value)
1 Generation of interval interrupt to INTC is enabled
Bit 0—Interval Interrupt Bit 0 (ITVE0): INTC interval interrupt setting bit corresponding to bit
10 in TCNT0L. The rise of bit 10 in TCNT0L is ANDed with ITVE0, the result is stored in IIF0 in
TSRAH, and an interrupt request is sent to INTC.
Bit 0:
ITVE0 Description
0 ATU interval interrupt generation is disabled (Initial value)
1 Generation of interval interrupt to INTC is enabled
The down-count start register (DSTR) is an 8-bit register. The ATU has one DSTR register in
channel 10.
Bit: 7 6 5 4 3 2 1 0
DST10H DST10G DST10F DST10E DST10D DST10C DST10B DST10A
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W* R/W* R/W* R/W* R/W* R/W* R/W* R/W*
Note: * Only 1 can be written.
DSTR is an 8-bit readable/writable register that starts and stops the channel 10 down-counter
(DCNT).
When the one-shot pulse function is used, a value of 1 can be set in a DST10 bit at any time by the
user program. The DST10 bits are cleared to 0 automatically when the DCNT value underflows.
When the offset one-shot pulse function is used, a DST10 bit is automatically set to 1 when a
compare-match occurs between the channel 1 or 2 free-running counter (TCNT) and a general
register (GR) while the corresponding timer connection register (TCNR) bit is set to 1. The bit is
automatically cleared to 0 when the DCNT value underflows. A value of 1 can be set in a DST10
bit at any time by the user program.
DSTR is initialized to H'00 by a power-on reset, and in hardware standby mode and software
standby mode.
For details, see sections 10.3.5, One-Shot Pulse Function, and 10.3.6, Offset One-Shot Pulse
Function.
Bit 7—Down-Count Start Flag 10H (DST10H): Starts and stops down-counter 10H
(DCNT10H).
Bit 7:
DST10H Description
0 DCNT10H is halted (Initial value)
[Clearing condition]
When the DCNT10H value underflows
1 DCNT10H counts
[Setting conditions]
One-shot pulse function: Set by user program
Offset one-shot pulse function: Set on GR2B compare-match, or by user program
Bit 6—Down-Count Start Flag 10G (DST10G): Starts and stops down-counter 10G
(DCNT10G).
Bit 6:
DST10G Description
0 DCNT10G is halted (Initial value)
[Clearing condition]
When the DCNT10G value underflows
1 DCNT10G counts
[Setting conditions]
One-shot pulse function: Set by user program
Offset one-shot pulse function: Set on GR2A compare-match, or by user program
Bit 5—Down-Count Start Flag 10F (DST10F): Starts and stops down-counter 10F (DCNT10F).
Bit 5:
DST10F Description
0 DCNT10F is halted (Initial value)
[Clearing condition]
When the DCNT10F value underflows
1 DCNT10F counts
[Setting conditions]
One-shot pulse function: Set by user program
Offset one-shot pulse function: Set on GR1F compare-match, or by user program
Bit 4—Down-Count Start Flag 10E (DST10E): Starts and stops down-counter 10E (DCNT10E).
Bit 4:
DST10E Description
0 DCNT10E is halted (Initial value)
[Clearing condition]
When the DCNT10E value underflows
1 DCNT10E counts
[Setting conditions]
One-shot pulse function: Set by user program
Offset one-shot pulse function: Set on GR1E compare-match, or by user program
Bit 3—Down-Count Start Flag 10D (DST10D): Starts and stops down-counter 10D
(DCNT10D).
Bit 3:
DST10D Description
0 DCNT10D is halted (Initial value)
[Clearing condition]
When the DCNT10D value underflows
1 DCNT10D counts
[Setting conditions]
One-shot pulse function: Set by user program
Offset one-shot pulse function: Set on GR1D compare-match, or by user program
Bit 2—Down-Count Start Flag 10C (DST10C): Starts and stops down-counter 10C
(DCNT10C).
Bit 2:
DST10C Description
0 DCNT10C is halted (Initial value)
[Clearing condition]
When the DCNT10C value underflows
1 DCNT10C counts
[Setting conditions]
One-shot pulse function: Set by user program
Offset one-shot pulse function: Set on GR1C compare-match, or by user program
Bit 1—Down-Count Start Flag 10B (DST10B): Starts and stops down-counter 10B
(DCNT10B).
Bit 1:
DST10B Description
0 DCNT10B is halted (Initial value)
[Clearing condition]
When the DCNT10B value underflows
1 DCNT10B counts
[Setting conditions]
One-shot pulse function: Set by user program
Offset one-shot pulse function: Set on GR1B compare-match, or by user program
Bit 0—Down-Count Start Flag 10A (DST10A): Starts and stops down-counter 10A
(DCNT10A).
Bit 0:
DST10A Description
0 DCNT10A is halted (Initial value)
[Clearing condition]
When the DCNT10A value underflows
1 DCNT10A counts
[Setting conditions]
One-shot pulse function: Set by user program
Offset one-shot pulse function: Set on GR1A compare-match, or by user program
The timer connection register (TCNR) is an 8-bit register. The ATU has one TCNR register in
channel 10.
Bit: 7 6 5 4 3 2 1 0
CN10H CN10G CN10F CN10E CN10D CN10C CN10B CN10A
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
TCNR is an 8-bit readable/writable register that enables or disables connection between the
channel 10 down-counter start register (DSTR) and channel 1 and 2 compare-match signals.
TCNR is initialized to H'00 by a power-on reset, and in hardware standby mode and software
standby mode.
For details, see sections 10.3.5, One-Shot Pulse Function, and 10.3.6, Offset One-Shot Pulse
Function.
Bit 7—Connection Flag 10H (CN10H): Enables or disables connection between DST10H and
channel 2 compare-match signal OFF2B.
Bit 7:
CN10H Description
0 Connection between DST10H and OFF2B is disabled (Initial value)
1 Connection between DST10H and OFF2B is enabled
Bit 6—Connection Flag 10G (CN10G): Enables or disables connection between DST10G and
channel 2 compare-match signal OFF2A.
Bit 6:
CN10G Description
0 Connection between DST10G and OFF2A is disabled (Initial value)
1 Connection between DST10G and OFF2A is enabled
Bit 5—Connection Flag 10F (CN10F): Enables or disables connection between DST10F and
channel 1 compare-match signal OFF1F.
Bit 5:
CN10F Description
0 Connection between DST10F and OFF1F is disabled (Initial value)
1 Connection between DST10F and OFF1F is enabled
Bit 4—Connection Flag 10E (CN10E): Enables or disables connection between DST10E and
channel 1 compare-match signal OFF1E.
Bit 4:
CN10E Description
0 Connection between DST10E and OFF1E is disabled (Initial value)
1 Connection between DST10E and OFF1E is enabled
Bit 3—Connection Flag 10D (CN10D): Enables or disables connection between DST10D and
channel 1 compare-match signal OFF1D.
Bit 3:
CN10D Description
0 Connection between DST10D and OFF1D is disabled (Initial value)
1 Connection between DST10D and OFF1D is enabled
Bit 2—Connection Flag 10C (CN10C): Enables or disables connection between DST10C and
channel 1 compare-match signal OFF1C.
Bit 2:
CN10C Description
0 Connection between DST10C and OFF1C is disabled (Initial value)
1 Connection between DST10C and OFF1C is enabled
Bit 1—Connection Flag 10B (CN10B): Enables or disables connection between DST10B and
channel 1 compare-match signal OFF1B.
Bit 1:
CN10B Description
0 Connection between DST10B and OFF1B is disabled (Initial value)
1 Connection between DST10B and OFF1B is enabled
Bit 0—Connection Flag 10A (CN10A): Enables or disables connection between DST10A and
channel 1 compare-match signal OFF1A.
Bit 0:
CN10A Description
0 Connection between DST10A and OFF1A is disabled (Initial value)
1 Connection between DST10A and OFF1A is enabled
The free-running counters (TCNT) are 32- or 16-bit up-counters. The ATU has ten TCNT
counters: one 32-bit TCNT in channel 0, and one 16-bit TCNT in each of channels 1 to 9.
Bit: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
When TCNT0 overflows (from H'FFFFFFFF to H'00000000), the OVF0 overflow flag in the
timer status register (TSR) is set to 1.
TCNT0 is connected to the CPU via an internal 16-bit bus, and can only be accessed by a
longword read or write. Word reads or writes cannot be used..
TCNT0 is initialized to H'00000000 by a power-on reset, and in hardware standby mode and
software standby mode.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
TCNT3 to TCNT5 can be cleared to H'0000 by a compare-match with the corresponding general
register (GR) or input capture (counter clear function).
When one of counters TCNT1 to TCNT5 overflows (from H'FFFF to H'0000), the overflow flag
(OVF) for the corresponding channel in the timer status register (TSR) is set to 1.
TCNT1 to TCNT5 are connected to the CPU via an internal 16-bit bus, and can only be accessed
by a word read or write.
TCNT1 to TCNT5 are initialized to H'0000 by a power-on reset, and in hardware standby mode
and software standby mode.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
TCNT6 to TCNT9 are connected to the CPU via an internal 16-bit bus, and can only be accessed
by a word read or write.
TCNT6 to TCNT9 are initialized to H'0001 by a power-on reset, and in hardware standby mode
and software standby mode.
The input capture registers (ICR) are 32-bit registers. The ATU has four 32-bit ICR registers in
channel 0.
Input capture registers 0AH, 0AL to 0DH, 0DL (ICR0AH, ICR0AL to ICR0DH, ICR0DL)
Bit: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R R R R R R R R R R R R R R R R
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R R R R R R R R R R R R R R R R
The ICR registers are 32-bit read-only registers used exclusively for input capture.
These dedicated input capture registers store the TCNT0 value on detection of an input capture
signal from an external source. The corresponding TSR bit is set to 1 at this time. The input
capture signal edge to be detected is specified by timer I/O control register TIOR0A.
ICR0A and ICR0D can detect an external input capture (TIA0) or the channel 1 general register
(GR1A) compare-match signal (TRG1A) as an input capture signal.
The ICR registers are connected to the CPU via an internal 16-bit bus, and can only be accessed
by a longword read. Word reads cannot be used.
The ICR registers are initialized to H'00000000 by a power-on reset, and in hardware standby
mode and software standby mode.
The general registers (GR) are 16-bit registers. The ATU has 18 general registers: six in channel 1,
two in channel 2, four each in channels 3 and 4, and two in channel 5.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The GR registers are 16-bit readable/writable registers with both input capture and output compare
functions. Function switching is performed by means of the timer I/O control registers (TIOR).
When a general register is used for input capture, it stores the TCNT value on detection of an input
capture signal from an external source. The corresponding IMF bit in TSR is set to 1 at this time.
The input capture signal edge to be detected is specified by the corresponding TIOR.
When a general register is used for output compare, the GR value and free-running counter
(TCNT) value are constantly compared, and when both values match, the IMF bit in the timer
status register (TSR) is set to 1. Compare-match output is specified by the corresponding TIOR.
The GR registers are connected to the CPU via an internal 16-bit bus, and can only be accessed by
a word read or write.
The GR registers are initialized to H'FFFF by a power-on reset, and in hardware standby mode and
software standby mode.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Channel 2 compare-match signals can be transmitted to the advanced pulse controller (APC). For
details, see section 11, Advanced Pulse Controller (APC).
General Registers 3A to 3D, 4A to 4D, 5A, and 5B (GR3A to GR3D, GR4A to GR4D, GR5A,
GR5B)
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The DCNT registers are 16-bit down-counters. The ATU has eight DCNT counters in channel 10.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
When the one-shot pulse function is used, DCNT starts counting down when the corresponding
DSTR bit is set to 1 by the user program after the DCNT value has been set. When the DCNT
value underflows, the corresponding DSTR bit and DCNT are automatically cleared to 0, and the
count is stopped. At the same time, the corresponding channel 10 timer status register F (TSRF)
status flag is set to 1.
When the offset one-shot pulse function is used, on compare-match with a channel 1 or 2 general
register (GR) when the corresponding timer connection register (TCNR) bit is 1, the
corresponding down-count start register (DSTR) bit is automatically set to 1 and the down-count
is started. When the DCNT value underflows, the corresponding DSTR bit and DCNT are
automatically cleared to 0, and the count is stopped. At the same time, the corresponding channel
10 TSRF status flag is set to 1.
The DCNT counters are connected to the CPU via an internal 16-bit bus, and can only be accessed
by a word read or write.
The DCNT counters are initialized to H'0000 by a power-on reset, and in hardware standby mode
and software standby mode.
For details, see sections 10.3.5, One-Shot Pulse Function, and 10.3.6, Offset One-Shot Pulse
Function.
The offset base register (OSBR) is a 16-bit register. The ATU has one OSBR register in channel 1.
Bit: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R R R R R R R R R R R R R R R R
OSBR is a 16-bit read-only register used exclusively for input capture. OSBR uses the channel 0
ICR0A input capture register input as its trigger signal (TRG0A), and stores the TCNT1 value on
detection of the edge selected with bits 0 and 1 of TIORA.
OSBR is connected to the CPU via an internal 16-bit bus, and can only be accessed by a word
read.
OSBR is initialized to H'0000 by a power-on reset, and in hardware standby mode and software
standby mode.
The cycle registers (CYLR) are 16-bit registers. The ATU has four cycle registers, one each for
channels 6 to 9.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The CYLR registers are 16-bit readable/writable registers used for PWM cycle storage.
The CYLR value is constantly compared with the corresponding free-running counter (TCNT6 to
TCNT9) value, and when the two values match, the corresponding timer start register (TSR) bit
(CMF6 to CMF9) is set to 1, and the free-running counter (TCNT6 to TCNT9) is cleared. At the
same time, the buffer register (BFR) value is transferred to the duty register (DTR).
The CYLR registers are connected to the CPU via an internal 16-bit bus, and can only be accessed
by a word read or write.
The CYLR registers are initialized to H'FFFF by a power-on reset, and in hardware standby mode
and software standby mode.
For details of the CYLR, BFR, and DTR registers, see sections 10.3.9, PWM Timer Function.
The buffer registers (BFR) are 16-bit registers. The ATU has four buffer registers, one each for
channels 6 to 9.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The BFR registers are 16-bit readable/writable registers that store the value to be transferred to the
duty register (DTR) in the event of a cycle register (CYLR) compare-match.
The BFR registers are connected to the CPU via an internal 16-bit bus, and can only be accessed
by a word read or write.
The BFR registers are initialized to H'FFFF by a power-on reset, and in hardware standby mode
and software standby mode.
The duty registers (DTR) are 16-bit registers. The ATU has four duty registers, one each for
channels 6 to 9.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The DTR registers are 16-bit readable/writable registers used for PWM duty storage.
The DTR value is constantly compared with the corresponding free-running counter (TCNT6 to
TCNT9) value, and when the two values match, the corresponding channel output pin (TO6 to
TO9) goes to 0 output.
The DTR registers are connected to the CPU via an internal 16-bit bus, and can only be accessed
by a word read or write.
The DTR registers are initialized to H'FFFF by a power-on reset, and in hardware standby mode
and software standby mode.
10.3 Operation
10.3.1 Overview
The ATU has eleven timers of seven kinds in channels 0 to 10. It also has a built-in prescaler that
generates input clocks, and it is possible to generate or select internal clocks of the required
frequency independently of circuitry outside the ATU.
Channel 0 (32-Bit Dedicated Input Capture Timer): Channel 0 has a 32-bit free-running
counter (TCNT0) and four 32-bit input capture registers (ICR0A to ICR0D). TCNT0 is an up-
counter that performs free-running operation. The four input capture registers (ICR0A to ICR0D)
can be used for input capture with input from the corresponding external signal input pin (TIA0 to
TID0) or output compare-match trigger input from channel 1 GR1A. Input pin (TIA0 to TID0) and
GR1A output compare-match trigger selection can be made by setting the trigger selection register
(TGSR).
Channel 0 also has an interval interrupt request register (ITVRR). When 1 is set in ITVE0 to
ITVE3 in ITVRR, an interval timer function can be used whereby an interrupt request can be sent
to the CPU when the corresponding bit (of bits 10 to 13) in TCNT0 changes to 1.
Channels 1 and 2: ATU channel 1 has a 16-bit free-running counter (TCNT1) and six 16-bit
general registers (GR1A to GR1F). TCNT1 is an up-counter that performs free-running operation.
The six general registers (GR1A to GR1F) can be used as input capture or output compare-match
registers using the corresponding external signal I/O pin (TIOA0 to TIOF0). Use as a one-shot
pulse offset function is also possible in combination with ATU channel 10 described below.
Channel 2 has a 16-bit free-running counter (TCNT2) and two 16-bit general registers (GR2A and
GR2B). Channel 2 can perform the same kind of operations as channel 1, the only difference being
in the number of general registers.
In addition, channel 1 has a 16-bit dedicated input capture register (OSBR) (not provided in
channel 2). The TIA0 external pin for input to channel 0 can also be used as the OSBR trigger
input, enabling use of a twin-capture function.
Channels 3, 4, and 5: ATU channels 3 and 4 each have a 16-bit free-running counter (TCNT3,
TCNT4) and four 16-bit general registers (GR3A to GR3D, GR4A to GR4D). TCNT3 and
TCNT4 are up-counters that perform free-running operation. The four general registers (GR3A to
GR3D, GR4A to GR4D) each have corresponding external signal I/O pins (TIOA3 to TIOD3,
TIOA4 to TIOD4, TIOA5, TIOB5), and can be used as input capture or output compare-match
registers.
With channels 3 and 4, GR3D and GR4D are automatically designated as cycle registers by setting
PWM mode in the timer mode register (TMDR). In PWM mode, the counter is automatically
cleared by an output compare-match when the GR3D/GR4D value matches the TCNT3/TCNT4
value. Therefore, channels 3 and 4 can each be used as 3-channel PWM timers, with GR3A to
GR3C or GR4A to GR4C as the duty registers, and GR3D or GR4D as the cycle register.
Channel 5 has a 16-bit counter (TCNT5) and two 16-bit general registers (GR5A and GR5B).
Channel 5 can perform the same kind of operations as channel 3, the only difference being in the
number of general registers. In PWM mode, GR5A is designated as the duty register and GR5B as
the cycle register.
Channels 6, 7, 8, and 9 (Dedicated PWM Timers): ATU channels 6 to 9 each have a 16-bit free-
running counter (TCNT6 to TCNT9), 16-bit cycle register (CYLR6 to CYLR9), 16-bit duty
register DTR6 to DTR9), and buffer register (BFR6 to BFR9). Each of channels 6 to 9 also has an
external output pin (TO6 to TO9), and can be used as a buffered PWM timer. TCNT6 to TCNT9
are up-counters, and 0 is output to the corresponding external output pin when the TCNT value
matches the DTR value (when DTR ≠ H'0000). When the TCNT value matches the CYLR value
(when DTR ≠ H'0000), 1 is output to the external output pin, TCNT is initialized to H'0001, and
the BFR value is transferred to DTR. Thus, the configuration of channels 6 to 9 enables them to
perform waveform output with the CYLR value as the cycle and the DTR value as the duty, and to
use BFR to absorb the time lag between setting of data in DTR and compare-match occurrence.
The relationship between the pins and registers is shown in table 10.4.
When DTR ≥ CYLR, 1 is output continuously to the external output pin, giving a duty of 100%.
When DTR = H'0000, 0 is output continuously to the external output pin, giving a duty of 0%.
Channel 10: ATU channel 10 has eight 16-bit down-counters (DCNT10A to DCNT10H), and
corresponding external output pins (TOA10 to TOH10). One-shot pulse output can be performed
by setting the DCNT value, starting DCNT operation in the user program and outputting 1 to the
external output pin, then halting the count operation when DCNT underflows, and outputting 0 to
the external output pin.
By coupling the operation with the channel 1 or channel 2 output compare function, offset one-
shot pulse output can be performed, whereby a one-shot pulse is generated by starting DCNT
operation in response to a compare-match signal and outputting 1 to the external output pin, then
halting the count operation when DCNT underflows, and outputting 0.
Prescaler: The ATU has a dedicated prescaler with a 2-stage configuration. The first prescaler
stage includes a 5-bit prescaler register (PSCR1) that allows any scaling factor from 1 to 1/32 to
be specified. The first prescaler stage supplies a clock (φ') scaled from the φ clock second
prescaler stage and to channel 0. The second prescaler stage further scales the φ' clock supplied by
the first stage by a factor of the reciprocal of a power of 2 (the power being between 0 and 5) to
create six different clocks (φ") to be supplied to channels 1 to 10.
In channels 1 to 9, one of the six clocks (φ") created by scaling in the second prescaler stage can
be selected for use. In channel 10, two of the φ" clocks can be selected, with one clock input for
DCNT10A to DCNT10F, and the other for DCNT10G and DCNT10H.
The ATU channel 0 to 5 free-running counters (TCNT) are all designated as free-running counters
immediately after a reset, and start counting up as free-running counters when the corresponding
TSTR bit is set to 1. When TCNT overflows (channel 0: from H'FFFFFFFF to H'00000000;
channels 1 to 5: from H'FFFF to H'0000), the OVF bit in the timer status register (TSR) is set to 1.
If the OVE bit in the corresponding timer interrupt enable register (TIER) is set to 1 at this time,
an interrupt request is sent to the CPU. After overflowing, TCNT starts counting up again from
H'00000000 or H'0000.
If the timer start register (TSTR) value is cleared to 0 during the count, only the corresponding
free-running counter (TCNT) stops counting, and initialization of all TCNT counters and ATU
registers is not performed. The value at the point at which the TSTR value is cleared to 0
continues to be output externally.
H'0000
Time
STR bit
in TSTR
OVF
The ATU channel 6 to 9 counters (TCNT) all perform cyclic count operations unconditionally.
ATU channel 3 to 5 free-running counters (TCNT) perform synchronous count operation when 1
is set in bits T3PWM to T5PWM in the timer mode register (TMDR). These free-running counters
also perform synchronous count operation if the corresponding CCI bit in the timer I/O control
register (TIOR) is set to 1 when bits T3PWM to T5PWM are 0. The relevant TCNT counter is
cleared by a compare-match of TCNT with GR3D or GR4D in channel 3 or 4, GR5B in channel 5,
or CYLR in channels 6 to 9 (counter clear function). In this way, cyclic counting is performed.
TCNT starts counting up as a cyclic counter when the corresponding STR bit in TSTR is set to 1
after the TMDR setting is made. When the count value matches the GR3D, GR4D, GR5B, or
CYLR value, the corresponding IMF3D, IMF4D, or IMF5B bit in timer status register D (TSRD)
(or the CMF bit in TSRE for channels 6 to 9) is set to 1, and TCNT is cleared to H'0000 (H'0001
for channels 6 to 9). If the corresponding TIER bit is set to 1 at this time, an interrupt request is
sent to the CPU. After the compare-match, TCNT starts counting up again from H'0000 (H'0001
for channels 6 to 9).
GR3D, GR4D,
GR5B, CYLR
H'0000
(channels 6 to 9: H'0001) Time
STR bit
in TSTR
IMF3D, IMF4D,
IMF5B, CMF
External output value selection and counter clear function (channels 3 to 5 only) specification can
be performed with the timer I/O control register (TIOR). 1 output, 0 output, or toggle output can
be selected as the external output value. When the counter clear function is specified, the relevant
TCNT is cleared to H'0000 by a compare-match between the corresponding general register and
TCNT. If the appropriate interrupt enable register (TIER) setting is made, an interrupt request will
be sent to the CPU when an output compare-match occurs.
In the example in figure 10.13, ATU channel 1 is activated, and external output is performed with
1 output specified in the event of GR1A output compare-match, 0 output in the event of GR1B
output compare-match, and toggle output in the event of GR1C output compare-match.
Counter value
TCNT1
H'FFFF
GR1A
GR1B
GR1C
H'0000
Time
No change
No change
TIOA1
(1 output)
No change
TIOB1
(0 output)
TIOC1
(toggle output)
In ATU channels 0 to 5, when input capture is specified for the timer I/O control register (TIOR),
an input capture trigger signal is input from the corresponding external pin (TIA0 to TID0, TIOA1
to TIOF1, TIOA2, TIOB2, TIOA3 to TIOD3, TIO4A to TIOD4, TIOA5, TIOB5). A free-running
counter (TCNT) starts counting up when 1 is set in the timer start register (TSTR). When a trigger
signal is input from one of the above external pins, the counter value is transferred to the
corresponding register (ICR0AH/L to ICR0DH/L, OSBR, GR1A to GR1F, GR2A, GR2B, GR3A
to GR3D, GR4A to GR4D, GR5A, GR5B).
The detected edge of the external trigger input data can be selected by making a setting in the
timer I/O control register (TIOR). Rising-edge, falling-edge, or both-edge detection can be
selected. A CPU interrupt request can be issued if the appropriate setting is made in the interrupt
enable register (TIER).
An example of free-running counter and input capture operation is shown in figure 10.14.
In the example in figure 10.14, ATU channel 1 is activated, and input capture operation is
performed with rising-edge detection specified for TIOA1 and both-edge detection for TIOB1.
Counter value
TCNT1 H'FFFF
Data 1
Data 2
Data 3
Data 4
H'0000
(32 bits in case of channel 0) Time
STR1
TIOA1
TIOB1
ATU channel 10 has eight down-counters (DCNT10A to DCNT10H) and corresponding external
pins (TOA10 to TOH10) which can be used as one-shot pulse output pins.
To generate a one-shot pulse, the one-shot pulse width is set in the down-counter (DCNT), and the
corresponding down-count start register (DSTR) bit (DST10A to DST10H) is set to 1 by the user
program to start the down-count using the clock specified in the timer control register (TCR).
When the down-count starts, 1 is output to the corresponding external pin (TOA10 to TOH10). If
the DCNT value is 0, however, the external pin remains at 0 even if DST is set to 1; in this case, a
one-shot pulse is not generated, but an interrupt is requested. When the DCNT value underflows,
DCNT and the relevant DST bit are automatically cleared to 0, and DCNT stops counting. At the
same time, 0 is output to the corresponding external pin.
By making the appropriate setting in timer interrupt enable register F (TIERF), an interrupt request
can be sent to the CPU when the corresponding down-counter (DCNT10A to DCNT10H) reaches
0.
It is possible to forcibly output 0 to the output pin during the down-count by clearing DCNT to 0
(since DST cannot be cleared to 0 by the user program). In this case, DCNT and the relevant DST
bit are automatically cleared to 0 when the DCNT value underflows, and DCNT stops counting.
At the same time, 0 is output to the corresponding external pin.
In the example in figure 10.15, one-shot pulse widths dataA and dataB are set for DCNT10A by
the user program, and one-shot pulse output is performed by writing 1 to DST10A.
H'FFFF
Down-count value
Data B DCNT10A
Data A
H'0000
Time
Write to DCNT10A (Data A) DST10A= ‘1’ (Data B) DST10A = ‘1’
and DST10A by
user program
DST10A
Automatically
cleared to 0
TOA10 One-shot One-shot pulse
pulse
The ATU channel 10 down-counters (DCNT) can be coupled with compare-matches between the
channel 1 and 2 free-running counters (TCNT) and general registers (GR) by setting bits CN10A
to CN10H to 1 in the timer connection register (TCNR). At the same time, the external pins
(TOA10 to TOH10) corresponding to the eight channel 10 down-counters, DCNT10A to
DCNT10H, can be used as offset one-shot pulse output pins.
Setting 1 in timer start register (TSTR) bit STR1 or STR2 starts the up-count by TCNT1 or
TCNT2 in channel 1 or 2. When TCNT1 or TCNT2 matches the general register (GR!A to GR1F,
GR2A, GR2B) value, the down-count start register (DSTR) bit corresponding to bit CN10A to
CN10H in TCNR corresponding to GR automatically changes to 1, and the down-count is started.
When the down-count starts, 1 is output to the corresponding external pin (TOA10 to TOH10). If
the DCNT value is 0, however, the external pin remains at 0 even if DST is set to 1; in this case, a
one-shot pulse is not generated, but an interrupt is requested. When the DCNT value underflows,
DCNT and the relevant DST bit are automatically cleared to 0, and DCNT stops counting. At the
same time, 0 is output to the corresponding external pin. As long as a count value is set in DCNT
from the CPU before the next match with the general register, one-shot pulses can be output
consecutively. DSTR cannot be rewritten while the offset one-shot pulse function is being used.
By making the appropriate setting in timer interrupt enable register F (TIERF), an interrupt request
can be sent to the CPU one clock cycle after the corresponding down-counter (DCNT10A to
DCNT10H) reaches 0.
It is possible to forcibly output 0 to the output pin during the down-count by clearing DCNT to 0
(since DST cannot be cleared to 0 by the user program). In this case, DCNT and the relevant DST
bit are automatically cleared to 0 when the DCNT value underflows, and DCNT stops counting.
At the same time, 0 is output to the corresponding external pin.
In the example in figure 10.16, the ATU channel 1 free-running counter is started, and offset one-
shot pulse output is performed by means of GR1A output compare-match and the DCNT10A
channel 10 down-counter corresponding to GR1A.
Counter value
TCNT1
H'FFFF
GR1A
H'0000
Time
Write to GR1A
H'FFFF
data B
data A
Down-count value
DCNT10A
H'0000
Offset Offset
One- One-shot
TOA10 shot pulse
pulse
The 8 bits of the interval interrupt request register (ITVRR) are connected to bits 10 to 13 of
TCNT0L in the channel 0 32-bit free-running counter (TCNT0H, TCNT0L). The upper 4 bits
(ITVAD3 to ITVAD0) are used to start A/D converter sampling, and the lower 4 bits (ITVE3 to
ITVE0) generate signals to the interrupt controller (INTC).
For A/D converter activation, an edge sensor is provided for bits 10 to 13 of TCNT0L, and A/D
channel 0 sampling is started when the corresponding bit in TCNT0L changes to 1 as a result of
setting 1 in one of the upper 4 bits (ITVAD3 to ITVAD0) of ITVRR.
For generation of interrupt signals to the INTC, after detection of bits 10 to 13 of TCNT0L by the
edge sensor, when the corresponding bit in TCNT0L changes to 1 as a result of setting 1 in one of
the lower 4 bits (ITVE3 to ITVE0) of ITVRR after detection of bits 10 to 13 of TCNT0L by the
edge sensor, the corresponding flag (IIF0 to IIF3) in timer status register TSRAH is set to 1 and an
interrupt request is sent to INTC. The above four interrupt sources have only one interrupt vector
address, and therefore when more than one of bits ITVE3 to ITVE0 in ITVRR is specified, control
branches to the same vector when any TCNT0 bit corresponding to one of the specified bits
changes to 1.
To suppress interrupts to INTC, or to prevent A/D sampling from being started, all ITVRR bits
should be cleared to 0.
ATU
13 12 11 10 bit TCNT0L
(32 bit FRT)
Edge sensor
TRSAH
(status flags)
In the example in figure 10.18, free-running counter 0 (TCNT0) is started by setting 1 in ITVE1 in
ITVRR.
H'FFFFFFFF
Counter value
H'FFFFF800
TCNT0
H'00002800
H'00001800
H'00000800
H'00000000
Time
CPU 0 write
to IIF1by user
program
Interrupt status
flag (IIF1)
The ATU’s channel 0 ICR0A and channel 1 OSBR can be made to perform input capture in
response to the same trigger by means of a setting in timer I/O control register TIOR0A. When the
ATU channel 0 counter (TCNT0) and channel 1 counter (TCNT1) are started by a setting in the
timer status register (TSR), and a trigger signal is input from the ICR0A input capture input pin
(TIA0), the TCNT0 value can be transferred to ICR0A, and the TCNT1 value to OSBR. Rising-
edge, falling-edge, or both-edge detection can be selected for the TIA0 trigger input pin.
By making the appropriate setting in the timer interrupt enable register (TIER), an interrupt
request can be sent to the CPU when input capture occurs.
In the example in figure 10.19, twin-capture is started using a both-edge detection specification.
TIA0
H'FFFFFFFF
Channel 0
counter Data X1
value Data X2
TCNT0
H'00000000
Time
H'FFFF
Channel 1 Data Y1
counter
value
TCNT1 Data Y2
H'0000
Time
PWM mode is set unconditionally for ATU channels 6 to 9, and also by setting 1 in the
corresponding bit (T3PWM to T5PWM) of the ATU channel 3 to 5 timer mode registers (TMDR),
enabling the counters to be used as PWM timers.
In ATU channels 6 to 9, when the free-running counter (TCNT) is started, 0 is output to the
external pin if the corresponding duty register (DTR6 to DTR9) value is 0, and 1 is output to the
external pin if the DTR6 to DTR9 value is 1. When the TCNT count matches the DTR6 to DTR9
value after the up-count is started, 0 is output to the corresponding external pin (unless 100% duty
has been set, in which case 1 is output). When the continuing TCNT up-count matches the cycle
register (CYLR) value, 1 is output to the corresponding external pin (unless 0% duty has been set,
in which case 0 is output). At the same time, the counter is cleared. 0% duty is specified by setting
DTR to H'0000, and 100% duty by setting DTR ≥ CYLR.
The relationship between pins and registers is shown in table 10.4. Details of the buffer function
for ATU channels 6 to 9 are given in section 10.3.10, Buffer Function.
In the example in figure 10.20, H'F000 is set in CYLR6 to CYLR8, H'F000 in DTR6, H'7000 in
DTR7, and H'0000 in DTR8, ATU channels 6 to 8 are activated simultaneously, and waveform
output (100%, 50%, 0%) is generated on external pins TO6 to TO8.
Counter value
TCNT6 to TCNT8
H'FFFF
CYLR6–8,
DTR6 (H'F000)
DTR7 (H'7000)
DTR8 (H'0000)
Time
No change No change
TO6
TO7
No change No change No change
TO8 (‘0’)
In ATU channels 3 to 5, when PWM mode is set, corresponding general register GR3D, GR4D,
and GR5B function as cycle registers, and GR3A to GR3C, GR4A to GR4C, and GR5A, as duty
registers. At the same time, external pins TIOA3 to TIOC3, TIOA4 to TIOC4, and TIOA5
function as PWM waveform output pins. In channels 3 and 4, there are four duty registers for one
cycle register, and the cycle is the same for all the corresponding output pins.
In PWM mode, output of a 0% duty waveform cannot be set for ATU channels 3 to 5. If 0% duty
is required, channels 6 to 9 should be used. Although constant 1 output is performed if 100% duty
is set (GR3A, B, C ≥ GR3D, GR4A, B, C ≥ GR4D or GR5A ≥ GR5B), use of channels 6 to 9 is
also recommended if 100% duty is to be set.
In the example in figure 10.21, H'F000 is set in GR3D, H'F000 in GR3A, H'7000 in GR3B, and
H'0000 in GR3C, ATU channel 3 is activated, and waveform output is generated on external pins
TIOA3 to TIOD3.
Counter value
TCNT3
H'FFFF
GR3D,
GR3A (H'F000)
GR3B (H'7000)
GR3C (H'0000)
Time
No change No change
TIOA3
TIOB3
TIOC3
ATU channels 6 to 9 each have a free-running counter (TCNT6 to TCNT9), cycle register
(CYLR6 to CYLR9), duty register (DTR6 to DTR9), and buffer register (BFR6 to BFR9). PWM
waveform output by means of counter matches with the cycle register and duty register is
performed as described in section 10.3.9, PWM Timer Function. However, channels 6 to 9 also
include a buffer function, whereby the corresponding buffer register value is transferred to the
duty register on a match between the cycle register and counter. If the corresponding bit in timer
interrupt enable register E (TIERE) is set to 1, an interrupt request can be sent to the CPU when
the cycle register value and counter value match.
In the example in figure 10.22, H'4000 is set in BFR6, H'A000 in DTR6, and H'F000 in CYLR6,
and after the PWM operation is started, the BFR6 value is changed to H'B000 and H'7000 during
the operation, so that a waveform with varying duty cycles is output continuously on external pin
TO6.
H'0000
Time
STR6
TO6
There is a maximum delay of one DCNT input clock count clock cycle between setting of the
down-count start flag (DST) and the start of the DCNT down-count. One-shot pulse output also
varies by a delay of one CK state, but there is no error in the one-shot pulse output pulse width.
CK
1 written
to DST
Internal write signal
DCNT start delay
Down-count start
flag DST
One-shot pulse
output
1 state 1 state
There is a delay of one CK state between the occurrence of a compare-match between the channel
1 or 2 free-running counter (TCNT) and a general register (GR), and setting of the channel 10
down-count start flag (DST) is set. In addition, there is a maximum delay of one DCNT input
clock count clock cycle between setting of the DST flag and the start of the DCNT count. One-
shot pulse output varies by a further delay of one CK state, but there is no error in the one-shot
pulse output pulse width.
Figure 10.24 shows an example with an offset width setting of H'0100, and a pulse width setting
of H'0003.
1 state
CK
GR H'0100
Compare-match
signal
Down-count start
flag DST DCNT start
delay
One-shot pulse
output
1 state 1 state
10.3.13 Channel 3 to 5 PWM Output Waveform Actual Cycle and Actual Duty
In channel 3 to 5 PWM mode, the actual cycle corresponding to the cycle register value is one
TCNT input clock cycle greater than the cycle register value, and the actual cycle corresponding to
the duty register value is one TCNT input clock cycle greater than the duty register value. This
phenomenon is due to the fact that the value is H'0000 when the free-running counter (TCNT3 to
TCNT5) is cleared.
The timing in this case is shown in figure 10.25. In this example, H'0005 is set as the cycle register
value and H'0000 as the duty register value, the actual cycle value is H'0006, and the actual duty
value is H'0001.
Actual cycle
TCNT 0000 0001 0002 0003 0004 0005 0000 0001 0002 0003 0004 0005 0000 0001 0002 0003
Compare-match signal
(duty)
Compare-match signal
(cycle)
Actual duty
PWM output
10.3.14 Channel 3 to 5 PWM Output Waveform Settings and Interrupt Handling Times
Since channels 3 to 5 have no function for rewriting a general register (GR) simultaneously with
compare-match occurrence (buffer function) in PWM mode or when the counter clear function is
set, it may not be possible to generate waveform output with a resolution that exceeds the time
required to rewrite GR after a compare-match.
The timing in this case is shown in figure 10.26. In this example, channel 5 is set to PWM mode,
H'00FE is set in GR5A and H'00FF in GR5B, and free-running counter 5 (TCNT5) is started.
When H'0000 (0% duty) is set in GR5A in the interrupt handling routine after a compare-match
with GR5B, a 0% duty waveform cannot be output immediately since the TCNT5 value is already
H'0002, and so 1 continues to be output until the subsequent compare-match with GR5A.
TCNT5 00FA 00FB 00FC 00FD 00FE 00FF 0000 0001 0002 00FE 00FF 0000 0001 0002 0003
GR5B 00FF
Compare-match signal
PWM output
In channel 3 to 5 PWM mode, free-running counter (TCNT3 to TCNT5) PWM output is not 1 in
the first cycle when the counter is started. However, the interrupt status flag is set to 1 when there
is a match with the duty register value in the first cycle.
The timing in this case is shown in figure 10.27. In this example, H'0003 is set as the duty register
value, and H'0005 as the cycle register value.
Cycle
TCNT 0000 0001 0002 0003 0004 0005 0000 0001 0002 0003 0004 0005 0000 0001 0002 0003
Duty
PWM output
In channels 6 to 9, the maximum TCNT input clock error occurs between the cycle register value
or duty register value and the actual output waveform in the waveform of the first cycle when the
free-running counter starts (there is no error in the waveform in the second and subsequent cycles).
This is because the counter start signal from the CPU cannot be determined in synchronization
with the TCNT input clock timing. To output a waveform with no error in the waveform of the
first cycle, the initial value of the duty register (DTR) should be set to H'0000 (in this case,
however, the interrupt status flag will be set when 1 is first output).
The timing in this case is shown in figure 10.28. In this example, H'0003 is set as the duty register
value, and H'0005 as the cycle register value.
Cycle
TCNT 0001 0002 0003 0004 0005 0001 0002 0003 0004 0005 0001 0002 0003 0004
Duty
PWM output
10.3.17 Timing of Buffer Register (BFR) Write and Transfer by Buffer Function
In channels 6 to 9, if the BFR value is transferred to the duty register (DTR) by a compare-match
with the cycle register (CYLR) in the T2 state during a write cycle from the CPU to the buffer
register (BFR), the value prior to the CPU write to BFR is transferred to DTR.
The timing in this case is shown in figure 10.29. In this example, a CYLR compare-match and a
write of H'AAAA to BFR occur simultaneously when the BFR value is H'5555.
CK
H'AAAA
written
Internal write signal to BFR
Compare-match signal
DTR H'5555
Figure 10.29 Contention between Buffer Register (BFR) Write and Transfer by Buffer
Function
10.4 Interrupts
The ATU has 44 interrupt sources of five kinds: input capture interrupts, compare-match
interrupts, overflow interrupts, underflow interrupts, and interval interrupts.
IMF (ICF) Setting Timing in Input Capture: When an input capture signal is generated, the
IMF bit (ICF bit in case of channel 0) is set to 1 in the timer status register (TSR), and the TCNT
value is simultaneously transferred to the corresponding GR (ICR in the case of channel 0).
In the example in figure 10.30, a signal is input from an external pin, and input capture is
performed on detection of a rising edge.
CK
TCNT N
GR (ICR) N
IMF (ICF) Setting Timing in Compare-Match: The IMF bit (CMF bit in case of channels 6 to
9) is set to 1 in the timer status register (TSR) by the compare-match signal generated when the
general register (GR) or cycle register (CYLR) value matches the timer counter (TCNT) value.
The compare-match signal is generated in the last state of the match (when the matched TCNT
count value is updated).
CK
TCNT N N+1
GR(CYLR) N
Compare-match signal
OVF Setting Timing in Overflow: When TCNT overflows (from H'FFFF to H'0000, or from
H'FFFFFFFF to H'00000000), the OVF bit is set to 1 in the timer status register (TSR).
CK
Overflow signal
OSF Setting Timing in Underflow: When a down-counter (DCNT) counts down from H'0001 to
H'0000 on DCNT input clock input, the OSF bit is set to 1 in the timer status register (TSR) when
the next DCNT input clock pulse is input (when underflow occurs). However, when DCNT is
H'0000, it remains unchanged at H'0000 no matter how many DCNT input clock pulses are input.
CK
Underflow signal
Timing of IIF Setting by Interval Timer: When 1 is generated by ANDing the rise of bit 10–13
in free-running counter TCNT0L with bit ITVE0–ITVE3 in the interval interrupt request register
(ITVRR), the IIF bit is set to 1 in the timer status register (TSR).
The timing in this case is shown in figure 10.34. TCNT0 value N in the figure is the counter value
when TCNT0L bit 10–13 changes to 1. (For example, N = H'00000400 in the case of bit 10,
H'00000800 in the case of bit 11, etc.)
CK
TCNT0 N–1 N
Clearing by CPU Program: The interrupt status flag is cleared when the CPU writes 0 to the flag
after reading it while set to 1.
The procedure and timing in this case are shown in figure 10.35.
CK
Clearing by DMAC: The interrupt status flag (ICF0B, CMF6) is cleared automatically during
data transfer when the DMAC is activated by input capture (ICR0B) or compare-match (CYLR6).
The procedure and timing in this case are shown in figure 10.36.
CK
Start
Clear request signal
from DMAC
Free-running counter 0 (TCNT0) and input capture registers 0A to 0D (ICR0A to ICR0D) are 32-
bit registers. As these registers are connected to the CPU via an internal 16-bit data bus, a read or
write (read only, in the case of ICR0A to ICR0D) is automatically divided into two 16-bit
accesses.
Figure 10.37 shows a read from TCNT0, and figure 10.38 a write to TCNT0.
When reading TCNT0, in the first read the TCNT0H (upper 16-bit) value is output to the internal
data bus, and at the same time, the TCNT0L (lower 16-bit) value is output to an internal buffer
register. Then, in the second read, the TCNT0L (lower 16-bit) value held in the internal buffer
register is output to the internal data bus.
When writing to TCNT0, in the first write the upper 16 bits are output to an internal buffer
register. Then, in the second write, the lower 16 bits are output to TCNT0L, and at the same time,
the upper 16 bits held in the internal buffer register are output to TCNT0H to complete the write.
The above method performs simultaneous reading and simultaneous writing of 32-bit data,
preventing contention with an up-count.
TCNT0L
Module data bus
Figure 10.39 shows the operation when performing a word read or write access to TCNT1.
The timer control register (TCR), timer I/O control registers 1 to 5 (TIOR1 to TIOR5), and the
timer connection register (TCNR) are 8-bit registers. These registers are connected to the upper 8
bits or lower 8 bits of the internal 16-bit data bus, and can be read or written a byte at a time.
In addition, a pair of 8-bit registers for which only the least significant bit of the address is
different, such as timer I/O control register 4A (TIOR4A) and timer I/O control register 4B
(TIOR4B), can be read or written in combination a word at a time.
Figures 10.40 and 10.41 show the operation when performing individual byte read or write
accesses to TIOR4A and TIOR4B. Figure 10.42 shows the operation when performing a word
read or write access to TIOR4A and TIOR4B simultaneously.
The timer mode register (TMOR), prescaler register 1 (PSCR1), timer I/O control register 0
(TIOR0), the trigger selection register (TGSR), interval interrupt request register (ITVRR), timer
status register (TSR), timer interrupt enable register (TIER), and down-count start register (DSTR)
are 8-bit registers. These registers are connected to the upper 8 bits or lower 8 bits of the internal
16-bit data bus, and can be read or written a byte at a time.
Figures 10.43 and 10.44 show the operation when performing individual byte read or write
accesses to TGSR and TIOR0A.
Sample Setup Procedure for Input Capture: An example of the setup procedure for input
capture is shown in figure 10.45.
4. Set the corresponding bit to 1 in the timer start register (TSTR) to start the free-running
counter (TCNT) for the relevant channel.
Note: When channel 0 input capture (ICR0A) occurs, the TCNT1 value is always transferred to
the offset base register (OSBR), irrespective of channel 1 free-running counter (TCNT1)
activation.
For details, see section 10.3.8, Twin-Capture Function.
Start
Start counter 4
1. Set the first-stage counter clock φ' in prescaler register 1 (PSCR1), and select the second-stage
counter clock φ" with the CKSEL bit in the timer control register (TCR). When selecting an
external clock, also select the external clock edge type with the CKEG bit in TCR.
2. Set the port E control register (PECR) or port G control register (PGCR), corresponding to the
waveform output port, to ATU output compare-match output. Also set the corresponding bit to
1 in the port E IO register (PEIOR) or port G IO register (PGIOR) to specify the output
attribute for the port.
3. Select 0, 1, or toggle output for output compare-match output with the timer I/O control
register (TIOR). If necessary, an interrupt request can be sent to the CPU on output compare-
match by making the appropriate setting in the interrupt enable register (TIER).
4. Set the timing for compare-match generation in the ATU general register (GR) corresponding
to the port set in 2.
5. Set the corresponding bit to 1 in the timer start register (TSTR) to start the free-running
counter (TCNT). Waveform output is performed from the relevant port when the TCNT value
and GR value match.
Start
Start counter 5
Waveform output
Figure 10.46 Sample Setup Procedure for Waveform Output by Output Compare-Match
Sample Setup Procedure for ATU Channel 0 Input Capture Triggered by Channel 1
Compare-Match: An example of the setup procedure for ATU channel 0 input capture triggered
by channel 1 compare-match is shown in figure 10.47.
1. Set the channel 1 timer I/O control register (TIOR1A) to output compare-match, and set the
timing for compare-match generation in the channel 1 general register (GR1A).
2. Set bits TRG1A and TRG1D to 1 in the trigger selection register (TGSR).
3. Set the corresponding bit to 1 in the timer start register (TSTR) to start the channel 1 free-
running counter (TCNT1). On compare-match between TCNT1 and GR1A, the compare-
match signal is transmitted to channel 0 as the channel 0 TIA0 and TID0 input capture signal.
Start
Set compare-match 1
Set TGSR 2
Start counter 3
Signal transmission
Sample Setup Procedure for One-Shot pulse Output: An example of the setup procedure for
one-shot pulse output is shown in figure 10.48.
1. Set the first-stage counter clock φ' in prescaler register 1 (PSCR1), and select the second-stage
counter clock φ" with the CKSEL bit in timer control register TCR10.
2. Set the port C control register (PCCR) corresponding to the waveform output port to ATU one-
shot pulse output. Also set the corresponding bit to 1 in the port C IO register (PCIOR) to
specify the output attribute.
3. Set the one-shot pulse width in the down-counter (DCNT) corresponding to the port set in (2).
If necessary, an interrupt request can be sent to the CPU when the down-counter underflows by
making the appropriate setting in the interrupt enable register (TIERF).
4. Set the corresponding bit (DST10A to DST10H) to 1 in the down-count start register (DSTR)
to start the down-counter (DCNT).
Start
Start down-count 4
Sample Setup Procedure for Offset One-Shot Pulse Output: An example of the setup
procedure for offset one-shot pulse output is shown in figure 10.49.
1. Set the first-stage counter clock φ' in prescaler register 1 (PSCR1), and select the second-stage
counter clock φ" with the CKSEL bit in the timer control register (TCR1, TCR2, TCR10).
2. Set the port C control register (PCCR) corresponding to the waveform output port to ATU one-
shot pulse output. Also set the corresponding bit to 1 in the port C IO register (PCIOR) to
specify the output attribute.
3. Set the one-shot pulse width in the down-counter (DCNT) corresponding to the port set in (2).
If necessary, an interrupt request can be sent to the CPU when the down-counter underflows by
making the appropriate setting in the interrupt enable register (TIERF).
4. Set the offset width in the channel 1 or 2 general register (GR1A–GR1F, GR2A, GR2B)
connected to the down-counter (DCNT) corresponding to the port set in (2).
5. Set the CN10A–CN10H bit in the timer connection register (TCNR) corresponding to the port
set in (2) to 1.
6. Set the corresponding bit to 1 in the timer start register (TSTR) to start the channel 1 or 2 free-
running counter (TCNT1, TCNT2). When the TCNT value and GR value match, the
corresponding DCNT starts counting down, and one-shot pulse output is performed.
Start
Start count 6
Figure 10.49 Sample Setup Procedure for Offset One-Shot Pulse Output
Sample Setup Procedure for Interval Timer Operation: An example of the setup procedure for
interval timer operation is shown in figure 10.50.
Note: TCNT0 bit 10 corresponds to ITVE0 and ITVAD0, bit 11 to ITVE1 and ITVAD1, bit 12
to ITVE2 and ITVAD2, and bit 13 to ITVE3 and ITVAD3.
Start
Set interval 2
Start counter 3
Sample Setup Procedure for PWM Timer Operation (Channels 3 to 5 ): An example of the
setup procedure for PWM timer operation (channels 3 to 5 ) is shown in figure 10.51.
1. Set the first-stage counter clock φ' in prescaler register 1 (PSCR1), and select the second-stage
counter clock φ" with the CKSEL bit in the timer control register (TCR). When selecting an
external clock, at the same time select the external clock edge type with the CKEG bit in TCR.
2. Set the port E control register (PECR) or port G control register (PGCR), corresponding to the
waveform output port, to ATU output compare-match output. Also set the corresponding bit to
1 in the port E IO register (PEIOR) or port G IO register (PGIOR) to specify the output
attribute.
3. Set bit T3PWM–T5PWM in the timer mode register (TMDR) to PWM mode. When PWM
mode is set, the TIOD3. TIOD4, and TIOD5 pins go to 0 output irrespective of the timer I/O
control register (TIOR) contents.
4. The GR3A–GR3C, GR4A–GR4C, and GR5A ATU general registers are used as duty registers
(DTR), and the GR3D, GR4D, and GR5B ATU general registers as cycle registers (CYLR).
Set the PWM waveform output 0 output timing in DTR, and the PWM waveform output 1
output timing in CYLR.
5. Set the corresponding bit to 1 in the timer start register (TSTR) to start the free-running
counter (TCNT) for the relevant channel.
Start
Set GR 4
Start count 5
Figure 10.51 Sample Setup Procedure for PWM Timer Operation (Channels 3 to 5)
Sample Setup Procedure for PWM Timer Operation (Channels 6 to 9): An example of the
setup procedure for PWM timer operation (channels 6 to 9 ) is shown in figure 10.52.
1. Set the first-stage counter clock φ' in prescaler register 1 (PSCR1), and select the second-stage
counter clock φ" with the CKSEL bit in the timer control register (TCR6–TCR9).
2. Set the port B control register (PBCR) corresponding to the waveform output port to ATU
PWM output. Also set the corresponding bit to 1 in the port B IO register (PBIOR) to specify
the output attribute.
3. Set PWM waveform output 1 output timing in the cycle register (CYLR6–CYLR9), and set the
PWM waveform output 0 output timing in the buffer register (BFR6–BFR9) and duty register
(DTR6–DTR9). If necessary, an interrupt request can be sent to the CPU on a compare-match
between the CYLR value and the free-running counter (TCNT) value by making the
appropriate setting in the interrupt enable register (TIERE).
4. Set the corresponding bit to 1 in the timer start register (TSTR) to start the TCNT counter for
the relevant channel.
Notes: 1. Do not make a setting in DTR after the counter is started. Use BFR to make a DTR
setting. For details, see section 10.3.10, Buffer Function.
2. 0% duty is specified by setting H'0000 in the duty register (DTR), and 100% duty is
specified by setting buffer register (BFR) ≥ cycle register (CYLR).
Start
Start count 4
Figure 10.52 Sample Setup Procedure for PWM Timer Operation (Channels 6 to 9)
Contention between TCNT Write and Clearing by Compare-Match: With channel 3 to 9 free-
running counters (TCNT3 to TCNT9), if a compare-match occurs in the T2 state of a CPU write
cycle when clearing is enabled, the write to TCNT has priority and clearing is not performed.
The compare-match remains valid, and writing of 1 to the interrupt status flag and waveform
output to an external destination are performed in the same way as for a normal compare-match.
T1 T2
CK
Compare-match signal
Contention between GR Write and Data Transfer by Input Capture: If input capture occurs
in the T2 state of a CPU write cycle for a channel 1 to 5 general register (GR1A to GR1F, GR2A,
GR2B, GR3A to GR3D, GR4A to GR4D, GR5A, GR5B), the write to TCNT has priority and the
data transfer to GR is not performed.
Writing of 1 to the interrupt status flag due to input capture is performed in the same way as for
normal input capture.
T1 T2
CK
Address GR address
Figure 10.54 Contention between GR Write and Data Transfer by Input Capture
The timing in this case is shown in figure 10.55. In this example, the CPU writes H'5555 at the
point at which TCNT is to be incremented from H'1001 to H'1002.
T1 T2
CK
5555
TCNT 1001 (CPU write value) 5556
Contention between TCNT Write and Counter Clearing by Overflow: With channel 3 to 5
free-running counters (TCNT3 to TCNT5), if overflow occurs in the T2 state of a CPU write cycle
when clearing is enabled, the write to TCNT has priority and the counter is not cleared to H'0000.
Writing of 1 to the interrupt status flag (OVF) due to the overflow is performed in the same way as
for normal overflow.
The timing in this case is shown in figure 10.56. In this example, H'5555 is written at the point at
which TCNT overflows.
T1 T2
CK
Overflow signal
5555
TCNT FFFF (CPU write value) 5556
Contention between Interrupt Status Flag Setting by Interrupt Generation and Clearing: If
an event such as input capture/compare-match or overflow/underflow occurs in the T2 state of an
interrupt status flag 0 write cycle by the CPU, setting of the interrupt status flag to 1 by that event
has priority and the interrupt status flag is not cleared.
CK
0 written
Internal write signal
to TSR
TCNT N N+1
GR N
Compare-match signal
Figure 10.57 Contention between Interrupt Status Flag Setting by Compare-Match and
Clearing
Contention between DTR Write and BFR Value transfer by Buffer Function: Do not write to
the duty register (DTR) when the free-running counter (TCNT) has been started in channels 6 to 9.
If there is contention between transfer of the buffer register (BFR) value to the corresponding
DTR due to a cycle register compare-match, and a write to DTR by the CPU, the OR of the BFR
value and CPU write value is written to DTR.
Figure 10.58 shows an example in which contention arises when the BFR value is H'AAAA and
the value to be written to DTR is H'5555.
CK
H'5555
Internal write signal written
to DTR
Compare-match signal
BFR H'AAAA
DTR H'FFFF
(OR of H'5555 and
H'AAAA)
Figure 10.58 Contention between DTR Write and BFR Value Transfer by Buffer Function
Contention between Interrupt Status Flag Clearing by DMAC and Setting by Input
Capture/Compare-Match: If a clear request signal is generated by the DMAC when the interrupt
status flag (ICF0B, CMF6) is set by input capture (ICR0B) or compare-match (CYLR6), clearing
by the DMAC has priority and the interrupt status flag is not set.
The width of the DMAC clear request signal is normally two states, the same as an ATU access
cycle, and clearing is performed in two states. If a bus wait, or a bus request from off-chip, occurs
while the DMAC clear request signal is being output, the DMAC clear request signal width will be
N states (N ≥ 3).
a. When the input capture/compare-match signal precedes the interrupt status flag
clear signal by 1/2 state
CK
b. When the input capture/compare-match signal follows the interrupt status flag
clear signal by 1/2 state, and contention arises
CK
Input capture/
compare-match signal
Figure 10.59 Contention between Interrupt Status Flag Clearing by DMAC and Setting by
Input Capture/Compare-Match
Note that when H'0000 is written to DCNT, the corresponding DSTR bit is not cleared to 0
immediately; it is cleared to 0, and the down-counter is stopped, when underflow occurs following
the H'0000 write.
CK
H'0000
written
Internal write signal to DCNT
DSTR
TSR
Port output
(one-shot pulse)
Starting a Count with a Down-Counter Value of H'0000: A one-shot pulse will not be output if
the down-count start register (DSTR) is set and the down-counter (DCNT) count started from the
CPU, or the timer connection register (TCNR) is set and DCNT is started by a channel 1 or
channel 2 compare-match, when the DCNT value is H'0000. However, the OSF bit in the timer
status register (TSR) will be set to 1.
CK
DSTR
TSR
Remains unchanged at 0
Port output
(one-shot pulse)
CK
TCNT N
GR (ICR) N
Contention between DCNT Write and Counter Clearing by Underflow: With the channel 10
down-counters (DCNT10A to DCNT10H), if the count is halted due to underflow occurring in the
T2 state of a down-counter write cycle by the CPU, retention of the H'0000 value has priority and
the write to DCNT by the CPU is not performed. Writing of 1 to the interrupt status flag (OSF)
when the underflow occurs is performed in the same way as for normal underflow.
The timing in this case is shown in figure 10.63. In this example, a write of H'5555 to DCNT is
attempted at the same time as DCNT underflows.
T1 T2
CK
Underflow signal
Contention between DSTR Bit Setting by CPU and Clearing by Underflow: If underflow
occurs in the T2 state of a down-counter start register (DSTR) “1” write cycle by the CPU,
clearing to 0 by the underflow has priority, and the corresponding bit of DSTR is not set to 1.
CK
1 written
Internal write signal
to DSTR
Underflow signal
Down-count start
register
Figure 10.64 Contention between DSTR Bit Setting by CPU and Clearing by Underflow
Timing of Prescaler Register (PSCR1), Timer Control Register (TCR), and Timer Mode
Register (TMDR) Setting: Settings in the prescaler register (PSCR1), timer control register
(TCR), and timer mode register (TMDR) should be made before the counter is started. Operation
is not guaranteed if these registers are modified while the counter is running.
Interrupt Status Flag Clearing Procedure: When an interrupt status flag is cleared to 0 by the
CPU, it must first be read before 0 is written to it. Correct operation cannot be guaranteed if 0 is
written without first reading the flag.
Register Values when a Free-Running Counter (TCNT) Halts: If the timer start register
(TSTR) value is set to 0 during counter operation, only incrementing of the corresponding free-
running counter (TCNT) is stopped, and neither the free-running counter (TCNT) nor any other
ATU registers are initialized. The external output value at the time TSTR is cleared to 0 will
continue to be output.
TCNT0 Writing and Interval Timer Operation: If the CPU program writes 1 to a bit in free-
running counter 0 (TCNT0) corresponding to a bit set to 1 in the interval interrupt request register
(ITVRR) when that TCNT0 bit is 0, TCNT0 bit 10, 11, 12, or 13 will be detected as having
changed from 0 to 1, and an interrupt request will be sent to INTC and A/D sampling will be
started.
Automatic TSR Clearing by DMAC Activation by the ATU: When the DMAC is activated by
the ATU, automatic clearing of TSR will not be performed unless an address in the ATU’s I/O
space (H'FFFF8200 to H'FFFF82FF) is set as either the DMAC data transfer source address or
destination address. If it is wished to set an address outside the ATU’s I/O space for both transfer
source and destination, the corresponding bit should be written with 0 after being read while set to
1 from within the interrupt handling routine.
Interrupt Status Flag Setting/Resetting: With TSRF, a 0 write to a bit is invalid only if
duplicate events have occurred for the same bit before writing 0 after reading 1 to clear a specific
bit. (The duplicate events are accepted.) In order to perform the 0 write, another 1 read is
necessary. Also, with TSRA to TSRE, events are not accepted even if duplicate events have
occurred for the same bit before a 0 write following a 1 read is performed.
External Output Value in Software Standby Mode: In software standby mode, the ATU
register and external output values are cleared to 0. However, while the TIOA to TIOF1, TIOA,
and TIOB2 external output values are cleared to 0 immediately after software standby mode is
exited, other external output values and all registers are cleared to 0 immediately before a
transition to software standby mode.
CK
TIOA–F1,
TIOA, B2
Other external
outputs
Figure 10.65 External Output Value Transition Points in Relation to Software Standby
Mode
11.1 Overview
The SH7050 series has an on-chip advanced pulse controller (APC) that can generate a maximum
of eight pulse outputs, using the advanced timer unit (ATU) as the time base.
11.1.1 Features
ATU
Internal/external clock
Compare-
match signal
TCNT2 GR2A
Compare-
Compare match
signal
GR2B
Set
Reset PULS7
Bit 7 Bit 15
Set
Reset PULS6
Bit 6 Bit 14
POPCR (pulse output port setting register)
Set
Reset PULS5
Bit 5 Bit 13
Set
Reset PULS4
Bit 4 Bit 12
Set
Reset PULS3
Bit 3 Bit 11
Set
Reset PULS2
Bit 2 Bit 10
Set
Reset PULS1
Bit 1 Bit 9
Set
Reset PULS0
Bit 0 Bit 8
APC
Legend:
POPCR: Pulse output port control register
The pulse output port control register (POPCR) is a 16-bit readable/writable register.
POPCR is initialized to H'0000 by a power-on reset and in hardware standby mode. It is not
initialized in software standby mode.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PULS7 PULS6 PULS5 PULS4 PULS3 PULS2 PULS1 PULS0 PULS7 PULS6 PULS5 PULS4 PULS3 PULS2 PULS1 PULS0
ROE ROE ROE ROE ROE ROE ROE ROE SOE SOE SOE SOE SOE SOE SOE SOE
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bits 15 to 8:
PULS7 to 0ROE Description
0 0 output to APC pulse output pin (PULS7–PULS0) is disabled (Initial value)
1 0 output to APC pulse output pin (PULS7–PULS0) is enabled
When one of these bits is set to 1, 0 is output from the corresponding pin on a compare-match
between the GR2B and TCNT2 values.
Bits 7 to 0—PULS7 to PULS0 Set Output Enable (PULS7SOE to PULS0SOE): These bits
enable or disable 1 output to the APC pulse output pins (PULS7 to PULS0) bit by bit.
Bits 7 to 0:
PULS7 to 0SOE Description
0 1 output to APC pulse output pin (PULS7–PULS0) is disabled (Initial value)
1 1 output to APC pulse output pin (PULS7–PULS0) is enabled
When one of these bits is set to 1, 1 is output from the corresponding pin on a compare-match
between the GR2A and TCNT2 values.
11.3 Operation
11.3.1 Overview
APC pulse output is enabled by designating multiplex pins for APC pulse output with the pin
function controller (PFC), and setting the corresponding bits to 1 in the pulse output port control
register (POPCR).
When general register 2A (GR2A) in the advanced timer unit (ATU) subsequently generates a
compare-match signal, 1 is output from the pins set to 1 by bits 7 to 0 in POPCR. When general
register 2B (GR2B) generates a compare-match signal, 0 is output from the pins set to 1 by bits 15
to 8 in POPCR.
0 is output from the output-enabled state until the first compare-match occurs.
CR Upper 8 bits
of POPCR
GR2B
Compare-match
signal
Reset signal
Port function
selection
APC output pins Set signal
(PULS0 to PULS7)
Compare-match
signal
GR2A
Lower 8 bits
of POPCR
Example of Setting Procedure for Advanced Pulse Controller Output Operation: Figure 11.3
shows an example of the setting procedure for advanced pulse controller output operation.
1. Set general registers GR2A and GR2B as output compare registers with the timer I/O control
register (TIOR).
2. Set the pulse rise point with GR2A and the pulse fall point with GR2B.
3. Select the timer counter 2 (TCNT2) counter clock with the timer prescale register (PSCR).
TCNT2 can only be cleared by an overflow.
4. Enable the respective interrupts with the timer interrupt enable register (TIER).
5. Set the pins for 1 output and 0 output with POPCR.
6. Set the control register for the port to be used by the APC to the APC output pin function.
7. Set the STR bit to 1 in the timer start register (TSTR) to start timer counter 2 (TCNT2).
8. Each time a compare-match interrupt is generated, update the GR value and set the next pulse
output time.
9. Each time a compare-match interrupt is generated, update the POPCR value and set the next
pin for pulse output.
GR function selection 1
GR setting 2
ATU settings
Count operation setting 3
No
Compare-match?
Yes
ATU setting GR setting 8
Figure 11.3 Example of Setting Procedure for Advanced Pulse Controller Output
Operation
Example of Advanced Pulse Controller Output Operation: Figure 11.4 shows an example of
advanced pulse controller output operation.
1. Set ATU registers GR2A and GR2B (to be used for output trigger generation) as output
compare registers. Set the rise point in GR2A and the fall point in GR2B, and enable the
respective compare-match interrupts.
2. Write H'0101 to POPCR.
3. Start ATU timer 2. When a GR2A compare-match occurs, 1 is output from the PULS0 pin.
When a GR2B compare-match occurs, 0 is output from the PULS0 pin.
4. Pulse output widths and output pins can be continually changed by successively rewriting
GR2A, GR2B, and POPCR in response to compare-match interrupts.
5. By setting POPCR to a value such as H'E0E0, pulses can be output from up to 8 pins in
response to a single compare-match.
Cleared on overflow
Rewritten
Rewritten
Rewritten
Rewritten
Rewritten
Rewritten
Rewritten
Rewritten
Rewritten
GR2B
GR2A
H'0000
PULS0
PULS1
PULS2
PULS3
PULS4
PULS5
PULS6
PULS7
TCNT value
H'FFFF
H'8000
GR2A H'8000
GR2B H'8000
POPCR H'0101
PULS0 pin
Pin output is 0
12.1 Overview
The watchdog timer (WDT) is a 1-channel timer for monitoring system operations. If a system
encounters a problem (crashes, for example) and the timer counter overflows without being
rewritten correctly by the CPU, an overflow signal (WDTOVF) is output externally. The WDT
can simultaneously generate an internal reset signal for the entire chip.
When the watchdog function is not needed, the WDT can be used as an interval timer. In the
interval timer operation, an interval timer interrupt is generated at each counter overflow. The
WDT is also used in recovering from the standby mode.
12.1.1 Features
Overflow φ/2
ITI
(interrupt Interrupt φ/64
signal) control φ/128
Clock Clock φ/256
select φ/512
φ/1024
WDTOVF Reset φ/4096
Internal control φ/8192
reset signal* Internal
clock sources
Bus
Module bus interface
WDT
TCSR: Timer control/status register
TCNT: Timer counter
RSTCSR: Reset control/status register
Note: The internal reset signal can be generated by setting the register.
The type of reset can be selected (power-on or manual).
Table 12.2 summarizes the three WDT registers. They are used to select the clock, switch the
WDT mode, and control the reset signal.
Address
Write* Read*
1 2
Name Abbreviation R/W Initial Value
R/(W)*
3
Timer control/status TCSR H'18 H'FFFF8610 H'FFFF8610
register
Timer counter TCNT R/W H'00 H'FFFF8611
R/(W)*
3
Reset control/status RSTCSR H'1F H'FFFF8612 H'FFFF8613
register
Notes: In register access, three cycles are required for both byte access and word access.
1. Write by word transfer. It cannot be written in byte or longword.
2. Read by byte transfer. It cannot be read in word or longword.
3. Only 0 can be written in bit 7 to clear the flag.
The TCNT is an 8-bit read/write upcounter. (The TCNT differs from other registers in that it is
more difficult to write to. See section 12.2.4, Register Access, for details.) When the timer enable
bit (TME) in the timer control/status register (TCSR) is set to 1, the watchdog timer counter starts
counting pulses of an internal clock selected by clock select bits 2 to 0 (CKS2 to CKS0) in the
TCSR. When the value of the TCNT overflows (changes from H'FF to H'00), a watchdog timer
overflow signal (WDTOVF) or interval timer interrupt (ITI) is generated, depending on the mode
selected in the WT/IT bit of the TCSR.
The TCNT is initialized to H'00 by a power-on reset and when the TME bit is cleared to 0. It is not
initialized in the standby mode.
Bit: 7 6 5 4 3 2 1 0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
The timer control/status register (TCSR) is an 8-bit read/write register. (The TCSR differs from
other registers in that it is more difficult to write to. See section 12.2.4, Register Access, for
details.) TCSR performs selection of the timer counter (TCNT) input clock and mode.
Bits 7 to 5 are initialized to 000 by a power-on reset, in hardware standby mode and software
standby mode. Bits 2 to 0 are initialized to 000 by a power-on reset and in hardware standby
mode, but retain their values in the software standby mode.
Bit: 7 6 5 4 3 2 1 0
OVF WT/IT TME — — CKS2 CKS1 CKS0
Initial value: 0 0 0 1 1 0 0 0
R/W: R/(W)* R/W R/W R R R/W R/W R/W
Note: * Only 0 can be written in bit 7 to clear the flag.
Bit 7—Overflow Flag (OVF): Indicates that the TCNT has overflowed from H'FF to H'00 in the
interval timer mode. It is not set in the watchdog timer mode.
IT
Bit 6: WT/IT Description
0 Interval timer mode: interval timer interrupt request to the CPU when
TCNT overflows (initial value)
1 Watchdog timer mode: WDTOVF signal output externally when TCNT
overflows. (Section 12.2.3, Reset Control/Status Register (RSTCSR),
describes in detail what happens when TCNT overflows in the watchdog
timer mode.)
Bits 4 and 3—Reserved: These bits always read as 1. The write value should always be 1.
Bits 2 to 0: Clock Select 2 to 0 (CKS2 to CKS0): These bits select one of eight internal clock
sources for input to the TCNT. The clock signals are obtained by dividing the frequency of the
system clock (φ).
Description
Overflow Interval*
Bit 2: CKS2 Bit 1: CKS1 Bit 0: CKS0 Clock Source φ = 20 MHz)
(φ
0 0 0 φ/2 (initial value) 25.6 µs
0 0 1 φ/64 819.2 µs
0 1 0 φ/128 1.6 ms
0 1 1 φ/256 3.3 ms
1 0 0 φ/512 6.6 ms
1 0 1 φ/1024 13.1 ms
1 1 0 φ/4096 52.4 ms
1 1 1 φ/8192 104.9 ms
Note: * The overflow interval listed is the time from when the TCNT begins counting at H'00
until an overflow occurs.
The RSTCSR is an 8-bit readable and writable register. (The RSTCSR differs from other registers
in that it is more difficult to write. See section 12.2.4, Register Access, for details.) It controls
output of the internal reset signal generated by timer counter (TCNT) overflow and selects the
internal reset signal type. RSTCR is initialized to H'1F by input of a reset signal from the RES pin,
but is not initialized by the internal reset signal generated by the overflow of the WDT. It is
initialized to H'1F in hardware standby mode and software standby mode.
Bit: 7 6 5 4 3 2 1 0
WOVF RSTE — — — — — —
Initial value: 0 0 0 0 1 1 1 1
R/W: R/(W)* R/W R R R R R R
Note: * Only 0 can be written in bit 7 to clear the flag.
Bit 7—Watchdog Timer Overflow Flag (WOVF): Indicates that the TCNT has overflowed
(H'FF to H'00) in the watchdog timer mode. It is not set in the interval timer mode.
Bit 6—Reset Enable (RSTE): Selects whether to reset the chip internally if the TCNT overflows
in the watchdog timer mode.
Bit 5, 4—Reserved: These bits always read as 0. The write value should always be 0.
Bits 3 to 0—Reserved: These bits always read as 1. The write value should always be 1.
The watchdog timer’s TCNT, TCSR, and RSTCSR registers differ from other registers in that they
are more difficult to write to. The procedures for writing and reading these registers are given
below.
Writing to the TCNT and TCSR: These registers must be written by a word transfer instruction.
They cannot be written by byte transfer instructions.
The TCNT and TCSR both have the same write address. The write data must be contained in the
lower byte of the written word. The upper byte must be H'5A (for the TCNT) or H'A5 (for the
TCSR) (figure 12.2). This transfers the write data from the lower byte to the TCNT or TCSR.
Writing to the RSTCSR: The RSTCSR must be written by a word access to address
H'FFFF8612. It cannot be written by byte transfer instructions.
Procedures for writing 0 in WOVF (bit 7) and for writing to RSTE (bit 6) and RSTS (bit 5) are
different, as shown in figure 12.3.
To write 0 in the WOVF bit, the write data must be H'A5 in the upper byte and H'00 in the lower
byte. This clears the WOVF bit to 0. The RSTE and RSTS bits are not affected. To write to the
RSTE and RSTS bits, the upper byte must be H'5A and the lower byte must be the write data. The
values of bits 6 and 5 of the lower byte are transferred to the RSTE and RSTS bits, respectively.
The WOVF bit is not affected.
Reading from the TCNT, TCSR, and RSTCSR: TCNT, TCSR, and RSTCSR are read like
other registers. Use byte transfer instructions. The read addresses are H'FFFF8610 for the TCSR,
H'FFFF8611 for the TCNT, and H'FFFF8613 for the RSTCSR.
12.3 Operation
To use the WDT as a watchdog timer, set the WT/IT and TME bits of the TCSR to 1. Software
must prevent TCNT overflow by rewriting the TCNT value (normally by writing H'00) before
overflow occurs. No TCNT overflows will occur while the system is operating normally, but if the
TCNT fails to be rewritten and overflows occur due to a system crash or the like, a WDTOVF
signal is output externally (figure 12.4). The WDTOVF signal can be used to reset the system. The
WDTOVF signal is output for 128 φ clock cycles.
If the RSTE bit in the RSTCSR is set to 1, a signal to reset the chip will be generated internally
simultaneous to the WDTOVF signal when TCNT overflows. Either a power-on reset or a manual
reset can be selected by the RSTS bit. The internal reset signal is output for 512 φ clock cycles.
When a watchdog overflow reset is generated simultaneously with a reset input at the RES pin, the
RES reset takes priority, and the WOVF bit is cleared to 0.
TCNT
value
Overflow
H'FF
H'00 Time
WDTOVF
signal
128 φ clocks
Internal
reset signal*
512 φ clocks
WT/IT: Timer mode select bit
TME: Timer enable bit
Note: * Internal reset signal occurs only when the RSTE bit is set to 1.
To use the WDT as an interval timer, clear WT/IT to 0 and set TME to 1. An interval timer
interrupt (ITI) is generated each time the timer counter overflows. This function can be used to
generate interval timer interrupts at regular intervals (figure 12.5).
TCNT value
Overflow Overflow Overflow Overflow
H'FF
H'00 Time
The watchdog timer has a special function to clear the standby mode with an NMI interrupt. When
using the standby mode, set the WDT as described below.
Before Transition to the Standby Mode: The TME bit in the TCSR must be cleared to 0 to stop
the watchdog timer counter before it enters the standby mode. The chip cannot enter the standby
mode while the TME bit is set to 1. Set bits CKS2 to CKS0 so that the counter overflow interval is
equal to or longer than the oscillation settling time. See section 22.3, AC Characteristics, for the
oscillation settling time.
Recovery from the Standby Mode: When an NMI request signal is received in standby mode,
the clock oscillator starts running and the watchdog timer starts incrementing at the rate selected
by bits CKS2 to CKS0 before the standby mode was entered. When the TCNT overflows (changes
from H'FF to H'00), the clock is presumed to be stable and usable; clock signals are supplied to the
entire chip and the standby mode ends.
For details on the standby mode, see section 21, Power-Down States.
In the interval timer mode, when the TCNT overflows, the OVF flag of the TCSR is set to 1 and
an interval timer interrupt is simultaneously requested (figure 12.6).
CK
Overflow signal
(internal signal)
OVF
When the TCNT overflows in the watchdog timer mode, the WOVF bit of the RSTCSR is set to 1
and a WDTOVF signal is output. When the RSTE bit is set to 1, TCNT overflow enables an
internal reset signal to be generated for the entire chip (figure 12.7).
CK
Overflow signal
(internal signal)
WOVF
If a timer counter increment clock pulse is generated during the T3 state of a write cycle to the
TCNT, the write takes priority and the timer counter is not incremented (figure 12.8).
T1 T2 T3
CK
Internal
write signal
TCNT
input clock
TCNT N M
If the values of bits CKS2 to CKS0 are altered while the WDT is running, the count may
increment incorrectly. Always stop the watchdog timer (by clearing the TME bit to 0) before
changing the values of bits CKS2 to CKS0.
To prevent incorrect operation, always stop the watchdog timer (by clearing the TME bit to 0)
before switching between interval timer mode and watchdog timer mode.
If a WDTOVF signal is input to the RES pin, the LSI cannot initialize correctly.
Avoid logical input of the WDTOVF output signal to the RES input pin. To reset the entire system
with the WDTOVF signal, use the circuit shown in figure 12.9.
SH7050 series
Reset signal to
entire system WDTOVF
If the RSTE bit is cleared to 0 in the watchdog timer mode, the LSI will not reset internally when a
TCNT overflow occurs, but the TCNT and TCSR in the WDT will reset.
13.1 Overview
The SH7050 series has a serial communication interface (SCI) with three independent channels,
both of which possess the same functions.
The SCI supports both asynchronous and clock synchronous serial communication. It also has a
multiprocessor communication function for serial communication among two or more processors.
13.1.1 Features
Bus interface
Internal
Module data bus
data bus
SCR
φ
RxD RSR TSR SMR Baud rate φ/4
generator φ/16
Transmit/ φ/64
receive control
TxD
Parity Clock
generation
Parity check
External clock
SCK
TEI
TxI
RxI
ERI
SCI
Table 13.2 summarizes the SCI internal registers. These registers select the communication mode
(asynchronous or clock synchronous), specify the data format and bit rate, and control the
transmitter and receiver sections.
Initial Access
Address*
2
Channel Name Abbreviation R/W Value Size
0 Serial mode register SMR0 R/W H'00 H'FFFF81A0 8, 16
Bit rate register BRR0 R/W H'FF H'FFFF81A1 8, 16
Serial control register SCR0 R/W H'00 H'FFFF81A2 8, 16
Transmit data register TDR0 R/W H'FF H'FFFF81A3 8, 16
R/(W) *
1
Serial status register SSR0 H'84 H'FFFF81A4 8, 16
Receive data register RDR0 R H'00 H'FFFF81A5 8, 16
1 Serial mode register SMR1 R/W H'00 H'FFFF81B0 8, 16
Bit rate register BRR1 R/W H'FF H'FFFF81B1 8, 16
Serial control register SCR1 R/W H'00 H'FFFF81B2 8, 16
Transmit data register TDR1 R/W H'FF H'FFFF81B3 8, 16
R/(W) *
1
Serial status register SSR1 H'84 H'FFFF81B4 8, 16
Receive data register RDR1 R H'00 H'FFFF81B5 8, 16
2 Serial mode register SMR2 R/W H'00 H'FFFF81C0 8, 16
Bit rate register BRR2 R/W H'FF H'FFFF81C1 8, 16
Serial control register SCR2 R/W H'00 H'FFFF81C2 8, 16
Transmit data register TDR2 R/W H'FF H'FFFF81C3 8, 16
Serial status register SSR2 R/(W) * 1
H'84 H'FFFF81C4 8, 16
Receive data register RDR2 R H'00 H'FFFF81C5 8, 16
Notes: In register access, two cycles are required for byte access, and four cycles for word
access.
1. The only value that can be written is a 0 to clear the flags.
2. Do not access empty addresses.
The receive shift register (RSR) receives serial data. Data input at the RxD pin is loaded into the
RSR in the order received, LSB (bit 0) first, converting the data to parallel form. When one byte
has been received, it is automatically transferred to the RDR.
Bit: 7 6 5 4 3 2 1 0
R/W: — — — — — — — —
The receive data register (RDR) stores serial receive data. The SCI completes the reception of one
byte of serial data by moving the received data from the receive shift register (RSR) into the RDR
for storage. The RSR is then ready to receive the next data. This double buffering allows the SCI
to receive data continuously.
The CPU can read but not write the RDR. The RDR is initialized to H'00 by a power-on reset, in
hardware standby mode and software standby mode.
Bit: 7 6 5 4 3 2 1 0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
The transmit shift register (TSR) transmits serial data. The SCI loads transmit data from the
transmit data register (TDR) into the TSR, then transmits the data serially from the TxD pin, LSB
(bit 0) first. After transmitting one data byte, the SCI automatically loads the next transmit data
from the TDR into the TSR and starts transmitting again. If the TDRE bit of the SSR is 1,
however, the SCI does not load the TDR contents into the TSR.
Bit: 7 6 5 4 3 2 1 0
R/W: — — — — — — — —
The transmit data register (TDR) is an 8-bit register that stores data for serial transmission. When
the SCI detects that the transmit shift register (TSR) is empty, it moves transmit data written in the
TDR into the TSR and starts serial transmission. Continuous serial transmission is possible by
writing the next transmit data in the TDR during serial transmission from the TSR.
The CPU can always read and write the TDR. The TDR is initialized to H'FF by a power-on reset,
in hardware standby mode and software standby mode.
Bit: 7 6 5 4 3 2 1 0
Initial value: 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
The serial mode register (SMR) is an 8-bit register that specifies the SCI serial communication
format and selects the clock source for the baud rate generator.
The CPU can always read and write the SMR. The SMR is initialized to H'00 by a power-on reset,
in hardware standby mode and software standby mode.
Bit: 7 6 5 4 3 2 1 0
C/A CHR PE O/E STOP MP CKS1 CKS0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
A
Bit 7: C/A Description
0 Asynchronous mode (initial value)
1 Clocked synchronous mode
Bit 6—Character Length (CHR): Selects 7-bit or 8-bit data in the asynchronous mode. In the
clock synchronous mode, the data length is always eight bits, regardless of the CHR setting.
Bit 5—Parity Enable (PE): Selects whether to add a parity bit to transmit data and to check the
parity of receive data, in the asynchronous mode. In the clock synchronous mode, a parity bit is
neither added nor checked, regardless of the PE setting.
Bit 5: PE Description
0 Parity bit not added or checked (initial value)
1 Parity bit added and checked. When PE is set to 1, an even or odd
parity bit is added to transmit data, depending on the parity mode (O/E)
setting. Receive data parity is checked according to the even/odd (O/E)
mode setting.
Bit 4—Parity Mode (O/E E): Selects even or odd parity when parity bits are added and checked.
The O/E setting is used only in asynchronous mode and only when the parity enable bit (PE) is set
to 1 to enable parity addition and check. The O/E setting is ignored in the clock synchronous
mode, or in the asynchronous mode when parity addition and check is disabled.
E
Bit 4: O/E Description
0 Even parity (initial value). If even parity is selected, the parity bit is
added to transmit data to make an even number of 1s in the transmitted
character and parity bit combined. Receive data is checked to see if it
has an even number of 1s in the received character and parity bit
combined.
1 Odd parity. If odd parity is selected, the parity bit is added to transmit
data to make an odd number of 1s in the transmitted character and
parity bit combined. Receive data is checked to see if it has an odd
number of 1s in the received character and parity bit combined.
Bit 3—Stop Bit Length (STOP): Selects one or two bits as the stop bit length in the
asynchronous mode. This setting is used only in the asynchronous mode. It is ignored in the clock
synchronous mode because no stop bits are added.
In receiving, only the first stop bit is checked, regardless of the STOP bit setting. If the second
stop bit is 1, it is treated as a stop bit, but if the second stop bit is 0, it is treated as the start bit of
the next incoming character.
Bit 2—Multiprocessor Mode (MP): Selects multiprocessor format. When multiprocessor format
is selected, settings of the parity enable (PE) and parity mode (O/E) bits are ignored. The MP bit
setting is used only in the asynchronous mode; it is ignored in the clock synchronous mode. For
the multiprocessor communication function, see section 13.3.3, Multiprocessor Communication.
Bit 2: MP Description
0 Multiprocessor function disabled (initial value)
1 Multiprocessor format selected
Bits 1 and 0—Clock Select 1 and 0 (CKS1 and CKS0): These bits select the internal clock
source of the on-chip baud rate generator. Four clock sources are available; φ, φ/4, φ/16, or φ/64.
For further information on the clock source, bit rate register settings, and baud rate, see section
13.2.8, Bit Rate Register.
The serial control register (SCR) operates the SCI transmitter/receiver, selects the serial clock
output in the asynchronous mode, enables/disables interrupt requests, and selects the
transmit/receive clock source. The CPU can always read and write the SCR. The SCR is initialized
to H'00 by a power-on reset, in hardware standby mode and software standby mode. Manual reset
does not initialize SCR.
Bit: 7 6 5 4 3 2 1 0
TIE RIE TE RE MPIE TEIE CKE1 CKE0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit 7—Transmit Interrupt Enable (TIE): Enables or disables the transmit-data-empty interrupt
(TxI) requested when the transmit data register empty bit (TDRE) in the serial status register
(SSR) is set to 1 by transfer of serial transmit data from the TDR to the TSR.
Bit 6—Receive Interrupt Enable (RIE): Enables or disables the receive-data-full interrupt (RxI)
requested when the receive data register full bit (RDRF) in the serial status register (SSR) is set to
1 by transfer of serial receive data from the RSR to the RDR. It also enables or disables receive-
error interrupt (ERI) requests.
Bit 5—Transmit Enable (TE): Enables or disables the SCI serial transmitter.
Bit 5: TE Description
0 Transmitter disabled (initial value). The transmit data register empty bit
(TDRE) in the serial status register (SSR) is locked at 1.
1 Transmitter enabled. Serial transmission starts when the transmit data
register empty (TDRE) bit in the serial status register (SSR) is cleared
to 0 after writing of transmit data into the TDR. Select the transmit
format in the SMR before setting TE to 1.
Bit 4—Receive Enable (RE): Enables or disables the SCI serial receiver.
Bit 4: RE Description
0 Receiver disabled (initial value). Clearing RE to 0 does not affect the
receive flags (RDRF, FER, PER, ORER). These flags retain their
previous values.
1 Receiver enabled. Serial reception starts when a start bit is detected in
the asynchronous mode, or synchronous clock input is detected in the
clock synchronous mode. Select the receive format in the SMR before
setting RE to 1.
Bit 2—Transmit-End Interrupt Enable (TEIE): Enables or disables the transmit-end interrupt
(TEI) requested if TDR does not contain valid transmit data when the MSB is transmitted.
Bits 1 and 0—Clock Enable 1 and 0 (CKE1 and CKE0): These bits select the SCI clock source
and enable or disable clock output from the SCK pin. Depending on the combination of CKE1 and
CKE0, the SCK pin can be used for serial clock output, or serial clock input. Select the SCK pin
function by using the pin function controller (PFC).
The CKE0 setting is valid only in the asynchronous mode, and only when the SCI is internally
clocked (CKE1 = 0). The CKE0 setting is ignored in the clock synchronous mode, or when an
external clock source is selected (CKE1 = 1). Select the SCI operating mode in the serial mode
register (SMR) before setting CKE1 and CKE0. For further details on selection of the SCI clock
source, see table 13.10 in section 13.3, Operation.
Bit 1: Bit 0:
Description*
1
CKE1 CKE0
0 0 Asynchronous mode Internal clock, SCK pin used for input pin (input
signal is ignored) or output pin (output level is
undefined) *
2
Clock synchronous mode Internal clock, SCK pin used for synchronous
clock output*
2
The serial status register (SSR) is an 8-bit register containing multiprocessor bit values, and status
flags that indicate SCI operating status.
The CPU can always read and write the SSR, but cannot write 1 in the status flags (TDRE, RDRF,
ORER, PER, and FER). These flags can be cleared to 0 only if they have first been read (after
being set to 1). Bits 2 (TEND) and 1 (MPB) are read-only bits that cannot be written. The SSR is
initialized to H'84 by a power-on reset, in hardware standby mode and software standby mode.
Manual reset does not initialize SSR.
Bit: 7 6 5 4 3 2 1 0
TDRE RDRF ORER FER PER TEND MPB MPBT
Initial value: 1 0 0 0 0 1 0 0
R/W: R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R R R/W
Note: * The only value that can be written is a 0 to clear the flag.
Bit 7—Transmit Data Register Empty (TDRE): Indicates that the SCI has loaded transmit data
from the TDR into the TSR and new serial transmit data can be written in the TDR.
Bit 6—Receive Data Register Full (RDRF): Indicates that RDR contains received data.
Bit 5—Overrun Error (ORER): Indicates that data reception ended abnormally due to an
overrun error.
Bit 4—Framing Error (FER): Indicates that data reception ended abnormally due to a framing
error in the asynchronous mode.
Bit 3—Parity Error (PER): Indicates that data reception (with parity) ended abnormally due to a
parity error in the asynchronous mode.
Bit 2—Transmit End (TEND): Indicates that when the last bit of a serial character was
transmitted, the TDR did not contain valid data, so transmission has ended. TEND is a read-only
bit and cannot be written.
Bit 1—Multiprocessor Bit (MPB): Stores the value of the multiprocessor bit in receive data
when a multiprocessor format is selected for receiving in the asynchronous mode. The MPB is a
read-only bit and cannot be written.
Bit 0—Multiprocessor Bit Transfer (MPBT): Stores the value of the multiprocessor bit added to
transmit data when a multiprocessor format is selected for transmitting in the asynchronous mode.
The MPBT setting is ignored in the clock synchronous mode, when a multiprocessor format is not
selected, or when the SCI is not transmitting.
The bit rate register (BRR) is an 8-bit register that, together with the baud rate generator clock
source selected by the CKS1 and CKS0 bits in the serial mode register (SMR), determines the
serial transmit/receive bit rate.
The CPU can always read and write the BRR. The BRR is initialized to H'FF by a power-on reset,
in hardware standby mode and software standby mode. Each channel has independent baud rate
generator control, so different values can be set in the two channels.
Bit: 7 6 5 4 3 2 1 0
Initial value: 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Table 13.3 lists examples of BRR settings in the asynchronous mode; table 13.4 lists examples of
BBR settings in the clock synchronous mode.
Asynchronous mode:
φ
N= × 106 − 1
64 × 22n−1 ×B
Synchronous mode:
φ
N= × 106 − 1
8× 22n−1 ×B
SMR Settings
n Clock Source CKS1 CKS2
0 φ 0 0
1 φ/4 0 1
2 φ/16 1 0
3 φ/64 1 1
φ × 106
Error (%) = − 1 × 100
(N + 1) × B × 64 × 22n−1
φ (MHz)
4 4.9152 6
Bit Rate
(Bits/s) n N Error (%) n N Error (%) n N Error (%)
110 2 70 0.03 2 86 0.31 2 106 –0.44
150 1 207 0.16 1 255 0.00 2 77 0.16
300 1 103 0.16 1 127 0.00 1 155 0.16
600 0 207 0.16 0 255 0.00 1 77 0.16
1200 0 103 0.16 0 127 0.00 0 155 0.16
2400 0 51 0.16 0 63 0.00 0 77 0.16
4800 0 25 0.16 0 31 0.00 0 38 0.16
9600 0 12 0.16 0 15 0.00 0 19 –2.34
14400 0 8 –3.55 0 10 –3.03 0 12 0.16
19200 0 6 –6.99 0 7 0.00 0 9 –2.34
28800 0 3 8.51 0 4 6.67 0 6 –6.99
31250 0 3 0.00 0 4 –1.70 0 5 0.00
38400 0 2 8.51 0 3 0.00 0 4 –2.34
φ (MHz)
7.3728 8 9.8304
Bit Rate
(Bits/s) n N Error (%) n N Error (%) n N Error (%)
110 2 130 –0.07 2 141 0.03 2 174 0.26
150 2 95 0.00 2 103 0.16 2 127 0.00
300 1 191 0.00 1 207 0.16 1 255 0.00
600 1 95 0.00 1 103 0.16 1 127 0.00
1200 0 191 0.00 0 207 0.16 0 255 0.00
2400 0 95 0.00 0 103 0.16 0 127 0.00
4800 0 47 0.00 0 51 0.16 0 63 0.00
9600 0 23 0.00 0 25 0.16 0 31 0.00
14400 0 15 0.00 0 16 2.12 0 20 1.59
19200 0 11 0.00 0 12 0.16 0 15 0.00
28800 0 7 0.00 0 8 –3.55 0 10 –3.03
31250 0 6 0.54 0 7 0.00 0 9 –1.70
38400 0 5 0.00 0 6 –6.99 0 7 0.00
φ (MHz)
10 11.0592 12
Bit Rate
(Bits/s) n N Error (%) n N Error (%) n N Error (%)
110 2 177 –0.25 2 195 0.19 2 212 0.03
150 2 129 0.16 2 143 0.00 2 155 0.16
300 2 64 0.16 2 71 0.00 2 77 0.16
600 1 129 0.16 1 143 0.00 1 155 0.16
1200 1 64 0.16 1 71 0.00 1 77 0.16
2400 0 129 0.16 0 143 0.00 0 155 0.16
4800 0 64 0.16 0 71 0.00 0 77 0.16
9600 0 32 –1.36 0 35 0.00 0 38 0.16
14400 0 21 –1.36 0 23 0.00 0 25 0.16
19200 0 15 1.73 0 19 0.00 0 19 –2.34
28800 0 10 –1.36 0 11 0.00 0 12 0.16
31250 0 9 0.00 0 10 0.54 0 11 0.00
38400 0 7 1.73 0 8 0.00 0 9 –2.34
φ (MHz)
12.288 14 14.7456
Bit Rate
(Bits/s) n N Error (%) n N Error (%) n N Error (%)
110 2 217 0.08 2 248 –0.17 3 64 0.70
150 2 159 0.00 2 181 0.16 2 191 0.00
300 2 79 0.00 2 90 0.16 2 95 0.00
600 1 159 0.00 1 181 0.16 1 191 0.00
1200 1 79 0.00 1 90 0.16 1 95 0.00
2400 0 159 0.00 0 181 0.16 0 191 0.00
4800 0 79 0.00 0 90 0.16 0 95 0.00
9600 0 39 0.00 0 45 –0.93 0 47 0.00
14400 0 26 –1.23 0 29 1.27 0 31 0.00
19200 0 19 0.00 0 22 –0.93 0 23 0.00
28800 0 12 2.56 0 14 1.27 0 15 0.00
31250 0 11 2.40 0 13 0.00 0 14 –1.70
38400 0 9 0.00 0 10 3.57 0 11 0.00
φ (MHz)
16 17.2032 18
Bit Rate
(Bits/s) n N Error (%) n N Error (%) n N Error (%)
110 3 70 0.03 3 75 0.48 3 79 –0.12
150 2 207 0.16 2 223 0.00 2 233 0.16
300 2 103 0.16 2 111 0.00 2 116 0.16
600 1 207 0.16 1 223 0.00 1 233 0.16
1200 1 103 0.16 1 111 0.00 1 116 0.16
2400 0 207 0.16 0 223 0.00 0 233 0.16
4800 0 103 0.16 0 111 0.00 0 116 0.16
9600 0 51 0.16 0 55 0.00 0 58 –0.69
14400 0 34 –0.79 0 36 0.90 0 38 0.16
19200 0 25 0.16 0 27 0.00 0 28 1.02
28800 0 16 2.12 0 18 –1.75 0 19 –2.34
31250 0 15 0.00 0 16 1.20 0 17 0.00
38400 0 12 0.16 0 13 0.00 0 14 –2.34
φ (MHz)
18.432 19.6608 20
Bit Rate
(Bits/s) n N Error (%) n N Error (%) n N Error (%)
110 3 81 –0.22 3 86 0.31 3 88 –0.25
150 2 239 0.00 2 255 0.00 3 64 0.16
300 2 119 0.00 2 127 0.00 2 129 0.16
600 1 239 0.00 1 255 0.00 2 64 0.16
1200 1 119 0.00 1 127 0.00 1 129 0.16
2400 0 239 0.00 0 255 0.00 1 64 0.16
4800 0 119 0.00 0 127 0.00 0 129 0.16
9600 0 59 0.00 0 63 0.00 0 64 0.16
14400 0 39 0.00 0 42 –0.78 0 42 0.94
19200 0 29 0.00 0 31 0.00 0 32 –1.36
28800 0 19 0.00 0 20 1.59 0 21 –1.36
31250 0 17 2.40 0 19 –1.70 0 19 0.00
38400 0 14 0.00 0 15 0.00 0 15 1.73
Table 13.4 Bit Rates and BRR Settings in Clocked Synchronous Mode
φ (MHz)
4 8 10 12
Bit Rate
(Bits/s) n N n N n N n N
110 3 141 3 212 3 212 3 212
250 2 249 3 124 3 155 3 187
500 2 124 2 249 3 77 3 93
1k 1 249 2 124 2 155 2 187
2.5k 1 99 1 199 1 249 2 74
5k 0 199 1 99 1 124 1 149
10k 0 99 0 199 0 249 1 74
25k 0 39 0 79 0 99 0 119
50k 0 19 0 39 0 49 0 59
100k 0 9 0 19 0 24 0 29
250k 0 3 0 7 0 9 0 11
500k 0 1 0 3 0 4 0 5
1M 0 1 — — 0 2
2.5M 0 0* 0 0*
5M
φ (MHz)
16 20
Bit Rate
(Bits/s) n N n N
110 3 212 3 212
250 3 249 3 249
500 3 124 3 155
1k 2 249 3 77
2.5k 2 99 2 124
5k 1 199 2 249
10k 1 99 1 124
25k 0 159 1 199
50k 0 79 0 99
100k 0 39 0 49
250k 0 15 0 19
500k 0 7 0 9
1M 0 3 0 4
2.5M — — 0 1
5M 0 0*
Note: * Settings with an error of 1% or less are recommended.
Legend:
Blank: No setting available
—: Setting possible, but error occurs
Table 13.5 indicates the maximum bit rates in the asynchronous mode when the baud rate
generator is being used for various frequencies. Tables 13.6 and 13.7 show the maximum rates for
external clock input.
Table 13.5 Maximum Bit Rates for Various Frequencies with Baud Rate Generator
(Asynchronous Mode)
Settings
φ (MHz) Maximum Bit Rate (Bits/s) n N
4 125000 0 0
4.9152 153600 0 0
6 187500 0 0
7.3728 230400 0 0
8 250000 0 0
9.8304 307200 0 0
10 312500 0 0
11.0592 345600 0 0
12 375000 0 0
12.288 384000 0 0
14 437500 0 0
14.7456 460800 0 0
16 500000 0 0
17.2032 537600 0 0
18 562500 0 0
18.432 576000 0 0
19.6608 614400 0 0
20 625000 0 0
Table 13.6 Maximum Bit Rates during External Clock Input (Asynchronous Mode)
Table 13.7 Maximum Bit Rates during External Clock Input (Clock Synchronous Mode)
13.3 Operation
13.3.1 Overview
For serial communication, the SCI has an asynchronous mode in which characters are
synchronized individually, and a clock synchronous mode in which communication is
synchronized with clock pulses. Asynchronous/clock synchronous mode and the transmission
format are selected in the serial mode register (SMR), as shown in table 13.8. The SCI clock
source is selected by the C/A bit in the serial mode register (SMR) and the CKE1 and CKE0 bits
in the serial control register (SCR), as shown in table 13.9.
Asynchronous Mode:
Table 13.8 Serial Mode Register Settings and SCI Communication Formats
Table 13.9 SMR and SCR Settings and SCI Clock Source Selection
In the asynchronous mode, each transmitted or received character begins with a start bit and ends
with a stop bit. Serial communication is synchronized one character at a time.
The transmitting and receiving sections of the SCI are independent, so full duplex communication
is possible. The transmitter and receiver are both double buffered, so data can be written and read
while transmitting and receiving are in progress, enabling continuous transmitting and receiving.
Figure 13.2 shows the general format of asynchronous serial communication. In asynchronous
serial communication, the communication line is normally held in the marking (high) state. The
SCI monitors the line and starts serial communication when the line goes to the space (low) state,
indicating a start bit. One serial character consists of a start bit (low), data (LSB first), parity bit
(high or low), and stop bit (high), in that order.
When receiving in the asynchronous mode, the SCI synchronizes on the falling edge of the start
bit. The SCI samples each data bit on the eighth pulse of a clock with a frequency 16 times the bit
rate. Receive data is latched at the center of each bit.
1 bit 7 or 8 bits 1 or 1 or
no bit 2 bits
Figure 13.2 Data Format in Asynchronous Communication (Example: 8-bit Data with
Parity and Two Stop Bits)
Transmit/Receive Formats: Table 13.10 shows the 12 communication formats that can be
selected in the asynchronous mode. The format is selected by settings in the serial mode register
(SMR).
Clock: An internal clock generated by the on-chip baud rate generator or an external clock input
from the SCK pin can be selected as the SCI transmit/receive clock. The clock source is selected
by the C/A bit in the serial mode register (SMR) and bits CKE1 and CKE0 in the serial control
register (SCR) (table 13.9).
When an external clock is input at the SCK pin, it must have a frequency equal to 16 times the
desired bit rate.
When the SCI operates on an internal clock, it can output a clock signal at the SCK pin. The
frequency of this output clock is equal to the bit rate. The phase is aligned as in figure 13.3 so that
the rising edge of the clock occurs at the center of each transmit data bit.
0 D0 D1 D2 D3 D4 D5 D6 D7 0/1 1 1
1 frame
Figure 13.3 Output Clock and Communication Data Phase Relationship (Asynchronous
Mode)
SCI Initialization (Asynchronous Mode): Before transmitting or receiving, clear the TE and RE
bits to 0 in the serial control register (SCR), then initialize the SCI as follows.
When changing the operation mode or communication format, always clear the TE and RE bits to
0 before following the procedure given below. Clearing TE to 0 sets TDRE to 1 and initializes the
transmit shift register (TSR). Clearing RE to 0, however, does not initialize the RDRF, PER, FER,
and ORER flags and receive data register (RDR), which retain their previous contents.
When an external clock is used, the clock should not be stopped during initialization or subsequent
operation. SCI operation becomes unreliable if the clock is stopped.
Figure 13.4 is a sample flowchart for initializing the SCI. The procedure is as follows (the steps
correspond to the numbers in the flowchart):
Initialize
No
1-bit interval elapsed?
Yes
Set TE or RE to 1 in SCR; Set RIE,
4
TIE, TEIE, and MPIE as necessary
End
Transmitting Serial Data (Asynchronous Mode): Figure 13.5 shows a sample flowchart for
transmitting serial data. The procedure is as follows (the steps correspond to the numbers in the
flowchart):
Initialize 1
Start transmitting
No
TDRE = 1?
Yes
3
No
All data transmitted?
Yes
No
TEND = 1?
Yes
No
Output break signal?
4
Yes
Set DR = 0
End transmission
1. The SCI monitors the TDRE bit in the SSR. When TDRE is cleared to 0, the SCI recognizes
that the transmit data register (TDR) contains new data, and loads this data from the TDR into
the transmit shift register (TSR).
2. After loading the data from the TDR into the TSR, the SCI sets the TDRE bit to 1 and starts
transmitting. If the transmit-data-empty interrupt enable bit (TIE) is set to 1 in the SCR, the
SCI requests a transmit-data-empty interrupt (TxI) at this time.
Serial transmit data is transmitted in the following order from the TxD pin:
a. Start bit: one 0 bit is output.
b. Transmit data: seven or eight bits of data are output, LSB first.
c. Parity bit or multiprocessor bit: one parity bit (even or odd parity) or one multiprocessor bit
is output. Formats in which neither a parity bit nor a multiprocessor bit is output can also
be selected.
d. Stop bit: one or two 1 bits (stop bits) are output.
e. Marking: output of 1 bits continues until the start bit of the next transmit data.
3. The SCI checks the TDRE bit when it outputs the stop bit. If TDRE is 0, the SCI loads new
data from the TDR into the TSR, outputs the stop bit, then begins serial transmission of the
next frame. If TDRE is 1, the SCI sets the TEND bit to 1 in the SSR, outputs the stop bit, then
continues output of 1 bits (marking). If the transmit-end interrupt enable bit (TEIE) in the SCR
is set to 1, a transmit-end interrupt (TEI) is requested.
Figure 13.6 shows an example of SCI transmit operation in the asynchronous mode.
TDRE
TEND
1 frame
Receiving Serial Data (Asynchronous Mode): Figures 13.7 and 13.8 show a sample flowchart
for receiving serial data. The procedure is as follows (the steps correspond to the numbers in the
flowchart).
Initialization 1
Start reception
No Error handling
No
RDRF = 1?
Yes
Read reception data of RDR and
4
clear RDRF bit in SSR to 0
No
All data received?
Yes
End reception
No
ORER = 1?
Yes
No
FER = 1?
Yes
Yes
Break?
No
No
PER = 1?
Yes
End
1. The SCI monitors the communication line. When it detects a start bit (0), the SCI synchronizes
internally and starts receiving.
2. Receive data is shifted into the RSR in order from the LSB to the MSB.
3. The parity bit and stop bit are received. After receiving these bits, the SCI makes the following
checks:
a. Parity check. The number of 1s in the receive data must match the even or odd parity
setting of the O/E bit in the SMR.
b. Stop bit check. The stop bit value must be 1. If there are two stop bits, only the first stop bit
is checked.
c. Status check. RDRF must be 0 so that receive data can be loaded from the RSR into the
RDR.
If the data passes these checks, the SCI sets RDRF to 1 and stores the received data in the
RDR. If one of the checks fails (receive error), the SCI operates as indicated in table 13.11.
Note: When a receive error occurs, further receiving is disabled. While receiving, the RDRF
bit is not set to 1, so be sure to clear the error flags.
4. After setting RDRF to 1, if the receive-data-full interrupt enable bit (RIE) is set to 1 in the
SCR, the SCI requests a receive-data-full interrupt (RxI). If one of the error flags (ORER,
PER, or FER) is set to 1 and the receive-data-full interrupt enable bit (RIE) in the SCR is also
set to 1, the SCI requests a receive-error interrupt (ERI).
Figure 13.9 shows an example of SCI receive operation in the asynchronous mode.
TDRF
The multiprocessor communication function enables several processors to share a single serial
communication line for sending and receiving data. The processors communicate in the
asynchronous mode using a format with an additional multiprocessor bit (multiprocessor format).
Receiving processors skip incoming data until they receive data with the multiprocessor bit set to
1. When they receive data with the multiprocessor bit set to 1, receiving processors compare the
data with their IDs. The receiving processor with a matching ID continues to receive further
incoming data. Processors with IDs not matching the received data skip further incoming data
until they again receive data with the multiprocessor bit set to 1. Multiple processors can send and
receive data in this way.
Figure 13.10 shows the example of communication among processors using the multiprocessor
format.
Communication Formats: Four formats are available. Parity-bit settings are ignored when the
multiprocessor format is selected. For details see table 13.9.
Transmitting
processor
Serial
H'01 H'AA
data
(MPB = 1) (MPB = 0)
Transmitting Multiprocessor Serial Data: Figure 13.11 shows a sample flowchart for
transmitting multiprocessor serial data. The procedure is as follows (the steps correspond to the
numbers in the flowchart):
4. Output a break at the end of serial transmission: Set the data register (DR) of the port to 0, then
clear TE to 0 in SCR and set the TxD pin function as output port with the PFC.
Initialization 1
Start transmission
No
TDRE = 1?
Yes
Write transmit data in TDR
and set MPBT in SSR
No 3
All data transmitted?
Yes
Read TEND bit in SSR
No
TEND = 1?
Yes
No
Output break signal? 4
Yes
Set DR = 0
End transmission
1. The SCI monitors the TDRE bit in the SSR. When TDRE is cleared to 0 the SCI recognizes
that the transmit data register (TDR) contains new data, and loads this data from the TDR into
the transmit shift register (TSR).
2. After loading the data from the TDR into the TSR, the SCI sets the TDRE bit to 1 and starts
transmitting. If the transmit-data-empty interrupt enable bit (TIE) in the SCR is set to 1, the
SCI requests a transmit-data-empty interrupt (TxI) at this time.
Serial transmit data is transmitted in the following order from the TxD pin:
a. Start bit: one 0 bit is output.
b. Transmit data: seven or eight bits are output, LSB first.
c. Multiprocessor bit: one multiprocessor bit (MPBT value) is output.
d. Stop bit: one or two 1 bits (stop bits) are output.
e. Marking: output of 1 bits continues until the start bit of the next transmit data.
3. The SCI checks the TDRE bit when it outputs the stop bit. If TDRE is 0, the SCI loads data
from the TDR into the TSR, outputs the stop bit, then begins serial transmission of the next
frame. If TDRE is 1, the SCI sets the TEND bit in the SSR to 1, outputs the stop bit, then
continues output of 1 bits in the marking state. If the transmit-end interrupt enable bit (TEIE)
in the SCR is set to 1, a transmit-end interrupt (TEI) is requested at this time.
Figure 13.12 shows an example of SCI receive operation in the multiprocessor format.
Example: 8-bit data with multiprocessor bit and one stop bit
Multiprocessor Multiprocessor
bit bit
Start Stop Start Stop
1 bit Data bit bit Data bit 1
Serial Idle
0 D0 D1 D7 0/1 1 0 D0 D1 D7 0/1 1
data (marking
state)
TDRE
TEND
1 frame
Receiving Multiprocessor Serial Data: Figure 13.13 shows a sample flowchart for receiving
multiprocessor serial data. The procedure for receiving multiprocessor serial data is listed below.
Initialization 1
Start reception
FER = 1? Yes
or ORER =1?
No
Read RDRF bit in SSR 3
No
RDRF = 1?
Yes
Read receive data from RDR
No
Is ID the station’s ID
Yes
Read ORER and FER bits in SSR
FER = 1? Yes
or ORER =1?
No
Read RDRF bit of SSR 5
No
RDRF = 1?
Yes
Read receive data from RDR
4
No
All data received? Error processing
Yes
Clear RE bit in SCR to 0
End reception
No
ORER = 1?
Yes
No
FER = 1?
Yes
Yes
Break?
No
Framing error handling Clear RE bit in SCR to 0
End
Figure 13.13 Sample Flowchart for Receiving Multiprocessor Serial Data (cont)
Figures 13.14 and 13.15 show examples of SCI receive operation using a multiprocessor format.
MPB
MPIE
RDRF
RDR
ID1
value
RxI interrupt request RxI interrupt handler Not station’s No RxI interrupt,
(multiprocessor reads data in RDR ID, so MPIE is RDR maintains
interrupt), MPIE = 0 and clears RDRF to 0 set to 1 again state
Example: Own ID matches data, 8-bit data with multiprocessor bit and one stop bit
MPB
MPIE
RDRF
RDR
value ID1 ID2 Data2
RxI interrupt request RxI interrupt handler Station’s ID, so receiving MPIE
(multiprocessor reads data in RDR continues, with data bit is again
interrupt), MPIE = 0 and clears RDRF to 0 received by the RxI set to 1
interrupt processing routine
In the clock synchronous mode, the SCI transmits and receives data in synchronization with clock
pulses. This mode is suitable for high-speed serial communication.
The SCI transmitter and receiver are independent, so full duplex communication is possible while
sharing the same clock. The transmitter and receiver are also double buffered, so continuous
transmitting or receiving is possible by reading or writing data while transmitting or receiving is in
progress.
Figure 13.16 shows the general format in clock synchronous serial communication.
Transfer direction
One unit (character or frame) of communication data
* *
Synchroni-
zation clock
LSB MSB
Serial data Bit 0 Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7
In clock synchronous serial communication, each data bit is output on the communication line
from one falling edge of the serial clock to the next. Data are guaranteed valid at the rising edge of
the serial clock. In each character, the serial data bits are transmitted in order from the LSB (first)
to the MSB (last). After output of the MSB, the communication line remains in the state of the
MSB. In the clock synchronous mode, the SCI transmits or receives data by synchronizing with
the falling edge of the synchronization clock.
Communication Format: The data length is fixed at eight bits. No parity bit or multiprocessor bit
can be added.
Clock: An internal clock generated by the on-chip baud rate generator or an external clock input
from the SCK pin can be selected as the SCI transmit/receive clock. The clock source is selected
by the C/A bit in the serial mode register (SMR) and bits CKE1 and CKE0 in the serial control
register (SCR). See table 13.9.
When the SCI operates on an internal clock, it outputs the clock signal at the SCK pin. Eight clock
pulses are output per transmitted or received character. When the SCI is not transmitting or
receiving, the clock signal remains in the high state.
Note: An overrun error occurs only during the receive operation, and the sync clock is output
until the RE bit is cleared to 0. When you want to perform a receive operation in one-
character units, select external clock for the clock source.
SCI Initialization (Clock Synchronous Mode): Before transmitting or receiving, software must
clear the TE and RE bits to 0 in the serial control register (SCR), then initialize the SCI as follows.
When changing the mode or communication format, always clear the TE and RE bits to 0 before
following the procedure given below. Clearing TE to 0 sets TDRE to 1 and initializes the transmit
shift register (TSR). Clearing RE to 0, however, does not initialize the RDRF, PER, FER, and
ORER flags and receive data register (RDR), which retain their previous contents.
1. Write the value corresponding to the bit rate in the bit rate register (BRR) unless an external
clock is used.
2. Select the clock source in the serial control register (SCR). Leave RIE, TIE, TEIE, MPIE, TE,
and RE cleared to 0.
3. Select the communication format in the serial mode register (SMR).
4. Wait for at least the interval required to transmit or receive one bit, then set TE or RE in the
serial control register (SCR) to 1. When selecting the simultaneous transmission and receiving,
set TE and RE bits to 1 simultaneously. Also set RIE, TIE, TEIE, and MPIE. The TxD, RxD
pins becomes usable in response to the PFC corresponding bits and the TE, RE bit settings.
Start of initialization
Select transmit/receive
format in SMR 2
No
1-bit interval elapsed?
Yes
Set TE and RE to 1 in SCR;
Set RIE, TIE, TEIE, and MPIE bits 4
End
Transmitting Serial Data (Synchronous Mode): Figure 13.18 shows a sample flowchart for
transmitting serial data and indicates the procedure to follow.
1. SCI initialization: Set the TxD pin function with the PFC.
2. SCI status check and transmit data write: Read SSR, check that the TDRE flag is 1, then write
transmit data in TDR and clear the TDRE flag to 0.
3. To continue transmitting serial data: After checking that the TDRE flag is 1, indicating that
data can be written, write data in TDR, then clear the TDRE flag to 0. When the DMAC is
activated by a transmit-data-empty interrupt request (TXI) to write data in TDR, the TDRE
flag is checked and cleared automatically.
Initialize 1
Start transmitting
No
TDRE = 1?
Yes
No
All data transmitted?
3
Yes
No
TEND = 1?
Yes
End
Transmit direction
Synchroni-
zation clock
LSB MSB
Serial data Bit 0 Bit 1 Bit 7 Bit 0 Bit 1 Bit 6 Bit 7
TDRE
TEND
1. The SCI monitors the TDRE bit in the SSR. When TDRE is cleared to 0 the SCI recognizes
that the transmit data register (TDR) contains new data and loads this data from the TDR into
the transmit shift register (TSR).
2. After loading the data from the TDR into the TSR, the SCI sets the TDRE bit to 1 and starts
transmitting. If the transmit-data-empty interrupt enable bit (TIE) in the SCR is set to 1, the
SCI requests a transmit-data-empty interrupt (TxI) at this time.
If clock output mode is selected, the SCI outputs eight synchronous clock pulses. If an external
clock source is selected, the SCI outputs data in synchronization with the input clock. Data are
output from the TxD pin in order from the LSB (bit 0) to the MSB (bit 7).
3. The SCI checks the TDRE bit when it outputs the MSB (bit 7). If TDRE is 0, the SCI loads
data from the TDR into the TSR, then begins serial transmission of the next frame. If TDRE is
1, the SCI sets the TEND bit in the SSR to 1, transmits the MSB, then holds the transmit data
pin (TxD) in the MSB state. If the transmit-end interrupt enable bit (TEIE) in the SCR is set to
1, a transmit-end interrupt (TEI) is requested at this time.
4. After the end of serial transmission, the SCK pin is held in the high state.
Receiving Serial Data (Clock Synchronous Mode): Figure 13.20 shows a sample flowchart for
receiving serial data. When switching from the asynchronous mode to the clock synchronous
mode, make sure that ORER, PER, and FER are cleared to 0. If PER or FER is set to 1, the RDRF
bit will not be set and both transmitting and receiving will be disabled.
Initialization 1
Start reception
Yes
ORER = 1? 2
No Error processing
No
RDRF = 1?
Yes
No
All data received?
Yes
End reception
Error handling
End
Transfer direction
Synchroni-
zation clock
Serial
Bit 7 Bit 0 Bit 7 Bit 0 Bit 1 Bit 6 Bit 7
data
RDRF
ORER
1. The SCI synchronizes with serial clock input or output and initializes internally.
2. Receive data is shifted into the RSR in order from the LSB to the MSB. After receiving the
data, the SCI checks that RDRF is 0 so that receive data can be loaded from the RSR into the
RDR. If this check passes, the SCI sets RDRF to 1 and stores the received data in the RDR. If
the check does not pass (receive error), the SCI operates as indicated in table 13.11 and no
further transmission or reception is possible. If the error flag is set to 1, the RDRF bit is not set
to 1 during reception, even if the RDRF bit is 0 cleared. When restarting reception, be sure to
clear the error flag.
3. After setting RDRF to 1, if the receive-data-full interrupt enable bit (RIE) is set to 1 in the
SCR, the SCI requests a receive-data-full interrupt (RxI). If the ORER bit is set to 1 and the
receive-data-full interrupt enable bit (RIE) in the SCR is also set to 1, the SCI requests a
receive-error interrupt (ERI).
Transmitting and Receiving Serial Data Simultaneously (Clock Synchronous Mode): Figure
13.22 shows a sample flowchart for transmitting and receiving serial data simultaneously. The
procedure is as follows (the steps correspond to the numbers in the flowchart):
1. SCI initialization: Set the TxD and RxD pins using the PFC.
2. SCI status check and transmit data write: Read the serial status register (SSR), check that the
TDRE bit is 1, then write transmit data in the transmit data register (TDR) and clear TDRE to
0. The TxI interrupt can also be used to determine if the TDRE bit has changed from 0 to 1.
3. Receive error handling: If a receive error occurs, read the ORER bit in SSR to identify the
error. After executing the necessary error processing, clear ORER to 0. Transmitting/receiving
cannot resume if ORER remains set to 1.
4. SCI status check and receive data read: Read the serial status register (SSR), check that RDRF
is set to 1, then read receive data from the receive data register (RDR) and clear RDRF to 0.
The RxI interrupt can also be used to determine if the RDRF bit has changed from 0 to 1.
5. Continue transmitting and receiving serial data: Read the RDRF bit and RDR, and clear RDRF
to 0 before the frame MSB (bit 7) of the current frame is received. Also read the TDRE bit to
check whether it is safe to write (if it reads 1); if so, write data in TDR, then clear TDRE to 0
before the MSB (bit 7) of the current frame is transmitted. When the DMAC or the DTC is
started by a transmit-data-empty interrupt request (TxI) to write data in TDR, the TDRE bit is
checked and cleared automatically. When the DMAC is started by a receive-data-full interrupt
(RxI) to read RDR, the RDRF bit is cleared automatically.
Note: When selecting the transmission or receiving mode to the simultaneous transmission and
receiving mode, clear TE and RE bits to zero once, then set both of them to 1
simultaneously.
Initialization 1
Start transmitting/receive
No
TDRE = 1?
Yes
Write transmission data in TDR
and clear TDRE bit of SSR to 0
Yes
ORER = 1? 3
No Error handling
No
RDRF = 1?
Yes
Read receive data of RDR,
and clear RDRF bit of SSR to 0 5
All
No
data transmitted/and
received
Yes
End transmission/reception
TxI is requested when the TDRE bit in the SSR is set to 1. TxI can start the direct memory access
controller (DMAC) to transfer data. TDRE is automatically cleared to 0 when the DMAC writes
data in the transmit data register (TDR).
RxI is requested when the RDRF bit in the SSR is set to 1. RxI can start the DMAC to transfer
data. RDRF is automatically cleared to 0 when the DMAC reads the receive data register (RDR).
ERI is requested when the ORER, PER, or FER bit in the SSR is set to 1. ERI cannot start the
DMAC.
TEI is requested when the TEND bit in the SSR is set to 1. TEI cannot start the DMAC. Where the
TxI interrupt indicates that transmit data writing is enabled, the TEI interrupt indicates that the
transmit operation is complete.
The TDRE bit in the serial status register (SSR) is a status flag indicating loading of transmit data
from TDR into TSR. The SCI sets TDRE to 1 when it transfers data from TDR to TSR. Data can
be written to TDR regardless of the TDRE bit status. If new data is written in TDR when TDRE is
0, however, the old data stored in TDR will be lost because the data has not yet been transferred to
the TSR. Before writing transmit data to the TDR, be sure to check that TDRE is set to 1.
Table 13.13 indicates the state of the SSR status flags when multiple receive errors occur
simultaneously. When an overrun error occurs, the RSR contents cannot be transferred to the
RDR, so receive data is lost.
Receive Data
SSR Status Flags
Transfer
Receive Error Status RDRF ORER FER PER RSR → RDR
Overrun error 1 1 0 0 X
Framing error 0 0 1 0 O
Parity error 0 0 0 1 O
Overrun error + framing error 1 1 1 0 X
Overrun error + parity error 1 1 0 1 X
Framing error + parity error 0 0 1 1 O
Overrun error + framing error + parity 1 1 1 1 X
error
Note: O = Receive data is transferred from RSR to RDR.
X = Receive data is not transferred from RSR to RDR.
Break signals can be detected by reading the RxD pin directly when a framing error (FER) is
detected. In the break state, the input from the RxD pin consists of all 0s, so FER is set and the
parity error flag (PER) may also be set. In the break state, the SCI receiver continues to operate, so
if the FER bit is cleared to 0, it will be set to 1 again.
The TxD pin becomes a general I/O pin with the I/O direction and level determined by the I/O port
data register (DR) and pin function controller (PFC) control register (CR). These conditions allow
break signals to be sent. The DR value is substituted for the marking status until the PFC is set.
Consequently, the output port is set to initially output a 1. To send a break in serial transmission,
first clear the DR to 0, then establish the TxD pin as an output port using the PFC. When TE is
cleared to 0, the transmission section is initialized regardless of the present transmission status.
13.5.5 Receive Error Flags and Transmitter Operation (Clock Synchronous Mode Only)
When a receive error flag (ORER, PER, or FER) is set to 1, the SCI will not start transmitting
even if TDRE is set to 1. Be sure to clear the receive error flags to 0 before starting to transmit.
Note that clearing RE to 0 does not clear the receive error flags.
13.5.6 Receive Data Sampling Timing and Receive Margin in the Asynchronous Mode
In the asynchronous mode, the SCI operates on a base clock of 16 times the bit rate frequency. In
receiving, the SCI synchronizes internally with the falling edge of the start bit, which it samples
on the base clock. Receive data is latched on the rising edge of the eighth base clock pulse (figure
13.23).
16 clocks
8 clocks
Internal 0 78 15 0 78 15 0 5
base clock
–7.5 clocks +7.5 clocks
Receive
data (RxD) Start bit D0 D1
Synchronization
sampling timing
Data
sampling timing
The receive margin in the asynchronous mode can therefore be expressed as:
D − 0.5
M= (
0.5 −
1
2N
) − (L − 0.5) F −
N
(1 + F) × 100%
From the equation above, if F = 0 and D = 0.5 the receive margin is 46.875%:
D = 0.5, F = 0
M = (0.5 – 1/(2 × 16)) × 100%
= 46.875%
• When using an external clock source for the synchronization clock, update the TDR with the
DMAC, and then after five system clocks or more elapse, input a transmit clock. If a transmit
clock is input in the first four system clocks after the TDR is written, an error may occur
(figure 13.24).
• Before reading the receive data register (RDR) with the DMAC, select the receive-data-full
interrupt of the SCI as a start-up source.
SCK
t
TDRE
D0 D1 D2 D3 D4 D5 D6 D7
When receiving, RDRF is 1 when RE is set to zero 1.5 clocks after the rising edge of the RxD D7
bit SCK output, but it cannot be copied to RDR.
14.1 Overview
The SH7050 series includes a 10-bit successive-approximation A/D converter., with software
selection of up to 16 analog input channels.
The A/D converter is composed of two independent modules, A/D0 and A/D1. A/D0 comprises
three groups, while A/D1 comprises a single group.
14.1.1 Features
• 10-bit resolution
16 input channels (A/D0: 12 channels, A/D1: 4 channels)
• High-speed conversion
Conversion time: minimum 6.7 µs per channel (when φ = 20 MHz)
• Two conversion modes
Single mode: A/D conversion on one channel
Scan mode:
Continuous conversion on 1 to 12 channels (A/D0)
Continuous conversion on 1 to 4 channels (A/D1)
• Sixteen 10-bit A/D data registers
A/D conversion results are transferred for storage into data registers corresponding to the
channels.
• Two sample-and-hold circuits
A sample-and-hold circuit is built into each A/D converter module (AD/0 and AD/1),
simplifying the configuration of external analog input circuitry.
A/D0
Module data bus
Bus interface
Internal
data bus
approximation
Successive-
ADTRGR
AVCC
ADCSR0
register
ADCR0
AVref 10-bit D/A ADDR0–11
AVSS
AN0
AN1
Analog multiplexer
AN2
AN3 Sample-and-
AN4 hold circuit +
AN5 A/D conversion
AN6 – control circuit
AN7 Comparator
AN8
AN9
AN10
AN11
ADI0
ATU trigger
interrupt
ADTRG signal
A/D1
Module data bus
Bus interface
Internal
approximation
data bus
Successive-
ADCSR1
register
ADCR1
10-bit D/A ADDR
12–15
ADEND
AN12
Analog multiplexer
Sample-and-
AN13 hold circuit +
– A/D conversion
AN14 control circuit
Comparator
AN15
ADI1
Legend: interrupt
ADCR0, ADCR1: A/D control registers 0 and 1 signal
ADCSR0, ADCSR1: A/D control/status registers 0 and 1
ADDR0 to ADDR15: A/D data registers 0 to 15
ADTRGR: A/D trigger register
Table 14.1 summarizes the A/D converter’s input pins. There are 16 analog input pins, AN0 to
AN15. The 12 pins AN0 to AN11 are A/D0 analog inputs, divided into three groups: AN0 to AN3
(group 0), AN4 to AN7 (group 1), and AN8 to AN11 (group 2). The four pins AN12 to AN15 are
A/D1 analog inputs, comprising analog input group 3.
The ADTRG pin is used to provide A/D conversion start timing from off-chip. When a low-level
pulse is applied to this pin, the A/D converter starts conversion. This pin is shared by A/D0 and
A/D1.
The ADEND pin is an output used to monitor conversion timing when channel 15 is used in scan
mode.
The AVCC and AVSS pins are power supply voltage pins for the analog section in the A/D
converter. The AVref pin is the A/D converter reference voltage pin. These pins are also shared by
A/D0 and A/D1.
To maintain chip reliability, ensure that AVCC = VCC ±10% and AVSS = VSS during normal
operation, and never leave the AVCC and AVSS pins open, even when the A/D converter is not
being used.
The voltage applied to the analog input pins should be in the range AVSS ≤ ANn ≤ AVref.
Initial Access
Size*
1
Name Abbreviation R/W Value Address
A/D data register 0 (H/L) ADDR0 (H/L) R H'0000 H'FFFF85D0 8, 16
A/D data register 1 (H/L) ADDR1 (H/L) R H'0000 H'FFFF85D2 8, 16
A/D data register 2 (H/L) ADDR2 (H/L) R H'0000 H'FFFF85D4 8, 16
A/D data register 3 (H/L) ADDR3 (H/L) R H'0000 H'FFFF85D6 8, 16
A/D data register 4 (H/L) ADDR4 (H/L) R H'0000 H'FFFF85D8 8, 16
A/D data register 5 (H/L) ADDR5 (H/L) R H'0000 H'FFFF85DA 8, 16
A/D data register 6 (H/L) ADDR6 (H/L) R H'0000 H'FFFF85DC 8, 16
A/D data register 7 (H/L) ADDR7 (H/L) R H'0000 H'FFFF85DE 8, 16
A/D data register 8 (H/L) ADDR8 (H/L) R H'0000 H'FFFF85E0 8, 16
A/D data register 9 (H/L) ADDR9 (H/L) R H'0000 H'FFFF85E2 8, 16
A/D data register 10 (H/L) ADDR10 (H/L) R H'0000 H'FFFF85E4 8, 16
A/D data register 11 (H/L) ADDR11 (H/L) R H'0000 H'FFFF85E6 8, 16
A/D data register 12 (H/L) ADDR12 (H/L) R H'0000 H'FFFF85F0 8, 16
A/D data register 13 (H/L) ADDR13 (H/L) R H'0000 H'FFFF85F2 8, 16
A/D data register 14 (H/L) ADDR14 (H/L) R H'0000 H'FFFF85F4 8, 16
A/D data register 15 (H/L) ADDR15 (H/L) R H'0000 H'FFFF85F6 8, 16
R/(W)*
2
A/D control/status register 0 ADCSR0 H'00 H'FFFF85E8 8, 16
A/D control register 0 ADCR0 R/W H'1F H'FFFF85E9 8, 16
R/(W)*
2
A/D control/status register 1 ADCSR1 H'00 H'FFFF85F8 8, 16
A/D control register 1 ADCR1 R/W H'7F H'FFFF85F9 8, 16
A/D trigger register ADTRGR R/W H'FF H'FFFF83B8 8
Notes: Register accesses consist of 3 cycles for byte access and 6 cycles for word access.
1. A 16-bit access must be made on a word boundary.
2. Only 0 can be written in bit 7, to clear the flag.
A/D data registers 0 to 15 (ADDR0 to ADDR15) are 16-bit read-only registers that store the
results of A/D conversion. There are 16 registers, corresponding to analog inputs 0 to 15 (AN0 to
AN15).
The ADDR registers are initialized to H'0000 by a power-on reset, and in hardware standby mode
and software standby mode.
Bit: 7 6 5 4 3 2 1 0
ADDRnH
AD9 AD8 AD7 AD6 AD5 ADR AD3 AD2
(upper byte)
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
ADDRnL
AD1 AD0 — — — — — —
(lower byte)
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
(n = 0 to 15)
The A/D converter converts analog input to a 10-bit digital value. The upper 8 bits of this data are
stored in the upper byte of the ADDR corresponding to the selected channel, and the lower 2 bits
in the lower byte of that ADDR. Only the most significant 2 bits of the ADDR lower byte data are
valid.
Table 14.3 shows correspondence between the analog input channels and A/D data registers.
ADCSR0 is initialized to H'00 by a power-on reset, and in hardware standby mode and software
standby mode.
Bit: 7 6 5 4 3 2 1 0
ADF ADIE ADM1 ADM0 CH3 CH2 CH1 CH0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/(W)* R/W R/W R/W R/W R/W R/W R/W
Note: * Only 0 can be written, to clear the flag.
Bit 7—A/D End Flag (ADF): Indicates the end of A/D conversion.
Bit 7:
ADF Description
0 Indicates that A/D0 is performing A/D conversion, or is in the idle state. (Initial value)
[Clearing conditions]
• When ADF is read while set to 1, then 0 is written in ADF
• When the DMAC is activated by ADI0
1 Indicates that A/D0 has finished A/D conversion, and the digital value has been
transferred to ADDR.
[Setting conditions]
• Single mode: When A/D conversion ends
• Scan mode: When all A/D conversions end within one selected analog group
The operation of the A/D converter after ADF is set to 1 differs between single mode and scan
mode.
In single mode, after the A/D converter transfers the digit value to ADDR, ADF is set to 1 and the
A/D converter enters the idle state. In scan mode, after all conversions end within one selected
analog group, ADF is set to 1 and conversion is continued. For example, in the case of 12-channel
scanning, ADF is set to 1 immediately after the end of conversion for AN0 to AN3 (group 0)
Bit 6—A/D Interrupt Enable (ADIE): Enables or disables the A/D interrupt (ADI).
To prevent incorrect operation, ensure that the ADST bit in A/D control register 0 (ADCR0) is
cleared to 0 before switching the operating mode.
Bit 6:
ADIE Description
0 A/D interrupt (ADI0) is disabled (Initial value)
1 A/D interrupt (ADI0) is enabled
When A/D conversion ends and the ADF bit in ADCSR0 is set to 1, an A/D0 A/D interrupt
(ADI0) will be generated If the ADIE bit is 1. ADI0 is cleared by clearing ADF or ADIE to 0.
Bits 5 and 4: A/D Mode 1 and 0 (ADM1, ADM0): These bits select the A/D conversion mode
from single mode, 4-channel scan mode, 8-channel scan mode, and 12-channel scan mode.
To prevent incorrect operation, ensure that the ADST bit in A/D control register 0 (ADCR0) is
cleared to 0 before switching the operating mode.
Bit 5: Bit 4:
ADM1 ADM0 Description
0 0 Single mode (Initial value)
1 4-channel scan mode (analog group 0/1/2)
1 0 8-channel scan mode (analog groups 0 and 1)
1 12-channel scan mode (analog groups 0, 1, and 2)
When ADM1 and ADM0 are set to 00, single mode is set. In single mode, operation ends after
A/D conversion has been performed once on the analog channels selected with bits CH3 to CH0 in
ADCSR.
When ADM1 and ADM0 are set to 01, 4-channel scan mode is set. In scan mode, A/D conversion
is performed continuously on a number of channels. The channels on which A/D conversion is to
be performed in scan mode are set with bits CH3 to CH0 in ADCSR0. In 4-channel scan mode,
conversion is performed continuously on the channels in one of analog groups 0 (AN0 to AN3), 1
(AN4 to AN7), or 2 (AN8 to AN11).
When ADM1 and ADM0 are set to 10, 8-channel scan mode is set. In 8-channel scan mode,
conversion is performed continuously on the 8 channels in analog groups 0 (AN0 to AN3) and 1
(AN4 to AN7)
When ADM1 and ADM0 are set to 11, 12-channel scan mode is set. In 12-channel scan mode,
conversion is performed continuously on the 12 channels in analog groups 0 (AN0 to AN3), 1
(AN4 to AN7), and 2 (AN8 to AN11).
For details of the operation in single mode and scan mode, see section 14.4, Operation.
Bits 3 to 0—Channel Select 3 to 0 (CH3 to CH0): These bits, together with the ADM1 and
ADM0 bits, select the analog input channels.
To prevent incorrect operation, ensure that the ADST bit in A/D control register 0 (ADCR0) is
cleared to 0 before changing the analog input channel selection.
A/D control register 0 (ADCR0) is an 8-bit readable/writable register that controls the start of A/D
conversion and selects the operating clock.
ADCR0 is initialized to H'1F by a power-on reset, and in hardware standby mode and software
standby mode.
Bits 4 to 0 of ADCR0 are reserved. These bits cannot be written to, and always return 1 if read.
Bit: 7 6 5 4 3 2 1 0
TRGE CKS ADST — — — — —
Initial value: 0 0 0 1 1 1 1 1
R/W: R/W R/W R/W R R R R R
Bit 7—Trigger Enable (TRGE): Enables or disables triggering of A/D conversion by external
input or the ATU.
Bit 7:
TRGE Description
0 A/D conversion triggering by external input or ATU is disabled (Initial value)
1 A/D conversion triggering by external input or ATU is enabled
For details of external or ATU trigger selection, see section 14.2.6, A/D Trigger Register.
When external triggering is selected, upon input of a low-level pulse to the ADTRG pin after
TRGE has been set to 1, the A/D converter detects the falling edge of the pulse, and sets the
ADST bit to 1 in ADCR. The same operation is subsequently performed when 1 is written in the
ADST bit by software. External triggering of A/D conversion is only enabled when the ADST bit
is cleared to 0.
When external triggering is used, the low-level pulse input to the ADTRG pin must be at least 1.5
φ clock cycles in width. For details, see section 14.4.4, External Triggering of A/D Conversion.
Bit 6—Clock Select (CKS): Selects the A/D conversion time. A/D conversion is executed in a
maximum of 266 states when CKS is 0, and a maximum of 134 states when 1. To prevent
incorrect operation, ensure that the ADST bit in A/D control register 0 (ADCR0) is cleared to 0
before changing the A/D conversion time. For details, see section 14.4.3, Analog Input Setting and
A/D Conversion Time.
Bit 6:
CKS Description
0 Conversion time = 266 states (maximum) (Initial value)
1 Conversion time = 134 states (maximum)
Bit 5—A/D Start (ADST): Starts or stops A/D conversion. A/D conversion is started when ADST
is set to 1, and stopped when ADST is cleared to 0.
Bit 5:
ADST Description
0 A/D conversion is stopped (Initial value)
1 A/D conversion is being executed
[Clearing conditions]
• Single mode: Automatically cleared to 0 when A/D conversion ends
• Scan mode: Cleared by writing 0 in ADST after confirming that ADF in ADCSR0
is 1
Note that the operation of the ADST bit differs between single mode and scan mode.
In single mode and scan mode, ADST is automatically cleared to 0 when A/D conversion ends on
one channel. However, in scan mode, when all conversions have ended for the selected analog
inputs, ADST remains set to 1 in order to start A/D conversion again for all the channels.
Therefore, the ADST bit must be cleared to 0, stopping A/D conversion, before changing the
conversion time or the analog input channel selection.
Ensure that the ADST bit in ADCR0 is cleared to 0 before switching the operating mode.
Also, make sure that A/D conversion is stopped (ADST is cleared to 0) before changing A/D
interrupt enabling (bit ADIE in ADCSR0), the A/D conversion time (bit CKS in ADCR0), the
operating mode (bits ADM1 and ADM0 in ADSCR), or the analog input channel selection (bits
CH3 to CH0 in ADCSR0). The A/D data register contents will not be guaranteed if these changes
are made while the A/D converter is operating (ADST is set to 1).
Bits 4 to 0—Reserved: These bits are always read as 1, and should only be written with 1.
ADCSR1 is initialized to H'00 by a power-on reset, and in hardware standby mode and software
standby mode.
Bit: 7 6 5 4 3 2 1 0
ADF ADIE ADST SCAN CKS — CH1 CH0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/(W)* R/W R/W R/W R/W R R/W R/W
Note: * Only 0 can be written, to clear the flag.
Bit 4—Scan Mode (SCAN): Selects single mode or scan mode for A/D1. To prevent incorrect
operation, ensure that the ADST bit is cleared to 0 before switching the operating mode.
Bit 4:
SCAN Description
0 Single mode (Initial value)
1 Scan mode
For details of the operation in single mode and scan mode, see section 14.4, Operation.
Bit 2—Reserved: This bit is always read as 0, and should only be written with 0.
Bits 1 and 0—Channel Select 1 and 0 (CH1 and CH0): These bits, together with the SCAN bit,
select the analog input channels.
To prevent incorrect operation, ensure that the ADST bit in A/D control/status register 1
(ADCSR1) is cleared to 0 before changing the analog input channel selection.
A/D control register 1 (ADCR1) is an 8-bit readable/writable register that controls the start of A/D
conversion and selects the operating clock.
ADCR1 is initialized to H'7F by a power-on reset, and in hardware standby mode and software
standby mode.
Bit: 7 6 5 4 3 2 1 0
TRGE — — — — — — —
Initial value: 0 1 1 1 1 1 1 1
R/W: R/W R R R R R R R
Bits 6 to 0—Reserved: These bits are always read as 1, and should only be written with 1.
The A/D trigger register (ADTRGR) is an 8-bit readable/writable register that selects the A/D0
trigger. Either external pin (ADTRG) or ATU (ATU interval timer interrupt) triggering can be
selected.
ADTRGR is initialized to H'FF by a power-on reset, and in hardware standby mode and software
standby mode.
Bit: 7 6 5 4 3 2 1 0
EXTRG — — — — — — —
Initial value: 1 1 1 1 1 1 1 1
R/W: R/W R R R R R R R
Bit 7—Trigger Enable (EXTRG): Selects external pin input (ADTRG) or the ATU interval
timer interrupt.
Bit 7:
EXTRGA Description
0 A/D conversion is triggered by the ATU channel 0 interval timer interrupt
1 A/D conversion is triggered by external pin input (ADTRG) (Initial value)
Bits 6 to 0—Reserved: These bits are always read as 1, and should only be written with 1.
In order to select external triggering or ATU triggering, the TGRE bit in ADCR0 must be set to 1.
For details, see section 14.2.3, A/D Control Register 0.
To prevent the data being changed between the reads of the upper and lower bytes of an A/D data
register, the lower byte is read via a temporary register (TEMP). The upper byte can be read
directly.
Data is read from an A/D data register as follows. When the upper byte is read, the upper-byte
value is transferred directly to the CPU and the lower-byte value is transferred into TEMP. Next,
when the lower byte is read, the TEMP contents are transferred to the CPU.
When performing byte-size reads on an A/D data register, always read the upper byte before the
lower byte. It is possible to read only the upper byte, but if only the lower byte is read, incorrect
data may be obtained. If a word-size read is performed on an A/D data register, reading is
performed in upper byte, lower byte order automatically.
Figure 14.2 shows the data flow for access to an A/D data register.
Upper-byte read
TEMP
(H'40)
ADDRnH ADDRnL
(H'AA) (H'40)
Lower-byte read
TEMP
(H'40)
ADDRnH ADDRnL
(H'AA) (H'40)
14.4 Operation
The A/D converter operates by successive approximations with 10-bit resolution. It has two
operating modes: single mode and scan mode. In single mode, conversion is performed once on
one specified channel, then ends. In scan mode, A/D conversion continues on one or more
specified channels until the ADST bit is cleared to 0.
Single mode, should be selected when only one A/D conversion on one channel is required. Single
mode is selected for A/D0 by setting the ADM1 and ADM0 bits in A/D control/status register 0
(ADSCR0) to 00, and for A/D1 by clearing the SCAN mode bit in ADCSR1 to 0. When the
ADST bit (in ADCR0 for A/D0, or in ADCSR1 for A/D1) is set to 1, A/D conversion is started in
single mode.
The ADST bit remains set to 1 during A/D conversion, and is automatically cleared to 0 when
conversion ends.
When conversion ends, the ADF flag in ADCSR is set to 1. If the ADIE bit in ADCSR is also 1,
an ADI interrupt is requested. To clear the ADF flag, first read ADF when set to 1, then write 0 in
ADF. If the DMAC is activated by the ADI interrupt, ADF is cleared automatically.
An example of the operation when analog input channel 1 (AN1) is selected and A/D conversion
is performed in single mode is described next. Figure 14.3 shows a timing diagram for this
example.
1. Single mode is selected (ADM1 = ADM0 = 0), input channel AN1 is selected (CH3 = CH2 =
CH1 = 0, CH0 = 1), the A/D interrupt is enabled (ADIE = 1), and A/D conversion is started
(ADST = 1).
2. When A/D conversion is completed, the result is transferred to ADDR1. At the same time the
ADF flag is set to 1, the ADST bit is cleared to 0, and the A/D converter becomes idle.
3. Since ADF = 1 and ADIE = 1, an ADI interrupt is requested.
4. The A/D interrupt handling routine is started.
5. The routine reads ADF set to 1, then writes 0 in ADF.
6. The routine reads and processes the conversion result (ADDR1).
7. Execution of the A/D interrupt handling routine ends. After this, if the ADST bit is set to 1,
A/D conversion starts again and steps 2 to 7 are repeated.
Set*
ADIE
Clear* Clear*
ADF
ADDR0
Read conversion Read conversion
result result
ADDR1 A/D conversion result (1) A/D conversion result (2)
ADDR2
ADDR3
Figure 14.3 Example of A/D Converter Operation (Single Mode, Channel 1 Selected)
Scan mode is useful for monitoring analog inputs in a group of one or more channels. Scan mode
is selected for A/D0 by setting the ADM1 and ADM0 bits in A/D control/status register 0
(ADSCR0) to 01 (4-channel scan mode), 10 8-channel scan mode), or 11 (12-channel scan mode),
and for A/D1 by setting the SCAN bit in A/D control/status register 1 (ADCSR1) to 1. When the
ADST bit is set to 1, A/D conversion is started in scan mode.
In scan mode, A/D conversion is performed in low-to-high analog input channel number order
(AN0, AN1 ... AN15). The ADST bit remains set to 1 until written with 0 by software.
When all conversions are completed within one selected analog group, the ADF flag in ADCSR is
set to 1 and A/D conversion us repeated. When ADF is set to 1, if the ADIE bit in ADCSR is also
1, an ADI interrupt (ADI0 or ADI1) is requested. To clear the ADF flag, first read ADF when set
to 1, then write 0 in ADF. If the DMAC is activated by the ADI interrupt, ADF is cleared
automatically.
An example of the operation when analog input channels 0 to 2 and 4 to 6 (AN0 to AN2 and AN4
to AN6) are selected and A/D conversion is performed in 8-channel scan mode is described in
Figure 14.4. Figure 14.6 shows a timing diagram for this example.
1. 8-channel scan mode is selected (ADM1 = 1, ADM0 = 0), input channels AN0 to AN2 and
AN4 to AN6 are selected (CH3 = 0, CH2 = 0, CH1 = 1, CH0 = 0), and A/D conversion is
started.
2. When conversion of the first channel (AN0) is completed, the result is transferred to ADDR0.
Next, conversion of the second channel (AN1) starts automatically.
3. Conversion proceeds in the same way through the third channel (AN2).
4. When conversion is completed for all the channels (AN0 to AN2) in one selected analog group
(analog group 0), the ADF flag is set to 1. If the ADIE bit is also 1, an ADI interrupt is
requested.
5. Conversion of the fourth channel (AN4) starts automatically.
6. Conversion proceeds in the same way through the sixth channel (AN6)
7. Steps 2 to 6 are repeated as long as the ADST bit remains set to 1. When the ADST bit is
cleared to 0, A/D conversion stops. After this, if the ADST bit is set to 1, A/D conversion starts
again from the first channel (AN0).
Clear*1
ADF
State of channel 0
Idle A/D Idle A/D Idle
(AN0) conver- conver-
sion (1) sion (7)
State of channel 1
Idle A/D Idle A/D Idle
(AN1) conver- conver-
sion (2) sion (8)
State of channel 2
Idle A/D Idle A/D Idle
(AN2) conver- conver-
sion (3) sion (9)
State of channel 3
Idle
(AN3)
State of channel 4
Idle A/D Idle A/D Idle
(AN4) conver- conver-
sion (4) sion (10) *2
State of channel 5
Idle A/D Idle A/D Idle
(AN5) conver- conver-
sion (5) sion (11)
tate of channel 6
Idle A/D Idle
(AN6) conver-
sion (6)
State of channel 7
Idle
(AN7)
ADDR3
ADDR7
Figure 14.4 Example of A/D Converter Operation (Scan Mode, Channels AN0 to AN2 and
AN4 to AN6 Selected)
The A/D converter has a built-in sample-and-hold circuit in A/D0 and A/D1. The A/D converter
samples the analog input at time tD (A/D conversion start delay time) after the ADST bit is set to 1,
then starts conversion. Figure 14.5 shows the A/D conversion timing.
The A/D conversion time (tCONV) includes tD and the analog input sampling time (tSPL). The length of
tD is not fixed, since it includes the time required for synchronization of the A/D conversion
operation. The total conversion time therefore varies within the ranges shown in table 14.4.
In scan mode, the tCONV values given in table 14.4 apply to the first conversion. In the second and
subsequent conversions, tCONV is fixed at 256 states when CKS = 0 or 128 states when CKS = 1.
CKS = 0 CKS = 1
Item Symbol Min Typ Max Min Typ Max Unit
A/D conversion start tD 10 — 17 6 — 9 States
delay time
Input sampling time tSPL — 64 — — 32 —
(A/D0)
Input sampling time tSPL — 64 — — 32 —
(A/D1)
A/D conversion time tCONV 259 — 266 131 — 134
Analog input
A/D conversion start sampling time
delay time (tD) (tSPL)
Write cycle
A/D synchronization time
(3 states) (to 14 states)
Address
Internal write
signal ADST write timing
Analog input
sampling signal
ADF
End of A/D
conversion
A/D conversion can be externally triggered. To activate the A/D converter with an external trigger,
first set the pin functions with the PFC (pin function controller), then set the TRGE bit to 1 in the
A/D control register (ADCR). For the A/D0 converter module, also set the EXTRG bit in the A/D
trigger register (ADTRGR). When a low-level pulse is input to the ADTRG pin after these settings
have been made, the A/D converter detects the falling edge of the pulse and sets the ADST bit to
1. Figure 14.6 shows the timing for external trigger input.
The ADST bit is set to 1 one state after the A/D converter samples the falling edge on the ADTRG
pin. The timing from setting of the ADST bit until the start of A/D conversion is the same as when
1 is written into the ADST bit by software.
ADTRG input
ADST bit
ADST = 1
The A/D0 converter module can be activated by an A/D conversion request from the ATU’s
channel 0 interval timer.
To activate the A/D converter by means of the ATU, set the TRGE bit to 1 in A/D control register
0 (ADCR0) and clear the EXTRG bit to 0 in the A/D trigger register (ADTRGR). When an ATU
channel 0 interval timer A/D conversion request is generated after these settings have been made,
the ADST bit set to 1. The timing from setting of the ADST bit until the start of A/D conversion is
the same as when 1 is written into the ADST bit by software.
When channel 15 is used in scan mode, the conversion timing can be monitored with the ADEND
output pin.
After the channel 15 analog voltage has been latched in scan mode, and conversion has started, the
ADEND pin goes high. The ADEND pin subsequently goes low when channel 15 conversion
ends.
ADEND
The DMAC can be activated by an ADI interrupt. In this case an interrupt request is not sent to the
CPU.
When the DMAC is activated by an ADI interrupt, the ADF bit in ADCSR is automatically
cleared when data is transferred by the DMAC.
See section 9.4.3, Example of DMA Transfer between A/D Converter and Internal Memory, for an
example of this operation.
AVCC
AVref
SH7050
Rin*2 100 Ω
*1 *1 AN0–AN15
AVSS
0.1 µF
Notes: 1.
10 µF 0.01 µF
15.1 Overview
The SH7050 series has an on-chip compare match timer (CMT) configured of 16-bit timers for
two channels. The CMT has 16-bit counters and can generate interrupts at set intervals.
15.1.1 Features
CM10 φ/8 φ/32 φ/128 φ/512 CMI1 φ/8 φ/32 φ/128 φ/512
Comparator
Comparator
CMCOR0
CMCOR1
CMCSR0
CMCSR1
CMCNT0
CMCNT1
CMSTR
Bus
Module bus interface
CMT
Internal bus
CMSTR: Compare match timer start register
CMCSR: Compare match timer control/status register
CMCOR: Compare match timer constant register
CMCNT: Compare match timer counter
CMI: Compare match interrupt
Initial Access
Channel Name Abbreviation R/W Value Address Size (Bits)
Shared Compare match CMSTR R/W H'0000 H'FFFF83D0 8, 16, 32
timer start register
0 Compare match CMCSR0 R/(W)* H'0000 H'FFFF83D2 8, 16, 32
timer control/status
register 0
Compare match CMCNT0 R/W H'0000 H'FFFF83D4 8, 16, 32
timer counter 0
Compare match CMCOR0 R/W H'FFFF H'FFFF83D6 8, 16, 32
timer constant
register 0
1 Compare match CMCSR1 R/(W)* H'0000 H'FFFF83D8 8, 16, 32
timer control/status
register 1
Compare match CMCNT1 R/W H'0000 H'FFFF83DA 8, 16, 32
timer counter 1
Compare match CMCOR1 R/W H'FFFF H'FFFF83DC 8, 16, 32
timer constant
register 1
Notes: With regard to access size, two cycles are required for byte access and word access, and
four cycles for longword access.
* The only value that can be written to the CMCSR0 and CMCSR1 CMF bits is a 0 to
clear the flags.
The compare match timer start register (CMSTR) is a 16-bit register that selects whether to
operate or halt the channel 0 and channel 1 counters (CMCNT). It is initialized to H'0000 by a
power-on reset and in standby modes.
Bit: 15 14 13 12 11 10 9 8
— — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
— — — — — — STR1 STR0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R/W R/W
Bits 15–2—Reserved: These bits always read as 0. The write value should always be 0.
Bit 1—Count Start 1 (STR1): Selects whether to operate or halt compare match timer counter 1.
Bit 0—Count Start 0 (STR0): Selects whether to operate or halt compare match timer counter 0.
The compare match timer control/status register (CMCSR) is a 16-bit register that indicates the
occurrence of compare matches, sets the enable/disable of interrupts, and establishes the clock
used for incrementation. It is initialized to H'0000 by a power-on reset and in hardware standby
mode and software standby mode.
Bit: 15 14 13 12 11 10 9 8
— — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
CMF CMIE — — — — CKS1 CKS0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/(W)* R/W R R R R R/W R/W
Note: * The only value that can be written is a 0 to clear the flag.
Bits 15–8 and 5–2—Reserved: These bits always read as 0. The write value should always be 0.
Bit 7—Compare Match Flag (CMF): This flag indicates whether or not the CMCNT and
CMCOR values have matched.
Bit 6—Compare Match Interrupt Enable (CMIE): Selects whether to enable or disable a
compare match interrupt (CMI) when the CMCNT and CMCOR values have matched (CMF = 1).
Bits 1, 0—Clock Select 1, 0 (CKS1, CKS0): These bits select the clock input to the CMCNT
from among the four internal clocks obtained by dividing the system clock (φ). When the STR bit
of the CMSTR is set to 1, the CMCNT begins incrementing with the clock selected by CKS1 and
CKS0.
The compare match timer counter (CMCNT) is a 16-bit register used as an upcounter for
generating interrupt requests.
When an internal clock is selected with the CKS1, CKS0 bits of the CMCSR register and the STR
bit of the CMSTR is set to 1, the CMCNT begins incrementing with that clock. When the CMCNT
value matches that of the compare match timer constant register (CMCOR), the CMCNT is
cleared to H'0000 and the CMF flag of the CMCSR is set to 1. If the CMIE bit of the CMCSR is
set to 1 at this time, a compare match interrupt (CMI) is requested.
The CMCNT is initialized to H'0000 by a power-on reset and in hardware standby mode and
software standby mode.
Bit: 15 14 13 12 11 10 9 8
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
The compare match timer constant register (CMCOR) is a 16-bit register that sets the compare
match period with the CMCNT.
The CMCOR is initialized to H'FFFF by a power-on reset and in hardware standby mode and
software standby mode. There is no initializing with manual reset.
Bit: 15 14 13 12 11 10 9 8
Initial value: 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Initial value: 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
15.3 Operation
When an internal clock is selected with the CKS1, CKS0 bits of the CMCSR register and the STR
bit of the CMSTR is set to 1, the CMCNT begins incrementing with the selected clock. When the
CMCNT counter value matches that of the compare match constant register (CMCOR), the
CMCNT counter is cleared to H'0000 and the CMF flag of the CMCSR register is set to 1. If the
CMIE bit of the CMCSR register is set to 1 at this time, a compare match interrupt (CMI) is
requested. The CMCNT counter begins counting up again from H'0000.
H'0000 Time
One of four clocks (φ/8, φ/32, φ/128, φ/512) obtained by dividing the system clock (CK) can be
selected by the CKS1, CKS0 bits of the CMCSR. Figure 15.3 shows the timing.
CK
Internal clock
CMCNT input
clock
15.4 Interrupts
The CMT has a compare match interrupt for each channel, with independent vector addresses
allocated to each of them. The corresponding interrupt request is output when the interrupt request
flag CMF is set to 1 and the interrupt enable bit CMIE has also been set to 1.
When activating CPU interrupts by interrupt request, the priority between the channels can be
changed by using the interrupt controller settings. See section 6, Interrupt Controller, for details.
The CMF bit of the CMCSR register is set to 1 by the compare match signal generated when the
CMCOR register and the CMCNT counter match. The compare match signal is generated upon
the final state of the match (timing at which the CMCNT counter matching count value is
updated). Consequently, after the CMCOR register and the CMCNT counter match, a compare
match signal will not be generated until a CMCNT counter input clock occurs. Figure 15.4 shows
the CMF bit set timing.
CK
CMCNT
input clock
CMCNT N 0
CMCOR N
Compare
match signal
CMF
CMI
The CMF bit of the CMCSR register is cleared either by writing a 0 to it after reading a 1, or by a
clear signal after a DTC transfer. Figure 15.5 shows the timing when the CMF bit is cleared by the
CPU.
CK
CMF
If a compare match signal is generated during the T2 state of the CMCNT counter write cycle, the
CMCNT counter clear has priority, so the write to the CMCNT counter is not performed. Figure
15.6 shows the timing.
T1 T2
CK
Address CMCNT
Internal
write signal
Compare
match signal
CMCNT N H'0000
If an increment occurs during the T2 state of the CMCNT counter word write cycle, the counter
write has priority, so no increment occurs. Figure 15.7 shows the timing.
CK
Address CMCNT
Internal
write signal
Compare
match signal
CMCNT N M
If an increment occurs during the T2 state of the CMCNT byte write cycle, the counter write has
priority, so no increment of the write data results on the writing side. The byte data on the side not
performing the writing is also not incremented, so the contents are those before the write.
Figure 15.8 shows the timing when an increment occurs during the T2 state of the CMCNTH write
cycle.
CK
Address CMCNTH
Internal
write signal
CMCNT
input clock
CMCNTH N M
CMCNTL X X
16.1 Overview
The pin function controller (PFC) consists of registers for selecting multiplex pin functions and
their input/output direction. Table 16.1 shows the SH7050’s multiplex pins.
Initial Access
Name Abbreviation R/W Value Address Size
Port A IO register PAIOR R/W H'0000 H'FFFF8382 8, 16
Port A control register PACR R/W H'0000 H'FFFF8384 8, 16
Port B IO register PBIOR R/W H'C0C0 H'FFFF8388 8, 16
Port B control register PBCR R/W H'80C0 H'FFFF838A 8, 16
Port C IO register PCIOR R/W H'8000 H'FFFF8392 8, 16
Port C control register 1 PCCR1 R/W H'C000 H'FFFF8394 8, 16
Port C control register 2 PCCR2 R/W H'0BFF H'FFFF8396 8, 16
Port D IO register PDIOR R/W H'0000 H'FFFF839A 8, 16
Port D control register PDCR R/W H'0000 H'FFFF839C 8, 16
CK control register* CKCR R/W H'FFFE H'FFFF839E 8, 16
Port E IO register PEIOR R/W H'8000 H'FFFF83A2 8, 16
Port E control register PECR R/W H'8000 H'FFFF83A4 8, 16
Port F IO register PFIOR R/W H'F000 H'FFFF83A8 8, 16
Port F control register 1 PFCR1 R/W H'FF00 H'FFFF83AA 8, 16
Port F control register 2 PFCR2 R/W H'00AA H'FFFF83AC 8, 16
Port G IO register PGIOR R/W H'0000 H'FFFF83B0 8, 16
Port G control register 1 PGCR1 R/W H'0AAA H'FFFF83B2 8, 16
Port G control register 2 PGCR2 R/W H'AA80 H'FFFF83B4 8, 16
Notes: A register access is performed in 2 cycles regardless of the access size.
* CK control register is only bult in the version of flash memory. it is not in the version of
mask ROM.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PA15 PA14 PA13 PA12 PA11 PA10 PA9 PA8 PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0
IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The port A IO register (PAIOR) is a 16-bit readable/writable register that selects the input/output
direction of the 16 pins in port A. Bits PA15IOR to PA0IOR correspond to pins PA15/A15 to
PA0/A0. PAIOR is enabled when port A pins function as general input/output pins (PA15 to
PA0), and disabled otherwise.
When port A pins function as PA15 to PA0, a pin becomes an output when the corresponding bit
in PAIOR is set to 1, and an input when the bit is cleared to 0.
PAIOR is initialized to H'0000 by a power-on reset (excluding a WDT power-on reset), and in
hardware standby mode. It is not initialized in software standby mode or sleep mode.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PA15 PA14 PA13 PA12 PA11 PA10 PA9 PA8 PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0
MD MD MD MD MD MD MD MD MD MD MD MD MD MD MD MD
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The port A control register (PACR) is a 16-bit readable/writable register that selects the functions
of the 16 multiplex pins in port A. PACR settings are not valid in all operating modes.
PACR is initialized to H'0000 by a power-on reset (excluding a WDT power-on reset), and in
hardware standby mode. It is not initialized in software standby mode or sleep mode.
Bit 15—PA15 Mode Bit (PA15MD): Selects the function of pin PA15/A15.
Description
Bit 15: Expanded Mode Expanded Mode
PA15MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A15) General input/output (PA15) General input/output (PA15)
(Initial value) (Initial value) (Initial value)
1 Address output (A15) Address output (A15) General input/output (PA15)
Bit 14—PA14 Mode Bit (PA14MD): Selects the function of pin PA14/A14.
Description
Bit 14: Expanded Mode Expanded Mode
PA14MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A14) General input/output (PA14) General input/output (PA14)
(Initial value) (Initial value) (Initial value)
1 Address output (A14) Address output (A14) General input/output (PA14)
Bit 13—PA13 Mode Bit (PA13MD): Selects the function of pin PA13/A13.
Description
Bit 13: Expanded Mode Expanded Mode
PA13MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A13) General input/output (PA13) General input/output (PA13)
(Initial value) (Initial value) (Initial value)
1 Address output (A13) Address output (A13) General input/output (PA13)
Bit 12—PA12 Mode Bit (PA12MD): Selects the function of pin PA12/A12.
Description
Bit 12: Expanded Mode Expanded Mode
PA12MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A12) General input/output (PA12) General input/output (PA12)
(Initial value) (Initial value) (Initial value)
1 Address output (A12) Address output (A12) General input/output (PA12)
Bit 11—PA11 Mode Bit (PA11MD): Selects the function of pin PA11/A11.
Description
Bit 11: Expanded Mode Expanded Mode
PA11MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A11) General input/output (PA11) General input/output (PA11)
(Initial value) (Initial value) (Initial value)
1 Address output (A11) Address output (A11) General input/output (PA11)
Bit 10—PA10 Mode Bit (PA10MD): Selects the function of pin PA10/A10.
Description
Bit 10: Expanded Mode Expanded Mode
PA10MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A10) General input/output (PA10) General input/output (PA10)
(Initial value) (Initial value) (Initial value)
1 Address output (A10) Address output (A10) General input/output (PA10)
Bit 9—PA9 Mode Bit (PA9MD): Selects the function of pin PA9/A9.
Description
Bit 9: Expanded Mode Expanded Mode
PA9MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A9) General input/output (PA9) General input/output (PA9)
(Initial value) (Initial value) (Initial value)
1 Address output (A9) Address output (A9) General input/output (PA9)
Bit 8—PA8 Mode Bit (PA8MD): Selects the function of pin PA8/A8.
Description
Bit 8: Expanded Mode Expanded Mode
PA8MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A8) General input/output (PA8) General input/output (PA8)
(Initial value) (Initial value) (Initial value)
1 Address output (A8) Address output (A8) General input/output (PA8)
Bit 7—PA7 Mode Bit (PA7MD): Selects the function of pin PA7/A7.
Description
Bit 7: Expanded Mode Expanded Mode
PA7MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A7) General input/output (PA7) General input/output (PA7)
(Initial value) (Initial value) (Initial value)
1 Address output (A7) Address output (A7) General input/output (PA8)
Bit 6—PA6 Mode Bit (PA6MD): Selects the function of pin PA6/A6.
Description
Bit 6: Expanded Mode Expanded Mode
PA6MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A6) General input/output (PA6) General input/output (PA6)
(Initial value) (Initial value) (Initial value)
1 Address output (A6) Address output (A6) General input/output (PA6)
Bit 5—PA5 Mode Bit (PA5MD): Selects the function of pin PA5/A5.
Description
Bit 5: Expanded Mode Expanded Mode
PA5MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A5) General input/output (PA5) General input/output (PA5)
(Initial value) (Initial value) (Initial value)
1 Address output (A5) Address output (A5) General input/output (PA5)
Bit 4—PA4 Mode Bit (PA4MD): Selects the function of pin PA4/A4.
Description
Bit 4: Expanded Mode Expanded Mode
PA4MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A4) General input/output (PA4) General input/output (PA4)
(Initial value) (Initial value) (Initial value)
1 Address output (A4) Address output (A4) General input/output (PA4)
Bit 3—PA3 Mode Bit (PA3MD): Selects the function of pin PA3/A3.
Description
Bit 3: Expanded Mode Expanded Mode
PA3MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A3) General input/output (PA3) General input/output (PA3)
(Initial value) (Initial value) (Initial value)
1 Address output (A3) Address output (A3) General input/output (PA3)
Bit 2—PA2 Mode Bit (PA2MD): Selects the function of pin PA2/A2.
Description
Bit 2: Expanded Mode Expanded Mode
PA2MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A2) General input/output (PA2) General input/output (PA2)
(Initial value) (Initial value) (Initial value)
1 Address output (A2) Address output (A2) General input/output (PA2)
Bit 1—PA1 Mode Bit (PA1MD): Selects the function of pin PA1/A1.
Description
Bit 1: Expanded Mode Expanded Mode
PA1MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A1) General input/output (PA1) General input/output (PA1)
(Initial value) (Initial value) (Initial value)
1 Address output (A1) Address output (A1) General input/output (PA1)
Bit 0—PA0 Mode Bit (PA0MD): Selects the function of pin PA0/A0.
Description
Bit 0: Expanded Mode Expanded Mode
PA0MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A0) General input/output (PA0) General input/output (PA0)
(Initial value) (Initial value) (Initial value)
1 Address output (A0) Address output (A0) General input/output (PA0)
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PB11 PB10 PB9 PB8 PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0
— — — —
IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR
Initial value: 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0
R/W: R R R/W R/W R/W R/W R/W R/W R R R/W R/W R/W R/W R/W R/W
The port B IO register (PBIOR) is a 16-bit readable/writable register that selects the input/output
direction of the 12 pins in port B. Bits PB11IOR to PB0IOR correspond to pins PB11/A21/POD to
PB0/TO6. PBIOR is enabled when port B pins function as general input/output pins (PB11 to
PB0), and disabled otherwise. PBIOR bits 4 and 5 should be cleared to 0 when ATU clock input is
selected.
When port B pins function as PB11 to PB0, a pin becomes an output when the corresponding bit
in PBIOR is set to 1, and an input when the bit is cleared to 0.
PBIOR is initialized to H'C0C0 by a power-on reset (excluding a WDT power-on reset), and in
hardware standby mode. It is not initialized in software standby mode or sleep mode.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PB11 PB11 PB10 PB9 PB8 PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0
— — —
MD1 MD0 MD MD MD MD MD MD MD MD MD MD MD
Initial value: 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/W R/W R R R/W R/W R/W R/W R/W R/W
The port B control register (PBCR) is a 16-bit readable/writable register that selects the functions
of the 12 multiplex pins in port B.
PBCR is initialized to H'80C0 by a power-on reset (excluding a WDT power-on reset), and in
hardware standby mode. It is not initialized in software standby mode or sleep mode.
Bit 15—Reserved: This bit is always read as 1, and should only be written with 1.
Bits 14 and 13—PB11 Mode Bits 1 and 0 (PB11MD1, PB11MD0): These bits select the
function of pin PB11/A21/POD.
Description
Bit 14: Bit 13: Expanded Mode Expanded Mode
PB11MD1 PB11MD0 with ROM Disabled with ROM Enabled Single-Chip Mode
0 0 Address output (A21) General input/output General input/output
(PB11) (PB11)
(Initial value) (Initial value) (Initial value)
1 Address output (A21) Address output (A21) General input/output
(PB11)
1 0 Address output (A21) Port output disable Port output disable
input (POD) input (POD)
1 Reserved Reserved Reserved
Bit 12—PB10 Mode Bit (PB10MD): Selects the function of pin PB10/A20.
Description
Bit 12: Expanded Mode Expanded Mode
PB10MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A20) General input/output (PB10) General input/output (PB10)
(Initial value) (Initial value) (Initial value)
1 Address output (A20) Address output (A20) General input/output (PB10)
Bit 11—PB9 Mode Bit (PB9MD): Selects the function of pin PB9/A19.
Description
Bit 11: Expanded Mode Expanded Mode
PB9MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A19) General input/output (PB9) General input/output (PB9)
(Initial value) (Initial value) (Initial value)
1 Address output (A19) Address output (A19) General input/output (PB9)
Bit 10—PB8 Mode Bit (PB8MD): Selects the function of pin PB8/A18.
Description
Bit 10: Expanded Mode Expanded Mode
PB8MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A18) General input/output (PB8) General input/output (PB8)
(Initial value) (Initial value) (Initial value)
1 Address output (A18) Address output (A18) General input/output (PB8)
Bit 9—PB7 Mode Bit (PB7MD): Selects the function of pin PB7/A17.
Description
Bit 9: Expanded Mode Expanded Mode
PB7MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A17) General input/output (PB7) General input/output (PB7)
(Initial value) (Initial value) (Initial value)
1 Address output (A17) Address output (A17) General input/output (PB7)
Bit 8—PB6 Mode Bit (PB6MD): Selects the function of pin PB6/A16.
Description
Bit 8: Expanded Mode Expanded Mode
PB6MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Address output (A16) General input/output (PB6) General input/output (PB6)
(Initial value) (Initial value) (Initial value)
1 Address output (A16) Address output (A16) General input/output (PB6)
Bits 7 and 6—Reserved: These bits are always read as 1, and should only be written with 1.
Bit 5—PB5 Mode Bit (PB5MD): Selects the function of pin PB5/TCLKB.
Bit 5:
PB5MD Description
0 General input/output (PB5) (Initial value)
1 ATU clock input (TCLKB)
Bit 4—PB4 Mode Bit (PB4MD): Selects the function of pin PB4/TCLKA.
Bit 4:
PB4MD Description
0 General input/output (PB4) (Initial value)
1 ATU clock input (TCLKA)
Bit 3—PB3 Mode Bit (PB3MD): Selects the function of pin PB3/TO9.
Bit 3:
PB3MD Description
0 General input/output (PB3) (Initial value)
1 ATU PWM output (TO9)
Bit 2—PB2 Mode Bit (PB2MD): Selects the function of pin PB2/TO8.
Bit 2:
PB2MD Description
0 General input/output (PB2) (Initial value)
1 ATU PWM output (TO8)
Bit 1—PB1 Mode Bit (PB1MD): Selects the function of pin PB1/TO7.
Bit 1:
PB1MD Description
0 General input/output (PB1) (Initial value)
1 ATU PWM output (TO7)
Bit 0—PB0 Mode Bit (PB0MD): Selects the function of pin PB1/TO6.
Bit 0:
PB0MD Description
0 General input/output (PB0) (Initial value)
1 ATU PWM output (TO6)
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PC14 PC13 PC12 PC11 PC10 PC9 PC8 PC7 PC6 PC5 PC4 PC3 PC2 PC1 PC0
—
IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR
Initial value: 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The port C IO register (PCIOR) is a 16-bit readable/writable register that selects the input/output
direction of the 15 pins in port C. Bits PC14IOR to PC0IOR correspond to pins PC14/TOH10 to
PC0/WRL. PCIOR is enabled when port C pins function as general input/output pins (PC14 to
PC0), and disabled otherwise.
When port C pins function as PC14 to PC0, a pin becomes an output when the corresponding bit
in PCIOR is set to 1, and an input when the bit is cleared to 0.
PCIOR is initialized to H'8000 by a power-on reset (excluding a WDT power-on reset), and in
hardware standby mode. It is not initialized in software standby mode or sleep mode.
Port C control registers 1 and 2 (PCCR1, PCCR2) are 16-bit readable/writable registers that select
the functions of the 15 multiplex pins in port C. PCCR1 selects the functions of the pins for the
upper 7 bits in port C, and PCCR2 selects the functions of the pins for the lower 8 bits in port C.
PCCR1 and PCCR2 are initialized to H'C000 and H'0BFF, respectively, by a power-on reset
(excluding a WDT power-on reset), and in hardware standby mode. They are not initialized in
software standby mode or sleep mode.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PC14 PC14 PC13 PC13 PC12 PC12 PC11 PC11 PC10 PC10 PC9 PC9 PC8 PC8
— —
MD1 MD0 MD1 MD0 MD1 MD0 MD1 MD0 MD1 MD0 MD1 MD0 MD1 MD0
Initial value: 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R R R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bits 15 and 14—Reserved: These bits are always read as 1, and should only be written with 1.
Bits 13 and 12—PC14 Mode Bits 1 and 0 (PC14MD1, PC14MD0): These bits select the
function of pin PC14/TOH10.
Bits 11 and 10—PC13 Mode Bits 1 and 0 (PC13MD1, PC13MD0): These bits select the
function of pin PC13/TOG10.
Bits 9 and 8—PC12 Mode Bits 1 and 0 (PC12MD1, PC12MD0): These bits select the function
of pin PC12/TOF10/DRAK1.
Bit 9: Bit 8:
PC12MD1 PC12MD0 Description
0 0 General input/output (PC12) (Initial value)
1 ATU one-shot pulse output (TOF10)
1 0 DMAC DREQ1 acceptance signal output (DRAK1)
1 Reserved
Bits 7 and 6—PC11 Mode Bits 1 and 0 (PC11MD1, PC11MD0): These bits select the function
of pin PC11/TOE10/DRAK0.
Bit 7: Bit 6:
PC11MD1 PC11MD0 Description
0 0 General input/output (PC11) (Initial value)
1 ATU one-shot pulse output (TOE10)
1 0 DMAC DREQ0 acceptance signal output (DRAK0 )
1 Reserved
Bits 5 and 4—PC10 Mode Bits 1 and 0 (PC10MD1, PC10MD0): These bits select the function
of pin PC10/TOD10.
Bit 5: Bit 4:
PC10MD1 PC10MD0 Description
0 0 General input/output (PC10) (Initial value)
1 ATU one-shot pulse output (TOD10)
1 0 Reserved
1 Reserved
Bits 3 and 2—PC9 Mode Bits 1 and 0 (PC9MD1, PC9MD0): These bits select the function of
pin PC9/TOC10.
Bit 3: Bit 2:
PC9MD1 PC9MD0 Description
0 0 General input/output (PC9) (Initial value)
1 ATU one-shot pulse output (TOC10)
1 0 Reserved
1 Reserved
Bits 1 and 0—PC8 Mode Bits 1 and 0 (PC8MD1, PC8MD0): These bits select the function of
pin PC8/TOB10.
Bit 1: Bit 0:
PC8MD1 PC8MD0 Description
0 0 General input/output (PC8) (Initial value)
1 ATU one-shot pulse output (TOB10)
1 0 Reserved
1 Reserved
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PC7 PC7 PC6 PC6 PC5 PC4 PC3 PC2 PC1 PC0
— — — — — —
MD1 MD0 MD1 MD0 MD MD MD MD MD MD
Initial value: 0 0 0 0 1 0 1 1 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R R/W R R/W R R/W R R/W R R/W R R/W
Bits 15 and 14—PC7 Mode Bits 1 and 0 (PC7MD1, PC7MD0): These bits select the function of
pin PC7/TOA10.
Bits 13 and 12—PC6 Mode Bits 1 and 0 (PC6MD1, PC6MD0): These bits select the function of
pin PC6/CS2/IRQ6/ADEND.
Description
Bit 13: Bit 12:
PC6MD1 PC6MD0 Expanded Mode Single-Chip Mode
0 0 General input/output (PC6) General input/output (PC6)
(Initial value)
(Initial value)
1 Chip select output (CS2) General input/output (PC6)
1 0 Interrupt request input (IRQ6) Interrupt request input (IRQ6)
1 A/D conversion end output A/D conversion end output
(ADEND) (ADEND)
Bit 11—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 10—PC5 Mode Bit (PC5MD): Selects the function of pin PC5/CS1.
Description
Bit 10:
PC5MD Expanded Mode Single-Chip Mode
0 General input/output (PC5) (Initial value) General input/output (PC5) (Initial value)
1 Chip select output (CS1) General input/output (PC5)
Bit 9—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 8—PC4 Mode Bit (PC4MD): Selects the function of pin PC4/CS0.
Description
Bit 8:
PC4MD Expanded Mode Single-Chip Mode
0 General input/output (PC4) General input/output (PC4)
1 Chip select output (CS0) (Initial value) General input/output (PC4) (Initial value)
Bit 7—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 6—PC3 Mode Bit (PC3MD): Selects the function of pin PC3/RD.
Description
Bit 6:
PC3MD Expanded Mode Single-Chip Mode
0 General input/output (PC3) General input/output (PC3)
1 Read output (RD) (Initial value) General input/output (PC3) (Initial value)
Bit 5—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 4—PC2 Mode Bit (PC2MD): Selects the function of pin PC2/WAIT.
Description
Bit 4:
OC2ND Expanded Mode Single-Chip Mode
0 General input/output (PC2) General input/output (PC2)
1 Wait state input (WAIT) (Initial value) General input/output (PC2) (Initial value)
Bit 3—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 2—PC1 Mode Bit (PC1MD): Selects the function of pin PC1/WRH.
Description
Bit 2:
PC1MD Expanded Mode Single-Chip Mode
0 General input/output (PC1) General input/output (PC1)
1 High-end write (WRH) (Initial value) General input/output (PC1) (Initial value)
Bit 1—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 0—PC0 Mode Bit (PC0MD): Selects the function of pin PC0/WRL.
Description
Bit 0:
PC0MD Expanded Mode Single-Chip Mode
0 General input/output (PC0) General input/output (PC0)
1 Low-end write (WRL) (Initial value) General input/output (PC0) (Initial value)
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PD15 PD14 PD13 PD12 PD11 PD10 PD9 PD8 PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0
IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The port D IO register (PDIOR) is a 16-bit readable/writable register that selects the input/output
direction of the 16 pins in port D. Bits PD15IOR to PD0IOR correspond to pins PD15/D15 to
PD0/D0. PDIOR is enabled when port D pins function as general input/output pins (PD15 to
PD0), and disabled otherwise.
When port D pins function as PD15 to PD0, a pin becomes an output when the corresponding bit
in PDIOR is set to 1, and an input when the bit is cleared to 0.
PDIOR is initialized to H'0000 by a power-on reset (excluding a WDT power-on reset), and in
hardware standby wode. It is not initialized in software standby mode or sleep mode.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PD15 PD14 PD13 PD12 PD11 PD10 PD9 PD8 PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0
MD MD MD MD MD MD MD MD MD MD MD MD MD MD MD MD
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The port D control register (PDCR) is a 16-bit readable/writable register that selects the functions
of the 16 multiplex pins in port D. PDCR settings are not valid in all operating modes.
PDCR is initialized to H'0000 by a power-on reset (excluding a WDT power-on reset), and in
hardware standby mode. It is not initialized in software standby mode or sleep mode.
Bit 15—PD15 Mode Bit (PD15MD): Selects the function of pin PD15/D15.
Description
Expanded Mode Expanded Mode
Bit 15: with ROM Disabled with ROM Disabled Expanded Mode
PD15MD Area 0: 8 Bits Area 0: 16 Bits with ROM Enabled Single-Chip Mode
0 General input/output Data input/output General input/output General input/output
(PD15) (D15) (PD15) (PD15)
(Initial value) (Initial value) (Initial value) (Initial value)
1 Data input/output Data input/output Data input/output General input/output
(D15) (D15) (D15) (PD15)
Bit 14—PD14 Mode Bit (PD14MD): Selects the function of pin PD14/D14.
Description
Expanded Mode Expanded Mode
Bit 14: with ROM Disabled with ROM Disabled Expanded Mode
PD14MD Area 0: 8 Bits Area 0: 16 Bits with ROM Enabled Single-Chip Mode
0 General input/output Data input/output General input/output General input/output
(PD14) (D14) (PD14) (PD14)
(Initial value) (Initial value) (Initial value) (Initial value)
1 Data input/output Data input/output Data input/output General input/output
(D14) (D14) (D14) (PD14)
Bit 13—PD13 Mode Bit (PD13MD): Selects the function of pin PD13/D13.
Description
Expanded Mode Expanded Mode
Bit 13: with ROM Disabled with ROM Disabled Expanded Mode
PD13MD Area 0: 8 Bits Area 0: 16 Bits with ROM Enabled Single-Chip Mode
0 General input/output Data input/output General input/output General input/output
(PD13) (D13) (PD13) (PD13)
(Initial value) (Initial value) (Initial value) (Initial value)
1 Data input/output Data input/output Data input/output General input/output
(D13) (D13) (D13) (PD13)
Bit 12—PD12 Mode Bit (PD12MD): Selects the function of pin PD12/D12.
Description
Expanded Mode Expanded Mode
Bit 12: with ROM Disabled with ROM Disabled Expanded Mode
PD12MD Area 0: 8 Bits Area 0: 16 Bits with ROM Enabled Single-Chip Mode
0 General input/output Data input/output General input/output General input/output
(PD12) (D12) (PD12) (PD12)
(Initial value) (Initial value) (Initial value) (Initial value)
1 Data input/output Data input/output Data input/output General input/output
(D12) (D12) (D12) (PD12)
Bit 11—PD11 Mode Bit (PD11MD): Selects the function of pin PD11/D11.
Description
Expanded Mode Expanded Mode
Bit 11: with ROM Disabled with ROM Disabled Expanded Mode
PD11MD Area 0: 8 Bits Area 0: 16 Bits with ROM Enabled Single-Chip Mode
0 General input/output Data input/output General input/output General input/output
(PD11) (D11) (PD11) (PD11)
(Initial value) (Initial value) (Initial value) (Initial value)
1 Data input/output Data input/output Data input/output General input/output
(D11) (D11) (D11) (PD11)
Bit 10—PD10 Mode Bit (PD10MD): Selects the function of pin PD10/D10.
Description
Expanded Mode Expanded Mode
Bit 10: with ROM Disabled with ROM Disabled Expanded Mode
PD10MD Area 0: 8 Bits Area 0: 16 Bits with ROM Enabled Single-Chip Mode
0 General input/output Data input/output General input/output General input/output
(PD10) (D10) (PD10) (PD10)
(Initial value) (Initial value) (Initial value) (Initial value)
1 Data input/output Data input/output Data input/output General input/output
(D10) (D10) (D10) (PD10)
Bit 9—PD9 Mode Bit (PD9MD): Selects the function of pin PD9/D9.
Description
Expanded Mode Expanded Mode
Bit 9: with ROM Disabled with ROM Disabled Expanded Mode
PD9MD Area 0: 8 Bits Area 0: 16 Bits with ROM Enabled Single-Chip Mode
0 General input/output Data input/output General input/output General input/output
(PD9) (D9) (PD9) (PD9)
(Initial value) (Initial value) (Initial value) (Initial value)
1 Data input/output Data input/output Data input/output General input/output
(D9) (D9) (D9) (PD9)
Bit 8—PD8 Mode Bit (PD8MD): Selects the function of pin PD8/D8.
Description
Expanded Mode Expanded Mode
Bit 8: with ROM Disabled with ROM Disabled Expanded Mode
PD8MD Area 0: 8 Bits Area 0: 16 Bits with ROM Enabled Single-Chip Mode
0 General input/output Data input/output General input/output General input/output
(PD8) (D8) (PD8) (PD8)
(Initial value) (Initial value) (Initial value) (Initial value)
1 Data input/output Data input/output Data input/output General input/output
(D8) (D8) (D8) (PD8)
Bit 7—PD7 Mode Bit (PD7MD): Selects the function of pin PD7/D7.
Description
Bit 7: Expanded Mode Expanded Mode
PD7MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Data input/output (D7) General input/output (PD7) General input/output (PD7)
(Initial value) (Initial value) (Initial value)
1 Data input/output (D7) Data input/output (D7) General input/output (PD7)
Bit 6—PD6 Mode Bit (PD6MD): Selects the function of pin PD6/D6.
Description
Bit 6: Expanded Mode Expanded Mode
PD6MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Data input/output (D6) General input/output (PD6) General input/output (PD6)
(Initial value) (Initial value) (Initial value)
1 Data input/output (D6) Data input/output (D6) General input/output (PD6)
Bit 5—PD5 Mode Bit (PD5MD): Selects the function of pin PD5/D5.
Description
Bit 5: Expanded Mode Expanded Mode
PD5MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Data input/output (D5) General input/output (PD5) General input/output (PD5)
(Initial value) (Initial value) (Initial value)
1 Data input/output (D5) Data input/output (D5) General input/output (PD5)
Bit 4—PD4 Mode Bit (PD4MD): Selects the function of pin PD4/D4.
Description
Bit 4: Expanded Mode Expanded Mode
PD4MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Data input/output (D4) General input/output (PD4) General input/output (PD4)
(Initial value) (Initial value) (Initial value)
1 Data input/output (D4) Data input/output (D4) General input/output (PD4)
Bit 3—PD3 Mode Bit (PD3MD): Selects the function of pin PD3/D3.
Description
Bit 3: Expanded Mode Expanded Mode
PD3MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Data input/output (D3) General input/output (PD3) General input/output (PD3)
(Initial value) (Initial value) (Initial value)
1 Data input/output (D3) Data input/output (D3) General input/output (PD3)
Bit 2—PD2 Mode Bit (PD2MD): Selects the function of pin PD2/D2.
Description
Bit 2: Expanded Mode Expanded Mode
PD2MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Data input/output (D2) General input/output (PD2) General input/output (PD2)
(Initial value) (Initial value) (Initial value)
1 Data input/output (D2) Data input/output (D2) General input/output (PD2)
Bit 1—PD1 Mode Bit (PD1MD): Selects the function of pin PD1/D1.
Description
Bit 1: Expanded Mode Expanded Mode
PD1MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Data input/output (D1) General input/output (PD1) General input/output (PD1)
(Initial value) (Initial value) (Initial value)
1 Data input/output (D1) Data input/output (D1) General input/output (PD1)
Bit 0—PD0 Mode Bit (PD0MD): Selects the function of pin PD0/D0.
Description
Bit 0: Expanded Mode Expanded Mode
PD0MD with ROM Disabled with ROM Enabled Single-Chip Mode
0 Data input/output (D0) General input/output (PD0) General input/output (PD0)
(Initial value) (Initial value) (Initial value)
1 Data input/output (D0) Data input/output (D0) General input/output (PD0)
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PE14 PE13 PE12 PE11 PE10 PE9 PE8 PE7 PE6 PE5 PE4 PE3 PE2 PE1 PE0
—
IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR
Initial value: 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The port E IO register (PEIOR) is a 16-bit readable/writable register that selects the input/output
direction of the 15 pins in port E. Bits PE14IOR to PE0IOR correspond to pins PE14/TIOC3 to
PE0/TIOA1. PEIOR is enabled when port E pins function as general input/output pins (PE14 to
PE0) or as ATU input/output pins, and disabled otherwise. PEIOR bits 8 to 11 should be cleared to
0 when ATU input capture input is selected.
When port E pins function as PE14 to PE0, a pin becomes an output when the corresponding bit in
PEIOR is set to 1, and an input when the bit is cleared to 0.
PEIOR is initialized to H'8000 by a power-on reset (excluding a WDT power-on reset), and in
hardware standby mode. It is not initialized in software standby mode or sleep mode.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PE14 PE13 PE12 PE11 PE10 PE9 PE8 PE7 PE6 PE5 PE4 PE3 PE2 PE1 PE0
—
MD MD MD MD MD MD MD MD MD MD MD MD MD MD MD
Initial value: 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The port E control register (PECR) is a 16-bit readable/writable register that selects the functions
of the 15 multiplex pins in port E.
PECR is initialized to H'8000 by a power-on reset (excluding a WDT power-on reset), and in
hardware standby mode. It is not initialized in software standby mode or sleep mode.
Bit 15—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 14—PE14 Mode Bit (PE14MD): Selects the function of pin PE14/TIOC3.
Bit 14:
PE14MD Description
0 General input/output (PE14) (Initial value)
1 ATU input capture input/output compare output (TIOC3)
Bit 13—PE13 Mode Bit (PE13MD): Selects the function of pin PE13/TIOB3.
Bit 13:
PE13MD Description
0 General input/output (PE13) (Initial value)
1 ATU input capture input/output compare output (TIOB3)
Bit 12—PE12 Mode Bit (PE12MD): Selects the function of pin PE12/TIOA3.
Bit 12:
PE12MD Description
0 General input/output (PE12) (Initial value)
1 ATU input capture input/output compare output (TIOA3)
Bit 11—PE11 Mode Bit (PE11MD): Selects the function of pin PE11/TID0.
Bit 11:
PE11MD Description
0 General input/output (PE11) (Initial value)
1 ATU input capture input (TID0
Bit 10—PE10 Mode Bit (PE10MD): Selects the function of pin PE10/TIC0.
Bit 10:
PE10MD Description
0 General input/output (PE10) (Initial value)
1 ATU input capture input (TIC0)
Bit 9—PE9 Mode Bit (PE9MD): Selects the function of pin PE9/TIB0.
Bit 9:
PE9MD Description
0 General input/output (PE9) (Initial value)
1 ATU input capture input (TIB0)
Bit 8—PE8 Mode Bit (PE8MD): Selects the function of pin PE8/TIA0.
Bit 8:
PE8MD Description
0 General input/output (PE8) (Initial value)
1 ATU input capture input (TIA0)
Bit 7—PE7 Mode Bit (PE7MD): Selects the function of pin PE7/TIOB2.
Bit 7:
PE7MD Description
0 General input/output (PE7) (Initial value)
1 ATU input capture input/output compare output (TIOB2)
Bit 6—PE6 Mode Bit (PE6MD): Selects the function of pin PE6/TIOA2.
Bit 6:
PE6MD Description
0 General input/output (PE6) (Initial value)
1 ATU input capture input/output compare output (TIOA2)
Bit 5—PE5 Mode Bit (PE5MD): Selects the function of pin PE5/TIOF1.
Bit 5:
PE5MD Description
0 General input/output (PE5) (Initial value)
1 ATU input capture input/output compare output (TIOF1)
Bit 4—PE4 Mode Bit (PE4MD): Selects the function of pin PE4/TIOE1.
Bit 4:
PE4MD Description
0 General input/output (PE4) (Initial value)
1 ATU input capture input/output compare output (TIOE1)
Bit 3—PE3 Mode Bit (PE3MD): Selects the function of pin PE3/TIOD1.
Bit 3:
PE3MD Description
0 General input/output (PE3) (Initial value)
1 ATU input capture input/output compare output (TIOD1)
Bit 2—PE2 Mode Bit (PE2MD): Selects the function of pin PE2/TIOC1.
Bit 2:
PE2MD Description
0 General input/output (PE2) (Initial value)
1 ATU input capture input/output compare output (TIOC1)
Bit 1—PE1 Mode Bit (PE1MD): Selects the function of pin PE1/TIOB1.
Bit 1:
PE1MD Description
0 General input/output (PE1) (Initial value)
1 ATU input capture input/output compare output (TIOB1)
Bit 0—PE0 Mode Bit (PE0MD): Selects the function of pin PE0/TIOA1.
Bit 0:
PE0MD Description
0 General input/output (PE0) (Initial value)
1 ATU input capture input/output compare output (TIOA1)
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PF11 PF10 PF9 PF8 PF7 PF6 PF5 PF4 PF3 PF2 PF1 PF0
— — — —
IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR
Initial value: 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R R R R R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The port F IO register (PFIOR) is a 16-bit readable/writable register that selects the input/output
direction of the 12 pins in port F. Bits PF11IOR to PF0IOR correspond to pins
PF11/BREQ/PULS7 to PF0/IRQ0. PFIOR is enabled when port F pins function as general
input/output pins (PF11 to PF0) or the PF8/SCK2/PULS4 pin has the serial clock function
(SCK2), and is disabled otherwise.
When port F pins function as PF11 to PF0 or include the SCK2 function, a pin becomes an output
when the corresponding bit in PFIOR is set to 1, and an input when the bit is cleared to 0.
PFIOR is initialized to H'F000 by a power-on reset (excluding a WDT power-on reset), and in
hardware standby mode. It is not initialized in software standby mode or sleep mode.
Port F control registers 1 and 2 (PFCR1, PFCR2) are 16-bit readable/writable registers that select
the functions of the 12 multiplex pins in port F. PFCR1 selects the functions of the pins for the
upper 4 bits in port F, and PFCR2 selects the functions of the pins for the lower 8 bits in port F.
PFCR1 and PFCR2 are initialized to H'FF00 and H'00AA, respectively, by a power-on reset
(excluding a WDT power-on reset), and in hardware standby mode. They are not initialized in
software standby mode or sleep mode.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PF11 PF11 PF10 PF10 PF9 PF9 PF8 PF8
— — — — — — — —
MD1 MD0 MD1 MD0 MD1 MD0 MD1 MD0
Initial value: 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
R/W: R R R R R R R R R/W R/W R/W R/W R/W R/W R/W R/W
Bits 15 to 8—Reserved: These bits are always read as 1, and should only be written with 1.
Bits 7 and 6—PF11 Mode Bits 1 and 0 (PF11MD1, PF11MD0): These bits select the function
of pin PF11/BREQ/PULS7.
Description
Bit 7: Bit 6:
PF11MD1 PF11MD0 Expanded Mode Single-Chip Mode
0 0 General input/output (PF11) General input/output (PF11)
(Initial value) (Initial value)
1 Bus request input (BREQ) General input/output (PF11)
1 0 APC pulse output (PULS7) APC pulse output (PULS7)
1 Reserved Reserved
Bits 5 and 4—PF10 Mode Bits 1 and 0 (PF10MD1, PF10MD0): These bits select the function
of pin PF10/BACK/PULS6.
Description
Bit 5: Bit 4:
PF10MD1 PF10MD0 Expanded Mode Single-Chip Mode
0 0 General input/output (PF10) General input/output (PF10)
(Initial value) (Initial value)
1 Bus request acknowledge output General input/output (PF10)
(BACK)
1 0 APC pulse output (PULS6) APC pulse output (PULS6)
1 Reserved Reserved
Bits 3 and 2—PF9 Mode Bits 1 and 0 (PF9MD1, PF9MD0): These bits select the function of
pin PF9/CS3/IRQ7/PULS5.
Description
Bit 3: Bit 2:
PF9MD1 PF9MD0 Expanded Mode Single-Chip Mode
0 0 General input/output (PF9) General input/output (PF9)
(Initial value) (Initial value)
1 Chip select output (CS3) General input/output (PF9)
1 0 Interrupt request input (IRQ7) Interrupt request input (IRQ7)
1 APC pulse output (PULS5) APC pulse output (PULS5)
Bits 1 and 0—PF8 Mode Bits 1 and 0 (PF8MD1, PF8MD0): These bits select the function of
pin PF8/SCK/PULS4.
Bit 1: Bit 0:
PF8MD1 PF8MD0 Description
0 0 General input/output (PF8) (Initial value)
1 Serial clock input/output (SCK2)
1 0 APC pulse output (PULS4)
1 Reserved
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PF7 PF7 PF6 PF6 PF5 PF5 PF4 PF4 PF3 PF2 PF1 PF0
— — — —
MD1 MD0 MD1 MD0 MD1 MD0 MD1 MD0 MD MD MD MD
Initial value: 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R R/W R R/W R R/W R R/W
Bits 15 and 14—PF7 Mode Bits 1 and 0 (PF7MD1, PF7MD0): These bits select the function of
pin PF7/DREQ0/PULS3.
Bits 13 and 12—PF6 Mode Bits 1 and 0 (PF6MD1, PF6MD0): These bits select the function of
pin PF6/DACK0/PULS2.
Description
Bit 13: Bit 12:
PF6MD1 PF6MD0 Expanded Mode Single-Chip Mode
0 0 General input/output (PF6) General input/output (PF6)
(Initial value)
1 DMA transfer request acceptance General input/output (PF6)
output (DACK0)
1 0 APC pulse output (PULS2) APC pulse output (PULS2)
1 Reserved Reserved
Bits 11 and 10—PF5 Mode Bits 1 and 0 (PF5MD1, PF5MD0): These bits select the function of
pin PF5/DREQ1/PULS1.
Bits 9 and 8—PF4 Mode Bits 1 and 0 (PF4MD1, PF4MD0): These bits select the function of
pin PF4/DACK1/PULS0.
Description
Bit 9: Bit 8:
PF4MD1 PF4MD0 Expanded Mode Single-Chip Mode
0 0 General input/output (PF4) General input/output (PF4)
(Initial value)
1 DMA transfer request acceptance General input/output (PF4)
output (DACK1)
1 0 APC pulse output (PULS0) APC pulse output (PULS0)
1 Reserved Reserved
Bit 7—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 6—PF3 Mode Bit (PF3MD): Selects the function of pin PF3/IRQ3.
Bit 6:
PE3MD Description
0 General input/output (PF3) (Initial value)
1 Interrupt request input (IRQ3)
Bit 5—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 4—PF2 Mode Bit (PF2MD): Selects the function of pin PF2/IRQ2.
Bit 4:
PE2MD Description
0 General input/output (PF2) (Initial value)
1 Interrupt request input (IRQ2)
Bit 3—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 2—PF1 Mode Bit (PF1MD): Selects the function of pin PF1/IRQ1.
Bit 2:
PE1MD Description
0 General input/output (PF1) (Initial value)
1 Interrupt request input (IRQ1)
Bit 1—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 0—PF0 Mode Bit (PF0MD): Selects the function of pin PF0/IRQ0.
Bit 0:
PE0MD Description
0 General input/output (PF0) (Initial value)
1 Interrupt request input (IRQ0)
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PG1 PG1 PG1 PG1 PG1 PG1 PG9 PG8 PG7 PG6 PG5 PG4 PG3 PG2 PG1 PG0
5 4 3 2 1 0 IOR IOR IOR IOR IOR IOR IOR IOR IOR IOR
IOR IOR IOR IOR IOR IOR
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The port G IO register (PGIOR) is a 16-bit readable/writable register that selects the input/output
direction of the 16 pins in port G. Bits PG15IOR to PG0IOR correspond to pins
PG15/IRQ5/TIOB5 to PG0/ADTRG/IRQOUT. PGIOR is enabled when port G pins function as
general input/output pins (PG15 to PG0), serial clock pins (SCK1, SCK0), or timer input/output
pins (TIOD3, TIOA4, TIOB4, TIOC4, TIOD4, TIOA5, TIOB5), and is disabled otherwise.
When port G pins function as PG15 to PG0, SCK1 and SCK0, or TIOD3, TIOA4, TIOB4, TIOC4,
TIOD4, TIOA5, and TIOB5, a pin becomes an output when the corresponding bit in PGIOR is set
to 1, and an input when the bit is cleared to 0.
PGIOR is initialized to H'0000 by a power-on reset (excluding a WDT power-on reset), and in
hardware standby mode. It is not initialized in software standby mode or sleep mode.
Port G control registers 1 and 2 (PGCR1, PGCR2) are 16-bit readable/writable registers that select
the functions of the 16 multiplex pins in port G. PGCR1 selects the functions of the pins for the
upper 8 bits in port G, and PGCR2 selects the functions of the pins for the lower 8 bits in port G.
PGCR1 and PGCR2 are initialized to H'0AAA and H'AA80, respectively, by a power-on reset
(excluding a WDT power-on reset), and in hardware standby mode. They are not initialized in
software standby mode or sleep mode.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PG15 PG15 PG14 PG14 PG13 PG12 PG11 PG10 PG9 PG8
— — — — — —
MD1 MD0 MD1 MD0 MD0 MD0 MD MD MD MD
Initial value: 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0
R/W: R/W R/W R/W R/W R R/W R R/W R R/W R R/W R R/W R R/W
Bits 15 and 14—PG15 Mode Bits 1 and 0 (PG15MD1, PG15MD0): These bits select the
function of pin PG15/IRQ5/TIOB5.
Bits 13 and 12—PG14 Mode Bits 1 and 0 (PG14MD1, PG14MD0): These bits select the
function of pin PG14/IRQ4/TIOA5.
Bit 11—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 10—PG13 Mode Bit (PG13MD): Selects the function of pin PG13/TIOD4.
Bit 10:
PG13MD Description
0 General input/output (PG13) (Initial value)
1 ATU input capture input/output compare output (TIOD4)
Bit 9—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 8—PG12 Mode Bit (PG12MD): Selects the function of pin PG12/TIOC4.
Bit 8:
PG12MD Description
0 General input/output (PG12) (Initial value)
1 ATU input capture input/output compare output (TIOC4)
Bit 7—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 6—PG11 Mode Bit (PG11MD): Selects the function of pin PG11/TIOB4.
Bit 6:
PG11MD Description
0 General input/output (PG11) (Initial value)
1 ATU input capture input/output compare output (TIOB4)
Bit 5—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 4—PG10 Mode Bit (PG10MD): Selects the function of pin PG10/TIOA4.
Bit 4:
PG10MD Description
0 General input/output (PG10) (Initial value)
1 ATU input capture input/output compare output (TIOA4)
Bit 3—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 2—PG9 Mode Bit (PG9MD): Selects the function of pin PG9/TIOD3.
Bit 2:
PG9MD Description
0 General input/output (PG9) (Initial value)
1 ATU input capture input/output compare output (TIOD3)
Bit 1—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 0—PG8 Mode Bit (PG8MD): Selects the function of pin PG8/RXD2.
Bit 0:
PG8MD Description
0 General input/output (PG8) (Initial value)
1 Receive data input (RXD2)
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PG7 PG6 PG5 PG4 PG3 PG2 PG1 PG0 PG0 IRQ IRQ
— — — — —
MD0 MD0 MD MD MD MD MD MD1 MD0 MD1 MD0
Initial value: 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0
R/W: R R/W R R/W R R/W R R/W R R/W R/W R/W R/W R/W R/W R/W
Bit 15—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 14—PG7 Mode Bit (PG7MD): Selects the function of pin PG7/TXD2.
Bit 14:
PG7MD Description
0 General input/output (PG7) (Initial value)
1 Transmit data output (TXD2)
Bit 13—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 12—PG6 Mode Bit (PG6MD): Selects the function of pin PG6/RXD1.
Bit 12:
PG6MD Description
0 General input/output (PG6) (Initial value)
1 Receive data input (RXD1)
Bit 11—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 10—PG5 Mode Bit (PG5MD): Selects the function of pin PG5/TXD1.
Bit 10:
PG5MD Description
0 General input/output (PG5) (Initial value)
1 Transmit data output (TXD1)
Bit 9—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 8—PG4 Mode Bit (PG4MD): Selects the function of pin PG4/SCK1.
Bit 8:
PG4MD Description
0 General input/output (PG4) (Initial value)
1 Serial clock input/output (SCK1)
Bit 7—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 6—PG3 Mode Bit (PG3MD): Selects the function of pin PG3/RXD0.
Bit 6:
PG3MD Description
0 General input/output (PG3) (Initial value)
1 Receive data input (RXD0)
Bit 5—PG2 Mode Bit (PG2MD): Selects the function of pin PG2/TXD0.
Bit 5:
PG2MD Description
0 General input/output (PG2) (Initial value)
1 Transmit data output (TXD0)
Bit 4—PG1 Mode Bit (PG1MD): Selects the function of pin PG1/SCK0.
Bit 4:
PG1MD Description
0 General input/output (PG1) (Initial value)
1 Serial clock input/output (SCK0)
Bits 3 and 2—PG0 Mode Bits 1 and 0 (PG0MD1, PG0MD0): These bits select the function of
pin PG0/ADTRG/IRQOUT.
Bit 3: Bit 2:
PG0MD1 PG0MD0 Description
0 0 General input/output (PG0) (Initial value)
1 A/D conversion trigger input (ADTRG)
1 0 Interrupt request output (IRQOUT)
1 Reserved
IRQOUT Mode Bits 1 and 0 (IRQMD1, IRQMD0): These bits select the
Bits 1 and 0—IRQOUT
IRQOUT function for pin PG0/ADTRG/IRQOUT.
Bit 1: Bit 0:
IRQMD1 IRQMD0 Description
0 0 IRQOUT is always high (Initial value)
1 Output on INTC interrupt request
1 0 Reserved
1 Reserved
CK control register (CKCR) is a 16-bit readable/writable register being used for controlling clock
output from CK terminal.
CKCR is initialized to H'FFFE by a power-on reset and in hardware standby mode. It is not
initialized in software standby mode or sleep mode.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
— — — — — — — — — — — — — — — CKLO
Initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
R/W: R R R R R R R R R R R R R R R R/W
Bits 15 to 1—Reserved: This bit is always read as 1, and should only be written with 1.
Bit 0—CK low fixed bit (CKLO): This bit is used for selecting the internal clock output or low
level output for output from the CK terminal.
Bit 0:
CKLO Description
0 Selects the internal clock for the CK terminal output (Initial value)
1 Always selects the low level for the CK terminal output
17.1 Overview
The SH7050 series has eight ports: A, B, C, D, E, F, G, and H.
Ports A to G are input/output ports (A: 16 bits, B: 12 bits, C: 15 bits, D: 16 bits, E: 15 bits, F: 12
bits, G: 16 bits), and H is a 16-bit input port.
All the port pins are multiplexed as general input/output pins (general input pins in the case of port
H) and special function pins. The functions of the multiplex pins are selected by means of the pin
function controller (PFC). Each port is provided with a data register for storing the pin data.
17.2 Port A
Port A is an input/output port with the 16 pins shown in figure 17.1.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PA15 PA14 PA13 PA12 PA11 PA10 PA9 PA8 PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0
DR DR DR DR DR DR DR DR DR DR DR DR DR DR DR DR
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The port A data register (PADR) is a 16-bit readable/writable register that stores port A data. Bits
PA15DR to PA0DR correspond to pins PA15/A15 to PA0/A0.
When a pin functions as a general output, if a value is written to PADR, that value is output
directly from the pin, and if PADR is read, the register value is returned directly regardless of the
pin state. When the POD pin is driven low, general outputs go to the high-impedance state
regardless of the PADR value. When the POD pin is driven high, the written value is output from
the pin.
When a pin functions as a general input, if PADR is read the pin state, not the register value, is
returned directly. If a value is written to PADR, although that value is written into PADR it does
not affect the pin state. Table 17.2 summarizes port A data register read/write operations.
PADR is initialized by a power-on reset (excluding a WDT power-on reset), and in hardware
standby mode. It is not initialized in software standby mode or sleep mode.
17.3 Port B
Port B is an input/output port with the 12 pins shown in figure 17.2.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PB11 PB10 PB9 PB8 PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0
— — — —
DR DR DR DR DR DR DR DR DR DR DR DR
Initial value: 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0
R/W: R R R/W R/W R/W R/W R/W R/W R R R/W R/W R/W R/W R/W R/W
The port B data register (PBDR) is a 16-bit readable/writable register that stores port B data. Bits
PB11DR to PB0DR correspond to pins PB11/A21/POD to PB0/TO6.
When a pin functions as a general output, if a value is written to PBDR, that value is output
directly from the pin, and if PBDR is read, the register value is returned directly regardless of the
pin state. For PB6 to PB10, when the POD pin is driven low, general outputs go to the high-
impedance state regardless of the PBDR value. When the POD pin is driven high, the written
value is output from the pin.
When a pin functions as a general input, if PBDR is read the pin state, not the register value, is
returned directly. If a value is written to PBDR, although that value is written into PBDR it does
not affect the pin state. Table 17.4 summarizes port B data register read/write operations.
PBDR is initialized by a power-on reset (excluding a WDT power-on reset), and in hardware
standby mode. It is not initialized in software standby mode or sleep mode.
(Bits 8 to 12)
PBIOR Pin Function Read Write
0 General input Pin state Value is written to PBDR, but does not affect
pin state
Other than general Pin state Value is written to PBDR, but does not affect
input pin state
1 General output PBDR value Write value is output from pin (POD pin = high)
High impedance regardless of PBDR value
(POD pin = low)
Other than general PBDR value Value is written to PBDR, but does not affect
output pin state
17.4 Port C
Port C is an input/output port with the 15 pins shown in figure 17.3.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PC14 PC13 PC12 PC11 PC10 PC9 PC8 PC7 PC6 PC5 PC4 PC3 PC2 PC1 PC0
—
DR DR DR DR DR DR DR DR DR DR DR DR DR DR DR
Initial value: 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The port C data register (PCDR) is a 16-bit readable/writable register that stores port C data. Bits
PC14DR to PC0DR correspond to pins PC14/TOH10 to PC0/WRL.
When a pin functions as a general output, if a value is written to PCDR, that value is output
directly from the pin, and if PCDR is read, the register value is returned directly regardless of the
pin state.
When a pin functions as a general input, if PCDR is read the pin state, not the register value, is
returned directly. If a value is written to PCDR, although that value is written into PCDR it does
not affect the pin state. Table 17.6 summarizes port C data register read/write operations.
PCDR is initialized by a power-on reset (excluding a WDT power-on reset), and in hardware
standby mode. It is not initialized in software standby mode or sleep mode.
17.5 Port D
Port D is an input/output port with the 16 pins shown in figure 17.4.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PD15 PD14 PD13 PD12 PD11 PD10 PD9 PD8 PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0
DR DR DR DR DR DR DR DR DR DR DR DR DR DR DR DR
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The port D data register (PDDR) is a 16-bit readable/writable register that stores port D data. Bits
PD15DR to PD0DR correspond to pins PD15/D15 to PD0/D0.
When a pin functions as a general output, if a value is written to PDDR, that value is output
directly from the pin, and if PDDR is read, the register value is returned directly regardless of the
pin state. When the POD pin is driven low, general outputs go to the high-impedance state
regardless of the PDDR value. When the POD pin is driven high, the written value is output from
the pin.
When a pin functions as a general input, if PDDR is read the pin state, not the register value, is
returned directly. If a value is written to PDDR, although that value is written into PDDR it does
not affect the pin state. Table 17.8 summarizes port D data register read/write operations.
PDDR is initialized by a power-on reset (excluding a WDT power-on reset), and in hardware
standby mode. It is not initialized in software standby mode or sleep mode.
17.6 Port E
Port E is an input/output port with the 15 pins shown in figure 17.5.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PE14 PE13 PE12 PE11 PE10 PE9 PE8 PE7 PE6 PE5 PE4 PE3 PE2 PE1 PE0
—
DR DR DR DR DR DR DR DR DR DR DR DR DR DR DR
Initial value: 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The port E data register (PEDR) is a 16-bit readable/writable register that stores port E data. Bits
PE14DR to PE0DR correspond to pins PE14/TIOC3 to PE0/TIOA1.
When a pin functions as a general output, if a value is written to PEDR, that value is output
directly from the pin, and if PEDR is read, the register value is returned directly regardless of the
pin state.
When a pin functions as a general input, if PEDR is read the pin state, not the register value, is
returned directly. If a value is written to PEDR, although that value is written into PEDR it does
not affect the pin state. Table 17.10 summarizes port E data register read/write operations.
PEDR is initialized by a power-on reset (excluding a WDT power-on reset), and in hardware
standby mode. It is not initialized in software standby mode or sleep mode.
17.7 Port F
Port F is an input/output port with the 12 pins shown in figure 17.6.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PF11 PF10 PF9 PF8 PF7 PF6 PF5 PF4 PF3 PF2 PF1 PF0
— — — —
DR DR DR DR DR DR DR DR DR DR DR DR
Initial value: 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R R R R R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The port F data register (PFDR) is a 16-bit readable/writable register that stores port F data. Bits
PF11DR to PF0DR correspond to pins PF11/BREQ/PULS7 to PF0/IRQ0.
When a pin functions as a general output, if a value is written to PFDR, that value is output
directly from the pin, and if PFDR is read, the register value is returned directly regardless of the
pin state.
When a pin functions as a general input, if PFDR is read the pin state, not the register value, is
returned directly. If a value is written to PFDR, although that value is written into PFDR it does
not affect the pin state. Table 17.12 summarizes port F data register read/write operations.
PFDR is initialized by a power-on reset (excluding a WDT power-on reset), and in hardware
standby mode. It is not initialized in software standby mode or sleep mode.
17.8 Port G
Port G is an input/output port with the 16 pins shown in figure 17.7.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PG15 PG14 PG13 PG12 PG11 PG10 PG9 PG8 PG7 PG6 PG5 PG4 PG3 PG2 PG1 PG0
DR DR DR DR DR DR DR DR DR DR DR DR DR DR DR DR
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
The port G data register (PGDR) is a 16-bit readable/writable register that stores port G data. Bits
PG15DR to PG0DR correspond to pins PG15/TIOB5/IRQ5 to PG0/ADTRG/IRQOUT.
When a pin functions as a general output, if a value is written to PGDR, that value is output
directly from the pin, and if PGDR is read, the register value is returned directly regardless of the
pin state.
When a pin functions as a general input, if PGDR is read the pin state, not the register value, is
returned directly. If a value is written to PGDR, although that value is written into PGDR it does
not affect the pin state. Table 17.14 summarizes port G data register read/write operations.
PGDR is initialized by a power-on reset (excluding a WDT power-on reset), and in hardware
standby mode. It is not initialized in software standby mode or sleep mode.
17.9 Port H
Port H is an input port with the 16 pins shown in figure 17.8.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PH15 PH14 PH13 PH12 PH11 PH10 PH9 PH8 PH7 PH6 PH5 PH4 PH3 PH2 PH1 PH0
DR DR DR DR DR DR DR DR DR DR DR DR DR DR DR DR
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R R R R R R R R R R R R R R R R
The port H data register (PHDR) is a 16-bit read-only register that stores port H data. Bits
PH15DR to PH0DR correspond to pins PH15/AN15 to PH0/AN0.
Writes to these bits are ignored, and do not affect the pin states. When these bits are read, the pin
state, not the register value, is returned directly. However, 1 will be returned while A/D converter
analog input is being sampled. Table 17.16 summarizes port H data register read/write operations.
PHDR is not initialized by a power-on reset, or in hardware standby mode, software standby
mode, or sleep mode. (The bits always reflect the pin states.)
Output buffer control by means of POD is performed asynchronously from bus cycles.
Address Bus Pins (A20 to A0) and Data Bus Pins (D15 to D0)
POD (when Designated as Output Ports)
0 Enabled (high-impedance)
1 Disabled (general output)
18.1 Features
The SH7050 has 128 kbytes of on-chip flash memory. The features of the flash memory are
summarized below.
• Programmer mode
Flash memory can be programmed/erased in programmer mode, using a PROM programmer,
as well as in on-board programming mode.
18.2 Overview
FLMCR1
FLMCR2 Operating FWE pin
Bus interface/controller
EBR1 mode Mode pin
RAMER
Flash memory
(128 kB)
Legend:
FLMCR1: Flash memory control register 1
FLMCR2: Flash memory control register 2
EBR1: Erase block register 1
RAMER: RAM emulation register
When the mode pins and the FWE pin are set in the reset state and a reset-start is executed, the
SH7050 enters one of the operating modes shown in figure 18.2. In user mode, flash memory can
be read but not programmed or erased.
Flash memory can be programmed and erased in boot mode, user program mode, and programmer
mode.
Boot mode
On-board programming mode
Notes: Only make a transition between user mode and user program mode when the CPU is
not accessing the flash memory.
1. RAM emulation possible
2. MD0 = 1, MD1 = 0, MD2 = 1, MD3 = 1
Boot Mode
SH7050 SH7050
SCI SCI
Boot program Boot program
New application
program
SH7050 SH7050
SCI SCI
Boot program Boot program
SH7050 SH7050
SCI SCI
Boot program Boot program
New application
program
SH7050 SH7050
SCI SCI
Boot program Boot program
Emulation should be performed in user mode or user program mode. When the emulation block
set in RAMER is accessed while the emulation function is being executed, data written in the
overlap RAM is read.
User Mode
SCI
Application program
Execution state
Emulation block
When overlap RAM data is confirmed, the RAMS bit is cleared, RAM overlap is released, and
writes should actually be performed to the flash memory.
When the programming control program is transferred to RAM, ensure that the transfer
destination and the overlap RAM do not overlap, as this will cause data in the overlap RAM to
be rewritten.
SCI
Overlap RAM
(programming data)
Programming control
program execution state
Application program
Programming data
The flash memory is divided into three 32 kB blocks, one 28 kB blocks, and four 1 kB blocks.
Address H'00000
32 kB
32 kB
128 kB 32 kB
28 kB
1 kB
1 kB
1 kB
1 kB
Address H'1FFFF
FLMCR1 is an 8-bit register used for flash memory operating mode control. Program-verify mode
or erase-verify mode is entered by setting SWE to 1 when FWE = 1. Program mode is entered by
setting SWE to 1 when FWE = 1, then setting the PSU bit, and finally setting the P bit. Erase
mode is entered by setting SWE to 1 when FWE = 1, then setting the ESU bit, and finally setting
the E bit. FLMCR1 is initialized by a reset, and in hardware standby mode and software standby
mode. Its initial value is H'80 when a high level is input to the FWE pin, and H'00 when a low
level is input. When on-chip flash memory is disabled, a read will return H'00, and writes are
invalid.
Writes to bits SWE, ESU, PSU, EV, and PV in FLMCR1 are enabled only when FWE = 1 and
SWE = 1; writes to the E bit only when FWE = 1, SWE = 1, and ESU = 1; and writes to the P bit
only when FWE = 1, SWE = 1, and PSU = 1.
Bit: 7 6 5 4 3 2 1 0
FWE SWE ESU PSU EV PV E P
Initial value: 1/0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/W R/W
Bit 7—Flash Write Enable Bit (FWE): Sets hardware protection against flash memory
programming/erasing.
Bit 7:
FWE Description
0 When a low level is input to the FWE pin (hardware-protected state) (Initial value)
1 When a high level is input to the FWE pin
Bit 6—Software Write Enable Bit (SWE): Enables or disables the flash memory. This bit should
be set before setting bits 5 to 0, and EBR1 bits 7 to 0.
Bit 6:
SWE Description
0 Writes disabled (Initial value)
1 Writes enabled
[Setting condition]
When FWE = 1
Bit 5—Erase Setup Bit (ESU): Prepares for a transition to erase mode. Do not set the SWE, PSU,
EV, PV, E, or P bit at the same time.
Bit 5:
ESU Description
0 Erase setup cleared (Initial value)
1 Erase setup
[Setting condition]
When FWE = 1 and SWE = 1
Bit 4—Program Setup Bit (PSU): Prepares for a transition to program mode. Do not set the
SWE, ESU, EV, PV, E, or P bit at the same time.
Bit 4:
PSU Description
0 Program setup cleared (Initial value)
1 Program setup
[Setting condition]
When FWE = 1 and SWE = 1
Bit 3—Erase-Verify (EV): Selects erase-verify mode transition or clearing. Do not set the SWE,
ESU, PSU, PV, E, or P bit at the same time.
Bit 3:
EV Description
0 Erase-verify mode cleared (Initial value)
1 Transition to erase-verify mode
[Setting condition]
When FWE = 1 and SWE = 1
Bit 2—Program-Verify (PV): Selects program-verify mode transition or clearing. Do not set the
SWE, ESU, PSU, EV, E, or P bit at the same time.
Bit 2:
PV Description
0 Program-verify mode cleared (Initial value)
1 Transition to program-verify mode
[Setting condition]
When FWE = 1 and SWE = 1
Bit 1—Erase (E): Selects erase mode transition or clearing. Do not set the SWE, ESU, PSU, EV,
PV, or P bit at the same time.
Bit 1:
E Description
0 Erase mode cleared (Initial value)
1 Transition to erase mode
[Setting condition]
When FWE = 1, SWE = 1, and ESU1 = 1
Bit 0—Program 1 (P1): Selects program mode transition or clearing. Do not set the SWE, PSU,
ESU, EV, PV, or E bit at the same time.
Bit 0:
P Description
0 Program mode cleared (Initial value)
1 Transition to program mode
[Setting condition]
When FWE = 1, SWE = 1, and PSU1 = 1
FLMCR2 is an 8-bit register that monitors the presence or absence of flash memory program/erase
protection (error protection). FLMCR2 is initialized to H'00 by a reset, and in hardware standby
mode.
Bit: 7 6 5 4 3 2 1 0
FLER — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit 7—Flash Memory Error (FLER): Indicates that an error has occurred during an operation on
flash memory (programming or erasing). When FLER is set to 1, flash memory goes to the error-
protection state.
Bit 7:
FLER Description
0 Flash memory is operating normally. (Initial value)
Flash memory program/erase protection (error protection) is disabled.
[Clearing condition]
Reset or hardware standby mode
1 An error has occurred during flash memory programming/erasing.
Flash memory program/erase protection (error protection) is enabled.
[Setting condition]
See section 18.8.3, Error Protection.
EBR1 is an 8-bit readable/writable register that specifies the flash memory erase area block by
block. EBR1 is initialized to H'00 by a reset, in hardware standby mode and software standby
mode, when a low level is input to the FWE pin, and when a high level is input to the FWE pin
and the SWE bit in FLMCR1 is not set. When a bit in EBR1 is set to 1, the corresponding block
can be erased. Other blocks are erase-protected. Set only one bit in EBR1 (more than one bit
cannot be set). When on-chip flash memory is disabled, a read will return H'00, and writes are
invalid.
Bit: 7 6 5 4 3 2 1 0
EB7 EB6 EB5 EB4 EB3 EB2 EB1 EB0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
RAMER specifies the area of flash memory to be overlapped with part of RAM when emulating
real-time flash memory programming. RAMER is initialized to H'0000 by a reset and in hardware
standby mode. It is not initialized in software standby mode. RAMER settings should be made in
user mode or user program mode. (For details, see the description of the BSC.)
Flash memory area divisions are shown in table 18.4. To ensure correct operation of the emulation
function, the ROM for which RAM emulation is performed should not be accessed immediately
after this register has been modified. Normal execution of an access immediately after register
modification is not guaranteed.
Bit: 15 14 13 12 11 10 9 8
— — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
— — — — — RAMS RAM1 RAM0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R/W R/W R/W
Bit 2—RAM Select (RAMS): Specifies selection or non-selection of flash memory emulation in
RAM. When RAMS = 1, all flash memory block are program/erase-protected.
Bit 2:
RAMS Description
0 Emulation not selected (Initial value)
Program/erase-protection of all flash memory blocks is disabled
1 Emulation selected
Program/erase-protection of all flash memory blocks is enabled
Bits 1 and 0—Flash Memory Area Selection (RAM1, RAM0): These bits are used together
with bit 2 to select the flash memory area to be overlapped with RAM. (See table 18.4.)
When boot mode is used, the flash memory programming control program must be prepared in the
host beforehand. The SCI to be used is set to channel asynchronous mode.
When a reset-start is executed after the SH7050 pins have been set to boot mode, the boot program
built into the SH7050 is started and the programming control program prepared in the host is
serially transmitted to the SH7050 via the channel 1 SCI. In the SH7050, the programming control
program received via the channel 1 SCI is written into the programming control program area in
on-chip RAM. After the transfer is completed, control branches to the start address of the
programming control program area and the programming control program execution state is
entered (flash memory programming is performed).
The transferred programming control program must therefore include coding that follows the
programming algorithm given later.
The system configuration in boot mode is shown in figure 18.3, and the boot mode execution
procedure in figure 18.4.
SH7050
Flash memory
Start
No
n = N?
Yes
End of transmission
Note: If a memory cell does not operate normally and cannot be erased, one H'FF byte is
transmitted as an erase error, and the erase operation and subsequent operations
are halted.
Start Stop
D0 D1 D2 D3 D4 D5 D6 D7
bit bit
When boot mode is initiated, the SH7050 measures the low period of the asynchronous SCI
communication data (H'00) transmitted continuously from the host. The SCI transmit/receive
format should be set as follows: 8-bit data, 1 stop bit, no parity. The SH7050 calculates the bit rate
of the transmission from the host from the measured low period, and transmits one H'00 byte to
the host to indicate the end of bit rate adjustment. The host should confirm that this adjustment
end indication (H'00) has been received normally, and transmit one H'55 byte to the SH7050. If
reception cannot be performed normally, initiate boot mode again (reset), and repeat the above
operations. Depending on the host’s transmission bit rate and the SH7050’s system clock
frequency, there will be a discrepancy between the bit rates of the host and the SH7050. To ensure
correct SCI operation, the host’s transfer bit rate should be set to 4800bps, 9600bps.
Table 18.6 shows host transfer bit rates and system clock frequencies for which automatic
adjustment of the SH7050 bit rate is possible. The boot program should be executed within this
system clock range.
Table 18.6 System Clock Frequencies for which Automatic Adjustment of SH7050 Bit Rate
is Possible
On-Chip RAM Area Divisions in Boot Mode: In boot mode, the RAM area is divided into an
area used by the boot program and an area to which the programming control program is
transferred via the SCI, as shown in figure 18.5. The boot program area cannot be used until the
execution state in boot mode switches to the programming control program transferred from the
host.
H'FFFFE800
Boot program area
( 2 kbytes)
H'FFFFEFFF
Programming
control program area
(4 kbytes)
H'FFFFFFFF
Note: The boot program area cannot be used until a transition is made to the execution state for
the programming control program transferred to RAM. Note also that the boot program
remains in this area of the on-chip RAM even after control branches to the programming
control program.
After setting FWE, the user should branch to, and execute, the previously prepared
programming/erase control program.
As the flash memory itself cannot be read while flash memory programming/erasing is being
executed, the control program that performs programming and erasing should be run in on-chip
RAM or external memory.
Use the following procedure (figure 18.6) to execute the programming control program that writes
to flash memory (when transferred to RAM).
FWE = 1
2
(user program mode)
Transfer programming/erase
3
control program to RAM
Execute programming/
4 erase control program in RAM
(flash memory rewriting)
Note: When programming and erasing, start the watchdog timer so that measures can be taken to
prevent program runaway, etc. Memory cells may not operate normally if
overprogrammed or overerased due to program runaway.
The flash memory cannot be read while being programmed or erased. Therefore, the program
(programming control program) that controls flash memory programming/erasing should be
located and executed in on-chip RAM or external memory.
Notes: 1. Operation is not guaranteed if setting/resetting of the SWE, ESU, PSU, EV, PV, E, and
P bits in FLMCR1 is executed by a program in flash memory.
2. When programming or erasing, set FWE to 1 (programming/erasing will not be
executed if FWE = 0).
3. Programming should be performed in the erased state. Do not perform additional
programming on previously programmed addresses.
Follow the procedure shown in the program/program-verify flowchart in figure 18.7 to write data
or programs to flash memory. Performing program operations according to this flowchart will
enable data or programs to be written to flash memory without subjecting the device to voltage
stress or sacrificing program data reliability. Programming should be carried out 32 bytes at a
time.
Following the elapse of 10 µs or more after the SWE bit is set to 1 in flash memory control
register 1 (FLMCR1), 32-byte program data is stored in the program data area and reprogram data
area, and the 32-byte data in the program data area in RAM is written consecutively to the
program address (the lower 8 bits of the first address written to must be H'00, H'20, H'40, H'60,
H'80, H'A0, H'C0, or H'E0). Thirty-two consecutive byte data transfers are performed. The
program address and program data are latched in the flash memory. A 32-byte data transfer must
be performed even if writing fewer than 32 bytes; in this case, H'FF data must be written to the
extra addresses.
Next, the watchdog timer is set to prevent overprogramming in the event of program runaway, etc.
Set 6.6 ms as the WDT overflow period. After this, preparation for program mode (program setup)
is carried out by setting the PSU bit in FLMCR1, and after the elapse of 50 µs or more, the
operating mode is switched to program mode by setting the P bit in FLMCR1. The time during
which the P bit is set is the flash memory programming time. Use a fixed 500 µs pulse for the
write time.
In program-verify mode, the data written in program mode is read to check whether it has been
correctly written in the flash memory.
After the elapse of a given programming time, the programming mode is exited (the P bit in
FLMCR1 is cleared, then the PSUn bit is cleared at least 10 µs later). The watchdog timer is
cleared after the elapse of 10 µs or more, and the operating mode is switched to program-verify
mode by setting the PV bit in FLMCR1. Before reading in program-verify mode, a dummy write
of H'FF data should be made to the addresses to be read. The dummy write should be executed
after the elapse of 4 µs or more. When the flash memory is read in this state (verify data is read in
32-bit units), the data at the latched address is read. Wait at least 2 µs after the dummy write
before performing this read operation. Next, the written data is compared with the verify data, and
reprogram data is computed (see figure 18.7) and transferred to the reprogram data area. After 32
bytes of data have been verified, exit program-verify mode, wait for at least 4 µs, then clear the
SWE bit in FLMCR1. If reprogramming is necessary, set program mode again, and repeat the
program/program-verify sequence as before. However, ensure that the program/program-verify
sequence is not repeated more than 400 times on the same bits.
Start
Data writes must be performed in the memory-
Set SWE-bit of FLMCR1 erased state. Do not write additional data to an
address to which data is already written.
Wait 10 µs
n=1
m=0
Enable WDT
Wait 50 µs
Wait 500 µs
Wait 10 µs
Wait 10 µs
Disable WDT
Wait 4 µs
Wait 2 µs
Increment address
NG
Write data= Verify data?
OK m=1
*4
Transfer rewrite data to rewrite data area
32 byte data
NG verify complete?
OK
Clear PV-bit of FLMCR1
RAM Wait 4 µs
Write data storage area
(32 byte) NG NG
m = 0? n ≥ 400?
Rewrite data storage area OK OK
(32 byte) Clear SWE bit of FLMCR1 Clear SWE bit of FLMCR1
Notes: 1. Transfer data in a byte unit. The lower eight bits of the start address to which data is written must be H'00, H'20, H'40, H'60, H'80, H'A0, H'C0, or
H'E0. Transfer 32-byte data even when writing fewer than 32 bytes. In this case, Set H'FF in unused addresses.
2. Read verify data in logword form (32 bits).
3. Even for bits to which data is already written, an additional write should be performed if their verify result is NG.
4. The write data storage area (32 bytes) and rewrite data storage area (32 bytes) must be located in RAM. The contents of the rewrite data storage
area are rewritten as writing progresses.
Source data (D) Verify data (V) Rewrite data (X) Description
0 0 1 Rewrite should not be performed to bits already written to.
0 1 0 Write is incomplete; rewrite should be performed.
1 0 1 —
1 1 1 Left in the erased state.
To perform data or program erasure, set the 1 bit flash memory area to be erased in erase block
register 1 (EBR1) at least 10 µs after setting the SWE bit to 1 in flash memory control register 1
(FLMCR1). Next, the watchdog timer is set to prevent overerasing in the event of program
runaway, etc. Set 6.6 ms as the WDT overflow period. After this, preparation for erase mode
(erase setup) is carried out by setting the ESU bit in FLMCR1, and after the elapse of 200 µs or
more, the operating mode is switched to erase mode by setting the E bit in FLMCR1. The time
during which the E bit is set is the flash memory erase time. Ensure that the erase time does not
exceed 5 ms.
Note: With flash memory erasing, preprogramming (setting all memory data in the memory to
be erased to all “0”) is not necessary before starting the erase procedure.
In erase-verify mode, data is read after memory has been erased to check whether it has been
correctly erased.
After the elapse of the erase time, erase mode is exited (the E bit in FLMCR1 is cleared, then the
ESU bit is cleared at least 10 µs later), the watchdog timer is cleared after the elapse of 10 µs or
more, and the operating mode is switched to erase-verify mode by setting the EV bit in FLMCR1.
Before reading in erase-verify mode, a dummy write of H'FF data should be made to the addresses
to be read. The dummy write should be executed after the elapse of 20 µs or more. When the flash
memory is read in this state (verify data is read in 32-bit units), the data at the latched address is
read. Wait at least 2 µs after the dummy write before performing this read operation. If the read
data has been erased (all “1”), a dummy write is performed to the next address, and erase-verify is
performed. If the read data has not been erased, set erase mode again, and repeat the erase/erase-
verify sequence in the same way. However, ensure that the erase/erase-verify sequence is not
repeated more than 60 times. When verification is completed, exit erase-verify mode, and wait for
at least 5 µs. If erasure has been completed on all the erase blocks, clear the SWE bit in FLMCR1.
If there are any unerased blocks, set 1 bit for the flash memory area to be erased, and repeat the
erase/erase-verify sequence in the same way.
Start *1
Wait 10 µs
n=1
Set EBR1 *3
WDT Enable
Wait 200 µs
Wait 5ms
Wait 10 µs
Wait 10 µs
WDT Disable
Wait 20 µs
n←n+1
Wait 2 µs
Wait 5 µs Wait 5 µs
*4 All
NG NG
objective blocks n ≥ 61?
erased?
OK OK
Clear SWE-bit in FLMCR1 Clear SWE-bit of FLMCR1
Notes: 1. Preprogramming (setting erase block data to all “0”) is not necessary.
2. Verify data is read in 32-bit (longword) units.
3. Set only one bit in EBR1. More than one bit cannot be set.
4. Erasing is performed in block units. To erase a number of blocks, each block must be erased in turn.
18.8 Protection
There are two kinds of flash memory program/erase protection, hardware protection and software
protection.
Functions
Item Description Program Erase
FWE pin protection • When a low level is input to the FWE pin, Yes Yes
FLMCR1 and EBR1 are initialized, and the
program/erase-protected state is entered.
Reset/standby • In a reset (including a WDT overflow Yes Yes
protection reset) and in standby mode, FLMCR1 and
EBR1 are initialized, and the
program/erase-protected state is entered.
• In a reset via the RES pin, the reset state
is not entered unless the RES pin is held
low until oscillation stabilizes after
powering on. In the case of a reset during
operation, hold the RES pin low for the
RES pulse width specified in the AC
Characteristics section.
Software protection can be implemented by setting erase block register 1 (EBR1) and the RAMS
bit in the RAM emulation register (RAMER). When software protection is in effect, setting the P
or E bit in flash memory control register 1 (FLMCR1) does not cause a transition to program
mode or erase mode. (See table 18.8.)
Functions
Item Description Program Erase
SWE pin protection • Clearing the SWE bit to 0 in FLMCR1 sets Yes Yes
the program/erase-protected state for all
blocks.
• (Execute in on-chip RAM or external
memory.)
Block specification • Erase protection can be set for individual — Yes
protection blocks by settings in erase block register 1
(EBR1).
• Setting EBR1 to H'00 places all blocks in
the erase-protected state.
Emulation protection • Setting the RAMS bit to 1 in the RAM Yes Yes
emulation register (RAMER) places all
blocks in the program/erase-protected
state.
In error protection, an error is detected when SH7050 runaway occurs during flash memory
programming/erasing, or operation is not performed in accordance with the program/erase
algorithm, and the program/erase operation is aborted. Aborting the program/erase operation
prevents damage to the flash memory due to overprogramming or overerasing.
If the SH7050 malfunctions during flash memory programming/erasing, the FLER bit is set to 1 in
FLMCR2 and the error protection state is entered. The FLMCR1 and EBR1 settings are retained,
but program mode or erase mode is aborted at the point at which the error occurred. Program
mode or erase mode cannot be re-entered by re-setting the P or E bit. However, PV and EV bit
setting is enabled, and a transition can be made to verify mode.
1. When flash memory is read during programming/erasing (including a vector read or instruction
fetch)
2. Immediately after exception handling (excluding a reset) during programming/erasing
3. When a SLEEP instruction (including software standby) is executed during
programming/erasing
4. When the bus is released during programming/erasing
RD VF PR ER FLER = 0 RD VF PR ER FLER = 0
RES = 0 or
Error occurrence HSTBY = 0 FLMCR1, EBR1
(software standby) initialization state
Error RES = 0 or
occurrence HSTBY = 0
RD VF PR ER FLER = 1 RD VF PR ER FLER = 1
Software standby
mode release
FLMCR1, EBR1
initialization state
Legend:
RD: Memory read possible RD: Memory read not possible
VF: Verify-read possible VF: Verify-read not possible
PR: Programming possible PR: Programming not possible
ER: Erasing possible ER: Erasing not possible
Set RAMER
No
Tuning OK?
Yes
Clear RAMER
H'000000
Flash memory
EB0 to EB3
H'FFFFE800
H'FFFFEBFF
On-chip RAM
1. Set bits RAMS, RAM1, and RAM0 in RAMER to 1, 0, 1, to overlap part of RAM onto the
area (EB4) for which real-time programming is required.
2. Real-time programming is performed using the overlapping RAM.
3. After the program data has been confirmed, the RAMS bit is cleared, releasing RAM overlap.
4. The data written in the overlapping RAM is written into the flash memory space (EB4).
Notes: 1. When the RAMS bit is set to 1, program/erase protection is enabled for all blocks
regardless of the value of RAM1 and RAM0 (emulation protection). In this state,
setting the P or E bit in flash memory control register 1 (FLMCR1) will not cause a
transition to program mode or erase mode. When actually programming a flash
memory area, the RAMS bit should be cleared to 0.
2. A RAM area cannot be erased by execution of software in accordance with the erase
algorithm while flash memory emulation in RAM is being used.
In programmer mode, set the mode pins to PLLx2 mode (see table 18.9) and input a 6 MHz input
clock, so that the SH7050 runs at 12 MHz.
Table 18.9 shows the pin settings for programmer mode. For the pin names in programmer mode,
see section 1.3.3, Pin Assignments.
Connect the socket adapter to the chip as shown in figure 18.13. This will enable conversion to a
32-pin arrangement. The on-chip ROM memory map is shown in figure 18.12, and the socket
adapter pin correspondence diagram in figure 18.13.
Addresses in Addresses in
MCU mode programmer mode
H'00000000 H'00000
H'0001FFFF H'1FFFF
Table 18.10 shows how the different operating modes are set when using programmer mode, and
table 18.11 lists the commands used in programmer mode. Details of each mode are given below.
Pin Names
Mode FWE CE OE WE D0–D7 A0–A17
Read H or L L L H Data output Ain
Output disable H or L L H H Hi-z X
Command write H or L L H L Data input *Ain
Chip disable H or L H X X Hi-z X
Notes: 1. Chip disable is not a standby state; internally, it is an operation state.
2. *Ain indicates that there is also address input in auto-program mode.
3. For command writes in auto-program and auto-erase modes, input a high level to the
FWE pin.
CE
OE
twep
tf tr
WE
tds tdh
I/O7–I/O0
Figure 18.14 Timing Waveforms for Memory Read after Memory Write
Table 18.13 AC Characteristics in Transition from Memory Read Mode to Another Mode
CE
OE
twep
tf tr
WE
tds tdh
I/O7–I/O0
Figure 18.15 Timing Waveforms in Transition from Memory Read Mode to Another Mode
CE VIL
OE VIL
1. In auto-program mode, 128 bytes are programmed simultaneously. This should be carried out
by executing 128 consecutive byte transfers.
2. A 128-byte data transfer is necessary even when programming fewer than 128 bytes. In this
case, H'FF data must be written to the extra addresses.
3. The lower 7 bits of the transfer address must be low. If a value other than an effective address
is input, processing will switch to a memory write operation but a write error will be flagged.
4. Memory address transfer is performed in the third cycle (figure 18.13). Do not perform transfer
after the second cycle.
5. Do not perform a command write during a programming operation.
6. Perform one auto-program operation for a 128-byte block for each address. Two or more
additional programming operations cannot be performed on a previously programmed address
block.
7. Confirm normal end of auto-programming by checking D6. Alternatively, status read mode
can also be used for this purpose (D7 status polling uses the auto-program operation end
identification pin).
8. Status polling D6 and D7 pin information is retained until the next command write. As long as
the next command write has not been performed, reading is possible by enabling CE and OE.
FWE
tpnh
Address
A16–A0 stable
tpns tces tceh tnxtc tnxtc
CE
OE twep
tf tr tas tah twsts tspa
WE
Data transfer
tds tdh twrite
1 to 128byte
FWE
tenh
A16–A0
tens tces tceh tnxtc tnxtc
CE
OE twep
tf tr tests tspa
WE
tds tdh terase
1. Status read mode is provided to specify the kind of abnormal end. Use this mode when an
abnormal end occurs in auto-program mode or auto-erase mode.
2. The return code is retained until a command write other than a status read mode command
write is executed.
A16–A0
tces tceh tnxtc tces tceh tnxtc tnxtc
CE
tce
OE twep twep
tf tr tf tr toe
WE
tdf
tds tdh tds tdh
I/O7–I/O0 H'71 H'71
1. D7 status polling is a flag that indicates the operating status in auto-program/auto-erase mode.
2. D6 status polling is a flag that indicates a normal or abnormal end in auto-program/auto-erase
mode.
During Internal
Pin Name Operation Abnormal End Normal End
D7 0 1 0 1
D6 0 0 1 1
D0–D5 0 0 0 0
Commands cannot be accepted during the oscillation stabilization period or the programmer mode
setup period. After the programmer mode setup time, a transition is made to memory read mode.
Memory read
mode Command wait state
Command Automatic write mode Normal/abnormal
wait state Automatic erase mode complete verify
tOSC1 tbmv tdwn
VCC
RES
FWE
Note : For the level of FWE input pin, set VIL when using other than the automatic write mode
and automatic erase mode.
1. When programming addresses which have previously been programmed, carry out auto-
erasing before auto-programming.
2. When performing programming using PROM mode on a chip that has been
programmed/erased in an on-board programming mode, auto-erasing is recommended before
carrying out auto-programming.
Notes: 1. The flash memory is initially in the erased state when the device is shipped by Renesas.
For other chips for which the erasure history is unknown, it is recommended that auto-
erasing be executed to check and supplement the initialization (erase) level.
2. Auto-programming should be performed once only on the same address block.
Additional programming cannot be performed on previously programmed address
blocks.
The values read from the internal registers for the flash ROM of the mask-ROM version and F-
ZTAT version differ as follows.
Status
Register Bit F-ZTAT Version Mask-ROM Version
FLMCR1 FWE 0: Application software running 0: Is not read out
1: Programming 1: Application software running
Note: This difference applies to all the F-ZTAT versions and all the mask-ROM versions that have
different ROM size.
19.1 Features
The SH7051 has 256 kbytes of on-chip flash memory. The features of the flash memory are
summarized below.
19.2 Overview
FLMCR1
FLMCR2 Operating FWE pin
Bus interface/controller
EBR1 mode Mode pin
EBR2
RAMER
Flash memory
(256 kB)
Legend:
FLMCR1: Flash memory control register 1
FLMCR2: Flash memory control register 2
EBR1: Erase block register 1
EBR2: Erase block register 2
RAMER: RAM emulation register
When the mode pins and the FWE pin are set in the reset state and a reset-start is executed, the
SH7050 enters one of the operating modes shown in figure 19.2. In user mode, flash memory can
be read but not programmed or erased.
Flash memory can be programmed and erased in boot mode, user program mode, and programmer
mode.
Boot mode
On-board programming mode
Notes: Only make a transition between user mode and user program mode when the CPU is
not accessing the flash memory.
1. RAM emulation possible
2. MD0 = 1, MD1 = 0, MD2 = 1, MD3 = 1
Boot Mode
SH7051 SH7051
SCI SCI
Boot program Boot program
New application
program
SH7051 SH7051
SCI SCI
Boot program Boot program
SH7051 SH7051
SCI SCI
Boot program Boot program
New application
program
SH7051 SH7051
SCI SCI
Boot program Boot program
Emulation should be performed in user mode or user program mode. When the emulation block
set in RAMER is accessed while the emulation function is being executed, data written in the
overlap RAM is read.
User Mode
SCI
Application program
Execution state
Emulation block
When overlap RAM data is confirmed, the RAMS bit is cleared, RAM overlap is released, and
writes should actually be performed to the flash memory.
When the programming control program is transferred to RAM, ensure that the transfer
destination and the overlap RAM do not overlap, as this will cause data in the overlap RAM to
be rewritten.
SCI
Overlap RAM
(programming data)
Programming control
program execution state
Application program
Programming data
The flash memory is divided into seven 32 kB blocks, one 28 kB blocks, and four 1 kB blocks.
Address H'00000
32 kB
32 kB
32 kB
32 kB
256 kB 32 kB
32 kB
32 kB
28 kB
1 kB
1 kB
1 kB
1 kB
Address H'3FFFF
FLMCR1 is an 8-bit register used for flash memory operating mode control. Program-verify mode
or erase-verify mode for addresses H'00000 to H'1FFFF is entered by setting SWE to 1 when FWE
= 1, then setting the EV1 or PV1 bit. Program mode for addresses H'00000 to H'1FFFF is entered
by setting SWE to 1 when FWE = 1, then setting the PSU1 bit, and finally setting the P1 bit. Erase
mode for addresses H'00000 to H'1FFFF is entered by setting SWE to 1 when FWE = 1, then
setting the ESU1 bit, and finally setting the E1 bit. FLMCR1 is initialized by a reset, and in
hardware standby mode and software standby mode. Its initial value is H'80 when a high level is
input to the FWE pin, and H'00 when a low level is input. When on-chip flash memory is disabled,
a read will return H'00, and writes are invalid.
Writes to bits SWE, ESU1, PSU1, EV1, and PV1 in FLMCR1 are enabled only when FWE = 1
and SWE = 1; writes to the E1 bit only when FWE = 1, SWE = 1, and ESU1 = 1; and writes to the
P1 bit only when FWE = 1, SWE = 1, and PSU1 = 1.
Bit: 7 6 5 4 3 2 1 0
FWE SWE ESU1 PSU1 EV1 PV1 E1 P1
Initial value: 1/0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/W R/W
Bit 7—Flash Write Enable Bit (FWE): Sets hardware protection against flash memory
programming/erasing.
Bit 7:
FWE Description
0 When a low level is input to the FWE pin (hardware-protected state)
1 When a high level is input to the FWE pin
Bit 6—Software Write Enable Bit (SWE): Enables or disables the flash memory. This bit should
be set when setting bits 5 to 0, FLMCR2 bits 5 to 0, EBR1 bits 3 to 0, and EBR2 bits 7 to 0.
Bit 6:
SWE Description
0 Writes disabled (Initial value)
1 Writes enabled
[Setting condition]
When FWE = 1
Bit 5—Erase Setup Bit 1 (ESU1): Prepares for a transition to erase mode (applicable addresses:
H'00000 to H'1FFFFF). Do not set the SWE, PSU1, EV1, PV1, E1, or P1 bit at the same time.
Bit 5:
ESU1 Description
0 Erase setup cleared (Initial value)
1 Erase setup
[Setting condition]
When FWE = 1 and SWE = 1
Bit 4—Program Setup Bit 1 (PSU1): Prepares for a transition to program mode (applicable
addresses: H'00000 to H'1FFFFF). Do not set the SWE, ESU1, EV1, PV1, E1, or P1 bit at the
same time.
Bit 4:
PSU1 Description
0 Program setup cleared (Initial value)
1 Program setup
[Setting condition]
When FWE = 1 and SWE = 1
Bit 3:
EV1 Description
0 Erase-verify mode cleared (Initial value)
1 Transition to erase-verify mode
[Setting condition]
When FWE = 1 and SWE = 1
Bit 2:
PV1 Description
0 Program-verify mode cleared (Initial value)
1 Transition to program-verify mode
[Setting condition]
When FWE = 1 and SWE = 1
Bit 1—Erase 1 (E1): Selects erase mode transition or clearing (applicable addresses: H'00000 to
H'1FFFFF). Do not set the SWE, ESU1, PSU1, EV1, PV1, or P1 bit at the same time.
Bit 1:
E1 Description
0 Erase mode cleared (Initial value)
1 Transition to erase mode
[Setting condition]
When FWE = 1, SWE = 1, and ESU1 = 1
Bit 0—Program 1 (P1): Selects program mode transition or clearing (applicable addresses:
H'00000 to H'1FFFFF). Do not set the SWE, PSU1, ESU1, EV1, PV1, or E1 bit at the same time.
Bit 0:
P1 Description
0 Program mode cleared (Initial value)
1 Transition to program mode
[Setting condition]
When FWE = 1, SWE = 1, and PSU1 = 1
FLMCR2 is an 8-bit register used for flash memory operating mode control. Program-verify mode
or erase-verify mode for addresses H'20000 to H'3FFFF is entered by setting SWE (FLMCR1) to
1 when FWE (FLMCR1) = 1, then setting the EV2 or PV2 bit. Program mode for addresses
H'20000 to H'3FFFF is entered by setting SWE (FLMCR1) to 1 when FWE (FLMCR1) = 1, then
setting the PSU2 bit, and finally setting the P2 bit. Erase mode for addresses H'20000 to H'3FFFF
is entered by setting SWE (FLMCR1) to 1 when FWE (FLMCR1) = 1, then setting the ESU2 bit,
and finally setting the E2 bit. FLMCR2 is initialized to H'00 by a reset, in hardware standby mode
and software standby mode, when a low level is input to the FWE pin, and when a high level is
input to the FWE pin and the SWE bit in FLMCR1 is not set (the exception is the FLER bit, which
is initialized only by a reset and in hardware standby mode). When on-chip flash memory is
disabled, a read will return H'00, and writes are invalid.
Writes to bits SWE, ESU2, PSU2, EV2, and PV2 in FLMCR2 are enabled only when FWE
(FLMCR1) = 1 and SWE (FLMCR1) = 1; writes to the E2 bit only when FWE (FLMCR1) = 1,
SWE (FLMCR1) = 1, and ESU2 = 1; and writes to the P2 bit only when FWE (FLMCR1) = 1,
SWE (FLMCR1) = 1, and PSU2 = 1.
Bit: 7 6 5 4 3 2 1 0
FLER — ESU2 PSU2 EV2 PV2 E2 P2
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R/W R/W R/W R/W R/W R/W
Bit 7—Flash Memory Error (FLER): Indicates that an error has occurred during an operation on
flash memory (programming or erasing). When FLER is set to 1, flash memory goes to the error-
protection state.
Bit 7:
FLER Description
0 Flash memory is operating normally. (Initial value)
Flash memory program/erase protection (error protection) is disabled.
[Clearing condition]
Reset or hardware standby mode
1 An error has occurred during flash memory programming/erasing.
Flash memory program/erase protection (error protection) is enabled.
[Setting condition]
See section 19.8.3, Error Protection.
Bit 5—Erase Setup Bit 2 (ESU2): Prepares for a transition to erase mode (applicable addresses:
H'20000 to H'3FFFF). Do not set the PSU2, EV2, PV2, E2, or P2 bit at the same time.
Bit 5:
ESU2 Description
0 Erase setup cleared (Initial value)
1 Erase setup
[Setting condition]
When FWE = 1 and SWE = 1
Bit 4—Program Setup Bit 2 (PSU2): Prepares for a transition to program mode (applicable
addresses: H'20000 to H'3FFFF). Do not set the ESU2, EV2, PV2, E2, or P2 bit at the same time.
Bit 4:
PSU2 Description
0 Program setup cleared (Initial value)
1 Program setup
[Setting condition]
When FWE = 1 and SWE = 1
Bit 3:
EV2 Description
0 Erase-verify mode cleared (Initial value)
1 Transition to erase-verify mode
[Setting condition]
When FWE = 1 and SWE = 1
Bit 2:
PV2 Description
0 Program-verify mode cleared (Initial value)
1 Transition to program-verify mode
[Setting condition]
When FWE = 1 and SWE = 1
Bit 1—Erase 2 (E2): Selects erase mode transition or clearing (applicable addresses: H'20000 to
H'3FFFF). Do not set the ESU2, PSU2, EV2, PV2, or P2 bit at the same time.
Bit 1:
E2 Description
0 Erase mode cleared (Initial value)
1 Transition to erase mode
[Setting condition]
When FWE = 1, SWE = 1, and ESU2 = 1
Bit 0—Program 2 (P2): Selects program mode transition or clearing (applicable addresses:
H'20000 to H'3FFFF). Do not set the ESU2, PSU2, EV2, PV2, or E2 bit at the same time.
Bit 0:
P2 Description
0 Program mode cleared (Initial value)
1 Transition to program mode
[Setting condition]
When FWE = 1, SWE = 1, and PSU2 = 1
EBR1 is an 8-bit register that specifies the flash memory erase area block by block. EBR1 is
initialized to H'00 by a reset, in hardware standby mode and software standby mode, when a low
level is input to the FWE pin, and when a high level is input to the FWE pin and the SWE bit in
FLMCR1 is not set. When a bit in EBR1 is set to 1, the corresponding block can be erased. Other
blocks are erase-protected. Only one of the bits of EBR1 and EBR2 combined can be set. Do not
set more than one bit. When on-chip flash memory is disabled, a read will return H'00, and writes
are invalid.
Bit: 7 6 5 4 3 2 1 0
— — — — EB3 EB2 EB1 EB0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R/W R/W R/W R/W
EBR2 is an 8-bit register that specifies the flash memory erase area block by block. EBR2 is
initialized to H'00 by a reset, in hardware standby mode and software standby mode, when a low
level is input to the FWE pin, and when a high level is input to the FWE pin and the SWE bit in
FLMCR1 is not set. When a bit in EBR2 is set to 1, the corresponding block can be erased. Other
blocks are erase-protected. Only one of the bits of EBR1 and EBR2 combined can be set. Do not
set more than one bit. When on-chip flash memory is disabled, a read will return H'00, and writes
are invalid.
Bit: 7 6 5 4 3 2 1 0
EB11 EB10 EB9 EB8 EB7 EB6 EB5 EB4
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
RAMER specifies the area of flash memory to be overlapped with part of RAM when emulating
real-time flash memory programming. RAMER is initialized to H'0000 by a reset and in hardware
standby mode. It is not initialized in software standby mode. RAMER settings should be made in
user mode or user program mode. (For details, see the description of the BSC.)
Flash memory area divisions are shown in table 19.4. To ensure correct operation of the emulation
function, the ROM for which RAM emulation is performed should not be accessed immediately
after this register has been modified. Normal execution of an access immediately after register
modification is not guaranteed.
Bit: 15 14 13 12 11 10 9 8
— — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
— — — — — RAMS RAM1 RAM0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R/W R/W R/W
Bit 2—RAM Select (RAMS): Specifies selection or non-selection of flash memory emulation in
RAM. When RAMS = 1, all flash memory block are program/erase-protected.
Bit 2:
RAMS Description
0 Emulation not selected (Initial value)
Program/erase-protection of all flash memory blocks is disabled
1 Emulation selected
Program/erase-protection of all flash memory blocks is enabled
Bits 1 and 0—Flash Memory Area Selection (RAM1, RAM0): These bits are used together
with bit 2 to select the flash memory area to be overlapped with RAM. (See table 19.4.)
When boot mode is used, the flash memory programming control program must be prepared in the
host beforehand. The SCI to be used is set to channel asynchronous mode.
When a reset-start is executed after the SH7051 pins have been set to boot mode, the boot program
built into the SH7051 is started and the programming control program prepared in the host is
serially transmitted to the SH7051 via the channel 1 SCI. In the SH7051, the programming control
program received via the channel 1 SCI is written into the programming control program area in
on-chip RAM. After the transfer is completed, control branches to the start address of the
programming control program area and the programming control program execution state is
entered (flash memory programming is performed).
The transferred programming control program must therefore include coding that follows the
programming algorithm given later.
The system configuration in boot mode is shown in figure 19.3, and the boot mode execution
procedure in figure 19.4.
SH7051
Flash memory
Start
No
n = N?
Yes
End of transmission
Note: If a memory cell does not operate normally and cannot be erased, one H'FF byte is
transmitted as an erase error, and the erase operation and subsequent operations
are halted.
Start Stop
D0 D1 D2 D3 D4 D5 D6 D7
bit bit
When boot mode is initiated, the SH7051 measures the low period of the asynchronous SCI
communication data (H'00) transmitted continuously from the host. The SCI transmit/receive
format should be set as follows: 8-bit data, 1 stop bit, no parity. The SH7051 calculates the bit rate
of the transmission from the host from the measured low period, and transmits one H'00 byte to
the host to indicate the end of bit rate adjustment. The host should confirm that this adjustment
end indication (H'00) has been received normally, and transmit one H'55 byte to the SH7051. If
reception cannot be performed normally, initiate boot mode again (reset), and repeat the above
operations. Depending on the host’s transmission bit rate and the SH7051’s system clock
frequency, there will be a discrepancy between the bit rates of the host and the SH7051. To ensure
correct SCI operation, the host’s transfer bit rate should be set to 4800bps, 9600bps.
Table 19.6 shows host transfer bit rates and system clock frequencies for which automatic
adjustment of the SH7051 bit rate is possible. The boot program should be executed within this
system clock range.
Table 19.6 System Clock Frequencies for which Automatic Adjustment of SH7051 Bit Rate
is Possible
On-Chip RAM Area Divisions in Boot Mode: In boot mode, the RAM area is divided into an
area used by the boot program and an area to which the programming control program is
transferred via the SCI, as shown in figure 19.5. The boot program area cannot be used until the
execution state in boot mode switches to the programming control program transferred from the
host.
H'FFFFD800
Boot program area
( 2 kbytes)
H'FFFFDFFF
Programming
control program area
(8 kbytes)
H'FFFFFFFF
Note: The boot program area cannot be used until a transition is made to the execution state for
the programming control program transferred to RAM. Note also that the boot program
remains in this area of the on-chip RAM even after control branches to the programming
control program.
After setting FWE, the user should branch to, and execute, the previously prepared
programming/erase control program.
As the flash memory itself cannot be read while flash memory programming/erasing is being
executed, the control program that performs programming and erasing should be run in on-chip
RAM or external memory.
Use the following procedure (figure 19.6) to execute the programming control program that writes
to flash memory (when transferred to RAM).
FWE = 1
2
(user program mode)
Transfer programming/erase
3
control program to RAM
Execute programming/
4 erase control program in RAM
(flash memory rewriting)
Note: When programming and erasing, start the watchdog timer so that measures can be taken to
prevent program runaway, etc. Memory cells may not operate normally if
overprogrammed or overerased due to program runaway.
The flash memory cannot be read while being programmed or erased. Therefore, the program
(programming control program) that controls flash memory programming/erasing should be
located and executed in on-chip RAM or external memory.
Notes: 1. Operation is not guaranteed if setting/resetting of the SWE, ESU1, PSU1, EV1, PV1,
E1, and P1 bits in FLMCR1, or the ESU2, PSU2, EV2, PV2, E2, and P2 bits in
FLMCR2, is executed by a program in flash memory.
2. When programming or erasing, set FWE to 1 (programming/erasing will not be
executed if FWE = 0).
3. Programming should be performed in the erased state. Do not perform additional
programming on previously programmed addresses.
4. Do not program addresses H'00000 to H'1FFFF and H'20000 to H'3FFFF
simultaneously. Operation is not guaranteed if this is done.
When writing data or programs to flash memory, the program/program-verify flowchart shown in
figure 19.7 should be followed. Performing program operations according to this flowchart will
enable data or programs to be written to flash memory without subjecting the device to voltage
stress or sacrificing program data reliability. Programming should be carried out 32 bytes at a
time.
Following the elapse of 10 µs or more after the SWE bit is set to 1 in flash memory control
register 1 (FLMCR1), 32-byte program data is stored in the program data area and reprogram data
area, and the 32-byte data in the program data area in RAM is written consecutively to the
program address (the lower 8 bits of the first address written to must be H'00, H'20, H'40, H'60,
H'80, H'A0, H'C0, or H'E0). Thirty-two consecutive byte data transfers are performed. The
program address and program data are latched in the flash memory. A 32-byte data transfer must
be performed even if writing fewer than 32 bytes; in this case, H'FF data must be written to the
extra addresses.
Next, the watchdog timer is set to prevent overprogramming in the event of program runaway, etc.
Set 6.6 ms as the WDT overflow period. After this, preparation for program mode (program setup)
is carried out by setting the PSUn bit in FLMCRn, and after the elapse of 50 µs or more, the
operating mode is switched to program mode by setting the Pn bit in FLMCRn. The time during
which the Pn bit is set is the flash memory programming time. Use a fixed 500 µs pulse for the
write time.
In program-verify mode, the data written in program mode is read to check whether it has been
correctly written in the flash memory.
After the elapse of a given programming time, the programming mode is exited (the Pn bit in
FLMCRn is cleared, then the PSUn bit is cleared at least 10 µs later). The watchdog timer is
cleared after the elapse of 10 µs or more, and the operating mode is switched to program-verify
mode by setting the PVn bit in FLMCRn. Before reading in program-verify mode, a dummy write
of H'FF data should be made to the addresses to be read. The dummy write should be executed
after the elapse of 4 µs or more. When the flash memory is read in this state (verify data is read in
32-bit units), the data at the latched address is read. Wait at least 2 µs after the dummy write
before performing this read operation. Next, the written data is compared with the verify data, and
reprogram data is computed (see figure 19.7) and transferred to the reprogram data area. After 32
bytes of data have been verified, exit program-verify mode, wait for at least 4 µs, then clear the
SWE bit in FLMCR1. If reprogramming is necessary, set program mode again, and repeat the
program/program-verify sequence as before. However, ensure that the program/program-verify
sequence is not repeated more than 400 times on the same bits.
Start
Data writes must be performed in the memory-
Set SWE-bit of FLMCR1 erased state. Do not write additional data to an
address to which data is already written.
Wait 10 µs
n=1
m=0
Enable WDT
Wait 50 µs
Wait 500 µs
Wait 10 µs
Wait 10 µs
Disable WDT
Wait 4 µs
Wait 2 µs
Increment address
NG
Write data= Verify data?
OK m=1
*4
Transfer rewrite data to rewrite data area
32 byte data
NG verify complete?
OK
Clear PV1 (2) bit of FLMCR1 (2)
RAM
Wait 4 µs
Write data storage area
(32 byte) NG NG
m = 0? n ≥ 400?
OK OK
Rewrite data storage area
(32 byte) Clear SWE bit om FLMCR1 Clear SWE bit in FLMCR1
Notes: 1. Transfer data in a byte unit. The lower eight bits of the start address to which data is written must be H'00, H'20, H'40, H'60, H'80, H'A0, H'C0, or H'E0.
Transfer 32-byte data even when writing fewer than 32 bytes. In this case, Set H'FF in unused addresses.
2. Read verify data in logword form (32 bits).
3. Even for bits to which data is already written, an additional write should be performed if their verify result is NG.
4. The write data storage area (32 bytes) and rewrite data storage area (32 bytes) must be located in RAM. The contents of the rewrite data storage area are
rewritten as writing progresses.
Source data (D) Verify data (V) Rewrite data (X) Description
0 0 1 Rewrite should not be performed to bits already written to.
0 1 0 Write is incomplete; rewrite should be performed.
1 0 1 —
1 1 1 Left in the erased state.
19.7.3 Erase Mode (n = 1 for Addresses H'0000 to H'1FFFF, n = 2 for Addresses H'20000
to H'3FFFF)
When erasing flash memory, the erase/erase-verify flowchart shown in figure 19.8 should be
followed.
To perform data or program erasure, set the flash memory area to be erased in erase block register
n (EBRn) at least 10 µs after setting the SWE bit to 1 in flash memory control register 1
(FLMCR1). Next, the watchdog timer is set to prevent overerasing in the event of program
runaway, etc. Set 6.6 ms as the WDT overflow period. After this, preparation for erase mode
(erase setup) is carried out by setting the ESUn bit in FLMCRn, and after the elapse of 200 µs or
more, the operating mode is switched to erase mode by setting the En bit in FLMCRn. The time
during which the En bit is set is the flash memory erase time. Ensure that the erase time does not
exceed 5 ms.
Note: With flash memory erasing, preprogramming (setting all memory data in the memory to
be erased to all “0”) is not necessary before starting the erase procedure.
In erase-verify mode, data is read after memory has been erased to check whether it has been
correctly erased.
After the elapse of a the erase time, erase mode is exited (the En bit in FLMCRn is cleared, then
the ESUn bit is cleared at least 10 µs later), the watchdog timer is cleared after the elapse of 10 µs
or more, and the operating mode is switched to erase-verify mode by setting the EVn bit in
FLMCRn. Before reading in erase-verify mode, a dummy write of H'FF data should be made to
the addresses to be read. The dummy write should be executed after the elapse of 20 µs or more.
When the flash memory is read in this state (verify data is read in 32-bit units), the data at the
latched address is read. Wait at least 2 µs after the dummy write before performing this read
operation. If the read data has been erased (all “1”), a dummy write is performed to the next
address, and erase-verify is performed. The erase-verify operation is carried out on all the erase
blocks; the erase block register bit for an erased block should be cleared to prevent excessive
application of the erase voltage. When verification is completed, exit erase-verify mode, and wait
for at least 5 µs. If erasure has been completed on all the erase blocks after completing erase-verify
operations on all these blocks, clear the SWE bit in FLMCR1. If there are any unerased blocks, set
erase mode again, and repeat the erase/erase-verify sequence as before. However, ensure that the
erase/erase-verify sequence is not repeated more than 60 times.
Start *1
Wait (10) µs
n=1
Set EBR1(2) *3
Enable WDT
Wait (200) µs
Wait (5) ms
Wait (10) µs
Wait (10) µs
Disable WDT
n←n+1
Set EV1(2) bit in FLMCR1(2)
Wait (20) µs
Wait (2) µs
*4 End of
NG NG
erasing of all erase n ≥ 61?
blocks?
OK OK
Clear SWE bit in FLMCR1 Clear SWE bit in FLMCR1
Notes: 1. Preprogramming (setting erase block data to all “0”) is not necessary.
2. Verify data is read in 32-bit (longword) units.
3. Set only one bit in EBR1(2). More than one bit cannot be set.
4. Erasing is performed in block units. To erase a number of blocks, each block must be erased in turn.
19.8 Protection
There are two kinds of flash memory program/erase protection, hardware protection and software
protection.
Functions
Item Description Program Erase
FWE pin protection • When a low level is input to the FWE pin, Yes Yes
FLMCR1, FLMCR2, EBR1, and EBR2 are
initialized, and the program/erase-
protected state is entered.
Reset/standby • In a reset (including a WDT overflow Yes Yes
protection reset) and in standby mode, FLMCR1,
FLMCR2, EBR1, and EBR2 are initialized,
and the program/erase-protected state is
entered.
• In a reset via the RES pin, the reset state
is not entered unless the RES pin is held
low until oscillation stabilizes after
powering on. In the case of a reset during
operation, hold the RES pin low for the
RES pulse width specified in the AC
Characteristics section.
Software protection can be implemented by setting erase block register 1 (EBR1), erase block
register 2 (EBR2), and the RAMS bit in the RAM emulation register (RAMER). When software
protection is in effect, setting the P1 or E1 bit in flash memory control register 1 (FLMCR1), or
the P2 or E2 bit in flash memory control register 2 (FLMCR2), does not cause a transition to
program mode or erase mode. (See table 19.8.)
Functions
Item Description Program Erase
SWE pin protection • Clearing the SWE bit to 0 in FLMCR1 sets Yes Yes
the program/erase-protected state for all
blocks.
• (Execute in on-chip RAM or external
memory.)
Block specification • Erase protection can be set for individual — Yes
protection blocks by settings in erase block register 1
(EBR1) and erase block register 2
(EBR2).
• Setting EBR1 and EBR2 to H'00 places all
blocks in the erase-protected state.
Emulation protection • Setting the RAMS bit to 1 in the RAM Yes Yes
emulation register (RAMER) places all
blocks in the program/erase-protected
state.
In error protection, an error is detected when SH7051 runaway occurs during flash memory
programming/erasing, or operation is not performed in accordance with the program/erase
algorithm, and the program/erase operation is aborted. Aborting the program/erase operation
prevents damage to the flash memory due to overprogramming or overerasing.
If the SH7051 malfunctions during flash memory programming/erasing, the FLER bit is set to 1 in
FLMCR2 and the error protection state is entered. The FLMCR1, FLMCR2, EBR1, and EBR2
settings are retained, but program mode or erase mode is aborted at the point at which the error
occurred. Program mode or erase mode cannot be re-entered by re-setting the P1, P2, E1, or E2
bit. However, PV1, PV2, EV1, and EV2 bit setting is enabled, and a transition can be made to
verify mode.
1. When flash memory is read during programming/erasing (including a vector read or instruction
fetch)
2. Immediately after exception handling (excluding a reset) during programming/erasing
3. When a SLEEP instruction (including software standby) is executed during
programming/erasing
4. When the bus is released during programming/erasing
RD VF PR ER FLER = 0 RD VF PR ER FLER = 0
RES = 0 or
Error occurrence
HSTBY = 0 FLMCR1, FLMCR2,
(software standby) EBR1, EBR2
Error RES = 0 or initialization state
occurrence HSTBY = 0
RD VF PR ER FLER = 1 RD VF PR ER FLER = 1
Software standby
mode release
FLMCR1, FLMCR2, EBR1,
EBR2 initialization state
Legend:
RD: Memory read possible RD: Memory read not possible
VF: Verify-read possible VF: Verify-read not possible
PR: Programming possible PR: Programming not possible
ER: Erasing possible ER: Erasing not possible
Set RAMER
No
Tuning OK?
Yes
Clear RAMER
H'000000
Flash memory
EB0 to EB7
H'FFFFD800
H'FFFFDBFF
On-chip RAM
1. Set bits RAMS, RAM1, and RAM0 in RAMER to 1, 0, 0, to overlap part of RAM onto the
area (EB8) for which real-time programming is required.
2. Real-time programming is performed using the overlapping RAM.
3. After the program data has been confirmed, the RAMS bit is cleared, releasing RAM overlap.
4. The data written in the overlapping RAM is written into the flash memory space (EB8).
Notes: 1. When the RAMS bit is set to 1, program/erase protection is enabled for all blocks
regardless of the value of RAM1 and RAM0 (emulation protection). In this state,
setting the P1 or E1 bit in flash memory control register 1 (FLMCR1), or the P2 or E2
bit in flash memory control register 2 (FLMCR2), will not cause a transition to
program mode or erase mode. When actually programming or erasing a flash memory
area, the RAMS bit should be cleared to 0.
2. A RAM area cannot be erased by execution of software in accordance with the erase
algorithm while flash memory emulation in RAM is being used.
In programmer mode, set the mode pins to PLLx2 mode (see table 19.9) and input a 6 MHz input
clock, so that the SH7051 runs at 12 MHz.
Table 19.9 shows the pin settings for programmer mode. For the pin names in programmer mode,
see section 1.3.3, Pin Assignments.
Connect the socket adapter to the chip as shown in figure 19.13. This will enable conversion to a
32-pin arrangement. The on-chip ROM memory map is shown in figure 19.12, and the socket
adapter pin correspondence diagram in figure 19.13.
Addresses in Addresses in
MCU mode programmer mode
H'00000000 H'00000
H'0003FFFF H'3FFFF
Table 19.10 shows how the different operating modes are set when using programmer mode, and
table 19.11 lists the commands used in programmer mode. Details of each mode are given below.
Pin Names
Mode FWE CE OE WE D0–D7 A0–A17
Read H or L L L H Data output Ain
Output disable H or L L H H Hi-z X
Command write H or L L H L Data input *Ain
Chip disable H or L H X X Hi-z X
Notes: 1. Chip disable is not a standby state; internally, it is an operation state.
2. *Ain indicates that there is also address input in auto-program mode.
3. For command writes in auto-program and auto-erase modes, input a high level to the
FWE pin.
CE
OE
twep
tf tr
WE
tds tdh
I/O7–I/O0
Figure 19.14 Timing Waveforms for Memory Read after Memory Write
Table 19.13 AC Characteristics in Transition from Memory Read Mode to Another Mode
CE
OE
twep
tf tr
WE
tds tdh
I/O7–I/O0
Figure 19.15 Timing Waveforms in Transition from Memory Read Mode to Another Mode
CE VIL
OE VIL
1. In auto-program mode, 128 bytes are programmed simultaneously. This should be carried out
by executing 128 consecutive byte transfers.
2. A 128-byte data transfer is necessary even when programming fewer than 128 bytes. In this
case, H'FF data must be written to the extra addresses.
3. The lower 7 bits of the transfer address must be low. If a value other than an effective address
is input, processing will switch to a memory write operation but a write error will be flagged.
4. Memory address transfer is performed in the third cycle (figure 18.13). Do not perform transfer
after the second cycle.
5. Do not perform a command write during a programming operation.
6. Perform one auto-program operation for a 128-byte block for each address. Two or more
additional programming operations cannot be performed on a previously programmed address
block.
7. Confirm normal end of auto-programming by checking D6. Alternatively, status read mode
can also be used for this purpose (D7 status polling uses the auto-program operation end
identification pin).
8. Status polling D6 and D7 pin information is retained until the next command write. As long as
the next command write has not been performed, reading is possible by enabling CE and OE.
FWE
tpnh
Address
A16–A0 stable
tpns tces tceh tnxtc tnxtc
CE
OE twep
tf tr tas tah twsts tspa
WE
Data transfer
tds tdh twrite
1 to 128byte
FWE
tenh
A16–A0
tens tces tceh tnxtc tnxtc
CE
OE twep
tf tr tests tspa
WE
tds tdh terase
1. Status read mode is provided to specify the kind of abnormal end. Use this mode when an
abnormal end occurs in auto-program mode or auto-erase mode.
2. The return code is retained until a command write other than a status read mode command
write is executed.
A16–A0
tces tceh tnxtc tces tceh tnxtc tnxtc
CE
tce
OE twep twep
tf tr tf tr toe
WE
1. D7 status polling is a flag that indicates the operating status in auto-program/auto-erase mode.
2. D6 status polling is a flag that indicates a normal or abnormal end in auto-program/auto-erase
mode.
During Internal
Pin Name Operation Abnormal End — Normal End
D7 0 1 0 1
D6 0 0 1 1
D0–D5 0 0 0 0
Commands cannot be accepted during the oscillation stabilization period or the programmer mode
setup period. After the programmer mode setup time, a transition is made to memory read mode.
Memory read
mode Command wait state
Command Automatic write mode Normal/abnormal
wait state Automatic erase mode complete verify
tOSC1 tbmv tdwn
VCC
RES
FWE
Note : For the level of FWE input pin, set VIL when using other than the automatic write mode
and automatic erase mode.
Figure 19.21 Oscillation Stabilization Time, Boot Program Transfer Time, and Power-
Down Sequence
1. When programming addresses which have previously been programmed, carry out auto-
erasing before auto-programming.
2. When performing programming using PROM mode on a chip that has been
programmed/erased in an on-board programming mode, auto-erasing is recommended before
carrying out auto-programming.
Notes: 1. The flash memory is initially in the erased state when the device is shipped by Renesas.
For other chips for which the erasure history is unknown, it is recommended that auto-
erasing be executed to check and supplement the initialization (erase) level.
2. Auto-programming should be performed once only on the same address block.
Additional programming cannot be performed on previously programmed address
blocks.
The values read from the internal registers for the flash ROM of the mask-ROM version and F-
ZTAT version differ as follows.
Status
Register Bit F-ZTAT Version Mask-ROM Version
FLMCR1 FWE 0: Application software running 0: Is not read out
1: Programming 1: Application software running
Note: This difference applies to all the F-ZTAT versions and all the mask-ROM versions that have
different ROM size.
Section 20 RAM
20.1 Overview
The SH7050 has 6 kbytes/the SH7051 has 10 kbytes of on-chip RAM. The on-chip RAM is linked
to the CPU and direct memory access controller (DMAC) with a 32-bit data bus (figure 20.1). The
CPU can access data in the on-chip RAM in 8, 16, or 32 bit widths. The DMAC can access 8 or 16
bit widths. On-chip RAM data can always be accessed in one state, making the RAM ideal for use
as a program area, stack area, or data area, which require high-speed access. The contents of the
on-chip RAM are held in both the sleep and software standby modes. When the RAME bit (see
below) is cleared to 0, the on-chip RAM contents are also held in hardware standby mode.
Memory area 0 addresses H'FFFFF800 to H'FFFFFFFF (SH7050) and H'FFFF0800 to
H'FFFFFFFF (SH7051) are allocated to the on-chip RAM.
SH7050
On-chip RAM
On-chip RAM
20.2 Operation
The on-chip RAM is controlled by means of the system control register (SYSCR).
When the RAME bit in SYSCR is set to 1, the on-chip RAM is enabled. Accesses to addresses
H'FFFFE800–H'FFFFFFFF (SH7050) and H'FFFFD800–H'FFFFFFFF (SH7051) are then directed
to the on-chip RAM.
When the RAME bit in SYSCR is cleared to 0, the on-chip RAM is not accessed. A read will
return an undefined value, and a write is invalid. If a transition is made to hardware standby mode
after the RAME bit in SYSCR is cleared to 0, the contents of the on-chip RAM are held.
For details of SYSCR, see 21.2.2, System Control Register (SYSCR), in section 21, Power-Down
State.
21.1 Overview
In the power-down state, the CPU functions are halted. This enables a great reduction in power
consumption.
Table 21.1 describes the transition conditions for entering the modes from the program execution
state as well as the CPU and peripheral function status in each mode and the procedures for
canceling each mode.
State
On-Chip
Entering CPU Peripheral I/O Canceling
Mode Procedure Clock CPU Registers Modules RAM Ports Procedure
Undefined Held* Initialized High-level
2
Hardware Low-level Halted Halted Halted
standby input at input at
HSTBY pin HSTBY pin,
executing
power-on
reset
Halt*
1
Software Execute Halt Halt Held Held Held or • NMI
standby SLEEP high interrupt
instruction impe- • Power-on
dance*
3
with SBY bit reset
set to 1 in
SBYCR
Sleep Execute Run Halt Held Run Held Held • Interrupt
SLEEP • DMAC
instruction address
with SBY bit error
set to 0 in
SBYCR • Power-on
reset
Notes: 1. SBYCR: standby control register. SBY: standby bit
2. Some bits within on-chip peripheral module registers are initialized by the standby
mode; some are not. Refer to table 21.3, Register States in the Standby Mode, in
section 21.4.1, Transition to Standby Mode. Also refer to the register descriptions for
each peripheral module.
3. The status of the I/O port in standby mode is set by the port high impedance bit (HIZ) of
the SBYCR. Refer to section 21.2, Standby Control Register (SBYCR). For pin status
other than for the I/O port, refer to Appendix B, Pin States.
Table 21.3 shows the register used for power-down state control.
The standby control register (SBYCR) is a read/write 8-bit register that sets the transition to
standby mode, and the port status in standby mode. The SBYCR is initialized to H'1F by reset.
Bit: 7 6 5 4 3 2 1 0
SSBY HIZ — — — — — —
Initial value: 0 0 0 1 1 1 1 1
R/W: R/W R/W R R R R R R
Bit 7—Standby (SSBY): Specifies transition to the standby mode. The SSBY bit cannot be set to
1 while the watchdog timer is running (when the timer enable bit (TME) of the WDT timer
control/status register (TCSR) is set to 1). To enter the standby mode, always halt the WDT by 0
clearing the TME bit, then set the SSBY bit.
Bit 6—Port High Impedance (HIZ): In the standby mode, this bit selects whether to set the I/O
port pin to high impedance or hold the pin status. The HIZ bit cannot be set to 1 when the TME bit
of the WDT timer control/status register (TCSR) is set to 1. When making the I/O port pin status
high impedance, always clear the TME bit to 0 before setting the HIZ bit.
Bits 5–0—Reserved: Bit 5 always reads as 0. Always write 0 to bit 5. Bits 4–0 always read as 1.
Always write 1 to these bits.
Bit: 7 6 5 4 3 2 1 0
— — — — — — — RAME
Initial value: 0 0 0 0 0 0 0 1
R/W: R R R R R R R R/W
The system control register (SYSCR) is an 8-bit readable/writable register that enables or disables
accesses to the on-chip RAM.
Bits 7 to 1—Reserved: These bits are always read as 0, and should only be written with 0.
Bit 0—RAME Enable (RAME): Selects enabling or disabling of the on-chip RAM. When
RAME is set to 1, on-chip RAM is enabled. When RAME is cleared to 0, on-chip RAM cannot be
accessed. In this case, a read or instruction fetch from on-chip RAM will return an undefined
value, and a write to on-chip RAM will be ignored. The initial value of RAME is 1.
When on-chip RAM is disabled by clearing RAME to 0, do not place an instruction that attempts
to access on-chip RAM immediately after the SYSCR write instruction, as normal access cannot
be guaranteed in this case.
When on-chip RAM is enabled by setting RAME to 1, place an SYSCR read instruction
immediately after the SYSCR write instruction. Normal access cannot be guaranteed if an on-chip
RAM access instruction is placed immediately after the SYSCR write instruction.
The chip enters hardware standby mode when the HSTBY pin goes low. Hardware standby mode
reduces power consumption drastically by halting all chip functions. As the transition to hardware
standby mode is made by means of external pin input, the transition is made asynchronously,
regardless of the current state of the chip, and therefore the chip state prior to the transition is not
preserved. However, on-chip RAM data is retained as long as the specified voltage is supplied. To
retain on-chip RAM data, clear the RAM enable bit (RAME) to 0 in the system control register
(SYSCR) before driving the HSTBY pin low. See “Pin States” for the pin states in hardware
standby mode.
Hardware standby mode is exited by means of the HSTBY pin and RES pin. When HSTBY is
driven high while RES is low, the clock oscillator starts running. The RES pin should be held low
long enough for clock oscillation to stabilize. When RES is driven high, power-on reset exception
handling is started and a transition is made to the program execution state.
Figure 21.1 shows sample pin timings for hardware standby mode. A transition to hardware
standby mode is made by driving the HSTBY pin low after driving the RES pin low. Hardware
standby mode is exited by driving HSTBY high, waiting for clock oscillation to stabilize, then
switching RES from low to high.
Oscillator
RES
HSTBY
To enter the standby mode, set the SBY bit to 1 in SBYCR, then execute the SLEEP instruction.
The LSI moves from the program execution state to the standby mode. In the standby mode,
power consumption is greatly reduced by halting not only the CPU, but the clock and on-chip
peripheral modules as well. CPU register contents and on-chip RAM data are held as long as the
prescribed voltages are applied (when the RAME bit in SYSCR is 0). The register contents of
some on-chip peripheral modules are initialized, but some are not (table 21.4). The I/O port status
can be selected as held or high impedance by the port high impedance bit (HIZ) of the SBYCR.
For pin status other than for the I/O port, refer to Appendix B, Pin States.
The standby mode is canceled by an NMI interrupt, a power-on reset, or a manual reset.
Cancellation by an NMI: Clock oscillation starts when a rising edge or falling edge (selected by
the NMI edge select bit (NMIE) of the interrupt control register (ICR) of the INTC) is detected in
the NMI signal. This clock is supplied only to the watchdog timer. A WDT overflow occurs if the
time established by the clock select bits (CKS2–CKS0) in the TCSR of the WDT elapses before
transition to the standby mode. The occurrence of this overflow is used to indicate that the clock
has stabilized, so the clock is supplied to the entire chip, the standby mode is canceled, and NMI
exception processing begins.
When canceling standby mode with NMI interrupts, set the CKS2–CKS0 bits so that the WDT
overflow period is longer than the oscillation stabilization time.
When canceling standby mode with an NMI pin set for falling edge, be sure that the NMI pin level
upon entering standby (when the clock is halted) is high level, and that the NMI pin level upon
returning from standby (when the clock starts after oscillation stabilization) is low level. When
canceling standby mode with an NMI pin set for rising edge, be sure that the NMI pin level upon
entering standby (when the clock is halted) is low level, and that the NMI pin level upon returning
from standby (when the clock starts after oscillation stabilization) is high level.
Cancellation by a Power-On Reset: A power-on reset caused by setting the RES pin to low level
cancels the standby mode.
This example describes a transition to standby mode on the falling edge of an NMI signal, and a
cancellation on the rising edge of the NMI signal. The timing is shown in figure 21.2.
When the NMI pin is changed from high to low level while the NMI edge select bit (NMIE) of the
ICR is set to 0 (falling edge detection), the NMI interrupt is accepted. When the NMIE bit is set to
1 (rising edge detection) by an NMI exception service routine, the standby bit (SBY) of the
SBYCR is set to 1, and a SLEEP instruction is executed, standby mode is entered. Thereafter,
standby mode is canceled when the NMI pin is changed from low to high level.
Oscillator
CK
NMI pin
NMIE bit
SSBY bit
Executing the SLEEP instruction when the SBY bit of SBYCR is 0 causes a transition from the
program execution state to the sleep mode. Although the CPU halts immediately after executing
the SLEEP instruction, the contents of its internal registers remain unchanged. The on-chip
peripheral modules continue to run during the sleep mode.
Cancellation by an Interrupt: When an interrupt occurs, the sleep mode is canceled and interrupt
exception processing is executed. The sleep mode is not canceled if the interrupt cannot be
accepted because its priority level is equal to or less than the mask level set in the CPU’s status
register (SR) or if an interrupt by an on-chip peripheral module is disabled at the peripheral
module.
Cancellation by a DMAC Address Error: If a DMAC address error occurs, the sleep mode is
canceled and DMAC address error exception processing is executed.
Cancellation by a Power-On Reset: A power-on reset resulting from setting the RES pin to low
level cancels the sleep mode.
22.2 DC Characteristics
Table 22.2 DC Characteristics
Conditions: VCC = 5.0 V ± 10%, AVCC = 5.0 V ± 10%, AVref = 4.5 V to AVCC, VSS = AVSS = 0 V,
Ta = –40 to +85°C
Measurement
Item Pin Symbol Min Typ Max Unit Conditions
Input high- RES, NMI, VIH VCC – 0.7 — VCC + 0.3 V —
level MD3–MD0,
voltage HSTBY
EXTAL VCC × 0.7 — VCC + 0.3 V —
A/D port 2.2 — AVCC + 0.3 V —
Other input pins 2.2 — VCC + 0.3 V —
Input low- RES, NMI, VIL –0.3 — 0.5 V —
level MD3–MD0,
voltage HSTBY
Other input pins –0.3 — 0.8 V —
+
Schmitt TIA0–TID0, VT 4.0 — — V —
trigger TIOA1–TIOF1,
input TIOA2–TIOF2, –
VT — — 1.0 V —
voltage TIOA3–TIOF3,
TIOA4–TIOF4,
+ –
TIOA5, TIOB5, VT – VT 0.4 — — V —
TCLKA, TCLKB
Input leak RES, NMI, | Iin | — — 1.0 µA Vin =
current MD3–MD0, 0.5 to VCC – 0.5 V
HSTBY
A/D port — — 1.0 µA Vin =
0.5 to AVCC – 0.5 V
Other input pins — — 1.0 µA Vin =
0.5 to VCC – 0.5 V
Three- A21–A0, | ITSI | — — 1.0 µA Vin =
state leak D15–D0, 0.5 to VCC – 0.5 V
current CS3–CS0,
(while off) WRH, WRL, RD
Measurement
Item Pin Symbol Min Typ Max Unit Conditions
Output All output pins VOH VCC – 0.5 — — V IOH = –200 µA
high-level 3.5 — — V IOH = –1 mA
voltage
Output All output pins VOL — — 0.4 V IOL = 1.6 mA
low-level — — 1.2 V IOL = 8 mA
voltage
Input RES Cin — — 60 pF Vin = 0 V,
capacitance NMI — — 30 pF f = 1 MHz,
Ta = 25°C
All other input — — 20 pF
pins
Current Ordinary ICC — 100 150 mA f = 20 MHz
consump- operation (90)*
tion Sleep — 80 130 mA f = 20 MHz
(70)*
Standby — 1 20 µA Ta ≤ 50°C
— — 80 µA Ta > 50°C
Write operation — 110 150 µA –20°C ≤ Ta ≤ 85°C
f = 20 MHz
Analog During A/D AICC — 1.5 5 mA
supply conversion
current Awaiting A/D — 0.5 5 µA
conversion
Reference During A/D AIref — 1.0 5 mA AVref = 5.0 V
power conversion
supply Awaiting A/D — 0.5 5 µA
current conversion
RAM standby voltage VRAM 2.0 — — V
Note: * Mask version
Conditions: VCC = 5.0 V ± 10%, AVCC = 5.0 V ± 10%, AVref = 4.5 V to AVCC, VSS = AVSS = 0 V,
Ta = –40 to +85°C
1. When the A/D converter is not used (including during standby), do not release the AVCC, AVSS,
and AVref pins. Connect the AVCC and AVref pins to VCC and the AVSS pin to VSS.
2. The current consumption is measured when VIHmin = VCC – 0.5 V, VIL max = 0.5 V, with all
output pins unloaded.
22.3 AC Characteristics
Input output reference voltage level and loading current of AC characteristics measuring
conditions are same as defined in figure 22.22.
Conditions: VCC = 5.0 V ± 10%, AVCC = 5.0 V ± 10%, AVref = 4.5 V to AVCC, VSS = AVSS = 0 V,
Ta = –40 to +85°C
tcyc
tCH tCL
tCF tCR
TEXCYC
TEXH TEXL
EXTAL
1/2 VCC 1/2 VCC
TEXF TEXR
CK
HSTBY
tosc1 tosc1
RES
Conditions: VCC = 5.0 V ± 10%, AVCC = 5.0 V ± 10%, AVref = 4.5 V to AVCC, VSS = AVSS = 0 V,
Ta = –40 to +85°C
CK
tRESS tRESS
RES
VIH VIH
VIL VIL
tRESW
CK
tNMIH tNMIS
VIH
NMI
VIL
tIRQEH tIRQES
VIH
IRQ edge
VIL
tIRQLS
IRQ level
CK
tIRQOD tIRQOD
IRQOUT
CK
tBRQS tBRQS
BREQ
(Input)
tBACKD1 tBACKD2
BACK
(Output)
tBZD
RD, CSn,
WRH, WRL
tBZD
A21–A0,
D15–D0
Conditions: VCC = 5.0 V ± 10%, AVCC = 5.0 V ±10%, AVREF = 4.5 V – AVCC, VSS = AVSS = 0 V,
Ta = –40 to +85°C
T1 T2
CK
tAD
A21–A0
tCSD1 tCSD2
CSn
RD
(During read)
tACC tRDS tRDH
D15–D0
(During read)
tWSD1 tWSD2 tWR
WRx
(During write) tAS
tWDD tWDH
D15–D0
(During write)
tDACKD tDACKD
DACKn
Note: tRDH is specified from the first negate timing for A21–A0, CSn, and RD.
T1 Tw T2
CK
tAD
A21–A0
tCSD1 tCSD2
CSn
RD
(During read)
tACC tRDS tRDH
D15–D0
(During read)
tWSD1 tWSD2 tWR
WRx
(During write) tAS
tWDD tWDH
D15–D0
(During write)
tDACKD tDACKD
DACKn
Note: tRDH is specified from the first negate timing for A21ÐA0, CSn, and RD.
T1 Tw Tw Two T2
CK
A21–A0
CSn
RD
(During read)
D15–D0
(During read)
WRx
(During write)
D15–D0
(During write)
tWTS tWTH tWTS tWTH
WAIT
DACKn
Figure 22.10 Basic Cycle (2 Software Waits + Wait due to WAIT Signal)
Conditions: VCC = 5.0 V ± 10%, AVCC = 5.0 V ± 10%, AVREF = 4.5 V to AVCC, VSS = AVSS = 0 V,
Ta = –40 to +85°C
CK
tDRQS
DREQ0,
DREQ1
level
tDRQS tDRQH
DREQ0,
DREQ1
edge
tDRQS
DREQ0,
DREQ1
level release
CK
DREQ0,
DREQ1
edge
tDRQW
CK
tDRAKD tDRAKD
DRAKn
22.3.5 Advanced Timer Unit Timing and Advanced Pulse Controller Timing
Table 22.8 Advanced Timer Unit Timing and Advanced Pulse Controller Timing
Conditions: VCC = 5.0 V ± 10%, AVCC = 5.0 V ± 10%, AVREF = 4.5 V to AVCC, VSS = AVSS = 0 V,
Ta = –40 to +85°C
CK
tTOCD
Timer output
tTICS
Input capture
input
PULS output
tPLSD
CK
tTCKS tTCKS
TCLKA, TCLKB
tTCKWL tTCKWH
Conditions: VCC = 5.0 V ± 10%, AVCC = 5.0 V ± 10%, AVREF = 4.5 V to AVCC, VSS = AVSS = 0 V,
Ta = –40 to +85°C
CK
tPRS tPRH
Port
(read)
tPWD
Port
(write)
Conditions: VCC = 5.0 V ± 10%, AVCC = 5.0 V ± 10%, AVREF = 4.5 V to AVCC, VSS = AVSS = 0 V,
Ta = –40 to +85°C
CK tWOVD tWOVD
WDTOVF
Conditions: VCC = 5.0 V ± 10%, AVCC = 5.0 V ± 10%, AVREF = 4.5 V to AVCC, VSS = AVSS = 0 V,
Ta = –40 to +85°C
tsckw
tsckr tsckf
SCK0, SCK1
tscyc
tscyc
SCK0, SCK1
tTXD
TXD0, TXD1
(Transmit data)
tRXS
tRXH
RXD0, RXD1
(Receive data)
Conditions: VCC = 5.0 V ± 10%, AVCC = 5.0 V ± 10%, AVREF = 4.5 V to AVCC, VSS = AVSS = 0 V,
Ta = –40 to +85°C
1 state
CK
ADTRG
input
tTRGS
ADCR
tCONV
tD tSPL
CK
Address
Analog input
sampling
signal
ADF
IOL
IOH, IOL
LSI output pin DUT output
CL V VREF
| IOH |
Note: CL is set with the following pins, including the total capacitance of the
measurement jig, etc:
30 pF: CK, CS0–CS3, BREQ, BACK, DACK0, DACK1, and IRQOUT
50 pF: A21–A0, D15–D0, RD, WRx
70 pF: Port output and peripheral module output pins other than the above.
IOL, IOH: IOL = 1.6 mA, IOH = –200 µA
Conditions: VCC = 5.0 V ± 10%, AVCC = 5.0 V ± 10%, AVREF = 4.5 V to AVCC, VSS = AVSS = 0 V,
Ta = –40 to +85°C
20 MHz
Item Min Typ Max Unit
Resolution 10 10 10 Bits
Conversion time (when CKS = 1) — — 6.7 µs
Analog input capacitance — — 20 pF
Permitted signal source impedance — — 3 kΩ
Non-linear error — — ±1.5 LSB
Offset error — — ±1.5 LSB
Full-scale error — — ±1.5 LSB
Quantization error — — ±0.5 LSB
Absolute error — — ±2.0 LSB
A.1 Addresses
On-chip supporting module register addresses and bit names are shown below. 16-bit and 32-bit
registers are shown in two and four rows, respectively.
Table A.1 Two-Cycle, 8-Bit Access Space (8-Bit and 16-Bit Access Permitted; 32-Bit
Access Prohibited)
Bit Names
Register
Address Abbr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module
H'FFFF8000 — — — — — — — — — —
to
H'FFFF819F
H'FFFF81A0 SMR0 C/A CHR PE O/E STOP MP CKS1 CKS0 SCI
H'FFFF81A1 BRR0 (channel 0)
Table A.2 Two-Cycle, 16-Bit Access Space (In Principle, 8-Bit, 16-Bit, and 32-Bit Access
Permitted)
Bit Names
Register
Address Abbr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module
H'FFFF8200 TMDR*1 — — — — — T5PWM T4PWM T3PWM ATU
(channels
H'FFFF8201 — — — — — — — — —
3–5)
1
H'FFFF8202 TIERDH* — — — OVE3 IME3D IME3C IME3B IME3A
H'FFFF8203 TSRDH*1 — — — OVF3 IMF3D IMF3C IMF3B IMF3A
1
H'FFFF8204 TIERDL* OVE4 IME4D IME4C IME4B IME4A OVE5 IME5B IME5A
1
H'FFFF8205 TSRDL* OVF4 IMF4D IMF4C IMF4B IMF4A OVF5 IMF5B IMF5A
2
H'FFFF8206 TCR3* — — CKEG1 CKEG0 — CKSEL2 CKSEL1 CKSEL0 ATU
(channel 3)
2
H'FFFF8207 TCR4* — — CKEG1 CKEG0 — CKSEL2 CKSEL1 CKSEL0 ATU
(channel 4)
H'FFFF8208 TIOR3A*2 CCI3B IO3B2 IO3B1 IO3B0 CCI3A IO3A2 IO3A1 IO3A0 ATU
(channel 3)
H'FFFF8209 TIOR3B*2 CCI3D IO3D2 IO3D1 IO3D0 CCI3C IO3C2 IO3C1 IO3C0
H'FFFF820A TIOR4A*2 CCI4B IO4B2 IO4B1 IO4B0 CCI4A IO4A2 IO4A1 IO4A0 ATU
(channel 4)
H'FFFF820B TIOR4B*2 CCI4D IO4D2 IO4D1 IO4D0 CCI4C IO4C2 IO4C1 IO4C0
H'FFFF820C TCR5*2 — — CKEG1 CKEG0 — CKSEL2 CKSEL1 CKSEL0 ATU
(channel 5)
H'FFFF820D TIOR5A*2 CCI5B IO5B2 IO5B1 IO5B0 CCI5A IO5A2 IO5A1 IO5A0
H'FFFF820E TCNT3*3 ATU
(channel 3)
H'FFFF820F
H'FFFF8210 GR3A*3
H'FFFF8211
H'FFFF8212 GR3B*3
H'FFFF8213
H'FFFF8214 GR3C*3
H'FFFF8215
H'FFFF8216 GR3D*3
H'FFFF8217
Bit Names
Register
Address Abbr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module
H'FFFF8218 TCNT4*3 ATU
(channel 4)
H'FFFF8219
H'FFFF821A GR4A*3
H'FFFF821B
3
H'FFFF821C GR4B*
H'FFFF821D
3
H'FFFF821E GR4C*
H'FFFF821F
3
H'FFFF8220 GR4D*
H'FFFF8221
3
H'FFFF8222 TCNT5* ATU
(channel 5)
H'FFFF8223
3
H'FFFF8224 GR5A*
H'FFFF8225
H'FFFF8226 GR5B*3
H'FFFF8227
H'FFFF8228 — — — — — — — — — —
to
H'FFFF823F
H'FFFF8240 TIERE*1 — CME6 — CME7 — CME8 — CME9 ATU
(channels
H'FFFF8241 TSRE*1 — CMF6 — CMF7 — CMF8 — CMF9
6–9)
2
H'FFFF8242 TCR7* — — — — — CKSEL2 CKSEL1 CKSEL0 ATU
(channel 7)
H'FFFF8243 TCR6*2 — — — — — CKSEL2 CKSEL1 CKSEL0 ATU
(channel 6)
H'FFFF8244 TCR9*2 — — — — — CKSEL2 CKSEL1 CKSEL0 ATU
(channel 9)
H'FFFF8245 TCR8*2 — — — — — CKSEL2 CKSEL1 CKSEL0 ATU
(channel 8)
Bit Names
Register
Address Abbr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module
H'FFFF8246 TCNT6*3 ATU
(channel 6)
H'FFFF8247
H'FFFF8248 CYLR6*3
H'FFFF8249
3
H'FFFF824A BFR6*
H'FFFF824B
3
H'FFFF824C DTR6*
H'FFFF824D
3
H'FFFF824E TCNT7* ATU
(channel 7)
H'FFFF824F
3
H'FFFF8250 CYLR7*
H'FFFF8251
3
H'FFFF8252 BFR7*
H'FFFF8253
H'FFFF8254 DTR7*3
H'FFFF8255
H'FFFF8256 TCNT8*3 ATU
(channel 8)
H'FFFF8257
H'FFFF8258 CYLR8*3
H'FFFF8259
H'FFFF825A BFR8*3
H'FFFF825B
H'FFFF825C DTR8*3
H'FFFF825D
H'FFFF825E TCNT9*3 ATU
(channel 9)
H'FFFF825F
H'FFFF8260 CYLR9*3
H'FFFF8261
H'FFFF8262 BFR9*3
H'FFFF8263
H'FFFF8264 DTR9*3
H'FFFF8265
Bit Names
Register
Address Abbr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module
H'FFFF8266 — — — — — — — — — —
to
H'FFFF827F
1
H'FFFF8280 TGSR* — — — — — TRG0D — TRG0A ATU
(channel 0)
H'FFFF8281 TIOR0A*1 IO0D1 IO0D0 IO0C1 IO0C0 IO0B1 IO0B0 IO0A1 IO0A0
1
H'FFFF8282 ITVRR* ITVAD3 ITVAD2 ITVAD1 ITVAD0 ITVE3 ITVE2 ITVE1 ITVE0
1
H'FFFF8283 TSRAH* — — — — IIF3 IIF2 IIF1 IIF0
1
H'FFFF8284 TIERA* — — — OVE0 ICE0D ICE0C ICE0B ICE0A
1
H'FFFF8285 TSRAL* — — — OVF0 ICF0D ICF0C ICF0B ICF0A
H'FFFF8286 — — — — — — — — —
H'FFFF8287 — — — — — — — — —
4
H'FFFF8288 TCNT0H*
H'FFFF8289
H'FFFF828A TCNT0L*4
H'FFFF828B
H'FFFF828C ICR0AH*4
H'FFFF828D
H'FFFF828E ICR0AL*4
H'FFFF828F
H'FFFF8290 ICR0BH*4
H'FFFF8291
H'FFFF8292 ICR0BL*4
H'FFFF8293
H'FFFF8294 ICR0CH*4
H'FFFF8295
H'FFFF8296 ICR0CL*4
H'FFFF8297
H'FFFF8298 ICR0DH*4
H'FFFF8299
H'FFFF829A ICR0DL*4
H'FFFF829B
H'FFFF829C — — — — — — — — — —
to
H'FFFF82BF
Bit Names
Register
Address Abbr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module
H'FFFF82C0 TCR1*2 — — CKEG1 CKEG0 — CKSEL2 CKSEL1 CKSEL0 ATU
2 (channel 1)
H'FFFF82C1 TIOR1A* — IO1B2 IO1B1 IO1B0 — IO1A2 IO1A1 IO1A0
H'FFFF82C2 TIOR1B*2 — IO1D2 IO1D1 IO1D0 — IO1C2 IO1C1 IO1C0
2
H'FFFF82C3 TIOR1C* — IO1F2 IO1F1 IO1F0 — IO1E2 IO1E1 IO1E0
1
H'FFFF82C4 TIERB* — OVE1 IME1F IME1E IME1D IME1C IME1B IME1A
1
H'FFFF82C5 TSRB* — OVF1 IMF1F IMF1E IMF1D IMF1C IMF1B IMF1A
2
H'FFFF82C6 TCR2* — — CKEG1 CKEG0 — CKSEL2 CKSEL1 CKSEL0 ATU
2 (channel 2)
H'FFFF82C7 TIOR2A* — IO2B2 IO2B1 IO2B0 — IO2A2 IO2A1 IO2A0
1
H'FFFF82C8 TIERC* — — — — — OVE2 IME2B IME2A
1
H'FFFF82C9 TSRC* — — — — — OVF2 IMF2B IMF2A
3
H'FFFF82CA TCNT2*
H'FFFF82CB
3
H'FFFF82CC GR2A*
H'FFFF82CD
H'FFFF82CE GR2B*3
H'FFFF82CF
H'FFFF82D0 TCNT1*3 ATU
(channel 1)
H'FFFF82D1
H'FFFF82D2 GR1A*3
H'FFFF82D3
H'FFFF82D4 GR1B*3
H'FFFF82D5
H'FFFF82D6 GR1C*3
H'FFFF82D7
H'FFFF82D8 GR1D*3
H'FFFF82D9
H'FFFF82DA GR1E*3
H'FFFF82DB
H'FFFF82DC GR1F*3
H'FFFF82DD
H'FFFF82DE OSBR*3
H'FFFF82DF
Bit Names
Register
Address Abbr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module
H'FFFF82E0 TCR10*2 — CKSEL2A CKSEL1A CKSEL0A — CKSEL2B CKSEL1B CKSEL0B ATU
2 (channel
H'FFFF82E1 TCNR* CN10H CN10G CN10F CN10E CN10D CN10C CN10B CN10A
10)
H'FFFF82E2 TIERF*1 OSE10H OSE10G OSE10F OSE10E OSE10D OSE10C OSE10B OSE10A
1
H'FFFF82E3 TSRF* OSF10H OSF10G OSF10F OSF10E OSF10D OSF10C OSF10B OSF10A
H'FFFF82E4 — — — — — — — — —
1
H'FFFF82E5 DSTR* DST10H DST10G DST10F DST10E DST10D DST10C DST10B DST10A
H'FFFF82E6 — — — — — — — — —
H'FFFF82E7 — — — — — — — — —
H'FFFF82E8 — — — — — — — — — ATU (all
1 channels)
H'FFFF82E9 PSCR1* — — — PSCE PSCD PSCC PSCB PSCA
3
H'FFFF82EA TSTR* — — — — — — STR9 STR8
H'FFFF82EB STR7 STR6 STR5 STR4 STR3 STR2 STR1 STR0
H'FFFF82EC — — — — — — — — — —
to
H'FFFF82EF
H'FFFF82F0 DCNT10A*3 ATU
(channel
H'FFFF82F1
10)
H'FFFF82F2 DCNT10B*3
H'FFFF82F3
H'FFFF82F4 DCNT10C*3
H'FFFF82F5
H'FFFF82F6 DCNT10D*3
H'FFFF82F7
H'FFFF82F8 DCNT10E*3
H'FFFF82F9
H'FFFF82FA DCNT10F*3
H'FFFF82FB
H'FFFF82FC DCNT10G*3
H'FFFF82FD
H'FFFF82FE DCNT10H*3
H'FFFF82FF
Bit Names
Register
Address Abbr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module
H'FFFF8300 — — — — — — — — — INTC
to
H'FFFF8347
H'FFFF8348 IPRA
H'FFFF8349
H'FFFF834A IPRB
H'FFFF834B
H'FFFF834C IPRC
H'FFFF834D
H'FFFF834E IPRD
H'FFFF834F
H'FFFF8350 IPRE
H'FFFF8351
H'FFFF8352 IPRF
H'FFFF8353
H'FFFF8354 IPRG
H'FFFF8355
H'FFFF8356 IPRH
H'FFFF8357
H'FFFF8358 ICR NMIL — — — — — — NMIE
H'FFFF8359 IRQ0S IRQ1S IRQ2S IRQ3S IRQ4S IRQ5S IRQ6S IRQ7S
H'FFFF835A ISR — — — — — — — —
H'FFFF835B IRQ0F IRQ1F IRQ2F IRQ3F IRQ4F IRQ5F IRQ6F IRQ7F
H'FFFF835C — — — — — — — — —
to
H'FFFF837F
H'FFFF8380 PADR*2 PA15DR PA14DR PA13DR PA12DR PA11DR PA10DR PA9DR PA8DR Port A
H'FFFF8381 PA7DR PA6DR PA5DR PA4DR PA3DR PA2DR PA1DR PA0DR
H'FFFF8382 PAIOR*2 PA15IOR PA14IOR PA13IOR PA12IOR PA11IOR PA10IOR PA9IOR PA8IOR
H'FFFF8383 PA7IOR PA6IOR PA5IOR PA4IOR PA3IOR PA2IOR PA1IOR PA0IOR
H'FFFF8384 PACR*2 PA15MD PA14MD PA13MD PA12MD PA11MD PA10MD PA9MD PA8MD
H'FFFF8385 PA7MD PA6MD PA5MD PA4MD PA3MD PA2MD PA1MD PA0MD
Bit Names
Register
Address Abbr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module
H'FFFF8386 PBDR*2 — — PB11DR PB10DR PB9DR PB8DR PB7DR PB6DR Port B
H'FFFF8387 — — PB5DR PB4DR PB3DR PB2DR PB1DR PB0DR
H'FFFF8388 PBIOR*2 — — PB11IOR PB10IOR PB9IOR PB8IOR PB7IOR PB6IOR
H'FFFF8389 — — PB5IOR PB4IOR PB3IOR PB2IOR PB1IOR PB0IOR
2
H'FFFF838A PBCR* — PB11MD PB11MD PB10MD PB9MD PB8MD PB7MD PB6MD
1 0
H'FFFF838B — — PB5MD PB4MD PB3MD PB2MD PB1MD PB0MD
H'FFFF838C — — — — — — — — — —
to
H'FFFF838F
2
H'FFFF8390 PCDR* — PC14DR PC13DR PC12DR PC11DR PC10DR PC9DR PC8DR Port C
H'FFFF8391 PC7DR PC6DR PC5DR PC4DR PC3DR PC2DR PC1DR PC0DR
2
H'FFFF8392 PCIOR* — PC14IOR PC13IOR PC12IOR PC11IOR PC10IOR PC9IOR PC8IOR
H'FFFF8393 PC7IOR PC6IOR PC5IOR PC4IOR PC3IOR PC2IOR PC1IOR PC0IOR
H'FFFF8394 PCCR1*2 — — PC14MD1 PC14MD0 PC13MD1 PC13MD0 PC12MD1 PC12MD0
Bit Names
Register
Address Abbr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module
H'FFFF83A6 PFDR*2 — — — — PF11DR PF10DR PF9DR PF8DR Port F
H'FFFF83A7 PF7DR PF6DR PF5DR PF4DR PF3DR PF2DR PF1DR PF0DR
H'FFFF83A8 PFIOR*2 — — — — PF11IOR PF10IOR PF9IOR PF8IOR
H'FFFF83A9 PF7IOR PF6IOR PF5IOR PF4IOR PF3IOR PF2IOR PF1IOR PF0IOR
2
H'FFFF83AA PFCR1* — — — — — — — —
H'FFFF83AB PF11MD1 PF11MD0 PF10MD1 PF10MD0 PF9MD1 PF9MD0 PF8MD1 PF8MD0
2
H'FFFF83AC PFCR2* PF7MD1 PF7MD0 PF6MD1 PF6MD0 PF5MD1 PF5MD0 PF4MD1 PF4MD0
H'FFFF83AD — PF3MD — PF2MD — PF1MD — PF0MD
2
H'FFFF83AE PGDR* PG15DR PG14DR PG13DR PG12DR PG11DR PG10DR PG9DR PG8DR Port G
H'FFFF83AF PG7DR PG6DR PG5DR PG4DR PG3DR PG2DR PG1DR PG0DR
2
H'FFFF83B0 PGIOR* PG15IOR PG14IOR PG13IOR PG12IOR PG11IOR PG10IOR PG9IOR PG8IOR
H'FFFF83B1 PG7IOR PG6IOR PG5IOR PG4IOR PG3IOR PG2IOR PG1IOR PG0IOR
2
H'FFFF83B2 PGCR1* PG15MD1 PG15MD0 PG14MD1 PG14MD0 — PG13MD — PG12MD
H'FFFF83B3 — PG11MD — PG10MD — PG9MD — PG8MD
H'FFFF83B4 PGCR2*2 — PG7MD — PG6MD — PG5MD — PG4MD
H'FFFF83B5 — PG3MD PG2MD PG1MD PG0MD1 PG0MD0 IRQMD1 IRQMD0
H'FFFF83B6 PHDR*2 PH15DR PH14DR PH13DR PH12DR PH11DR PH10DR PH9DR PH8DR Port H
H'FFFF83B7 PH7DR PH6DR PH5DR PH4DR PH3DR PH2DR PH1DR PH0DR
H'FFFF83B8 ADTRGR*1 EXTRG — — — — — — — AD0
H'FFFF83B9 — — — — — — — — — —
to
H'FFFF83BF
H'FFFF83C0 POPCR*2 PULSE7ROE PULSE6ROE PULSE5ROE PULSE4ROE PULSE3ROE PULSE2ROE PULSE1ROE PULSE0ROE APC
H'FFFF83C1 PULSE7SOE PULSE6SOE PULSE5SOE PULSE4SOE PULSE3SOE PULSE2SOE PULSE1SOE PULSE0SOE
H'FFFF83C2 — — — — — — — — — —
to
H'FFFF83C7
H'FFFF83C8 SYSCR*1 — — — — — — — RAME (Power-
down
state)
H'FFFF83C9 — — — — — — — — — —
to
H'FFFF83CF
Bit Names
Register
Address Abbr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module
H'FFFF83D0 CMSTR — — — — — — — — CMT (both
channels)
H'FFFF83D1 — — — — — — STR1 STR0
H'FFFF83D2 CMCSR0 — — — — — — — — CMT
(channel 0)
H'FFFF83D3 CMF CMIE — — — — CKS1 CKS0
H'FFFF83D4 CMCNT0
H'FFFF83D5
H'FFFF83D6 CMCOR0
H'FFFF83D7
H'FFFF83D8 CMCSR1 — — — — — — — — CMT
(channel 1)
H'FFFF83D9 CMF CMIE — — — — CKS1 CKS0
H'FFFF83DA CMCNT1
H'FFFF83DB
H'FFFF83DC CMCOR1
H'FFFF83DD
H'FFFF83DE — — — — — — — — — —
to
H'FFFF83FF
Notes: 1. Only 8-bit access permitted; 16-bit and 32-bit access prohibited.
2. 8-bit and 16-bit access permitted; 32-bit access prohibited.
3. Only 16-bit access permitted; 8-bit and 32-bit access prohibited.
4. Only 32-bit access permitted; 8-bit and 16-bit access prohibited
Table A.3 Three-Cycle, 8-Bit Access Space (8-Bit and 16-bit Access Permitted; 32-Bit
Access Prohibited)
Bit Names
Register
Address Abbr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module
H'FFFF8400 — — — — — — — — — —
to
H'FFFF857F
H'FFFF8580 FLMCR1* FWE VPPE ESU PSU EV PV E P Flash
H'FFFF8581 FLMCR2* FLER — — — — — — —
H'FFFF8582 EBR1* EB7 EB6 EB5 EB4 EB3 EB2 EB1 EB0
H'FFFF8583 — — — — — — — — — —
to
H'FFFF85CF
H'FFFF85D0 ADDR0H AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2 AD0
H'FFFF85D1 ADDR0L AD1 AD0 — — — — — —
H'FFFF85D2 ADDR1H AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2
H'FFFF85D3 ADDR1L AD1 AD0 — — — — — —
H'FFFF85D4 ADDR2H AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2
H'FFFF85D5 ADDR2L AD1 AD0 — — — — — —
H'FFFF85D6 ADDR3H AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2
H'FFFF85D7 ADDR3L AD1 AD0 — — — — — —
H'FFFF85D8 ADDR4H AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2
H'FFFF85D9 ADDR4L AD1 AD0 — — — — — —
H'FFFF85DA ADDR5H AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2
H'FFFF85DB ADDR5L AD1 AD0 — — — — — —
H'FFFF85DC ADDR6H AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2
H'FFFF85DD ADDR6L AD1 AD0 — — — — — —
H'FFFF85DE ADDR7H AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2
H'FFFF85DF ADDR7L AD1 AD0 — — — — — —
H'FFFF85E0 ADDR8H AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2
H'FFFF85E1 ADDR8L AD1 AD0 — — — — — —
H'FFFF85E2 ADDR9H AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2
H'FFFF85E3 ADDR9L AD1 AD0 — — — — — —
H'FFFF85E4 ADDR10H AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2
H'FFFF85E5 ADDR10L AD1 AD0 — — — — — —
H'FFFF85E6 ADDR11H AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2
H'FFFF85E7 ADDR11L AD1 AD0 — — — — — —
H'FFFF85E8 ADCSR0 ADF ADIE ADM1 ADM0 CH3 CH2 CH1 CH0
H'FFFF85E9 ADCR0 TRGE CKS ADST — — — — —
Bit Names
Register
Address Abbr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module
H'FFFF85EA — — — — — — — — — —
to
H'FFFF85EF
H'FFFF85F0 ADDR12H AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2 AD1
H'FFFF85F1 ADDR12L AD1 AD0 — — — — — —
H'FFFF85F2 ADDR13H AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2
H'FFFF85F3 ADDR13L AD1 AD0 — — — — — —
H'FFFF85F4 ADDR14H AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2
H'FFFF85F5 ADDR14L AD1 AD0 — — — — — —
H'FFFF85F6 ADDR15H AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2
H'FFFF85F7 ADDR15L AD1 AD0 — — — — — —
H'FFFF85F8 ADCSR1 ADF ADIE ADST SCAN CKS — CH1 CH0
H'FFFF85F9 ADCR1 TRGE — — — — — — —
H'FFFF85FA — — — — — — — — — —
to
H'FFFF85FF
Note: * Only 8-bit access permitted; 16-bit and 32-bit access prohibited.
Table A.4 Three-Cycle, 16-Bit Access Space (In Principle, 8-Bit, 16-Bit, and 32-Bit Access
Permitted)
Bit Names
Register
Address Abbr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module
H'FFFF8600 UBARH UBA31 UBA30 UBA29 UBA28 UBA27 UBA26 UBA25 UBA24 UBC
H'FFFF8601 UBA23 UBA22 UBA21 UBA20 UBA19 UBA18 UBA17 UBA16
H'FFFF8602 UBARL UBA15 UBA14 UBA13 UBA12 UBA11 UBA10 UBA9 UBA8
H'FFFF8603 UBA7 UBA6 UBA5 UBA4 UBA3 UBA2 UBA1 UBA0
H'FFFF8604 UBAMRH UBM31 UBM30 UBM29 UBM28 UBM27 UBM26 UBM25 UBM24
H'FFFF8605 UBM23 UBM22 UBM21 UBM20 UBM19 UBM18 UBM17 UBM16
H'FFFF8606 UBAMRL UBM15 UBM14 UBM13 UBM12 UBM11 UBM10 UBM9 UBM8
H'FFFF8607 UBM7 UBM6 UBM5 UBM4 UBM3 UBM2 UBM1 UBM0
H'FFFF8608 UBBR — — — — — — — —
H'FFFF8609 CP1 CP0 ID1 ID0 RW1 RW0 SZ1 SZ0
H'FFFF860A — — — — — — — — — —
to
H'FFFF860F
H'FFFF8610 TCSR*4 OVF WT/IT TME — — CKS2 CKS1 CKS0 WDT
H'FFFF8611 TCNT*4
H'FFFF8612 — — — — — — — — —
H'FFFF8613 RSTCSR*4 WOVF RSTE — — — — — —
H'FFFF8614 SBYCR*1 SSBY HIZ — — — — — — (Power-
down
state)
H'FFFF8615 — — — — — — — — — —
to
H'FFFF861F
H'FFFF8620 BCR1 — — — — — — — — BSC
H'FFFF8621 — — — — A3SZ A2SZ A1SZ A0SZ
H'FFFF8622 BCR2 IW31 IW30 IW21 IW20 IW11 IW10 IW01 IW00
H'FFFF8623 CW3 CW2 CW1 CW0 SW3 SW2 SW1 SW0
H'FFFF8624 WCR1 W33 W32 W31 W30 W23 W22 W21 W20
H'FFFF8625 W13 W12 W11 W10 W03 W02 W01 W00
H'FFFF8626 WCR2 — — — — — — — —
H'FFFF8627 — — — — DSW3 DSW2 DSW1 DSW0
Bit Names
Register
Address Abbr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module
H'FFFF8628 RAMER — — — — — — — — Flash
H'FFFF8629 — — — — — RAMS RAM1 RAM0
H'FFFF862A — — — — — — — — — —
to
H'FFFF86AF
2
H'FFFF86B0 DMAOR* — — — — — — PR1 PR0 DMAC (all
channels)
H'FFFF86B1 — — — — — AE NMIF DME
H'FFFF86B2 — — — — — — — — — —
to
H'FFFF86BF
5
H'FFFF86C0 SAR0* DMAC
(channel 0)
H'FFFF86C1
H'FFFF86C2
H'FFFF86C3
H'FFFF86C4 DAR0*5
H'FFFF86C5
H'FFFF86C6
H'FFFF86C7
H'FFFF86C8 DMATCR0*3 — — — — — — — —
H'FFFF86C9
H'FFFF86CA
H'FFFF86CB
H'FFFF86CC CHCR0*5 — — — — — — — —
H'FFFF86CD — — — — — RL AM AL
H'FFFF86CE DM1 DM0 SM1 SM0 RS3 RS2 RS1 RS0
H'FFFF86CF — DS TM TS1 TS0 IE TE DE
Bit Names
Register
Address Abbr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module
H'FFFF86D0 SAR1*5 DMAC
(channel 1)
H'FFFF86D1
H'FFFF86D2
H'FFFF86D3
5
H'FFFF86D4 DAR1*
H'FFFF86D5
H'FFFF86D6
H'FFFF86D7
3
H'FFFF86D8 DMATCR1* — — — — — — — —
H'FFFF86D9
H'FFFF86DA
H'FFFF86DB
5
H'FFFF86DC CHCR1* — — — — — — — —
H'FFFF86DD — — — — — RL AM AL
H'FFFF86DE DM1 DM0 SM1 SM0 RS3 RS2 RS1 RS0
H'FFFF86DF — DS TM TS1 TS0 IE TE DE
H'FFFF86E0 SAR2*5 DMAC
(channel 2)
H'FFFF86E1
H'FFFF86E2
H'FFFF86E3
H'FFFF86E4 DAR2*5
H'FFFF86E5
H'FFFF86E6
H'FFFF86E7
H'FFFF86E8 DMATCR2*3 — — — — — — — —
H'FFFF86E9
H'FFFF86EA
H'FFFF86EB
H'FFFF86EC CHCR2*5 — — — — — — — —
H'FFFF86ED — — — — RO — — —
H'FFFF86EE DM1 DM0 SM1 SM0 RS3 RS2 RS1 RS0
H'FFFF86EF — — TM TS1 TS0 IE TE DE
Bit Names
Register
Address Abbr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Module
H'FFFF86F0 SAR3*5 DMAC
(channel 3)
H'FFFF86F1
H'FFFF86F2
H'FFFF86F3
5
H'FFFF86F4 DAR3*
H'FFFF86F5
H'FFFF86F6
H'FFFF86F7
3
H'FFFF86F8 DMATCR3* — — — — — — — —
H'FFFF86F9
H'FFFF86FA
H'FFFF86FB
5
H'FFFF86FC CHCR3* — — — — — — — —
H'FFFF86FD — — — DI — — — —
H'FFFF86FE DM1 DM0 SM1 SM0 RS3 RS2 RS1 RS0
H'FFFF86FF — — TM TS1 TS0 IE TE DE
H'FFFF8700 — — — — — — — — — —
to
H'FFFF87FF
Notes: 1. Only 8-bit access permitted; 16-bit and 32-bit access prohibited.
2. Only 16-bit access permitted; 8-bit and 32-bit access prohibited.
3. Only 32-bit access permitted; 8-bit and 16-bit access prohibited.
4. This is the read address. The write address is H'FFFF8610 for the TCSR and TCNT,
and H'FFFF8612 for RSTCSR.
For details, see 12.2.4, Register Access, in section 12, Watchdog Timer.
5. 16-bit and 32-bit access permitted; 8-bit access prohibited.
A.2 Registers
Bit names
Bit Bit Name Value Description (abbreviations).
Bits marked “—”
7 Communication mode (C/A) 0 Asynchronous mode (Initial value) are reserved.
1 Synchronous mode
6 Character length (CHR) 0 8-bit data (Initial value)
1 7-bit data
5 Parity enable (PE) 0 Parity bit addition and check disabled
(Initial value)
Type of access permitted 1 Parity bit addition and check enabled
R Read only 4 Parity mode (O/E) 0 Even parity (Initial value)
W Write only 1 Odd parity
R/W Read or write
3 Stop bit length (STOP) 0 1 stop bit (Initial value)
1 2 stop bits
2 Multiprocessor bit (MP) 0 Multiprocessor function disabled
(Initial value)
1 Multiprocessor format selected
1, 0 Clock select 1, 0 0 0 φ clock (Initial value)
(CKS1, CKS0) 1 φ/4 clock
1 0 φ/16 clock
1 φ/64 clock
Bit: 7 6 5 4 3 2 1 0
Bit name: C/A CHR PE O/E STOP MP CKS1 CKS0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name:
Initial value: 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: TIE RIE TE RE MPIE TEIE CKE1 CKE0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name:
Initial value: 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: TDRE RDRF ORER FER PER TEND MPB MPBT
Initial value: 1 0 0 0 0 1 0 0
R/W: R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R R R/W
Note: * Only 0 can be written to clear the flag.
Bit: 7 6 5 4 3 2 1 0
Bit name:
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
Bit name: — — — — — T5PWM T4PWM T3PWM
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — — — OVE3 IME3D IME3C IME3B IME3A
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — — — OVF3 IMF3D IMF3C IMF3B IMF3A
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R/(W)* R/(W)* R/(W)* R/(W)* R/(W)*
Note: * Only 0 can be written to clear the flag.
Bit: 7 6 5 4 3 2 1 0
Bit name: OVE4 IME4D IME4C IME4B IME4A OVE5 IME5B IME5A
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: OVF4 IMF4D IMF4C IMF4B IMF4A OVF5 IMF5B IMF5A
Initial value: 0 0 0 0 0 0 0 0
R/W: R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)*
Note: * Only 0 can be written to clear the flag.
Bit: 7 6 5 4 3 2 1 0
Bit name: — — CKEG1 CKEG0 — CKSEL2 CKSEL1 CKSEL0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R/W R/W R R/W R/W R/W
TIOR3A
Bit: 7 6 5 4 3 2 1 0
Bit name: CCI3B IO3B2 IO3B1 IO3B0 CCI3A IO3A2 IO3A1 IO3A0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
TIOR3B
Bit: 7 6 5 4 3 2 1 0
Bit name: CCI3D IO3D2 IO3D1 IO3D0 CCI3C IO3C2 IO3C1 IO3C0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
TIOR4A
Bit: 7 6 5 4 3 2 1 0
Bit name: CCI4B IO4B2 IO4B1 IO4B0 CCI4A IO4A2 IO4A1 IO4A0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
TIOR4B
Bit: 7 6 5 4 3 2 1 0
Bit name: CCI4D IO4D2 IO4D1 IO4D0 CCI4C IO4C2 IO4C1 IO4C0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
TIOR5A
Bit: 7 6 5 4 3 2 1 0
Bit name: CCI5B IO5B2 IO5B1 IO5B0 CCI5A IO5A2 IO5A1 IO5A0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name:
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name:
Initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — CME6 — CME7 — CME8 — CME9
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/W R R/W R R/W R R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — CMF6 — CMF7 — CMF8 — CMF9
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/(W)* R R/(W)* R R/(W)* R R/(W)*
Note: * Only 0 can be written to clear the flag.
Bit: 7 6 5 4 3 2 1 0
Bit name: — — — — — CKSEL2 CKSEL1 CKSEL0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name:
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name:
Initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name:
Initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name:
Initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — — — — — TRG0D — TRG0A
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R/W R R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: IO0D1 IO0D0 IO0C1 IO0C0 IO0B1 IO0B0 IO0A1 IO0A0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: ITVAD3 ITVAD2 ITVAD1 ITVAD0 ITVE3 ITVE2 ITVE1 ITVE0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — — — — IIF3 IIF2 IIF1 IIF0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R/(W)* R/(W)* R/(W)* R/(W)*
Note: * Only 0 can be written to clear the flag.
Bit: 7 6 5 4 3 2 1 0
Bit name: — — — OVE0 ICE0D ICE0C ICE0B ICE0A
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — — — OVF0 ICF0D ICF0C ICF0B ICF0A
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R/(W)* R/(W)* R/(W)* R/(W)* R/(W)*
Note: * Only 0 can be written to clear the flag.
Bit: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit name:
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name:
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit name:
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R R R R R R R R R R R R R R R R
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name:
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R R R R R R R R R R R R R R R R
TIOR1A
Bit: 7 6 5 4 3 2 1 0
Bit name: — IO1B2 IO1B1 IO1B0 — IO1A2 IO1A1 IO1A0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R R/W R/W R/W
TIOR1B
Bit: 7 6 5 4 3 2 1 0
Bit name: — IO1D2 IO1D1 IO1D0 — IO1C2 IO1C1 IO1C0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R R/W R/W R/W
TIOR1C
Bit: 7 6 5 4 3 2 1 0
Bit name: — IO1F2 IO1F1 IO1F0 — IO1E2 IO1E1 IO1E0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R R/W R/W R/W
TIOR2A
Bit: 7 6 5 4 3 2 1 0
Bit name: — IO2B2 IO2B1 IO2B0 — IO2A2 IO2A1 IO2A0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — OVE1 IME1F IME1E IME1D IME1C IME1B IME1A
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — OVF1 IMF1F IMF1E IMF1D IMF1C IMF1B IMF1A
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)*
Note: * Only 0 can be written to clear the flag.
Bit: 7 6 5 4 3 2 1 0
Bit name: — — — — — OVE2 IME2B IME2A
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — — — — — OVF2 IMF2B IMF2A
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R/(W)* R/(W)* R/(W)*
Note: * Only 0 can be written to clear the flag.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name:
Initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name:
Initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name:
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R R R R R R R R R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
Bit name: — CKSEL2A CKSEL1A CKSEL0A — CKSEL2B CKSEL1B CKSEL0B
Initial value: 0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: CN10H CN10G CN10F CN10E CN10D CN10C CN10B CN10A
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: OSE10H OSE10G OSE10F OSE10E OSE10D OSE10C OSE10B OSE10A
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: OSF10H OSF10G OSF10F OSF10E OSF10D OSF10C OSF10B OSF10A
Initial value: 0 0 0 0 0 0 0 0
R/W: R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)*
Note: * Only 0 can be written to clear the flag.
Bit: 7 6 5 4 3 2 1 0
Bit name: DST10H DST10G DST10F DST10E DST10D DST10C DST10B DST10A
Initial value: 0 0 0 0 0 0 0 0
R/W: R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)* R/(W)*
Note: * Only 1 can be written.
Bit: 7 6 5 4 3 2 1 0
Bit name: — — — PSCE PSCD PSCC PSCB PSCA
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: — — — — — — STR9 STR8
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: STR7 STR6 STR5 STR4 STR3 STR2 STR1 STR0
Initial value: 0 0 0 0 0 0 0 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name:
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name:
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit
Register 15–12 11–8 7–4 3–0
Interrupt priority register A IRQ0 IRQ1 IRQ2 IRQ3
Interrupt priority register B IRQ4 IRQ5 IRQ6 IRQ7
Interrupt priority register C DMAC0, 1 DMAC2, 3 ATU01 ATU02
Interrupt priority register D ATU03 ATU11 ATU12 ATU13
Interrupt priority register E ATU2 ATU31 ATU32 ATU41
Interrupt priority register F ATU42 ATU5 ATU6–9 ATU101
Interrupt priority register G ATU102 ATU103 CMT0, A/D0 CMT1, A/D1
Interrupt priority register H SCI0 SCI1 SCI2 WDT
Bit: 15 14 13 12 11 10 9 8
Bit name: NMIL — — — — — — NMIE
Initial value: * 0 0 0 0 0 0 0
R/W: R R R R R R R R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: IRQ0S IRQ1S IRQ2S IRQ3S IRQ4S IRQ5S IRQ6S IRQ7S
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Note: * 1 when the NMI pin is high, 0 when low.
Bit: 15 14 13 12 11 10 9 8
Bit name: — — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
Bit name: IRQ0F IRQ1F IRQ2F IRQ3F IRQ4F IRQ5F IRQ6F IRQ7F
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Detection
Bit Bit Name Value Setting Description
7–0 IRQ0 to IRQ7 flags 0 Level There is no IRQn interrupt request
(IRQ0F to IRQ7F) detection [Clearing condition]
IRQn input is high
Edge IRQn interrupt request has not been
detection detected (Initial value)
[Clearing conditions]
1. Read IRQnF when IRQnF =1, then
write 0 in IRQnF
2. IRQn interrupt exception handling is
carried out
1 Level There is an IRQn interrupt request
detection [Setting condition]
IRQn input is low
Edge IRQn interrupt request has been detected
detection [Setting condition]
Falling edge in IRQn input
Bit: 15 14 13 12 11 10 9 8
Bit name: PA15DR PA14DR PA13DR PA12DR PA11DR PA10DR PA9DR PA8DR
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: PA7DR PA6DR PA5DR PA4DR PA3DR PA2DR PA1DR PA0DR
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: PA15IOR PA14IOR PA13IOR PA12IOR PA11IOR PA10IOR PA9IOR PA8IOR
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: PA7IOR PA6IOR PA5IOR PA4IOR PA3IOR PA2IOR PA1IOR PA0IOR
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: PA15MD PA14MD PA13MD PA12MD PA11MD PA10MD PA9MD PA8MD
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: PA7MD PA6MD PA5MD PA4MD PA3MD PA2MD PA1MD PA0MD
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Pin Function
Expanded Mode Expanded Mode
Bit Bit Name Value with ROM Disabled with ROM Enabled Single-Chip Mode
15 PA15 mode bit 0 Address output (A15) Generic input/output Generic input/output (PA15)
(PA15MD) (Initial value) (PA15) (Initial value) (Initial value)
1 Address output (A15) Address output (A15) Generic input/output (PA15)
14 PA14 mode bit 0 Address output (A14) Generic input/output Generic input/output (PA14)
(PA14MD) (Initial value) (PA14) (Initial value) (Initial value)
1 Address output (A14) Address output (A14) Generic input/output (PA14)
13 PA13 mode bit 0 Address output (A13) Generic input/output Generic input/output (PA13)
(PA13MD) (Initial value) (PA13) (Initial value) (Initial value)
1 Address output (A13) Address output (A13) Generic input/output (PA13)
12 PA12 mode bit 0 Address output (A12) Generic input/output Generic input/output (PA12)
(PA12MD) (Initial value) (PA12) (Initial value) (Initial value)
1 Address output (A12) Address output (A12) Generic input/output (PA12)
11 PA11 mode bit 0 Address output (A11) Generic input/output Generic input/output (PA11)
(PA11MD) (Initial value) (PA11) (Initial value) (Initial value)
1 Address output (A11) Address output (A11) Generic input/output (PA11)
10 PA10 mode bit 0 Address output (A10) Generic input/output Generic input/output (PA10)
(PA10MD) (Initial value) (PA10) (Initial value) (Initial value)
1 Address output (A10) Address output (A10) Generic input/output (PA10)
9 PA9 mode bit 0 Address output (A9) Generic input/output Generic input/output (PA9)
(PA9MD) (Initial value) (PA9) (Initial value) (Initial value)
1 Address output (A9) Address output (A9) Generic input/output (PA9)
Pin Function
Expanded Mode Expanded Mode
Bit Bit Name Value with ROM Disabled with ROM Enabled Single-Chip Mode
8 PA8 mode bit 0 Address output (A8) Generic input/output Generic input/output (PA8)
(PA8MD) (Initial value) (PA8) (Initial value) (Initial value)
1 Address output (A8) Address output (A8) Generic input/output (PA8)
7 PA7 mode bit 0 Address output (A7) Generic input/output Generic input/output (PA7)
(PA7MD) (Initial value) (PA7) (Initial value) (Initial value)
1 Address output (A7) Address output (A7) Generic input/output (PA7)
6 PA6 mode bit 0 Address output (A6) Generic input/output Generic input/output (PA6)
(PA6MD) (Initial value) (PA6) (Initial value) (Initial value)
1 Address output (A6) Address output (A6) Generic input/output (PA6)
5 PA5 mode bit 0 Address output (A5) Generic input/output Generic input/output (PA5)
(PA5MD) (Initial value) (PA5) (Initial value) (Initial value)
1 Address output (A5) Address output (A5) Generic input/output (PA5)
4 PA4 mode bit 0 Address output (A4) Generic input/output Generic input/output (PA4)
(PA4MD) (Initial value) (PA4) (Initial value) (Initial value)
1 Address output (A4) Address output (A4) Generic input/output (PA4)
3 PA3 mode bit 0 Address output (A3) Generic input/output Generic input/output (PA3)
(PA3MD) (Initial value) (PA3) (Initial value) (Initial value)
1 Address output (A3) Address output (A3) Generic input/output (PA3)
2 PA2 mode bit 0 Address output (A2) Generic input/output Generic input/output (PA2)
(PA2MD) (Initial value) (PA2) (Initial value) (Initial value)
1 Address output (A2) Address output (A2) Generic input/output (PA2)
1 PA1 mode bit 0 Address output (A1) Generic input/output Generic input/output (PA1)
(PA1MD) (Initial value) (PA1) (Initial value) (Initial value)
1 Address output (A1) Address output (A1) Generic input/output (PA1)
0 PA0 mode bit 0 Address output (A0) Generic input/output Generic input/output (PA0)
(PA0MD) (Initial value) (PA0) (Initial value) (Initial value)
1 Address output (A0) Address output (A0) Generic input/output (PA0)
Bit: 15 14 13 12 11 10 9 8
Bit name: — — PB11DR PB10DR PB9DR PB8DR PB7DR PB6DR
Initial value: 1 1 0 0 0 0 0 0
R/W: R R R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — — PB5DR PB4DR PB3DR PB2DR PB1DR PB0DR
Initial value: 1 1 0 0 0 0 0 0
R/W: R R R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: — — PB11IOR PB10IOR PB9IOR PB8IOR PB7IOR PB6IOR
Initial value: 1 1 0 0 0 0 0 0
R/W: R R R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — — PB5IOR PB4IOR PB3IOR PB2IOR PB1IOR PB0IOR
Initial value: 1 1 0 0 0 0 0 0
R/W: R R R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: — PB11MD1 PB11MD0 PB10MD PB9MD PB8MD PB7MD PB6MD
Initial value: 1 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — — PB5MD PB4MD PB3MD PB2MD PB1MD PB0MD
Initial value: 1 1 0 0 0 0 0 0
R/W: R R R/W R/W R/W R/W R/W R/W
Pin Function
Expanded Mode Expanded Mode
Bit Bit Name Value with ROM Disabled with ROM Enabled Single-Chip Mode
14, PB11 mode bit 0 0 Address output (A21) Generic input/output Generic input/output (PB11)
13 1, 0 (PB11MD1, (Initial value) (PB11) (Initial value) (Initial value)
PB11MD0)
1 Address output (A21) Address output (A21) Generic input/output (PB11)
1 0 Address output (A21) Port output disable input Port output disable input
(POD) (POD)
1 Reserved Reserved Reserved
12 PB10 mode bit 0 Address output (A20) Generic input/output Generic input/output (PB10)
(PB10MD) (Initial value) (PB10) (Initial value) (Initial value)
1 Address output (A20) Address output (A20) Generic input/output (PB10)
11 PB9 mode bit 0 Address output (A19) Generic input/output Generic input/output (PB9)
(PB9MD) (Initial value) (PB9) (Initial value) (Initial value)
1 Address output (A19) Address output (A19) Generic input/output (PB9)
10 PB8 mode bit 0 Address output (A18) Generic input/output Generic input/output (PB8)
(PB8MD) (Initial value) (PB8) (Initial value) (Initial value)
1 Address output (A18) Address output (A18) Generic input/output (PB8)
9 PB7 mode bit 0 Address output (A17) Generic input/output Generic input/output (PB7)
(PB7MD) (Initial value) (PB7) (Initial value) (Initial value)
1 Address output (A17) Address output (A17) Generic input/output (PB7)
8 PB6 mode bit 0 Address output (A16) Generic input/output Generic input/output (PB6)
(PB6MD) (Initial value) (PB6) (Initial value) (Initial value)
1 Address output (A16) Address output (A16) Generic input/output (PB6)
Pin Function
Expanded Mode Expanded Mode
Bit Bit Name Value with ROM Disabled with ROM Enabled Single-Chip Mode
5 PB5 mode bit 0 Generic input/output (PB5) (Initial value)
(PB5MD)
1 ATU clock input (TCLKB)
4 PB4 mode bit 0 Generic input/output (PB4) (Initial value)
(PB4MD)
1 ATU clock input (TCLKA)
3 PB3 mode bit 0 Generic input/output (PB3) (Initial value)
(PB3MD)
1 ATU PWM output (TO9)
2 PB2 mode bit 0 Generic input/output (PB2) (Initial value)
(PB2MD)
1 ATU PWM output (TO8)
1 PB1 mode bit 0 Generic input/output (PB1) (Initial value)
(PB1MD)
1 ATU PWM output (TO7)
0 PB0 mode bit 0 Generic input/output (PB0) (Initial value)
(PB0MD)
1 ATU PWM output (TO6)
Bit: 15 14 13 12 11 10 9 8
Bit name: — PC14DR PC13DR PC12DR PC11DR PC10DR PC9DR PC8DR
Initial value: 1 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: PC7DR PC6DR PC5DR PC4DR PC3DR PC2DR PC1DR PC0DR
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: — PC14IOR PC13IOR PC12IOR PC11IOR PC10IOR PC9IOR PC8IOR
Initial value: 1 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: PC7IOR PC6IOR PC5IOR PC4IOR PC3IOR PC2IOR PC1IOR PC0IOR
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
PCCR1
Bit: 15 14 13 12 11 10 9 8
Bit name: — — PC14MD1 PC14MD0 PC13MD1 PC13MD0 PC12MD1 PC12MD0
Initial value: 1 1 0 0 0 0 0 0
R/W: R R R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: PC11MD1 PC11MD0 PC10MD1 PC10MD0 PC9MD1 PC9MD0 PC8MD1 PC8MD0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Pin Function
Bit Bit Name Value Expanded Mode Single-Chip Mode
13, 12 PC14 mode bit 0 0 Generic input/output (PC14) Generic input/output (PC14)
1, 0 (PC14MD1, (Initial value) (Initial value)
PC14MD0) 1 ATU one-shot pulse output ATU one-shot pulse
(TOH10) output (TOH10)
1 0 Reserved Reserved
1 Reserved Reserved
11, 10 PC13 mode bit 0 0 Generic input/output (PC13) Generic input/output (PC13)
1, 0 (PC13MD1, (Initial value) (Initial value)
PC13MD0) 1 ATU one-shot pulse output ATU one-shot pulse
(TOG10) output (TOG10)
1 0 Reserved Reserved
1 Reserved Reserved
9, 8 PC12 mode bit 0 0 Generic input/output (PC12) Generic input/output (PC12)
1, 0 (PC12MD1, (Initial value) (Initial value)
PC12MD0) 1 ATU one-shot pulse output ATU one-shot pulse
(TOF10) output (TOF10)
1 0 DMAC DREQ1 acknowledge DMAC DREQ1 acknowledge
signal output (DRAK1) signal output (DRAK1)
1 Reserved Reserved
Pin Function
Bit Bit Name Value Expanded Mode Single-Chip Mode
7, 6 PC11 mode bit 0 0 Generic input/output (PC11) Generic input/output (PC11)
1, 0 (PC11MD1, (Initial value) (Initial value)
PC11MD0) 1 ATU one-shot pulse output ATU one-shot pulse
(TOE10) output (TOE10)
1 0 DMAC DREQ0 acknowledge DMAC DREQ0 acknowledge
signal output (DRAK0) signal output (DRAK0)
1 Reserved Reserved
5, 4 PC10 mode bit 0 0 Generic input/output (PC10) Generic input/output (PC10)
1, 0 (PC10MD1, (Initial value) (Initial value)
PC10MD0) 1 ATU one-shot pulse output ATU one-shot pulse output
(TOD10) (TOD10)
1 0 Reserved Reserved
1 Reserved Reserved
3, 2 PC9 mode bit 0 0 Generic input/output (PC9) Generic input/output (PC9)
1, 0 (PC9MD1, (Initial value) (Initial value)
PC9MD0) 1 ATU one-shot pulse output ATU one-shot pulse output
(TOC10) (TOC10)
1 0 Reserved Reserved
1 Reserved Reserved
1, 0 PC8 mode bit 0 0 Generic input/output (PC8) Generic input/output (PC8)
1, 0 (PC8MD1, (Initial value) (Initial value)
PC8MD0) 1 ATU one-shot pulse output ATU one-shot pulse output
(TOB10) (TOB10)
1 0 Reserved Reserved
1 Reserved Reserved
PCCR2
Bit: 15 14 13 12 11 10 9 8
Bit name: PC7MD1 PC7MD0 PC6MD1 PC6MD0 — PC5MD — PC4MD
Initial value: 0 0 0 0 1 0 1 1
R/W: R/W R/W R/W R/W R R/W R R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — PC3MD — PC2MD — PC1MD — PC0MD
Initial value: 1 1 1 1 1 1 1 1
R/W: R R/W R R/W R R/W R R/W
Pin Function
Bit Bit Name Value Expanded Mode Single-Chip Mode
15, 14 PC7 mode bit 0 0 Generic input/output (PC7) Generic input/output (PC7)
1, 0 (PC7MD1, (Initial value) (Initial value)
PC7MD0) 1 ATU one-shot pulse output ATU one-shot pulse output
(TOA10) (TOA10)
1 0 Reserved Reserved
1 Reserved Reserved
13, 12 PC6 mode bit 0 0 Generic input/output (PC6) Generic input/output (PC6)
1, 0 (PC6MD1, (Initial value) (Initial value)
PC6MD0) 1 Chip select output (CS2) Generic input/output (PC6)
1 0 Interrupt request input Interrupt request input
(IRQ6) (IRQ6)
1 A/D conversion end output A/D conversion end output
(ADEND) (ADEND)
10 PC5 mode bit 0 Generic input/output (PC5) Generic input/output (PC5)
(PC5MD) (Initial value) (Initial value)
1 Chip select output (CS1) Generic input/output (PC5)
8 PC4 mode bit 0 Generic input/output (PC4) Generic input/output (PC4)
(PC4MD) 1 Chip select output (CS0) Generic input/output (PC4)
(Initial value) (Initial value)
6 PC3 mode bit 1 0 Generic input/output (PC3) Generic input/output (PC3)
(PC3MD) 1 Read output (RD) Generic input/output (PC3)
(Initial value) (Initial value)
Pin Function
Bit Bit Name Value Expanded Mode Single-Chip Mode
4 PC2 mode bit 0 Generic input/output (PC2) Generic input/output (PC2)
(PC2MD) 1 Wait state input (WAIT) Generic input/output (PC2)
(Initial value) (Initial value)
2 PC1 mode bit 0 Generic input/output (PC1) Generic input/output (PC1)
(PC1MD) 1 Upper write (WRH) Generic input/output (PC1)
(Initial value) (Initial value)
0 PC0 mode bit 0 Generic input/output (PC0) Generic input/output (PC0)
(PC0MD) 1 Lower write (WRL) Generic input/output (PC0)
(Initial value) (Initial value)
Bit: 15 14 13 12 11 10 9 8
Bit name: PD15DR PD14DR PD13DR PD12DR PD11DR PD10DR PD9DR PD8DR
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: PD7DR PD6DR PD5DR PD4DR PD3DR PD2DR PD1DR PD0DR
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: PD15IOR PD14IOR PD13IOR PD12IOR PD11IOR PD10IOR PD9IOR PD8IOR
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: PD7IOR PD6IOR PD5IOR PD4IOR PD3IOR PD2IOR PD1IOR PD0IOR
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: PD15MD PD14MD PD13MD PD12MD PD11MD PD10MD PD9MD PD8MD
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: PD7MD PD6MD PD5MD PD4MD PD3MD PD2MD PD1MD PD0MD
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Pin Function
Expanded Mode Expanded Mode
with ROM Disabled with ROM Disabled Expanded Mode
Bit Bit Name Value Area 0: 8 Bits Area 0: 16 Bits with ROM Enabled Single-Chip Mode
15 PD15 mode bit 0 Generic input/output Data input/output Generic input/output Generic input/output
(PD15MD) (PD15) (Initial value) (D15) (Initial value) (PD15) (Initial value) (PD15) (Initial value)
1 Data input/output Data input/output Data input/output Generic input/output
(D15) (D15) (D15) (PD15)
14 PD14 mode bit 0 Generic input/output Data input/output Generic input/output Generic input/output
(PD14MD) (PD14) (Initial value) (D14) (Initial value) (PD14) (Initial value) (PD14) (Initial value)
1 Data input/output Data input/output Data input/output Generic input/output
(D14) (D14) (D14) (PD14)
13 PD13 mode bit 0 Generic input/output Data input/output Generic input/output Generic input/output
(PD13MD) (PD13) (Initial value) (D13) (Initial value) (PD13) (Initial value) (PD13) (Initial value)
1 Data input/output Data input/output Data input/output Generic input/output
(D13) (D13) (D13) (PD13)
12 PD12 mode bit 0 Generic input/output Data input/output Generic input/output Generic input/output
(PD12MD) (PD12) (Initial value) (D12) (Initial value) (PD12) (Initial value) (PD12) (Initial value)
1 Data input/output Data input/output Data input/output Generic input/output
(D12) (D12) (D12) (PD12)
11 PD11 mode bit 0 Generic input/output Data input/output Generic input/output Generic input/output
(PD11MD) (PD11) (Initial value) (D11) (Initial value) (PD11) (Initial value) (PD11) (Initial value)
1 Data input/output Data input/output Data input/output Generic input/output
(D11) (D11) (D11) (PD11)
10 PD10 mode bit 0 Generic input/output Data input/output Generic input/output Generic input/output
(PD10MD) (PD10) (Initial value) (D10) (Initial value) (PD10) (Initial value) (PD10) (Initial value)
1 Data input/output Data input/output Data input/output Generic input/output
(D10) (D10) (D10) (PD10)
9 PD9 mode bit 0 Generic input/output Data input/output Generic input/output Generic input/output
(PD9MD) (PD9) (Initial value) (D9) (Initial value) (PD9) (Initial value) (PD9) (Initial value)
1 Data input/output Data input/output Data input/output Generic input/output
(D9) (D9) (D9) (PD9)
Pin Function
Expanded Mode Expanded Mode
with ROM Disabled with ROM Disabled Expanded Mode
Bit Bit Name Value Area 0: 8 Bits Area 0: 16 Bits with ROM Enabled Single-Chip Mode
8 PD8 mode bit 0 Generic input/output Data input/output Generic input/output Generic input/output
(PD8MD) (PD8) (Initial value) (D8) (Initial value) (PD8) (Initial value) (PD8) (Initial value)
1 Data input/output Data input/output Data input/output Generic input/output
(D8) (D8) (D8) (PD8)
Expanded Mode Expanded Mode
with ROM Disabled with ROM Enabled Single-Chip Mode
7 PD7 mode bit 0 Data input/output (D7) Generic input/output (PD7) Generic input/output (PD7)
(PD7MD) (Initial value) (Initial value) (Initial value)
1 Data input/output (D7) Data input/output (D7) Generic input/output (PD7)
6 PD6mode bit 0 Data input/output (D6) Generic input/output (PD6) Generic input/output (PD6)
(PD6MD) (Initial value) (Initial value) (Initial value)
1 Data input/output (D6) Data input/output (D6) Generic input/output (PD6)
5 PD5 mode bit 0 Data input/output (D5) Generic input/output (PD5) Generic input/output (PD5)
(PD5MD) (Initial value) (Initial value) (Initial value)
1 Data input/output (D5) Data input/output (D5) Generic input/output (PD5)
4 PD4 mode bit 0 Data input/output (D4) Generic input/output (PD4) Generic input/output (PD4)
(PD4MD) (Initial value) (Initial value) (Initial value)
1 Data input/output (D4) Data input/output (D4) Generic input/output (PD4)
3 PD3 mode bit 0 Data input/output (D3) Generic input/output (PD3) Generic input/output (PD3)
(PD3MD) (Initial value) (Initial value) (Initial value)
1 Data input/output (D3) Data input/output (D3) Generic input/output (PD3)
2 PD2 mode bit 0 Data input/output (D2) Generic input/output (PD2) Generic input/output (PD2)
(PD2MD) (Initial value) (Initial value) (Initial value)
1 Data input/output (D2) Data input/output (D2) Generic input/output (PD2)
1 PD1 mode bit 0 Data input/output (D1) Generic input/output (PD1) Generic input/output (PD1)
(PD1MD) (Initial value) (Initial value) (Initial value)
1 Data input/output (D1) Data input/output (D1) Generic input/output (PD1)
0 PD0 mode bit 0 Data input/output (D0) Generic input/output (PD0) Generic input/output (PD0)
(PD0MD) (Initial value) (Initial value) (Initial value)
1 Data input/output (D0) Data input/output (D0) Generic input/output (PD0)
Bit: 15 14 13 12 11 10 9 8
Bit name: — — — — — — — —
Initial value: 1 1 1 1 1 1 1 1
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
Bit name: — — — — — — — CKLO
Initial value: 1 1 1 1 1 1 1 0
R/W: R R R R R R R R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: — PE14DR PE13DR PE12DR PE11DR PE10DR PE9DR PE8DR
Initial value: 1 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: PE7DR PE6DR PE5DR PE4DR PE3DR PE2DR PE1DR PE0DR
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: — PE14IOR PE13IOR PE12IOR PE11IOR PE10IOR PE9IOR PE8IOR
Initial value: 1 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: PE7IOR PE6IOR PE5IOR PE4IOR PE3IOR PE2IOR PE1IOR PE0IOR
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: — PE14MD PE13MD PE12MD PE11MD PE10MD PE9MD PE8MD
Initial value: 1 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: PE7MD PE6MD PE5MD PE4MD PE3MD PE2MD PE1MD PE0MD
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: — — — — PF11DR PF10DR PF9DR PF8DR
Initial value: 1 1 1 1 0 0 0 0
R/W: R R R R R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: PF7DR PF6DR PF5DR PF4DR PF3DR PF2DR PF1DR PF0DR
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: — — — — PF11IOR PF10IOR PF9IOR PF8IOR
Initial value: 1 1 1 1 0 0 0 0
R/W: R R R R R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: PF7IOR PF6IOR PF5IOR PF4IOR PF3IOR PF2IOR PF1IOR PF0IOR
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
PFCR1
Bit: 15 14 13 12 11 10 9 8
Bit name: — — — — — — — —
Initial value: 1 1 1 1 1 1 1 1
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
Bit name: PF11MD1 PF11MD0 PF10MD1 PF10MD0 PF9MD1 PF9MD0 PF8MD1 PF8MD0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Pin Function
Bit Bit Name Value Expanded Mode Single-Chip Mode
7, 6 PF11 mode bit 1, 0 0 0 Generic input/output (PF11) Generic input/output (PF11)
(PF11MD1, PF11MD0) (Initial value) (Initial value)
1 Bus request input (BREQ) Generic input/output (PF11)
1 0 APC pulse output (PULS7) APC pulse output (PULS7)
1 Reserved Reserved
5, 4 PF10 mode bit 1, 0 0 0 Generic input/output (PF10) Generic input/output (PF10)
(PF10MD1, PF10MD0) (Initial value) (Initial value)
1 Bus request acknowledge Generic input/output (PF10)
output (BACK)
1 0 APC pulse output (PULS6) APC pulse output (PULS6)
1 Reserved Reserved
3, 2 PF9 mode bit 1, 0 0 0 Generic input/output (PF9) Generic input/output (PF9)
(PF9MD1, PF9MD0) (Initial value) (Initial value)
1 Chip select output (CS3) Generic input/output (PF9)
1 0 Interrupt request input Interrupt request input (IRQ7)
(IRQ7)
1 APC pulse output (PULS5) APC pulse output (PULS5)
1, 0 PF8 mode bit 1, 0 0 0 Generic input/output (PF8) Generic input/output (PF8)
(PF8MD1, PF8MD0) (Initial value) (Initial value)
1 Serial clock input/output (SCK2) Serial clock input/output (SCK2)
1 0 APC pulse output (PULS4) APC pulse output (PULS4)
1 Reserved Reserved
PFCR2
Bit: 15 14 13 12 11 10 9 8
Bit name: PF7MD1 PF7MD0 PF6MD1 PF6MD0 PF5MD1 PF5MD0 PF4MD1 PF4MD0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — PF3MD — PF2MD — PF1MD — PF0MD
Initial value: 1 0 1 0 1 0 1 0
R/W: R R/W R R/W R R/W R R/W
Pin Function
Bit Bit Name Value Expanded Mode Single-Chip Mode
15, 14 PF7 mode bit 1, 0 0 0 Generic input/output (PF7) Generic input/output (PF7)
(PF7MD1, PF7MD0) (Initial value) (Initial value)
1 DMA transfer request input DMA transfer request input
(DREQ0) (DREQ0)
1 0 APC pulse output (PULS3) APC pulse output (PULS3)
1 Reserved Reserved
13, 12 PF6 mode bit 1, 0 0 0 Generic input/output (PF6) Generic input/output (PF6)
(PF6MD1, PF6MD0) (Initial value)
1 DMA transfer request Generic input/output (PF6)
acknowledge output (DACK0)
1 0 APC pulse output (PULS2) APC pulse output (PULS2)
1 Reserved Reserved
11, 10 PF5 mode bit 1, 0 0 0 Generic input/output (PF5) Generic input/output (PF5)
(PF5MD1, PF5MD0) (Initial value) (Initial value)
1 DMA transfer request input DMA transfer request input
(DREQ1) (DREQ1)
1 0 APC pulse output (PULS1) APC pulse output (PULS1)
1 Reserved Reserved
9, 8 PF4 mode bit 1, 0 0 0 Generic input/output (PF4) Generic input/output (PF4)
(PF4MD1, PF4MD0) (Initial value)
1 DMA transfer request Generic input/output (PF4)
acknowledge output (DACK1)
1 0 APC pulse output (PULS0) APC pulse output (PULS0)
1 Reserved Reserved
Pin Function
Bit Bit Name Value Expanded Mode Single-Chip Mode
6 PF3 mode bit 0 Generic input/output (PF3) Generic input/output (PF3)
(PF3MD) (Initial value) (Initial value)
1 Interrupt request input Interrupt request input (IRQ3)
(IRQ3)
4 PF2 mode bit 0 Generic input/output (PF2) Generic input/output (PF2)
(PF2MD) (Initial value) (Initial value)
1 Interrupt request input Interrupt request input
(IRQ2) (IRQ2)
2 PF1 mode bit 0 Generic input/output (PF1) Generic input/output (PF1)
(PF1MD) (Initial value) (Initial value)
1 Interrupt request input Interrupt request input
(IRQ1) (IRQ1)
0 PF0 mode bit 0 Generic input/output (PF0) Generic input/output (PF0)
(PF0MD) (Initial value) (Initial value)
1 Interrupt request input Interrupt request input
(IRQ0) (IRQ0)
Bit: 15 14 13 12 11 10 9 8
Bit name: PG15DR PG14DR PG13DR PG12DR PG11DR PG10DR PG9DR PG8DR
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: PG7DR PG6DR PG5DR PG4DR PG3DR PG2DR PG1DR PG0DR
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: PG15IORPG14IORPG13IORPG12IORPG11IORPG10IOR PG9IOR PG8IOR
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: PG7IOR PG6IOR PG5IOR PG4IOR PG3IOR PG2IOR PG1IOR PG0IOR
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
PGCR1
Bit: 15 14 13 12 11 10 9 8
Bit name: PG15MD1 PG15MD0 PG14MD1 PG14MD0 — PG13MD — PG12MD
Initial value: 0 0 0 0 1 0 1 0
R/W: R/W R/W R/W R/W R R/W R R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — PG11MD — PG10MD — PG9MD — PG8MD
Initial value: 1 0 1 0 1 0 1 0
R/W: R R/W R R/W R R/W R R/W
PGCR2
Bit: 15 14 13 12 11 10 9 8
Bit name: — PG7MD — PG6MD — PG5MD — PG4MD
Initial value: 1 0 1 0 1 0 1 0
R/W: R R/W R R/W R R/W R R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — PG3MD PG2MD PG1MD PG0MD1 PG0MD0 IRQMD1 IRQMD0
Initial value: 1 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: PH15DR PH14DR PH13DR PH12DR PH11DR PH10DR PH9DR PH8DR
Initial value: — — — — — — — —
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
Bit name: PH7DR PH6DR PH5DR PH4DR PH3DR PH2DR PH1DR PH0DR
Initial value: — — — — — — — —
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
Bit name: EXTRG — — — — — — —
Initial value: 1 1 1 1 1 1 1 1
R/W: R/W R R R R R R R
Bit: 15 14 13 12 11 10 9 8
Bit name: PULS7 PULS6 PULS5 PULS4 PULS3 PULS2 PULS1 PULS0
ROE ROE ROE ROE ROE ROE ROE ROE
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: PULS7 PULS6 PULS5 PULS4 PULS3 PULS2 PULS1 PULS0
SOE SOE SOE SOE SOE SOE SOE SOE
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — — — — — — — RAME
Initial value: 0 0 0 0 0 0 0 1
R/W: R R R R R R R R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: — — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
Bit name: — — — — — — STR1 STR0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: — — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
Bit name: CMF CMIE — — — — CKS1 CKS0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/(W)* R/W — — — — R/W R/W
Note: * Only 0 can be written, to clear the flag.
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name:
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name:
Initial value: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: FWE SWE ESU PSU EV PV E P
Initial value: 1/0 0 0 0 0 0 0 0
R/W: R R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: FLER — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
Bit name: EB7 EB6 EB5 EB4 EB3 EB2 EB1 EB0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
Bit name: AD1 AD0 — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
Bit name: ADF ADIE ADM1 ADM0 CH3 CH2 CH1 CH0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/(W)* R/W R/W R/W R/W R/W R/W R/W
Note: * Only 0 can be written to clear the flag.
Bit: 7 6 5 4 3 2 1 0
Bit name: TRGE CKS ADST — — — — —
Initial value: 0 0 0 1 1 1 1 1
R/W: R/W R/W R/W R R R R R
Bit: 7 6 5 4 3 2 1 0
Bit name: ADF ADIE ADST SCAN CKS — CH1 CH0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/(W)* R/W R/W R/W R/W R R/W R/W
Note: * Only 0 can be written to clear the flag.
Bit: 7 6 5 4 3 2 1 0
Bit name: TRGE — — — — — — —
Initial value: 0 1 1 1 1 1 1 1
R/W: R/W R R R R R R R
Bit: 15 14 13 12 11 10 9 8
Bit name: UBA31 UBA30 UBA29 UBA28 UBA27 UBA26 UBA25 UBA24
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: UBA23 UBA22 UBA21 UBA20 UBA19 UBA18 UBA17 UBA16
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: UBA15 UBA14 UBA13 UBA12 UBA11 UBA10 UBA9 UBA8
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: UBA7 UBA6 UBA5 UBA4 UBA3 UBA2 UBA1 UBA0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: UBM31 UBM30 UBM29 UBM28 UBM27 UBM26 UBM25 UBM24
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: UBM23 UBM22 UBM21 UBM20 UBM19 UBM18 UBM17 UBM16
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: UBM15 UBM14 UBM13 UBM12 UBM11 UBM10 UBM9 UBM8
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: UBM7 UBM6 UBM5 UBM4 UBM3 UBM2 UBM1 UBM0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: — — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
Bit name: CP1 CP0 ID1 ID0 RW1 RW0 SZ1 SZ0
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: OVF WT/IT TME — — CKS2 CKS1 CKS0
Initial value: 0 0 0 1 1 0 0 0
R/W: R/(W)* R/W R/W R R R/W R/W R/W
Note: * To prevent TCSR from being modified easily, the write method differs from that used for
general registers. For details, see section 12.2.4, Register Access.
Bit: 7 6 5 4 3 2 1 0
Bit name:
Initial value: 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: WOVF RSTE — — — — — —
Initial value: 0 0 0 0 1 1 1 1
R/W: R/(W)* R/W R R R R R R
Note: * Only 0 can be written in bit 7 to clear the flag.
Bit: 7 6 5 4 3 2 1 0
Bit name: SSBY HIZ — — — — — —
Initial value: 0 0 0 1 1 1 1 1
R/W: R/W R/W R R R R R R
Bit: 15 14 13 12 11 10 9 8
Bit name: — — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
Bit name: — — — — A3SZ A2SZ A1SZ A0SZ
Initial value: 0 0 0 0 1 1 1 1
R/W: R R R R R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: IW31 IW30 IW21 IW20 IW11 IW10 IW01 IW00
Initial value: 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: CW3 CW2 CW1 CW0 SW3 SW2 SW1 SW0
Initial value: 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: W33 W32 W31 W30 W23 W22 W21 W20
Initial value: 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: W13 W12 W11 W10 W03 W02 W01 W00
Initial value: 1 1 1 1 1 1 1 1
R/W: R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: — — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
Bit name: — — — — DSW3 DSW2 DSW1 DSW0
Initial value: 0 0 0 0 1 1 1 1
R/W: R R R R R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: — — — — — — — —
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R R
Bit: 7 6 5 4 3 2 1 0
Bit name: — — — — — RAMS RAM1 RAM0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8
Bit name: — — — — — — PR1 PR0
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R/W R/W
Bit: 7 6 5 4 3 2 1 0
Bit name: — — — — — AE NMIF DME
Initial value: 0 0 0 0 0 0 0 0
R/W: R R R R R R R/(W)* R/W
Note: * Only 0 can be written in bits AE and NMIF, after reading 1 from these bits.
Bit: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit name:
Initial value: — — — — — — — — — — — — — — — —
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name:
Initial value: — — — — — — — — — — — — — — — —
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit name:
Initial value: — — — — — — — — — — — — — — — —
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name:
Initial value: — — — — — — — — — — — — — — — —
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit name: — — — — — — — —
Initial value: 0 0 0 0 0 0 0 0 — — — — — — — —
R/W: R R R R R R R R R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name:
Initial value: — — — — — — — — — — — — — — — —
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W
Bit: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit name: — — — — — — — — — — — DI RO RL AM AL
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R R R R R R R R R R R R/W R/W R/W R/W R/W
Bit: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit name: DM1 DM0 SM1 SM0 RS3 RS2 RS1 RS0 — DS TM TS1 TS0 IE TE DE
Initial value: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
R/W: R/W R/W R/W R/W R/W R/W R/W R/W R R/W R/W R/W R/W R/W R/(W) R/W
Notes: 1. Only 0 can be written in the TE bit, after reading 1 from this bit.
2. The DI, RO, RL, AM, AL, or DS bit may be absent, depending on the channel.
B.1 Pin States at Reset and in Power-Down, and Bus Right Released
State
Table B.1 shows the SH7050 pin states at reset and in power-down, and bus right released state.
Table B.1 Pin States at Reset and in Power-Down, and Bus Right Released State
Pin Function Pin State
Reset Power-Down
Power-On Reset by RES pin Bus-
Item Pins Hardware Software Released
ROMless, ROMless,
Expanded, Single- Standby Standby Sleep State
Expanded, Expanded,
with ROM Chip
8-Bit 16-Bit
Clock EXTAL I I I I Z Z I I
XTAL O O O O Z Z O O
CK O O O O Z H* O O
Operating FWE, I I I I I I I I
Mode MD0–MD3
Selection
HSTBY I I I I I I I I
System RES I I I I I I I I
Control
WDTOVF O O O O Z H* O O
BREQ — — — — Z Z I I
BACK — — — — Z Z O O
Interrupt NMI I I I I I I I I
IRQ0– — — — — Z Z I I
IRQ7
IRQOUT — — — — Z H* O O
Address A0–A21 L L — — Z Z O Z
Bus
Data Bus D0–D7 Z Z — — Z Z I/O Z
D8–D15 — Z — — Z Z I/O Z
HD
*1
D
126 85
127 84 NOTE)
1. DIMENSIONS"*1"AND"*2"
DO NOT INCLUDE MOLD FLASH
2. DIMENSION"*3"DOES NOT
INCLUDE TRIM OFFSET.
bp
HE
b1
E
*2
c1
c
Reference Dimension in Millimeters
Symbol
ZE
Min Nom Max
43 Terminal cross section D
168 28
1 42
E 28
A2 3.20
ZD
HD 30.9 31.2 31.5
F
HE 30.9 31.2 31.5
A 3.56
A2
A1
A
0.00 0.15 0.25
c
bp 0.24 0.32 0.40
θ
L b1 0.30
A1
e *3 bp L1 c 0.12 0.17 0.22
y x M
c1 0.15
Detail F
θ 0° 8°
e 0.65
x 0.13
y 0.10
ZD 0.68
ZE 0.68
L 0.5 0.8 1.1
L1 1.6
Colophon 5.0
SH7050 Group, SH7050F-ZTAT,
SH7051F-ZTAT
Hardware Manual