The revision list can be viewed directly by
clicking the title page.
The revision list summarizes the locations of
revisions and additions. Details should always
be checked by referring to the relevant text.
SH7125 Group, SH7124Group
32
Hardware Manual
Renesas 32-Bit RISC Microcomputer
SuperH™ RISC engine Family
SH7125 R5F7125
SH7124 R5F7124
Rev.3.00
Revision Date: Sep. 27, 2007
Page 2
Rev. 3.00 Sep. 27, 2007 Page ii of xx
Page 3
Notes regarding these materials
1. This document is provided for reference purposes only so that Renesas customers may select the appropriate
Renesas products for their use. Renesas neither makes warranties or representations with respect to the
accuracy or completeness of the information contained in this document nor grants any license to any
intellectual property rights or any other rights of Renesas or any third party with respect to the information in
this document.
2. Renesas shall have no liability for damages or infringement of any intellectual property or other rights arising
out of the use of any information in this document, including, but not limited to, product data, diagrams, charts,
programs, algorithms, and application circuit examples.
3. You should not use the products or the technology described in this document for the purpose of military
applications such as the development of weapons of mass destruction or for the purpose of any other military
use. When exporting the products or technology described herein, you should follow the applicable export
control laws and regulations, and procedures required by such laws and regulations.
4. All information included in this document such as product data, diagrams, charts, programs, algorithms, and
application circuit examples, is current as of the date this document is issued. Such information, however, is
subject to change without any prior notice. Before purchasing or using any Renesas products listed in this
document, please confirm the latest product information with a Renesas sales office. Also, please pay regular
and careful attention to additional and different information to be disclosed by Renesas such as that disclosed
through our website. (http://www.renesas.com )
5. Renesas has used reasonable care in compiling the information included in this document, but Renesas
assumes no liability whatsoever for any damages incurred as a result of errors or omissions in the information
included in this document.
6. When using or otherwise relying on the information in this document, you should evaluate the information in
light of the total system before deciding about the applicability of such information to the intended application.
Renesas makes no representations, warranties or guaranties regarding the suitability of its products for any
particular application and specifically disclaims any liability arising out of the application and use of the
information in this document or Renesas products.
7. With the exception of products specified by Renesas as suitable for automobile applications, Renesas
products are not designed, manufactured or tested for applications or otherwise in systems the failure or
malfunction of which may cause a direct threat to human life or create a risk of human injury or which require
especially high quality and reliability such as safety systems, or equipment or systems for transportation and
traffic, healthcare, combustion control, aerospace and aeronautics, nuclear power, or undersea communication
transmission. If you are considering the use of our products for such purposes, please contact a Renesas
sales office beforehand. Renesas shall have no liability for damages arising out of the uses set forth above.
8. Notwithstanding the preceding paragraph, you should not use Renesas products for the purposes listed below:
(1) artificial life support devices or systems
(2) surgical implantations
(3) healthcare intervention (e.g., excision, administration of medication, etc.)
(4) any other purposes that pose a direct threat to human life
Renesas shall have no liability for damages arising out of the uses set forth in the above and purchasers who
elect to use Renesas products in any of the foregoing applications shall indemnify and hold harmless Renesas
Technology Corp., its affiliated companies and their officers, directors, and employees against any and all
damages arising out of such applications.
9. You should use the products described herein within the range specified by Renesas, especially with respect
to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation
characteristics, installation and other product characteristics. Renesas shall have no liability for malfunctions or
damages arising out of the use of Renesas products beyond such specified ranges.
10. Although Renesas endeavors to improve the quality and reliability of its products, IC products have specific
characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use
conditions. Please be sure to implement safety measures to guard against the possibility of physical injury, and
injury or damage caused by fire in the event of the failure of a Renesas product, such as safety design for
hardware and software including but not limited to redundancy, fire control and malfunction prevention,
appropriate treatment for aging degradation or any other applicable measures. Among others, since the
evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or
system manufactured by you.
11. In case Renesas products listed in this document are detached from the products to which the Renesas
products are attached or affixed, the risk of accident such as swallowing by infants and small children is very
high. You should implement safety measures so that Renesas products may not be easily detached from your
products. Renesas shall have no liability for damages arising out of such detachment.
12. This document may not be reproduced or duplicated, in any form, in whole or in part, without prior written
approval from Renesas.
13. Please contact a Renesas sales office if you have any questions regarding the information contained in this
document, Renesas semiconductor products, or if you have any other inquiries.
Rev. 3.00 Sep. 27, 2007 Page iii of xx
Page 4
General Precautions on Handling of Product
1. Treatment of NC Pins
Note: Do not connect anything to the NC pins.
The NC (not connected) pins are either not connected to any of the internal circuitry or are
used as test pins or to reduce noise. If something is connected to the NC pins, the
operation of the LSI is not guaranteed.
2. Treatment of Unused Input Pins
Note: Fix all unused input pins to high or low level.
Generally, the input pins of CMOS products are high-impedance input pins. If unused pins
are in their open states, intermediate levels are induced by noise in the vicinity, a passthrough current flows internally, and a malfunction may occur.
3. Processing before Initialization
Note: When power is first supplied, the product's state is undefined.
The states of internal circuits are undefined until full power is supplied throughout the
chip and a low level is input on the reset pin. During the period where the states are
undefined, the register settings and the output state of each pin are also undefined. Design
your system so that it does not malfunction because of processing while it is in this
undefined state. For those products which have a reset function, reset the LSI immediately
after the power supply has been turned on.
4. Prohibition of Access to Undefined or Reserved Addresses
Note: Access to undefined or reserved addresses is prohibited.
The undefined or reserved addresses may be used to expand functions, or test registers
may have been be allocated to these addresses. Do not access these registers; the system's
operation is not guaranteed if they are accessed.
Rev. 3.00 Sep. 27, 2007 Page iv of xx
Page 5
Configuration of This Manual
This manual comprises the following items:
1. General Precautions on Handling of Product
2. Configuration of This Manual
3. Preface
4. Contents
5. Overview
6. Description of Functional Modules
• CPU and System-Control Modules
• On-Chip Peripheral Modules
The configuration of the functional description of each module differs according to the
module. However, the generic style includes the following items:
i) Feature
ii) Input/Output Pin
iii) Register Description
iv) Operation
v) Usage Note
When designing an application system that includes this LSI, take notes into account. Each section
includes notes in relation to the descriptions given, and usage notes are given, as required, as the
final part of each section.
7. List of Registers
8. Electrical Characteristics
9. Appendix
10. Main Revisions and Additions in this Edition (only for revised versions)
The list of revisions is a summary of points that have been revised or added to earlier versions.
This does not include all of the revised contents. For details, see the actual locations in this
manual.
11. Index
Rev. 3.00 Sep. 27, 2007 Page v of xx
Page 6
Preface
The SH7125 Group and SH7124 Group RISC (Reduced Instruction Set Computer) microcomputer
include a Renesas Technology-original RISC CPU as its core, and the peripheral functions
required to configure a system.
Target Users: This manual was written for users who will be using the SH7125 Group and
SH7124 Group in the design of application systems. Target users are expected to
understand the fundamentals of electrical circuits, logical circuits, and
microcomputers.
Objective: This manual was written to explain the hardware functions and electrical
characteristics of the SH7125 Group and SH7124 Group to the target users.
Refer to the SH-1/SH-2/SH-DSP Software Manual for a detailed description of the
instruction set.
Notes on reading this manual:
• In order to understand the overall functions of the chip
Read the manual according to the contents. This manual can be roughly categorized into parts
on the CPU, system control functions, peripheral functions and electrical characteristics.
• In order to understand the details of the CPU's functions
Read the SH-1/SH-2/SH-DSP Software Manual.
• In order to understand the details of a register when its name is known
Read the index that is the final part of the manual to find the page number of the entry on the
register. The addresses, bits, and initial values of the registers are summarized in section 20,
List of Registers.
Examples: Register name: The following notation is used for cases when the same or a
similar function, e.g. serial communication interface, is
implemented on more than one channel:
XXX_N (XXX is the register name and N is the channel
number)
Bit order: The MSB is on the left and the LSB is on the right.
Number notation: Binary is B'xxxx, hexadecimal is H'xxxx, decimal is xxxx.
Signal notation: An overbar is added to a low-active signal: xxxx
Related Manuals: The latest versions of all related manuals are available from our web site.
Please ensure you have the latest versions of all documents you require.
http://www.renesas.com/
Rev. 3.00 Sep. 27, 2007 Page vi of xx
Page 7
SH7125 Group and SH7124 Group manuals:
Document Title Document No.
SH7125 Group, SH7124 Group Hardware Manual This manual
A. Pin States ........................................................................................................................... 727
B. Product Code Lineup ......................................................................................................... 731
C. Package Dimensions .......................................................................................................... 732
Main Revisions and Additions in this Edition..................................................... 737
Index .........................................................................................................753
Rev. 3.00 Sep. 27, 2007 Page xx of xx
Page 21
Section 1 Overview
Section 1 Overview
1.1 Features of SH7125 and SH7124
This LSI is a single-chip RISC (Reduced Instruction Set Computer) microcomputer that integrates
a Renesas Technology original RISC CPU core with peripheral functions required for system
configuration.
The CPU in this LSI has a RISC-type instruction set. Most instructions can be executed in one
state (one system clock cycle), which greatly improves instruction execution speed. In addition,
the 32-bit internal-bus architecture enhances data processing power. With this CPU, it has become
possible to assemble low-cost, high-performance, and high-functioning systems, even for
applications that were previously impossible with microcomputers, such as real-time control,
which demands high speeds.
In addition, this LSI includes on-chip peripheral functions necessary for system configuration,
such as a ROM, a RAM, timers, a serial communication interface (SCI), an A/D converter, an
interrupt controller (INTC), and I/O ports.
TM
The version of the on-chip ROM is F-ZTAT
flash memory. The flash memory can be programmed with a programmer that supports
programming of this LSI, and can also be programmed and erased by software. This enables LSI
chip to be re-programmed at a user-site while mounted on a board.
(Flexible Zero Turn Around Time)* that includes
The features of this LSI are listed in table 1.1.
TM
Note: * F-ZTAT
Rev. 3.00 Sep. 27, 2007 Page 1 of 758
REJ09B0243-0300
is a trademark of Renesas Technology Corp.
Page 22
Section 1 Overview
Table 1.1 Features
Items Specification
CPU
Operating modes
User break controller
(UBC)
On-chip ROM
On-chip RAM
• Central processing unit with an internal 32-bit RISC (Reduced
Instruction Set Computer) architecture
• Instruction length: 16-bit fixed length for improved code efficiency
• Load-store architecture (basic operations are executed between
Note: Some specifications on slot illegal instruction exception handling
in this LSI differ from those of the conventional SH-2. For details,
see section 5.8.4, Notes on Slot Illegal Instruction Exception
Handling.
• Operating modes
Single chip mode
• Operating states
Program execution state
Exception handling state
• Power-down modes
Sleep mode
Software standby mode
Module standby mode
• Addresses, data values, type of access, and data size can all be set as
break conditions
• Supports a sequential break function
• Two break channels
• 128 kbytes (SH71253, SH71243)
• 64 kbytes (SH71252, SH71242)
• 32 kbytes (SH71241)
• 8 kbytes
Rev. 3.00 Sep. 27, 2007 Page 2 of 758
REJ09B0243-0300
Page 23
Items Specification
Interrupt controller
(INTC)
• External interrupt pins
SH7125: Five pins (NMI and IRQ3 to IRQ0)
SH7124: Four pins (NMI and IRQ3 to IRQ1)
• On-chip peripheral interrupts: Priority level set for each module
• Vector addresses: A vector address for each interrupt source
User debugging
• E10A emulator support
interface (H-UDI)
Clock pulse
generator (CPG)
• Clock mode: Input clock can be selected from external input or crystal
resonator
• Four types of clocks generated:
CPU clock: Maximum 50 MHz
Bus clock: Maximum 40 MHz
Peripheral clock: Maximum 40 MHz
MTU2 clock: Maximum 40 MHz
Watchdog timer
(WDT)
• On-chip one-channel watchdog timer
• Interrupt generation is supported.
Section 1 Overview
Rev. 3.00 Sep. 27, 2007 Page 3 of 758
REJ09B0243-0300
Page 24
Section 1 Overview
Items Specification
Multi-function timer
pulse unit 2 (MTU2)
• Maximum 16 lines of pulse input/output and three lines of pulse input
based on six channels of 16-bit timers (SH7125)
• Maximum 12 lines of pulse input/output and three lines of pulse input
based on six channels of 16-bit timers (SH7124)
• 21 output compare and input capture registers
• A total of 21 independent comparators
• Selection of eight counter input clocks
• Input capture function
• Pulse output modes
Toggle, PWM, complementary PWM, and reset-synchronized PWM
modes
• Synchronization of multiple counters
• Complementary PWM output mode
Non-overlapping waveforms output for 6-phase inverter control
Automatic dead time setting
0% to 100% PWM duty cycle specifiable
Output suppression
A/D conversion delaying function
Dead time compensation
Interrupt skipping at crest or trough
• Reset-synchronized PWM mode
Three-phase PWM waveforms in positive and negative phases can be
output with a required duty cycle
• Phase counting mode
Two-phase encoder pulse counting available
Port output enable
(POE)
Compare match timer
(CMT)
• High-impedance control of waveform output pins and channel 0 pins in
MTU2
• 16-bit counters
• Compare match interrupts can be generated
• Two channels
Serial communication
interface (SCI)
• Clock synchronous or asynchronous mode
• Three channels
Rev. 3.00 Sep. 27, 2007 Page 4 of 758
REJ09B0243-0300
Page 25
Items Specification
A/D converter (ADC)
• 10 bits × 8 channels
• Conversion request by external triggers or MTU2
• Two sample-and-hold function units (two channels can be sampled
simultaneously)
I/O ports
• 37 general input/output pins and eight general input pins (SH7125)
• 23 general input/output pins and eight general input pins (SH7124)
• Input or output can be selected for each bit
Packages
• QFP-64 (0.8 pitch) (SH7125)
• LQFP-64 (0.5 pitch) (SH7125)
• LQFP-48 (0.65 pitch) (SH7124)
• VQFN-64 (0.4 pitch) (SH7125 and SH7124)
• VQFN-52 (0.4 pitch) (SH7124)
Power supply voltage
• Vcc: 4.0 to 5.5 V
• AVcc: 4.0 to 5.5 V
Section 1 Overview
Rev. 3.00 Sep. 27, 2007 Page 5 of 758
REJ09B0243-0300
Page 26
Section 1 Overview
1.2 Block Diagram
The block diagram of this LSI is shown in figure 1.1.
Internal bus
controller
I/O
port
(PFC)
[Legend]
ROM: On-chip ROM
RAM: On-chip RAM
UBC: User break controller
H-UDI: User debugging interface
INTC: Interrupt controller
CPG: Clock pulse generator
WDT: Watchdog timer
CPU: Central processing unit
SH2
CPU
Peripheral bus
INTCWDT CPG
H-UDIMTU2 POESCICMTADC
UBC
L bus (Iφ)
RAMROM
I bus (Bφ)
controller
Peripheral bus (Pφ)
Power-
down
mode
control
PFC: Pin function controller
MTU2: Multi-function timer pulse unit 2
POE: Port output enable
SCI: Serial communication interface
CMT: Compare match timer
ADC: A/D converter
Figure 1.1 Block Diagram
Rev. 3.00 Sep. 27, 2007 Page 6 of 758
REJ09B0243-0300
Page 27
1.3 Pin Assignments
K
8
Section 1 Overview
PB3/IRQ1/POE1/TIC5V
PB2/IRQ0/POE0
PB1/TIC5W
AV
PF7/AN7
PF6/AN6
PF5/AN5
PF4/AN4
PF3/AN3
PF2/AN2
PF1/AN1
PF0/AN0
AV
PB16/POE3
PE15/TIOC4D/IRQOUT
PE14/TIOC4C
PB5/IRQ3/TIC5U
PLLVSSMD1
FWE/ASEBRK/ASEBRKA
NMI
ASEMD0
EXTAL
XTAL
WDTOVF
RES
PA0/POE0/RXD0
VCLPA1/POE1/TXD0
48 4746 4544 4342 4140 39 38 37 36 35 34 33
49
50
51
52
SS
53
54
55
56
57
58
QFP-64
LQFP-64
(Top view)
59
60
61
CC
62
63
64
SS
VCCPA2/IRQ0/SCK0
V
32
PA3/IRQ1/RXD1/TRST
PA4/IRQ2/TXD1/TMS
31
PA5/IRQ3/SCK1
30
PA6/TCLKA
29
PA7/TCLKB/SCK2/TCK
28
PA8/TCLKC/RXD2/TDI
27
PA9/TCLKD/TXD2/TDO/POE
26
PA10/RXD0
25
V
SS
24
PA11/TXD0/ADTRG
23
V
CC
22
PA12/SCK0
21
PA13/SCK1
20
PA14/RXD1
19
PA15/TXD1
18
PE0/TIOC0A
17
12345678910111213141516
CC
V
PE12/TIOC4A
PE11/TIOC3D
PE13/TIOC4B/MRES
V
V
PE9/TIOC3B
PE10/TIOC3C
PE8/TIOC3A
PE7/TIOC2B
PE5/TIOC1B/TXD1
PE6/TIOC2A/SCK1
PE2/TIOC0C/TXD0
PE4/TIOC1A/RXD1
PE3/TIOC0D/SCK0
PE1/TIOC0B/RXD0
CL
SS
Pins for the system development tool.
When these pins are used for an on-chip
debugger, they are not available.
Figure 1.2 (1) Pin Assignments of SH7125
Rev. 3.00 Sep. 27, 2007 Page 7 of 758
REJ09B0243-0300
Page 28
Section 1 Overview
K
8
PB3/IRQ1/POE1/TIC5V
PB2/IRQ0/POE0
PB1/TIC5W
AV
PF7/AN7
PF6/AN6
PF5/AN5
PF4/AN4
PF3/AN3
PF2/AN2
PF1/AN1
PF0/AN0
AV
PB16/POE3
PB15/TIOC4D/IRQOUT
PE14/TIOC4C
PB5/IRQ3/TIC5U
PLLVSSMD1
FWE/ASEBRK/ASEBRKA
NMI
ASEMD0
EXTAL
XTAL
WDTOVF
RES
PA0/POE0/RXD0
VCLPA1/POE1/TXD0
48 4746 4544 4342 4140 39 38 37 36 35 34 33
VCCPA2/IRQ0/SCK0
49
50
51
52
SS
53
54
55
56
57
VQFN-64
(Top view)
58
59
60
61
CC
62
63
64
12345678910111213141516
CC
V
PE12/TIOC4A
PE11/TIOC3D
PE13/TIOC4B/MRES
V
V
PE9/TIOC3B
PE10/TIOC3C
PE8/TIOC3A
PE7/TIOC2B
PE5/TIOC1B/TXD1
PE6/TIOC2A/SCK1
PE4/TIOC1A/RXD1
PE3/TIOC0D/SCK0
CL
SS
Figure 1.2 (2) Pin Assignments of SH7125
SS
V
32
PA3/IRQ1/RXD1/TRST
PA4/IRQ2/TXD1/TMS
31
PA5/IRQ3/SCK1
30
PA6/TCLKA
29
PA7/TCLKB/SCK2/TCK
28
PA8/TCLKC/RXD2/TDI
27
PA9/TCLKD/TXD2/TDO/POE
26
PA10/RXD0
25
V
SS
24
PA11/TXD0/ADTRG
23
V
CC
22
PA12/SCK0
21
PA13/SCK1
20
PA14/RXD1
19
PA15/TXD1
18
PE0/TIOC0A
17
PE2/TIOC0C/TXD0
PE1/TIOC0B/RXD0
Rev. 3.00 Sep. 27, 2007 Page 8 of 758
REJ09B0243-0300
Page 29
Section 1 Overview
K
8
PB3/IRQ1/POE1/TIC5V
PB1/TIC5W
AV
PF7/AN7
PF6/AN6
PF5/AN5
PF4/AN4
PF3/AN3
PF2/AN2
PF1/AN1
PF0/AN0
AV
PB5/IRQ3/TIC5U
PLLVSSMD1
FWE/ASEBRK/ASEBRKA
NMI
ASEMD0
EXTAL
XTAL
36 35 34 33 32 31 30 29 28
37
38
39
SS
40
41
42
43
LQFP-48
(Top view)
44
45
46
47
48
CC
123456789101112
CL
SS
CC
V
PE14/TIOC4C
PE13/TIOC4B/MRES
PE15/TIOC4D/IRQOUT
V
V
PE12/TIOC4A
PE11/TIOC3D
CL
WDTOVF
RES
PA0/POE0/RXD0
V
27 26
25
24
23
22
21
20
19
18
17
16
15
14
13
PE9/TIOC3B
PE8/TIOC3A
PE10/TIOC3C
PE3/TIOC0D/SCK0
PA1/POE1/TXD0
PA3/IRQ1/RXD1/TRST
PA4/IRQ2/TXD1/TMS
PA6/TCLKA
PA7/TCLKB/SCK2/TCK
V
Connect all Vcc pins to the system.
There will be no operation if any pins
are open.
Vss I Ground Ground pin
Connect all Vss pins to the system
power supply (0V). There will be no
operation if any pins are open.
VCLO Power supply for
internal powerdown
PLLVss I PLL ground Ground pin for the on-chip PLL
EXTAL I External clock Connected to a crystal resonator.
XTAL O Crystal Connected to a crystal resonator.
MD1 I Mode set Sets the operating mode. Do not
FWE I Flash memory
write enable
External capacitance pins for internal
power-down power supply
Connect these pins to Vss via a 0.1
to 0.47 µF capacitor (placed close to
the pins).
oscillator
An external clock signal may also be
input to the EXTAL pin.
change values on this pin during
operation.
Pin for flash memory
Flash memory can be protected
against programming or erasure
through this pin.
Section 1 Overview
Rev. 3.00 Sep. 27, 2007 Page 11 of 758
REJ09B0243-0300
Page 32
Section 1 Overview
Classification Symbol I/O Name Function
System control
RESI Power-on reset When low, this LSI enters the power-
on reset state.
MRESI Manual reset When low, this LSI enters the
manual reset state.
WDTOVF O Watchdog timer
overflow
Output signal for the watchdog timer
overflow
If this pin needs to be pulled down,
use the resistor larger than
1 MΩ to pull this pin down.
Interrupts
NMI I Non-maskable
interrupt
Non-maskable interrupt request pin
Fix to high or low level when not in
use.
IRQ3 to IRQ0
(SH7125)
IRQ3 to IRQ1
(SH7124)
I Interrupt requests
3 to 0
Maskable interrupt request pins
Selectable as level input or edge
input. The rising edge, falling edge,
and both edges are selectable as
edges.
IRQOUT O Interrupt request
output
Shows that an interrupt cause has
occurred. The interrupt cause can be
recognized even in the bus release
state.
Multi function timerpulse unit 2 (MTU2)
TCLKA,
TCLKB,
TCLKC,
I MTU2 timer clock
input
External clock input pins for the timer
TCLKD
TIOC0A,
TIOC0B,
TIOC0C,
TIOC0D
TIOC1A,
TIOC1B
(only in
SH7125)
TIOC2A,
TIOC2B
(only in
SH7125)
I/O MTU2 input
capture/output
compare
(channel 0)
I/O MTU2 input
capture/output
compare
(channel 1)
I/O MTU2 input
capture/output
compare
(channel 2)
The TGRA_0 to TGRD_0 input
capture input/output compare
output/PWM output pins
The TGRA_1 to TGRB_1 input
capture input/output compare
output/PWM output pins
The TGRA_2 to TGRB_2 input
capture input/output compare
output/PWM output pins
Rev. 3.00 Sep. 27, 2007 Page 12 of 758
REJ09B0243-0300
Page 33
Classification Symbol I/O Name Function
Multi function timerpulse unit 2 (MTU2)
Port output enable
(POE)
TIOC3A,
TIOC3B,
TIOC3C,
TIOC3D
TIOC4A,
TIOC4B,
TIOC4C,
TIOC4D
TIC5U,
TIC5V,
TIC5W
POE8, POE3,
POE1, POE0
(SH7125)
POE8, POE1,
POE0
(SH7124)
I/O MTU2 input
capture/output
compare
(channel 3)
I/O MTU2 input
capture/output
compare
(channel 4)
I MTU2 input
capture
(channel 5)
I Port output
enable
The TGRA_3 to TGRD_3 input
capture input/output compare
output/PWM output pins
The TGRA_4 to TGRD_4 input
capture input/output compare
output/PWM output pins
The TGRU_5, TGRV_5, and
TGRW_5 input capture input pins
Request signal input to place the
waveform output pins and channel 0
pins of MTU2 in high impedance
state.
In the SH7125, while POE3 function
is selected in the PFC, the pin is
pulled up inside this LSI if no signals
are input to them.
Serial
communication
interface (SCI)
TXD2 to
TXD0
RXD2 to
O Transmit data Transmit data output pins
I Receive data Receive data input pins
RXD0
SCK2 to
I/O Serial clock Clock input/output pins
SCK0
(SH7125)
SCK2, SCK0
(SH7124)
A/D converter
(ADC)
AN7 to AN0 I Analog input pins Analog input pins
ADTRG
(only in
I A/D conversion
trigger input
External trigger input pin for starting
A/D conversion
SH7125)
AVcc I Analog power
supply
Power supply pin for the A/D
converter
Connect all AVcc pins to the system
power supply (Vcc) when the A/D
converter is not used. The A/D
converter does not work if any pin is
open.
Section 1 Overview
Rev. 3.00 Sep. 27, 2007 Page 13 of 758
REJ09B0243-0300
Page 34
Section 1 Overview
Classification Symbol I/O Name Function
A/D converter AVss I Analog ground Ground pin for the A/D converter
Connect it to the system ground (0
V).
Connect all AVss pins to the system
ground (0 V) correctly. The A/D
converter does not work if any pin is
open.
I/O ports
PA15 to PA0
I/O General port 16-bit input/output port pins
(SH7125)
PA9 to PA6,
8-bit input/output port pins
PA4, PA3,
PA1, PA0
(SH7124)
PB16, PB5,
I/O General port 5-bit input/output port pins
PB3 to PB1
(SH7125)
PB5, PB3,
3-bit input/output port pins
PB1
(SH7124)
PE15 to PE0
I/O General port 16-bit input/output port pins
(SH7125)
PE15 to PE8,
12-bit input/output port pins
PE3 to PE0
(SH7124)
PF7 to PF0 I General port 8-bit input port pins
User debugging
interface
(H-UDI)
TCK I Test clock Test-clock input pin
TMS I Test mode select Inputs the test-mode select signal.
TDI I Test data input Serial input pin for instructions and
data
TDO O Test data
output
Serial output pin for instructions and
data
TRSTI Test reset Initialization-signal input pin
Rev. 3.00 Sep. 27, 2007 Page 14 of 758
REJ09B0243-0300
Page 35
Section 1 Overview
Classification Symbol I/O Name Function
E10A interface
ASEMD0I ASE mode Sets the ASE mode.
When a low level is input, this LSI
enters ASE mode. When a high level
is input, this LSI enters the normal
mode. The emulator functions are
available in ASE mode. When no
signal is input, this pin is pulled up
inside this LSI.
ASEBRK I Break request E10A emulator break input pin
ASEBRKAK O Break mode
acknowledge
Indicates that the E10A emulator has
entered its break mode.
Note: The WDTOVF pin should not be pulled down. When absolutely necessary, pull it down
through a resistor of 1 MΩ or larger.
Rev. 3.00 Sep. 27, 2007 Page 15 of 758
REJ09B0243-0300
Page 36
Section 1 Overview
Rev. 3.00 Sep. 27, 2007 Page 16 of 758
REJ09B0243-0300
Page 37
Section 2 CPU
2.1 Features
• General registers: 32-bit register × 16
• Basic instructions: 62
• Addressing modes: 11
Register direct (Rn)
Register indirect (@Rn)
Post-increment register indirect (@Rn+)
Pre-decrement register indirect (@-Rn)
Register indirect with displacement (@disp:4, Rn)
Index register indirect (@R0, Rn)
GBR indirect with displacement (@disp:8, GBR)
Index GBR indirect (@R0, GBR)
PC relative with displacement (@disp:8, PC)
PC relative (disp:8/disp:12/Rn)
Immediate (#imm:8)
Section 2 CPU
CPUS200C_000020020700Rev. 3.00 Sep. 27, 2007 Page 17 of 758
REJ09B0243-0300
Page 38
Section 2 CPU
2.2 Register Configuration
There are three types of registers: general registers (32-bit × 16), control registers (32-bit × 3), and
system registers (32-bit × 4).
General register (Rn)
310
R15, SP (hardware stack pointer)*
Status register (SR)
319 8 7 6 5 4 3 2 1 0
Global base register (GBR)
31
Vector base register (VBR)
31
Multiply and accumulate register (MAC)
310
Procedure register (PR)
310
Program counter (PC)
310
Notes: 1. R0 can be used as an index register in index register indirect or index GBR
indirect addressing mode. For some instructions, only R0 is used as the
source or destination register.
2. R15 is used as a hardware stack pointer during exception handling.
1
R0*
R1
R2
R3
R4
R5
R6
R7
R8
R9
R10
R11
R12
R13
R14
M
QI3I2I1I0S
GBR
VBR
MACH
MACL
PR
PC
2
T
0
0
Figure 2.1 CPU Internal Register Configuration
Rev. 3.00 Sep. 27, 2007 Page 18 of 758
REJ09B0243-0300
Page 39
Section 2 CPU
2.2.1 General Registers (Rn)
There are sixteen 32-bit general registers (Rn), designated R0 to R15. The general registers are
used for data processing and address calculation. R0 is also used as an index register. With a
number of instructions, R0 is the only register that can be used. R15 is used as a hardware stack
pointer (SP). In exception handling, R15 is used for accessing the stack to save or restore the
status register (SR) and program counter (PC) values.
2.2.2 Control Registers
There are three 32-bit control registers, designated status register (SR), global base register
(GBR), and vector base register (VBR). SR indicates a processing state. GBR is used as a base
address in GBR indirect addressing mode for data transfer of on-chip peripheral module registers.
VBR is used as a base address of the exception handling (including interrupts) vector table.
These bits are always read as 0. The write value
should always be 0.
9 M Undefined R/W Used by the DIV0U, DIV0S, and DIV1 instructions.
8 Q Undefined R/W Used by the DIV0U, DIV0S, and DIV1 instructions.
7 to 4 I[3:0] 1111 R/W Interrupt Mask
3, 2 All 0 R Reserved
These bits are always read as 0. The write value
should always be 0.
Rev. 3.00 Sep. 27, 2007 Page 19 of 758
REJ09B0243-0300
Page 40
Section 2 CPU
Bit
1 S Undefined R/W S Bit
0 T Undefined R/W T Bit
Bit
name Default
Read/
Write Description
Used by the multiply and accumulate instruction.
Indicates true (1) or false (0) in the following
instructions: MOVT, CMP/cond, TAS, TST, BT (BT/S),
BF (BF/S), SETT, CLRT
Indicates carry, borrow, overflow, or underflow in the
following instructions: ADDV, ADDC, SUBV, SUBC,
NEGC, DIV0U, DIV0S, DIV1, SHAR, SHAL, SHLR,
SHLL, ROTR, ROTL, ROTCR, ROTCL
• Global-base register (GBR)
This register indicates a base address in GBR indirect addressing mode. The GBR indirect
addressing mode is used for data transfer of the on-chip peripheral module registers and logic
operations.
• Vector-base register (VBR)
This register indicates the base address of the exception handling vector table.
Rev. 3.00 Sep. 27, 2007 Page 20 of 758
REJ09B0243-0300
Page 41
Section 2 CPU
2.2.3 System Registers
There are four 32-bit system registers, designated two multiply and accumulate registers (MACH
and MACL), a procedure register (PR), and program counter (PC).
• Multiply and accumulate registers (MACH and MACL)
This register stores the results of multiplication and multiply-and-accumulate operation.
• Procedure register (PR)
This register stores the return-destination address from subroutine procedures.
• Program counter (PC)
The PC indicates the point which is four bytes (two instructions) after the current execution
instruction.
2.2.4 Initial Values of Registers
Table 2.1 lists the initial values of registers after a reset.
Table 2.1 Initial Values of Registers
Type of register Register Default
General register R0 to R14 Undefined
R15 (SP) SP value set in the exception handling vector table
Control register SR I3 to I0: 1111 (H'F)
Reserved bits: 0
Other bits: Undefined
GBR Undefined
VBR H'00000000
System register MACH, MACL, PR Undefined
PC PC value set in the exception handling vector table
Rev. 3.00 Sep. 27, 2007 Page 21 of 758
REJ09B0243-0300
Page 42
Section 2 CPU
2.3 Data Formats
2.3.1 Register Data Format
The size of register operands is always longwords (32 bits). When loading byte (8 bits) or word
(16 bits) data in memory into a register, the data is sign-extended to longword and stored in the
register.
310
Longword
Figure 2.2 Register Data Format
2.3.2 Memory Data Formats
Memory data formats are classified into bytes, words, and longwords. Byte data can be accessed
from any address. Locate, however, word data at an address 2n, longword data at 4n. Otherwise,
an address error will occur if an attempt is made to access word data starting from an address other
than 2n or longword data starting from an address other than 4n. In such cases, the data accessed
cannot be guaranteed. The hardware stack area, pointed by the hardware stack pointer (SP, R15),
uses only longword data starting from address 4n because this area holds the program counter and
status register.
Address m + 1
Address 2n
Address 4n
Address m
3123
ByteByteByteByte
WordWord
Address m + 2
157
Longword
Figure 2.3 Memory Data Format
Rev. 3.00 Sep. 27, 2007 Page 22 of 758
REJ09B0243-0300
Address m + 3
0
Page 43
Section 2 CPU
2.3.3 Immediate Data Formats
Immediate data of eight bits is placed in the instruction code.
For the MOV, ADD, and CMP/EQ instructions, the immediate data is sign-extended to longword
and then calculated. For the TST, AND, OR, and XOR instructions, the immediate data is zeroextended to longword and then calculated. Thus, if the immediate data is used for the AND
instruction, the upper 24 bits in the destination register are always cleared.
The immediate data of word or longword is not placed in the instruction code. It is placed in a
table in memory. The table in memory is accessed by the MOV immediate data instruction in PC
relative addressing mode with displacement.
2.4 Features of Instructions
2.4.1 RISC Type
The instructions are RISC-type instructions with the following features:
Fixed 16-Bit Length: All instructions have a fixed length of 16 bits. This improves program code
efficiency.
One Instruction per Cycle: Since pipelining is used, basic instructions can be executed in one
cycle.
Data Size: The basic data size for operations is longword. Byte, word, or longword can be
selected as the memory access size. Byte or word data in memory is sign-extended to longword
and then calculated. Immediate data is sign-extended to longword for arithmetic operations or
zero-extended to longword size for logical operations.
Table 2.2 Word Da t a Sign Extension
CPU in this LSI Description Example of Other CPUs
MOV.W @(disp,PC),R1
ADD R1,R0
........
.DATA.W H'1234
Note: * Immediate data is accessed by @(disp,PC).
Rev. 3.00 Sep. 27, 2007 Page 23 of 758
REJ09B0243-0300
Sign-extended to 32 bits, R1
becomes H'00001234, and is
then operated on by the ADD
instruction.
ADD.W #H'1234,R0
Page 44
Section 2 CPU
Load/Store Architecture: Basic operations are executed between registers. In operations
involving memory, data is first loaded into a register (load/store architecture). However, bit
manipulation instructions such as AND are executed directly in memory.
Delayed Branching: Unconditional branch instructions means the delayed branch instructions.
With a delayed branch instruction, the branch is made after execution of the instruction
immediately following the delayed branch instruction. This minimizes disruption of the pipeline
when a branch is made. The conditional branch instructions have two types of instructions:
conditional branch instructions and delayed branch instructions.
Table 2.3 Delayed Branch Instructions
CPU in this LSI Description Example of Other CPUs
BRA TRGET
ADD R1,R0
ADD is executed before branch to TRGET. ADD.W R1,R0
BRA TRGET
Multiply/Multiply-and-Accumulate Operations: A 16 × 16 → 32 multiply operation is
executed in one to two cycles, and a 16 × 16 + 64 → 64 multiply-and-accumulate operation in two
to three cycles. A 32 × 32 → 64 multiply operation and a 32 × 32 + 64 → 64 multiply-andaccumulate operation are each executed in two to four cycles.
T Bit: The result of a comparison is indicated by the T bit in SR, and a conditional branch is
performed according to whether the result is True or False. Processing speed has been improved
by keeping the number of instructions that modify the T bit to a minimum.
Table 2.4 T Bit
CPU in this LSI Description Example of Other CPUs
CMP/GE R1,R0 When R0 ≥ R1, the T bit is set. CMP.W R1,R0
BT TRGET0 When R0 ≥ R1, a branch is made to TRGET0. BGE TRGET0
BF TRGET1 When R0 < R1, a branch is made to TRGET1. BLT TRGET1
ADD #1,R0 The T bit is not changed by ADD. SUB.W #1,R0
CMP/EQ #0,R0 When R0 = 0, the T bit is set. BEQ TRGET
BT TRGET A branch is made when R0 = 0.
Immediate Data: 8-bit immediate data is placed in the instruction code. Word and longword
immediate data is not placed in the instruction code. It is placed in a table in memory. The table in
memory is accessed with the MOV immediate data instruction using PC relative addressing mode
with displacement.
Rev. 3.00 Sep. 27, 2007 Page 24 of 758
REJ09B0243-0300
Page 45
Section 2 CPU
Table 2.5 Access to Immediate Data
Type This LSI's CPU Example of Other CPU
8-bit immediate MOV #H'12,R0 MOV.B #H'12,R0
16-bit immediate MOV.W @(disp,PC),R0
........
.DATA.W H'1234
32-bit immediate MOV.L @(disp,PC),R0
........
.DATA.L H'12345678
Note: * Immediate data is accessed by @(disp,PC).
MOV.W #H'1234,R0
MOV.L #H'12345678,R0
Absolute Addresses: When data is accessed by absolute address, place the absolute address value
in a table in memory beforehand. The absolute address value is transferred to a register using the
method whereby immediate data is loaded when an instruction is executed, and the data is
accessed using the register indirect addressing mode.
Table 2.6 Ac c e ss to Absolute Address
Type CPU in this LSI Example of Other CPUs
Absolute address MOV.L @(disp,PC),R1
MOV.B @R1,R0
........
.DATA.L H'12345678
Note: * Immediate data is referenced by @(disp,PC).
MOV.B @H'12345678,R0
16-Bit/32-Bit Displacement: When data is accessed using the 16- or 32-bit displacement
addressing mode, the displacement value is placed in a table in memory beforehand. Using the
method whereby immediate data is loaded when an instruction is executed, this value is
transferred to a register and the data is accessed using index register indirect addressing mode.
Rev. 3.00 Sep. 27, 2007 Page 25 of 758
REJ09B0243-0300
Page 46
Section 2 CPU
Table 2.7 Access with Displacement
Type CPU in this LSI Example of Other CPUs
16-bit displacement MOV.W @(disp,PC),R0
MOV.W @(H'1234,R1),R2
MOV.W @(R0,R1),R2
........
.DATA.W H'1234
Note: * Immediate data is referenced by @(disp,PC).
2.4.2 Addressing Modes
Table 2.8 lists addressing modes and effective address calculation methods.
Table 2.8 Addressing Modes and Effect ive Addresses
Addressing
Mode
Register
direct
Register
indirect
Register
indirect with
post-increment
Register
indirect with
pre-decrement
Instruction
Format Effective Address Calculation Method
Rn Effective address is register Rn.
(Operand is register Rn contents.)
@Rn Effective address is register Rn contents.
RnRn
@Rn+ Effective address is register Rn contents. A
constant is added to Rn after instruction
execution: 1 for a byte operand, 2 for a word
operand, 4 for a longword operand.
RnRn
Rn + 1/2/4
1/2/4
+
@–Rn Effective address is register Rn contents,
decremented by a constant beforehand: 1 for a
byte operand, 2 for a word operand, 4 for a
longword operand.
Rn
Rn - 1/2/4
1/2/4
-
Rn - 1/2/4
Calculation
Formula
Rn
Rn
After instruction
execution
Byte: Rn + 1 → Rn
Word: Rn + 2 → Rn
Longword: Rn + 4
→ Rn
Byte: Rn – 1 → Rn
Word: Rn – 2 → Rn
Longword: Rn – 4
→ Rn
(Instruction
executed with Rn
after calculation)
Rev. 3.00 Sep. 27, 2007 Page 26 of 758
REJ09B0243-0300
Page 47
Section 2 CPU
Addressing
Mode
Register
indirect with
displacement
Index
register indirect
GBR indirect
with
displacement
Instruction
Format Effective Address Calculation Method
@(disp:4,
Rn)
Effective address is register Rn contents with
4-bit displacement disp added. After disp is
zero-extended, it is multiplied by 1 (byte), 2
(word), or 4 (longword), according to the
operand size.
Rn
disp
(zero-extended)
1/2/4
+
×
Rn
+ disp × 1/2/4
@(R0, Rn) Effective address is sum of register Rn and R0
contents.
Rn
+ R0
Rn
@(disp:8,
GBR)
+
R0
Effective address is register GBR contents with
8-bit displacement disp added. After disp is
zero-extended, it is multiplied by 1 (byte), 2
(word), or 4 (longword), according to the
operand size.
GBR
disp
(zero-extended)
+
×
GBR
+ disp × 1/2/4
Calculation
Formula
Byte: Rn + disp
Word: Rn + disp × 2
Longword: Rn +
disp × 4
Rn + R0
Byte: GBR + disp
Word: GBR + disp ×
2
Longword: GBR +
disp × 4
Index GBR
indirect
@(R0,
GBR)
1/2/4
Effective address is sum of register GBR and
R0 contents.
GBR
+
GBR + R0
R0
GBR + R0
Rev. 3.00 Sep. 27, 2007 Page 27 of 758
REJ09B0243-0300
Page 48
Section 2 CPU
Addressing
Mode
PC relative with
displacement
Instruction
Format Effective Address Calculation Method
@(disp:8,
PC)
Effective address is PC with 8-bit displacement
disp added. After disp is zero-extended, it is
multiplied by 2 (word) or 4 (longword), according
to the operand size. With a longword operand,
the lower 2 bits of PC are masked.
*With longword operand
*
&
+
×
PC + disp × 2
or
PC&
H'FFFFFFFC
+ disp × 4
H'FFFFFFFC
disp
(zero-extended)
PC
2/4
PC relative disp:8 Effective address is PC with 8-bit displacement
disp added after being sign-extended and
multiplied by 2.
PC
disp
(sign-extended)
2
+
PC + disp × 2
×
disp:12 Effective address is PC with 12-bit displacement
disp added after being sign-extended and
multiplied by 2.
PC
disp
(sign-extended)
+
PC + disp × 2
×
Calculation
Formula
Word: PC + disp
× 2
Longword:
PC&H'FFFFFFFC
+ disp × 4
PC + disp × 2
PC + disp × 2
2
Rev. 3.00 Sep. 27, 2007 Page 28 of 758
REJ09B0243-0300
Page 49
Section 2 CPU
Addressing
Mode
PC relative Rn Effective address is sum of PC and Rn.
Immediate #imm:8 8-bit immediate data imm of TST, AND, OR,
Instruction
Format Effective Address Calculation Method
PC
+
Rn
PC + Rn
Calculation
Formula
PC + Rn
or XOR instruction is zero-extended.
#imm:8 8-bit immediate data imm of MOV, ADD, or
CMP/EQ instruction is sign-extended.
#imm:8 8-bit immediate data imm of TRAPA instruction
is zero-extended and multiplied by 4.
2.4.3 Instruction Formats
This section describes the instruction formats, and the meaning of the source and destination
operands. The meaning of the operands depends on the instruction code. The following symbols
are used in the table.
Note: * Number of execution cycles until this LSI enters sleep mode.
About the number of execution cycles:
The table lists the minimum number of execution cycles. In practice, the number of
execution cycles will be increased depending on the conditions such as:
• When there is a conflict between instruction fetch and data access
• When the destination register of a load instruction (memory → register) is also used
by the instruction immediately after the load instruction.
Rev. 3.00 Sep. 27, 2007 Page 45 of 758
REJ09B0243-0300
Page 66
Section 2 CPU
2.6 Processing States
The CPU has the five processing states: reset, exception handling, program execution, and powerdown. Figure 2.4 shows the CPU state transition.
From any state
when RES = 0
Power-on reset stateManual reset state
When internal power-on reset by WDT
or internal manual reset by WDT occurs.
SSBY bit = 0
Sleep mode
From any state
when RES = 1 and MRES = 0
RES = 1
Exception
processing
for SLEEP
instruction
RES = 0
Exception
handling state
source
occurs
Program
execution state
Exception
processing
ends
RES = 1,
MRES = 1
SSBY bit = 1 and
STBYMD bit = 1
for SLEEP
instruction
standby mode
Figure 2.4 Transitions between Processing States
Software
Power-down mode
Reset state
NMI interrupt or IRQ
interrupt occurs
Rev. 3.00 Sep. 27, 2007 Page 46 of 758
REJ09B0243-0300
Page 67
Section 2 CPU
• Reset state
The CPU is reset. When the RES pin is low, the CPU enters the power-on reset state. When the
RES pin is high and MRES pin is low, the CPU enters the manual reset state.
• Exception handling state
This state is a transitional state in which the CPU processing state changes due to a request for
exception handling such as a reset or an interrupt.
When a reset occurs, the execution start address as the initial value of the program counter
(PC) and the initial value of the stack pointer (SP) are fetched from the exception handling
vector table. Then, a branch is made for the start address to execute a program.
When an interrupt occurs, the PC and status register (SR) are saved in the stack area pointed to
by SP. The start address of an exception handling routine is fetched from the exception
handling vector table and a branch to the address is made to execute a program.
Then the processing state enters the program execution state.
• Program execution state
The CPU executes programs sequentially.
• Power-down state
The CPU stops to reduce power consumption. The SLEEP instruction makes the CPU enter
sleep mode or software standby mode.
Rev. 3.00 Sep. 27, 2007 Page 47 of 758
REJ09B0243-0300
Page 68
Section 2 CPU
Rev. 3.00 Sep. 27, 2007 Page 48 of 758
REJ09B0243-0300
Page 69
Section 3 MCU Operating Modes
Section 3 MCU Operating Modes
3.1 Selection of Operating Modes
This LSI has four MCU operating modes and three on-chip flash memory programming modes.
The operating mode is determined by the setting of FWE, MD1, and MD0 pins. Table 3.1 shows
the allowable combinations of these pin settings; do not set these pins in the other way than the
shown combinations.
When power is applied to the system, be sure to conduct power-on reset.
The MCU operating mode can be selected from MCU extension modes 0 to 2 and single chip
mode. For the on-chip flash memory programming mode, boot mode, user boot mode, and user
program mode, which are on-chip programming modes are available.
Table 3.1 Selection of Operating Modes
Pin Setting
Mode No. FWE MD1 Mode Name On-Chip ROM
Mode 3 0 1 Single chip mode Active
Mode 4* 1 0 Boot mode Active
Mode 6*1 1 User program mode Active
Note: * Flash memory programming mode.
Rev. 3.00 Sep. 27, 2007 Page 49 of 758
REJ09B0243-0300
Page 70
Section 3 MCU Operating Modes
3.2 Input/Output Pins
Table 3.2 describes the configuration of operating mode related pin.
Table 3.2 Pin Configuration
Pin Name Input/Output Function
MD1 Input Designates operating mode through the level applied to this pin
FWE Input Enables, by hardware, programming/erasing of the on-chip flash
memory
3.3 Operating Modes
3.3.1 Mode 3 (Single Chip Mode)
All ports can be used in this mode, however the external address cannot be used.
Rev. 3.00 Sep. 27, 2007 Page 50 of 758
REJ09B0243-0300
Page 71
Section 3 MCU Operating Modes
3.4 Address Map
The address map for the operating modes are shown in figures 3.1 to 3.3.
In the initial state of this LSI, some of on-chip modules are set in module standby state for saving
power. When operating these modules, clear module standby state according to the procedure in
section 19, Power-Down Modes.
3.6 Note on Changing Operating Mode
When changing operating mode while power is applied to this LSI, make sure to do it in the
power-on reset state (that is, the low level is applied to the RES pin).
MD1
t
*
MDS
RES
Note: * See section 21.3.2, Control Signal Timing.
Figure 3.4 Reset Input Timing when Changing O pera ting Mode
Rev. 3.00 Sep. 27, 2007 Page 54 of 758
REJ09B0243-0300
Page 75
Section 4 Clock Pulse Generator (CPG)
Section 4 Clock Pulse Generator (CPG)
This LSI has a clock pulse generator (CPG) that generates an internal clock (Iφ), a bus clock (Bφ),
a peripheral clock (Pφ), and a clock (MPφ) for the MTU2 module. The CPG also controls power-
down modes.
4.1 Features
• Five clocks generated independently
An internal clock (Iφ) for the CPU; a peripheral clock (Pφ) for the on-chip peripheral modules;
a bus clock (Bφ = CK) for the external bus interface; and a MTU2 clock (MPφ) for the on-chip
MTU2 module.
• Frequency change function
Frequencies of the internal clock (Iφ), bus clock (Bφ), peripheral clock (Pφ), and MTU2 clock
(MPφ) can be changed independently using the divider circuit within the CPG. Frequencies are
changed by software using the frequency control register (FRQCR) setting.
• Power-down mode control
The clock can be stopped in sleep mode and standby mode and specific modules can be
stopped using the module standby function.
• Oscillation stop detection
If the clock supplied through the clock input pin stops for any reason, the timer pins can be
automatically placed in the high-impedance state.
CPGS301C_000020030900Rev. 3.00 Sep. 27, 2007 Page 55 of 758
Frequency control register
Oscillation stop detection control register
Standby control register 1
Standby control register 2
Standby control register 3
Standby control register 4
Standby control register 5
Standby control register 6
FRQCR
Peripheral clock
(Pφ)
Bus clock
(Bφ = CK)
CPG control unit
Standby
control circuit
STBCR2STBCR1STBCR3 STBCR4 STBCR5 STBCR6
Bus interface
Internal bus
Figure 4.1 Block Diagram of CPG
Rev. 3.00 Sep. 27, 2007 Page 56 of 758
REJ09B0243-0300
Page 77
Section 4 Clock Pulse Generator (CPG)
The clock pulse generator blocks function as follows:
PLL Circuit: The PLL circuit multiples the clock frequency input from the crystal oscillator or
the EXTAL pin by 8. The multiplication ratio is fixed at ×8.
Crystal Oscillator: The crystal oscillator is an oscillator circuit when a crystal resonator is
connected to the XTAL and EXTAL pins.
Divider: The divider generates clocks with the frequencies to be used by the internal clock (Iφ),
bus clock (Bφ), peripheral clock (Pφ), and MTU2 clock (MPφ).
The frequencies can be selected from 1/2, 1/4 (initial value), and 1/8 times the frequency output
from the PLL circuit. The division ratio should be specified in the frequency control register
(FRQCR).
Oscillation Stop Detection Circuit: This circuit detects an abnormal condition in the crystal
oscillator.
Clock Frequency Control Circuit: The clock frequency control circuit controls the clock
frequency according to the setting in the frequency control register (FRQCR).
Standby Control Circuit: The standby control circuit controls the state of the on-chip oscillator
circuit and other modules in sleep or standby mode.
Frequency Control Register (FRQCR): The frequency control register (FRQCR) has control
bits for the frequency division ratios of the internal clock (Iφ), bus clock (Bφ), peripheral clock
(Pφ), and MTU2 clock (MPφ).
Oscillation Stop Detection Control Register (OSCCR): The oscillation stop detection control
register (OSCCR) has an oscillation stop detection flag and a bit for selecting flag status output
through an external pin.
Standby Control Registers 1 to 6 (STBCR1 t o STBCR6): The standby control register
(STBCR) has bits for controlling the power-down modes. For details, see section 19, Power-Down
Modes.
Rev. 3.00 Sep. 27, 2007 Page 57 of 758
REJ09B0243-0300
Page 78
Section 4 Clock Pulse Generator (CPG)
Table 4.1 shows the operating clock for each module.
EXTAL Input Connects a crystal resonator or an external clock.
Rev. 3.00 Sep. 27, 2007 Page 58 of 758
REJ09B0243-0300
Page 79
Section 4 Clock Pulse Generator (CPG)
4.3 Clock Operating Mode
Table 4.3 shows the clock operating mode of this LSI.
Table 4.3 Clock O perating Mode
Source PLL Circuit Input to Divider
EXTAL input or crystal resonator ON (×8) ×8
The frequency of the external clock input from the EXTAL pin is multiplied by 8 in the PLL
circuit before being supplied to the on-chip modules in this LSI, which eliminates the need to
generate a high-frequency clock outside the LSI. Since the input clock frequency ranging from 10
MHz to 12.5 MHz can be used, the internal clock (Iφ) frequency ranges from 10 MHz to 50 MHz.
Maximum operating frequencies:
Iφ = 50 MHz, Bφ = 40 MHz, Pφ = 40 MHz, and MPφ = 40 MHz
Table 4.4 shows the frequency division ratios that can be specified with FRQCR.
Rev. 3.00 Sep. 27, 2007 Page 59 of 758
REJ09B0243-0300
Page 80
Section 4 Clock Pulse Generator (CPG)
Table 4.4 Frequency Division Ratios Specifiable with FRQCR
Notes: * Clock frequencies when the input clock frequency is assumed to be the shown value.
The internal clock (Iφ) frequency must be 10 to 50 MHz and the peripheral clock (Pφ)
frequency must be 10 to 40 MHz. The bus clock (Bφ) frequency must be equal to the
peripheral clock (Pφ) frequency.
1. The PLL multiplication ratio is fixed at ×8. The division ratio can be selected from ×1/2, ×1/4, and ×1/8 for each clock by the setting in the frequency control register.
2. The output frequency of the PLL circuit is the product of the frequency of the input from
the crystal resonator or EXTAL pin and the multiplication ratio (×8) of the PLL circuit.
3. The input to the divider is always the output from the PLL circuit.
4. The internal clock (Iφ) frequency is the product of the frequency of the input from the
crystal resonator or EXTAL pin, the multiplication ratio (×8) of the PLL circuit, and the
division ratio of the divider. The resultant frequency must be a maximum of 50 MHz
(maximum operating frequency).
5. The peripheral clock (Pφ) frequency is the product of the frequency of the input from the
crystal resonator or EXTAL pin, the multiplication ratio (×8) of the PLL circuit, and the
division ratio of the divider. The resultant frequency must be a maximum of 40 MHz.
6. When using the MTU2, the MTU2 clock (MPφ) frequency must be equal to or higher
than the peripheral clock frequency (Pφ). The MTU2 clock (MPφ) frequency are the
product of the frequency of the input from the crystal resonator or EXTAL pin, the
multiplication ratio (×8) of the PLL circuit, and the division ratio of the divider.
7. The frequency of the CK pin is always be equal to the bus clock (Bφ) frequency.
8. The bus clock (Bφ) frequency must be equal to the peripheral clock (Pφ) frequency.
Rev. 3.00 Sep. 27, 2007 Page 60 of 758
REJ09B0243-0300
Page 81
Section 4 Clock Pulse Generator (CPG)
4.4 Register Descriptions
The CPG has the following registers.
For details on the addresses of these registers and the states of these registers in each processing
state, see section 20, List of Registers
Table 4.5 Register Configuration
Abbrevia-
Register Name
tion
Frequency control register FRQCR R/W H'36DB H'FFFFE800 16
Oscillation stop detection
OSCCR R/W H'00 H'FFFFE814 8
control register
4.4.1 Frequency Control Register (FRQCR)
FRQCR is a 16-bit readable/writable register that specifies the frequency division ratios for the
internal clock (Iφ), bus clock (Bφ), peripheral clock (Pφ), and MTU2 clock (MPφ). FRQCR can be
accessed only in words.
R/W Initial Value Address Access Size
FRQCR is initialized to H'36DB only by a power-on reset (except a power-on reset due to a WDT
overflow).
Before making changes to FRQCR, stop clock supply to each module except the CPU, on-chip
ROM, and on-chip-RAM.
This bit is always read as 0. The write value should
always be 0.
14 to 12 IFC[2:0] 011 R/W Internal Clock (Iφ) Frequency Division Ratio
Specify the division ratio of the internal clock (Iφ)
frequency with respect to the output frequency of PLL
circuit. If a prohibited value is specified, subsequent
operation is not guaranteed.
000: Setting prohibited
001: ×1/2
010: Setting prohibited
011: ×1/4 (initial value)
100: ×1/8
Other than above: Setting prohibited
11 to 9 BFC[2:0] 011 R/W Bus Clock (Bφ) Frequency Division Ratio
Specify the division ratio of the bus clock (Bφ)
frequency with respect to the output frequency of PLL
circuit. If a prohibited value is specified, subsequent
operation is not guaranteed.
000: Setting prohibited
001: ×1/2
010: Setting prohibited
011: ×1/4 (initial value)
100: ×1/8
Other than above: Setting prohibited
Rev. 3.00 Sep. 27, 2007 Page 62 of 758
REJ09B0243-0300
Page 83
Section 4 Clock Pulse Generator (CPG)
Initial
Bit Bit Name
Value
R/W Description
8 to 6 PFC[2:0] 011 R/W Peripheral Clock (Pφ) Frequency Division Ratio
Specify the division ratio of the peripheral clock (Pφ)
frequency with respect to the output frequency of PLL
circuit. If a prohibited value is specified, subsequent
operation is not guaranteed.
000: Setting prohibited
001: ×1/2
010: Setting prohibited
011: ×1/4 (initial value)
100: ×1/8
Other than above: Setting prohibited
5 to 3 011 R/W Reserved
These bits are always read as B'011. The write value
should always be B'011.
2 to 0 MPFC[2:0] 011 R/W MTU2 Clock (MPφ) Frequency Division Ratio
Specify the division ratio of the MTU2 clock (MPφ)
frequency with respect to the output frequency of PLL
circuit. If a prohibited value is specified, subsequent
operation is not guaranteed.
000: Setting prohibited
001: ×1/2
010: Setting prohibited
011: ×1/4 (initial value)
100: ×1/8
Other than above: Setting prohibited
Rev. 3.00 Sep. 27, 2007 Page 63 of 758
REJ09B0243-0300
Page 84
Section 4 Clock Pulse Generator (CPG)
4.4.2 Oscillation Stop Detection Control Register (OSCCR)
OSCCR is an 8-bit readable/writable register that has an oscillation stop detection flag and selects
flag status output to an external pin. OSCCR can be accessed only in bytes.
Bit:
Initial value:
R/W:
7654321
-----
00000000
RRRRRRRR/W
OSC
STOP
0
OSC
ERS
Initial
Bit Bit Name
Value
R/W Description
7 to 3 All 0 R Reserved
These bits are always read as 0. The write value should
always be 0.
2 OSCSTOP 0 R Oscillation Stop Detection Flag
[Setting conditions]
• When a stop in the clock input is detected during
normal operation
• When software standby mode is entered
[Clearing conditions]
• By a power-on reset input through the RES pin
• When software standby mode is canceled
1 0 R Reserved
This bit is always read as 0. The write value should
always be 0.
0 OSCERS 0 R/W Oscillation Stop Detection Flag Output Select
Selects whether to output the oscillation stop detection
flag signal through the WDTOVF pin.
0: Outputs only the WDT overflow signal through the
WDTOVF pin
1: Outputs the WDT overflow signal and the oscillation
stop detection flag signal through the WDTOVF pin
Rev. 3.00 Sep. 27, 2007 Page 64 of 758
REJ09B0243-0300
Page 85
Section 4 Clock Pulse Generator (CPG)
4.5 Changing Frequency
Selecting division ratios for the frequency divider can change the frequencies of the internal clock
(Iφ), bus clock (Bφ), peripheral clock (Pφ), and MTU2 clock (MPφ). This is controlled by software
through the frequency control register (FRQCR). The following describes how to specify the
frequencies.
1. In the initial state, IFC2 to IFC0 = H'011 (×1/4), BFC2 to BFC0 = H'011 (×1/4), PFC2 to
PFC0 = H'011 (×1/4), and MPFC2 to MPFC0 = H'011 (×1/4).
2. Stop all modules except the CPU, on-chip ROM, and on-chip RAM.
3. Set the desired values in bits IFC2 to IFC0, BFC2 to BFC0, PFC2 to PFC0, and MPFC2 to
MPFC0 bits. Since the frequency multiplication ratio in the PLL circuit is fixed at ×8, the
frequencies are determined only be selecting division ratios. When specifying the frequencies,
satisfy the following condition: internal clock (Iφ) ≥ bus clock (Bφ) = peripheral clock (Pφ).
When using the MTU2 clock, specify the frequencies to satisfy the following condition:
internal clock (Iφ) ≥ MTU2 clock (MPφ) ≥ peripheral clock (Pφ).
4. After an instruction to rewrite FRQCR has been issued, the actual clock frequencies will
change after (1 to 24n) cyc + 11Bφ + 7Pφ.
n: Division ratio specified by the BFC bit in FRQCR (1, 1/2, 1/4, or 1/8)
cyc: Clock obtained by dividing EXTAL by 8 with the PLL.
Note: (1 to 24n) depends on the internal state.
Rev. 3.00 Sep. 27, 2007 Page 65 of 758
REJ09B0243-0300
Page 86
Section 4 Clock Pulse Generator (CPG)
4.6 Oscillator
Clock pulses can be supplied from a connected crystal resonator or an external clock.
4.6.1 Connecting Crystal Resonator
A crystal resonator can be connected as shown in figure 4.2. Use the damping resistance (Rd)
listed in table 4.6. Use a crystal resonator that has a resonance frequency of 10 to 12.5 MHz. It is
recommended to consult the crystal resonator manufacturer concerning the compatibility of the
crystal resonator and the LSI.
C
EXTAL
XTAL
R
d
Figure 4.2 Connection of Crystal Resonator (Example)
Figure 4.3 shows an equivalent circuit of the crystal resonator. Use a crystal resonator with the
characteristics listed in table 4.7.
C
L
XTAL
LR
C
s
0
EXTAL
Figure 4.3 Crystal Resonator Equivalent Circuit
Rev. 3.00 Sep. 27, 2007 Page 66 of 758
REJ09B0243-0300
Page 87
Section 4 Clock Pulse Generator (CPG)
Table 4.7 Crystal Resonator Characteristics
Frequency (MHz) 10 12.5
Rs Max. (Ω) (Reference Values) 60 50
C0 Max. (pF) (Reference Values) 7 7
4.6.2 External Clock Input Method
Figure 4.4 shows an example of an external clock input connection. In this case, make the external
clock high level to stop it when in software standby mode. During operation, make the external
input clock frequency 10 to 12.5 MHz.
When leaving the XTAL pin open, make sure the parasitic capacitance is less than 10 pF.
Even when inputting an external clock, be sure to wait at least the oscillation stabilization time in
power-on sequence or in releasing software standby mode, in order to ensure the PLL stabilization
time.
EXTAL
XTAL
Open state
External clock input
Figure 4.4 Example of External Clock Connection
Rev. 3.00 Sep. 27, 2007 Page 67 of 758
REJ09B0243-0300
Page 88
Section 4 Clock Pulse Generator (CPG)
4.7 Function for Detecting Oscillator Stop
This CPG detects a stop in the clock input if any system abnormality halts the clock supply.
When no change has been detected in the EXTAL input for a certain period, the OSCSTOP bit in
OSCCR is set to 1 and this state is retained until a power-on reset is input through the RES pin or
software standby mode is canceled. If the OSCERS bit is set to 1 at this time, an oscillation stop
detection flag signal is output through the WDTOVF pin. In addition, the high-current ports (pins
to which the TIOC3B, TIOC3D, and TIOC4A to TIOC4D signals in the MTU2 are assigned) are
always placed in high-impedance state regardless of the PFC setting. For details, refer to appendix
A, Pin States.
Even in software standby mode, these pins are always placed in high-impedance state. For details,
refer to appendix A, Pin States. These pins enter the normal state after software standby mode is
canceled. Under an abnormal condition where oscillation stops while the LSI is not in software
standby mode, LSI operations other than the oscillation stop detection function become
unpredictable. In this case, even after oscillation is restarted, LSI operations including the above
high-current pins become unpredictable.
Even while no change is detected in the EXTAL input, the PLL circuit in this LSI continues
oscillating at a frequency range from 100 kHz to 10 MHz (depending on the temperature and
operating voltage).
Rev. 3.00 Sep. 27, 2007 Page 68 of 758
REJ09B0243-0300
Page 89
Section 4 Clock Pulse Generator (CPG)
4.8 Usage Notes
4.8.1 Note on Crystal Resonator
A sufficient evaluation at the user’s site is necessary to use the LSI, by referring the resonator
connection examples shown in this section, because various characteristics related to the crystal
resonator are closely linked to the user’s board design. As the oscillator circuit's circuit constant
will depend on the resonator and the floating capacitance of the mounting circuit, the value of each
external circuit’s component should be determined in consultation with the resonator
manufacturer. The design must ensure that a voltage exceeding the maximum rating is not applied
to the oscillator pin.
4.8.2 Notes on Board Design
Measures against radiation noise are taken in this LSI. If further reduction in radiation noise is
needed, it is recommended to use a multiple layer board and provide a layer exclusive to the
system ground.
When using a crystal resonator, place the crystal resonator and its load capacitors as close as
possible to the XTAL and EXTAL pins. Do not route any signal lines near the oscillator circuitry
as shown in figure 4.5. Otherwise, correct oscillation can be interfered by induction.
C
L2
C
L1
Signal A Signal B
This LSI
XTAL
EXTAL
Avoid
Figure 4.5 Cautio ns for Oscillator Circuit Board Design
Rev. 3.00 Sep. 27, 2007 Page 69 of 758
REJ09B0243-0300
Page 90
Section 4 Clock Pulse Generator (CPG)
A circuitry shown in figure 4.6 is recommended as an external circuitry around the PLL. Separate
the PLL power lines (PLLVss) and the system power lines (Vcc, Vss) at the board power supply
source, and be sure to insert bypass capacitors CB and CPB close to the pins.
PLLV
SS
V
CL
CPB = 0.1 µF
V
CC
V
SS
*
CB = 0.1 µF
*
(Recommended values are shown.)
Note: * CB and CPB are laminated ceramic type.
Figure 4.6 Recommended External Circuitry around PLL
Rev. 3.00 Sep. 27, 2007 Page 70 of 758
REJ09B0243-0300
Page 91
Section 5 Exception Handling
Section 5 Exception Handling
5.1 Overview
5.1.1 Types of Exception Handling and Priority
Exception handling is started by four sources: resets, address errors, interrupts and instructions and
have the priority, as shown in table 5.1. When several exceptions are detected at once, they are
processed according to the priority.
Table 5.1 Types of Exceptions and Priority
Exception Exception Source Priority
Reset Power-on reset High
Manual reset
Interrupt User break (break before instruction execution)
Address error CPU address error (instruction fetch)
Instruction General illegal instructions (undefined code)
Illegal slot instruction (undefined code placed immediately after a
delayed branch instruction*
Trap instruction (TRAPA instruction)
Address error CPU address error (data access)
Interrupt User break (break after instruction execution or operand break)
The exceptions are detected and the exception handling starts according to the timing shown in
table 5.2.
Table 5.2 Timing for Exception Detection and Start of Exception Handling
Exception Timing of Source Detection and Start of Exception Handling
Reset Power-on reset Started when the RES pin changes from low to high or when the
WDT overflows.
Manual reset Started when the MRES pin changes from low to high or when the
WDT overflows.
Address error
Interrupt
Instruction Trap instruction Started by the execution of the TRAPA instruction.
General illegal
instructions
Illegal slot
instructions
Detected during the instruction decode stage and started after the
execution of the current instruction is completed.
Started when an undefined code placed at other than a delay slot
(immediately after a delayed branch instruction) is decoded.
Started when an undefined code placed at a delay slot
(immediately after a delayed branch instruction) or an instruction
that changes the PC value is detected.
When exception handling starts, the CPU operates
Exception Handling Triggered by Reset: The initial values of the program counter (PC) and
stack pointer (SP) are fetched from the exception handling vector table (PC from the address
H'00000000 and SP from the address H'00000004 when a power-on reset. PC from the address
H'00000008 and SP from the address H'0000000C when a manual reset.). For details, see section
5.1.3, Exception Handling Vector Table. H'00000000 is then written to the vector base register
(VBR), and H'F (B'1111) is written to the interrupt mask bits (I3 to I0) in the status register (SR).
The program starts from the PC address fetched from the exception handling vector table.
Exception Handling Triggere d by Address Error, Interrupt, and Instruction: SR and PC are
saved to the stack indicated by R15. For interrupt exception handling, the interrupt priority level is
written to the interrupt mask bits (I3 to I0) in SR. For address error and instruction exception
handling, bits I3 to I0 are not affected. The start address is then fetched from the exception
handling vector table and the program starts from that address.
Rev. 3.00 Sep. 27, 2007 Page 72 of 758
REJ09B0243-0300
Page 93
Section 5 Exception Handling
5.1.3 Exception Handling Vector Table
Before exception handling starts, the exception handling vector table must be set in memory. The
exception handling vector table stores the start addresses of exception handling routines. (The
reset exception handling table holds the initial values of PC and SP.)
All exception sources are given different vector numbers and vector table address offsets. The
vector table addresses are calculated from these vector numbers and vector table address offsets.
During exception handling, the start addresses of the exception handling routines are fetched from
the exception handling vector table that is indicated by this vector table address.
Table 5.3 shows the vector numbers and vector table address offsets. Table 5.4 shows how vector
table addresses are calculated.
Table 5.3 Vector Numbers and Vector Table Address Offsets
Exception Handling Source Vector Number Vector Table Address Offset
Power-on reset PC 0 H'00000000 to H'00000003
SP 1 H'00000004 to H'00000007
Manual reset PC 2 H'00000008 to H'0000000B
SP 3 H'0000000C to H'0000000F
General illegal instruction 4 H'00000010 to H'00000013
(Reserved for system use) 5 H'00000014 to H'00000017
Illegal slot instruction 6 H'00000018 to H'0000001B
(Reserved for system use) 7 H'0000001C to H'0000001F
8 H'00000020 to H'00000023
CPU address error 9 H'00000024 to H'00000027
(Reserved for system use) 10 H'00000028 to H'0000002B
Interrupt NMI 11 H'0000002C to H'0000002F
User break 12 H'00000030 to H'00000033
(Reserved for system use) 13 H'00000034 to H'00000037
: :
31 H'0000007C to H'0000007F
Trap instruction (user vector) 32 H'00000080 to H'00000083
: :
63 H'000000FC to H'000000FF
Rev. 3.00 Sep. 27, 2007 Page 73 of 758
REJ09B0243-0300
Page 94
Section 5 Exception Handling
Exception Handling Source Vector Number Vector Table Address Offset
Interrupt IRQ0 (SH7125)
IRQ1
IRQ2
IRQ3
(Reserved for system use)
64 H'00000100 to H'00000103
65 H'00000104 to H'00000107
66 H'00000108 to H'0000010B
67 H'0000010C to H'0000010F
68 H'00000110 to H'00000113
: :
71 H'0000011C to H'0000011F
On-chip peripheral module*72 H'00000120 to H'00000123
: :
255 H'000003FC to H'000003FF
Note: * For details on the vector numbers and vector table address offsets of on-chip peripheral
module interrupts, see table 6.3 in section 6, Interrupt Controller (INTC).
Resets have priority over any exception source. There are two types of resets: power-on resets and
manual resets. As table 5.5 shows, both types of resets initialize the internal status of the CPU. In
power-on resets, all registers of the on-chip peripheral modules are initialized; in manual resets,
they are not.
High Overflow High Initialized Initialized Initialized
High Not overflowed Low Initialized Not initialized Not initialized Manual reset
High Overflow High Initialized Not initialized Not initialized
Reset State
WDT
Overflow
MRES CPU, INTC
Internal State
On-Chip
Peripheral
Module
POE, PFC,
I/O Port
5.2.2 Power-On Reset
Power-On Reset by RES Pin: When the RES pin is driven low, this LSI enters the power-on
reset state. To reliably reset this LSI, the RES pin should be kept low for at least the oscillation
settling time when applying the power or when in standby mode (when the clock is halted) or at
least 20 tcyc when the clock is operating. During the power-on reset state, CPU internal states and
all registers of on-chip peripheral modules are initialized. See appendix A, Pin States, for the
status of individual pins during power-on reset mode.
In the power-on reset state, power-on reset exception handling starts when driving the RES pin
high after driving the pin low for the given time. The CPU operates as follows:
1. The initial value (execution start address) of the program counter (PC) is fetched from the
exception handling vector table.
2. The initial value of the stack pointer (SP) is fetched from the exception handling vector table.
3. The vector base register (VBR) is cleared to H'00000000 and the interrupt mask bits (I3 to I0)
of the status register (SR) are set to H'F (B'1111).
Rev. 3.00 Sep. 27, 2007 Page 75 of 758
REJ09B0243-0300
Page 96
Section 5 Exception Handling
4. The values fetched from the exception handling vector table are set in PC and SP, then the
program starts.
Be certain to always perform power-on reset exception handling when turning the system power
on.
Power-On Reset by WDT: When WTCNT of the WDT overflows while a setting is made so that
a power-on reset can be generated in watchdog timer mode of the WDT, this LSI enters the
power-on reset state.
The frequency control register (FRQCR) in the clock pulse generator (CPG) and the watchdog
timer (WDT) registers are not initialized by a reset generated by the WDT (these registers are only
initialized by a power-on reset from the RES pin).
If a reset caused by the signal input on the RES pin and a reset caused by a WDT overflow occur
simultaneously, the RES pin reset has priority, and the WOVF bit in RSTCSR is cleared to 0.
When the power-on reset exception handling caused by the WDT is started, the CPU operates as
follows:
1. The initial value (execution start address) of the program counter (PC) is fetched from the
exception handling vector table.
2. The initial value of the stack pointer (SP) is fetched from the exception handling vector table.
3. The vector base register (VBR) is cleared to H'00000000 and the interrupt mask bits (I3 to I0)
of the status register (SR) are set to H'F (B'1111).
4. The values fetched from the exception handling vector table are set in the PC and SP, then the
program starts.
5.2.3 Manual Reset
When the RES pin is high and the MRES pin is driven low, the LSI becomes to be a manual reset
state. To reliably reset the LSI, the MRES pin should be kept at low for at least the duration of the
oscillation settling time that is set in WDT when in software standby mode (when the clock is
halted) or at least 20 t
when the clock is operating. During manual reset, the CPU internal status
cyc
is initialized. Registers of on-chip peripheral modules are not initialized. See appendix A, Pin
States, for the status of individual pins during manual reset mode.
In the manual reset status, manual reset exception processing starts when the MRES pin is first
kept low for a set period of time and then returned to high. The CPU will then operate in the same
procedures as described for power-on resets.
Rev. 3.00 Sep. 27, 2007 Page 76 of 758
REJ09B0243-0300
Page 97
Section 5 Exception Handling
5.3 Address Errors
5.3.1 Address Error Sources
Address errors occur when instructions are fetched or data is read from or written to, as shown in
table 5.6.
Table 5.6 Bus Cycles and Address Errors
Bus Cycle
Type Bus Master Bus Cycle Description Address Errors
CPU Instruction fetched from even address None (normal) Instruction
fetch
Instruction fetched from a space other than
Instruction fetched from on-chip peripheral
Instruction fetched from external memory
read/write
Longword data accessed from a longword
Longword data accessed from other than a
Byte or word data accessed in on-chip
Longword data accessed in 16-bit on-chip
Longword data accessed in 8-bit on-chip
Reserved space accessed when in single
Instruction fetched from odd address Address error occurs
None (normal)
on-chip peripheral module space
Address error occurs
module space
Address error occurs
space in single chip mode
CPU
Word data accessed from even address None (normal) Data
Word data accessed from odd address Address error occurs
None (normal)
boundary
Address error occurs
long-word boundary
None (normal)
peripheral module space
None (normal)
peripheral module space
None (normal)
peripheral module space
Address error occurs
chip mode
Rev. 3.00 Sep. 27, 2007 Page 77 of 758
REJ09B0243-0300
Page 98
Section 5 Exception Handling
5.3.2 Address Error Exception So urce
When an address error exception is generated, the bus cycle which caused the address error ends,
the current instruction finishes, and then the address error exception handling starts. The CPU
operates as follows:
1. The status register (SR) is saved to the stack.
2. The program counter (PC) is saved to the stack. The PC value to be saved is the start address
of the instruction which caused an address error exception. When the instruction that caused
the exception is placed in the delay slot, the address of the delayed branch instruction which is
placed immediately before the delay slot.
3. The start address of the exception handling routine is fetched from the exception handling
vector table that corresponds to the generated address error, and the program starts executing
from that address. This branch is not a delayed branch.
Rev. 3.00 Sep. 27, 2007 Page 78 of 758
REJ09B0243-0300
Page 99
Section 5 Exception Handling
5.4 Interrupts
5.4.1 Interrupt Sources
Table 5.7 shows the sources that start the interrupt exception handling. They are NMI, user break,
IRQ, and on-chip peripheral modules.
Table 5.7 Interrupt Sources
Number of
Type Request Source
NMI NMI pin (external input) 1
User break User break controller (UBC) 1
IRQ IRQ0 to IRQ3 pins (external input) 4 (SH7125)
On-chip peripheral module Multi-function timer pulse unit 2 (MTU2) 28
Watchdog timer (WDT) 1
A/D converter (A/D_0 and A/D_1) 2
Compare match timer (CMT_0 and CMT_1) 2
Serial communication interface (SCI_0, SCI_1,
and SCI_2)
Port output enable (POE) 2
All interrupt sources are given different vector numbers and vector table address offsets. For
details on vector numbers and vector table address offsets, see table 6.3 in section 6, Interrupt
Controller (INTC).
Sources
3 (SH7124)
12
Rev. 3.00 Sep. 27, 2007 Page 79 of 758
REJ09B0243-0300
Page 100
Section 5 Exception Handling
5.4.2 Interrupt Priority
The interrupt priority is predetermined. When multiple interrupts occur simultaneously
(overlapped interruptions), the interrupt controller (INTC) determines their relative priorities and
starts the exception handling according to the results.
The priority of interrupts is expressed as priority levels 0 to 16, with priority 0 the lowest and
priority 16 the highest. The NMI interrupt has priority 16 and cannot be masked, so it is always
accepted. The priority level of the user break interrupt is 15. IRQ interrupt and on-chip peripheral
module interrupt priority levels can be set freely using the interrupt priority registers A to F and H
to M (IPRA to IPRF and IPRH to IPRM) of the INTC as shown in table 5.8. The priority levels
that can be set are 0 to 15. Level 16 cannot be set. For details on IPRA to IPRF, see section 6.3.4,
Interrupt Priority Registers A to F and H to M (IPRA to IPRF and IPRH to IPRM).
Table 5.8 Interrupt Priority
Type Priority Level Comment
NMI 16 Fixed priority level. Cannot be masked.
User break 15 Fixed priority level. Can be masked.
IRQ 0 to 15
On-chip peripheral module
Set with interrupt priority registers A to F and H
to M (IPRA to IPRF and IPRH to IPRM).
5.4.3 Interrupt Exception Handling
When an interrupt occurs, the interrupt controller (INTC) ascertains its priority level. NMI is
always accepted, but other interrupts are only accepted if they have a priority level higher than the
priority level set in the interrupt mask bits (I3 to I0) of the status register (SR).
When an interrupt is accepted, exception handling begins. In interrupt exception handling, the
CPU saves SR and the program counter (PC) to the stack. The priority level of the accepted
interrupt is written to bits I3 to I0 in SR. Although the priority level of the NMI is 16, the value set
in bits I3 to I0 is H'F (level 15). Next, the start address of the exception handling routine is fetched
from the exception handling vector table for the accepted interrupt, and program execution
branches to that address and the program starts. For details on the interrupt exception handling, see
section 6.6, Interrupt Operation.
Rev. 3.00 Sep. 27, 2007 Page 80 of 758
REJ09B0243-0300
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.