RA0E1 Group: User's Manual: Hardware 32-Bit MCU
RA0E1 Group: User's Manual: Hardware 32-Bit MCU
RA0E1 Group
32 User’s Manual: Hardware
32-Bit MCU
Renesas Advanced (RA) Family
Renesas RA0 Series
All information contained in these materials, including products and product specifications,
represents information on the product at the time of publication and is subject to change by
Renesas Electronics Corp. without notice. Please review the latest information published by
Renesas Electronics Corp. through various means, including the Renesas Electronics Corp.
website (http://www.renesas.com).
www.renesas.com
Rev.1.10 Dec 2024
Notice
1. Descriptions of circuits, software and other related information in this document are provided only to illustrate the operation of semiconductor products
and application examples. You are fully responsible for the incorporation or any other use of the circuits, software, and information in the design of your
product or system. Renesas Electronics disclaims any and all liability for any losses and damages incurred by you or third parties arising from the use of
these circuits, software, or information.
2. Renesas Electronics hereby expressly disclaims any warranties against and liability for infringement or any other claims involving patents, copyrights, or
other intellectual property rights of third parties, by or arising from the use of Renesas Electronics products or technical information described in this
document, including but not limited to, the product data, drawings, charts, programs, algorithms, and application examples.
3. No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights of Renesas Electronics or
others.
4. You shall be responsible for determining what licenses are required from any third parties, and obtaining such licenses for the lawful import, export,
manufacture, sales, utilization, distribution or other disposal of any products incorporating Renesas Electronics products, if required.
5. You shall not alter, modify, copy, or reverse engineer any Renesas Electronics product, whether in whole or in part. Renesas Electronics disclaims any
and all liability for any losses or damages incurred by you or third parties arising from such alteration, modification, copying or reverse engineering.
6. Renesas Electronics products are classified according to the following two quality grades: “Standard” and “High Quality”. The intended applications for
each Renesas Electronics product depends on the product’s quality grade, as indicated below.
"Standard": Computers; office equipment; communications equipment; test and measurement equipment; audio and visual equipment; home
electronic appliances; machine tools; personal electronic equipment; industrial robots; etc.
"High Quality": Transportation equipment (automobiles, trains, ships, etc.); traffic control (traffic lights); large-scale communication equipment; key
financial terminal systems; safety control equipment; etc.
Unless expressly designated as a high reliability product or a product for harsh environments in a Renesas Electronics data sheet or other Renesas
Electronics document, Renesas Electronics products are not intended or authorized for use in products or systems that may pose a direct threat to
human life or bodily injury (artificial life support devices or systems; surgical implantations; etc.), or may cause serious property damage (space system;
undersea repeaters; nuclear power control systems; aircraft control systems; key plant systems; military equipment; etc.). Renesas Electronics disclaims
any and all liability for any damages or losses incurred by you or any third parties arising from the use of any Renesas Electronics product that is
inconsistent with any Renesas Electronics data sheet, user’s manual or other Renesas Electronics document.
7. No semiconductor product is absolutely secure. Notwithstanding any security measures or features that may be implemented in Renesas Electronics
hardware or software products, Renesas Electronics shall have absolutely no liability arising out of any vulnerability or security breach, including but not
limited to any unauthorized access to or use of a Renesas Electronics product or a system that uses a Renesas Electronics product. RENESAS
ELECTRONICS DOES NOT WARRANT OR GUARANTEE THAT RENESAS ELECTRONICS PRODUCTS, OR ANY SYSTEMS CREATED USING
RENESAS ELECTRONICS PRODUCTS WILL BE INVULNERABLE OR FREE FROM CORRUPTION, ATTACK, VIRUSES, INTERFERENCE,
HACKING, DATA LOSS OR THEFT, OR OTHER SECURITY INTRUSION (“Vulnerability Issues”). RENESAS ELECTRONICS DISCLAIMS ANY AND
ALL RESPONSIBILITY OR LIABILITY ARISING FROM OR RELATED TO ANY VULNERABILITY ISSUES. FURTHERMORE, TO THE EXTENT
PERMITTED BY APPLICABLE LAW, RENESAS ELECTRONICS DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, WITH
RESPECT TO THIS DOCUMENT AND ANY RELATED OR ACCOMPANYING SOFTWARE OR HARDWARE, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8. When using Renesas Electronics products, refer to the latest product information (data sheets, user’s manuals, application notes, “General Notes for
Handling and Using Semiconductor Devices” in the reliability handbook, etc.), and ensure that usage conditions are within the ranges specified by
Renesas Electronics with respect to maximum ratings, operating power supply voltage range, heat dissipation characteristics, installation, etc. Renesas
Electronics disclaims any and all liability for any malfunctions, failure or accident arising out of the use of Renesas Electronics products outside of such
specified ranges.
9. Although Renesas Electronics endeavors to improve the quality and reliability of Renesas Electronics products, semiconductor products have specific
characteristics, such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Unless designated as a high reliability
product or a product for harsh environments in a Renesas Electronics data sheet or other Renesas Electronics document, Renesas Electronics products
are not subject to radiation resistance design. You are responsible for implementing safety measures to guard against the possibility of bodily injury,
injury or damage caused by fire, and/or danger to the public in the event of a failure or malfunction of Renesas Electronics products, 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 appropriate measures. Because the evaluation of microcomputer software alone is very difficult and impractical, you are
responsible for evaluating the safety of the final products or systems manufactured by you.
10. Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas
Electronics product. You are responsible for carefully and sufficiently investigating applicable laws and regulations that regulate the inclusion or use of
controlled substances, including without limitation, the EU RoHS Directive, and using Renesas Electronics products in compliance with all these
applicable laws and regulations. Renesas Electronics disclaims any and all liability for damages or losses occurring as a result of your noncompliance
with applicable laws and regulations.
11. Renesas Electronics products and technologies shall not be used for or incorporated into any products or systems whose manufacture, use, or sale is
prohibited under any applicable domestic or foreign laws or regulations. You shall comply with any applicable export control laws and regulations
promulgated and administered by the governments of any countries asserting jurisdiction over the parties or transactions.
12. It is the responsibility of the buyer or distributor of Renesas Electronics products, or any other party who distributes, disposes of, or otherwise sells or
transfers the product to a third party, to notify such third party in advance of the contents and conditions set forth in this document.
13. This document shall not be reprinted, reproduced or duplicated in any form, in whole or in part, without prior written consent of Renesas Electronics.
14. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas
Electronics products.
(Note1) “Renesas Electronics” as used in this document means Renesas Electronics Corporation and also includes its directly or indirectly controlled
subsidiaries.
(Note2) “Renesas Electronics product(s)” means any product developed or manufactured by or for Renesas Electronics.
Trademarks
Renesas and the Renesas logo are trademarks of Renesas Electronics
Corporation. All trademarks and registered trademarks are the property
of their respective owners.
2. Audience
This manual is written for system designers who are designing and programming applications using the Renesas
Microcontroller. The user is expected to have basic knowledge of electrical circuits, logic circuits, and the MCU.
3. Renesas Publications
Renesas provides the following documents. Before using any of these documents, visit www.renesas.com for the most
up-to-date version of the document.
Microcontrollers Data sheet Features, overview, and electrical characteristics of the MCU
User’s Manual: Hardware MCU specifications such as pin assignments, memory maps,
peripheral functions, electrical characteristics, timing diagrams, and
operation descriptions
Application Notes Technical notes, board design guidelines, and software migration
information
Technical Update (TU) Preliminary reports on product specifications such as restriction and
errata
Software User’s Manual: Software API reference and programming information
Application Notes Project files, guidelines for software programming, and application
examples to develop embedded software applications
Tools & Kits, Solutions User’s Manual: Development Tools User’s manual and quick start guide for developing embedded
software applications with Development Kits (DK), Starter Kits
User’s Manual: Software (SK), Promotion Kits (PK), Product Examples (PE), and Application
Quick Start Guide Examples (AE)
Application Notes Project files, guidelines for software programming, and application
examples to develop embedded software applications
4. Numbering Notation
The following numbering notation is used throughout this manual:
Example Description
011b Binary number. For example, the binary equivalent of the number 3 is 011b.
0x1F Hexadecimal number. For example, the hexadecimal equivalent of the number 31 is described 0x1F. In
some cases, a hexadecimal number is shown with the suffix "h".
1234 Decimal number. A decimal number is followed by this symbol only when the possibility of confusion
exists. Decimal numbers are generally shown without a suffix.
5. Typographic Notation
The following typographic notation is used throughout this manual:
Example Description
AAA.BBB.CCC Periods separated a function module symbol (AAA), register symbol (BBB), and bit field symbol
(CCC).
AAA.BBB A period separated a function module symbol (AAA) and register symbol (BBB).
BBB.DDD A period separated a register symbol (BBB) and bit field symbol (DDD).
EEE[3:0] Numbers in brackets expresses a bit number. For example, EEE[3:0] occupies bits 3 to 0.
7. Special Terms
The following terms have special meanings.
Term Description
NC Not connected pin. This pin should be left floating unless specified otherwise.
Hi-Z High impedance.
x Don't care or undefined.
8. Register Description
Each register description includes both a register diagram that shows the bit assignments and a register bit table that
describes the content of each bit. The example of symbols used in these tables are described in the sections that follow.
The following is an example of a register description and associated bit field definition.
0: {enumeratedValue/description}
1: {enumeratedValue/description}
7:1 — These bits are read as 0. The write value should be 0. R/W
(4) Symbol
{filed/name} indicates the short name of bit field. Reserved bit is expressed with a —.
(5) Function
Function indicates the full name of the bit field, {field/description}, and enumerated values.
(6) R/W
The R/W column indicates access type whether the bit field is readable or writable.
Abbreviation Description
Features
■ Arm Cortex-M23 Core ■ Operating Temperature and Packages
● Armv8-M architecture ● Ta = -40℃ to +105℃
● Maximum operating frequency: 32 MHz – 32-pin LQFP (7 mm × 7 mm, 0.8 mm pitch)
● Debug and Trace: DWT, FPB, CoreSight™ MTB-M23 – 32-pin HWQFN (5 mm × 5 mm, 0.5 mm pitch)
● CoreSight Debug Port: SW-DP – 24-pin HWQFN (4 mm × 4 mm, 0.5 mm pitch)
– 20-pin LSSOP (4.4 mm × 6.5 mm, 0.65 mm pitch)
■ Memory – 16-pin HWQFN (3 mm × 3 mm, 0.5 mm pitch)
● Up to 64-KB code flash memory
● 1-KB data flash memory (100,000 program/erase cycles)
● 12-KB SRAM
● Flash read protection (FRP)
● 128-bit unique ID
■ Connectivity
● Serial Array Unit (SAU)
– Simplified SPI × 3
– Simplified IIC × 3
– UART × 2
– UART (LIN-bus supported) × 1
● Serial Interface UARTA (UARTA) × 1
● I2C Bus interface (IICA) × 1
■ Analog
● 12-bit A/D Converter (ADC12)
● Temperature Sensor (TSN)
■ Timers
● 16-bit Timer Array Unit (TAU) × 8
● 32-bit interval timer (TML32) × 1
– 1 channel in 32-bit counter mode
– 2 channels in 16-bit counter mode
– 4 channels in 8-bit counter mode
■ Safety
● SRAM parity error check
● Flash area protection
● ADC self-diagnosis function
● Cyclic Redundancy Check (CRC)
● Independent Watchdog Timer (IWDT)
● GPIO readback level detection
● Register write protection
● Illegal memory access detection
■ Security
● True Random Number Generator (TRNG)
■ Operating Voltage
● VCC: 1.6 to 5.5 V
1. Overview
The MCU integrates multiple series of software- and pin-compatible Arm®-based 32-bit cores that share a common set of
Renesas peripherals to facilitate design scalability.
The MCU in this series incorporates an energy-efficient Arm Cortex®-M23 32-bit core, that is particularly well suited for
cost-sensitive and low-power applications, with the following features:
● Up to 64-KB code flash memory
● 12-KB SRAM
● Serial Interface (SAU, UARTA, IICA)
● General Purpose Timer (TAU, TML32)
● 12-bit A/D Converter (ADC12)
Event Link Controller (ELC) The Event Link Controller (ELC) uses the event requests generated by various peripheral
modules as source signals to connect them to different modules, allowing direct link between
the modules without CPU intervention.
See section 15, Event Link Controller (ELC).
Data Transfer Controller (DTC) A Data Transfer Controller (DTC) module is provided for transferring data when activated by an
interrupt request.
See section 14, Data Transfer Controller (DTC).
Timer Array Unit (TAU) The timer array unit has eight 16-bit timers.Each 16-bit timer is called a channel and can be
used as an independent timer. In addition, two or more channels can be used to create a High
functional timer.
See section 17, Timer Array Unit (TAU).
32-bit Interval Timer (TML32) The 32-bit interval timer is made up of four 8-bit interval timers (referred to as channels 0 to 3).
Each is capable of operating independently and in that case they all have the same functions.
Two 8-bit interval timer channels can be connected to operate as a 16-bit interval timer. Four
8-bit interval timer channels can be connected to operate as a 32-bit interval timer.
See section 18, 32-bit Interval Timer (TML32).
Realtime Clock (RTC) The Realtime Clock (RTC) has the following features.
● Capable of counting years, months, days of the week, dates, hours, minutes, and seconds,
for up to 99 years
● Fixed-cycle interrupt (with period selectable from among 0.5 of a second, 1 second, 1
minute, 1 hour, 1 day, or 1month)
● Alarm interrupt (alarm set by day of week, hour, and minute)
● Pin output function of 1 Hz
See section 19, Realtime Clock (RTC).
Serial Array Unit (SAU) A Serial Array Unit (SAU) has up to two units. Unit0 has four channels and Unit1 has two
channels. Each channel can achieve simplified SPI, UART or simplified IIC.
See section 21, Serial Array Unit (SAU)).
I2C Bus Interface (IICA) The I2C Bus Interface (IICA) has 1 channel. The IICA module conforms I2C (Inter-Integrated
Circuit) Bus Interface functions.
See section 22, I2C Bus Interface (IICA).
Serial Interface UARTA (UARTA) The Serial Interface UARTA (UARTA) has 1 channel. UARTA performs an asynchronous
communication.
See section 23, Serial Interface UARTA (UARTA).
12-bit A/D Converter (ADC12) A 12-bit successive approximation A/D converter is provided. Up to 10 analog input channels
are selectable. Temperature sensor output and internal reference voltage are selectable for
conversion.
See section 25, 12-bit A/D Converter (ADC12).
Temperature Sensor (TSN) The on-chip Temperature Sensor (TSN) determines and monitors the die temperature for
reliable operation of the device. The sensor outputs a voltage directly proportional to the die
temperature, and the relationship between the die temperature and the output voltage is fairly
linear. The output voltage is provided to the ADC12 for conversion and can be further used by
the end application.
See section 26, Temperature Sensor (TSN).
Cyclic Redundancy Check (CRC) The Cyclic Redundancy Check (CRC) generates CRC codes to detect errors in the data. Two
calculator CRC-generation polynomials (CRC-CCITT, CRC-32) are available.
See section 24, Cyclic Redundancy Check (CRC).
True Random Number Generator The True Random Number Generator(TRNG) generates 32-bit random number seeds.
(TRNG) See section 29, True Random Number Generator (TRNG).
Arm
SWCLK Cortex-M23
SWDIO Core
Data transfer controller
NVIC MTB (DTC)
SysTick SWD
Bus matrix
64 KB
Code flash
FRP 1 KB 12 KB
Data flash SRAM (Parity)
R 7 F A 0 E1 0 7 3 C F J # A A 0
Production identification code
Packaging
A: Tray
B: Tray (Full carton)
C: Magazine
H: Tape and reel
U: Tray (Full Tray)
Package type
FJ:LQFP 32 pins
NH:HWQFN 32 pins
NK: HWQFN 24 pins
SC: LSSOP 20 pins
NL: HWQFN 16 pins
Quality Grade
Operating temperature
Feature set
Group name
Series name
RA Family
Flash memory
Renesas microcontroller
Note: Check the order screen for each product on the Renesas website for valid symbols after the #.
R7FA0E1073CNH
R7FA0E1053CNH
R7FA0E1073CNK
R7FA0E1053CNK
R7FA0E1073CSC
R7FA0E1053CSC
R7FA0E1073CNL
R7FA0E1053CNL
R7FA0E1073CFJ
R7FA0E1053CFJ
Parts number
Pin count 32 24 20 16
Package LQFP/HWQFN HWQFN LSSOP HWQFN
Code flash memory 64 KB 32 KB 64 KB 32 KB 64 KB 32 KB 64 KB 32 KB
Data flash memory 1 KB 1 KB 1 KB 1 KB
SRAM(Parity) 12 KB 12 KB 12 KB 12 KB
System CPU clock 32 MHz 32 MHz 32 MHz 32 MHz
Sub clock oscillator Yes Yes (CMC.XTSEL=1) Yes (CMC.XTSEL=1) Yes (CMC.XTSEL=1)
ICU Yes Yes Yes Yes
Event control ELC Yes Yes Yes Yes
DMA DTC Yes Yes Yes Yes
Timers TAU 8 (PWM outputs: 7) 8 (PWM outputs: 7) 8 (PWM outputs: 7) 8 (PWM outputs: 7)
TML32 1 (32-bit counter 1 (32-bit counter 1 (32-bit counter 1 (32-bit counter
mode), mode), mode), mode),
2 (16-bit counter 2 (16-bit counter 2 (16-bit counter 2 (16-bit counter
mode), mode), mode), mode),
4 (8-bit counter 4 (8-bit counter 4 (8-bit counter 4 (8-bit counter
mode) mode) mode) mode)
RTC Yes Yes Yes Yes
IWDT Yes Yes Yes Yes
Communication SAU 3 (simplified SPI), 3 (simplified SPI), 3 (simplified SPI), 2 (simplified SPI),
3 (simplified IIC), 3 (simplified IIC), 3 (simplified IIC), 2 (simplified IIC),
2 (UART), 2 (UART), 2 (UART), 2 (UART)
1 (UART supporting 1 (UART supporting 1 (UART supporting
LIN-bus) LIN-bus) LIN-bus)
UARTA 1 1 1 1
IICA 1 1 1 1
Analog ADC12 10 8 6 5
TSN Yes Yes Yes Yes
Data processing CRC Yes Yes Yes Yes
Security TRNG TRNG TRNG TRNG
I/O ports I/O pins 26 20 16 12
Input pins 3 1 1 1
Pull-up resistors 16 12 12 9
N-ch open-drain 15 11 9 6
outputs
5-V tolerance 2 2 — —
Power supply VCC Input Power supply pin. Connect it to the system power supply. Connect
this pin to VSS by a 0.1-µF capacitor. Place the capacitor close to
the pin.
VCL I/O Connect this pin to the VSS pin by the smoothing capacitor used to
stabilize the internal power supply. Place the capacitor close to the
pin.
VSS Input Ground pin. Connect it to the system power supply (0 V).
Clock X2 I/O Pins for a crystal resonator. An external clock signal can be input
through the X2 pin.
X1 Input
XCIN Input Input/output pins for the sub-clock oscillator. Connect a crystal
resonator between XCOUT and XCIN.
XCOUT Output
PCLBUZ0 Output Clock output / Buzzer output
EXCLK Input External clock input for the main clock
System control RES Input Reset signal input pin. The MCU enters the reset state when this
signal goes low.
On-chip debug SWDIO I/O Serial wire debug data input/output pin
SWCLK Input Serial wire clock pin
Interrupt NMI Input Non-maskable interrupt request pin
IRQ0 to IRQ5 Input Maskable interrupt request pins
TAU TI00 to TI07 Input Pins for inputting an external counting clock/capture trigger to 16-bit
timers 00 to 07
TO00 to TO07 I/O Timer output pins for 16-bit timers 00 to 07
RTC RTCOUT Output Output pin for 1-Hz clock
IICA SCLAn (n = 0) I/O Input/output pins for the clock
SDAAn (n = 0) I/O Input/output pins for data
SAU SCK00, SCK11, SCK20 I/O Serial clock I/O pins for serial interfaces SPI00, SPI11 and SPI20
SI00, SI11, SI20 Input Serial data input pins for serial interfaces SPI00, SPI11 and SPI20
SO00, SO11, SO20 Output Serial data output pins for serial interfaces SPI00, SPI11, and SPI20
SSI00 Input Chip select pin for serial interfaces SPI00
SCL00, SCL11, SLC20 Output Serial clock output pins for serial interfaces IIC00, IIC11, and IIC20
SDA00, SDA11, SDA20 I/O Serial data I/O pins for serial interfaces IIC00, IIC11, and IIC20
RXD0, RXD1, RXD2 Input Serial data input pins for serial interfaces UART0, UART1, and
UART2
TXD0, TXD1, TXD2 Output Serial data output pins for serial interfaces UART0, UART1, and
UART2
UARTA RXDAn (n = 0) Input Serial data input pin for the UARTA serial interface
TXDAn (n = 0) Output Serial data output pin for the UARTA serial interface
Analog power supply VREFH0 Input Analog reference voltage supply pin for the ADC12. Connect this pin
to external reference voltage or VCC.
VREFL0 Input Analog reference ground pin for the ADC12. Connect this pin to
external reference ground voltage or VSS.
ADC12 AN000 to AN007, AN021 Input Input pins for the analog signals to be processed by the A/D
to AN022 converter.
P108/SWDIO
P100
P101
P102
P103
P109
P112
P110
24
23
22
21
20
19
18
17
P015 25 16 P300/SWCLK
P014 26 15 P200
P013 27 14 P201
P012 28 13 RES/P206
P009 29 12 P207
P008 30 11 P208
P011/VREFL0 31 10 P913
P010/VREFH0 32 9 P914
1
2
3
4
5
6
7
8
VCL
P215/XCIN
P214/XCOUT
VSS
P213/X2/EXCLK
P212/X1
VCC
P407
Figure 1.3 Pin assignment for LQFP / HWQFN 32-pin (top view)
Note: For the QFN package product, solder the exposed die pad to the PCB.
The potential of the exposed die pad is recommended to design as electrically open.
P100
P101
P102
P109
P112
P110
18
17
16
15
14
13
P015 19 12 P108/SWDIO
P014 20 11 P300/SWCLK
P013 21 exposed 10 P200
P012 22 die pad 9 P201
P011/VREFL0 23 8 RES/P206
P010/VREFH0 24 7 P913
1
2
3
4
5
6
VCL
VSS
P213/X2/EXCLK/XCOUT
P212/X1/XCIN
VCC
P914
Note: For the QFN package product, solder the exposed die pad to the PCB.
The potential of the exposed die pad is recommended to design as electrically open.
P010/VREFH0 1 20 P011/VREFL0
VCL 2 19 P012
VSS 3 18 P013
P213/X2/EXCLK/XCOUT 4 17 P100
P212/X1/XCIN 5 16 P101
VCC 6 15 P102
RES/P206 7 14 P112
P201 8 13 P110
P200 9 12 P109
P300/SWCLK 10 11 P108/SWDIO
P108/SWDIO
P100
P101
P102
12
10
11
9
P012 13 8 P300/SWCLK
P011/VREFL0 14 exposed 7 P200
15 die pad 6 P201
P010/VREFH0
VCL 16 5 RES/P206
2
3
4
VSS
P213/X2/EXCLK/XCOUT
P212/X1/XCIN
VCC
Note: For the QFN package product, solder the exposed die pad to the PCB.
The potential of the exposed die pad is recommended to design as electrically open.
Power,
I/O ports
System,
32-pin
24-pin
20-pin
16-pin
Clock,
Debug Interrupt TAU RTC SAU IICA UARTA ADC
1 1 2 16 VCL — — — — — — — —
2 — — — XCIN P215 — — — — — — —
3 — — — XCOUT P214 — — — — — — —
4 2 3 1 VSS — — — — — — — —
7 5 6 4 VCC — — — — — — — —
9 6 — — — P914 — — — — SCLA0_A — —
10 7 — — — P913 — — — — SDAA0_A — —
13 8 7 5 RES P206 — — — — — — —
15 10 9 7 — P200 IRQ0_A/NMI — — — — — —
26 20 — — — P014 — — — — — — AN006
27 21 18 — — P013 — — — — — — AN005
28 22 19 13 — P012 — — — — — — AN004
29 — — — — P009 — — — — — — AN003
30 — — — — P008 — — — — — — AN002
Note 1. When setting CMC.XTSEL = 1 for 24-, 20-, and 16-pin products
Note: Some signal names have _A, _B, _C or _D suffixes, but these suffixes can be ignored when assigning functionality,
except for SAU and IICA. For SAU and IICA, only signals, except for SCL11 and SCK11, bearing the same suffix
can be selected. The simultaneous use of the same signal with different suffixes is prohibited.
2. CPU
The MCU is based on the Arm® Cortex®-M23 core.
2.1 Overview
2.1.1 CPU
● Arm Cortex-M23
– Revision: r1p0-00rel0
– Armv8-M architecture profile
– Main Extension is not implemented
– Single-cycle integer multiplier
– 19-cycle integer divider
● SysTick timer
– Driven by SYSTICCLK (LOCO) or ICLK
2.1.2 Debug
● Arm® CoreSight™ MTB-M23
– Revision: r0p0-00rel0
– Buffer size: 1 KB of 12-KB MTB SRAM
● Data Watchpoint Unit (DWT)
– 2 comparators for watchpoints
● Flash Patch and Break point Unit (FPB)
– 4 instruction comparators
● CoreSight Debug Access Port (DAP)
– Serial Wire-Debug Port (SW-DP)
● Debug Register Module (DBGREG)
– Reset control
– Halt control
Cortex®-M23 integration
Cortex-M23
SWJ-DP
CM23 core
DAP IC NVIC MTB
SRAM
APB-AP DWT
DBGREG
OCDREG
To: System control
ROM Table
FPB
2.4.2.2 Reset
In OCD mode, some resets depend on the CPU status and the DBGSTOPCR register setting.
Table 2.4 Reset or interrupt and mode setting
Control in On-Chip Debug (OCD) mode
Reset or interrupt name OCD break mode OCD run mode
For more information on these registers, see the ARM® CoreSight™ MTB-M23 Technical Reference Manual (ARM DDI
0564C).
For more information on these registers, see the ARM® CoreSight™ MTB-M23 Technical Reference Manual (ARM DDI
0564C).
Figure 2.2 shows a block diagram of the AP connection and address spaces.
DAP
IC
OCD address space
Port 1
APB-AP
OCDREG
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
CDBG CDBG
Bit field: — — PWRU PWRU — — — — — — — — — — — —
PACK PREQ
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit field: — — — — — — — — — — — — — — — —
The DBGSTR register is a status register which indicates the state of the debug power-up request to the MCU from the
emulator.
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 DBGSTOP_IWDT Mask Bit for IWDT Reset/Interrupt in the OCD Run Mode R/W
In the OCD break mode, the reset/interrupt is masked and IWDT counter is stopped,
regardless of this bit value.
0: Enable IWDT reset/interrupt
1: Mask IWDT reset/interrupt and stop IWDT counter
The Debug Stop Control Register (DBGSTOPCR) controls the functional stop in OCD mode. All bits in the register are
regarded as 0 when the MCU is not in OCD mode. In OCD break mode, the states of the CPU and peripheral functions may
deviate. Also, when released OCD break mode and run the program again, the state of the CPU and peripheral functions
may be different and the program may be executed.
Bit position: 31 0
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit field: — — — — — — — — — — — — — — — —
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CPUS
CPUS
Bit field: — — — — — — — — — — — — — TOPC AUTH
LEEP
LK
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit field: — — — — — — — — — — — — — — — —
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
EDBG
Bit field: — — — — — — — DBIRQ — — — — — — —
RQ
Emulator
host PC
SWD
APB-AP OCDREG
ID
comparator
Option-setting
memory
IAUTH output
ID code Compare result
(debug enable)
2.7.1 ID Code
The ID code is used for checking permission for debug and access to on-chip resources. If the ID code matches the 128-bit
data written in the ID Authentication Code Registers 0 to 3, the SWD debugger obtains access permission. ID code is
written in the OCD/Serial Programmer ID Setting Register (OSIS) in the option-setting memory. The initial value of the ID
code is all 1s (0xFFFFFFFF_FFFFFFFF_FFFFFFFF_FFFFFFFF). See section 6, Option-Setting Memory for details.
2.7.2 DBGEN
After the OCD emulator gets access permission, the OCD emulator must set the DBGEN bit in the System Control OCD
Control Register (SYOCDCR). In addition, the OCD emulator must clear the DBGEN bit before disconnecting it. See
section 9, Low Power Modes for details.
If system bus access is required in Software Standby or Snooze mode, set the MCUCTRL.DBIRQ bit in OCDREG to wake
up the MCU from the low power modes. Simultaneously, by asserting the MCUCTRL.DBIRQ bit in OCDREG, the OCD
emulator can wake up the MCU without starting CPU execution by using a CPU break.
2. Set up SWJ-DP to access the DAP bus. In the setup, the OCD emulator must assert CDBGPWRUPREQ in SWJ-DP
Control Status Register, then wait until CDBGPWRUPACK in the same register is asserted.
3. Set up the APB-AP to access OCDREG. The APB-AP is connected to the DAP bus port 1.
4. Write the 128-bit ID code to IAUTH registers 0 to 3 in OCDREG using the APB-AP.
5. If the 128-bit ID code matches the OSIS value, the AHB-AP is authorized to issue an AHB transaction. The
authorization result can be confirmed by the AUTH bit in the MCUSTAT Register or the DbgStatus bit in the AHB-AP
Control Status Word Register.
● When the DbgStatus bit is 1, the 128-bit ID code is a match with the OSIS value. AHB transfers are permitted.
● When the DbgStatus bit is 0, the 128-bit ID code is not a match with the OSIS value. AHB transfers are not
permitted.
6. Set up the AHB-AP to access the system address space. The AHB-AP is connected to the DAP bus port 0.
7. Start accessing the CPU debug resources using the AHB-AP.
2.8 References
1. ARM®v8-M Architecture Reference Manual (ARM DDI 0553B.a)
2. ARM® Cortex®-M23 Processor Technical Reference Manual (ARM DDI 0550C)
3. ARM® Cortex®-M23 Device Generic User Guide (ARM DUI 1095A)
4. ARM® CoreSight™ SoC-400 Technical Reference Manual (ARM DDI 0480G)
5. ARM® CoreSight™ Architecture Specification (ARM IHI 0029E)
6. ARM® CoreSight™ MTB-M23 Technical Reference Manual (ARM DDI 0564C)
3. Operating Modes
3.1 Overview
The MCU starts in single-chip mode and the on-chip flash is enabled when a reset is released. In single-chip mode, all I/O
pins are available for use as input or output port, inputs or outputs for peripheral functions, or as interrupt inputs.
Reset
Single-chip mode
4. Address Space
4.1 Address Space
The MCU supports a 4-GB linear address space ranging from 0x0000_0000 to 0xFFFF_FFFF that can contain both program
and data. Figure 4.1 shows the memory map of a 64-KB/32-KB flash product.
0xFFFF_FFFF
System for Cortex®-M23
0xE000_0000
Reserved area*1
0x4080_0000
Flash I/O registers
0x407E_0000
Reserved area*1
0x4010_0400
On-chip flash (data flash)
0x4010_0000
Peripheral I/O registers
0x4000_0000
Reserved area*1
0x2000_7000
On-chip SRAM
0x2000_4000
Reserved area*1
0x0101_0034
On-chip flash (option-setting memory)
0x0101_0010
0x0100_1091 Reserved area*1
5. Resets
5.1 Overview
The MCU provides 7 resets. Table 5.1 lists the reset names and sources.
Table 5.1 Reset names and sources
Reset name Source
RES pin reset Voltage input to the RES pin is driven low
Power-on reset VCC rise (voltage detection VPOR)*1
SOSC Enable or disable Initialized to disable Continue with the state that was selected before the
reset occurred
Drive capability Initialized to low power mode 1 Continue with the state that was selected before the
reset occurred
XCIN/XCOUT Initialized to general-purpose input Continue with the state that was selected before the
pins reset occurred
LOCO Enable or disable Initialized to disable. However, during IWDT operation, LOCO oscillates regardless of the value
of LCSTP.
Bit position: 7 6 5 4 3 2 1 0
IWDT RPER
Bit field: — — SWRF — — LVIRF
RF F
This register is cleared after it is read, in addition to when a reset occurs as described in Table 5.2.
Bit position: 7 6 5 4 3 2 1 0
5.3 Operation
After VCC exceeds VPOR and the specified power-on reset time (tPOR) elapses, the CPU starts the reset exception handling.
The power-on reset time is a stabilization period of the external power supply and the MCU circuit.
After a power-on reset is generated, the PORF flag in the PORSR is clear to 0. When VCC falls below VPOR, a power-on
reset state is occurred.
Figure 5.1 shows example of operations during a power-on reset.
VPOR, VPDR
0V
Wait for oscillation Wait for oscillation
accuracy stabilization accuracy stabilization
HOCO
Starting oscillation Starting oscillation
is specified by software is specified by software
MOSC
(when X1 oscillation is selected)
Normal operation Reset period Normal operation Reset period
(ICLK = HOCO) (oscillation (ICLK = HOCO) (oscillation
stop) stop)
CPU Operation stops
LVD reset processing
time
VPOR, VPDR*2
Time
LVD1MKR.MK
LVD1CR.LVD1EN
LVD1SR.MON
Clear
RESF.LVIRF
Note: For details on the electrical characteristics, see section 31, Electrical Characteristics.
Note 1. Vdet0 indicates the detection level of voltage monitor 0 reset and Vdet1 indicates the detection level of voltage monitor 0
reset.
Note 2. VPOR indicates the detection level of power-on reset at power supply rise, VPDR indicates the detection level of power-on
reset at power supply fall, and Vdet0 indicates the detection level of voltage monitor 0 reset.
6. Option-Setting Memory
6.1 Overview
The option-setting memory determines the state of the MCU after a reset. The Option-setting memory is allocated to the
configuration setting area and the program flash area of the flash memory. The available methods of setting are different for
the two areas.
Figure 6.1 shows the option-setting memory area.
Address*1
OCD/Serial Programmer ID
0x0101_0018 to 0x0101_0033
Setting Register (OSIS)
Configuration setting area
Access Window Setting Register
0x0101_0010 to 0x0101_0013
(AWS)
Note 1. The option-setting memory must be allocated to the user area of the flash memory.
Note 2. The address of these registers will be changed when the boot swap is set. See section 6.2.1. OFS0 : Option Function
Select Register 0 and section 6.2.2. OFS1 : Option Function Select Register 1 for details.
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit field: — — — — — — — — — — — — — — — —
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
IWDT IWDT
IWDT
Bit field: — STPC — RSTIR IWDTRPSS[1:0] IWDTRPES[1:0] IWDTCKS[3:0] IWDTTOPS[1:0] —
STRT
TL QS
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
FRPDI
Bit field: — — — FRPE[5:0] FRPS[5:0]
S
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PORT LVDA
Bit field: HOCOFRQ1[2:0] — — — — — — VDSEL0[2:0] — —
SELB S
Address: 0x0101_0010
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
BTFL
Bit field: — — — — FAWE[10:0]
G
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Issuing the program or erase command to an area outside the access window causes a command-locked state. The access
window is only valid in the program flash area. The access window provides protection in self-programming mode and
on-chip debug mode. The access window can be locked by the FSPR bit.
The access window is specified in both the FAWS[10:0] bits and the FAWE[10:0] bits. The settings for the FAWS[10:0] and
FAWE[10:0] bits are as follows:
FAWE[10:0] = FAWS[10:0]: The P/E command is allowed to execute in the full program flash area.
FAWE[10:0] > FAWS[10:0]: The P/E command is only allowed to execute in the window from the block pointed to by the
FAWS[10:0] bits to the block one lower than the block pointed to by the FAWE[10:0] bits.
FAWE[10:0] < FAWS[10:0]: The P/E command is not allowed to execute in the program flash area.
Address P/E
…
Protected
area
Block 7
(FAWE[10:00] = 0x007)
Block 6
Access Non-protected
Block 5
window area
Block 4
(FAWS[10:0] = 0x004)
Block 3
Block 2
Protected
area
Block 1
Block 0
Bit position: 31 0
Bit field:
These fields hold the ID for use in ID authentication for the OCD emulator/serial programmer.
ID code bits [127] and [126] on the 32-bit word at the address 0x0101_0018 determine whether the ID code protection is
enabled, and the authentication method. Table 6.2 shows how the ID code determines the authentication method.
On-chip debug mode 0xFF, …, 0xFF (all bytes are Protection disabled The ID code is not checked, the ID code always
(SWD boot mode) 0xFF) matches, and the connection to the on-chip debugger
or serial programmer is permitted.
Bit [127] = 1, bit [126] = 1, Protection enabled Matching ID code indicates that authentication is
and at least one of the 16 complete and connection to the on-chip debugger or
bytes is not 0xFF serial programmer is permitted.
Mismatching ID code indicates transition to the ID code
protection wait state.
When the ID code sent from the on-chip debugger
or serial programmer is ALeRASE in ASCII code
(0x414C_6552_4153_45FF_FFFF_FFFF_FFFF_FFFF),
the content of the user flash area is erased and all bits
in the OSIS register are 1.
However, when the AWS.FSPR bit is 0, the content of
the user flash area is not erased.
Bit [127] = 1 and bit [126] = Protection enabled Matching ID code indicates that authentication is
0 complete and connection to the on-chip debugger or
serial programmer is permitted.
Mismatching ID code indicates transition to the ID code
protection wait state.
Bit [127] = 0 Protection enabled The ID code is not checked, the ID code is always
mismatching, the connection to the on-chip debugger
or serial programmer is prohibited.
Note: Programming formats vary depending on the compiler. See the compiler manual for details.
6.4.1 Data for Programming Reserved Areas and Reserved Bits in the Option-Setting
Memory
When reserved areas and reserved bits in the option-setting memory are within the scope of programming, write 1 to all bits
of reserved areas and all reserved bits. If 0 is written to these bits, normal operation cannot be guaranteed.
Detected event Voltage falls past Vdet0 Voltage rises or falls past Vdet1
Detection voltage Selectable from 6 different levels in the Selectable from 18 different levels in the
OFS1.VDSEL0[2:0] bits LVD1CR.LVD1V[4:0] bits
Monitoring flag None LVD1SR.MON flag: Monitors whether voltage is
higher or lower than Vdet1
VCC
Voltage detection
level selector
+ Internal reset signal 0
Vdet0 Internal reset signal
-
Internal reset signal 1
Reference
voltage source
OFS1.VDSEL0[2:0] bits
OFS1.LVDAS bit
Note: For details of OFS1.LVDAS and OFS1.VDSEL0[2:0], see section 6, Option-Setting Memory.
VCC
MON
Controller
Reference
Voltage monitor 1
voltage source maskable interrupt signal
Detector
Event
Figure 7.2 Block diagram of voltage monitor 1 interrupt and reset circuit
Bit position: 7 6 5 4 3 2 1 0
Bit position: 7 6 5 4 3 2 1 0
Bit field: — — — — — — — MK
Note: Set the PRCR.PRC3 bit to 1 (write enabled) before rewriting this register.
Bit position: 7 6 5 4 3 2 1 0
VPOR, VPDR*1
Time
Clear
RESF.LVIRF
Note: For details of the electrical characteristics, see section 31, Electrical Characteristics.
Note 1. VPOR indicates the detection level of power-on reset at power supply rise, VPDR indicates the detection level of power-on
reset at power supply fall, and Vdet0 indicates the detection level of voltage monitor 0 reset.
Table 7.4 Procedures for setting bits related to voltage monitor 1 interrupt and voltage monitor 1 reset so that
voltage monitoring stops
Step Voltage monitor 1 interrupt (voltage monitor 1 ELC event output), voltage monitor 1 reset
Figure 7.4 shows the timing of the interrupt request signal generated in the LVD1 interrupt mode.
VPOR, VPDR
Time
LVD1MKR.MK
LVD1CR.LVD1EN
LVD1SR.MON
LVD1SR.DET
Cleared by software
Note: If operation of LVD1 is enabled while VCC is lower than the voltage detection level (Vdet1), it generates an interrupt
request signal (LVD_LVD1) at the time its operation is enabled.
Table 8.2 Clock generation circuit specifications for the internal clocks
Item Clock source Clock supply Specification
System clock (ICLK) MOSC*1/SOSC/HOCO/ CPU, DTC, FLASH, Flash-IF, SRAM Up to 32 MHz
MOCO/ LOCO 1 MHz to 32 MHz (P/E)
CKSEL
FOCOSCR
DIV[2:0]
MOSCDIV CKSEL
Selector
FMAINSCR CKSEL
Frequency ICLKSCR
divider FOCO
Selector
FMAIN
X1 Main clock
1/1
Selector
Main clock
1/2
1/4
System clock (ICLK)
oscillator 1/8
To CPU, Flash, SRAM, Flash-IF
X2/EXCLK 1/16
Selector
XCOUT oscillator FSUB
CSEL
CKS0 Frequency
divider
1/1
DIV[2:0] Clock/Buzzer output
Selector
1/2
1/4
HOCODIV 1/8
1/16
(PCLBUZ0)
1/32
1/64
To PCLBUZ0 pin
1/128
Frequency 1/2048
divider 1/4096
1/8192
High-speed 1/1
High-speed-on-chip clock
1/2
1/4
oscillator 1/8
1/16
24/32 MHz 1/32
Frequency Frequency
divider divider
Middle-speed 1/2
IWDT clock (IWDTCLK)
Middle-speed-on-chip
clock 1/1 To IWDT
oscillator 1/2
1/4
4 MHz
To TAU *1
Low-speed
Low-speed-on-chip
clock
oscillator
32.768 kHz
To UARTA, TML32
WUTMMCK0
OSMC
Selector
FSXP
WUTMMCK0
RTC128EN OSMC
RTC_RTCC0
Selector
divider To RTC
1/256
CKSEL
FOCOSCR
DIV[2:0]
MOSCDIV CKSEL
Selector
XTSEL FMAINSCR CKSEL
CMC Frequency ICLKSCR
divider FOCO
Selector
1/1 FMAIN
Main clock
Selector
Selector
X1/XCIN Main clock
1/2
1/4 System clock (ICLK)
oscillator 1/8
1/16 To CPU, Flash, SRAM, Flash-IF
CKSEL Peripheral module clock (PCLKB)
FSUBSCR
To peripheral modules
CCS[2:0]
Selector
Selector
oscillator FSUB
CSEL
CKS0 Frequency
CMC divider
1/1
XTSEL DIV[2:0] Clock/Buzzer output
Selector
1/2
1/4
HOCODIV 1/8
1/16
(PCLBUZ0)
1/32
1/64
To PCLBUZ0 pin
1/128
Frequency 1/2048
divider 1/4096
1/8192
High-speed 1/1
High-speed-on-chip clock
1/2
1/4
oscillator 1/8
1/16
24/32 MHz 1/32
Frequency Frequency
divider divider
Middle-speed 1/2
IWDT clock (IWDTCLK)
Middle-speed-on-chip
clock 1/1 To IWDT
oscillator 1/2
1/4
4 MHz
To TAU *1
Low-speed
Low-speed-on-chip
clock
oscillator
32.768 kHz
To UARTA, TML32
WUTMMCK0
OSMC
Selector
FSXP
WUTMMCK0
RTC128EN OSMC
RTC_RTCC0
Selector
divider To RTC
1/256
Figure 8.2 Clock generation circuit block diagram (24-, 20-, 16-pin)
X1 Output These pins are used to connect a crystal resonator. The EXCLK pin can also be used to input an
external clock. For details, see section 8.3.2. External Clock Input.
X2/EXCLK Input
XCIN Input These pins are used to connect a 32.768-kHz crystal resonator
XCOUT Output
PCLBUZ0 Output This pin is used to output the CLKOUT/BUZZER clock
SWCLK Input This pin is used to input from the SWD
Bit position: 7 6 5 4 3 2 1 0
Bit position: 7 6 5 4 3 2 1 0
Bit position: 7 6 5 4 3 2 1 0
CKSE
Bit field: — — — — — — CKST
L
Bit position: 7 6 5 4 3 2 1 0
CKSE
Bit field: — — — — — — CKST
L
Bit position: 7 6 5 4 3 2 1 0
CKSE
Bit field: — — — — — — —
L
Bit position: 7 6 5 4 3 2 1 0
CKSE
Bit field: — — — — — — CKST
L
Bit position: 7 6 5 4 3 2 1 0
MOST
Bit field: — — — — — — —
P
Operation of the main clock oscillator (MOSTP = 0) is prohibited in the Low-speed mode.
Bit position: 7 6 5 4 3 2 1 0
SOST
Bit field: — — — — — — —
P
● Confirm that the sub-clock oscillator is stable when stopping the sub-clock oscillator
● Regardless of whether the sub-clock oscillator is selected as the system clock, confirm that the sub-clock oscillation is
stable before executing a WFI instruction to place the MCU in Software Standby mode
● When a transition to Software Standby mode is to follow the setting to stop the sub-clock oscillator, wait for at least 3
SOSC clock cycles before executing the WFI instruction.
Bit position: 7 6 5 4 3 2 1 0
LCST
Bit field: — — — — — — —
P
Bit position: 7 6 5 4 3 2 1 0
HCST
Bit field: — — — — — — —
P
During On chip Debug operation, HOCO oscillates regardless of the value of HCSTP.
Bit position: 7 6 5 4 3 2 1 0
MCST
Bit field: — — — — — — —
P
Note: Set the PRCR.PRC0 bit to 1 (write enabled) before rewriting this register.
The MOCOCR register controls the MOCO clock.
Bit position: 7 6 5 4 3 2 1 0
Voltage waveform
on the X1 pin
This register indicates the counter value by the MOSC clock oscillation stabilization time counter.
The MOSC clock oscillation stabilization time can be checked in the following cases:
● If the MOSC clock starts oscillation while the main on-chip oscillator clock or subsystem clock is in use as the CPU
clock.
● If entry to and then release from the Software Standby mode proceed while the main on-chip oscillator clock is in use as
the CPU clock and the MOSC clock is oscillating.
Note: The oscillation stabilization time counter starts counting in the following cases.
● When oscillation of the MOSC clock starts (MOSEL[1:0] = 01b → MOSTP = 0)
● When the Software Standby mode is released
0x00 Less than 28/fMOSC Less than 25.6 µs Less than 12.8 µs
Bit position: 7 6 5 4 3 2 1 0
Bit position: 7 6 5 4 3 2 1 0
HOCO
Bit field: — — — — — — —
SF
The OSCSF register contains flags to indicate the operating status of the counters in the oscillation stabilization wait circuits
for the individual oscillators. After oscillation starts, these counters measure the wait time until each oscillator output clock
is supplied to the internal circuits. An overflow of a counter indicates that the clock supply is stable and available for the
associated circuit.
[Clearing condition]
● When the HOCO clock is operating and then is deactivated because the HOCOCR.HCSTP bit is set to1.
● When the MCU enters Software Standby mode due to the WFI instruction.
Bit position: 7 6 5 4 3 2 1 0
Bit position: 7 6 5 4 3 2 1 0
1:0 DIV[1:0] Selection of the Middle-speed On-chip Oscillator Clock Frequency R/W
0 0: × 1/1
0 1: × 1/2
1 0: × 1/4
Others: Setting prohibited
7:2 — These bits are read as 0. The write value should be 0. R/W
Note: Set the PRCR.PRC0 bit to 1 (write enabled) before rewriting this register.
Note: Set the MOCODIV register while ensuring that the voltage is within the usable range for the flash operation mode set in the flash
operating mode select register (FLMODE) both before and after the frequency change.
The MOCODIV register is used to select the frequency of the middle-speed on-chip oscillator.
The MOCODIV register can be set by an 8-bit memory manipulation instruction.
The value of this register is 0x00 following a reset.
Bit position: 7 6 5 4 3 2 1 0
2:0 DIV[2:0] Selection Division Ratio for the MOSC Clock R/W
0 0 0: × 1/1
0 0 1: × 1/2
0 1 0: × 1/4
0 1 1: × 1/8
1 0 0: × 1/16
Others: Setting prohibited
7:3 — These bits are read as 0. The write value should be 0. R/W
Note: Set the PRCR.PRC0 bit to 1 (write enabled) before rewriting this register.
Note: Set the MOSCDIV register while ensuring that the voltage is within the usable range for the flash operation mode set in the flash
operating mode select register (FLMODE) both before and after the frequency change.
This register is used to select the division ratio of the MOSC clock.
The MOSCDIV register can be set by an 8-bit memory manipulation instruction. The value of this register is 0x00 following
a reset.
Table 8.7 Example division ratio for the MOSC clock (MOSCDIV)
DIV[2:0] Selected division ratio for the MOSC clock fMOSC = 20 MHz
Bit position: 7 6 5 4 3 2 1 0
WUTM
Bit field: — — — — — — —
MCK0
3:0 — These bits are read as 0. The write value should be 0. R/W
4 WUTMMCK0 Selection of the Operating clock source for the Realtime Clock, 32-bit Interval Timer, Serial R/W
Interface UARTA
0: SOSC
1: LOCO*1 *2
7:5 — These bits are read as 0. The write value should be 0. R/W
Note: Set the PRCR.PRC0 bit to 1 (write enabled) before rewriting this register.
Note 1. After stopping SOSC, the clock source can be changed from SOSC to LOCO.
Note 2. Switching between SOSC and LOCO clock can be enabled by the WUTMMCK0 bit only when all of the realtime clock, 32-bit
interval timer, and serial interface UARTA are stopped.
Bit position: 7 6 5 4 3 2 1 0
PCLO
Bit field: — — — CSEL CCS[2:0]
E
Bit position: 7 6 5 4 3 2 1 0
Note: The frequency of the oscillator may vary due to changes in temperature and power supply voltage after frequency
trimming. In such cases, regular trimming is essential, especially when high-frequency accuracy is required.
Bit position: 7 6 5 4 3 2 1 0
Note: The frequency of the oscillator may vary due to changes in temperature and power supply voltage after frequency
trimming. In such cases, regular trimming is essential, especially when high-frequency accuracy is required.
Bit position: 7 6 5 4 3 2 1 0
Note: The frequency of the oscillator may vary due to changes in temperature and power supply voltage after frequency
trimming. In such cases, regular trimming is essential, especially when high-frequency accuracy is required.
CL1
X1
Rf
X2
Rd CL2
CL
L RS
X1 X2
C0
C1
XCIN
Rf
XCOUT
Rd
C2
CS
LS RS
XCIN XCOUT
C0
For details of the registers used to set the frequencies of the internal clocks, see section 8.5.1. System Clock (ICLK) to
section 8.5.5. External Pin Output Clock (CLKOUT).
If the value of any of these bits is changed, subsequent operation is at the frequency determined by the new value.
● DIV[2:0] in HOCODIV
● DIV[2:0] in MOCODIV
● DIV[2:0] in MOSCDIV
● CKSEL in FOCOSCR
● CKSEL in FMAINSCR
● CKSEL in FSUBSCR
● CKSEL in ICLKSCR
When the clock source of ICLK is being switched, the duration of ICLK clock cycle become longer during the clock source
transition period. See Figure 8.9 and Figure 8.10.
HOCODIV DIV[2:0]
Frequency
divider
1/1
1/2
1/4
HOCO 1/8 FOCOSCR CKSEL
1/16
1/32
Selector
FMAINSCR CKSEL
MOCODIV DIV[1:0]
divider
1/1
MOCO 1/2
1/4
Selector
ICLK
MOSCDIV DIV[2:0]
Frequency
divider
1/1
1/2
MOSC 1/4
1/8
1/16
CKSEL
FSUBSCR
SOSC
Selector
LOCO
CKSEL Source A (Low speed) Source B (High speed) Source A (Low speed)
CKST Source A (Low speed) Source B (High speed) Source A (Low speed)
ta tb
Selected clock
Clock source A
Clock source B
● DIV[2:0] in MOSCDIV
● CKSEL in FOCOSCR
● CKSEL in FMAINSCR
● CKSEL in FSUBSCR
[Condition]
● ICLKSCR.CKSEL = 1 (ICLK = LOCO or SOSC)
2. Do not write to registers listed in this section for the following condition:
[Registers]
● FOCOSCR, HOCODIV
[Condition]
● FMAINSCR.CKSEL = 1 (FMAIN = MOSC)
3. Do not write to registers listed in this section for the following condition:
[Registers]
● HOCODIV
[Condition]
● FOCOSCR.CKSEL = 1 (FOCO = MOCO)
MCU
CL2
X1
X2
CL1
Reducing power consumption by The frequency division ratio can be selected for HOCO, MOCO, and MOSC*1
switching clock signals
Module stop Functions can be stopped independently for each peripheral module
Low power modes ● Sleep mode
● Software Standby mode
● Snooze mode
Power control modes Power consumption can be reduced in Normal, Sleep, and Snooze mode by selecting an
appropriate operating power control mode according to the operating frequency and voltage.
Four operating power control modes are available:
● High-speed mode
● Middle-speed mode
● Low-speed mode
● Subosc-speed mode
Note 1. For details, see section 8, Clock Generation Circuit
Transition condition WFI instruction while WFI instruction while Snooze request in Software
SBYCR.SSBY = 0 SBYCR.SSBY = 1 Standby mode.
Canceling method All interrupts. Any reset available Interrupts shown in Table 9.3. Interrupts shown in Table 9.3.
in the mode. Any reset available in the mode. Any reset available in the mode.
State after cancellation by an Program execution state Program execution state Program execution state
interrupt (interrupt processing) (interrupt processing) (interrupt processing)
State after cancellation by a Reset state Reset state Reset state
reset
Main clock oscillator Selectable Stop Stop
Sub-clock oscillator Selectable Selectable Selectable
High-speed on-chip oscillator Selectable Stop Selectable*2
Middle-speed on-chip oscillator Selectable Stop Selectable*2
Low-speed on-chip oscillator Selectable Selectable Selectable
Clock/buzzer output function Selectable Selectable*3 Selectable*3
CPU Stop (Retained) Stop (Retained) Stop (Retained)
SRAM Selectable Stop (Retained) Selectable
Flash memory Selectable*7 Stop (Retained) Selectable*7
Data Transfer Controller (DTC) Selectable Stop (Retained) Selectable
Independent Watchdog Timer Selectable*4 Selectable*4 Selectable*4
(IWDT)
Realtime clock (RTC) Selectable Selectable Selectable
32-bit Interval Timer (TML32) Selectable Selectable*5 Selectable*5
12-bit A/D Converter (ADC12) Selectable Stop (Retained) Selectable*10
Table 9.3 Available interrupt sources to transition to Normal mode from Snooze mode and Software Standby
mode
Interrupt source Name Software Standby mode Snooze mode
Figure 9.1 shows the transition between Normal mode to low power mode.
SBYCR.SSBY = 0
Reset state
Sleep mode
WFI instruction*1
RES pin = High*2
All interrupts
Snooze mode
Interrupt*4
Note 1. When an interrupt that acts as a trigger for cancel is received during a transition to the program stopped state after the
execution of a WFI instruction, the MCU executes interrupt exception handling instead of a transition to low power mode.
Note 2. The HOCO is the source of the operating clock following a transition from the reset state to Normal mode.
Note 3. The transition to Normal mode is made from an interrupt in Sleep mode, Software Standby mode, or Snooze mode. The
clock source is the same as before entering the low power mode.
Note 4. See Table 9.3.
Note 5. See section 9.8.1. Transition to Snooze Mode.
Note 6. See section 9.8.3. Returning from Snooze Mode to Software Standby Mode.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RTCL FWKU
Bit field: SSBY — — — — — FLSTP — — — — — — —
PC P
6:0 — These bits are read as 0. The write value should be 0. R/W
7 FLSTP Flash Mode in Sleep Mode or in Snooze Mode R/W
0: Flash active
1: Flash stop
8 FWKUP Setting for Starting the High-speed On-chip Oscillator at the times of release from Software R/W
Standby Mode and of Transitions to Snooze Mode
0: Starting of the high-speed on-chip oscillator is at normal speed
1: Starting of the high-speed on-chip oscillator is at high speed
9 RTCLPC SOSC Setting in Software Standby Mode or in Snooze Mode R/W
0: Enables supply of SOSC clock to peripheral functions
1: Stops supply SOSC clock to peripheral functions other than the Realtime clock
14:10 — These bits are read as 0. The write value should be 0. R/W
FWKUP bit (Setting for Starting the High-speed On-chip Oscillator at the times of release from Software
Standby Mode and of Transitions to Snooze Mode)
When the FWKUP bit is set to 1, High-speed On-chip Oscillator enters high-speed startup mode, shortening standby release
time and Snooze transition time. Instead, the frequency accuracy of HOCO changes during OSCSF.HOCOSF = 0 after
ICLK starts operating, see section 31, Electrical Characteristics. This bit can be set only when ICLK = HOCO (32MHz).
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MSTP
Bit field: — — — — — — — — — — — — — — —
A22
5:0 — These bits are read as 1. The write value should be 1. R/W
6 MSTPA22 DTC Module Stop*1 R/W
0: Cancel the module-stop state
1: Enter the module-stop state
15:7 — These bits are read as 1. The write value should be 1. R/W
Note 1. When rewriting the MSTPA22 bit from 0 to 1, disable the DTC before setting the MSTPA22 bit.
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit field: — — — — — — — — — — — — — — — —
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
5:0 — These bits are read as 1. The write value should be 1. R/W
6 MSTPB6 Serial Array Unit 0 Module Stop R/W
Target module: SAU0
0: Cancel the module-stop state
1: Enter the module-stop state
7 MSTPB7 Serial Array Unit 1 Module Stop R/W
Target module: SAU1
0: Cancel the module-stop state
1: Enter the module-stop state
9:8 — These bits are read as 1. The write value should be 1. R/W
10 MSTPB10 I2C Bus Interface Module Stop R/W
Target module: IICA0
0: Cancel the module-stop state
1: Enter the module-stop state
14:11 — These bits are read as 1. The write value should be 1. R/W
15 MSTPB15 Serial Interface UARTA Module Stop R/W
Target module: UARTA0
0: Cancel the module-stop state
1: Enter the module-stop state
31:16 — These bits are read as 1. The write value should be 1. R/W
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
MSTP
Bit field: — — — — — — — — — — — — — — —
C28
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MSTP MSTP
Bit field: — — — — — — — — — — — — — —
C14 C1
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
MSTP MSTP
Bit field: — — — — — — — — — — — — — —
D23 D16
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MSTP MSTP
Bit field: — — — — — — — — — — — — — —
D4 D0
Bit position: 7 6 5 4 3 2 1 0
5:0 — These bits are read as 0. The write value should be 0. R/W
7:6 MODE[1:0] Operating Mode Select R/W
0 0: Setting prohibited
0 1: Low-speed mode
1 0: Middle-speed mode
1 1: High-speed mode
Note: Direct transition between High-speed mode and Low-speed mode is prohibited (Writing 0x40 (0xC0) over 0xC0 (0x40) is ignored).
The transition between High-speed mode and Low-speed mode should be made through the Middle-speed mode.
The FLMODE register is used to reduce power consumption in Normal mode, Sleep mode, and Snooze mode. Power
consumption can be reduced according to the operating frequency and operating voltage used by the FLMODE setting.
For the procedure to change the operating power control modes, see section 9.5. Function for Lower Operating Power
Consumption.
Bit position: 7 6 5 4 3 2 1 0
FLMW
Bit field: — — — — — — —
EN
Bit position: 7 6 5 4 3 2 1 0
0 — Normal mode
1 RAMSD[1:0] = 10b —
2 — Wait mode
3 Waiting (80 ns) —
4 RAMSD[1:0] = 11b —
5 — Shutdown mode
Follow the procedure shown in Table 9.6 to switch the operating mode of the RAM from shutdown mode to normal mode.
Table 9.6 Procedure for settings to switch from Shutdown mode to Normal mode
Step Operation Mode
0 — Shutdown mode
1 RAMSD[1:0] = 10b —
2 — Wait mode
3 Waiting (1.2 µs) —
4 RAMSD[1:0] = 00b —
5 — Normal mode
Note: When the RAM returns to normal mode from shutdown mode, the contents of the RAM other than in the range from 0x2000_4000 to
0x2000_4FFF are undefined. Initialize the RAM area to be used.
Bit position: 7 6 5 4 3 2 1 0
DBGE
Bit field: — — — — — — —
N
6:0 — These bits are read as 0. The write value should be 0. R/W
7 DBGEN Debugger Enable bit R/W
Set to 1 first in on-chip debug mode.
0: On-chip debugger is disabled
1: On-chip debugger is enabled
Note: Set the PRCR.PRC1 bit to 1 (write enabled) before rewriting this register.
[Clearing condition]
● Power-on reset is generated
● Writing 0 to the bit.
Note: Certain restrictions apply in terms of the MCU states in which the DBGEN bit can be set to 1. For details, see
section 2.7.3. Restrictions on Connecting an OCD emulator.
Note: When transitioning from Sub-speed mode to a higher speed mode, it can only revert to the mode that was active
before entering Sub-speed mode.
Note 1. When the mode before entering Sub-speed mode was High-speed mode.
Example 2: From Middle-speed mode to High-speed mode
(Operation begins in Middle-speed mode)
1. Set the FLMWRP.FLMWEN bit to 1 (Rewriting the FLMODE register is enabled.).
2. Set the FLMODE.MODE[1:0] bits to 11b (High-speed mode).
3. Set the FLMWRP.FLMWEN bit to 0 (Rewriting the FLMODE register is disabled.).
4. Turn on any required oscillator in High-speed mode.
5. Set the frequency of each clock lower than or equal to the maximum operating frequency for High-speed mode.
High-speed mode
The maximum operating frequency during a flash read is 32 MHz for ICLK. The operating voltage range during a flash read
is 1.8 to 5.5 V. However, the maximum operating frequency during a flash read is 4 MHz when the operating voltage is 1.6
to 1.8 V.
During flash programming/erasure (P/E), the operating frequency range is 1 to 32 MHz and the operating voltage range is
1.8 to 5.5 V.
Figure 9.2 shows the operating voltages and frequencies in High-speed mode.
VCC[V] VCC[V]
5.5
5.5
1.8 1.8
1.6 1.6
Middle-speed mode
The power consumption of this mode is lower than that of High-speed mode under the same conditions.
The maximum operating frequency during a flash read is 24 MHz for ICLK. The operating voltage range during a flash read
is 1.6 to 5.5 V. However, the maximum operating frequency during a flash read is 4 MHz when the operating voltage is 1.6
to 1.8 V.
During flash programming/erasure (P/E), the operating frequency range is 1 to 24 MHz and the operating voltage range
is 1.6 to 5.5 V. However, the maximum operating frequency during flash programming/erasure (P/E) is 4 MHz when the
operating voltage is 1.6 to 1.8 V.
Figure 9.3 shows the operating voltages and frequencies in Middle-speed mode.
VCC[V] VCC[V]
5.5
5.5
Except P/E
P/E
1.8 1.8
1.6 1.6
Low-speed mode
The maximum operating frequency during a flash read is 2 MHz for ICLK. The operating voltage range during a flash read
is 1.6 to 5.5 V.
Figure 9.4 shows the operating voltages and frequencies in Low-speed mode.
VCC[V] VCC[V]
5.5 5.5
Except
P/E
1.8 1.8
P/E is prohibited
1.6 1.6
Subosc-speed mode
The maximum operating frequency during a flash read is 37.6832 kHz for ICLK. The operating voltage range during a flash
read is 1.6 to 5.5 V. P/E operations for flash memory are prohibited.
Using the oscillators other than the sub-clock oscillator or low-speed on-chip oscillator is prohibited.
Figure 9.5 shows the operating voltages and frequencies in Subosc-speed mode.
VCC[V] VCC[V]
5.5 5.5
Except
P/E
1.8 1.8 P/E is prohibited
1.6 1.6
4 16 24 48 ICLK[MHz] 4 16 24 48 ICLK[MHz]
0.
0.
0.
0.
0.
0.
02
02
03
03 8
03
03
78
78
76
76
27
27
52
52
83
83
6
68
8
2
2
Note: For details on proper setting of the interrupts, see section 11, Interrupt Controller Unit (ICU).
After exiting Software Standby mode, the oscillators that were operating before the transition restart. After the oscillator set
as the ICLK source clock has stabilized, the MCU returns from Software standby mode to normal mode. Oscillators that
are not set as the ICLK source should wait for stabilization before using them. See section 11.2.14. SBYEDCR0 : Software
Standby/Snooze End Control Register 0 and section 11.2.15. SBYEDCR1 : Software Standby/Snooze End Control Register
1 for information on how to wake up the MCU from Software Standby mode.
You can cancel Software Standby mode in any of the following ways:
1. Canceling by an interrupt
When an available interrupt request (see Table 9.3) is generated, an oscillator that operates before the transition to
Software Standby mode restarts. After all the oscillators are stabilized, the MCU returns to Normal mode from Software
Standby mode and starts the interrupt handling.
2. Canceling by a RES pin reset
When the RES pin is driven low, the MCU enters the reset state, and the oscillators whose default status is operating,
start the oscillation. Be sure to keep the RES pin low for the time period specified in section 31, Electrical
Characteristics. When the RES pin is driven high after the specified time period, the CPU starts the reset exception
handling.
3. Canceling by a power-on reset
Software Standby mode is canceled by a power-on reset and the MCU starts the reset exception handling.
4. Canceling by a voltage monitor reset
Software Standby mode is canceled by a voltage monitor reset from the voltage detection circuit and the MCU starts the
reset exception handling.
5. Canceling by IWDT reset
Software Standby mode is canceled by an internal reset generated by an IWDT underflow and the MCU starts the
reset exception handling. However, IWDT stops in Software Standby mode and an internal reset for canceling Software
Standby mode is not generated in the following condition:
● OFS0.IWDTSTRT = 0 and OFS0.IWDTSTPCTL = 1.
Oscillator
ICLK
IRQn pin
SBYCR.SSBY
Oscillation
WFI instruction stabilization
time
Clear the DTCST.DTCST bit to 0 before executing a WFI instruction except when using DTC in Snooze mode. If DTC is
required in Snooze mode, set the DTCST.DTCST bit to 1 before executing a WFI instruction.
Software
Normal mode Standby
*1 *2
Low power mode mode Snooze mode Normal mode
Oscillation
Oscillator Oscillates stopped Oscillates
for system clock
Figure 9.8 Canceling of Snooze mode when an interrupt request signal is generated
Snooze request
signal
Software
Normal Standby
*1
Low power mode mode*2 mode Snooze mode Software Standby mode
Oscillator Oscillation
Oscillates stopped Oscillates Oscillation stopped
for system clock
Figure 9.9 Canceling of Snooze mode when an interrupt request signal is not generated
No
DTC triggered?
Yes
Snooze mode
DTC run
No
Normal mode
[Conditions]
● During the time period from executing a WFI instruction to returning to Normal mode
(3) Do not write to registers listed in this section for the following condition:
[Registers]
● FLMODE
[Condition]
● ICLKSCR.CKSEL = 1 (ICLK = LOCO or SOSC).
● DFLCTL.DFLEN = 0 (Data flash is disabled)
(5) Write access to registers listed in this section is invalid when PRCR.PRC1 bit is 0:
[Registers]
● SBYCR, PSMCR, SYOCDCR.
9.9.7 Writing to the IWDT Registers by DTC in Sleep Mode or Snooze Mode
Do not write to the IWDT registers by the DTC while IWDT is stopped after entering Sleep mode or Snooze mode.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 PRC0 Enable writing to the registers related to the clock generation circuit R/W
0: Disable writes
1: Enable writes
1 PRC1 Enable writing to the registers related to the low power modes R/W
0: Disable writes
1: Enable writes
2 — This bit is read as 0. The write value should be 0. R/W
3 PRC3 Enable writing to the registers related to the LVD R/W
0: Disable writes
1: Enable writes
7:4 — These bits are read as 0. The write value should be 0. R/W
15:8 PRKEY[7:0] PRC Key Code W
These bits control the write access to the PRCR register. To modify the PRCR register, write
0xA5 to the upper 8 bits and the target value to the lower 8 bits as a 16-bit unit.
Low voltage detection 1*3 Voltage monitor 1 interrupt of the voltage monitor 1 circuit (LVD_LVD1)
Interrupt Controller
IRQ
MD DTCENSTn.STi
Wakeup signal
IRQ0
NVIC
Detection
IRQ5
Peripheral
modules
Interrupt request
Interrupt source
DTC
Bit position: 7 6 5 4 3 2 1 0
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The NMISR register monitors the status of non-maskable interrupt sources. Writes to the NMISR register are ignored. The
setting in the Non-Maskable Interrupt Enable Register (NMIER) does not affect the status flags in this register. Before the
end of the non-maskable interrupt handler, check that all of the bits in this register are set to 0 to confirm that no other NMI
requests are generated during handler processing.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit position: 7 6 5 4 3 2 1 0
NMIM
Bit field: — — — — — — —
D
Change the NMICR register settings before enabling NMI pin interrupts, that is, before setting NMIER.NMIEN to 1.
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit field: ST31 ST30 ST29 ST28 ST27 — — — ST23 ST22 — — ST19 ST18 — ST16
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit field: ST15 — ST13 ST12 — — — — ST7 ST6 ST5 ST4 ST3 ST2 ST1 —
STi bits (DTC Enable Status by Event Number i) (i = 1 to 7, 12 to 13, 15 to 16, 18 to 19, 22 to 23, 27 to 31)
The STi bit indicates whether the corresponding event is disabled or enabled as a DTC activation factor. This register is
read-only and is set by the DTCENSETn.SETi bit and cleared by the DTCENCLRn.CLRi bit.
After check the DTC transfer end (DTCENSTn.STi = 0), stop the DTC module by setting MSTPCRA.MSTPA22 or
DTCST.DTCST register.
[Setting condition]
● When 1 is written to the DTCENSETn.SETi bit.
[Clearing condition]
● When 1 is written to the DTCENCLRn.CLRi bit.
● When the specified number of transfers is complete. For chain transfers, when the specified number of transfers for the
last chain transfer is complete.
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit field: — — — — — — — — — — — — — — — —
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit field: — — — — — — ST41 ST40 — ST38 ST37 ST36 ST35 ST34 ST33 ST32
[Clearing condition]
● When 1 is written to the DTCENCLRn.CLRi bit.
● When the specified number of transfers is complete. For chain transfers, when the specified number of transfers for the
last chain transfer is complete.
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit field: SET31 SET30 SET29 SET28 SET27 — — — SET23 SET22 — — SET19 SET18 — SET16
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit field: SET15 — SET13 SET12 — — — — SET7 SET6 SET5 SET4 SET3 SET2 SET1 —
SETi bits (DTC Enable Set by Event Number i) (i = 1 to 7, 12 to 13, 15 to 16, 18 to 19, 22 to 23, 27 to 31)
By writing 1 to the SETi bit, the corresponding event is selected as the DTC activation source. Writing 0 has no effect. It
reads as 0.
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit field: — — — — — — — — — — — — — — — —
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit field: — — — — — — SET41 SET40 — SET38 SET37 SET36 SET35 SET34 SET33 SET32
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit field: CLR31 CLR30 CLR29 CLR28 CLR27 — — — CLR23 CLR22 — — CLR19 CLR18 — CLR16
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit field: CLR15 — CLR13 CLR12 — — — — CLR7 CLR6 CLR5 CLR4 CLR3 CLR2 CLR1 —
CLRi bits (DTC Enable Clear by Event Number i)(i = 1 to 7, 12 to 13, 15 to 16, 18 to 19, 22 to 23, 27 to 31)
Writing 1 to the CLRi bit disables DTC activation by the corresponding event. Writing 0 has no effect. It reads as 0.
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit field: — — — — — — — — — — — — — — — —
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit field: — — — — — — CLR41 CLR40 — CLR38 CLR37 CLR36 CLR35 CLR34 CLR33 CLR32
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit field: IF31 IF30 IF29 IF28 IF27 IF26 IF25 IF24 IF23 IF22 IF21 IF20 IF19 IF18 IF17 IF16
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit field: IF15 IF14 IF13 IF12 IF11 IF10 — — IF7 IF6 IF5 IF4 IF3 IF2 IF1 IF0
[Clearing condition]
● When the ICU notifies the interrupt request to the NVIC.
● When a DTC transfer that does not notify the CPU of an interrupt started.
– MRB.DISEL = 0 and Remaining transfer operations ≠ 0
● When a DTC transfer finished.
– MRB.DISEL = 0 and Remaining transfer operations = 0
– MRB.DISEL = 1
● When 1 is written to the DTCENSETn.SETi bit or DTCENCLRn.CLRi bit.
To clear the interrupt request flag, write 1 to the DTCENSETn.SETi bit or DTCENCLRn.CLRi bit.
By using the INTFLAG0 register and the DTCENST0 register, pending DTC requests can be confirmed. If the
DTCENST0.STi = 1, the INTFLAG0.IFi = 1 and the DTCSTS.VECN[7:0] ≠ i, the DTC request of the event i is pending.
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit field: — — — — — — — — — — — — — — — —
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit field: — — — — — — IF41 IF40 IF39 IF38 IF37 IF36 IF35 IF34 IF33 IF32
[Clearing condition]
● When the ICU notifies the interrupt request to the NVIC.
● When a DTC transfer that does not notify the CPU of an interrupt started.
– MRB.DISEL = 0 and Remaining transfer operations ≠ 0
● When a DTC transfer finished.
To clear the interrupt request flag, write 1 to the DTCENSETn.SETi bit or DTCENCLRn.CLRi bit.
By using the INTFLAG1 register and the DTCENST1 register, pending DTC requests can be confirmed. If the
DTCENST1.STi = 1, the INTFLAG1.IFi = 1 and the DTCSTS.VECN[7:0] ≠ i, the DTC request of the event i is pending.
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
UART UART
ADC1 IICA0E SPI00
Bit field: — — — 0RXE — — — — — 0ERR — — —
2ED D RXED
D ED
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
27 UART0RXED UART0 Reception Transfer End Interrupt Snooze Mode Returns Enable R/W
0: Snooze Mode returns by UART0 reception transfer end interrupt disabled
1: Snooze Mode returns by UART0 reception transfer end interrupt enabled
30:28 — These bits are read as 0. The write value should be 0. R/W
31 ADC12ED End of A/D Conversion Interrupt Snooze Mode Returns Enable R/W
0: Snooze Mode returns by End of A/D conversion interrupt disabled
1: Snooze Mode returns by End of A/D conversion interrupt enabled
The bits in this register control whether the associated interrupt can wake up the CPU from Software Standby/Snooze Mode.
DTCED bit (DTC Transfer Complete Interrupt Snooze Mode Returns Enable)
The DTCED bits enable the use of DTC transfer complete interrupts to cancel Snooze Mode.
SPI00RXED bit (SPI00 Transfer End or Buffer Empty Interrupt Snooze Mode Returns Enable)
The SPI00RXED bits enable the use of SPI00 transfer end or buffer empty interrupts to cancel Snooze Mode.
UART0ERRED bit (UART0 Reception Communication Error Occurrence Interrupt Snooze Mode Returns
Enable)
The UART0ERRED bits enable the use of UART0 reception communication error occurrence interrupts to cancel Snooze
Mode.
IICA0ED bit (IICA0 Address Match Interrupt Software Standby/Snooze Mode Returns Enable)
The IICA0ED bit enables the use of IICA0 interrupts to cancel Software Standby/Snooze Mode.
UART0RXED bit (UART0 Reception Transfer End Interrupt Snooze Mode Returns Enable)
The UART0RXED bits enable the use of UART0 reception transfer end interrupts to cancel Snooze Mode.
ADC12ED bit (End of A/D Conversion Interrupt Snooze Mode Returns Enable)
The ADC12ED bits enable the use of End of A/D conversion interrupts to cancel Snooze Mode.
Bit position: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
Bit field: — — — — — — — — — — — — — — — —
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The bits in this register control whether the associated interrupt can wake up the CPU from Software Standby/Snooze Mode.
ITLED bit (Interval Signal of 32-bit Interval Timer Interrupt Software Standby/Snooze Mode Returns
Enable)
The ITLED bit enables the use of Interval signal of 32-bit interval timer interrupts to cancel Software Standby/Snooze
Mode.
URE0ED bit (UARTA0 Reception Communication Error Interrupt Software Standby/Snooze Mode Returns
Enable)
The URE0ED bit enables the use of the UARTA0 reception communication error interrupts to cancel Software Standby/
Snooze Mode.
UT0ED bit (UARTA0 Transmission Transfer End or Buffer Empty Interrupt Software Standby/Snooze
Mode Returns Enable)
The UT0ED bit enables the use of UARTA0 transmission transfer end or buffer empty interrupts to cancel Software
Standby/Snooze Mode.
UR0ED bit (UARTA0 Reception Transfer End Interrupt Software Standby/Snooze Mode Returns Enable)
The UR0ED bit enables the use of UARTA0 reception transfer end interrupts to cancel Software Standby/Snooze Mode.
Interrupt request source Name of the source generating the interrupt request
Name Name of the interrupt
Connect to NVIC “ ✓” indicates the interrupt can be used as a CPU interrupt
Invoke DTC “ ✓” indicates the interrupt can be used to request DTC activation
Canceling Snooze mode “ ✓” indicates the interrupt can be used to request a return from Snooze mode
Canceling Software Standby mode “ ✓” indicates the interrupt can be used to request a return from Software Standby mode
0 IWDT IWDT_NMIUNDF ✓ — ✓ ✓
1 LVD LVD_LVD1 ✓ ✓ ✓ ✓
2 PORT PORT_IRQ0 ✓ ✓ ✓ ✓
3 PORT_IRQ1 ✓ ✓ ✓ ✓
4 PORT_IRQ2 ✓ ✓ ✓ ✓
5 PORT_IRQ3 ✓ ✓ ✓ ✓
6 PORT_IRQ4 ✓ ✓ ✓ ✓
7 PORT_IRQ5 ✓ ✓ ✓ ✓
8 Reserved — — — —
9 Reserved — — — —
10 DTC DTC_COMPLETE ✓ — ✓ —
11 FLASH FLASH_FRDYI ✓ — — —
12 SAU1 SAU1_UART_TXI2/ ✓ ✓ — —
SAU1_SPI_TXRXI20/
SAU1_IIC_TXRXI20
13 SAU1_UART_RXI2 ✓ ✓ — —
14 SAU1_UART_ERRI2 ✓ — — —
16 ELC_SWEVT1 ✓*1 ✓ — —
17 TRNG TRNG_RDREQ ✓ — — —
18 SAU0 SAU0_UART_TXI0/ ✓ ✓ ✓ —
SAU0_SPI_TXRXI00/
SAU0_IIC_TXRXI00
19 TAU0 TAU0_TMI00 ✓ ✓ — —
20 SAU0 SAU0_UART_ERRI0 ✓ — ✓ —
21 TAU0 TAU0_TMI01H ✓ — — —
22 SAU0 SAU0_UART_TXI1 ✓ ✓ — —
23 SAU0_UART_RXI1/ ✓ ✓ — —
SAU0_SPI_TXRXI11/
SAU0_IIC_TXRXI11
24 SAU0_UART_ERRI1 ✓ — — —
25 TAU0 TAU0_TMI03H ✓ — — —
26 IICA0 IICA0_TXRXI ✓ — ✓ ✓
27 SAU0 SAU0_UART_RXI0 ✓ ✓ ✓ —
28 TAU0 TAU0_TMI01 ✓ ✓ — —
29 TAU0_TMI02 ✓ ✓ — —
30 TAU0_TMI03 ✓ ✓ — —
31 ADC12 ADC12_ADI ✓ ✓ ✓ —
32 RTC RTC_ALM_OR_PRD ✓ ✓ ✓ ✓
33 TML32 TML32_ITL_OR ✓ ✓ ✓ ✓
34 TML32_ITL0 — ✓ — —
35 TAU0 TAU0_TMI04 ✓ ✓ — —
36 TAU0_TMI05 ✓ ✓ — —
37 TAU0_TMI06 ✓ ✓ — —
38 TAU0_TMI07 ✓ ✓ — —
39 UARTA0 UARTA0_ERRI ✓ — ✓ ✓
40 UARTA0_TXI ✓ ✓ ✓ ✓
41 UARTA0_RXI ✓ ✓ ✓ ✓
Note 1. Only interrupts after DTC transfer are supported.
Set the IRQCRi.IRQMD[1:0] bits to select the detection mode for the IRQi pins. For interrupt sources associated with
peripheral modules, see Table 11.3. Events must be accepted by the NVIC before an interrupt occurs and is accepted by the
CPU.
Set
Set
Reset
Reset
Interrupt Set-Enable Registers
(NVIC_ISER)
Automatically cleared by
Automatically cleared the interrupt completion
Table 11.6 shows operation when the DTC is the interrupt request destination.
Table 11.6 Operation when DTC becomes interrupt request destination
Remaining
Interrupt request transfer
destination DISEL*1 operations Operation per request Interrupt request destination after transfer
Non-maskable interrupts can only be used with the CPU, not to activate the DTC. Non-maskable interrupts take precedence
over all other interrupts. The non-maskable interrupt states can be verified in the Non-Maskable Interrupt Status Register
(NMISR). Confirm that all bits in the NMISR are 0 before returning from the NMI handler.
Non-maskable interrupts are disabled by default. To use non-maskable interrupts:
1. Set the NMIMD bit of NMICR register.
2. Write 1 to the NMICLR.NMICLR bit to clear the NMISR.NMIST flag to 0.
3. Enable the non-maskable interrupt by writing 1 to the associated bit in the Non-Maskable Interrupt Enable Register
(NMIER).
After 1 is written to the NMIER register, subsequent write access to the NMIEN bit in NMIER is ignored. An NMI cannot
be disabled when enabled, except by a reset.
non-maskable interrupt
● Use the NMIER register to enable the target interrupt request.
maskable interrupt
● Select the CPU as the interrupt request destination.
● Enable the interrupt in the NVIC.
Interrupt requests through the IRQn pins that do not satisfy these conditions are not detected while the clock is stopped in
Software Standby mode.
Note: In Snooze mode, a clock is supplied to the ICU. If an interrupt is detected, the CPU acknowledges the interrupt after
returning to Normal mode from Software Standby mode.
11.9 Reference
● ARM® Cortex®-M23 Processor Technical Reference Manual (ARM DDI 0550C)
12. Buses
12.1 Overview
Table 12.1 lists the bus specifications, Figure 12.1 shows the bus configuration, and Table 12.2 lists the addresses assigned
for each bus.
Table 12.1 Bus specifications
Bus type Description
CM23 DTC
System bus
DMA bus
The system bus is used for instruction and data accesses to the CPU.
Different master and slave transfer combinations can proceed simultaneously. In addition, requests for bus access from
masters other than the DTC are not accepted during reads of transfer control information for the DTC.
Flash/SRAM access
CPU instruction fetching Flash Flash Flash SRAM SRAM SRAM SRAM
instruction such as STREX instruction always gets a failed status. When an exclusive write operation is performed by the
CPU, the main bus always writes the data successfully.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
14:0 — These bits are read as 0. The write value should be 0. R/W
15 IERES Ignore Error Responses R/W
0: A bus error is reported.
1: A bus error is not reported.
Note: Changing reserved bits from the initial value of 0 is prohibited. Operation during the change is not guaranteed.
Bit position: 31 0
The value of the BUSnERRADD.BERAD[31:0] bits (n = 3, 4) is valid only when the BUSnERRSTAT.ERRSTAT flag (n =
3, 4) is set to 1.
Bit position: 7 6 5 4 3 2 1 0
ERRS ACCS
Bit field: — — — — — —
TAT TAT
section 12.4.3. Conditions for issuing illegal Address Access Errors lists the address ranges where access leads to illegal
address access errors. The reserved area in the slave does not trigger an illegal address access error.
Note: DTC does not receive bus errors. If the DTC accesses the bus, the transfer continues.
Note: E indicates the path where an illegal address access error occurs.
— indicates the path where an illegal address access error does not occur.
Note: The bus module detects an access error resulting from access to reserved area, for example if no area is assigned for the slave.
0x0200_0000 to 0x1FFF_FFFF: Access error detection.
0x0000_0000 to 0x01FF_FFFF: Memory bus 1 no access error detection.
12.5 References
1. ARM®v8-M Architecture Reference Manual (ARM DDI0553B.a)
2. ARM® Cortex®-M23 Processor User Guide (ARM DUI0963B)
3. ARM® AMBA® 5 AHB-Lite Protocol Specification (ARM IHI0033B.b)
Memory Memory
Non-secure data
Code flash
ending address defined
by FRPS bits
CPU
Non-maskable interrupt request
NVIC
interrupt request
DTC
Interrupt MRA
controller
MRB
Register CRA
Vector number
Activation
Activation request control
DTC response
Bus interface
DTCCR
DTC
Snooze control DTCVBR response
signals
DTCST control
DTC_
DTCEND DTCSTS
System ELC
Bit position: 7 6 5 4 3 2 1 0
1:0 — The read values are undefined. The write value should be 0. —
3:2 SM[1:0] Transfer Source Address Addressing Mode —
0 0: Address in the SAR register is fixed (write-back to SAR is skipped.)
0 1: Address in the SAR register is fixed (write-back to SAR is skipped.)
1 0: SAR value is incremented after data transfer:
+1 when SZ[1:0] = 00b
+2 when SZ[1:0] = 01b
+4 when SZ[1:0] = 10b
1 1: SAR value is decremented after data transfer:
-1 when SZ[1:0] = 00b
-2 when SZ[1:0] = 01b
-4 when SZ[1:0] = 10b
5:4 SZ[1:0] DTC Data Transfer Size —
0 0: Byte (8-bit) transfer
0 1: Halfword (16-bit) transfer
1 0: Word (32-bit) transfer
1 1: Setting prohibited
7:6 MD[1:0] DTC Transfer Mode Select —
0 0: Normal transfer mode
0 1: Repeat transfer mode
1 0: Block transfer mode
1 1: Setting prohibited
The MRA register cannot be accessed directly from the CPU. However, the CPU can access the SRAM area (transfer
information (n) start address + 0x03) and DTC transfers it automatically to and from the MRA register. See section 14.3.1.
Allocating Transfer Information and DTC Vector Table.
Bit position: 7 6 5 4 3 2 1 0
1:0 — The read values are undefined. The write value should be 0. —
3:2 DM[1:0] Transfer Destination Address Addressing Mode —
0 0: Address in the DAR register is fixed (write-back to DAR is skipped)
0 1: Address in the DAR register is fixed (write-back to DAR is skipped)
1 0: DAR value is incremented after data transfer:
+1 when MRA.SZ[1:0] = 00b
+2 when SZ[1:0] = 01b
+4 when SZ[1:0] = 10b
1 1: DAR value is decremented after data transfer:
-1 when MRA.SZ[1:0] = 00b
-2 when SZ[1:0] = 01b
-4 when SZ[1:0] = 10b
4 DTS DTC Transfer Mode Select —
0: Select transfer destination as repeat or block area.
1: Select transfer source as repeat or block area.
5 DISEL DTC Interrupt Select —
0: Generate an interrupt request to the CPU when specified data transfer is
complete.
1: Generate an interrupt request to the CPU each time DTC data transfer is
performed.
The MRB register cannot be accessed directly from the CPU. However, the CPU can access the SRAM area (transfer
information (n) start address + 0x02) and DTC transfers it automatically to and from the MRB register. See section 14.3.1.
Allocating Transfer Information and DTC Vector Table.
Bit position: 31 0
Bit field:
The SAR sets the transfer source start address and cannot be accessed directly from the CPU. However, the CPU can access
the SRAM area (transfer information (n) start address + 0x04) and DTC transfers it automatically to and from the SAR
register. See section 14.3.1. Allocating Transfer Information and DTC Vector Table.
Misalignment is prohibited for DTC transfers. Bit[0] must be 0 when MRA.SZ[1:0] = 01b, and bit[1] and bit[0] must be 0
when MRA.SZ[1:0] = 10b.
Bit position: 31 0
Bit field:
The DAR sets the transfer destination start address and cannot be accessed directly from the CPU. However, the CPU can
access the SRAM area (transfer information (n) start address + 0x08) and DTC transfers it automatically to and from the
DAR register. See section 14.3.1. Allocating Transfer Information and DTC Vector Table.
Misalignment is prohibited for DTC transfers. Bit[0] must be 0 when MRA.SZ[1:0] = 01b, and bit[1] and bit[0] must be 0
when MRA.SZ[1:0] = 10b.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit field:
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit field:
The CRB sets the block transfer count for block transfer mode. The transfer count is 1, 65535, and 65536 when the set value
is 0x0001, 0xFFFF, and 0x0000, respectively. The CRB value is decremented (-1) when the final data of a single block size
is transferred. When normal transfer mode or repeat transfer mode is selected, this register is not used, and the set value is
ignored.
The CRB cannot be accessed directly from the CPU. However, the CPU can access the SRAM area (transfer information
(n) start address + 0x0C) and DTC transfers it automatically to and from the CRB register. See section 14.3.1. Allocating
Transfer Information and DTC Vector Table.
Bit position: 7 6 5 4 3 2 1 0
2:0 — These bits are read as 0. The write value should be 0. R/W
3 — This bit is read as 1. The write value should be 1. R/W
4 RRS DTC Transfer Information Read Skip Enable R/W
0: Transfer information read is not skipped
1: Transfer information read is skipped when vector numbers match
7:5 — These bits are read as 0. The write value should be 0. R/W
Bit position: 31 0
Bit field:
The DTCVBR sets the base address for calculating the DTC vector table address, which can be set in the range of
0x0000_0000 to 0xFFFF_FFFF (4 GB) in 1-KB units.
Bit position: 7 6 5 4 3 2 1 0
DTCS
Bit field: — — — — — — —
T
For details on these transitions, see section 14.9. Low Power Consumption Function and section 9, Low Power Modes.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
[Clearing condition]
● When transfer by the DTC, in response to a transfer request, is complete.
:
:
:
+4(n - 1)
:
Transfer information (n) :
start address :
4 bytes
4 bytes
Lower address
Start address 3 2 1 0
CRA CRB
Chain
transfer
MRA MRB Reserved (0)
CRA CRB
4 bytes
14.4 Operation
The DTC transfers data according to the transfer information. Storage of the transfer information in the SRAM area is
required before a DTC operation. When the DTC is activated, it reads the DTC vector associated with the vector number.
The DTC reads the transfer information from the transfer information store address referenced by the DTC vector and
transfers the data. After the data transfer, the DTC writes back the transfer information. Storing the transfer information in
the SRAM area allows data transfer of any number of channels.
The transfer modes include:
● Normal transfer mode
● Repeat transfer mode
● Block transfer mode.
The DTC specifies a transfer source address in the SAR register and a transfer destination address in the DAR register. The
values of these registers are incremented, decremented, or address-fixed independently after the data transfer.
Table 14.2 lists the DTC transfer modes.
Table 14.2 DTC transfer modes
Data size transferred on single transfer Increment or decrement of Settable transfer
Transfer mode request memory address count
Normal transfer mode 1 byte (8 bit), 1 halfword (16 bit), 1 word (32 bit) Incremented or decremented by 1, 1 to 65536
2, or 4 or address-fixed
Repeat transfer mode*1 1 byte (8 bit), 1 halfword (16 bit), 1 word (32 bit) Incremented or decremented by 1, 1 to 256*3
2, or 4 or address-fixed
Block transfer mode*2 Block size specified in CRAH (1 to 256 bytes, 1 Incremented or decremented by 1, 1 to 65536
to 256 halfwords (2 to 512 bytes), or 1 to 256 2, or 4 or address-fixed
words (4 to 1024 bytes))
Note 1. Set the transfer source or transfer destination as the repeat area.
Note 2. Set the transfer source or transfer destination as the block area.
Note 3. After a data transfer of the specified count, the initial state is restored and operation restarts.
Setting the MRB.CHNE bit to 1 allows multiple transfers or chain transfer on a single activation source. It also enables a
chain transfer when the specified data transfer is complete.
Figure 14.4 shows the operation flow of the DTC. Table 14.3 lists the chain transfer conditions. The combination of control
information for the second and subsequent transfers are omitted in this table.
Start
Match and
DTCCR.RRS = 1 Compare vector
numbers. Match?
Mismatch or DTCCR.RRS = 0
Read DTC vector
Next transfer
Read transfer
information
Update transfer
information start address
Yes
MRB.CHNE = 1
No Yes
MRB.CHNS = 0
No
No
Yes Yes
Last data transfer Last data transfer
(transfer counter = 1)*1 (transfer counter = 1)*1
No No
Yes
MRB.DISEL = 1
No
Write transfer information Write transfer information Write transfer information Write transfer information
End
Table 14.4 Transfer information write-back skip conditions and applicable registers
MRA.SM[1:0] bits MRB.DM[1:0] bits
b3 b2 b3 b2 SAR register DAR register
0 0 0 0 Skip Skip
0 0 0 1
0 1 0 0
0 1 0 1
0 0 1 0 Skip Write-back
0 0 1 1
0 1 1 0
0 1 1 1
1 0 0 0 Write-back Skip
1 0 0 1
1 1 0 0
1 1 0 1
1 0 1 0 Write-back Write-back
1 0 1 1
1 1 1 0
1 1 1 1
Transfer 6
SAR times Data 1 DAR
Data 1
(transfer 1 data
Data 2 unit per event) Data 2
Data 3 Data 3
Data 4 Data 4
Data 5 Data 5
Data 6 Data 6
Figure 14.5 Memory map of normal transfer mode (MRA.SM[1:0] = 10b, MRB.DM[1:0] = 10b, CRA = 0x0006)
SAR Transfer source Increment, decrement, fixed*1 ● When the MRB.DTS bit is 0
address Increment, decrement, or fixed*1
● When the MRB.DTS bit is 1
SAR register initial value
DAR Transfer destination Increment, decrement, or fixed*1 ● When the MRB.DTS bit is 0
address DAR register initial value
● When the MRB.DTS bit is 1
Increment, decrement, or fixed*1
CRAH Retains transfer CRAH CRAH
counter
CRAL Transfer counter A CRAL - 1 CRAH
CRB Transfer counter B Not updated Not updated
Note 1. Write-back is skipped in address-fixed mode.
Transfer 8
SAR Data 1 times Data 1 DAR
(transfer 1 data
Data 2 unit per event) Data 2
Data 3 Data 3
Data 4 Data 4
Data 1
Data 2
Data 3
Data 4
Figure 14.6 Memory map of repeat transfer mode when transfer source is a repeat area (MRA.SM[1:0] =
10b, MRB.DM[1:0] = 10b, CRAH = 0x04)
SAR
First block
Transfer
nth block
Data area
Transfer information
DTC vector table allocated in the SRAM
System clock
ICU.INTFLAGn.IFi
DTC access R W
Figure 14.9 Example 1 of DTC operation timing in normal transfer and repeat transfer modes
System clock
ICU.INTFLAGn.IFi
DTC access
Figure 14.10 Example 2 of DTC operation timing in block transfer mode when the block size = 4
System clock
ICU.INTFLAGn.IFi
DTC access R W R W
System clock
(1) (2)
ICU.INTFLAGn.IFi
DTC access R W RR W
Note: When activation sources (vector numbers) of (1) and (2) are the same and the RRS = 1, the transfer information read for
request (2) is skipped.
Figure 14.12 Example of operation when a transfer information read is skipped with the vector, transfer
information, and transfer destination data on the SRAM, and the transfer source data on the
peripheral module
Block*5 P × Cr P × Cw
1 Set the DTCCR.RRS bit to 0 Set the DTCCR.RRS bit to 0 to reset the transfer information read skip flag. After
that, the transfer information read is not skipped while the DTC is activated. Be sure
to specify this setting when the transfer information is updated.
2 Set transfer information (MRA, MRB, SAR, Allocate transfer information (MRA, MRB, SAR, DAR, CRA, and CRB) in the data
DAR, CRA, and CRB) area. To set transfer information, see section 14.2. Register Descriptions. To allocate
transfer information, see section 14.3.1. Allocating Transfer Information and DTC
Vector Table.
3 Set transfer information start addresses in Set the transfer information start addresses in the DTC vector table. To set the DTC
the DTC vector table vector table, see section 14.3.1. Allocating Transfer Information and DTC Vector
Table.
4 Set the DTCCR.RRS bit to 1 Set the DTCCR.RRS bit to 1 to enable skipping of the second and subsequent
transfer information read cycles for continuous DTC activation from the same
interrupt source. The RRS bit can be set to 1, but if this is set during DTC transfer, it
becomes valid from the next transfer.
5 Set the ICU.DTCENSTx.STy bit to 1. Set the ICU.DTCENSTx.STy bit to 1. The interrupt must be enabled in the NVIC.
The interrupt should be enabled in the NVIC.
6 Set the enable bit for an activation source Set the enable bit for the activation source interrupts to 1. When a source interrupt
interrupt is generated, the DTC is activated. To set the interrupt source enable bit, see the
settings for the modules that are to be the activation sources.
7 Set the DTCST.DTCST bit to 1 Set the DTC Module Start bit (DTCST.DTCST) to 1.
Note: The DTCST.DTCST bit can be set even if the setting for each activation source is not completed.
5. Set the DAR register to the address of the data table in the SRAM area where to store the A/D conversion result.
6. Set the CRA registers to the size of the data table. The CRB register can be set to any value.
Source(1)
Input circuit (Fixed)
(1)
Transfer information allocated in Normal (0x8000)
the on-chip memory space Transfer Destination(1) ⋮
Input buffer (0x81FF)
(0x8200)
⋮
(0x83FF)
First data transfer
Transfer Information (TI)
upper 8bits Destination(3)
of DAR
CRA = 0x0200 Destination(2)
Chain transfer
(counter = 0)
Second data transfer TI (2) Repeat Transfer
CRA
Source(2)
for first TI
0x0200 (Fixed)
CRA = 0x0101
Chain transfer
(continuous)
Third data transfer TI (3) Repeat Transfer
CRA = 0x0202
14.7 Interrupt
DTC transfer ends. While the MSTPCRA.MSTPA22 bit is 1, accessing the DTC registers is prohibited. Writing 0 to the
MSTPCRA.MSTPA22 bit releases the DTC from the module-stop state.
Note: When a transfer end interrupt from the CSI in SNOOZE mode is being used as the DTC activation source, use the
transfer end interrupt to release the chip from the SNOOZE mode and start processing by the CPU after completion
of DTC transfer, or use a chain transfer to make the settings for reception by the CSI (writing 1 to the ST[0] bit,
writing 0 to the SWC bit, setting the SSC0 register, and writing 1 to the SS[0] bit) again.
Note: When a transfer end interrupt from the UART in SNOOZE mode is being used as the DTC activation source, use the
transfer end interrupt to release the chip from the SNOOZE mode and start processing by the CPU after completion
of DTC transfer, or use a chain transfer to make the settings for reception by the UART (writing 1 to the ST[1] bit,
writing 0 to the SWC bit, setting the SSC0 register, and writing 1 to the SS[1] bit) again.
Note: When an A/D conversion end interrupt from the A/D converter in SNOOZE mode is being used as the DTC
activation source, use the A/D conversion end interrupt to release the chip from the SNOOZE mode and start
processing by the CPU after completion of DTC transfer, or use a chain transfer to make the settings for the
SNOOZE mode function of the A/D converter (writing 1 to the AWC bit after having written 0 to it) again.
Event link function 26 types of event signals can be directly connected to modules. The ELC generates the
ELC event signal, and events that activate the DTC.
Module-stop function Module-stop state can be set.
ELC
PORT_IRQn
TAU0
(n = 0 to 5)
DTC ADC12
LVD
PORT1/2
Bit position: 7 6 5 4 3 2 1 0
ELCO
Bit field: — — — — — — —
N
6:0 — These bits are read as 0. The write value should be 0. R/W
7 ELCON All Event Link Enable R/W
0: All the event link operations are disabled.
1: All the event link operations are enabled.
Bit position: 7 6 5 4 3 2 1 0
[Clearing condition]
● If writing the WE bit to 0 with writing the WI bit to 0, the WE bit becomes 0.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The ELSRn register specifies an event signal to be linked to each peripheral module. Table 15.2 shows the association
between the ELSRn register and the peripheral modules. Table 15.3 shows the association between the event signal names
and the event numbers set in the ELSRn register.
Table 15.2 Association between the ELSRn registers and peripheral functions
Register name Peripheral function (module) Event name
Table 15.3 Association between event signal names set in ELSRn.ELS[5:0] bits and signal numbers (1 of 2)
Event number Interrupt request source Name Description
Table 15.3 Association between event signal names set in ELSRn.ELS[5:0] bits and signal numbers (2 of 2)
Event number Interrupt request source Name Description
15.3 Operation
Delay time
Module A Module B
ELC
ADC12 ELC_AD 4 or 5 cycles of ICLK after an event input to ELC, the hardware trigger is detected in ADC12.
TAU0 ELC_TAU00 4 or 5 cycles of ICLK after an event input to ELC, the edge is detected in TAU0 channel 0.*1
TAU0 ELC_TAU01 4 or 5 cycles of ICLK after an event input to ELC, the edge is detected in TAU0 channel 1.*1
PORT1 ELC_PORT1 3 or 4 cycles of ICLK after an event input to ELC, the output of PORT1 changes.
PORT2 ELC_PORT2 3 or 4 cycles of ICLK after an event input to ELC, the output of PORT2 changes.
TML32 ELC_ITLC There is no delay for event link to the 32-bit interval timer.
Note 1. This is the case of rising edge detection. Falling edge is detected in the following cycle of rising edge detection.
ADC12 ELC_AD Available Not available Using ELC event as hardware trigger of ADC12 in snooze
mode is prohibited
TAU0 ELC_TAU00 Available Not available Using TAU in snooze mode is prohibited
TAU0 ELC_TAU01 Available Not available Using TAU in snooze mode is prohibited
PORT1 ELC_PORT1 Available Not available Available if either ADC12, DTC or SAU is working in
snooze mode
PORT2 ELC_PORT2 Available Not available Available if either ADC12, DTC or SAU is working in
snooze mode
TML32 ELC_ITLC Available Available Available
PCR
PIM
Peripheral output P108,P300 only
enable 001b
(only SWD)
PDR other
ISEL
Interrupt
CMOS
Peripheral input
PIDR
TTL
EOSR
other
POSR
PODR 000b
PORR
EORR
ELC
PSEL[2:0]
NCODR
PMC
ISEL
Analog
input
Note: This figure shows a basic port configuration. The configuration differs depending on the ports.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PODR PODR PODR PODR PODR PODR PODR PODR PODR PODR PODR PODR PODR PODR PODR PODR
Bit field:
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
The Pmn Output Data Register (PODRm) is a 16-bit read/write register and is accessed in 16-bit units.
Note: When the RES pin (OFS1.PORTSELB = 1) is selected, the PODR2.PODR06 bit (P206) is always read as 0.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PDR1 PDR1 PDR1 PDR1 PDR1 PDR0 PDR0 PDR0 PDR0 PDR0 PDR0 PDR0 PDR0 PDR0 PDR0
Bit field: PDR11
5 4 3 2 0 9 8 7 6 5 4 3 2 1 0
The Pmn Direction Register (PDRm) is a 16-bit read/write register and is accessed in 16-bit units.
Note: When the RES pin (OFS1.PORTSELB = 1) is selected, the PODR2.PODR06 bit (P206) is always read as 0.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PIDR1 PIDR1 PIDR1 PIDR1 PIDR1 PIDR1 PIDR0 PIDR0 PIDR0 PIDR0 PIDR0 PIDR0 PIDR0 PIDR0 PIDR0 PIDR0
Bit field:
5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
The Pmn State Register (PIDRm) is a 16-bit write register and is accessed in 16-bit units.
Note: When the RES pin (OFS1.PORTSELB = 1) is selected, the PIDR2.PIDR06 bit (P206) is always read as 1.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PORR PORR PORR PORR PORR PORR PORR PORR PORR PORR PORR PORR PORR PORR PORR PORR
Bit field:
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
The Pmn Output Reset Register (PORRm) is a 16-bit write register and is accessed in 16-bit units.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
POSR POSR POSR POSR POSR POSR POSR POSR POSR POSR POSR POSR POSR POSR POSR POSR
Bit field:
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
The Pmn Output Set Register (POSRm) is a 16-bit write register and is accessed in 16-bit units.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
EORR EORR EORR EORR EORR EORR EORR EORR EORR EORR EORR EORR EORR EORR EORR EORR
Bit field:
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
The Pmn Event Output Reset Register (EORRm) is a 16-bit write register and is accessed in 16-bit units.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
EOSR EOSR EOSR EOSR EOSR EOSR EOSR EOSR EOSR EOSR EOSR EOSR EOSR EOSR EOSR EOSR
Bit field:
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
The Pmn Event Output Register (EOSRm) is a 16-bit write register and is accessed in 16-bit units.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
NCOD
Bit field: PMC ISEL — — — PSEL[2:0] — PIM PCR — PDR PIDR PODR
R
PODR bit (Pmn Output Data), PIDR bit (Pmn State), PDR bit (Pmn Direction)
The PDR, PIDR, and PODR bits serve the same function as the PDRm, PIDRm, PODRm. When these bits are read, the
PDRm, PIDRm, PODRm value is read.
Note: PCR can be selected when P206 (OFS1.PORTSELB = 0) is selected. When the RES pin (OFS1.PORTSELB = 1) is
selected, the input pull-up resistor is enable.
In addition, the PMC bit is used to prevent through-current flowing into input buffers.
When N-ch open drain output is selected for serial communications with an external device operating at a different voltage
or an input port is not used, low power consumption can be achieved by setting the corresponding PMC bit to 1.
Bits associated with non-existent pins are reserved. Reserved bits are read as 0. The write value should be 0.
P206, P214 and P215 do not have PMC bit. so The PMC bits in these Port Pin Function register are reserved.
Note: For P214 and P215, low power consumption can be achieved by setting the MOSEL[1:0] = 01b in the clock
operation mode control register (CMC) and setting the SOSTP = 1 in the sub-clock oscillator control register
(SOSCCR).
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit position: 7 6 5 4 3 2 1 0
PFSW
Bit field: B0WI — — — — — —
E
5:0 — These bits are read as 0. The write value should be 0. R/W
6 PFSWE PmnPFS_A Register Write Enable R/W
0: Writing to the PmnPFS_A register is disable
1: Writing to the PmnPFS_A register is enable
7 B0WI PFSWE Bit Write Disable R/W
0: Writing to the PFSWE bit is enabled
1: Writing to the PFSWE bit is disabled
16.3 Operation
● Pmn Input Data bit (PIDRn), which indicates the pin states
● Pmn Output Set bit (POSRn), which indicates the output value when a software write occurs
● Pmn Output Reset bit (PORRn), which indicates the output value when a software write occurs
● Event Output Set bit (EOSRn), which indicates the output value when an ELC_PORT1 or 2 signal occurs
● Event Output Reset bit (EORRn), which indicates the output value when an ELC_PORT1 or 2 signal occurs.
Each pin is associated with a Port mn Pin Function Select register (PmnPFS_A), which includes the associated PODR,
PIDR, and PDR bits. In addition, the PmnPFS_A register includes the following:
● PCR: Pull-up resistor control bit that turns the input pull-up MOS on or off
● NCODR: N-channel open-drain control bit that selects the output type for each pin
● PIM: Pin input buffer selection bit to specify an normal input or TTL input buffer
● ISEL: IRQ input enable bit to specify an IRQ input pin
● PMC: Pin mode control bit to specify an analog pin and prevent through-current flowing into input buffers
● PSEL[2:0]: Port function select bits to select the associated peripheral function.
These configurations can be made by a single-register access to the Port mn Pin Function Select register. For details, see
section 16.2.8. PmnPFS_A : Port mn Pin Function Select Register (m = 1 to 4, n = 00 to 15), section 16.2.9. P0nPFS_A :
Port 0n Pin Function Select Register (n = 08 to 15), and section 16.2.10. P9nPFS_A : Port 9n Pin Function Select Register
(n = 13 to 14).
EOSR
ELC
PODR PAD
EORR
en
ELC_PORTn
Note: When linking the PORT with events, do not turn off ELC setting or rewrite PODR register with CPU while ELC event
is being transferred.
Note: A glitch may occur when ELC.ELSR changes the setting to disable event output after setting the link.
P206/RES PORTSELB = 0:
● If the direction setting is for input (PDR2.PDR06 = 0), connect the associated pin to VCC (pulled up)
through a resistor or to VSS (pulled down) through a resistor.
● If the direction setting is for output (PDR2.PDR06 = 1), leave the pin.
PORTSELB = 1:
Leave open, or connect to VCC.
P200/NMI Set in Pin Mode Control bit (PmnPFS_A.PMC) to 1, and release the pin.
Alternatively, connect the associated pin to VCC (pulled up) through a resistor or to VSS (pulled down) through
a resistor.
P212/X1 When the main clock oscillator is not used, set the MOSCCR.MOSTP bit to 1 (general port P212). When this
pin is not used as port P212, configure it in the same way as ports 0 to 4. When the external clock is input to
the EXCLK pin, leave this pin open.
P213/X2/EXCLK When the main clock oscillator is not used, set the MOSCCR.MOSTP bit to 1 (general port P213). When this
pin is not used as port P213,it is configured in the same way as ports 0 to 4.
P215/XCIN When the sub-clock oscillator is not used, set the SOSCCR.SOSTP bit to 1 (general port P215). When this pin
is not used as port P215, configure it in the same way as ports 0 to 4.
P214/XCOUT When the sub-clock oscillator is not used, set the SOSCCR.SOSTP bit to 1 (general port P214). When this pin
is not used as port P214, configure it in the same way as ports 0 to 4.
P0x to P4x ● If the direction setting is for input (PDRm.PDRn = 0), connect the associated pin to VCC (pulled up)
through a resistor or to VSS (pulled down) through a resistor*1,*2
● If the direction setting is for output (PDRm.PDRn = 1), release the pin*1
P913, P914 ● If the direction setting is for input (PDR9.PDRn = 0), connect the associated pin to VCC (pulled up)
through a resistor or to VSS (pulled down) through a resistor.
● If the direction setting is for output (PDR9.PDRn = 1), set the port's output latch to 0 and leave the pins
open-circuit, or set the port's output latch to 1 and independently connect the pins to VCC or VSS via
resistors.
Note 1. Clear the PmnPFS_A.PSEL[2:0], PmnPFS_A.ISEL, PmnPFS_A.PCR, and PmnPFS_A.PMC bits to 0.
Note 2. P108, P206, and P300 should be enabled for input pull-up from the initial value (PmnPFS_A.PCR = 1).
Numbers in this list correspond to the priority for writing to the PODRn. For example, if 1. and 3. from the list occur at the
same time, the higher priority event 1. is executed.
Table 16.5 Examples of register settings for port and alternate functions (1/6)
Function Used
Pin Name Function Name I/O PSEL[2:0] ISEL PMC PDR PODR
Table 16.6 Examples of register settings for port and alternate functions (2/6) (1 of 3)
Function Used
Pin Name Function Name I/O PSEL[2:0] ISEL NCODR PMC PDR PODR
Table 16.6 Examples of register settings for port and alternate functions (2/6) (2 of 3)
Function Used
Pin Name Function Name I/O PSEL[2:0] ISEL NCODR PMC PDR PODR
Table 16.6 Examples of register settings for port and alternate functions (2/6) (3 of 3)
Function Used
Pin Name Function Name I/O PSEL[2:0] ISEL NCODR PMC PDR PODR
Table 16.7 Examples of register settings for port and alternate functions (3/6)
Function Used
Pin Name Function Name I/O PORTSELB PDR PODR
Table 16.8 Examples of register settings for port and alternate functions (4/6) (1 of 2)
Function Used
Pin Name Function Name I/O PSEL[2:0] ISEL NCODR PMC PDR PODR
Table 16.8 Examples of register settings for port and alternate functions (4/6) (2 of 2)
Function Used
Pin Name Function Name I/O PSEL[2:0] ISEL NCODR PMC PDR PODR
Table 16.9 Examples of register settings for port and alternate functions (5/6) (1 of 2)
Function Used CMC
Pin Function
Name Name I/O SOSEL MOSEL[1:0] XTSEL PSEL[2:0] ISEL NCODR PMC PDR PODR
Table 16.9 Examples of register settings for port and alternate functions (5/6) (2 of 2)
Function Used CMC
Pin Function
Name Name I/O SOSEL MOSEL[1:0] XTSEL PSEL[2:0] ISEL NCODR PMC PDR PODR
Table 16.10 Examples of register settings for port and alternate functions (6/6)
Function Used
Pin Name Function Name I/O PSEL[2:0] ISEL NCODR PMC PDR PODR
16.5.6 Notes on Communications with Devices Operating at a Different Voltage (1.8 V, 2.5
V, or 3 V) by Switching I/O Buffers
The pin input buffer selection bits (PIM) and the N-Channel Open-Drain Control bits (NCODR) can be used to switch the
I/O buffers to enable communications with external devices that have different operating voltages (1.8 V, 2.5 V, or 3 V) to
this device.
(1) Procedure for setting input pins of UART0 to UART2, UARTA0, SPI00, SPI01, and SPI20 for use
with the TTL input buffers
1. Pull up the input pin to be used to the voltage of the target device via an external resistor. The on-chip pull-up resistor
cannot be used for this purpose.
2. Set the PIM bit to 1 to switch to the TTL input buffer. For VIH and VIL, refer to the DC characteristics when the TTL
input buffer is selected.
3. Enable the operation of the serial array unit and set the mode to the UART/simplified SPI mode.
(2) Procedure for setting output pins of UART0 to UART2, UARTA0, SPI00, SPI01, and SPI20 for
use with the N-ch open-drain output mode
1. Pull up the input pin to be used to the voltage of the target device via an external resistor. The on-chip pull-up resistor
cannot be used for this purpose.
2. The port pins are set for input (Hi-Z) after the reset state is released.
3. Set the PMC bits to 1 to disable input to the input buffer.
4. Set the NCODR bits to 1 to set the N-ch open drain output (withstand voltage of VCC) mode.
5. Enable the operation of the serial array unit and set the mode to the UART/simplified SPI mode.
6. Set the PDR bits to the output mode. At this time, the output data is high level, so the pin is in the Hi-Z state.
(3) Procedure for setting I/O pins of IIC00, IIC01, and IIC20 for use in connection with a device
operating at a different voltage (1.8 V, 2.5 V, or 3 V)
1. Pull up the input pin to be used to the voltage of the target device via an external resistor. The on-chip pull-up resistor
cannot be used for this purpose.
2. The port pins are set for input (Hi-Z) after the reset state is released.
3. Set the NCODR bits to 1 to set the N-ch open drain output (withstand voltage of VCC) mode.
4. Set the PIM bit to 1 to switch to the TTL input buffer. For VIH and VIL, refer to the DC characteristics when the TTL
input buffer is selected.
5. Enable the operation of the serial array unit and set the mode to the simplified I2C mode.
6. Set the PDR bits to the output mode (data I/O is possible in the output mode). At this time, the output data is high level,
so the pin is in the Hi-Z state.
Note: The input buffer is enabled even if the pin is operating as an output when the N-ch open-drain output mode
is selected by the corresponding bit in the N-channel open-drain control bit (NCODR). This may lead to a
through current flowing through the pin when the voltage level on this pin is intermediate. However, setting the
corresponding bit of the given PMC bit to 1 prevents the flow of a through current.
Note: When the pin is set to TTL input buffer by the port input buffer selection bit (PIMx) and is driven high, a through
current may flow through the pin due to the configuration of the TTL input buffer. Drive the pin low to prevent the
through current.
Note: Communications by using P212 and P213 with devices operating at different voltage levels are not possible since
P212PFS_A and P213PFS_A registers do not have PIM bit.
Note: The input buffer is enabled even if the P913, P914 pin is operating as an output. This may lead to a through current
flowing through the pin when the voltage level on this pin is intermediate. However, setting the corresponding bit of
the given PMC bit to 1 prevents the flow of a through current.
Table 16.11 Register settings for the pin function select configuration (PORT0)
Pin
PSEL[2:0]
settings P008 P009 P010 P011 P012 P013 P014 P015
PMC bit ✓ (AN002) ✓ (AN003) ✓ (AN000/ ✓ (AN001/ ✓ (AN004) ✓ (AN005) ✓ (AN006) ✓ (AN007)
VREFH0) VREFL0)
NCODR bit — — — — — — — —
PIM bit — — — — — — — —
PCR bit — — — — — — — —
32-pin product ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
24-pin product — — ✓ ✓ ✓ ✓ ✓ ✓
20-pin product — — ✓ ✓ ✓ ✓ — —
16-pin product — — ✓ ✓ ✓ — — —
✓: Available
—: Setting prohibited
Table 16.12 Register settings for the pin function select configuration (PORT1)
Pin
PSEL[2:0]
settings P100 P101 P102 P103 P108 P109 P110 P112
000b P1n Output Data (initial) P1n Output Data P1n Output Data (initial)
001b TI04_A/TO04_A TI07_A/TO07_A TI06_A/TO06_A TI05_A/TO05_A SWDIO (initial) TI02_A/TO02_A TI01_A/TO01_A TI03_A/TO03_A
010b TI01_B/TO01_B TI00_C TO00_C SSI00_A TI03_B/TO03_B TXD2_A/ SO20_A RXD2_A/SI20_A/ SCK20_A/
SDA20_A SCL20_A
NCODR bit ✓ ✓ ✓ ✓ — ✓ ✓ ✓
PIM bit ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
PCR bit ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
32-pin product ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
24-pin product ✓ ✓ ✓ — ✓ ✓ ✓ ✓
20-pin product ✓ ✓ ✓ — ✓ ✓ ✓ ✓
16-pin product ✓ ✓ ✓ — ✓ — — —
✓: Available
—: Setting prohibited
Table 16.13 Register settings for the pin function select configuration (PORT2) (1 of 2)
Pin
PSEL[2:0]
settings P200 P201 P206 P207 P208 P212 P213 P214 P215
PMC bit ✓ ✓ — ✓ ✓ ✓ ✓ — —
NCODR bit — ✓ — ✓ ✓ ✓ ✓ — —
PIM bit — ✓ — ✓ ✓ — — — —
PCR bit — ✓ ✓ ✓ ✓ ✓ ✓ — —
Table 16.13 Register settings for the pin function select configuration (PORT2) (2 of 2)
Pin
PSEL[2:0]
settings P200 P201 P206 P207 P208 P212 P213 P214 P215
32-pin product ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓
24-pin product ✓ ✓ ✓ — — ✓ ✓ — —
20-pin product ✓ ✓ ✓ — — ✓ ✓ — —
16-pin product ✓ ✓ ✓ — — ✓ ✓ — —
✓: Available
—: Setting prohibited
Table 16.14 Register settings for the pin function select configuration (PORT3)
Pin
010b TI04_B/TO04_B
PMC bit ✓
ISEL bit —
NCODR bit —
PIM bit ✓
PCR bit ✓
32-pin product ✓
24-pin product ✓
20-pin product ✓
16-pin product ✓
✓: Available
—: Setting prohibited
Table 16.15 Register settings for the pin function select configuration (PORT4)
Pin
001b SCK11_A/SCL11_A
010b RTCOUT_A
011b PCLBUZ0_C
PMC bit ✓
NCODR bit ✓
PIM bit ✓
PCR bit ✓
32-pin product ✓
24-pin product —
20-pin product —
16-pin product —
✓: Available
—: Setting prohibited
Table 16.16 Register settings for the pin function select configuration (PORT9) (1 of 2)
Pin
010b — —
PMC bit ✓ ✓
ISEL bit — —
Table 16.16 Register settings for the pin function select configuration (PORT9) (2 of 2)
Pin
NCODR bit — —
PIM bit — —
PCR bit — —
32-pin product ✓ ✓
24-pin product ✓ ✓
20-pin product — —
16-pin product — —
✓: Available
—: Setting prohibited
channel 1
channel 2
channel 6
channel 7
Channel 7 of unit 0 can be used to realize LIN-bus communication operating in combination with UART2 of the serial array
unit.
Table 17.1 lists the TAU functions and Figure 17.2 to Figure 17.11 show each functional image.
Independent channel operation Interval timer Each timer of a unit can be used as a reference timer that
function *1 generates an interrupt (TAU0_TMI0n) at fixed intervals.
Square wave output A toggle operation is performed each time TAU0_TMI0n
interrupt is generated and a square wave with a duty
factor of 50% is output from a timer output pin (TO0n).
External event counter Each timer of a unit can be used as an event counter that
generates an interrupt when the number of the valid edges
of a signal input to the timer input pin (TI0n) has reached a
specific value.
Divider function (only channel 0 of unit A clock input from a timer input pin (TI00) is divided and
0) output from an output pin (TO00).
Input pulse interval measurement Counting is started by the valid edge of a pulse signal
input to a timer input pin (TI0n). The count value of the
timer is captured at the valid edge of the next pulse. In this
way, the interval of the input pulse can be measured.
Measurement of high- or low-level Counting is started by a single edge of the signal input to
width of input signal the timer input pin (TI0n), and the count value is captured
at the other edge. In this way, the high-level or low-level
width of the input signal can be measured.
Delay counter Counting is started at the valid edge of the signal input
to the timer input pin (TI0n), and an interrupt is generated
after any delay period.
Simultaneous channel operation One-shot pulse output Two channels are used as a set to generate a one-shot
function *2 pulse with a specified output timing and a specified pulse
width.
PWM (Pulse Width Modulation) output Two channels are used as a set to generate a pulse with a
specified period and a specified duty factor.
Multiple PWM (Pulse Width By extending the PWM function and using one master
Modulation) output channel and two or more slave channels, up to seven
types of PWM signals that have a specific period and a
specified duty factor can be generated.
8-bit timer operation function (channels 1 and 3 only) *3 The 8-bit timer operation function makes it possible to use
a 16-bit timer channel in a configuration consisting of two
8-bit timer channels.
LIN-bus supporting function (channel Detection of wakeup signal The timer starts counting at the falling edge of a signal
7 of unit 0 only) *4 input to the serial data input pin (RXD2) of UART2 and
the count value of the timer is captured at the rising edge.
In this way, a low-level width can be measured. If the low-
level width is greater than a specific value, it is recognized
as a wakeup signal.
Detection of break field The timer starts counting at the falling edge of a signal
input to the serial data input pin (RXD2) of UART2 after
a wakeup signal is detected, and the count value of the
timer is captured at the rising edge. In this way, a low-level
width is measured. If the low-level width is greater than a
specific value, it is recognized as a break field.
Measurement of pulse width of sync After a break field is detected, the low-level width and
field high-level width of the signal input to the serial data input
pin (RXD2) of UART2 are measured. From the bit interval
of the sync field measured in this way, a baud rate is
calculated.
Note 1. This function can be used without being affected by the operation mode of other channels. For details, see section 17.7.
Independent Channel Operation Function of Timer Array Unit.
Note 2. This function can be used to combine a master channel (a reference timer mainly controlling the cycle) and slave channels (timers
operating according to the master channel). For details, see section 17.8. Simultaneous Channel Operation Function of Timer Array
Unit.
Note 3. There are several rules for using 8-bit timer operation function. For details, see section 17.3.2. Basic Rules of 8-bit Timer Operation
Function (Channels 1 and 3 only).
Note 4. Timer array unit is used to check whether signals received in LIN-bus communication match the LIN-bus communication format. For
details about setting up the operations used to implement the LIN-bus, see section 17.2.16. ISC : Input Switch Control Register and
section 17.7.5. Operation for Input Signal High- or Low-Level Width Measurement.
Compare operation
Operation clock Timer output
Channel n (TOmn)
Figure 17.7 Functional image of measurement of high- or low-level width of input signal
Compare operation
Operation clock Interrupt signal (TAUm_TMImn)
Channel n (master)
Compare operation
Timer output
Channel p (slave) (TOmp) Duty
Period
Compare operation
Timer output
Channel p (slave) (TOmp) Duty
Period
Compare operation
Timer output
Channel q (slave) (TOmq) Duty
Period
Note: m: Unit number (m = 0), n: Channel number (n = 0 to 7), p, q: Slave channel number (n < p < q ≤ 7)
Figure 17.12 shows the block diagram of the timer array unit. Figure 17.13 to Figure 17.18 show a block diagram for each
channel.
2 2 4 4
PCLKB Prescaler
1
PCLKB/2 , PCLKB/22,
PCLKB/20 to
PCLKB/24, PCLKB/26
PCLKB/215
8
PCLKB/2 , PCLKB/210,
PCLKB/212, PCLKB/214
Selector Selector
Timer input select
register 1 (TIS1)
Selector Selector
TIS[0]
CK03 CK02 CK01 CK00
TI00
Selector
TO00
Event input
TAU0_TMI00
from ELC
(Timer interrupt)
Timer input select
Channel 0
register 1 (TIS1)
TIS[1]
TO01
TAU0_TMI01
Channel 1 TAUm_TMI01H
TI01
Selector
TO02
Event input
TI02
from ELC TAU0_TMI02
Channel 2
Timer input select
register 0 (TIS0)
TO03
TIS[2:0] TAU0_TMI03
TI03 Channel 3 TAU0_TMI03H
3
TO04
TI04
Channel 4 TAU0_TMI04
FSUB
Selector
LOCO TO05
MOCO
Channel 5 TAU0_TMI05
TI05
TI07 TO07
Selector
CK00
clock selection
Count clock
Output
Operating
selection
f MCK fTCLK TO00
Timer controller controller
CK01
Mode
Timer input select selection
register 1 (TIS1) Interrupt
controller TAU0_TMI00
TIS[1:0] Edge
detection (Timer interrupt)
selection
Trigger
Timer counter register 00 (TCR00)
TI00
Selector
Timer status
register 00 (TSR00)
Event input
from ELC Timer data register 00 (TDR00) OVF
Overflow
4
2 3 2
CK00
clock selection
Count clock
Operating
CK01 Output
selection
register 0n (TSR01)
8-bit timer
controller Interrupt
TAU0_TMI01H
Mode controller
(Timer interrupt)
selection
4
2 3 2
CK00
clock selection
Count clock
Operating fTCLK Output
selection
fMCK Timer controller TO0n
CK01 controller
Mode
selection Interrupt
controller TAU0_TMI0n
Edge
TI0n detection (Timer interrupt)
selection
Trigger
Timer counter register 0n (TCR0n)
Timer status
register 0n (TSR0n)
Note: n = 2, 4, 6
Figure 17.15 Internal block diagram of channels 2, 4, and 6 of timer array unit 0
CK00
clock selection
Count clock
Operating
CK01 Output
selection
8-bit timer
controller Interrupt
TAU0_TMI03H
Mode controller
(Timer interrupt)
selection
4
2 3 2
clock selection
Count clock
CK00 Output
Operating
selection
fMCK fTCLK
Timer controller TO05
controller
CK01
Mode
selection Interrupt
Timer input select
register 0 (TIS0) controller TAU0_TMI05
Edge
(Timer interrupt)
detection
selection
TIS[2:0]
Trigger
3
Timer counter register 05 (TCR05) Timer status
register 05
FSUB (TSR05)
Selector
LOCO
MOCO Timer data register 05 (TDR05) OVF
Overflow
TI05
4
2 3 2
CK00
clock selection
Count clock
fTCLK Output
selection
Operating
Mode
selection Interrupt
Selector
RXD2
4
2 3 2
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
15:0 n/a 16-bit Clock Count Result for Unit m and Channel n R
The value of this counter is incremented or decremented in synchronization with the rising edge of a count clock. Whether
the counter is incremented or decremented depends on the operation mode that is selected by the MD[2:0] bits and OPIRQ
bit of timer mode register 0n (TMR0n) (see section 17.2.4. TMR0n : Timer Mode Register 0n (n = 0, 2, 4, 5, 6, 7) and
section 17.2.5. TMR0n : Timer Mode Register 0n (n = 1, 3).
The count value can be read by reading timer counter register 0n (TCR0n). The count value is set to 0xFFFF in the
following cases.
● When the reset signal is generated
● When counting of the slave channel has been completed in the PWM output mode
● When counting of the slave channel has been completed in the delay count mode
● When counting of the master/slave channel has been completed in the one-shot pulse output mode
● When counting of the slave channel has been completed in the multiple PWM output mode
Note: The count value is not captured to timer data register 0n (TDR0n) even when the TCR0n register is read.
Note: When reading the TCR0n register, it is necessary to access the TCR0n register with 16-bit width which is the same
as its counter size to prevent from mistaking the count value.
The value read from the TCR0n register varies depending on the change to the operation mode and operating state as shown
in the Table 17.3.
Table 17.3 Timer counter register 0n (TCR0n) read value in various operation modes
Value read from the timer counter register 0n (TCR0n)*1
Value when the
operation mode
Value when the is changed after
operation mode Value when count count operation was Value when waiting
is changed after operation is temporarily temporarily stopped for a start trigger
Operation mode Count mode releasing reset stopped (TT0.TT[n] = 1) (TT0.TT[n] = 1) after one count
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit field:
15:0 n/a 16-bit Timer Capture Result or Setting Compare Data for Unit m and Channel n R/W
This is a 16-bit register from which a capture function and a compare function can be selected.
The capture or compare function can be switched by selecting an operation mode by using the TMR0n.MD[2:0] bits and
TMR0n.OPIRQ bit of timer mode register 0n (TMR0n).
The value of the TDR0n register can be changed at any time. This register can be read or written in 16-bit units.
In addition, for the TDR01 and TDR03 registers, while in the 8-bit timer mode (when the SPLIT01, SPLIT03 bits of timer
mode registers 01 and 03 (TMR01, TMR03) are 1), it is possible to read and write the data in 8-bit units, with TDR01H and
TDR03H used as the higher 8 bits, and TDR01L and TDR03L used as the lower 8 bits.
(i) When timer data register 0n (TDR0n) is used as compare register
Counting down is started from the value set to the TDR0n register. When the count value reaches 0x0000, an interrupt
signal (TAU0_TMI0n) is generated. The TDR0n register holds its value until it is rewritten.
Note: The TDR0n register does not perform a capture operation even if a capture trigger is input, when it is set to the
compare function.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The TPS0 register is a 16-bit register used to select two types or four types of operation clocks (CK00, CK01, CK02,
CK03) that are commonly supplied to each channel. CK00 is selected by using bits 3 to 0 of the TPS0 register, and CK01
is selected by using bits 7 to 4 of the TPS0 register. In addition, only for channels 1 and 3, CK02 and CK03 can be also
selected. CK02 is selected by using bits 9 and 8 of the TPS0 register, and CK03 is selected by using bits 13 and 12 of the
TPS0 register.
Rewriting of the TPS0 register during timer operation is possible only in the following cases.
● If the PRS0[3:0] bits can be rewritten (n = 0 to 7):
All channels for which CK00 is selected as the operation clock (TMR0n.CKS[1:0] = 00b) are stopped (TE0.TE[n] = 0).
● If the PRS1[3:0] bits can be rewritten (n = 0 to 7):
All channels for which CK01 is selected as the operation clock (TMR0n.CKS[1:0] = 01b) are stopped (TE0.TE[n] = 0).
● If the PRS2[1:0] bits can be rewritten (n = 1, 3):
All channels for which CK02 is selected as the operation clock (TMR0n.CKS[1:0] = 10b) are stopped (TE0.TE[n] = 0).
● If the PRS3[1:0] bits can be rewritten (n = 1, 3):
All channels for which CK03 is selected as the operation clock (TMR0n.CKS[1:0] = 11b) are stopped (TE0.TE[n] = 0).
0011b PCLKB/23 250 kHz 625 kHz 1.25 MHz 2.5 MHz 4 MHz
0100b PCLKB/24 125 kHz 313 kHz 625 kHz 1.25 MHz 2 MHz
0101b PCLKB/25 62.5 kHz 156 kHz 313 kHz 625 kHz 1 MHz
0110b PCLKB/26 31.3 kHz 78.1 kHz 156 kHz 313 kHz 500 kHz
0111b PCLKB/27 15.6 kHz 39.1 kHz 78.1 kHz 156 kHz 250 kHz
1000b PCLKB/28 7.81 kHz 19.5 kHz 39.1 kHz 78.1 kHz 125 kHz
1001b PCLKB/29 3.91 kHz 9.77 kHz 19.5 kHz 39.1 kHz 62.5 kHz
1010b PCLKB/210 1.95 kHz 4.88 kHz 9.77 kHz 19.5 kHz 31.3 kHz
1011b PCLKB/211 977 Hz 2.44 kHz 4.88 kHz 9.77 kHz 15.6 kHz
1100b PCLKB/212 488 Hz 1.22 kHz 2.44 kHz 4.88 kHz 7.81 kHz
1101b PCLKB/213 244 Hz 610 Hz 1.22 kHz 2.44 kHz 3.91 kHz
Note 1. When changing the clock selected for PCLKB, stop timer array unit (TT0 = 0x00FF).
Note: If PCLKB (undivided) is selected as the operation clock (CK0k) and TDR0n is set to 0x0000 (n = 0 to 7), interrupt
requests output from timer array units cannot be used.
Note: Waveform of the clock to be selected in the TPS0 register which becomes high level for one period of PCLKB from
its rising edge. For details, see section 17.4.1. Count Clock (fTCLK).
10b PCLKB/24 125 kHz 313 kHz 625 kHz 1.25 MHz 2 MHz
11b PCLKB/26 31.3 kHz 78.1 kHz 156 kHz 313 kHz 500 kHz
Note 1. When changing the clock selected for PCLKB, stop timer array unit (TT0 = 0x00FF).
The timer array unit must also be stopped if the operating clock (fMCK) or the valid edge of the signal input from the TI0n pin is
selected.
00b PCLKB/28 7.81 kHz 19.5 kHz 39.1 kHz 78.1 kHz 125 kHz
01b PCLKB/210 1.95 kHz 4.88 kHz 9.77 kHz 19.5 kHz 31.3 kHz
10b PCLKB/212 488 Hz 1.22 kHz 2.44 kHz 4.88 kHz 7.81 kHz
Note 1. When changing the clock selected for PCLKB, stop timer array unit (TT0 = 0x00FF).
The timer array unit must also be stopped if the operating clock (fMCK) or the valid edge of the signal input from the TI0n pin is
selected.
By using channels 1 and 3 in the 8-bit timer mode and specifying CK02 or CK03 as the operation clock, the interval times
shown in Table 17.7 can be achieved by using the interval timer function.
Table 17.7 Interval times available for operation clock CK02 or CK03
Interval time*1 (PCLKB = 32 MHz)
Clock 10 µs 100 µs 1 ms 10 ms
CK02 PCLKB/2 ✓ — — —
PCLKB/22 ✓ — — —
PCLKB/24 ✓ ✓ — —
PCLKB/26 ✓ ✓ — —
CK03 PCLKB/28 — ✓ ✓ —
PCLKB/210 — ✓ ✓ —
PCLKB/212 — — ✓ ✓
PCLKB/214 — — ✓ ✓
Note: For details of a signal of PCLKB/2j selected with the TPS0 register, see section 17.4.1. Count Clock (fTCLK).
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
MAST OPIR
Bit field: CKS[1:0] — CCS STS[2:0] CIS[1:0] — — MD[2:0]
ER Q
Note: The bit function assigned to bit 11 of the TMR0n register depends on the channel.
The TMR0n register sets an operation mode of channel n. This register is used to select the operation clock (fMCK), select
the count clock, select the master or slave, select the 16-bit timer, specify the start trigger and capture trigger, select the
valid edge of the timer input, and specify the operation mode (interval, capture, event counter, one-count, or capture and
one-count).
Rewriting the TMR0n register is prohibited while the corresponding timer is in operation (when TE0.TE[n] = 1). However,
bits 7 and 6 (CIS[1:0]) can be rewritten even while the corresponding timer is operating with some functions (when
TE0.TE[n] = 1). For details, see section 17.7. Independent Channel Operation Function of Timer Array Unit and section
17.8. Simultaneous Channel Operation Function of Timer Array Unit.
Note: The timer array unit must be stopped (TT0 = 0x00FF) if the clock selected for PCLKB is changed even if the
operating clock specified by using the CKS[1:0] bits (fMCK) or the valid edge of the signal input from the TI0n pin is
selected as the count clock(fTCLK).
MASTER bit (Selection Between Using Channel n Independently or Simultaneously with Another
Channel (as a Slave or Master))
Only the channel 2, 4, 6 can be set as a master channel (MASTER = 1).
Be sure to use channel 0, 5, 7 are fixed to 0 (Regardless of the bit setting, channel 0 operates as master, because it is the
highest channel).
Clear the MASTER bit to 0 for a channel that is used with the independent channel operation function.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OPIR
Bit field: CKS[1:0] — CCS SPLIT STS[2:0] CIS[1:0] — — MD[2:0]
Q
Note: The timer array unit must be stopped (TT0 = 0x00FF) if the clock selected for PCLKB is changed, even if the
operating clock specified by using the CKS[1:0] bits (fMCK) or the valid edge of the signal input from the TI0n pin is
selected as the count clock(fTCLK).
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The TSR0n register indicates the overflow state of the counter of channel n.
The TSR0n register is valid only in the capture mode (TMR0n.MD[2:0] = 010b) and capture & one-count mode
(TMR0n.MD[2:0] = 110b). See Table 17.10 for the operation of the OVF bit in each operation mode and set or clear
conditions.
The 8 lower-order bits of a TSR0n register can be handled as TSR0nL, which can be read by an 8-bit memory manipulation
instruction.
Note: The OVF bit does not change immediately after the counter has overflowed, but changes upon the subsequent
capture.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The TE0 register is used to enable or stop the timer operation of each channel.
Each bit of the TE0 register corresponds to each bit of the timer channel start register 0 (TS0) and the timer channel stop
register 0 (TT0). When a bit of the TS0 register is set to 1, the corresponding bit of this register is set to 1. When a bit of the
TT0 register is set to 1, the corresponding bit of this register is cleared to 0.
The lower 8 bits of the TE0 register can be set with an 8-bit memory manipulation instruction.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
11 TSH3 Trigger to Enable Operation (Start Operation) of the Higher 8-bit Timer when Channel 3 is in R/W
the 8-bit Timer Mode
0: No trigger operation
1: The TE0.TEH3 bit is set to 1 and the count operation becomes enabled
15:12 — These bits are read as 0. The write value should be 0. R/W
Note: When switching from a function that does not use TI0n pin input to one that does, the following wait period is required from when
timer mode register 0n (TMR0n) is set until the TS[n] (TSH1, TSH3) bit is set to 1.
When the TI0n pin noise filter is enabled (TNFEN.TNFEN0n = 1): Four cycles of the operation clock (fMCK) When the Ti0n pin noise
filter is disabled (TNFEN.TNFEN0n = 0): Two cycles of the operation clock (fMCK)
Note: When the TS0 register is read, 0 is always read.
The TS0 register is a trigger register that is used to initialize timer counter register 0n (TCR0n) and start the counting
operation of each channel.
When a bit of this register is set to 1, the corresponding bit of timer channel enable status register 0 (TE0) is set to 1. The
TS[n], TSH1, TSH3 bits are immediately cleared when operation is enabled (TE0.TE[n], TEH1, TEH3), because they are
trigger bits.
TSH1 bit (Trigger to Enable Operation (Start Operation) of the Higher 8-bit Timer when Channel 1 is in the
8-bit Timer Mode)
The TCR01 register count operation start in the interval timer mode in the count operation enabled state (see Table 17.11 in
section 17.4.2. Timing of the Start of Counting).
TSH3 bit (Trigger to Enable Operation (Start Operation) of the Higher 8-bit Timer when Channel 3 is in the
8-bit Timer Mode)
The TCR03 register count operation start in the interval timer mode in the count operation enabled state (see Table 17.11 in
section 17.4.2. Timing of the Start of Counting).
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
11 TTH3 Trigger to Stop Operation of the Higher 8-bit Timer when Channel 3 is in the 8-bit Timer R/W
Mode
0: No trigger operation
1: The TE0.TEH3 bit is cleared to 0 and the count operation is stopped
15:12 — These bits are read as 0. The write value should be 0. R/W
Note: When the TT0 register is read, 0 is always read.
The TT0 register is a trigger register that is used to stop the counting operation of each channel.
When a bit of this register is set to 1, the corresponding bit of timer channel enable status register 0 (TE0) is cleared to 0.
The TT0.TT[n], TTH1, TTH3 bits are immediately cleared when operation is stopped (TE0.TE[n], TEH1, TEH3), because
they are trigger bits.
Bit position: 7 6 5 4 3 2 1 0
The TIS0 register is used to select the channel 5 of unit 0 timer input.
Note: Make sure that both the high-level and low-level widths of timer input to be selected are no less than 1/fMCK + 10 ns.
Therefore, when selecting FSUB as PCLKB, the TIS[2] bit cannot be set to 1.
Bit position: 7 6 5 4 3 2 1 0
The TIS1 register is used to select channels 0 and 1 of unit 0 timer input.
Note: When selecting the event input signal from ELC in this register, select PCLKB (undivided) as the operating clock in
timer clock select register 0 (TPS0).
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The TOE0 register is used to enable or disable timer output of each channel.
Channel n for which timer output has been enabled becomes unable to rewrite the value of the TO0.TO[n] bit of timer
output register 0 (TO0) described later by software, and the value reflecting the setting of the timer output function through
the count operation is output from the timer output pin (TO0n).
The lower 8 bits of the TOE0 register can be set with an 8-bit memory manipulation instruction.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The TO0n bit on this register can be rewritten by software only when timer output is disabled (TOE0.TOE[n] = 0). When
timer output is enabled (TOE0.TOE[n] = 1), rewriting this register by software is ignored, and the value is changed only by
the timer operation.
To use the port functions multiplexed with the inputs and outputs of timer array units, select the function by setting
PSEL[2:0] bits.
The lower 8 bits of the TO0 register can be set with an 8-bit memory manipulation instruction.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The TOL0 register controls the timer output level of each channel.
The setting of the inverted output of channel n by this register is reflected at the timing of set or reset of the timer output
signal while the timer output is enabled (TOE0.TOE[n] = 1) in the Slave channel output mode (TOM0.TOM[n] = 1). In the
master channel output mode (TOM0.TOM[n] = 0), this register setting is invalid.
The lower 8 bits of the TOL0 register can be set with an 8-bit memory manipulation instruction.
Note: If the value of this register is rewritten during timer operation, the timer output logic is inverted when the timer output
signal changes next, instead of immediately after the register value is rewritten.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The TOM0 register is used to control the timer output mode of each channel.
When a channel is used for the independent channel operation function, set the corresponding bit of the channel to be used
to 0.
When a channel is used for the simultaneous channel operation function (PWM output, one-shot pulse output, or multiple
PWM output), set the corresponding bit of the master channel to 0 and the corresponding bit of the slave channel to 1.
The setting of each channel n by this register is reflected at the timing when the timer output signal is set or reset while the
timer output is enabled (TOE0.TOE[n] = 1).
The lower 8 bits of the TOM0 register can be set with an 8-bit memory manipulation instruction.
Bit position: 7 6 5 4 3 2 1 0
SSIE0
Bit field: — — — — — ISC1 ISC0
0
Bit position: 7 6 5 4 3 2 1 0
0 TNFEN00 Enabling or Disabling Use of the Noise Filter for the TI00 Pin R/W
0: Turns the noise filter off
1: Turns the noise filter on
1 TNFEN01 Enabling or Disabling Use of the Noise Filter for the TI01 Pin R/W
0: Turns the noise filter off
1: Turns the noise filter on
2 TNFEN02 Enabling or Disabling Use of the Noise Filter for the TI02 Pin R/W
0: Turns the noise filter off
1: Turns the noise filter on
3 TNFEN03 Enabling or Disabling Use of the Noise Filter for the TI03 Pin R/W
0: Turns the noise filter off
1: Turns the noise filter on
4 TNFEN04 Enabling or Disabling Use of the Noise Filter for the TI04 Pin R/W
0: Turns the noise filter off
1: Turns the noise filter on
5 TNFEN05 Enabling or Disabling Use of the Noise Filter for the TI05 Pin R/W
0: Turns the noise filter off
1: Turns the noise filter on
6 TNFEN06 Enabling or Disabling Use of the Noise Filter for the TI06 Pin R/W
0: Turns the noise filter off
1: Turns the noise filter on
7 TNFEN07 Enabling or Disabling Use of the Noise Filter for the TI07 Pin*1 R/W
0: Turns the noise filter off
1: Turns the noise filter on
Note 1. For the TI07 pin, it can be switched by setting the ISC1 bit of the ISC register.
ISC.ISC1 = 0: Whether or not to use the noise filter of the TI07 pin can be selected.
ISC.ISC1 = 1: Whether or not to use the noise filter of the RXD2 pin can be selected.
Note: The presence or absence of timer I/O pins of channel 0 to 7 depends on the product.
The TNFEN registers are used to set whether the noise filter can be used for the timer input signal to each channel.
Enable the noise filter by setting the corresponding bits to 1 on the pins in need of noise removal.
When the noise filter is enabled, after synchronization with the operating clock (fMCK)for the target channel, whether the
signal keeps the same value for two clock cycles is detected.
When the noise filter is disabled, the input signal is only synchronized with the operating clock (fMCK) for the target
channel*1.
Note 1. For details, see (2) When valid edge of input signal via the TI0n pin is selected (TMR0n.CCS = 1), section 17.4.2.
Timing of the Start of Counting, and section 17.6. Timer Input (TI0n) Control.
17.2.18 Registers Controlling Port Functions of Pins to be Used for Timer I/O
Set the following registers to control the port functions multiplexed with the inputs and outputs of timer array units.
● Pmn Direction Register (PDRm) or PDR bit of Port mn Pin Function Select Register (PmnPFS_A)
● PSEL[2:0] bits of Port mn Pin Function Select Register (PmnPFS_A)
When the pins multiplexed with TO01 to TO07 are to be used for outputs of timers, set the following registers.
● Set the PDRxx bit of Pmn Direction Register (PDRm) or PDR bit of Port mn Pin Function Select Register (PmnPFS_A)
Set the PDRm.PDRxx bit to 1. or Set the PmnPFS_A.PDR bit to 1.
● PSEL[2:0] bits of Port mn Pin Function Select Register (PmnPFS_A)
Select the TO0x function by setting PSEL[2:0] bits of Port mn Pin Function Select Register (PmnPFS_A)
When the pins multiplexed with TI01 to TI07 are to be used for inputs of timers, set the following registers.
● Set the PDRxx bit of Pmn Direction Register (PDRm) or PDR bit of Port mn Pin Function Select Register (PmnPFS_A)
Set the PDRm.PDRxx bit to 0. or Set the PmnPFS_A.PDR bit to 0.
● PSEL[2:0] bits of Port mn Pin Function Select Register (PmnPFS_A)
Select the TI0x function by setting PSEL[2:0] bits of Port mn Pin Function Select Register (PmnPFS_A)
12. To stop the channels in combination simultaneously, the channel stop trigger bit (TT0.TT[n]) of the channels in
combination must be set at the same time.
13. CK02 and CK03 cannot be selected while channels are operating simultaneously, because the operating clocks of master
channels and slave channels have to be synchronized.
14. Timer mode register 00 (TMR00) has no master bit (it is fixed to 0). However, as channel 0 is the highest channel, it can
be used as a master channel during simultaneous operation.
The rules of the simultaneous channel operation function are applied in a channel group (a master channel and slave
channels forming one simultaneous channel operation function).
If two or more channel groups that do not operate in combination are specified, the basic rules of the simultaneous channel
operation function in this section do not apply to the channel groups.
TAU0
Channel group 1
(Simultaneous channel operation
CK00 Channel 0: Master function)
Channel 1: Slave
Channel 2: Slave
17.3.2 Basic Rules of 8-bit Timer Operation Function (Channels 1 and 3 only)
The 8-bit timer operation function makes it possible to use a 16-bit timer channel in a configuration consisting of two 8-bit
timer channels.
This function can only be used for channels 1 and 3, and there are several rules for using it.
The basic rules for this function are as follows:
1. The 8-bit timer operation function applies only to channels 1 and 3.
2. When using 8-bit timers, set the SPLIT bit of timer mode register 0n (TMR0n) to 1.
3. The higher 8 bits can be operated as the interval timer function.
4. At the start of operation, the higher 8 bits output TAU0_TMI01H and TAU0_TMI03H (an interrupt) (which is the same
operation performed when the TMR0n.OPIRQ bit is set to 1).
5. The operation clock of the higher 8 bits is selected according to the CKS[1:0] bits of the lower-bit TMR0n register.
6. For the higher 8 bits, the TS0.TSH1 and TSH3 bits are manipulated to start channel operation and the TT0.TTH1 and
TTH3 bits are manipulated to stop channel operation. The channel state can be checked using the TE0.TEH1 and TEH3
bits.
7. The lower 8 bits operate according to the TMR0n register settings. The following three functions support operation of
the lower 8 bits:
● Interval timer function and square wave output function
● External event counter function
● Delay count function
8. For the lower 8 bits, the TS0.TS[1] and TS[3] bits are manipulated to start channel operation and the TT0.TT[1] and
TT[3] bits are manipulated to stop channel operation. The channel state can be checked using the TE0.TE[1] and TE[3]
bits.
9. During 16-bit operation, manipulating the TS0.TSH1, TSH3, TT0.TTH1, and TTH3 bits are invalid. The TS0.TS[1],
TS[3], TT0.TT[1], and TT[3] bits are manipulated to operate channels 1 and 3. The TE0.TEH1, and TEH3 bits are not
changed.
10. For the 8-bit timer function, the simultaneous operation functions (one-shot pulse, PWM, and multiple PWM) cannot be
used.
Because the timer array unit is designed to operate in synchronization with PCLKB, the timings of the count clock (fTCLK)
are shown below.
(1) When operation clock (fMCK) specified by the TMR0n.CKS[1:0] bits is selected (TMR0n.CCS = 0)
The count clock (fTCLK) is between PCLKB to PCLKB/215 by setting of timer clock select register 0 (TPS0). When a
divided PCLKB is selected, however, the clock selected in TPS0n register, but a signal which becomes high level for one
period of PCLKB from its rising edge. When a PCLKB is selected, fixed to high level
Counting of timer counter register 0n (TCR0n) delayed by one period of PCLKB from rising edge of the count clock,
because of synchronization with PCLKB. But, this is described as "counting at rising edge of the count clock", as a matter
of convenience.
Figure 17.20 shows the count clock (fTCLK) timing from PCLKB when TMR0n.CCS = 0.
PCLKB
PCLKB/2
PCLKB/4
fTCLK
( = fMCK
= CKmn) PCLKB/8
PCLKB/16
Figure 17.20 Timing of PCLKB and count clock (fTCLK) (when TMR0n.CCS = 0)
(2) When valid edge of input signal via the TI0n pin is selected (TMR0n.CCS = 1)
The count clock (fTCLK) becomes the signal that detects valid edge of input signal via the Ti0n pin and synchronizes next
rising fMCK. The count clock (fTCLK) is delayed for 1 to 2 period of fMCK from the input signal via the Ti0n pin (when a
noise filter is used, the delay becomes 3 to 4 clock).
Counting of timer counter register 0n (TCR0n) delayed by one period of PCLKB from rising edge of the count clock,
because of synchronization with PCLKB. But, this is described as "counting at valid edge of input signal via the TI0n pin",
as a matter of convenience.
Figure 17.21 shows the count clock (fTCLK) timing from PCLKB when TMR0n.CCS = 1 and noise filter unused.
PCLKB
fMCK
TSm.TS[n] (write)
<1>
TEm.TE[n]
TImn input
<2>
Sampling wave
Edge detection <3> Edge detection
Figure 17.21 Timing of PCLKB and count clock (fTCLK) (when TMR0n.CCS = 1, noise filter unused)
<1> Setting TS0.TS[n] bit to 1 enables the timer to be started and to become wait state for valid edge of input signal via the
TI0n pin.
<2> The rise of input signal via the TI0n pin is sampled by fMCK.
<3> The edge is detected by the rising of the sampled signal and the detection signal (count clock) is output.
● Interval timer mode No operation is carried out from start trigger detection (TS0.TS[n] = 1) until count clock generation.
The first count clock loads the value of the TDR0n register to the TCR0n register and the subsequent count
clock performs count down operation (see (1) Operation in interval timer mode).
● Event counter mode Writing 1 to the TS0.TS[n] bit loads the value of the TDR0n register to the TCR0n register. If detect edge of
TI0n input. The subsequent count clock performs count down operation (see (2) Operation in event counter
mode).
● Capture mode No operation is carried out from start trigger detection (TS0.TS[n] = 1) until count clock generation.
The first count clock loads 0x0000 to the TCR0n register and the subsequent count clock performs count up
operation (see (3) Operation in capture mode (input pulse interval measurement)).
● One-count mode The waiting-for-start-trigger state is entered by writing 1 to the TS0.TS[n] bit while the timer is stopped
(TE0.TE[n] = 0).
No operation is carried out from start trigger detection until count clock generation. The first count clock loads
the value of the TDR0n register to the TCR0n register and the subsequent count clock performs count down
operation (see (4) Operation in one-count mode).
● Capture & one-count The waiting-for-start-trigger state is entered by writing 1 to the TS0.TS[n] bit while the timer is stopped
mode (TE0.TE[n] = 0).
No operation is carried out from start trigger detection until count clock generation. The first count clock loads
0x0000 to the TCR0n register and the subsequent count clock performs count up operation (see (5) Operation
in capture & one-count mode (high-level width measurement)).
fMCK
(fTCLK)
TSm.TS[n]
(write)
<1>
TEm.TE[n]
<2>
Start trigger
detection signal
TCRmn Initial
value m m-1 0x0001 0x0000 m
<5>
TAUm_TMImn
Note: In the first cycle operation of count clock after writing the TSm.TS[n] bit, an error at a maximum of one clock is generated
since count start delays until count clock has been generated. When the information on count start timing is necessary, an
interrupt can be generated at count start by setting TMRmn.OPIRQ = 1.
Note: fMCK, the start trigger detection signal, and TAUm_TMImn become active between one clock in synchronization with
PCLKB.
Note: m = 0, n = 0 to 7
fMCK
TSm.TS[n]
(write)
<1>
TEm.TE[n]
<2>
TImn input
<3>
TDRmn m
Note: Figure 17.23 shows the timing when the noise filter is not used. By making the noise filter on-state, the edge detection
becomes 2 fMCK cycles (it sums up to 3 to 4 cycles) later than the normal cycle of TImn input. The error per one period
occurs be the asynchronous between the period of the TImn input and that of the count clock (fMCK).
Note: m = 0, n = 0 to 7
fMCK
TSm.TS[n]
(write)
<1>
TEm.TE[n]
*1
<3>
TImn input
<4> <5>
Start trigger
detection signal
<3>
<2>
TCRmn Initial value 0x0000 0x0001 0x0000 m−1 m 0x0000
TDRmn 0x0001*1 m
TAUm_TMImn
When TMRmn.OPIRQ = 1
Note: In the first cycle operation of count clock after writing the TSm.TS[n] bit, an error at a maximum of one clock is generated
since count start delays until count clock has been generated. When the information on count start timing is necessary, an
interrupt can be generated at count start by setting TMRmn.OPIRQ = 1.
Note: If a clock has been input to TImn (the trigger exists) when capturing starts, counting starts when a trigger is detected, even
if no edge is detected. Therefore, the first captured value (<4>) does not determine a pulse interval (in the above figure,
0x0001 just indicates two clock cycles but does not determine the pulse interval) and so the user can ignore it.
Note: Figure 17.24 shows the timing when the noise filter is not used. By making the noise filter on-state, the edge detection
becomes 2 fMCK cycles (it sums up to 3 to 4 cycles) later than the normal cycle of TImn input. The error per one period
occurs be the asynchronous between the period of the TImn input and that of the count clock (fMCK).
Note: m = 0, n = 0 to 7
Figure 17.24 Timing during operation in capture mode (input pulse interval measurement)
fMCK
(fTCLK)
TSm.TS[n] (write)
<1>
TEm.TE[n]
TImn input
<3>
Edge detection
Rising edge
<4>
Start trigger
detection signal
<2> <5>
TCRmn Initial value m 1 0 0xFFFF
TAUm_TMImn
Note: Figure 17.25 shows the timing when the noise filter is not used. By making the noise filter on-state, the edge detection
becomes 2 fMCK cycles (it sums up to 3 to 4 cycles) later than the normal cycle of TImn input. The error per one period
occurs be the asynchronous between the period of the TImn input and that of the count clock (fMCK).
Note: m = 0, n = 0 to 7
fMCK
(fTCLK)
TSm.TS[n] (write)
<1>
TEm.TE[n]
Start trigger
detection signal
<2>
TCRmn Initial value 0x0000 m−1 m m+1
TDRmn 0x0000 m
TAUm_TMImn
Note: Figure 17.26 shows the timing when the noise filter is not used. By making the noise filter on-state, the edge detection
becomes 2 fMCK cycles (it sums up to 3 to 4 cycles) later than the normal cycle of TImn input. The error per one period
occurs be the asynchronous between the period of the TImn input and that of the count clock (fMCK).
Note: m = 0, n = 0 to 7
Figure 17.26 Timing during operation in capture & one-count mode (high-level width measurement)
<5>
TOm.TO[n] bit
Interrupt signal of the master channel register
(TAUm_TMImn)
Controller
TOLm.TOL[n]
TOMm.TOM[n]
Internal bus
Note: m = 0, n = 0 to 7
<2> When TOM0.TOM[n] = 1 (slave channel output mode), both TAU0_TMI0n (master channel timer interrupt) and
TAU0_TMI0p (slave channel timer interrupt) are transmitted to the TO0 register.
At this time, the TOL0 register becomes valid and the signals are controlled as follows:
When TOL0.TOL[n] = 0: Positive logic output (TAU0_TMI0n → set, TAU0_TMI0p → reset)
When TOL0.TOL[n] = 1: Negative logic output (TAU0_TMI0n → reset, TAU0_TMI0p → set)
When TAU0_TMI0n and TAU0_TMI0p are simultaneously generated, (0% output of PWM), TAU0_TMI0p (reset signal)
takes priority, and TAU0_TMI0n (set signal) is masked.
<3> While timer output is enabled (TOE0.TOE[n] = 1), TAU0_TMI0n (master channel timer interrupt) and TAU0_TMI0p
(slave channel timer interrupt) are transmitted to the TO0 register. Writing to the TO0 register (TO0.TO[n] write signal)
becomes invalid.
When TOE0.TOE[n] = 1, the TO0n pin output never changes with signals other than interrupt signals.
To initialize the TO0n pin output level, it is necessary to set timer operation is stopped (TOE0.TOE[n] = 0) and to write a
value to the TO0 register.
<4> While timer output is disabled (TOE0.TOE[n] = 0), writing to the TO0.TO[n] bit to the target channel (TO0.TO[n]
write signal) becomes valid. When timer output is disabled (TOE0.TOE[n] = 0), neither TAU0_TMI0n (master channel
timer interrupt) nor TAU0_TMI0p (slave channel timer interrupt) is transmitted to the TO0 register.
<5> The TO0 register can always be read, and the TO0n pin output level can be checked.
TCRmn
Undefined value (0xFFFF after reset)
(Counter)
Hi-Z
Timer alternate-function pin
TOmn
TOEm.TOE[n]
Note: m = 0, n = 0 to 7
Figure 17.28 State transitions from the settings for timer output to the start of timer operation
<1> The operation mode of timer output is set.
● TOM0.TOM[n] bit (0: Master channel output mode, 1: Slave channel output mode)
● TOL0.TOL[n] bit (0: Positive logic output, 1: Negative logic output)
<2> The timer output signal is set to the initial state by setting timer output register 0 (TO0).
<3> The timer output operation is enabled by writing 1 to the TOE0.TOE[n] bit (writing to the TO0 register is disabled).
<4> The port is set to Peripheral output by the PSEL[2:0] bits of Port mn Pin Function Select Register (PmnPFS_A) (see
section 16.2.8. PmnPFS_A : Port mn Pin Function Select Register (m = 1 to 4, n = 00 to 15), section 16.2.9. P0nPFS_A :
Port 0n Pin Function Select Register (n = 08 to 15), section 16.2.10. P9nPFS_A : Port 9n Pin Function Select Register (n =
13 to 14)).
<5> The port I/O setting is set to output by the PDR bit of PmnPFS_A register (see section 17.2.18. Registers Controlling
Port Functions of Pins to be Used for Timer I/O).
<6> The timer operation is enabled (TS0.TS[n] = 1).
(2) Default level of TO0n pin and output level after timer operation start
The change in the output level of the TO0n pin when timer output register 0 (TO0) is written while timer output is disabled
(TOE0.TOE[n] = 0), the initial level is changed, and then timer output is enabled (TOE0.TOE[n] = 1) before port output is
enabled, is shown below.
a. When operation starts with master channel output mode (TOM0.TOM[n] = 0) setting
The setting of timer output level register 0 (TOL0) is invalid when master channel output mode (TOM0.TOM[n] = 0).
When the timer operation starts after setting the default level, the toggle signal is generated and the output level of the
TO0n pin is inverted.
Figure 17.29 shows the output state of the TO0n pin with the output toggled (TOM0.TOM[n] = 0).
TOEm.TOE[n]
Note: Toggle: Toggle signal to invert the output on the TOmn pin
Note: m = 0, n = 0 to 7
Figure 17.29 TOmn pin output states with toggled output (TOM0.TOM[n] = 0)
b. When operation starts with slave channel output mode (TOM0.TOM[p] = 1) setting (PWM output)
When slave channel output mode (TOM0.TOM[p] = 1), the active level is determined by timer output level register 0
(TOL0) setting.
Figure 17.30 shows the output state of the TO0p pin with PWM output (TOM0.TOM[p] = 1).
TOEm.TOE[p]
Active Active Active
Hi-Z Default TOm.TO[p] bit = 0
state (default state: low) TOLm.TOL[p]
bit = 0
TOm.TO[p] bit = 1 (active-high)
(default state: high)
TOmp
(output) TOm.TO[p] bit = 0
(default state: low)
TOLm.TOL[p]
bit = 1
TOm.TO[p] bit = 1 (active-low)
(default state: high)
Reset Reset
Set Set Set
Note: Set: The output signal of the TOmp pin changes from inactive level to active level.
Reset: The output signal of the TOmp pin changes from active level to inactive level.
Note: m = 0, p = 1 to 7
Figure 17.30 TO0p pin output states with PWM output (TOM0.TOM[p] = 1)
TOLm
Note: Set: The output signal of the TOmn pin changes from inactive level to active level.
Reset: The output signal of the TOmn pin changes from active level to inactive level.
Note: m = 0, n = 0 to 7
Figure 17.31 Operation when the relevant bit of the TOL0 register is changed during timer
operation
b. Set and reset timing
To realize 0% and 100% output at PWM output, the TO0n pin and TO0.TO[n] bit set timing at master channel timer
interrupt (TAU0_TMI0n) generation is delayed by 1 count clock by the slave channel.
If the set condition and reset condition are generated at the same time, a higher priority is given to the latter.
Figure 17.32 shows the states of operation following set and reset signals when the master and slave channels are set as
follows.
Master channel: TOE0.TOE[n] = 1, TOM0.TOM[n] = 0, TOL0.TOL[n] = 0
Slave channel: TOE0.TOE[p] = 1, TOM0.TOM[p] = 1, TOL0.TOL[p] = 0
fTCLK
TAUm_TMImn
Master
Internal reset
channel signal
TOmn
pin/TOm.TO[n]
Toggle Toggle
Internal reset
signal
1 clock delay
TAUm_TMImp
Slave
channel
Internal reset
signal
TOmp
pin/TOm.TO[p]
fTCLK
TAUm_TMImn
Internal reset
signal
Master
channel TOmn
pin/TOm.TO[n]
Toggle Toggle
Internal reset
signal
1 clock delay
Slave
TAUm_TMImp
channel
Before writing TO0 0 0 0 0 0 0 0 0 TO[7] TO[6] TO[5] TO[4] TO[3] TO[2] TO[1] TO[0]
0 0 1 0 0 0 1 0
TOE0 0 0 0 0 0 0 0 0 TOE[7] TOE[6] TOE[5] TOE[4] TOE[3] TOE[2] TOE[1] TOE[0]
0 0 1 0 1 1 1 1
Data to be written TO0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1
↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
× × × × ×
After writing TO0 0 0 0 0 0 0 0 0 TO[7] TO[6] TO[5] TO[4] TO[3] TO[2] TO[1] TO[0]
1 1 1 0 0 0 1 0
Writing is done only to the TO0.TO[n] bit with TOE0.TOE[n] = 0, and writing to the TO0.TO[n] bit with TOE0.TOE[n] = 1
is ignored.
TO0n (channel output) to which TOE0.TOE[n] = 1 is set is not affected by the write operation. Even if the write operation is
done to the TO0.TO[n] bit, it is ignored and the output change by timer operation is normally done.
Figure 17.33 shows an example of a TO0.TO[n] bit collective manipulation.
TO04
TO01
TO00
Writing to the
Before writing
TO0.TO[n] bit
TCRmn
TEm.TE[n]
TAUm_TMImn
TOmn
TCRmn
TEm.TE[n]
TAUm_TMImn
TOmn
Note: m = 0, n = 0 to 7
Figure 17.34 Examples of the operation of timer interrupts and TOmn outputs when counting is started
When the TMR0n.OPIRQ bit is set to 1, a timer interrupt (TAU0_TMI0n) is output at count operation start, and TO0n
performs a toggle operation.
When the TMR0n.OPIRQ bit is set to 0, a timer interrupt (TAU0_TMI0n) is not output at count operation start, and TO0n
does not change either. After counting one cycle, TAU0_TMI0n is output and TO0n performs a toggle operation.
TMRmn.CCS
Interrupt signal from master channel
fMCK
Count clock
selection
fTCLK
Timer
controller
Noise Edge
TImn pin
filter detection
selection
Trigger
Note: m = 0, n = 0 to 7
TImn pin
Note: m = 0, n = 0 to 7
Figure 17.36 Sampling waveforms through TI0n input pin with noise filter enabled and disabled
Timer counter register 0n (TCR0n) operates as a down counter in the interval timer mode.
The TCR0n register loads the value of timer data register 0n (TDR0n) at the first count clock after the channel start trigger
bit (TS[n], TSH1, TSH3) of timer channel start register 0 (TS0) is set to 1. If the TMR0n.OPIRQ bit of timer mode register
0n (TMR0n) is 0 at this time,TAU0_TMI0n is not output and the output on TO0n is not toggled. If the TMR0n.OPIRQ bit
of the TMR0n register is 1, TAU0_TMI0n is output and the output on TO0n is toggled.
After that, the TCR0n register count down in synchronization with the count clock.
When TCR0n = 0x0000, TAU0_TMI0n is output and the output on TO0n is toggled at the next count clock. At the same
time, the TCR0n register loads the value of the TDR0n register again. After that, the same operation is repeated.
The TDR0n register can be rewritten at any time. The new value of the TDR0n register becomes valid from the next period.
Figure 17.37 shows a block diagram of the operation as an interval timer or a square wave output.
Clock selection
CKm1
Operation clock*1 Timer counter
CKm0 Output
register mn (TCRmn) TOmn pin
controller
Trigger selection
Note: m = 0, n = 0 to 7
Note 1. For channels 1 and 3, the clock can be selected as CKm0, CKm1, CKm2, or CKm3.
Figure 17.37 Block diagram for operation as an interval timer or for square wave output
Figure 17.38 shows an example of basic timing during operation as an Interval timer or for square wave output
(TMR0n.OPIRQ = 1).
TSm.TS[n]
TEm.TE[n]
TCRmn
0x0000
TDRmn a b
TOmn
TAUm_TMImn
Note: m = 0, n = 0 to 7
Figure 17.38 Example of basic timing during operation as an interval timer or for square wave output
(TMR0n.OPIRQ = 1)
Table 17.13 to Table 17.18 show register settings and procedure for operation when the interval timer or square wave
output.
Table 17.13 Example of TMR0n settings for operation as an interval timer or for square wave output
Bit Symbol Set value Function
13 — 0 Fixed to 0.
15:14 CKS[1:0] 00b Selection of the operating clock (fMCK)
to
11b 0 0: Selects CK00 as the operating clock for channel n.
0 1: Selects CK02 as the operating clock (this can only be selected for channels 1
and 3).
1 0: Selects CK01 as the operating clock for channel n.
1 1: Selects CK03 as the operating clock (this can only be selected for channels 1
and 3).
Table 17.14 Example of TO0 settings for operation as an interval timer or for square wave output
Bit Symbol Set value Function
Table 17.15 Example of TOE0 settings for operation as an interval timer or for square wave output
Bit Symbol Set value Function
Table 17.16 Example of TOL0 settings for operation as an interval timer or for square wave output
Bit Symbol Set Value Function
n - (n = 0) 0 Fixed to 0 (channels 0)
TOL[n] (n = 1 to Control of timer output of channel n (channels 1 to 7)
7)
0: Set this bit to 0 when TOM0.TOM[n] = 0 (master channel output mode).
Table 17.17 Example of TOM0 settings for operation as an interval timer or for square wave output
Bit Symbol Set value Function
n - (n = 0) 0 Fixed to 0 (channels 0)
TOM[n] (n = 1 to Control of timer output mode of channel n (channels 1 to 7)
7)
0: Sets master channel output mode.
Table 17.18 Procedure for operations when the interval timer or square wave output function is to be
used (1 of 2)
Step Software operation Hardware state
Table 17.18 Procedure for operations when the interval timer or square wave output function is to be
used (2 of 2)
Step Software operation Hardware state
Operation <7> The TT0.TT[n] (TTH1, TTH3) bit is set to 1. TE0.TE[n] (TEH1, TEH3) = 0, and count operation
stop The TT0.TT[n] (TTH1, TTH3) bit automatically stops. The TCR0n register holds count value and
returns to 0 because it is a trigger bit. → stops.
The TO0n output is not initialized and retains its
current state.
<8> The TOE0.TOE[n] bit is cleared to 0 and value is set The TO0n pin outputs the TO0.TO[n] bit set level.
to the TO0.TO[n] bit.
→
To resume operation, go to step <5>.
To terminate the operation, go to step <9>
TAU stop <9> To hold the TO0n pin output level The TO0n pin output level is held by port function.
Set PSEL[2:0] bits to 000b after the value to be held
is set to the Ppq Output Data Register (PODRp).
→
When holding the TO0n pin output level is not
necessary
Setting not required.
<10> Sets the MSTPD0 bit of Module Stop Control This stops supply of the input clock to timer array unit
Register D (MSTPCRD) to 1. → 0.
Power-off state.
Note: n = 0 to 7, p = 0 to 9, q = 00 to 15
TNFEN.TNFENmn
Clock selection
Noise Edge
TImn pin Timer counter
filter detection
register mn (TCRmn)
Trigger selection
Note: m = 0, n = 0 to 7
Figure 17.40 shows an example of basic timing during operation as an external event counter.
TSm.TS[n]
TEm.TE[n]
TImn
3 3
2 2 2 2
TCRmn 1 1 1 1
0x0000 0 0 0
TAUm_TMImn
Note: m = 0, n = 0 to 7
Figure 17.40 Example of basic timing during operation as an external event counter
Table 17.19 to Table 17.24 show register settings and procedure for operation when the external event counter.
Table 17.19 Example of TMR0n settings in external event counter mode (1 of 2)
Bit Symbol Set value Function
n — (n = 0) 0 Fixed to 0 (channels 0)
TOL[n] (n = 1 to Control of timer output of channel n (channels 1 to 7)
7)
0: Set this bit to 0 when TOM0.TOM[n] = 0 (master channel output mode).
n — (n = 0) 0 Fixed to 0 (channels 0)
TOM[n] (n = 1 to Control of timer output mode of channel n (channels 1 to 7)
7)
0: Sets master channel output mode.
Table 17.24 Procedure for operations when the external event counter function is to be used (1 of 2)
Step Software operation Hardware state
Table 17.24 Procedure for operations when the external event counter function is to be used (2 of 2)
Step Software operation Hardware state
Operation <4> Sets the TS0.TS[n] bit to 1. TE0.TE[n] = 1 and count operation starts.
start The TS0.TS[n] bit automatically returns to 0 because Value of the TDR0n register is loaded to timer
→
it is a trigger bit. counter register 0n (TCR0n) and detection of the
TI0n pin input edge is awaited.
During <5> Set value of the TDR0n register can be changed. The Counter (TCR0n) counts down each time input edge
operation TCR0n register can always be read. of the TI0n pin has been detected. When count value
The TSR0n register is not used. reaches 0x0000, the value of the TDR0n register
Set values of the TMR0n register, TOM0.TOM[n], is loaded to the TCR0n register again, and the
TOL0.TOL[n], TO0.TO[n], and TOE0.TOE[n] bits count operation is continued. By detecting TCR0n =
cannot be changed. 0x0000, the TAU0_TMI0n output is generated.
After that, the above operation is repeated.
Operation <6> The TT0.TT[n] bit is set to 1. TE0.TE[n] = 0, and count operation stops.
stop The TT0.TT[n] bit automatically returns to 0 because The TCR0n register holds count value and stops.
it is a trigger bit. →
To resume operation, go to step <4>.
To terminate the operation, go to step <7>
TAU stop <7> Sets the MSTPD0 bit of Module Stop Control This stops supply of the input clock to timer array unit
Register D (MSTPCRD) to 1. → 0.
Power-off state.
Note: n = 0 to 7
Timer counter register 00 (TCR00) operates as a down counter in the interval timer mode.
After the channel start trigger bit (TS[0]) of timer channel start register 0 (TS0) is set to 1, the TCR00 register loads the
value of timer data register 00 (TDR00) when the TI00 valid edge is detected.
If the OPIRQ bit of timer mode register 00 (TMR00) is 0 at this time, TAU0_TMI00 is not output and the output on TO00
is not toggled. If the OPIRQ bit of timer mode register 00 (TMR00) is 1, TAU0_TMI00 is output and the output on TO00 is
toggled.
After that, the TCR00 register counts down at the valid edge of the TI00 pin. When TCR00 = 0x0000, it toggles the output
on TO00. At the same time, the TCR00 register loads the value of the TDR00 register again, and continues counting.
If detection of both the edges of the TI00 pin is selected, the duty factor error of the input clock affects the divided clock
period of the TO00 output.
The period of the TO00 output clock includes a sampling error of one period of the operation clock.
Clock period of TO00 output = Ideal TO00 output clock period ± Operation clock period (error)
The TDR00 register can be rewritten at any time. The new value of the TDR00 register becomes valid during the next count
period.
Figure 17.41 shows a block diagram for operation as a frequency divider.
TNFEN.TNFEN00
Clock selection
Noise Edge
TI00 pin Timer counter Output
filter detection TO00 pin
register 00 (TCR00) controller
Trigger selection
Timer data
TS0.TS[0] register 00 (TDR00)
TS0.TS[0]
TE0.TE[0]
TI00
2 2 2
1 1 1 1 1 1 1
TCR00
0x0000 0 0 0 0 0 0 0
TO00
TAUm_TMI00
Divided Divided
by 6 by 4
Figure 17.42 Example of basic timing during operation as a frequency divider (TMR00.OPIRQ = 1)
Table 17.25 to Table 17.30 show register settings and procedure for operation when a frequency divider.
Table 17.25 Example of TMR00 settings for operation as a frequency divider (1 of 2)
Bit Symbol Set value Function
Table 17.30 Procedure for operations when the frequency divider function is to be used (1 of 2)
Step Software operation Hardware state
Table 17.30 Procedure for operations when the frequency divider function is to be used (2 of 2)
Step Software operation Hardware state
Channel <3> Sets the corresponding bit of the TAU noise filter Channel stops operating.
default setting enable register (TNFEN) to 0 (off) or 1 (on). (Clock is supplied and some power is consumed.)
Sets timer mode register 00 (TMR00) (determines
operation mode of channel and selects the detection
edge).
Sets interval (period) value to timer data register 00
(TDR00).
Note: The TI0n pin input is sampled using the operating clock selected with the CKS[1:0] bits of timer mode register 0n
(TMR0n), so an error equivalent to one operation clock occurs.
When the channel start trigger bit (TS[n]) of timer channel start register 0 (TS0) is set to 1, the TCR0n register counts up
from 0x0000 in synchronization with the count clock.
When the TI0n pin input valid edge is detected, the count value of the TCR0n register is transferred (captured) to timer data
register 0n (TDR0n) and, at the same time, the TCR0n register is cleared to 0x0000, and the TAU0_TMI0n is output. If the
counter overflows at this time, the OVF bit of timer status register 0n (TSR0n) is set to 1. If the counter does not overflow,
the OVF bit is cleared. After that, the above operation is repeated.
As soon as the count value has been captured to the TDR0n register, the OVF bit of the TSR0n register is updated
depending on whether the counter overflows during the measurement period. Therefore, the overflow state of the captured
value can be checked.
If the counter reaches a full count for two or more periods, it is judged to be an overflow occurrence, and the OVF bit of the
TSR0n register is set to 1. However, a normal interval value cannot be measured for the OVF bit, if two or more overflows
occur.
Set the STS[2:0] bits of the TMR0n register to 001b to use the valid edges of TI0n as a start trigger and a capture trigger.
Instead of using the TI0n pin input, an input pulse interval can also be measured by using the timer input selected in the
TIS0 or TIS1 register or the software operation (TS0.TS[n] = 1) as a start trigger and a capture trigger.
Figure 17.43 shows a block diagram for operation for input pulse interval measurement.
Clock selection
CKm1
Operation clock*1 Timer counter
CKm0 register mn (TCRmn)
TNFEN.TNFENmn
Trigger selection
Noise Edge
TImn pin
filter detection
Timer data Interrupt
register mn (TDRmn) Interrupt signal
controller
(TAUm_TMImn)
TSm.TS[n]
Note: m = 0, n = 0 to 7
Note 1. For channels 1 and 3, the clock can be selected as CKm0, CKm1, CKm2, or CKm3.
Figure 17.43 Block diagram for operation for input pulse interval measurement
Figure 17.44 shows an example of basic timing during operation for input pulse interval measurement (TMR0n.OPIRQ =
0).
TSm.TS[n]
TEm.TE[n]
TImn
0xFFFF
b c d
TCRmn a
0x0000
TDRmn 0x0000 a b c d
TAUm_TMImn
TSRmn.OVF
Note: m = 0, n = 0 to 7
Figure 17.44 Example of basic timing during operation for input pulse interval measurement
(TMR0n.OPIRQ = 0)
Table 17.31 to Table 17.36 show register settings and procedure for operation for input pulse interval measurement.
Table 17.31 Example of TMR0n settings for operation for input pulse interval measurement
Bit Symbol Set value Function
13 — 0 Fixed to 0.
15:14 CKS[1:0] 00b Selection of the operating clock (fMCK)
to
11b 0 0: Selects CK00 as the operating clock for channel n.
0 1: Selects CK02 as the operating clock (this can only be selected for channels 1
and 3).
1 0: Selects CK01 as the operating clock for channel n.
1 1: Selects CK03 as the operating clock (this can only be selected for channels 1
and 3).
Table 17.32 Example of TO0 settings for operation for input pulse interval measurement
Bit Symbol Set value Function
Table 17.33 Example of TOE0 settings for operation for input pulse interval measurement
Bit Symbol Set value Function
Table 17.34 Example of TOL0 settings for operation for input pulse interval measurement
Bit Symbol Set value Function
n — (n = 0) 0 Fixed to 0 (channels 0)
TOL[n] (n = 1 to Control of timer output of channel n (channels 1 to 7)
7)
0: Set this bit to 0 when TOM0.TOM[n] = 0 (master channel output mode).
Table 17.35 Example of TOM0 settings for operation for input pulse interval measurement
Bit Symbol Set value Function
n — (n = 0) 0 Fixed to 0 (channels 0)
TOM[n] (n = 1 to Control of timer output mode of channel n (channels 1 to 7)
7)
0: Sets master channel output mode.
Table 17.36 Procedure for operations when the input pulse interval measurement function is to be used
Step Software operation Hardware state
By starting counting at one edge of the TI0n pin input and capturing the number of counts at another edge, the signal width
(high-level width or low-level width) of TI0n can be measured. The signal width of TI0n can be calculated by the following
expression.
Signal width of TI0n input = Period of count clock × ((0x10000 × TSR0n.OVF) + (Captured value of TDR0n + 1))
Note: The TI0n pin input is sampled using the operating clock selected with the CKS[1:0] bits of timer mode register 0n
(TMR0n), so an error equivalent to one operation clock occurs.
Timer counter register 0n (TCR0n) operates as an up counter in the capture & one-count mode.
When the channel start trigger bit (TS[n]) of timer channel start register 0 (TS0) is set to 1, the TE0.TE[n] bit is set to 1 and
the TI0n pin start edge detection wait state is set.
When the TI0n pin input start edge (rising edge of the TI0n pin input when the high-level width is to be measured) is
detected, the counter counts up from 0x0000 in synchronization with the count clock. When the valid capture edge (falling
edge of the TI0n pin input when the high-level width is to be measured) is detected later, the count value is transferred to
timer data register 0n (TDR0n) and, at the same time, TAU0_TMI0n is output. If the counter overflows at this time, the
OVF bit of timer status register 0n (TSR0n) is set to 1. If the counter does not overflow, the OVF bit is cleared. The TCR0n
register stops at the value "value transferred to the TDR0n register + 1", and the TI0n pin start edge detection wait state is
set. After that, the above operation is repeated.
As soon as the count value has been captured to the TDR0n register, the OVF bit of the TSR0n register is updated
depending on whether the counter overflows during the measurement period. Therefore, the overflow state of the captured
value can be checked.
If the counter reaches a full count for two or more periods, it is judged to be an overflow occurrence, and the OVF bit of the
TSR0n register is set to 1. However, a normal interval value cannot be measured for the OVF bit, if two or more overflows
occur.
Whether the high-level width or low-level width of the TI0n pin is to be measured can be selected by using the CIS[1:0] bits
of the TMR0n register.
Because this function is used to measure the signal width of the TI0n pin input, the TS0.TS[n] bit cannot be set to 1 while
the TE0.TE[n] bit is 1.
Instead of the TI0n pin input, the timer input selected in the TIS0 register can also be used as a start edge and a capture
edge.
CIS[1:0] of TMR0n register = 10b: Low-level width is measured.
CIS[1:0] of TMR0n register = 11b: High-level width is measured.
Figure 17.45 shows a block diagram for operation for Input Signal high- or low-level width measurement.
Clock selection
CKm1
Operation clock*1 Timer counter
CKm0 register mn (TCRmn)
TNFEN.TNFENmn
Trigger selection
Note: m = 0, n = 0 to 7
Note 1. For channels 1 and 3, the clock can be selected as CKm0, CKm1, CKm2, or CKm3.
Figure 17.45 Block diagram for operation for input signal high- or low-level width measurement
Figure 17.46 shows an example of basic timing during operation for input signal high- or low-level width measurement.
TSm.TS[n]
TEm.TE[n]
TImn
0xFFFF
a
TCRmn b
c
0x0000
TDRmn 0x0000 a b c
TAUm_TMImn
TSRmn.OVF
Note: m = 0, n = 0 to 7
Figure 17.46 Example of basic timing during operation for input signal high- or low-level width
measurement
Table 17.37 to Table 17.42 show register settings and procedure for operation for input signal high- or low-level width
measurement.
Table 17.37 Example of TMR0n settings for operation for input signal high- or low-level width
measurement (1 of 2)
Bit Symbol Set value Function
13 — 0 Fixed to 0.
Table 17.37 Example of TMR0n settings for operation for input signal high- or low-level width
measurement (2 of 2)
Bit Symbol Set value Function
Table 17.38 Example of TO0 settings for operation for input signal high- or low-level width measurement
Bit Symbol Set value Function
Table 17.39 Example of TOE0 settings for operation for input signal high- or low-level width
measurement
Bit Symbol Set value Function
Table 17.40 Example of TOL0 settings for operation for input signal high- or low-level width
measurement
Bit Symbol Set value Function
n — (n = 0) 0 Fixed to 0 (channels 0)
TOL[n] (n = 1 to Control of timer output of channel n (channels 1 to 7)
7)
0: Set this bit to 0 when TOM0.TOM[n] = 0 (master channel output mode).
Table 17.41 Example of TOM0 settings for operation for input signal high- or low-level width
measurement
Bit Symbol Set value Function
n — (n = 0) 0 Fixed to 0 (channels 0)
TOM[n] (n = 1 to Control of timer output mode of channel n (channels 1 to 7)
7)
0: Sets master channel output mode.
Table 17.42 Procedure for operations when the input signal high- or low-level width measurement function is to
be used (1 of 2)
Step Software operation Hardware state
Table 17.42 Procedure for operations when the input signal high- or low-level width measurement function is to
be used (2 of 2)
Step Software operation Hardware state
Operation <4> Sets TS0.TS[n] bit to 1. TE0.TE[n] = 1, and the TI0n pin start edge detection
start The TS0.TS[n] bit automatically returns to 0 because → wait state is set.
it is a trigger bit.
<5> Detects the TI0n pin input count start valid edge. Clears timer counter register 0n (TCR0n) to 0x0000
→
and starts counting up.
During <6> Set value of the TDR0n register can always be read. When the TI0n pin start edge is detected, the counter
operation The TCR0n register can always be read. (TCR0n) counts up from 0x0000. If a capture edge
The TSR0n register can always be read. of the TI0n pin is detected, the count value is
Set values of the TMR0n register, TOM0.TOM[n], transferred to timer data register 0n (TDR0n) and
TOL0.TOL[n], TO0.TO[n], and TOE0.TOE[n] bits TAU0_TMI0n is generated.
cannot be changed. If an overflow occurs at this time, the OVF bit of timer
status register 0n (TSR0n) is set; if an overflow does
not occur, the OVF bit is cleared. The TCR0n register
stops the count operation until the next TI0n pin start
edge is detected.
Operation <7> The TT0.TT[n] bit is set to 1. TE0.TE[n] = 0, and count operation stops.
stop The TT0.TT[n] bit automatically returns to 0 because The TCR0n register holds count value and stops.
it is a trigger bit. → The OVF bit of the TSR0n register is also held.
To resume operation, go to step <4>.
To terminate the operation, go to step <8>
TAU stop <8> Sets the MSTPD0 bit of Module Stop Control This stops supply of the input clock to timer array unit
Register D (MSTPCRD) to 1. → 0.
Power-off state.
Note: n = 0 to 7
Clock selection
CKm1
Operation clock*1 Timer counter
CKm0 register mn (TCRmn)
Trigger selection
TSm.TS[n]
TNFEN.TNFENmn
Timer data Interrupt Interrupt signal
Noise register mn (TDRmn) controller (TAUm_TMImn)
Edge
TImn pin
filter detection
Note: m = 0, n = 0 to 7
Note 1. For channels 1 and 3, the clock can be selected as CKm0, CKm1, CKm2, or CKm3.
TSm.TS[n]
TEm.TE[n]
TImn
0xFFFF
TCRmn
0x0000
TDRmn a b
TAUm_TMImn
a+1 b+1
Note: m = 0, n = 0 to 7
11 — (n = 0, 5, 7) 0 Fixed to 0 (channels 0, 5, 7)
SPLIT (n = 1, 3) 1/0 Setting of SPLIT bit (channels 1, 3)
0: 16-bit timer mode
1: 8-bit timer mode
MASTER (n = 2, 0 Setting of MASTER bit (channels 2, 4, 6)
4, 6)
0: Independent channel operation function.
12 CCS 0 Count clock selection
0: Selects operation clock (fMCK).
13 — 0 Fixed to 0.
15:14 CKS[1:0] 00b Selection of the operating clock (fMCK)
to
11b 0 0: Selects CK00 as the operating clock for channel n
0 1: Selects CK02 as the operating clock (this can only be selected for channels 1
and 3)
1 0: Selects CK01 as the operating clock for channel n
1 1: Selects CK03 as the operating clock (this can only be selected for channels 1
and 3)
n — (n = 0) 0 Fixed to 0 (channels 0)
TOL[n] (n = 1 to Control of timer output of channel n (channels 1 to 7)
7)
0: Set this bit to 0 when TOM0.TOM[n] = 0 (master channel output mode)
n — (n = 0) 0 Fixed to 0 (channels 0)
TOM[n] (n = 1 to Control of timer output mode of channel n (channels 1 to 7)
7)
0: Sets master channel output mode.
Table 17.48 Procedure for operations when the delay counter function is to be used
Step Software operation Hardware state
master channel) is detected. The output level of TO0p becomes active one count clock after generation of TAU0_TMI0n
from the master channel, and inactive when TCR0p = 0x0000.
Instead of using the TI0n pin input, a one-shot pulse can also be output using the software operation (TS0.TS[n] = 1) as a
start trigger.
Note: The timing of loading of timer data register 0n (TDR0n) of the master channel is different from that of the TDR0p
register of the slave channel. If the TDR0n and TDR0p registers are rewritten during operation, therefore, an illegal
waveform is output. Rewrite the TDR0n register after TAU0_TMI0n is generated and the TDR0p register after
TAU0_TMI0p is generated.
Figure 17.49 shows a block diagram for operation for the one-shot pulse output function.
Master channel
(one-count mode)
Clock selection
CKm1
Operation clock Timer counter
CKm0 register mn (TCRmn)
Trigger selection
TNFEN.TNFENmn
TSm.TS[n]
Timer data Interrupt
register mn (TDRmn) Interrupt signal
Noise Edge controller
TImn pin (TAUm_TMImn)
filter detection
Slave channel
(one-count mode)
Clock selection
CKm1
Operation clock Timer counter Output
CKm0 register mp (TCRmp) controller TOmp pin
Trigger selection
Figure 17.49 Block diagram for operation for the one-shot pulse output function
Figure 17.50 shows an example of basic timing during operation for the one-shot pulse output function.
TSm.TS[n]
TEm.TE[n]
TImn
Master 0xFFFF
channel
TCRmn
0x0000
TDRmn a
TOmn
TAUm_TMImn
TSm.TS[p]
TEm.TE[p]
0xFFFF
TCRmp
Slave 0x0000
channel
TDRmp b
TOmp
TAUm_TMImp
a+2 b a+2 b
Figure 17.50 Example of basic timing during operation for the one-shot pulse output function
Table 17.49 to Table 17.53 show register settings for the master channel when the one-shot pulse output function is to be
used.
Table 17.49 Example of TMR0n settings for the master channel when the one-shot pulse output function is to be
used (1 of 2)
Bit Symbol Set value Function
Table 17.49 Example of TMR0n settings for the master channel when the one-shot pulse output function is to be
used (2 of 2)
Bit Symbol Set value Function
11 — (n = 0) 0 Fixed to 0 (channels 0)
MASTER (n = 2, 1 Setting of MASTER bit (channels 2, 4, 6)
4, 6)
1: Master channel
12 CCS 0 Count clock selection
0: Selects operation clock (fMCK).
13 — 0 Fixed to 0.
15:14 CKS[1:0] 00b Selection of the operating clock (fMCK)
or
10b 0 0: Selects CK00 as the operating clock for channel n
1 0: Selects CK01 as the operating clock for channel n
Table 17.50 Example of TO0 settings for the master channel when the one-shot pulse output function is to be
used
Bit Symbol Set value Function
Table 17.51 Example of TOE0 settings for the master channel when the one-shot pulse output function is to be
used
Bit Symbol Set value Function
Table 17.52 Example of TOL0 settings for the master channel when the one-shot pulse output function is to be
used
Bit Symbol Set value Function
n — (n = 0) 0 Fixed to 0 (channels 0)
TOL[n] (n = 2, 4, Control of timer output of channel n (channels 2, 4, 6)
6)
0: Set this bit to 0 when TOM0.TOM[n] = 0 (master channel output mode)
Table 17.53 Example of TOM0 settings for the master channel when the one-shot pulse output function is to be
used
Bit Symbol Set value Function
n — (n = 0) 0 Fixed to 0 (channels 0)
TOM[n] (n = 2, 4, Control of timer output mode of channel n (channels 2, 4, 6)
6)
0: Sets master channel output mode
Table 17.54 to Table 17.58 show register settings for the slave channel when the one-shot pulse output function is to be
used.
Table 17.54 Example of TMR0p settings for the slave channel when the one-shot pulse output function is to be
used (1 of 2)
Bit Symbol Set value Function
Table 17.54 Example of TMR0p settings for the slave channel when the one-shot pulse output function is to be
used (2 of 2)
Bit Symbol Set value Function
13 — 0 Fixed to 0.
15:14 CKS[1:0] 00b Selection of the operating clock (fMCK) (Make the same setting as master channel.)
or
10b 0 0: Selects CK00 as the operating clock for channel .
1 0: Selects CK01 as the operating clock for channel p
Table 17.55 Example of TO0 settings for the slave channel when the one-shot pulse output function is to be
used
Bit Symbol Set value Function
Table 17.56 Example of TOE0 settings for the slave channel when the one-shot pulse output function is to be
used
Bit Symbol Set value Function
Table 17.57 Example of TOL0 settings for the slave channel when the one-shot pulse output function is to be
used
Bit Symbol Set value Function
Table 17.58 Example of TOM0 settings for the slave channel when the one-shot pulse output function is to be
used
Bit Symbol Set value Function
Table 17.59 show procedure for operations when the one-shot pulse output function is to be used.
Table 17.59 Procedure for operations when the one-shot pulse output function is to be used (1 of 2)
Step Software operation Hardware state
Table 17.59 Procedure for operations when the one-shot pulse output function is to be used (2 of 2)
Step Software operation Hardware state
Operation <8> The TT0.TT[n] (master) and TT[p] (slave) bits are set TE0.TE[n], TE[p] = 0, and count operation stops.
stop to 1 at the same time. The TCR0n and TCR0p registers hold count value
The TT0.TT[n] and TT[p] bits automatically return to → and stop.
0 because they are trigger bits. The TO0p output is not initialized and retains its
current state.
<9> The TOE0.TOE[p] bit of slave channel is cleared to 0 The TO0p pin outputs the TO0p set level.
and value is set to the TO0.TO[p] bit.
→
To resume operation, go to step <5>.
To terminate the operation, go to step <10>
TAU stop <10> To hold the TO0p pin output level The TO0p pin output level is held by port function
Set PSEL[2:0] bits to 000b after the value to be held
is set to the Prs Output Data Register (PODRr).
→
When holding the TO0p pin output level is not
necessary
Setting not required.
<11> Sets the MSTPD0 bit of Module Stop Control This stops supply of the input clock to timer array unit
Register D (MSTPCRD) to 1. → 0.
Power-off state.
Note 1. Do not set the TS0.TS[n] bit of the slave channel to 1.
Note: The duty factor exceeds 100% if the set value of TDR0p (slave) > (set value of TDR0n (master) + 1), it summarizes
to 100% output.
The master channel operates in the interval timer mode. If the channel start trigger bit (TS[n]) of timer channel start register
0 (TS0) is set to 1, an interrupt (TAU0_TMI0n) is output, the value set to timer data register 0n (TDR0n) is loaded to
timer counter register 0n (TCR0n), and the counter counts down in synchronization with the count clock. When the counter
reaches 0x0000, TAU0_TMI0n is output, the value of the TDR0n register is loaded again to the TCR0n register, and the
counter counts down. This operation is repeated until the channel stop trigger bit (TT[n]) of timer channel stop register 0
(TT0) is set to 1.
If two channels are used to output a PWM waveform, the period until the master channel counts down to 0x0000 is the
PWM output (TO0p) cycle.
The slave channel operates in one-count mode. By using TAU0_TMI0n from the master channel as a start trigger, the
TCR0p register loads the value of the TDR0p register and the counter counts down to 0x0000. When the counter reaches
0x0000, it outputs TAU0_TMI0p and waits until the next start trigger (TAU0_TMI0n from the master channel) is generated.
If two channels are used to output a PWM waveform, the period until the slave channel counts down to 0x0000 is the PWM
output (TO0p) duty.
PWM output (TO0p) goes to the active level one clock after the master channel generates TAU0_TMI0n and goes to the
inactive level when the TCR0p register of the slave channel becomes 0x0000.
In the 16-pin products, this function can be used by setting channels 0 and 2 as the master channel and the slave channel,
respectively.
Note: To rewrite both timer data register 0n (TDR0n) of the master channel and the TDR0p register of the slave channel,
a write access is necessary two times. The timing at which the values of the TDR0n and TDR0p registers are
loaded to the TCR0n and TCR0p registers is upon occurrence of TAU0_TMI0n of the master channel. Thus, when
rewriting is performed split before and after occurrence of TAU0_TMI0n of the master channel, the TO0p pin cannot
output the expected waveform. To rewrite both the TDR0n register of the master and the TDR0p register of the
slave, therefore, be sure to rewrite both the registers immediately after TAU0_TMI0n is generated from the master
channel.
Figure 17.51 shows a block diagram for operation for the PWM function
Master channel
(interval timer mode)
Clock selection
CKm1
Operation clock Timer counter
CKm0 register mn (TCRmn)
Trigger selection
Slave channel
(one-count mode)
Clock selection
CKm1
Operation clock Timer counter Output
CKm0 register mp (TCRmp) controller TOmp pin
Trigger selection
Note: m=0
n = 0, 2, 4, 6 (master channel number)
n < p ≤ 7 (Slave channel number)
Figure 17.51 Block diagram for operation for the PWM function
Figure 17.52 shows an example of basic timing during operation for the PWM function.
TSm.TS[n]
TEm.TE[n]
0xFFFF
Master
TCRmn
channel 0x0000
TDRmn a b
TOmn
TAUm_TMImn
TSm.TS[p]
TEm.TE[p]
0xFFFF
TCRmp
Slave 0x0000
channel
TDRmp c d
TOmp
TAUm_TMImp
Note: m=0
n = 0, 2, 4, 6 (master channel number)
n < p ≤ 7 (Slave channel number)
Figure 17.52 Example of basic timing during operation for the PWM function
Table 17.60 to Table 17.64 show register settings for the master channel when the PWM function is to be used.
Table 17.60 Example of TMR0n settings for the master channel when the PWM function is to be used (1 of 2)
Bit Symbol Set value Function
13 — 0 Fixed to 0.
Table 17.60 Example of TMR0n settings for the master channel when the PWM function is to be used (2 of 2)
Bit Symbol Set value Function
Table 17.61 Example of TO0 settings for the master channel when the PWM function is to be used
Bit Symbol Set value Function
Table 17.62 Example of TOE0 settings for the master channel when the PWM function is to be used
Bit Symbol Set value Function
Table 17.63 Example of TOL0 settings for the master channel when the PWM function is to be used
Bit Symbol Set value Function
n — (n = 0) 0 Fixed to 0 (channels 0)
TOL[n] (n = 2, 4, Control of timer output of channel n (channels 2, 4, 6)
6)
0: Set this bit to 0 when TOM0.TOM[n] = 0 (master channel output mode).
Table 17.64 Example of TOM0 settings for the master channel when the PWM function is to be used
Bit Symbol Set value Function
n — (n = 0) 0 Fixed to 0 (channels 0)
TOM[n] (n = 2, 4, Control of timer output mode of channel n (channels 2, 4, 6)
6)
0: Sets master channel output mode.
Table 17.65 to Table 17.69 show register settings for the slave channel when the PWM function is to be used.
Table 17.65 Example of TMR0p settings for the slave channel when the PWM function is to be used (1 of 2)
Bit Symbol Set value Function
Table 17.65 Example of TMR0p settings for the slave channel when the PWM function is to be used (2 of 2)
Bit Symbol Set value Function
13 — 0 Fixed to 0.
15:14 CKS[1:0] 00b Selection of the operating clock (fMCK) (Make the same setting as master channel.)
or
10b 0 0: Selects CK00 as the operating clock for channel p
1 0: Selects CK01 as the operating clock for channel p
Table 17.66 Example of TO0 settings for the slave channel when the PWM function is to be used
Bit Symbol Set value Function
Table 17.67 Example of TOE0 settings for the slave channel when the PWM function is to be used
Bit Symbol Set value Function
Table 17.68 Example of TOL0 settings for the slave channel when the PWM function is to be used
Bit Symbol Set value Function
Table 17.69 Example of TOM0 settings for the slave channel when the PWM function is to be used
Bit Symbol Set value Function
Table 17.70 show procedure for operations when the PWM function is to be used.
Table 17.70 Procedure for operations when the PWM function is to be used (1 of 2)
Step Software operation Hardware state
Table 17.70 Procedure for operations when the PWM function is to be used (2 of 2)
Step Software operation Hardware state
Channel <3> Sets timer mode register 0n, 0p (TMR0n, TMR0p) of Channel stops operating.
default setting two channels to be used (determines operation mode (Clock is supplied and some power is consumed.)
of channels).
An interval (period) value is set to timer data register
0n (TDR0n) of the master channel, and a duty factor
is set to the TDR0p register of the slave channel.
<4> Sets slave channel. The TO0p pin goes into Hi-Z output state.
The TOM0.TOM[p] bit of timer output mode register 0
(TOM0) is set to 1 (slave channel output mode).
Sets the TOL0.TOL[p] bit.
Sets the TO0.TO[p] bit and determines default level The TO0p default setting level is output when the Prs
→
of the TO0p output. Direction Register (PDRr) is in output mode.
Sets the TOE0.TOE[p] bit to 1 and enables operation TO0p does not change because channel stops
→
of TO0p. operating.
Sets the Prs Direction Register (PDRr) to 1. → The TO0p pin outputs the TO0p set level.
Operation <5> Sets the TOE0.TOE[p] bit (slave) to 1 (only when TE0.TE[n] = 1, TE0.TE[p] = 1
start operation is resumed). When the master channel starts counting,
The TS[n] (master) and TS[p] (slave) bits of timer TAU0_TMI0n is generated. Triggered by this
channel start register 0 (TS0) are set to 1 at the → interrupt, the slave channel also starts counting.
same time.
The TS0.TS[n] and TS[p] bits automatically return to
0 because they are trigger bits.
During <6> Set values of the TMR0n and TMR0p registers, The counter of the master channel loads the TDR0n
operation TOM0.TOM[n], TOM[p], TOL0.TOL[n], and TOL[p] register value to timer counter register 0n (TCR0n),
bits cannot be changed. and counts down. When the count value reaches
Set values of the TDR0n and TDR0p registers can be TCR0n = 0x0000, TAU0_TMI0n output is generated.
changed after TAU0_TMI0n of the master channel is At the same time, the value of the TDR0n register is
generated. loaded to the TCR0n register, and the counter starts
The TCR0n and TCR0p registers can always be counting down again.
read. The TSR0n and TSR0p registers are not used. At the slave channel, the value of the TDR0p
register is loaded to the TCR0p register, triggered by
TAU0_TMI0n of the master channel, and the counter
starts counting down. The output level of TO0p
becomes active one count clock after generation of
theTAU0_TMI0n output from the master channel. It
becomes inactive when TCR0p = 0x0000, and the
counting operation is stopped.
After that, the above operation is repeated.
Operation <7> The TT0.TT[n] (master) and TT[p] (slave) bits are set TE0.TE[n], TE[p] = 0, and count operation stops.
stop to 1 at the same time. The TCR0n and TCR0p registers hold count value
The TT0.TT[n] and TT[p] bits automatically return to → and stop.
0 because they are trigger bits. The TO0p output is not initialized and retains its
current state.
<8> The TOE0.TOE[p] bit of slave channel is cleared to 0 The TO0p pin outputs the TO0p set level.
and value is set to the TOm.TO[p] bit.
→
To resume operation, go to step <5>.
To terminate the operation, go to step <9>
TAU stop <9> To hold the TO0p pin output level The TO0p pin output level is held by port function
Set PSEL[2:0] bits to 000b after the value to be held
is set to the Prs Output Data Register (PODRr).
→
When holding the TO0p pin output level is not
necessary
Setting not required.
<10> Sets the MSTPD0 bit of Module Stop Control This stops supply of the input clock to timer array unit
Register D (MSTPCRD) to 1. → 0.
Power-off state.
Note: n = 0, 2, 4, 6 (Master channel number)
n < p ≤ 7 (Slave channel number)
r = 0 to 9
s = 00 to 15
Note: Although the duty factor exceeds 100% if the set value of TDR0p (slave 1) > {set value of TDR0n (master) + 1} or if
the {set value of TDR0q (slave 2)} > {set value of TDR0n (master) + 1}, it is summarized into 100% output.
Timer counter register 0n (TCR0n) of the master channel operates in the interval timer mode and counts the periods. The
TCR0p register of the slave channel 1 operates in one-count mode, counts the duty factor, and outputs a PWM waveform
from the TO0p pin. The TCR0p register loads the value of timer data register 0p (TDR0p), using TAU0_TMI0n of the
master channel as a start trigger, and starts counting down. When TCR0p = 0x0000, TCR0p outputs TAU0_TMI0p and
stops counting until the next start trigger (TAU0_TMI0n of the master channel) has been input. The output level of TO0p
becomes active one count clock after generation of TAU0_TMI0n from the master channel, and inactive when TCR0p =
0x0000.
In the same way as the TCR0p register of the slave channel 1, the TCR0q register of the slave channel 2 operates in
one-count mode, counts the duty factor, and outputs a PWM waveform from the TO0q pin. The TCR0q register loads the
value of the TDR0q register, using TAU0_TMI0n of the master channel as a start trigger, and starts counting down.
When TCR0q = 0x0000, the TCR0q register outputs TAU0_TMI0q and stops counting until the next start trigger
(TAU0_TMI0n of the master channel) has been input. The output level of TO0q becomes active one count clock after
generation of TAU0_TMI0n from the master channel, and inactive when TCR0q = 0x0000.
When channel 0 is used as the master channel as above, up to seven types of PWM signals can be output at the same time.
Note: To rewrite both timer data register 0n (TDR0n) of the master channel and the TDR0p register of the slave channel
1, write access is necessary at least twice. Since the values of the TDR0n and TDR0p registers are loaded to the
TCR0n and TCR0p registers after TAU0_TMI0n is generated from the master channel, if rewriting is performed
separately before and after generation of TAU0_TMI0n from the master channel, the TO0p pin cannot output the
expected waveform. To rewrite both the TDR0n register of the master and the TDR0p register of the slave, be sure
to rewrite both the registers immediately after TAU0_TMI0n is generated from the master channel (This applies also
to the TDR0q register of the slave channel 2).
Figure 17.53 shows a block diagram for operation for the multiple PWM output function (for two types of PWM output).
Master channel
(interval timer mode)
Clock selection
CKm1
Operation clock Timer counter
CKm0 register mn (TCRmn)
Trigger selection
Timer data Interrupt
TSm.TS[n] register mn (TDRmn) controller Interrupt signal
(TAUm_TMImn)
Slave channel 1
(one-count mode)
Clock selection
CKm1
Operation clock Timer counter Output
CKm0 register mp (TCRmp) controller TOmp pin
Trigger selection
Slave channel 2
(one-count mode)
Clock selection
CKm1
Operation clock Timer counter Output
CKm0 register mq (TCRmq) controller TOmq pin
Trigger selection
Note: m=0
n = 0, 2, 4 (Master channel number)
p, q: Slave channel number
n < p < q ≤ 7 (Where p and q are integers greater than n)
Figure 17.53 Block diagram for the multiple PWM output function (for two types of PWM output)
Figure 17.54 shows an example of basic timing during operation for the multiple PWM output function (for two types of
PWM output).
TSm.TS[n]
TEm.TE[n]
0xFFFF
Master
TCRmn
channel 0x0000
TDRmn a b
TOmn
TAUm_TMImn
TSm.TS[p]
TEm.TE[p]
0xFFFF
TCRmp
Slave 0x0000
channel 1
TDRmp c d
TOmp
TAUm_TMImp
TEm.TE[q]
0xFFFF
TCRmq
Slave 0x0000
channel 2
TDRmq e f
TOmq
TAUm_TMImq
Note: m=0
n = 0, 2, 4 (Master channel number)
p, q: Slave channel number
n < p < q ≤ 7 (Where p and q are integers greater than n)
Note: TSm.TS[n], TSmp, TSmq: Bits n, p, and q of timer channel start register m (TSm)
TEmn, TEmp, TEmq: Bits n, p, and q of timer channel enable status register m (TEm)
TCRmn, TCRmp, TCRmq: Timer counter registers mn, mp, mq (TCRmn, TCRmp, TCRmq)
TDRmn, TDRmp, TDRmq: Timer data registers mn, mp, mq (TDRmn, TDRmp, TDRmq)
TOmn, TOmp, TOmq: Signals on the TOmn, TOmp, and TOmq output pins
Figure 17.54 Example of basic timing during operation for the multiple PWM output function (for two types
of PWM output)
Table 17.71 to Table 17.75 show register settings for the master channel when the multiple PWM output function is to be
used.
Table 17.71 Example of TMR0n settings for the master channel when the multiple PWM output function is to be
used
Bit Symbol Set value Function
13 — 0 Fixed to 0.
15:14 CKS[1:0] 00b Selection of the operating clock (fMCK)
or
10b 0 0: Selects CK00 as the operating clock for channel n
1 0: Selects CK01 as the operating clock for channel n
Table 17.72 Example of TO0 settings for the master channel when the multiple PWM output function is to be
used
Bit Symbol Set value Function
Table 17.73 Example of TOE0 settings for the master channel when the multiple PWM output function is to be
used
Bit Symbol Set value Function
Table 17.74 Example of TOL0 settings for the master channel when the multiple PWM output function is to be
used
Bit Symbol Set value Function
n — (n = 0) 0 Fixed to 0 (channels 0)
TOL[n] (n = 2, 4) Control of timer output of channel n (channels 2, 4)
0: Set this bit to 0 when TOM0.TOM[n] = 0 (master channel output mode).
Table 17.75 Example of TOM0 settings for the master channel when the multiple PWM output function is to be
used
Bit Symbol Set value Function
n — (n = 0) 0 Fixed to 0 (channels 0)
TOM[n] (n = 2, 4) Control of timer output mode of channel n (channels 2, 4)
0: Sets master channel output mode.
Table 17.76 to Table 17.81 show register settings for the slave channel when the multiple PWM output function is to be used
(for two types of PWM output).
Table 17.76 Example of TMR0p settings for the slave channel when the multiple PWM output function is to be
used (for two types of PWM output)
Bit Symbol Set value Function
13 — 0 Fixed to 0.
15:14 CKS[1:0] 00b Selection of the operating clock (fMCK) (make the same setting as master channel.)
or
10b 0 0: Selects CK00 as the operating clock for channel p
1 0: Selects CK01 as the operating clock for channel p
Table 17.77 Example of TMR0q settings for the slave channel when the multiple PWM output function is to be
used (for two types of PWM output) (1 of 2)
Bit Symbol Set value Function
Table 17.77 Example of TMR0q settings for the slave channel when the multiple PWM output function is to be
used (for two types of PWM output) (2 of 2)
Bit Symbol Set value Function
13 — 0 Fixed to 0.
15:14 CKS[1:0] 00b Selection of the operating clock (fMCK) (make the same setting as master channel.)
or
10b 0 0: Selects CK00 as the operating clock for channel q
1 0: Selects CK01 as the operating clock for channel q
Table 17.78 Example of TO0 settings for the slave channel when the multiple PWM output function is to be used
(for two types of PWM output)
Bit Symbol Set value Function
Table 17.79 Example of TOE0 settings for the slave channel when the multiple PWM output function is to be used
(for two types of PWM output)
Bit Symbol Set value Function
Table 17.80 Example of TOL0 settings for the slave channel when the multiple PWM output function is to be used
(for two types of PWM output)
Bit Symbol Set value Function
Table 17.81 Example of TOM0 settings for the slave channel when the multiple PWM output function is to be
used (for two types of PWM output)
Bit Symbol Set value Function
Table 17.82 show procedure for operations when the PWM function is to be used.
Table 17.82 Procedure for operations when the multiple PWM output function is to be used (for two types of
PWM output) (1 of 2)
Step Software operation Hardware state
Table 17.82 Procedure for operations when the multiple PWM output function is to be used (for two types of
PWM output) (2 of 2)
Step Software operation Hardware state
Operation <7> The TT0.TT[n] bit (master), TT[p], and TT[q] (slave) TE0.TE[n], TE[p], TE[q] = 0, and count operation
stop bits are set to 1 at the same time. stops. The TCR0n, TCR0p and TCR0q registers hold
The TT0.TT[n], TT[p] and TT[q] bits automatically → count value and stop.
return to 0 because they are trigger bits. The TO0p and TO0q outputs are not initialized and
retain their current states.
<8> The TOE0.TOE[p], and TOE[q] bits of slave channels The TO0p and TO0q pins output the TO0p and TO0q
are cleared to 0 and value is set to the TO0.TO[p] set levels.
and TO[q] bits. →
To resume operation, go to step <5>.
To terminate the operation, go to step <9>
TAU stop <9> To hold the TO0p pin and TO0q pin output levels The TO0p pin and TO0q pin output levels are held by
Set PSEL[2:0] bits to 000b after the value to be held port function
is set to the Prs Output Data Register (PODRr).
→
When holding the TO0p pin output level is not
necessary
Setting not required.
<10> Sets the MSTPD0 bit of Module Stop Control This stops supply of the input clock to timer array unit
Register D (MSTPCRD) to 1. → 0.
Power-off state.
Note: n = 0, 2, 4 (Master channel number)
p, q: Slave channel number
n < p < q ≤ 7 (Where p and q are integers greater than n)
r = 0 to 9
s = 00 to 15
17.9.2 Point for Caution when a Timer Output is to be Used as an Event Input for the ELC
The timer outputs (TO00 to TO03) of channels 0 to 3 of timer array unit 0 can be used as event inputs for the event link
controller (ELC).
Figure 18.3 Image of the 16-bit interval timer and 16-bit capture function
INTITLC
CAPEN FF
01b
FSXP fITL2
10b Edge detection Data bus
Event input from ELC 11b MKF0C TML32_ITL_OR
CAPR 00b
FDIV0[2:0]
EN0 ITLCMP00 (8 lower-order bits) INTITL0 ITF0C ITF03 ITF02 ITF01 ITF00
1/128
111b Clear
CTRS[1:0] 1/64
110b Count operation
1/32 ITL000 (8 bits)
101b controller
1/16
ISEL[2:0] 100b
1/8
011b
1/4 ITLCAP00 (8 lower-order bits)
010b
MKF00
1/2
001b Channel 0 8-bit counter mode
Event input from ELC 101b 1/1
FSXP 100b fITL0 000b
TML32_ITL0
MOSC 011b Divider 16-bit counter FF
MOCO 010b FDIV1[2:0]
Data bus mode (ELC)
1/1, 1/2, 1/4, 1/8,
HOCO 001b 1/16, 1/32, 1/64, 1/128 MD[1:0] Trigger signal for the
1/128 32-bit counter A/D converter (ADITL0)
1/64
111b EN1 ITLCMP00 (8 higher-order bits) INTITL1 mode
1/32
110b
10b 8-bit counter
TML32_ITL1
101b Clear FF
1/16
100b 01b
mode
(ELC)
1/8 00b Count operation
CSEL[2:0] ITL001 (8 bits)
MKF01
1/4
011b controller
1/2
010b
001b
Event input from ELC 101b 1/1 ITLCAP00 (8 higher-order bits)
000b
FSXP 100b Channel 1
fITL1
MOSC 011b
MOCO 010b FDIV2[2:0]
HOCO 001b MD[1:0],CAPEN Data bus
MKF02
1/128
1/64
111b 8-bit counter TML32_ITL2
110b 100b mode FF
(ELC)
1/32 INTITL2
101b 010b EN2 ITLCMP01 (8 lower-order bits)
1/16 100b 000b 16-bit counter
1/8 xx1b Clear mode
011b
1/4
010b Count operation
1/2 controller ITL012 (8 bits)
001b Channel 2
1/1 000b
TML32_ITL3
8-bit counter mode FF
Data bus (ELC)
FDIV3[2:0] MD[1:0],CAPEN
MKF03
1/128
111b INTITL3
1/64 100b EN3 ITLCMP01 (8 higher-order bits)
110b
1/32 010b
101b 000b Clear
1/16 ITLMKF0
100b Count operation
1/8
011b xx1b ITL013 (8 bits)
1/4 controller
010b
1/2
001b Channel 3
1/1
000b
Note: In 16-bit counter mode, the counters in channels 0 and 1 are connected (ITL000 + ITL001) and the counters in
channels 2 and 3 are connected (ITL012 + ITL013).
In 32-bit counter mode, the counters in channels 0 to 3 are connected (ITL000 + ITL001 + ITL012 + ITL013).
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit field:
15:0 n/a Comparison Data of 16-bit Counter (ITL0n) and 8-bit Counter (ITL0n_H/ITL0n_L) are Stored R/W
The ITLCMP00 is compared with ITL00 (ITL000 + ITL001).
The ITLCMP01 is compared with ITL01 (ITL012 + ITL013).
Note: Write to the ITLCMP0n_H and ITLCMP0n_L registers while the settings of the EN0 to EN3 bits in the ITLCTL0 register are 0,
respectively.
Note: Write to the ITLCMP00 register while the IEN0 bit in the ITLCTL0 register is 0. Write to the ITLCMP01 register while the EN2 bit in
the ITLCTL0 register is 0 in 16-bit counter mode or while the EN0 bit in the ITLCTL0 register is 0 in 32-bit counter mode.
Interval Timer Compare Registers (ITLCMP0n/ITLCMP0n_L/ITLCMP0n_H) is compare value registers used in 8-bit,
16-bit, or 32-bit counter mode. ITLCMP0n_L (ITLCMP0n[7:0]) and ITLCMP0n_H (ITLCMP0n[15:8]) used in 8-bit
counter mode.
A value from 0x0001 to 0xFFFF can be specified. Setting these registers to 0x0000 is prohibited.
These registers hold values to be compared with the ITL0n counter values.
When the ITLCTL0.MD[1:0] bits are set to 10b, these registers are used as compare registers in 32-bit counter mode.
Specify the upper 16-bit compare value in the ITLCMP01 register and the lower 16-bit compare value in the ITLCMP00
register.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
This register holds 16-bit captured values when the interval timers are operating in 16-bit capture mode.
The values of the 16-bit counters (ITL000 + ITL001) are stored in the ITLCAP00 register in response to the capture trigger
selected in the ITLCC0 register when the CAPEN bit in the ITLCC0 register is 1.
When an interrupt on compare match with the ITLCMP01 register is to be used, select the counter clock in the ITLCSEL0
register and set the comparison value in the ITLCMP01 register.
Bit position: 7 6 5 4 3 2 1 0
EN0 bit (8-bit Counter Mode: ITL000 Count Enable, 16-bit Counter Mode: ITL000 + ITL001 Count Enable,
32-bit Counter Mode: ITL000 + ITL001 + ITL012 + ITL013 Count Enable)
In 8-bit counter mode, writing 1 to this bit starts up-counting in the ITL000 counter and writing 0 stops it.
In 16-bit counter mode, writing 1 to this bit starts up-counting in the ITL000 + ITL001 counter and writing 0 stops it.
In 32-bit counter mode, writing 1 to this bit starts up-counting in the ITL000 + ITL001 + ITL012 + ITL013 counter and
writing 0 stops it.
EN2 bit (8-bit Counter Mode: ITL012 Count Enable, 16-bit Counter Mode: ITL012 + ITL013 Count Enable)
In 8-bit counter mode, writing 1 to this bit starts up-counting in the ITL012 counter and writing 0 stops it.
In 16-bit counter mode, writing 1 to this bit starts up-counting in the ITL012 + ITL013 counter and writing 0 stops it.
In 32-bit counter mode, set this bit to 0.
Bit position: 7 6 5 4 3 2 1 0
Bit position: 7 6 5 4 3 2 1 0
2:0 FDIV0[2:0] 8-bit Counter Mode: Counter Clock for ITL000*1 R/W
16-bit Counter Mode: Counter Clock for ITL000 + ITL001*1
32-bit Counter Mode: Counter Clock for ITL000 + ITL001 + ITL012 + ITL013*1
0 0 0: fITL0
0 0 1: fITL0/2
0 1 0: fITL0/4
0 1 1: fITL0/8
1 0 0: fITL0/16
1 0 1: fITL0/32
1 1 0: fITL0/64
1 1 1: fITL0/128
3 — This bit is read as 0. The write value should be 0. R/W
6:4 FDIV1[2:0] 8-bit Counter Mode: Counter Clock for ITL001*2 R/W
0 0 0: fITL0
0 0 1: fITL0/2
0 1 0: fITL0/4
0 1 1: fITL0/8
1 0 0: fITL0/16
1 0 1: fITL0/32
1 1 0: fITL0/64
1 1 1: fITL0/128
7 — This bit is read as 0. The write value should be 0. R/W
Note 1. Be sure to write to the FDIV0[2:0] bits only while the ITLCTL0.EN0 bit is 0.
Note 2. In 8-bit counter mode, be sure to write to the FDIV1[2:0] bits only while the ITLCTL0.EN1 bit is 0.
This register is used to select the counter clock for the interval timer.
FDIV0[2:0] bits (8-bit Counter Mode: Counter Clock for ITL000, 16-bit Counter Mode: Counter Clock for
ITL000 + ITL001, 32-bit Counter Mode: Counter Clock for ITL000 + ITL001 + ITL012 + ITL013)
In 8-bit counter mode, ITL000 counts cycles of the counter clock specified in the FDIV0[2:0] bits.
In 16-bit counter mode, ITL000 + ITL001 counts cycles of the counter clock specified in the FDIV0[2:0] bits.
In 32-bit counter mode, ITL000 + ITL001 + ITL012 + ITL013 counts cycles of the counter clock specified in the
FDIV0[2:0] bits.
Bit position: 7 6 5 4 3 2 1 0
2:0 FDIV2[2:0] 8-bit Counter Mode: Counter Clock for ITL012*1 R/W
16-bit Counter Mode: Counter Clock for ITL012 + ITL013*1
0 0 0: fITL0
0 0 1: fITL0/2
0 1 0: fITL0/4
0 1 1: fITL0/8
1 0 0: fITL0/16
1 0 1: fITL0/32
1 1 0: fITL0/64
1 1 1: fITL0/128
3 — This bit is read as 0. The write value should be 0. R/W
6:4 FDIV3[2:0] 8-bit Counter Mode: Counter Clock for ITL013*2 R/W
0 0 0: fITL0
0 0 1: fITL0/2
0 1 0: fITL0/4
0 1 1: fITL0/8
1 0 0: fITL0/16
1 0 1: fITL0/32
1 1 0: fITL0/64
1 1 1: fITL0/128
7 — This bit is read as 0. The write value should be 0. R/W
Note 1. In 8-bit or 16-bit counter mode, be sure to write to the FDIV2[2:0] bits only while the ITLCTL0.EN2 bit is 0.
Note 2. In 8-bit counter mode, be sure to write to the FDIV3[2:0] bits only while the ITLCTL0.EN3 bit is 0.
This register is used to select the counter clock for the interval timer.
FDIV2[2:0] bits (8-bit Counter Mode: Counter Clock for ITL012, 16-bit Counter Mode: Counter Clock for
ITL012 + ITL013)
In 8-bit counter mode, ITL012 counts cycles of the counter clock specified in the FDIV2[2:0] bits.
In 16-bit counter mode, ITL012 + ITL013 counts cycles of the counter clock specified in the FDIV2[2:0] bits.
In 32-bit counter mode, these bits are not used; write 000b to them.
Bit position: 7 6 5 4 3 2 1 0
Bit position: 7 6 5 4 3 2 1 0
8-bit mode 00b x ITF00 The next rising edge of the counter clock following a
match between the ITLCMP00_L and ITL000 values
x ITF01 The next rising edge of the counter clock following a
match between the ITLCMP00_H and ITL001 values
x ITF02 The next rising edge of the counter clock following a
match between the ITLCMP01_L and ITL012 values
x ITF03 The next rising edge of the counter clock following a
match between the ITLCMP01_H and ITL013 values
16-bit mode 01b x ITF00 The next rising edge of the counter clock following a
match between the ITLCMP00 and ITL000 + ITL001
values
x ITF02 The next rising edge of the counter clock following a
match between the ITLCMP01 and ITL012 + ITL013
values
1 ITF0C The ITL000 + ITL001 value is stored in ITLCAP00 after
a capture trigger is generated.
32-bit mode 10b — ITF00 The next rising edge of the counter clock following
a match between the ITLCMP00 + ITLCMP01 and
ITL000 + ITL001 + ITL012 + ITL013 values
Bit position: 7 6 5 4 3 2 1 0
0 MKF00 Mask for Compare Match Status Flag for Channel 0*1 R/W
0: ITLS0.ITF00 is not masked
1: ITLS0.ITF00 is masked
1 MKF01 Mask for Compare Match Status Flag for Channel 1*1 R/W
0: ITLS0.ITF01 is not masked
1: ITLS0.ITF01 is masked
2 MKF02 Mask for Compare Match Status Flag for Channel 2*1 R/W
0: ITLS0.ITF02 is not masked
1: ITLS0.ITF02 is masked
3 MKF03 Mask for Compare Match Status Flag for Channel 3*1 R/W
0: ITLS0.ITF03 is not masked
1: ITLS0.ITF03 is masked
4 MKF0C Mask for Capture Detection Status Flag*1 R/W
0: ITLS0.ITF0C is not masked
1: ITLS0.ITF0C is masked
7:5 — These bits are read as 0. The write value should be 0. R/W
Note 1. Setting all functional bits to 1 for masking prevents setting of the corresponding bits in the ITLS0 register. This in turn prevents
software detection of compare matches and completion of capture. When compare match for any of channels 0 to 3 is to be used,
be sure to set the bit corresponding to the given status flag to 0 so that the flag is not masked. For the state of completion of
capture, on the other hand, the CAPF flag in the interval timer capture control register 0 (ITLCC0) can be used to detect this even
when the MKF0C bit is set to 1 to mask the ITLS0.ITF0C flag.
This register is used to enable or disable setting of each valid bit in the interval timer status register (ITLS0) to 1.
Setting an MKF0C or MKF0i (i = 0 to 3) bit to 1 masks the corresponding status flag among ITF0C and ITF0i (i = 0 to 3),
after which the given flag is not set to 1 even if a compare match with a compare register or capture completion is detected.
Since the status flag is not set to 1, masking also prevents generation of the interval detection interrupt (TML32_ITL_OR).
18.3 Operation
Interval timer compare registers 000 (ITLCMP00) Bits 7 to 0 Specify 8-bit compare values for channels 0.
Interval timer compare registers 001 (ITLCMP00) Bits 7 to 0 Specify 8-bit compare values for channels 1.
Interval timer compare registers 012 (ITLCMP01) Bits 7 to 0 Specify 8-bit compare values for channels 2.
Interval timer compare registers 013 (ITLCMP01) Bits 7 to 0 Specify 8-bit compare values for channels 3.
Interval timer control register 0 (ITLCTL0) EN0 Specify whether to start or stop counting in channel 0.
EN1 Specify whether to start or stop counting in channel 1.
EN2 Specify whether to start or stop counting in channel 2.
EN3 Specify whether to start or stop counting in channel 3.
MD[1:0] Set to 00b.
Interval timer frequency division registers 0 FDIV0[2:0] Select the count clock for channel 0.
(ITLFDIV00)
FDIV1[2:0] Select the count clock for channel 1.
Interval timer frequency division registers 1 FDIV2[2:0] Select the count clock for channel 2.
(ITLFDIV01)
FDIV3[2:0] Select the count clock for channel 3.
Interval timer clock select register 0 (ITLCSEL0) ISEL[2:0] Select the count clock for the interval timer.
CSEL[2:0] Set to 000b.
Interval timer capture control register 0 (ITLCC0) Bits 7 to 0 Set to 0.
Interval timer compare registers 00 (ITLCMP00) Bits 15 to 0 Specify 16-bit compare values for channels 0 and 1
Interval timer compare registers 01 (ITLCMP01) Bits 15 to 0 Specify 16-bit compare values for channels 2 and 3.
Interval timer control register 0 (ITLCTL0) EN0 Specify whether to start or stop counting in channels 0
and 1.
EN1 Set to 0.
EN2 Specify whether to start or stop counting in channels 2
and 3.
EN3 Set to 0.
MD[1:0] Set to 01b.
Interval timer frequency division registers 0 FDIV0[2:0] Select the count clock for channels 0 and 1.
(ITLFDIV00)
FDIV1[2:0] Set to 000b.
Interval timer frequency division registers 1 FDIV2[2:0] Select the count clock for channels 2 and 3.
(ITLFDIV01)
FDIV3[2:0] Set to 000b.
Interval timer clock select register 0 (ITLCSEL0) ISEL[2:0] Select the count clock for the interval timer.
CSEL[2:0] Set to 000b.
Interval timer capture control register 0 (ITLCC0) Bits 7 to 0 Set to 0.
Interval timer compare registers 00 (ITLCMP00) Bits 15 to 0 Specify a compare value in 32-bit counter mode.
Specify the lower 16 bits of the compare value in
channels 0 and 1 (ITLCMP00).
Interval timer compare registers 01 (ITLCMP01) Bits 15 to 0 Specify a compare value in 32-bit counter mode.
Specify the upper 16 bits of the compare value in
channels 2 and 3 (ITLCMP01).
Interval timer control register 0 (ITLCTL0) EN0 Specify whether to start or stop counting in channels 0 to
3.
EN1 Set to 0.
EN2 Set to 0.
EN3 Set to 0.
MD[1:0] Set to 10b.
Interval timer frequency division registers 0 FDIV0[2:0] Select the count clock for channels 0 to 3.
(ITLFDIV00)
FDIV1[2:0] Set to 000b.
Interval timer frequency division registers 1 FDIV2[2:0] Set to 000b.
(ITLFDIV01)
FDIV3[2:0] Set to 000b.
Interval timer clock select register 0 (ITLCSEL0) ISEL[2:0] Select the count clock for the interval timer.
CSEL[2:0] Set to 000b.
Interval timer capture control register 0 (ITLCC0) Bits 7 to 0 Set to 0.
Interval timer compare register 00 (ITLCMP00) Bits 15 to 0 Specify 16-bit compare values for channels 0 and 1.
Interval timer compare register 01 (ITLCMP01)*1 Bits 15 to 0 Specify 16-bit compare values for channels 2 and 3.
Interval timer control register 0 (ITLCTL0) EN0 Specify whether to start or stop counting in channels 0
and 1.
EN1 Set to 0.
EN2 Specify whether to start or stop counting in channels 2
and 3.
EN3 Set to 0.
MD[1:0] Set to 01b.
Interval timer frequency division registers 0 FDIV0[2:0] Select the count clock for channel 0.
(ITLFDIV00)
FDIV1[2:0] Set to 000b.
Interval timer frequency division registers 1 FDIV2[2:0] Set to 000b.
(ITLFDIV01)
FDIV3[2:0] Set to 000b.
Interval timer clock select register 0 (ITLCSEL0) ISEL[2:0] Select the count clock for the interval timer in channels 0
and 1.
CSEL[2:0] Select the count clock for the interval timer for capturing
in channels 2 and 3.
Interval timer capture control register 0 (ITLCC0) CAPEN Set to 1.
CAPCCR Specify whether to clear or hold the counter value in
channels 0 and 1 after the completion of capturing.
CTRS[1:0] Select a capture trigger.
Note 1. Channels 2 and 3 can only be used in 16-bit counter mode when an interrupt on compare match with ITLCMP01 is not to be used
as a capture trigger.
Count clock
counter*3 value
0xFFFF
Counter channel i
0x0000
Time
Modifying ITLCTL0.ENi
from 1 to 0 clears the counter
without synchronization with the
count clock.
ITLCTL0.ENi
Writing 0 to ITLS0.ITF0i
clears the interrupt.
TML32_ITL_OR
Compare register
0xFFFF
the counter clock. If a capture trigger is generated again within 2 cycles of the counter clock after an earlier capture trigger
was generated, the ITLCC0.CAPF bit may not be set.
Note 1. If the value of the ITLS0 register is other than 0x00, interrupt operation does not proceed even when the capture
detection flag (ITF0C) is set to 1 because the interrupt request signal (TML32_ITL_OR) is kept at the high level.
Figure 18.7 shows an example of capture operation.
Count clock
ITLCTL0.EN0
Counter*1 value 0x0000 0x0001 0x0002 0x0FFF 0x1000 0x0000 X-1 X X+1 0x0FFF 0x1000 0x0000
TML32_ITL_OR
ITLS0.ITF0C
0 is written to the
Completion of capturing is detected. capture detection flag.
ITLCC0.CAPF
ITLCC0.CAPFCR
18.3.5 Interrupt
Table 18.8 shows the interrupt sources in 8-bit, 16-bit, and 32-bit counter modes.
The ITF00 to ITF03 and ITF0C bits are interrupt status flags in the ITLS0 register. When any of the interrupt status flag is
set, an interrupt request is output as the TML32_ITL_OR signal.
Table 18.8 Interrupt sources in 8-bit, 16-bit, and 32-bit counter modes (1 of 2)
Interrupt condition in 8-bit counter Interrupt condition in 16-bit counter Interrupt condition in 32-bit counter
Interrupt source mode mode mode
ITLS0.ITF00 Next rising edge of the counter clock Next rising edge of the counter clock Next rising edge of the counter clock
after a compare match in channel 0 after a compare match in channels 0 after a compare match
and 1
ITLS0.ITF01 Next rising edge of the counter clock Not generated Not generated
after a compare match in channel 1
Table 18.8 Interrupt sources in 8-bit, 16-bit, and 32-bit counter modes (2 of 2)
Interrupt condition in 8-bit counter Interrupt condition in 16-bit counter Interrupt condition in 32-bit counter
Interrupt source mode mode mode
ITLS0.ITF02 Next rising edge of the counter clock Next rising edge of the counter clock Not generated
after a compare match in channel 2 after a compare match in channels 2
and 3
ITLS0.ITF03 Next rising edge of the counter clock Not generated Not generated
after a compare match in channel 3
ITLS0.ITF0C Not generated; this is the case when Timing of storing the counter value in Not generated; this is the case when
the setting of the ITLCC0 register is the capture register after a capture the setting of the ITLCC0 register is
0x00. trigger is input. 0x00.
If the value of the ITLS0 register is other than 0x00, the interrupt request signal (TML32_ITL_OR) is kept at the high level.
Accordingly, the generation of an additional interrupt request (TML32_ITL_OR) does not proceed, even when a compare
match or completion of capture is detected for an operating channel.
However, if the value of the ITLS0 register is not 0x00 after any bit in the ITLS0 register is set to 0 by an 8-bit memory
manipulation instruction, a low-level pulse signal is output on the TML32_ITL_OR pin is set to 1. Accordingly, clearing a
status flag in the ITLS0 register to 0 during interrupt processing or other processing enables the detection of an interrupt in
response to another status bit having the setting 1. Figure 18.8 shows the relationship between clearing of the detection flags
and the interval detection interrupt signal.
The following describes the operation shown in Figure 18.8.
When a compare match in channel 1 is detected while the value of the ITLS0 register is 0x00, the ITF01 flag is set to 1
and the interval detection interrupt signal (TML32_ITL_OR) is driven high. While the interval detection interrupt signal
(TML32_ITL_OR) is kept at the high level, the generation of an additional interrupt request (TML32_ITL_OR) does not
proceed even when a compare match or completion of capture is detected for an operating channel.
Note that if another detection flag is set to 1 immediately before clearing the ITLS0.ITF0x (x = 0, 1, 2, 3, C) flag bit to 0,
the output of the TML32_ITL_OR pin temporarily goes to the low level after clearing of the given ITLS0.ITF0x flag bit.
<1> The ITLS0.ITF01 flag is set to 1 in response to a compare match in channel 1 and the interval detection interrupt signal
(TML32_ITL_OR) are driven high. The interval detection interrupt processing is executed.
<2> Check which detection flag in the ITLS0 register is set to 1 from within the interval detection interrupt processing. In
the case shown in Figure 18.8, the ITLS0.ITF01 and ITF00 flags being set to 1 can be confirmed.
<3> Clear the ITLS0.ITF01 and ITF00 flags detected in step 2 and write 00011100b to the ITLS0 register so that its value
becomes 0x00.*1
<4> The respective processing sequences in response to the ITLS0.ITF01 and ITF00 flags being set to 1 are then
executed.*1
Note 1. Missing an interrupt source can also be prevented by repeating the processing for clearing an interrupt source per
flag.
<5> The ITLS0.ITF01 flag is set to 1 in response to a further compare match in channel 1 and the interval detection
interrupt signal (TML32_ITL_OR) is driven high. The interval detection interrupt processing is executed.
<6> Check which detection flag in the ITLS0 register is set to 1 from within the interval detection interrupt processing. In
the case shown in Figure 18.8, the ITLS0.ITF01 flag being set to 1 can be confirmed.
<7> Clear the ITLS0.ITF01 flag detected in step 6 and write 00011101b to the ITLS0 register so that its value becomes
0x00. Though the ITLS0.ITF00 flag is also set to 1 in response to the compare match in channel 0 at this time, the
ITLS0.ITF00 flag is not cleared because the processing for the flag does not proceed.
<8> As the ITLS0.ITF00 flag is set to 1 at the time the ITLS0.ITF01 flag is cleared to 0 in step 7, the TML32_ITL_OR
signal is temporarily driven low.
<9> The processing in response to the ITLS0.ITF00 flag being set to 1 is then executed.
<10> Check which detection flag in the ITLS0 register is set to 1 from within the interval detection interrupt processing.
In the case shown in Figure 18.8, the ITLS0.ITF00 flag being set to 1 can be confirmed.
<11> Clear the ITLS0.ITF00 flag detected in step 11 and write 00011101b to the ITLS0 register so that its value becomes
0x00.
<12> The processing in response to the ITLS0.ITF00 flag being set to 1 is then executed.
ITLS0.ITF01 flag
ITLS0.ITF00 flag
Interval detection
interrupt signal
(TML32_ITL_OR)
Processing in response <1> Generation of <3> <4> Execution of the respective <9> Execution of the
<10> Checking <12> Execution of the processing
an interval <5> Generation of <7> Clearing ITLS0 (ITLS0.ITF00
to the interval detection detection interrupt
Clearing processing sequences in response to
an interval ITLS0 (the processing in response
being set to 1 is
in response to ITLS0.ITF00 being
ITLS0 ITLS0.ITF01 and ITF00 being set set
interrupt detection interrupt ITLS0.ITF00 level to ITLS0.ITF01 being set
detected).
<2> Checking ITLS0 is retained)
(ITLS0.ITF01 and ITF00
<11> Clearing ITLS0 (the
being set to 1 is <6> Checking ITLS0 <8> As ITLS0.ITF00 is set
ITLS0.ITF01 level is
detected). (ITLS0.ITF01 being to 1 at the time
retained)
set to 1 is detected). ITLS0.ITF01 is cleared, an
interrupt is generated and
held pending.
Table 18.12 Procedure for starting event input from the ELC
Step Process Detail
Starting event Input from <1> Start of the procedure for starting event input —
the ELC from the ELC.
<2> Select the 32-bit interval timer as the destination Use the ELSR28*1 register. Set the appropriate
of output. ELSR28.ELS[5:0] bits for the 32-bit interval
timer to be linked.
<3> Set up the ELCR register to enable the output. Set the ELCR.ELCON bit to 1 to enable linkage
of all events.
<4> Specify the operating mode of the event See Table 18.9.
generation source. Use the CSEL[2:0] or ISEL[2:0] bits in the
ITLCSEL0 register or the CTRS[1:0] bits in the
ITLCC0 register to select the event input from
the ELC for the count source or capture trigger
as desired.
<5> Specify the operating mode of the 32-bit interval Wait for stopping.
timer.
<6> Start the operation of the event generation —
source.
<7> Completion of the procedure for starting event —
input from the ELC.
Note 1. For details, see section 15, Event Link Controller (ELC).
Table 18.13 shows the procedure for stopping event input from the ELC.
Table 18.13 Procedure for stopping event Input from the ELC
Step Process Detail
Stopping event Input from <1> Start of the procedure for stopping event input —
the ELC from the ELC
<2> Stop the operation of the event generation —
source.
<3> Stop the 32-bit interval timer. See Table 18.10.
<4> Set up the ELSR28 register*1
to disable the Set the ELSR28.ELS[5:0] bits to 0.
output.
(Optional: set up the ELCR register to disable all
event linkage).
<5> Completion of the procedure for stopping event —
input from the ELC
Note 1. For details, see section 15, Event Link Controller (ELC).
19.1 Overview
The realtime clock has the following features.
Table 19.1 RTC specifications
Item Description
The realtime clock interrupt signal (RTC_ALM_OR_PRD) can be used to wake up the MCU from the Software Standby
mode or to trigger transitions to the Snooze mode.
Figure 19.1 shows a block diagram of a realtime clock.
RTC128
WALE WALIE WAFG RIFG RWST RWAIT RTCE RCLOE1 AMPM CT[2:0]
EN
RTCOUT
RTC_ALM_OR_PRD
Matched
RTCC0.CT[2:0]
Selector
RIFG
AMPM
RWST RWAIT
Selector
LOCO SOSC/256
Count enable/ Time error
disable circuit correction OSMC.
register WUTMMCK0
RTC128EN
(SUBCUD)
Buffer Buffer Buffer Buffer Buffer Buffer Buffer RTCE (8-bit)
RTC128EN
Internal bus
Note: The count of years, months, weeks, days, hours, minutes, and seconds can only proceed when the sub-clock
oscillator (SOSC = 32.768 kHz) is selected as the operating clock of the realtime clock (RTCCLK). When the
low-speed on-chip oscillator clock (LOCO = 32.768 kHz) is selected, only the fixed-cycle interrupt is available.
Bit position: 7 6 5 4 3 2 1 0
RCLO RTC12
Bit field: RTCE — AMPM CT[2:0]
E1 8EN
Note: Do not change the value of the RCLOE1 bit when RTCE is 1.
The RTCC0 is an 8-bit register that is used to start or stop the realtime clock operation, control the RTCOUT pin, and set a
12- or 24-hour system and the fixed-cycle interrupt.
RTC128EN bit (Selection of the operating clock for the realtime clock (RTCCLK))
● Setting this bit to 1 enables the realtime clock to operate with the 128-Hz clock for lower-power operation.
● Time error correction cannot be used when the setting of this bit is 1.
● The WUTMMCK0 bit in the OSMC register should be set to 0 when setting this bit to 1. For details, see section 8,
Clock Generation Circuit.
Bit position: 7 6 5 4 3 2 1 0
So that the 16-bit internal counter continues to run, return the value of this bit to 0 on completion of reading or writing
within one second. When reading or writing to the counter is required while generation of the alarm interrupt is enabled,
first set the RTCC0.CT[2:0] bits to 010b (generating the constant-period interrupt once per 1 second). Then, complete the
processing from setting the RWAIT bit to 1 to setting it to 0 before generation of the next constant-period interrupt.
After setting this bit to 1, it takes up to one cycle of RTCCLK until the counter value can be actually read or written (RWST
= 1).*1 *2
When the internal counter (16 bits) overflows while the setting of this bit is 1, an indicator of the counter having overflowed
is retained after RWAIT has become 0, after which counting up continues.
Note that, when the second count register has been written to, the overflow is not retained.
Note 1. When the RWAIT bit is set to 1 within one cycle of RTCCLK after setting the RTCC0.RTCE bit to 1, the setting of the
RWST bit actually becoming 1 may take up to two cycles of the operating clock (RTCCLK).
Note 2. When the RWAIT bit is set to 1 within one cycle of RTCCLK after release from Sleep mode, Software Standby
mode, or Snooze mode, the setting of the RWST bit actually becoming 1 may take up to two cycles of the operating
clock (RTCCLK).
Bit position: 7 6 5 4 3 2 1 0
Bit position: 7 6 5 4 3 2 1 0
Bit position: 7 6 5 4 3 2 1 0
and then to the counter up to two cycles of RTCCLK later. Even if the minute count register overflows while this register
is being written, this register ignores the overflow and is set to the value written. Specify a decimal value of 00 to 23, 01 to
12, or 21 to 32 by using BCD code according to the time system specified using the AMPM bit of the realtime clock control
register 0 (RTCC0). If the RTCC0.AMPM bit value is changed, the values of the HOUR register change according to the
specified time system. This register is not initialized by a reset signal.
Table 19.2 shows the relationship between the setting value of the RTCC0.AMPM bit, the hour count register (HOUR)
value, and time.
Table 19.2 Displayed time digits
24-hour display (RTCC0.AMPM = 1) 12-hour display (RTCC0.AMPM = 0)
Time HOUR register Time HOUR register
The HOUR register value is set to 12-hour display when the RTCC0.AMPM bit is 0 and to 24-hour display when the
RTCC0.AMPM bit is 1. In 12-hour display, the HOUR10[1] bit displays 0 for AM and 1 for PM.
Bit position: 7 6 5 4 3 2 1 0
When data is written to this register, it is written to a buffer and then to the counter up to two cycles of RTCCLK later. Even
if the hour count register overflows while this register is being written, this register ignores the overflow and is set to the
value written. Set a decimal value of 01 to 31 to this register in BCD code.
This register is not initialized by a reset signal.
Bit position: 7 6 5 4 3 2 1 0
Bit position: 7 6 5 4 3 2 1 0
MONT
Bit field: — — — MONTH1[3:0]
H10
Bit position: 7 6 5 4 3 2 1 0
Bit position: 7 6 5 4 3 2 1 0
This register is used to correct the time with high accuracy when it is running slow or fast by adjusting the value that is
considered an overflow from the internal counter (16 bits) to the second count register (SEC) (reference value: 0x7FFF).
Note: Time error correction cannot be used in the 128-Hz operating mode (RTCC0.RTC128EN = 1). It can only proceed if
the setting of the RTCC0.RTC128EN bit is 0.
The range of value that can be corrected by using the time error correction register (SUBCUD) is shown in Table 19.3.
Table 19.3 Correction range using time error correction register (SUBCUD)
DEV = 0 (correction every 20 seconds) DEV = 1 (correction every 60 seconds)
Correctable range –189.2 ppm to 189.2 ppm –63.1 ppm to 63.1 ppm
Maximum excludes quantization ±1.53 ppm ±0.51 ppm
error
Minimum resolution ±3.05 ppm ±1.02 ppm
Note: If a correctable range is –63.1 ppm or lower and 63.1 ppm or higher, set DEV to 0.
Bit position: 7 6 5 4 3 2 1 0
This register is used to set minutes of alarm. This register is not initialized by a reset signal.
Note: Set a decimal value of 00 to 59 to this register in BCD code. If a value outside the range is set, the alarm is not
detected.
Bit position: 7 6 5 4 3 2 1 0
Note: Set a decimal value of 00 to 23, 01 to 12, or 21 to 32 to this register in BCD code. If a value outside the range is set,
the alarm is not detected.
Bit position: 7 6 5 4 3 2 1 0
This register is used to set days of the week of alarm. This register is not initialized by a reset signal.
Table 19.4 shows an example of setting the alarm.
Table 19.4 Example of setting the alarm
Day of week 12-hour display 24-hour display
Wednesda
Minute 10
Minute 10
Thursday
Saturday
Minute 1
Minute 1
Tuesday
Monday
Hour 10
Hour 10
Sunday
Hour 1
Hour 1
Friday
WW0
WW1
WW2
WW3
WW4
WW5
WW6
Time of Alarm
y
19.3 Operation
Start
Setting RTCC0.AMPM, CT[2:0] Selects 12- or 24-hour system and interrupt (RTC_ALM_OR_PRD).
No
RTC_ALM_OR_PRD = 1?
Yes
End
● Transition to Sleep or Software Standby mode when at least two counter clock cycles (RTCCLK) have elapsed after
setting the RTCC0.RTCE bit to 1 (see Figure 19.3, Example 1).
● After setting the RTCC0.RTCE bit to 1 and then setting the RTCC1.RWAIT bit to 1, poll the RTCC1.RWST bit to check
if it has become 1 yet. After setting the RTCC1.RWAIT bit to 0 and polling the RTCC1.RWST bit to check if it has
become 0 yet, a transition to Sleep or Software Standby mode will proceed (see Figure 19.3, Example 2).
Example 1 Example 2
Yes
RTCC1.RWST = 0 ?
No
Yes
WFI instruction Placed in Sleep
execution or Software Standby mode.
Figure 19.3 Procedure for shifting to Sleep or Software Standby mode after setting RTCC0.RTCE bit to 1
19.3.3 Reading from and Writing to the Counters of the Realtime Clock
Read or write the counter after setting 1 to the RTCC1.RWAIT bit first.
Set the RTCC1.RWAIT bit to 0 after completion of reading or writing the counter.
Figure 19.4 shows the procedure for reading realtime clock.
Start
No
RTCC1..RWST = 1? Checks wait status of counter.
Yes
No
RTCC1.RWST = 0?*1
Yes
End
Note 1. Be sure to confirm that RTCC1.RWST = 0 before setting Software Standby mode.
Note: Complete the series of process of setting the RTCC1.RWAIT bit to 1 to clearing the RTCC1.RWAIT bit to 0 within 1
second. When reading or writing to the counter is required while generation of the alarm interrupt is enabled, first set
the RTCC0.CT[2:0] bits to 010b (generating the constant-period interrupt once per 1 second). Then, complete the
processing from setting the RWAIT bit to 1 to setting it to 0 before generation of the next constant-period interrupt.
Note: The second count register (SEC), minute count register (MIN), hour count register (HOUR), day-of-week count
register (WEEK), day count register (DAY), month count register (MONTH), and year count register (YEAR) may be
read in any sequence. All the registers do not have to read and only some registers may be read.
Start
Sets counter
RTCC1.RWAIT = 0
operation.
No
RTCC1.RWST = 0?*1
Yes
End
Note 1. Be sure to confirm that RTCC1.RWST = 0 before setting Software Standby mode.
Note: Complete the series of operations of setting the RTCC1.RWAIT bit to 1 to clearing the RTCC1.RWAIT bit to 0 within
1 second. When reading or writing to the counter is required while generation of the alarm interrupt is enabled, first
set the RTCC0.CT[2:0] bits to 010b (generating the constant-period interrupt once per 1 second). Then, complete
the processing from setting the RWAIT bit to 1 to setting it to 0 before generation of the next constant-period
interrupt.
Note: When changing the values of the SEC, MIN, HOUR, WEEK, DAY, MONTH, and YEAR register while the counting
is in progress (RTCC0.RTCE = 1), rewrite the values of the MIN register after disabling interrupt processing
of RTC_ALM_OR_PRD by using the interrupt mask flag register. Furthermore, clear the RTCC1.WAFG and
RTCC1.RIFG flags after rewriting the MIN register.
Note: The second count register (SEC), minute count register (MIN), hour count register (HOUR), day-of-week count
register (WEEK), day count register (DAY), month count register (MONTH), and year count register (YEAR) may be
written in any sequence. All the registers do not have to be set and only some registers may be written.
Start
No
RTC_ALM_OR_PRD = 1?
Yes
No
RTCC1.WAFG = 1?
Note: The alarm minute register (ALARMWM), alarm hour register (ALARMWH), and alarm day-of-week register (ALARMWW)
may be written in any sequence.
Note: Fixed-cycle interrupts and alarm match interrupts use the same interrupt source (RTC_ALM_OR_PRD). To use these
two types of interrupts at the same time, the source of the interrupt can be identified by checking the fixed-cycle
interrupt status flag (RTCC1.RIFG) and the alarm detection status flag (RTCC1.WAFG) when an RTC_ALM_OR_PRD is
generated.
(When SUBCUD.DEV = 0)
Correction value*1 *2= Number of correction counts in 1 minute ÷ 3 = (Oscillation frequency*3 ÷ Target frequency*4 – 1) ×
32768 × 60 ÷ 3
(When SUBCUD.DEV = 1)
Correction value*1 *2 = Number of correction counts in 1 minute = (Oscillation frequency*3 ÷ Target frequency*4 – 1) ×
32768 × 60
Note 1. The correction value is the time error correction value calculated by using bits the F6 and F[5:0] bits of the time error
correction register (SUBCUD).
(When SUBCUD.F6 = 0) Correction value = {(F[5:0]) – 1} × 2
(When SUBCUD.F6 = 1) Correction value = – {/F[5:0] + 1} × 2
(When SUBCUD.F6, F[5:0]) = *00000*b), time error correction is not performed. “*” is 0 or 1.
/F[5:0] are bit-inverted values (000011b when 111100b).
Note 2. The correction value is 2, 4, 6, 8, … 120, 122, 124 or –2, –4, –6, –8, … –120, –122, –124.
Note 3. The oscillation frequency is a value of the count clock (RTCCLK).
It can be calculated from the output frequency of the RTCOUT pin × 32768 when the time error correction register is
set to its initial value (0x00).
Note 4. The target frequency is the frequency resulting after correction performed by using the time error correction register.
0x8054 0x8055
00
0x7FFF 0x0000
59
0x0000 0x0001
0x7FFF + 0x56 (86)
0x8054 0x8055
40
0x7FFF 0x0000
39
0x0000 0x0001
0x7FFF + 0x56 (86)
0x8054 0x8055
20
0x7FFF 0x0000
19
0x0000 0x0001
0x7FFF
01
0x8054 0x8055 0x0000 0x0001
0x7FFF + 0x56 (86)
00
Count start
0x0000
SEC
counter value
RSUBC
Figure 19.7 Operation for correction when the value of (SUBCUD.DEV, F6, F[5:0]) = 00101100b
To measure the oscillation frequency *1 of each product, a signal at about 1 Hz can be output from the RTCOUT pin when
the clock error correction register (SUBCUD) is set to its initial value (0x00).
Note 1. See section 19.3.5. 1 Hz Output by the Realtime Clock for the setting procedure for output of about 1 Hz from the
RTCOUT pin.
[Calculating the correction value]
When the output frequency from the RTCOUT pin is 0.9999817 Hz:
Oscillation frequency = 32768 × 0.9999817 ≈ 32767.4 Hz
Given that the target frequency is 32768 Hz (32767.4 Hz + 18.3 ppm), set the SUBCUD.DEV to 0. Accordingly, the
expression for calculating the correction value when the SUBCUD.DEV is 1 is applicable.
Correction value
= Error for correction of counting of 1 minute
= (Oscillation frequency ÷ Target frequency –1) × 32768 × 60
= (32767.4 ÷ 32768 – 1) × 32768 × 60
= –36
[Calculating the values to be set to (SUBCUD.F6 and F[5:0])
When the correction value is –36:
If the correction value is 0 or less (the clock is running fast), set the SUBCUD.F6 to 0. Calculate the SUBCUD.F[5:0] bits
from the correction value.
– {/F[5:0] + 1} × 2 = –36 /F[5:0] = 17
/F[5:0] = 010001b
F[5:0] = 101110b
Consequently, when correcting from 32767.4 Hz to 32768 Hz (32767.4 Hz + 18.3 ppm), setting the correction register such
that the SUBCUD.DEV is 1 and the correction value is –36 ((SUBCUD.F6, F[5:0]) = 1101110b) results in the desired
frequency of 32768 Hz (error of 0 ppm).
Figure 19.8 shows the operation for correction when the value of (SUBCUD.DEV, F6, F[5:0]) is 11101110b.
R01UH1040EJ0110 Rev.1.10
0x7FFF-0x24 (36) 0x7FFF-0x24 (36)
Count start
Counter (16-bit) 0x0000 0x7FDA0x7FDB 0x0000 0x0001 0x7FFF 0x0000 0x0001 0x7FFF 0x0000 0x0001 0x7FFF 0x0000 0x0001 0x7FFF 0x0000 0x0001 0x7FFF 0x0000 0x0001 0x7FFF 0x0000 0x7FDA0x7FDB
counter value
SEC 00 01 19 20 39 40 59 00
Operation for correction when the value of (SUBCUD.DEV, F6, F[5:0]) = 11101110b
The bus interface and registers operate with PCLKB, and the 14-bit counter and control circuits operate with IWDTCLK.
Clock
frequency
divider
IWDTCLK
IWDTCLK IWDTCLK/16
IWDTCLK/32
IWDTCLK/64 IWDT control circuit 14-bit counter
IWDTCLK/128
IWDTCLK/256
IWDTSR
Bit position: 7 6 5 4 3 2 1 0
Bit field:
7:0 n/a The down-counter is refreshed by writing 0x00 and then writing 0xFF to this register R/W
The IWDTRR register refreshes the down-counter of the IWDT. The down-counter of the IWDT is refreshed by writing
0x00 and then writing 0xFF to IWDTRR (refresh operation) within the refresh-permitted period. After the down-counter is
refreshed, it starts counting down from the value selected in the IWDT Timeout Period Select bits (OFS0.IWDTTOPS[1:0])
in the Option Function Select Register 0 (OFS0).
When 0x00 is written, the read value is 0x00. When a value other than 0x00 is written, the read value is 0xFF. For details of
the refresh operation, see section 20.3.2. Refresh Operation.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
REFE UNDF
Bit field: CNTVAL[13:0]
F F
Note: If window end position setting ≥ window start position setting, the window end position setting is set to 0%.
Figure 20.2 IWDTRPSS[1:0] and IWDTRPES[1:0] bit settings and refresh-permitted period
20.3 Operation
When the reset state is released, the counter automatically starts counting down from the value selected in the IWDT
Timeout Period Select bits (OFS0.IWDTTOPS[1:0]).
After that, as long as the program continues normal operation and the counter is refreshed within the refresh-permitted
period, the value in the counter is reset each time the counter is refreshed and down-counting continues. The IWDT does
not output the reset signal as long as this procedure continues. However, if the counter underflows because the program
crashed or because a refresh error occurred when an attempt is made to refresh outside the refresh-permitted period, the
IWDT asserts the reset signal or non-maskable interrupt request/interrupt request (IWDT_NMIUNDF).
After the reset signal or non-maskable interrupt request/interrupt request is generated, the counter reloads the timeout period
after counting for 1 cycle, the value of the timeout period is set in the down-counter and counting starts. The reset output
or interrupt request output can be selected with the IWDT Reset Interrupt Request Select bit (OFS0.IWDTRSTIRQS).
The interrupt enabled for operating the NMI can be selected with the IWDT Underflow/Refresh Error Interrupt Enable bit
(NMIER.IWDTEN).
Figure 20.3 shows an example of operation under the following conditions:
● Auto start mode (OFS0.IWDTSTRT = 0)
● IWDT behavior selection: interrupt (OFS0.IWDTRSTIRQS = 0)
● Non-maskable Interrupt: IWDT Underflow/Refresh Error Interrupt Enabled (NMIER.IWDTEN = 1)
● The window start position is 75% (OFS0.IWDTRPSS[1:0] = 10b)
● The window end position is 25% (OFS0.IWDTRPES[1:0] = 10b).
Counter value
100%
Refresh-
prohibited period
75%
50% Refresh-
permitted period
25%
Refresh-
prohibited period
0%
Reset pin *1
Refresh
the counter
Active: High
Underflow
Refresh error Refresh error
Status flag
Refresh error flag cleared
Active: High
Interrupt request
(IWDT_NMIUNDF)
Active: High
Reset output
from IWDT
Active: High L
[Example write sequences that are not valid to refresh the counter]
● 0x23 (a value other than 0x00) → 0xFF
After 0xFF is written to the IWDTRR register, refreshing the counter requires up to 4 cycles of the signal for counting
(the IWDT Clock Frequency Division Ratio Select bits (OFS0.IWDTCKS[3:0]) to determine how many cycles of the
IWDT clock (IWDTCLK) make up 1 cycle for counting. To meet this requirement, writing 0xFF to the IWDTRR must
be completed 4 count cycles before the end of the refresh-permitted period or a down-counter underflow. The value of the
counter can be checked with the counter bits (IWDTSR.CNTVAL[13:0]).
[Example refreshing timings]
● When the window start position is set to 0x01FF, even if 0x00 is written to IWDTRR before 0x01FF is reached at
(0x0202, for example), refreshing occurs if 0xFF is written to IWDTRR after the value of the IWDTSR.CNTVAL[13:0]
bits reaches 0x01FF
● When the window end position is set to 0x01FF, refreshing occurs if 0x0203 (4 count cycles before 0x01FF) or a
greater value is read from the IWDTSR.CNTVAL[13:0] bits immediately after writing 0x00 → 0xFF to IWDTRR
● When the refresh-permitted period continues until count 0x0000, refreshing can be performed immediately before
an underflow. In this case, if 0x0003 (4 count cycles before an underflow) or a greater value is read from the
IWDTSR.CNTVAL[13:0] bits immediately after writing 0x00 → 0xFF to IWDTRR, no underflow occurs and
refreshing is performed.
Figure 20.4 shows the IWDT refresh-operation waveforms when PCLKB > IWDTCLK and the clock division ratio is
IWDTCLK.
Peripheral clock
(PCLKB)
IWDT clock
(IWDTCLK)
Data written to
0x00 0x54 0x00 0xFF
IWDTRR register
Invalid
Refresh
synchronization signal
Refresh signal
(after synchronization Refresh request
with IWDTCLK)
Refreshing
Figure 20.4 IWDT refresh operation waveforms when OFS0.IWDTCKS[3:0] = 0000b, OFS0.IWDTTOPS[1:0] =
11b
Peripheral clock
(PCLKB)
IWDT clock
(IWDTCLK)
Refreshing
(after synchronization with IWDTCLK)
Counter value (n + 1) (n) (n - 1) (n - 2) (n - 3) 0x07FF 0x07FE
Bits
IWDTSR.CNTVAL (n + 1) (n) (n - 1) (n - 2) (n - 3) 0x07FF
[13:0]
IWDTSR.CNTVAL
[13:0] read signal
(internal signal)
IWDTSR.CNTVAL
[13:0] read data xxxx (n + 1) (n) (n - 2) 0x07FF
Figure 20.5 Processing for reading IWDT counter value when OFS0.IWDTCKS[3:0] = 0000b,
OFS0.IWDTTOPS[1:0] = 11b
Note: Most of the following descriptions in this section use the units and channels of the 32-pin products as an example.
[Clock control]
● Master or slave selection
● Phase control of I/O clock
● Setting of transfer period by prescaler and internal counter of each channel
● Maximum transfer rate *1
During master communication: Max. PCLKB/2 (SPI00 only), Max. PCLKB/4
During slave communication: Max. fMCK/6*2
[Interrupt function]
● Transfer end interrupt or buffer empty interrupt (SAU0_SPI_TXRXI00/SAU0_SPI_TXRXI11/SAU1_SPI_TXRXI20)
In addition, simplified SPIs of following channels support the Snooze mode. In the Snooze mode, data can be received
without CPU processing upon detecting SCK input in the Software Standby mode. The Snooze mode is only available in the
following simplified SPIs, which support asynchronous reception.
● SPI00
Note 1. Set up the transfer rate within a range satisfying the SCK cycle time (tKCY). For details, see section 31, Electrical
Characteristics with Ta = -40 to +105°C.
Note 2. fMCK is a clock divided by PCLKB with a prescaler.
Note: Use a general-purpose port pin to send a chip select signal when required.
21.1.2 UART
This is a start-stop synchronization communication function using two lines: serial data transmission (TXD) and serial data
reception (RXD) lines. By using these two communication lines, each data frame, which consist of a start bit, data, parity
bit, and stop bit, is transferred asynchronously (using the internal baud rate) between the microcontroller and the other
communication party. Full-duplex UART communication can be performed by using a channel dedicated to transmission
(even-numbered channel) and a channel dedicated to reception (odd-numbered channel). The LIN-bus can be implemented
by using timer array unit with an external interrupt (IRQ0).
For details about the settings, see section 21.6. Operation of UART Communication .
[Data Transmission and reception]
● Data length of 7, 8, or 9 bits*1
● MSB or LSB first selectable
● Level setting of transmit and receive data and select of reverse
● Parity bit appending and parity check functions
● Stop bit appending
[Interrupt function]
● Transfer end interrupt and buffer empty interrupt (SAU0_UART_TXI0/SAU0_UART_RXI0/SAU0_UART_TXI1/
SAU0_UART_RXI1/SAU1_UART_TXI2/SAU1_UART_RXI2)
● Error interrupt in case of framing error, parity error, or overrun error (SAU0_UART_ERRI0/SAU0_UART_ERRI1/
SAU1_UART_ERRI2)
In addition, UART reception of following channels supports the Snooze mode. In the Snooze mode, data can be received
without CPU processing upon detecting RXD input in the Software Standby mode. The Snooze mode is only available in
the following UARTs, which support the reception baud rate adjustment function.
● UART0
Note 1. Only UART0 and UART2 support the 9-bit data length.
[Interrupt function]
● Transfer end interrupt (SAU0_IIC_TXRXI00/SAU0_IIC_TXRXI11/SAU1_IIC_TXRXI20)
Note 1. When receiving the last data, ACK is not output if 0 is written to the SOE bit (serial output enable register m
(SOEm)) and serial communication data output is stopped. See (2) Processing flow for details.
Note: To use an I2C bus of full function, see section 22, I2C Bus Interface (IICA).
PRS1 PRS0
[3:0] [3:0]
4 4
PCLKB Prescaler
PCLKB/20 to PCLKB/20 to
PCLKB/215 PCLKB/215
Selector Selector
Selector
fMCK
Clock controller
Selector
Serial clock I/O pin fTCLK
(when SPI00: SCK00) Shift register
(when IIC00: SCL00) Output
Synchro-
Edge fSCK controller Serial data output pin
nous
circuit detection (when SPI00: SO00)
(when IIC00: SDA00)
(when UART0: TXD0)
Interrupt
Communication controller controller Serial transfer end interrupt
Slave select input pin
(SPI00: SSI00) Edge (when SPI00: SAU0_SPI_TXRXI00)
detection (when IIC00: SAU0_IIC_TXRXI00)
Mode selection Serial flag clear trigger
(when UART0: SAU0_UART_TXI0)
SPI00 or IIC00 register 00 (SIR00)
or UART0
Serial data input pin ISC.SSIE00 (for transmission)
(when SPI00: SI00) PECT OVCT
(when IIC00: SDA00) Synchro- Noise
nous elimination Edge/
(when UART0: RXD0) circuit
enabled/
level Clear
disabled
State of
communications
detection
2
TRXE[1:0] DCP[1:0] EOC PTC[1:0] DIR SLC[1:0] DLS[1:0] TSF BFF PEF OVF
When UART0
Serial communication operation setting register 00 (SCR00) Serial status register 00 (SSR00)
Selector
ULBS.ULBS0
CK01 CK00
Channel 1
Communication controller
CK01 CK00
Channel 2
Communication controller
Serial data output pin
(UART1: TXD1)
Mode selection
Noise UART1
Synchro- Edge/level
nous elimination (for transmission) Serial transfer end interrupt
Serial data input pin enabled/ detection
circuit disabled (UART1: SAU0_UART_TXI1)
(UART1: RXD1)
SNFEN.SNFEN10
When UART1
Selector
ULBS.ULBS1
CK01 CK00
Serial data output pin
Channel 3 (when SPI11: SO11)
Communication controller
(when IIC11: SDA11)
Serial clock I/O pin
(when SPI11: SCK11)
(when IIC11: SCL11) Mode selection Serial transfer end interrupt
SPI11 or IIC11 (when SPI11: SAU0_SPI_TXRXI11)
or UART1 (when IIC11: SAU0_IIC_TXRXI11)
Selector (for reception) Error (when UART1: SAU0_UART_RXI1)
Serial data input pin Synchro- Edge/level
nous detection controller
(when SPI11: SI11) circuit Serial transfer error interrupt
(when IIC11: SDA11) (UART1: SAU0_UART_ERRI1)
PRS1 PRS0
[3:0] [3:0]
4 4
PCLKB Prescaler
PCLKB/20 to PCLKB/20 to
PCLKB/215 PCLKB/215
Selector Selector
Channel 0 CK11 CK10 (Clock division setting block) (Buffer register block)
(LIN-bus supported)
Serial data output pin
Selector fMCK
(when SPI20: SO20)
(when IIC20: SDA20)
Clock controller
Selector
fTCLK (when UART2:TXD2)
Serial clock I/O pin Shift register
(when SPI20: SCK20) Output
Synchro- Edge fSCK
(when IIC20: SCL20) nous controller
circuit detection
Interrupt
Serial transfer end interrupt
controller
Communication controller (when SPI20: SAU1_SPI_TXRXI20)
(when IIC20: SAU1_IIC_TXRXI20)
Mode selection (when UART2: SAU1_UART_TXI2)
Serial flag clear trigger
SPI20 or IIC20
register 10 (SIR10)
or UART2
(for transmission) PECT OVCT
Noise
Serial data input pin Synchro-
elimination Edge/
nous
enabled/ level
(when SPI20: SI20) circuit Clear
State of
communications
disabled
(when IIC20: SDA20) detection
(when UART2: RXD2) 2
Error controller
SNFEN.SNFEN20
CKS CCS STS SIS MD1 [1:0] MD0
ULBS.ULBS2
CK11 CK10
Channel 1
(LIN-bus supported) Communication
controller Serial transfer end interrupt
(UART2: SAU1_UART_RXI2)
Mode selection
UART2
Edge/level Error
(for reception)
detection controller Serial transfer error interrupt
(UART2: SAU1_UART_ERRI2)
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0x3 PCLKB/23 250 kHz 625 kHz 1.25 MHz 2.5 MHz 4 MHz
0x4 PCLKB/24 125 kHz 313 kHz 625 kHz 1.25 MHz 2 MHz
0x5 PCLKB/25 62.5 kHz 156 kHz 313 kHz 625 kHz 1 MHz
0x6 PCLKB/26 31.3 kHz 78.1 kHz 156 kHz 313 kHz 500 kHz
0x7 PCLKB/27 15.6 kHz 39.1 kHz 78.1 kHz 156 kHz 250 kHz
0x8 PCLKB/28 7.81 kHz 19.5 kHz 39.1 kHz 78.1 kHz 125 kHz
0x9 PCLKB/29 3.91 kHz 9.77 kHz 19.5 kHz 39.1 kHz 62.5 kHz
0xA PCLKB/210 1.95 kHz 4.88 kHz 9.77 kHz 19.5 kHz 31.3 kHz
0xB PCLKB/211 977 Hz 2.44 kHz 4.88 kHz 9.77 kHz 15.6 kHz
0xC PCLKB/212 488 Hz 1.22 kHz 2.44 kHz 4.88 kHz 7.81 kHz
0xD PCLKB/213 244 Hz 610 Hz 1.22 kHz 2.44 kHz 3.91 kHz
Note: When changing the clock selected for PCLKB, do so after having stopped (serial channel stop register m (STm) = 0x000F) the
operation of the serial array unit (SAU).
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The SMRmn register is used to set an operation mode of channel n. It is also used to select an operation clock (fMCK),
specify whether the serial clock (fSCK) may be input or not, set a start trigger, the operating mode (as simplified SPI, UART
or simplified I2C), and an interrupt source. This register is also used to invert the level of the receive data only in the UART
mode.
Rewriting the SMRmn register is prohibited when the register is in operation (when SEm.SE[n] = 1). However, the MD0 bit
can be rewritten during operation.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The SMRmn register is used to set an operation mode of channel n. It is also used to select an operation clock (fMCK),
specify whether the serial clock (fSCK) may be input or not, set a start trigger, the operating mode (as simplified SPI, UART,
or simplified I2C), and an interrupt source. This register is also used to invert the level of the receive data only in the UART
mode.
Rewriting the SMRmn register is prohibited when the register is in operation (when SEm.SE[n] = 1). However, the MD0 bit
can be rewritten during operation.
SIS0 bit (Controls Inversion of Level of Channel n Receive Data in UART Mode)
The SIS0 bit is used for control inversion of the level of channel n receive data in UART mode.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1:0 DLS[1:0] Setting of Data Length in Simplified SPI and UART Modes R/W
0 0: Setting prohibited
0 1: 9-bit data length (stored in bits 0 to 8 of the SDRm0 register)
(settable in UART mode only)
1 0: 7-bit data length (stored in bits 0 to 6 of the SDRm0 register)
1 1: 8-bit data length (stored in bits 0 to 7 of the SDRm0 register)
2 — This bit is read as 1. The write value should be 1. R/W
3 — This bit is read as 0. The write value should be 0. R/W
DLS[1:0] bits (Setting of Data Length in Simplified SPI and UART Modes)
Be sure to set DLS[1:0] = 11b in the simplified I2C mode.
DIR bit (Selection of Data Transfer Sequence in Simplified SPI and UART Modes)
Be sure to clear DIR = 0 in the simplified I2C mode.
DCP[1:0] bits (Selection of Data and Clock Phase in Simplified SPI Mode)
See Figure 21.3.
Be sure to set DCP[1:0] = 00b in the UART mode and simplified I2C mode.
Figure 21.3 shows the data and clock phase in simplified SPI mode.
Type 1 SCKp
Type 2 SCKp
Type 3 SCKp
Type 4 SCKp
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1:0 DLS[1:0] Setting of Data Length in Simplified SPI and UART Modes R/W
0 0: Setting prohibited
0 1: 9-bit data length (stored in the DAT[8:0] bits of the SDRm1 register)
(settable in UART mode only)
1 0: 7-bit data length (stored in the DAT[6:0] bits of the SDRm1 register)
1 1: 8-bit data length (stored in the DAT[7:0] bits of the SDRm1 register)
2 — This bit is read as 1. The write value should be 1. R/W
3 — This bit is read as 0. The write value should be 0. R/W
4 SLC Setting of Stop Bit in UART Mode R/W
0: No stop bit
1: Stop bit length = 1 bit
6:5 — These bits are read as 0. The write value should be 0. R/W
7 DIR Selection of Data Transfer Sequence in Simplified SPI and UART Modes R/W
0: Inputs or outputs data with MSB first
1: Inputs or outputs data with LSB first
9:8 PTC[1:0] Setting of Parity Bit in UART Mode R/W
0 0: Transmission: Does not output the parity bit
Reception: Receives without parity
0 1: Transmission: Outputs 0 parity*1
Reception: No parity judgment
1 0: Transmission: Outputs even parity
Reception: Determines as even parity
1 1: Transmission: Outputs odd parity
Reception: Determines as odd parity
10 EOC Mask Control of Error Interrupt Signal SAU0_UART_ERRI0 (m = 0), SAU1_UART_ERRI2 R/W
(m = 1)
0: Disables generation of error interrupt SAU0_UART_ERRI0 (m = 0),
SAU1_UART_ERRI2 (m = 1) (SAUm_UART_RXIq is generated)
1: Enables generation of error interrupt SAU0_UART_ERRI0 (m = 0),
SAU1_UART_ERRI2 (m = 1) (SAUm_UART_RXIq is not generated if an error
occurs)
11 — This bit is read as 0. The write value should be 0. R/W
13:12 DCP[1:0] Selection of Data and Clock Phase in Simplified SPI Mode R/W
0 0: Type1 (SCK: inverted, Input timing: rising edge)
0 1: Type2 (SCK: non-inverted, Input timing: falling edge)
1 0: Type3 (SCK: inverted, Input timing: falling edge)
1 1: Type4 (SCK: non-inverted, Input timing: rising edge)
15:14 TRXE[1:0] Setting of Channel 1 Operation Mode R/W
0 0: Disable communication
0 1: Reception only
1 0: Transmission only
1 1: Transmission and reception
Note 1. 0 is always added regardless of the data contents.
The SCRm1 is a communication operation setting register of channel 1. It is used to set a data transmission and reception
mode, phase of data and clock, whether an error signal is to be masked or not, parity bit, start bit, stop bit, and data length.
Rewriting the SCRm1 register is prohibited when the register is in operation (when SEm.SE[1] = 1).
DLS[1:0] bits (Setting of Data Length in Simplified SPI and UART Modes)
Be sure to set DLS[1:0] = 11b in the simplified I2C mode.
DIR bit (Selection of Data Transfer Sequence in Simplified SPI and UART Modes)
Be sure to clear DIR = 0 in the simplified I2C mode.
EOC bit (Mask Control of Error Interrupt Signal SAU0_UART_ERRI0 (m = 0), SAU1_UART_ERRI2 (m = 1))
Set EOC = 0 in the simplified SPI mode, simplified I2C mode, and during UART transmission.*1
DCP[1:0] bits (Selection of Data and Clock Phase in Simplified SPI Mode)
See Figure 21.3.
Be sure to set DCP[1:0] = 00b in the UART mode and simplified I2C mode.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 DLS Setting of Data Length in Simplified SPI and UART Modes R/W
0: 7-bit data length (stored in the DAT[6:0] bits of the SDR02 register)
1: 8-bit data length (stored in the DAT[7:0] bits of the SDR02 register)
2:1 — These bits are read as 1. The write value should be 1. R/W
3 — This bit is read as 0. The write value should be 0. R/W
5:4 SLC[1:0] Setting of Stop Bit in UART Mode R/W
0 0: No stop bit
0 1: Stop bit length = 1 bit
1 0: Stop bit length = 2 bits
1 1: Setting prohibited
6 — This bit is read as 0. The write value should be 0. R/W
7 DIR Selection of Data Transfer Sequence in Simplified SPI and UART Modes R/W
0: Inputs or outputs data with MSB first
1: Inputs or outputs data with LSB first
9:8 PTC[1:0] Setting of Parity Bit in UART Mode R/W
0 0: Transmission: Does not output the parity bit
Reception: Receives without parity
0 1: Transmission: Outputs 0 parity*1
Reception: No parity judgment
1 0: Transmission: Outputs even parity
Reception: Determines as even parity
1 1: Transmission: Outputs odd parity
Reception: Determines as odd parity
11:10 — These bits are read as 0. The write value should be 0. R/W
13:12 DCP[1:0] Selection of Data and Clock Phase in Simplified SPI Mode R/W
0 0: Type1 (SCK: inverted, Input timing: rising edge)
0 1: Type2 (SCK: non-inverted, Input timing: falling edge)
1 0: Type3 (SCK: inverted, Input timing: falling edge)
1 1: Type4 (SCK: non-inverted, Input timing: rising edge)
15:14 TRXE[1:0] Setting of Channel 2 Operation Mode R/W
0 0: Disables communication
0 1: Reception only
1 0: Transmission only
1 1: Transmission and reception
Note 1. 0 is always added regardless of the data contents.
The SCR02 is a communication operation setting register of channel 2. It is used to set a data transmission and reception
mode, phase of data and clock, whether an error signal is to be masked or not, parity bit, start bit, stop bit, and data length.
Rewriting the SCR02 register is prohibited when the register is in operation (when SE0.SE[2] = 1).
DLS bit (Setting of Data Length in Simplified SPI and UART Modes)
Be sure to set DLS = 1 in the simplified I2C mode.
Set 1 bit (SLC[1:0] = 01b) during UART reception or in the simplified I2C mode. Set no stop bit (SLC[1:0] = 00b) in the
simplified SPI mode.
Set 1 bit (SLC[1:0] = 01b) or 2 bits (SLC[1:0] = 10b) during UART transmission.
DIR bit (Selection of Data Transfer Sequence in Simplified SPI and UART Modes)
Be sure to clear DIR = 0 in the simplified I2C mode.
DCP[1:0] bits (Selection of Data and Clock Phase in Simplified SPI Mode)
See Figure 21.3.
Be sure to set DCP[1:0] = 00b in the UART mode and simplified I2C mode.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 DLS Setting of Data Length in Simplified SPI and UART Modes R/W
0: 7-bit data length (stored in the DAT[6:0] bits of the SDR03 register)
1: 8-bit data length (stored in the DAT[7:0] bits of the SDR03 register)
2:1 — These bits are read as 1. The write value should be 1. R/W
3 — This bit is read as 0. The write value should be 0. R/W
4 SLC Setting of Stop Bit in UART Mode R/W
0: No stop bit
1: Stop bit length = 1 bit
6:5 — These bits are read as 0. The write value should be 0. R/W
7 DIR Selection of Data Transfer Sequence in Simplified SPI and UART Modes R/W
0: Inputs or outputs data with MSB first
1: Inputs or outputs data with LSB first
9:8 PTC[1:0] Setting of Parity Bit in UART Mode R/W
0 0: Transmission: Does not output the parity bit
Reception: Receives without parity
0 1: Transmission: Outputs 0 parity*1
Reception: No parity determination
1 0: Transmission: Outputs even parity
Reception: Determines as even parity
1 1: Transmission: Outputs odd parity
Reception: Determines as odd parity
10 EOC Mask Control of Error Interrupt Signal SAU0_UART_ERRI1 R/W
0: Disables generation of error interrupt SAU0_UART_ERRI1 (SAU0_UART_RXI1 is
generated)
1: Enables generation of error interrupt SAU0_UART_ERRI1 (SAU0_UART_RXI1 is
not generated if an error occurs)
11 — This bit is read as 0. The write value should be 0. R/W
13:12 DCP[1:0] Selection of Data and Clock Phase in Simplified SPI Mode R/W
0 0: Type1 (SCK: inverted, Input timing: rising edge)
0 1: Type2 (SCK: non-inverted, Input timing: falling edge)
1 0: Type3 (SCK: inverted, Input timing: falling edge)
1 1: Type4 (SCK: non-inverted, Input timing: rising edge)
15:14 TRXE[1:0] Setting of Operation Mode of Channel 3 R/W
0 0: Disable communication
0 1: Reception only
1 0: Transmission only
1 1: Transmission and reception
Note 1. 0 is always added regardless of the data contents.
The SCR03 is a communication operation setting register of channel 3. It is used to set a data transmission and reception
mode, phase of data and clock, whether an error signal is to be masked or not, parity bit, start bit, stop bit, and data length.
Rewriting the SCR03 register is prohibited when the register is in operation (when SE0.SE[3] = 1).
DLS bit (Setting of Data Length in Simplified SPI and UART Modes)
Be sure to set DLS = 1 in the simplified I2C mode.
DIR bit (Selection of Data Transfer Sequence in Simplified SPI and UART Modes)
Be sure to clear DIR = 0 in the simplified I2C mode.
DCP[1:0] bits (Selection of Data and Clock Phase in Simplified SPI Mode)
See Figure 21.3.
Be sure to set DCP[1:0] = 00b in the UART mode and simplified I2C mode.
21.3.8 SDRmn : Serial Data Register mn (mn = 00, 01, 02, 03, 10, 11)
Base address: SAUm = 0x400A_2000 + 0x200 × m
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Note 1. Only the following UARTs support the 9-bit data length.
● UART0 and UART2
21.3.9 SIRmn : Serial Flag Clear Trigger Register mn (mn = 00, 02, 10)
Base address: SAUm = 0x400A_2000 + 0x200 × m
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The SIRmn is a trigger register that is used to clear each error flag of channel n.
When each bit (PECT, OVCT) of this register is set to 1, the corresponding bit (PEF, OVF) of serial status register mn is
cleared to 0. Because the SIRmn is a trigger register, it is cleared immediately when the corresponding bit of the SSRmn
register is cleared. When the SIRmn register is read, 0x0000 is always read.
21.3.10 SIRmn : Serial Flag Clear Trigger Register mn (mn = 01, 03, 11)
Base address: SAUm = 0x400A_2000 + 0x200 × m
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The SIRmn is a trigger register that is used to clear each error flag of channel n.
When each bit (FECT, PECT, OVCT) of this register is set to 1, the corresponding bit (FEF, PEF, OVF) of serial status
register mn is cleared to 0. Because the SIRmn is a trigger register, it is cleared immediately when the corresponding bit of
the SSRmn register is cleared. When the SIRmn register is read, 0x0000 is always read.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
<Setting condition>
● Even though receive data is stored in the SDRmn register, that data is not read and transmit data or the next receive data
is written while the TRXE[0] bit of the SCRmn register is set to 1 (reception or transmission and reception mode in
each communication mode).
● Transmit data is not ready for slave transmission or transmission and reception in simplified SPI mode.
<Setting condition>
● The parity of the transmit data and the parity bit do not match when UART reception ends (parity error).
● No ACK signal is returned from the slave at the ACK reception timing during I2C transmission (ACK is not detected).
BFF bit (Flag Indicating the State of the Buffer Register for Channel n)
<Clearing condition>
● Transferring transmit data from the SDRmn register to the shift register ends during transmission.
● Reading receive data from the SDRmn register ends during reception.
● The ST[n] bit of the STm register is set to 1 (communication is stopped) or the SS[n] bit of the SSm register is set to 1
(communication is enabled).
<Setting condition>
● Transmit data is written to the SDRmn register while the TRXE[1] bit of the SCRmn register is set to 1 (transmission or
transmission and reception mode in each communication mode).
● Receive data is stored in the SDRmn register while the TRXE[0] bit of the SCRmn register is set to 1 (reception or
transmission and reception mode in each communication mode).
● A reception error occurs.
<Setting condition>
● Communication starts.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
<Setting condition>
● Even though receive data is stored in the SDRmn register, that data is not read and transmit data or the next receive data
is written while the TRXE[0] bit of the SCRmn register is set to 1 (reception or transmission and reception mode in
each communication mode).
● Transmit data is not ready for slave transmission or transmission and reception in simplified SPI mode.
<Setting condition>
● The parity of the transmit data and the parity bit do not match when UART reception ends (parity error).
● No ACK signal is returned from the slave at the ACK reception timing during I2C transmission (ACK is not detected).
<Setting condition>
● A stop bit is not detected when UART reception ends.
BFF bit (Flag Indicating the State of the Buffer Register for Channel n)
<Clearing condition>
● Transferring transmit data from the SDRmn register to the shift register ends during transmission.
● Reading receive data from the SDRmn register ends during reception.
● The ST[n] bit of the STm register is set to 1 (communication is stopped) or the SS[n] bit of the SSm register is set to 1
(communication is enabled).
<Setting condition>
● Transmit data is written to the SDRmn register while the TRXE[1] bit of the SCRmn register is set to 1 (transmission or
transmission and reception mode in each communication mode).
● Receive data is stored in the SDRmn register while the TRXE[0] bit of the SCRmn register is set to 1 (reception or
transmission and reception mode in each communication mode).
● A reception error occurs.
<Setting condition>
● Communication starts.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Note: For the UART reception, set the TRXE[0] bit of SCR0n register to 1, and then be sure to set the SS[n] bit to 1 after at least 4 fMCK
clock cycles have elapsed.
Note 1. Setting an SS[n] bit to 1 during communications stops communications through channel n and places the channel in the waiting
state. At this time, the values of the control registers and shift register, the states of the SCKp and SOp pins, and the values of the
SSR0n.FEF, PEF, and OVF flags are retained.
The SS0 is a trigger register that is used to enable starting communication or count by each channel of serial array unit 0.
When 1 is written to a bit (SS[n]) of this register, the corresponding bit (SE[n]) of serial channel enable status register 0
(SE0) is set to 1 (operation is enabled). Because the SS[n] bit is a trigger bit, it is cleared immediately when SE0.SE[n] = 1.
When the SS0 register is read, 0x0000 is always read.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
When 1 is written to a bit (ST[n]) of this register, the corresponding bit (SE[n]) of serial channel enable status register 0
(SE0) is cleared to 0 (operation is stopped). Because the ST[n] bit is a trigger bit, it is cleared immediately when SE0.SE[n]
= 0. When the ST0 register is read, 0x0000 is always read.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The SE0 register indicates whether data transmission and reception operation of each channel of serial array unit 0 is
enabled or stopped. When 1 is written to a bit of serial channel start register 0 (SS0), the corresponding bit of this register is
set to 1. When 1 is written to a bit of serial channel stop register 0 (ST0), the corresponding bit is cleared to 0.
For channel n whose operation is enabled, the value of the CKO[n] bit of serial output register 0 (SO0) to be described later
cannot be rewritten by software, and a value reflected by a communication operation is output from the serial clock pin.
For channel n whose operation is stopped, the value of the CKO[n] bit of the SO0 register can be set by software and is
output from the serial clock pin. In this way, any waveform, such as that of a start condition or stop condition, can be created
by software.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The SE1 register indicates whether data transmission and reception operation of each channel of serial array unit 1 is
enabled or stopped. When 1 is written to a bit of serial channel start register 1 (SS1), the corresponding bit of this register is
set to 1. When 1 is written to a bit of serial channel stop register 1 (ST1), the corresponding bit is cleared to 0.
For channel n whose operation is enabled, the value of the CKO[n] bit of serial output register 1 (SO1) to be described later
cannot be rewritten by software, and a value reflected by a communication operation is output from the serial clock pin.
For channel n whose operation is stopped, the value of the CKO[n] bit of the SO1 register can be set by software and is
output from the serial clock pin. In this way, any waveform, such as that of a start condition or stop condition, can be created
by software.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The SOE0 register is used to enable or stop output of the serial communication operation of each channel of serial array unit
0.
For channel n whose serial output is enabled, the value of the SO[n] bit of serial output register 0 (SO0) to be described later
cannot be rewritten by software, and a value reflected by a communication operation is output from the serial data output
pin.
For channel n, whose serial output is stopped, the SO[n] bit value of the SO0 register can be set by software, and that value
can be output from the serial data output pin. In this way, any waveform, such as that of a start condition or stop condition,
can be created by software.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The SOE1 register is used to enable or stop output of the serial communication operation of each channel of serial array unit
1.
For channel n whose serial output is enabled, the value of the SO[n] bit of serial output register 1 (SO1) to be described later
cannot be rewritten by software, and a value reflected by a communication operation is output from the serial data output
pin.
For channel n, whose serial output is stopped, the SO[n] bit value of the SO1 register can be set by software, and that value
can be output from the serial data output pin. In this way, any waveform, such as that of a start condition or stop condition,
can be created by software.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The SO0 is a buffer register for serial output of each channel of serial array unit 0.
The value of the SO[n] bit of this register is output from the serial data output pin of channel n.
The value of the CKO[n] bit of this register is output from the serial clock output pin of channel n.
The SO[n] bit of this register can be rewritten by software only when serial output is disabled (SOE0.SOE[n] = 0). When
serial output is enabled (SOE0.SOE[n] = 1), rewriting by software is ignored, and the value of the register can be changed
only by a serial communication operation.
The CKO[n] bit of this register can be rewritten by software only when the channel operation is stopped (SE0.SE[n] = 0).
While channel operation is enabled (SE0.SE[n] = 1), rewriting by software is ignored, and the value of the CKO[n] bit can
be changed only by a serial communication operation.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The SO1 is a buffer register for serial output of each channel of serial array unit 1.
The value of the SO[n] bit of this register is output from the serial data output pin of channel n.
The value of the CKO[n] bit of this register is output from the serial clock output pin of channel n.
The SO[n] bit of this register can be rewritten by software only when serial output is disabled (SOE1.SOE[n] = 0). When
serial output is enabled (SOE1.SOE[n] = 1), rewriting by software is ignored, and the value of the register can be changed
only by a serial communication operation.
The CKO[n] bit of this register can be rewritten by software only when the channel operation is stopped (SE1.SE[n] = 0).
While channel operation is enabled (SE1.SE[n] = 1), rewriting by software is ignored, and the value of the CKO[n] bit can
be changed only by a serial communication operation.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 SOL0 Selects Inversion of the Level of the Transmit Data of Channel 0 in UART Mode R/W
0: Communication data is output as is
1: Communication data is inverted and output
1 — This bit is read as 0. The write value should be 0. R/W
2 SOL2 Selects Inversion of the Level of the Transmit Data of Channel 2 in UART Mode R/W
0: Communication data is output as is
1: Communication data is inverted and output
15:3 — These bits are read as 0. The write value should be 0. R/W
The SOL0 register is used to set inversion of the data output level of each channel of serial array unit 0.
This register can be set only in the UART mode. Be sure to set 0 for the bit corresponding the channel used in the simplified
SPI mode or simplified I2C mode.
Inverting channel n by using this register is reflected on pin output only when serial output is enabled (SOE0.SOE[n] = 1).
When serial output is disabled (SOE0.SOE[n] = 0), the value of the SO0.SO[n] bit is output as is.
Rewriting the SOL0 register is prohibited when the channel n is in operation (when SE0.SE[n] = 1).
Figure 21.4 shows examples in which the level of transmit data is reversed during UART transmission.
SOLm.SOLn = 0 output
TXDq
ST Transmit data P S
SOLm.SOLn = 1 output
TXDq
ST P S
Transmit data (inverted)
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 SOL0 Selects Inversion of the Level of the Transmit Data of Channel 0 in UART Mode R/W
0: Communication data is output as is
1: Communication data is inverted and output
15:1 — These bits are read as 0. The write value should be 0. R/W
The SOL1 register is used to set inversion of the data output level of each channel of serial array unit 1.
This register can be set only in the UART mode. Be sure to set 0 for the bit corresponding the channel used in the simplified
SPI mode or simplified I2C mode.
Inverting channel n by using this register is reflected on pin output only when serial output is enabled (SOE1.SOE[n] = 1).
When serial output is disabled (SOE1.SOE[n] = 0), the value of the SO1.SO[n] bit is output as is.
Rewriting the SOL1 register is prohibited when the channel n is in operation (when SE1.SE[n] = 1).
Figure 21.4 shows examples in which the level of transmit data is reversed during UART transmission.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The SSC0 register is used to control the startup of reception (the Snooze mode) while in the Software Standby mode when
receiving SPI00 or UART0 serial data.
SSEC bit (Selection of whether to Enable or Disable the Generation of Communication Error Interrupts in
the Snooze Mode)
● The SSEC bit can be set to 1 or 0 only when both the SWC and SCRmn.EOC bits are set to 1 during UART reception in
the Snooze mode. In other cases, clear the SSEC bit to 0.
● Setting SSEC, SWC = 1, 0 is prohibited.
Table 21.5 shows the interrupt in UART reception operation in Snooze mode.
Table 21.5 Interrupt in UART reception operation in Snooze mode
SCRmn.EOC bit SSEC bit Reception ended successfully Reception ended in an error
Bit position: 7 6 5 4 3 2 1 0
SSIE0
Bit field: — — — — — ISC1 ISC0
0
Bit position: 7 6 5 4 3 2 1 0
Note 1. Be sure to clear bits [7:5], bit [3] and bit [1].
The SNFEN register is used to set whether the noise filter can be used for the input signal from the serial data input pin to
each channel.
Disable the noise filter of the pin used for simplified SPI or simplified I2C communication, by clearing the corresponding bit
of this register to 0.
Enable the noise filter of the pin used for UART communication, by setting the corresponding bit of this register to 1. When
the noise filter is enabled, after synchronization is performed with the operation clock (fMCK) of the target channel, 2-clock
match detection is performed. When the noise filter is disabled, only synchronization is performed with the operation clock
(fMCK) of the target channel.
Bit position: 7 6 5 4 3 2 1 0
The ULBS register is used to enable the UART loopback function. This register has bits to individually control UART
channels. When the bit corresponding to each channel is set to 1, the UART loopback function is selected, and output from
the transmission shift register is looped back to the reception shift register.
Table 21.9 Setting of serial output register m (SOm) when sopping the operation by channels
Bit Symbol Set value Function
[Clock control]
● Master or slave selection
● Phase control of I/O clock
● Setting of transfer period by prescaler and internal counter of each channel
● Maximum transfer rate*1
– During master communication:
• Max. PCLKB/2 (SPI00 only)
• Max. PCLKB/4
– During slave communication:
• Max. fMCK/6
[Interrupt function]
● Transfer end interrupt or buffer empty interrupt (SAU0_SPI_TXRXI00/SAU0_SPI_TXRXI11/SAU1_SPI_TXRXI20)
In addition, simplified SPIs of following channels support the Snooze mode. In the Snooze mode, data can be received
without CPU processing upon detecting SCK input in the Software Standby mode. The Snooze mode is only available in
SPI00, which support asynchronous reception.
Note 1. Set up the transfer rate within a range satisfying the SCK cycle time (tKCY). For details, see section 31, Electrical
Characteristics .
Note: Use a general-purpose port pin to send a chip select signal when required.
The channels supporting simplified SPI are channels 0 and 3 of SAU0 and channel 0 of SAU1. See Table 21.1 and Table
21.2.
Simplified SPI performs the following seven types of communication operations.
● Master transmission (See section 21.5.1. Master Transmission.)
● Master reception (See section 21.5.2. Master Reception.)
● Master transmission and reception (See section 21.5.3. Master Transmission and Reception.)
● Slave transmission (See section 21.5.4. Slave Transmission.)
● Slave reception (See section 21.5.5. Slave Reception.)
● Slave transmission and reception (See section 21.5.6. Slave Transmission and Reception.)
● Snooze mode function (See section 21.5.7. Snooze Mode Function.)
Table 21.11 Example of serial mode register mn (SMRmn) contents for master transmission of simplified
SPI (2 of 2)
Bit Symbol Set value Function
Table 21.14 Example of serial output register m (SOm) contents for master transmission of simplified
SPI
Bit Symbol Set value Function
<6> Setting the SOm register Set the initial output level of the serial clock (SOm.CKO[n])
and serial data (SOm.SO[n]).
<7> Setting of the SOEm register Set the SOEm.SOE[n] bit to 1 and enable data output of the
target channel.
<8> Setting port Set a Peripheral Select register, a Pmn Output Data Register
and a Pmn Direction Register (enable data output and clock
output of the target channel)
<9> Writing to the SSm register Set the SSm.SS[n] bit of the target channel to 1 and set
SEm.SE[n] bit = 1 to enable operation.
<10> Completing initial setting Setting of SAU is completed.
Write transmit data to the SDRmn.DAT[7:0] bits and start
communication.
<6> Changing setting of the SMRmn register Reset the register to change serial mode register mn
(optional) (SMRmn) setting.
<7> Changing setting of the SCRmn register Reset the register to change serial communication operation
(optional) setting register mn (SCRmn) setting.
<8> Changing setting of the SOEm register Set the SOEm.SOE[n] bit to 0 to stop output from the target
(optional) channel.
<9> Changing setting of the SOm register Set the initial output level of the serial clock (SOm.CKO[n])
(optional) and serial data (SOm.SO[n]).
<10> Changing setting of the SOEm register Set the SOEm.SOE[n] bit to 1 and enable output from the
target channel.
<11> Port manipulation Enable data output and clock output of the target channel.
<12> Writing to the SSm register Set the SSm.SS[n] bit of the target channel to 1 and set
SEm.SE[n] = 1 to enable operation.
<13> Completing resumption setting Setting is completed.
Set transmit data to the SDRmn.DAT[7:0] bits and start
communication.
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3)
SSm.SS[n]
STm.ST[n]
SEm.SE[n]
SCKp pin
SOp pin Transmit data 1 Transmit data 2 Transmit data 3
SAUm_SPI_TXRXIp
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), p: SPI number (p = 00, 11, 20), mn = 00 to 03, 10 to 11
Figure 21.5 Timing of master transmission (in single transmission mode) (type 1: SCRmn.DCP[1:0] = 00b)
Figure 21.6 shows the flowchart of master transmission (in single transmission mode).
Set data for transmission and the number of data. Clear communication end flag
Main routine
Setting transmit data (Storage area, Transmission data pointer, Number of communication data and
Communication end flag are optionally set on the internal RAM by the software)
Enable interrupt
No
Transmitting next data?
Yes
Writing transmit data to the Sets communication Read transmit data, if any, from storage area and
completion flag write it to the SDRmn.DAT[7:0] bits. Update
SDRmn.DAT[7:0] bits
transmit data pointer. If not, set transmit end flag
Yes
Main routine
Disable interrupt
End of communication
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), p: SPI number (p = 00, 11, 20)
Note 1. See Table 21.17.
SSm.SS[n] <1>
STm.ST[n] <6>
SEm.SE[n]
SAUm_SPI_TXRXIp
Data transmission Data transmission Data transmission
SMRmn.MD0
<4>
SSRmn.TSF
SSRmn.BFF
Note: The MD0 bit of serial mode register mn (SMRmn) can be rewritten even during operation.
However, rewrite it before transfer of the last bit is started, so that it has been rewritten before the transfer end interrupt of
the last transmit data.
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), p: SPI number (p = 00, 11, 20), mn = 00 to 03, 10 to 11
Note 1. If transmit data is written to the SDRmn register while the BFF bit of serial status register mn (SSRmn) is 1 (valid data is
stored in serial data register mn (SDRmn)), the transmit data is overwritten.
Figure 21.7 Timing of master transmission (in continuous transmission mode) (type 1: SCRmn.DCP[1:0] =
00b)
Figure 21.8 shows the flowchart of master transmission (in continuous transmission mode).
Starting setting
<1>
For the initial setting, see*1.
SAU initial setting (Select buffer empty interrupt)
Set the data pointer for transmission and the number of data items. Clear
communication end flag
Main routine
Enable interrupt
communication data 0? then write into the SDRmn.DAT[7:0] bits, and update
transmit data pointer and number of transmit data.
Yes If no more transmit data, clear SMRmn.MD0 bit if
it’s set. If not, finish.
No
Check completion of transmission by
Transmission completed?
verifying transmit end flag
Yes
Set SMRmn.MD0 bit
to 1
Main routine
Yes Communication
continued?
No
Disable interrupt
End of communication
Note: <1> to <6> in the figure correspond to <1> to <6> in Figure 21.7.
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), p: SPI number (p = 00, 11, 20)
Note 1. See Table 21.17.
Table 21.25 Example of serial output enable register m (SOEm) contents for master reception of simplified
SPI
Bit Symbol Set value Function
n SOE[n] x Bit that cannot be used in this mode (set to the initial value when not used in any mode)
Note: ×: Bit that cannot be used in this mode (set to the initial value when not used in any mode)
0/1: Set to 0 or 1 depending on the usage of the user
<6> Setting the SOm register Set the initial output level of the serial clock (SOm.CKO[n]).
<7> Setting port Enable clock output of the target channel.
<8> Writing to the SSm register Set the SSm.SS[n] bit of the target channel to 1 and set
SEm.SE[n] = 1 to enable operation.
<9> Completing initial setting Initial setting is completed.
Set dummy data to the SDRmn.DAT[7:0] bits and start
communication.
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3)
Table 21.28 shows the procedure for stopping master reception.
<6> Changing setting of the SMRmn register Reset the register to change serial mode register mn
(optional) (SMRmn) setting.
<7> Changing setting of the SCRmn register Reset the register to change serial communication operation
(optional) setting register mn (SCRmn) setting.
<8> Changing setting of the SOm register Set the initial output level of the serial clock (SOm.CKO[n]).
(optional)
<9> Clearing error flag If the SSRmn.OVF flag remains set, clear this using serial flag
clear trigger register mn (SIRmn).
<10> Port manipulation Enable clock output of the target channel.
<11> Writing to the SSm register Set the SSm.SS[n] bit of the target channel to 1 and set
SEm.SE[n] = 1 to enable operation.
<12> Completing resumption setting Setting is completed.
Set dummy data to the SDRmn.DAT[7:0]) bits and start
communication.
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3)
SSm.SS[n]
STm.ST[n]
SEm.SE[n]
Receive data 1 Receive data 2 Receive data 3
SDRmn.DAT[7:0] Dummy data for reception Dummy data Dummy data
Write Write Write
Read Read Read
SCKp pin
SAUm_SPI_TXRXIp
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), p: SPI number (p = 00, 11, 20), mn = 00 to 03, 10 to 11
Figure 21.9 Timing of master reception (in single reception mode) (type 1: SCRmn.DCP[1:0] = 00b)
Figure 21.10 shows the flowchart of master reception (in single reception mode).
Setting receive data (Storage area, Reception data pointer, and number of communication data are
optionally set on the internal RAM by the software)
Enable interrupt
No
All reception completed? Check the number of communication data
Yes
Main routine
Disable interrupt
End of communication
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), p: SPI number (p = 00, 11, 20)
Note 1. See Table 21.27.
SSm.SS[n] <1>
<8>
STm.ST[n]
SEm.SE[n] Receive data 3
SDRmn.DAT[7:0] Dummy data Dummy data Receive data 1 Dummy data Receive data 2
<2> Write <2> Write <2> Write
Read Read Read
SCKp pin
Shift register mn Reception & shift operation Reception & shift operation Reception & shift operation
SAUm_SPI_TXRXIp
Data reception Data reception Data reception
SMRmn.MD0
<5>
SSRmn.TSF
SSRmn.BFF
Figure 21.11 Timing of master reception (in continuous reception mode) (type 1: DCPmn[1:0] = 00b)
Figure 21.12 shows the flowchart of master reception (in continuous reception mode).
Enable interrupt
No
SSRmn.BFF = 1?
Yes
<4>
Reading receive data from Read receive data, if any, then write them to
Interrupt processing routine
the SDRmn.DAT[7:0]) bits storage area, and update receive data pointer
<7>
(also subtract 1 from number of communication
Subtract 1 from number of data)
communication data
=0 Number of communication
³2
data?
<2>
<5> =1
Writing dummy data to
Clear SMRmn.MD0 bit to 0
the SDRmn.DAT[7:0]) bits
Yes
Communication continued?
No
Disable interrupt
End of communication
Note: <1> to <8> in the figure correspond to <1> to <8> in Figure 21.11.
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), p: SPI number (p = 00, 11, 20)
Note 1. See Table 21.27.
Table 21.31 Example of serial mode register mn (SMRmn) contents for master transmission and reception of
simplified SPI (2 of 2)
Bit Symbol Set value Function
Table 21.34 Example of serial output register m (SOm) contents for master transmission and reception of
simplified SPI (2 of 2)
Bit Symbol Set value Function
n+8 CKO[n] 0/1 Communication starts when a bit is 1 if the clock phase is non-reversed (SCRmn.DCP[0] =
0). If the clock phase is reversed (SCRmn.DCP[0] = 1), communication starts when a bit is
0
<6> Setting the SOm register Set the initial output level of the serial clock (SOm.CKO[n])
and serial data (SOm.SO[n]).
<7> Changing setting of the SOEm register Set the SOEm.SOE[n] bit to 1 and enable data output of the
target channel
<8> Setting port Enable data output and clock output of the target channel.
<9> Writing to the SSm register Set the SSm.SS[n] bit of the target channel to 1 and set
SEm.SE[n] bit to 1 to enable operation.
<10> Completing initial setting Initial setting is completed.
Set transmit data to the SDRmn.DAT[7:0] bits and start.
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3)
Table 21.38 shows the procedure for stopping master transmission and reception.
<6> Changing setting of the SMRmn register Reset the register to change serial mode register mn
(optional) (SMRmn) setting.
<7> Changing setting of the SCRmn register Reset the register to change serial communication operation
(optional) setting register mn (SCRmn) setting.
<8> Clearing error flag (optional) If the SSRmn.OVF flag remains set, clear this using serial flag
clear trigger register mn (SIRmn).
<9> Changing setting of the SOEm register Set the SOEm.SOE[n] bit to 0 to stop output from the target
(optional) channel.
<10> Changing setting of the SOm register Set the initial output level of the serial clock (SOm.CKO[n])
(optional) and serial data (SOm.SO[n]).
<11> Changing setting of the SOEm register Set the SOEm.SOE[n] bit to 1 and enable output from the
(optional) target channel.
<12> Port manipulation Enable data output and clock output of the target channel.
<13> Writing to the SSm register Set the SSm.SS[n] bit of the target channel to 1 and set the
SEm.SE[n] bit to 1 to enable operation.
<14> Completing resumption setting —
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3)
SSm.SS[n]
STm.ST[n]
SEm.SE[n]
Receive data 1 Receive data 2 Receive data 3
SDRmn.DAT[7:0] Transmit data 1 Transmit data 2 Transmit data 3
Write Write Write
Read Read Read
SCKp pin
Shift register mn Reception & shift operation Reception & shift operation Reception & shift operation
SSRmn.TSF
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), p: SPI number (p = 00, 11, 20), mn = 00 to 03, 10 to 11
Figure 21.13 Timing of master transmission and reception (in single transmission and reception mode)
(type 1: SCRmn.DCP[1:0] = 00b)
Figure 21.14 shows the flowchart of master transmission and reception (in single transmission and reception mode).
software)
Enable interrupt
Read receive data from Read receive data then write to storage area and update receive
the SDRmn.DAT[7:0] bits data pointer
Yes
Main routine
Disable interrupt
End of communication
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), p: SPI number (p = 00, 11, 20)
Note 1. See Table 21.37.
Figure 21.14 Flowchart of master transmission and reception (in single transmission and reception mode)
SSm.SS[n] <1>
STm.ST[n] <8>
SEm.SE[n]
Receive data 3
SDRmn.DAT[7:0] Transmit data 1 Transmit data 2 Receive data 1 Transmit data 3 Receive data 2
Write Write Write
Read Read Read
SCKp pin
Shift register mn Reception & shift operation Reception & shift operation Reception & shift operation
SSRmn.TSF
SSRmn.BFF
Note: The MD0 bit of serial mode register mn (SMRmn) can be rewritten even during operation.
However, rewrite it before transfer of the last bit is started, so that it has been rewritten before the transfer end interrupt of
the last transmit data.
Note: <1> to <8> in the figure correspond to <1> to <8> in Figure 21.16.
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), p: SPI number (p = 00, 11, 20)
mn = 00 to 03, 10 to 11
Note 1. If transmit data is written to the SDRmn register while the BFF bit of serial status register mn (SSRmn) is 1 (valid data is
stored in serial data register mn (SDRmn)), the transmit data is overwritten.
Note 2. The transmit data can be read by reading the SDRmn register during this period. Reading this register does not affect
the transfer operation.
Figure 21.15 Timing of master transmission and reception (in continuous transmission and reception
mode) (type 1: SCRmn.DCP[1:0] = 00b)
Figure 21.16 shows the flowchart of master transmission and reception (in continuous transmission and reception mode)
Starting setting
Enable interrupt
No
SSRmn.BFF = 1?
Yes
<4>
Reading reception data to
the SDRmn.DAT[7:0] bits Except for initial interrupt, read data received
<7> then write them to storage area, and update
Interrupt processing routine
No Number of communication
data = 0?
Yes
Set SMRmn.MD0 bit
to 1
Yes
Continuing Communication?
Main routine
No
Disable interrupt
End of communication
Note: <1> to <8> in the figure correspond to <1> to <8> in Figure 21.15
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), p: SPI number (p = 00, 11, 20)
Note 1. See Table 21.37.
Figure 21.16 Flowchart of master transmission and reception (in continuous transmission and reception
mode
1: Clock input fSCK from the SCKp pin (slave transfer in simplified SPI mode)
Table 21.41 Example of serial mode register mn (SMRmn) contents for slave transmission of simplified
SPI (2 of 2)
Bit Symbol Set value Function
Note: ×: Bit that cannot be used in this mode (set to the initial value when not used in any mode)
0/1: Set to 0 or 1 depending on the usage of the user
<6> Changing setting of the SMRmn register Reset the register to change serial mode register mn
(optional) (SMRmn) setting.
<7> Changing setting of the SCRmn register Reset the register to change serial communication operation
(optional) setting register mn (SCRmn) setting.
<8> Clearing error flag (optional) If the SSRmn.OVF flag remains set, clear this using serial flag
clear trigger register mn (SIRmn).
<9> Changing setting of the SOEm register Set the SOEm.SOE[n] bit to 0 to stop output from the target
(optional) channel.
<10> Changing setting of the SOm register Set the initial output level of the serial data (SOm.SO[n]).
<11> Changing setting of the SOEm register Set the SOEm.SOE[n] bit to 1 and enable output from the
target channel.
<12> Port manipulation Enable data output of the target channel.
<13> Writing to the SSm register Set the SSm.SS[n] bit of the target channel to 1 and set
SEm.SE[n] to 1 to enable operation.
<14> Starting communication Sets transmit data to set the SEm.SE[n] bit and wait for a
clock from the master.
<15> Completing resumption setting —
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3)
SSm.SS[n]
STm.ST[n]
SEm.SE[n]
SDRmn.DAT[7:0] Transmit data 1 Transmit data 2 Transmit data 3
SCKp pin
SAUm_SPI_TXRXIp
Data transmission Data transmission Data transmission
SSRmn.TSF
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), p: SPI number (p = 00, 11, 20), mn = 00 to 03, 10 to 11
Figure 21.17 Timing of slave transmission (in single transmission mode) (type 1: SCRmn.DCP[1:0] = 00b)
Figure 21.18 shows the flowchart of slave transmission (in single transmission mode).
Set storage area and the number of data for transmit data
Main routine
Setting transmit data (storage area, transmission data pointer, and number of
communication data are optionally set in the internal RAM by
software)
Enable interrupt
routine
Yes
Transmitting next data? Determine if it completes by counting number of communication data
No
Yes
Continuing transmit?
Main routine
No
Disable interrupt
End of communication
SSm.SS[n] <1>
STm.ST[n] <6>
SEm.SE[n]
SAUm_SPI_TXRXIp
Data transmission Data transmission Data transmission
SMRmn.MD0
<4>
SSRmn.TSF
SSRmn.BFF
Note: The MD0 bit of serial mode register mn (SMRmn) can be rewritten even during operation. However, rewrite it before
transfer of the last bit is started.
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), p: SPI number (p = 00, 11, 20), mn = 00 to 03, 10 to 11
Note 1. If transmit data is written to the SDRmn register while the BFF bit of serial status register mn (SSRmn) is 1 (valid data is
stored in serial data register mn (SDRmn)), the transmit data is overwritten.
Figure 21.19 Timing of slave transmission (in continuous transmission mode) (type 1: SCRmn.DCP[1:0] =
00b)
Figure 21.20 shows the flowchart of slave transmission (in continuous transmission mode).
Starting setting
Set storage area and the number of data for transmit data
Main routine
Setting transmit data (Storage area, Transmission data pointer, Number of communication data and
Communication end flag are optionally set on the internal RAM by the software)
Enable interrupt
If transmit data is left, read them from storage area then write into
Number of communication No the SDRmn.DAT[7:0] bits, and update transmit data pointer.
Interrupt processing routine
data 1?
If not, change the interrupt to transmission end interrupt.
Yes
Reading transmit data
No Number of communication
data = -1?
Yes
Set SMRmn.MD0 bit
to 1
Main routine
Yes
Communication continued?
No
Disable interrupt
End of communication
Note: <1> to <6> in the figure correspond to <1> to <6> in Figure 21.19.
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3)
Note 1. See Table 21.47.
1: Clock input fSCK from the SCKp pin (slave transfer in simplified SPI mode)
n SO[n] x Bit that cannot be used in this mode (set to the initial value when not used in any mode)
n+8 CKO[n] x Bit that cannot be used in this mode (set to the initial value when not used in any mode)
n SOE[n] x Bit that cannot be used in this mode (set to the initial value when not used in any mode)
Table 21.56 Example of serial channel start register m (SSm) contents for slave reception of simplified
SPI
Bit Symbol Set value Function
Note: ×: Bit that cannot be used in this mode (set to the initial value when not used in any mode)
0/1: Set to 0 or 1 depending on the usage of the user
SSm.SS[n]
STm.ST[n]
SEm.SE[n]
Receive data 3
SDRmn.DAT[7:0] Receive data 1 Receive data 2
Shift register mn Reception & shift operation Reception & shift operation Reception & shift operation
SAUm_SPI_TXRXIp
Data reception Data reception Data reception
SSRmn.TSF
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), p: SPI number (p = 00, 11, 20), mn = 00 to 03, 10 to 11
Figure 21.21 Timing of slave reception (in single reception mode) (type 1: SCRmn.DCP[1:0] = 00b)
Figure 21.22 shows the flowchart of slave reception (in single reception mode).
Preparation for reception (storage area, reception data pointer, and number of communication
data are optionally set in the internal RAM by software)
Enable interrupt
generated.
Transfer end interrupt
No
Reception completed? Check completion of number of receive data
Yes
Main routine
Disable interrupt
End of communication
1: Clock input fSCK from the SCKp pin (slave transfer in simplified SPI mode)
Table 21.65 Example of serial output enable register m (SOEm) contents for slave transmission and reception of
simplified SPI
Bit Symbol Set value Function
Note: Be sure to set transmit data to the SDRmn.DAT[7:0] bits before the clock from the master is started.
Note: ×: Bit that cannot be used in this mode (set to the initial value when not used in any mode)
0/1: Set to 0 or 1 depending on the usage of the user
SSm.SS[n]
STm.ST[n]
SEm.SE[n]
Receive data 1 Receive data 2 Receive data 3
SDRmn.DAT[7:0] Transmit data 1 Transmit data 2 Transmit data 3
Write Write Write
Read Read Read
SCKp pin
Shift register mn Reception & shift operation Reception & shift operation Reception & shift operation
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), p: SPI number (p = 00, 11, 20), mn = 00 to 03, 10 to 11
Figure 21.23 Timing of slave transmission and reception (in single transmission and reception mode)
Figure 21.24 shows the flowchart of slave transmission and reception (in single transmission and reception mode).
Setting storage area and number of data for transmission and reception
Set transmission and data (storage area, transmission and reception data pointer, number of
Main routine
reception data communication data and Communication end flag are optionally set in the
internal RAM by software)
Enable interrupt
Reading receive data from Read receive data and write it to storage area. Update
the SDRmn.DAT[7:0] bits receive data pointer.
No
Transmission and reception
completed?
Yes
Yes
Main routine
Transmission and reception Update the number of communication data and confirm
next data? if next transmission and reception data is available
No
Disable interrupt
End of communication
Note: Be sure to set transmit data to the SDRmn.DAT[7:0] bits before the clock from the master is started.
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), p: SPI number (p = 00, 11, 20), mn = 00 to 03, 10 to 11
Note 1. See Table 21.67
Figure 21.24 Flowchart of slave transmission and reception (in single transmission and reception mode)
SSm.SS[n] <1>
STm.ST[n] <8>
SEm.SE[n]
Receive data 3
SDRmn.DAT[7:0] Transmit data 1 Transmit data 2 Receive data 1 Transmit data 3 Receive data 2
Write Write Write
Read Read Read
SCKp pin
Shift register mn Reception & shift operation Reception & shift operation Reception & shift operation
SSRmn.TSF
SSRmn.BFF
Note: The MD0 bit of serial mode register mn (SMRmn) can be rewritten even during operation.
However, rewrite it before transfer of the last bit is started, so that it has been rewritten before the transfer end interrupt of
the last transmit data.
Note: <1> to <8> in the figure correspond to <1> to <8> in Figure 21.26.
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), p: SPI number (p = 00, 11, 20)
mn = 00 to 03, 10 to 11
Note 1. If transmit data is written to the SDRmn register while the BFF bit of serial status register mn (SSRmn) is 1 (valid data is
stored in serial data register mn (SDRmn)), the transmit data is overwritten.
Note 2. The transmit data can be read by reading the SDRmn register during this period. At this time, the transfer operation is
not affected.
Figure 21.25 Timing of slave transmission and reception (in continuous transmission and reception mode)
(type 1: SCRmn.DCP[1:0] = 00b)
Figure 21.26 shows the flowchart of slave transmission and reception (in continuous transmission and reception mode).
Starting setting
Setting storage area and number of data for transmission and reception
Setting Transmission and data (Storage area, Transmission and reception data pointer, and
reception data number of communication data are optionally set on the internal RAM by
the software)
Main routine
Enable interrupt
Write the data for Read the data for transmission from the storage area, and
<2> transmission in write it to SDRmn.DAT[7:0] bits to update the transmission
SDRmn.DAT[7:0] bits data pointer.
No
SSRmn.BFF = 1?
Yes
<4>
Interrupt processing routine
No Number of communication
data = 0?
Yes
Set SMRmn.MD0 bit
to 1
Main routine
Yes Communication
continued?
No
Disable interrupt
End of communication
Note: Be sure to set transmit data to the SDRmn.DAT[7:0] bits before the clock from the master is started.
Note: <1> to <8> in the figure correspond to <1> to <8> in Figure 21.25
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3)
Note 1. See Table 21.67.
Figure 21.26 Flowchart of slave transmission and reception (in continuous transmission and reception
mode)
Note: The Snooze mode can only be specified when the high-speed on-chip oscillator clock or middle-speed on-chip
oscillator clock is selected for PCLKB.
Note: The maximum transfer rate when using SPI00 in the Snooze mode is 1 Mbps.
Software
State of the CPU Normal operation Standby Snooze mode Normal operation
mode
<4>
SS0.SS[0] <3> <11>
ST0.ST[0] <1> <9>
SE0.SE[0]
SSC0.SWC <10>
SSC0.SSEC L
SAU0_SPI_TXRXI00
Data reception Data reception
SSR00.TSF
Note: Before switching to the Snooze mode or after reception operation in the Snooze mode finishes, set the ST0.ST[0] bit to 1
(the SE0.SE[0] bit is cleared and the operation stops). After the receive operation completes, clear the SSC0.SWC bit to 0
(Snooze mode release).
Note: When SSC0.SWC = 1, the SSR00.BFF and OVF flags do not change.
Note: <1> to <11> in the figure correspond to <1> to <11> in Figure 21.28.
Note 1. Only read received data while SSC0.SWC = 1 and before the next valid edge of the SCK00 pin input is detected.
Figure 21.27 Timing of Snooze mode operation (on startup) (type 1: SCR00.DCP[1:0] = 00b)
Figure 21.28 shows the flowchart of Snooze mode operation (on startup).
Snooze operation
No
SSR00.TSF = 0 for all channels?
Yes
Enter the Software Standby CPU and peripheral hardware clock PCLKB supplied to the SAU is
<4> mode stopped
Software
Standby
mode
Note: <1> to <11> in the figure correspond to <1> to <11> in Figure 21.27.
Software Software
State of the CPU Normal operation Standby Snooze mode Normal operation Standby Snooze mode
mode mode
<4> <4>
SS0.SS[0] <3> <3>
ST0.ST[0] <1> <9>
SE0.SE[0]
SSC0.SWC <10>
SSC0.SSEC L
SAU0_SPI_TXRXI00
Data reception Data reception
SSR00.TSF
Note: Before switching to the Snooze mode or after reception operation in the Snooze mode finishes, set the ST0.ST[0] bit to 1
(the SE0.SE[0] bit is cleared and the operation stops). After the receive operation completes, clear the SSC0.SWC bit to 0
(Snooze mode release).
Note: When SSC0.SWC = 1, the SSR00.BFF and OVF flags do not change.
Note: <1> to <10> in the figure correspond to <1> to <10> in Figure 21.30.
Note 1. Only read received data while SSC0.SWC = 1 and before the next valid edge of the SCK00 pin input is detected.
Figure 21.29 Timing of Snooze mode operation (continuous startup) (type 1: SCR00.DCP[1:0] = 00b)
Figure 21.30 shows the flowchart of Snooze mode operation (continuous startup).
Snooze operation
No
SSR00.TSF = 0 for all channels?
Yes
<4> Enter the Software Standby CPU and peripheral hardware clock PCLKB supplied to
Software
mode
mode
SDR00.DAT[7:0] bits
Note: <1> to <10> in the figure correspond to <1> to <10> in Figure 21.29.
The operation clock (fMCK) is determined by serial clock select register m (SPSm) and CKS bit of serial mode register mn
(SMRmn) as shown in Table 21.70.
Table 21.70 Selection of operation clock for simplified SPI, UART and simplified I2C
21.5.9 Procedure for Processing Errors that Occurred During Simplified SPI
Communication
The procedure for processing errors that occurred during simplified SPI communication is described in Table 21.71.
Table 21.71 Processing procedure in case of overrun error
Step Software Manipulation State of the Hardware Remark
<1> Reads serial data register mn The BFF bit of the SSRmn register is This is to prevent an overrun error if
(SDRmn). → set to 0 and channel n is enabled to the next reception is completed during
receive data. error processing.
<2> Reads serial status register mn — The error type is identified and the read
(SSRmn). value is used to clear the error flag.
<3> Writes 1 to serial flag clear trigger The error flag is cleared. The error only during reading can be
register mn (SIRmn). cleared, by writing the value read from
→
the SSRmn register to the SIRmn
register without modification.
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), mn = 00 to 03, 10 to 11
[Interrupt function]
● Transfer end interrupt and buffer empty interrupt (SAU0_UART_TXI0/SAU0_UART_RXI0/SAU0_UART_TXI1/
SAU0_UART_RXI1/SAU1_UART_TXI2/SAU1_UART_RXI2)
● Error interrupt in case of framing error, parity error, or overrun error (SAU0_UART_ERRI0/SAU0_UART_ERRI1/
SAU1_UART_ERRI2)
In addition, UART reception of following channels supports the Snooze mode. In the Snooze mode, data can be received
without CPU processing upon detecting RXD input in the Software Standby mode. The Snooze mode is only available in
UART0, which support the reception baud rate adjustment function.
The LIN-bus is accepted in UART2 (channels 0 and 1 of unit 1).
[LIN-bus functions]
LIN-bus functions are achieved using the external interrupt (IRQ0) and timer array unit 0 (channel 7).
● Wakeup signal detection
● Break field (BF) detection
● Sync field measurement, baud rate calculation
Note 1. Only UART0 and UART2 support the 9-bit data length.
When the medium-speed on-chip oscillator clock (MOCO) or low-speed on-chip oscillator clock (LOCO) is selected for
PCLKB, use the medium-speed on-chip oscillator trimming register (MIOTRM) and low-speed on-chip oscillator trimming
register (LIOTRM) to correct oscillation frequency accuracy.
● UART0 uses channels 0 and 1 of SAU0
● UART1 uses channels 2 and 3 of SAU0
● UART2 uses channels 0 and 1 of SAU1.
Note: When using a serial array unit for UART, both the transmitter side (even-numbered channel) and the receiver side
(odd-numbered channel) can only be used for UART.
Transfer rate*2 Max. fMCK/6 [bps] (SDRmn.STCLK[6:0] = 2 or more), Min. PCLKB/ (2 × 215 × 128) [bps]
Note 2. Use this operation within a range that satisfies the conditions above and the peripheral functions characteristics specified in the
electrical characteristics. For details, see section 31, Electrical Characteristics .
Table 21.74 Example of serial communication operation setting register mn (SCRmn) contents for UART
transmission (2 of 2)
Bit Symbol Set value Function
13:12 DCP[1:0] 00b Since this bit is dedicated to other modes, it is fixed in the UART mode
15:14 TRXE[1:0] 10b Setting TRXE[1:0] = 10b is fixed in the UART transmission mode
n SOLn 0/1 Selects inversion of the level of the transmit data of channel 0 in UART mode
0: Non-reverse (normal) transmission
1: Reverse transmission
Note: ×: Bit that cannot be used in this mode (set to the initial value when not used in any mode)
0/1: Set to 0 or 1 depending on the usage of the user
<6> Changing setting of the SOLm register Set an output data level.
<7> Setting the SOm register Set the initial output level of the serial data (SOm.SO[n]).
<8> Changing setting of the SOEm register Set the SOEm.SOE[n] bit to 1 and enable data output of the
target channel.
<9> Setting port Enable data output of the target channel.
<10> Writing to the SSm register Set the SSm.SS[n] bit of the target channel to 1 and set
SEm.SE[n] = 1 to enable operation.
<11> Completing initial setting Initial setting is completed.
Set transmit data to the SDRmn.DAT[7:0] bits (8 bits) or the
SDRmn.DAT[8:0] bits (9 bits) and start communication.
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0, 2), mn = 00, 02, 10
Table 21.81 shows the procedure for stopping master transmission
Table 21.81 Procedure for stopping UART transmission
Step Process Detail
<6> Changing setting of the SMRmn register Reset the register to change serial mode register mn
(optional) (SMRmn) setting.
<7> Changing setting of the SCRmn register Reset the register to change the serial communication
(optional) operation setting register mn (SCRmn) setting.
<8> Changing setting of the SOLm register Reset the register to change serial output level register m
(Selective) (SOLm) setting.
<9> Changing setting of the SOEm register Clear the SOEm.SOE[n] bit to 0 and stop output.
(optional)
<10> Changing setting of the SOm register Set the initial output level of the serial data (SOm.SO[n]).
(optional)
<11> Changing setting of the SOEm register Set the SOEm.SOE[n] bit to 1 and enable output.
<12> Port manipulation Enable data output of the target channel.
<13> Writing to the SSm register Set the SSm.SS[n] bit of the target channel to 1 and set the
SEm.SE[n] bit to 1 (to enable operation).
<14> Completing resumption setting Setting is completed.
Set transmit data to the SDRmn.DAT[7:0] bits (8 bits) or the
SDRmn.DAT[8:0] bits (9 bits) and start communication.
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0, 2), mn = 00, 02, 10
SSm.SS[n]
STm.ST[n]
SEm.SE[n]
SDRmn.DAT[8:0] Transmit data 1 Transmit data 2 Transmit data 3
or DAT[7:0]
TXDq pin ST Transmit data 1 ST Transmit data 2 ST Transmit data 3 P SP
P SP P SP
SAUm_UART_TXIq
Data transmission Data transmission Data transmission
SSRmn.TSF
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0, 2), q: UART number (q = mx2 + n/2), mn = 00, 02, 10
Starting UART
communication
Enable interrupt
Read transmit data from storage area and write it to the SDRmn.DAT[7:0] bits
Writing transmit data to (8 bits) or the SDRmn.DAT[8:0] bits (9 bits). Update transmit data pointer.
the SDRmn.DAT[7:0] bits (8 bits) or
the SDRmn.DAT[8:0] bits (9 bits) Communication starts by writing to the SDRmn.DAT[7:0] bits
(8 bits) or the SDRmn.DAT[8:0] bits (9 bits).
Yes
Main routine
Disable interrupt
End of communication
SSm.SS[n] <1>
STm.ST[n] <6>
SEm.SE[n]
SDRmn.DAT[8:0]
or DAT[7:0] Transmit data 1 Transmit data 2 Transmit data 3
TXDq pin
ST Transmit data 1 P SP ST Transmit data 2 P SP ST Transmit data 3 P SP
SAUm_UART_TXIq
Data transmission Data transmission Data transmission
SMRmn.MD0
<4>
SSRmn.TSF
SSRmn.BFF
<2><3> <2> <3> <2> <3> <5>
*1
Note: The MD0 bit of serial mode register mn (SMRmn) can be rewritten even during operation.
However, rewrite it before transfer of the last bit is started, so that it has been rewritten before the transfer end interrupt of
the last transmit data.
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0, 2), q: UART number (q = mx2 + n/2), mn = 00, 02, 10
Note 1. If transmit data is written to the SDRmn register while the BFF bit of serial status register mn (SSRmn) is 1 (valid data is
stored in serial data register mn (SDRmn)), the transmit data is overwritten.
Starting UART
communication
Set the data pointer for transmission and the number of data items. Clear
Setting transmit data communication end flag
(Storage area, Transmission data pointer, Number of communication data and
Communication end flag are optionally set on the internal RAM by the software)
Main routine
Enable interrupt
No
Check completion of transmission by
Transmission completed?
verifying transmit end flag
Yes
Yes
Communication
continued?
No
Disable interrupt
End of communication
Note: <1> to <6> in the figure correspond to <1> to <6> in Figure 21.33.
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0, 2), mn = 00, 02, 10
Note 1. See Table 21.80.
Transfer rate*2 Max. fMCK/6 [bps] (SDRmn.STCLK[6:0] = 2 or more), Min. PCLKB/ (2 × 215 × 128) [bps]
15 CKS 0/1 Operation clock (fMCK) of channel r (same setting value as SMRmn.CKS bit)
n SO[n] x Bit that cannot be used in this mode (set to the initial value when not used in any mode)
n+8 CKO[n] x Bit that cannot be used in this mode (set to the initial value when not used in any mode)
n SOE[n] x Bit that cannot be used in this mode (set to the initial value when not used in any mode)
Note: For the UART reception, be sure to set the SMRmr register of channel r to UART transmission mode that is to be
paired with channel n.
Note: ×: Bit that cannot be used in this mode (set to the initial value when not used in any mode)
0/1: Set to 0 or 1 depending on the usage of the user
<5> Changing setting of the SMRmn and Reset the registers to change serial mode registers mn, mr
SMRmr registers (optional) (SMRmn, SMRmr) setting.
<6> Changing setting of the SCRmn register Reset the register to change the serial communication
(optional) operation setting register mn (SCRmn) setting.
<7> Clearing error flag If the SSRmn.FEF, PEF, and OVF flags remain set, clear them
using serial flag clear trigger register mn (SIRmn).
<8> Setting port Enable data input of the target channel.
<9> Writing to the SSm register Set the SSm.SS[n] bit of the target channel to 1 and set the
SEm.SE[n] bit to 1 to enable operation). Wait for start bit
detection.
<10> Completing resumption setting —
Note: Set the TRXE[0] bit of SCRmn register to 1, and then be sure to set SSm.SS[n] to 1 after at least 4 fMCK clocks have elapsed.
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3)
SSm.SS[n]
STm.ST[n]
SEm.SE[n]
Receive data 3
SDRmn.DAT[8:0] or DAT[7:0] Receive data 1 Receive data 2
RXDq pin
ST Receive data 1 P SP ST Receive data 2 P SP ST Receive data 3 P SP
SAUm_UART_RXIq
Data reception Data reception Data reception
SSRmn.TSF
Note: m: Unit number (m = 0, 1), n: Channel number (n = 1, 3), mn = 01, 03, 11, q: UART number (q = mx2 + n/2)
Setting receive data Setting storage area of the receive data, number of communication
Main routine
Enable interrupt
Reading receive data from Read receive data then writes to storage area.
the SDRmn.DAT[7:0] bits (8 bits) or Update receive data pointer and number of
the SDRmn.DAT[8:0] bits (9 bits) communication data.
No
Indicating normal reception?
Yes
No
Reception completed? Check the number of communication data,
determine the completion of reception
Yes
Main routine
Disable Interrupt
End of UART
Note: The Snooze mode can only be used when the high-speed on-chip oscillator clock or medium-speed on-chip
oscillator clock is selected for PCLKB.
When the medium-speed on-chip oscillator clock is selected, use the Middle-speed On-chip Oscillator Trimming
Register (MIOTRM) to correct the accuracy of the oscillation frequency.
Note: The maximum transfer rate in the Snooze mode is 115.2 kbps (when setting the SBYCR.FWKUP = 1, PCLKB =
HOCO (32 MHz)).
When the SBYCR.FWKUP is set to 1, PCLKB cannot be set to a value other than HOCO = 32 MHz.
Note: When SSC0.SWC = 1, UART0 can be used only when the reception operation is started in the Software Standby
mode.
When used simultaneously with another Snooze mode function or interrupt, if the reception operation is started in a
state other than the Software Standby mode, such as those given below, data may not be received correctly and a
framing error or parity error may be generated.
● When after the SSC0.SWC bit has been set to 1, the reception operation is started before the Software Standby
mode is entered
● When the reception operation is started while another function is in the Snooze mode
● When after returning from the Software Standby mode to normal operation due to an interrupt or other cause,
the reception operation is started before the SSC0.SWC bit is returned to 0
Note: If a parity error, framing error, or overrun error occurs while the SSC0.SSEC bit is set to 1, the SSR01.PEF, FEF,
or OVF flag is not set and an error interrupt (SAU0_UART_ERRI0) is not generated. Therefore, when the setting of
SSC0.SSEC = 1 is made, clear the SSR01.PEF, FEF, and OVF before setting the SSC0.SWC bit to 1 and read the
value in bits 7 to 0 of the SDR01 register.
Note: The CPU shifts from the Software Standby mode to the Snooze mode on detecting the valid edge of the RXD0
signal.
Note, however, that transfer through the UART channel may not start and the CPU may remain in the Snooze mode
if an input pulse on the RXD0 pin is too short to be detected as a start bit. In such cases, data may not be received
correctly, and this may lead to a framing error or parity error in the next UART transfer.
Table 21.94 shows the baud rate setting for UART reception in Snooze mode.
Table 21.94 Baud rate setting for UART reception in Snooze mode
High-speed on-chip Operating clock SDR01.STCLK[6:0 Maximum Minimum
Baud rate oscillator (HOCO) (fMCK) ] permissible value permissible value
Note 1. When the accuracy of the clock frequency of the high-speed on-chip oscillator is ±1.5% or ±2.0%, the permissible range becomes
smaller as shown below.
● In the case of HOCO ±1.5%, perform (Maximum permissible value – 0.5%) and (Minimum permissible value + 0.5%) to the
values in the above table.
● In the case of HOCO ±2.0%, perform (Maximum permissible value – 1.0%) and (Minimum permissible value + 1.0%) to the
values in the above table.
Table 21.95 Baud rate setting for UART reception in Snooze mode when starting of the high-speed on-chip
oscillator is at high speed (FWKUP = 1)
High-speed on-chip Operating clock Maximum Minimum
Baud rate oscillator (HOCO) (fMCK) SDR01 [15:9] permissible value permissible value
Note: The maximum permissible value and minimum permissible value are permissible values for the baud rate in UART
reception. The baud rate on the transmitting side should be set to fall inside this range.
Software
Standby
State of the CPU Normal operation mode Snooze mode Normal operation
<4>
SS0.SS[1] <3> <12>
ST0.ST[1] <1> <10>
SE0.SE[1]
SSC0.SWC <11>
SCR01.EOC L
SSC0.SSEC L
Clock request signal
(internal signal)
Receive data 2
SDR01.DAT[8:0] or
SDR01.DAT[7:0] Receive data 1
*1
<9> Read
RXD0 pin ST ST
Receive data 1 P SP Receive data 2 P SP
SAU0_UART_RXI0
Data reception <7> Data reception
SAU0_UART_ERRI0 L
SSR01.TSF <6>
Note: Before switching to the Snooze mode or after reception operation in the Snooze mode finishes, set the ST0.ST[1] bit to 1
(the SE0.SE[1] bit is cleared and the operation stops).
After the receive operation completes, also clear the SSC0.SWC bit to 0 (Snooze mode release).
Note: <1> to <12> in the figure correspond to <1> to <12> in Figure 21.39.
Note 1. Read the received data when SSC0.SWC = 1.
Software
State of the CPU Normal operation Standby Snooze mode Normal operation
<4>mode
SS0.SS[1] <3> <12>
ST0.ST[1] <1> <10>
SE0.SE[1]
SSC0.SWC <11>
SCR01.EOC
SSC0.SSEC L
SAU0_UART_RXI0
Data reception <7> Data reception
SAU0_UART_ERRI0 L
SSR01.TSF <6>
Note: Before switching to the Snooze mode or after reception operation in the Snooze mode finishes, set the ST0.ST[1] bit to 1
(the SE0.SE[1] bit is cleared and the operation stops).
After the receive operation completes, also clear the SSC0.SWC bit to 0 (Snooze mode release).
Note: <1> to <12> in the figure correspond to <1> to <12> in Figure 21.39.
Note 1. Read the received data when SSC0.SWC = 1.
Setting start
Yes
<1> Writing 1 to the ST0.ST[1] bit The operation of all channels is also stopped to switch to the
® SE0.SE[1] = 0 Software Standby mode.
Normal operation
Enable interrupt
<4> Enter the Software Standby PCLKB supplied to the SAU is stopped.
Standby mode
mode
Software
<7>
Transfer end interrupt (SAU0_UART_RXI0) or
<8> error interrupt (SAU0_UART_ERRI0) generated
SAU0_UART_ERRI0 SAU0_UART_RXI0
Writing 1 to the ST0.ST[1] bit <10> Writing 1 to the ST0.ST[1] bit Stops operation by setting SE0.SE[1] = 0.
Normal operation
Clear the SSC0.SWC bit to 0 <11> Clear the SSC0.SWC bit to 0 Reset Snooze mode setting.
Error processing
Change to the UART Change to the UART Set the SPS0 register and the STCLK[6:0] bits in the
reception baud rate in reception baud rate in SDR01 register.
normal operation normal operation
Writing 1 to the SS0.SS[1] bit <12> Writing 1 to the SS0.SS[1] bit Communications waiting state (SE0.SE[1] = 1)
Note: <1> to <12> in the figure correspond to <1> to <12> in Figure 21.37 and Figure 21.38.
Figure 21.39 Flowchart of Snooze mode operation (SCR01.EOC = 0, SSC0.SSEC = 0/1 or SCR01.EOC = 1,
SSC0.SSEC = 0)
Normal operation
Software Software Standby
State of the CPU Normal operation Standby Snooze mode mode Snooze mode
mode
SS0.SS[1] <3> <4>
ST0.ST[1] <1> <10>
SE0.SE[1]
SSC0.SWC <11>
SCR01.EOC <11>
SSC0.SSEC
Clock request signal
(internal signal)
Receive data 2
SDR01.DAT[8:0] or
Receive data 1
SDR01.DAT[7:0]
Read *1 <9>
RXD0 pin
ST Receive data 1 P SP ST Receive data 2 P SP
SAU0_UART_RXI0
Data reception Data reception
L
SAU0_UART_ERRI0
Note: Before switching to the Snooze mode or after reception operation in the Snooze mode finishes, set the ST0.ST[1] bit to 1
(the SE0.SE[1] bit is cleared and the operation stops).
After the receive operation completes, also clear the SSC0.SWC bit to 0 (Snooze mode release).
Note: If a parity error, framing error, or overrun error occurs while the SSC0.SSEC bit is set to 1, the SSR01.PEF, FEF, or OVF
flag is not set and an error interrupt (SAU0_UART_ERRI0) is not generated. Therefore, when the setting of SSC0.SSEC
= 1 is made, clear the SSR01.PEF, FEF, and OVF flags before setting the SSC0.SWC bit to 1 and read the value in
SDR01.DAT[7:0] (8 bits) or SDR01.DAT[8:0] (9 bits).
Note: <1> to <11> in the figure correspond to <1> to <11> in Figure 21.41.
Note 1. Read the received data when SSC0.SWC = 1.
Setting start
Yes
SIR01 = 0x0007 Clear the all error flags
<2> Setting SSC0 register Snooze mode setting (make the setting to disable generation
(SWC = 1, SSEC = 1) of error interrupt SAU0_UART_ERRI0 in Snooze mode).
Setting interrupt
Standby mode
<4> Enter the Software Standby PCLKB supplied to the SAU is stopped
Software
mode
<7>
Reception error detected
Standby mode
<7>
Transfer end interrupt (SAU0_UART_RXI0) generated
<8>
SAU0_ENDIn
Normal operation
Note: If a parity error, framing error, or overrun error occurs while the SSC0.SSEC bit is set to 1, the SSR01.PEF, FEF, or OVF
flag is not set and an error interrupt (SAU0_UART_ERRI0) is not generated. Therefore, when the setting of SSC0.SSEC
= 1 is made, clear the SSR01.PEF, FEF, and OVF flags before setting the SSC0.SWC bit to 1 and read the value in
SDR01.DAT[7:0] (8 bits) or SDR01.DAT[8:0] (9 bits).
Note: <1> to <11> in the figure correspond to <1> to <11> in Figure 21.40.
The operation clock (fMCK) is determined by serial clock select register m (SPSm) and CKS bit of serial mode register mn
(SMRmn). See Table 21.70.
Figure 21.42 shows the permissible baud rate range for reception (1 Data Frame Length = 11 Bits).
Latch
timing
FL
1 data frame (11 × FL)
Figure 21.42 Permissible baud rate range for reception (1 data frame length = 11 bits)
As shown in Figure 21.42, the timing of latching receive data is determined by the division ratio set by STCLK[6:0] bits of
serial data register mn (SDRmn) after the start bit is detected. If the last data (stop bit) is received before this latch timing,
the data can be correctly received.
21.6.5 Procedure for Processing Errors that Occurred During UART Communication
The procedure for processing errors that occurred during UART communication is described in Table 21.97 and Table
21.98.
Table 21.97 Processing procedure for parity error or overrun error
Step Software manipulation State of the hardware Note
<1> Reads serial data register mn The BFF bit of the SSRmn register is This is to prevent an overrun error
(SDRmn). → set to 0 and channel n is enabled to if the next reception is completed
receive data during error processing.
<2> Reads serial status register mn — The error type is identified and the
(SSRmn). read value is used to clear the error
flag.
<3> Writes 1 to serial flag clear trigger The error flag is cleared. Only the error generated during
register mn (SIRmn). reading can be cleared, by writing
→ the value read from the SSRmn
register to the SIRmn register without
modification.
<1> Reads serial data register mn The BFF bit of the SSRmn register is This is to prevent an overrun error
(SDRmn). → set to 0 and channel n is enabled to if the next reception is completed
receive data during error processing.
<2> Reads serial status register mn — The error type is identified and the
(SSRmn). read value is used to clear the error
flag.
<3> Writes serial flag clear trigger register The error flag is cleared. Only the error generated during
mn (SIRmn). reading can be cleared, by writing
→ the value read from the SSRmn
register to the SIRmn register without
modification.
<4> Sets the ST[n] bit of serial channel The SE[n] bit of serial channel —
stop register m (ST[n]) to 1. → enable status register m (SEm) is set
to 0 and channel n stops operation.
<5> Synchronization with other party of — Synchronization with the other party
communication of communication is re-established
and communication is resumed
because it is considered that a
framing error has occurred because
the start bit has been shifted.
<6> Sets the SSm.SS[n] bit of serial The SE[n] bit of serial channel —
channel start register m (SSm) to 1. enable status register m (SEm) is
→
set to 1 and channel n is enabled to
operate.
Transfer rate*1 Max. fMCK/6 [bps] (SDR10.STCLK[6:0] = 2 or more), Min. PCLKB/ (2 × 215 × 128) [bps]
LIN Bus
13-bit length
Break 0x55 PID Data Data Checksum
8-bit length*1 transmission*2 transmission transmission transmission transmission transmission
TXD2
(output)
Delimiter
transmission
SAU1_UART_TXI2*3
UART2 restart
(1 ® SS1.SS[0] bit)
BF transmission
0x00 ® TXD2
BF generation
Waiting for
No
completion of BF 13-bit length
TXD2
SSR10.TSF = 0? transmission
Yes
0x000
UART2 stop
(1 ® ST1.ST[0] bit)
UART2 restart
(1 ® SS1.SS[0] bit)
Yes 0x55
Transmitting PID to
Data ® TXD2 checksum
Yes
No
Waiting for completion of transmission
SSR10.TSF = 0? (transmission completed to the LIN bus)
Yes
End of LIN
communication
Note: This flow assumes that the initial setting of the UART is completed and transmission is enabled.
Note 1. This is only required if the LIN bus is started from Sleep mode.
Transfer rate*1 Max. fMCK/6 [bps] (SDR11.STCLK[6:0] = 2 or more), Min. PCLKB/ (2 × 215 × 128) [bps]
Protected
Wakeup signal Checksum
Break field Sync field identifier Data field Data field
frame field
field
LIN Bus
Header Response
Break 0x55 PID Data Data Checksum
reception reception reception reception reception reception
<2> <5>
RXD2
SAU1_UART_RXI2
<1>
Edge detection
(IRQ0)
<3> <4>
Channel 7 Pulse interval
STOP Pulse width measurement
of TAU0 measurement
TAU0_TMI07
Break field
No
Generate TAU0_TMI07? If the detected pulse RXD2 pin
width is 11 bits or
Yes Channel 7 Pulse width
more, it is judged as
No of TAU0 measurement
BF.
11 bit lengths or more? TAU0_TMI07 Channel 7
Yes
Changing channel 7
of TAU0 to pulse interval Set up TM07 to measure the
measurement interval between the falling edges.
Yes
Sync field
RXD2 pin
No Measure the intervals
Generate TAU0_TMI07? Channel 7 Pulse interval
between five falling
of TAU0 measurement
edges of SF, and
Yes accumulate the four TAU0_TMI07
Accumulate captured values captured values.
Accumulate four
No times
Completed 4 times?
Yes
No
Completing all data
transmission?
Yes
Stop UART2 reception
(1 ® ST1.ST[1])
End of LIN
communication
Selector
IRQ0
IRQ0 input
Port input
switch control
(ISC0)
<ISC0>
0: Selects IRQ0 pin
1: Selects RXD2 pin
Selector
TI07
Channel 7 input of
timer array unit
Port input
switch control
(ISC1)
<ISC1>
0: Selects TI07 pin
1: Selects RXD2 pin
[Interrupt function]
● Transfer end interrupt (SAU0_IIC_TXRXI00/SAU0_IIC_TXRXI11/SAU1_IIC_TXRXI20)
Note 1. When receiving the last data, ACK is not output if 0 is written to the SOEm.SOE[n] bit and serial communication
data output is stopped. See (2) Processing flow for details.
The channel supporting simplified I2C is channels 0 to 3 of SAU0 and channel 0 and 1 of SAU1. section 21, Serial Array
Unit (SAU) to section 21, Serial Array Unit (SAU) show the channels supporting simplified I2C for each product.
Simplified I2C performs the following four types of communication operations:
● Address field transmission (see section 21.8.1. Address Field Transmission)
● Data transmission (see section 21.8.2. Data Transmission)
● Data reception (see section 21.8.3. Data Reception)
● Stop condition generation (see section 21.8.4. Stop Condition Generation.)
Transfer rate*2 Max.fMCK/4 [Hz] (SDRmn.STCLK[6:0] = 1 or more) fMCK: Operation clock frequency of
target channel. However, the following condition must be satisfied in each mode of I2C:
● Max. 1 MHz (fast mode plus)
● Max. 400 kHz (fast mode)
● Max. 100 kHz (standard mode)
Table 21.103 Example of serial communication operation setting register mn (SCRmn) contents for address field
transmission of simplified I2C (2 of 2)
Bit Symbol Set value Function
7 DIR 0 This bit is fixed in simplified I2C mode because it is for simplified SPI and UART modes.
9:8 PTC[1:0] 00b This bit is fixed in simplified I2C mode because it is for UART mode.
10 EOC 0 This bit is fixed in simplified I2C mode because it is for UART receive mode.
11 — 0 Setting disabled (set to the initial value)
13:12 DCP[1:0] 00b This bit is fixed in simplified I2C mode because it is for simplified SPI mode.
15:14 TRXE[1:0] 10b Setting TRXE[1:0] = 10b is fixed in the simplified I2C address field transmission
Table 21.107 Example of serial channel start register m (SSm) contents for address field transmission of
simplified I2C
Bit Symbol Set value Function
<6> Setting the SOm register Set the initial output level (1) of the serial data (SOm.SO[n])
and serial clock (SOm.CKO[n]).
<7> Setting port Enable data output, clock output, and NMOS open-drain
output of the target channel.
<8> Completing initial setting —
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3)
SSm.SS[n]
SEm.SE[n]
SOEm.SOE[n]
SCLr output
SOm.CKO[n]
bit manipulation
SDAr output D7 D6 D5 D4 D3 D2 D1 D0
SOm.SO[n] bit
R/W
manipulation Address
SDAr input D7 D6 D5 D4 D3 D2 D1 D0 ACK
Shift
Shift register mn operation
SAUm_IIC_TXRXIr
SSRmn.TSF
Table 21.113 Example of serial data register mn (SDRmn) contents for data transmission of simplified I2C
Bit Symbol Set value Function
n SO[n] 0/1 The value varies depending on the communication data during communication operation.
n+8 CKO[n] 0/1 The value varies depending on the communication data during communication operation.
SSm.SS[n] “L”
SEm.SE[n]
“H”
SOEm.SOE[n] “H”
SCLr output
SDAr output D7 D6 D5 D4 D3 D2 D1 D0
SAUm_IIC_TXRXIr
SSRmn.TSF
Table 21.120 Example of serial communication operation setting register mn (SCRmn) contents for data
reception of simplified I2C
Bit Symbol Set value Function
n SO[n] 0/1 The value varies depending on the communication data during communication operation.
n+8 CKO[n] 0/1 The value varies depending on the communication data during communication operation.
Table 21.124 Example of serial channel start register m (SSm) contents for data reception of simplified
I2C
Bit Symbol Set value Function
SSm.SS[n]
STm.ST[n]
SEm.SE[n]
SOEm.SOE[n] “H”
SCLr output
SDAr input D7 D6 D5 D4 D3 D2 D1 D0
SAUm_IIC_TXRXIr
SSRmn.TSF
STm.ST[n]
SEm.SE[n]
SDRmn.DAT[7:0] Dummy data (0xFF) Receive data Dummy data (0xFF) Receive data
SCLr output
SDAr input D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0
SAUm_IIC_TXRXIr
SSRmn.TSF
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), r: IIC number (r = 00, 11, 20)
STm.ST[n]
SEm.SE[n]
SOEm.SOE[n] *1
SCLr output
SDAr output
Stop condition
Note: m: Unit number (m = 0, 1), n: Channel number (n = 0 to 3), r: IIC number (r = 00, 11, 20)
Note 1. During a receive operation, the SOE[n] bit of serial output enable register m (SOEm) is cleared to 0 before receiving the
last data.
Note: SDRmn.STCLK[6:0] must not be set to 0x00. Set SDRmn.STCLK[6:0] to 0x01 or greater.
The duty ratio of the SCL signal output by the simplified I2C is 50%. The I2C bus specifications define that the
low-level width of the SCL signal is longer than the high-level width. If 400 kbps (fast mode) or 1 Mbps (fast mode
plus) is specified, therefore, the low-level width of the SCL output signal becomes shorter than the value specified in
the I2C bus specifications. Make sure that the SDRmn.STCLK[6:0] value satisfies the I2C bus specifications.
The operation clock (fMCK) is determined by serial clock select register m (SPSm) and CKS bit of serial mode register mn
(SMRmn). See Table 21.70.
Table 21.127 shows an example of setting an I2C transfer rate where fMCK = PCLKB = 32 MHz.
Table 21.127 Example of setting I2C transfer rate where fMCK = PCLKB = 32 MHz
PCLKB = 32 MHz
I2C transfer mode Error from desired
(desired transfer rate) Operation clock (fMCK) SDRmn.STCLK[6:0] Calculated transfer rate transfer rate
21.8.6 Procedure for Processing Errors that Occurred during Simplified I2C
Communication
The procedure for processing errors that occurred during simplified I2C communication is described in Table 21.128 and
Table 21.129.
<1> Read serial data register mn The BFF bit of the SSRmn register is This is to prevent an overrun error
(SDRmn). → set to 0 and channel n is enabled to if the next reception is completed
receive data during error processing.
<2> Read serial status register mn — The error type is identified and the
(SSRmn). read value is used to clear the error
flag.
<3> Write 1 to serial flag clear trigger The error flag is cleared. Only the error during reading can
register mn (SIRmn). be cleared, by writing the value
→
read from the SSRmn register to the
SIRmn register without modification.
Table 21.129 Processing procedure for ACK error in simplified I2C mode
Step Software manipulation State of the hardware Remark
<1> Read serial status register mn — The error type is identified and the
(SSRmn). read value is used to clear the error
flag.
<2> Write serial flag clear trigger register The error flag is cleared. Only the error during reading can
mn (SIRmn). be cleared, by writing the value
→
read from the SSRmn register to the
SIRmn register without modification.
<3> Set the ST[n] bit of serial channel The SE[n] bit of serial channel The slave is not ready for reception
stop register m (STm) to 1. → enable status register m (SEm) is set because ACK is not returned.
to 0 and channel n stops operation. Therefore, a stop condition is
created, the bus is released, and
<4> Create a stop condition. — communication is started again from
<5> Create a start condition. — the start condition.
Or, a restart condition is generated
and transmission can be redone from
address transmission.
<6> Set the SS[n] bit of serial channel The SE[n] bit of serial channel —
start register m (SSm) to 1. enable status register m (SEm) is
→
set to 1 and channel n is enabled to
operate.
Wakeup function CPU can return from Software Standby mode and Snooze mode using a wakeup event
Internal bus
Filter
Slave address Clear Start
register n (SVAn) condition
SDAAn Set
Match
generator
Noise signal
IICCTLn1.SVADIS
eliminator
Stop
IICA shift SO latch condition
register n (IICAn)
D Q
IICCTLn1.DFC generator
IICWLn
N-ch open-
drain output
Data hold
IICSn.TRC time correction
circuit
Start condition
detector
Filter
Stop condition
detector
SCLAn
Interrupt request
Noise Serial clock IICAn_TXRXI
signal generator
eliminator counter
N-ch open-
IICSn.MSTS, EXC, COI
drain output Clock stretch
IICCTLn1.DFC Serial clock controller IICA shift register n (IICAn)
controller Bus state
PCLKB detector
IICCTLn0.STT, SPT
Selector
PSEL
fMCK
Port output control Counter IICSn.MSTS, EXC, COI
PCLKB/2
Match signal
IICCTLn1.PRS
IICA low-level width IICA high-level width IICA control register n1 STCF IICBSY STCEN IICRSV
setting register n (IICWLn) setting register n (IICWHn) (IICCTLn1)
IICA flag register n
(IICFn)
Internal bus
Note: n=0
(4) SO latch
The SO latch is used to retain the output level of SDAA0 pin.
(10) ACK generator, stop condition detector, start condition detector, and ACK detector
These circuits generate or detect each state.
SCLAn SCL
SCLin
SCLout#
SDAAn SDA
SDAin
SDAout#
SDAAn
SDAAn
SCLAn
SCLAn
(Master) SCLin SCLin
SCLout# SCLout#
SDAin SDAin
SDAout# SDAout#
(Slave 1) (Slave 2)
Note: n=0
Figure 22.2 Example of the serial bus configuration using the I2C bus
Bit position: 7 6 5 4 3 2 1 0
Bit field:
7:0 n/a 8-bit Transmit and Receive Data for IICA of Unit 0 R/W
The IICA0 register is used to convert 8-bit serial data to 8-bit parallel data and vice versa in synchronization with the serial
clock. The IICA0 register can be used for both transmission and reception.
The actual transmit and receive operations can be controlled by writing to and reading from the IICA0 register. Release I2C
bus interface (IICA) from the clock stretch state and start data transfer by writing data to the IICA0 register during the clock
stretch period.
Do not write data to the IICA0 register during data transfer.
Write to or read from the IICA0 register only during the clock stretch period. Accessing the IICA0 register in a
communication state other than during the clock stretch period is prohibited. When the device serves as the master mode,
however, the IICA0 register can be written only once after the communication trigger bit (IICCTL00.STT) is set to 1.
When communication is reserved, write data to the IICA0 register after the interrupt triggered by a stop condition is
detected.
Bit position: 7 6 5 4 3 2 1 0
This register holds seven bits (A[6:0]) of the local address when in slave mode.
Rewriting to this register is prohibited while IICS0.STD = 1 (while the start condition is detected).
Bit position: 7 6 5 4 3 2 1 0
Bit field: IICE LREL WREL SPIE WTIM ACKE STT SPT
This register is used to enable or disable the I2C operations, set the timing of clock stretching, and set other I2C operations.
Note that bits SPIE, WTIM, and ACKE must be set while the setting of IICE is 0 or this module is in the clock stretch state.
These bits can be set at the same time as setting the IICE bit 1.
When TRC bit of the IICA status register 0 (IICS0) is set to 1 (transmission state), WREL bit of IICA control register
00 (IICCTL00) is set to 1 during the 9th clock and the interface is released from the clock stretch state, after which the
IICS0.TRC bit is cleared (reception state) and the SDAA0 line is set to the high impedance state. Release the interface from
the clock stretch state while the IICS0.TRC bit is 1 (transmission state) by writing to the IICA shift register 0 (IICA0).
If the I2C operation is enabled (IICE = 1) when the SCLA0 line is high level, the SDAA0 line is low level, and the digital
filter is turned on (DFC bit of IICCTL01 register = 1), a start condition is inadvertently detected immediately. In this case,
set 1 to the LREL bit after enabling the I2C operation (IICE = 1).
● Set by instruction
SPIE bit (Enable and Disable Generation of Interrupt Request when Stop Condition is Detected)
If the WUP bit of IICA control register 01 (IICCTL01) is 1, no stop condition interrupt will be generated even if SPIE = 1.
Condition for clearing (SPIE = 0)
● Cleared by instruction
● Reset
Bit position: 7 6 5 4 3 2 1 0
Bit field: MSTS ALD EXC COI TRC ACKD STD SPD
<Master mode>
● When 1 is output to the LSB of the first byte (transfer direction specification bit)
<Slave mode>
● When a start condition is detected
● When 0 is input to the LSB of the first byte (transfer direction specification bit)
<Slave mode>
● When 1 (slave transmission) is input to the LSB (transfer direction specification bit) of the first byte from the master
mode (during address transfer)
Note 1. When TRC bit of the IICA status register 0 (IICS0) is set to 1 (transmission state), WREL bit of IICA control register
00 (IICCTL00) is set to 1 during the 9th clock and the interface is released from the clock stretch state, after which
the IICS0.TRC bit is cleared (reception state) and the SDAA0 line is set to the high impedance state. Release the
interface from the clock stretch state while the IICS0.TRC bit is 1 (transmission state) by writing to the IICA shift
register 0.
● Reset
Bit position: 7 6 5 4 3 2 1 0
This register sets the operation mode of I2C and indicates the state of the I2C bus.
The IICCTL00.STT clear flag (STCF) and I2C bus status flag (IICBSY) bits are read-only.
The IICRSV bit can be used to enable or disable the communication reservation.
The STCEN bit can be used to set the initial value of the IICBSY bit.
The IICRSV and STCEN bits can be written only when the I2C operation is disabled (IICCTL00.IICE=0). The IICF0
register is read-only while the I2C operation is enabled.
Write to the STCEN bit only when the operation is stopped (IICCTL00.IICE = 0).
The bus release status (IICBSY = 0) is recognized regardless of the actual bus status when STCEN = 1. When generating
the first start condition (IICCTL00.STT = 1), it is necessary to verify that no third-party communications are in progress in
order to prevent such communications from being destroyed.
Write to the IICRSV bit only when the operation is stopped (IICCTL00.IICE = 0).
● Reset
Bit position: 7 6 5 4 3 2 1 0
SVADI
Bit field: WUP CLD DAD SMC DFC — PRS
S
This register is used to set the operation mode of I2C and detect the states of the SCLA0 and SDAA0 pins.
The CLD and DAD bits are read-only.
Set the IICCTL01 register, except the WUP bit, while I2C operation is disabled (IICCTL00.IICE).
The fastest operation frequency of the IICA operation clock (fMCK) is 20 MHz (max.).
Set PRS bit of the IICA control register 01 (IICCTL01) to 1 only when the PCLKB exceeds 20 MHz.
Note the minimum PCLKB operation frequency when setting the transfer clock.
The minimum PCLKB operation frequency for I2C bus interface (IICA) is determined according to the mode.
Fast mode: PCLKB = 3.5 MHz (min.)
Fast mode plus: PCLKB = 10 MHz (min.)
Normal mode: PCLKB = 1 MHz (min.)
DAD bit (Detection of SDAA0 Pin Level (Valid Only when IICCTL00.IICE = 1))
Condition for clearing (DAD = 0)
● When the SDAA0 pin is at low level
● When IICCTL00.IICE = 0 (operation stop)
● Reset
CLD bit (Detection of SCLA0 Pin Level (Valid Only when IICCTL00.IICE = 1))
Condition for clearing (CLD = 0)
● When the SCLA0 pin is at low level
● When IICCTL00.IICE = 0 (operation stop)
● Reset
● Set by instruction (when the IICS0.MSTS, IICS0.EXC, and IICS0.COI bits are 0, and the IICS0.STD bit also 0
(communication not entered))
The status of the IICA status register 0 (IICS0) must be checked and the WUP bit must be set during the period shown in
Figure 22.3.
<1> <2>
SCLAn
Note: n=0
Bit position: 7 6 5 4 3 2 1 0
Bit field:
This register is used to set the low-level width (tLOW) of the SCLA0 pin signal that is output by I2C bus interface (IICA)
and to control the SDAA0 pin signal.
Set the IICWL0 register while the I2C operation is disabled (IICCTL00.IICE).
For details about setting the IICWL0 register, see section 22.3.2. Setting Transfer Clock Using IICWL0 and IICWH0
Registers. The data hold time is one-quarter of the time set by the IICWL0 register.
Bit position: 7 6 5 4 3 2 1 0
Bit field:
This register is used to set the high-level width of the SCLA0 pin signal that is output by I2C bus interface (IICA) and to
control the SDAA0 pin signal.
Set the IICWH0 register while the I2C operation is disabled (IICCTL00.IICE).
For the procedures for setting the transfer clock in master mode and the IICWL0 and IICWH0 registers in slave mode, refer
to (1) Transfer clock setting in master mode and (2) Setting of IICWL0 and IICWH0 registers in slave mode, respectively.
22.2.9 Registers to Control the Port Function Multiplexed with the I2C I/O Pins
For information on how to set up the I/O ports, see section 16, I/O Ports.
Set the IICCTL00.IICE bit to 1 before setting the output mode because the SCLA0 and the SDAA0 pins output a low level
(fixed) when the IICCTL00.IICE bit is 0.
SDAAn
Note: n=0
Since outputs from the serial clock line and the serial data bus line are N-ch open-drain outputs, an external pull-up resistor
is required. Figure 22.2 shows a serial bus configuration example using the I2C bus.
At this time, the optimal setting values of the IICWL0 and IICWH0 registers are as follows. (The fractional parts of all
setting values are rounded up.)
● When the fast mode
0.52
IICWL0 = Transfer clock × fMCK
0.48
IICWH0 = Transfer clock − tR − tF × fMCK
● When the normal mode
0.47
IICWL0 = Transfer clock × fMCK
0.53
IICWH0 = Transfer clock − tR − tF × fMCK
● When the fast mode plus
0.50
IICWL0 = Transfer clock × fMCK
0.50
IICWH0 = Transfer clock − tR − tF × fMCK
Note: Calculate the rise time (tR) and fall time (tF) of the SDAA0 and SCLA0 signals separately, because they differ
depending on the pull-up resistance and wire load.
H
SCLAn
SDAAn
Note: n=0
22.3.4 Address
The address is defined by the 7 bits of data that follow the start condition.
An address is a 7-bit data segment that is output in order to select one of the slave devices that are connected to the master
device via the bus lines. Therefore, each slave device connected via the bus lines must have a unique address. The slave
devices include hardware that detects the start condition and checks whether or not the 7-bit address data matches the data
values stored in the slave address register 0 (SVA0). If the address data matches the SVA0 register values, the slave device
is selected and communicates with the master device until the master device generates a start condition or stop condition.
Figure 22.6 shows the address.
SCLAn 1 2 3 4 5 6 7 8 9
Address
*1
IICAn_TXRXI
Note: n=0
Note 1. IICAn_TXRXI is not issued if data other than a local address or extension code is received while the all address match
function is disabled during slave device operation.
SCLAn 1 2 3 4 5 6 7 8 9
Note: n=0
Note 1. IICAn_TXRXI is not issued if data other than a local address or extension code is received while the all address match
function is disabled during slave device operation.
When the master device receives the last data item, it does not return ACK and instead generates a stop condition. If a slave
device does not return ACK after receiving data, the master device outputs a stop condition or restart condition and stops
transmission. If ACK is not returned, the possible causes are as follows.
1. Reception was not performed normally.
2. The final data item was received.
3. The reception side specified by the address does not exist.
To generate ACK, the reception side makes the SDAA0 line low at the ninth clock (indicating normal reception). Automatic
generation of ACK is enabled by setting ACKE bit of IICA control register 00 (IICCTL00) to 1. TRC bit of the IICS0
register is set to the value of the eighth bit that follows 7-bit address information. Usually, set the IICCTL00.ACKE bit to 1
for reception (IICCTL00.TRC = 0).
If a slave device can receive no more data during reception (IICCTL00.TRC = 0) or does not require the next data item, then
the slave device must inform the master device, by clearing the IICCTL00.ACKE bit to 0, that it will not receive any more
data.
When the master device does not require the next data item during reception (IICCTL00.TRC = 0), it must clear the
IICCTL00.ACKE bit to 0 so that ACK is not generated. In this way, the master informs a slave device at the transmission
side that it does not require any more data (transmission will be stopped). Figure 22.8 shows the ACK.
SCLAn 1 2 3 4 5 6 7 8 9
SDAAn A[6] A[5] A[4] A[3] A[2] A[1] A[0] R/W# ACK
Note: n=0
H
SCLAn
SDAAn
Note: n=0
IICAn IICAn data write (release from the clock stretch state)
SCLAn 6 7 8 9 1 2 3
Slave
Clock stretching is inserted after
output of the 8th clock cycle.
0xFF is written to IICAn or IICCTLn0.WREL is set to 1.
IICAn
SCLAn
ACKE H
Transfer lines
Clock stretching from the slave device Clock stretching from the master device
SCLAn 6 7 8 9 1 2 3
SDAAn D2 D1 D0 ACK D7 D6 D5
Note: n=0
(2) When clock stretching is set for the 9th clock cycle for both the master and slave devices
(master: transmission, slave: reception, and IICCTL00.ACKE = 1)
SCLAn 6 7 8 9 1 2 3
SCLAn
ACKE H
SCLAn 6 7 8 9 1 2 3
SDAAn D2 D1 D0 ACK D7 D6 D5
Note: n=0
Execute the processing for release only once for each period in the clock stretch state.
If, for example, data is written to the IICA0 register after release from the clock stretch state by setting the
IICCTL00.WREL bit to 1, an incorrect value may be output to SDAA0 line because the timing for changing the SDAA0
line conflicts with the timing for writing the IICA0 register.
In addition to the above, communications are stopped if the IICCTL00.IICE bit is cleared to 0 when communications have
been aborted, so that the clock stretch state can be released.
If the I2C bus has deadlocked due to noise, the device can exit from communications by setting LREL bit of the IICCTL00
register to 1, so that the clock stretch state can be released.
If the processing for release from clock stretching is executed when IICCTL01.WUP = 1, the clock stretch state is not
released.
22.3.10 Timing of Generation of the Interrupt Request Signal (IICA0_TXRXI) and Control
of Clock Stretching
The setting of WTIM bit of IICA control register 00 (IICCTL00) determines the timing by which IICA0_TXRXI is
generated and controls clock stretching, as shown in Table 22.2.
The numbers in the table indicate the pulses of the serial clock signal. Interrupt requests and control of clock stretching are
both synchronized with the falling edge of these clock pulses.
Table 22.2 IICA0_TXRXI generation timing and control of clock stretching
During slave device operation During master device operation
WTIM Address Data reception Data transmission Address Data reception Data transmission
When 8th cycle clock stretching has been selected (IICCTL00.WTIM = 0), the presence or absence of ACK generation
must be determined before release from the clock stretch state.
5. Detection of stop condition
IICA0_TXRXI is generated when a stop condition is detected (only when IICCTL00.SPIE = 1).
Note 1. The IICA0_TXRXI signal of the slave device and clock stretching occur at the falling edge of the 9th clock cycle only
when there is a match with the address set to the slave address register 0 (SVA0).
At this point, ACK is generated regardless of the value set to the IICCTL00.ACKE bit. For a slave device that
has received an extension code, or has received an address while the all address match function is enabled,
IICA0_TXRXI occurs at the falling edge of the eighth clock.
However, if the address does not match after restart, IICA0_TXRXI is generated at the falling edge of the 9th clock
cycle, but clock stretching does not occur.
Note 2. When the Slave Address Register n (SVAn) does not match the received address, the address match function is
disabled, and an extended code has not been received, neither IICA0_TXRXI nor clock stretching will occur.
Note 3. Master mode only
Table 22.3 shows the bit definitions for the major extension codes.
Table 22.3 Bit definitions of major extension codes
Slave address R/W# bit Description
22.3.14 Arbitration
When several master devices simultaneously generate a start condition (when the IICCTL00.STT bit is set to 1 before the
IICS0.STD bit is set to 1), communication among the master devices is performed as the clocks are adjusted until the data
differs. This kind of operation is called arbitration.
When one of the master devices loses in arbitration, an arbitration loss flag (IICS0.ALD) is set to 1 through the timing by
which the arbitration loss occurred, and the SCLA0 and SDAA0 lines are both set to high impedance, which releases the
bus.
The arbitration loss is detected by checking IICS0.ALD = 1 with software at the timing of the next interrupt request (the 8th
or 9th clock cycle, when a stop condition is detected, for instance).
For details of interrupt request timing, see section 22.3.10. Timing of Generation of the Interrupt Request Signal
(IICA0_TXRXI) and Control of Clock Stretching.
Figure 22.12 shows the arbitration timing example.
Master 1
Hi-Z
SCLAn
Hi-Z
SDAAn
Master 2 Master 1 loses arbitration
SCLAn
SDAAn
Transfer lines
SCLAn
SDAAn
Note: n=0
During address transmission At falling edge of 8th or 9th clock following byte transfer*1
Read/write data after address transmission
During extension code transmission
Read/write data after extension code transmission
During data transmission
During ACK transfer period after data transmission
When restart condition is detected during data transfer
When stop condition is detected during data transfer When stop condition is generated (when IICCTL00.SPIE = 1)*2
When data is at low level while attempting to generate a restart condition At falling edge of eighth or ninth clock following byte transfer*1
When stop condition is detected while attempting to generate a restart When stop condition is generated (when IICCTL00.SPIE = 1)*2
condition
When data is at low level while attempting to generate a stop condition At falling edge of 8th or 9th clock following byte transfer*1
When SCLA0 is at low level while attempting to generate a restart
condition
Note 1. When the IICCTL00.WTIM = 1, an interrupt request occurs at the falling edge of the ninth clock. When IICCTL00.WTIM = 0, the
extension code's slave address is received, and an address is received while the all address match function is enabled, an interrupt
request occurs at the falling edge of the 8th clock.
Note 2. When there is a chance that arbitration will occur, set IICCTL00.SPIE = 1 for master device operation.
Table 22.6 Flow when setting IICCTL01.WUP = 0 on address match (or when the all address match function is
enabled) (including extension code reception)
Step Process Detail
Use the following flows to perform the processing to release the Software Standby mode other than by an interrupt request
signal (IICA0_TXRXI) generated from I2C bus interface (IICA).
● When operating next IIC communication as master device: Flow shown in Table 22.7.
● When operating next IIC communication as slave device:
When released by IICA0_TXRXI interrupt: Same as the flow in Table 22.6.
When released by other than IICA0_TXRXI interrupt: Wait for IICA0_TXRXI interrupt with IICCTL01.WUP left set
to 1.
Table 22.7 When operating as master device after releasing Software Standby mode other than by
IICA0_TXRXI
Step Process Detail
When setting bit 1 (STT) of the IICCTLn0 register while in a non-participatory state on the bus, after the bus is released
(upon detecting a stop condition), it automatically generates a start condition and enters communication standby status.
Setting the SPIE bit of the IICCTLn0 register to 1, and detecting the release of the bus upon interrupt request
(IICAn_TXRXI) (detecting a stop condition), after writing the address to the IICA shift register n (IICAn), automatically
initiates communication as a master. Data written to the IICA0 register before the stop condition is detected is invalid.
When the IICCTL00.STT bit has been set to 1, the operation mode (as start condition or as communication reservation) is
determined according to the bus status.
● If the bus has been released ……………………… a start condition is generated
● If the bus has not been released (communication standby status) … communication reservation
Check whether the communication reservation operates or not using the IICS0.MSTS bit after the IICCTL00.STT bit is set
to 1 and the wait time elapses.
Use software to secure the wait time calculated by the following expression.
Wait time from setting IICCTL00.STT = 1 to checking the IICS0.MSTS flag:
(IICWL0 setting value + IICWH0 setting value + 4) / fMCK + tF × 2
IICCTLn0 Write to
Program processing .STT = 1 IICAn
SCLAn 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6
SDAAn
Note: n=0
SCLAn
SDAAn
IICSn.STD
IICSn.SPD
Note: n=0
Disable interrupts
Enable interrupts
Note: n=0
Note 1. The wait time is calculated as follows.
(IICWLn setting value + IICWHn setting value + 4) / fMCK + tF × 2
tF: SDAAn and SCLAn signal falling times
fMCK: IICA operation clock frequency
Note 2. The communication reservation operation executes a write to the IICA shift register n (IICAn) when a stop condition
interrupt request occurs.
To confirm whether the start condition was generated or request was rejected, check IICF0.STCF bit. It takes up to 5 cycles
of fMCK until the IICF0.STCF bit is set to 1 after setting IICCTL00.STT = 1. Therefore, secure the time by software.
2. When IICF0.STCEN = 1
Immediately after I2C operation is enabled (IICCTL00.IICE = 1), the bus released status (IICF0.IICBSY = 0) is
recognized regardless of the actual bus status. To generate the first start condition (IICCTL00.STT = 1), it is necessary
to confirm that the bus has been released, so as to not disturb other communications.
3. If other I2C communications are already in progress
If I2C operation is enabled and the device participates in communication already in progress when the SDAA0 pin is
low and the SCLA0 pin is high, the IICA recognizes that the SDAA0 pin has gone low (detects a start condition). If the
value on the bus at this time can be recognized as an extension code or the all address match function is enabled, ACK is
returned, but this interferes with other I2C communications. To avoid this, start the IICA in the following sequence.
<1> Clear SPIE bit of the IICCTL00 register to 0 to disable generation of an interrupt request signal (IICA0_TXRXI)
when the stop condition is detected.
<2> Set IICE bit of the IICCTL00 register to 1 to enable the operation of the IICA.
<3> Wait for detection of the start condition.
<4> Set LREL bit of the IICCTL00 register to 1 before ACK is returned (4 to 72 cycles of fMCK after setting the
IICCTL00.IICE bit to 1), to forcibly disable detection.
4. Setting the IICCTL00.STT and IICCTL00.SPT bits again after they are set and before they are cleared to 0 is prohibited.
5. When transmission is reserved, set the IICCTL00.SPIE bit to 1 so that an interrupt request is generated when the stop
condition is detected. Transfer is started when communication data is written to the IICA shift register 0 (IICA0) after
the interrupt request is generated. Unless the interrupt is generated when the stop condition is detected, the device
stops in the wait state because the interrupt request is not generated when communication is started. However, it is not
necessary to set the IICCTL00.SPIE bit to 1 when the IICS0.MSTS bit is detected by software.
START
Setting the MSTPCRB register Cancel the module-stop state and start clock supply.
Setting port Setting of the port multiplexed with the pin to be used.
First, set the port to input mode*1.
IICFn ¬ 0x0X
Set a start condition.
Setting STCEN, IICRSV = 0
Setting IICCTLn1
Initial setting
IICCTLn0 ¬ 0XX111XXb
ACKE = WTIM = SPIE = 1
IICCTLn0 ¬ 1XX111XXb
IICE = 1
Setting port Set the port from input mode to output mode and enable the output of the I2C bus*1.
Yes
IICFn.STCEN = 1?
No
Prepare for starting communication
IICCTLn0.SPT = 1
(generate a stop condition).
IICAn_TXRXI No
interrupt occurs?
Wait for detection of the stop condition.
Yes
Start communication
Writing IICAn (specify an address and transfer
direction).
IICAn_TXRXI No
interrupt occurs? Wait for detection of acknowledgment.
Yes
No IICSn.ACKD = 1?
IICCTLn0.ACKE = 1
Yes IICCTLn0.WTIM = 0
IICSn.TRC = 1? No
IICCTLn0.WREL = 1 Start reception.
Communication processing
Yes
IICAn_TXRXI No
Writing IICAn Starts transmission.
interrupt occurs?
Wait for data
Yes reception.
No End of transfer?
IICCTLn0.WTIM = 1
Yes
IICCTLn0.WREL = 1
Restart? No
IICAn_TXRXI No
Yes IICCTLn0.SPT = 1 interrupt occurs?
Wait for detection
of acknowledgment.
Yes
END
Note: n=0
Note 1. See section 22.2.9. Registers to Control the Port Function Multiplexed with the I2C I/O Pins.
Note 2. Release (SCLAn and SDAAn pins = high level) the I2 bus in conformance with the specifications of the product that is
communicating. If EEPROM is outputting a low level to the SDAAn pin, for example, set the SCLAn pin in the output port
mode, and output a clock pulse from the output port until the SDAAn pin is constantly at high level.
START
Setting the MSTPCRB register Cancel the Module-stop state and start clock supply.
IICFn ¬ 0x0X
Set a start condition.
Setting STCEN and IICRSV
Setting IICCTLn1
IICCTLn0 ¬ 0XX111XXb
ACKE = WTIM = SPIE = 1
IICCTLn0 ¬ 1XX111XXb
Initial setting
IICE = 1
Setting port Set the port from input mode to output mode and enable the output of the I2C bus*1.
Bus status is No
IICFn.STCEN = 1?
being checked.
Prepare for starting
No IICAn_TXRXI Yes IICCTLn0.SPT = 1 communication
interrupt occurs? (generate a stop condition).
Yes
IICAn_TXRXI No
interrupt occurs?
IICSn.SPD = 1? No Wait for detection
Yes of the stop condition.
Yes IICCTLn0.SPIE = 0
(Communication start request)
IICAn_TXRXI No
IICCTLn0.SPIE = 1 interrupt occurs? Wait for a communication request.
Yes
Yes
A B
Enable reserving Disable reserving
communication. communication.
Note: n=0
Note 1. section 22.2.9. Registers to Control the Port Function Multiplexed with the I2C I/O Pins.
Note 2. Confirm that the bus is released (IICCTLn1.CLD bit = 1, IICCTLn1.DAD bit = 1) for a specific period (for example, for
a period of one frame). If the SDAAn pin is constantly at low level, decide whether to release the I2C bus (SCLAn and
SDAAn pins = high level) in conformance with the specifications of the product that is communicating.
IICSn.MSTS = 1? No
Yes IICAn_TXRXI No
interrupt occurs? Wait for bus release
(communication being reserved).
Yes
No IICSn.EXC = 1 or
Wait state after stop condition IICSn.COI = 1?
was detected and start condition
was generated by the communication Yes
reservation function.
C Slave device operation
IICFn.IICBSY = 0? No
Yes
D
IICFn.STCF = 0? No
Yes IICAn_TXRXI No
interrupt occurs? Wait for bus release
Yes
C
IICSn.EXC = 1 or No
IICSn.COI = 1?
Detect a stop condition.
Yes
Note: n=0
Note 1. The wait time is calculated as follows.
(IICWLn setting value + IICWHn setting value + 4) / fMCK + tF × 2
Note 2. tF: SDAAn and SCLAn signal falling times
fMCK: IICA operation clock frequency
Start communication
Writing IICAn
(specify an address and transfer direction).
IICAn_TXRXI No
interrupt occurs? Wait for detection of ACK.
Yes
IICSn.MSTS = 1? No
Yes 2
No IICSn.ACKD = 1?
IICCTLn0.ACKE = 1
IICCTLn0.WTIM = 0
Yes
No
IICSn.TRC = 1? IICCTLn0.WREL = 1 Start reception.
Yes
IICCTLn0.WTIM = 1 IICAn_TXRXI No
Communication processing
Yes
Writing IICAn Start transmission.
IICSn.MSTS = 1? No
IICAn_TXRXI No Yes
interrupt occurs? 2
Wait for data transmission.
Reading IICAn
Yes
IICSn.MSTS = 1? No
Transfer end? No
Yes 2 Yes
IICSn.ACKD = 1? No IICCTLn0.ACKE = 0
Yes IICCTLn0.WTIM = 1
Yes
IICAn_TXRXI No
interrupt occurs? Wait for detection of ACK.
No
Restart?
Yes
IICCTLn0.SPT = 1
Yes
IICSn.MSTS = 1? No
IICCTLn0.STT = 1 END
Yes 2
C
Communication processing
IICSn.EXC = 1 or No
IICSn.COI = 1 ?
Yes 1
Note: n=0
IICAn_TXRXI Flag
Interrupt servicing
Setting
IICA Main processing
Data
Setting
Note: n=0
Figure 22.20 Interface configuration with the main processor in slave device operation
Therefore, data communication processing is performed by preparing the following three flags and passing them to the main
processing instead of IICA0_TXRXI.
<1> Communication mode flag
This flag indicates the following two communication statuses.
● Clear mode: Status in which data communication is not performed
● Communication mode: Status in which data communication is performed (from valid address detection to stop
condition detection, no detection of ACK from master device, address mismatch)
START
Setting the MSTPCRB register Cancel the module-stop state and start clock supply.
Setting port Setting of the port multiplexed with the pin to be used.
First, set the port to input mode *1.
Setting IICCTLn1
IICCTLn0 ¬ 0XX011XXb
ACKE = WTIM = 1, SPIE = 0
IICCTLn0 ¬ 1XX011XXb
IICE = 1
Setting port Set the port from input mode to output mode and enable the output of the I2C bus *1.
No Communication
mode flag = 1?
Yes
No
Communication
direction flag = 1?
Yes
IICCTLn0.SPIE = 1
Writing IICAn Starts
transmission.
Communication processing
No Starts
Communication IICCTLn0.WREL = 1
mode flag = 1? reception.
Yes
No Communication No
Communication
direction flag = 1? mode flag = 1?
Yes Yes
No No
Communication
Ready flag = 1? direction flag = 0?
Yes Yes
No
Clearing ready flag Ready flag = 1?
Yes
Yes
IICSn.ACKD = 1? Reading IICAn
No
Clearing communication
mode flag Clearing ready flag
IICCTLn0.WREL = 1
Note: n=0
Note 1. See section 22.2.9. Registers to Control the Port Function Multiplexed with the I2C I/O Pins.
If the address matches, the communication mode is set, wait is canceled, and processing returns from the interrupt (the ready
flag is cleared).
<3> For data transmit/receive, only the ready flag is set. Processing returns from the interrupt with the I2C bus remaining in
the communication standby status.
Figure 22.22 shows the interrupt flowchart for slave device operation.
IICAn_TXRXI generated
Yes <1>
IICSn.SPD = 1?
No
Yes <2>
IICSn.STD = 1?
No No
IICSn.COI = 1?
<3>
Yes
Set ready flag
Note: n=0
1. When IICCTL00.WTIM = 0
IICCTLn0.SPT = 1
¯
ST AD6 to AD0 R/W# ACK D7 to D0 ACK D7 to D0 ACK SP
1 2 3 4 5
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Note 1. To generate a stop condition, set the IICCTLn0.WTIM bit to 1 and change the timing for generating the IICAn_TXRXI
interrupt request signal.
2. When IICCTL00.WTIM = 1
IICCTLn0.SPT = 1
¯
ST AD6 to AD0 R/W# ACK D7 to D0 ACK D7 to D0 ACK SP
1 2 3 4
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
1. When IICCTL00.WTIM = 0
IICCTLn0.STT = 1 IICCTLn0.SPT = 1
¯ ¯
ST AD6 to AD0 R/W# ACK D7 to D0 ACK ST AD6 to AD0 R/W# ACK D7 to D0 ACK SP
1 2 3 4 5 6 7
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Note 1. To generate a start condition, set the IICCTLn0.WTIM bit to 1 and change the timing for generating the IICAn_TXRXI
interrupt request signal.
Note 2. Clear the IICCTLn0.WTIM bit to 0 to restore the original setting.
Note 3. To generate a stop condition, set the IICCTLn0.WTIM bit to 1 and change the timing for generating the IICAn_TXRXI
interrupt request signal.
2. When IICCTL00.WTIM = 1
IICCTLn0.STT = 1 IICCTLn0.SPT = 1
¯ ¯
ST AD6 to AD0 R/W# ACK D7 to D0 ACK ST AD6 to AD0 R/W# ACK D7 to D0 ACK SP
1 2 3 4 5
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
1. When IICCTL00.WTIM = 0
IICCTLn0.SPT = 1
¯
ST AD6 to AD0 R/W# ACK D7 to D0 ACK D7 to D0 ACK SP
1 2 3 4 5
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Note 1. To generate a stop condition, set the IICCTLn0.WTIM bit to 1 and change the timing for generating the IICAn_TXRXI
interrupt request signal.
2. When IICCTL00.WTIM = 1
IICCTLn0.SPT = 1
¯
ST AD6 to AD0 R/W# ACK D7 to D0 ACK D7 to D0 ACK SP
1 2 3 4
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
1. When IICCTL00.WTIM = 0
1 2 3 4
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.29 Slave device operation slave address data reception (IICCTL00.WTIM = 0)
2. When IICCTL00.WTIM = 1
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.30 Slave device operation slave address data reception (IICCTL00.WTIM = 1)
1. When IICCTL00.WTIM = 0 (after restart, matches with SVA0, the all address match function is disabled)
ST AD6 to AD0 R/W# ACK D7 to D0 ACK ST AD6 to AD0 R/W# ACK D7 to D0 ACK SP
1 2 3 4 5
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.31 Slave device operation after normal access, matches with SVA0 (IICCTL00.WTIM = 0)
2. When IICCTL00.WTIM = 1 (after restart, matches with SVA0, the all address match function is disabled)
ST AD6 to AD0 R/W# ACK D7 to D0 ACK ST AD6 to AD0 R/W# ACK D7 to D0 ACK SP
1 2 3 4 5
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.32 Slave device operation after normal access, matches with SVA0 (IICCTL00.WTIM = 1)
1. When IICCTL00.WTIM = 0
(after restart, does not match address (extension code, the all address match function is disabled))
ST AD6 to AD0 R/W# ACK D7 to D0 ACK ST AD6 to AD0 R/W# ACK D7 to D0 ACK SP
1 2 3 4 5
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.33 Slave device operation after normal access, matches the extension code (IICCTL00.WTIM = 0)
2. When IICCTL00.WTIM = 1
(after restart, does not match address (extension code, the all address match function is disabled))
ST AD6 to AD0 R/W# ACK D7 to D0 ACK ST AD6 to AD0 R/W# ACK D7 to D0 ACK SP
1 2 3 4 5 6
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.34 Slave device operation after normal access, matches the extension code (IICCTL00.WTIM = 1)
1. When IICCTL00.WTIM = 0
(after restart, does not match address (not extension code, the all address match function is disabled))
ST AD6 to AD0 R/W# ACK D7 to D0 ACK ST AD6 to AD0 R/W# ACK D7 to D0 ACK SP
1 2 3 4
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.35 Slave device operation after normal access, does not matches (IICCTL00.WTIM = 0)
2. When IICCTL00.WTIM = 1
(after restart, does not match address (not extension code, the all address match function is disabled))
ST AD6 to AD0 R/W# ACK D7 to D0 ACK ST AD6 to AD0 R/W# ACK D7 to D0 ACK SP
1 2 3 4
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.36 Slave device operation after normal access, does not matches (IICCTL00.WTIM = 1)
(3) Slave device operation (when receiving extension code and the all address match function is
disabled)
The device is always participating in communication when it receives an extension code.
1. When IICCTL00.WTIM = 0
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
2. When IICCTL00.WTIM = 1
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
1. When IICCTL00.WTIM = 0 (after restart, matches with SVA0, the all address match function is disabled)
ST AD6 to AD0 R/W# ACK D7 to D0 ACK ST AD6 to AD0 R/W# ACK D7 to D0 ACK SP
1 2 3 4 5
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.39 Slave device operation after code access, matches with SVA0 (IICCTL00.WTIM = 0)
2. When IICCTL00.WTIM = 1 (after restart, matches with SVA0, the all address match function is disabled)
ST AD6 to AD0 R/W# ACK D7 to D0 ACK ST AD6 to AD0 R/W# ACK D7 to D0 ACK SP
1 2 3 4 5 6
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.40 Slave device operation after code access, matches with SVA0 (IICCTL00.WTIM = 1)
1. When IICCTL00.WTIM = 0 (after restart, extension code reception, the all address match function is
disabled)
ST AD6 to AD0 R/W# ACK D7 to D0 ACK ST AD6 to AD0 R/W# ACK D7 to D0 ACK SP
1 2 3 4 5
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.41 Slave device operation after code access, matches the extension code (IICCTL00.WTIM = 0)
2. When IICCTL00.WTIM = 1 (after restart, extension code reception, the all address match function is
disabled)
ST AD6 to AD0 R/W# ACK D7 to D0 ACK ST AD6 to AD0 R/W# ACK D7 to D0 ACK SP
1 2 3 4 5 6 7
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.42 Slave device operation after code access, matches the extension code (IICCTL00.WTIM = 1)
1. When IICCTL00.WTIM = 0
(after restart, does not match address (not extension code, the all address match function is disabled))
ST AD6 to AD0 R/W# ACK D7 to D0 ACK ST AD6 to AD0 R/W# ACK D7 to D0 ACK SP
1 2 3 4
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.43 Slave device operation after code access, does not matches (IICCTL00.WTIM = 0)
2. When IICCTL00.WTIM = 1
(after restart, does not match address (not extension code, the all address match function is disabled))
ST AD6 to AD0 R/W# ACK D7 to D0 ACK ST AD6 to AD0 R/W# ACK D7 to D0 ACK SP
1 2 3 4 5
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.44 Slave device operation after code access, does not matches (IICCTL00.WTIM = 1)
(5) Arbitration loss operation (operation as slave mode after arbitration loss)
When the device is used as a master device in a multi-master system, read the IICS0.MSTS bit each time interrupt request
signal IICA0_TXRXI has occurred to check the arbitration result.
(a) When arbitration loss occurs during transmission of slave address data
1. When IICCTL00.WTIM = 0
1 2 3 4
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.46 Arbitration loss when sending slave address data (IICCTL00.WTIM = 0)
2. When IICCTL00.WTIM = 1
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.47 Arbitration loss when sending slave address data (IICCTL00.WTIM = 1)
(b) When arbitration loss occurs during transmission of extension code (the all address match function
is disabled)
1. When IICCTL00.WTIM = 0
1 2 3 4
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
2. When IICCTL00.WTIM = 1
1 2 3 4 5
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
(6) Operation when arbitration loss occurs (no communication after arbitration loss)
When the device is used as a master device in a multi-master system, read the IICS0.MSTS bit each time interrupt request
signal IICA0_TXRXI has occurred to check the arbitration result.
(a) When arbitration loss occurs during transmission of slave address data (when IICCTL00.WTIM = 1)
1 2
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
Figure 22.50 Operation when arbitration loss occurs during slave address data transmission
(IICCTL00.WTIM = 1)
(b) When arbitration loss occurs during transmission of extension code (the all address match function
is disabled)
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.51 Operation when arbitration loss occurs during extension code transmission
1. When IICCTL00.WTIM = 0
1 2 3
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
Figure 22.52 Operation when arbitration loss occurs during data transfer (IICCTL00.WTIM = 0)
2. When IICCTL00.WTIM = 1
1 2 3
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
Figure 22.53 Operation when arbitration loss occurs during data transfer (IICCTL00.WTIM = 1)
(d) When loss occurs due to restart condition during data transfer
1. Not extension code (Example: unmatches with SVA0, the all address match function is disabled)
1 2 3
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
m = 6 to 0
Figure 22.54 Operation when arbitration loss occurs due to restart during data transfer (not extension
code)
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
m = 6 to 0
Figure 22.55 Operation when arbitration loss occurs due to restart during data transfer (extension code)
(e) When loss occurs due to stop condition during data transfer
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
m = 6 to 0
Figure 22.56 Operation when arbitration loss occurs due to stop condition during data transfer
(f) When arbitration loss occurs due to low-level data when attempting to generate a restart condition
1. When IICCTL00.WTIM = 0
IICCTLn0.STT = 1
¯
ST AD6 to AD0 R/W# ACK D7 to D0 ACK D7 to D0 ACK D7 to D0 ACK SP
1 2 3 4 5
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.57 Operations when arbitration loss occurs due to low-level data when attempting to generate a
restart condition (IICCTL00.WTIM = 0)
2. When IICCTL00.WTIM = 1
IICCTLn0.STT = 1
¯
ST AD6 to AD0 R/W# ACK D7 to D0 ACK D7 to D0 ACK D7 to D0 ACK SP
1 2 3 4
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.58 Operations when arbitration loss occurs due to low-level data when attempting to generate a
restart condition (IICCTL00.WTIM = 1)
(g) When arbitration loss occurs due to a stop condition when attempting to generate a restart condition
1. When IICCTL00.WTIM = 0
IICCTLn0.STT = 1
¯
ST AD6 to AD0 R/W# ACK D7 to D0 ACK SP
1 2 3 4
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.59 Operations when arbitration loss occurs due to stop condition when attempting to generate a
restart condition (IICCTL00.WTIM = 0)
2. When IICCTL00.WTIM = 1
IICCTLn0.STT = 1
¯
ST AD6 to AD0 R/W# ACK D7 to D0 ACK SP
1 2 3
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.60 Operations when arbitration loss occurs due to stop condition when attempting to generate a
restart condition (IICCTL00.WTIM = 1)
(h) When arbitration loss occurs due to low-level data when attempting to generate a stop condition
1. When IICCTL00.WTIM = 0
IICCTLn0.SPT = 1
¯
ST AD6 to AD0 R/W# ACK D7 to D0 ACK D7 to D0 ACK D7 to D0 ACK SP
1 2 3 4 5
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.61 Operations when arbitration loss occurs due to S low-level data when attempting to generate
a stop condition (IICCTL00.WTIM = 0)
2. When IICCTL00.WTIM = 1
IICCTLn0.SPT = 1
¯
ST AD6 to AD0 R/W# ACK D7 to D0 ACK D7 to D0 ACK D7 to D0 ACK SP
1 2 3 4
Note: n=0
Note: ▲: Always generated
△: Generated only when IICCTLn0.SPIE = 1
x: Don't care
Figure 22.62 Operations when arbitration loss occurs due to S low-level data when attempting to generate
a stop condition (IICCTL00.WTIM = 1)
(1) Example of Master device to Slave device Communications (When the master device and the
slave device insert clock stretching on the 9th cycle.)
1. Start condition → address → data
Master side
*1
IICAn Data shift +Output (AD[6:0] + W#) Data shift
<2> <5>
IICSn.ACKD
(ACK detection)
IICCTLn0.WTIM
(8th or 9th cycle clock stretching) H
IICCTLn0.ACKE
(ACK control) H
IICSn.MSTS
(communication status)
IICCTLn0.STT
<1>
(ST trigger)
IICCTLn0.SPT
(SP trigger) L
IICCTLn0.WREL
(release from clock stretching) L
IICAn_TXRXI
(interrupt)
IICSn.TRC
(transmit/receive)
SCLAn (bus)
(clock line)
*2
<4>
SDAAn (bus)
(data line) AD6 AD5 AD4 AD3 AD2 AD1 AD0 W# ACK D17
IICCTLn0.ACKE
(ACK control) H
IICSn.MSTS
(communication status) L
*3
IICCTLn0.WREL
<6>
(release from clock stretching)
IICAn_TXRXI
(interrupt)
IICSn.TRC
(transmit/receive) L
Note: n=0
Note 1. For release from the clock stretch state during transmission by a master device, write data to the IICAn register instead
of setting the IICCTLn0.WREL bit.
Note 2. Make sure that the time between the fall of the SDAAn pin signal and the fall of the SCLAn pin signal is at least 4.0 µs
when specifying standard mode and at least 0.6 µs when specifying fast mode.
Note 3. For release from the clock stretch state during reception by a slave mode, write 0xFF to IICAn or set the
IICCTLn0.WREL bit.
Figure 22.63 Example of master device to slave device communications (When the master device and the
slave device insert clock stretching on the 9th cycle.) (1/4)
The meanings of <1> to <6> in Figure 22.63 are explained below.
<1> The start condition trigger is set by the master device (IICCTL00.STT = 1) and a start condition (SCLA0 = 1 and
SDAA0 changes from 1 to 0) is generated once the bus data line goes low (SDAA0).
When the start condition is subsequently detected, the master device enters the master mode communication status
(IICS0.MSTS = 1). The master device is ready to communicate once the bus clock line goes low (SCLA0 = 0) after
the hold time has elapsed.
<2> The master device writes the address + W (transmission) to the IICA shift register 0 (IICA0) and transmits the slave
address.
<3> In the slave device if the address received matches the address (SVA0 value) of a slave device, that slave device sends
an ACK by hardware to the master device. The ACK is detected by the master device (IICS0.ACKD = 1) at the rising edge
of the 9th clock.
<4> The master device issues an interrupt (IICA0_TXRXI: end of address transmission) at the falling edge of the 9th clock.
The slave device with the address matching the transmitted slave address sets the clock stretch state (SCLA0 = 0) and issues
an interrupt (IICA0_TXRXI: address match).
<5> The master device writes the data to transmit to the IICA0 register and releases the clock stretch state set by the master
device.
<6> If the slave device releases the clock stretch state (IICCTL00.WREL = 1), the master device starts transferring data to
the slave device.
If the transmitted address does not match the address of the slave device, the slave device does not return an ACK to the
master device (NACK: SDAA0 = 1). The slave device also does not issue the IICA0_TXRXI interrupt (address match) and
does not set the clock stretch state.
The master device, however, issues the IICA0_TXRXI interrupt (end of address transmission) regardless of whether it
receives an ACK or NACK.
Note: <1> to <15> in (1) Example of Master device to Slave device Communications (When the master device and the
slave device insert clock stretching on the 9th cycle.) represent the entire procedure for communicating data using
the I2C bus.
Figure 22.63 shows the processing from <1> to <6>,
Figure 22.64 shows the processing from <3> to <10>, and
Figure 22.65 shows the processing from <7> to <15>.
Master side
*1 *1
IICAn Data shift +Output (D1[7:0]) Data shift
<5> <9>
IICSn.ACKD
(ACK detection)
IICCTLn0.WTIM
(8th or 9th cycle clock stretching) H
IICCTLn0.ACKE
(ACK control) H
IICSn.MSTS
(communication status) H
IICCTLn0.STT
(ST trigger) L
IICCTLn0.SPT
(SP trigger) L
IICCTLn0.WREL
(release from clock stretching) L
IICAn_TXRXI
(interrupt)
IICSn.TRC
(transmit/receive) H
Bus line
SCLAn (bus)
(clock line)
<4> <8>
SDAAn (bus)
(data line) W# ACK D17 D 16 D 15 D14 D 13 D 12 D 11 D 10 ACK D 27
<3> <7>
Slave side
IICSn.ACKD
(ACK detection)
IICSn.STD
(ST detection)
IICSn.SPD
L
(SP detection)
IICCTLn0.WTIM
(8th or 9th cycle clock stretching) H
IICCTLn0.ACKE
H
(ACK control)
IICSn.MSTS
L
(communication status)
IICCTLn0.WREL <6> *2 <10> *2
(release from clock stretching)
IICAn_TXRXI
(interrupt)
IICSn.TRC L
(transmit/receive)
Note: n=0
Note 1. For release from the clock stretch state during transmission by a master device, write data to the IICAn register instead
of setting the IICCTLn0.WREL bit.
Note 2. For release from the clock stretch state during reception by a slave mode, write 0xFF to IICAn or set the
IICCTLn0.WREL bit.
Figure 22.64 Example of master device to slave device communications (When the master device and the
slave device insert clock stretching on the 9th cycle.) (2/4)
The meanings of <3> to <10> in Figure 22.64 are explained below.
<3> In the slave device if the address received matches the address (SVA0 value) of a slave device, that slave device sends
an ACK by hardware to the master device. The ACK is detected by the master device (IICS0.ACKD = 1) at the rising edge
of the 9th clock.
<4> The master device issues an interrupt (IICA0_TXRXI: end of address transmission) at the falling edge of the 9th clock.
The slave device with the address matching the transmitted slave address sets the clock stretch state (SCLA0 = 0) and issues
an interrupt (IICA0_TXRXI: address match).
<5> The master device writes the data to transmit to the IICA shift register 0 (IICA0) and releases the clock stretch state set
by the master device.
<6> If the slave device releases the clock stretch state (IICCTL00.WREL = 1), the master device starts transferring data to
the slave device.
<7> After data transfer is completed, because of IICCTL00.ACKE = 1, the slave device sends an ACK by hardware to the
master device. The ACK is detected by the master device (IICS0.ACKD = 1) at the rising edge of the 9th clock.
<8> The master device and slave device set the clock stretch state (SCLA0 = 0) at the falling edge of the 9th clock, and both
the master device and slave device issue an interrupt (IICA0_TXRXI: end of transfer).
<9> The master device writes the data to transmit to the IICA0 register and releases the clock stretch state set by the master
device.
<10>The slave device reads the received data and releases the clock stretch state (IICCTL00.WREL = 1). The master device
then starts transferring data to the slave device.
If the transmitted address does not match the address of the slave device, the slave device does not return an ACK to the
master device (NACK: SDAA0 = 1). The slave device also does not issue the IICA0_TXRXI interrupt (address match) and
does not set the clock stretch state.
The master device, however, issues the IICA0_TXRXI interrupt (end of address transmission) regardless of whether it
receives an ACK or NACK.
Note: <1> to <15> in (1) Example of Master device to Slave device Communications (When the master device and the
slave device insert clock stretching on the 9th cycle.) represent the entire procedure for communicating data using
the I2C bus.
Figure 22.63 shows the processing from <1> to <6>,
Figure 22.64 shows the processing from <3> to <10>, and
Figure 22.65 shows the processing from <7> to <15>.
Master side
*1
IICAn Data shift +Output (D16[7:0])
<9>
IICSn.ACKD
(ACK detection)
IICCTLn0.WTIM
(8th or 9th cycle clock stretching) H
IICCTLn0.ACKE
(ACK control) H
IICSn.MSTS
(communication status)
IICCTLn0.STT
L
(ST trigger)
IICCTLn0.SPT
(SP trigger)
<14>
IICCTLn0.WREL
(release from clock stretching)
L
IICAn_TXRXI
(interrupt)
IICSn.TRC
(transmit/receive)
SCLAn (bus)
(clock line)
<8> <12>
SDAAn (bus)
D150 ACK D167 D166 D165 D164 D163 D162 D161 D160 ACK
(data line)
*2
<7> <11>
Slave side <15>
IICSn.ACKD
(ACK detection)
IICSn.STD L
(ST detection)
IICSn.SPD
(SP detection)
IICCTLn0.WTIM H
(8th or 9th cycle clock stretching)
IICCTLn0.ACKE H
(ACK control)
IICSn.MSTS L
(communication status)
*3 *3
IICCTLn0.WREL <10> <13>
(release from clock stretching)
IICAn_TXRXI
(interrupt)
IICSn.TRC L
(transmit/receive)
Note: n=0
Note 1. For release from the clock stretch state during transmission by a master device, write data to the IICAn register instead
of setting the IICCTLn0.WREL bit.
Note 2. Make sure that the time between the rise of the SCLAn pin signal and the generation of the stop condition after a stop
condition has been issued is at least 4.0 µs when specifying standard mode and at least 0.6 µs when specifying fast
mode.
Note 3. For release from the clock stretch state during reception by a slave mode, write 0xFF to IICAn or set the
IICCTLn0.WREL bit.
Figure 22.65 Example of master device to slave device communications (When the master device and the
slave device insert clock stretching on the 9th cycle.) (3/4)
The meanings of <7> to <15> in Figure 22.65 are explained below.
<7> After data transfer is completed, because of IICCTL00.ACKE = 1, the slave device sends an ACK by hardware to the
master device. The ACK is detected by the master device (IICS0.ACKD = 1) at the rising edge of the 9th clock.
<8> The master device and slave device set the clock stretch state (SCLA0 = 0) at the falling edge of the 9th clock, and both
the master device and slave device issue an interrupt (IICA0_TXRXI: end of transfer).
<9> The master device writes the data to transmit to the IICA shift register 0 (IICA0) and releases the clock stretch state set
by the master device.
<10>The slave device reads the received data and releases the clock stretch state (IICCTL00.WREL = 1). The master device
then starts transferring data to the slave device.
<11>When data transfer is complete, the slave device (IICCTL00.ACKE = 1) sends an ACK by hardware to the master
device.
The ACK is detected by the master device (IICS0.ACKD = 1) at the rising edge of the 9th clock.
<12>The master device and slave device set the clock stretch state (SCLA0 = 0) at the falling edge of the 9th clock, and
both the master device and slave device issue an interrupt (IICA0_TXRXI: end of transfer).
<13>The slave device reads the received data and releases the clock stretch state (IICCTL00.WREL = 1).
<14>By the master device setting a stop condition trigger (IICCTL00.SPT = 1), the bus data line is cleared (SDAA0 = 0)
and the bus clock line is set (SCLA0 = 1). After the stop condition setup time has elapsed, by setting the bus data line
(SDAA0 = 1), the stop condition is then generated (SCLA0 = 1 and SDAA0 changes from 0 to 1).
<15>When a stop condition is generated, the slave device detects the stop condition and issues an interrupt (IICA0_TXRXI:
stop condition).
Note: <1> to <15> in (1) Example of Master device to Slave device Communications (When the master device and the
slave device insert clock stretching on the 9th cycle.) represent the entire procedure for communicating data using
the I2C bus.
Figure 22.63 shows the processing from <1> to <6>,
Figure 22.64 shows the processing from <3> to <10>, and
Figure 22.65 shows the processing from <7> to <15>.
Master side
IICAn_TXRXI
(interrupt)
IICSn.TRC
(transmit/receive) H
Bus line
Restart condition
SCLAn (bus)
(clock line)
<8>
SDAAn (bus)
(data line) D13 D12 D11 D10 ACK AD6 AD5 AD4 AD3 AD2 AD1
<7> *1 Slave address
Slave side
IICSn.ACKD
(ACK detection)
IICSn.STD
(ST detection)
IICSn.SPD
L
(SP detection)
IICCTLn0.WTIM
(8th or 9th cycle clock stretching) H
IICCTLn0.ACKE
H
(ACK control)
IICSn.MSTS
(communication status)
L
IICCTLn0.WREL *2
<i>
(release from clock stretching)
IICAn_TXRXI
(interrupt)
IICSn.TRC
L
(transmit/receive)
Note: n=0
Note 1. Make sure that the time between the rise of the SCLAn pin signal and the generation of the start condition after a restart
condition has been issued is at least 4.7 µs when specifying standard mode and at least 0.6 µs when specifying fast
mode.
Note 2. For release from the clock stretch state during reception by a slave mode, write 0xFF to IICAn or set the
IICCTLn0.WREL bit.
Figure 22.66 Example of master device to slave device communications (When the master device and the
slave device insert clock stretching on the 9th cycle.) (4/4)
The following describes the operations in Figure 22.66. After the operations in steps <7> and <8>, the operations in steps
<i> to <iii> are performed. These steps return the processing to step <3>, the data transmission step.
<7> After data transfer is completed, because of IICCTL00.ACKE = 1, the slave device sends an ACK by hardware to the
master device. The ACK is detected by the master device (IICS0.ACKD = 1) at the rising edge of the 9th clock.
<8> The master device and slave device set the clock stretch state (SCLA0 = 0) at the falling edge of the 9th clock, and both
the master device and slave device issue an interrupt (IICA0_TXRXI: end of transfer).
<i> The slave device reads the received data and releases the clock stretch state (IICCTL00.WREL = 1).
<ii> The start condition trigger is set again by the master device (IICCTL00.STT = 1) and a start condition (SCLA0
= 1 and SDAA0 changes from 1 to 0) is generated once the bus clock line goes high (SCLA0 = 1) and the bus data
line goes low (SDAA0 = 0) after the restart condition setup time has elapsed. When the start condition is subsequently
detected, the master device is ready to communicate once the bus clock line goes low (SCLA0 = 0) after the hold time
has elapsed.
<iii> The master device writing the address + R/W (transmission) to the IICA shift register 0 (IICA0) enables the slave
address to be transmitted.
(2) Example of Slave device to Master device Communications (8th Cycle Clock Stretching Is
Selected for the Master device and 9th Cycle Clock Stretching Is Selected for the Slave device)
1. Start condition → address → data
Master side
IICAn_TXRXI
(interrupt)
IICSn.TRC
(transmit/receive)
Start condition
Bus line
SCLAn (bus)
(clock line) *2
<4>
SDAAn (bus) D 17
AD6 AD5 AD4 AD3 AD2 AD1 AD0 R ACK
(data line)
Slave address <3>
*3
Slave side
IICCTLn0.ACKE H
(ACK control)
IICSn.MSTS L
(communication status)
IICCTLn0.WREL L
(release from clock stretching)
IICAn_TXRXI
(interrupt)
IICSn.TRC
(transmit/receive)
Note: n=0
Note 1. For release from the clock stretch state during reception by a master device, write 0xFF to IICAn or set the
IICCTLn0.WREL bit.
Note 2. Make sure that the time between the fall of the SDAAn pin signal and the fall of the SCLAn pin signal is at least 4.0 µs
when specifying standard mode and at least 0.6 µs when specifying fast mode.
Note 3. For release from the clock stretch state during transmission by a slave mode, write data to the IICAn register instead of
setting the IICCTLn0.WREL bit.
Figure 22.67 Example of slave device to master device communications (8th cycle clock stretching is
selected for the master device and 9th cycle clock stretching is selected for the slave device)
(1/3)
The meanings of <1> to <7> in Figure 22.67 are explained below.
<1> The start condition trigger is set by the master device (IICCTL00.STT = 1) and a start condition (SCLA0 = 1
and SDAA0 changes from 1 to 0) is generated once the bus data line goes low (SDAA0). When the start condition is
subsequently detected, the master device enters the master mode communication status (IICS0.MSTS = 1). The master
device is ready to communicate once the bus clock line goes low (SCLA0 = 0) after the hold time has elapsed.
<2> The master device writes the address + R (reception) to the IICA shift register 0 (IICA0) and transmits the slave
address.
<3> In the slave device if the address received matches the address (SVA0 value) of a slave device, that slave device sends
an ACK by hardware to the master device. The ACK is detected by the master device (IICS0.ACKD = 1) at the rising edge
of the 9th clock.
<4> The master device issues an interrupt (IICA0_TXRXI: end of address transmission) at the falling edge of the 9th clock.
The slave device with the address matching the transmitted slave address sets the clock stretch state (SCLA0 = 0) and issues
an interrupt (IICA0_TXRXI: address match).
<5> The timing at which the master device sets the clock stretch state changes to the 8th clock (WTIM = 0).
<6> The slave device writes the data to transmit to the IICA0 register and releases the clock stretch state set by the slave
device.
<7> The master device releases the clock stretch state (IICCTL00.WREL = 1) and starts transferring data from the slave
device to the master device.
If the transmitted address does not match the address of the slave device, the slave device does not return an ACK to the
master device (NACK: SDAA0 = 1). The slave device also does not issue the IICA0_TXRXI interrupt (address match) and
does not set the clock stretch state.
The master device, however, issues the IICA0_TXRXI interrupt (end of address transmission) regardless of whether it
receives an ACK or NACK.
Note: <1> to <19> in (2) Example of Slave device to Master device Communications (8th Cycle Clock Stretching Is
Selected for the Master device and 9th Cycle Clock Stretching Is Selected for the Slave device) represent the entire
procedure for communicating data using the I2C bus.
Figure 22.67 shows the processing from <1> to <7>,
Figure 22.68 shows the processing from <3> to <12>, and
Figure 22.69 shows the processing from <8> to <19>.
Master side
IICCTLn0.WTIM
(8th or 9th cycle clock stretching) <5>
IICCTLn0.ACKE
(ACK control) H
IICSn.MSTS
(communication status) H
IICCTLn0.STT
(ST trigger) L
IICCTLn0.SPT
(SP trigger) L
IICCTLn0.WREL *1 *1
(release from clock stretching)
<7> <9>
IICAn_TXRXI
(interrupt)
IICSn.TRC
(transmit/receive) L
Bus line
SCLAn (bus)
(clock line)
<4> <8> <11>
SDAAn (bus)
(data line) R ACK D17 D16 D15 D14 D13 D12 D11 D10 ACK D27
<3> <10>
Slave side
IICSn.SPD L
(SP detection)
IICCTLn0.WTIM
(8th or 9th cycle clock stretching)
H
IICCTLn0.ACKE
H
(ACK control)
IICSn.MSTS
(communication status) L
IICCTLn0.WREL
(release from clock stretching) L
IICAn_TXRXI
(interrupt)
IICSn.TRC
(transmit/receive) H
Note: n=0
Note 1. For release from the clock stretch state during reception by a master device, write 0xFF to IICAn or set the
IICCTLn0.WREL bit.
Note 2. For release from the clock stretch state during transmission by a slave mode, write data to the IICAn register instead of
setting the IICCTLn0.WREL bit.
Figure 22.68 Example of slave device to master device communications (8th cycle clock stretching is
selected for the master device and 9th cycle clock stretching is selected for the slave device)
(2/3)
The meanings of <3> to <12> in Figure 22.68 are explained below.
<3> In the slave device if the address received matches the address (SVA0 value) of a slave device, that slave device sends
an ACK by hardware to the master device. The ACK is detected by the master device (IICS0.ACKD = 1) at the rising edge
of the 9th clock.
<4> The master device issues an interrupt (IICA0_TXRXI: end of address transmission) at the falling edge of the 9th clock.
The slave device with the address matching the transmitted slave address sets the clock stretch state (SCLA0 = 0) and issues
an interrupt (IICA0_TXRXI: address match).
<5> The master device changes the timing of clock stretching to the 8th clock (IICCTL00.WTIM = 0).
<6> The slave device writes the data to transmit to the IICA shift register 0 (IICA0) and releases the clock stretch state set
by the slave device.
<7> The master device releases the clock stretch state (IICCTL00.WREL = 1) and starts transferring data from the slave
device to the master device.
<8> The master device sets the clock stretch state (SCLA0 = 0) at the falling edge of the 8th clock, and issues an interrupt
(IICA0_TXRXI: end of transfer). Because of IICCTL00.ACKE = 1 in the master device, the master device then sends an
ACK by hardware to the slave device.
<9> The master device reads the received data and releases the clock stretch state (IICCTL00.WREL = 1).
<10>The ACK is detected by the slave device (IICS0.ACKD = 1) at the rising edge of the 9th clock.
<11>The slave device sets the clock stretch state (SCLA0 = 0) at the falling edge of the 9th clock, and the slave device issue
an interrupt (IICA0_TXRXI: end of transfer).
<12>By the slave device writing the data to transmit to the IICA0 register, the clock stretch state set by the slave device is
released. The slave device then starts transferring data to the master device.
If the transmitted address does not match the address of the slave device, the slave device does not return an ACK to the
master device (NACK: SDAA0 = 1). The slave device also does not issue the IICA0_TXRXI interrupt (address match) and
does not set the clock stretch state.
The master device, however, issues the IICA0_TXRXI interrupt (end of address transmission) regardless of whether it
receives an ACK or NACK.
Note: <1> to <19> in (2) Example of Slave device to Master device Communications (8th Cycle Clock Stretching Is
Selected for the Master device and 9th Cycle Clock Stretching Is Selected for the Slave device) represent the entire
procedure for communicating data using the I2C bus.
Figure 22.67 shows the processing from <1> to <7>,
Figure 22.68 shows the processing from <3> to <12>, and
Figure 22.69 shows the processing from <8> to <19>.
Master side
IICCTLn0.SPT
(SP trigger)
IICCTLn0.WREL *1 *1 <17>
(release from clock stretching)
IICAn_TXRXI <9> <15>
(interrupt)
IICSn.TRC
(transmit/receive) L
SCLAn (bus)
(clock line)
<8> <11> <13> <16> *2
SDAAn (bus)
(data line) D150 ACK D167 D166 D165 D164 D163 D162 D161 D160 NACK
<10>
Slave side
<19>
IICAn Data shift +Output (D16[7:0])
<12> *3
IICSn.ACKD
(ACK detection)
IICSn.STD
(ST detection) L
IICSn.SPD
(SP detection)
IICCTLn0.WTIM
H
(8th or 9th cycle clock stretching)
IICCTLn0.ACKE
H
(ACK control)
IICSn.MSTS
(communication status) L
IICCTLn0.WREL <18>
*1,4
(release from clock stretching)
IICAn_TXRXI
(interrupt)
IICSn.TRC
*4
(transmit/receive)
Note: n=0
Note 1. For release from the clock stretch state, write 0xFF to IICAn or set the IICCTLn0.WREL bit.
Note 2. Make sure that the time between the rise of the SCLAn pin signal and the generation of the stop condition after a stop
condition has been issued is at least 4.0 µs when specifying standard mode and at least 0.6 µs when specifying fast
mode.
Note 3. For release from the clock stretch state during transmission by a slave mode, write data to the IICAn register instead of
setting the IICCTLn0.WREL bit.
Note 4. If the clock stretch state during transmission by a slave mode is released by setting the IICCTLn0.WREL bit, the
IICSn.TRC bit is cleared.
Figure 22.69 Example of slave device to master device communications (8th cycle clock stretching is
selected for the master device and 9th cycle clock stretching is selected for the slave device)
(3/3)
The meanings of <8> to <19> in Figure 22.69 are explained below.
<8> The master device sets the clock stretch state (SCLA0 = 0) at the falling edge of the 8th clock, and issues an interrupt
(IICA0_TXRXI: end of transfer). Because of IICCTL00.ACKE = 0 in the master device, the master device then sends an
ACK by hardware to the slave device.
<9> The master device reads the received data and releases the clock stretch state (IICCTL00.WREL = 1).
<10>The ACK is detected by the slave device (IICS0.ACKD = 1) at the rising edge of the 9th clock.
<11>The slave device sets the clock stretch state (SCLA0 = 0) at the falling edge of the 9th clock, and the slave device issue
an interrupt (IICA0_TXRXI: end of transfer).
<12>By the slave device writing the data to transmit to the IICA0 register, the clock stretch state set by the slave device is
released. The slave device then starts transferring data to the master device.
<13>The master device issues an interrupt (IICA0_TXRXI: end of transfer) at the falling edge of the 8th clock, and sets the
clock stretch state (SCLA0 = 0). Because ACK control (IICCTL00.ACKE = 1) is performed, the bus data line is at the low
level (SDAA0 = 0) at this stage.
<14>The master device sets NACK as the response (IICCTL00.ACKE = 0) and changes the timing at which it sets the clock
stretch state to the 9th clock (IICCTL00.WTIM = 1).
<15>If the master device releases the clock stretch state (IICCTL00.WREL = 1), the slave device detects the NACK (ACK
= 0) at the rising edge of the 9th clock.
<16>The master device and slave device set the clock stretch state (SCLA0 = 0) at the falling edge of the 9th clock, and
both the master device and slave device issue an interrupt (IICA0_TXRXI: end of transfer).
<17>When the master device issues a stop condition (IICCTL00.SPT = 1), the bus data line is cleared (SDAA0 = 0) and the
master device releases the clock stretch state. The master device then waits until the bus clock line is set (SCLA0 = 1).
<18>The slave device acknowledges the NACK, halts transmission, and releases the clock stretch state (IICCTL00.WREL
= 1) to end communication. Once the slave device releases the clock stretch state, the bus clock line is set (SCLA0 = 1).
<19>Once the master device recognizes that the bus clock line is set (SCLA0 = 1) and after the stop condition setup
time has elapsed, the master device sets the bus data line (SDAA0 = 1) and issues a stop condition (SCLA0 = 1 and
SDAA0 changes from 0 to 1). The slave device detects the generated stop condition and slave device issue an interrupt
(IICA0_TXRXI: stop condition).
Note: <1> to <19> in (2) Example of Slave device to Master device Communications (8th Cycle Clock Stretching Is
Selected for the Master device and 9th Cycle Clock Stretching Is Selected for the Slave device) represent the entire
procedure for communicating data using the I2C bus.
Figure 22.67 shows the processing from <1> to <7>,
Figure 22.68 shows the processing from <3> to <12>, and
Figure 22.69 shows the processing from <8> to <19>.
UARTAn
RXDAn
RXDAn
Reception unit ASIMAn1.ALV
Inversion control
Selector
UARTAn_RXI Filter
UARTAn_ERRI
Reception control
Receive shift
register
Internal bus
FSXP Register
UTA0CK.SEL[1:0]
block
fSEL
fSEL/2 BRGCAn ASIMAn1 ASCTAn
MOSC fUTAn
fSEL/22 Selector
Selector
HOCO 3
Prescaler fSEL/2
MOCO fSEL/24
fSEL/25
fSEL/26
TXBAn
Baud rate generator
Transmission control
TXDAn TXDAn
Inversion control
ASIMAn1.ALV
Transmission unit
ULBS.ULBSp
Bit position: 7 6 5 4 3 2 1 0
Note: When the TXBFA bit of the ASISA0 register is 1, do not write data for transmission to the TXBA0 register.
Note: After setting the TXEA bit of the ASIMA00 register to 1, wait for the period of at least one cycle of the UARTA0
operation clock (fUTA0) before setting the first data for transmission in the TXBA0 register. If data for transmission is
set within one cycle of the UARTA0 operation clock after the ASIMA00.TXEA bit is set to 1, the start of transmission
is delayed by one cycle of the UARTA0 operation clock.
Note: Data is transferred from the TXBA0, and is then transmitted as serial data through the TXDA0 pin. In the first
transmission, data is transferred from the TXBA0 register to this register immediately after data is written to the
TXBA0 register. In continuous transmission, data is transferred after transmission of one frame and just before
generation of the transfer completion interrupt.
The transmit shift register cannot be manipulated directly by software.
Bit position: 7 6 5 4 3 2 1 0
The RXBA0 register stores the parallel data converted by the receive shift register. Every time one byte of data is received,
the next receive data is transferred from the receive shift register *1 to this register.
Note 1. The receive shift register converts the serial data that is input through the RXDA0 pin to parallel data.
Note: If an overrun error (ASISA0.OVEA) occurs, the data received at that time is not stored in the RXBA0 register.
Bit position: 7 6 5 4 3 2 1 0
Note: To start transmission, set the EN bit to 1 and then set the TXEA bit to 1.
To stop transmission, clear the TXEA bit to 0 and then clear the EN bit to 0.
Note: To start reception, set the EN bit to 1 and then set the RXEA bit to 1.
To stop reception, clear the RXEA bit to 0 and then clear the EN bit to 0.
Note: Follow the procedure below when setting the EN bit to 1 and then setting the RXEA bit to 1.
● When ASIMA01.ALV = 0, the setting must be made while the level being input to the RXDA0 pin is high.
Otherwise, reception starts at that point and a framing error may occur.
● When ASIMA01.ALV = 1, the setting must be made while the level being input to the RXDA0 pin is low.
Otherwise, reception starts at that point and a framing error may occur.
Note: The TXEA and RXEA bits are synchronized with the UARTA0 operation clock (fUTA0). To enable transmission or
reception again, set the TXEA or RXEA bit to 1 at least two cycles of the UARTA0 operation clock after clearing the
TXEA or RXEA bit to 0. If the bit is set to 1 within two cycles of the UARTA0 operation clock after the clearing, the
transmission or reception circuit may not be able to be initialized.
Note: After setting TXEA bit to 1, wait for at least one cycle of the UARTA0 operation clock (fUTA0) before setting the
transmit data in the TXBA0 register.
Note: Clear the RXEA bit to 0 before modifying the ISRMA bit.
Bit position: 7 6 5 4 3 2 1 0
Note: Clear both the ASIMA00.TXEA and RXEA bits to 0 before modifying the ASIMA01 register.
Note: Reception is always handled as including a stop bit. The setting of the SL bit does not affect reception.
Bit position: 7 6 5 4 3 2 1 0
7:0 n/a Controls the UART Baud Rate (Serial Transfer Speed) R/W
Selection of 8-bit counter output clock (fUTA0 / BRGCA0)
0x02: fUTA0/2
0x03: fUTA0/3
⋮ ⋮
0xFC: fUTA0/252
0xFD: fUTA0/253
0xFE: fUTA0/254
0xFF: fUTA0/255
Others: Setting prohibited
The BRGCA0 register sets the frequency divisor for the 8-bit counter in the serial interface UARTA0.
Note: Modify the BRGCA0 register bits while the ASIMA00.TXEA and RXEA bits are 0 (in the transmission and reception
stopped state).
Note: The baud rate is one half the frequency of the output clock signal from the 8-bit counter.
Note: For an example of the baud rate setting, see (c) Baud rate setting example.
Bit position: 7 6 5 4 3 2 1 0
The ASISA0 register indicates the error status and the transmission status on completion of reception by the serial interface
UARTA0. It consists of three error flag bits (PEA, FEA, and OVEA) and two transmission status flag bits (TXBFA and
TXSFA).
The PEA, FEA, and OVEA bits are initialized by clearing the ASIMA00.EN or RXEA bit to 0. These bits are also cleared
by writing to the corresponding bit of the ASCTA0 register. The TXBFA and TXSFA bits are initialized by clearing the
ASIMA00.EN or TXEA bit to 0.
Note: For continuous transmission, be sure to check that the TXBFA flag is 0 after writing the first transmit data (the
first byte) to the TXBA0 register and then write the next transmit data (the second byte) to the TXBA0 register.
Otherwise, the transmit data become undefined.
However, the TXBFA flag need not be checked when continuous transmission is performed by using the buffer
empty interrupt (ASIMA00.ISSMA bit = 1).
Note: When initializing the transmission unit (ASIMA00.TXEA = 0) after completion of continuous transmission, be sure
to check that the TXSFA flag is 0 after the transfer completion interrupt is generated, and then initialize the unit.
Otherwise, the transmit data become undefined.
Note: The operation of the PEA bit depends on the setting of the PS[1:0] bits of the ASIMA01 register.
Note: For the receive data, only the first 1 bit of the stop bits is checked regardless of the stop bit length.
Note: When an overrun error occurs, the next receive data is not written to the RXBA0 register and discarded.
[Setting condition]
● The next reception is completed before the receive data in the RXBA0 register is read.
[Setting condition]
● A stop bit is not detected when receiving data.
[Setting condition]
● The parity of the received data does not match the parity bit.
[Setting condition]
● Data is transferred from the TXBA0 register. (Data is being transmitted.)
[Setting condition]
● Data is written to the TXBA0 register. (Data exists in the TXBA0 register.)
Bit position: 7 6 5 4 3 2 1 0
Note: After writing 1 to the trigger bit, the corresponding error flag is cleared on the next rising edge of the operating clock
(fUTA0). Accordingly, if reading the ASISA0 register immediately after writing 1 to the trigger bit, the corresponding
error flag may not have been cleared yet.
Bit position: 7 6 5 4 3 2 1 0
The UTA0CK register selects the operating clock of the UARTA0. The SEL[1:0] bits select the clock source, fSEL, for
UARTA0 from MOSC, HOCO, and MOCO. The bits from CK[3:0] select the operating clock for UARTA0 from fSEL to
fSEL/64, and FSXP.
Note: This register should be read or written when the TXEA and RXEA bits are 0 (in the transmission and reception
stopped state).
Bit position: 7 6 5 4 3 2 1 0
The ULBS register is used to enable the UART loopback function. This register has bits to individually control UART
channels. When the bit corresponding to each channel is set to 1, the UART loopback function is selected, and output from
the transmission shift register is looped back to the reception shift register.
23.3 Operation
UARTA0 operates in the following two modes.
● Operation stop mode
● UART mode
Step of communication <1> Enable clock supply Set bit 15 of the MSTPCRB register to 0.
procedure
<2> Baud rate setting Set the BRGCA0 register.
<3> Operation mode setting 1 Set bits 0 to 6 (ALV, DIR, SL, CL[1:0], and
PS[1:0]) of the ASIMA01 register.
<4> Operation mode setting 2 Set bits 0 and 1 (ISSMA and ISRMA) of the
ASIMA00 register
<5> Enable operation Set bit 7 (EN) of the ASIMA00 register to 1.
<6> Enable communication Set bit 6 (TXEA) of the ASIMA00 register to 1 to
enable transmission.
Set bit 5 (RXEA) of the ASIMA00 register to 1 to
enable reception.
<7> Write transmit data Write transmit data to the TXBA0 register.
<8> Start of transmission —
Note: When using the receiving function, set the port pin allocated for reception to input mode by using the port mode registers. When
using the transmitting function, set the port pin allocated for transmission to output mode by using the port mode registers, and set
the respective bits in the port registers to 1.
For information on how to set up the I/O ports, see the descriptions given in section 16, I/O Ports.
1. LSB first
One data frame
Character bits
2. MSB first
One data frame
Character bits
The character bit length, the parity, the stop bit length, the transfer direction (LSB or MSB first), and the TXDA0 pin output
(direct or inverted) in one data frame are specified by the ASIMA01 register.
Figure 23.3 shows the examples of transmit and receive data waveforms.
Character length: 8 bits, LSB first, Even parity, Stop bit: 1 bit, Transfer data: 0x55
Character length: 8 bits, MSB first, Even parity, Stop bit: 1 bit, Transfer data: 0x55
Character length: 8 bits, MSB first, Even parity, Stop bit: 1 bit, Transfer data: 0x55, Transmit and receive data level inversion
Character length: 7 bits, LSB first, Odd parity, Stop bit: 2 bits, Transfer data: 0x36
Character length: 5 bits, LSB first, No parity, Stop bit: 1 bit, Transfer data: 0x17
Start D0 D1 D2 D3 D4 Stop
● In reception
In the data for reception, including the parity bit, the number of bits with the value 1, is counted. If it is even, a parity
error occurs.
(c) 0 parity
The parity bit is cleared to 0 when data is transmitted, regardless of the transmit data.
The parity bit is not detected when the data is received. Therefore, a parity error does not occur regardless of whether the
parity bit is 0 or 1.
(d) No parity
No parity bit is appended to the transmit data.
Reception is performed assuming that there is no parity bit. A parity error does not occur, because there is no parity bit.
UARTAn_TXI
UARTAn_TXI
UARTAn_TXI
UARTAn_TXI
Note: n=0
Continuous transmission is achieved by polling the transmit buffer data flag (bit 5: TXBFA) and the transmit shift register
data flag (bit 4: TXSFA) of the status register (ASISA0).
When using this method, clear bit 1 (ISSMA) of the operation mode setting register 00 (ASIMA00) to 0.
0 Writing is enabled.
1 Writing is disabled.
Note: To determine if continuous transmission is enabled or disabled, only check the ASISA0.TXBFA flag. The ASISA0.TXSFA flag must
not be used for the determination in combination with this flag.
0 Transmission is completed.
1 Transmission is in progress.
Note: When initializing the transmission unit after completion of continuous transmission, check that the ASISA0.TXSFA flag is 0 after the
transfer completion interrupt is generated, and then initialize the unit.
Note: During continuous transmission, after transmission of one data frame, the subsequent transmission may be completed before
execution of the UARTA0_TXI interrupt processing.
This can be detected by incorporating the program that counts the number of transmit data and by referencing the ASISA0.TXSFA
flag.
Table 23.6 shows a step example of continuous transmission processing by polling.
Table 23.6 Step example of continuous transmission processing by polling
Step Process Detail
Figure 23.5 and Figure 23.6 show the timing when continuous transmission is started and completed, respectively.
TXDAn Start Data 1 Parity Stop Start Data 2 Parity Stop Start
ASIMAn0.ISSMA
UARTAn_TXI Output when ASIMAn0.ISSMA = 1
ASISAn.TXBFA
ASISAn.TXSFA
Note: n=0
Note: When the ASISAn register is read, both the ASISAn.TXBFA and TXSFA bits are read as 1 within this period.
Accordingly, use only the ASISAn.TXBFA flag to determine if writing is enabled or disabled.
TXDAn Parity Stop Start Data n - 1 Parity Stop Start Data n Parity Stop
ASIMAn0.ISSMA
Output when ASIMAn0.ISSMA = 0
UARTAn_TXI
ASISAn.TXBFA
ASISAn.TXSFA
ASIMAn0.EN or TXEA
Note: n=0
UARTAn_RXI
RXBAn
Writing to RXBAn
UARTAn_RXI
RXBAn
Writing to RXBAn
Note: n=0
Note: rxd_in: The internal signal generated by latching RXDAn with a noise filter
(rxd_in is delayed relative to RXDAn by maximum of 3 cycles of the UART operation clock.)
Note: The UARTAn_RXI output timing in the figure is just an example.
The timing relative to RXDAn varies according to the setting of the BRGCAn register.
ASISA0.PEA Parity error The parity specified for reception does not match the parity of receive data.
ASISA0.FEA Framing error No stop bit is detected.
ASISA0.OVEA Overrun error Before the receive data is read from the receive buffer, the next data
reception is completed.
Setting bit 0 (ISRMA) of the operation mode setting register 00 (ASIMA00) to 0 allows the reception error interrupt to be
separated from UARTA0_RXI and allows it to be generated as UARTA0_ERRI.
Figure 23.8 shows the interrupt output waveform which varies depending on the setting of the ASIMA00.ISRMA bit.
UARTAn_RXI UARTAn_RXI
UARTAn_ERRI UARTAn_ERRI
UARTAn_RXI UARTAn_RXI
UARTAn_ERRI UARTAn_ERRI
Note: n=0
ASIMAn0.EN
Match
detector
RXDAn Internal
signal
enb
ASIMAn0.RXEA
Operating clock
Note: When ASIMAn1.ALV = 0 (wait state = high level; start bit = low level), the initial value of the receive data (RXDAn) must be
high.
Note: When ASIMAn1.ALV = 1 (wait state = low level; start bit = high level), the initial value of the receive data (RXDAn) must be
low.
Note: n=0
When bit 7 (EN) = 1 in the operation mode setting register 00 (ASIMA00), the UARTA0 operation clock (fUTA0) is supplied
to each module. When ASIMA00.EN = 0, the UARTA0 operation clock is fixed to low level.
(b) Transmission counter
This counter is cleared to 0 and stops when bit 7 (EN) = 0 or bit 6 (TXEA) = 0 in the operation mode setting register 00
(ASIMA00). It starts counting when ASIMA00.EN = 1 and ASIMA00.TXEA = 1.
The counter is cleared to 0 when the first transmit data is written to the transmit buffer register (TXBA0).
When continuous transmission is performed, the counter is cleared to 0 again when transmission of one frame of data has
been completed. If there is no data to be transmitted next, the counter is not cleared to 0 and continues counting until the
ASIMA00.EN or TXEA bit is cleared to 0. When EN = 0 or TXEA = 0 in the ASIMA00 register, the counter stops at 0x00.
(c) Reception counter
This counter is cleared to 0 and stops when bit 7 (EN) = 0 or bit 5 (RXEA) = 0 in the operation mode setting register 00
(ASIMA00). It starts counting when the start bit is detected.
The counter stops operation after one frame has been received, until the next start bit is detected. When EN = 0 or RXEA =
0 in the ASIMA00 register, the counter stops at 0x00.
Figure 23.10 shows the configuration of the baud rate generator.
Baud
Match detector 1/2
rate
Bits 7 to 0 of
BRGCAn
Note: n=0
Note: Keep the baud rate error during transmission to within the permissible error range on the reception side.
Note: Make sure that the baud rate error during reception satisfies the permissible baud rate error range during reception.
Permissible baud rate error during reception is described in (d) Permissible baud rate range during reception.
200 bps Disabled Disabled Disabled Disabled Disabled Disabled 156 0.16%
300 bps Disabled Disabled Disabled Disabled Disabled 208 0.16% 104 0.16%
600 bps Disabled Disabled Disabled Disabled 208 0.16% 104 0.16% 52 0.16%
1200 bps Disabled Disabled Disabled 208 0.16% 104 0.16% 52 0.16% 26 0.16%
2400 bps Disabled Disabled 208 0.16% 104 0.16% 52 0.16% 26 0.16% 13 0.16%
4800 bps Disabled 208 0.16% 104 0.16% 52 0.16% 26 0.16% 13 0.16% Disabled
9600 bps 208 0.16% 104 0.16% 52 0.16% 26 0.16% 13 0.16% Disabled Disabled
19200 bps 104 0.16% 52 0.16% 26 0.16% 13 0.16% Disabled Disabled Disabled
FLmax
Latch timing
Note: Be sure to make settings so that the baud rate error during reception is within the permissible error range. Use the
calculation expression below to check if the error is within the permissible range.
After the start bit is detected, the latch timing of receive data is determined by the counter specified with the baud rate
generator control register (BRGCA0). If the whole frame including the stop bit has been received before this latching,
reception can proceed correctly.
Assuming that 11 bits of data are received, the theoretical values can be calculated as follows.
● The relation between 1-bit data length and baud rate
FL = (Brate) - 1
Brate: Baud rate of UART
k: Set value of BRGCA0 FL: 1-bit data length
Margin of latch timing: 1 clock
● Minimum permissible data frame length (FLmin)
k−1 21k+1
FLmin = 11 × FL − 2k × FL = 2k FL
● Maximum permissible baud rate for reception on the transmitting side (BRmax)
● Minimum permissible baud rate for reception on the transmitting side (BRmin)
BRmin = (FLmax/11)−1 = 20k
21k−1 Brate
Table 23.13 shows the permissible baud rate error between UART and the transmitting side can be calculated from the
above minimum and maximum baud rate expressions.
Table 23.13 Maximum and minimum permissible baud rate error
Division ratio (k) Maximum permissible baud rate error Minimum permissible baud rate error
2 +2.32% −2.43%
4 +3.52% −3.61%
8 +4.14% −4.19%
20 +4.51% −4.53%
50 +4.66% −4.67%
100 +4.71% −4.71%
255 +4.74% −4.74%
Note: The permissible error of reception depends on the number of bits in one frame, input clock frequency, and division ratio (k).
The higher the input clock frequency and the division ratio (k), the higher the permissible error.
Note: k: Set value of BRGCA0
23.4.2 Point for Caution when Selecting the UARTA0 Operation Clock (fUTA0)
When the Middle-speed on-chip oscillator (MOCO) is selected for fUTA0, communication may not be executed correctly due
to the oscillation frequency accuracy of the Middle-speed on-chip oscillator. Adjust the accuracy, therefore, by using the
MOCO trimming register (MIOTRM).
When the Low-speed peripheral clock (FSXP) is selected for fUTA0 and the Low-speed on-chip oscillator (LOCO) is
selected for FSXP, communication may not be executed correctly due to the oscillation frequency accuracy of the Low-
speed on-chip oscillator. Adjust the accuracy, therefore, by using the LOCO trimming register (LIOTRM).
Data for CRC calculation*1 CRC code generated for data in 8n-bit units CRC code generated for data in 32n-bit units
(where n is a natural number) (where n is a natural number)
CRC processor unit Operation executed on 8 bits in parallel Operation executed on 32 bits in parallel
CRC generating polynomial [16-bit CRC] [32-bit CRC]
● X16 + X12 + X5 + 1 (CRC-CCITT). ● X32 + X26 + X23 + X22 + X16 + X12 + X11
+ X10 + X8 + X7 + X5 + X4 + X2 + X + 1
(CRC-32)
Module-stop function Module-stop state can be set to reduce power consumption
Note 1. This function cannot divide data used in CRC calculations. Write data in 8-bit or 32-bit units.
Data bus
CRCCR0
CRCDOR/
CRCDOR_HA
CRC code
generation
circuit Control signal
CRCDIR/
CRCDIR_BY
Bit position: 7 6 5 4 3 2 1 0
DORC
Bit field: — — — — GPS[2:0]
LR
Bit position: 31 0
Bit field:
Bit position: 31 0
Bit field:
24.3 Operation
3. Read the calculation result in the CRC Data Output Register (CRCDOR_HA)
CRC code = 0xF78F
F 7 8 F F 0
Clear CRCDOR/CRCDOR_HA
6. Read the calculation result in the CRC Data Output Register (CRCDOR_HA)
CRC code = 0x no error
1. CRC code
After specifying the method for generation calculation, write data to CRCDIR in order of (1), (2), (3), and (4).
7 0
CRCDIR (1)
7 0
CRCDIR (2)
7 0
CRCDIR (3)
7 0
CRCDIR (4)
2. Transmit data
7 07 0 7 07 07 07 0
(H) (L) (4) (3) (2) (1) Output
25.1 Overview
The A/D converter is used to convert analog input signals into digital values, and is configured to control up to 10 channels
of A/D converter analog inputs (AN000 to AN007, AN021 and AN022). 12-bit, 10-bit, or 8-bit resolution can be selected
by the ADTYP[1:0] bits of the A/D converter mode register 2 (ADM2). The A/D converter has the following function.
Table 25.1 lists the ADC12 specifications and Figure 25.1 shows a block diagram of ADC12.
Table 25.1 ADC12 specifications (1 of 2)
Parameter Specifications
Reference voltage ● VREFH0, VCC, or internal reference voltage (BGR) (external reference voltage or output voltage
from reference voltage generation circuit) can be selected as the analog reference voltage.
● VREFL0 or VSS can be selected as the analog reference ground.
Module-stop function Module-stop state can be set to reduce power consumption.*2
Note 1. AN000 to AN007, AN021, AN022 for LQFP/HWQFN 32-pin
AN000, AN001, AN004 to AN007, AN021, AN022 for HWQFN 24-pin
AN000, AN001, AN004, AN005, AN021. AN022 for LSSOP 20-pin
AN000, AN001, AN004, AN021. AN022 for HWQFN 16-pin
Note 2. For details, see section 9, Low Power Modes.
Trigger mode Software trigger no-wait Conversion is started by setting the ADCE bit to 1 by software, and then
mode setting ADCS to 1 after the A/D power supply stabilization wait time has
passed.
Software trigger wait mode The power is turned on by setting the ADCS bit to 1 by software while A/D
conversion is stopped and conversion is then started automatically after the
A/D power supply stabilization wait time has passed.
Hardware trigger no-wait Conversion is started by detecting a hardware trigger.
mode
Hardware trigger wait mode The power to the A/D converter is turned on by detecting a hardware
trigger while the A/D converter is off and in the conversion standby state,
and conversion is then started automatically after the stabilization wait time
passes. When using the Snooze mode function, specify the hardware trigger
wait mode.
Channel selection mode Select mode A/D conversion is performed on the analog input of one selected channel.
Scan mode A/D conversion is performed on the analog input of four channels in order.
Four consecutive channels can be selected from AN000 to AN007 as
analog input channels.
Conversion operation mode One-shot conversion mode A/D conversion is performed on the selected channel once.
Sequential conversion mode A/D conversion is sequentially performed on the selected channels until it is
stopped by software.
Table 25.3 shows the sampling clock cycle for each operation voltage mode.
Table 25.3 Sampling clock cycle for each operation voltage mode
Operation voltage
mode*1 Sampling clock cycles
Normal mode 1 43 fAD Set the number of sampling clock cycles so that the sampling capacitor is
sufficiently charged according to the output impedance of the analog input source.
Normal mode 2 160 fAD
Note 1. The operation mode that can be selected differs depending on the analog input channel, VCC voltage, VREFH0 voltage, trigger
mode, and PCLKB. See section 25.2.1. ADM0 : A/D Converter Mode Register 0 for details.
Figure 25.1
R01UH1040EJ0110 Rev.1.10
AN000/VREFH0
AN001/VREFL0
AN002
AN003
AN004
AN005 ADM2.ADREFP[1:0] bits
AN006
2
Selector
Comparison
Voltage
generator ADM2.ADREFM bit
AN021 VSS
AN022
Successive
approximation register VREFL0/AN001
(SAR)
Selector
VSS
RTC trigger signal (RTC_ALM_OR_PRD)
Timer trigger signal (ADITL0 (TML32_ITL0))
Controller
TAU trigger signal (TAU0_TMI01)
Event input signal (ELC_AD)
A/D conversion
Temperature sensor 4 result upper ADC12_ADI
Internal reference voltage *1 limit/lower limit
ADREFP[1:0] ADREFM ADRCK AWC ADTYP[1:0] comparator
Note 1. For details about the internal reference voltage, see section 31, Electrical Characteristics.
6
7 6
Internal bus
These are the analog input pins of the 10 channels of the A/D converter. They input analog signals to be converted into
digital signals. Pins other than the one selected as the analog input pin can be used as I/O port pins.
2. Sample & hold circuit
The sample & hold circuit samples each of the analog input voltages sequentially sent from the input circuit, and sends
them to the A/D voltage comparator. This circuit also holds the sampled analog input voltage during A/D conversion.
3. A/D voltage comparator
This A/D voltage comparator compares the voltage generated from the voltage tap of the comparison voltage generator
with the analog input voltage. If the analog input voltage is found to be greater than the reference voltage (1/2 AVREF)
as a result of the comparison, the most significant bit (MSB) of the successive approximation register (SAR) is set. If the
analog input voltage is less than the reference voltage (1/2 AVREF), the MSB of the SAR is reset. After that, bit 10 of the
SAR register is automatically set, and the next comparison is made. The voltage tap of the comparison voltage generator
is selected by the value of bit 11, to which the result has already been set.
● Bit 11 = 0: (1/4 AVREF)
● Bit 11 = 1: (3/4 AVREF)
The voltage tap of the comparison voltage generator and the analog input voltage are compared and bit 10 of the SAR
register is manipulated according to the result of the comparison.
● Analog input voltage ≥ Voltage tap of comparison voltage generator: Bit 10 = 1
● Analog input voltage ≤ Voltage tap of comparison voltage generator: Bit 10 = 0
In addition to VREFH0, it is possible to select VCC or the internal reference voltage*1 as the ‘+’ side reference voltage
of the A/D converter.
Note 1. For details about the internal reference voltage, see section 31, Electrical Characteristics TA = -40 to +105°C.
10. VREFL0 pin
This pin inputs an external reference voltage (VREFL0). To use VREFL0 as the ‘-’ side reference voltage of the A/D
converter, set the ADREFM bit of the ADM2 register to 1.
In addition to VREFL0, it is possible to select VSS as the ‘-’ side reference voltage of the A/D converter.
11. Testing of the A/D converter
This test checks whether or not the A/D converter is operating normally by converting the A/D converter's positive and
negative reference voltages, analog input channels (ANxxx), temperature sensor output voltage, and internal reference
voltage.
Note: n = 0 to 3
Bit position: 7 6 5 4 3 2 1 0
This register sets the time for converting analog input to digital data, and starts and stops conversion.
Note: The ADMD, FR[2:0], and LV[1:0] bits should be changed at least 0.2 µs after conversion stops (ADCS = 0, ADCE =
0).
Note: After changing ADMD, FR[2:0] and LV[1:0] bits, set ADCE = 1 or ADCS = 1 at least 4.8 µs later.
Note: When setting ADCE = 1 or ADCS = 1 from the conversion stop state (ADCS = 0, ADCE = 0), wait at least 5 µs
before setting.
Note: Setting change from ADCS = 1 and ADCE = 1 to ADCS = 1 and ADCE = 0 is prohibited.
Note: Do not change the ADCS and ADCE bits from 0 to 1 at the same time by using an 8-bit manipulation instruction. Be
sure to follow the procedure described in section 25.6. A/D Converter Setup Procedure.
Table 25.4 Relationship between ADCS and ADCE bits, including A/D operation status
A/D operation
ADCS ADCE A/D conversion mode state
Table 25.5 shows the conditions for setting and clearing the ADCS bit.
Table 25.5 Conditions for setting and clearing the ADCS bit
A/D conversion mode Set conditions Clear conditions
Software trigger no- Select mode Sequential When 1 is written to When 0 is written to ADCS
wait mode conversion mode ADCS
One-shot conversion ● When 0 is written to ADCS
mode ● The bit is automatically cleared to 0
when A/D conversion ends.
Scan mode Sequential When 0 is written to ADCS
conversion mode
One-shot conversion ● When 0 is written to ADCS
mode ● The bit is automatically cleared to 0
when conversion ends on the specified
four channels.
Software trigger wait Select mode Sequential When 0 is written to ADCS
mode conversion mode
One-shot conversion ● When 0 is written to ADCS
mode ● The bit is automatically cleared to 0
when A/D conversion ends.
Scan mode Sequential When 0 is written to ADCS
conversion mode
One-shot conversion ● When 0 is written to ADCS
mode ● The bit is automatically cleared to 0
when conversion ends on the specified
four channels.
Hardware trigger no- Select mode Sequential When 0 is written to ADCS
wait mode conversion mode
One-shot conversion When 0 is written to ADCS
mode
Scan mode Sequential When 0 is written to ADCS
conversion mode
One-shot conversion When 0 is written to ADCS
mode
Hardware trigger wait Select mode Sequential When a hardware When 0 is written to ADCS
mode conversion mode trigger is input
One-shot conversion ● When 0 is written to ADCS
mode ● The bit is automatically cleared to 0
when A/D conversion ends.
Scan mode Sequential When 0 is written to ADCS
conversion mode
One-shot conversion ● When 0 is written to ADCS
mode ● The bit is automatically cleared to 0
when conversion ends on the specified
four channels.
The timing when using the A/D voltage comparator is shown in Figure 25.2 and Figure 25.3.
ADCE ADCE = 0
Note 1. The maximum conversion start time takes the time shown in Table 25.6.
Figure 25.2 Timing when 12-bit A/D Converter is used (software trigger wait mode)
ADCE
Trigger standby
Conversion standby
Conversion Trigger Conversion Conversion
standby standby operation stopped
Conversion
Hardware trigger time
wait mode
(One-shot ADCS
conversion mode)
Hardware trigger The interrupt is output.
detection
Automatically cleared upon
completion of A/D conversion.
(or cleared by writing 0 to the
ADCS bit.)
Note 1. While in the software trigger no-wait mode or hardware trigger no-wait mode, the time from the rising of the ADCE bit to
the rising of the ADCS bit must be 1 µs + 2 cycles of the conversion clock (fAD) or longer to stabilize the internal circuit.
Note 2. The maximum conversion start time takes the time shown in Table 25.6.
Figure 25.3 Timing when 12-bit A/D Converter is used (other than software trigger wait mode)
Table 25.6 shows the conversion start time with FR[2:0] and ADLSP bits setting.
Table 25.6 Settings of conversion start time (1 of 2)
ADM1 ADM0 Conversion start time (number of PCLKB clock)
Conversion Software trigger no-wait mode/ Software trigger wait mode/
ADSLP FR[2:0] clock (fAD) Hardware trigger no-wait mode Hardware trigger wait mode
0 000b PCLKB/32 31 1
0 001b PCLKB/16 15 1
0 010b PCLKB/8 7 1
0 011b PCLKB/4 3 1
0 100b PCLKB/2 1 1
0 101b PCLKB 1 1
1 011b PCLKB/4 3 1
1 100b PCLKB/2 1 1
1 101b PCLKB 1 1
However, for the second and subsequent conversion in sequential conversion mode and for conversion of the channels
specified for scan1, 2, and 3 in scan mode, the conversion start time and stabilization wait time for A/D power supply do not
occur after a hardware trigger is detected.
Note: If using the hardware trigger wait mode, setting the ADCS bit to 1 is prohibited (but the bit is automatically switched
to 1 when the hardware trigger signal is detected). However, it is possible to clear the ADCS bit to 0 to specify the
A/D conversion standby state.
Note: While in the one-shot conversion mode of the hardware trigger no-wait mode, the ADCS bit is not automatically
cleared to 0 when A/D conversion ends. Instead, 1 is retained.
Note: Only rewrite the value of the ADCE bit when ADCS = 0 (while in the conversion stopped/conversion standby state).
Note: To complete A/D conversion, specify at least the following time as the hardware trigger interval:
● Hardware trigger no wait mode: 2 PCLKB clock cycles + conversion start time + conversion time
● Hardware trigger wait mode: 2 PCLKB clock cycles + conversion start time + A/D power supply stabilization wait
time + conversion time + 5 µs
Table 25.7 shows the relationship between operation voltage mode and conversion time.
Table 25.7 Conversion time in each operation mode
Conversion time (number of fAD clock) [cycles]
0 000b PCLKB/32 1 4 1 4
0 001b PCLKB/16 1 4 1 4
0 010b PCLKB/8 1 6 1 4
Table 25.8 Conversion start delay time, A/D power supply stabilization wait time, and interrupt output delay
time (2 of 2)
A/D power
supply
Conversion start stabilization wait
delay time time (number
(number of fAD of fAD clock) Interrupt output delay time (number
clock) [cycles] [cycles] of fAD clock) [cycles]
Conversion
ADM1.ADLSP ADM0.FR[2:0] clock (fAD) No-wait mode*1 Wait mode*2 No-wait mode*1 Wait mode*2 *3
0 011b PCLKB/4 1 10 1 4
0 100b PCLKB/2 1 18 1 4
0 101b PCLKB 1 34 1 4
1 011b PCLKB/4 1 4 1 4
1 100b PCLKB/2 1 4 1 4
1 101b PCLKB 1 6 1 4
Note 1. No-wait mode means either software trigger no-wait mode or hardware trigger no-wait mode.
Note 2. Wait mode means either software trigger wait mode or hardware trigger wait mode.
Note 3. The value in this column is applicable when the one-shot conversion mode is selected. When the sequential conversion mode is
selected, the number of clock cycles is shortened by 3 cycles of the conversion clock (fAD).
Table 25.9 to Table 25.10 show the A/D conversion time with FR[2:0], LV[1:0], and ADLSP bits setting.
Table 25.9 A/D conversion time in Normal mode 1 and 2 (1 of 2)
A/D conversion time [µs]*1
Select mode Scan mode
00b (Normal 0 000b PCLKB/32 PCLKB = 32 2.4 V ≤ 66 × 32/ 72 × 32/ 258 × 264 ×
mode 1) VREFH0 ≤ PCLKB PCLKB 32/ 32/
VCC ≤ 5.5 V PCLKB PCLKB
0 001b PCLKB/16 16 ≤ PCLKB 66 × 16/ 72 × 16/ 258 × 264 ×
≤ 32 PCLKB PCLKB 16/ 16/
PCLKB PCLKB
0 010b PCLKB/8 8 ≤ PCLKB ≤ 66 × 8/ 74 × 8/ 258 × 8/ 266 × 8/
32 PCLKB PCLKB PCLKB PCLKB
0 011b PCLKB/4 4 < PCLKB ≤ 66 × 4/ 78 × 4/ 258 × 4/ 270 × 4/
32 PCLKB PCLKB PCLKB PCLKB
0 100b PCLKB/2 4 < PCLKB ≤ 66 × 2/ 86 × 2/ 258 × 2/ 278 × 2/
32 PCLKB PCLKB PCLKB PCLKB
0 101b PCLKB 4 < PCLKB ≤ 66 × 1/ 102 × 1/ 258 × 1/ 294 × 1/
32 PCLKB PCLKB PCLKB PCLKB
1 011b PCLKB/4 PCLKB = 4 66 × 4/ 72 × 4/ 258 × 4/ 264 × 4/
PCLKB PCLKB PCLKB PCLKB
1 100b PCLKB/2 2 ≤ PCLKB ≤ 66 × 2/ 72 × 2/ 258 × 2/ 264 × 2/
4 PCLKB PCLKB PCLKB PCLKB
1 101b PCLKB 1 ≤ PCLKB ≤ 66 × 1/ 74 × 1/ 258 × 1/ 266 × 1/
4 PCLKB PCLKB PCLKB PCLKB
Other than the above, Setting - - - - - - -
prohibited
01b (Normal 0 000b PCLKB/32 PCLKB = 32 2.4 V ≤ 183 × 189 × 726 × 732 ×
mode 2) VREFH0 ≤ 32/ 32/ 32/ 32/
VCC ≤ 5.5 V PCLKB PCLKB PCLKB PCLKB
0 001b PCLKB/16 16 ≤ PCLKB 183 × 189 × 726 × 732 ×
≤ 32 16/ 16/ 16/ 16/
PCLKB PCLKB PCLKB PCLKB
0 010b PCLKB/8 8 ≤ PCLKB ≤ 183 × 8/ 191 × 8/ 726 × 8/ 734 × 8/
32 PCLKB PCLKB PCLKB PCLKB
0 011b PCLKB/4 4 < PCLKB ≤ 183 × 4/ 195 × 4/ 726 × 4/ 738 × 4/
32 PCLKB PCLKB PCLKB PCLKB
0 100b PCLKB/2 4 < PCLKB ≤ 183 × 2/ 203 × 2/ 726 × 2/ 746 × 2/
32 PCLKB PCLKB PCLKB PCLKB
0 101b PCLKB 4 < PCLKB ≤ 183 × 1/ 219 × 1/ 726 × 1/ 762 × 1/
32 PCLKB PCLKB PCLKB PCLKB
1 011b PCLKB/4 PCLKB = 4 183 × 4/ 189 × 4/ 726 × 4/ 732 × 4/
PCLKB PCLKB PCLKB PCLKB
1 100b PCLKB/2 2 ≤ PCLKB ≤ 183 × 2/ 189 × 2/ 726 × 2/ 732 × 2/
4 PCLKB PCLKB PCLKB PCLKB
1 101b PCLKB 1 ≤ PCLKB ≤ 183 × 1/ 191 × 1/ 726 × 1/ 734 × 1/
4 PCLKB PCLKB PCLKB PCLKB
Other than the above, Setting - - - - - - -
prohibited
Note 1. A/D conversion time consists of conversion start delay time, A/D power supply stabilization wait time, conversion time, and interrupt
output delay time.
See Figure 25.2, Figure 25.3, Table 25.7, and Table 25.8.
Note 2. No-wait mode means software trigger no-wait mode or hardware trigger no-wait mode.
Note 3. Wait mode means software trigger wait mode or hardware trigger wait mode. For the second and subsequent conversion in
sequential conversion mode and for conversion of the channels specified for scan 1, 2, and 3 in scan mode, the conversion start
time and A/D power supply stabilization wait time do not occur after a software trigger or a hardware trigger is detected.
Note 4. For PCLKB frequency and VCC conditions, see section 9.5.2. Operating Range. Set the frequency and VCC to satisfy this condition
and section 9.5.2. Operating Range.
Note 5. The value in this column is applicable when the one-shot conversion mode is selected. When the sequential conversion mode is
selected, the number of clock cycles is shortened by 3 cycles of the conversion clock (fAD).
Note: The A/D conversion time must also be within the relevant range of conversion times described in section 31.6.1. A/D
Converter Characteristics.
Note: Rewrite the FR[2:0], LV[1:0] bits to different values while conversion is stopped (ADCS = 0, ADCE = 0). The FR[2:0],
and LV[1:0] bits should be changed at least 0.2 µs after conversion stops (ADCS = 0, ADCE = 0).
Note: The above A/D conversion time does not include the conversion start time. Add the conversion start time to obtain
the time for the first conversion. Additionally, the A/D conversion time does not include clock frequency errors.
Consider clock frequency errors when selecting the A/D conversion time.
Note: When the internal reference voltage or temperature sensor output voltage is selected as the target for A/D
conversion, use normal mode 2.
Note: When the internal reference voltage is selected as the positive reference voltage, normal mode 1 and mode 2
cannot be used. Use low voltage mode 1 or 2.
10b (Low 0 000b PCLKB/32 PCLKB = 32 1.8 V ≤ 82 × 32/ 88 × 32/ 322 × 328 ×
Voltage mode VREFH0 ≤ PCLKB PCLKB 32/ 32/
1) VCC ≤ 5.5 V PCLKB PCLKB
0 001b PCLKB/16 16 ≤ PCLKB 1.8 V ≤ 82 × 16/ 88 × 16/ 322 × 328 ×
≤ 32 VREFH0 ≤ PCLKB PCLKB 16/ 16/
VCC ≤ 5.5 V PCLKB PCLKB
0 010b PCLKB/8 8 ≤ PCLKB ≤ 1.8 V ≤ 82 × 8/ 90 × 8/ 322 × 8/ 330 × 8/
32 VREFH0 ≤ PCLKB PCLKB PCLKB PCLKB
VCC ≤ 5.5 V
0 011b PCLKB/4 4 < PCLKB ≤ 1.8 V ≤ 82 × 4/ 94 × 4/ 322 × 4/ 334 × 4/
32 VREFH0 ≤ PCLKB PCLKB PCLKB PCLKB
VCC ≤ 5.5 V
0 100b PCLKB/2 4 < PCLKB ≤ 1.8 V ≤ 82 × 2/ 102 × 2/ 322 × 2/ 342 × 2/
16 VREFH0 ≤ PCLKB PCLKB PCLKB PCLKB
VCC ≤ 5.5 V
4 < PCLKB ≤ 2.4 V ≤
32 VREFH0 ≤
VCC ≤ 5.5 V
0 101b PCLKB 4 < PCLKB ≤ 1.8 V ≤ 82 × 1/ 118 × 1/ 322 × 1/ 358 × 1/
8 VREFH0 ≤ PCLKB PCLKB PCLKB PCLKB
VCC ≤ 5.5 V
4 < PCLKB ≤ 2.4 V ≤
16 VREFH0 ≤
VCC ≤ 5.5 V
4 < PCLKB ≤ 2.7 V ≤
24 VREFH0 ≤
VCC ≤ 5.5 V
1 011b PCLKB/4 PCLKB = 4 1.6 V ≤ 82 × 4/ 88 × 4/ 322 × 4/ 328 × 4/
VREFH0 ≤ PCLKB PCLKB PCLKB PCLKB
VCC ≤ 5.5 V
1 100b PCLKB/2 2 ≤ PCLKB ≤ 1.6 V ≤ 82 × 2/ 88 × 2/ 322 × 2/ 328 × 2/
4 VREFH0 ≤ PCLKB PCLKB PCLKB PCLKB
VCC ≤ 5.5 V
1 101b PCLKB 1 ≤ PCLKB ≤ 1.6 V ≤ 82 × 1/ 90 × 1/ 322 × 1/ 330 × 1/
4 VREFH0 ≤ PCLKB PCLKB PCLKB PCLKB
VCC ≤ 5.5 V
Other than the above, Setting - - - - - - -
prohibited
11b (Low 0 000b PCLKB/32 PCLKB = 32 1.8 V ≤ 109 × 115 × 430 × 436 ×
Voltage mode VREFH0 ≤ 32/ 32/ 32/ 32/
2) VCC ≤ 5.5 V PCLKB PCLKB PCLKB PCLKB
0 001b PCLKB/16 16 ≤ PCLKB 1.8 V ≤ 109 × 115 × 430 × 436 ×
≤ 32 VREFH0 ≤ 16/ 16/ 16/ 16/
VCC ≤ 5.5 V PCLKB PCLKB PCLKB PCLKB
0 010b PCLKB/8 8 ≤ PCLKB ≤ 1.8 V ≤ 109 × 8/ 117 × 8/ 430 × 8/ 438 × 8/
32 VREFH0 ≤ PCLKB PCLKB PCLKB PCLKB
VCC ≤ 5.5 V
0 011b PCLKB/4 4 < PCLKB ≤ 1.8 V ≤ 109 × 4/ 121 × 4/ 430 × 4/ 442 × 4/
32 VREFH0 ≤ PCLKB PCLKB PCLKB PCLKB
VCC ≤ 5.5 V
0 100b PCLKB/2 4 < PCLKB ≤ 1.8 V ≤ 109 × 2/ 129 × 2/ 430 × 2/ 450 × 2/
16 VREFH0 ≤ PCLKB PCLKB PCLKB PCLKB
VCC ≤ 5.5 V
4 < PCLKB ≤ 2.4 V ≤
32 VREFH0 ≤
VCC ≤ 5.5 V
0 101b PCLKB 4 < PCLKB ≤ 1.8 V ≤ 109 × 1/ 145 × 1/ 430 × 1/ 466 × 1/
8 VREFH0 ≤ PCLKB PCLKB PCLKB PCLKB
VCC ≤ 5.5 V
4 < PCLKB ≤ 2.4 V ≤
16 VREFH0 ≤
VCC ≤ 5.5 V
4 < PCLKB ≤ 2.7 V ≤
24 VREFH0 ≤
VCC ≤ 5.5 V
1 011b PCLKB/4 PCLKB = 4 1.6 V ≤ 109 × 4/ 115 × 4/ 430 × 4/ 436 × 4/
VREFH0 ≤ PCLKB PCLKB PCLKB PCLKB
VCC ≤ 5.5 V
1 100b PCLKB/2 2 ≤ PCLKB ≤ 1.6 V ≤ 109 × 2/ 115 × 2/ 430 × 2/ 436 × 2/
4 VREFH0 ≤ PCLKB PCLKB PCLKB PCLKB
VCC ≤ 5.5 V
1 101b PCLKB 1 ≤ PCLKB ≤ 1.6 V ≤ 109 × 1/ 117 × 1/ 430 × 1/ 438 × 1/
4 VREFH0 ≤ PCLKB PCLKB PCLKB PCLKB
VCC ≤ 5.5 V
Other than the above, Setting - - - - - - -
prohibited
Note 1. A/D conversion time consists of conversion start delay time, A/D power supply stabilization wait time, conversion time, and interrupt
output delay time.
See Figure 25.2, Figure 25.3, Table 25.7, and Table 25.8.
Note 2. No-wait mode means software trigger no-wait mode or hardware trigger no-wait mode.
Note 3. Wait mode means software trigger wait mode or hardware trigger wait mode. For the second and subsequent conversion in
sequential conversion mode and for conversion of the channels specified for scan 1, 2, and 3 in scan mode, the conversion start
time and A/D power supply stabilization wait time do not occur after a software trigger or a hardware trigger is detected.
Note 4. For PCLKB frequency and VCC conditions, see section 9.5.2. Operating Range. Set the frequency and VCC to satisfy this condition
and section 9.5.2. Operating Range.
Note 5. The value in this column is applicable when the one-shot conversion mode is selected. When the sequential conversion mode is
selected, the number of clock cycles is shortened by 3 cycles of the conversion clock (fAD).
Note: The A/D conversion time must also be within the relevant range of conversion times described in section 31.6.1. A/D
Converter Characteristics.
Note: Rewrite the FR[2:0], LV[1:0] bits to different values while conversion is stopped (ADCS = 0, ADCE = 0). The FR[2:0],
and LV[1:0] bits should be changed at least 0.2 µs after conversion stops (ADCS = 0, ADCE = 0).
Note: The above A/D conversion time does not include the conversion start time. Add the conversion start time to obtain
the time for the first conversion. Additionally, the A/D conversion time does not include clock frequency errors.
Consider clock frequency errors when selecting the A/D conversion time.
Note: When the internal reference voltage or temperature sensor output voltage is selected as the target for A/D
conversion, use low voltage mode 2 and use a conversion clock (fAD) with a frequency no greater than 16 MHz.
Note: When the internal reference voltage is selected as the positive reference voltage, the conversion clock (fAD) must be
in the range from 1 to 2 MHz.
ADCS
Sampling timing
ADC12_ADI
Sampling Successive
approximation
Figure 25.4 12-bit A/D converter sampling and A/D conversion timing (example for software trigger no-wait
mode, select mode, and one-shot conversion mode)
Bit position: 7 6 5 4 3 2 1 0
ADSC ADLS
Bit field: ADTMD[1:0] — ADTRS[2:0]
M P
Note: Only rewrite the value of the ADM1 register while conversion operation is stopped (ADCS = 0, ADCE = 0).
Note: To complete A/D conversion, specify at least the following time as the hardware trigger interval:
Hardware trigger no wait mode: 2 PCLKB clock cycles + conversion start time + A/D conversion time
Hardware trigger wait mode: 2 PCLKB clock cycles + conversion start time + A/D power supply stabilization wait
time + A/D conversion time + 5 µs
Note: In modes other than Snooze mode, input of the next RTC_ALM_OR_PRD or ADITL0 (= TML32_ITL0) is not
recognized as a valid hardware trigger for up to 4 PCLKB cycles after the first RTC_ALM_OR_PRD or ADITL0 (=
TML32_ITL0) is input.
Bit position: 7 6 5 4 3 2 1 0
ADRE ADRC
Bit field: ADREFP[1:0] — AWC ADTYP[1:0]
FM K
This register is used to select the ‘+’ side and ‘-’ side reference voltages of the A/D converter, check the upper limit and
lower limit A/D conversion result values, select the resolution, and specify whether to use the Snooze mode.
Note: Only rewrite the value of the ADM2 register while conversion operation is stopped (ADCS = 0, ADCE = 0).
Note: Do not set the ADREFP[1:0] bits to 10 when shifting to Software Standby mode, or to Sleep mode while the CPU
is operating on the subsystem clock. When the internal reference voltage is selected (ADREFP[1:0] = 10b), the
A/D converter reference voltage current (IADREF) indicated in section 31.3.2. Operating and Standby Current will be
added.
Note: When using VREFH0 and VREFL0, specify AN000 and AN001 as the analog inputs and set the Pin Mode Control
bit (PMC) to 1, the N-Channel Open-Drain Control bit (NCODR) to 0, and the Port Direction bit (PDR) to 0 in the Port
mn Pin Function Select Register PmnPFS_A.
ADRCK bit (Checking the Upper Limit and Lower Limit Conversion Result Values)
This bit is used for checking the upper limit and lower limit conversion result values.
Figure 25.5 shows the generation range of the interrupt signal (ADC12_ADI) for AREA 1 to AREA 3.
0000000000b
Note: If ADC12_ADI does not occur, the A/D conversion result is not stored in the ADCRn or ADCRnH register.
Figure 25.5 ADRCK bit interrupt signal generation range (in 10-bit resolution mode)
ADREFM bit (Selection of the ‘-’ Side Reference Voltage of the A/D Converter)
This bit is used for selection of the ‘-’ side reference voltage of the 12-bit A/D converter.
ADREFP[1:0] bits (Selection of the ‘+’ Side Reference Voltage Source of the A/D Converter)
These bits are used for selection of the ‘+’ side reference voltage source of the 12-bit A/D converter.
Use Table 25.11 procedure to rewrite the ADREFP[1:0] bits.
Table 25.11 Register settings for ADREFP[1:0] rewrite
Step Process Remark
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit field:
15:0 n/a 12-bit or 10-bit Resolution A/D Converter Result for Channel n R
Note: When selecting 12-bit mode, the upper 4 bits are fixed at 0, and when selecting 10-bit mode, the lower 6 bits are fixed at 0.
Note: The contents of the ADCR register are stored in the ADCR0 register.
ADCRn is a 16-bit register that holds the A/D conversion result.
Each time A/D conversion ends, the conversion result is loaded from the successive approximation register (SAR).
In select mode, the conversion results are stored in the ADCR and ADCR0 registers*1. In scan mode, the conversion results
of scan 0 are stored in the ADCR and ADCR0 registers, and the conversion results of scan 1 to 3 are stored in the ADCR1
to ADCR3 registers.*1
Note 1. If the A/D conversion result is outside the range specified by using the A/D conversion comparison function (set up
by the ADRCK bit of the ADM2 register, ADUL register, and ADLL register; see Figure 25.5), the result is not stored.
Note: When 8-bit resolution A/D conversion is selected (when the ADTYP[1:0] bits of A/D converter mode register 2
(ADM2) are respectively set to 01b) and the ADCRn register is read, 0 is read from the bits other than the higher 8
bits.
Note: When the ADCRn register is accessed in 16-bit units, and A/D conversion with 10-bit resolution is selected, the
higher 10 bits of the conversion result are read in order starting at bit 15 of the ADCRn register.
When A/D conversion with 12-bit resolution is selected, the higher 12 bits of the conversion result are read in order
starting at bit 11 of the ADCRn register.
Note: The contents of the ADCRn register may become undefined when writing to any of the following registers.
● A/D converter mode register 0 (ADM0)
● Analog input channel specification register (ADS)
Read the conversion result following conversion completion before writing to any of these registers. Otherwise, the
correct conversion result may not be obtained.
Bit position: 7 6 5 4 3 2 1 0
Bit field:
ADCRnH is an 8-bit register that holds the A/D conversion result. The higher 8 bits of 12-bit resolution are stored*1.
Note 1. If the A/D conversion result is outside the range specified by using the A/D conversion comparison function (setup
by the ADRCK bit of the ADM2 register, ADUL register, and ADLL register; see Figure 25.5), the result is not stored.
Note: The contents of the ADCRnH register may become undefined when writing to any of the following registers.
● A/D converter mode register 0 (ADM0)
● Analog input channel specification register (ADS)
Read the conversion result following conversion completion before writing to any of these registers. Otherwise, the
correct conversion result may not be obtained.
Bit position: 7 6 5 4 3 2 1 0
4:0 ADS[4:0] Selection of the Analog Input Channel (See Table 25.12 to Table 25.13) R/W
6:5 — These bits are read as 0. The write value should be 0. R/W
7 ADISS Select Internal or External of Analog Input (See Table 25.12 to Table 25.13) R/W
0: External input
1: Internal circuit input
This register specifies the input channel of the analog voltage to be A/D converted.
Table 25.12 and Table 25.13 show the input sources that can be selected for ADS[4:0] bits and ADISS bit in each operating
mode.
<Select mode (ADMD = 0)>
Table 25.12 Input source selection by ADS[4:0] bits and ADISS bit in select mode
ADISS ADS[4:0] Analog input channel Input source
Note: Rewrite the value of the ADISS bit while conversion is stopped (ADCS = 0, ADCE = 0).
Note: If using VREFH0 as the ‘+’ side reference voltage of the A/D converter, do not select AN000 as an A/D conversion
channel.
Note: If using VREFL0 as the ‘-’ side reference voltage of the A/D converter, do not select AN001 as an A/D conversion
channel.
Note: When the setting of the ADISS bit is 1, the internal reference voltage cannot be used for the ‘+’ side reference
voltage. After the ADISS bit is set to 1, the initial conversion result cannot be used. For the setting flow, see section
25.6.5. Example of Using the ADC12 when Selecting the Temperature Sensor Output Voltage or Internal Reference
Voltage, and Software Trigger No-wait Mode and One-shot Conversion Mode.
For details about the internal reference voltage, see section 31, Electrical Characteristics TA = -40 to +105°C.
Note: Do not set the ADISS bit to 1 when shifting to Software Standby mode, or to Sleep mode while the CPU is operating
on the subsystem clock. When the ADISS bit is set to 1, the A/D converter reference voltage current (IADREF)
indicated in section 31.3.2. Operating and Standby Current will be added.
Note: When the setting of the ADISS bit is 1, the hardware trigger wait mode and one-shot conversion mode cannot be
used at the same time.
Note: When the setting of the ADISS bit is 1, the software trigger wait mode and one-shot conversion mode cannot be
used at the same time.
Bit position: 7 6 5 4 3 2 1 0
Bit field:
7:0 n/a Setting the Upper Limit for A/D Conversion Results R/W
This register is used to specify the setting for checking the upper limit of the A/D conversion results.
The A/D conversion results and ADUL register value are compared, and interrupt signal (ADC12_ADI) generation is
controlled in the range specified by the ADRCK bit of A/D converter mode register 2 (ADM2) (shown in Figure 25.5).
Bit position: 7 6 5 4 3 2 1 0
Bit field:
7:0 n/a Setting the Lower Limit for A/D Conversion Results R/W
This register is used to specify the setting for checking the lower limit of the A/D conversion results.
The A/D conversion results and ADLL register value are compared, and interrupt signal (ADC12_ADI) generation is
controlled in the range specified by the ADRCK bit of A/D converter mode register 2 (ADM2) (shown in Figure 25.5).
Note: When A/D conversion with 10-bit resolution is selected, the A/D conversion result register ADCRn[15:8] value is
compared with the values in the ADUL and ADLL registers. When A/D conversion with 12-bit resolution is selected,
the A/D conversion result register ADCRn[11:4] value is compared with the values in the ADUL and ADLL registers.
Note: Only write new values to the ADUL and ADLL registers while conversion is stopped (ADCS = 0, ADCE = 0).
Note: The setting of the ADUL register must be greater than that of the ADLL register.
Bit position: 7 6 5 4 3 2 1 0
This register is used to select the ‘+’ side reference voltage or ‘-’ side reference voltage for the converter, an analog input
channel (ANxxx), the temperature sensor output voltage, or the internal reference voltage*1 as the target for A/D conversion.
When using this register to test the converter, set as follows.
● For zero-scale measurement, select the ‘-’ side reference voltage as the target for conversion.
● For full-scale measurement, select the ‘+’ side reference voltage as the target for conversion.
The voltage tap and sampled voltage are compared and bit 10 of the SAR register is manipulated as follows.
● Sampled voltage ≥ Voltage tap: Bit 10 = 1
● Sampled voltage < Voltage tap: Bit 10 = 0
Note: Two types of the A/D conversion result registers are available.
● ADCRn register (16 bits): Store 12-bit or 10-bit A/D conversion value
Note: AVREF: The ‘+’ side reference voltage of the A/D converter. This can be selected from VREFH0, the internal
reference voltage, and VCC.
For details about the internal reference voltage, see section 31, Electrical Characteristics.
Note: n = 0 to 3
Figure 25.6 shows the conversion operation of the A/D converter during software trigger no-wait mode.
1 is written to ADCS
ADCS
Conversion time
Conversion Sampling
start time time
Conversion
SAR Undefined
result
Conversion
ADCRn result
ADC12_ADI
Figure 25.6 Conversion operation of A/D converter (software trigger no-wait mode)
In one-shot conversion mode, the ADCS bit is automatically cleared to 0 after completion of A/D conversion.
In sequential conversion mode, A/D conversion operations proceed continuously until the software clears bit 7 (ADCS) of
the A/D converter mode register 0 (ADM0) to 0.
Writing to the analog input channel specification register (ADS) during A/D conversion interrupts the current conversion
after which A/D conversion of the analog input specified by the ADS register proceeds. Data from the A/D conversion that
was in progress are discarded.
The value of the A/D conversion result register (ADCRn, ADCRnH) is 0x00 or 0x0000 following a reset.
SAR ADCRn
4095 0x0FFF
4094 0x0FFE
4093 0x0FFD
3 0x0003
2 0x0002
1 0x0001
0 0x0000
1 1 3 2 5 3 8187 4094 8189 4095 8191 1
8192 4096 8192 4096 8192 4096 8192 4096 8192 4096 8192
Input voltage/AVREF
Figure 25.7 Relationship between analog input voltage and A/D conversion result
AVREF: The ‘+’ side reference voltage of the A/D converter. This can be selected from VREFH0 the internal reference
voltage*1, and VCC.
Note 1. For details about the internal reference voltage, see section 31, Electrical Characteristics.
25.5.1 Software Trigger No-wait Mode (Select Mode, Sequential Conversion Mode)
<1> In the stop state, the ADCE bit of A/D converter mode register 0 (ADM0) is set to 1, and the A/D converter enters the
standby state.
<2> After the software counts up to the stabilization wait time (1 µs + 2 cycles of the conversion clock (fAD)), the ADCS
bit of the ADM0 register is set to 1 to perform the A/D conversion of the analog input specified by the analog input channel
specification register (ADS).
<3> When A/D conversion ends, the conversion result is stored in the A/D conversion result registers (ADCR, ADCRH,
ADCR0, and ADCR0H), and the A/D conversion end interrupt request signal (ADC12_ADI) is generated. After A/D
conversion ends, the next A/D conversion immediately starts.
<4> When ADCS is overwritten with 1 during conversion operation, the current A/D conversion is interrupted, and
conversion restarts. The partially converted data is discarded.
<5> When the value of the ADS register is written during conversion operation, the current A/D conversion is interrupted,
and A/D conversion is performed on the analog input respecified by the ADS register. The partially converted data is
discarded.
<6> Even if a hardware trigger is input during conversion operation, A/D conversion does not start.
<7> When ADCS is cleared to 0 during conversion operation, the current A/D conversion is interrupted, and the A/D
converter enters the standby state.
<8> When ADCE is cleared to 0 while in the A/D conversion standby state, the A/D converter enters the stop state.
Figure 25.8 shows the example of software trigger no-wait mode (select mode, sequential conversion mode) operation
timing.
ADC12_ADI
Figure 25.8 Example of software trigger no-wait mode (select mode, sequential conversion mode)
operation timing
Note: When <4> or <5> is detected while conversion is in progress, conversion is automatically restarted from the rising
edge of the next cycle of the conversion clock (fAD). The conversion time at the first conversion operation restarted
is the same as that when there is A/D power supply stabilization wait time in software trigger wait mode or hardware
trigger wait mode. (See section 25.2.1. ADM0 : A/D Converter Mode Register 0 and section 25.2.1. ADM0 : A/D
Converter Mode Register 0.)
25.5.2 Software Trigger No-wait Mode (Select Mode, One-shot Conversion Mode)
<1> In the stop state, the ADCE bit of A/D converter mode register 0 (ADM0) is set to 1, and the A/D converter enters the
standby state.
<2> After the software counts up to the stabilization wait time (1 µs + 2 cycles of the conversion clock (fAD)), the ADCS
bit of the ADM0 register is set to 1 to perform the A/D conversion of the analog input specified by the analog input channel
specification register (ADS).
<3> When A/D conversion ends, the conversion result is stored in the A/D conversion result registers (ADCR, ADCRH,
ADCR0, and ADCR0H), and the A/D conversion end interrupt request signal (ADC12_ADI) is generated.
<4> After A/D conversion ends, the ADCS bit is automatically cleared to 0, and the A/D converter enters the standby state.
<5> When ADCS is overwritten with 1 during conversion operation, the current A/D conversion is interrupted, and
conversion restarts. The partially converted data is discarded.
<6> When the value of the ADS register is rewritten or overwritten during conversion operation, the current A/D conversion
is interrupted, and A/D conversion is performed on the analog input respecified by the ADS register. The partially converted
data is discarded.
<7> When ADCS is cleared to 0 during conversion operation, the current A/D conversion is interrupted, and the A/D
converter enters the standby state.
<8> When ADCE is cleared to 0 while in the A/D conversion standby state, the A/D converter enters the stop state. In
addition, A/D conversion does not start even if a hardware trigger is input while in the A/D conversion standby state.
Figure 25.9 shows the example of software select no-wait mode (select mode, one-shot conversion mode) operation timing.
Data 0 Data 1
ADS (AN000) (AN001)
A/D Conversion is Conversion is
<3>conversion interrupted <3> <3> interrupted.
ends. and restarts.
A/D
conversion Stop Conversion Data 0 Conversion Data 0 Data 0 Conversion Data 0 Data 1 Conversion Data 1 Conversion Stop
state state standby
(AN000) standby (AN000) (AN000) standby (AN000) (AN001) standby (AN001) standby state
ADC12_ADI
Figure 25.9 Example of software select no-wait mode (select mode, one-shot conversion mode) operation
timing
Note: When <5> or <6> is detected while conversion is in progress, conversion is automatically restarted from the rising
edge of the next cycle of the conversion clock (fAD). The conversion time at the first conversion operation restarted
is the same as that when there is A/D power supply stabilization wait time in software trigger wait mode or hardware
trigger wait mode. (See section 25.2.1. ADM0 : A/D Converter Mode Register 0 and section 25.2.1. ADM0 : A/D
Converter Mode Register 0.)
25.5.3 Software Trigger No-wait Mode (Scan Mode, Sequential Conversion Mode)
<1> In the stop state, the ADCE bit of A/D converter mode register 0 (ADM0) is set to 1, and the A/D converter enters the
standby state.
<2> After the software counts up to the stabilization wait time (1 µs + 2 cycles of the conversion clock (fAD)), the ADCS
bit of the ADM0 register is set to 1 to perform A/D conversion on the four analog input channels specified by scan 0 to scan
3, which are specified by the analog input channel specification register (ADS). A/D conversion is performed on the analog
input channels in order, starting with that specified by scan 0.
<3> A/D conversion is sequentially performed on the four analog input channels, the conversion results are stored in the
A/D conversion result register (ADCRn, ADCRnH) each time conversion ends, and the A/D conversion end interrupt
request signal (ADC12_ADI) is generated immediately after A/D conversion of the four channels ends. After A/D
conversion of the four channels ends, the next A/D conversion of the specified channels automatically starts (until all
four channels are finished).
<4> When ADCS is overwritten with 1 during conversion operation, the current A/D conversion is interrupted, and
conversion restarts at the first channel. The partially converted data is discarded.
<5> When the value of the ADS register is rewritten or overwritten during conversion operation, the current A/D conversion
is interrupted, and A/D conversion is performed on the first channel respecified by the ADS register. The partially converted
data is discarded.
<6> Even if a hardware trigger is input during conversion operation, A/D conversion does not start.
<7> When ADCS is cleared to 0 during conversion operation, the current A/D conversion is interrupted, and the A/D
converter enters the standby state.
<8> When ADCE is cleared to 0 while in the A/D conversion standby state, the A/D converter enters the stop state.
Figure 25.10 shows the example of software trigger no-wait mode (scan mode, sequential conversion mode) operation
timing.
ADCE <6>
<2> ADCS is set to 1 while in the <4> ADCS is overwritten A hardware trigger is
ADCS is cleared <7>
The trigger conversion standby state. with 1 during A/D to 0 during A/D The trigger
is not conversion operation. generated (and ignored). conversion operation. is not
acknowledged.
acknowledged.
ADCS
ADCR1
Data 1 (AN001) Data 1 (AN001) Data 5 (AN005)
ADCR1H
ADCR2
Data 2 (AN002) Data 2 (AN002) Data 6 (AN006)
ADCR2H
ADCR3
Data 3 (AN003) Data 3 (AN003) Data 7 (AN007)
ADCR3H
An interrupt request signal is generated An interrupt request signal is generated An interrupt request signal is generated
immediately after the fourth A/D conversion ends. immediately after the fourth A/D conversion ends. immediately after the fourth A/D conversion ends.
ADC12_ADI
Figure 25.10 Example of software trigger no-wait mode (scan mode, sequential conversion mode)
operation timing
Note: When <4> or <5> is detected while conversion is in progress, conversion is automatically restarted from the rising
edge of the next cycle of the conversion clock (fAD). The conversion time at the first conversion operation restarted
is the same as that when there is A/D power supply stabilization wait time in software trigger wait mode or hardware
trigger wait mode. (See section 25.2.1. ADM0 : A/D Converter Mode Register 0 and section 25.2.1. ADM0 : A/D
Converter Mode Register 0.)
25.5.4 Software Trigger No-wait Mode (Scan Mode, One-shot Conversion Mode)
<1> In the stop state, the ADCE bit of A/D converter mode register 0 (ADM0) is set to 1, and the A/D converter enters the
standby state.
<2> After the software counts up to the stabilization wait time (1 µs + 2 cycles of the conversion clock (fAD)), the ADCS
bit of the ADM0 register is set to 1 to perform A/D conversion on the four analog input channels specified by scan 0 to scan
3, which are specified by the analog input channel specification register (ADS). A/D conversion is performed on the analog
input channels in order, starting with that specified by scan 0.
<3> A/D conversion is sequentially performed on the four analog input channels, the conversion results are stored in
the A/D conversion result register (ADCRn, ADCRnH) each time conversion ends, and the A/D conversion end interrupt
request signal (ADC12_ADI) is generated immediately after A/D conversion of the four channels ends.
<4> After A/D conversion of the four channels ends, the ADCS bit is automatically cleared to 0, and the A/D converter
enters the standby state.
<5> When ADCS is overwritten with 1 during conversion operation, the current A/D conversion is interrupted, and
conversion restarts at the first channel. The partially converted data is discarded.
<6> When the value of the ADS register is rewritten or overwritten during conversion operation, the current A/D conversion
is interrupted, and A/D conversion is performed on the first channel respecified by the ADS register. The partially converted
data is discarded.
<7> When ADCS is cleared to 0 during conversion operation, the current A/D conversion is interrupted, and the A/D
converter enters the standby state.
<8> When ADCE is cleared to 0 while in the A/D conversion standby state, the A/D converter enters the stop state. In
addition, A/D conversion does not start even if a hardware trigger is input while in the A/D conversion standby state.
Figure 25.11 shows the example of software trigger no-wait mode (scan mode, one-shot conversion mode) operation timing.
ADCR0 Data 0 (AN000) Data 0 (AN000) Data 0 (AN000) Data 0 (AN000) Data 4 (AN004)
ADCR0H
ADCR1
Data 1 (AN001) Data 1 (AN001) Data 5 (AN005)
ADCR1H
ADCR3
Data 3 (AN003) Data 3 (AN003)
ADCR3H
Figure 25.11 Example of software trigger no-wait mode (scan mode, one-shot conversion mode) operation
timing
Note: When <5> or <6> is detected while conversion is in progress, conversion is automatically restarted from the rising
edge of the next cycle of the conversion clock (fAD). The conversion time at the first conversion operation restarted
is the same as that when there is A/D power supply stabilization wait time in software trigger wait mode or hardware
trigger wait mode. (See section 25.2.1. ADM0 : A/D Converter Mode Register 0 and section 25.2.1. ADM0 : A/D
Converter Mode Register 0.)
25.5.5 Software Trigger Wait Mode (Select Mode, Sequential Conversion Mode)
<1> To shift to software trigger wait mode, the ADCE bit of A/D converter mode register 0 (ADM0) must be set to 0 (stop
state).
<2> If ADCS is set to 1 in the stop state, A/D conversion is performed on the analog input specified by the analog input
channel specification register (ADS) (software trigger wait mode).
<3> When A/D conversion ends, the conversion result is stored in the A/D conversion result registers (ADCR, ADCRH,
ADCR0, and ADCR0H), and the A/D conversion end interrupt request signal (ADC12_ADI) is generated. After A/D
conversion ends, the next A/D conversion immediately starts.
<4> When ADCS is overwritten with 1 during conversion operation, the current A/D conversion is interrupted, and
conversion restarts. The partially converted data is discarded.
<5> When the value of the ADS register is rewritten or overwritten during conversion operation, the current A/D conversion
is interrupted, and A/D conversion is performed on the analog input respecified by the ADS register. The partially converted
data is discarded.
<6> Even if a hardware trigger is input during conversion operation, A/D conversion does not start.
<7> When ADCS is cleared to 0 during conversion operation, the current A/D conversion is interrupted, and the A/D
converter enters the stop state.
Figure 25.12 shows the example of software trigger wait mode (select mode, sequential conversion mode) operation timing.
<1> ADCE = 0
ADCE
ADCS is cleared to 0
<2> ADCS is set to 1 while in the <4> ADCS is overwritten <6> A hardware trigger is <7> during A/D conversion
with 1 during A/D generated (and ignored).
conversion standby state. operation.
conversion operation.
ADCS
<5> ADS is rewritten (from AN000 to AN001)
during A/D conversion operation.
ADC12_ADI
Figure 25.12 Example of software trigger wait mode (select mode, sequential conversion mode) operation
timing
Note: When <4> or <5> is detected during conversion operation, conversion is restarted automatically after the
stabilization wait time has passed since the rising edge of the next conversion clock (fAD). The conversion time
at the first conversion operation restarted is the same as that when there is A/D power supply stabilization wait
time in software trigger wait mode or hardware trigger wait mode. (See section 25.2.1. ADM0 : A/D Converter Mode
Register 0 and section 25.2.1. ADM0 : A/D Converter Mode Register 0.)
25.5.6 Software Trigger Wait Mode (Select Mode, One-shot Conversion Mode)
<1> To shift to software trigger wait mode, the ADCE bit of A/D converter mode register 0 (ADM0) must be set to 0 (stop
state).
<2> If ADCS is set to 1 in the stop state, A/D conversion is performed on the analog input specified by the analog input
channel specification register (ADS) (software trigger wait mode).
<3> When A/D conversion ends, the conversion result is stored in the A/D conversion result registers (ADCR, ADCRH,
ADCR0, and ADCR0H), and the A/D conversion end interrupt request signal (ADC12_ADI) is generated.
<4> After A/D conversion ends, the ADCS bit is automatically cleared to 0, and the A/D converter enters the stop state.
<5> When ADCS is overwritten with 1 during conversion operation, the current A/D conversion is interrupted, and
conversion restarts. The partially converted data is initialized.
<6> When the value of the ADS register is rewritten or overwritten during conversion operation, the current A/D conversion
is interrupted, and A/D conversion is performed on the analog input respecified by the ADS register. The partially converted
data is discarded.
<7> When ADCS is cleared to 0 during conversion operation, the current A/D conversion is interrupted, and the A/D
converter enters the stop state.
<8> When a hardware trigger is input during conversion operation, the trigger is not accepted.
Figure 25.13 shows the example of software trigger wait mode (select mode, one-shot conversion mode) operation timing.
<1> ADCE = 0
ADCE
ADCS is set to 1
<2> while in the <3> ADCS is <2> <5> ADCS is overwritten <4> <2> <8> A hardware trigger <4> <2> <7> ADCS is cleared to 0
automatically with 1 during A/D is generated (and during A/D conversion
conversion cleared to 0 after operation.
conversion operation. ignored).
standby state. conversion ends.
ADC12_ADI
Figure 25.13 Example of software trigger wait mode (select mode, one-shot conversion mode) operation
timing
Note: When <5> or <6> is detected during conversion operation, conversion is restarted automatically after the
stabilization wait time has passed since the rising edge of the next conversion clock (fAD). The conversion time
at the first conversion operation restarted is the same as that when there is A/D power supply stabilization wait
time in software trigger wait mode or hardware trigger wait mode. (See section 25.2.1. ADM0 : A/D Converter Mode
Register 0 and section 25.2.1. ADM0 : A/D Converter Mode Register 0.)
Note: In software trigger wait mode (select mode, one-shot conversion mode), the ADISS = 1 setting (input source =
temperature sensor output voltage, internal reference voltage) cannot be used.
25.5.7 Software Trigger Wait Mode (Scan Mode, Sequential Conversion Mode)
<1> To shift to software trigger wait mode, the ADCE bit of A/D converter mode register 0 (ADM0) must be set to 0 (stop
state).
<2> If ADCS is set to 1 in the stop state, A/D conversion is performed on the four analog input channels specified by scan 0
to scan 3, which are specified by the analog input channel specification register (ADS) (software trigger wait mode).
A/D conversion is performed on the analog input channels in order, starting with that specified by scan 0.
<3> A/D conversion is sequentially performed on the four analog input channels, the conversion results are stored in the
A/D conversion result register (ADCRn, ADCRnH) each time conversion ends, and the A/D conversion end interrupt
request signal (ADC12_ADI) is generated immediately after A/D conversion of the four channels ends. After A/D
conversion of the four channels ends, the next A/D conversion of the specified channels automatically starts.
<4> When ADCS is overwritten with 1 during conversion operation, the current A/D conversion is interrupted, and
conversion restarts. The partially converted data is discarded.
<5> When the value of the ADS register is rewritten or overwritten during conversion operation, the current A/D conversion
is interrupted, and A/D conversion is performed on the first channel respecified by the ADS register. The partially converted
data is discarded.
<6> When a hardware trigger is input during conversion operation, the trigger is not accepted.
<7> When ADCS is cleared to 0 during conversion operation, the current A/D conversion is interrupted, and the A/D
converter enters the stop state.
Figure 25.14 shows the example of software trigger wait mode (scan mode, sequential conversion mode) operation timing.
<1> ADCE = 0
ADCE
<6> A hardware trigger is <7> ADCS is cleared to 0
<2> ADCS is set to 1 while in the <4> ADCS is overwritten with 1 generated (and ignored). during A/D conversion
conversion standby state. during A/D conversion operation.
operation.
ADCS
ADCR1
Data 1 (AN001) Data 1 (AN001) Data 5 (AN005)
ADCR1H
ADCR2
Data 2 (AN002) Data 2 (AN002) Data 6 (AN006)
ADCR2H
ADCR3
Data 3 (AN003) Data 3 (AN003) Data 7 (AN007)
ADCR3H
An interrupt request signal is generated An interrupt request signal is generated An interrupt request signal is generated
immediately after the fourth A/D immediately after the fourth A/D immediately after the fourth A/D
conversion ends. conversion ends. conversion ends.
ADC12_ADI
Figure 25.14 Example of software trigger wait mode (scan mode, sequential conversion mode) operation
timing
Note: When <4> or <5> is detected during conversion operation, conversion is restarted automatically after the
stabilization wait time has passed since the rising edge of the next conversion clock (fAD). The conversion time
at the first conversion operation restarted is the same as that when there is A/D power supply stabilization wait
time in software trigger wait mode or hardware trigger wait mode. (See section 25.2.1. ADM0 : A/D Converter Mode
Register 0 and section 25.2.1. ADM0 : A/D Converter Mode Register 0.)
25.5.8 Software Trigger Wait Mode (Scan Mode, One-shot Conversion Mode)
<1> To shift to software trigger wait mode, the ADCE bit of A/D converter mode register 0 (ADM0) must be set to 0 (stop
state).
<2> If ADCS is set to 1 in the stop state, A/D conversion is performed on the four analog input channels specified by scan 0
to scan 3, which are specified by the analog input channel specification register (ADS) (software trigger wait mode).
A/D conversion is performed on the analog input channels in order, starting with that specified by scan 0.
<3> A/D conversion is sequentially performed on the four analog input channels, the conversion results are stored in
the A/D conversion result register (ADCRn, ADCRnH) each time conversion ends, and the A/D conversion end interrupt
request signal (ADC12_ADI) is generated immediately after A/D conversion of the four channels ends.
<4> After A/D conversion ends, the ADCS bit is automatically cleared to 0, and the A/D converter enters the stop state.
<5> When ADCS is overwritten with 1 during conversion operation, the current A/D conversion is interrupted, and
conversion restarts. The partially converted data is discarded.
<6> When the value of the ADS register is rewritten or overwritten during conversion operation, the current A/D conversion
is interrupted, and A/D conversion is performed on the first channel respecified by the ADS register. The partially converted
data is discarded.
<7> When ADCS is cleared to 0 during conversion operation, the current A/D conversion is interrupted, and the A/D
converter enters the stop state.
<8> When a hardware trigger is input during conversion operation, the trigger is not accepted.
Figure 25.15 shows the example of software trigger wait mode (scan mode, one-shot conversion mode) operation timing.
<1> ADCE = 0
ADCE
<2> ADCS is set to 1 while <4>ADCS is <2> <5> ADCS is overwritten <4> <2> <8> A hardware trigger is <7> ADCS is cleared to 0
in the conversion automatically
with 1 during A/D during A/D conversion
standby state. cleared to 0 after conversion operation. generated (and ignored). operation.
conversion ends.
ADCS
ADCR0
Data 0 (AN000) Data 0 (AN000) Data 0 (AN000) Data 0 (AN000) Data 4 (AN004)
ADCR0H
ADCR1
Data 1 (AN001) Data 1 (AN001) Data 5 (AN005)
ADCR1H
ADCR2
Data 2 (AN002) Data 2 (AN002) Data 6 (AN006)
ADCR2H
ADCR3
Data 3 (AN003) Data 3 (AN003)
ADCR3H
Figure 25.15 Example of software trigger wait mode (scan mode, one-shot conversion mode) operation
timing
Note: When <5> or <6> is detected during conversion operation, conversion is restarted automatically after the
stabilization wait time has passed since the rising edge of the next conversion clock (fAD). The conversion time
at the first conversion operation restarted is the same as that when there is A/D power supply stabilization wait
time in software trigger wait mode or hardware trigger wait mode. (See section 25.2.1. ADM0 : A/D Converter Mode
Register 0 and section 25.2.1. ADM0 : A/D Converter Mode Register 0.)
25.5.9 Hardware Trigger No-wait Mode (Select Mode, Sequential Conversion Mode)
<1> In the stop state, the ADCE bit of A/D converter mode register 0 (ADM0) is set to 1, and the A/D converter enters the
standby state.
<2> After the software counts up to the stabilization wait time (1 µs + 2 cycles of the conversion clock (fAD)), the ADCS bit
of the ADM0 register is set to 1 to place the A/D converter in the hardware trigger standby state (and conversion does not
start at this stage). Note that, while in this state, A/D conversion does not start even if ADCS is set to 1.
<3> If a hardware trigger is input while ADCS = 1, A/D conversion is performed on the analog input specified by the
analog input channel specification register (ADS).
<4> When A/D conversion ends, the conversion result is stored in the A/D conversion result registers (ADCR, ADCRH,
ADCR0, and ADCR0H), and the A/D conversion end interrupt request signal (ADC12_ADI) is generated. After A/D
conversion ends, the next A/D conversion immediately starts.
<5> If a hardware trigger is input during conversion operation, the current A/D conversion is interrupted, and conversion
restarts. The partially converted data is discarded.
<6> When the value of the ADS register is rewritten or overwritten during conversion operation, the current A/D conversion
is interrupted, and A/D conversion is performed on the analog input respecified by the ADS register. The partially converted
data is discarded.
<7> When ADCS is overwritten with 1 during conversion operation, the current A/D conversion is interrupted, and
conversion restarts. The partially converted data is discarded.
<8> When ADCS is cleared to 0 during conversion operation, the current A/D conversion is interrupted, and the A/D
converter enters the standby state. However, the A/D converter does not stop in this state.
<9> When ADCE is cleared to 0 while in the A/D conversion standby state, the A/D converter enters the stop state.
When ADCS = 0, inputting a hardware trigger is ignored and A/D conversion does not start.
Figure 25.16 shows the example of hardware trigger no-wait mode (select mode, sequential conversion mode) operation
timing.
ADC12_ADI
Figure 25.16 Example of hardware trigger no-wait mode (select mode, sequential conversion mode)
operation timing
Note: When <5>, <6>, or <7> is detected while conversion is in progress, conversion is automatically restarted from the
rising edge of the next cycle of the conversion clock (fAD). The conversion time at the first conversion operation
restarted is the same as that when there is A/D power supply stabilization wait time in software trigger wait mode
or hardware trigger wait mode. (See section 25.2.1. ADM0 : A/D Converter Mode Register 0 and section 25.2.1.
ADM0 : A/D Converter Mode Register 0.)
25.5.10 Hardware Trigger No-wait Mode (Select Mode, One-shot Conversion Mode)
<1> In the stop state, the ADCE bit of A/D converter mode register 0 (ADM0) is set to 1, and the A/D converter enters the
standby state.
<2> After the software counts up to the stabilization wait time (1 µs + 2 cycles of the conversion clock (fAD)), the ADCS bit
of the ADM0 register is set to 1 to place the A/D converter in the hardware trigger standby state (and conversion does not
start at this stage). Note that, while in this state, A/D conversion does not start even if ADCS is set to 1.
<3> If a hardware trigger is input while ADCS = 1, A/D conversion is performed on the analog input specified by the
analog input channel specification register (ADS).
<4> When A/D conversion ends, the conversion result is stored in the A/D conversion result registers (ADCR, ADCRH,
ADCR0, and ADCR0H), and the A/D conversion end interrupt request signal (ADC12_ADI) is generated.
<5> After A/D conversion ends, the ADCS bit remains set to 1, and the A/D converter enters the standby state.
<6> If a hardware trigger is input during conversion operation, the current A/D conversion is interrupted, and conversion
restarts. The partially converted data is discarded.
<7> When the value of the ADS register is rewritten or overwritten during conversion operation, the current A/D conversion
is interrupted, and A/D conversion is performed on the analog input respecified by the ADS register. The partially converted
data is discarded.
<8> When ADCS is overwritten with 1 during conversion operation, the current A/D conversion is interrupted, and
conversion restarts. The partially converted data is discarded.
<9> When ADCS is cleared to 0 during conversion operation, the current A/D conversion is interrupted, and the A/D
converter enters the standby state. However, the A/D converter does not stop in this state.
<10>When ADCE is cleared to 0 while in the A/D conversion standby state, the A/D converter enters the stop state.
When ADCS = 0, inputting a hardware trigger is ignored and A/D conversion does not start.
Figure 25.17 shows the example of hardware trigger no-wait mode (select mode, one-shot conversion mode) operation
timing.
Data 0 Data 1
ADS (AN000) (AN001)
Conversion is Conversion is
<4> A/D conversion interrupted Conversion is Conversion is
ends. interrupted interrupted interrupted.
<4> and restarts. <4> and restarts. <4>
and restarts.
A/D
conversion Stop Conversion Data 0 Conversion Data 0 Data 0 Conversion Data 0 Data 1 Conversion Data 1 Data 1 Conversion Data 1 Conversion Stop
state state standby (AN000) standby (AN000) (AN000) standby (AN000) (AN001) standby (AN001) (AN001)
standby
(AN001) standby state
ADC12_ADI
Figure 25.17 Example of hardware trigger no-wait mode (select mode, one-shot conversion mode)
operation timing
Note: When <6>, <7>, or <8> is detected while conversion is in progress, conversion is automatically restarted from the
rising edge of the next cycle of the conversion clock (fAD). The conversion time at the first conversion operation
restarted is the same as that when there is A/D power supply stabilization wait time in software trigger wait mode
or hardware trigger wait mode. (See section 25.2.1. ADM0 : A/D Converter Mode Register 0 and section 25.2.1.
ADM0 : A/D Converter Mode Register 0.)
25.5.11 Hardware Trigger No-wait Mode (Scan Mode, Sequential Conversion Mode)
<1> In the stop state, the ADCE bit of A/D converter mode register 0 (ADM0) is set to 1, and the A/D converter enters the
standby state.
<2> After the software counts up to the stabilization wait time (1 µs + 2 cycles of the conversion clock (fAD)), the ADCS bit
of the ADM0 register is set to 1 to place the A/D converter in the hardware trigger standby state (and conversion does not
start at this stage). Note that, while in this state, A/D conversion does not start even if ADCS is set to 1.
<3> If a hardware trigger is input while ADCS = 1, A/D conversion is performed on the four analog input channels
specified by scan 0 to scan 3, which are specified by the analog input channel specification register (ADS). A/D conversion
is performed on the analog input channels in order, starting with that specified by scan 0.
<4> A/D conversion is sequentially performed on the four analog input channels, the conversion results are stored in the
A/D conversion result register (ADCRn, ADCRnH) each time conversion ends, and the A/D conversion end interrupt
request signal (ADC12_ADI) is generated immediately after A/D conversion of the four channels ends. After A/D
conversion of the four channels ends, the next A/D conversion of the specified channels automatically starts.
<5> If a hardware trigger is input during conversion operation, the current A/D conversion is interrupted, and conversion
restarts at the first channel. The partially converted data is discarded.
<6> When the value of the ADS register is rewritten or overwritten during conversion operation, the current A/D conversion
is interrupted, and A/D conversion is performed on the first channel respecified by the ADS register. The partially converted
data is discarded.
<7> When ADCS is overwritten with 1 during conversion operation, the current A/D conversion is interrupted, and
conversion restarts. The partially converted data is discarded.
<8> When ADCS is cleared to 0 during conversion operation, the current A/D conversion is interrupted, and the A/D
converter enters the standby state. However, the A/D converter does not stop in this state.
<9> When ADCE is cleared to 0 while in the A/D conversion standby state, the A/D converter enters the stop state.
When ADCE = 0, any hardware trigger input is ignored and A/D conversion does not start.
Figure 25.18 shows the example of hardware trigger no-wait mode (scan mode, sequential conversion mode) operation
timing.
ADCR0 Data 0 Data 0 Data 0 Data 4 (AN004) Data 4 (AN004) Data 4 (AN004)
(AN000) (AN000) Data 0 (AN000) (AN000)
ADCR0H
ADCR1
Data 1 (AN001) Data 1 (AN001) Data 5 (AN005) Data 5 (AN005) Data 5 (AN005)
ADCR1H
ADCR3
Data 3 (AN003) Data 3 (AN003) Data 7 (AN007) Data 7 (AN007)
ADCR3H
An interrupt request signal is An interrupt request signal is An interrupt request signal is An interrupt request signal is
generated immediately after the generated immediately after the generated immediately after the generated immediately after the
ADC12_ADI fourth A/D conversion ends. fourth A/D conversion ends. fourth A/D conversion ends. fourth A/D conversion ends.
Figure 25.18 Example of hardware trigger no-wait mode (scan mode, sequential conversion mode)
operation timing
Note: When <5>, <6>, or <7> is detected while conversion is in progress, conversion is automatically restarted from the
rising edge of the next cycle of the conversion clock (fAD). The conversion time at the first conversion operation
restarted is the same as that when there is A/D power supply stabilization wait time in software trigger wait mode
or hardware trigger wait mode. (See section 25.2.1. ADM0 : A/D Converter Mode Register 0 and section 25.2.1.
ADM0 : A/D Converter Mode Register 0.)
25.5.12 Hardware Trigger No-wait Mode (Scan Mode, One-shot Conversion Mode)
<1> In the stop state, the ADCE bit of A/D converter mode register 0 (ADM0) is set to 1, and the A/D converter enters the
standby state.
<2> After the software counts up to the stabilization wait time (1 µs + 2 cycles of the conversion clock (fAD)), the ADCS bit
of the ADM0 register is set to 1 to place the A/D converter in the hardware trigger standby state (and conversion does not
start at this stage). Note that, while in this state, A/D conversion does not start even if ADCS is set to 1.
<3> If a hardware trigger is input while ADCS = 1, A/D conversion is performed on the four analog input channels
specified by scan 0 to scan 3, which are specified by the analog input channel specification register (ADS). A/D conversion
is performed on the analog input channels in order, starting with that specified by scan 0.
<4> A/D conversion is sequentially performed on the four analog input channels, the conversion results are stored in
the A/D conversion result register (ADCRn, ADCRnH) each time conversion ends, and the A/D conversion end interrupt
request signal (ADC12_ADI) is generated immediately after A/D conversion of the four channels ends.
<5> After A/D conversion of the four channels ends, the ADCS bit remains set to 1, and the A/D converter enters the
standby state.
<6> If a hardware trigger is input during conversion operation, the current A/D conversion is interrupted, and conversion
restarts at the first channel. The partially converted data is discarded.
<7> When the value of the ADS register is rewritten or overwritten during conversion operation, the current A/D conversion
is interrupted, and A/D conversion is performed on the first channel respecified by the ADS register. The partially converted
data is discarded.
<8> When ADCS is overwritten with 1 during conversion operation, the current A/D conversion is interrupted, and
conversion restarts at the first channel. The partially converted data is discarded.
<9> When ADCS is cleared to 0 during conversion operation, the current A/D conversion is interrupted, and the A/D
converter enters the standby state. However, the A/D converter does not stop in this state.
<10>When ADCE is cleared to 0 while in the A/D conversion standby state, the A/D converter enters the stop state.
When ADCS = 0, inputting a hardware trigger is ignored and A/D conversion does not start.
Figure 25.19 shows the example of hardware trigger no-wait mode (scan mode, one-shot conversion mode) operation
timing.
ADCR1
Data 1 (AN001) Data 1 (AN001) Data 5 (AN005) Data 5 (AN005)
ADCR1H
ADCR3
Data 3 (AN003) Data 3 (AN003) Data 7 (AN007)
ADCR3H
An interrupt request signal is An interrupt request signal is An interrupt request signal is
generated immediately after the generated immediately after the generated immediately after the
ADC12_ADI fourth A/D conversion ends. fourth A/D conversion ends. fourth A/D conversion ends.
Figure 25.19 Example of hardware trigger no-wait mode (scan mode, one-shot conversion mode)
operation timing
Note: When <6>, <7>, or <8> is detected while conversion is in progress, conversion is automatically restarted from the
rising edge of the next cycle of the conversion clock (fAD). The conversion time at the first conversion operation
restarted is the same as that when there is A/D power supply stabilization wait time in software trigger wait mode
or hardware trigger wait mode. (See section 25.2.1. ADM0 : A/D Converter Mode Register 0 and section 25.2.1.
ADM0 : A/D Converter Mode Register 0.)
25.5.13 Hardware Trigger Wait Mode (Select Mode, Sequential Conversion Mode)
<1> In the stop state, the ADCE bit of A/D converter mode register 0 (ADM0) is set to 1, and the A/D converter enters the
hardware trigger standby state.
<2> If a hardware trigger is input while in the hardware trigger standby state, A/D conversion is performed on the
analog input specified by the analog input channel specification register (ADS). The ADCS bit of the ADM0 register is
automatically set to 1 according to the hardware trigger input.
<3> When A/D conversion ends, the conversion result is stored in the A/D conversion result registers (ADCR, ADCRH,
ADCR0, and ADCR0H), and the A/D conversion end interrupt request signal (ADC12_ADI) is generated. After A/D
conversion ends, the next A/D conversion immediately starts. (At this time, no hardware trigger is necessary.)
<4> If a hardware trigger is input during conversion operation, the current A/D conversion is interrupted, and conversion
restarts. The partially converted data is discarded.
<5> When the value of the ADS register is rewritten or overwritten during conversion operation, the current A/D conversion
is interrupted, and A/D conversion is performed on the analog input respecified by the ADS register. The partially converted
data is discarded.
<6> When ADCS is overwritten with 1 during conversion operation, the current A/D conversion is interrupted, and
conversion restarts. The partially converted data is discarded.
<7> When ADCS is cleared to 0 during conversion operation, the current A/D conversion is interrupted, the A/D converter
enters the hardware trigger standby state, and the A/D converter enters the stop state.
<8> If ADCE = 0 is set during the hardware trigger wait state, the A/D converter is stopped. When ADCE = 0, the hardware
trigger input is ignored and A/D conversion does not start.
Figure 25.20 shows the example of hardware trigger wait mode (select mode, sequential conversion mode) operation timing.
ADC12_ADI
Figure 25.20 Example of hardware trigger no-wait mode (select mode, sequential conversion mode)
operation timing
Note: When <4>, <5>, or <6> is detected during conversion operation, conversion is restarted automatically after the
stabilization wait time has passed since the rising edge of the next conversion clock (fAD). The conversion time at
the first conversion operation restarted is the same as that when there is A/D power supply stabilization wait time
in software trigger wait mode or hardware trigger wait mode. (See section 25.2.1. ADM0 : A/D Converter Mode
Register 0 and section 25.2.1. ADM0 : A/D Converter Mode Register 0.)
25.5.14 Hardware Trigger Wait Mode (Select Mode, One-shot Conversion Mode)
<1> In the stop state, the ADCE bit of A/D converter mode register 0 (ADM0) is set to 1, and the A/D converter enters the
hardware trigger standby state.
<2> If a hardware trigger is input while in the hardware trigger standby state, A/D conversion is performed on the
analog input specified by the analog input channel specification register (ADS). The ADCS bit of the ADM0 register is
automatically set to 1 according to the hardware trigger input.
<3> When A/D conversion ends, the conversion result is stored in the A/D conversion result registers (ADCR, ADCRH,
ADCR0, and ADCR0H), and the A/D conversion end interrupt request signal (ADC12_ADI) is generated.
<4> After A/D conversion ends, the ADCS bit is automatically cleared to 0, and the A/D converter enters the stop state.
<5> If a hardware trigger is input during conversion operation, the current A/D conversion is interrupted, and conversion
restarts. The partially converted data is discarded.
<6> When the value of the ADS register is rewritten or overwritten during conversion operation, the current A/D conversion
is interrupted, and A/D conversion is performed on the analog input respecified by the ADS register. The partially converted
data is discarded.
<7> When ADCS is overwritten with 1 during conversion operation, the current A/D conversion is interrupted, and
conversion restarts. The partially converted data is initialized.
<8> When ADCS is cleared to 0 during conversion operation, the current A/D conversion is interrupted, the A/D converter
enters the hardware trigger standby state, and the A/D converter enters the stop state.
<9> If ADCE = 0 is set during the hardware trigger wait state, the A/D converter is stopped. When ADCE = 0, the hardware
trigger input is ignored and A/D conversion does not start.
Figure 25.21 shows the example of hardware trigger wait mode (select mode, one-shot conversion mode) operation timing.
ADCE
<2> A hardware trigger <2> <5> A hardware trigger is <2> Trigger
generated during A/D <2> <2> standby The trigger is not
is generated. acknowledged.
conversion operation. state
Hardware
trigger
Trigger
ADCS is automatically <4> <4> <4> <7>ADCS is overwritten <4>
The trigger is not standby
acknowledged. state cleared to 0 after with 1 during A/D <8> ADCS is cleared
conversion ends. conversion operation. to 0 during A/D
conversion
ADCS <6> during
ADS is rewritten operation.
A/D conversion
operation (from AN000
to AN001).
Data 0 Data 1
ADS (AN000) (AN001)
<3> A/D conversion Conversion is Conversion is Conversion is Conversion is
ends. interrupted interrupted interrupted interrupted.
and restarts.
<3> and restarts. <3> and restarts.
<3>
A/D
conversion Stop state Data 0 Stop Data 0 Data 0 Stop Data 0 Data 1 Stop Data 1 Data 1 Stop Data 1 Stop state
state (AN000) state (AN000) (AN000) state (AN000) (AN001) state (AN001) (AN001) state (AN001)
ADC12_ADI
Figure 25.21 Example of hardware trigger wait mode (select mode, one-shot conversion mode) operation
timing
Note: When <5>, <6>, or <7> is detected during conversion operation, conversion is restarted automatically after the
stabilization wait time has passed since the rising edge of the next conversion clock (fAD).The conversion time at
the first conversion operation restarted is the same as that when there is A/D power supply stabilization wait time
in software trigger wait mode or hardware trigger wait mode. (See section 25.2.1. ADM0 : A/D Converter Mode
Register 0 and section 25.2.1. ADM0 : A/D Converter Mode Register 0.)
Note: The setting of ADISS being 1 (the input source is temperature sensor output voltage or internal reference voltage)
cannot be used in the hardware trigger wait mode (select mode and one-shot conversion mode).
25.5.15 Hardware Trigger Wait Mode (Scan Mode, Sequential Conversion Mode)
<1> In the stop state, the ADCE bit of A/D converter mode register 0 (ADM0) is set to 1, and the A/D converter enters the
hardware trigger standby state.
<2> If a hardware trigger is input while in the hardware trigger standby state, A/D conversion is performed on the four
analog input channels specified by scan 0 to scan 3, which are specified by the analog input channel specification register
(ADS). The ADCS bit of the ADM0 register is automatically set to 1 according to the hardware trigger input. A/D
conversion is performed on the analog input channels in order, starting with that specified by scan 0.
<3> A/D conversion is sequentially performed on the four analog input channels, the conversion results are stored in the
A/D conversion result register (ADCRn, ADCRnH) each time conversion ends, and the A/D conversion end interrupt
request signal (ADC12_ADI) is generated immediately after A/D conversion of the four channels ends. After A/D
conversion of the four channels ends, the next A/D conversion of the specified channels automatically starts.
<4> If a hardware trigger is input during conversion operation, the current A/D conversion is interrupted, and conversion
restarts at the first channel. The partially converted data is discarded.
<5> When the value of the ADS register is rewritten or overwritten during conversion operation, the current A/D conversion
is interrupted, and A/D conversion is performed on the first channel respecified by the ADS register. The partially converted
data is discarded.
<6> When ADCS is overwritten with 1 during conversion operation, the current A/D conversion is interrupted, and
conversion restarts. The partially converted data is discarded.
<7> When ADCS is cleared to 0 during conversion operation, the current A/D conversion is interrupted, the A/D converter
enters the hardware trigger standby state, and the A/D converter enters the stop state.
<8> If ADCE = 0 is set during the hardware trigger wait state, the A/D converter is stopped. When ADCE = 0, the hardware
trigger input is ignored and A/D conversion does not start.
Figure 25.22 shows the example of hardware trigger wait mode (scan mode, sequential conversion mode) operation timing.
ADCE
<4> A hardware trigger is
<2> A hardware trigger generated during A/D Trigger The trigger
is generated. conversion operation. standby is not
Hardware state acknowledged.
trigger
The trigger Trigger ADCS is overwritten <6>
is not standby
ADCS is cleared <7>
acknowledged.
with 1 during A/D to 0 during A/D
state
conversion operation. conversion operation.
ADCS
ADCR1
Data 1 (AN001) Data 1 (AN001) Data 5 (AN005) Data 5 (AN005) Data 5 (AN005)
ADCR1H
ADCR3
Data 3 (AN003) Data 3 (AN003) Data 7 (AN007) Data 7 (AN007)
ADCR3H
An interrupt request signal is An interrupt request signal is An interrupt request signal is An interrupt request signal is
generated immediately after the generated immediately after the generated immediately after the generated immediately after the
ADC12_ADI fourth A/D conversion ends. fourth A/D conversion ends. fourth A/D conversion ends. fourth A/D conversion ends.
Figure 25.22 Example of hardware trigger wait mode (scan mode, sequential conversion mode) operation
timing
Note: When <4>, <5>, or <6> is detected during conversion operation, conversion is restarted automatically after the
stabilization wait time has passed since the rising edge of the next conversion clock (fAD). The conversion time at
the first conversion operation restarted is the same as that when there is A/D power supply stabilization wait time
in software trigger wait mode or hardware trigger wait mode. (See section 25.2.1. ADM0 : A/D Converter Mode
Register 0 and section 25.2.1. ADM0 : A/D Converter Mode Register 0.)
25.5.16 Hardware Trigger Wait Mode (Scan Mode, One-shot Conversion Mode)
<1> In the stop state, the ADCE bit of A/D converter mode register 0 (ADM0) is set to 1, and the A/D converter enters the
hardware trigger standby state.
<2> If a hardware trigger is input while in the hardware trigger standby state, A/D conversion is performed on the four
analog input channels specified by scan 0 to scan 3, which are specified by the analog input channel specification register
(ADS). The ADCS bit of the ADM0 register is automatically set to 1 according to the hardware trigger input. A/D
conversion is performed on the analog input channels in order, starting with that specified by scan 0.
<3> A/D conversion is sequentially performed on the four analog input channels, the conversion results are stored in
the A/D conversion result register (ADCRn, ADCRnH) each time conversion ends, and the A/D conversion end interrupt
request signal (ADC12_ADI) is generated immediately after A/D conversion of the four channels ends.
<4> After A/D conversion ends, the ADCS bit is automatically cleared to 0, and the A/D converter enters the stop state.
<5> If a hardware trigger is input during conversion operation, the current A/D conversion is interrupted, and conversion
restarts at the first channel. The partially converted data is discarded.
<6> When the value of the ADS register is rewritten or overwritten during conversion operation, the current A/D conversion
is interrupted, and A/D conversion is performed on the first channel respecified by the ADS register. The partially converted
data is discarded.
<7> When ADCS is overwritten with 1 during conversion operation, the current A/D conversion is interrupted, and
conversion restarts. The partially converted data is discarded.
<8> When ADCS is cleared to 0 during conversion operation, the current A/D conversion is interrupted, the A/D converter
enters the hardware trigger standby state, and the A/D converter enters the stop state.
Figure 25.23 shows the example of hardware trigger wait mode (scan mode, one-shot conversion mode) operation timing.
ADCR1
Data 1 (AN001) Data 1 (AN001) Data 5 (AN005) Data 5 (AN005)
ADCR1H
ADCR3
Data 3 (AN003) Data 3 (AN003) Data 7 (AN007)
ADCR3H
An interrupt request signal is An interrupt request signal is An interrupt request signal is
generated immediately after the generated immediately after the generated immediately after the
ADC12_ADI fourth A/D conversion ends. fourth A/D conversion ends. fourth A/D conversion ends.
Figure 25.23 Example of hardware trigger wait mode (scan mode, one-shot conversion mode) operation
timing
Note: When <5>, <6>, or <7> is detected during conversion operation, conversion is restarted automatically after the
stabilization wait time has passed since the rising edge of the next conversion clock (fAD). The conversion time at
the first conversion operation restarted is the same as that when there is A/D power supply stabilization wait time
in software trigger wait mode or hardware trigger wait mode. (See section 25.2.1. ADM0 : A/D Converter Mode
Register 0 and section 25.2.1. ADM0 : A/D Converter Mode Register 0.)
Setting up <1> MSTPCRD register setting The MSTPD16 bit of the MSTPCRD register is set to 0, and
Software Trigger supplying the clock starts.
No-Wait Mode
<2> PmnPFS_A register settings The ports are set as the analog input.
(See section 16.5.4. Notes on Using Analog Functions.)
<3> ● ADM0 register setting ● ADM0 register
● ADM1 register setting FR[2:0], LV[1:0]: bits: These are used to specify the A/D
● ADM2 register setting conversion time .
● ADUL and ADLL register ADMD bit: Select mode or scan mode
setting ● ADM1 register
● ADS register setting ADTMD1 and ADTMD0 bits: These are used to specify the
(The order of the settings is software trigger no-wait mode.
irrelevant.) ADSCM bit: Sequential conversion mode or one-shot
conversion mode
● ADM2 register
ADRCK bit: This is used to select the range for the A/D
conversion result comparison value for generating the interrupt
signal from AREA1, AREA3, and AREA 2.
ADTYP[1:0] bits: 12-bit, 10-bit, or 8-bit resolution
● ADUL and ADLL register
These are used to specify the upper limit and lower limit A/D
conversion result comparison values.
● ADS register
ADS[4:0] bits: These are used to select the analog input
channels.
<4> Supplied from the internal reference ● Supplied from an internal reference voltage
voltage? – Setting ADM2 register: ADREFP[1:0] bits to 11b
– Reference voltage discharge time: 1 µs wait
● Supplied from other voltage source
This step is through.
<5> Setting ADM2 register ● ADM2 register
Changing the values of ADREFM bit: This is used to select the ‘-’ side reference
ADREFP[1:0] voltage source
ADREFP[1:0] bits: These are used to select the ‘+’ side
reference voltage source. Before the supply setting of the
internal reference voltage (ADREFP[1:0] = 10b), the reference
voltage discharge time (1 µs) is required.
<6> Reference voltage stabilization wait The reference voltage stabilization wait time count indicated by A
time count A below may be required if the values of the ADREFP[1:0] bits are
changed.
If the values of ADREFP[1:0] are changed to 10b, respectively: A =
5 µs
A wait is not required if the values of ADREFP[1:0] are changed to
00b or 01b, respectively.
<7> ADCE bit setting The ADCE bit of the ADM0 register is set to 1, and the A/D
converter enters the standby state.
<8> Reference voltage stabilization wait Use software to control waiting until reference voltage stabilization
time count B wait time count B (1 µs + 2 cycles of the conversion clock (fAD))
elapses.
<9> ADCS bit setting After reference voltage stabilization wait time count B elapses, the
ADCS bit of the ADM0 register is set to 1, and A/D conversion
starts.
<10> Start of A/D conversion —
— ⋮ (The A/D conversion operations are performed)
<11> End of A/D conversion The A/D conversion end interrupt (ADC12_ADI) is generated.*1
<12> Storage of conversion results in the The conversion results are stored in the ADCRn and ADCRnH
ADCRn and ADCRnH register register.
Note 1. Depending on the settings of the ADRCK bit, ADUL and ADLL registers, there is a possibility of no interrupt signal being generated.
In this case, the results are not stored in the ADCRn or ADCRnH register.
Setting up <1> MSTPCRD register setting The MSTPD16 bit of the MSTPCRD register is set to 0, and
Software Trigger supplying the clock starts.
Wait Mode
<2> PmnPFS_A register settings The ports are set as the analog input.
(See section 16.5.4. Notes on Using Analog Functions.)
<3> ● ADM0 register setting ● ADM0 register
● ADM1 register setting FR[2:0], LV[1:0]: bits: These are used to specify the A/D
● ADM2 register setting conversion time .
● ADUL and ADLL register ADMD bit: Select mode or scan mode
setting ● ADM1 register
● ADS register setting ADTMD1 and ADTMD0 bits: These are used to specify the
(The order of the settings is software trigger wait mode.
irrelevant.) ADSCM bit: Sequential conversion mode or one-shot
conversion mode
● ADM2 register
ADRCK bit: This is used to select the range for the A/D
conversion result comparison value for generating the interrupt
signal from AREA1, AREA3, and AREA 2.
ADTYP[1:0] bits: 12-bit, 10-bit, or 8-bit resolution
● ADUL and ADLL register
These are used to specify the upper limit and lower limit A/D
conversion result comparison values.
● ADS register
ADS[4:0] bits: These are used to select the analog input
channels.
<4> Supplied from the internal reference ● Supplied from an internal reference voltage
voltage? – Setting ADM2 register: ADREFP[1:0] bits to 11b
– Reference voltage discharge time: 1 µs wait
● Supplied from other voltage source
This step is through.
<5> Setting ADM2 register ● ADM2 register
Changing the values of ADREFM bit: This is used to select the ‘-’ side reference
ADREFP[1:0] voltage source
ADREFP[1:0] bits: These are used to select the ‘+’ side
reference voltage source. Before the supply setting of the
internal reference voltage (ADREFP[1:0] = 10b), the reference
voltage discharge time (1 µs) is required.
<6> Reference voltage stabilization wait The reference voltage stabilization wait time count indicated by A
time count A below may be required if the values of the ADREFP[1:0] bits are
changed.
If the values of ADREFP[1:0] are changed to 10b, respectively: A =
5 µs
A wait is not required if the values of ADREFP[1:0] are changed to
00b or 01b, respectively.
<7> ADCE bit setting Do not set the ADCE bit of the ADM0 register (0).
The A/D converter must remain in the stopped state.
<8> ADCS bit setting The ADCS bit of the ADM0 register is set to 1, and the A/D
converter enters the standby state.
<9> Stabilization wait time for A/D power The A/D converter automatically counts up to the stabilization wait
supply time for A/D power supply.
<10> Start of A/D conversion After counting up to the stabilization wait time for A/D power supply
ends, A/D conversion starts.
— ⋮ (The A/D conversion operations are performed)
<11> End of A/D conversion The A/D conversion end interrupt (ADC12_ADI) is generated.*1
<12> Storage of conversion results in the The conversion results are stored in the ADCRn and ADCRnH
ADCRn and ADCRnH register register.
Note 1. Depending on the settings of the ADRCK bit, ADUL and ADLL registers, there is a possibility of no interrupt signal being generated.
In this case, the results are not stored in the ADCRn or ADCRnH register.
Setting up <1> MSTPCRD register setting The MSTPD16 bit of the MSTPCRD register is set to 0, and
Hardware Trigger supplying the clock starts.
No-Wait Mode
<2> PmnPFS_A register settings The ports are set as the analog input.
(See section 16.5.4. Notes on Using Analog Functions.)
<3> ● ADM0 register setting ● ADM0 register
● ADM1 register setting FR[2:0], LV[1:0]: bits: These are used to specify the A/D
● ADM2 register setting conversion time .
● ADUL and ADLL register ADMD bit: Select mode or scan mode
setting ● ADM1 register
● ADS register setting ADTMD1 and ADTMD0 bits: These are used to specify the
(The order of the settings is hardware trigger no-wait mode.
irrelevant.) ADSCM bit: Sequential conversion mode or one-shot
conversion mode
● ADM2 register
ADRCK bit: This is used to select the range for the A/D
conversion result comparison value for generating the interrupt
signal from AREA1, AREA3, and AREA 2.
ADTYP[1:0] bits: 12-bit, 10-bit, or 8-bit resolution
● ADUL and ADLL register
These are used to specify the upper limit and lower limit A/D
conversion result comparison values.
● ADS register
ADS[4:0] bits: These are used to select the analog input
channels.
<4> Supplied from the internal reference ● Supplied from an internal reference voltage
voltage? – Setting ADM2 register: ADREFP[1:0] bits to 11b
– Reference voltage discharge time: 1 µs wait
● Supplied from other voltage source
This step is through.
<5> Setting ADM2 register ● ADM2 register
Changing the values of ADREFM bit: This is used to select the ‘-’ side reference
ADREFP[1:0] voltage source
ADREFP[1:0] bits: These are used to select the ‘+’ side
reference voltage source. Before the supply setting of the
internal reference voltage (ADREFP[1:0] = 10b), the reference
voltage discharge time (1 µs) is required.
<6> Reference voltage stabilization wait The reference voltage stabilization wait time count indicated by A
time count A below may be required if the values of the ADREFP[1:0] bits are
changed.
If the values of ADREFP[1:0] are changed to 10b, respectively: A =
5 µs
A wait is not required if the values of ADREFP[1:0] are changed to
00b or 01b, respectively.
<7> ADCE bit setting The ADCE bit of the ADM0 register is set to 1, and the A/D
converter enters the standby state.
<8> Reference voltage stabilization wait Use software to control waiting until reference voltage stabilization
time count B wait time count B (1 µs + 2 cycles of the conversion clock (fAD))
elapses.
<9> ADCS bit setting After reference voltage stabilization wait time count B elapses, the
ADCS bit of the ADM0 register is set to 1, and A/D converter enters
the hardware trigger standby state.
<10> Start of A/D conversion —
— ⋮ (The A/D conversion operations are performed)
<11> End of A/D conversion The A/D conversion end interrupt (ADC12_ADI) is generated.*1
<12> Storage of conversion results in the The conversion results are stored in the ADCRn and ADCRnH
ADCRn and ADCRnH register register.
Note 1. Depending on the settings of the ADRCK bit, ADUL and ADLL registers, there is a possibility of no interrupt signal being generated.
In this case, the results are not stored in the ADCRn or ADCRnH register.
Setting up <1> MSTPCRD register setting The MSTPD16 bit of the MSTPCRD register is set to 0, and
Hardware Trigger supplying the clock starts.
Wait Mode
<2> PmnPFS_A register settings The ports are set as the analog input.
(See section 16.5.4. Notes on Using Analog Functions.)
<3> ● ADM0 register setting ● ADM0 register
● ADM1 register setting FR[2:0], LV[1:0]: bits: These are used to specify the A/D
● ADM2 register setting conversion time .
● ADUL and ADLL register ADMD bit: Select mode or scan mode
setting ● ADM1 register
● ADS register setting ADTMD1 and ADTMD0 bits: These are used to specify the
(The order of the settings is hardware trigger wait mode.
irrelevant.) ADSCM bit: Sequential conversion mode or one-shot
conversion mode
● ADM2 register
ADRCK bit: This is used to select the range for the A/D
conversion result comparison value for generating the interrupt
signal from AREA1, AREA3, and AREA 2.
ADTYP[1:0] bits: 12-bit, 10-bit, or 8-bit resolution
● ADUL and ADLL register
These are used to specify the upper limit and lower limit A/D
conversion result comparison values.
● ADS register
ADS[4:0] bits: These are used to select the analog input
channels.
<4> Supplied from the internal reference ● Supplied from an internal reference voltage
voltage? – Setting ADM2 register: ADREFP[1:0] bits to 11b
– Reference voltage discharge time: 1 µs wait
● Supplied from other voltage source
This step is through.
<5> Setting ADM2 register ● ADM2 register
Changing the values of ADREFM bit: This is used to select the ‘-’ side reference
ADREFP[1:0] voltage source
ADREFP[1:0] bits: These are used to select the ‘+’ side
reference voltage source. Before the supply setting of the
internal reference voltage (ADREFP[1:0] = 10b), the reference
voltage discharge time (1 µs) is required.
<6> Reference voltage stabilization wait The reference voltage stabilization wait time count indicated by A
time count A below may be required if the values of the ADREFP[1:0] bits are
changed.
If the values of ADREFP[1:0] are changed to 10b, respectively: A =
5 µs
A wait is not required if the values of ADREFP[1:0] are changed to
00b or 01b, respectively.
<7> ADCE bit setting The ADCE bit of the ADM0 register is set to 1, and the A/D
converter enters the standby state.
<8> Hardware trigger generation Set the trigger signal output of other modules.
<9> Stabilization wait time for A/D power The A/D converter automatically counts up to the stabilization wait
supply time for A/D power supply.
<10> Start of A/D conversion After counting up to the stabilization wait time for A/D power supply
ends, A/D conversion starts.
— ⋮ (The A/D conversion operations are performed)
<11> End of A/D conversion The A/D conversion end interrupt (ADC12_ADI) is generated.*1
<12> Storage of conversion results in the The conversion results are stored in the ADCRn and ADCRnH
ADCRn and ADCRnH register register.
Note 1. Depending on the settings of the ADRCK bit, ADUL and ADLL registers, there is a possibility of no interrupt signal being generated.
In this case, the results are not stored in the ADCRn or ADCRnH register.
25.6.5 Example of Using the ADC12 when Selecting the Temperature Sensor Output
Voltage or Internal Reference Voltage, and Software Trigger No-wait Mode and
One-shot Conversion Mode
Table 25.18 shows the setup steps When Temperature Sensor Output Voltage and Internal Reference Voltage Is Selected.
Table 25.18 Setup when temperature sensor output voltage and internal reference voltage is selected
Step Process Detail
Setup When <1> MSTPCRD register setting The MSTPD16 bit of the MSTPCRD register is set to 0, and
Temperature Sensor supplying the clock starts.
Output Voltage and
Internal Reference <2> ● ADM0 register setting ● ADM0 register
Voltage ● ADM1 register setting FR[2:0], LV[1:0]: bits: These are used to specify the A/D
Is Selected ● ADM2 register setting conversion time .
● ADUL and ADLL register ADMD bit: This is used to specify the select mode.
setting ● ADM1 register
● ADS register setting ADTMD1 and ADTMD0 bits: These are used to specify the
software trigger no-wait mode.
ADSCM bit: One-shot conversion mode
● ADM2 register
ADREFP[1:0] and ADREFM bits: These are used to select the
reference voltage.
ADRCK bit: This is used to select the range for the A/D
conversion result comparison value for generating the interrupt
signal from AREA1, AREA3, and AREA 2.
ADTYP[1:0] bits: 12-bit, 10-bit, or 8-bit resolution
● ADUL and ADLL register
These are used to specify the upper limit and lower limit A/D
conversion result comparison values.
● ADS register
ADISS and ADS[4:0] bits: These are used to select the
temperature sensor output voltage or internal reference voltage.
<3> Reference voltage stabilization wait The reference voltage stabilization wait time count A may be
time count A required if the values of the ADREFP[1:0] bits are changed.
A wait is not required if the values of ADREFP[1:0] are changed to
00b or 01b, respectively.
Setting the values of ADREFP[1:0] to 10b, respectively is prohibited.
<4> ADCE bit setting The ADCE bit of the ADM0 register is set to 1, and the A/D
converter enters the standby state.
<5> Reference voltage stabilization wait Use software to control waiting until reference voltage stabilization
time count B wait time count B (1 µs + 2 cycles of the conversion clock (fAD))
elapses.
<6> ADCS bit setting After reference voltage stabilization wait time count B elapses, the
ADCS bit of the ADM0 register is set to 1, and A/D conversion
starts.
<7> Start of A/D conversion —
<8> End of A/D conversion The A/D conversion end interrupt (ADC12_ADI) will be generated.
After ADISS is set to 1, the initial conversion result cannot be used.
<9> ADCS bit setting The ADCS bit of the ADM0 register is set to 1, and A/D conversion
starts.
<10> Start of A/D conversion —
<11> End of A/D conversion The A/D conversion end interrupt (ADC12_ADI) is generated.*1
<12> Storage of conversion results in the The conversion results are stored in the ADCRn and ADCRnH
ADCRn and ADCRnH register register.
Note 1. Depending on the settings of the ADRCK bit, ADUL and ADLL registers, there is a possibility of no interrupt signal being generated.
In this case, the results are not stored in the ADCRn or ADCRnH register.
Setting up <1> MSTPCRD register setting The MSTPD16 bit of the MSTPCRD register is set to 0, and
Test Mode supplying the clock starts.
<2> ● ADM0 register setting ● ADM0 register
● ADM1 register setting FR[2:0], LV[1:0]: bits: These are used to specify the A/D
● ADM2 register setting conversion time .
● ADUL and ADLL register ADMD bit: This is used to specify the select mode.
setting ● ADM1 register
● ADS register setting ADTMD1 and ADTMD0 bits: These are used to specify the
● ADTES register setting software trigger no-wait mode.
(The order of the settings is ADSCM bit: This is used to specify the one-shot conversion
irrelevant.) mode.
● ADM2 register
ADRCK bit: This is used to select the range for the A/D
conversion result comparison value for generating the interrupt
signal to AREA 2.
ADTYP[1:0] bits: 12-bit, 10-bit, or 8-bit resolution
● ADUL and ADLL register
These set ADUL to 0xFF and ADLL to 0x00 (initial values).
● ADS register
ADS[4:0] bits: These are used to set to AN000.
● ADTES register
ADTES[1:0] bits: VREFL0 or VREFH0.
<3> Supplied from the internal reference ● Supplied from an internal reference voltage
voltage? – Setting ADM2 register: ADREFP[1:0] bits to 11b
– Reference voltage discharge time: 1 µs wait
● Supplied from other voltage source
This step is through.
<4> Setting ADM2 register ● ADM2 register
Changing the values of ADREFM bit: This is used to select the ‘-’ side reference
ADREFP[1:0] voltage source
ADREFP[1:0] bits: These are used to select the ‘+’ side
reference voltage source. Before the supply setting of the
internal reference voltage (ADREFP[1:0] = 10b), the reference
voltage discharge time (1 µs) is required.
<5> Reference voltage stabilization wait The reference voltage stabilization wait time count indicated by A
time count A below may be required if the values of the ADREFP[1:0] bits are
changed.
If the values of ADREFP[1:0] are changed to 10b, respectively: A =
5 µs
A wait is not required if the values of ADREFP[1:0] are changed to
00b or 01b, respectively.
<6> ADCE bit setting The ADCE bit of the ADM0 register is set to 1, and the A/D
converter enters the standby state.
<7> Reference voltage stabilization wait Use software to control waiting until reference voltage stabilization
time count B wait time count B (1 µs + 2 cycles of the conversion clock (fAD))
elapses.
<8> ADCS bit setting After reference voltage stabilization wait time count B elapses, the
ADCS bit of the ADM0 register is set to 1, and A/D conversion
starts.
<9> Start of A/D conversion —
<10> End of A/D conversion The A/D conversion end interrupt (ADC12_ADI) is generated.*1
<11> Storage of conversion results in the The conversion results are stored in the ADCRn and ADCRnH
ADCRn and ADCRnH register register.
Note 1. Depending on the settings of the ADRCK bit, ADUL and ADLL registers, there is a possibility of no interrupt signal being generated.
In this case, the results are not stored in the ADCRn or ADCRnH register.
Note: For the procedure for testing the A/D converter, see section 25.8. Testing of the A/D Converter.
If the A/D conversion result range is specified using the ADUL and ADLL registers, A/D conversion results can be
determined at a certain interval of time. Using this function enables power supply voltage monitoring and input key
determination based on A/D inputs.
Note: The Snooze mode can only be specified when the high-speed on-chip oscillator clock or medium-speed on-chip
oscillator clock is selected for PCLKB.
Note 1. Depending on the setting of the A/D conversion result comparison function (ADRCK bit, ADUL/ADLL register), there is a
possibility of no interrupt signal being generated.
Figure 25.24 Block diagram when using Snooze mode in hardware trigger wait mode
When using the Snooze mode function, the initial setting of each register is specified before switching to the Software
Standby mode (for details about these settings, see Table 25.20). Just before moving to Software Standby mode, set bit 2
(AWC) of A/D converter mode register 2 (ADM2) to 1. After the initial settings are specified, set bit 0 (ADCE) of A/D
converter mode register 0 (ADM0) to 1.
If a hardware trigger is input after switching to the Software Standby mode, the high-speed on-chip oscillator clock is
supplied to the A/D converter. After supplying this clock, the A/D converter automatically counts up to the A/D power
supply stabilization wait time, and then A/D conversion starts.
The Snooze mode operation after A/D conversion ends differs depending on whether an interrupt signal is generated.*1
Note: Select the hardware trigger signal from among the realtime clock interrupt signal (RTC_ALM_OR_PRD), 32-bit
interval timer event signal (ADITL0 (= TML32_ITL0)).
Note: A/D converter can not be triggered by the ELC in the Snooze mode.
mode release) of the A/D converter mode register 2 (ADM2). If the AWC bit is left set to 1, A/D conversion will not
start normally in the subsequent Snooze or normal operation mode.
● While in the scan mode
If even one value of the A/D conversion results of the four channels falls within the range specified by the A/D
conversion result comparison function, and A/D conversion end interrupt request signal (ADC12_ADI) is generated,
the A/D converter switches from the Snooze mode to the normal operation mode. At this time, be sure to clear bit 2
(AWC = 0: Snooze mode release) of the A/D converter mode register 2 (ADM2). If the AWC bit is left set to 1, A/D
conversion will not start normally in the subsequent Snooze or normal operation mode.
Figure 25.25 shows an operation example when interrupt is generated after A/D conversion ends (while in scan mode).
RTC_ALM_OR_PRD
Conversion
Channel 1 Channel 2 Channel 3 Channel 4
channels
Interrupt signal
(ADC12_ADI)
Figure 25.25 Operation example when interrupt is generated after A/D conversion ends (while in scan
mode)
Figure 25.26 shows an operation example when no interrupt is generated after A/D conversion ends (while in scan mode).
RTC_ALM_OR_PRD
Conversion
Channel 1 Channel 2 Channel 3 Channel 4
channels
Interrupt signal
(ADC12_ADI)
Figure 25.26 Operation example when no interrupt is generated after A/D conversion ends (while in scan
mode)
Table 25.20 shows procedure for setting up Snooze mode (hardware trigger)
Table 25.20 Procedure for setting up Snooze mode (hardware trigger) (1 of 2)
Step Process Detail
Normal operation <1> MSTPCRD register setting The MSTPD16 bit of the MSTPCRD register is set to 0, and
supplying the clock starts.
<2> PmnPFS_A register settings The ports are set as the analog input.
(See section 16.5.4. Notes on Using Analog Functions.)
<3> ● ADM0 register setting ● ADM0 register
● ADM1 register setting FR[2:0], LV[1:0]: bits: These are used to specify the A/D
● ADM2 register setting conversion time.
● ADUL and ADLL register ADMD bit: Select mode or scan mode
setting ● ADM1 register
● ADS register setting ADTMD1 and ADTMD0 bits: These are used to specify the
(The order of the settings is hardware trigger wait mode.
irrelevant.) ADSCM bit: One-shot conversion mode
● ADM2 register
ADREFP[1:0] and ADREFM bits: These are used to select the
reference voltage.
ADRCK bit: This is used to select the range for the A/D
conversion result comparison value for generating the interrupt
signal from AREA1, AREA3, and AREA 2.
ADTYP[1:0] bits: 12-bit, 10-bit, or 8-bit resolution
● ADUL and ADLL register
These are used to specify the upper limit and lower limit A/D
conversion result comparison values.
● ADS register
ADS[4:0] bits: These are used to select the analog input
channels.
<4> Reference voltage stabilization wait The reference voltage stabilization wait time count indicated by A
time count A below may be required if the values of the ADREFP[1:0] bits are
changed.
If the values of ADREFP[1:0] are changed to 10b, respectively: A =
5 µs
Before changing as above, perform reference supply discharge (1
µs) by setting ADREFP[1:0] = 11b.
A wait is not required if the values of ADREFP[1:0] are changed to
00b or 01b, respectively.
<5> AWC = 1 Immediately before entering the Software Standby mode, enable the
Snooze mode by setting the AWC bit of the ADM2 register to 1.
<6> Normal operation The ADCE bit of the ADM0 register is set to 1, and the A/D
converter enters the standby state.
Note: If the analog input voltage is variable during A/D conversion in steps <1> to <10> above, use another method to
check the analog multiplexer.
Note: The results of conversion might include an error. Consider an appropriate level of error in comparison of the results
of conversion.
ADISS
ADS[4:0]
AN000/VREFH0
AN001/VREFL0
ANxxx ADTES[1:0]
ANxxx
Temperature
sensor
Internal reference
voltage
ADREFM
11...11b
Ideal line
Digital output
Overall
error
00...00b
0 AVREF
Analog input
11...11b
Digital output
00...00b
0 AVREF
Analog input
111b
011b
010b
001b
Zero-scale error
000b
0 1 2 3 AVREF
Analog input (LSB)
Full-scale error
Digital output (lower 3 bits)
111b
110b
000b
0 AVREF - 3 AVREF - 2 AVREF - 1 AVREF
11...11b
Ideal line
Digital output
Integral linearity
error
00...00b
0 AVREF
Analog input
11...11b
Ideal 1LSB width
Digital output
Differential
linearity error
00...00b
0 AVREF
Analog input
Sampling
time
A/D conversion time
Note: For details about the internal reference voltage, see section 31, Electrical Characteristics.
<2> Conflict between the conversion result being stored in the A/D conversion result register (ADCRn and ADCRnH) at the
end of conversion and the write access to the A/D converter mode register 0 (ADM0) or analog input channel specification
register (ADS) by instruction.
The ADM0 and ADS registers write have priority. The ADCRn and ADCRnH registers write is not performed, nor is the
conversion end interrupt signal (ADC12_ADI) generated.
VCC
VREFH0
0.1 µF
10 pF to 0.1 µF
VSS
0.1 µF
VREFL0
To make sure that sampling is effective, however, we recommend using the converter with analog input sources that have
output impedances no greater than 1 kΩ. If a source has a higher output impedance, lengthen the sampling time or connect
a larger capacitor (with a value of about 0.1 µF) to the pin from among AN000 to AN007, AN021, and AN022 to which
the source is connected (see Figure 25.35). The sampling capacitor may be being charged while the setting of the ADCS bit
is 0 and immediately after sampling is restarted and so is not defined at these times. Accordingly, the state of conversion
is undefined after charging starts in the next round of conversion after the value of the ADCS bit has been 1 or when
conversion is repeated. Thus, to secure full charging regardless of the size of fluctuations in the analog signal, ensure that
the output impedances of the sources of analog inputs are low or secure sufficient time for the completion of sampling.
NVIC_ICPR0/ADC12_ADI
Temperature sensor voltage output Temperature sensor outputs a voltage to the 12-bit A/D converter
Temperature sensor
Control circuit
Characteristics vary between sensors, so Renesas recommends measuring two different sample temperatures as follows:
1. Use the 12-bit A/D converter to measure the voltage V1 output by the temperature sensor at temperature T1.
2. Again use the 12-bit A/D converter to measure the voltage V2 output by the temperature sensor at a different
temperature T2.
3. Obtain the temperature gradient (slope = (V2 - V1) / (T2 - T1)) from these results.
4. Subsequently, obtain temperatures by substituting the slope into the formula for the temperature characteristic (T = (Vs
-V1) / slope + T1).
If you are using the temperature gradient given in section 31, Electrical Characteristics, use the A/D converter to measure
the voltage V1 output by the temperature sensor at temperature T1, then calculate the temperature characteristic using the
following formula:
T = (Vs - V1) / slope + T1
Note: This method produces less accurate temperatures than measurement at two points.
27. SRAM
27.1 Overview
The MCU provides an on-chip, high-density SRAM module with parity-bit checking. Parity check is performed on the all
SRAM areas.
Table 27.1 lists the SRAM specifications.
Table 27.1 SRAM specifications
Parameter Description
Bit position: 7 6 5 4 3 2 1 0
The PARIOAD register controls the operation on detection of a parity error. The SRAM Protection Register (SRAMPRCR)
protects this register against writes. Always set the SRAMPRCR bit in SRAMPRCR to 1 before writing to this bit. Do not
write to the PARIOAD register while accessing the SRAM.
Bit position: 7 6 5 4 3 2 1 0
SRAM
Bit field: KW[6:0]
PRCR
27.3 Operation
Yes
RPERF*1 = 1
No
Yes
Parity error
generated
No No
Parity error
generated
Yes
Note 1. RPERF: Internal Reset Request by RAM Parity Error Flag (RESF.RPERF bit)
Figure 27.1 Flow of SRAM parity check when SRAM parity reset is enabled
Start of check
Initial setting
(parity NMI)
Check SRAM
No
RPEST*1 = 0
Check SRAM
RETURN No
RPEST*1 = 1
Yes
Note 1. RPEST: SRAM Parity Error Interrupt Status Flag (NMISR.RPEST bit)
Figure 27.2 Flow of SRAM parity check when SRAM parity interrupt is enabled
2 2
Flash ready
interrupt FCB Code flash memory
(FLASH_FRDYI)
Read address
0x0000_FFFF
Block 31 (2 KB)
: 64 KB
Block 16 (2 KB)
0x0000_8000
0x0000_7FFF Block 15 (2 KB)
32 KB
Block 0 (2 KB)
0x0000_0000
Table 28.2 Read and P/E addresses of the code flash memory
Size of code flash memory Read address P/E address Number of blocks
Figure 28.3 shows the mapping of the data flash memory, and Table 28.3 shows the read and programming and erasure
(P/E) addresses of the data flash memory. The data area of the data flash memory is divided into 256-B blocks, with each
being a unit for erasure.
0x4010_03FF 0xFE00_03FF
Block 3 (256B)
Block 2 (256B)
1 KB
Block 1 (256B)
Block 0 (256B)
0x4010_0000 0xFE00_0000
Table 28.3 Read and P/E addresses of the data flash memory
Size of data flash memory Read address P/E address Number of blocks
Bit position: 7 6 5 4 3 2 1 0
DFLE
Bit field: — — — — — — —
N
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
FENT FENT
Bit field: FEKEY[7:0] — — — — — —
RYD RY0
To program the code flash or the data flash, either the FENTRY0 or FENTRYD bit must be set to 1 to enter the P/E mode.
Clearing the FENTRY0 bit or FENTRYD bit allows the code flash or data flash to be in read mode, but it is necessary to
confirm the value of this bit before changing it. See section 28.10.1. Sequencer Modes.
[Clearing conditions]
● Data is written by byte access
● A value other than 0xAA is set to the FEKEY[7:0] bits and written to the FENTRYR register
● Set 0xAA00 to the FENTRYR register
● Data is written to the FENTRYR register while the register has a value other than 0x0000.
[Clearing conditions]
● Data is written by byte access.
● A value other than 0xAA is set to the FEKEY[7:0] bits and written to the FENTRYR register.
● Set 0xAA00 to the FENTRYR register.
● Data is written to the FENTRYR register while the register has a value other than 0x0000.
Bit position: 7 6 5 4 3 2 1 0
When a procedure other than the specified procedure is used to write data, the FPSR.PERR flag is set to 1.
Bit position: 7 6 5 4 3 2 1 0
[Clearing conditions]
● The FPMCR register is accessed according to the procedure to unlock protection described in section 28.3.3. FPR :
Protection Unlock Register.
Bit position: 7 6 5 4 3 2 1 0
The FPMCR register sets the operating mode of the flash memory and is protected from unauthorized setting.
See Figure 28.13 and Figure 28.15 for this register write control method.
See section 28.3.3. FPR : Protection Unlock Register for the procedure to unlock the protection.
FMS0 bit, FMS1 bits (Flash Operating Mode Select 0, Flash Operating Mode Select 1)
These bits set the operating mode of the flash memory.
[How to enter the code flash from the read mode to the code flash P/E mode]
Set FMS1 = 0, FMS0 = 1, and RPDIS = 0. Wait for the mode setup time tMS (see section 31, Electrical Characteristics).
[How to enter the data flash from the read mode to the data flash P/E mode]
Set FMS1 = 1, FMS0 = 0, and RPDIS bit = 0.
[How to enter the code flash from the code flash P/E mode to the read mode]
Set FMS1 = 0, FMS0 = 0, and RPDIS = 1.
Wait for the read mode transition time (see section 31, Electrical Characteristics).
Bit position: 7 6 5 4 3 2 1 0
Note: A wrong frequency setting may cause the flash memory to be damaged.
The following information describes how to set the PCKA[4:0] bits when the frequency is not an integral number, for
example 31.5 MHz.
[When the frequency is higher than 4 MHz]
Set a rounded-up value for a non-integer frequency.
For example, set 32 MHz (PCKA = 11111b) when the frequency is 31.5 MHz.
[When the frequency is 4 MHz or lower]
Do not use a non-integer frequency. Use the frequency of 1, 2, 3, or 4 MHz.
Bit position: 7 6 5 4 3 2 1 0
FRES
Bit field: — — — — — — —
ET
Bit position: 7 6 5 4 3 2 1 0
Bit position: 7 6 5 4 3 2 1 0
Verifies whether the flash memory is the blank state (not to be programmed) from the start address pointed by the FSARH
and FSARL registers to the end address pointed by the FEARH and FEARL registers. The blank check command is allowed
to execute within the region of flash memory.
Note: The blank check result cannot guarantee that the flash memory is erased.
[Block erase]
Erases block of the flash memory.
Set the start address of the target erasure block in the FSARH and FSARL registers, and set the end address of the target
erasure block in the FEARH and FEARL registers. If a setting other than the specified is made, erasure may not be executed
correctly. The block erase command is allowed to execute within the region of flash memory.
Note: ● Commands cannot be executed when the ID authorization for the flash programmer has failed.
● The program, the block erase, and the read commands cannot be executed when the address of each
command points to an area that is protected by the access window.
Bit position: 7 6 5 4 3 2 1 0
Note: The security setting command cannot be set to 1 for the corresponding bit of the extra area after 0 is set.
The following information describes mapping for the extra bit of the startup area selection and security setting.
Table 28.5 Mapping for the extra bit of the startup area selection and security setting (address (P/E) :
0x0000_0010)
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
BTFL — — — — FAWE[10:0]
G
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
FSPR — — — — FAWS[10:0]
*1
[OCDID1-4 program]
These commands set the OCDID[127:0] bits.
Table 28.7 OCDID settings
Command OCDID FWBH0 FWBL0
The following information describes mapping for the extra bit of OCDID1-4 program.
Table 28.8 Mapping for the extra bit of OCDID1-4 program (address (P/E) : 0x0000_0018)
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
OCDID[31:16]
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
OCDID[15:0]
Table 28.9 Mapping for the extra bit of OCDID1-4 program (address (P/E) : 0x0000_0020)
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
OCDID[63:48]
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
OCDID[47:32]
Table 28.10 Mapping for the extra bit of OCDID1-4 program (address (P/E) : 0x0000_0028)
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
OCDID[95:80]
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
OCDID[79:64]
Table 28.11 Mapping for the extra bit of OCDID1-4 program (address (P/E) : 0x0000_0030)
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
OCDID[127:112]
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
OCDID[111:96]
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Note: This product does not have the auto increment function of the program command. It is necessary to set the next
address to the FSARH and FSARL registers every time programming flash.
See Figure 28.2 and Figure 28.3 for details on the addresses of the flash memory.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
FWBH0 ● Bits [31:0] of the programming data of the program command for the code flash
FWBL0 ● Bits [7:0] of the programming data of the program command for the data flash
● Bits [31:0] of the programming data of the startup selection and security setting command, the access window
information program command, and the OCDID program command.
Bit position: 7 6 5 4 3 2 1 0
EXRD
Bit field: FRDY — — — — — —
Y
FSTATR1 is a status register used to confirm the execution result of a software command. Each flag is set to 0 when the
next software command is executed.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
FSTATR2 is a status register used to confirm the execution result of a software command. Each error flag is set to 0 when
the next software command is executed.
[Clearing conditions]
● The next software command is executed.
[Clearing conditions]
● The next software command is executed.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
The error address is withdrawn from the FEAMH and FEAML registers after a software command execution. See Figure
28.2 and Figure 28.3 for details on the addresses of the flash memory.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SASM
Bit field: — FSPR — — — — — — — — — — — — —
F
Note 1. The reset value depends on the state of the extra area.
The FSCMR register monitors the extra area setting. Data of this register is updated at the reset sequence or execution of the
software command of the FEXCR register.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Note 1. The value of the blank product is 1. It is set to the same value set in bits [10:0] in the FWBH0 register after the access window
information program command is executed.
Bit position: 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SASM
Bit field: — — — — FAWE[10:0]
F
Note 1. The value of the blank product is 1. It is set to the same value set in bits [10:0] in the FWBL0 register after the access window
information program command is executed.
Address: 0x0101_1070 + n × 4
Bit position: 31 0
The UIDRn is a read-only register that stores a 16-byte ID code (unique ID) for identifying the individual MCU. The
UIDRn register should be read in 32-bit units.
Address: 0x0101_1080 + n × 4
Bit position: 31 0
The PNRn is a read-only register that stores a 16-byte part numbering. The PNRn register should be read in 32-bit units.
Each byte corresponds to the ASCII code representation of the product part number as detailed in product list.
In case of the part number is ’R7FA0E1073CNK’, 16-byte part numbering is stored as follows.
Address 0x0101_1080: ’K’, 0x4B in ASCII code
Address 0x0101_1081: ’N’, 0x4E in ASCII code
Address 0x0101_1082: ’C’, 0x43 in ASCII code
Address 0x0101_1083: ’3’, 0x33 in ASCII code
Address 0x0101_1084: ’7’, 0x37 in ASCII code
Address 0x0101_1085: ’0’, 0x30 in ASCII code
Address 0x0101_1086: ’1’, 0x31 in ASCII code
Address 0x0101_1087: ’E’, 0x45 in ASCII code
Address 0x0101_1088: ’0’, 0x30 in ASCII code
Address 0x0101_1089: ’A’, 0x41 in ASCII code
Address 0x0101_1090: ’F’, 0x46 in ASCII code
Address 0x0101_1091: ’7’, 0x37 in ASCII code
Address 0x0101_1092: ’R’, 0x52 in ASCII code
Address 0x0101_1093: ’’(space) , 0x20 in ASCII code
Address 0x0101_1094: ’’(space) , 0x20 in ASCII code
Address 0x0101_1095: ’’(space) , 0x20 in ASCII code
Address: 0x0101_1090
Bit position: 7 6 5 4 3 2 1 0
The MCUVER is a read-only register that stores a MCU version. The MCUVER register should be read in 8-bit units. The
higher the value, the newer MCU version.
Reset state
Se
tO
e
od
n-
ch
m
t
ip
se
g
in
de
Re
at
Re
bu
er
op
g
se
m
t
al
od
m
or
e
tN
Se
Programmable and erasable areas ● Code flash memory ● Code flash memory
● Data flash memory. ● Data flash memory.
Erasure in block units Possible Possible
Boot program at a reset User area program Depends on debug command
On-chip debug mode 0xFF, …, 0xFF (all bytes 0xFF) Protection disabled The ID code is not checked, the ID code
always matches, and the connection to the
on-chip debugger or serial programmer*1 is
permitted.
Bit [127] = 1, bit [126] = 1, and Protection enabled Matching ID code indicates that
at least one of all 16 bytes is not authentication is complete and connection to
0xFF the on-chip debugger or serial programmer
is permitted.
Mismatching ID code indicates transition to
the ID code protection wait state.
When the ID code sent from the on-chip
debugger or serial programmer is ALeRASE
in ASCII code
(0x414C_6552_4153_45FF_FFFF_FFFF_F
FFF_FFFF),
the content of the user flash area is erased
and all bits in the OSIS register are 1.
However, when the AWS.FSPR bit is 0, the
content of the user flash area is not erased.
Bit [127] = 1 and bit [126] = 0 Protection enabled Matching ID code indicates that
authentication is complete and connection to
the on-chip debugger or serial programmer
is permitted.
Mismatching ID code indicates transition to
the ID code protection wait state.
Bit [127] = 0 Protection enabled The ID code is not checked, the ID code is
always mismatching, the connection to the
on-chip debugger or serial programmer is
prohibited.
Note 1. Never send the ID code from on-chip debugger. Or send ID code 0xFF (all bytes 0xFF) from on-chip debugger.
Self-programming A user program written to memory can also program the flash Normal operating mode
memory. The background operation capability makes it possible to
fetch instructions or otherwise read data from code flash memory
while the data flash memory is programming. As a result, a program
resident in code flash memory can program data flash memory.
SWD programming A dedicated flash-memory programmer or an on-chip debugger On-chip debug mode
connected through SWD can program the on-board flash memory
after the device is mounted on the target system.
A dedicated flash-memory programmer or an on-chip debugger
connected through SWD and a dedicated programming adapter
board allow off-board programming of the flash memory, before it
is mounted on the target system.
Table 28.15 lists the functions of the on-chip flash memory. For self-programming, use the programming commands to read
the on-chip flash memory or run the user program.
Blank check Checks a specified block to ensure that writing to it Supported Supported
has not already proceeded.
Block erasure Erases the memory contents in the specified block Supported Supported
Programming Writes to the specified address Supported Supported
Read Reads data programmed in the flash memory Not supported (read by Not supported
user program is possible)
ID code check Compares the ID code sent by the host with the code Not supported (ID Supported
stored in the code flash memory. If the two match, authentication is not
the FCB enters the wait state for programming and performed)
erasure commands from the host.
Security configuration Configures the protection of security function (Access Supported with conditions Supported with conditions
window and Start-up area selection) See section 28.8. See section 28.8.
Protection Protection
Protection configuration Configures the access window for flash area Supported Supported
protection in the code flash memory
The on-chip flash memory supports the ID code check function. Authentication of ID code check is a security function for
use with SWD programming. Table 28.16 lists the available operations and security settings.
Table 28.16 Available operations and security settings
All security settings and erasure, programming, and read operations
Constraints on the security
Function On-chip debug mode Self-programming mode setting configuration
ID authentication When the ID codes do not match: ● Blank check: supported ID authentication is not
● Block erasure commands: not supported ● Block erasure: supported performed in the Self-
● Programming commands: not supported ● Programming: supported programming mode.
● Read commands: not supported ● Security configuration:
● Security configuration commands: not supported
supported ● Protection configuration:
● Protection configuration commands: not supported.
supported.
When the ID codes match:
● Block erasure commands: supported
● Programming commands: supported
● Read commands: supported
● Security configuration commands: supported
● Protection configuration commands: supported.
0x002C
0x0028 ID[95:64]
0x0024
0x0020 ID[63:32]
0x001C
0x0018 ID[31:0]
0x0014
0x0010 BTFL
G FAWE[10:0] FSPR FAWS[10:0]
0x000C
0x0008
0x0000_3FFF
New start-up Original start-up
No program
program program
(alternate area)
(alternate area) (default area)
0x0000_1FFF
Original start-up Original start-up New start-up
program program program
(default area) (default area) (alternate area)
0x0000_0000
(1) Program a new startup program in the alternate area. If the alternate area fails to be rewritten, the new startup
program can be rewritten again after starting up using the default area, because the original startup program is in
the default area.
(2) After the alternate area is successfully rewritten, the default area and the alternate area are switched using the
self-programming library. After that, the program in the alternate area starts after a reset.
The access window is specified in both the FAWS [10:0] and FAWE [10:0] bits. See section 6.2.3. AWS : Access Window
Setting Register. Setting of the FAWE[10:0] and FAWS[10:0] bits in various conditions is described as follows:
● FAWE [10:0] = FAWS [10:0]: The P/E command can execute anywhere in the user area of the code flash memory
● FAWE [10:0] > FAWS [10:0]: The P/E command can only execute in the window from the block pointed to by the
FAWS bits to one block lower than the block pointed to by the FAWE[10:0] bits
● FAWE [10:0] < FAWS [10:0]: The P/E command cannot execute anywhere in the user area of the code flash memory.
Address
0x0000_FFFF
…
Protected area
Block 8
0x0000_4000
0x0000_3FFF Block 7
(end block)
Block 6
Access
Window Non-protected area
Block 5
Block 4
0x0000_2000 (start block)
0x0000_1FFF
Block 3
Block 2
Protected area
Block 1
Block 0
0x0000_0000
28.8 Protection
The types of protection provided include:
● Startup Program Protection
● Area Protection
Figure 28.8 shows an overview of the Startup Program Protection. In this figure, the default area indicates the 8-KB region
from the start address and the alternate area indicates the next 8-KB region.
0x0000_3FFF
New start-up Orignal start-up
No program
program program
(alternate area)
(alternate area) (default area)
0x0000_1FFF
Orignal start-up Orignal start-up New start-up
program program program
(default area) (default area) (alternate area)
0x0000_0000
Note: (1) Program a new startup program in the alternate area. If the alternate area fails to be rewritten, the new startup program
can be rewritten again after starting up using the default area because the original startup program is in the default area.
(2) After the alternate area is successfully rewritten, the default area and the alternate area are switched using the
self-programming library. After that, the program in the alternate area starts after a reset.
Address
The address :
…
Disabled
That is set to the FWBH0
Block 8 register in executing the
0x0000_4000 access window information
0x0000_3FFF Block 7 program command (the next
(end block) block of the end block of the
access window)
Block 6
Access window Enabled
Block 5
The address :
Block 4 That is set to the FWBL0 register
0x0000_2000 (start block) in executing the access window
0x0000_1FFF
information program command
Block 3 (the start block of the access
window)
Block 2
Disabled
Block 1
Block 0
0x0000_0000
28.9 Self-programming
28.9.1 Overview
The MCU supports programming of the flash memory by the user program. The programming commands can be used with
user programs for writing to the code and data flash memory. This enables updates to the user programs and overwriting of
constant data fields.
In self-programming, it is necessary to supply a stable HOCO clock to the flash memory in order to generate the program
voltage and erase voltage. Therefore, in case that the HOCO is stopped where another clock source is selected as the
system clock, it is necessary to start the HOCO operation and ensure that the oscillation is in a stable state before executing
the self-programming. For details of HOCO clock oscillation stabilization check, see section 8.2.14. OSCSF : Oscillation
Stabilization Flag Register.
The background operation facility makes it possible to execute a program from the code flash memory to program the data
flash memory under the conditions shown in Figure 28.10. This program can also be copied in advance to and executed
from the internal SRAM. When executing from the internal SRAM, this program can also program the code flash memory
area.
Reset
FENTRYR = 0xAA00
FPMCR ← 0x08 *1 Code Flash : read mode
FENTRYR = 0xAA00 FENTRYR = 0xAA01 Data Flash : P/E mode
FPMCR ← 0x08 *1 FPMCR ← 0x82/0xC2 *1
Figure 28.12 Mode transitions to read mode from data flash access disable mode
Note 1. tDIS: Flash memory mode transition wait time 1 (See section 31, Electrical Characteristics.)
Figure 28.13 Procedure for changing from read mode to code flash P/E mode
It is necessary to enter the data flash P/E mode by setting the FENTRYD bit of the FENTRYR register before executing the
software command for the data flash. Figure 28.14 shows the procedure for entering to the data flash P/E Mode.
Note 1. tDSTOP: STOP recovery time (See section 31, Electrical Characteristics.)
Note 2. tDIS: Flash memory mode transition wait time 1 (See section 31, Electrical Characteristics.)
Figure 28.14 Procedure for changing from read mode to data flash P/E mode
(3) Switching the Code Flash or Data Flash P/E Mode to Read Mode
No
FENTRYR = 0x0000 ?
Yes
Note 1. tMS: Flash memory mode transition wait time 2 (See section 31, Electrical Characteristics.)
Figure 28.15 Procedure for changing from code flash P/E mode to read mode
No
FENTRYR = 0x0000 ?
Yes
Note 1. tMS: Flash memory mode transition wait time 2 (See section 31, Electrical Characteristics.)
Figure 28.16 Procedure for changing from data flash P/E mode to read mode
(4) Flowchart for programming the code flash or the data flash
The following figures describe the flow for programming the code flash or the data flash.
If the frequency is
Set frequency in the same value as
FISR.PCKA bit the current one, it
is possible to skip
this step.
Set programming address in
FSARH and FSARL registers
FSTATR1.FRDY bit = 1 ?
No
Yes
FSTATR1.FRDY bit = 0 ?
No
Yes
Sequencer
FSTATR2.ILGLERR bit = 0 ? initialization
FSTATR2.PRGERR bit = 0 ?
No
Yes Write 1 to
FRESETR.FRESET bit
No
If the frequency is
Set frequency in
the same value as
FISR.PCKA bit the current one, it
is possible to skip
Set programming address in this step.
FSARH and FSARL registers
FSTATR1.FRDY bit = 1 ?
No
Yes
FSTATR1.FRDY bit = 0 ?
No
Yes
Sequencer
FSTATR2.ILGLERR bit = 0 ? initialization
FSTATR2.PRGERR bit = 0 ?
No
Yes Write 1 to
FRESETR.FRESET bit
No
If the frequency is
Set frequency in
the same value as
FISR.PCKA bit the current one, it
is possible to skip
this step.
Set start address of the target
erasure block in
FSARH and FSARL registers
FSTATR1.FRDY bit = 1 ?
No
Yes
FSTATR1.FRDY bit = 0 ?
No
Yes
Sequencer
FSTATR2.ILGLERR bit = 0 ? initialization
FSTATR2.ERERR bit = 0 ?
No
Yes Write 1 to
FRESETR.FRESET bit
No
Figure 28.19 Flowchart for the code flash block erase procedure
If the frequency is
Set frequency in
the same value as
FISR.PCKA bit the current one, it
is possible to skip
this step.
Set start address of the target
erasure block in
FSARH and FSARL registers
FSTATR1.FRDY bit = 1 ?
No
Yes
FSTATR1.FRDY bit = 0 ?
No
Yes
Sequencer
FSTATR2.ILGLERR bit = 0 ? initialization
FSTATR2.ERERR bit = 0 ?
No
Yes Write 1 to
FRESETR.FRESET bit
Write 0 to
Continue Data Flash erasure ?
Yes FRESETR.FRESET bit
No
Figure 28.20 Flowchart for the data flash block erase procedure
Code Flash
blank check
FSTATR1.FRDY bit = 1 ?
No
Yes
Write 0x03 to FCR register
Write 0x00 to FCR register
FSTATR1.FRDY bit = 0 ?
No
Yes
Sequencer
FSTATR2.ILGLERR bit = 0 ? initialization
FSTATR2.ERERR bit = 0 ? No
Write 1 to
Yes FRESETR.FRESET bit
No
Figure 28.21 Flowchart for the code flash blank check procedure
Data Flash
blank check
FSTATR1.FRDY bit = 1 ?
No
Yes
Write 0x0B to FCR register
Write 0x00 to FCR register
FSTATR1.FRDY bit = 0 ?
No
Yes
Sequencer
FSTATR2.ILGLERR bit = 0 ? initialization
FSTATR2.ERERR bit = 0 ? No
Write 1 to
Yes FRESETR.FRESET bit
No
Figure 28.22 Flowchart for the data flash blank check procedure
(5) Startup Area Information and FSPR Program/Access Window Information Program/OCDID
information Program
Figure 28.23 is a simple flowchart of the procedure for the startup area information and FSPR program/access window
information program/OCDID information program.
FASR.EXS bit = 1
Write information
FSTATR1.EXRDY bit = 1 ?
No
Yes
*2
Write to FEXCR register
Write 0x00 to FEXCR register
FSTATR1.EXRDY bit = 0 ?
No
Yes
Sequencer
FSTATR2.ILGLERR bit = 0 ? initialization
FSTATR2.ERERR bit = 0 ? No
Write 1 to
Yes FRESETR.FRESET bit
Write 0 to
FASR.EXS bit = 0 FRESETR.FRESET bit
Yes
No
Note: Order of the FSPR Bit Setting by Startup Area Information and FSPR Program
Note 1. Write data :
0x81 : Reserved
0x82 : start-up area information and FSPR bit access window information
0x83 : OCDID1 information
0x84 : OCDID2 information
0x85 : OCDID3 information
0x86 : OCDID4 information
Note 2. 0x0y (y = 1 to 6)
Figure 28.23 Simple flowchart for the procedure for Startup Area Information and FSPR Program/Access
Window Information Program/OCDID information Program
Set the FSPR bit after programing of the startup area information and the access window information. If the FSPR bit
is set before programing of the startup area information and the access window information, the programming cannot
be performed because of the security function in the FSPR. When programming using the hex file, programming in the
ascending order of the address. In this case, the FSPR bit is written before the access window information. Therefore, divide
the hex file for FSPR into another file, and use it after setting the access window information.
No
FSTATR1.FRDY bit = 1 ?
Yes
No
FSTATR1.FRDY bit = 0 ?
Yes
Bit position: 7 6 5 4 3 2 1 0
Bit field:
Bit position: 7 6 5 4 3 2 1 0
1:0 — These bits are read as 0. The write value should be 0. R/W
2 SGSTART Seed Generation Start W
0: No effect
1: Start to generate the seed data
Bit position: 7 6 5 4 3 2 1 0
29.3 Operation
1 Module stop setting Set the MSTPCRC.MSTPC28 = 0 to cancel the module-stop state.
2 Wait Wait for the peripheral module clock (PCLKB) × 6.
3 TRNG enable setting Set the TRNGSCR0.SGCEN = 1 to enable the true random number generator.
4 TRNG interrupt setting Set the TRNGSCR1.INTEN bit to enable/disable the TRNG interrupt output.
5 TRNG operation start setting Set the TRNGSCR0.SGSTART = 1 to start the generation of a random number seed.
6 Read the seed data There are 2 operation for TRNG seed generation, Polling and Interrupt.
1. Polling operation ; Read TRNGSDR for 4 times after the TRNGSCR0.RDRDY = 1
2. Interrupt operation ; Read TRNGSDR register for 4 times after TRNG interrupt is generated.
7 TRNG operation stop setting Set the TRNGSCR0.SGCEN = 0 to disable the true random number generator. Set the
TRNGSCR0.SGSTART = 0 to stop the generation of a random number seed.
8 Module stop setting Set the MSTPCRC.MSTPC28 = 1 to enter the module-stop state.
This regulator supplies voltage to all internal circuits and memory except for I/O and analog domains.
30.2 Operation
Table 30.1 lists the LDO pin settings, and Figure 30.1 shows the LDO settings.
Table 30.1 LDO pin
Pins Setting descriptions
VCC VCL
Internal
logic and memory
Output voltage P100 to P103, P108 to P110, P112, P201, P206 to VO1 -0.3 to VCC + 0.3*2 V
P208, P300, P407
P913, P914 (N-ch open-drain) VO2 -0.3 to +6.5 V
High-level output current P100 to P103, P108 Per pin IOH1 -40 mA
to P110, P112, P201
to P207, P208, P300, Total of all pins -100 mA
P407
P008 to P015, P212, Per pin IOH2 -5 mA
P213
Total of all pins -20 mA
Low-level output current P100 to P103, P108 to Per pin IOL1 40 mA
P110, P112, P201, P206
to P208, P300, P407, Total of all pins 100 mA
P913, P914
P008 to P015, P212, Per pin IOL2 10 mA
P213
Total of all pins 20 mA
Ambient operating In normal operation mode Ta -40 to +105 °C
temperature
In flash memory programming mode -40 to +105 °C
Storage temperature Tstg -65 to +150 °C
Note 1. Connect the VCL pin to VSS via a capacitor (0.47 to 1 µF). The listed value is the absolute maximum rating of the VCL pins. Only
use the capacitor connection. Do not apply a specific voltage to this pin.
Note 2. This voltage must be no higher than 6.5 V.
Note 3. The voltage on a pin in use for A/D conversion must not exceed VREFH0 + 0.3.
Note: The characteristics of functions multiplexed on a given pin are the same as those for the port pin unless otherwise
specified.
Note: VREFH0 refers to the positive reference voltage of the A/D converter.
Caution: Product quality may suffer if the absolute maximum rating is exceeded even momentarily for any
parameter. That is, the absolute maximum ratings are rated values at which the product is on the verge of
suffering physical damage, and therefore the product must be used under conditions that ensure that the
absolute maximum ratings are not exceeded.
Note: Make sure that Tj = Ta + θja × total power consumption (W), where total power consumption = (VCC - VOH) × ΣIOH +
VOL × ΣIOL + ICCmax × VCC.
Main clock oscillation allowable input cycle time*1 Ceramic resonator 0.05 — 1 µs —
Crystal resonator
Note 1. The listed time and frequency indicate permissible ranges of the oscillator. For actual applications, request evaluation by the
manufacturer of the oscillator circuit mounted on a board so you can use appropriate values. Refer to AC Characteristics for
instruction execution time.
Note: Since the CPU is started by the high-speed on-chip oscillator clock after release from the reset state, the user
should use the oscillation stabilization time counter status register (OSTC) to check the X1 clock oscillation
stabilization time. Specify the values for the oscillation stabilization time in the OSTC register and the oscillation
stabilization time select register (OSTS) after having sufficiently evaluated the oscillation stabilization time with the
resonator to be used.
Note 1. The listed time and frequency indicate permissible ranges of the oscillator. For actual applications, request evaluation by the
manufacturer of the oscillator circuit mounted on a board so you can use appropriate values. Refer to AC Characteristics for
instruction execution time.
31.3 DC Characteristics
Allowable high-level Per pin for P100 to P103, IOH1 — — -10*2 mA 1.6 V ≤ VCC ≤ 5.5 V
output current*1 P108 to P110, P112,
P201, P206 to P208,
P300, P407
Total of all pins — — -80*4 mA 4.0 V ≤ VCC ≤ 5.5 V
(when duty ≤ 70%*3)
— — -19 mA 2.7 V ≤ VCC < 4.0 V
— — -10 mA 1.8 V ≤ VCC < 2.7 V
— — -5 mA 1.6 V ≤ VCC < 1.8 V
Per pin for P008 to P015, IOH2 — — -3*2 mA 4.0 V ≤ VCC ≤ 5.5 V
P212, P213
— — -1*2 mA 2.7 V ≤ VCC < 4.0 V
Note: The following pins are not capable of the output of high-level signals in the N-ch open-drain mode.
P100 to P103, P109, P110, P112, P201, P207, P208, P212, P213 and P407.
Note: The characteristics of functions multiplexed on a given pin are the same as those for the port pin unless otherwise
specified.
Allowable low-level output Per pin for P100 to P103, IOL1 — — 20*2 mA —
current*1 P108 to P110, P112,
P201, P206 to P208,
P300, P407
Per pin for P913, P914 — — 15*2 mA —
Note: The characteristics of functions multiplexed on a given pin are the same as those for the port pin unless otherwise
specified.
Input voltage, high P100 to P103, Normal input VIH1 VCC × 0.8 — VCC V —
P108 to P110, buffer
P112, P200,
P201, P206 to
P208, P300,
P407
P100 to P103, TTL input buffer VIH2 2.2 — VCC V 4.0 V ≤ VCC ≤ 5.5 V
P108 to P110,
P112, P201, 2.0 — VCC V 3.3 V ≤ VCC < 4.0 V
P207, P208, 1.5 — VCC V 1.6 V ≤ VCC < 3.3 V
P300, P407
P008 to P015 VIH3 VCC × 0.7 — VCC V —
Input voltage, low P100 to P103, Normal input VIL1 0 — VCC × 0.2 V —
P108 to P110, buffer
P112, P200,
P201, P206 to
P208, P300,
P407
P100 to P103, TTL input buffer VIL2 0 — 0.8 V 4.0 V ≤ VCC ≤ 5.5 V
P108 to P110,
P112, P201, 0 — 0.5 V 3.3 V ≤ VCC < 4.0 V
P207, P208, 0 — 0.32 V 1.6 V ≤ VCC < 3.3 V
P300, P407
P008 to P015 VIL3 0 — VCC × 0.3 V —
Note: The maximum value of VIH of pins P100 to P103, P109, P110, P112, P201, P207, P208, P212, P213 and P407 is
VCC, even in the N-ch open-drain mode.
Note: The characteristics of functions multiplexed on a given pin are the same as those for the port pin unless otherwise
specified.
Output voltage, high P100 to P103, P108 to VOH1 VCC - 1.5 — — V 4.0 V ≤ VCC ≤ 5.5 V
P110, P112, P201, P206 IOH1 = -10 mA
to P208, P300, P407
VCC - 0.7 — — V 4.0 V ≤ VCC ≤ 5.5 V
IOH1 = -3 mA
Output voltage, low P100 to P103, P108 to VOL1 — — 1.3 V 4.0 V ≤ VCC ≤ 5.5 V
P110, P112, P201, P206 IOL1 = 20 mA
to P208, P300, P407
— — 0.7 V 4.0 V ≤ VCC ≤ 5.5 V
IOL1 = 8.5 mA
Note: P100 to P103, P109, P110, P112, P201, P207, P208, P212, P213 and P407 do not output high-level signals in the
N-ch open-drain mode.
Note: The characteristics of functions multiplexed on a given pin are the same as those for the port pin unless otherwise
specified.
Note: The characteristics of functions multiplexed on a given pin are the same as those for the port pin unless otherwise
specified.
Supply High- Normal All peripheral clocks ICLK = 32 MHz Icc 2.7 — mA —
current*1 speed mode disabled, CoreMark
mode*2 code executing
from flash
All peripheral clocks ICLK = 32 MHz — 5.0 —
enabled, CoreMark
code executing
from flash*6
Sleep All peripheral clocks ICLK = 32 MHz 0.82 — —
mode disabled
All peripheral clocks ICLK = 32 MHz — 2.7 —
enabled*6
Middle- Normal All peripheral clocks ICLK = 24 MHz 2.1 — —
speed mode disabled, CoreMark
code executing ICLK = 16 MHz 1.5 — —
mode*2
from flash ICLK = 8 MHz 1.0 — —
ICLK = 4 MHz 0.70 — —
All peripheral clocks ICLK = 24 MHz — 3.8 —
enabled, CoreMark
code executing ICLK = 16 MHz — 2.7 —
from flash *6
ICLK = 8 MHz — 1.6 —
ICLK = 4 MHz — 1.1 —
Sleep All peripheral clocks ICLK = 24 MHz 0.67 — —
mode disabled
ICLK = 16 MHz 0.61 — —
ICLK = 8 MHz 0.50 — —
ICLK = 4 MHz 0.44 — —
All peripheral clocks ICLK = 24 MHz — 2.1 —
enabled*6
ICLK = 16 MHz — 1.6 —
ICLK = 8 MHz — 1.1 —
ICLK = 4 MHz — 0.8 —
Low- Normal All peripheral clocks ICLK = 2 MHz 180 — µA —
speed mode disabled, CoreMark
mode*3 code executing
from flash
All peripheral clocks ICLK = 2 MHz — 323 —
enabled, CoreMark
code executing
from flash*6
Sleep All peripheral clocks ICLK = 2 MHz 47 — —
mode disabled
All peripheral clocks ICLK = 2 MHz — 161 —
enabled*6
Supply Subosc- Normal Peripheral clocks ICLK = 32.768 kHz Ta = -40°C Icc 3.3 — µA —
current*1 speed mode disabled
Ta = 25°C 3.7 —
mode*4
Ta = 50°C 3.9 —
Ta = 70°C 4.3 —
Ta = 85°C 4.8 —
Ta = 105°C 6.2 —
Peripheral clocks ICLK = 32.768 kHz Ta = -40°C — 7.2
enabled*7
Ta = 25°C — 7.9
Ta = 50°C — 9.6
Ta = 70°C — 13.0
Ta = 85°C — 18.8
Ta = 105°C — 36.5
Sleep Peripheral clocks ICLK = 32.768 kHz Ta = -40°C 1.0 — —
mode disabled
Ta = 25°C 1.3 —
Ta = 50°C 1.5 —
Ta = 70°C 1.8 —
Ta = 85°C 2.2 —
Ta = 105°C 3.2 —
Peripheral clocks ICLK = 32.768 kHz Ta = -40°C — 4.8
enabled*7
Ta = 25°C — 5.4
Ta = 50°C — 7.0
Ta = 70°C — 10.5
Ta = 85°C — 16.1
Ta = 105°C — 33.3
Note 1. Supply current is the total current flowing into VCC. Supply current values apply when internal pull-up MOSs are in the off state and
these values do not include output charge/discharge current from any of the pins.
Note 2. The clock source is high-speed on-chip oscillator (HOCO).
Note 3. The clock source is middle-speed on-chip oscillator (MOCO).
Note 4. The clock source is the Sub-clock oscillator (SOSC) and CMC.SODRV[1:0] are 10b (Low power mode 2).
Note 5. VCC = 3.3 V.
Note 6. Includes operating current for PCLBUZ, TAU, SAU, and IICA functions only. For other peripheral operating currents, please add the
current in Peripheral Functions Supply current in Table 31.14.
Note 7. Includes operating current for PCLBUZ, TAU and SAU functions only. For other peripheral operating currents, please add the
current in Table 31.14.
Supply Software Peripheral PSMCR.RA All SRAMs Ta = -40°C Icc 0.20 1.1 µA —
current Standby modules MSD[1:0] (0x2000_4000 to
*1 stop are 00b 0x2000_6FFF) are Ta = 25°C 0.20 1.1
mode*2
on Ta = 50°C 0.30 2.4
Ta = 70°C 0.50 5.5
Ta = 85°C 0.80 11
Ta = 105°C 1.8 28
PSMCR.RA Only 4KB SRAM Ta = -40°C 0.20 1.1 —
MSD[1:0] (0x2000_4000 to
are 11b 0x2000_4FFF) is on Ta = 25°C 0.20 1.1
Ta = 50°C 0.30 2.4
Ta = 70°C 0.50 5.0
Ta = 85°C 0.70 10
Ta = 105°C 1.7 25
Note 1. Supply current is the total current flowing into VCC. Supply current values apply when internal pull-up MOSs are in the off state and
these values do not include output charge/discharge current from any of the pins.
Note 2. The IWDT and LVD are not operating.
Note 3. VCC = 3.3 V.
Peripheral High-speed on chip oscillator operating OFS1.HOCOFRQ1[2:0] are 010b IHOCO 320 — µA —
Functions current*1
Supply
current*1 Middle-speed on chip oscillator operating current*1 IMOCO 20 — µA —
Independent watchdog timer operating fLOCO = 32.768 kHz (typ.) IIWDT 0.03 — µA —
current*1*2*5
A/D converter When conversion at Normal mode, VREFH0 = VCC = IADC 0.81 1.6 mA —
operating maximum speed 5.0 V
current*1*6
Low voltage mode, VREFH0 = 0.46 0.75 mA —
VCC = 3.0 V
When the low-speed on-chip oscillator (LOCO) is selected, ILOCO should be included in the supply current.
When the Sub-clock oscillator (SOSC) is selected, ISOSC should be included in the supply current.
Note 4. This current only flows to the 32-bit interval timer. It does not include the operating current of the low-speed on-chip oscillator
(LOCO) or Sub-clock oscillator (SOSC).
The supply current of the RA0 microcontrollers is the sum of either Icc and IIT.
When the low-speed on-chip oscillator (LOCO) is selected, ILOCO should be included in the supply current.
When the Sub-clock oscillator (SOSC) is selected, ISOSC should be included in the supply current.
Note 5. This current only flows to the independent watchdog timer. It does not include the operating current of the low-speed on-chip
oscillator (LOCO) .
The supply current of the RA0 microcontrollers is the sum of either Icc, IIWDT and ILOCO.
Note 6. This current only flows to the A/D converter. The supply current of the RA0 microcontrollers is the sum of Icc and IADC when the A/D
converter is operating or in the SLEEP mode.
Note 7. This current flows into VREFH0.
Note 8. This current only flows to the LVD0 circuit. The supply current of the RA0 microcontrollers is the sum of Icc and ILVD0 when the
LVD0 circuit is in operation.
Note 9. This current only flows to the LVD1 circuit. The supply current of the RA0 microcontrollers is the sum of Icc and ILVD1 when the
LVD1 circuit is in operation.
Note 10. This current only flows during self programming.
Note 11. This current only flows while the data flash memory is being rewritten.
Note 12. VCC = 3.3 V.
Thermal Resistance 32-pin LQFP θja 68.4 ℃/W JESD 51-2 and 51-7
compliant
32-pin HWQFN 24.8
24-pin HWQFN 25.3
20-pin LSSOP 64.2
16-pin HWQFN 30.7
32-pin LQFP Ψjt 7.87 ℃/W JESD 51-2 and 51-7
compliant
32-pin HWQFN 0.38
24-pin HWQFN 0.39
20-pin LSSOP 3.34
16-pin HWQFN 0.48
Note 1. The values are reference values when the 4-layer board is used. Thermal resistance depends on the number of layers or size of the
board. For details, refer to the JEDEC standards.
31.4 AC Characteristics
Table 31.16 AC characteristics
Conditions: VCC = 1.6 to 5.5 V, VSS = 0 V, Ta = -40 to +105°C
Parameter Symbol Min Typ Max Unit Test conditions
Instruction cycle Main system clock High- TCY 0.03125 — 1 µs 1.8 V ≤ VCC ≤ 5.5 V
(minimum (FMAIN) operation speed
instruction mode 0.25 — 1 µs 1.6 V ≤ VCC < 1.8 V
execution time)
Middle- 0.04167 — 1 µs 1.8 V ≤ VCC ≤ 5.5 V
speed
mode 0.25 — 1 µs 1.6 V ≤ VCC < 1.8 V
TO00 to TO07 output frequency High- fTO — — 16 MHz 4.0 V ≤ VCC ≤ 5.5 V
speed
mode — — 8 MHz 2.7 V ≤ VCC < 4.0 V
Middle- — — 4 MHz 1.8 V ≤ VCC < 2.7 V
speed
mode — — 2 MHz 1.6 V ≤ VCC < 1.8 V
10
1.0
In normal operation
Cycle time TCY [µs]
0.25
0.1
0.05
0.03125
0.01
0 1.0 2.0 3.0 4.0 5.0 6.0
1.6 1.8 5.5
Supply voltage VCC [V]
10
1.0
In normal operation
Cycle time TCY [µs]
0.25
0.1
0.05
0.04167
0.01
0 1.0 2.0 3.0 4.0 5.0 6.0
1.6 1.8 5.5
Supply voltage VCC [V]
10
1.0
In normal operation
Cycle time TCY [µs]
0.5
0.1
0.05
0.01
0 1.0 2.0 3.0 4.0 5.0 6.0
1.6 5.5
1/fEX
tEXL tEXH
EXCLK
tTIL tTIH
TI00 to TI07
1/fTO
TO00 to TO07
tIRQL tIRQH
Wait time after RES cancellation LVD0 enabled*1 tRESWT — 0.506 0.694 ms —
(at power-on)
LVD0 disabled*2 — 0.201 0.335 ms —
Wait time after RES cancellation LVD0 enabled*1 tRESWT2 — 0.476 0.616 ms —
(during powered-on state)
LVD0 disabled*2 — 0.170 0.257 ms —
Internal reset by Independent watch dog timer reset, SRAM tRESW2 — 0.04 0.041 ms —
parity error reset, software reset
Note 1. When OFS1.LVDAS = 0.
Note 2. When OFS1.LVDAS = 1.
Note 3. When RES pin is not used as the external reset input, this specification can be ignore.
VCC
RES
tRESWP
Internal reset
tRESWT
tRESW
RES
Internal reset
tRESWT2
tRESW2
Internal reset
Recovery High-speed Crystal resonator System clock source tSBYMC — 1.64 — ms Figure 31.12
time from mode connected to main clock is main clock oscillator
Software oscillator (20 MHz)*2
Standby VCC = 1.8 V to 5.5 V
mode*1
System clock source — 8.19 — ms
is main clock oscillator
(4 MHz)*2
VCC = 1.6 V to 1.8 V
External clock input to System clock source tSBYEX — 2.8 2.8 µs
main clock oscillator is main clock oscillator
(20 MHz)
VCC = 1.8 V to 5.5 V
System clock source — 13.8 14.0 µs
is main clock oscillator
(4 MHz)
VCC = 1.6 V to 1.8 V
System clock source is System clock source tSBYHO — 4.2 4.6 µs
HOCO is HOCO (32 MHz)
VCC = 1.8 V to 5.5 V
SBYCR.FWKUP = 0
System clock source — 0.9 1.1 µs
is HOCO (32 MHz)
VCC = 1.8 V to 5.5 V
SBYCR.FWKUP = 1
System clock source — 5.2 5.6 µs
is HOCO (4 MHz)
VCC = 1.6 V to 1.8 V
System clock source is MOCO (4 MHz) tSBYMO — 3.3 4.2 µs
Note 1. The division ratio of ICLK is the minimum division ratio within the allowable frequency range.
The recovery time is determined by the system clock source.
Note 2. The Oscillation Stabilization Time Select Register (OSTS) is set to 0x05.
Recovery Middle-speed Crystal System clock source tSBYMC — 1.64 — ms Figure 31.12
time from mode resonator is main clock
Software connected to oscillator (20 MHz)*2
Standby main clock VCC = 1.8 V to 5.5 V
mode*1 oscillator
System clock source — 8.19 — ms
is main clock
oscillator (4 MHz)*2
VCC = 1.6 V to 1.8 V
External clock System clock source tSBYEX — 2.8 2.8 µs
input to main is main clock
clock oscillator oscillator (20 MHz)
VCC = 1.8 V to 5.5 V
System clock source — 13.8 14.0 µs
is main clock
oscillator (4 MHz)
VCC = 1.6 V to 1.8 V
System clock System clock source tSBYHO — 5.1 5.5 µs
source is HOCO is HOCO (24 MHz)
VCC = 1.8 V to 5.5 V
System clock source — 5.6 6.1 µs
is HOCO (3 MHz)
VCC = 1.6 V to 1.8 V
System clock source is MOCO (4 MHz) tSBYMO — 3.3 4.2 µs
Note 1. The division ratio of ICLK is the minimum division ratio within the allowable frequency range.
The recovery time is determined by the system clock source.
Note 2. The Oscillation Stabilization Time Select Register (OSTS) is set to 0x05.
Recovery time Low-speed Crystal System clock source tSBYMC — 4.1 — ms Figure 31.12
from Software mode resonator is main clock oscillator
Standby connected to (2 MHz)*2
mode*1 main clock
oscillator
External clock System clock source tSBYEX — 27.5 28.0 µs
input to main is main clock oscillator
clock oscillator (2 MHz)*2
System clock source is MOCO (2 MHz) tSBYMO — 6.0 7.5 µs
Note 1. The division ratio of ICLK is the minimum division ratio within the allowable frequency range.
The recovery time is determined by the system clock source.
Note 2. The Oscillation Stabilization Time Select Register (OSTS) is set to 0x05.
Crystal resonator frequency is 8 MHz and the MOSC Clock Division Register (MOSCDIV) is set to 0x02.
Recovery time Subosc-speed System clock SBYCR.RTCLPC = 0 tSBYSC — 0.29 0.31 ms Figure 31.12
from Software mode source is sub-
Standby clock oscillator SBYCR.RTCLPC = 1 — 0.32 0.34 ms
mode*1 (32.768 kHz)
System clock source is LOCO (32.768 kHz) tSBYLO — 0.29 0.36 ms
Note 1. The sub-clock oscillator or LOCO itself continues oscillating in Software Standby mode during Subosc-speed mode.
Oscillator
ICLK
IRQ
tSBYMC, tSBYEX,
tSBYMO, tSBYHO
Oscillator
ICLK
IRQ
tSBYSC, tSBYLO
Recovery time from High-speed SBYCR.FWKUP = 0 tSNZ — 4.1 4.4 µs Figure 31.13
Software Standby mode System
mode to Snooze clock source is SBYCR.FWKUP = 1 — 0.9 1.0 µs
mode HOCO
Middle-speed mode tSNZ — 4.2 4.4 µs
System clock source is HOCO (24 MHz)
VCC = 1.8 V to 5.5 V
Middle-speed mode tSNZ — 4.8 5.3 µs
System clock source is HOCO (3 MHz)
VCC = 1.6 V to 1.8 V
Low-speed mode tSNZ — 4.0 5.4 µs
System clock source is MOCO (2 MHz)
Oscillator
ICLK
IRQ
Figure 31.13 Recovery timing from Software Standby mode to Snooze mode
Transfer 1.6 V ≤ VCC ≤ 5.5 V — — fMCK/6 — fMCK/6 — fMCK/6 bps Figure 31.15
rate*1
Theoretical value of the — 5.3 — 4 — 0.33 Mbps
maximum transfer rate
fMCK = PCLKB*2
Note 1. The transfer rate in the SNOOZE mode is within the range from 4800 to 9600 bps.
Note 2. The maximum operating frequencies of the peripheral module clock (PCLKB) are as follows.
High-speed mode: 32 MHz (1.8 V ≤ VCC ≤ 5.5 V), 4 MHz (1.6 V ≤ VCC ≤ 5.5 V)
Middle-speed mode: 24 MHz (1.8 V ≤ VCC ≤ 5.5 V), 4 MHz (1.6 V ≤ VCC ≤ 5.5 V)
Low-speed mode: 2 MHz (1.6 V ≤ VCC ≤ 5.5 V)
Note: Select the normal input buffer for the RXDq pin and the normal output mode for the TXDq pin by using the Port gh
Pin Function Select Register (PghPFS_A.PIM and PghPFS_A.NCODR).
gh: Port number (gh = 100, 101, 109, 110, 212, 213)
TXDq RX
RA0
User device
microcontroller
RXDq TX
Figure 31.14 Connection in the UART communications with devices operating at same voltage levels
1/Transfer rate
High-/low-bit width
Baud rate error tolerance
TXDq
RXDq
Figure 31.15 Bit width in the UART communications when interfacing devices operate at the same voltage
level (reference)
Note: ● q: UART number (q = 0 to 2), gh: Port number (gh = 100, 101, 109, 110, 212, 213)
● fMCK: Serial array unit operation clock frequency
To set this operating clock, set the CKS bit in the serial mode register mn (SMRmn).
m: Unit number, n: Channel number (mn = 00, 01, 02, 03, 10, 11)
Table 31.24 In simplified SPI communications in the master mode with devices operating at same voltage levels
with the internal SCKp clock (the ratings below are only applicable to SPI00)
Conditions: VCC = 2.7 to 5.5 V, VSS = 0 V, Ta = -40 to +85°C
High-speed mode Middle-speed mode Low-speed mode
Test
Parameter Symbol Min. Max. Min. Max. Min. Max. Unit Conditions
SCKp cycle time tKCY1 ≥ 2/ 4.0 V ≤ VCC ≤ 5.5 V tKCY1 62.5 — 83.3 — 1000 — ns Figure 31.17
PCLKB Figure 31.18
2.7 V ≤ VCC ≤ 5.5 V 83.3 — 125 — 1000 — ns
SCKp high-/ low- 4.0 V ≤ VCC ≤ 5.5 V tKH1, tKL1 tKCY1/2 - 7 — tKCY1/2 - 10 — tKCY1/2 - 50 — ns
level width
2.7 V ≤ VCC ≤ 5.5 V tKCY1/2 - 10 — tKCY1/2 - 15 — tKCY1/2 - 50 — ns
Note 1. The setting applies when SCRmn.DCP0[1:0] = 00b or 11b. The setting for the SIp setup time becomes to SCKp↓ and that for the
SIp hold time becomes from SCKp↓ when SCRmn.DCP0[1:0] = 01b or 10b.
Note 2. This setting applies when SCRmn.DCP0[1:0] = 00b or 11b. The setting for the delay time to SOp output becomes from SCKp↑ when
SCRmn.DCP0[1:0] = 01b or 10b.
Note 3. C is the load capacitance of the SCKp and SOp output lines.
Note: Select the normal input buffer for the SIp pin and the normal output mode for the SOp pin and SCKp pin by using
the Port gh Pin Function Select Register (PghPFS_A.PIM and PghPFS_A.NCODR).
Note: ● The listed times are only valid when the peripheral I/O redirect function of SPI00 is not in use.
● p: Simplified SPI number (p = 00), m: Unit number (m = 0), n: Channel number (n = 0), gh: Port number (gh =
100 to 103, 112, 201)
● fMCK: Serial array unit operation clock frequency
To set this operating clock, use the CKS bit in the serial mode register mn (SMRmn).
m: Unit number, n: Channel number (mn = 00)
Table 31.25 In simplified SPI communications in the master mode with devices operating at same voltage levels
with the internal SCKp clock
Conditions: VCC = 1.6 to 5.5 V, VSS = 0 V, Ta = -40 to +105°C
High-speed mode Middle-speed mode Low-speed mode
Test
Parameter Symbol Min. Max. Min. Max. Min. Max. Unit Conditions
SCKp cycle time tKCY1 ≥ 4/ 2.7 V ≤ VCC ≤ 5.5 V tKCY1 125 — 166 — 2000 — ns Figure 31.17
PCLKB Figure 31.18
2.4 V ≤ VCC ≤ 5.5 V 250 — 250 — 2000 — ns
SCKp high-/ low-level 4.0 V ≤ VCC ≤ 5.5 V tKH1, tKL1 tKCY1/2 - 12 — tKCY1/2 - 21 — tKCY1/2 - 50 — ns
width
2.7 V ≤ VCC ≤ 5.5 V tKCY1/2 - 18 — tKCY1/2 - 25 — tKCY1/2 - 50 — ns
Note 1. This setting applies when SCRmn.DCP[1:0] = 00b or 11b. The setting for the SIp setup time becomes to SCKp↓ and that for the SIp
hold time becomes from SCKp↓ when SCRmn.DCP[1:0] = 01b or 10b.
Note 2. This setting applies when SCRmn.DCP[1:0] = 00b or 11b. The setting for the delay time to SOp output becomes from SCKp↑ when
SCRmn.DCP[1:0] = 01b or 10b.
Note 3. C is the load capacitance of the SCKp and SOp output lines.
Note: Select the normal input buffer for the SIp pin and the normal output mode for the SOp pin and SCKp pin by using
the Port gh Pin Function Select Register (PghPFS_A.PIM and PghPFS_A.NCODR).
Note: ● p: Simplified SPI number (p = 00, 11, 20), m: Unit number (m = 0, 1), n: Channel number (n = 0, 3), gh: Port
number (gh= 100 to 103, 109, 110, 112, 201, 212, 213, 407)
● fMCK: Serial array unit operation clock frequency
To set this operating clock, use the CKS bit in the serial mode register mn (SMRmn).
m: Unit number, n: Channel number (mn = 00, 03, 10)
Table 31.26 In simplified SPI communications in the slave mode with devices operating at same voltage levels
with the SCKp external clock
Conditions: VCC = 1.6 to 5.5 V, VSS = 0 V, Ta = -40 to +105°C
High-speed mode Middle-speed mode Low-speed mode
Test
Item Conditions Symbol Min. Max. Min. Max. Min. Max. Unit Conditions
SCKp cycle 4.0 V ≤ VCC ≤ 5.5 V 20 MHz < fMCK tKCY2 8/fMCK — 8/fMCK — — — ns Figure
time*4 31.17
fMCK ≤ 20 MHz 6/fMCK — 6/fMCK — 6/fMCK — ns Figure
31.18
2.7 V ≤ VCC ≤ 5.5 V 16 MHz < fMCK 8/fMCK — 8/fMCK — — — ns
SIp setup time 2.7 V ≤ VCC ≤ 5.5 V tSIK2 1/fMCK + 20 — 1/fMCK + 30 — 1/fMCK + 30 — ns
(to SCKp↑)*1
1.8 V ≤ VCC ≤ 5.5 V 1/fMCK + 30 — 1/fMCK + 30 — 1/fMCK + 30 — ns
SIp hold time 1.8 V ≤ VCC ≤ 5.5 V tKSI2 1/fMCK + 31 — 1/fMCK + 31 — 1/fMCK + 31 — ns
(from SCKp↑)*1
1.6 V ≤ VCC ≤ 5.5 V 1/fMCK + — 1/fMCK + 250 — 1/fMCK + 250 — ns
250
Delay time from C = 30 pF*3 2.7 V ≤ VCC ≤ 5.5 V tKSO2 — 2/fMCK + — 2/fMCK + — 2/fMCK + ns
SCKp↓ to SOp 44 110 110
output*2
2.4 V ≤ VCC ≤ 5.5 V — 2/fMCK + — 2/fMCK + — 2/fMCK + ns
75 110 110
Note 1. This setting applies when SCRmn.DCP[1:0] = 00b or 11b. The setting for the SIp setup time becomes to SCKp↓ and that for the SIp
hold time becomes from SCKp↓ when SCRmn.DCP[1:0] = 01b or 10b.
Note 2. This setting applies when SCRmn.DCP[1:0] = 00b or 11b. The setting for the delay time to SOp output becomes from SCKp↑ when
SCRmn.DCP[1:0] = 01b or 10b.
Note 3. C is the load capacitance of the SOp output line.
Note 4. Transfer rate in the SNOOZE mode is 1 Mbps at the maximum.
Note: Select the normal input buffer for the SIp pin and SCKp pin and the normal output mode for the SOp pin by using
the Port gh Pin Function Select Register (PghPFS_A.PIM and PghPFS_A.NCODR).
Note: ● p: Simplified SPI number (p = 00, 11, 20), m: Unit number (m = 0, 1), n: Channel number (n = 0, 3), gh: Port
number (gh = 100 to 103, 109, 110, 112, 201, 212, 213, 407)
● fMCK: Serial array unit operation clock frequency
To set this operating clock, use the CKS bit in the serial mode register mn (SMRmn).
m: Unit number, n: Channel number (mn = 00, 03, 10)
SCKp SCK
RA0
SIp SO User device
microcontroller
SOp SI
Figure 31.16 Connection in the simplified SPI communications with devices operating at same voltage
levels
tKCY1, 2
tKL1, 2 tKH1, 2
SCKp
tSIK1, 2 tKSI1, 2
tKSO1, 2
Figure 31.17 Timing of serial transfer in the simplified SPI communications with devices operating at same
voltage levels when SCRmn.DCP[1:0] = 00b or 11b
tKCY1, 2
tKH1, 2 tKL1, 2
SCKp
tSIK1, 2 tKSI1, 2
tKSO1, 2
Figure 31.18 Timing of serial transfer in the simplified SPI communications with devices operating at same
voltage levels when SCRmn.DCP[1:0] = 01b or 10b
Table 31.27 In simplified IIC communications with devices operating at same voltage levels (1 of 2)
Conditions: VCC = 1.6 to 5.5 V, VSS = 0 V, Ta = -40 to +105°C
High-speed mode Middle-speed mode Low-speed mode
Test
Parameter Symbol Min. Max. Min. Max. Min. Max. Unit Conditions
SCLr clock 2.7 V ≤ VCC ≤ 5.5 V, fSCL — 1000*1 — 1000*1 — 400*1 kHz Figure 31.20
frequency Cb = 50 pF,
Rb = 2.7 kΩ
Hold time when 2.7 V ≤ VCC ≤ 5.5 V, tLOW 475 — 475 — 1150 — ns
SCLr is low Cb = 50 pF,
Rb = 2.7 kΩ
Hold time when 2.7 V ≤ VCC ≤ 5.5 V, tHIGH 475 — 475 — 1150 — ns
SCLr is high Cb = 50 pF,
Rb = 2.7 kΩ
Table 31.27 In simplified IIC communications with devices operating at same voltage levels (2 of 2)
Conditions: VCC = 1.6 to 5.5 V, VSS = 0 V, Ta = -40 to +105°C
High-speed mode Middle-speed mode Low-speed mode
Test
Parameter Symbol Min. Max. Min. Max. Min. Max. Unit Conditions
Data setup time 2.7 V ≤ VCC ≤ 5.5 V, tSU:DAT 1/fMCK + 85*2 — 1/fMCK +85*2 — 1/fMCK +145*2 — ns Figure 31.20
(reception) Cb = 50 pF,
Rb = 2.7 kΩ
1.8 V ≤ VCC < 2.7 V, 1/fMCK + 230*2 — 1/fMCK + 230*2 — 1/fMCK + 230*2 — ns
Cb = 100 pF,
Rb = 5 kΩ
1.6 V ≤ VCC < 1.8 V, 1/fMCK + 290*2 — 1/fMCK + 290*2 — 1/fMCK + 290*2 — ns
Cb = 100 pF,
Rb = 5 kΩ
Data hold time 2.7 V ≤ VCC ≤ 5.5 V, tHD:DAT 0 305 0 305 0 305 ns
(transmission) Cb = 50 pF,
Rb = 2.7 kΩ
Note: Select the normal input buffer and the N-ch open drain output [withstand voltage of VCC] mode for the SDAr pin and
the normal output mode for the SCLr pin by using the Port gh Pin Function Select Register (PghPFS_A.PIM and
PghPFS_A.NCODR).
VCC
Rb
SDAr SDA
RA0
User device
microcontroller
SCLr SCL
Figure 31.19 Connection in the simplified IIC communications with devices operating at same voltage
levels
1/fSCL
tLOW tHIGH
SCLr
SDAr
tHD:DAT tSU:DAT
Figure 31.20 Timing of serial transfer in the simplified IIC communications with devices operating at same
voltage levels
Note: ● Rb[Ω]: Communication line (SDAr) pull-up resistance, Cb[F]: Communication line (SDAr, SCLr) load capacitance
● r: IIC number (r = 00, 11, 20), gh: Port number (gh = 100, 102, 110, 112, 201, 212, 407)
● fMCK: Serial array unit operation clock frequency
To set this operating clock, use the CKSmn bit in the serial mode register mn (SMRmn).
m: Unit number, n: Channel number (mn = 00, 03, 10)
Table 31.28 In UART communications with devices operating at different voltage levels (1.8 V, 2.5 V, 3 V)
(1)
Conditions: VCC = 1.8 to 5.5 V, VSS = 0 V, Ta = -40 to +105°C
High-speed mode Middle-speed mode Low-speed mode
Test
Parameter Symbol Min. Max. Min. Max. Min. Max. Unit Conditions
Reception
Note 1. Transfer rate in the SNOOZE mode is within the range from 4800 to 9600 bps.
Note 2. Use this rate with VCC ≥ Vb.
Note 3. The maximum operating frequencies of the system clock (PCLKB) are:
High-speed mode: 32 MHz (1.8 V ≤ VCC ≤ 5.5 V), 4 MHz (1.6 V ≤ VCC ≤ 5.5 V)
Middle-speed mode: 24 MHz (1.8 V ≤ VCC ≤ 5.5 V), 4 MHz (1.6 V ≤ VCC ≤ 5.5 V)
Low-speed mode: 2 MHz (1.6 V ≤ VCC ≤ 5.5 V)
Note: Select the TTL input buffer for the RXDq pin and the N-ch open drain output [withstand voltage of VCC] mode for
the TXDq pin by using the Port gh Pin Function Select Register (PghPFS_A.PIM and PghPFS_A.NCODR). For VIH
and VIL, see the DC characteristics with TTL input buffer selected.
To set this operating clock, use the CKS bit in the serial mode register mn (SMRmn).
m: Unit number, n: Channel number (mn = 00, 01, 02, 03, 10, 11)
● Communications by using P212 and P213 with devices operating at different voltage levels are not possible
since P212PFS_A and P213PFS_A registers do not have PIM bit.
Table 31.29 In UART communications with devices operating at different voltage levels (1.8 V, 2.5 V, 3 V)
(2)
Conditions: VCC = 1.8 to 5.5 V, VSS = 0 V, Ta = -40 to +105°C
High-speed mode Middle-speed mode Low-speed mode
Test
Parameter Symbol Min. Max. Min. Max. Min. Max. Unit Conditions
Transmission
Note 1. The smaller maximum transfer rate derived by using fMCK/6 or the following expression is the valid maximum transfer rate.
Expression for calculating the transfer rate when 4.0 V ≤ VCC ≤ 5.5 V, 2.7 V ≤ Vb ≤ 4.0 V
1
Maximum transfer rate = [bps]
− Cb × Rb × ln 1 − 2.2
V ×3
b
1 2.2
Transfer rate × 2 − −Cb × Rb × l n 1 − Vb
Baud rate error (theoretical value) =
1 × 100[%]
Transfer rate × Number of transferred bits
This value is the theoretical value of the relative difference between the transmission and reception sides.
Note 2. This rate is calculated as an example when the conditions described in the Conditions column are met. See *1 above to calculate
the maximum transfer rate under conditions of the customer.
Note 3. The smaller maximum transfer rate derived by using fMCK/6 or the following expression is the valid maximum transfer rate.
Expression for calculating the transfer rate when 2.7 V ≤ VCC < 4.0 V, 2.3 V ≤ Vb ≤ 2.7 V
1
Maximum transfer rate = [bps]
− Cb × Rb × ln 1 − 2.0
V ×3
b
1 2.0
Transfer rate × 2 − −Cb × Rb × l n 1 − Vb
Baud rate error (theoretical value) =
1 × 100[%]
Transfer rate × Number of transferred bits
This value is the theoretical value of the relative difference between the transmission and reception sides.
Note 4. This rate is calculated as an example when the conditions described in the Conditions column are met. See *3 above to calculate
the maximum transfer rate under conditions of the customer.
Note 5. Use this rate with VCC ≥ Vb.
Note 6. The smaller maximum transfer rate derived by using fMCK/6 or the following expression is the valid maximum transfer rate.
Expression for calculating the transfer rate when 1.8 V ≤ VCC < 3.3 V, 1.6 V ≤ Vb ≤ 2.0 V
1
Maximum transfer rate = [bps]
− Cb × Rb × ln 1 − 1.5
V ×3
b
1 1.5
Transfer rate × 2 − −Cb × Rb × l n 1 − Vb
Baud rate error (theoretical value) = 1 × 100[%]
Transfer rate × Number of transferred bits
This value is the theoretical value of the relative difference between the transmission and reception sides.
Note 7. This rate is calculated as an example when the conditions described in the Conditions column are met. See *6 above to calculate
the maximum transfer rate under conditions of the customer.
Note: Select the TTL input buffer for the RXDq pin and the N-ch open drain output [withstand voltage of VCC] mode for
the TXDq pin by using the Port gh Pin Function Select Register (PghPFS_A.PIM and PghPFS_A.NCODR). For VIH
and VIL, see the DC characteristics with TTL input buffer selected.
Vb
Rb
TXDq RX
RA0
User device
microcontroller
RXDq TX
Figure 31.21 In UART communications with devices operating at different voltage levels
1/Transfer rate
Low-bit width
High-bit width
Baud rate error tolerance
TXDq
1/Transfer rate
High-/Low-bit width
Baud rate error tolerance
RXDq
Figure 31.22 Bit width in the UART communications with devices operating at different voltage levels
(reference)
Note: ● Rb[Ω]: Communication line (TXDq) pull-up resistance, Cb[F]: Communication line (TXDq) load capacitance,
Vb[V]: Communication line voltage
● q: UART number (q = 0 to 2), gh: Port number (gh = 100, 101, 109, 110, 212, 213)
● fMCK: Serial array unit operation clock frequency
To set this operating clock, use the CKS bit in the serial mode register mn (SMRmn).
m: Unit number, n: Channel number (mn = 00, 01, 02, 03, 10, 11)
● Communications by using P212 and P213 with devices operating at different voltage levels are not possible
since P212PFS_A and P213PFS_A registers do not have PIM bit.
Table 31.30 In simplified SPI communications in the master mode with devices operating at different voltage
levels (2.5 V or 3 V) with the internal SCKp clock (the ratings below are only applicable to
SPI00)
Conditions: VCC = 2.7 to 5.5 V, VSS = 0 V, Ta = -40 to +105°C
Middle-speed
High-speed mode mode Low-speed mode
Test
Parameter Symbol Min. Max. Min. Max. Min. Max. Unit Conditions
SCKp tKCY1 ≥ 2/PCLKB 4.0 V ≤ VCC ≤ 5.5 V, tKCY1 200 — 200 — 2300 — ns Figure 31.24
cycle time 2.7 V ≤ Vb ≤ 4.0 V, Figure 31.25
Cb = 20 pF,
Rb = 1.4 kΩ
Note: Select the TTL input buffer for the SIp pin and the N-ch open drain output [withstand voltage of VCC] mode
for the SOp pin and SCKp pin by using the Port gh Pin Function Select Register (PghPFS_A.PIM and
PghPFS_A.NCODR). For VIH and VIL, see the DC characteristics with TTL input buffer selected.
Note: ● Rb[Ω]: Communication line (SCKp, SOp) pull-up resistance, Cb[F]: Communication line (SCKp, SOp) load
capacitance, Vb[V]: Communication line voltage
● p: Simplified SPI number (p = 00), m: Unit number (m = 0), n: Channel number (n = 0), gh: Port number (gh =
100, 101, 102)
● fMCK: Serial array unit operation clock frequency
To set this operating clock, use the CKSmn bit in the serial mode register mn (SMRmn).
m: Unit number, n: Channel number (mn = 00)
Table 31.31 In simplified SPI communications in the master mode with devices operating at different voltage
levels (1.8 V, 2.5 V, or 3 V) with the internal SCKp clock (1)
Conditions: VCC = 1.8 to 5.5 V, VSS = 0 V, Ta = -40 to +105°C
High-speed mode Middle-speed mode Low-speed mode
Test
Parameter Symbol Min. Max. Min. Max. Min. Max. Unit Conditions
SCKp cycle tKCY1 ≥ 4/ 4.0 V ≤ VCC ≤ 5.5 V, tKCY1 300 — 300 — 2300 — ns Figure
time PCLKB 2.7 V ≤ Vb ≤ 4.0 V, 31.24
Cb = 30 pF, Figure
Rb = 1.4 kΩ 31.25
SCKp low- 4.0 V ≤ VCC ≤ 5.5 V, tKL1 tKCY1/2 -12 — tKCY1/2 -12 — tKCY1/2 - 50 — ns
level width 2.7 V ≤ Vb ≤ 4.0 V,
Cb = 30 pF, Rb = 1.4 kΩ
Note: Select the TTL input buffer for the SIp pin and the N-ch open drain output [withstand voltage of VCC] mode
for the SOp pin and SCKp pin by using the Port gh Pin Function Select Register (PghPFS_A.PIM and
PghPFS_A.NCODR). For VIH and VIL, see the DC characteristics with TTL input buffer selected.
Table 31.32 In simplified SPI communications in the master mode with devices operating at different voltage
levels (1.8 V, 2.5 V, or 3 V) with the internal SCKp clock (2)
Conditions: VCC = 1.8 to 5.5 V, VSS = 0 V, Ta = -40 to +105°C
High-speed mode Middle-speed mode Low-speed mode
Test
Parameter Symbol Min. Max. Min. Max. Min. Max. Unit Conditions
SIp setup time 4.0 V ≤ VCC ≤ 5.5 V, tSIK1 81 — 81 — 479 — ns Figure 31.24
(to SCKp↑)*1 2.7 V ≤ Vb ≤ 4.0 V, Figure 31.25
Cb = 30 pF,
Rb = 1.4 kΩ
Note: Select the TTL input buffer for the SIp pin and the N-ch open drain output [withstand voltage of VCC] mode
for the SOp pin and SCKp pin by using the Port gh Pin Function Select Register (PghPFS_A.PIM and
PghPFS_A.NCODR). For VIH and VIL, see the DC characteristics with TTL input buffer selected.
Table 31.33 In simplified SPI communications in the master mode with devices operating at different voltage
levels (1.8 V, 2.5 V, or 3 V) with the internal SCKp clock (3)
Conditions: VCC = 1.8 to 5.5 V, VSS = 0 V, Ta = -40 to +105°C
High-speed mode Middle-speed mode Low-speed mode
Test
Parameter Symbol Min. Max. Min. Max. Min. Max. Unit Conditions
SIp setup time 4.0 V ≤ VCC ≤ 5.5 V, tSIK1 44 — 44 — 110 — ns Figure 31.24
(to SCKp↓ )*1 2.7 V ≤ Vb ≤ 4.0 V, Figure 31.25
Cb = 30 pF,
Rb = 1.4 kΩ
Note: Select the TTL input buffer for the SIp pin and the N-ch open drain output [withstand voltage of VCC] mode
for the SOp pin and SCKp pin by using the Port gh Pin Function Select Register (PghPFS_A.PIM and
PghPFS_A.NCODR). For VIH and VIL, see the DC characteristics with TTL input buffer selected.
<Master> Vb Vb
Rb Rb
SCKp SCK
RA0
SIp SO User device
microcontroller
SOp SI
Figure 31.23 Connection in the simplified SPI communications with devices operating at different voltage
levels
Note: ● Rb[Ω]: Communication line (SCKp, SOp) pull-up resistance, Cb[F]: Communication line (SCKp, SOp) load
capacitance, Vb[V]: Communication line voltage
● p: Simplified SPI number (p = 00, 11, 20), m: Unit number, n: Channel number (mn = 00, 03, 10), gh: Port
number (gh = 100 to 103, 109, 110, 112, 201, 212, 213, 407)
● fMCK: Serial array unit operation clock frequency
To set this operating clock, use the CKS bit in the serial mode register mn (SMRmn).
m: Unit number, n: Channel number (mn = 00, 03, 10)
● Communications by using P212 and P213 with devices operating at different voltage levels are not possible
since P212PFS_A and P213PFS_A registers do not have PIM bit.
tKCY1
tKL1 tKH1
SCKp
tSIK1 tKSI1
tKSO1
Figure 31.24 Timing of serial transfer in the simplified SPI communications in the master mode with
devices operating at different voltage levels when SCRmn.DCP[1:0] = 00b or 11b
tKCY1
tKH1 tKL1
SCKp
tSIK1 tKSI1
tKSO1
Figure 31.25 Timing of serial transfer in the simplified SPI communications in the master mode with
devices operating at different voltage levels when SCRmn.DCP[1:0] = 01b or 10b
Note: ● p: Simplified SPI number (p = 00, 11, 20), m: Unit number, n: Channel number (mn = 00, 03, 10), gh: Port
number (gh = 100 to 103, 109, 110, 112, 201, 212, 213, 407)
● Communications by using P212 and P213 with devices operating at different voltage levels are not possible
since P212PFS_A and P213PFS_A registers do not have PIM bit.
Table 31.34 In simplified SPI communications in the slave mode with devices operating at different voltage levels
(1.8 V, 2.5 V, or 3 V) with the external SCKp clock
Conditions: VCC = 1.8 to 5.5 V, VSS = 0 V, Ta = -40 to +105°C
High-speed mode Middle-speed mode Low-speed mode
Test
Parameter Symbol Min. Max. Min. Max. Min. Max. Unit Conditions
SCKp cycle 4.0 V ≤ VCC ≤ 5.5 V, 24 MHz < fMCK tKCY2 14/fMCK — — — — — ns Figure 31.27
time*1 2.7 V ≤ Vb ≤ 4.0 V Figure 31.28
20 MHz < fMCK ≤ 24 MHz 12/fMCK — 12/fMCK — — — ns
SCKp high-/ 4.0 V ≤ VCC ≤ 5.5 V, tKH2, tKL2 tKCY2/2 - — tKCY2/2 - — tKCY2/2 - — ns
low-level 2.7 V ≤ Vb ≤ 4.0 V 12 12 50
width
2.7 V ≤ VCC < 4.0 V, tKCY2/2 - — tKCY2/2 - — tKCY2/2 - — ns
2.3 V ≤ Vb ≤ 2.7 V 18 18 50
Note: Select the TTL input buffer for the SIp pin and the N-ch open drain output [withstand voltage of VCC] mode
for the SOp pin and SCKp pin by using the Port gh Pin Function Select Register (PghPFS_A.PIM and
PghPFS_A.NCODR). For VIH and VIL, see the DC characteristics with TTL input buffer selected.
<Slave> Vb
Rb
SCKp SCK
RA0
SIp SO User device
microcontroller
SOp SI
Figure 31.26 Connection in the simplified SPI communications with devices operating at different voltage
levels
Note: ● Rb[Ω]: Communication line (SOp) pull-up resistance, Cb[F]: Communication line (SOp) load capacitance, Vb[V]:
Communication line voltage
● p: Simplified SPI number (p = 00, 11, 20), m: Unit number, n: Channel number (mn = 00, 03, 10), gh: Port
number (gh = 100 to 103, 109, 110, 112, 201, 212, 213, 407)
● fMCK: Serial array unit operation clock frequency
To set this operating clock, use the CKS bit in the serial mode register mn (SMRmn).
m: Unit number, n: Channel number (mn = 00, 03, 10)
● Communications by using P212 and P213 with devices operating at different voltage levels are not possible
since P212PFS_A and P213PFS_A registers do not have PIM bit.
tKCY2
tKL2 tKH2
SCKp
tSIK2 tKSI2
tKSO2
Figure 31.27 Timing of serial transfer in the simplified SPI communications in the slave mode with devices
operating at different voltage levels when SCRmn.DCP[1:0] = 00b or 11b
tKCY2
tKH2 tKL2
SCKp
tSIK2 tKSI2
tKSO2
Figure 31.28 Timing of serial transfer in the simplified SPI communications in the slave mode with devices
operating at different voltage levels when SCRmn.DCP[1:0] = 01b or 10b
Note: ● p: Simplified SPI number (p = 00, 11, 20), m: Unit number, n: Channel number (mn = 00, 03, 10), gh: Port
number (gh = 100 to 103, 109, 110, 112, 201, 212, 213, 407)
● Communications by using P212 and P213 with devices operating at different voltage levels are not possible
since P212PFS_A and P213PFS_A registers do not have PIM bit.
Table 31.35 Simplified IIC communications with devices operating at different voltage levels (1.8 V, 2.5 V, or 3
V) (1 of 2)
Conditions: VCC = 1.8 to 5.5 V, VSS = 0 V, Ta = -40 to +105°C
High-speed mode Middle-speed mode Low-speed mode
Parameter Symbol Min. Max. Min. Max. Min. Max. Unit Test Conditions
SCLr clock 4.0 V ≤ VCC ≤ 5.5 V, fSCL — 1000*1 — 1000*1 — 300*1 kHz Figure 31.30
frequency 2.7 V ≤ Vb ≤ 4.0 V,
Cb = 50 pF, Rb = 2.7 kΩ
Hold time when 4.0 V ≤ VCC ≤ 5.5 V, tLOW 475 — 475 — 1550 — ns
SCLr is low 2.7 V ≤ Vb ≤ 4.0 V,
Cb = 50 pF, Rb = 2.7 kΩ
Hold time when 4.0 V ≤ VCC ≤ 5.5 V, tHIGH 245 — 245 — 610 — ns
SCLr is high 2.7 V ≤ Vb ≤ 4.0 V,
Cb = 50 pF, Rb = 2.7 kΩ
Table 31.35 Simplified IIC communications with devices operating at different voltage levels (1.8 V, 2.5 V, or 3
V) (2 of 2)
Conditions: VCC = 1.8 to 5.5 V, VSS = 0 V, Ta = -40 to +105°C
High-speed mode Middle-speed mode Low-speed mode
Parameter Symbol Min. Max. Min. Max. Min. Max. Unit Test Conditions
Data setup 4.0 V ≤ VCC ≤ 5.5 V, tSU:DAT 1/fMCK +135*3 — 1/fMCK +135*3 — 1/fMCK +190*3 — ns Figure 31.30
time 2.7 V ≤ Vb ≤ 4.0 V,
(reception) Cb = 50 pF, Rb = 2.7 kΩ
2.7 V ≤ VCC < 4.0 V, 1/fMCK +135*3 — 1/fMCK +135*3 — 1/fMCK +190*3 — ns
2.3 V ≤ Vb ≤ 2.7 V,
Cb = 50 pF, Rb = 2.7 kΩ
2.7 V ≤ VCC < 4.0 V, 1/fMCK +190*3 — 1/fMCK +190*3 — 1/fMCK +190*3 — ns
2.3 V ≤ Vb ≤ 2.7 V,
Cb = 100 pF, Rb = 2.7 kΩ
1.8 V ≤ VCC < 3.3 V, 1/fMCK +190*3 — 1/fMCK +190*3 — 1/fMCK +190*3 — ns
1.6 V ≤ Vb ≤ 2.0 V*2,
Cb = 100 pF, Rb = 5.5 kΩ
Data hold time 4.0 V ≤ VCC ≤ 5.5 V, tHD:DAT 0 305 0 305 0 305 ns
(transmission) 2.7 V ≤ Vb ≤ 4.0 V,
Cb = 50 pF, Rb = 2.7 kΩ
Note: Select the TTL input buffer and the N-ch open drain output [withstand voltage of VCC] mode for the SDAr pin and
the N-ch open drain output [withstand voltage of VCC] mode for the SCLr pin by using the Port gh Pin Function
Select Register (PghPFS_A.PIM and PghPFS_A.NCODR). For VIH and VIL, see the DC characteristics with TTL
input buffer selected.
Vb Vb
Rb Rb
SDAr SDA
RA0
User device
microcontroller
SCLr SCL
Figure 31.29 Connection in the IIC communications with devices operating at different voltage levels
1/fSCL
tLOW tHIGH
SCLr
SDAr
tHD:DAT tSU:DAT
Figure 31.30 Timing of serial transfer in the simplified IIC communications with devices operating at
different voltage levels
Note: ● Rb[Ω]: Communication line (SDAr, SCLr) pull-up resistance, Cb[F]: Communication line (SDAr, SCLr) load
capacitance, Vb[V]: Communication line voltage
● r: Simplified IIC number (r = 00, 11, 20), gh: Port number (gh = 100 to 102, 110, 112, 201, 212, 407)
● fMCK: Serial array unit operation clock frequency
To set this operating clock, use the CKS bit in the serial mode register mn (SMRmn).
m: Unit number, n: Channel number (mn = 00, 03, 10)
Note: Select the normal input buffer for the RXDA0 pin and the normal output mode for the TXDA0 pin by using the Port
gh Pin Function Select Register (PghPFS_A.PIM and PghPFS_A.NCODR).
Note: n: Unit number (n = 0), gh: Port number (gh = 100, 101, 109, 110, 207, 208, 212, 213)
Note: Communications by using P212 and P213 with devices operating at different voltage levels are not possible since
P212PFS_A and P213PFS_A registers do not have PIM bit.
SCLA0 clock frequency Standard mode: PCLKB ≥ 1 fSCL 0 — 100 kHz Figure 31.31
MHz
Setup time of restart condition — tSU:STA 4.7 — — µs
Note 1. The first clock pulse is generated after this period when the start or restart condition is detected.
Note 2. The maximum value of tHD:DAT applies to normal transfer. The clock stretching will be inserted on reception of an acknowledgment
(ACK) signal.
Note: Communications by using P212 and P213 with devices operating at different voltage levels are not possible since
P212PFS_A and P213PFS_A registers do not have PIM bit.
Note: The maximum value of communication line capacitance (Cb) and communication line pull-up resistor (Rb) are as
follows.
Cb = 400 pF, Rb = 2.7 kΩ
SCLA0 clock frequency Fast mode: PCLKB ≥ 3.5 MHz fSCL 0 — 400 kHz Figure 31.31
1.8 V ≤ VCC ≤ 5.5 V
Setup time of restart condition 1.8 V ≤ VCC ≤ 5.5 V tSU:STA 0.6 — — µs
Hold time when SCLA0 is low 1.8 V ≤ VCC ≤ 5.5 V tLOW 1.3 — — µs
Hold time when SCLA0 is high 1.8 V ≤ VCC ≤ 5.5 V tHIGH 0.6 — — µs
Note 1. The first clock pulse is generated after this period when the start or restart condition is detected.
Note 2. The maximum value of tHD:DAT applies to normal transfer. The clock stretching will be inserted on reception of an acknowledgment
(ACK) signal.
Note: Communications by using P212 and P213 with devices operating at different voltage levels are not possible since
P212PFS_A and P213PFS_A registers do not have PIM bit.
Note: The maximum value of communication line capacitance (Cb) and communication line pull-up resistor (Rb) are as
follows.
Cb = 320 pF, Rb = 1.1 kΩ
SCLA0 clock frequency Fast mode plus: PCLKB ≥ 10 MHz fSCL 0 — 1000 kHz Figure 31.31
2.7 V ≤ VCC ≤ 5.5 V
Setup time of restart condition 2.7 V ≤ VCC ≤ 5.5 V tSU:STA 0.26 — — µs
Hold time when SCLA0 is low 2.7 V ≤ VCC ≤ 5.5 V tLOW 0.5 — — µs
Hold time when SCLA0 is high 2.7 V ≤ VCC ≤ 5.5 V tHIGH 0.26 — — µs
Note 1. The first clock pulse is generated after this period when the start or restart condition is detected.
Note 2. The maximum value of tHD:DAT applies to normal transfer. The clock stretching will be inserted on reception of an acknowledgment
(ACK) signal.
Note: Communications by using P212 and P213 with devices operating at different voltage levels are not possible since
P212PFS_A and P213PFS_A registers do not have PIM bit.
Note: The maximum value of communication line capacitance (Cb) and communication line pull-up resistor (Rb) are as
follows.
Cb = 120 pF, Rb = 1.1 kΩ
tLOW tR
SCLAn
tHIGH tF
tHD:DAT
tSU:STA tHD:STA tSU:STO
tHD:STA tSU:DAT
SDAAn
tBUF
Stop Start Restart Stop
condition condition condition condition
Note: n=0
Overall error*1 *3 *4 *5 12-bit AINL — — ±7.5 LSB 4.5 V ≤ VREFH0 = VCC ≤ 5.5 V
resolution
— — ±9.0 LSB 2.7 V ≤ VREFH0 = VCC ≤ 5.5 V
— — ±9.0 LSB 2.4 V ≤ VREFH0 = VCC ≤ 5.5 V
Zero-scale error*1 *2 *3 *4 *5 12-bit EZS — — ±0.17 %FSR 4.5 V ≤ VREFH0 = VCC ≤ 5.5 V
resolution
— — ±0.21 %FSR 2.7 V ≤ VREFH0 = VCC ≤ 5.5 V
— — ±0.21 %FSR 2.4 V ≤ VREFH 0 =VCC ≤ 5.5 V
Full-scale error*1 *2 *3 *4 *5 12-bit EFS — — ±0.17 %FSR 4.5 V ≤ VREFH0 = VCC ≤ 5.5 V
resolution
— — ±0.21 %FSR 2.7 V ≤ VREFH0 = VCC ≤ 5.5 V
— — ±0.21 %FSR 2.4 V ≤ VREFH0 = VCC ≤ 5.5 V
Integral linearity error*1 *4 *5 12-bit ILE — — ±3.0 LSB 4.5 V ≤ VREFH0 = VCC ≤ 5.5 V
resolution
— — ±3.0 LSB 2.7 V ≤ VREFH0 = VCC ≤ 5.5 V
— — ±3.0 LSB 2.4 V ≤ VREFH0 = VCC ≤ 5.5 V
Differential linearity error*1 12-bit DLE — ±1.0 — LSB 4.5 V ≤ VREFH0 = VCC ≤ 5.5 V
resolution
— ±1.0 — LSB 2.7 V ≤ VREFH0 = VCC ≤ 5.5 V
— ±1.0 — LSB 2.4 V ≤ VREFH0 = VCC ≤ 5.5 V
Analog input voltage VAIN 0 — VREFH0 V —
Note 1. This value does not include the quantization error (±1/2 LSB).
Note 2. This value is indicated as a ratio (%FSR) to the full-scale value.
Note 3. When pins AN021 to AN022 are selected as the target pins for conversion, the maximum values are as follows.
Overall error: Add ±3 LSB to the maximum value.
Zero-scale/full-scale error: Add ±0.04%FSR to the maximum value.
Note 4. When reference voltage (+) = VCC (ADVREF[1:0] = 00b) and reference voltage (-) = VSS (ADVREFM = 0b), the maximum values
are as follows.
Overall error: Add ±10 LSB to the maximum value.
Zero-scale/full-scale error: Add ±0.25%FSR to the maximum value.
Integral linearity error: Add ±4 LSB to the maximum value.
Note 5. When VREFH0 < VCC, the maximum values are as follows.
Overall error/zero-scale error/full-scale error: Add (±0.75 LSB × (VCC voltage (V) - VREFH0 voltage (V)) to the maximum value.
Integral linearity error: Add (±0.2 LSB × (VCC voltage (V) - VREFH0 voltage (V)) to the maximum value.
Note 6. When the internal reference voltage or the temperature sensor output voltage is selected as the target for conversion, the sampling
time must be at least 5 µs. Accordingly, use standard mode 2 with the longer sampling time.
Zero-scale error*1 *2 *3 *4 *5 12-bit EZS — — ±0.21 %FSR 2.7 V ≤ VREFH0 = VCC ≤ 5.5 V
resolution
— — ±0.21 %FSR 2.4 V ≤ VREFH0 = VCC ≤ 5.5 V
— — ±0.27 %FSR 1.8 V ≤ VREFH0 = VCC ≤ 5.5 V
— — ±0.28 %FSR 1.6 V ≤ VREFH0 = VCC ≤ 5.5 V
Full-scale error*1 *2 *3 *4 *5 12-bit EFS — — ±0.21 %FSR 2.7 V ≤ VREFH0 = VCC ≤ 5.5 V
resolution
— — ±0.21 %FSR 2.4 V ≤ VREFH0 = VCC ≤ 5.5 V
— — ±0.27 %FSR 1.8 V ≤ VREFH0 = VCC ≤ 5.5 V
— — ±0.28 %FSR 1.6 V ≤ VREFH0 = VCC ≤ 5.5 V
Integral linearity error*1 *4 *5 12-bit ILE — — ±4.0 LSB 2.7 V ≤ VREFH0 = VCC ≤ 5.5 V
resolution
— — ±4.0 LSB 2.4 V ≤ VREFH0 = VCC ≤ 5.5 V
— — ±4.5 LSB 1.8 V ≤ VREFH0 = VCC ≤ 5.5 V
— — ±4.5 LSB 1.6 V ≤ VREFH0 = VCC ≤ 5.5 V
Differential linearity error*1 12-bit DLE — ±1.5 — LSB 2.7 V ≤ VREFH0 = VCC ≤ 5.5 V
resolution
— ±1.5 — LSB 2.4 V ≤ VREFH0 = VCC ≤ 5.5 V
— ±2.0 — LSB 1.8 V ≤ VREFH0 = VCC ≤ 5.5 V
— ±2.0 — LSB 1.6 V ≤ VREFH0 = VCC ≤ 5.5 V
Analog input voltage VAIN 0 — VREFH0 V —
Note 1. This value does not include the quantization error (±1/2 LSB).
Note 2. This value is indicated as a ratio (%FSR) to the full-scale value.
Note 3. When pins AN021 to AN022 are selected as the target pins for conversion, the maximum values are as follows.
Overall error: Add ±3 LSB to the maximum value.
Zero-scale/full-scale error: Add ±0.04%FSR to the maximum value.
Note 4. When reference voltage (+) = VCC (ADVREF[1:0] = 00b) and reference voltage (-) = VSS (ADVREFM = 0b), the maximum values
are as follows.
Overall error: Add ±10 LSB to the maximum value.
Zero-scale/full-scale error: Add ±0.25%FSR to the maximum value.
Integral linearity error: Add ±4 LSB to the maximum value.
Note 5. When VREFH0 < VCC, the maximum values are as follows.
Overall error/zero-scale error/full-scale error: Add (±0.75 LSB × (VCC voltage (V) - VREFH0 voltage (V)) to the maximum value.
Integral linearity error: Add (±0.2 LSB × (VCC voltage (V) - VREFH0 voltage (V)) to the maximum value.
Note 6. When the internal reference voltage or the temperature sensor output voltage is selected as the target for conversion, the sampling
time must be at least 5 µs. Accordingly, use standard mode 2 with the longer sampling time, and use the conversion clock (fAD) of
no more than 16 MHz.
Note 7. If the internal reference voltage or temperature sensor output voltage is to be A/D converted, VCC must be at least 1.8 V.
Note 1. This value does not include the quantization error (±1/2 LSB).
Note 2. This value is indicated as a ratio (%FSR) to the full-scale value.
Note 3. Refer to Table 31.44.
Note 4. When reference voltage (-) is selected as VSS, the maximum values are as follows.
Zero-scale error: Add ±0.35%FSR to the maximum value.
Integral linearity error: Add ±0.5 LSB to the maximum value.
Table 31.43 Resistance and capacitance values of equivalent circuit (Reference data)
Parameter Min Typ Max Unit Test conditions
Analog input capacitance Cin Refer to I/O input capacitance (Cin), see Table 31.11.
Normal-precision channel*1 — — 10 —
MCU
Analog input
ANn Rs ADC12
Vi
Cin Cs
0xFFF
Full-scale error
Integral nonlinearity
error (INL)
A/D converter
output code Ideal line of actual A/D
Actual A/D conversion conversion characteristic
characteristic
Absolute accuracy
Absolute accuracy
Absolute accuracy is the difference between output code based on the theoretical A/D conversion characteristics, and the
actual A/D conversion result. When measuring absolute accuracy, the voltage at the midpoint of the width of the analog
input voltage (1-LSB width), which can meet the expectation of outputting an equal code based on the theoretical A/D
conversion characteristics, is used as the analog input voltage. For example, if 12-bit resolution is used and the reference
voltage VREFH0 = 3.072 V, then 1-LSB width becomes 0.75 mV, and 0 mV, 0.75 mV, and 1.5 mV are used as the analog
input voltages. If analog input voltage is 6 mV, an absolute accuracy of ±5 LSB means that the actual A/D conversion result
is in the range of 0x003 to 0x00D, though an output code of 0x008 can be expected from the theoretical A/D conversion
characteristics.
Offset error
Offset error is the difference between the transition point of the ideal first output code and the actual first output code.
Full-scale error
Full-scale error is the difference between the transition point of the ideal last output code and the actual last output code.
Note 1. This width is the minimum time required for a POR reset when VCC falls below VPDR. This width is also the minimum time required
for a POR reset from when VCC falls below 0.7 V to when VCC exceeds VPOR in the Software standby mode or while the main
system clock is stopped through setting HOCOCR.HCSTOP bit and MOSCCR.MOSTP bit.
TPW
VPDR or 0.7 V
Detection voltage Supply voltage level Vdet0_0 3.84 3.96 4.08 V The power supply voltage is rising.
3.76 3.88 4.00 V The power supply voltage is falling.
Vdet0_1 2.88 2.97 3.06 V The power supply voltage is rising.
2.82 2.91 3.00 V The power supply voltage is falling.
Vdet0_2 2.59 2.67 2.75 V The power supply voltage is rising.
2.54 2.62 2.70 V The power supply voltage is falling.
Vdet0_3 2.31 2.38 2.45 V The power supply voltage is rising.
2.26 2.33 2.40 V The power supply voltage is falling.
Vdet0_4 1.84 1.90 1.95 V The power supply voltage is rising.
1.80 1.86 1.91 V The power supply voltage is falling.
Vdet0_5 1.64 1.69 1.74 V The power supply voltage is rising.
1.60 1.65 1.70 V The power supply voltage is falling.
Minimum pulse width tLW0 500 — — µs —
Detection voltage Supply voltage level Vdet1_0 4.08 4.16 4.24 V The power supply voltage is rising.
4.00 4.08 4.16 V The power supply voltage is falling.
Vdet1_1 3.88 3.96 4.04 V The power supply voltage is rising.
3.80 3.88 3.96 V The power supply voltage is falling.
Vdet1_2 3.68 3.75 3.82 V The power supply voltage is rising.
3.60 3.67 3.74 V The power supply voltage is falling.
Vdet1_3 3.48 3.55 3.62 V The power supply voltage is rising.
3.40 3.47 3.54 V The power supply voltage is falling.
Vdet1_4 3.28 3.35 3.42 V The power supply voltage is rising.
3.20 3.27 3.34 V The power supply voltage is falling.
Vdet1_5 3.07 3.13 3.19 V The power supply voltage is rising.
3.00 3.06 3.12 V The power supply voltage is falling.
Vdet1_6 2.91 2.97 3.03 V The power supply voltage is rising.
2.85 2.91 2.97 V The power supply voltage is falling.
Vdet1_7 2.76 2.82 2.87 V The power supply voltage is rising.
2.70 2.76 2.81 V The power supply voltage is falling.
Vdet1_8 2.61 2.66 2.71 V The power supply voltage is rising.
2.55 2.60 2.65 V The power supply voltage is falling.
Vdet1_9 2.45 2.50 2.55 V The power supply voltage is rising.
2.40 2.45 2.50 V The power supply voltage is falling.
Vdet1_A 2.35 2.40 2.45 V The power supply voltage is rising.
2.30 2.35 2.40 V The power supply voltage is falling.
Detection voltage Supply voltage level Vdet1_B 2.25 2.30 2.34 V The power supply voltage is rising.
2.20 2.25 2.29 V The power supply voltage is falling.
Vdet1_C 2.15 2.20 2.24 V The power supply voltage is rising.
2.10 2.15 2.19 V The power supply voltage is falling.
Vdet1_D 2.05 2.09 2.13 V The power supply voltage is rising.
2.00 2.04 2.08 V The power supply voltage is falling.
Vdet1_E 1.94 1.98 2.02 V The power supply voltage is rising.
1.90 1.94 1.98 V The power supply voltage is falling.
Vdet1_F 1.84 1.88 1.91 V The power supply voltage is rising.
1.80 1.84 1.87 V The power supply voltage is falling.
Vdet1_10 1.74 1.78 1.81 V The power supply voltage is rising.
1.70 1.74 1.77 V The power supply voltage is falling.
Vdet1_11 1.64 1.67 1.70 V The power supply voltage is rising.
1.60 1.63 1.66 V The power supply voltage is falling.
Minimum pulse width tLW1 500 — — µs —
tLWn
Vdetn
Time
tdetn tdetn
Note: n = 0, 1
Note: Make sure to keep the internal reset state by the LVD0 circuit or an external reset until VCC reaches the operating
voltage range shown in AC characteristics.
Note 1. This voltage depends on the POR detection voltage. When the voltage drops, the data in RAM are retained until a POR is applied,
but are not retained following a POR.
VCC
VCCDR
Number of code flash rewrites*1 *2 *3 Cerwr 10000 — — Times Retained for 10 years
Ta = 85°C
1000 — — Retained for 20 years
Ta = 85°C
Min Typ Max Min Typ Max Min Typ Max Min Typ Max Min Typ Max
Programming 4 bytes tP4 — 74.7 656.5 — 51.0 464.6 — 41.7 384.8 — 37.1 346.2 — 34.2 321.9 µs
time
Erasure time 2 Kbytes tE2K — 10.4 312.2 — 7.7 258.5 — 6.4 231.8 — 5.8 218.4 — 5.6 214.4 ms
Time taken to forcibly stop tSED — — 18.0 — — 14.0 — — 12.0 — — 11.0 — — 10.3 µs
the erasure
Security setting time tAWSSAS — 18.0 525.5 — 14.3 468.7 — 12.5 440.7 — 11.6 426.7 — 11.3 422.3 ms
Note: The listed values do not include the time until the operations of the flash memory start following execution of an
instruction by software.
Min Typ Max Min Typ Max Min Typ Max Min Typ Max Min Typ Max
Programming 1 byte tP4 — 74.7 656.5 — 51.0 464.6 — 41.7 384.8 — 37.1 346.2 — 34.2 321.9 µs
time
Erasure time 256 bytes tE2K — 7.8 259.2 — 6.4 232.0 — 5.8 218.5 — 5.5 211.8 — 5.4 209.7 ms
Time taken to forcibly stop tSED — — 18.0 — — 14.0 — — 12.0 — — 11.0 — — 10.3 µs
the erasure
Time until reading starts tDSTOP 0.25 — — 0.25 — — 0.25 — — 0.25 — — 0.25 — — µs
following setting DFLEN to 1
Note: The listed values do not include the time until the operations of the flash memory start following execution of an
instruction by software.
tSWCKcyc
tSWCKH
tSWCKf
SWCLK
tSWCKr
tSWCKL
SWCLK
tSWDS tSWDH
SWDIO
(Input)
tSWDD
SWDIO
(Output)
tSWDD
SWDIO
(Output)
tSWDD
SWDIO
(Output)
JEITA Package Code RENESAS Code Previous Code MASS (TYP.) [g]
HD
2
D
24 17
25 16
detail of lead end
1
E HE c
θ L
32 9
1 8
e (UNIT:mm)
3
ITEM DIMENSIONS
b x M
D 7.00±0.10
A E 7.00±0.10
A2 HD 9.00±0.20
HE 9.00±0.20
A 1.70 MAX.
A1 0.10±0.10
A2 1.40
b 0.37±0.05
y A1 c 0.145 ±0.055
L 0.50±0.20
θ 0° to 8°
NOTE
e 0.80
1.Dimensions “ 1” and “ 2” do not include mold flash. x 0.20
Figure A2.1 LQFP 32-pin 2012 Renesas Electronics Corporation. All rights reserved.
2X
aaa C
24 17
25 16
INDEX AREA
(D/2 X E/2)
32 9
2X
aaa C 8
1
B E A
ccc C
C
SEATING PLANE
A (A3) A1
32X e b(32X) bbb C A B
ddd C Dimension in Millimeters
eee C Reference
Symbol
Min. Nom. Max.
E2 fff C A B
A - - 0.80
1 8
A1 0.00 0.02 0.05
A3 0.203 REF.
fff C A B 32 9
b 0.18 0.25 0.30
D 5.00 BSC
E 5.00 BSC
D2 e 0.50 BSC
L 0.35 0.40 0.45
K 0.20 - -
25 16 D2 3.15 3.20 3.25
E2 3.15 3.20 3.25
24 17
aaa 0.15
L(32X) K(32X) bbb 0.10
ccc 0.10
ddd 0.05
eee 0.08
fff 0.10
JEITA Package Code RENESAS Code Previous Code MASS (TYP.) [g]
2
D
1
E
c
1 10
L
3
bp
A
A2 HE
A1 y e
(UNIT:mm)
ITEM DIMENSIONS
D 6.50 0.10
E 4.40 0.10
NOTE HE 6.40 0.20
A 1.45 MAX.
1.Dimensions “ 1” and “ 2”
A1 0.10 0.10
2.Dimension “ ” does not include tr A2 1.15
e 0.65 0.12
bp 0.22 0.10
0.05
c 0.15 0.05
0.02
L 0.50 0.20
y 0.10
0 to 10
Figure A2.4 LSSOP 20-pin 2012 Renesas Electronics Corporation. All rights reserved.
2X
aaa C
12 9
13 8
D
INDEX AREA
(D/2 X E/2)
16 5
2X
aaa C
1 4
E A
B
ccc C
Note: This applies to the number of cycles when access from the CPU does not conflict with the instruction fetching to the
external memory or bus access from other bus master such as DTC.
SRAM, BUS, DTC, ICU, 0x4000_2000 0x4001_BFFF 3 ICLK Memory Protection Unit, SRAM,
DBG Buses, Data Transfer Controller,
Interrupt Controller, CPU, Flash
Memory
SYSC 0x4001_E000 0x4001_E6FF 2 ICLK Low Power Modes, Resets, Low
Voltage Detection, Clock Generation
Circuit, Register Write Protection
ELC, IWDT, MSTP 0x4004_0000 0x4004_7FFF 3 PCLKB Event Link Controller, Watchdog
Timer, Module Stop Control
CRC 0x4007_4000 0x4007_4FFF 3 PCLKB CRC Calculator
PORT, PFS_A, PORGA, 0x400A_0000 0x400A_3FFF 2 PCLKB I/O Ports, 12-bit A/D Converter, Serial
ADC12, SAU0, SAU1, Array Unit 0, Serial Array Unit 1, Timer
TAU, RTC, IICA, UARTA, Array Unit, Real time Clock, I2C Bus
TML32, PCLBUZ Interface, Serial Interface UARTA, 32-
bit Interval Timer, Clock/Buzzer Output
Controller
TRNG 0x400D_1000 0x400D_1FFF 3 PCLKB True Random Number Generator
FLCN 0x407E_C000 0x407E_FFFF 7 ICLK Data Flash, Flash Control
ADC12 ADC_D
RTC RTC_C
Revision History
Revision 1.00 — January 31, 2024
Initial release
R01UH1040EJ0110