Be sure to refer to the “Check Sheet” for the latest cautions on development.
“Check Sheet” is seen at the following support page
URL : http://www.fujitsu.com/global/services/microelectronics/product/micom/support/index.html
“Check Sheet” lists the minimal requirement items to be checked to prevent problems beforehand in system development.
FUJITSU LIMITED
Page 4
Page 5
CONTENTS
■ Objectives and Intended Reader
The MB91350A series is one of the FR60 family of microcontrollers. The FR60 fam ily of microcontroll ers
is based on the FR30/40 family of CPUs, which u se a 32-b it high-performance RI SC CPU as the core CPU.
The FR60 family offers enhanced bus access. The MB91350A series is a single-chip microcontroller with
built-in peripheral resources. The MB91350A series is ideal for embedded control applications th at require
high-performance or high-speed CPU processing.
This manual is intended for engineers who will develop products using the MB91 350A seri es and describes
the functions and operations of the MB91350A series. Read this manual thoroughly.
For more information on instructions, see the "Instructions Manual".
Note : FR, which is an abbreviation of FUJITSU RISC controller, is a product of FUJITSU LIMITED.
■ Trademark
The company names and brand names herein are the trademarks or registered trademarks of their respective
owners.
■ License
Purchase of Fujitsu I2C components conveys a licence under the Philips I2C Patent Rights to use, these
2
components in an I
defined by Philips.
C system provided that the system conforms to the I2C Standard Specification as
■ Organization of This Manual
This manual consists of the following 19 chapters and an appendix.
CHAPTER 1 OVERVIEW
This chapter provides basic information required to u nderstand the MB91 350A series. It covers features
and dimensions, and presents a block diagram of the MB91350A series.
CHAPTER 2 HANDLING THE DEVICE
This chapter provides precautions on handling the device.
CHAPTER 3 CPU AND CONTROL UNITS
This chapter provides basic information required to understand the MB91350A series core CPU
functions. It covers architecture, specifications, and instructions.
CHAPTER 4 EXTERNAL BUS INTERFACE
This chapter describes basic items related to the external bus interface, register configuration/functions,
bus operation, bus timing, and procedures for setting the registers.
CHAPTER 5 I/O PORT
This chapter describes the I/O ports and the configuration and functions of registers.
i
Page 6
CHAPTER 6 8/16-bit Up/Down Counters/Timer and U-Timers
This chapter outlines the 8/16-bit up/down counter/timer an d U-TIMER and explains the configuration
and functions of the registers and timer operations.
CHAPTER 7 16-BIT FREE-RUNNING TIMER AND 16-BIT RELOAD TIMER
This chapter outlines the 16-bit free-running timer and 16-bit reload timer and explains the
configuration and functions of the registers and timer operations.
This chapter gives an outline of the PPG (Programmable Pulse Generator) timer and explains the
register configuration and functions and the timer operations.
CHAPTER 9 INTERRUPT CONTROLLER
This chapter describes the overview of the interrupt controller, the configuration and functions of
registers, and interrupt controller operation.
CHAPTER 10 EXTERNAL INTERRUPT AND NMI CONTROLLER
This chapter outlines the external interrupt/NMI controller and explains the configuration and functions
of the registers and operations of the external interrupt/NMI controller.
CHAPTER 11 REALOS-RELATED HARDWARE
This chapter outlines the delayed interrupt module and bit search module, and explains the
configuration and functions of registers and operations.
CHAPTER 12 A/D CONVERTER
This chapter outlines the A/D converter and explains the configuration and functions of registers and
the A/D converter operations.
CHAPTER 13 8-BIT D/A CONVERTER
This chapter gives an overview of the 8-bit D/A converter, register configuration and functions, an d 8bit D/A converter operation.
CHAPTER 14 UART, SERIAL I/O INTERFACE (SIO), INPUT CAPTURE MODULE, AND
OUTPUT COMPARE MODULE
This chapter outlines the UART, SIO, input capture, and output compare, and expl ains the configuration
and functions of registers. It also explains UART, SIO, input capture, and output compare operations.
CHAPTER 15 I
This chapter describes the overview of the I
2
and I
C interface operation.
2
C INTERFACE
2
C interface, the configuration and functions of registers,
CHAPTER 16 DMA CONTROLLER (DMAC)
This chapter describes the overview of the DMAC, the configuration and functions of registers, and
DMAC operation.
CHAPTER 17 FLASH MEMORY
This chapter provides an outline of flash memory and explains its register configuration, register
functions, and operations.
CHAPTER 18 MB91F355A/F353A/F356B/F357B SERIAL PROGRAMMING CONNECTION
This chapter describes the serial onboard writing connection (Fujitsu standard) using the AF220/AF210 /
AF120/AF110 Flash Microcontroller Programmer by Yokogawa Digital Computer Corporation.
ii
Page 7
CHAPTER 19 DATA INTERNAL RAM/INSTRUCTION INTERNAL RAM ACCESS
RESTRICTION FUNCTIONS
This chapter outlines a function that restricts access to data internal RAM and instruction internal RAM.
It also explains the configuration and functions of reg isters and internal RAM operatio ns.
APPENDIX
This appendix consists of the following parts: I/O map, interrupt vectors, pin state for each CPU state,
and the instruction lists.
iii
Page 8
• The contents of this document are subject to change without notice.
Customers are advised to consult with sales representatives before ordering.
• The information, such as descriptions of function and application circuit examples, in this document are presented solely for the
purpose of reference to show examples of operations and uses of FUJITSU semiconductor device; FUJITSU does not warrant
proper operation of the device with respect to use based on such information. When you develop equipment incorporating the
device based on such information, you must assume any responsibility arising out of such use of the information. FUJITSU
assumes no liability for any damages whatsoever arising out of the use of the information.
• Any information in this document, including descriptions of function and schematic diagrams, shall not be construed as license
of the use or exercise of any intellectual property right, such as patent right or copyright, or any other right of FUJITSU or any
third party or does FUJITSU warrant non-infringement of any third-party's intellectual property right or other right by using such
information. FUJITSU assumes no liability for any infringement of the intellectual property rights or other rights of third parties
which would result from the use of information contained herein.
• The products described in this document are designed, developed and manufactured as contemplated for general use, including
without limitation, ordinary industrial use, general office use, personal use, and household use, but are not designed, developed
and manufactured as contemplated (1) for use accompanying fatal risks or dangers that, unless extremely high safety is secured,
could have a serious effect to the public, and could lead directly to death, personal injury, severe physical damage or other loss
(i.e., nuclear reaction control in nuclear facility, aircraft flight control, air traffic control, mass transport control, medical life
support system, missile launch control in weapon system), or (2) for use requiring extremely high reliability (i.e., submersible
repeater and artificial satellite).
Please note that FUJITSU will not be liable against you and/or any third party for any claims or damages arising in connection
with above-mentioned uses of the products.
• Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage or loss from such
failures by incorporating safety design measures into your facility and equipment such as redundancy, fire protection, and
prevention of over-current levels and other abnormal operating conditions.
• Exportation/release of any products described in this document may require necessary procedures in accordance with the
regulations of the Foreign Exchange and Foreign Trade Control Law of Japan and/or US export control laws.
• The company names and brand names herein are the trademarks or registered trademarks of their respective owners.
61.1 Features"Table 1.1-2 Comparison of Functions: Internal Memory (Products whose
Memory Capacity is to be Extended and the Configuration of Memory are Currently under Study.)" was changed.
(The column for MB91351A was added.)
7, 81.2 Block Diagram"Figure 1.2-1 MB91F353A/353A/352A/351A Block Diagram" was changed.
"Figure 1.2-2 MB91355A/354A/F355A/F356B/F357B Block Diagram" was
changed.
121.4 Pin Layout"■ Pin layout of the MB91352A and MB91F353A (LQFP-120)" was deleted.
463.1 Memory Space"Figure 3.1-1 MB91F355A, MB91355A, MB91F353A, MB91353A and
MB95F357B Memory Maps" was changed.
(Internal ROM → Internal RAM)
47"Figure 3.1-2 MB91351A Memory Map " was added.
"Figure 3.1-3 MB91354A and MB91352A Memory Map" was changed.
(Internal ROM → Internal RAM)
48"Figure 3.1-4 MB91F356B Memory Map" was added.
xi
Page 16
PageChanges (For details, refer to main body.)
483.1 Memory Space"■ Memory Map" was changed.
(For the MB91V350A, a 512K-byte internal ROM area is used as emulation
RAM for the MB91355A, F355A, 353A, and F353A memory map. In addi-
tion, the instruction internal RAM is extended from 8 KB to 16 KB. → For the
MB91V350A, with the memory map of the MB91355A/F355A/353A/F353A/
F357B, the 512K bytes area of the internal ROM, and with the memory map of
the MB91F356B, the 256K bytes area of the internal ROM, is the emulation
RAM. In addition, internal RAM(Instruction) is extended from 8K bytes to16K
bytes.)
1744.2.2 ACR0 to ACR7
(Area Configuration Registers)
2304.10 Procedure for Setting
a Register
238
to
244
2466.1 8/16-bit Up/Down
2716.2.2 U-TIMER Registers"■ Reload Register (UTIMR)" was changed.
2756.2.3 Operation of the U-
34810.3 Operation of the
5.2 I/O Port Registers"Table 5.2-1 Initial Values and Functions of the Port Function Registers
Counters/Timers
TIMER
External Interrupt and
NMI Controller
"Notes:" was changed.
"(Set both ASR and ACR at the same ti me us ing wo rd access. When acces sing
ASR and ACR using half word, please set ACR after setting ASR.)" was
added.
"■ Procedure for Setting the External Bus Interface" was changed.
(PFRs)" was changed.
("*2" was deleted.)
"■ Overview of the 8/16-bit Up/Down Counters/Timers" was changed.
(The MB91F355A/355A/354A/V350A→ The MB91F355A/355A/354A/
F356B/F357B)
("Note:" was added.)
"■ Calculation of Baud Rate" was changed.
("Note:" was added.)
"■ Operating Procedure for an External Interrupt" was changed.
("1. Terminal and general-purpose I/O port used as external interrupt input are
set to input port." was added.)
38413.3 8-bit D/A Converter
Operation
413, 41414.2.2 Serial I/O Interface
Registers
45015.2.2 Bus Control Regis-
ter (IBCR)
451
to
454
47916.2.1 DMAC ch0 to ch4
Control/Status Registers A
"Table 13.3-1 Logical Expressions for D/A Converter Output Voltage" was
changed.
(Values specified in DADR1 DADR2 DADR3 → Values specified in DADR0
DADR1 DADR2)
"[Bits 15, 14, and 13] Shift clock selection bits (SMD2, SMD1, SMD0: Serial
shift clock mode)" was changed.
"[Bit 12] MSS (Master Slave Select)" was changed.
("Note:" was changed.)
"■ Bus Control Register (IBCR)" was changed.
("Note:" was changed.)
"■ [Bits 28 to 24] IS4 to 0 (Input Select)*: Transfer Source Selection" was
changed.
xii
Page 17
PageChanges (For details, refer to main body.)
49416.3.1 Overview of Opera-
tion
"● Fly-by transfer (I/O → memory)" was changed.
(Access areas used for MB91350A fly-by transfer must be external areas. →
Access areas used for MB91F355A/F356B/F357B/355A fly-by transfer must
be external areas.)
53417.1 Outline of Flash
536"Figure 17.1-3 Memory Map of MB91F356B Flash Memory" was added.
Memory
"Summary of 17.1 Outline of Flash Memory" was changed.
537, 538"■ Sector Address Table of Flash Memory" was changed.
54417.2.2 Flash Memory W ait
"[Bits 2 to 0] WTC2, WTC1, and WTC0 (wait cycle bits)" was changed.
Register (FLWC)
55917.5.2 Data Writing"■ How to Specify Address" was changed.
56818.1 Basic Configuration
of MB91F355A/F353A/
F356B/F357B
Serial Programming Con-
"■ Basic Configuration of MB91F355A/F353A/F356B/F357B Serial Programming Connection" was changed.
("Either a program operating in single-chip mode or a program operating in
internal ROM external bus mode is selected to write." was added.)
nection
56918.2 Pins Used for Fujitsu
Standard Serial Onboard
"Table 18.2-1 Function of Pins Used for Fujitsu Standard Serial Onboard Writing" was changed.
Writing
57318.5 Other Precautionary
Information
"● Oscillation Clock Frequency" was changed.
(4.0 MHz and 12.0 MHz → 10.0 MHz and 12.5 MHz)
"● Port State for Write Operations on Flash Memory" was changed.
(reset state except → initial state in the single-chip mode except)
584APPENDIX A I/O Map"Address 00009C
of Table A-1 I/O Map" was changed.
H
("*1" was added.)
The vertical lines marked in the left side of the page show the changes.
xiii
Page 18
xiv
Page 19
CHAPTER 1
OVERVIEW
The FR family is a standard single-chip microcontroller
that has a 32-bit high-performance RISC CPU as well as
internal I/O resources and bus control configuration for
embedded controllers that require high-performance or
high-speed CPU processing.
This model is an FR60 family model that is based on the
FR30/40 family of CPUs, and offers enhanced bus
access. The FR family is a single-chip microcontroller
with built-in peripheral resources.
1.1 Features
1.2 Block Diagram
1.3 Package Dimensions
1.4 Pin Layout
1.5 List of Pin Functions
1.6 Input-output Circuit Forms
1
Page 20
CHAPTER 1 OVERVIEW
1.1Features
This section describes the features of the FR60 family microcontrollers.
■ FR CPU Features
•32-bit RISC, load/store architecture, five stages pipeline
•Maximum operating frequency of 50 MHz [PLL used: Oscillation at 12.5 MHz]
•16-bit fixed-length instructions (basic instructions), one instruction per cycle
•Memory-to-memory transfer, bit processing, instructions including barrel shift, etc.--instructions
appropriate for embedded applications
•Function entry and exit instructions, multi load/store instructions of register content--instructions
compatible with high-level languages
•Register interlock function to facilitate assembly- language coding
•Built-in multiplier/instruction-level support
•Signed 32-bit multiplication: 5 cycles
•Interrupts (saving of PC and PS): 6 cycles, 16 priority lev els
•Harvard architecture enabling simultaneous execution of both program access and data access
•Instructions compatible with the FR family
■ Bus Interface
•Maximum operating frequency of 25 MHz
•24-bit address full output (16M bytes space) capability
•8/16-bit data output
•Prefetch buffer installed
•Use of unused data/address pins as general-purpose I/O ports
•Totally independent 4-area chip select outputs that can be configured in units as small as 64K bytes
•Supported interface for each type of memory
•Basic bus cycle (2 cycles)
•Automatic wait cycle generator that can be programmed for each area and can insert waits.
•External wait cycle using RDY input
•DMA support of fly-by transfer capable of wait control for independent I/O
•Signed 16-bit multiplication: 3 cycles
(21-bit address full output (2M bytes space) capability: MB91F353A/351A/35 2A/353A)
SRAM and ROM/FLASH
Page mode FLASHROM and page mode ROM interface
(The MB91F353A/351A/352A/353A does not support fly-by transfer.)
2
Page 21
■ Internal Memory
Table 1.1-1 provides details about internal memory.
•Fly-by transfer supported between external I/O and memory
•Transfer data size that can be selected from 8, 16, and 32 bits
•Multibyte transfer supported (defined by software)
•DMAC descriptor I/O area (200 to 240
(The MB91F353A/351A/352A/353A does not have an external interface.)
External pin transfer is not supported. Demand transfer and fly-by transfer cannot be used.
■ Bit Search Module (Used by REALOS)
•Searches for the position of the first bit varying between 1 and 0 in the MSB of a word
■ Various Timers
•16-bit reload timer; 4 channels (including 1 channel for REALOS)
The internal clock can be selected using divide by 2, 8, or 32.
(For ch3, divide by 64 or 128 can also be selected.)
Note 1)* : Values do not include resin protrusion.
Resin protrusion is +0.25(.010)Max(each side).
Note 2) Pins width and pins thickness include plating thickness
Note 3) Pins width do not include tie bar cutting remainder.
0.145±0.055
89132
88
(.006±.002)
0.08(.003)
Details of "A" part
P-LFQFP176-24×24-0.50
+0.20
–0.10
1.50
(Mounting height)
+.008
–.004
.059
INDEX
176
1
LEAD No.
C
2003 FUJITSU LIMITED F176006S-c-4-6
0.50(.020)
0.22±0.05
(.009±.002)
0.08(.003)
0.10±0.10
0˚~8˚
45
44
M
"A"
0.50±0.20
(.020±.008)
0.60±0.15
(.024±.006)
Dimensions in mm (inches).
Note: The values in parentheses are reference values.
Note 1) * : These dimensions do not include resin protrusion.
Resin protrusion is +0.25(.010) MAX(each side).
Note 2) Pins width and pins thickness include plating thickness.
Note 3) Pins width do not include tie bar cutting remainder.
+.016
SQ
60
0.08(.003)
P-LFQFP120-16×16-0.50
Details of "A" part
+0.20
–0.10
1.50
(Mounting height)
+.008
.059 –.004
10
INDEX
120
130
LEAD No.
0.50(.020)
C
2002 FUJITSU LIMITED F120033S-c-4-4
0.22±0.05
(.009±.002)
31
0.08(.003)
0~8
"A"
+0.05
–0.03
M
0.145
.006
+.002
–.001
Dimensions in mm (inches).
Note: The values in parentheses are reference values.
˚
0.60±0.15
(.024±.006)
0.10±0.05
(.004±.002)
(Stand off)
0.25(.010)
Page 29
1.4Pin Layout
88
Figure 1.4-1 , Figure 1.4-2 show the FR60 family pin layouts.
■ Pin Layout of the MB91F355A/354A/355A/F356B/F357B
The installed package is FPT-176P-M02.
Figure 1.4-1 Pin Layout of the MB91F355A/354A/355A/F356B/F357B
Table 1.5-1 lists the functions of the pins. Table 1.5-2 lists the power supply and GND
pins. See Figure 1.4-1 , Figure 1.4-2 for the pin layouts.
■ List of Pin Functions
Table 1.5-1 Pin Functions (1 / 13)
Pin number
176 pins120 pins
1 to 81 to 8
9 to 169 to 16
19 to 2617,20 to 26
27 to 3427 to 34
37 to 4135 to 39
I/O
Pin name
D16 to D23
P20 to P27Can be used as a port in external bus 8-bit mode.
D24 to D31
P30 to P37Can be used as a port in single-chip mode.
A00 to A07
P40 to P47Can be used as a port in single-chip mode.
A08 to A15
P50 to P57Can be used as a port in single-chip mode.
A16 to A20
P60 to P64
circuit
type
C
C
C
C
C
Function
Bits 16 to 23 of the external data bus.
Valid only in external bus mode.
Bits 24 to 31 of the external data bus.
Valid only in external bus mode.
Bits 0 to 7 of the external address bus.
Valid only in external bus mode.
Bits 8 to 15 of the external address bus.
Valid only in external bus mode.
Bits 16 to 20 of the external address bus.
Valid only in external bus mode.
Can be used as a port in single-chip mode or when an
external address bus is not used.
A21 to A23
42 to 44-
P65 to P67
47, 48106,105DA0, DA1-D/A converter output pin
49-DA2-D/A converter output pin
50 to 57113 to 120AN0 to AN 7GAnalog input pin
58 to 61-AN8 to AN11GAnalog input pin
TOT0 to
TOT3
67 to 70-
PP0 to PP3
C
D
Bits 21 to 23 of the external address bus.
Valid only in external bus mode.
Can be used as a port in single-chip mode or when an
external address bus is not used.
[TOT0 to TOT3] are reload timer output ports.
This function is valid when timer output is enabled.
[PP0 to PP3] are general-purpose I/O ports.
This function is valid when the timer output function is
disabled.
13
Page 32
CHAPTER 1 OVERVIEW
Table 1.5-1 Pin Functions (2 / 13)
Pin number
176 pins120 pins
7197
72-
7398
74 to 78-
Pin name
OC0
PO0
OC1
PO1
OC2
PO2
OC3 to OC7
PO3 to PO7
PPG0
I/O
circuit
type
D
D
D
D
Function
[OC0] is an output compare output pin.
[PO0] is a general-purpose I/O port.
This function can be used as a port when output compare
output is not used.
[OC1] is an output compare output pin.
[PO1] is a general-purpose I/O port.
This function can be used as a port when output compare
output is not used.
[OC2] is an output compare output pin.
[PO2] is a general-purpose I/O port.
This function can be used as a port when output compare
output is not used.
[OC3 to OC7] are output compare output pins.
[PO3 to PO7] are general-purpose I/O ports.
This function can be used as a port when output compare
output is not used.
[PPG0] is a PPG timer output pin.
8170
82-
8371
84-
8572
PN0
PPG1
PN1
PPG2
PN2
PPG3
PN3
PPG4
PN4
PPG5
D
D
D
D
D
[PN0] is a general-purpose I/O port.
This function can be used as a port when PPG timer output
is not used.
[PPG1] is a PPG timer output pin.
[PN1] is a general-purpose I/O port.
This function can be used as a port when PPG timer output
is not used.
[PPG2] is a PPG timer output pin.
[PN2] is a general-purpose I/O port.
This function can be used as a port when PPG timer output
is not used.
[PPG3] is a PPG timer output pin.
[PN3] is a general-purpose I/O port.
This function can be used as a port when PPG timer output
is not used.
[PPG4] is a PPG timer output pin.
[PN4] is a general-purpose I/O port.
This function can be used as a port when PPG timer output
is not used.
[PPG5] is a PPG timer output pin.
86-
14
PN5
D
[PN5] is a general-purpose I/O port.
This function can be used as a port when PPG timer output
is not used.
Page 33
Table 1.5-1 Pin Functions (3 / 13)
Pin number
176 pins120 pins
8773
Pin name
SI6
AIN0
TRG0
PM0
SO6
I/O
circuit
type
D
Function
[SI6] is data input for serial I/O6.
Since this input is always used when serial I/O6 input is
operating, output using the port must be stopped beforehand
unless this operation is the intended operation.
[AIN0] is input for the up/down timer.
Since this input is always used when input is allowed,
output using the port must be stopped beforehand unless
this operation is the intended operation.
[TRG0] is external trigger input for PPG timer 0.
Since this input is always used when input is allowed,
output using the port must be stopped beforehand unless
this operation is the intended operation.
[PM0] is a general-purpose I/O port.
This function can be used as a port when serial I/O, up/
down timer, and PPG timer output are not used.
[SO6] is data output from serial I/O6.
This function is valid when data output from serial I/O6 is
allowed.
8874
8975
BIN0
TRG1
PM1
SCK6
ZIN0
TRG2
[BIN0] is input for the up/down timer.
Since this input is always used when input is allowed,
output using the port must be stopped beforehand unless
this operation is the intended operation.
D
[TRG1] is external trigger input for PPG timer 1.
Since this input is always used when input is allowed,
output using the port must be stopped beforehand unless
this operation is the intended operation.
[PM1] is a general-purpose I/O port.
This function can be used as a port when serial I/O, up/
down timer, and PPG timer output are not used.
[SCK6] is clock I/O for serial I/O6.
This function is valid when clock output from serial I/O6 is
allowed or when external shift clock input is used.
[ZIN0] is input for the up/down timer.
Since this input is always used when input is allowed,
output using the port must be stopped beforehand unless
this operation is the intended operation.
D
[TRG2] is external trigger input for PPG timer 2.
Since this input is always used when input is allowed,
output using the port must be stopped beforehand unless
this operation is the intended operation.
PM2
[PM2] is a general-purpose I/O port.
This function can be used as a port when serial I/O, up/
down timer, and PPG timer output are not used.
15
Page 34
CHAPTER 1 OVERVIEW
Table 1.5-1 Pin Functions (4 / 13)
Pin number
176 pins120 pins
9078
Pin name
SI7
AIN1*
TRG3
PM3
S07
I/O
circuit
type
D
Function
[SI7] is data input for serial I/O7.
Since this input is always used when serial I/O7 input is
operating, output using the port must be stopped beforehand
unless this operation is the intended operation.
[AIN1] is input for the up/down timer.
Since this input is always used when input is allowed,
output using the port must be stopped beforehand unless
this operation is the intended operation.
*
: The 120-pin version does not support this function.
[TRG3] is external trigger input for PPG timer 3.
Since this input is always used when input is allowed,
output using the port must be stopped beforehand unless
this operation is the intended operation.
[PM3] is a general-purpose I/O port.
This function can be used as a port when serial I/O, up/
down timer, and PPG timer output are not used.
[S07] is data output from serial I/O7.
This function is valid when data output from serial I/O7 is
allowed.
9179
BIN1*
TRG4
PM4
[BIN1] is input for the up/down timer.
Since this input is always used when input is allowed,
output using the port must be stopped beforehand unless
this operation is the intended operation.
*
D
: The 120-pin version does not support this function.
[TRG4] is external trigger input for PPG timer 4.
Since this input is always used when input is allowed,
output using the port must be stopped beforehand unless
this operation is the intended operation.
[PM4] is a general-purpose I/O port.
This function can be used as a port when serial I/O, up/
down timer, and PPG timer output are not used.
16
Page 35
Table 1.5-1 Pin Functions (5 / 13)
Pin number
176 pins120 pins
9280
9442
Pin name
SCK7
ZIN1*
TRG5*
PM5
SDA
I/O
circuit
type
D
F
Function
[SCK7] is clock I/O for serial I/O7.
This function is valid when clock output from serial I/O7 is
allowed or when external shift clock input is used.
[ZIN1] is input for the up/down timer.
Since this input is always used when input is allowed,
output using the port must be stopped beforehand unless
this operation is the intended operation.
*
: The 120-pin version does not support this function.
[TRG5] is external trigger input for PPG timer 5.
Since this input is always used when input is allowed,
output using the port must be stopped beforehand unless
this operation is the intended operation.
*
: The 120-pin version does not support this function.
[PM5] is a general-purpose I/O port.
This function can be used as a port when serial I/O, up/
down timer, and PPG timer output are not used.
[SDA] is a DATA I/O pin for the I
This function is valid when the I
2
C bus.
2
C is allowed to operate in
standard mode.
Output using the port must be stopped beforehand unless
this operation is intended (open drain output).
9541
98 to 10381 to 86
[PL0] is a general-purpose I/O port.
PL0
This function can be used as a port when I
not allowed (open drain output).
2
C bus.
2
C is allowed to operate in
SCL
[SCL] is a CLK I/O pin for the I
This function is valid when the I
standard mode.
F
Output using the port must be stopped beforehand unless
this operation is intended (open drain output).
[PL1] is a general-purpose I/O port.
PL1
This function can be used as a port when I
not allowed (open drain output).
[INT0 to INT5] are external interrupt input.
Since this input is always used when the corresponding
INT0 to INT5
E
external interrupt is allowed, output using the port must be
stopped beforehand unless this operation is the intended
operation.
PK0 to PK5[PK0 to PK5] are general-purpose I/O ports.
2
C operation is
2
C operation is
17
Page 36
CHAPTER 1 OVERVIEW
Table 1.5-1 Pin Functions (6 / 13)
Pin number
176 pins120 pins
10487
10588
I/O
Pin name
INT6
FRCK
PK6[PK6] is a general-purpose I/O port.
INT7
ATG
circuit
type
E
E
Function
[INT6] is external interrupt input.
Since this input is always used when the corresponding
external interrupt is allowed, output using the port must be
stopped beforehand unless this operation is the intended
operation.
[FRCK] is external clock input pin for the free-running
timer.
Since this input is always used when it is selected as
external clock input for the free-running timer, output using
the port must be stopped beforehand unless this operation is
the intended operation.
[INT7] is external interrupt input.
Since this input is always used when the corresponding
external interrupt is allowed, output using the port must be
stopped beforehand unless this operation is the intended
operation.
[ATG] is external trigger for the A/D converter.
Since this input is always used when it is selected as the
source of A/D activation, output using the port must be
stopped beforehand unless this operation is the intended
operation.
106 to 113-
11689
11790
PK7[PK7] is a general-purpose I/O port.
[INT8 to INT15] are external interrupt input.
INT8 to
INT15
PJ0 to PJ7[PJ0 to PJ7] are general-purpose I/O ports.
SI0
PI0[PI0] is a general-purpose I/O port.
SO0
PI1
E
D
D
Since this input is always used when the corresponding
external interrupt is allowed, output using the port must be
stopped beforehand unless this operation is the intended
operation.
[SI0] is data input for UART0.
Since this input is always used when UART0 input is
operating, output using the port must be stopped beforehand
unless this operation is the intended operation.
[SO0] is data output from UART0.
This function is valid when UART0 data output is allowed.
[PI1] is a general-purpose I/O port.
This function is valid when UART0 data output is not
allowed.
18
Page 37
Table 1.5-1 Pin Functions (7 / 13)
Pin number
176 pins120 pins
11891
11992
12093
12194
I/O
Pin name
SCK0
PI2
SI1
PI3[PI3] is a general-purpose I/O port.
SO1
PI4
SCK1
PI5
circuit
type
D
D
D
D
Function
[SCK0] is clock I/O for UART0.
This function is valid when UART0 clock output is allowed
or when external clock input is used.
[PI2] is a general-purpose I/O port.
This function is valid when UART0 clock output is not
allowed or when external clock input is not used.
[SI1] is data input for UART1.
Since this input is always used when UART1 input is
operating, output using the port must be stopped beforehand
unless this operation is the intended operation.
[SO1] is data output from UART1.
This function is valid when UART1 data output is allowed.
[PI4] is a general-purpose I/O port.
This function is valid when UART1 data output is not
allowed.
[SCK1] is clock I/O for UART1.
This function is valid when UART1 clock output is allowed
or when external clock input is used.
[PI5] is a general-purpose I/O port.
This function is valid when UART1 clock output is not
allowed or when external clock input is not used.
12299
123100
124101
[SI2] is data input for UART2.
SI2
D
PH0[PH0] is a general-purpose I/O port.
SO2
D
PH1
SCK2
D
PH2
Since this input is always used when UART2 input is
operating, output using the port must be stopped beforehand
unless this operation is the intended operation.
[SO2] is data output from UART2.
This function is valid when UART2 data output is allowed.
[PH1] is a general-purpose I/O port.
This function is valid when UART2 data output is not
allowed or when external shift clock input is used.
[SCK2] is clock I/O for UART2.
This function is valid when UART2 clock output is allowed
or when external clock input is used.
[PH2] is a general-purpose I/O port.
This function is valid when UART2 clock output is not
allowed or when external clock input is not used.
19
Page 38
CHAPTER 1 OVERVIEW
Table 1.5-1 Pin Functions (8 / 13)
Pin number
176 pins120 pins
125102
126103
127104
128-
I/O
Pin name
SI3
PH3[PH3] is a general-purpose I/O port.
SO3
PH4
SCK3
PH5
SI4
circuit
type
D
D
D
D
Function
[SI3] is data input for UART3.
Since this input is always used when UART3 input is
operating, output using the port must be stopped beforehand
unless this operation is the intended operation.
[SO3] is data output from UART3.
This function is valid when UART3 data output is allowed.
[PH4] is a general-purpose I/O port.
This function is valid when UART3 data output is not
allowed.
[SCK3] is clock I/O for UART3.
This function is valid when UART3 clock output is allowed
or when external clock input is used.
[PH5] is a general-purpose I/O port.
This function is valid when UART3 clock output is not
allowed or when external clock input is not used.
[SI4] is data input for UART4.
Since this input is always used when UART4 input is
operating, output using the port must be stopped beforehand
unless this operation is the intended operation.
129-
130-
131-
PG0[PG0] is a general-purpose I/O port.
[SO4] is data output from UART4.
SO4
D
PG1
SCK4
D
PG2
SI5
D
PG3[PG3] is a general-purpose I/O port.
This function is valid when serial I/O4 data output is
allowed.
[PG1] is a general-purpose I/O port.
This function is valid when serial I/O4 data output is not
allowed.
[SCK4] is clock I/O for UART4.
This function is valid when serial I/O4 clock output is
allowed or when external clock input is used.
[PG2] is a general-purpose I/O port
This function is valid when serial I/O4 clock output is not
allowed or when external clock input is not used.
[SI5] is data input for serial I/O5.
Since this input is always used when serial I/O5 input is
operating, output using the port must be stopped beforehand
unless this operation is the intended operation.
20
Page 39
Table 1.5-1 Pin Functions (9 / 13)
Pin number
Pin name
176 pins120 pins
I/O
circuit
type
Function
[SO5] is data output from serial I/O5.
SO5
This function is valid when serial I/O5 data output is
allowed.
132-
D
[PG4] is a general-purpose I/O port.
PG4
This function is valid when serial I/O5 data output is not
allowed.
[SCK5] is clock I/O for serial I/O5.
SCK5
This function is valid when serial I/O5 clock output is
allowed or when external shift clock input is used.
133-
D
[PG5] is a general-purpose I/O port.
PG5
This function is valid when serial I/O5 clock output is not
allowed or when external clock input is not used.
[DREQ2] is DMA external transfer request input.
Since this input is always used when it is selected as the
147-
DREQ2
C
source of DMA activation, output using the port must be
stopped beforehand unless this operation is the intended
operation.
PC0[PC0] is a general-purpose I/O port.
[DACK2] is DMA external transfer request acceptance
output.
This function is valid when DMA transfer request
acceptance output is allowed.
148-
DACK2
C
[PC1] is a general-purpose I/O port.
PC1
This function is valid when DMA transfer request
acceptance output is allowed.
21
Page 40
CHAPTER 1 OVERVIEW
Table 1.5-1 Pin Functions (10 / 13)
Pin number
176 pins120 pins
149-
150-
151-
I/O
Pin name
DEOP2
DSTP2
PC2
DREQ0
PB0[PB0] is a general-purpose I/O port.
DACK0
PB1
circuit
type
C
C
C
Function
[DEOP2] is DMA external transfer end output.
This function is valid when DMA external transfer end
output is allowed.
[DSTP2] is DMA external transfer stop input.
This function is valid when DMA external transfer stop
input is allowed.
[PC2] is a general-purpose I/O port.
This function is valid when DMA external transfer end
output and external transfer stop input are not allowed.
[DREQ0] is DMA external transfer request input.
Since this input is always used when it is selected as the
source of DMA activation, output using the port must be
stopped beforehand unless this operation is the intended
operation.
[DACK0] is DMA external transfer request acceptance
output.
This function is valid when DMA transfer request
acceptance output is allowed.
[PB1] is a general-purpose I/O port.
This function is valid when DMA transfer request
acceptance output is not allowed.
152-
153-
[DEOP0] is DMA external transfer end output.
DEOP0
DSTP0
PB2
DREQ1
PB3[PB3] is a general-purpose I/O port.
C
C
This function is valid when DMA external transfer end
output is allowed.
[DSTP0] is DMA external transfer stop input.
This function is valid when DMA external transfer stop
input is allowed.
[PB2] is a general-purpose I/O port.
This function is valid when DMA external transfer end
output and external transfer stop input are not allowed.
[DREQ1] is DMA external transfer request input.
Since this input is always used when it is selected as the
source of DMA activation, output using the port must be
stopped beforehand unless this operation is the intended
operation.
22
Page 41
Table 1.5-1 Pin Functions (11 / 13)
Pin number
176 pins120 pins
154-
155-
156-
Pin name
DACK1
PB4
DEOP1
DSTP1
PB5
IOWR
PB6
I/O
circuit
type
C
C
C
Function
[DACK1] is DMA external transfer request acceptance
output.
This function is valid when DMA transfer request
acceptance output is allowed.
[PB4] is a general-purpose I/O port.
This function is valid when DMA external transfer request
acceptance output is not allowed.
[DEOP1] is DMA external transfer end output.
This function is valid when DMA external transfer end
output is allowed.
[DSTP1] is DMA external transfer stop input.
This function is valid when DMA external transfer stop
input is allowed.
[PB5] is a general-purpose I/O port.
This function is valid when DMA external transfer end
output and external transfer stop input are not allowed.
[IOWR
] is write strobe output for DMA fly-by transfer.
This function is valid when write strobe output for DMA
fly-by transfer is allowed.
[PB6] is a general-purpose I/O port.
This function is valid when write strobe output for DMA
fly-by transfer is not allowed.
157-
15866
15967
16068
IORD
PB7
CS0
PA0
CS1
PA1
CS2
PA2
[IORD
] is read strobe output for DMA fly-by transfer.
This function is valid when read strobe output for DMA fly-
C
C
C
C
by transfer is allowed.
[PB7] is a general-purpose I/O port.
This function is valid when read strobe output for DMA flyby transfer is not allowed.
] is chip select 0 output.
[CS0
This function is valid in external bus mode.
[PA0] is a general-purpose I/O port.
This function is valid in single-chip mode.
] is chip select 1 output.
[CS1
This function is valid when chip select 1 output is allowed.
[PA1] is a general-purpose I/O port.
This function is valid when chip select 1 output is not
allowed.
] is chip select 2 output.
[CS2
This function is valid when chip select 2 output is allowed.
[PA2] is a general-purpose I/O port.
This function is valid when chip select 2 output is not
allowed.
23
Page 42
CHAPTER 1 OVERVIEW
Table 1.5-1 Pin Functions (12 / 13)
Pin number
176 pins120 pins
16169
16445
16546
Pin name
CS3
PA3
RDY
IN0
P80
BGRNT
IN1
I/O
circuit
type
C
D
D
Function
] is chip select 3 output.
[CS3
This function is valid when chip select 3 output is allowed.
[PA3] is a general-purpose I/O port.
This function is valid when chip select 3 output is not
allowed.
[RDY] is external ready input.
This function is valid when external ready input is allowed.
[IN0] is an input capture input pin.
Since this input is always used when it is selected for input
capture input, output using the port must be stopped
beforehand unless this operation is the intended operation.
[P80] is a general-purpose I/O port.
This function is valid when external ready input is not
allowed.
[BGRNT
The low level is output when the external bus is open.
This function is valid when output is allowed.
[IN1] is an input capture input pin.
Since this input is always used when it is selected for input
capture input, output using the port must be stopped
beforehand unless this operation is the intended operation.
] is external bus open acceptance output.
16647
16748
P81
BRQ
IN2
P82
RD
P83
[P81] is a general-purpose I/O port.
This function is valid when external bus open acceptance is
not allowed.
[BRQ] is external bus open request input.
Input to the high level [1] if you want to open the external
bus.
This function is valid when input is allowed.
[IN2] is an input capture input pin.
D
D
Since this input is always used when it is selected for input
capture input, output using the port must be stopped
beforehand unless this operation is the intended operation.
[P82] is a general-purpose I/O port.
This function is valid when external bus open request is not
allowed.
] is external bus read strobe output.
[RD
This function is valid in external bus mode.
[P80] is a general-purpose I/O port.
This function is valid in single-chip mode.
24
Page 43
Table 1.5-1 Pin Functions (13 / 13)
Pin number
176 pins120 pins
16849
16950
17062
Pin name
WR0
P84
WR1
IN3
P85
SYSCLK
P90
I/O
circuit
type
D
D
C
Function
] is external bus write strobe output.
[WR0
This function is valid in external bus mode.
[P80] is a general-purpose I/O port.
This function is valid in single-chip mode.
[WR1
] is external bus write strobe output.
This function is valid when WR1
mode is allowed.
[IN3] is an input capture input pin.
Since this input is always used when it is selected for input
capture input, output using the port must be stopped
beforehand unless this operation is the intended operation.
[P85] is a general-purpose I/O port.
This function is valid when external bus write enable output
is not allowed.
[SYSCLK] is system clock output.
This function is valid when system clock output is allowed.
A clock having the same frequency as the external bus
operating frequency is output (stopped in stop mode).
[P90] is a general-purpose I/O port.
This function is valid when system clock output is not
allowed.
output in external bus
17163P91C[P91] is a general-purpose I/O port.
[MCLK] is memory clock output.
MCLK
172-
P92
17364P93C[P93] is a general-purpose I/O port.
AS
17465
P94
*: These functions are not supported for the 120-pin version.
C
C
This function is valid when memory clock output is
allowed. A clock having the same frequency as the external
bus operating frequency is output (stopped in sleep mode).
[P92] is a general-purpose I/O port.
This function is valid when memory clock output is not
allowed.
[AS
] is address strobe output.
This function is valid when address strobe output is
allowed.
[P94] is a general-purpose I/O port.
This function is valid when address load output is not
allowed.
25
Page 44
CHAPTER 1 OVERVIEW
Table 1.5-2 Power Supply and GND Pins
Pin number
176 pins120 pins
Pin nameFunction
17,35,65,79,93,96,114,
136,145,162,175
18,36,66,80,97,115,142,14
6,163,176
45107DAVSD/A converter GND pin
46108DAVCD/A converter power supply pin
62109
63110AVRHA/D converter reference power supply pin
64111
18,40,43,59,76,9
6,112
19,44,56,77,95
V
SS
V
CC
AV
CC
/AVRLA/D converter analog GND pin
AV
SS
GND pins. Use the same potential for all pins.
3.3 V power supply pins. Use the same potential
for all pins.
A/D converter analog power supply pin
26
Page 45
1.6Input-output Circuit Forms
This section describes the I/O circuit types listed in Table 1.6-1 .
■ Input-Output Circuit Types
Table 1.6-1 Input-Output Cir cuit Types (1 / 3)
ClassificationCircuit typeRemarks
•Oscillation feedback resistor for high-
X1
Clock input
speed operation (main clock oscillation) :
About 1 MΩ
A
X0
Standby control
•Oscillation feedback resistor for low-
X1A
Clock input
B
X0A
Standby control
speed operation (subclock oscilla ti on) :
About 7 MΩ
•CMOS level output
•CMOS level input
Pull-up control
With standby control
Digital output
With pull- up control
Pull-up resistance = about 50 kΩ (Typ)
C
Digital output
Digital input
Standby control
I
OL
= 8 mA
27
Page 46
CHAPTER 1 OVERVIEW
Table 1.6-1 Input-Output Cir cuit Types (2 / 3)
ClassificationCircuit typeRemarks
•CMOS level output
Pull-up control
•CMOS level hysteresis input
With standby control
Digital output
With pull- up control
Pull-up resistance = about 50 kΩ (Typ)
D
Digital output
Digital input
Standby control
I
OL
= 4 mA
•CMOS level output
•CMOS level hysteresis input
al output
Digit
I
= 4 mA
OL
E
5 V withstand voltage
Digital output
Digital input
•Nch open-drain output
•CMOS level hysteresis input
Digital output
F
Digital input
Standby control
With standby control
5 V withstand voltage
I
= 15 mA
OL
Analog input with switches
28
G
Analog input
Control
Page 47
Table 1.6-1 Input-Output Cir cuit Types (3 / 3)
ClassificationCircuit typeRemarks
•CMOS level hysteresis input
H
Digital input
•CMOS level hysteresis input
With pull-up resistor
Pull-up resistance = about 50 kΩ (Typ)
I
Digital input
•CMOS level input (flash memory
products only)
J
Control signal
Mode input
Diffusion resistor
29
Page 48
CHAPTER 1 OVERVIEW
30
Page 49
CHAPTER 2
HANDLING THE DEVICE
This chapter provides precautions on handling FR famil y
microcontrollers.
2.1 Precautions on Handling the Device
2.2 Precautions on Using the Little-Endian Area
31
Page 50
CHAPTER 2 HANDLING THE DEVICE
2.1Precautions on Handling the Device
This section contains information on the prevention of latch-ups, pin processing,
handling of circuits, input at power-on and so on.
■ Preventing a Latch-up
A latch-up can occur if, on a CMOS IC, a voltage higher than VCC or a voltage lower than VSS is applied to
an input or output pin or a voltage higher than the rating is applied between V
occurs, significantly increases the power supply current and may cause thermal destruction of an element.
When you use a CMOS IC, be very careful not to exceed the maximum rating.
■ Unused Input Pins
Do not leave an unused input pin open, since it may cause a malfunction. Handle by, for example, using a
pull-up or pull-down resistor.
■ Po wer Supply Pins
If more than one VCC or VSS pin exists, those that must be kept at the same potential are designed to be
connected to one other inside the device to prevent malfunctions such as latch-up. Be sure to connect the
pins to a power supply and ground external to the device to minimize u ndesired electromagnetic radiation,
prevent strobe signal malfunctions due to an increase in ground level, and conform to the total output
current rating. Given consideration to connecting the current supply source to V
the lowest impedance possible.
It is also recommended that a ceramic capacitor of around 0.1 µF be connected between V
circuit points close to the device as a bypass capacitor.
and VSS. A latch-up, if it
CC
and VSS of the device at
cc
and VSS at
CC
■ Quartz Oscillation Circuit
Noise near the X0, X1, X0A, and X1A pins may cause the device to malfunction. Design printed circuit
boards so that X0 and X1, X0A and X1A, the quartz oscillator (or ceramic oscillator), and the bypass
capacitor to ground are located as near as possible to one another.
In addition, it is strongly recommended that printed circuit board artwork that surrounds the X0 , X1, X0A,
and X1A pins with ground be used to make stable operation more likely.
■ Note on Using an External Clock
When an external clock is used, use the X0 pin unless otherwise specify and supply a negative-phase clock
to the X1 pin simultaneously. Do not use STOP mode (oscillation stop mode) for this operation because the
X1 pin is disabled when H is output at STOP.
Figure 2.1-1 Example of Using an External Clock (Normal Method)
Note: STOP mode (oscillation stop mode) cannot be used.
X0
X1
32
Page 51
■ Note for the Case of Using No Subclock
When the oscillator is not connect to the X0A,X1A pins, set the X0A pin to the pull-down operation and
open the X1A pin.
Figure 2.1-2 Setting for the Case of Using No Subclock
X0A
OPEN
■ Handling of NC and Open Pins
NC and open pins must be left open.
■ Mode Pins (MD0 to MD2)
These pins must be directly connected to VCC or VSS when they are used. Keep the pattern length between
a mode pin on a printed circuit board and V
low impedance.
■ Power-on
At power-on, be sure to set the INIT pin to the low level.
Also immediately after power-on, keep the INIT
required frequency stability. (For initialization by INIT from the INIT
time is set to the minimum value.)
■ Source Oscillation Input at Power-on
At power-on, be sure to input a source clock until the oscillation stabilization wait time is cleared.
■ Note on Operating in PLL Clock Mode
If the PLL clock mode is selected, the microcontroller attempt to be working with the self-oscillating circuit
even when there is no external oscillator or external clock input is stopped . Performance of this operation,
however, cannot be guaranteed.
X1A
MB91350A
or VSS as short as possible so that they can be connected at a
CC
pin at the L level until the oscillator has reached the
pin, the oscillation stabilization wait
■ Setting the External Bus
The MB91350A model type guarantees a 25 MHz external bus.
If the base clock is set to 50 MHz without the DIVR1 (external bus base clock freq.-divide setting register)
initial value being unchanged, the external bus will also be set to 50 MH z. When changing the base clock,
first set the external bus so that it does not exceed 25 MHz and then change the base clock.
■ MCLK and SYSCLK
The difference between MCLK and SYSCLK is that MCLK stops in sleep mode and stop mode whereas
SYSCLK stops only in stop mode. Use MCLK or SYSCLK, whichever is appropriate.
After initialization, MCLK is disabled (PORT) and SYSCLK is enabled. To use MCLK, you must set the
port function register (PFR) to use MCLK.
33
Page 52
CHAPTER 2 HANDLING THE DEVICE
■ Pull-up Control
The AC specification will not be guaranteed if pull-u p resi stor is connected to pins that are used as external
bus pins.
In addition, ports for which pull-up resistor is connected will be disabled in stop mode with HIZ = 1 and for
hardware standby.
■ Clock Controller
When inputting the low level to INIT, allocate wait time to allow oscillation to stabilize.
■ Subclock Switching
Immediately after switching the clock source to subclock mode from the main clock, insert at least one
NOP instruction.
Only word access is supported for the BSD0, BSD1, and BDSC registers.
■ D-bus Memory
Because instruction fetch to the D-bus memory is not executed, do not set the code area in the D-bus
memory.
If instruction fetch to the D-bus memory is executed, incorrect data will be interpreted for the codes,
causing a runaway condition.
■ Low-power Consumption Mode
When sleep or stop mode is set, always read the same registers immediately after writing to the standby
control register (STCR).
Specifically, use the sequence given below.
In addition, after returning from standby mode, set the I flag, ILM, and ICR to branch to the interrupt
handler that causes the return.
(ldi #value_of_standby, r0)
(ldi #_STCR, r12)
stb r0, @r12 // set STOP/SLEEP bit
ldub @r12, r0 // Must read STCR
ldub @r12, r0 // after reading, go into standby mode
nop // Must insert NOP * 5
nop
nop
nop
nop
34
Page 53
■ Prefetch
When prefetch to an area set as little endian is allowed, restrict access to that area to word (32-bit) access.
Access will be incorrect if byte or halfword access is allowed.
■ Accessing I/O Ports
Only byte access is supported for port access.
■ Switching Shared Port Functions
Use the port function register (PFR) to switch the pins that also serve as ports. To switch the bus pins, use
the external bus setting.
■ Internal RAM
The function that restricts internal RAM size operates immediately after a reset is cleared. Only 4K bytes
can be used for data and another 4K bytes for program execution regardless of the amount of RAM
installed for the device.
To release the restriction function, rewrite the setting of the function.
In addition, if the above setting would be rewritten, include at least one NOP instructio n immediately after
that processing.
■ Flash Memory
In programming mode, flash memory cannot be used for interrupt vector tables (reset is enabled).
■ Notes of PS Register
Since some instructions process the PS register first, interrupt processing routines can lead to breaks during
debugging or updating of the PS register flag due to the following exceptions.
Whichever the case, the program is designed to reprocess correctly after returning from EIT to ensure that
operation before and after EIT conforms to specifications.
1 The following operations may occur when (a) user interrupt/NMI is received, (b) step execution is
performed, (c) break occurs in a data event or emulator menu in an immediately preceding DIVOU/
DIVOS instruction.
(1) D0 and D1 flags precede and are renewed.
(2) EIT processing routine (user interruption, NMI or emulator) is executed .
(3) After returning from EIT, DIVOU/DIVOS instructions are executed and the D0 and D1 flags are
updated to the same value as (1).
2 When each ORCCR/STILM/MOV Ri and PS instruction is executed to permit interrupting with the user
interruption and the NMI factor generated, the following operations are done.
(1) The PS register precedes and is updated.
(2) EIT processing routine (user interruption, NMI, or emulator) is executed.
(3) After returning from EIT, the above instructions are executed and the PS register is updated to the
same value as (1).
35
Page 54
CHAPTER 2 HANDLING THE DEVICE
■ Precautions on the Debuggers
● Single-step execution of the RETI instruction
In an environment where interrupts frequently occur, only the relevant interrupt processing routines are
executed repeatedly during single-step execution.
As a result, the main routines and programs that have a low interrupt level will not be executed. (For
example, if the RETI is executed in single-step mode with timebase timer interrupts allowed, the break will
always be at the beginning of the timebase routine.)
For stages in which debugging of the relevant interrupt processing routines is not required, disable the
relevant interrupts.
● Break function
If the target address of a hardware break (including event breaks) is the address of the current system stack
pointer or if the target address is set in an area that contains the stack pointer, a break will occur after one
instruction is executed. This applies even when there is no data access instruction in the user program.
To avoid the problem, do not set word access for the area that contains the address of the system stack
pointer as a target of a hardware break (including event breaks).
● Internal ROM (flash memory and MASK ROM)
Note the following points when using an evaluation chip:
•Do not set the internal ROM area as the DMAC transfer destination.
•If the internal ROM area is set as the DMAC transfer destination, the internal ROM area may be
rewritten if a break occurs during DMAC transfer. (The internal ROM area can be set as the DMAC
transfer source.)
● Concurrent occurrence of a software break (INTE instruction) and user interrupt or NMI
If a software break and a user interrupt or NMI occur concurrently, the following problems occur in the
debugger:
•The debugger stops, indicating a point other than the break point set by the user.
•After having stopped, the debugger does not correctly execute processing.
If this problem occurs, use a hardware break in place of a software break. If you use a monitor debugger,
avoid setting a break at the relevant point.
● About the operand break
If there is a stack pointer in an area that is set as operand break of DSU, the system may cause
malfunctions. Do not set the access for the area that contains the address of the system stack pointer as a
target of a data event break.
36
Page 55
2.2Precautions on Using the Little-Endian Area
This section provides precautions on using the little-endian area.
■ Precautions on Using the Little-Endian Area
Note the precautions for the following items when using the little-endian area:
•C compiler
•Assembler
•Linker
•Debuggers
37
Page 56
CHAPTER 2 HANDLING THE DEVICE
2.2.1C Compiler (fcc911)
When programming with the C language, operation will be unpredictable if the following
operations are executed for the little-endian area:
• Mapping of variables with initial values
• Structure assignment
• Manipulation of arrays other than character-type arrays using character string
operation functions
• Specification of the -K lib option when character string operation functions are being
used
• Use of the double type and long double type
• Mapping of the stack to the little-endian area
■ Mapping of Variables with Initial Values
Variables with initial values cannot be mapped to the little-endian area.
The compiler does not have a function for gen erating little-endian initial values. V ariables can be mapped
to the little-endian area, but initial values cannot be set.
Provide processing at the beginning of the program that sets initial values.
Example:
Setting an initial value for the variable little_data in the little-endian area
extern int little_data;
void little_init(void) {
little_data = initial value;
}
void main(void) {
little_init( );
...
}
38
Page 57
■ Structure Assignment
When structures are assigned among structures, the compiler selects the optimum transfer method and
executes transfer for each byte, halfword, and word.
As a result, the correct result will not be obtained i f structure assignment spans structure variables assigned
to the regular area and structure variables assigned to the little-endian area.
Assign the members of a structure individually.
Example:
Assigning a structure to the structure variable little_st in the little-endian area
struct tag { char c; int i; } normal_st;
extern struct tag little_st;
In addition, mapping of the structure m embers de pends on the compiler. If a different compiler was used to
compile a structure, the members will be mapped differently. In this case, the correct result will not be
obtained even though the method described above is used.
If the mappings of the structure members do not match, do not map structure variables in the little-endian
area.
■ Manipulation of Arrays Other than Character-type Arrays Using Character String
Operation Functions
Character string operation functions provided as a standard library are processed in byte units.
As a result, the correct result will not be obtained if processing that uses character string operation
functions is executed for areas that have a type other than char, unsigned char, or signed char mapped in the
little-endian area.
Do not execute this type of processing.
Incorrect processing example:
Transferring word data using memcpy
int big = 0x01020304; /* Big-endian area */
extern int little; /* Little-endian area */
memcpy(&little,&big,4); /* Transfer using memcpy */
The result of the executing the above code is shown below. An error occurs when word data is transferred.
(Big-endian area)(Little-endian area)
01 02 03 0401 02 03 04
(Correct result)
memcpy
04 03 02 01
39
Page 58
CHAPTER 2 HANDLING THE DEVICE
■ Specification of the -K lib Option when Character String Operation Functions are Used
When the -K lib option is specified, the compiler expands several character string operation functions
inline. Because the compiler selects the optimum processing method at this time, processing may change
for each halfword or word.
If the processing changes, processing for the little-endian area will not be executed correctly.
Do not specify the -K lib option when executing processing that uses character string operation fu nctions
for the little-endian area. In addition, do not specify the -O 4 or -K speed option that includes the -K lib
option.
■ Use of the Double Type and Long Double Type
In double type access, the high-order word is accessed. In long double type access, the low-order word is
accessed.
For this reason, the correct result will not be obtained when double type and long double type variables
mapped in the little-endian area are accessed.
Variables of the same type allocated in the little-endian area can be assigned among the variables.
However, optimization can replace the assignment of these variables with an assignment of literals.
Do not map double type and long double type variables in the little-endian area.
Incorrect processing example:
Transferring double type data
double big = 1.0; /* Big-endian area */
extern int little; /* Little-endian area */
little = big; /* Transfer double type data */
The result of executing the above code is shown below. An error occurs when the double type data is
transferred.
(Big-endian area)(Little-endian area)
3f f0 00 00 00 00 00 00
(Correct result)
00 00 00 00 00 00 f0 3f
00 00 f0 3f 00 00 00 00
■ Mapping of the Stack to the Little-endian Area
Operation will be unpredictable if part or all of the stack is mapped to the little-endian area.
40
Page 59
2.2.2Assembler (fasm911)
/
Note the following points regarding the little-endian area when programming with the
FR assembly language:
■ Sections
Since the main purpose of the little-endian area is to exchange data with little-endi an system CPUs, define
the little-endian area as a data section without initial values.
Access by the MB91101 will be unpredictable if a code, stack, or data section with initial values is
specified in the little-endian area.
Example:
* Correct section definitions of the little-endian area */
.SECTION Little_Area, DATA, ALIGN=4
Little_Word:
.RES.W 1
Little_Half:
.RES.H 1
Little_Byte:
.RES.B 1
■ Accessing Data
When data in the little-endian area is accessed, the data values can be coded without having to take the byte
ordering into consideration.
However, when accessing data in the little-endian area, access it using the data size.
Example:
LDI #0x01020304, r0
LDI #Little_Word, r1
LDI #0x0102, r2
LDI #Little_Half, r3
LDI #0x01, r4
LDI #Little_Byte, r5
/* Using the ST instruction (or LD instruction) to access 32-bit data*/
ST r0, @r1
/* Using the STH instruction (or LDH instruction) to access 16-bit data*/
STH r2, @r3
/* Using the STB instruction (or LDB instruction) to access 8-bit data*/
STB r4, @r5
The data values will be unpredictable if the MB91350A model type is used to access data using a size that
is not the data size. For example, the data values will be unpredictable if a 32-bit access instruction is used
to access two consecutive 16-bit data items at one time.
41
Page 60
CHAPTER 2 HANDLING THE DEVICE
2.2.3Linker (flnk911)
When creating programs that use the little-endian area, note the following points
regarding section mapping at link time:
■ Restriction on Section Types
Only data sections without initial values can be mapped in the little-endian area.
If a data section with initial values, a stack section, or a code section is mapped in the little-endian area,
arithmetic operations such as address decisions will be executed internally in the linker using the bigendian method, causing program operation that is unpredictable.
■ Non-detection of Errors
Because the linker does not recognize the little-endian area, an error message may not be posted if the
restriction described above is not observed.
When using the linker, be careful of the contents for the sections mapped into the little-endian area.
42
Page 61
2.2.4Debuggers (sim911, eml911, and mon911)
When creating programs that use the little-endian area, note the following points
regarding the debuggers:
■ Simulator Debugger
There is no memory space specification command for displaying the little-endian area.
Therefore, when memory operator commands or instructions that manipulate memory are executed, the
area is handled as a big-endian area.
■ Emulator and Monitor Debuggers
Note that the data will not be handled using its correct values when the following commands are used to
access the little-endian area:
•set memory, show memory, enter, examine, and set watch commands
When floating-point (single or double) data is handled, setting or disp lay of the specified values wi ll not
be possible.
•search memory command
When a search uses halfword or word data, execution of the search with the specified values will not be
possible.
•Line/reverse assembly (including display of reverse assembly in the source window)
Setting or display of the correct instruction codes will not be possible. (Do not map instruction codes in
the little-endian area.)
•call and show call commands
Operation will be unpredictable if the stack area is mapped in the l ittle-endian area. (Do not map the
stack area in the little-endian area.)
43
Page 62
CHAPTER 2 HANDLING THE DEVICE
44
Page 63
CHAPTER 3
CPU AND CONTROL UNITS
This chapter provides basic information required to
understand the core CPU functions of FR family
microcontrollers. It covers architecture, specifications,
and instructions.
3.1 Memory Space
3.2 Internal Architecture
3.3 Programming Model
3.4 Data Configuration
3.5 Memory Map
3.6 Branch Instructions
3.7 EIT (Exception, Interrupt, and Trap)
3.8 Operating Modes
3.9 Reset (Device Initialization)
3.10 Clock Generation Control
3.11 Device State Control
3.12 Watch Timer
3.13 Main Clock Oscillation Stabilization Wait Timer
3.14 Peripheral Stop Control
45
Page 64
CHAPTER 3 CPU AND CONTROL UNITS
3.1Memory Space
FR family microcontrollers have a logical address space of 4 GB (232 addresses). The
CPU accesses this space linearly.
■ Direct Addressing Area
The areas in the address space listed below are used for input-output.
These areas called the direct addressing area. The address of an operand can be directly specified in an
instruction.
The size of the direct addressing area varies according to the size of data to be accessed:
•Byte data access: 000
•Halfword data access: 000H to 1FF
•Word data access: 000H to 3FF
to 0FF
H
H
H
H
■ Memory Map
Figure 3.1-1 to Figure 3.1-4 show the memory spaces of FR family microcontrollers.
Figure 3.1-1 MB91F355A, MB91355A, MB91F353A, MB91353A and MB95F357B Memory Maps
External ROM
external bus mode
I/O
I/O
Access not
allowed
Internal
RAM (8 KB)
Internal
RAM (16 KB)
(Data)
Access not
allowed
External area
Direct addressing area
Reference to I/O map
0000 0000
0000 0400
0001 0000
0003 E000
0004 0000
0004 4000
0005 0000
0008 0000
0010 0000
FFFF FFFF
Single-chip mode
H
H
H
H
H
H
H
H
H
H
Access not
allowed
Internal
RAM (8 KB)
(Instruction)
Internal
RAM (16 KB)
Access not
allowed
Internal ROM
(512 KB)
Access not
allowed
I/O
I/O
(Data)
Internal ROM
external bus mode
I/O
I/O
Access not
allowed
Internal
RAM (8 KB)
(Instruction)(Instruction)
Internal
RAM (16 KB)
(Data)
Access not
allowed
External area
Internal ROM
(512 KB)
External area
46
Page 65
Figure 3.1-2 MB91351A Memory Ma p
0000 0000
0000 0400
0001 0000
0003 E000
0004 0000
0004 4000
0005 0000
0008 0000
000A 0000
0010 0000
FFFF FFFF
H
H
H
H
H
H
H
H
H
H
H
Single-chip mode
I/O
I/O
Access not
allowed
Internal
RAM (8 KB)
(Instruction)
Internal
RAM (16 KB)
(Data)
Access not
allowed
Internal ROM
(384 KB)
Access not
allowed
Internal ROM
external bus mode
I/O
I/O
Access not
allowed
Internal
RAM (8 KB)
(Instruction)
Internal
RAM (16 KB)
(Data)
Access not
allowed
External area
Access not
allowed
Internal ROM
(384 KB)
External area
External ROM
external bus mode
I/O
I/O
Access not
allowed
Internal
RAM (8 KB)
(Instruction)
Internal
RAM (16 KB)
(Data)
Access not
allowed
External area
Direct addressing area
Reference to I/O map
Figure 3.1-3 MB91354A and MB91352A Memory Map
0000 0000
0000 0400
0001 0000
0003 E000
0004 0000
0004 2000
0005 0000
0008 0000
000A 0000
0010 0000
FFFF FFFF
Single-chip mode
H
H
H
H
H
H
H
H
H
H
H
I/O
I/O
Access not
allowed
Internal
RAM (8 KB)
(Instruction)
Internal
RAM (8 KB)
(Data)
Access not
allowed
Internal ROM
(384 KB)
Access not
allowed
Internal ROM
external bus mode
I/O
I/O
Access not
allowed
Internal
RAM (8 KB)
(Instruction)
Internal
RAM (8 KB)
(Data)
Access not
allowed
External area
Access not
allowed
Internal ROM
(384 KB)
External area
External ROM
external bus mode
I/O
I/O
Access not
allowed
Internal
RAM (8 KB)
(Instruction)
Internal
RAM (16 KB)
(Data)
Access not
allowed
External area
Direct addressing area
Reference to I/O map
47
Page 66
CHAPTER 3 CPU AND CONTROL UNITS
Figure 3.1-4 MB91F356B Memory Map
0000 0000
0000 0400
0001 0000
0003 E000
0004 0000
0004 4000
0005 0000
0008 0000
000C 0000
0010 0000
FFFF FFFF
Single-chip mode
H
H
H
Access not
allowed
H
Internal
RAM (8 KB)
(Instruction)
H
Internal
RAM (16 KB)
H
H
H
H
Internal ROM
H
H
I/O
I/O
(Data)
Access not
allowed
(256 KB)
Access not
allowed
Internal ROM
external bus mode
I/O
I/O
Access not
allowed
Internal
RAM (8 KB)
(Instruction)
Internal
RAM (16 KB)
(Data)
Access not
allowed
External area
Access not allowed
Internal ROM
(256 KB)
External area
External ROM
external bus mode
I/O
I/O
Access not
allowed
Internal
RAM (8 KB)
(Instruction)
Internal
RAM (16 KB)
(Data)
Access not
allowed
External area
Direct addressing area
Reference to I/O map
•Each mode setting is determined based on the mode vecto r fetch after INIT
setting the modes, see Section "3.8.2 Mode Settings".)
negate. (For details about
•For the MB91V350A, with the memory ma p of the MB91355A/F355A/353A/F353A/F357 B, the 512K bytes
area of the internal ROM, and with the memory map of the MB91F356B, the 256K bytes area of the internal
ROM, is the emulation RAM. In addition, internal RAM(Instruction) is extended from 8K bytes to16K bytes.
•The available internal RAM area is restricted as soon as a reset is cleared. If the available area setting
would be rewritten, include at least one NOP instruction immediately after that processing.
48
Page 67
3.2Internal Architecture
This section describes the structure of the internal architecture and instructions of the
FR family microcontrollers.
■ Overview of Internal Architecture
The FR family CPUs employ RISC architecture to create a high-performance core with instructions that
provide high-level functions for embedded applications.
49
Page 68
CHAPTER 3 CPU AND CONTROL UNITS
3.2.1Internal Architecture
This section describes the features and structure of the internal architecture.
■ Features of the Internal Architecture
•RISC architecture used
Basic instruction: One instruction per cycle
•32-bit architecture
General-purpose register: 32 bits x 16
•4 GB linear memory space
•Multiplier installed
32-bit by 32-bit multiplication: 5 cycles
16-bit by 16-bit multiplication: 3 cycles
•Enhanced interrupt processing function
Quick response speed: 6 cycles
Support of multiple interrupts
Level mask function: 16 levels
•Enhanced instructions for I/O operations
Memory-to-memory transfer instruction
Bit-processing instructions
•Efficient code
Basic instruction word length: 16 bits
•Low-power consumption
Sleep and stop modes
Gear function
50
Page 69
■ Structure of the Internal Architecture
The FR CPU uses the Harvard architecture, in which the instruction bus and data buses are ind ependent of
each other.
A 32-bit ↔ 16-bit bus converter is connected to the 32-bit bus (F-bus) to provide an interface between the
CPU and peripheral resources.
A Harvard ↔ Princeton bus converter is connected to the I-bus and D-bus to provide an interface between
the CPU and the bus controller.
Figure 3.2-1 shows the structure of the internal architecture.
Figure 3.2-1 Structure of the Internal Architecture
D-busI-bus
I address
D address
Data
RAM
D data
FRex CPU
I data
32
32
32
32
Harvard
Princeton
bus
converter
External address
24
External data
16
32-bit
16-bit
Bus converter
R-bus
Peripheral resourcesInternal I/O
16
Address
Data
32
32
F-bus
Bus converter
51
Page 70
CHAPTER 3 CPU AND CONTROL UNITS
■ CPU
The CPU is a compact implementation of the 32-bit RISC FR architecture. Five instructio n pipelines are
used to execute one instruction per cycle. A pipeline consists of the following stages:
Figure 3.2-2 shows the structure of the instruction pipeline.
•Instruction fetch (IF): Outputs an instructio n address to fetch an instruction.
•Instruction decode (ID): Decodes a fetched instruction. Also reads a register.
•Execution (EX): Executes an arithmetic operation.
•Memory access (MA): Performs a load or store access to memory.
•Write-back (WB): Writes an operation result (or loaded memory data) to a register.
Figure 3.2-2 Structure of the Instruction Pipeline
Instructions are never executed randomly. If Instruction A enters a pipeline before Instruction B, it always
reaches the write-back stage before Instruction B.
In general, one instruction is executed per cycle. However, multiple cycles are required to execute a load/
store instruction with a memory wait, a branch instruction without a delay slot, or a multiple-cycle
instruction. The execution of instructions slows down if the instructions are not supplied fast enough.
■ 32-bit/16-bit Bus Converter
The 32-bit/16-bit bus converter provides an interface between the F-bus accessed at high-speed with a 32bit width and the R-bus accessed with a 16-bit width. This converter enables data access to the built-in
peripheral circuits from the CPU.
WB
MAWB
EXMAWB
IDEXMAWB
IFIDEXMAWB
IFIDEXMA
WB
If the CPU performs a 32-bit width access to the R-bus, this bus converter converts the access into two 16bit width accesses. Some of the built-in peripheral circuits have limitations on the access bus width.
■ Harvard/Princeton Bus Converter
The Harvard/Princeton bus converter coordinates CPU instruction access and data access, and provides a
smooth interface with the external buses.
The CPU has a Harvard architecture with separate buses for instructions and data. On the oth er hand, the
bus controller that performs control of external buses has a Princeton architecture with a single bus. The
Harvard/Princeton bus converter assigns priorities to instruction and data accesses from the CPU to control
accesses to the bus controller. This function allows the order of external bus accesses to be permanently
optimized.
52
Page 71
3.2.2Overview of Instructions
The FR supports the general RISC instruction set as well as logical operation, bit
manipulation, and direct addressing instructions optimized for embedded applications.
For the instruction set, see the APPENDIX D "Instruction Lists".
Each instruction is 16-bit long (except for some instructions are 32- or 48-bit long),
resulting in superior efficiency of memory use.
An instruction set is classified into the following function groups:
• Arithmetic operation
• Load and store
• Branch
• Logical operation and bit manipulation
• Direct addressing
• Other
■ Arithmetic Operation
Arithmetic operation instructions include standard arithmetic operation instructions (addition, subtracti on,
and comparison) and shift instructions (logical shift and arithmetic operation shift). The addition and
subtraction instructions include an operation with carries for use with multiple-word-lengt h operations and
an operation that does not change flag values, a convenience in address calculations.
Furthermore, 32-bit-by-32-bit and 16-bit-by-16-bit multipli cation instructions and a 32-bit-by-32-bit step
division instruction are provided.
Additionally, an immediate data transfer instruction that sets immediate data in a register and a register-toregister transfer instruction are provided.
An arithmetic operation instruction is executed using the general-purpose registers and the multiplication
and division registers in the CPU.
■ Load and Store
Load and store instructions read and write to external memory. They are also used to read and write to a
peripheral circuit (I/O) on the chip.
Load and store instructions have three access lengths: byte, halfword, and word. In addition to indirect
memory addressing via general registers, indirect memory addressing via registers with displacements and
via registers with register incrementing or decrementing are provided for some instructions.
■ Branch
The branch group includes branch, call, interrupt, and return instructions. Som e branch instructions have
delay slots while others do not. These may be optimized according to the application. The branch
instructions are described in detail later.
53
Page 72
CHAPTER 3 CPU AND CONTROL UNITS
■ Logical Operation and Bit Manipulation
Logical operation instructions perform the AND, OR, and EOR logical operation s between general-purpose
registers or a general-purpose register and memory (and I/O). Bit manipulation instructions directly
manipulate the contents of memory (and I/O).
They access memory using general register indirect addressing.
■ Direct Addressing
Direct addressing instructions are used for access between an I/O and a general-purpose register or between
an I/O and the memory. High-speed and high-efficiency access can be achieved since an I/O address is
directly specified in an instruction instead of using register indirect addressing. Indir ect mem ory addressing
via registers with register incrementing or decrementing are provided for some instructions.
■ Other Types of Instructions
Other types of instructions include instructions that provide flag setting, stack manipulation, sign/zero
extension, and other functions in the PS register. Also, function entry and exit instructions that support
high-level languages and register multi-load/store instructions are provided.
54
Page 73
3.3Programming Model
This section describes the programming model, general-purpose registers, and
dedicated registers of the FR family microcontrollers.
■ Basic Programming Model
Figure 3.3-1 shows the FR family basic programming model.
Figure 3.3-1 Basic Programming Model
32 bits
[Initial value]
R0
R1
General-purpose
register
Program counterPC
Program statusPS ILMSCR CCR
Table base registerTBR
R12
R13
R14
R15
AC
FP
SP
XXXX XXXX
XXXX XXXX
0000 0000
H
H
H
Return pointerRP
System stack pointerSSP
User stack pointerUSP
Multiply and divide registers MDH
MDL
55
Page 74
CHAPTER 3 CPU AND CONTROL UNITS
3.3.1General-Purpose Registers
Registers R0 to R15 are general-purpose registers.
They are used as the accumulator for various arithmetic operations and as pointers for
memory access.
■ General-Purpose Registers
Figure 3.3-2 shows the configuration of the general-purpose registers.
Figure 3.3-2 Configuration of General-Purpose Registers
32 bits
[Initial value]
R0 XXXX XXXX
R1
R12
R13AC
R14FP XXXX XXXX
R15
S
P 0000 0000
H
H
H
Since it is assumed that the following registers of the 16 registers will be used for specific applications,
some of the instructions have been enhanced accordingly:
•R13: Virtual accumulator
•R14: Frame pointer
•R15: Stack pointer
The initial value after a reset is not defined for R0 to R14. For R15, the initial value is 00000000
(SSP
H
value).
56
Page 75
3.3.2Dedicated Registers
The dedicated registers are used for specific applications.
FR family microcontrollers provide the following dedicated registers:
• PS (Program Status)
• CCR (Condition Code Register)
• SCR (System Condition Code Register)
•ILM
• PC (Program Counter)
• TBR (Table Base Register)
• RP (Return Pointer)
• SSP (System Stack Pointer)
• USP (User Stack Pointer)
• Multiply & Divide register
■ PS (Program Status)
The program status (PS) register holds the program status and consists of three parts: ILM, SCR, and CCR.
In the figure, all the undefined bits are reserved. During reading, "0" is always read.
This register cannot be written.
The configuration of the program status (PS) register is shown below:
Bit location 31 2 0 1 6 10 8 7 0
ILM
SCR
CCR
57
Page 76
CHAPTER 3 CPU AND CONTROL UNITS
■ CCR (Condition Code Register)
The configuration of the condition code register (CCR) is shown below:
76543210[Initial value]
--SINZVC
[Bit 5] Stack flag
This bit specifies the stack pointer to be used as R15.
ValueDescription
0The system stack pointer (SSP) is used as R15.
When an EIT occurs, this bit is automatically set to "0".
(Note that the value saved on the stack is the value before it is cleared.)
1The user stack pointer (USP) is used as R15.
--00XXXX
B
•Reset clears this bit to "0".
•Set this bit to "0" when executing a RETI instruction.
[Bit 4] Interrupt enable flag
This bit enables or disables a user interrupt request.
ValueDescription
0User interrupt disabled.
When the INT instruction is executed, this bit is cleared to "0".
(Note that the value saved on the stack is the value before it is cleared.)
1User interrupt enabled.
The mask processing of a user interrupt request is controlled by the value held in ILM.
•Reset clears this bit to "0".
[Bit 3] Negative flag
This bit indicates the sign when the operation result is regarded as an integer represented by its 2's
complement.
ValueDescription
0Indicates that the operation result is a positive value.
58
1Indicates that the operation result is a negative value.
•The initial value after reset is undefined.
Page 77
[Bit 2] Zero flag
This bit indicates whether the operation result is "0".
ValueDescription
0Indicates that the operation result is not "0".
1Indicates that the operation result is "0".
•The initial value after reset is undefined.
[Bit 1] Overflow flag
This bit indicates whether an overflow has occurred as a result of the operation when the operand using
the operation is regarded as an integer represented by its 2's complement.
ValueDescription
0Indicates that the operation result did not cause an overflow.
1Indicates that the operation result caused an overflow.
•The initial value after reset is undefined.
[Bit 0] Carry flag
This bit indicates whether a carry or a borrow has occurred from the most significant bit in the
operation.
ValueDescription
0Indicates that no carry or borrow has occurred.
1Indicates that a carry or borrow has occurred.
•The initial value after reset is undefined.
59
Page 78
CHAPTER 3 CPU AND CONTROL UNITS
■ SCR (System Condition Code Register)
The configuration of the system condition code register (SCR) is shown below:
1098[Initial value]
D1D0T
[Bits 10 and 9] Step division flag
These bits hold the intermediate data when step division is executed.
Do not change these bits during step division. To execute other processing during a step division, save
and restore the value of the PS register to ensure that the step division is restarted.
•The initial value after reset is undefined.
•When the DIVOS instruction is executed, the multiplicand and divisor are accessed and this flag is set.
•When the DIV0U instruction is executed, this flag is cleared.
•DIV0S/DIV0U command and user interruption/NMI simultaneous receipt;
Do not perform any process desiring D0/D1 bit of the PS resister before the EIT branch in the EIT
process routine.
XX0
B
•When a halt caused by break, step, etc. occurs right before the DIV0S/DIV0U command, the D0/D1 bit
of the PS register may not display a valid value.
Calculation result, however, will be valid after recovery.
[Bit 8] Step trace trap flag
This bit specifies whether the step trace trap is to be enabled.
ValueDescription
0The step trace trap is disabled.
1The step trace trap is enabled.
All user NMIs and user interrupts are prohibited.
•Reset initializes this bit to "0".
•The step trace trap function is also used by emulators. When being used by an emulator, this function
cannot be used in a user program.
60
Page 79
■ ILM
The configuration of the ILM register is shown below:
The interrupt level mask (ILM) register holds an interrupt level mask value. The valu e held in ILM is used
as a level mask.
An interrupt request to the CPU is accepted only when its interrupt level is higher than the level indicated
in this ILM.
The highest level is 0 (00000
The program setting range is limited.
•When the original value is between 16 and 31:
A new value between 16 and 31 can be set. If an instruction that sets a value between 0 and 15 is
executed, the specified value plus 16 is transferred.
•When the original value is between 0 and 15: Any value between 0 and 31 can be set.
Reset initializes this bit to 15 (01111
■ PC (Program Counter)
The configuration of the program counter (PC) register is shown below:
2019181716[In itial value]
ILM4ILM3ILM2ILM1ILM0
), and the lowest level is 31 (11111B).
B
).
B
01111
B
310[Initial value]
PC
[Bits 31 to 0]
These are the bits of the program counter that indicates the address of the instruction being executed.
Bit 0 is set to "0" when the PC is updated after an instruction is executed. Bit 0 can become "1" only if
the branch address is an odd number address.
However, even if the branch address is an odd number address, bit 0 is invalid and therefore the
instruction should be placed at an address for multiple of two.
The initial value after reset is undefined.
■ TBR (Table Base Register)
The configuration of the table base register (TBR) is shown below:
310[Initial value]
TBR
The table base register holds the first address of the vector table to be used during EIT processing.
The initial value after reset is 000FFC00
XXXXXXXX
000FFC00
.
H
H
H
61
Page 80
CHAPTER 3 CPU AND CONTROL UNITS
■ RP (Return Pointer)
The configuration of the return pointer (RP) register is shown below:
310[Initial value]
RP
The return pointer holds the address returned from a subroutine.
When a CALL instruction is executed, the PC value is transferred to this RP.
When a RET instruction is executed, the RP contents are transferred to PC.
The initial value after reset is undefined.
■ SSP (System Stack Pointer)
The configuration of the system stack pointer (SSP) register is shown below:
310[Initial value]
SSP
XXXXXXXX
00000000
H
H
SSP is the system stack pointer.
SSP functions as R15 when the S flag is "0".
SSP can also be specified explicitly.
This register is also used as a stack pointer that specifies the stack on which the PS and PC contents are to
be saved if an EIT occurs.
The initial value after reset is 00000000
■ USP (User Stack Pointer)
The configuration of the user stack pointer (USP) register is shown below:
USP
USP is the user stack pointer
USP functions as R15 when the S flag is "1".
USP can also be specified explicitly.
The initial value after reset is undefined.
This register cannot be used by the RETI instruction.
.
H
310[Initial value]
XXXXXXXX
H
62
Page 81
■ Multiply & Divide Register
The configuration of the multiply & divide register is shown below:
MDH
MDL
The multiply and divide registers are 32-bit long.
The initial value after reset is undefined.
•When multiplication is executed
For a 32-bit-by-32-bit multiplication, the 64-bit long operation result is stored in the multiply and divide
registers as follows:
MDH: High-order 32 bits
MDL: Low-order 32 bits
For a 16-bit-by-16-bit multiplication, the re sult is stored as follows:
MDH: Undefined
MDL: 32-bit result
•When division is executed
At the start of calculation, the dividend is stored in MDL.
If a DIV0S/DIV0U, DIV1, DIV2, DIV3, or DIV4S instruction is executed for a division, the result is
stored in MDL and MDH as follows:
MDH: Remainder
MDL: Quotient
310
63
Page 82
CHAPTER 3 CPU AND CONTROL UNITS
3.4Data Configuration
This section describes the data structure in FR family microcontrollers.
■ Bit Ordering
FR family microcontrollers use the little endian method for bit ordering.
Figure 3.4-1 shows the data configuration in bit ordering.
Figure 3.4-1 Data Configuration in Bit Ordering
bit3129272523211917151311 9 7 5 3 1
302826242220181614121086420
MSBLSB
■ Byte Ordering
FR family microcontrollers use the big endian method for byte ordering.
Figure 3.4-2 shows the data configuration in byte ordering.
Figure 3.4-2 Data Configuration in Byte Ordering
MSBLSB
Address (n+1)
Address (n+2)
Address (n+3)
Memory bit 31 23
10101010
bit
7
0
10101010Address n
11001100
11111111
00010001
157 0
11001100 1111111100010001
64
Page 83
■ W o rd Alignment
● Program access
An FR family program must be placed at an address that is a multiple of 2.
Bit 0 of the PC is set to "0" if the PC is updated when an instruction is executed.
Bit 0 can be set to "1" only if an odd-number address is specified as the branch address.
If Bit 0 is set to "1", however, Bit 0 is invalid and an instruction must be placed at the address that is a
multiple of 2.
No odd-number address exception exists.
● Data access
When FR family data is accessed, forced alignment is applied as described below to the address based on
the width.
Word access:An address must be a multiple of 4. (The lowest-order 2 bits are forcibly set to "00".)
Halfword access: An address must be a multiple of 2. (The lowest-order bit is forcibly set to "0".)
Byte access:During word or halfword data access, some of the bits in the result of calculating an effective address are
forcibly set to "0".
For example, in @(R13, Ri) addressing mode, the register before addition is used without chang e in the
calculation (even if the lowest-order bit is "1") and the low-order bits are masked. A register before
calculation is not masked.
[Example] LD @(R13, R2), R0
R13 00002222
R2 00000003
H
H
+)
Addition result 00002225
H
Lower 2 bits forcibly masked
Address pin 00002224
H
65
Page 84
CHAPTER 3 CPU AND CONTROL UNITS
3.5Memory Map
This section describes the memory maps of the FR family microcontrollers.
■ Memory Map
The address space is 32 bits linear.
Figure 3.5-1 shows the memory map.
Figure 3.5-1 Memory Map
0000 0000
0000 0100
0000 0200H
0000 0400
000F FC00
000F FFFF
FFFF FFFF
● Direct addressing area
H
Byte data
H
Direct addressing areaHalfword data
Word data
H
H
Vector table
initial area
H
H
66
The following areas in the address space are the areas for I/O. When direct addressing is used in these
areas, an operand address can be directly specified in an instruction.
The size of an address area for which an address can be directly specified varies is determined by the data
length as follows:
•Byte data (8 bits): 000
•Halfword data (16 bits): 000H to 1FF
•Word data (32 bits): 000H to 3FF
● Vector table initial area
The area from 000FFC00
You can place the vector table that will be used during EIT processing at any address by rewriting the TBR.
Initialization by a reset places the table at this address.
to 0FF
H
to 000FFFFFH is the initial EIT vector table area.
H
H
H
H
Page 85
3.6Branch Instructions
This section describes the branch instructions used in the FR family microcontrollers.
■ Overview of Branch Instructions
In the FR family microcontrollers, both operations with and without a delay slot can be specified for the
branch instructions.
67
Page 86
CHAPTER 3 CPU AND CONTROL UNITS
3.6.1Operations with a Delay Slot
This section describes operation when operations with a delay slot are specified for a
branch instruction.
■ Branch Instructions with Delay Slot
Instructions written as follows perform a branch operation wi th a delay slot :
In an operation with a delay slot, the instruction imm ediately f ollowi ng the br anch in structio n (this is call ed
the delay slot) is executed, then the instruction at the branch destination is executed.
Since an instruction in the delay slot is executed before the branch operation, the apparent execution speed
is one cycle. However, a NOP instruction must be placed in the delay slot if there is no valid instruction put
there.
[Example]
;List of instructions
ADDR1,R2,;
BRA:DLABEL;Branch instruction
MOVR2,R3,;Delay slot ... Executed before branch
...
LABEL :STR3,@R4;Branch destination
If a conditional branch instruction is used, an instruction placed in the delay slot is executed whether or not
the condition for branching is met.
If a delay branch instruction is used, the order of execution for some instructions seems to be reversed.
However, this occurs only for updating the PC and the instructions are executed in the specified order for
other operations (register update and reference, etc.)
The following is a concrete example.
68
1) Ri referred by the JMP:D @Ri / CALL:D @Ri instruction is not affected even though Ri is updated by
the instruction in the delay slot.
Page 87
[Example]
LDI:32#Label,R0
JMP:D@R0; Branch to Label
LDI:8#0,R0; No effect on the branch destination address
...
2) RP referred by the RET:D instruction is not affected even though RP is updated by the instruction in the
delay slot.
[Example]
RET:D;Branch to address defined beforehand in RP
MOVR8,RP; No effect on the return operation
...
3) The flag referred by the Bcc:D rel instruction is not affected by the instruction in the delay slot.
[Example]
ADD#1,R0; Flag change
BC:DOverflow; Branch to execution result of above instruction
ANDCCR#0; This flag update is not referred by the above branch instruction.
...
4) If RP is referred by an instruction in the delay slot of the CALL:D instruction, the data that has been
updated by the CALL:D instruction is read.
[Example]
CALL:DLabel; Updating RP and branching
MOVRP,R0; Transferring RP, execution result of above CALL:D
...
■ Limitations on Operation with Delay Slot
● Instructions that can be placed in the delay slot
Only an instruction meeting the following conditions can be executed in the delay slot.
•One-cycle instruction
•Instruction other than a branch instruction
•Instruction whose operation is not affected even though the order is changed
A one-cycle instruction is an instruction denoted in the Number of Cycles column in the list of
instructions as 1, a, b, c, and d.
69
Page 88
CHAPTER 3 CPU AND CONTROL UNITS
● Step trace trap
A step trace trap does not occur between the execution of a branch instruction with a delay slot and the
delay slot.
● Interrupt NMI
An interrupt /NMI is not accepted between the execution of a branch instruction with a delay slot and the
delay slot.
● Undefined instruction exception
An undefined instruction exception does not occur if there is an undefined instruction in the delay sl ot. If an
undefined instruction is in the delay slot, it operates as a NOP instruction.
70
Page 89
3.6.2Operation without Delay Slot
This section describes operation when operations without a delay slot are specified for
a branch instruction.
■ Instructions not Using a Delay Slot
The instructions below execute branch operations without a delay slot:
In an operation without a delay slot, the instruction is executed by the order of the list.
Instruction immediately after the instruction is not executed before branch.
[Example]
; List of instructions
ADDR1,R2,;
BRALABEL; Branch instruction (without a delay slot)
MOVR2,R3,; Not executed
...
LABEL :STR3,@R4; Branch destination
A branch instruction without a delay slot is executed in two cycles if a branch occurs and in one cycle if no
branch occurs.
Since no appropriate instruction can be placed in the delay slot, branch instructions without a d elay slot
result in more efficient instruction codes than branch instructions with a delay slot and with NOP specified.
For both optimal execution speed and code efficiency, select an operation with a delay slot if a valid
instruction can be placed in the delay slot; otherwise, select an operation without a delay slot.
71
Page 90
CHAPTER 3 CPU AND CONTROL UNITS
3.7EIT (Exception, Interrupt, and Trap)
EIT, a generic term for exception, interrupt, and trap, refers to suspending program
execution if an event occurs during execution and then executing another program.
An exception is an event that occurs related to the execution context. Execution
restarts from the instruction that caused the exception.
An interrupt is an event that occurs independently of execution context. The event is
caused by hardware.
A trap is an event that occurs related to the execution context. Some traps, such as
system calls, are specified in a program. Execution restarts from the instruction
following the one that caused the trap.
■ Features of EIT
•Multiple interrupts support
•Level masking function (15 levels available to the user)
■ EIT Causes
Note:
Restrictions apply to EIT regarding the delay slot of branch instructions. See Section "3.6 Branch
Instructions" for more information.
•Trap instruction (INT)
•Emulator activation EIT (hardware/software)
The following are causes of EIT:
•Reset
•User interrupt (internal resource, external inter rup t)
•NMI
•Delayed interrupt
•Undefined instruction exception
•Trap instruction (INT)
•Trap instruction (INTE)
•Step trace trap
•No-coprocessor trap
•Coprocessor error trap
■ Return from EIT
•RETI instruction
72
Page 91
3.7.1EIT Interrupt Levels
The interrupt levels are 0 to 31 and are managed with five bits.
■ EIT Interrupt Levels
Table 3.7-1 shows the allocation of the levels.
Table 3.7-1 Interrupt Levels
Level
BinaryDecimal
00000
...
...
00011
00100
00101
...
...
01110
0111115NMI (for user)
10000
10001
...
...
11110
11111
Operation is possible for levels 16 to 31.
The interrupt level does not affect an undefined instruction exception, no-coprocessor trap, coprocessor
error trap, or an INT instruction. It does not change the ILM, either.
...
...
...
...
14
16
17
...
...
30
31
0
3
4
5
(Reserved for system)
...
...
(Reserved for system)
INTE instruction
Step trace trap
(Reserved for system)
...
...
(Reserved for system)
Interrupt
Interrupt
...
...
Interrupt
-
If the original ILM value is between 16
and 31, a program cannot set a value in
this ILM range.
User interrupts prohibited if ILM is set
Interrupts prohibited if ICR is set
73
Page 92
CHAPTER 3 CPU AND CONTROL UNITS
■ I Flag
A flag that specifies whether an interrupt is perm itted or prohibited. This flag is provided as Bit 4 of the PS
register.
ValueDescription
Interrupts prohibited
0
1
Cleared to "0" if the INT instruction is executed.
(Note that a value saved on the stack is the value before it is cleared.)
Interrupts permitted
The mask processing of an interrupt request is controlled by the value in the ILM
register.
■ Interrupt Level Mask (ILM) Register
A PS register (Bits 20 to 16) that holds an interrupt level mask value.
The CPU accepts only an interrupt request sent to it with an interrupt level higher than the level indicated
by the ILM.
The highest level is 0 (00000
Values that can be set by a program have a limit. If the original value is between 16 and 31, the new value
must be between 16 and 31. If an instruction that sets a value between 0 and 15 is executed, the specified
value plus 16 is transferred.
If the original value is between 0 and 15, any value between 0 and 31 may be set. Use the STILM
instruction to specify an arbitrary value.
B
■ Level Mask for Interrupt and NMI
If an NMI or interrupt request occurs, the interrupt level (Table 3.7-1 ) of the interrupt source is compared
with the level mask value held in the ILM. A request meeting the following condi tion is masked and is not
accepted:
Interrupt level of cause ≥ Level mask value
) and the lowest level is 31 (11111B).
74
Page 93
3.7.2ICR (Interrupt Control Register)
The interrupt control register (ICR: Interrupt Control Register), located in the interrupt
controller, sets the level of an interrupt request. An ICR is provided for each of the
interrupt request inputs. The ICR is mapped on the I/O space and is accessed from the
CPU through a bus.
■ Configuration of Interrupt Control Register (ICR)
The following shows the configuration of the interrupt control register (ICR) bits.
76543210[Initial value]
---ICR4ICR3ICR2ICR1ICR0
RR/WR/WR/WR/W
[Bit 4] ICR4
ICR4 is always set to "1".
[Bits 3 to 0] ICR3 to 0
These bits are the low-order 4 bits of the interrupt level for the corresponding interrupt source. They can
be read and written to. Together with Bit 4, a value between 16 and 31 can be set in the ICR.
---111111
B
■ Mapping of Interrupt Control Register (ICR)
Table 3.7-2 shows the relationship between interrupt sources, interrupt control register, and interrupt
vectors.
Table 3.7-2 Interrupt Sour ces, Interrupt Control Registers, and Interrupt Vectors
Interrupt control registerCorresponding interrupt vector
Table 3.7-2 Interrupt Sour ces, Interrupt Control Registers, and Interrupt Vectors
Interrupt control registerCorresponding interrupt vector
Interrupt
source
TBR initial value: 000F FC00
NumberAddress
H
Note: See "CHAPTER 9 INTERRUPT CONTROLLER".
Number
Address
HexadecimalDecimal
76
Page 95
3.7.3SSP (System Stack Pointer)
SSP (System Stack Pointer) is used to point to the stack to save and restore data when
EIT is accepted or a return operation occurs.
■ System Stack Pointer (SSP)
The configuration of the SSP register is shown below:
31......0[Initial value]
SSP
Eight is subtracted from the register value during EIT processing and eight is added to the register value
during the return operation from EIT that occurs when the RETI instruction is executed.
The system stack pointer (SSP) is initialized to 00000000
The SSP is also used as general-purpose register R15 if the S flag in the CCR is set to "0".
00000000
by a reset.
H
H
77
Page 96
CHAPTER 3 CPU AND CONTROL UNITS
3.7.4Interrupt Stack
The PC and PS values are saved and restored using the area pointed to by the SSP.
After an interrupt, the PC is stored at the address pointed to by the SSP and the PS is
stored at the address SSP + 4.
■ Interrupt Stack
Figure 3.7-1 shows an example of an interrupt stack.
Figure 3.7-1 Interrupt Stack
[Before interrupt][After interrupt]
SSP80000000
Memory
80000000
7FFFFFFC
7FFFFFF8
H
H
H
H
SSP7FFFFFF8
80000000
7FFFFFFC
7FFFFFF8
H
H
H
PS
PC
H
78
Page 97
3.7.5TBR (Table Base Register)
TBR (Table Base Register) indicates the beginning address of the vector table for EIT.
■ Table Base Register (TBR)
The configuration of the TBR register is shown below:
31......0[Initial value]
TBR
Obtain a vector address by adding to the TBR the offset value predetermined for an EIT cause.
The table base register (TBR) is initialized to 000FFC00
H
000FFC00
by a reset.
H
79
Page 98
CHAPTER 3 CPU AND CONTROL UNITS
3.7.6EIT Vector Table
A 1K bytes area from the address indicated in the tab le base register (TBR) is the vector
area for EIT.
■ EIT Vector Table
The size for each vector is 4 bytes. The relationship between a vector number and a vector address can be
expressed as follows:
vctadr = TBR + vctofs
= TBR + (3FC H - 4 x vct)
vctadr: Vector address
vctofs: Vector offset
vct: Vector number
The low-order two bits of the addition result are always handled as 00.
The area from 000FFC00
to 000FFFFFH is the initial area for the vector table upon reset.
H
Special functions are allocated to some of the vectors.
Table 3.7-3 shows the vector table on the architecture.
Table 3.7-3 Vector Table (1 / 4)
Interrupt number
Interrupt source
Interrupt
DecimalHexadecimal
*1
Reset
Mode vector
*1
000 -
101 -
Reserved for system202Reserved for system303Reserved for system404Reserved for system505Reserved for system606No-coprocessor trap707-