Renesas RA2A1 Group: 32-Bit MCU
Renesas RA2A1 Group: 32-Bit MCU
32-bit MCU
Renesas Advanced (RA) Family
Renesas RA2 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).
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 this MCU. The user
is expected to have basic knowledge of electrical circuits, logic circuits, and the MCU.
3. Related documents
Renesas provides the following documents for this MCU.
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.
1Fh Hexadecimal number. For example, the hexadecimal equivalent of the number 31 is described 1Fh. In
some cases, a hexadecimal number is shown with the prefix 0x, based on C/C++ formatting.
1234 Decimal number. Decimal numbers are generally shown without a suffix.
5. Typographic Notation
The following typographic notation is used throughout this manual:
Example Description
ICU.NMICR.NMIMD Periods separate a function module symbol (ICU), register symbol (NMICR), and bit field symbol
(NMIMD)
ICU.NMICR A period separates a function module symbol (ICU) and register symbol (NMICR)
NMICR.NMIMD A period separates a register symbol (NMICR) and bit field symbol (NMIMD)
NFCLKSEL[1:0] In a register bit name, the bit range enclosed in square brackets indicates the number of bits in the field
at this location. In this example, NFCLKSEL[1:0] represents a 2-bit field at the specified location in the
NMI Pin Interrupt Control Register (NMICR).
6. Unit Prefix
The following unit prefixes are sometimes misleading. Those unit prefixes are described throughout this manual with the
following meaning:
Prefix Description
b Bit
B Byte. This unit prefix is generally used for memory specification of the MCU and address space.
k 1000 = 103. k is also used to denote 1024 (210) but this unit prefix is used to denote 1000 (103)
throughout this manual.
K 1024 = 210. This unit prefix is used to denote 1024 (210) not 1000 (103) throughout this manual.
7. Special Terms
The following terms have special meanings:
Term Description
NC Not connected pin. NC means the pin is not connected to the MCU.
Hi-Z High impedance
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.
b7 b6 b5 b4 b3 b2 b1 b0 (2)
NFLTE — NFCLKSEL[1:0] — — — NMIMD
N
Value after reset: 0 0 0 0 0 0 0 0 (3)
(6)
(4) (5)
(6) R/W
The R/W column indicates access type: whether the bit field is read or write.
R/W: The bit field is read and write.
R/(W): The bit field is read and write. But writing to this bit field has some limitations. For details on the limitations,
see the description or notes of respective registers.
R: The bit field is read-only. Writing to this bit field has no effect.
W: The bit field is write-only. The read value is undefined.
9. Abbreviations
Abbreviations used in this manual are shown in the following table:
Abbreviation Description
AES Advanced Encryption Standard
AHB Advanced High-Performance Bus
AHB-AP AHB Access Port
APB Advanced Peripheral Bus
ARC Alleged RC
ATB Advanced Trace Bus
BCD Binary Coded Decimal
BSDL Boundary Scan Description Language
DES Data Encryption Standard
DSA Digital Signature Algorithm
ECC Elliptic Curve Cryptography
ETB Embedded Trace Buffer
ETM Embedded Trace Macrocell
FLL Frequency Locked Loop
FPU Floating-Point Unit
GSM Global System for Mobile communications
HMI Human Machine Interface
IrDA Infrared Data Association
LSB Least Significant Bit
MSB Most Significant Bit
NVIC Nested Vector Interrupt Controller
PC Program Counter
PFS Port Function Select
PLL Phase Locked Loop
POR Power-On Reset
PWM Pulse Width Modulation
RSA Rivest Shamir Adleman
SHA Secure Hash Algorithm
S/H Sample and Hold
SP Stack Pointer
SWD Serial Wire Debug
SW-DP Serial Wire-Debug Port
TRNG True Random Number Generator
UART Universal Asynchronous Receiver/Transmitter
10. Proprietary Notice
All text, graphics, photographs, trademarks, logos, artwork and computer code, collectively known as content, contained
in this document is owned, controlled or licensed by or to Renesas, and is protected by trade dress, copyright, patent and
trademark laws, and other intellectual property rights and unfair competition laws. Except as expressly provided herein,
no part of this document or content may be copied, reproduced, republished, posted, publicly displayed, encoded,
translated, transmitted or distributed in any other medium for publication or distribution or for any commercial
enterprise, without prior written consent from Renesas.
Arm® and Cortex® are registered trademarks of Arm Limited. CoreSight™ is a trademark of Arm Limited.
CoreMark® is a registered trademark of the Embedded Microprocessor Benchmark Consortium.
Magic Packet™ is a trademark of Advanced Micro Devices, Inc.
SuperFlash® is a registered trademark of Silicon Storage Technology, Inc. in several countries including the United
States and Japan.
Other brands and names mentioned in this document may be the trademarks or registered trademarks of their respective
holders.
Contents
Features ................................................................................................................................................... 46
1. Overview ........................................................................................................................................ 47
1.1 Function Outline ................................................................................................................... 47
1.2 Block Diagram ..................................................................................................................... 53
1.3 Part Numbering .................................................................................................................... 54
1.4 Function Comparison ........................................................................................................... 55
1.5 Pin Functions ....................................................................................................................... 56
1.6 Pin Assignments .................................................................................................................. 59
1.7 Pin Lists ............................................................................................................................... 62
2. CPU ............................................................................................................................................... 64
2.1 Overview .............................................................................................................................. 64
2.1.1 CPU ............................................................................................................................. 64
2.1.2 Debug .......................................................................................................................... 64
2.1.3 Operating Frequency ................................................................................................... 64
2.2 MCU Implementation Options .............................................................................................. 65
2.3 Trace Interface ..................................................................................................................... 66
2.4 SWD Interface ..................................................................................................................... 66
2.5 Debug Mode ........................................................................................................................ 66
2.5.1 Debug Mode Definition ................................................................................................ 66
2.5.2 Debug Mode Effects .................................................................................................... 66
2.5.2.1 Low power mode ................................................................................................. 66
2.5.2.2 Reset ................................................................................................................... 67
2.6 Programmers Model ............................................................................................................ 67
2.6.1 Address Spaces .......................................................................................................... 67
2.6.2 Cortex-M23 Peripheral Address Map .......................................................................... 68
2.6.3 External Debug Address Map ...................................................................................... 68
2.6.4 CoreSight ROM Table ................................................................................................. 68
2.6.4.1 ROM entries ........................................................................................................ 68
2.6.4.2 CoreSight component registers ........................................................................... 69
2.6.5 DBGREG Module ........................................................................................................ 69
2.6.5.1 Debug Status Register (DBGSTR) ...................................................................... 70
2.6.5.2 Debug Stop Control Register (DBGSTOPCR) .................................................... 70
2.6.5.3 DBGREG CoreSight component registers .......................................................... 71
2.6.6 OCDREG Module ........................................................................................................ 71
2.6.6.1 ID Authentication Code Register (IAUTH0 to 3) .................................................. 72
2.6.6.2 MCU Status Register (MCUSTAT) ....................................................................... 72
2.6.6.3 MCU Control Register (MCUCTRL) .................................................................... 73
2.6.6.4 OCDREG CoreSight component registers .......................................................... 73
2.7 SysTick System Timer ......................................................................................................... 74
2.8 OCD Emulator Connection .................................................................................................. 74
2.8.1 Unlock ID Code ........................................................................................................... 74
2.8.2 DBGEN ........................................................................................................................ 74
2.8.3 Restrictions on Connecting an OCD emulator ............................................................. 74
2.8.3.1 Starting connection while in low power mode ..................................................... 75
2.8.3.2 Changing low power mode while in OCD mode .................................................. 75
2.8.3.3 Modify the unlock ID code in OSIS ...................................................................... 75
2.8.3.4 Connecting sequence and SWD authentication .................................................. 75
2.9 References .......................................................................................................................... 76
3. Operating Modes ........................................................................................................................... 77
3.1 Overview .............................................................................................................................. 77
3.2 Details of Operating Modes ................................................................................................. 77
3.2.1 Single-Chip Mode ........................................................................................................ 77
3.2.2 SCI Boot Mode ............................................................................................................ 77
3.2.3 USB Boot Mode ........................................................................................................... 77
3.3 Operating Mode Transitions ................................................................................................ 77
3.3.1 Operating Mode Transitions as Determined by the Mode-Setting Pin ........................ 77
6. Resets ............................................................................................................................................ 86
6.1 Overview .............................................................................................................................. 86
6.2 Register Descriptions ........................................................................................................... 90
6.2.1 Reset Status Register 0 (RSTSR0) ............................................................................. 90
6.2.2 Reset Status Register 1 (RSTSR1) ............................................................................. 91
6.2.3 Reset Status Register 2 (RSTSR2) ............................................................................. 93
6.3 Operation ............................................................................................................................. 94
6.3.1 RES Pin Reset ............................................................................................................. 94
6.3.2 Power-On Reset .......................................................................................................... 94
6.3.3 Voltage Monitor Reset ................................................................................................. 95
6.3.4 Independent Watchdog Timer Reset ........................................................................... 96
6.3.5 Watchdog Timer Reset ................................................................................................ 97
6.3.6 Software Reset ............................................................................................................ 97
6.3.7 Determination of Cold/Warm Start ............................................................................... 97
6.3.8 Determination of Reset Generation Source ................................................................. 97
22. Low Power Asynchronous General Purpose Timer (AGT) .......................................................... 440
22.1 Overview ............................................................................................................................ 440
22.2 Register Descriptions ......................................................................................................... 442
22.2.1 AGT Counter Register (AGT) .................................................................................... 442
22.2.2 AGT Compare Match A Register (AGTCMA) ............................................................ 442
22.2.3 AGT Compare Match B Register (AGTCMB) ............................................................ 443
22.2.4 AGT Control Register (AGTCR) ................................................................................ 443
22.2.5 AGT Mode Register 1 (AGTMR1) ............................................................................. 445
22.2.6 AGT Mode Register 2 (AGTMR2) ............................................................................. 446
22.2.7 AGT I/O Control Register (AGTIOC) ......................................................................... 447
22.2.8 AGT Event Pin Select Register (AGTISR) ................................................................. 448
22.2.9 AGT Compare Match Function Select Register (AGTCMSR) .................................. 448
22.2.10 AGT Pin Select Register (AGTIOSEL) ...................................................................... 449
22.3 Operation ........................................................................................................................... 449
22.3.1 Reload Register and Counter Rewrite Operation ...................................................... 449
22.3.2 Reload Register and Compare Register A/B Rewrite Operation ............................... 451
22.3.3 Timer Mode ............................................................................................................... 452
22.3.4 Pulse Output Mode .................................................................................................... 453
22.3.5 Event Counter Mode .................................................................................................. 454
22.3.6 Pulse Width Measurement Mode .............................................................................. 456
22.3.7 Pulse Period Measurement Mode ............................................................................. 456
22.3.8 Compare Match function ........................................................................................... 457
22.3.9 Output Settings for Each Mode ................................................................................. 458
22.3.10 Standby Mode ........................................................................................................... 460
22.3.11 Interrupt Sources ....................................................................................................... 460
22.3.12 Event Signal Output to ELC ....................................................................................... 461
22.4 Usage Notes ...................................................................................................................... 461
22.4.1 Count Operation Start and Stop Control .................................................................... 461
22.4.2 Access to Counter Register ....................................................................................... 461
22.4.3 When Changing Mode ............................................................................................... 461
22.4.4 Digital Filter ................................................................................................................ 462
22.4.5 How to Calculate Event Number, Pulse Width, and Pulse Period ............................. 462
22.4.6 When Count is Forcibly Stopped by TSTOP Bit ........................................................ 462
22.4.7 When Selecting AGT0 Underflow as the Count Source ............................................ 462
22.4.8 Reset of I/O Register ................................................................................................. 462
22.4.9 When Selecting PCLKB, PCLKB/8, or PCLKB/2 as the Count Source ..................... 462
22.4.10 When Selecting AGTLCLK or AGTSCLK as the Count Source ................................ 462
22.4.11 When Switching Source Clock .................................................................................. 463
Features
■ Arm Cortex-M23 Core ■ System and Power Management
Armv8-M architecture Low power modes
Maximum operating frequency: 48 MHz Realtime Clock (RTC)
Arm Memory Protection Unit (Arm MPU) with 8 regions Event Link Controller (ELC)
Debug and Trace: DWT, FPB, and CoreSight™ MTB-M23 Data Transfer Controller (DTC)
CoreSight Debug Port: SW-DP Key Interrupt Function (KINT)
Power-on reset
■ Memory Low Voltage Detection (LVD) with voltage settings
Up to 256-KB code flash memory
8-KB data flash memory (100,000 program/erase (P/E) cycles) ■ Security and Encryption
Up to 32-KB SRAM AES128/256
Flash Cache (FCACHE) True Random Number Generator (TRNG)
Memory Protection Unit (MPU) ■ Human Machine Interface (HMI)
Memory Mirror Function (MMF)
Capacitive Touch Sensing Unit (CTSU)
128-bit unique ID
■ Multiple Clock Sources
■ Connectivity
Main clock oscillator (MOSC)
USB 2.0 Full-Speed (USBFS) module
(1 to 20 MHz when VCC = 2.4 to 5.5 V)
- On-chip transceiver with voltage regulator
(1 to 8 MHz when VCC = 1.8 to 5.5 V)
- Compliant with USB Battery Charging Specification 1.2
(1 to 4 MHz when VCC = 1.6 to 5.5 V)
Serial Communications Interface (SCI) × 3
Sub-clock oscillator (SOSC) (32.768 kHz)
- UART
High-speed on-chip oscillator (HOCO)
- Simple IIC
(24, 32, 48, 64 MHz when VCC = 2.4 to 5.5 V)
- Simple SPI
(24, 32, 48 MHz when VCC = 1.8 to 5.5 V)
Serial Peripheral Interface (SPI) × 2
(24, 32 MHz when VCC = 1.6 to 5.5 V)
I2C bus interface (IIC) × 2 Middle-speed on-chip oscillator (MOCO) (8 MHz)
Controller Area Network (CAN) module Low-speed on-chip oscillator (LOCO) (32.768 kHz)
■ Analog IWDT-dedicated on-chip oscillator (15 kHz)
16-bit A/D Converter (ADC16) Clock trim function for HOCO/MOCO/LOCO
- 1.2 Msps Clock out support
- Differential input mode ■ General Purpose I/O Ports
- Single-ended input mode Up to 49 input/output pins
24-bit Sigma-Delta A/D Converter (SDADC24) - Up to 3 CMOS input
- 15.6 ksps - Up to 46 CMOS input/output
- Differential input mode - Up to 9 input/output 5 V tolerant
- Single-ended input mode - Up to 3 high current (20 mA)
12-bit D/A Converter (DAC12)
8-bit D/A Converter (DAC8) × 2 ■ Operating Voltage
High-Speed Analog Comparator (ACMPHS) VCC: 1.6 to 5.5 V
Low-Power Analog Comparator (ACMPLP) × 2 ■ Operating Temperature and Packages
Operational Amplifier (OPAMP) × 3
Ta = -40°C to +85°C
Temperature Sensor (TSN)
- 36-pin BGA (5 mm × 5 mm, 0.8 mm pitch)
■ Timers Ta = -40°C to +105°C
General PWM Timer 32-bit (GPT32) - 64-pin LQFP (10 mm × 10 mm, 0.5 mm pitch)
General PWM Timer 16-bit (GPT16) × 6 - 32-pin LQFP (7 mm × 7 mm, 0.8 mm pitch)
Low Power Asynchronous General-Purpose Timer (AGT) × 2 - 48-pin QFN (7 mm × 7 mm, 0.5 mm pitch)
Watchdog Timer (WDT) - 40-pin QFN (6 mm × 6 mm, 0.5 mm pitch)
■ Safety
Error Correction Code (ECC) in SRAM
SRAM parity error check
Flash area protection
ADC self-diagnosis function
Clock Frequency Accuracy Measurement Circuit (CAC)
Cyclic Redundancy Check (CRC) calculator
Data Operation Circuit (DOC)
Port Output Enable for GPT (POEG)
Independent Watchdog Timer (IWDT)
GPIO readback level detection
Register write protection
Main oscillator stop detection
Illegal memory access
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 and efficient platform-based product development.
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 256-KB code flash memory
32-KB SRAM
16-bit A/D Converter (ADC16)
24-bit Sigma-Delta A/D Converter (SDADC24)
12-bit D/A Converter (DAC12)
8-bit D/A Converter (DAC8)
Operational Amplifier (OPAMP) with configurable switches
Security features.
System timer
Power control
DMA
Register write
KINT
protection
GPT32 × 1 CTSU
GPT16 × 6 CAN × 1
SCI × 3
WDT/IWDT
R7FA2A1AB3C FM#AA 0
Production identification code
Terminal material (Pb-free)
A: Sn (Tin) only
C: Others
Packing
A: Tray
B: Tray (Full carton)
H: Tape and reel
Package type
FM: LQFP 64 pins
FJ: LQFP 32 pins
BT: BGA 36 pins
NE: QFN 48 pins
NF: QFN 40 pins
Quality Grade
Operating temperature
2: -40°C to 85°C
3: -40°C to 105°C
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 #.
P108/SWDIO
ADREG
AVCC1
AVSS1
P100
P101
P102
P103
P104
P105
P106
P107
P112
P111
P110
48
47
46
45
44
43
42
41
40
39
38
37
36
35
34
33
P500 49 32 P300/SWCLK
P501 50 31 P301
P502 51 30 P302
P015 52 29 P303
P014/VREFL 53 28 P304
P013/VREFH 54 27 P200
P012 55 26 P201/MD
AVCC0 RES
R7FA2A1AB3CFM
56 25
AVSS0 57 24 P204
VREFL0 58 23 P205
VREFH0 59 22 P206
P003 60 21 VCC_USB_LDO
P002 61 20 VCC_USB
P001 62 19 P914/USB_DP
P000 63 18 P915/USB_DM
P109 64 17 VSS_USB
10
11
12
13
14
15
16
1
2
3
4
5
6
7
8
9
VSS
P214/XCOUT
VCC
P215/XCIN
P400
P401
P402
P403
VCL
P213/XTAL
P212/EXTAL
P411
P410
P409
P408
P407
SBIAS/VREFI
P108/SWDIO
ADREG
AVCC1
AVSS1
P100
P101
P102
P103
P104
P105
P110
36
35
34
33
32
31
30
29
28
27
26
25
P500 37 24 P300/SWCLK
P501 38 Exposed die pad 23 P301
P502 39 22 P302
P015 40 21 P200
P014/VREFL 41 20 P201/MD
P013/VREFH 42 19 RES
AVCC0 43
R7FA2A1AB3CNE 18 P206
AVSS0 44 17 VCC_USB_LDO
VREFL0 45 16 VCC_USB
VREFH0 46 15 P914/USB_DP
P000 47 14 P915/USB_DM
P109 48 13 VSS_USB
10
11
12
1
2
3
4
5
6
7
8
9
P215/XCIN
P214/XCOUT
VSS
VCC
P400
P401
VCL
P213/XTAL
P212/EXTAL
P409
P408
P407
P108/SWDIO
ADREG
AVCC1
AVSS1
P100
P101
P102
P103
P110
30
29
28
27
26
25
24
23
22
21
P213/XTAL
P212/EXTAL
P215/XCIN
P214/XCOUT
VSS
VCC
P408
P407
R7FA2A1AB2CBT
A B C D E F
P915
4 P502 AVCC0 P110 P301 P201/MD 4
/USB_DM
VCC_USB P914
3 VREFL0 AVSS0 P000 P400 3
_LDO /USB_DP
P214 VSS
2 VREFH0 P109 VCC RES 2
/XCOUT /VSS_USB
A B C D E F
Figure 1.6 Pin assignment for BGA 36-pin (top view, pad side down)
SBIAS/VREFI
P108/SWDIO
ADREG
AVCC1
AVSS1
P100
P101
P110
24
23
22
21
20
19
18
17
P500 25 16 P300/SWCLK
P501 26 15 P301
P502 27 14 P200
AVCC0 28 13 P201/MD
R7FA2A1AB3CFJ
AVSS0 29 12 RES
VREFL0 30 11 P204
VREFH0 31 10 P205
P109 32 9 P206
1
2
3
4
5
6
7
8
VCC
VSS
P400
VCL
P213/XTAL
P212/EXTAL
P408
P407
GPT_OPS,
SDADC24
ACMPHS,
ACMPLP
Interrupt
I/O ports
LQFP64
LQFP32
USBFS,
OPAMP
DAC12,
BGA36
ADC16
QFN48
QFN40
POEG
CTSU
DAC8
CAC
CAN
AGT
GPT
RTC
SCI
SPI
IIC
1 1 1 D3 1 P400 AGTEE0 GTETR GTIOC1 RTCOUT CTS0_RT SDA1_A MOSIA_A CMPIN0 TS00 KR02/
_A GA_A A_A _C S0_D/ IRQ0_A
SS0_D/
RXD1_C/
MISO1_C/
SCL1_C
2 2 - - - P401 AGTEE1 GTIU_A GTIOC4 SCK0_D/ SDA0_C SSLB1_A VCOUT_ TS01 KR03/
_A A_A SCK9_A B IRQ5_B
3 - - - - P402 GTIV_A GTIOC0 CTS9_RT SSLB2_A TS02
A_D S9_C/
SS9_C
4 - - - - P403 GTIW_A GTIOC0 SCK1_B SSLB3_A TS03
B_C
5 3 2 A1 2 VCL
6 4 3 B1 - XCIN P215
7 5 4 B2 - XCOUT P214
8 6 5 D2 3 VSS
9 7 6 C1 4 XTAL P213 AGTEE1 GTETR GTIOC0 RXD1_D/ IRQ2_B
_B GA_B A_B MISO1_D/
SCL1_D
10 8 7 D1 5 EXTAL P212 AGTIO0 GTETR GTIOC0 TXD1_D/ IRQ3_B
_A GB_B B_B MOSI1_D/
SDA1_D
11 9 8 E2 6 VCC
12 - - - - P411 GTIOC5 TXD0_F/ SSLA3_A TS04
A_A MOSI0_F/
SDA0_F/
RXD1_B/
MISO1_B/
SCL1_B
13 - - - - P410 GTIOC5 CTS0_RT SSLA2_A TS05
B_A S0_A/
SS0_A/
TXD1_B/
MOSI1_B/
SDA1_B
14 10 - - - P409 AGTO1_ GTIOC0 CTX0_B SCK0_A/ SCL0_B SSLA1_A TSCAP_E IRQ7_A
A A_C CTS1_RT
S1_B/
SS1_B
15 11 9 E1 7 P408 AGTO0_ GTOUU GTIOC0 CRX0_B RXD0_A/ SDA0_B SSLA0_A CMPIN1 TS06 IRQ1_A
A P_A A_A MISO0_A/
SCL0_A/
TXD1_C/
MOSI1_C/
SDA1_C
16 12 10 F1 8 CACREF P407 AGTIO0 GTOUL GTIOC0 USB_VB TXD0_A/ SCL0_A RSPCKB TSCAP_D IRQ1_B
_B _C O_A B_A US/ MOSI0_A/ _B
CTX0_D SDA0_A/
TXD9_A/
MOSI9_A/
SDA9_A
17 13 11 D2 - VSS_USB
18 14 12 F4 - P915 USB_DM
19 15 13 F3 - P914 USB_DP
20 16 14 F5 - VCC_US
B
21 17 15 E3 - VCC_US
B_LDO
22 18 - - 9 P206 AGTIO0 GTOVU GTIOC3 CTS0_RT SCL1_B SSLB0_A TS07 IRQ6_A
_B P_A A_A S0_C/
SS0_C/
TXD1_A/
MOSI1_A/
SDA1_A
23 - - - 10 P205 GTOVL GTIOC3 TXD0_C/ SDA1_B MISOB_B TS08 IRQ0_C
O_A B_A MOSI0_C/
SDA0_C/
CTS1_RT
S1_A/
SS1_A
24 - - - 11 P204 RXD0_C/ MOSIB_B TS09
MISO0_C/
SCL0_C/
SCK9_B
25 19 16 F2 12 RES
26 20 17 E4 13 MD P201
27 21 18 E5 14 P200 NMI
28 - - - - P304 GTIOC6 CTX0_A SCK0_B/ MISOA_B TS10 KR07
A_A TXD9_C/
MOSI9_C/
SDA9_C
29 - - - - P303 GTIOC6 CRX0_A CTS0_RT MOSIA_B TS11 KR06
B_A S0_B/
SS0_B/
SCK1_A
30 22 - - - CACREF P302 AGTOA1 GTOVL GTIOC3 TXD0_B/ RSPCKB TS12 KR05/
_A _A O_B B_B MOSI0_B/ _A IRQ4_B
SDA0_B/
RXD1_A/
MISO1_A/
SCL1_A
Power, System,
Clock, Debug,
GPT_OPS,
SDADC24
ACMPHS,
ACMPLP
I/O ports
Interrupt
LQFP64
LQFP32
USBFS,
OPAMP
DAC12,
BGA36
ADC16
QFN48
QFN40
POEG
CTSU
DAC8
CAC
CAN
AGT
GPT
RTC
SCI
SPI
IIC
31 23 19 D4 15 P301 AGTOB1 GTOWU GTIOC2 RTCOUT RXD0_B/ SDA0_A MOSIB_A TS13 KR04/
_A P_A A_B _A MISO0_B/ IRQ5_A
SCL0_B/
CTS9_RT
S9_B/
SS9_B
32 24 20 F6 16 SWCLK P300
33 25 21 E6 17 SWDIO P108
34 26 22 C4 18 CLKOUT_ P110 AGTOB0 GTOWL GTIOC2 CTX0_C TXD0_D/ SDA1_D RSPCKA ADTRG0_ CMPREF TSCAP_A IRQ2_A
A _A O_A B_B MOSI0_D/ _A A 1
SDA0_D/
RXD9_B/
MISO9_B/
SCL9_B
35 - - - - P111 RTCOUT SCL1_C RSPCKA TS14 IRQ6_B
_B _B
36 - - - - CLKOUT_ P112 SDA1_C SSLA0_B TSCAP_B IRQ7_B
B
37 27 23 D5 19 ADREG
38 28 24 D6 20 SBIAS/
VREFI
39 29 25 B5 21 AVCC1
40 30 26 C5 22 AVSS1
41 - - - - P107 AN023 ANSD3N
42 - - - - P106 AN022 ANSD3P
43 31 - - - P105 MOSIB_C AN021 ANSD2N TS18 IRQ7_C
44 32 - - - P104 MISOB_C AN020 ANSD2P TS19 IRQ6_C
45 33 27 - - P103 GTIOC6 RSPCKB AN019 ANSD1N TS20
A_B _C
46 34 28 - - P102 GTIOC6 CTS9_RT SSLB0_C AN018 ANSD1P TS21
B_B S9_D/
SS9_D
47 35 29 C6 23 P101 GTIOC5 RXD9_C/ AN017 ANSD0N IVREF2 TS22 IRQ5_C
A_B MISO9_C/
SCL9_C
48 36 30 B6 24 P100 GTIOC5 TXD9_D/ AN016 ANSD0P IVCMP2 TS23 IRQ4_C
B_B MOSI9_D/
SDA9_D
49 37 31 A6 25 P500 GTIOC5 RXD0_D/ AN000 DA12_0 IVCMP0 AMP0+ TS24 IRQ3_C
A_C MISO0_D/
SCL0_D
50 38 32 A5 26 P501 GTIOC5 TXD0_E/ AN001 IVREF0 AMP0- TS25 IRQ2_C
B_C MOSI0_E/
SDA0_E
51 39 33 A4 27 P502 CTS0_RT AN002 AMP0O IRQ1_C
S0_E/
SS0_E
52 40 - - - P015 AN003 AMP1O
53 41 - - - VREFL P014 GTIOC6 AN004 IVREF1 AMP1-
A_C
54 42 34 - - VREFH P013 GTIOC6 AN005 DA8_0 IVCMP1 AMP1+
B_C
55 - - - - P012 AN008 AMP2O
56 43 35 B4 28 AVCC0
57 44 36 B3 29 AVSS0
58 45 37 A3 30 VREFL0
59 46 38 A2 31 VREFH0
60 - - - - P003 AN006 AMP2-
61 - - - - P002 AN007 DA8_1 AMP2+
62 - - - - P001 RTCOUT CTS9_RT RSPCKB TS15 IRQ0_B
_D S9_A/ _D
SS9_A
63 47 39 C3 - P000 AGTIO1 GTIOC4 RXD9_A/ SCL0_C MISOB_A TS16 KR00/
_A B_B MISO9_A/ IRQ4_A
SCL9_A
64 48 40 C2 32 P109 AGTOA0 GTETR GTIOC1 SCK0_C/ SCL1_A MISOA_A ADTRG0_ CMPREF TS17 KR01/
_A GB_A B_B TXD9_B/ B 0/ IRQ3_A
MOSI9_B/ VCOUT_
SDA9_B A
Note: Several pin names have the added suffix of _A, _B, _C, _D, _E and _F. The suffix can be ignored when assigning
functionality.
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
Single-cycle integer multiplier
17-cycle integer divider.
Memory Protection Unit (MPU)
Armv8 Protected Memory System Architecture
8 protected regions.
SysTick timer
Driven by SYSTICCLK (LOCO) or ICLK.
See reference 1. and reference 2. in section 2.9 for details.
2.1.2 Debug
Arm CoreSight™ MTB-M23
Revision: r0p0-00rel0
Buffer size: 1 KB of 16-KB MTB SRAM.
Data Watchpoint Unit (DWT)
2 comparators for watchpoints.
Flash Patch and Breakpoint Unit (FPB)
4 instruction comparators.
CoreSight Debug Access Port (DAP)
Serial Wire-Debug Port (SW-DP).
Debug Register Module (DBGREG)
Reset control
Halt control.
See reference 1. and reference 2. in section 2.9 for details.
OCD Access
Trace/Debug Data
Cortex®-M23 integration
Cortex-M23
SWJ-DP
Cortex-M23
core
DAP IC NVIC MTB
SRAM
APB-AP DWT
DBGREG
OCDREG
To: System control
Bus matrix
Note 1. OCD connect is determined by the CDBGPWRUPREQ bit output in the SWJ-DP register. The bit can only be
written by the OCD. However, the level of the bit can be confirmed by reading the DBGSTR.CDBGPWRUPREQ
bit.
Note 2. Debug authentication is defined by the Armv8-M architecture. Enabled means that both invasive and non-
invasive CPU debugging are permitted. Disabled means that both are not permitted.
mode. However, AHB-AP cannot respond to On-Chip Debug (OCD) access in these low power modes. The OCD must
wait for cancellation of the low power mode to access the CoreSight debug components. To request low power mode
cancellation, the OCD can set the DBIRQ bit in the MCUCTRL register. For details, see section 2.6.6.3, MCU Control
Register (MCUCTRL).
2.5.2.2 Reset
In OCD mode, some resets depend on the CPU status and the DBGSTOPCTR setting.
Note: In OCD break mode, the CPU is halted. In OCD run mode, the CPU is in OCD mode and the CPU is not halted.
Note 1. The IWDT and WDT always stop in this mode.
Note 2. The IWDT and WDT operation depends on the DBGSTOPCTR setting.
Note 3. Reset or interrupt masking depends on the DBGSTOPCTR setting.
DAP
IC
OCD address space
Port 1
APB-AP
OCDREG
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
CDBGP CDBGP
— — WRUP WRUP — — — — — — — — — — — —
ACK REQ
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
— — — — — — — — — — — — — — — —
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
DBGST DBGST
— — — — — — OP_RE OP_RP — — — — — DBGSTOP_LVD[2:0]
CCR ER
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
DBGST DBGST
— — — — — — — — — — — — — — OP_W OP_IW
DT DT
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.
Note: OCDREG is located in the dedicated OCD address space. This address map is independent of the system
address map. See section 2.6.2, Cortex-M23 Peripheral Address Map.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — — — — — — — — — — — —
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — — — — — — — — — — — —
— — — — — — — DBIRQ — — — — — — — EDBGR
Q
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Emulator
host PC
MCU
SWD
APB-AP OCDREG
ID
comparator
Option-setting
memory
IAUTH output
Unlock ID Compare result
(debug enable)
2.8.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 11, 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, using the MCUCTRL.EDBGRQ bit in OCDREG, the
OCD emulator can wake up the MCU without starting CPU execution by using a CPU break.
1. Connect the OCD emulator to the MCU through the SWD interface.
2. Set up SWJ-DP to access the DAP bus. In the setup, the OCD emulator must assert CDBGPWRUPREQ in the SWJ-
DP Control Status Register, then wait until CDBGPWRUPACK in the same register is asserted.
3. Set up the AHB-AP to access the system address space. The AHB-AP is connected to the DAP bus port 0.
4. Start accessing the CPU debug resources using the AHB-AP.
2.9 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 Processor User Guide (ARM DUI 0963B).
4. ARM® CoreSight™ Architecture Specification (ARM IHI 0029D).
5. ARM® CoreSight™ MTB-M23 Technical Reference Manual (ARM DDI 0564C).
3. Operating Modes
3.1 Overview
Table 3.1 shows the selection of operating modes by the mode-setting pin. For details, see section 3.2, Details of
Operating Modes. Operation starts with the on-chip flash memory enabled, regardless of the mode in which operation
started.
R e se t
- M D = 1 a n d re le a se R E S p in
- R e le a se P O R R E S p in o r P O R o ccu rs
R E S p in o r
P O R o ccu rs M D = 0 and
re le a se R E S p in
4. Address Space
4.1 Overview
The MCU supports a 4-GB linear address space ranging from 0000 0000h to FFFF FFFFh, that can contain both
programs and data. Figure 4.1 shows the memory map.
FFFF FFFFh
System for Cortex®-M23
E000 0000h
Reserved area*2
407F B1A0h
On-chip flash
(option-setting memory)
407F B19Ch
Reserved area*2
407F 0000h
Flash I/O registers
407E 0000h
Reserved area*2
4010 2000h
On-chip flash (data flash)
4010 0000h
Peripheral I/O registers
4000 0000h
Reserved area*2
2000 8000h
On-chip SRAM*1
2000 0000h
Reserved area*2
0280 0000h
Memory mapping area
0200 0000h
0101 0034h Reserved area*2
On-chip flash (option-setting memory)
0101 0008h
Reserved area*2
0004 0000h
On-chip flash (program flash)
(read only)*1, *3
0000 0000h
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
KEY[7:0] — MEMMIRADDR[15:9]
MEMMIRADDR[8:0] — — — — — — —
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
KEY[7:0] — — — — — — — —
— — — — — — — — — — — — — — — EN
5.3 Operation
MMSFR — — — — — — — — — MEMMIRADDR[15:0] 0 0 0 0 0 0 0
Memory mirror space 8 MB code flash MAT Example: MMSFR = 0042 2380h
addresses addresses Read from 0200 1000h = Code flash 0042 3380h
Address bus + MemMir SFR
Read from 023E 8123h = Code flash 0000 A4A3h
MEMMIRADDR
0200 0000h
0042 2380h
9 bits 9 bits
Comp
Adder*1
32 bits
32 bits
Selector
32 bits
Code flash
CPU
Arm MPU Original address of CPU
Conversion address by
Security MPU
Memory Mirror Function
Start
No
MMEN.EN = 1
Yes
Compare the address bus and the memory
mirror space (0200 0000h to 027F FFFFh)
End
Start
Set
MMSFR.MEMMIRADDR[15:0]
(start address of the application
in code flash area)
Set MMEN.EN = 1
End
027F FFFFh
0201 0000h
Application code
0200 0000h
003F FFFFh
Code flash
You can choose any version of the application code in the
MMSFR register
6. Resets
6.1 Overview
The MCU provides 13 resets:
RES pin reset
Power-on reset
Independent watchdog timer reset
Watchdog timer reset
Voltage monitor 0 reset
Voltage monitor 1 reset
Voltage monitor 2 reset
SRAM parity error reset
SRAM ECC error reset
Bus master MPU error reset
Bus slave MPU error reset
CPU stack pointer error reset
Software reset.
Table 6.1 lists the reset names and sources.
Note 1. For details on the voltages to be monitored (VPOR, Vdet0, Vdet1, and Vdet2), see section 8, Low Voltage Detection
(LVD) and section 47, Electrical Characteristics.
The internal state and pins are initialized by a reset. Table 6.2 and Table 6.3 list the targets initialized by resets.
Reset source
Voltage monitor 1 Voltage monitor 2 SRAM parity error SRAM ECC error
Flags to be initialized reset reset Software reset reset reset
Reset source
Reset source
Reset source
SRAM Bus master Bus slave CPU stack
Software parity error SRAM ECC MPU error MPU error pointer
Registers to be initialized reset reset error reset reset reset error reset
Watchdog timer registers WDTRR, WDTCR, WDTSR,
WDTRCR, WDTCSTPR
Voltage monitor function 1 LVD1CR0, LVCMPCR.LVD1E, x x x x x x
registers LVDLVLR.LVD1LVL
LVD1CR1/LVD1SR x x x x x x
Voltage monitor function 2 LVD2CR0, LVCMPCR.LVD2E, x x x x x x
registers LVDLVLR.LVD2LVL
LVD2CR1/LVD2SR x x x x x x
SOSC registers SOSCCR x x x x x x
SOMCR x x x x x x
LOCO registers LOCOCR
LOCOUTCR x x x x x x
MOSC register MOMCR
Realtime Clock (RTC) register*1 x x x x x x
AGT register x x x x x x
MPU register x x x
Pin state (except XCIN/XCOUT pin)
Pin state (XCIN/XCOUT pin) x x x x x x
Registers other than those shown, CPU, and internal state
: Initialized
x: Not initialized
Note 1. The RTC has a software reset. RCR1.RTCOS, RCR1.CIE, RCR2.RTCOE, RCR2.ADJ30, and RCR2.RESET are
initialized.
Note 2. For details on the target bits, see section 23, Realtime Clock (RTC).
The RTC is not initialized by any reset source. SOSC and LOCO can be selected as the clock sources of RTC. Table 6.4
and Table 6.5 show the states of SOSC and LOCO when a reset occurs.
Note 1. The LOCO User Trimming Control Register (LOCOUTCR) is reset by POR, LVD0, LVD1, and LVD2 resets,
returning the LOCO to the default oscillation accuracy. This can affect RTC accuracy if the RTC uses the LOCO
(with a user trimming value in LOCOUTCR) as the RTC source clock. To restore the pre-reset LOCO oscillation
accuracy, reload the required trimming value into LOCOUTCR after any of these resets.
b7 b6 b5 b4 b3 b2 b1 b0
x: Undefined
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — CWSF
x: Undefined
RSTSR2 determines whether a power-on reset caused the reset processing (cold start) or a reset signal input during
operation caused the reset processing (warm start).
6.3 Operation
Vdet0*1
*3
VCCmin.
VPOR
VCC
RES pin
POR monitor
(active-low)
RSTSR0.LVD0RF
Note: For details on the electrical characteristics, see section 47, Electrical Characteristics.
Note 1. Vdet0 shows a voltage monitor 0 reset detection level, VPOR shows a power-on reset detection level, and VCCmin
shows the minimum guaranteed voltage of MCU.
Note 2. tLVD0 shows a time for voltage monitor 0 reset.
Note 3. At power-on, VCC should rise to the minimum guaranteed voltage before the POR reset is released.
Figure 6.1 Example of operations during power-on and voltage monitor 0 reset
Select bit (RN) in the LVD1CR0 register. When the LVD1CR0.RN bit is 0 and VCC has fallen to or below Vdet1, the
CPU is released from the internal reset state and starts reset exception handling when the LVD1 reset time (tLVD1)
elapses after VCC rises above Vdet1. When the LVD1CR0.RN bit is 1 and VCC falls to or below Vdet1, the CPU is
released from the internal reset state and starts reset exception handling when the LVD1 reset time (tLVD1) elapses.
Likewise, timing for release from the voltage monitor 2 reset state is selectable by setting the Voltage Monitor 2 Reset
Negate Select bit (RN) in the LDV2CR0 register.
Detection levels Vdet1 and Vdet2 can be changed in the Voltage Detection Level Select Register (LVDLVLR).
Figure 6.2 shows an example of operations during voltage monitor 1 and 2 resets. For details on the voltage monitor 1
reset and voltage monitor 2 reset, see section 8, Low Voltage Detection (LVD).
Vdeti*1
VCC
RES pin
LVDi valid setting
LVCMPCR.LVDiE
tLVDi*2
Internal reset signal
LVDiCR0.RN = 1
RES pin reset
RSTSR0.LVDiRF
tLVDi*2
Internal reset signal
Note: For details on the electrical characteristics, see section 47, Electrical Characteristics.
Note 1. Vdeti indicates the detection level of voltage monitor 1 reset and voltage monitor 2 reset (i = 1, 2).
Note 2. tLVDi indicates the time for voltage monitor 1 reset and voltage monitor 2 reset (i = 1, 2).
Figure 6.2 Example of operations during voltage monitor 1 and voltage monitor 2 resets
VPOR
VCC
RES pin
Reset exception
handling
RSTSR1 00h
or
RSTSR0.LVD1RF = 1 No
or
RSTSR0.LVD2RF = 1
Yes
RSTSR0. No
LVD0RF = 1
Yes RSTSR0. No
PORF = 1
Yes
7. Option-Setting Memory
7.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 7.1 shows the option-setting memory area.
Address*1
OCD/Serial Programmer ID
0101 0018h to 0101 0033h
Setting Register (OSIS)
Note 1. The option-setting memory must be allocated to the user area of the flash memory.
Note 2. See Table 7.1 for details.
Note 3. The address of these registers will be changed when the boot swap is set.
See section 7.2.1, Option Function Select Register 0 (OFS0), section 7.2.2, Option
Function Select Register 1 (OFS1), and section 7.2.3, MPU Registers for details.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
WDTST WDTRS WDTST
— — WDTRPSS[1:0] WDTRPES[1:0] WDTCKS[3:0] WDTTOPS[1:0] —
PCTL TIRQS RT
Note 1. When the boot swap is set, the address of this register changes.
Therefore, set 0000 2400h and 0000 0400h to the same value if boot swap is used.
Note 2. The value in a blank product is FFFF FFFFh. It is set to the value written by your application.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — — — — — — — — — — — —
Note 1. When the boot swap is set, the address of this register changes.
Therefore, set 0000 2404h and 0000 0404h to the same value if boot swap is used.
Note 2. The value in a blank product is FFFF FFFFh. It is set to the value written by your application.
After a reset release, operation is in the low-voltage mode and therefore HOCOCR.HCSTP must be immediately set to 0.
Note 1. When the boot swap is set, the address of MPU registers change.Therefore, set (0000 2408h to 0000 243Bh) and (0000 0408h
to 0000 043Bh) to the same value if boot swap is used.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — — — — — — — — — — — —
— FSPR — — — — — BTFLG — — — — — — — —
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — FAWE[11:0]
— — — — FAWS[11: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, serial
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[11:0] and FAWE[11:0] bits. The settings for the bits are as follows:
FAWE[11:0] = FAWS[11:0]: The P/E command is allowed to execute in the full program flash area.
FAWE[11:0] > FAWS[11:0]: The P/E command is only allowed to execute in the window from the block pointed to
by the FAWS[11:0] bits to the block one lower than the block pointed to by the FAWE[11:0] bits.
FAWE[11:0] < FAWS[11:0]: The P/E command is not allowed to execute in the program flash area.
Address P/E
…
Protected area
Block 7
(FAWE[11:0] = 007h)
Block 6
Block 3
Block 2
Protected area
Block 1
Block 0
Address(es): OSIS 0101 0018h, OSIS 0101 0020h, OSIS 0101 0028h, OSIS 0101 0030h
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
These fields hold the ID for use in ID authentication for the OCD/serial programmer.
ID code bits [127] and [126] determine whether the ID code protection is enabled, and the authentication method to use
with the host. Table 7.2 shows how the ID code determines the authentication method.
Setting bit [127] to 0 prevents Renesas from accessing the test mode. Therefore, Renesas cannot perform failure analysis
unless provided with bits [126:0]. To process any warranty claim, Renesas must be able to perform failure analysis.
Note: Programming formats vary depending on the compiler. See the compiler manual for details.
7.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 available for programming, write 1 to all bits in
the reserved areas and all reserved bits. If 0 is written to these bits, normal operation cannot be guaranteed.
OFS1.LVDAS
VCC
Level selection -
Internal reference voltage Vdet0
(for detecting Vdet0) circuit
OFS1.VDSEL1[2:0]
LVCMPCR.LVD1E
LVD1CR0.CMPE
Voltage detection 1 signal
+
Internal reference voltage Level selection - V
det1
(for detecting Vdet1) circuit
LVDLVLR.LVD1LVL[4:0]
LVCMPCR.LVD2E
LVD2CR0.CMPE
Voltage detection 2 signal
+
- V
det2
Internal reference voltage Level selection
(for detecting Vdet2) circuit
LVDLVLR.LVD2LVL[2:0]
Note: See section 7, Option-Setting Memory.
Voltage monitor 1
Event
Voltage monitor 2
Event
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — IRQSE IDTSEL[1:0]
L
Value after reset: 0 0 0 0 0 0 0 1
Note: Set the PRCR.PRC3 bit to 1 (write enabled) before rewriting this register.
Note 1. When enabling maskable interrupts, do not change the NMIER.LVD1EN bit value in the ICU from the reset state.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — MON DET
Note: Set the PRCR.PRC3 bit to 1 (write enabled) before rewriting this register.
Note 1. Only 0 can be written to this bit. After writing 0 to this bit, 2 system clock cycles are required for the bit to be read
as 0.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — IRQSE IDTSEL[1:0]
L
Value after reset: 0 0 0 0 0 0 0 1
Note: Set the PRCR.PRC3 bit to 1 (write enabled) before rewriting this register.
Note 1. When enabling maskable interrupts, do not change the NMIER.LVD2EN bit value in the ICU from the reset state.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — MON DET
Note: Set the PRCR.PRC3 bit to 1 (write enabled) before rewriting this register
Note 1. Only 0 can be written to this bit. After writing 0 to this bit, 2 system clock cycles are required for the bit to be read
as 0.
b7 b6 b5 b4 b3 b2 b1 b0
— LVD2E LVD1E — — — — —
Note: Set the PRCR.PRC3 bit to 1 (write enabled) before rewriting this register.
b7 b6 b5 b4 b3 b2 b1 b0
LVD2LVL[2:0] LVD1LVL[4:0]
Note: Set the PRCR.PRC3 bit to 1 (write enabled) before rewriting this register.
The contents of the LVDLVLR register can only be changed if the LVCMPCR.LVD1E and LVCMPCR.LVD2E bits
(voltage detection n circuit disable, n = 1, 2) are both 0. Do not set LVD detectors 1 and 2 to the same voltage detection
level.
b7 b6 b5 b4 b3 b2 b1 b0
RN RI — — — CMPE — RIE
Note: Set the PRCR.PRC3 bit to 1 (write enabled) before rewriting this register.
b7 b6 b5 b4 b3 b2 b1 b0
RN RI — — — CMPE — RIE
Note: Set the PRCR.PRC3 bit to 1 (write enabled) before rewriting this register.
*3
Vdet0*1
VPOR*1
RES pin
Voltage detection 0
signal (active-low)
RSTSR0.LVD0RF
Note: For details of the electrical characteristics, see section 47, Electrical Characteristics.
Note 1. VPOR indicates the detection level for a power-on reset and Vdet0 indicates the detection level for a voltage monitor 0 reset.
Note 2. tPOR indicates the time until the power-on reset is released and tLVD0 indicates the time until the LVD0 reset is released.
Note 3. At power-on, the VCC should rise to the minimum guaranteed voltage before the POR reset is released.
Table 8.4 Procedure for setting bits related to the voltage monitor 1 interrupt and voltage monitor 1 reset so
that voltage monitoring operates
Voltage monitor 1 interrupt
Step (voltage monitor 1 ELC event output) Voltage monitor 1 reset
Setting the voltage 1 Set LVCMPCR.LVD1E = 0 to disable voltage detection 1 before writing to the LVDLVLR register.
detection 1 circuit
2 Select the detection voltage by setting the LVDLVLR.LVD1LVL[4:0] bits.
3 Set LVCMPCR.LVD1E = 1 to enable the voltage detection 1 circuit.
4 Wait for at least td(E-A) for the LVD operation stabilization time after LVD is enabled.*1
Setting the voltage 5 Set LVD1CR0.RI = 0 to select the voltage monitor Set LVD1CR0.RI = 1 to select the voltage
monitor 1 interrupt or 1 interrupt. monitor 1 reset
reset Select the type of reset negation by setting the
LVD1CR0.RN bit.
6 Select the timing of interrupt requests by setting —
the LVD1CR1.IDTSEL[1:0] bits
Select the type of interrupt by setting the
LVD1CR1.IRQSEL bit.
Enabling output 7 Set LVD1SR.DET = 0.
8 Set LVD1CR0.RIE = 1 to enable the voltage monitor 1 interrupt or reset*2.
9 Set LVD1CR0.CMPE = 1 to enable output of the comparison results from voltage monitor 1.
Note 1. Steps 5 to 8 can be performed during the wait time of step 4. For details of td(E-A), see section 47, Electrical
Characteristics.
Note 2. Step 8 is not required if only the ELC event signal is to be output.
Table 8.5 Procedure for setting bits related to the 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
Stopping the enabling 1 Set LVD1CR0.CMPE = 0 to disable output of the comparison results from voltage monitor 1.
of output
2 Set LVD1CR0.RIE = 0 to disable the voltage monitor 1 interrupt or reset*1.
Stopping the voltage 3 Set LVCMPCR.LVD1E = 0 to disable the voltage detection 1 circuit.
detection 1 circuit
Note 1. Step 2 is not required if only the ELC event signal is to be output.
If the voltage monitor 1 interrupt or reset setting is to be made again after it is used and stopped once, omit the following
steps in the procedures for stopping and setting, depending on the conditions:
Setting or stopping the voltage detection 1 circuit is not required if the settings for the voltage detection 1 circuit do
not change
Setting the voltage monitor 1 interrupt or reset is not required if the settings for the voltage monitor 1 interrupt or
reset do not change.
Figure 8.5 shows an example of the voltage monitor 1 interrupt operation.
VCC
Vdet1
LVD1SR.MON
Set to 0 by software
LVD1SR.DET bit
LVD1CR1.IDTSEL[1:0] bits are
set to 10b (when drop and rise
are detected)
Voltage monitor 1
interrupt request
Set to 0 by software
LVD1SR.DET bit
LVD1CR1.IDTSEL[1:0] bits are
set to 00b (when rise is detected)
Voltage monitor 1
interrupt request
Set to 0 by software
LVD1SR.DET bit
LVD1CR1.IDTSEL[1:0] bits are
set to 01b (when drop is
detected)
Voltage monitor 1
interrupt request
Note 1. When the voltage monitor 0 reset is not in use, VCC ≥ VCCmin.
Table 8.6 Procedure for setting bits related to voltage monitor 2 interrupt and voltage monitor 2 reset so that
voltage monitor operates (1 of 2)
Voltage monitor 2 interrupt
Step (voltage monitor 2 ELC event output) Voltage monitor 2 reset
Setting the voltage 1 Set LVCMPCR.LVD2E = 0 to disable voltage detection 2 before writing to the LVDLVLR register.
detection 2 circuit
2 Select the detection voltage by setting the LVDLVLR.LVD2LVL[2:0] bits.
3 Set LVCMPCR.LVD2E = 1 to enable the voltage detection 2 circuit.
4 Wait for at least td(E-A) for the LVD operation stabilization time after LVD is enabled.*1
Table 8.6 Procedure for setting bits related to voltage monitor 2 interrupt and voltage monitor 2 reset so that
voltage monitor operates (2 of 2)
Voltage monitor 2 interrupt
Step (voltage monitor 2 ELC event output) Voltage monitor 2 reset
Setting the voltage 5 Set LVD2CR0.RI = 0 to select the voltage monitor Set LVD2CR0.RI = 1 to select the voltage
monitor 2 interrupt or 2 interrupt. monitor 2 reset
reset Select the type of the reset negation by setting
the LVD2CR0.RN bit.
6 Select the timing of interrupt requests by setting —
the LVD2CR1.IDTSEL[1:0] bits
Select the type of interrupt by setting the
LVD2CR1.IRQSEL bit.
Enabling output 7 Set LVD2SR.DET = 0.
8 Set LVD2CR0.RIE = 1 to enable the voltage monitor 2 interrupt or reset.*2
9 Set LVD2CR0.CMPE = 1 to enable output of the results of comparison by voltage monitor 2.
Note 1. Steps 5 to 8 can be performed during the wait time of step 4. For details of td(E-A), see section 47, Electrical
Characteristics.
Note 2. Step 8 is not required if only the ELC event signal is to be output.
Table 8.7 Procedure for setting bits related to voltage monitor 2 interrupt and voltage monitor 2 reset so that
voltage monitor stops
Step Voltage monitor 2 interrupt (voltage monitor 2 ELC event output), voltage monitor 2 reset
Stopping the enabling 1 Set LVD2CR0.CMPE = 0 to disable output of the comparison results from voltage monitor 2.
of output
2 Set LVD2CR0.RIE = 0 to disable the voltage monitor 2 interrupt or reset.*1
Stopping the voltage 3 Set LVCMPCR.LVD2E = 0 to disable the voltage detection 2 circuit.
detection 2 circuit
Note 1. Step 2 is not required if only the ELC event signal is to be output.
If the voltage monitor 2 interrupt or reset setting is to be made again after it is used and stopped once, omit the following
steps in the procedures for stopping and setting, depending on the conditions:
Setting or stopping the voltage detection 2 circuit is not required if the settings for the voltage detection 2 circuit do
not change
Setting the voltage monitor 2 interrupt or reset is not required if the settings for the voltage monitor 2 interrupt or
voltage monitor 2 reset do not change.
VCC
Vdet2
LVD2SR.MON bit
Set to 0 by software
LVD2SR.DET bit
LVD2CR1.IDTSEL[1:0] bits are
set to 10b (when drop and rise
are detected)
Voltage monitor 2
interrupt request
Set to 0 by software
Set to 0 by software
LVD2SR.DET bit
LVD2CR1.IDTSEL[1:0] bits are
set to 01b (when drop is
detected)
Voltage monitor 2
interrupt request
Note 1. When the voltage monitor 0 reset is not in use, VCC ≥ VCCmin.
Table 9.1 Clock generation circuit specifications for the clock sources
Clock source Description Specifications
Main clock oscillator (MOSC) Resonator frequency 1 MHz to 20 MHz*1
External clock input frequency Up to 20 MHz*1
External resonator or additional circuit: ceramic resonator, Available
crystal
Connection pins EXTAL, XTAL
Drive capability switching
Oscillation stop detection function
Sub-clock oscillator (SOSC) Resonator frequency 32.768 kHz
External resonator or additional circuit: crystal resonator Available
Connection pins: XCIN, XCOUT
Drive capability switching
High-speed on-chip oscillator Oscillation frequency 24/32/48/64 MHz
(HOCO)
User trimming Available
Middle-speed Oscillation frequency 8 MHz
on-chip oscillator (MOCO)
User trimming Available
Low-speed on-chip oscillator (LOCO) Oscillation frequency 32.768 kHz
User trimming Available
IWDT-dedicated on-chip oscillator Oscillation frequency 15 kHz
(IWDTLOCO)
User trimming No
External clock input for SWD Input clock frequency Up to 12.5 MHz
(SWCLK)
Note 1. The frequency depends on the supply voltage. See the table of Clock timing in the Electrical Characteristics chapter for more
information.
Table 9.2 Clock generation circuit specifications for the internal clocks
Parameter Clock source Clock supply Specification
System clock (ICLK) MOSC/SOSC/HOCO/ CPU, DTC, FLASH, SRAM Up to 48 MHz
MOCO/LOCO Division ratios: 1/2/4/8/16/32/64
Peripheral module clock B MOSC/SOSC/HOCO/ Peripheral module (CAC, ELC, I/O Up to 32 MHz
(PCLKB) MOCO/LOCO Ports, KINT, POEG, GPT, AGT, Division ratios:1/2/4/8/16/32/64
RTC, WDT, IWDT, USBFS, SCI,
IIC, CAN, SPI, CRC, ADC16,
SDADC24, DAC8, DAC12,
OPAMP, ACMPHS, ACMPLP,
CTSU, DOC, AES, and TRNG)
Peripheral module clock D MOSC/SOSC/HOCO/ Peripheral module (GPT count Up to 64 MHz (when ADC16 is not used)
(PCLKD) MOCO/LOCO clock, ADC16 conversion clock) 1 MHz to 32 MHz (when ADC16 is used)
Division ratios: 1/2/4/8/16/32/64
Flash interface clock MOSC/SOSC/HOCO/ Flash interface 1 MHz to 32 MHz (P/E)
(FCLK) MOCO/LOCO Up to 32 MHz (read)
Division ratios: 1/2/4/8/16/32/64
USB clock (UCLK) HOCO USBFS 48 MHz
CAN clock (CANMCLK) MOSC CAN 1 MHz to 20 MHz
AGT clock SOSC/LOCO AGT 32.768 kHz
(AGTSCLK/AGTLCLK)
CAC Main clock MOSC CAC Up to 20 MHz
(CACMCLK)
CAC Sub clock SOSC CAC 32.768 kHz
(CACSCLK)
CAC LOCO clock LOCO CAC 32.768 kHz
(CACLCLK)
CAC MOCO clock MOCO CAC 8 MHz
(CACMOCLK)
CAC HOCO clock HOCO CAC 24/32/48/64 MHz
(CACHCLK)
CAC IWDTLOCO clock IWDTLOCO CAC 15 kHz
(CACILCLK)
RTC clock (RTCSCLK/ SOSC/LOCO RTC 32.768 kHz
RTCLCLK)
IWDT clock (IWDTCLK) IWDTLOCO IWDT 15 kHz
SysTick Timer clock LOCO SysTick Timer 32.768 kHz
(SYSTICCLK)
Clock/buzzer output MOSC/SOSC/LOCO/ CLKOUT pin Up to 16 MHz
(CLKOUT) MOCO/HOCO Division ratios: 1/2/4/8/16/32/64/128
Serial wire clock (SWCLK) SWCLK pin OCD Up to 12.5 MHz
24-bit Sigma-Delta A/D MOSC/HOCO SDADC24 4 MHz to 20 MHz (MOSC)
converter clock 24/32/48/64 MHz (HOCO)
(SDADCCLK)
Note: Restrictions on setting the clock frequency: ICLK ≥ PCLKB, PCLKD ≥ PCLKB
Restrictions on the clock frequency ratio: (N: integer, and up to 64)
ICLK:FCLK = N:1, ICLK:PCLKB = N:1, ICLK:PCLKD = N:1 or 1:N
Note: The minimum FCLK frequency is 1 MHz in Programming/Erasure (P/E) mode.
SCKDIVCR FCK[2:0]
Selector
Flash interface clock (FCLK)
To flash interface
CKSEL[2:0]
SCKSCR
Frequency
divider SCKDIVCR ICK[2:0]
1/1
Selector
Oscillation
stop detection 1/2
Selector
circuit 1/4
1/8 System clock (ICLK)
1/16
1/32
To CPU, DTC, Flash, and SRAM
1/64
XTAL
Main clock Main clock
Selector
oscillator
EXTAL Oscillation
wait control
XCIN
Sub-clock Sub-clock SCKDIVCR PCKB[2:0]
PCKD[2:0]
oscillator
XCOUT
Peripheral module clock
Selector
Selector
PCLKB (Peripheral bus)
PCLKD (GPT,ADC16)
SDADCCKSEL
SDADCCKCR
Selector
24-bit Sigma-Delta ADC clock (SDADCCLK)
To SDADC24
Middle-speed
Middle-speed
on-chip clock
oscillator
8 MHz
1/4
1/8
1/16
1/32 Clock/buzzer output (CLKOUT)
1/64 To CLKOUT pin
1/128
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— FCK[2:0] — ICK[2:0] — — — — — — — —
— — — — — PCKB[2:0] — — — — — PCKD[2:0]
The SCKDIVCR register selects the frequencies of the system clock (ICLK), peripheral module clock (PCLKB,
PCLKD), and the flash interface clock (FCLK).
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — CKSEL[2:0]
Note 1. Selecting a system clock source that is faster than 32 MHz (system clock source > 32 MHz) is prohibited when
the SCKDIVCR.ICK[2:0] bits select division by 1 and MEMWAIT.MEMWAIT = 0.
The SCKSCR register selects the clock source for the system clock.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — MEMW
AIT
Value after reset: 0 0 0 0 0 0 0 0
Note: Writing 0 to the MEMWAIT bit is prohibited when SCKDIVCR.ICK bit selects division by 1 and
SCKSCR.CKSEL[2:0] bits select the system clock source that is faster than 32 MHz (ICLK > 32 MHz).
Note: When switching the operating power control mode, the flash cache function should be disabled by setting the
CACHEE.FCACHEEN bit to 0 before switching the mode. For details, see section 43, Flash Memory.
: Setting is possible.
x : Setting is not possible.
Figure 9.2 shows an example flow when setting the ICLK > 32 MHz.
Yes
FCACHEIV = 0? No
(Do not invalidate)
Yes
End
Change the
No
operation mode from
High-speed mode
Yes
End
Figure 9.3 When setting the ICLK ≤ 32 MHz from ICLK > 32 MHz
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — MOSTP
A fixed stabilization wait time is required after setting the main clock oscillator to start operation. A fixed wait time is
also required for oscillation to stop after stopping the main clock oscillator.
The following restrictions apply when starting and stopping operation:
After stopping the main clock oscillator, confirm that the OSCSF.MOSCSF bit is 0 before restarting the main clock
oscillator
Confirm that the main clock oscillator operates and that the OSCSF.MOSCSF bit is 1 before stopping the main
clock oscillator
Regardless of whether the main clock oscillator is selected as the system clock, confirm that the OSCSF.MOSCSF
bit is set to 1 before executing a WFI instruction to place the MCU in Software Standby mode while
MOSCCR.MOSTP bit is 0
When a transition to Software Standby mode is to follow the setting to stop the main clock oscillator, confirm that
the OSCSF.MOSCSF bit is set to 0 before executing the WFI instruction.
Writing 1 to MOSTP is prohibited under the following condition:
SCKSCR.CKSEL[2:0] = 011b (system clock source = MOSC).
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — SOSTP
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — LCSTP
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — HCSTP
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — MCSTP
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 MOCO clock, wait for at least 3
MOCO clock cycles before executing the WFI instruction.
Writing 1 to MCSTP is prohibited under the following condition:
SCKSCR.CKSEL[2:0] = 001b (system clock source = MOCO).
Writing 1 to the MCSTP bit (stopping the MOCO) is prohibited if oscillation stop detection is enabled in the Oscillation
Stop Detection Control Register (OSTDCR.OSTDE).
Because the MOCO clock is used to measure the wait time for other oscillators, the MOCO clock oscillates while the
wait time for other oscillators is being measured, regardless of the setting of MOCOCR.MCSTP. Therefore, the MOCO
clock might be unintentionally supplied even if the MCSTP is set to stop.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — MOSC — — HOCO
SF SF
Value after reset: 0 0 0 0 0 0 0 0/1*1
Note 1. The value after reset depends on the OFS1.HOCOEN bit setting.
When OFS1.HOCOEN = 1, the value after reset of HOCOSF bit is 0.
When OFS1.HOCOEN = 0, the HOCOSF value becomes 0 after reset is released, and the HOCOSF value
becomes 1 after the HOCO oscillation stabilization wait time elapses.
Note 2. An appropriate value is set in the Wait Control register for the given oscillator. If the wait time is not sufficient, the
oscillation stabilization flag is set to 1 and supply of the clock signal to the internal circuits starts before oscillation
is stable.
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.
When the HOCO clock is operating and then is deactivated because the HOCOCR.HCSTP bit is set to 1.
b7 b6 b5 b4 b3 b2 b1 b0
OSTDE — — — — — — OSTDI
E
Value after reset: 0 0 0 0 0 0 0 0
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — OSTDF
The OSTDSR register indicates the stop detection status of the main clock oscillator.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — MSTS[3:0]
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — HSTS[2:0]
HOCOWTCR controls the wait time until output of the signal from the high-speed clock oscillator to the internal circuits
starts. Only write to HOCOWTCR when the HOCOCR.HCSTP bit is 1 or the OSCSF.HOCOSF flag is 1. Do not write to
this register under any other conditions.
b7 b6 b5 b4 b3 b2 b1 b0
— MOSEL — — MODR — — —
V1
Value after reset: 0 0 0 0 0 0 0 0
Note: The EXTAL/XTAL pin is also used as a port. In the initial state, the pin is set as a port.
Note: The MOSCCR.MOSTP bit must be 1 (MOSC is stopped) before changing this register.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — SODRV[1:0]
b7 b6 b5 b4 b3 b2 b1 b0
b7 b6 b5 b4 b3 b2 b1 b0
LOCOUTRM[7:0]
MCU operation is not guaranteed when LOCOUTCR is set to a value that causes the LOCO frequency to be outside of
the specification range. When LOCOUTCR is modified, the frequency stabilization time corresponds to the frequency
stabilization time at the start of the MCU operation. When the ratio of the LOCO frequency and the other oscillation
frequency is an integer value, changing the LOCOUTCR value is prohibited.
b7 b6 b5 b4 b3 b2 b1 b0
MOCOUTRM[7:0]
MCU operation is not guaranteed when MOCOUTCR is set to a value that causes the MOCO frequency to be outside of
the specification range. When MOCOUTCR is modified, the frequency stabilization wait time corresponds to the time
when it is stabilized at the start of the MCU operation. When the ratio of the MOCO frequency and the other oscillation
frequency is an integer value, changing the MOCOUTCR value is prohibited.
b7 b6 b5 b4 b3 b2 b1 b0
HOCOUTRM[7:0]
MCU operation is not guaranteed when HOCOUTCR is set to a value that causes the HOCO frequency to be outside of
the specification range. When HOCOUTCR is modified, the frequency stabilization wait time corresponds to the time
when it is stabilized at the start of the MCU operation.
When UCKSEL.UCKSELC = 1, writing any other value except 00h to HOCOUTCR is prohibited. For UCKSEL
register, see section 26, USB 2.0 Full-Speed Module (USBFS).
b7 b6 b5 b4 b3 b2 b1 b0
SDADC — — — — — — SDADC
CKEN CKSEL
Value after reset: 0 0 0 0 0 0 0 0
CL1
EXTAL
Rf
XTAL
Rd CL2
XTAL Hi-Z
C1
XCIN
Rf
XCOUT
Rd
C2
Set OSTDCR.OSTDIE = 0
Read OSTDSR.OSTDF = 1
Yes
Set OSTDSR.OSTDF = 0
No
OSTDSR.OSTDF = 0 Try again?
Yes
No
End
Note: On returning from the oscillation-stopped state, the factor responsible for stopping the main clock oscillation
circuit must be removed from the system to allow oscillation to resume.
HOCO clock
MOCO clock
LOCO clock
Dedicated clock for the IWDT.
The following internal clocks are produced from these sources:
Operating clock for the CPU, DTC, flash memory, and SRAM — System clock (ICLK)
Operating clocks for peripheral modules — PCLKB and PCLKD
Operating clock for the flash interface — FCLK
Operating clock for the USBFS — UCLK
Operating clock for the CAN — CANMCLK
Operating clocks for the CAC — CACCLK
Operating clock for the RTC LOCO clock — RTCLCLK
Operating clock for the RTC sub clock — RTCSCLK
Operating clock for the IWDT — IWDTCLK
Operating clock for the AGT LOCO clock — AGTLCLK
Operating clock for the AGT sub clock — AGTSCLK
Operating clock for the SysTick timer — SYSTICCLK
Clock for external pin output — CLKOUT
Operating clock for the 24-bit Sigma-Delta A/D Converter — SDADCCLK.
For details of the registers used to set the frequencies of the internal clocks, see section 9.6.1, System Clock (ICLK) to
section 9.6.12, 24-bit Sigma-Delta A/D Converter Clock (SDADCCLK).
If the value of any of these bits is changed, subsequent operation is at a frequency determined by the new value.
SCKSCR.CKSEL[2:0]
SCKDIVCR.ICK[2:0]
Frequency
HOCO
divider
1/1
Selector
MOCO 1/2
Selector Selected clock 1/4 System clock (ICLK)
LOCO 1/8
1/16
1/32
Main clock oscillator 1/64
Sub-clock oscillator
SCKDIVCR.PCKx[2:0]
Selector
Peripheral module clock(PCLKx)
ta
ICLK
(SCKDIVCR.ICK[2:0] = 000b)
Clock source A
Clock source B
tb
Selected clock
PCLKB
(SCKDIVCR.PCKB[2:0] = 001b)
MCU
CL2
XTAL
EXTAL
CL1
Figure 9.10 Signal routing in board design for oscillation circuit (applicable to the main clock oscillator as
well as sub-clock oscillator)
CACREFE DFS[1:0]
DFS[1:0]
CACREF pin
Digital filter
RSCS[2:0] RCDS[1:0]
EDGES[1:0]
1/32
dividing circuit
Reference
Frequency
1/128 Edge detection
signal
generation circuit
1/1024 RPS
clock select
circuit 1/8192 Valid edge signal
FMCS[2:0] TCSS[1:0]
Frequency
measurement
Main clock clock CFME
Sub clock Frequency
dividing circuit
measurement clock
MOCO clock clock select 1/8 16-bit counter
LOCO clock circuit Overflow interrupt request
IWDTCLK clock 1/32
Peripheral module clock B
(PCLKB) Interrupt control Measurement end interrupt
CACNTBR circuit request
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — CFME
b7 b6 b5 b4 b3 b2 b1 b0
b7 b6 b5 b4 b3 b2 b1 b0
b7 b6 b5 b4 b3 b2 b1 b0
b7 b6 b5 b4 b3 b2 b1 b0
CAULVR is a 16-bit read/write register that specifies the upper value of the allowable range. When the counter value
exceeds the value specified in this register, a frequency error is detected. Write to this register when the CACR0.CFME
bit is 0.
The counter value stored in CACNTBR can vary depending on the difference between the phases of the digital filter and
edge-detection circuit, and the signal on the CACREF pin. Ensure that this setting allows an adequate margin.
CALLVR is a 16-bit read/write register that specifies the lower value of the allowable range. When the counter value
falls below the value specified in this register, a frequency error is detected.
Write to this register when the CACR0.CFME bit is 0.
The counter value stored in CACNTBR can vary depending on the difference between the phases of the digital filter and
edge-detection circuit, and the signal on the CACREF pin. Ensure that this setting allows an adequate margin.
10.3 Operation
CACREF pin or
internal clock
CFME bit in CACR0
1 is written to 0 is written to
CFME bit CFME bit
Counter value
FFFFh
Counter is
After 1 is written to CFME bit, counting cleared by writing
starts at the first valid edge 0 to CFME bit
CAULVR
CALLVR
0000h
Time
Note: Selectable means that operating or not operating can be selected in the control registers.
Stop (Retained) means that the contents of the internal registers are retained but the operations are suspended.
Operation prohibited means that the function must be stopped before entering Software Standby mode.
Otherwise, proper operation is not guaranteed in Snooze mode.
Note 1. All modules whose module-stop bits are 0 start as soon as PCLKs are supplied after entering Snooze mode. To
avoid an increasing power consumption in Snooze mode, set the module-stop bit of modules that are not
required in Snooze mode to 1 before entering Software Standby mode.
Note 2. When using SCI0 in Snooze mode, MOSCCR.MOSTP bits must be 1.
Note 3. Stopped when the Clock Output Source Select bits (CKOCR.CKOSEL[2:0]) are set to a value other than 010b
(LOCO) and 100b (SOSC).
Note 4. In IWDT-dedicated on-chip oscillator and IWDT, operating or stopping is selected by setting the IWDT Stop
Control bit (IWDTSTPCTL) in Option Function Select Register 0 (OFS0) in IWDT auto start mode.
In WDT, operating or stopping is selected by setting the WDT Stop Control bit (WDTSTPCTL) in Option Function
Select Register 0 (OFS0) in WDT auto start mode.
Note 5. Detection of USBFS resumption is possible.
Note 6. AGT0 operation is possible when 100b (LOCO) or 110b (SOSC) is selected in the AGT0.AGTMR1.TCK[2:0] bits.
AGT1 operation is possible when 100b (LOCO), 110b (SOSC), or 101b (underflow event signal from AGT0) is
selected in the AGT1.AGTMR1.TCK[2:0] bits.
Note 7. Event lists the restrictions described in section 11.9.13, ELC Event in Snooze Mode.
Note 8. Only VCOUT function is permitted. The VCOUT pin operates when ACMPHS and ACMPLP use no digital filter.
For details on digital filter, see section 38, High-Speed Analog Comparator (ACMPHS) and section 39, Low-
Power Analog Comparator (ACMPLP).
Note 9. Serial communication modes of SCI0 is only in asynchronous mode.
Note 10. When DACPC.PUMPEN or DAPC.PUMPEN bit is 1, MOCO clock divided by 8 is supplied to switches which are
used for DAC output.
Note 11. Only wakeup interrupt is available.
Note 12. When using the 16-bit A/D Converter (ADC160) in Snooze mode, the ADCMPCR.CMPAE or ADCMPCR.CMPBE
bit must be 1.
Note 13. When AMPCPC.PUMP0EN, AMPCPC.PUMP1EN, or AMPCPC.PUMP2EN bit is 1, MOCO clock divided by 8 is
supplied to switches which are used for OPAMP.
Table 11.3 Available interrupt sources to transition to Normal mode from Snooze mode and Software Standby
mode
Interrupt source Name Software Standby mode Snooze mode
NMI Yes Yes
Port PORT_IRQn (n = 0 to 7) Yes Yes
LVD LVD_LVD1 Yes Yes
LVD_LVD2 Yes Yes
IWDT IWDT_NMIUNDF Yes Yes
USBFS USBFS_USBR Yes Yes
RTC RTC_ALM Yes Yes
RTC_PRD Yes Yes
KINT KEY_INTKR Yes Yes
AGT1 AGT1_AGTI Yes Yes*3
AGT1_AGTCMAI Yes Yes
AGT1_AGTCMBI Yes Yes
ACMPLP ACMP_LP0 Yes Yes
IIC0 IIC0_WUI Yes Yes
ADC160 ADC160_WCMPM No Yes with SELSR0*1, *3
ADC160_WCMPUM No Yes with SELSR0*1, *3
SCI0 SCI0_AM No Yes with SELSR0*1, *2
SCI0_RXI_OR_ERI No Yes with SELSR0*1, *2
DTC DTC_COMPLETE No Yes with SELSR0*1
DOC DOC_DOPCI No Yes with SELSR0*1
CTSU CTSU_CTSUFN No Yes with SELSR0*1
Note 1. To use the interrupt request as a trigger for exiting Snooze mode, the request must be selected by SELSR0
register. See section 13, Interrupt Controller Unit (ICU). When a trigger selected by SELSR0 register occurs after
executing a WFI instruction and during the transition from Normal mode to Software Standby mode, whether the
request can be accepted depends on the timing of the occurrence.
Note 2. Only one of either SCI0_AM or SCI0_RXI_OR_ERI can be selected.
Note 3. Event that is enabled by the SNZEDCR register must not be used.
SBYCR.SSBY = 0
Reset state
Sleep mode
WFI instruction*1
RES pin = High*2
All interrupts SNZCR.SNZE = 1
Snooze mode
Interrupt shown in Table 11.3
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 transitioning to low power mode.
Note 2. The MOCO clock 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.
SSBY — — — — — — — — — — — — — — —
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — — — — — MSTPA — — — — — —
22
Value after reset: 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1
— — — — — — — — — — — — — — — —
Note 1. When rewriting the MSTPA22 bit from 0 to 1, disable the DTC before setting the MSTPA22 bit.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
Note 1. The MSTPB2 bit must be written while the oscillation of the clock controlled by this bit is stable. To enter Software
Standby mode after writing this bit, wait for 2 CAN clock (CANMCLK) cycles after writing, then execute a WFI
instruction.
Note 2. To enter Software Standby mode after writing the MSTPB11 bit, wait for 2 USB clock (UCLK) cycles after writing,
then execute a WFI instruction.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
MSTPC — — MSTPC — — — — — — — — — — — —
31 28
Value after reset: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Note 1. The MSTPC0 bit must be written while the oscillation of the clock to be controlled by this bit is stable. To enter
Software Standby mode after writing to this bit, wait for 2 cycles of the slowest clock from the clocks output by the
oscillators, then execute a WFI instruction.
Note 2. Set the MSTPC28 bit once to 0 at the beginning of the program to initialize the unused circuit even if the TRNG is
not used in this MCU. See section 11.9.15, Module-Stop Function for an Unused Circuit in section 11.9, Usage
Notes.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
Note 1. When the count source is sub-clock oscillator or LOCO, AGT1 counting does not stop even if MSTPD2 bit is set
to 1. If the count source is the sub-clock oscillator or LOCO, this bit must be set to 1 except when accessing the
AGT1 registers.
Note 2. When the count source is sub-clock oscillator or LOCO, AGT0 counting does not stop even if MSTPD3 bit is set
to 1. If the count source is the sub-clock oscillator or LOCO, this bit must be set to 1 except when accessing the
AGT0 registers.
b7 b6 b5 b4 b3 b2 b1 b0
— — — OPCM — — OPCM[1:0]
TSF
Value after reset: 0 0 0 0 0 0 1 0
b7 b6 b5 b4 b3 b2 b1 b0
— — — SOPC — — — SOPC
MTSF M
Value after reset: 0 0 0 0 0 0 0 0
The SOPCCR register is used to reduce power consumption in Normal mode, Sleep mode, and Snooze mode by
initiating entry to and exit from Subosc-speed mode. Subosc-speed mode is only available when using the sub-clock
oscillator or LOCO without dividing the frequency.
For the procedure to change operating power control modes, see section 11.5, Function for Lower Operating Power
Consumption.
SOPCMTSF flag (Sub Operating Power Control Mode Transition Status Flag)
The SOPCMTSF flag indicates the switching control state when the operating power control mode is switched from or to
Subosc-speed mode. This flag becomes 1 when the SOPCM bit is written, and 0 when mode transition completes. Read
this flag and confirm that it is 0 before proceeding.
Table 11.4 Relationship between the operating power control modes, and the OPCM[1:0] and SOPCM bits
Operating power control mode OPCM[1:0] bits SOPCM bit Power consumption
High-speed mode 00b 0 High
Middle-speed mode 01b 0
Low-voltage mode 10b 0
Low-speed mode 11b 0
Subosc-speed mode xxb 1 Low
b7 b6 b5 b4 b3 b2 b1 b0
b7 b6 b5 b4 b3 b2 b1 b0
To use a trigger shown in Table 11.8 as a condition to switch from Snooze mode to Software Standby mode, set the
associated bit in the SNZEDCR register to 1.
The event that is used to return to Normal mode from Snooze mode listed in Table 11.3 must not be enabled in the
SNZEDCR register.
DTCNZRED bit (Not Last DTC Transmission Completion Snooze End Enable)
The DTCNZRED bit specifies whether to enable a transition from Snooze mode to Software Standby mode on
completion of each DTC transmission, that is, when CRA or CRB register in the DTC is not 0. For details on the trigger
conditions, see section 16, Data Transfer Controller (DTC).
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
The SNZREQCR register controls which trigger causes the MCU to switch from Software Standby mode to Snooze
mode. If a trigger is selected as a request to cancel Software Standby mode by setting the WUPEN register, see section
13, Interrupt Controller Unit (ICU), the MCU enters Normal mode when the trigger is generated while the associated bit
of the SNZREQCR register is 1. The setting of the WUPEN register always has a higher priority than the SNZREQCR
register settings. For details, see section 11.8, Snooze Mode and section 13, Interrupt Controller Unit (ICU).
b7 b6 b5 b4 b3 b2 b1 b0
— — — FLSTP — — — FLSTO
F P
Value after reset: 0 0 0 0 0 0 0 0
b7 b6 b5 b4 b3 b2 b1 b0
DBGEN — — — — — — —
Figure 11.2 shows the operating voltages and frequencies in High-speed mode.
VCC VCC
[V] [V]
5.5 5.5
P/E
except P/E
2.7 2.7
2.4 2.4
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 flash read is 12 MHz for ICLK and FCLK. The operating voltage range is 1.8
to 5.5 V during flash read. However, for ICLK and FCLK, the maximum operating frequency during flash read is 8 MHz
when the operating voltage is 1.8 V or larger and smaller than 2.4 V.
During flash programming and erasure, the operating frequency range is 1 to 12 MHz and the operating voltage range is
1.8 to 5.5 V. The maximum operating frequency during flash programming and erasure is 8 MHz when the operating
voltage is 1.8 V or larger and smaller than 2.4 V.
Figure 11.3 shows the operating voltages and frequencies in Middle-speed mode.
VCC VCC
[V] [V]
5.5 5.5
2.4 2.4
1.8 1.8
1.6 1.6
Low-voltage mode
After a reset is canceled, operation is started from this mode.
The maximum operating frequency during flash read is 4 MHz for ICLK and FCLK. The operating voltage range is 1.6
to 5.5 V during flash read.
During flash programming and erasure, the operating frequency range is 1 to 4 MHz and the operating voltage range is
1.8 to 5.5 V.
Figure 11.4 shows the operating voltages and frequencies in Low-voltage mode.
VCC VCC
[V] [V]
5.5 5.5
1.8 1.8
1.6 1.6
Low-speed mode
The maximum operating frequency during flash read is 1 MHz for ICLK and FCLK. The operating voltage range is 1.8
to 5.5 V during flash read.
P/E operations for flash memory are prohibited.
Figure 11.5 shows the operating voltages and frequencies in Low-speed mode.
VCC VCC
[V] [V]
5.5 5.5
1.8 1.8
1.6 1.6
Subosc-speed mode
The maximum operating frequency during flash read is 37.6832 kHz for ICLK and FCLK. The operating voltage range is
1.8 to 5.5 V during flash read. 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 11.6 shows the operating voltages and frequencies in Subosc-speed mode.
VCC VCC
[V] [V]
5.5 5.5
1.8 1.8
1.6 1.6
0.
0. 278
0. 327 28
0
0 5
03 6
0
0 5
03 6
[MHz] [MHz]
76 8
76 8
83
83
2
2
Figure 11.6 Operating voltages and frequencies in Subosc-speed mode
1. Canceling by an interrupt
When an interrupt request occurs, Sleep mode is canceled and the MCU starts the interrupt handling.
2. Canceling by RES pin reset
When RES pin is driven low, the MCU enters the reset state. Be sure to keep RES pin low for the time period
specified in section 47, Electrical Characteristics. When RES pin is driven high after the specified time period, the
CPU starts the reset exception handling.
3. Canceling by IWDT reset
Sleep mode is canceled by an internal reset generated by an IWDT underflow and the MCU starts the reset
exception handling. However, IWDT stops in Sleep mode and an internal reset for canceling Sleep mode is not
generated in the following conditions:
OFS0.IWDTSTRT = 0 and OFS0.IWDTSTPCTL = 1.
4. Canceling by WDT reset
Sleep mode is canceled by an internal reset generated by a WDT underflow and the MCU starts the reset exception
handling. However, WDT stops in Sleep mode even when counting in Normal mode and an internal reset for
canceling Sleep mode is not generated in the following conditions:
OFS0.WDTSTRT = 0 (auto start mode) and OFS0.WDTSTPCTL = 1
OFS0.WDTSTRT = 1 (register start mode) and WDTCSTPR.SLCSTP = 1.
5. Canceling by other resets available in Sleep mode
Sleep mode is canceled by other resets and the MCU starts the reset exception handling.
Note: For details of proper setting of the interrupts, see section 13, Interrupt Controller Unit (ICU).
Oscillator
ICLK
IRQn pin
SBYCR.SSBY
Oscillation
WFI instruction
settling time
n = 0 to 7, 17, 23 to 25, 28 to 30
SNZCR.b0 Noise filter
+
Edge detect
SCI0
PAD (RXD0_D)
rxd
PAD (RXD0_C)
PAD (RXD0_B)
PAD (RXD0_A)
PSEL
Snooze end
signal Low
Software
Normal Standby
Low power mode mode*3 mode *1
Snooze mode *2
Normal mode*4
Oscillation
Oscillator Oscillates stopped Oscillates
for system clock
Figure 11.9 Canceling of Snooze mode when an interrupt request signal is generated
Table 11.7 Available snooze end requests (triggers to return to Software Standby mode)
Enable/disable control
Snooze end request Register Bit
AGT1 underflow or measurement complete (AGT1_AGTI) SNZEDCR b0
DTC transfer completion (DTC_COMPLETE) SNZEDCR b1
Not DTC transfer completion (DTC_TRANSFER) SNZEDCR b2
ADC160 window A/B compare match (ADC160_WCMPM) SNZEDCR b3
ADC160 window A/B compare mismatch (ADC160_WCMPUM) SNZEDCR b4
SCI0 address mismatch (SCI0_DCUF) SNZEDCR b7
Note: If the DTC is used to activate the ADC160, CTSU, or SCI0, the MCU transitions to software standby mode after a
snooze end request is generated.
WFI Trigger
instruction detection
Standby release
signal Low
Snooze end
signal
Software
Normal Standby
Low power mode mode*2 mode *1
Snooze mode Software Standby mode
Oscillator Oscillation
Oscillates stopped Oscillates Oscillation stopped
for system clock
Figure 11.10 Canceling of Snooze mode when an interrupt request signal is not generated
SNZCR.b7 = 1
Enable Snooze mode
(SNZE = 1)
No
Snooze request?
Yes
Snooze mode
SYSTEM_SNZREQ
By way of ELC
Module operating
Normal mode
High-speed mode
Middle-speed mode
Low-speed mode.
Do not use Low-voltage mode or Subosc-speed mode. Table 11.9 and Table 11.10 show the maximum transfer rate of
SCI0 in Snooze mode. When using the SCI0 in Snooze mode, set the following bits:
BGDM = 0
ABCS = 0
ABCSE = 0.
See section 27, Serial Communications Interface (SCI) for information on these bits.
Note 1. SCI0.SMR.CKS[1:0] = 00b, SCI0.SEMR.BRME = 1, SCI0.BRR = 3Dh, SCI0.MDDR = CEh must be used for 9600 bps.
Note 2. SCI0.SMR.CKS[1:0] = 00b, SCI0.SEMR.BRME = 1, SCI0.BRR = 1Eh, SCI0.MDDR = CEh must be used for 9600 bps.
Note 3. SCI0.SMR.CKS[1:0] = 00b, SCI0.SEMR.BRME = 1, SCI0.BRR = 0Dh, SCI0.MDDR = BAh must be used for 9600 bps.
Note 4. SCI0.SMR.CKS[1:0] = 00b, SCI0.SEMR.BRME = 1, SCI0.BRR = 3Eh, SCI0.MDDR = 9Dh must be used for 9600 bps.
Note 5. SCI0.SMR.CKS[1:0] = 00b, SCI0.SEMR.BRME = 1, SCI0.BRR = 32h, SCI0.MDDR = FEh must be used for 9600 bps.
Note 6. SCI0.SMR.CKS[1:0] = 00b, SCI0.SEMR.BRME = 1, SCI0.BRR = 18h, SCI0.MDDR = F9h must be used for 9600 bps.
Figure 11.12 shows an example setting for using SCI0 in Snooze mode entry.
MOCOCR.MCSTP = 1
Stop MOCO and the main clock oscillator
MOSCCR.MOSTP =1
SNZEDCR.b0 = 1
Enable snooze end request by AGT1 underflow
(AGTUNFED = 1)
SNZCR.b7 = 1
Enable Snooze mode
(SNZE = 1)
No
Snooze request?
Yes
Snooze mode
SCI0 receive
No AGT1 underflow
data completed before
AGT1 underflow?
Yes SELS event
SELS event or (receive data full or receive error)
snooze end request?
Snooze end request
(address mismatch)
Normal mode
End
Note 1. For the DTC activation sources, see Table 13.4, Event table.
Note 2. Non-maskable interrupts can be enabled only once after a reset release.
Note 3. These non-maskable interrupts can also be used as event signals. When used as interrupts, do not change the
value of the NMIER register from the reset state.To enable voltage monitor 1 and voltage monitor 2 interrupts, set
the LVD1CR1.IRQSEL and LVD2CR1.IRQSEL bits to 1.
Note 4. Low level: interrupt detection is not canceled if you do not clear it after a detection.
Note 5. See section 13.2.7, SYS Event Link Setting Register (SELSR0) and section 13.2.8, Wake Up Interrupt Enable
Register (WUPEN).
Interrupt Controller
CPU stack pointer monitor
MPU bus master error
MPU bus slave error
SRAM ECC error
SRAM parity error Clock
IWDT underflow/refresh error
WDT underflow/refresh error Clock restoration request Generation
Oscillation stop detection interrupt Circuit
Voltage monitor 2 interrupt NMI
Voltage monitor 1 interrupt
SR
Clock restoration Clock restoration enable level
CPU
Low voltage detection Digital determination
Detection
NMI pin filter
IRQ0
Digital
NVIC
Detection
filter
IRQ7
SELSR0
Peripheral
Module
Interrupt request
IELSRn
Control Destination switchover
to CPU
DTC activation
request
DTC
Interrupt DTC
source activation
IR
control DTC response
DTC
Switching the interrupt status and the transfer destination
NMISR: Non-Maskable Interrupt Status Register FCLKSEL: IRQi Digital Filter Sampling Clock Select
NMIER: Non-Maskable Interrupt Enable Register (IRQCRi.FCLKSEL (i = 0 to 7))
NMICLR: Non-Maskable Interrupt Status Clear Register FLTEN: IRQi Digital Filter Enable (IRQCRi.FLTEN (i = 0 to 7))
NMIMD: NMI Detection Set (NMICR.NMIMD) SELSR: SYS Event Link Setting Register 0
NFCLKSEL: NMI Digital Filter Sampling Clock Select WUPEN: Wake Up Interrupt Enable Register
(NMICR.NFCLKSEL) IELSRn: ICU Event Link Setting Register n (n = 0 to 31)
NFLTEN: NMI Digital Filter Enable (NMICR.NFLTEN) IR: Interrupt Status Flag (IELSRn.IR)
IRQMD: IRQi Detection Sense Select DTCE: DTC Activation Enable (IELSRn.DTCE)
(IRQCRi.IRQMD (i = 0 to 7))
Address(es): ICU.IRQCR0 4000 6000h, ICU.IRQCR1 4000 6001h, ICU.IRQCR2 4000 6002h, ICU.IRQCR3 4000 6003h,
ICU.IRQCR4 4000 6004h, ICU.IRQCR5 4000 6005h, ICU.IRQCR6 4000 6006h, ICU.IRQCR7 4000 6007h
b7 b6 b5 b4 b3 b2 b1 b0
— — — SPEST BUSMS BUSSS RECCS RPEST NMIST OSTST — — LVD2S LVD1S WDTST IWDTS
T T T T T T
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
b6 OSTST Main Clock Oscillation Stop Detection 0: Interrupt not requested for main clock oscillation stop R
Interrupt Status Flag 1: Interrupt requested for main clock oscillation stop.
b7 NMIST NMI Pin Interrupt Status Flag 0: Interrupt not requested R
1: Interrupt requested.
b8 RPEST SRAM Parity Error Interrupt Status Flag 0: Interrupt not requested R
1: Interrupt requested.
b9 RECCST SRAM ECC Error Interrupt Status Flag 0: Interrupt not requested R
1: Interrupt requested.
b10 BUSSST MPU Bus Slave Error Interrupt Status Flag 0: Interrupt not requested R
1: Interrupt requested.
b11 BUSMST MPU Bus Master Error Interrupt Status Flag 0: Interrupt not requested R
1: Interrupt requested.
b12 SPEST CPU Stack Pointer Monitor Interrupt Status 0: Interrupt not requested R
Flag 1: Interrupt requested.
b15 to b13 — Reserved These bits are read as 0. R
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.
[Setting condition]
When the WDT underflow/refresh error interrupt is generated.
[Clearing condition]
When 1 is written to the NMICLR.WDTCLR bit.
OSTST flag (Main Clock Oscillation Stop Detection Interrupt Status Flag)
The OSTST flag indicates a main clock oscillation stop detection interrupt request. It is read-only and cleared by the
NMICLR.OSTCLR bit.
[Setting condition]
When the main clock oscillation stop detection interrupt is generated.
[Clearing condition]
When 1 is written to the NMICLR.OSTCLR bit.
[Setting condition]
When an interrupt is generated in response to an SRAM ECC error.
[Clearing condition]
When 1 is written to the NMICLR.RECCCLR bit.
— — — SPEEN BUSME BUSSE RECCE RPEEN NMIEN OSTEN — — LVD2E LVD1E WDTE IWDTE
N N N N N N N
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
b5, b4 ― Reserved These bits are read as 0. The write value should be 0. R/W
b6 OSTEN Main Clock Oscillation Stop Detection 0: Disabled R/(W)
Interrupt Enable 1: Enabled. *1, *2
b10 BUSSEN MPU Bus Slave Error Interrupt Enable 0: Disabled R/(W)
1: Enabled. *1
b11 BUSMEN MPU Bus Master Error Interrupt Enable 0: Disabled R/(W)
1: Enabled. *1
b15 to b13 ― Reserved These bits are read as 0. The write value should be 0. R/W
Note 1. You can write 1 to this bit only once after reset. Subsequent write accesses are invalid. Writing 0 to this bit is
invalid.
Note 2. Do not write 1 to this bit when the source is used as an event signal.
— — — SPECL BUSM BUSSC RECCC RPECL NMICL OSTCL — — LVD2C LVD1C WDTCL IWDTC
R CLR LR LR R R R LR LR R LR
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
b7 b6 b5 b4 b3 b2 b1 b0
Change the NMICR register settings before enabling NMI pin interrupts, that is, before setting NMIER.NMIEN to 1.
Address(es): ICU.IELSR0 4000 6300h, ICU.IELSR1 4000 6304h, ICU.IELSR2 4000 6308h, ICU.IELSR3 4000 630Ch, ...
..., ICU.IELSR28 4000 6370h, ICU.IELSR29 4000 6374h, ICU.IELSR30 4000 6378h, ICU.IELSR31 4000 637Ch
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — — — DTCE — — — — — — — IR
— — — — — — — — IELS[7:0]
The IELSRn register selects the IRQ source used by the NVIC. For details, see Table 13.4. IELSRn, where n = 0 to 31,
corresponds to the NVIC-IRQ input source numbers 0 to 31.
— — — — — — — — SELS[7:0]
The SELSR0 register selects the events that wake up the CPU from Snooze mode. You can use only the events listed in
Table 13.4 checked as “Canceling Snooze mode”. When 0Bh is set in IELSRn.IELS[7:0], an Interrupt is generated that
cancels snooze mode.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
IIC0WU AGT1CB AGT1CA AGT1UD USBFS RTCPRD RTCALM ACMPLP LVD2WU LVD1WU KEYWU IWDTW
— — — —
PEN WUPEN WUPEN WUPEN WUPEN WUPEN WUPEN 0WUPE PEN PEN PEN UPEN
N
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
— — — — — — — — IRQWUPEN[7:0]
The bits in this register control whether the associated interrupt can wake up the CPU from Software Standby mode.
AGT1CAWUPEN bit (AGT1 Compare Match A Interrupt Software Standby Returns Enable)
The AGT1CAWUPEN bit enables the use of AGT1 compare match A interrupts to cancel Software Standby mode.
AGT1CBWUPEN bit (AGT1 Compare Match B Interrupt Software Standby Returns Enable)
The AGT1CBWUPEN bit enables the use of AGT1 compare match B interrupts to cancel Software Standby mode.
IIC0WUPEN bit (IIC0 Address Match Interrupt Software Standby Returns Enable)
The IIC0WUPEN bit enables the use of IIC0 interrupts to cancel Software Standby mode.
Heading Description
Interrupt request source Name of the source generating the interrupt request
02h PORT_IRQ1
03h PORT_IRQ2
04h PORT_IRQ3
05h PORT_IRQ4
06h PORT_IRQ5
07h PORT_IRQ6
08h PORT_IRQ7
0Eh LVD_LVD2 -
12h AGT0_AGTCMAI - -
13h AGT0_AGTCMBI - -
15h AGT1_AGTCMAI
16h AGT1_AGTCMBI
1Ah RTC_PRD -
1Bh RTC_CUP - - -
1Dh ADC160_GBADI - -
1Eh ADC160_CMPAI - - -
1Fh ADC160_CMPBI - - -
24h ACMP_LP1 - - -
26h USBFS_USBR -
28h IIC0_TXI - -
29h IIC0_TEI - - -
2Ah IIC0_EEI - - -
2Bh IIC0_WUI -
2Dh IIC1_TXI - -
2Eh IIC1_TEI - - -
2Fh IIC1_EEI - - -
31h CTSU_CTSURD - -
36h CAC_MENDI - - -
37h CAC_OVFI - - -
39h CAN0_RXF - - -
3Ah CAN0_TXF - - -
3Bh CAN0_RXM - - -
3Ch CAN0_TXM - - -
42h POEG_GROUP1 - - -
44h SDADC_SCANEND - -
45h SDADC_CALIEND - - -
47h GPT0_CCMPB - -
48h GPT0_CMPC - -
49h GPT0_CMPD - -
4Ah GPT0_OVF - -
4Bh GPT0_UDF - -
4Dh GPT1_CCMPB - -
4Eh GPT1_CMPC - -
4Fh GPT1_CMPD - -
50h GPT1_OVF - -
51h GPT1_UDF - -
53h GPT2_CCMPB - -
54h GPT2_CMPC - -
55h GPT2_CMPD - -
56h GPT2_OVF - -
57h GPT2_UDF - -
59h GPT3_CCMPB - -
5Ah GPT3_CMPC - -
5Bh GPT3_CMPD - -
5Ch GPT3_OVF - -
5Dh GPT3_UDF - -
5Fh GPT4_CCMPB - -
60h GPT4_CMPC - -
61h GPT4_CMPD - -
62h GPT4_OVF - -
63h GPT4_UDF - -
65h GPT5_CCMPB - -
66h GPT5_CMPC - -
67h GPT5_CMPD - -
68h GPT5_OVF - -
69h GPT5_UDF - -
6Bh GPT6_CCMPB - -
6Ch GPT6_CMPC - -
6Dh GPT6_CMPD - -
6Eh GPT6_OVF - -
6Fh GPT6_UDF - -
72h SCI0_TXI
73h SCI0_TEI - - -
74h SCI0_ERI - - -
78h SCI1_TXI - -
79h SCI1_TEI - - -
7Ah SCI1_ERI - - -
7Bh SCI1_AM - - -
7Dh SCI9_TXI - -
7Eh SCI9_TEI - - -
7Fh SCI9_ERI - - -
80h SCI9_AM - - -
82h SPI0_SPTI - -
83h SPI0_SPII - - -
84h SPI0_SPEI - - -
85h SPI0_SPTEND - - -
87h SPI1_SPTI - -
88h SPI1_SPII - - -
89h SPI1_SPEI - - -
8Ah SPI1_SPTEND - - -
8Ch AES_RDREQ - -
IELSRn
Set by software interrupt
Event select
Event
factor Pending
IR
Interrupt
source Set
Set
Reset
Reset
Enable register
Note: Do not use an interrupt request destination setting that is not indicated by a check, , in the event list (Table 13.4,
Event table).
If you select the CPU or DTC in the IELSRn register, setting the same interrupt factor in any other IELSRn register is
prohibited.
If the DTC is selected as the destination for requests from an IRQi pin, you must set the IRQMD[1:0] bits in IRQCRi for
that interrupt to select edge detection.
Note 1. Set the interrupt request mode for the DTC in the DTC.MRB.DISEL bit.
Note 2. When the IELSRn.IR flag is 1, an interrupt request (DTC activation request) that occurs again is ignored.
Note 3. For chain transfers, DTC transfer continues until the last chain transfer ends. The DISEL bit state and the
remaining transfer count determine whether a CPU interrupt occurs, the IELSRn.IR flag clear timing, and the
interrupt request destination after transfer. See Table 16.3, Chain transfer conditions in section 16, Data Transfer
Controller (DTC).
1) Set the sampling clock cycle to PCLKB, PCLKB/8, PCLKB/32, or PCLKB/64 in the IRQCRi.FCLKSEL[1:0] bits (i = 0 to 7).
2) Set the IRQCRi.FLTEN bit (i = 0 to 7) to 1 (digital filter enabled).
1) Set the sampling clock cycle to PCLKB, PCLKB/8, PCLKB/32, or PCLKB/64 in the NMICR.NFCLKSEL[1:0] bits.
2) Set the NMICR.NFLTEN bit to 1 (digital filter enabled).
Sampling clock
for digital filter
IRQCRi.FLTEN bit*1
Pulses removed
IRQi_d*1
(internal F/F)
Note 1. i = 0 to 7
For non-maskable interrupts, use the NMIER register to enable the target interrupt request
For maskable interrupts, use the WUPEN register to enable the target interrupt request.
2. Select the CPU as the interrupt request destination.
3. 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 event selected in IELSRn is detected, the CPU
acknowledges the interrupt after returning to Normal mode from Software Standby mode.
13.8 Reference
ARM® Cortex®-M23 Processor Technical Reference Manual (ARM DDI 0550C).
14. Buses
14.1 Overview
Table 14.1 lists the bus specifications, Figure 14.1 shows the bus configuration, and Table 14.2 lists the addresses
assigned for each bus.
CM23 DTC
System bus
DMA bus
Code flash
memory
Flash/SRAM access
CPU instruction fetching Flash Flash Flash SRAM SRAM SRAM SRAM
IERES — — — — — — — — — — — — — — —
Note: Changing reserved bits from the initial value of 0 is prohibited. Operation during the change is not guaranteed.
Address(es): BUS.BUSSCNTFLI 4000 4100h, BUS.BUSSCNTRAM0 4000 410Ch, BUS.BUSSCNTP0B 4000 4114h, BUS.BUSSCNTP2B 4000 4118h,
BUS.BUSSCNTP4B 4000 4120h, BUS.BUSSCNTP6B 4000 4128h, BUS.BUSSCNTFBU 4000 4130h
— — — — — — — — — — ARBMET[1:0] — — — —
Note: Changing reserved bits from the initial value of 0 is prohibited. Operation during the change is not guaranteed.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
BERAD[31:16]
BERAD[15:0]
Note: This register is only cleared by resets other than MPU-related resets. For more information, see section 6,
Resets, and section 15, Memory Protection Unit (MPU).
Table 14.3 lists the registers associated with each bus type.
b7 b6 b5 b4 b3 b2 b1 b0
ERRST — — — — — — ACCST
AT AT
Value after reset: 0 0 0 0 0 0 0 x
Note: This register is only cleared by resets other than MPU-related resets. For more information, see section 6,
Resets, and section 15, Memory Protection Unit (MPU).
Table 14.3 lists the registers associated with each bus type.
Note: DTC does not receive bus errors. If the DTC accesses the bus, the transfer continues.
14.4.4 Timeout
For some peripheral modules, a timeout error occurs with the module-stop function. When there is no response from the
slave for a certain period of time, a timeout error is detected. A timeout error is returned to the requesting master IP using
the AHB-Lite error response protocol.
14.6 References
1. ARM®v8-M Architecture Reference Manual (ARM DDI 0553B.a)
2. ARM® Cortex®-M23 Processor User Guide (ARM DUI 0963B)
3. ARM® AMBA® 5 AHB-Lite Protocol Specification (ARM IHI 0033B.b).
For information on error access for Arm MPU, see section 15.7. For information on error access for other MPUs, see
section 14.3.3, Bus Error Address Register (BUSnERRADD) (n = 3, 4) and section 14.3.4, BUS Error Status Register
(BUSnERRSTAT) (n = 3, 4) in section 14, Buses.
R0
R1
R2
R3
R4
R5
R6
R7
R8
R9
R10
R11
R12
Process Stack Main Stack
R13 (SP) Pointer (PSP) Pointer (MSP)
R14 (LR)
R15 (PC)
xPSR
Reset
Compare
(within) Non-maskable
interrupt
ERROR
flag
Compare
(within)
ERROR
flag
Start
End
15.2.3.1 Main Stack Pointer (MSP) Monitor Start Address Register (MSPMPUSA)
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
MSPMPUSA[31:16]
MSPMPUSA[15:0]
x: Undefined
The MSPMPUSA and MSPMPUEA registers specify the CPU stack region in the SRAM (1FF0 0000h to 200F FFFFh,
excluding reserved areas). For SRAM area to be covered, see Figure 4.1, Memory map.
15.2.3.2 Main Stack Pointer (MSP) Monitor End Address Register (MSPMPUEA)
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
MSPMPUEA[31:16]
MSPMPUEA[15:0]
x: Undefined
15.2.3.3 Process Stack Pointer (PSP) Monitor Start Address Register (PSPMPUSA)
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
PSPMPUSA[31:16]
PSPMPUSA[15:0]
x: Undefined
The PSPMPUSA and PSPMPUEA registers specify the CPU stack region in the SRAM (1FF0 0000h to 200F FFFFh,
excluding reserved areas). For SRAM area to be covered, see Figure 4.1, Memory map.
15.2.3.4 Process Stack Pointer (PSP) Monitor End Address Register (PSPMPUEA)
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
PSPMPUEA[31:16]
PSPMPUEA[15:0]
x: Undefined
KEY[7:0] — — — — — — — OAD
— — — — — — — ERRO — — — — — — — ENABL
R E
Value after reset: 0 0 0 0 0 0 0 0/1*1 0 0 0 0 0 0 0 0
When the MSPMPUCTL.ENABLE bit is set to 1, the following registers are available:
MSPMPUSA
MSPMPUEA
MSPMPUOAD.
When the PSPMPUCTL.ENABLE bit is set to 1, the following registers are available:
PSPMPUSA
PSPMPUEA
PSPMPUOAD.
KEY[7:0] — — — — — — — PROTE
CT
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
PSPMPUSA
PSPMPUEA.
When writing to the PROTECT bit, simultaneously write A5h to the KEY[7:0] bits, using halfword access.
CPU DTC
system bus
Peripheral
Code flash Data flash Peripheral
SRAM0 module related SecureIPs
memory memory module
system control
Region
Compare
control
(within)
circuit Master
Region 0 control
Region 1 circuit
Region 2
Region 3
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
MMPUSA[31:16]
MMPUSA[15:0]
x: Undefined
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
MMPUEA[31:16]
MMPUEA[15:0]
x: Undefined
— — — — — — — — — — — — — WP RP ENABL
E
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
The ENABLE, RP, and WP bits are individually configurable for each group A region n unit.
Table 15.5 shows the correspondence of the output information from the group A area n unit when the area set by the
MMPUACAn register is accessed.
n = 0 to 3
KEY[7:0] — — — — — — — PROTE
CT
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15.4.2 Operation
Setting of
regions Protected region
Region 0 R/W
Clear of Region 1 read only
MMPUACAn. Region 2 write only
All memory is All memory is ENABLE bit
R/W protected
after reset region Clear of Protected region
MMPUCTLA. Region 3 R/W
ENABLE bit
Protected region
Region 1 read-only
(write protection) Read permitted/write protected region
Region 2 write-only
(read protection) Read/write protected region
Region 3
(R/W protection)
Figure 15.6 Access permission or protection by overlap of the bus master MPU regions
Figure 15.7 shows the register setting flow after reset. During this register setting, stop the bus master except the CPU.
Start
End
Start
End
The bus slave MPU is located on each bus slave side and controls the permission or protection of access from each bus
master to each bus slave.
CPU
DTC
System bus
— — — — — — — — — — — — WPGR RPGRP — —
PA A
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15.5.2 Operation
PC region 0
Program counter
PC region 1
Region 0
Region 1
Bus of CPU Mask of access of CPU
Region 2
Region 3
Region 0
Bus of Region 1 Mask of access of master MPU
master MPU group A
group A Region 2
Region 3
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
SECMPUPCS[31:16]
SECMPUPCS[15:0]
Note 1. The address of these registers will be changed when the boot swap is set.
The SECMPUPCSn and SECMPUPCEn registers specify the security fetch region of the code flash (0000 0000h to
000F FFFFh, excluding reserved areas) or SRAM (1FF0 0000h to 200F FFFFh, excluding reserved areas). The secure
program is executed in the memory space defined by the SECMPUPCSn and SECMPUPCEn registers, and can access
the secure data specified in the SECMPUSm and SECMPUEm registers (m = 0 to 3).
The SECMPUPCSn register specifies the address where the region starts. Setting of the memory mirror space (0200
0000h to 027F FFFFh) for MMF is prohibited.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
SECMPUPCE[31:16]
SECMPUPCE[15:0]
Note 1. The address of these registers will be changed when the boot swap is set.
The SECMPUPCEn register specifies the address where the region ends.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — — — — SECMPUS0[23:16]
SECMPUS0[15:0]
Note 1. The address of these registers will be changed when the boot swap is set.
The SECMPUS0 and SECMPUE0 registers specify the secure region of the code flash (0000 0000h to 000F FFFFh,
excluding reserved areas). The memory space defined in the SECMPUS0 and SECMPUE0 registers can only be
accessed from the secure program set up in the SECMPUPCSn and SECMPUPCEn registers.
The SECMPUS0 register specifies the address where the region starts. Setting of the vector table area is prohibited.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — — — — SECMPUE0[23:16]
SECMPUE0[15:0]
Note 1. The address of these registers will be changed when the boot swap is set.
The SECMPUE0 register specifies the address where the region ends.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
SECMPUS1[31:16]
SECMPUS1[15:0]
Note 1. The address of these registers will be changed when the boot swap is set.
The SECMPUS1 and SECMPUE1 registers specify the secure region of the SRAM (1FF0 0000h to 200F FFFFh,
excluding reserved areas). The memory space defined in the SECMPUS1 and SECMPUE1 registers can only be
accessed from the secure program set up in the SECMPUPCSn and SECMPUPCEn registers.
The SECMPUS1 register specifies the address where the region starts. Setting of the stack area and the vector table are
prohibited.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
SECMPUE1[31:16]
SECMPUE1[15:0]
Note 1. The address of these registers will be changed when the boot swap is set.
The SECMPUE1 register specifies the address where the region ends.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
SECMPUS2[31:16]
SECMPUS2[15:0]
Note 1. The address of these registers will be changed when the boot swap is set.
The SECMPUS2 and SECMPUE2 registers specify the secure region of the security functions (400C 0000h to
400D FFFFh and 4010 0000h to 407F FFFFh). The memory space defined in the SECMPUS2 and SECMPUE2 registers
can only be accessed from the secure program set up in the SECMPUPCSn and SECMPUPCEn registers.
The SECMPUS2 register specifies the address where the region starts.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
SECMPUE2[31:16]
SECMPUE2[15:0]
Note 1. The address of these registers will be changed when the boot swap is set.
The SECMPUE2 register specifies the address where the region ends.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
SECMPUS3[31:16]
SECMPUS3[15:0]
Note 1. The address of these registers will be changed when the boot swap is set.
The SECMPUS3 and SECMPUE3 registers specify the secure region of the security functions (400C 0000h to
400D FFFFh and 4010 0000h to 407F FFFFh). The memory space defined in the SECMPUS3 and SECMPUE3 registers
can only be accessed from the secure program set up in the SECMPUPCSn and SECMPUPCEn registers.
The SECMPUS3 register specifies the address where the region starts.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
SECMPUE3[31:16]
SECMPUE3[15:0]
Note 1. The address of these registers will be changed when the boot swap is set.
The SECMPUE3 register specifies the address where the region ends.
Note 1. The address of these registers will be changed when the boot swap is set.
Memory Memory
Non-secure data
Non-secure data
Non-secure program
Secure function Region 2
(secure IPs) Secure data
Non-secure data
SRAM
Region1 Secure data
PC region 1 Secure program
Secure program in code flash (PC region 0) can access all data (secure data and non-secure data).
Secure program in SRAM (PC region 1) can access all data (secure data and non-secure data).
Non secure program (not PC region 0 or PC region 1) cannot access secure data (region 0, region 1, region 2, and region 3).
Non secure program (not PC region 0 or PC region 1) can access non-secure data.
15.7 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 Processor User Guide (ARM DUI 0963B).
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
b7 b6 b5 b4 b3 b2 b1 b0
x: Undefined
The MRA register cannot be accessed directly from the CPU. However, the CPU can access SRAM area (transfer
information (n) start address + 03h) and DTC transfer it automatically to and from the MRA register. See section 16.3.1,
Allocating Transfer Information and DTC Vector Table.
b7 b6 b5 b4 b3 b2 b1 b0
x: Undefined
The MRB register cannot be accessed directly from the CPU. However, the CPU can access the SRAM area (transfer
information (n) start address + 02h) and DTC transfer it automatically from and to the MRB register. See section 16.3.1,
Allocating Transfer Information and DTC Vector Table.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
x: Undefined
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 + 04h) and DTC transfer it automatically from and to the
SAR register. See section 16.3.1, Allocating Transfer Information and DTC Vector Table.
Note: Misalignment is prohibited for DTC transfers.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
x: Undefined
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 + 08h) and DTC transfer it automatically from and to
the DAR register. See section 16.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.
Note: Misalignment is prohibited for DTC transfers.
CRA
CRAH CRAL
x: Undefined
The CRA register cannot be accessed directly from the CPU, however the CPU can access the SRAM area (transfer
information (n) start address + 0Eh) and DTC transfer it automatically to and from the CRA register. See section 16.3.1,
Allocating Transfer Information and DTC Vector Table.
x: Undefined
The CRB sets the block transfer count for block transfer mode. The transfer count is 1, 65535, and 65536 when the set
value is 0001h, FFFFh, and 0000h, 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 + 0Ch) and DTC transfer it automatically to and from the CRB register. See section 16.3.1, Allocating
Transfer Information and DTC Vector Table.
b7 b6 b5 b4 b3 b2 b1 b0
— — — RRS — — — —
(CRB register) becomes 0 during the previous block transfer, the transfer information is read regardless of the RRS bit
value.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
The DTCVBR sets the base address for calculating the DTC vector table address, which can be set in the range of
0000 0000h to FFFF FFFFh (4 GB) in 1-KB units.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — DTCST
ACT — — — — — — — VECN[7:0]
Upper: DTCVBR
DTC vector table
Lower: vector number 4
:
:
:
+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
16.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.
There are three transfer modes:
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 16.2 describes the DTC transfer modes.
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 16.4 shows the operation flow of the DTC. Table 16.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
RRS = 1 Compare vector
numbers. Match
Mismatch or RRS = 0
Read DTC vector
Next transfer
Read transfer
information
Update transfer
information start address
Yes
CHNE = 1
No Yes
CHNS = 0
No
No
Yes Yes
Last data transfer Last data transfer
(Transfer counter = 1)*1 (Transfer counter = 1)*1
No No
Yes
DISEL = 1
No
Write transfer information Write transfer information Write transfer information Write transfer information
End
Note 1. The transfer counters used depend on the transfer modes as follows:
Normal transfer mode — CRA register
Repeat transfer mode — CRAL register
Block transfer mode — CRB register
Note 2. On completion of a data transfer, the counters operate as follows:
1 → 0 in normal and block transfer modes
1 → CRAH in repeat transfer mode
(1 → *) in the table indicates both of these two operations, depending on the mode.
Note 3. Chain transfer can be selected for the second or subsequent transfers. The conditions for the combination of the
second transfer and CHNE = 1 is omitted.
Table 16.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 per each event) Data 2
Data 3 Data 3
Data 4 Data 4
Data 5 Data 5
Data 6 Data 6
Figure 16.5 Memory map of normal transfer mode (MRA.SM[1:0] = 10b, MRB.DM[1:0] = 10b, CRA=0006h)
Transfer 8
SAR Data 1 times Data 1 DAR
(transfer 1 data
Data 2 per each event) Data 2
Data 3 Data 3
Data 4 Data 4
Data 1
Data 2
Data 3
Data 4
Figure 16.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=04h)
SAR
First block
Transfer
nth block
Data area
Transfer information
DTC vector table allocated in the SRAM
specified data transfer. In repeat transfer mode, chain transfer is performed after completion of the specified data transfer.
For details on chain transfer conditions, see Table 16.3, Chain transfer conditions.
System clock
ICU.IELSRn.IR
DTC access R W
Figure 16.9 Example 1 of DTC operation timing in normal transfer and repeat transfer modes
System clock
ICU.IELSRn.IR
DTC access
Figure 16.10 Example 2 of DTC operation timing in block transfer mode when the block size = 4
System clock
ICU.IELSRn.IR
DTC access R W R W
System clock
(1) (2)
ICU.IELSRn.IR
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 16.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
Start
Set the DTCCR.RRS bit to 0 [1] [1] 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.
Set transfer information [2] [2] Allocate transfer information (MRA, MRB, SAR, DAR, CRA,
(MRA, MRB, SAR, DAR, CRA, and CRB)
and CRB) in the data area. For setting transfer information,
see section 16.2, Register Descriptions. For how to allocate
transfer information, see section 16.3.1, Allocating Transfer
Information and DTC Vector Table.
Set transfer information start addresses in
[3] [3] Set the transfer information start addresses in the DTC
the DTC vector table
vector table. For how to set the DTC vector table, see
section 16.3.1, Allocating Transfer Information and DTC
Vector Table.
Set the DTCCR.RRS bit to 1 [4] [4] 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.
Set the ICU.IELSRn.DTCE bit to 1.
Set the ICU.IELSRn.IELS[7:0] as interrupt [5]
source. The interrupt should be enabled [5] Set the ICU.IELSRn.DTCE bit to 1. Set
in the NVIC. ICU.IELSRn.IELS[7:0] as interrupt sources that trigger
DTC. The interrupt must be enabled in the NVIC. See Table
13.4, Event table.
Set the enable bit for [6] Set the enable bit for the activation source interrupts to 1.
[6]
an activation source interrupt
When a source interrupt is generated, the DTC is activated.
To set the interrupt source enable bit, see the settings for
Setting for each activation
source the modules that are to be the activation sources.
Common setting
for DTC
Set the DTCST.DTCST bit to 1 [7] [7] Set the DTC Module Start bit (DTCST.DTCST) to 1.
End
Note: The DTCST.DTCST bit can be set even if the setting for the activation source is not complete.
Input circuit
Input buffer
DTC transfer ends. When 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.
ELC
PORT_IRQn
GPT
(n = 0 to 7)
DTC ADC16
LVD DAC12
SYSTEM_SNZREQ DAC8
b7 b6 b5 b4 b3 b2 b1 b0
ELCON — — — — — — —
b7 b6 b5 b4 b3 b2 b1 b0
WI WE — — — — — SEG
17.2.3 Event Link Setting Register n (ELSRn) (n = 0 to 3, 8, 9, 12, 14, 15, 18 to 20, 22)
Address(es): ELC.ELSR0 4004 1010h, ELC.ELSR1 4004 1014h, ELC.ELSR2 4004 1018h, ELC.ELSR3 4004 101Ch, ELC.ELSR8 4004 1030h,
ELC.ELSR9 4004 1034h, ELC.ELSR12 4004 1040h, ELC.ELSR14 4004 1048h, ELC.ELSR15 4004 104Ch, ELC.ELSR18 4004 1058h,
ELC.ELSR19 4004 105Ch, ELC.ELSR20 4004 1060h, ELC.ELSR22 4004 1068h
— — — — — — — — ELS[7:0]
The ELSRn register specifies an event signal to be linked to each peripheral module. Table 17.2 shows the associations
between the ELSRn registers and the peripheral modules. Table 17.3 shows the association between the event signal
names set in the ELSRn registers and the signal numbers.
Table 17.2 Association between the ELSRn registers and peripheral functions
Register name Peripheral function (module) Event name
ELSR0 GPT (A) ELC_GPTA
ELSR1 GPT (B) ELC_GPTB
ELSR2 GPT (C) ELC_GPTC
ELSR3 GPT (D) ELC_GPTD
ELSR8 ADC16A ELC_AD00
ELSR9 ADC16B ELC_AD01
ELSR12 DAC12 ELC_DAC12
ELSR14 PORT 1 ELC_PORT1
ELSR15 PORT 2 ELC_PORT2
ELSR18 CTSU ELC_CTSU
ELSR19 DA80 ELC_DA80
ELSR20 DA81 ELC_DA81
ELSR22 SDADC24 ELC_SDADC
Table 17.3 Association between event signal names set in ELSRn.ELS[7:0] bits and signal numbers (1 of 4)
Event number Interrupt request source Name Description
01h Port PORT_IRQ0*1 External pin interrupt 0
02h PORT_IRQ1*1 External pin interrupt 1
03h PORT_IRQ2*1 External pin interrupt 2
04h PORT_IRQ3*1 External pin interrupt 3
05h PORT_IRQ4*1 External pin interrupt 4
06h PORT_IRQ5*1 External pin interrupt 5
07h PORT_IRQ6*1 External pin interrupt 6
08h PORT_IRQ7*1 External pin interrupt 7
0Ah DTC DTC_DTCEND*3 DTC transfer end
Table 17.3 Association between event signal names set in ELSRn.ELS[7:0] bits and signal numbers (2 of 4)
Event number Interrupt request source Name Description
0Dh LVD LVD_LVD1 Voltage monitor 1 interrupt
0Eh LVD_LVD2 Voltage monitor 2 interrupt
0Fh MOSC MOSC_STOP Main clock oscillation stop
10h Low Power mode SYSTEM_SNZREQ*2, *3 Snooze entry
11h AGT0 AGT0_AGTI AGT interrupt
12h AGT0_AGTCMAI Compare match A
13h AGT0_AGTCMBI Compare match B
14h AGT1 AGT1_AGTI AGT interrupt
15h AGT1_AGTCMAI Compare match A
16h AGT1_AGTCMBI Compare match B
17h IWDT IWDT_NMIUNDF IWDT underflow
18h WDT WDT_NMIUNDF WDT underflow
1Ah RTC RTC_PRD Periodic interrupt
1Ch ADC16 ADC160_ADI A/D scan end interrupt
20h ADC160_WCMPM*3 Compare match
21h ADC160_WCMPUM*3 Compare mismatch
22h ACMPHS ACMP_HS0*1 High-speed analog comparator interrupt 0
23h ACMPLP ACMP_LP0*1 Low-power analog comparator interrupt 0
24h ACMP_LP1*1 Low-power analog comparator interrupt 1
27h IIC0 IIC0_RXI Receive data full
28h IIC0_TXI Transmit data empty
29h IIC0_TEI Transmit end
2Ah IIC0_EEI Transfer error
2Ch IIC1 IIC1_RXI Receive data full
2Dh IIC1_TXI Transmit data empty
2Eh IIC1_TEI Transmit end
2Fh IIC1_EEI Transfer error
34h DOC DOC_DOPCI*3 Data operation circuit interrupt
3Dh I/O Ports IOPORT_GROUP1 Port 1 event
3Eh IOPORT_GROUP2 Port 2 event
3Fh ELC ELC_SWEVT0 Software event 0
40h ELC_SWEVT1 Software event 1
43h SDADC24 SDADC_ADI A/D conversion end interrupt
44h SDADC_SCANEND A/D automatic scan completion interrupt
46h GPT320 GPT0_CCMPA Compare match A
47h GPT0_CCMPB Compare match B
48h GPT0_CMPC Compare match C
49h GPT0_CMPD Compare match D
4Ah GPT0_OVF Overflow
4Bh GPT0_UDF Underflow
Table 17.3 Association between event signal names set in ELSRn.ELS[7:0] bits and signal numbers (3 of 4)
Event number Interrupt request source Name Description
4Ch GPT161 GPT1_CCMPA Compare match A
4Dh GPT1_CCMPB Compare match B
4Eh GPT1_CMPC Compare match C
4Fh GPT1_CMPD Compare match D
50h GPT1_OVF Overflow
51h GPT1_UDF Underflow
52h GPT162 GPT2_CCMPA Compare match A
53h GPT2_CCMPB Compare match B
54h GPT2_CMPC Compare match C
55h GPT2_CMPD Compare match D
56h GPT2_OVF Overflow
57h GPT2_UDF Underflow
58h GPT163 GPT3_CCMPA Compare match A
59h GPT3_CCMPB Compare match B
5Ah GPT3_CMPC Compare match C
5Bh GPT3_CMPD Compare match D
5Ch GPT3_OVF Overflow
5Dh GPT3_UDF Underflow
5Eh GPT164 GPT4_CCMPA Compare match A
5Fh GPT4_CCMPB Compare match B
60h GPT4_CMPC Compare match C
61h GPT4_CMPD Compare match D
62h GPT4_OVF Overflow
63h GPT4_UDF Underflow
64h GPT165 GPT5_CCMPA Compare match A
65h GPT5_CCMPB Compare match B
66h GPT5_CMPC Compare match C
67h GPT5_CMPD Compare match D
68h GPT5_OVF Overflow
69h GPT5_UDF Underflow
6Ah GPT166 GPT6_CCMPA Compare match A
6Bh GPT6_CCMPB Compare match B
6Ch GPT6_CMPC Compare match C
6Dh GPT6_CMPD Compare match D
6Eh GPT6_OVF Overflow
6Fh GPT6_UDF Underflow
70h GPT GPT_UVWEDGE UVW edge event
71h SCI0 SCI0_RXI*4 Receive data full
72h SCI0_TXI*4 Transmit data empty
73h SCI0_TEI Transmit end
74h SCI0_ERI*4 Receive error
75h SCI0_AM Address match event
Table 17.3 Association between event signal names set in ELSRn.ELS[7:0] bits and signal numbers (4 of 4)
Event number Interrupt request source Name Description
77h SCI1 SCI1_RXI Receive data full
78h SCI1_TXI Transmit data empty
79h SCI1_TEI Transmit end
7Ah SCI1_ERI Receive error
7Bh SCI1_AM Address match event
7Ch SCI9 SCI9_RXI Receive data full
7Dh SCI9_TXI Transmit data empty
7Eh SCI9_TEI Transmit end
7Fh SCI9_ERI Receive error
80h SCI9_AM Address match event
81h SPI0 SPI0_SPRI Receive buffer full
82h SPI0_SPTI Transmit buffer empty
83h SPI0_SPII Idle
84h SPI0_SPEI Error
85h SPI0_SPTEND Transmission completed event
86h SPI1 SPI1_SPRI Receive buffer full
87h SPI1_SPTI Transmit buffer empty
88h SPI1_SPII Idle
89h SPI1_SPEI Error
8Ah SPI1_SPTEND Transmission completed event
17.3 Operation
Delay time
Module A Module B
PCR
Peripheral output
1
enable
PDR 0
Peripheral output
1
EOSR 0
POSR
PODR
PORR
Internal peripheral bus
EORR
ELC
PSEL[4:0]
PMR
EOF, EOR
Peripheral input/
interrupt
EIDR
PIDR
Read control
ISEL
ASEL
Analog
input or output
Note: Figure 18.1 shows a basic port configuration. The configuration differs depending on the ports.
: available
—: Setting prohibited
Address(es): PORT0.PCNTR1 4004 0000h, PORT1.PCNTR1 4004 0020h, PORT2.PCNTR1 4004 0040h, PORT3.PCNTR1 4004 0060h,
PORT4.PCNTR1 4004 0080h, PORT5.PCNTR1 4004 00A0h, PORT9.PCNTR1 4004 0120h
PORT0.PODR 4004 0000h, PORT1.PODR 4004 0020h, PORT2.PODR 4004 0040h, PORT3.PODR 4004 0060h,
PORT4.PODR 4004 0080h, PORT5.PODR 4004 00A0h, PORT9.PODR 4004 0120h
PORT0.PDR 4004 0002h, PORT1.PDR 4004 0022h, PORT2.PDR 4004 0042h, PORT3.PDR 4004 0062h,
PORT4.PDR 4004 0082h, PORT5.PDR 4004 00A2h, PORT9.PDR 4004 0122h
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
PODR PODR PODR PODR PODR PODR PODR PODR PODR PODR PODR PODR PODR PODR PODR PODR
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
PDR15 PDR14 PDR13 PDR12 PDR11 PDR10 PDR09 PDR08 PDR07 PDR06 PDR05 PDR04 PDR03 PDR02 PDR01 PDR00
m = 0 to 5, 9
n = 00 to 15
The Port Control Register 1 (PCNTR1/PODR/PDR) is a 32-bit and 16-bit read/write register that controls the port
direction and port output data.
The PCNTR1 specifies the port direction and port output data, and is accessed in 32-bit units. The PDRn (bits [15:0] in
PCNTR1) and PODRn (bits [31:16] in PCNTR1) respectively, are accessed in 16-bit units.
Address(es): PORT0.PCNTR2 4004 0004h, PORT1.PCNTR2 4004 0024h, PORT2.PCNTR2 4004 0044h, PORT3.PCNTR2 4004 0064h,
PORT4.PCNTR2 4004 0084h, PORT5.PCNTR2 4004 00A4h, PORT9.PCNTR2 4004 0124h
PORT1.EIDR 4004 0024h, PORT2.EIDR 4004 0044h
PORT0.PIDR 4004 0006h, PORT1.PIDR 4004 0026h, PORT2.PIDR 4004 0046h,PORT3.PIDR 4004 0066h,
PORT4.PIDR 4004 0086h, PORT5.PIDR 4004 00A6h, PORT9.PIDR 4004 0126h
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
EIDR15 EIDR14 EIDR13 EIDR12 EIDR11 EIDR10 EIDR09 EIDR08 EIDR07 EIDR06 EIDR05 EIDR04 EIDR03 EIDR02 EIDR01 EIDR00
PIDR15 PIDR14 PIDR13 PIDR12 PIDR11 PIDR10 PIDR09 PIDR08 PIDR07 PIDR06 PIDR05 PIDR04 PIDR03 PIDR02 PIDR01 PIDR00
x: Undefined
m = 0 to 5, 9
n = 00 to 15
x = 1, 2
The Port Control Register 2 (PCNTR2/EIDR/PIDR) allows read access to the Pmn state and the port event input data
using 32-bit or 16-bit access.
The PCNTR2 represents the Pmn state and the port event input data, and is accessed in 32-bit units. The PIDRn (bits
[15:0] in PCNTR2) and EIDRn (bits [31:16] in PCNTR2) respectively, are accessed in 16-bit units. Bits associated with
non-existent pins are reserved. Reserved bits are read as undefined.
Address(es): PORT0.PCNTR3 4004 0008h, PORT1.PCNTR3 4004 0028h, PORT2.PCNTR3 4004 0048h, PORT3.PCNTR3 4004 0068h,
PORT4.PCNTR3 4004 0088h, PORT5.PCNTR3 4004 00A8h, PORT9.PCNTR3 4004 0128h
PORT0.PORR 4004 0008h, PORT1.PORR 4004 0028h, PORT2.PORR 4004 0048h, PORT3.PORR 4004 0068h,
PORT4.PORR 4004 0088h, PORT5.PORR 4004 00A8h, PORT9.PORR 4004 0128h
PORT0.POSR 4004 000Ah, PORT1.POSR 4004 002Ah, PORT2.POSR 4004 004Ah, PORT3.POSR 4004 006Ah,
PORT4.POSR 4004 008Ah, PORT5.POSR 4004 00AAh, PORT9.POSR 4004 012Ah
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
PORR PORR PORR PORR PORR PORR PORR PORR PORR PORR PORR PORR PORR PORR PORR PORR
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
POSR POSR POSR POSR POSR POSR POSR POSR POSR POSR POSR POSR POSR POSR POSR POSR
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
m = 0 to 5, 9
n = 00 to 15
The Port Control Register 3 (PCNTR3/PORR/POSR) is a 32-bit and 16-bit write register that controls the setting or
resetting of the port output data.
The PCNTR3 controls the setting or resetting of the port output data, and is accessed in 32-bit units. The POSRn (bits
[15:0] in PCNTR3) and PORRn (bits [31:16] in PCNTR3) respectively, are accessed in 16-bit units.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
EORR EORR EORR EORR EORR EORR EORR EORR EORR EORR EORR EORR EORR EORR EORR EORR
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
EOSR EOSR EOSR EOSR EOSR EOSR EOSR EOSR EOSR EOSR EOSR EOSR EOSR EOSR EOSR EOSR
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
The Port Control Register 4 (PCNTR4/EORR/EOSR) is a 32-bit and 16-bit read/write register that controls the setting or
resetting of the port output data by an event input from the ELC.
The PCNTR4 controls the setting or resetting of the port output data by an event input from the ELC, and is accessed in
32-bit units. The EOSRn (bits [15:0] in PCNTR4) and EORRn (bits [31:16] in PCNTR4) respectively, are accessed in
16-bit units.
Address(es): PFS.P000PFS 4004 0800h to PFS.P003PFS 4004 080Ch, PFS.P012PFS 4004 0830h to PFS.P015PFS 4004 083Ch,
PFS.P100PFS 4004 0840h to PFS.P112PFS 4004 0870h,
PFS.P200PFS 4004 0880h to PFS.P201PFS 4004 0884h, PFS.P204PFS 4004 0890h to PFS.P206PFS 4004 0898h,
PFS.P212PFS 4004 08B0h to PFS.P215PFS 4004 08BCh,
PFS.P300PFS 4004 08C0h to PFS.P304PFS 4004 08D0h,
PFS.P400PFS 4004 0900h to PFS.P403PFS 4004 090Ch, PFS.P407PFS 4004 091Ch to PFS.P411PFS 4004 092Ch,
PFS.P500PFS 4004 0940h to PFS.P502PFS 4004 0948h,
PFS.P914PFS 4004 0A78h to PFS.P915PFS 4004 0A7Ch
PFS.P000PFS_HA 4004 0802h to PFS.P003PFS_HA 4004 080Eh, PFS.P012PFS_HA 4004 0832h to PFS.P015PFS_HA 4004 083Eh,
PFS.P100PFS_HA 4004 0842h to PFS.P112PFS_HA 4004 0872h, PFS.P200PFS_HA 4004 0882h to PFS.P201PFS_HA 4004 0886h,
PFS.P204PFS_HA 4004 0892h to PFS.P206PFS_HA 4004 0896h, PFS.P212PFS_HA 4004 08B2h to PFS.P215PFS_HA 4004 08BEh,
PFS.P300PFS_HA 4004 08C2h to PFS.P304PFS_HA 4004 08D2h, PFS.P400PFS_HA 4004 0902h to PFS.P403PFS_HA 4004 090Eh,
PFS.P407PFS_HA 4004 091Eh to PFS.P411PFS_HA 4004 092Eh, PFS.P500PFS_HA 4004 0942h to PFS.P502PFS_HA 4004 094Ah,
PFS.P914PFS_HA 4004 0A7Ah to PFS.P915PFS_HA 4004 0A7Eh
PFS.P000PFS_BY 4004 0803h to PFS.P003PFS_BY 4004 080Fh, PFS.P012PFS_BY 4004 0833h to PFS.P015PFS_BY 4004 083Fh,
PFS.P100PFS_BY 4004 0843h to PFS.P112PFS_BY 4004 0873h, PFS.P200PFS_BY 4004 0883h to PFS.P201PFS_BY 4004 0887h,
PFS.P204PFS_BY 4004 0893h to PFS.P206PFS_BY 4004 0897h, PFS.P212PFS_BY 4004 08B3h to PFS.P215PFS_BY 4004 08BFh,
PFS.P300PFS_BY 4004 08C3h to PFS.P304PFS_BY 4004 08D3h, PFS.P400PFS_BY 4004 0903h to PFS.P403PFS_BY 4004 090Fh,
PFS.P407PFS_BY 4004 091Fh to PFS.P411PFS_BY 4004 092Fh, PFS.P500PFS_BY 4004 0943h to PFS.P502PFS_BY 4004 094Bh,
PFS.P914PFS_BY 4004 0A7Bh to PFS.P915PFS_BY 4004 0A7Fh
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — PSEL[4:0] — — — — — — — PMR
ASEL ISEL EOF EOR DSCR1 DSCR — — — NCOD — PCR — PDR PIDR PODR
3 * R
Value after reset: 0 0 0 0 0 0*2 0 0 0 0 0 0*2 0 0 x 0
x: Undefined
PODR bit (Port Output Data), PIDR bit (Pmn State), PDR bit (Port Direction)
The PDR, PIDR, and PODR bits serve the same function as the PCNTR. When these bits are read, the PCNTR value is
read.
2. Disable the pull-up resistor with the Pull-up Control bit (PmnPFS.PCR).
3. Specify the input with the Port Direction bit (PmnPFS.PDR). The pin state cannot be read at this point. The
PmnPFS register is protected by the Write-Protect Register (PWPR). Release write-protect before modifying the
register.
Note 1. When the D/A converter output level is output to a port, select the I/O port for peripheral functions using the Port
Mode Control bit to set the D/A output with the PmnPFS.PSEL bit.
The ISEL bit for an unspecified IRQn is reserved. The ASEL bit for an unspecified analog input/output is reserved.
b7 b6 b5 b4 b3 b2 b1 b0
B0WI PFSWE — — — — — —
18.3 Operation
Port Output Set bit (POSRn), which indicates the output value when a software write occurs
Port 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.
ELC_PORT1, 2, 3, or 4
ELC
EIDR
PAD
en
EOSR
ELC
PODR PAD
EORR
en
ELC_PORT1 or 2
EOR
EOF PAD
ELC
Event pulse
Edge detect
From other PADs
DSCR bit L/M L/M L/M L/M L/M L/M L/M L/M
NCODR bit — — — — — — —
PCR bit
64-pin product
: Available
—: Setting prohibited
L/M: Low drive/Middle drive
Note 1. DAC8 channel n (n = 0, 1) output cannot be directly output from the pin, but the register can be set to output from a pin through
OPAMP.
Table 18.6 Register settings for input/output pin function (PORT1) (1)
Pin
PSEL[4:0]
settings Function P100 P101 P102 P103 P104 P105 P106 P107
00000b (initial) Hi-Z/SWD Hi-Z
00001b AGT — — — — — — — —
00010b GPT — — — — — — — —
00100b SCI — — — — — — — —
00111b IIC — — — — — — — —
01000b KINT — — — — — — — —
01001b CLKOUT/ — — — — — — — —
ACMPHS/
ACMPLP/RTC
01010b CAC/ADC16/ — — — — — — — —
SDADC24/
DAC12/DAC8
10000b CAN — — — — — — — —
ASEL bit AN016/ AN017/ AN018/ AN019/ AN020/ AN021/ AN022/ AN023/
ANSD0P/ ANSD0N/ ANSD1P ANSD1N ANSD2P ANSD2N ANSD3P ANSD3N
IVCMP2 IVREF2
DSCR bit L/M L/M L/M L/M L/M L/M L/M L/M
NCODR bit — — — — — —
PCR bit
64-pin product
48-pin product — —
40-pin product — — — —
36-pin product — — — — — —
32-pin product — — — — — —
: Available
—: Setting prohibited
L/M: Low drive/Middle drive
Table 18.7 Register settings for input/output pin function (PORT1) (2)
Pin
PSEL[4:0]
settings Function P108 P109 P110 P111 P112
00000b (initial) Hi-Z/SWD SWDIO Hi-Z
NCODR bit —
PCR bit
64-pin product
48-pin product — —
40-pin product — —
36-pin product — —
32-pin product — —
: Available
—: Setting prohibited
L/M: Low drive/Middle drive
01000b KINT — — — — — — — — —
01001b CLKOUT/ — — — — — — — — —
ACMPHS/
ACMPLP/RTC
01010b CAC/ADC16/ — — — — — — — — —
SDADC24/
DAC12/DAC8
ASEL bit — — — — — — — — —
NCODR bit — — — —
PCR bit — — —
64-pin product
48-pin product — —
40-pin product — — —
36-pin product — — —
32-pin product — —
: Available
—: Setting prohibited
L/M: Low drive/Middle drive
Note 1. When using NMI pin interrupt, Port related resisters setting are not required.
ASEL bit — — — — —
NCODR bit — —
PCR bit
64-pin product
48-pin product — —
40-pin product — — —
36-pin product — — —
32-pin product — — —
: Available
—: Setting prohibited
L/M: Low drive/Middle drive
00011b GPT GTIOC1A_A GTIOC4A_A GTIOC0A_D GTIOC0B_C GTIOC0B_A GTIOC0A_A GTIOC0A_C GTIOC5B_A GTIOC5A_A
00101b SCI RXD1_C/ SCK9_A CTS9_RTS9_ SCK1_B TXD9_A/ TXD1_C/ CTS1_RTS1_ TXD1_B/ RXD1_B/
SCL1_C/ C/SS9_C SDA9_A/ SDA1_C/ B/SS1_B SDA1_B/ SCL1_B/
MISO1_C MOSI9_A MOSI1_C MOSI1_B MISO1_B
00110b SPI MOSIA_A SSLB1_A SSLB2_A SSLB3_A RSPCKB_B SSLA0_A SSLA1_A SSLA2_A SSLA3_A
01100b CTSU TS00 TS01 TS02 TS03 TSCAP_D TS06 TSCAP_E TS05 TS04
DSCR1, DSCR bit L/M L/M L/M L/M L/M/ L/M/ L/M/ L/M L/M
M (IIC, SPI) M (IIC, SPI) M (IIC, SPI)
NCODR bit — —
PCR bit
64-pin product
48-pin product — — — —
40-pin product — — — — — —
36-pin product — — — — — —
32-pin product — — — — — —
: Available
—: Setting prohibited
L/M: Low drive/Middle drive
L/M: Low drive/Middle drive/Middle drive for IIC Fast mode (IIC)
NCODR bit —
PCR bit
64-pin product
48-pin product
40-pin product
36-pin product
32-pin product
: Available
—: Setting prohibited
L/M: Low drive/Middle drive
ASEL bit — —
ISEL bit — —
DSCR bit — —
NCODR bit — —
PCR bit — —
64-pin product
48-pin product
40-pin product
36-pin product
32-pin product — —
: Available
—: Setting prohibited
0
KR00 1 Filter 0
KRF0 1
KREG KRM0
KRMD
0
KR01 1 Filter 0
KRF1 1
KREG KRM1
KRMD
0
KR02 1 Filter 0
KRF2 1
KREG KRM2
KRMD
0
KR03 1 Filter 0
KRF3 1
KREG KRM3
KRMD KEY_INTKR
0
KR04 1 Filter 0
KRF4 1 KEY_INTKR mask signal
KREG KRM4
KRMD
0
KR05 1 Filter 0
KRF5 1
KREG KRM5
KRMD
0
KR06 1 Filter 0
KRF6 1
KREG KRM6
KRMD
0
KR07 1 Filter 0
KRF7 1
KREG KRM7
KRMD
b7 b6 b5 b4 b3 b2 b1 b0
KRMD — — — — — — KREG
The KRCTL register controls the usage of the key interrupt flags, KRF0 to KRF7, and sets the detection edge.
b7 b6 b5 b4 b3 b2 b1 b0
n = 0 to 7
Note: When KRMD = 0, setting the KRFn bit to 1 is prohibited.
When setting the KRFn bit to 1, the KRFn value does not change. To clear the KRFn bit, confirm the target bit is
1 before writing 0 to the bit, then write 1 to the other bits.
The KRF register controls the key interrupt flags, KRF0 to KRF7.
b7 b6 b5 b4 b3 b2 b1 b0
n = 0 to 7
Note: The on-chip pull-up resistors can be applied by setting the associated key interrupt input pin in the pull-up
function. For details, see section 18, I/O Ports.
Key interrupts can be assigned in the PmnPFS.PSEL[4:0] bits. For details, see section 18, I/O Ports.
An interrupt is generated when the target bit in the KRM register is set while a low level (KREG is set to 0) or
(KREG is set to 1) is being input to the key interrupt input pin. To ignore this interrupt, set the KRM register after
disabling the interrupt handling.
19.3 Operation
KRn
K E Y _ IN T K R
D e la y D e la y
n = 0 0 to 0 7
Figure 19.2 Operation of KEY_INTKR signal when key interrupt is input to a single channel
Figure 19.3 shows the operation when a valid edge is input to multiple key interrupt input pins. The KEY_INTKR signal
is set while a low level is being input to one pin (when KREG is 0). Therefore, even if a falling edge is input to another
pin in this period, a key interrupt (KEY_INTKR) is not generated again. See [1] in Figure 19.3.
KR00
KR01
[1]
KEY_INTKR
Figure 19.3 Operation of KEY_INTKR signal when key interrupts are input to multiple channels
(a) When KRF0 is cleared after a rising edge is input to the KR00 pin
KR00
KRF0
Cleared by
software
KEY_INTKR
Delay
Key interrupt
(b) When KRF0 is cleared before a rising edge is input to the KR00 pin
KR00
KRF0
Cleared by
software
KEY_INTKR
Delay
Figure 19.4 Basic operation of KEY_INTKR signal when key interrupt flag is used
Figure 19.5 shows the operation when a valid edge is input to multiple key interrupt input pins. A falling edge is also
input to the KR01 and KR05 pins after a falling edge is input to the KR00 pin (when KREG = 0). The KRF1 bit is set
when the KRF0 bit is cleared. The KEY_INTKR signal is negated 1 PCLKB clock cycle, after the KRF0 bit is cleared.
See [1] in Figure 19.5. Also, after a falling edge is input to the KR05 pin, the KRF5 bit is set. The KRF1 bit is cleared at
time [2] in the figure. The KEY_INTKR signal is negated 1 PCLKB clock cycle, after the KRF1 bit is cleared. See [3] in
the figure. It is therefore possible to generate a key interrupt when a valid edge is input to multiple channels.
KR00
KR01
KR05
KRF0
Cleared by software
Delay
KRF5
Cleared by
Delay software
[1] [3]
KEY_INTKR
Figure 19.5 Operation of KEY_INTKR signal when key interrupts are input to multiple channels
Group B
POEG Group A
IOCF
IOCE ICU
S POEG_GROUP0
GPT Ch 0
R
GTINTAD.GRPABH, Group A Ch 0
GTINTAD.GRPABL POEG_GROUP1
Group B Ch 6
Ch 1
Ch 6
GPT
CDRE0
ACMP_HS0 OPS
ACMPHS0
OPSCR. GTOUUP
GRP[1:0] GTOULO
OPSCR. GTOVUP
GODF GTOVLO
GTOWUP
GTOWLO
OSTPF
OSC stop GTINTAD.
OSTPE
Oscillation detect S To ch 1 GRP[1:0] GTIOC0A
To ch 6
Stop Detector R GTIOR. GTIOC0B
To ch 1 OADF[1:0]
To ch 6
GTIOR.
GTIOC1A
SSF OBDF[1:0]
GTIOC1B
PIDF GTIOC6A
Digital filter PIDE To ch 1 GTIOC6B
NFCS[1:0] To ch 6
GTETRGA INV
NFEN To ch 1
GTETRGB To ch 6
ST
Ch 0
Ch 1
Ch 6
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
The POEGGA and POEGGB registers control the output-disable state of the GPT pins, interrupts, and the external
trigger input to GPT. In the descriptions, POEGGn represents all the POEGGA and POEGGB registers.
PCLKB
Sampling clock
GTETRGn input
GTIOCmA
GTIOCmB
(PCLKD)
When high level is sampled at all points [1] [2] [3] Flag set (GTETRGn received)
When low level is sampled at least once [1] [0] [1] Flag not set
Note: Each channel output can be set in the GPT setting.
Low level sampling can be set in the POEGGn.INV setting.
Figure 20.3 shows the released timing for output disable. The output disable is released at the beginning of the next count
cycle of the GPT after the flag is cleared.
GPT320.GTCNT value
GPT320.GTPR
GPT320.GTCCRA
GTIOC0A
GTIOC0B
Output-disable
Figure 20.3 Output-disable release timing for the GPT pin outputs
Down-count
Input capture.
For the POEGGn.INV polarity setting signal, when the same level is input three times continuously with the sampling
clock selected in the POEGGn.NFCS[1:0] bits, that value is output. Set the control registers the same as for the input
level detection operation described in section 20.3.1, Pin Input Level Detection Operation. The state after filtering can be
monitored in POEGGn.ST.
Figure 20.4 shows the output timing of an external trigger to the GPT.
PCLKB
Sampling clock
GTETRGn pin
POEGGn.ST
(GTETRGn after filtering)
[1] [1] [2] [1] [1] [2] [3] [4] [1] [2] [3] [1]
Note 1. GTETRGn connects to GPT through the POEG module. Therefore, to use the GPT function, supply the POEG
clock by clearing the MSTPCRD.MSTPD14 bit.
GPT320
Control registers Interrupt request signals GPT161
GTWP GTICASR GTDTCR GPT0_CCMPA
GPT0_CCMPB GPT162
Clock source GTSTR GTICBSR GTDVU
GTSTP GTCR GPT0_CMPC GPT163
PCLKD CPT0_CMPD
PCLKD/4 Cycle setting/ GTCLR GTUDDTYC
GTSSR GTIOR GPT0_UDF GPT164
PCLKD/16 Cycle setting buffer registers GPT0_OVF
PCLKD/64 GTPSR GTINTAD GPT165
PCLKD/256 GTCSR GTST
GTPBR GTUPSR GTBER GPT166
PCLKD/1024
GTDNSR
GTPR
GPT161.GTIOCA output
GPT_OPS I/O pins
GTIU / GTIV / GTIW
3-phase PWM wave generator GTOUUP / GTOULO
for brushless DC motor GTOVUP / GTOVLO
GTOWUP / GTOWLO
OPSCR Output disable signals
Input UVW edge event signal (to ICU/ELC)
GTWP : General PWM Timer Write-Protection Register GTCNT : General PWM Timer Counter
GTSTR : General PWM Timer Software Start Register GTCCRA : General PWM Timer Compare Capture Register A
GTSTP : General PWM Timer Software Stop Register GTCCRB : General PWM Timer Compare Capture Register B
GTCLR : General PWM Timer Software Clear Register GTCCRC : General PWM Timer Compare Capture Register C
GTSSR : General PWM Timer Start Source Select Register GTCCRD : General PWM Timer Compare Capture Register D
GTPSR : General PWM Timer Stop Source Select Register GTCCRE : General PWM Timer Compare Capture Register E
GTCSR : General PWM Timer Clear Source Select Register GTCCRF : General PWM Timer Compare Capture Register F
GTUPSR : General PWM Timer Up Count Source Select Register GTPR : General PWM Timer Cycle Setting Register
GTDNSR : General PWM Timer Down Count Source Select Register GTPBR : General PWM Timer Cycle Setting Buffer Register
GTICASR : General PWM Timer Input Capture Source Select Register A GTDTCR : General PWM Timer Dead Time Control Register
GTICBSR : General PWM Timer Input Capture Source Select Register B GTDVU : General PWM Timer Dead Time Value Register U
GTCR : General PWM Timer Control Register OPSCR : Output Phase Switching Control Register
GTUDDTYC : General PWM Timer Count Direction and Duty Setting Register
GTIOR : General PWM Timer I/O Control Register
GTINTAD : General PWM Timer Interrupt Output Setting Register
GTST : General PWM Timer Status Register
GTBER : General PWM Timer Buffer Enable Register
GPT16 GPT32
m = 0 to 6, n = 1 to 6
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — — — — — — — — — — — —
PRKEY[7:0] — — — — — — — WP
To prevent accidental modification, the GTWP enables or disables writing to the following registers:
GTSSR, GTPSR, GTCSR, GTUPSR, GTDNSR, GTICASR, GTICBSR, GTCR, GTUDDTYC, GTIOR, GTINTAD,
GTST, GTBER, GTCNT, GTCCRA, GTCCRB, GTCCRC, GTCCRD, GTCCRE, GTCCRF, GTPR, GTPBR, GTDTCR,
GTDVU.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — — — — — — — — — — — —
The GTSTR starts the GTCNT counter operation for each channel n (n = 0 to 6).
The GTSTR bit number represents the channel number. The GTSTR register is shared by all of the channels. The
GTCNT counter starts for the channel associated with the GTSTR bit where 1 is written. Writing 0 has no effect on the
status of the GTCNT counter and the value of GTSTR register.
For the association between GTSTR bit number and a channel number, see Figure 21.2.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — — — — — — — — — — — —
The GTSTP stops the GTCNT counter operation for each channel n, where n = 0 to 6.
The GTSTP bit number represents the channel number. The GTSTP register is shared by all of the channels. The GTCNT
counter stops for the channel associated with the GTSTP bit where 1 is written. Writing 0 has no effect on the status of
the GTCNT counter and the value of GTSTP register.
For the association between GTSTP bit number and a channel number, see Figure 21.2.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — — — — — — — — — — — —
The GTCLR is a write-only register that clears the GTCNT counter operation for each channel n, where n = 0 to 6.
The GTCLR bit number represents the channel number. Each channel of the GTCLR register is shared by all the
channels. The GTCNT counter is cleared for the channel associated with the GTCLR bit number where 1 is written.
Writing 0 has no effect on the status of GTCNT counter.
For the association between GTCLR bit number and a channel number, see Figure 21.2.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
SSCBF SSCBF SSCBR SSCBR SSCAF SSCAF SSCAR SSCAR — — — — SSGTR SSGTR SSGTR SSGTR
AH AL AH AL BH BL BH BL GBF GBR GAF GAR
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
SSGTRGAR bit (GTETRGA Pin Rising Input Source Counter Start Enable)
The SSGTRGAR bit enables or disables the GTCNT counter start on the rising edge of the GTETRGA pin input.
SSGTRGAF bit (GTETRGA Pin Falling Input Source Counter Start Enable)
The SSGTRGAF bit enables or disables the GTCNT counter start on the falling edge of the GTETRGA pin input.
SSGTRGBR bit (GTETRGB Pin Rising Input Source Counter Start Enable)
The SSGTRGBR bit enables or disables the GTCNT counter start on the rising edge of the GTETRGB pin input.
SSGTRGBF bit (GTETRGB Pin Falling Input Source Counter Start Enable)
The SSGTRGBF bit enables or disables the GTCNT counter start on the falling edge of the GTETRGB pin input.
SSCARBL bit (GTIOCA Pin Rising Input during GTIOCB Value Low Source Counter Start Enable)
The SSCARBL bit enables or disables the GTCNT counter start on the rising edge of the GTIOCA pin input, when
GTIOCB input is 0.
SSCARBH bit (GTIOCA Pin Rising Input during GTIOCB Value High Source Counter Start Enable)
The SSCARBH bit enables or disables the GTCNT counter start on the rising edge of the GTIOCA pin input, when
GTIOCB input is 1.
SSCAFBL bit (GTIOCA Pin Falling Input during GTIOCB Value Low Source Counter Start Enable)
The SSCAFBL bit enables or disables the GTCNT counter start on the falling edge of the GTIOCA pin input, when
GTIOCB input is 0.
SSCAFBH bit (GTIOCA Pin Falling Input during GTIOCB Value High Source Counter Start Enable)
The SSCAFBH bit enables or disables the GTCNT counter start on the falling edge of the GTIOCA pin input, when
GTIOCB input is 1.
SSCBRAL bit (GTIOCB Pin Rising Input during GTIOCA Value Low Source Counter Start Enable)
The SSCBRAL bit enables or disables the GTCNT counter start on the rising edge of the GTIOCB pin input, when
GTIOCA input is 0.
SSCBRAH bit (GTIOCB Pin Rising Input during GTIOCA Value High Source Counter Start Enable)
The SSCBRAH bit enables or disables the GTCNT counter start on the rising edge of the GTIOCB pin input, when
GTIOCA input is 1.
SSCBFAL bit (GTIOCB Pin Falling Input during GTIOCA Value Low Source Counter Start Enable)
The SSCBFAL bit enables or disables the GTCNT counter start on the falling edge of the GTIOCB pin input, when
GTIOCA input is 0.
SSCBFAH bit (GTIOCB Pin Falling Input during GTIOCA Value High Source Counter Start Enable)
The SSCBFAH bit enables or disables the GTCNT counter start on the falling edge of the GTIOCB pin input, when
GTIOCA input is 1.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
PSCBF PSCBF PSCBR PSCBR PSCAF PSCAF PSCAR PSCAR — — — — PSGTR PSGTR PSGTR PSGTR
AH AL AH AL BH BL BH BL GBF GBR GAF GAR
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
PSGTRGAR bit (GTETRGA Pin Rising Input Source Counter Stop Enable)
The PSGTRGAR bit enables or disables the GTCNT counter stop on the rising edge of the GTETRGA pin input.
PSGTRGAF bit (GTETRGA Pin Falling Input Source Counter Stop Enable)
The PSGTRGAF bit enables or disables the GTCNT counter stop on the falling edge of the GTETRGA pin input.
PSGTRGBR bit (GTETRGB Pin Rising Input Source Counter Stop Enable)
PSGTRGBR bit enables or disables the GTCNT counter stop on the rising edge of the GTETRGB pin input.
PSGTRGBF bit (GTETRGB Pin Falling Input Source Counter Stop Enable)
The PSGTRGBF bit enables or disables the GTCNT counter stop on the falling edge of the GTETRGB pin input.
PSCARBL bit (GTIOCA Pin Rising Input during GTIOCB Value Low Source Counter Stop Enable)
The PSCARBL bit enables or disables the GTCNT counter stop on the rising edge of the GTIOCA pin input, when
GTIOCB input is 0.
PSCARBH bit (GTIOCA Pin Rising Input during GTIOCB Value High Source Counter Stop Enable)
This bit enables or disables the GTCNT counter stop on the rising edge of the GTIOCA pin input, when GTIOCB input
is 1.
PSCAFBL bit (GTIOCA Pin Falling Input during GTIOCB Value Low Source Counter Stop Enable)
The PSCAFBL bit enables or disables the GTCNT counter stop on the falling edge of the GTIOCA pin input, when
GTIOCB input is 0.
PSCAFBH bit (GTIOCA Pin Falling Input during GTIOCB Value High Source Counter Stop Enable)
The PSCAFBH bit enables or disables the GTCNT counter stop on the falling edge of the GTIOCA pin input, when
GTIOCB input is 1.
PSCBRAL bit (GTIOCB Pin Rising Input during GTIOCA Value Low Source Counter Stop Enable)
The PSCBRA bit enables or disables the GTCNT counter stop on the rising edge of the GTIOCB pin input, when
GTIOCA input is 0.
PSCBRAH bit (GTIOCB Pin Rising Input during GTIOCA Value High Source Counter Stop Enable)
The PSCBRAH bit enables or disables the GTCNT counter stop on the rising edge of the GTIOCB pin input, when
GTIOCA input is 1.
PSCBFAL bit (GTIOCB Pin Falling Input during GTIOCA Value Low Source Counter Stop Enable)
The PSCBFAL bit enables or disables the GTCNT counter stop on the falling edge of the GTIOCB pin input, when
GTIOCA input is 0.
PSCBFAH bit (GTIOCB Pin Falling Input during GTIOCA Value High Source Counter Stop Enable)
The PSCBFAH bit enables or disables the GTCNT counter stop on the falling edge of the GTIOCB pin input, when
GTIOCA input is 1.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
CSCBF CSCBF CSCBR CSCBR CSCAF CSCAF CSCAR CSCAR — — — — CSGTR CSGTR CSGTR CSGTR
AH AL AH AL BH BL BH BL GBF GBR GAF GAR
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
CSGTRGAR bit (GTETRGA Pin Rising Input Source Counter Clear Enable)
The CSGTRGAR bit enables or disables the GTCNT counter clear on the rising edge of the GTETRGA pin input.
CSGTRGAF bit (GTETRGA Pin Falling Input Source Counter Clear Enable)
The CSGTRGAF bit enables or disables the GTCNT counter clear on the falling edge of the GTETRGA pin input.
CSGTRGBR bit (GTETRGB Pin Rising Input Source Counter Clear Enable)
The CSGTRGBR bit enables or disables the GTCNT counter clear on the rising edge of the GTETRGB pin input.
CSGTRGBF bit (GTETRGB Pin Falling Input Source Counter Clear Enable)
The CSGTRGBF bit enables or disables the GTCNT counter clear on the falling edge of the GTETRGB pin input.
CSCARBL bit (GTIOCA Pin Rising Input during GTIOCB Value Low Source Counter Clear Enable)
The CSCARBL bit enables or disables the GTCNT counter clear on the rising edge of the GTIOCA pin input, when
GTIOCB input is 0.
CSCARBH bit (GTIOCA Pin Rising Input during GTIOCB Value High Source Counter Clear Enable)
The CSCARBH bit enables or disables the GTCNT counter clear on the rising edge of the GTIOCA pin input, when
GTIOCB input is 1.
CSCAFBL bit (GTIOCA Pin Falling Input during GTIOCB Value Low Source Counter Clear Enable)
The CSCAFBL bit enables or disables the GTCNT counter clear on the falling edge of the GTIOCA pin input, when
GTIOCB input is 0.
CSCAFBH bit (GTIOCA Pin Falling Input during GTIOCB Value High Source Counter Clear Enable)
The CSCAFBH bit enables or disables the GTCNT counter clear on the falling edge of the GTIOCA pin input, when
GTIOCB input is 1.
CSCBRAL bit (GTIOCB Pin Rising Input during GTIOCA Value Low Source Counter Clear Enable)
The CSCBRAL bit enables or disables the GTCNT counter clear on the rising edge of the GTIOCB pin input, when
GTIOCA input is 0.
CSCBRAH bit (GTIOCB Pin Rising Input during GTIOCA Value High Source Counter Clear Enable)
The CSCBRAH bit enables or disables the GTCNT counter clear on the rising edge of the GTIOCB pin input, when
GTIOCA input is 1.
CSCBFAL bit (GTIOCB Pin Falling Input during GTIOCA Value Low Source Counter Clear Enable)
The CSCBFAL bit enables or disables the GTCNT counter clear on the falling edge of the GTIOCB pin input, when
GTIOCA input is 0.
CSCBFAH bit (GTIOCB Pin Falling Input during GTIOCA Value High Source Counter Clear Enable)
The CSCBFAH bit enables or disables the GTCNT counter clear on the falling edge of the GTIOCB pin input, when
GTIOCA input is 1.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
USCBF USCBF USCBR USCBR USCAF USCAF USCAR USCAR — — — — USGTR USGTR USGTR USGTR
AH AL AH AL BH BL BH BL GBF GBR GAF GAR
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
USGTRGAR bit (GTETRGA Pin Rising Input Source Counter Count Up Enable)
The USGTRGAR bit enables or disables the GTCNT counter count up on the rising edge of the GTETRGA pin input.
USGTRGAF bit (GTETRGA Pin Falling Input Source Counter Count Up Enable)
The USGTRGAF bit enables or disables the GTCNT counter count up on the falling edge of the GTETRGA pin input.
USGTRGBR bit (GTETRGB Pin Rising Input Source Counter Count Up Enable)
The USGTRGBR bit enables or disables the GTCNT counter count up on the rising edge of the GTETRGB pin input.
USGTRGBF bit (GTETRGB Pin Falling Input Source Counter Count Up Enable)
The USGTRGBF bit enables or disables the GTCNT counter count up on the falling edge of the GTETRGB pin input.
USCARBL bit (GTIOCA Pin Rising Input during GTIOCB Value Low Source Counter Count Up Enable)
The USCARBL bit enables or disables GTCNT counter count up on the rising edge of GTIOCA pin input, when
GTIOCB input is 0.
USCARBH bit (GTIOCA Pin Rising Input during GTIOCB Value High Source Counter Count Up Enable)
The USCARBH bit enables or disables the GTCNT counter count up on the rising edge of the GTIOCA pin input, when
GTIOCB input is 1.
USCAFBL bit (GTIOCA Pin Falling Input during GTIOCB Value Low Source Counter Count Up Enable)
The USCAFBL bit enables or disables the GTCNT counter count up on the falling edge of the GTIOCA pin input, when
GTIOCB input is 0.
USCAFBH bit (GTIOCA Pin Falling Input during GTIOCB Value High Source Counter Count Up Enable)
The USCAFBH bit enables or disables the GTCNT counter count up on the falling edge of the GTIOCA pin input, when
GTIOCB input is 1.
USCBRAL bit (GTIOCB Pin Rising Input during GTIOCA Value Low Source Counter Count Up Enable)
The USCBRAL bit enables or disables the GTCNT counter count up on the rising edge of the GTIOCB pin input, when
GTIOCA input is 0.
USCBRAH bit (GTIOCB Pin Rising Input during GTIOCA Value High Source Counter Count Up Enable)
The USCBRAH bit enables or disables the GTCNT counter count up on the rising edge of the GTIOCB pin input, when
the GTIOCA input is 1.
USCBFAL bit (GTIOCB Pin Falling Input during GTIOCA Value Low Source Counter Count Up Enable)
The USCBFAL bit enables or disables the GTCNT counter count up on the falling edge of the GTIOCB pin input, when
the GTIOCA input is 0.
USCBFAH bit (GTIOCB Pin Falling Input during GTIOCA Value High Source Counter Count Up Enable)
The USCBFAH bit enables or disables the GTCNT counter count up on the falling edge of the GTIOCB pin input, when
the GTIOCA input is 1.
21.2.9 General PWM Timer Down Count Source Select Register (GTDNSR)
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
DSCBF DSCBF DSCBR DSCBR DSCAF DSCAF DSCAR DSCAR — — — — DSGTR DSGTR DSGTR DSGTR
AH AL AH AL BH BL BH BL GBF GBR GAF GAR
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
The GTDNSR sets the source to count down the GTCNT counter.
When at least one bit in the GTDNSR register is set to 1, the GTCNT counter is counted down by the source that is set to
1 in this register. In this case, GTCR.TPCS has no effect.
DSGTRGAR bit (GTETRGA Pin Rising Input Source Counter Count Down Enable)
The DSGTRGAR bit enables or disables the GTCNT counter count down on the rising edge of the GTETRGA pin input.
DSGTRGAF bit (GTETRGA Pin Falling Input Source Counter Count Down Enable)
The DSGTRGAF bit enables or disables the GTCNT counter count down on the falling edge of the GTETRGA pin
input.
DSGTRGBR bit (GTETRGB Pin Rising Input Source Counter Count Down Enable)
The DSGTRGBR bit enables or disables the GTCNT counter count down on the rising edge of the GTETRGB pin input.
DSGTRGBF bit (GTETRGB Pin Falling Input Source Counter Count Down Enable)
The DSGTRGBF bit enables or disables the GTCNT counter count down on the falling edge of the GTETRGB pin input.
DSCARBL bit (GTIOCA Pin Rising Input during GTIOCB Value Low Source Counter Count Down
Enable)
The DSCARBL bit enables or disables the GTCNT counter count down on the rising edge of the GTIOCA pin input,
when the GTIOCB input is 0.
DSCARBH bit (GTIOCA Pin Rising Input during GTIOCB Value High Source Counter Count Down
Enable)
The DSCARBH bit enables or disables the GTCNT counter count down on the rising edge of the GTIOCA pin input,
when GTIOCB input is 1.
DSCAFBL bit (GTIOCA Pin Falling Input during GTIOCB Value Low Source Counter Count Down
Enable)
The DSCAFBL bit enables or disables the GTCNT counter count down on the falling edge of the GTIOCA pin input,
when GTIOCB input is 0.
DSCAFBH bit (GTIOCA Pin Falling Input during GTIOCB Value High Source Counter Count Down
Enable)
The DSCAFBH bit enables or disables the GTCNT counter count down on the falling edge of the GTIOCA pin input,
when GTIOCB input is 1.
DSCBRAL bit (GTIOCB Pin Rising Input during GTIOCA Value Low Source Counter Count Down
Enable)
The DSCBRAL bit enables or disables the GTCNT counter count down on the rising edge of the GTIOCB pin input,
when GTIOCA input is 0.
DSCBRAH bit (GTIOCB Pin Rising Input during GTIOCA Value High Source Counter Count Down
Enable)
The DSCBRAH bit enables or disables the GTCNT counter count down on the rising edge of GTIOCB pin input, when
GTIOCA input is 1.
DSCBFAL bit (GTIOCB Pin Falling Input during GTIOCA Value Low Source Counter Count Down
Enable)
The DSCBFAL bit enables or disables the GTCNT counter count down on the falling edge of the GTIOCB pin input,
when GTIOCA input is 0.
DSCBFAH bit (GTIOCB Pin Falling Input during GTIOCA Value High Source Counter Count Down
Enable)
The DSCBFAH bit enables or disables the GTCNT counter count down on the falling edge of the GTIOCB pin input,
when GTIOCA input is 1.
21.2.10 General PWM Timer Input Capture Source Select Register A (GTICASR)
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
ASCBF ASCBF ASCBR ASCBR ASCAF ASCAF ASCAR ASCAR — — — — ASGTR ASGTR ASGTR ASGTR
AH AL AH AL BH BL BH BL GBF GBR GAF GAR
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ASGTRGAR bit (GTETRGA Pin Rising Input Source GTCCRA Input Capture Enable)
The ASGTRGAR bit enables or disables the input capture for GTCCRA on the rising edge of the GTETRGA pin input.
ASGTRGAF bit (GTETRGA Pin Falling Input Source GTCCRA Input Capture Enable)
The ASGTRGAF bit enables or disables the input capture for GTCCRA on the falling edge of the GTETRGA pin input.
ASGTRGBR bit (GTETRGB Pin Rising Input Source GTCCRA Input Capture Enable)
The ASGTRGBR bit enables or disables the input capture for GTCCRA on the rising edge of the GTETRGB pin input.
ASGTRGBF bit (GTETRGB Pin Falling Input Source GTCCRA Input Capture Enable)
The ASGTRGBF bit enables or disables the input capture for GTCCRA on the falling edge of the GTETRGB pin input.
ASCARBL bit (GTIOCA Pin Rising Input during GTIOCB Value Low Source GTCCRA Input Capture
Enable)
The ASCARBL bit enables or disables the input capture for GTCCRA on the rising edge of the GTIOCA pin input, when
GTIOCB input is 0.
ASCARBH bit (GTIOCA Pin Rising Input during GTIOCB Value High Source GTCCRA Input Capture
Enable)
The ASCARBH bit enables or disables the input capture for GTCCRA on the rising edge of the GTIOCA pin input,
when GTIOCB input is 1.
ASCAFBL bit (GTIOCA Pin Falling Input during GTIOCB Value Low Source GTCCRA Input Capture
Enable)
The ASCAFBL bit enables or disables the input capture for GTCCRA on the falling edge of the GTIOCA pin input,
when GTIOCB input is 0.
ASCAFBH bit (GTIOCA Pin Falling Input during GTIOCB Value High Source GTCCRA Input Capture
Enable)
The ASCAFBH bit enables or disables the input capture for GTCCRA on the falling edge of the GTIOCA pin input,
when the GTIOCB input is 1.
ASCBRAL bit (GTIOCB Pin Rising Input during GTIOCA Value Low Source GTCCRA Input Capture
Enable)
The ASCBRAL bit enables or disables the input capture for GTCCRA on the rising edge of the GTIOCB pin input, when
the GTIOCA input is 0.
ASCBRAH bit (GTIOCB Pin Rising Input during GTIOCA Value High Source GTCCRA Input Capture
Enable)
The ASCBRAH bit enables or disables the input capture for GTCCRA on the rising edge of the GTIOCB pin input,
when GTIOCA input is 1.
ASCBFAL bit (GTIOCB Pin Falling Input during GTIOCA Value Low Source GTCCRA Input Capture
Enable)
The ASCBFAL bit enables or disables the input capture for GTCCRA on the falling edge of the GTIOCB pin input,
when GTIOCA input is 0.
ASCBFAH bit (GTIOCB Pin Falling Input during GTIOCA Value High Source GTCCRA Input Capture
Enable)
The ASCBFAH bit enables or disables the input capture for GTCCRA on the falling edge of the GTIOCB pin input,
when GTIOCA input is 1.
ASELCm bit (ELC_GPTm Event Source Counter GTCCRA Input Capture Enable) (m = A to D)
The ASELCm bit enables or disables the input capture for GTCCRA at the ELC_GPTm event input.
21.2.11 General PWM Timer Input Capture Source Select Register B (GTICBSR)
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
BSCBF BSCBF BSCBR BSCBR BSCAF BSCAF BSCAR BSCAR — — — — BSGTR BSGTR BSGTR BSGTR
AH AL AH AL BH BL BH BL GBF GBR GAF GAR
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
BSGTRGAR bit (GTETRGA Pin Rising Input Source GTCCRB Input Capture Enable)
The BSGTRGAR bit enables or disables the input capture for GTCCRB on the rising edge of the GTETRGA pin input.
BSGTRGAF bit (GTETRGA Pin Falling Input Source GTCCRB Input Capture Enable)
The BSGTRGAF bit enables or disables the input capture for GTCCRB on the falling edge of the GTETRGA pin input.
BSGTRGBR bit (GTETRGB Pin Rising Input Source GTCCRB Input Capture Enable)
The BSGTRGBR bit enables or disables the input capture for GTCCRB on the rising edge of GTETRGB pin input.
BSGTRGBF bit (GTETRGB Pin Falling Input Source GTCCRB Input Capture Enable)
The BSGTRGBF bit enables or disables the input capture for GTCCRB on the falling edge of the GTETRGB pin input.
BSCARBL bit (GTIOCA Pin Rising Input during GTIOCB Value Low Source GTCCRB Input Capture
Enable)
The BSCARBL bit enables or disables the input capture for GTCCRB on the rising edge of the GTIOCA pin input, when
the GTIOCB input is 0.
BSCARBH bit (GTIOCA Pin Rising Input during GTIOCB Value High Source GTCCRB Input Capture
Enable)
The BSCARBH bit enables or disables the input capture for GTCCRB on the rising edge of the GTIOCA pin input, when
GTIOCB input is 1.
BSCAFBL bit (GTIOCA Pin Falling Input during GTIOCB Value Low Source GTCCRB Input Capture
Enable)
The BSCAFBL bit enables or disables the input capture for GTCCRB on the falling edge of the GTIOCA pin input,
when GTIOCB input is 0.
BSCAFBH bit (GTIOCA Pin Falling Input during GTIOCB Value High Source GTCCRB Input Capture
Enable)
The BSCAFBH bit enables or disables the input capture for GTCCRB on the falling edge of the GTIOCA pin input,
when GTIOCB input is 1.
BSCBRAL bit (GTIOCB Pin Rising Input during GTIOCA Value Low Source GTCCRB Input Capture
Enable)
The BSCBRAL bit enables or disables the input capture for GTCCRB on the rising edge of the GTIOCB pin input, when
GTIOCA input is 0.
BSCBRAH bit (GTIOCB Pin Rising Input during GTIOCA Value High Source GTCCRB Input Capture
Enable)
The BSCBRAH bit enables or disables the input capture for GTCCRB on the rising edge of the GTIOCB pin input, when
GTIOCA input is 1.
BSCBFAL bit (GTIOCB Pin Falling Input during GTIOCA Value Low Source GTCCRB Input Capture
Enable)
The BSCBFAL bit enables or disables the input capture for GTCCRB on the falling edge of the GTIOCB pin input, when
GTIOCA input is 0.
BSCBFAH bit (GTIOCB Pin Falling Input during GTIOCA Value High Source GTCCRB Input Capture
Enable)
The BSCBFAH bit enables or disables the input capture for GTCCRB on the falling edge of the GTIOCB pin input,
when GTIOCA input is 1.
BSELCm bit (ELC_GPTm Event Source Counter GTCCRB Input Capture Enable) (m = A to D)
The BSELCm bit enables or disables the input capture for GTCCRB at the ELC_GPTm event input.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — TPCS[2:0] — — — — — MD[2:0]
— — — — — — — — — — — — — — — CST
The ELC event input or the GTIOCA/GTIOCB/GTETRGn port input event enabled by GTPSR as the counter stop
source, occurs
0 is written by software directly.
21.2.13 General PWM Timer Count Direction and Duty Setting Register (GTUDDTYC)
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — — — — — — — — — — UDF UD
x: Don’t care
The GTUDDTYC sets the direction in which the GTCNT counts (up-counting or down-counting), and sets the duty of
the GTIOCA/GTIOCB pin output.
Count direction:
In saw-wave mode.
When the UD value is set to 0 during up-counting, the count direction changes at an overflow (the timing synchronous
with count clock after the GTCNT value becomes the GTPR value). When the UD value is set to 1 during down-
counting, the count direction changes at an underflow (the timing synchronous with count clock after the GTCNT value
becomes 0).
When the UD value changes from 1 to 0 with the UDF bit being 0 and while counting stops, the counter starts up-
counting and the count direction changes at an overflow (the timing synchronous with count clock after the GTCNT
value becomes the GTPR value). When the UD value changes from 0 to 1 with the UDF bit being 0 and while counting
stops, the counter starts down-counting and the count direction changes at an underflow (the timing synchronous with
count clock after the GTCNT value becomes 0).
When the UDF bit is set to 1 while counting stops, the UD bit value is reflected in the count direction when counting
starts.
In triangle-wave mode.
When the UD value changes during counting, the count direction does not change. When the UD value changes while the
UDF bit is 0 and counting stops, the change is not reflected in the count direction when counting starts.
When the UDF bit is set to 1 while counting is stopped, the UD value is reflected in the count direction when counting
starts.
OmDTYR bit (GTIOCm Output Value Selecting after Releasing 0%/100% Duty Setting) (m = A, B)
The OmDTYR bit selects the value that is the object of output retained or toggled at cycle end, when the control changes
from 0%/100% duty setting to compare match for the GTIOCm pin and GTIOR. The GTIOm[3:2] bits are set to 00b
(output retained at cycle end) or the GTIOR.GTIOm[3:2] bits are set to 11b (output toggled at cycle end).
While the duty 0%/100% setting operation is running, the compare match operation continues inside the GPT32. When
the OmDTYR bit is set to 1, the GTIOCm pin is in the output state selected by the GTIOR.GTIOm [3:2] bits at the end of
the cycle in the compare match operation.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
The GTIOR sets the functions of the GTIOCA and GTIOCB pins.
OADFLT bit (GTIOCA Pin Output Value Setting at the Count Stop)
The OADFLT bit selects whether the GTIOCA pin outputs high or low when counting stops.
OBDFLT bit (GTIOCB Pin Output Value Setting at the Count Stop)
The OBDFLT bit sets whether the GTIOCB pin outputs high or low when counting stops.
Note 1. The cycle end means an overflow (GTCNT changes from GTPR to 0 in up-counting), an underflow (GTCNT
changes from 0 to GTPR in down-counting), or counter clearing for saw-wave mode, and means a trough
(GTCNT changes from 0 to 1) for trianglewave mode.
Note 2. When the timing of a cycle end and the timing of a GTCCRA/GTCCRB compare match are the same in a
compare-match operation, the b3 and b2 settings are given priority in saw-wave PWM mode, and the b1 and b0
settings are given priority in any other mode.
Note 3. In event count operation where at least one bit in GTUPSR or GTDNSR is set to 1, the setting of b3 and b2 is
ignored.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — — — — — — — — — — — —
The GTINTAD enables or disables interrupt requests and output disable requests.
GRPABH bit (Same Time Output Level High Disable Request Enable)
The GRPABH bit enables or disables the output disable request when the GTIOCA pin and GTIOCB pin output 1 at the
same time.
GRPABL bit (Same Time Output Level Low Disable Request Enable)
The GRPABL bit enables or disables the output disable request when the GTIOCA pin and GTIOCB pin output 0 at the
same time.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
GTCNT counter value is transferred to GTCCRA by the input capture signal when the GTCCRA register functions
as an input capture register.
[Clearing condition]
0 is written to this flag.
prohibited.
When an interrupt by the OABHF flag is enabled (GTINTAD.GRPABH = 1), the OABHF flag is output to the POEG as
the output disable request.
[Setting condition]
The GTIOCA and GTIOCB pins output 1 at the same time when both OAE bit and OBE bit are set to 1.
[Clearing conditions]
The GTIOCA pin output value is different from the GTIOCB pin output value when both OAE bit and OBE bit are
set to 1
The GTIOCA and GTIOCB pins output 0 at the same time when both OAE bit and OBE bit are set to 1
Either the OAE bit or OBE bit is set to 0.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — — — — — — — — — — BD[1] BD[0]
The GTBER provides settings for the buffer operation and must be set while the GTCNT operation is stopped.
Note 1. The buffer operation mode is fixed in saw-wave one-shot pulse mode or triangle-wave PWM mode 3 (64-bit
transfer at trough).
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
GTCNT is a 32-bit read/write counter for GPT320. For GPT16m (m = 1 to 6), GTCNT is a 16-bit register. GTCNT can
only be written to after counting is stopped. GTCNT must be accessed in 32-bit units. Access in 8-bit/16-bit units is
prohibited.
For GPT16m (m = 1 to 6), the upper 16 bits for access in a 32-bit unit are always read as 0000h, and writing to these bits
is ignored.
GTCNT must be set within the range of 0 ≤ GTCNT ≤ GTPR.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
Note 1. For GPT16m (m = 1 to 6), the value of the upper 16 bits after reset is 0000h.
GTCCRn registers are read/write registers. The effective size of GTCCRn is the same as GTCNT (16-bit or 32-bit). If the
effective size of GTCCRn is 16-bit, the upper 16 bits for access in a 32-bit unit are always read as 0000h, and writing to
these bits is ignored.
GTCCRA and GTCCRB are registers used for both output compare and input capture. GTCCRC and GTCCRE are
compare match registers that can also function as buffer registers for GTCCRA and GTCCRB.
GTCCRD and GTCCRF are compare match registers that can also function as buffer registers for GTCCRC and
GTCCRE (double-buffer registers for GTCCRA and GTCCRB).
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
Note 1. For GPT16m (m = 1 to 6), the value of the upper 16 bits after reset is 0000h.
GTPR is a read/write register that sets the maximum count value of GTCNT. The effective size of GTPR is the same as
GTCNT (16-bit or 32-bit). If the effective size of GTPR is 16-bit, the upper 16 bits for access in a 32-bit unit are always
read as 0000h, and writing to these bits is ignored.
For saw waves, the value of (GTPR + 1) is the cycle. For triangle waves, the value of (GTPR value 2) is the cycle.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
Note 1. For GPT16m (m = 1 to 6), the value of the upper 16 bits after reset is 0000h.
GTPBR is a read/write register that functions as a buffer register for GTPR. The effective size of GTPBR is the same as
GTCNT (16-bit or 32-bit). If the effective size of GTPBR is 16-bit, the upper 16 bits for access in a 32-bit unit are always
read as 0000h, and writing to these bits is ignored.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — — — — — — — — — — — —
— — — — — — — — — — — — — — — TDE
The GTDTCR enables automatic setting of a compare match value for negative-phase waveform with dead time. GPT
has a dead time control function and the GTDVU register is used for setting dead time value.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
Value after
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
reset:*1
Note 1. For GPT16m (m = 1 to 6), the value of the upper 16 bits after reset is 0000h.
GTDVU is a read/write register that sets the dead time for generating PWM waveforms with dead time. The effective
size of GTDVU is the same as GTCNT (16-bit or 32-bit). If the effective size of GTDVU is 16-bit, the upper 16 bits for
access in a 32-bit unit are always read as 0000h, and writing to these bits is ignored.
Setting a dead time value that exceeds the cycle is prohibited. The set value can be confirmed by reading from GTCCRB.
When GTDVU is used, writing to GTCCRB is prohibited. When this register is set to 0, waveforms without dead time
are output.
While GPT is running, changing the GTDVU values is prohibited. To change GTDVU to a new value, stop the GPT with
the CST bit in the GTCR register. GTDVU must be accessed in 32-bit units. Access in 8-bit/16-bit units is prohibited.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — — — EN — W V U — WF VF UF
21.3 Operation
GPT320.GTPR register
GTCR.CST bit
Flag is cleared by software
GTST.TCFPO flag
Figure 21.3 Example of periodic count operation in up-counting by the count clock
Figure 21.4 shows an example for setting periodic count operation in up-counting.
Set cycle
Set the cycle in GTPR.
Figure 21.4 Example setting for a periodic count operation in up-counting by the count clock
GTST.TCFPU flag
Figure 21.5 Example of periodic count operation in down-counting by the count clock
Figure 21.6 shows an example setting for periodic count operation in down-counting by the count clock.
Set cycle
Set the cycle in GTPR.
Figure 21.6 Example setting for periodic count operation in down-counting by count clock
operation is synchronized by the count clock selected in GTCR.TPCS[2:0]. Set GTCR.TPCS[2:0] to 000b to count up
with a 1 PCLKD delay after GTCR.CST is set to 1.
Figure 21.7 shows an example of a periodic count operation in up-counting by a hardware resource (rising edge of
GTETRGA pin).
PCLKD
GTETRGA
GTCNT N N+1
Figure 21.7 Example of periodic count operation in up-counting using hardware sources
Figure 21.8 shows an example setting for periodic count operation in down-counting by the count clock.
Set cycle
Set the cycle in GTPR.
Figure 21.8 Example setting for an event count operation in up-counting using hardware sources
PCLKD
GTETRGA
GTCNT N+1 N
Figure 21.9 Example of event count operation in down-counting using hardware sources
Figure 21.10 shows an example setting for a periodic count operation in down-counting using a hardware resource.
Set cycle
Set the cycle in GTPR.
Figure 21.10 Example setting for an event count operation in down-counting using hardware sources
GPT320.GTPR register
GPT320.GTCCRA register
GPT320.GTCCRB register
[Setting examples]
GPT320.GTIOR.GTIOA[4:0] bits: Initial output is low, high output at compare match, output retained at cycle end
GPT320.GTIOR.GTIOB[4:0] bits: Initial output is high, low output at compare match, output retained at cycle end
Set cycle
Set the cycle in GTPR.
Figure 21.12 Example for setting low output and high output operation
GPT320.GTPR register
GPT320.GTCCRB register
GPT320.GTCCRA register
0000 0000h
Time
[Setting examples]
GPT320.GTIOR.GTIOA[4:0] bits: Initial output is high, output toggled at compare match, output retained at cycle end
GPT320.GTIOR.GTIOB[4:0] bits: Initial output is low, output toggled at compare match, output retained at cycle end
GPT320.GTPR register
GPT320.GTCCRA register
0000 0000h Time
[Setting examples]
GPT320.GTIOR.GTIOA[4:0] bits: Initial output is high, output toggled at compare match, output retained at cycle end
GPT320.GTIOR.GTIOB[4:0] bits: Initial output is low, output retained at compare match, output toggled at cycle end
Set cycle
Set the cycle in GTPR.
GPT320.GTPR register
E400h
C154h
9682h
1100h
0000 0000h Time
[Setting examples]
GTICASR setting input capture at both edges
GTICBSR setting input capture at the rising edge
Set cycle
Set the cycle in GTPR.
cccc
bbbb
aaaa
Figure 21.18 Example of GTPR buffer operation with saw waves in up-counting
cccc
bbbb
aaaa
Figure 21.19 Example of GTPR buffer operation with saw waves in down-counting
cccc
bbbb
aaaa
Set cycle
Set the cycle in GTPR.
GPT320.GTPR register
cccc
bbbb
aaaa
Figure 21.22 Example of GTCCRA and GTCCRB buffer operation with output compare, saw waves in up-
counting, high output at GTCCRA compare match, and low output at cycle end
GPT320.GTPR register
cccc
bbbb
aaaa
Figure 21.23 Example of GTCCRA and GTCCRB double buffer operation with output compare, triangle waves,
buffer operation at trough, output toggled at GTCCRA compare match, and output retained at
cycle end
GPT320.GTPR register
dddd
cccc
bbbb
aaaa
Figure 21.24 Example of GTCCRA and GTCCRB double buffer operation with output compare, triangle waves,
buffer operation at both troughs and crests, output toggled at GTCCRB compare match, and
output retained at cycle end
Set cycle
Set the cycle in GTPR.
Figure 21.25 Example setting for GTCCRA and GTCCRB buffer operation with output compare
GPT320.GTPR register
cccc
bbbb
aaaa
Figure 21.26 Example of GTCCRA and GTCCRB buffer operation with input capture at both edges of GTIOC0A
input, saw waves in up-counting, and GTCNT counter cleared at both edges of GTIOC0A input
GPT320.GTPR register
cccc
bbbb
aaaa
Figure 21.27 Example of GTCCRA and GTCCRB double buffer operation with input capture at both edges of
GTIOC0B input, saw waves in up-counting, and GTCNT counter cleared at both edges of
GTIOC0B input
Set cycle
Set the cycle in GTPR.
Figure 21.28 Example setting for GTCCRA and GTCCRB buffer operation with input capture
GPT320.GTPR register
ffff
eeee
dddd
cccc
bbbb
aaaa
Figure 21.29 Example of saw-wave PWM mode operation with up-counting, buffer operation, high output at
GTCCRA/GTCCRB compare match, and low output at cycle end
Set cycle
Set the cycle in GTPR.
GPT320.GTPR register
hhhh
gggg
ffff
eeee
dddd
cccc
bbbb
aaaa
Figure 21.31 Example of saw-wave one-shot pulse mode operation with up-counting, low output from the
GTIOC0A pin and high output from the GTIOC0B pin at count start, output toggled at GTCCRA/
GTCCRB compare match, and output retained at cycle end
Set cycle
Set the cycle in GTPR.
GPT320.GTPR register
ffff
eeee
dddd
cccc
bbbb
aaaa
Figure 21.33 Example of triangle-wave PWM mode 1 operation with buffer operation, low output from the
GTIOC0A pin and high output from the GTIOC0B pin at count start, output toggled at GTCCRA/
GTCCRB register compare match, and output retained at cycle end
Set cycle
Set the cycle in GTPR.
GPT320.GTPR register
hhhh
gggg
ffff
eeee
dddd
cccc
bbbb
aaaa
Figure 21.35 Example of triangle-wave PWM mode 2 operation with buffer operation, low output from the
GTIOC0A pin and high output from the GTIOC0B pin at count start, output toggled at GTCCRA/
GTCCRB compare match, and output retained at cycle end
Set cycle
Set the cycle in GTPR.
GPT320.GTPR register
hhhh
gggg
ffff
eeee
dddd
cccc
bbbb
aaaa
Figure 21.37 Example of triangle-wave PWM mode 3 operation with low output from the GTIOC0A pin and high
output from the GTIOC0B pin at count start, output toggled at GTCCRA/GTCCRB compare match,
and output retained at cycle end
Set cycle
Set the cycle in GTPR.
GPT320.GTPR register
GPT320.GTCCRA register
GPT320.GTCCRA register
Figure 21.39 Example of automatic dead time setting function operation in saw-wave one-shot pulse mode,
up-counting, and active-high
GPT320.GTPR register
GPT320.GTCCRA register
GPT320.GTCCRA register
Figure 21.40 Example of automatic dead time setting function operation in saw-wave one-shot pulse mode,
down-counting, and active-high
GPT320.GTPR register
GPT320.GTCCRA register
GPT320.GTCCRA register
Figure 21.41 Example of automatic compare-match value setting function with dead time in triangle-wave
PWM mode 1, and active-high
GPT320.GTPR register
GPT320.GTCCRA register
GPT320.GTCCRA register
GPT320.GTCCRB register GTCCRA - GTDVU GTCCRA - GTDVU GTCCRA - GTDVU GTCCRA - GTDVU
(automatic setting)
Figure 21.42 Example of automatic compare-match value setting function with dead time in triangle-wave
PWM mode 2 or 3, and active-high
Set cycle
Set the cycle in GTPR.
Figure 21.43 Example setting for automatic dead time setting function in saw-wave one-shot pulse mode, and
triangle-wave PWM mode 3
Set cycle
Set the cycle in GTPR.
Figure 21.44 Example setting for automatic dead time setting function in triangle-wave PWM mode 1 or 2
bbbb
aaaa
GTUDDTYC.UD bit
(count direction setting) Up-counting Down-counting Up-counting
GTST.TUCF flag
(count direction flag) Up-counting Down-counting Up-counting
Register write Register write Register write Register write Register write
Buffer transfer at Buffer transfer at Buffer transfer at Buffer transfer at Buffer transfer at
overflow overflow underflow underflow overflow
Figure 21.45 Example operation of a count direction changing function during buffer operation
GPT320.GTPR register
bbbb
aaaa
0% 100%
[Setting examples]
GPT320.GTIOR.GTIOA[4:0] bits: 00011b
Initial low output, output toggled at compare match, output retained at cycle end
GPT320.GTUDDTYC.OADTYR bit: 0b
Applied the value of duty 0% or 100% output to GTIOA[3:2] bits function after 0% or 100%
duty setting is released
GPT320.GTIOR.GTIOB[4:0] bits: 00011b
Initial low output, output toggled at compare match, output retained at cycle end
GPT320.GTUDDTYC.OBDTYR bit: 1
Applied the value of masked compare match output to GTIOB[3:2] bits function after 0% or
100% duty setting is released
ELC_GPTA input
Figure 21.47 Example of count start operation by a hardware source, started at the input of the signal from the
ELC_GPTA event
Set cycle
Set the cycle in GTPR.
Figure 21.48 Example setting for count start operation by a hardware source
0000 0000h
Time
ELC_GPTA input
ELC_GPTB Input
Figure 21.49 Example of count stop operation by hardware source started by software, stopped at ELC_GPTA
event input, and restarted at ELC_GPTB event input
Set cycle
Set the cycle in GTPR.
Figure 21.50 Example setting for count stop operation by a hardware source
Figure 21.51 shows an example of a count start/stop operation by a hardware source. Figure 21.52 shows the setting
example. In this example, the counter operates during the high-level periods of the external trigger input GTETRGA.
0000 0000h
Time
Figure 21.51 Example of count start/stop operation by a hardware source, started on the rising edge of
GTETRGA pin input, and stopped on the falling edge of GTETRGA pin input
Set cycle
Set the cycle in GTPR.
Figure 21.52 Example setting for count start/stop operation by a hardware source
ELC_GPTA input
ELC_GPTB input
Figure 21.53 Examples of count clearing operation by hardware source in saw-wave up-counting, started at
ELC_GPTA event input, and stopped/cleared at ELC_GPTB event input
GTPR register
ELC_GPTA input
ELC_GPTB input
Figure 21.54 Examples of count clearing operation by hardware source in saw-wave down-counting, started at
ELC_GPTA event input, and stopped/cleared at ELC_GPTB event input
Set cycle
Set the cycle in the GTPR register.
Figure 21.55 Example setting for count clearing operation by a hardware source
The GPTn_OVF/GPTn_UDF (n = 0 to 6) interrupt (overflow/underflow interrupt) is not generated when the counter is
cleared by a hardware source or by software.
Figure 21.56 shows the relationship between the counter clearing by a hardware source and the GPTn_OVF (n = 0 to 6)
interrupt.
GPTn_OVF (n = 0 to 6)
interrupt request
Figure 21.56 Relationship between counter clearing by hardware source and GPTn_OVF (n = 0 to 6) interrupt
GPT320.GTPR register
GPT161.GTPR register
GPT162.GTPR register
GPT163.GTPR register
Figure 21.57 Example of a simultaneous start, stop, and clear by software with the same count cycle (GTPR
register value)
GPT320.GTPR register
Set initial value
cccc
bbbb
aaaa
0000 0000h Time
GPT161.GTPR register
cccc
Set initial value
bbbb
aaaa
0000 0000h Time
GPT162.GTPR register
cccc
bbbb
Set initial value
aaaa
0000 0000h Time
GPT163.GTPR register
cccc
bbbb
aaaa
Set initial value
0000 0000h Time
Figure 21.58 Example of software phase start with the same count cycle (GTPR register value)
GPT320.GTPR register
GPT161.GTPR register
GPT162.GTPR register
GPT163.GTPR register
ELC_GPTB input
Figure 21.59 Example of a simultaneous start, stop, and clear by a hardware source with the same count cycle
(GTPR register value)
Set cycle
Set the cycle in the GTPR register.
GPT320.GTCNT counter
GPT320.GTPR register
GPT320.GTCCRB register
GPT320.GTCCRA register
GPT161.GTCNT counter
GPT161.GTPR register
GPT161.GTCCRB register
GPT161.GTCCRA register
GPT162.GTCNT counter
GPT162.GTPR register
GPT162.GTCCRB register
GPT162.GTCCRA register
GPT163.GTCNT counter
GPT163.GTPR register
GPT163.GTCCRB register
GPT163.GTCCRA register
GPT320.GTCNT counter
GPT320.GTPR register
GPT320.GTCCRA register
= GPT320.GTCCRB register
GPT161.GTCNT counter
GPT161.GTPR register
GPT161.GTCCRA register
= GPT161.GTCCRB register
GPT162.GTCNT counter
GPT162.GTPR register
GPT162.GTCCRA register
= GPT162.GTCCRB register
(3) 3-phase saw-wave complementary PWM output with automatic dead time setting
Figure 21.63 shows an example in which three channels perform synchronized operation in saw-wave one-shot pulse
mode with automatic dead time setting and 3-phase complementary PWM waveforms are output. The GTIOCA pin is set
so that it outputs low as the initial value, toggles the output at a GTCCRA compare match, and retains the output at the
cycle end. The GTIOCB pin is set so that it outputs high as the initial value, toggles the output at a GTCCRB compare
match, and retains the output at the cycle end.
GPT320.GTCNT counter
GPT320.GTPR register
GPT320.GTCCRD register
GPT320.GTCCRC register
GPT161.GTCNT counter
GPT161.GTPR register
GPT161.GTCCRD register
GPT161.GTCCRC register
GPT162.GTCNT counter
GPT162.GTPR register
GPT162.GTCCRD register
GPT162.GTCCRC register
Figure 21.63 Example of 3-phase saw-wave complementary PWM output with automatic dead time setting
GPT320.GTCNT counter
GPT320.GTPR register
GPT320.GTCCRA register
GPT320.GTCCRB register
GPT161.GTCNT counter
GPT161.GTPR register
GPT161.GTCCRA register
GPT161.GTCCRB register
GPT162.GTCNT counter
GPT162.GTPR register
GPT162.GTCCRA register
GPT162.GTCCRB register
(5) 3-phase triangle-wave complementary PWM output with automatic dead time setting
Figure 21.65 shows an example in which three channels perform synchronized operation in triangle-wave PWM mode 1
with automatic dead time setting and 3-phase complementary PWM waveforms are output. The GTIOCA pin is set so
that it outputs low as the initial value, toggles the output at a GTCCRA compare match, and retains the output at the
cycle end. The GTIOCB pin is set so that it outputs high as the initial value, toggles the output at a GTCCRB compare
match, and retains the output at the cycle end.
GPT320.GTCNT counter
GPT320.GTPR register
GPT320.GTCCRA register
GPT161.GTCNT counter
GPT161.GTPR register
GPT161.GTCCRA register
GPT162.GTCNT counter
GPT162.GTPR register
GPT162.GTCCRA register
GPT320.GTDVU GPT320.GTDVU
Figure 21.65 Example of 3-phase triangle-wave complementary PWM output with automatic dead time setting
(6) 3-phase asymmetric triangle-wave complementary PWM output with automatic dead time
setting
Figure 21.66 shows an example in which three channels perform synchronized operation in triangle-wave PWM mode 3
with automatic dead time setting and 3-phase complementary PWM waveforms are output. The GTIOCA is set so that it
outputs low as the initial value, toggles the output at a GTCCRA compare match, and retains the output at the cycle end.
The GTIOCB is set so that it outputs high as the initial value, toggles the output at a GTCCRB compare match, and
retains the output at the cycle end.
GPT320.GTCNT counter
GPT320.GTPR register
GPT320.GTCCRC register
GPT320.GTCCRD register
GPT161.GTCNT counter
GPT161.GTPR register
GPT161.GTCCRC register
GPT161.GTCCRD register
GPT162.GTCNT counter
GPT162.GTPR register
GPT162.GTCCRC register
GPT162.GTCCRD register
GPT320.GTDVU GPT320.GTDVU
Figure 21.66 Example of 3-phase asymmetric triangle-wave complementary PWM output with automatic dead
time setting
GTCNT counter
Up-counting Down-counting
Time
: Rising edge
: Falling edge
GTCNT counter
Up-counting Down-counting
Time
: Rising edge
: Falling edge
GTCNT counter
Down-counting
Up-counting
Time
: Rising edge
: Falling edge
GTCNT counter
Up-counting Down-counting
Time
: Rising edge
: Falling edge
GTCNT counter
Down-counting
Up-counting
Time
: Rising edge
: Falling edge
GTCNT counter
Down-counting
Up-counting
Time
: Rising edge
: Falling edge
GTCNT counter
Up-counting Down-counting
Time
: Rising edge
: Falling edge
GTCNT Counter
Down-counting
Up-counting
Time
: Rising edge
: Falling edge
GTCNT
Up-counting
Time
: Rising edge
: Falling edge
GTCNT
Up-counting
Time
: Rising edge
: Falling edge
To ELC
GPT_UVWEDGE
1 pulse @ PCLKD
GPT161 PWM
PWM
To ELC
GPT_UVWEDGE
1 pulse @ PCLKD
Figure 21.79 Example of 6-phase PWM output operation with chopper control
Figure 21.80 shows a 6-phase PWM output example of an output disable control operation.
GPT161 PWM
PWM
"U-phase" after input
selection
GTIU
"V-phase" after input
selection
GTIV
"W-phase" after input
selection
GTIW
Output enable
OPSCR.EN
Auto clear Setting by software
Output Disabled Source
Select
0 (Group A output disable request)
OPSCR.GRP
Group output disable
OPSCR.GODF
Clear by software
Connected between
POEG group A and OPS
To ELC
GPT_UVWEDGE
1 pulse @ PCLKD
Counting of GPT161
Start the count operation of GPT161, and output a PWM waveform.
Noise filter settings of GPT_OPS external input (only external input is selected)
When using a noise filter, set the sampling clock of the noise filter by OPSCR.NFCS[1:0] bits.
Then the noise filter is enabled if OPSCR.NFEN = 1.
GPT_OPS Working
Setting the OPSCR.EN = 1 outputs the 6-phase output to drive the brushless DC motor from the
GPT_OPS.
n = 0 to 6
Note: n = 0 to 6
Sampling clock
Signal conveyed
internally
GPT320.GTPR register
GTBER.BD[0]
Figure 21.83 Example of operation for disabling buffer operation with triangle waves, double buffer operation,
and buffer transfer at both troughs and crests
Figure 21.84 shows an example of the GTIOC pin output disable control operation.
GPT320.GTPR register
cccc
bbbb
aaaa
Figure 21.84 Example of GTIOC pin output disable control operation in saw-wave up-counting, buffer
operation, active level 1, high output at GTCCRA compare match, low output at cycle end, and
low output at output disable
GPT320.GTPR register
GPT320.GTCCRA register
GPT320.GTCCRB register
Hi-Z
GTIOC0B pin output
(2) When automatic dead time setting is not made in triangle-wave PWM mode
The GTCCRA register must be set within the range of 0 < GTCCRA < GTPR. If GTCCRA = 0 or GTCCRA = GTPR is
set, a compare match occurs within the cycle only when GTCCRA = 0 or GTCCRA = GTPR is satisfied. When
GTCCRA > GTPR, no compare match occurs.
Similarly, GTCCRB must be set within the range of 0 < GTCCRB < GTPR. If GTCCRB = 0 or GTCCRB = GTPR is set,
a compare match occurs within the cycle only when GTCCRB is 0 or GTCCRB = GTPR is satisfied. When GTCCRB >
GTPR, no compare match occurs.
(3) When automatic dead time setting is made in saw-wave one-shot pulse mode
The GTCCRC and GTCCRD registers must be set to satisfy the following restrictions. If the restrictions are not satisfied,
the correct output waveforms with secured dead time might not be obtained.
In up-counting: GTCCRC < GTCCRD, GTCCRC > GTDVU, GTCCRD < GTPR - GTDVU
In down-counting: GTCCRC > GTCCRD, GTCCRC < GTPR - GTDVU, GTCCRD > GTDVU.
(4) When automatic dead time setting is not made in saw-wave one-shot pulse mode
The GTCCRC and GTCCRD registers must be set to satisfy the following restrictions. If the restrictions are not satisfied,
two compare matches do not occur and pulse output cannot be performed.
In up-counting: 0 < GTCCRC < GTCCRD < GTPR
In down-counting: GTPR > GTCCRC > GTCCRD > 0.
Similarly, GTCCRE and GTCCRF must be set to satisfy the following restrictions. If the restrictions are not satisfied,
two compare matches do not occur and pulse output cannot be performed.
In up-counting: 0 < GTCCRE < GTCCRF < GTPR
In down-counting: GTPR > GTCCRE > GTCCRF > 0.
If up-counting and down-counting by hardware sources occur at the same time, the GTCNT counter value does not
change. When there is a conflict between updating the GTCNT register and reading by the CPU, pre-update data is read.
Note 1. AGT0 cannot use the AGT0 underflow signal. AGT1 connects directly with the underflow event signal from the
AGT0 timer.
Note 2. Satisfy the frequency of the peripheral module clock (PCLKB) ≥ the frequency of the count source clock.
Data bus
TMOD[2:0] Compare
TIOGT[1:0] = other than match A event
= 00b 010b TSTART TCMEA TCMEB signal
Event is always counted
Event is counted during polarity = 01b
period specified for AGTEEn*1 16-bit counter
= 010b AGT
counter
TIPF[1:0] Underflow
event signal/
TMOD[2:0] Measurement
= 011b or 100b complete event
Digital signal
One edge/ Counter
filter both edges Polarity control
switching selection circuit
Measurement
TEDGPL TEDGSEL complete signal
TMOD[2:0] = 001b Q
AGTIOn pin TEDGSEL = 1 CK
Toggle flip-flop
TEDGSEL = 0
Q CLR
Write to AGTMR1 register
AGTOn pin TOE Write 1 to TSTOP
AGTOAn pin Q CK
TOEA TOPOLA = 1
Toggle flip-flop
TOPOLA = 0
Q CLR
Write to AGTMR1 register
Write 1 to TSTOP
AGTOBn pin Q CK
TOEB TOPOLB = 1
Toggle flip-flop
TOPOLB = 0
Q CLR
Write to AGTMR1 register
Write 1 to TSTOP
TSTART, TSTOP, TUNDF, TCMAF, TCMBF: Bits in AGTCR register
TEDGSEL, TOE, TIPF[1:0], TIOGT[1:0]: Bits in AGTIOC register
TMOD[2:0], TEDGPL, TCK[2:0]: Bits in AGTMR1 register
CKS[2:0]: Bits in AGTMR2 register
TCMEA, TOEA, TOPOLA, TCMEB, TOEB, TOPOLB: Bits in AGTCMSR register
Note 1. The polarity can be selected by the EEPS bit in the AGTISR register.
Note 2. AGT0 cannot use AGT underflow event. AGT1 uses the underflow of AGT0.
Note 1. When 1 is written to the TSTOP bit in the AGTCR register, the 16-bit counter is forcibly stopped and set to
FFFFh.
Note 2. When the TCK[2:0] bit setting in the AGTMR1 register is a value other than 001b (PCLKB/8) or 011b (PCLKB/2),
if the AGT register is set to 0000h, a request signal to the ICU, the DTC and the ELC is generated once
immediately after the count starts. The AGTOn and AGTIOn outputs are toggled.
When the AGT register is set to 0000h in event counter mode, regardless of the value of TCK[2:0] bits, a request
signal to the ICU, the DTC and the ELC is generated once immediately after the count starts.
In addition, the AGTOn output toggles even during a period other than the specified count period. When the AGT
register is set to 0001h or more, a request signal is generated each time AGT underflows.
AGT is a 16-bit register. The write value is written to the reload register and the read value is read from the counter.
The states of the reload register and the counter change according to the TSTART bit in the AGTCR register and
TCMEA/TCMEB bit in the AGTCMSR register. For details, see section 22.3.1, Reload Register and Counter Rewrite
Operation. The AGT register can be set by a 16-bit memory manipulation instruction.
Note 1. Set the AGTCMA register to FFFFh when compare match A is not used.
The AGTCMA register is a read/write register to set a value for compare match with the AGT counter. The states of the
reload register and compare register A change according to the TSTART bit in the AGTCR register. For details, see
section 22.3.2, Reload Register and Compare Register A/B Rewrite Operation. The AGTCMA register can be set by a
16-bit memory manipulation instruction.
Note 1. Set the AGTCMB register to FFFFh when compare match B is not used.
The AGTCMB register is a read/write register to set a value for compare match with the AGT counter. The states of the
reload register and compare register B change according to the TSTART bit in the AGTCR register. For details, see
section 22.3.2, Reload Register and Compare Register A/B Rewrite Operation. The AGTCMB register can be set by a
16-bit memory manipulation instruction.
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. When 1 (count is forcibly stopped) is written to the TSTOP bit, TSTART and TCSTF bits are initialized at the same time. The
pulse output level is also initialized. The read value is 0.
Note 2. For information on using the TSTART and TCSTF bits, see section 22.4.1, Count Operation Start and Stop Control.
Note 3. Only 0 can be written to clear the flag.
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. Write access to the AGTMR1 register initializes the output from the AGTOn, AGTIOn, AGTOAn and AGTOBn pins of the AGT
(n = 0, 1). For details on the output level at initialization, see section 22.2.7, AGT I/O Control Register (AGTIOC).
Note 2. When event counter mode is selected, the external input (AGTIOn) is selected as the count source regardless of the TCK[2:0]
bit setting.
Note 3. Do not switch count sources during count operation. Count sources should be switched when both the TSTART and TCSTF
bits in the AGTCR register are set to 0 (count is stopped).
Note 4. The operating mode can only be changed when the count is stopped while both the TSTART and TCSTF bits in the AGTCR
register are set to 0 (count is stopped).
Note 5. The TEDGPL bit is enabled only in event counter mode.
Note 6. When running AGT in Software Standby mode or Snooze mode, select AGTLCLK or AGTSCLK (TCK[2:0] = 100b or 110b) as
the count source.
Note 7. AGT0 cannot use AGT0 underflow (setting prohibited). AGT1 uses the AGT0 underflow.
b7 b6 b5 b4 b3 b2 b1 b0
LPM — — — — CKS[2:0]
Note 1. Do not rewrite the CKS[2:0] bits during count operation. Only rewrite the CKS[2:0] bits when both the TSTART
and TCSTF bits in the AGTCR register are set to 0 (count is stopped).
Note 2. When count source is AGTLCLK or AGTSCLK, the switch of CKS[2:0] is valid.
Note 3. Do not switch the TCK[2:0] bits in the AGTMR1 register when CKS[2:0] are not 000b. Switch the TCK[2:0] bits in
the AGTMR1 register after CKS[2:0] are set to 000b, and wait for 1 cycle of the count source.
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. When AGTEEn pin is used, the polarity to count an event can be selected with the EEPS bit in the AGTISR
register.
Note 2. TIOGT[1:0] bits are enabled only in event counter mode.
Note 3. When event counter mode operation is performed during Software Standby mode, the digital filter function cannot
be used.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — EEPS — —
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. Do not rewrite the AGTCMSR register during a count operation. Only rewrite the AGTCMSR register when both
the TSTART and TCSTF bits in the AGTCR register are set to 0 (count is stopped).
Note 2. Do not set 1 when in pulse width measurement mode or pulse period measurement mode.
b7 b6 b5 b4 b3 b2 b1 b0
— — — TIES — — — —
The AGTIOSEL register sets the AGTIOn pin when using the AGTIOn in Software Standby mode. The AGTIOSEL
register can be set with an 8-bit memory manipulation instruction.
22.3 Operation
Write 5678h to AGT register with software Write 1234h to AGT register with software
Count source
AGT counter FFFFh 5678h 5677h 5676h 5675h 5674h 5673h 5672h 5671h 5670h 566Fh 1234h 1233h 1232h 1231h 1230h
Figure 22.2 Timing of rewrite operation with TSTART, TCMEA and TCMEB bit values when compare match A
register and compare match B register are invalid
Write 5678h to AGT register with software Write 1234h to AGT register with software
Count source
AGT counter FFFFh 5678h 5677h 5676h 5675h 5674h 5673h 5672h 5671h 5670h 566Fh ••••• ••••• 0002h 0001h 0000h 1234h1233h 1232h1231h
Figure 22.3 Timing of rewrite operation with TSTART bit value and TCMEA or TCMEB bit value when compare
match A register or compare match B register is valid
Write 1234h to AGTCMA register with software Write 2345h to AGTCMA register with software
Count source
AGT counter 5678h 5677h 5676h 5675h 5674h 5673h 5672h 5671h 5670h 566Fh 566Eh ... 0000h 5678h 5677h
Reload register of
FFFFh 1234h 2345h
compare match A
Underflow signal
Figure 22.4 Timing of rewrite operation with the TSTART bit value for compare register A
Count source
Previous value
Reload register (0300h)
New value (1010h)
AGT counter 02FAh 02F9h 02F8h 02F7h 1010h 100Fh 100Eh ••••• ••••• 0000h 1010h 100Fh 100Eh 100Dh 100Ch 100Bh
Count source
TSTART bit in
AGTCR register
AGT counter FFFFh 0002h 0001h 0000h 0002h 0001h 0000h 0002h 0001h 0000h 0002h 0001h 0004h 0003h 0002h 0001h 0000h 0004h 0003h
TEDGSEL bit in
AGTIOC register 0
TUNDF bit in
AGTCR register
Underflow signal
TMOD[2:0] bits in
010b
AGTMR1 register
Event is counted at rising edge
AGTIOC register 00h
TSTART bit
in AGTCR register
Event input is started Event input is complete
AGTIOn pin
event input
Underflow signal
*2
Event input to AGTIOn pin
*1
AGTEEn pin
AGT counter FFFFh FFFEh FFFDh FFFCh FFFBh FFFAh FFF9h FFF8h
Note 1. To control synchronization, there is a delay of 2 cycles of the count source until the count operation is affected. It is also possible that the
count start timing is shifted for 1 cycle because of the phase difference between the AGTEEn and the sampling clock.
Note 2. Count operation can be performed for 2 cycles of the count source immediately after the count starts, depending on the previous state
before the count stops.
To disable the count for 2 cycles immediately after the count starts, write 1 to the TSTOP bit in the AGTCR register to initialize the internal
circuit, and then complete the operation settings before starting the count operation.
This example applies when the high-level width of the measurement pulse is measured (TEDGSEL bit in AGTIOC register = 1)
Measurement
Measurement is stopped
is stopped
Measurement Measurement
is started is started
0000h Time
TSTART bit in
AGTCR register
Measurement pulse
input to AGTIOn pin
TEDGF bit in
AGTCR register
TUNDF bit in
AGTCR register
Figure 22.10 shows the operation example in pulse period measurement mode.
Only input pulses with a period longer than twice the period of the count source are measured. Also, the low-level and
high-level widths must both be longer than the period of the count source. If a pulse period shorter than these conditions
is input, the input might be ignored.
Count source
TSTART bit
in AGTCR register
AGT counter 0300h 02FFh 02FEh 0300h 02FFh 02FEh 02FDh02FCh 02FBh 02FAh 02F9h 02F8h 02F7h 0300h 02FFh •••• •••• 0001h 0000h 0300h 02FFh 02FEh
Content of read-out buffer 0300h 02FFh 02FEh 02FBh 02FAh 02F9h 02F8h 02F7h •••• •••• 0001h 0000h 0300h 02FFh
*2 02FEh *2 02F7h
Read data
*3 *3
TEDGF bit in
AGTCR register
This example applies when the initial value of the AGT register is set to 0300h, the TEDGSEL bit in the AGTIOC register is set to 0, and the period
from one rising edge to the next edge of the measurement pulse is measured.
Note 1. Reading from the AGT register must be performed during the period from when the TEDGF bit is set to 1 (active edge received) until the
next active edge is input. The content of the read-out buffer is retained until the AGT register is read. If it is not read before the active edge
is input, the measurement result of the previous period is retained.
Note 2. When the AGT register is read in pulse period measurement mode, the content of the read-out buffer is read.
Note 3. When the active edge of the measurement pulse is input and then the set edge of an external pulse is input, the TEDGF bit in the AGTCR
register is set to 1 (active edge received).
Note 4. To set to 0 with software, write 0 to the TEDGF bit in the AGTCR register using an 8-bit memory manipulation instruction.
Note 5. To set to 0 with software, write 0 to the TUNDF bit in the AGTCR register using an 8-bit memory manipulation instruction.
Underflow Underflow
n
Matched Matched
Counter content (hex)
Matched Matched
0000h Time
TSTART bit in
AGTCR register
AGTOAn pin
output
Output inverted by compare match Output inverted by underflow Output inverted by compare match Output inverted by underflow
TCMAF bit in
AGTCR register
TCMBF bit in
AGTCR register
TUNDF bit in
AGTCR register
Note 1. Registers associated with AGT: AGT, AGTCMA, AGTCMB, AGTCR, AGTMR1, AGTMR2, AGTIOC, AGTISR
and AGTCMSR.
When the operating mode (see Table 22.1) is set to event counter mode, or the count source is set to AGT0
underflow (TCK[2:0] = 101b):
After 1 (count starts) is written to the TSTART bit in the AGTCR register while the count is stopped, the TCSTF
bit in the AGTCR register remains 0 (count stops) for 2 PCLKB cycles. Do not access the registers associated
with AGT*1 other than the TCSTF bit until this bit is set to 1 (count in progress).
After 0 (count stops) is written to the TSTART bit during a count operation, the TCSTF bit remains 1 for 2
PCLKB cycles. When the TCSTF bit is set to 0, the count is stopped. Do not access the registers associated with
AGT*1 other than the TCSTF bit until this bit is set to 0.
Clear the interrupt register before changing the TSTART bit from 0 to 1. See section 13, Interrupt Controller
Unit (ICU) for details.
Note 1. Registers associated with AGT: AGT, AGTCMA, AGTCMB, AGTCR, AGTMR1, AGTMR2, AGTIOC, AGTISR
and AGTCMSR
22.4.5 How to Calculate Event Number, Pulse Width, and Pulse Period
In event counter mode, event number is expressed mathematically as follows:
Event number = initial value of counter [AGT register] - counter value of active event end
In pulse width measurement mode, pulse width is expressed mathematically as follows:
Pulse width = counter value of stopping measurement - counter value of next stopping measurement
In pulse period measurement mode, input pulse period is expressed mathematically as follows:
Period of input pulse = (initial value of counter [AGT register] - reading value of the read-out buffer) + 1.
Note 1. The frequency of the peripheral module clock (PCLKB) must be the frequency of the count source clock.
Bus interface
RCR2 To each
RTCOUT
function Time counter 1-Hz/64-Hz output Alarm function
prescaler
128 Hz generation
LOCO Interrupt control
for LOCO
RTC_ALM
RFRH/RFRL
RTC_PRD
RCR1
RTC_CUP
Event signal output
(RTC_PRD)
R64CNT: 64-Hz counter RSECAR/BCNT0AR: Second Alarm Register/Binary Counter 0 Alarm Register
RSECCNT/BCNT0: Second counter/Binary counter 0 RMINAR/BCNT1AR: Minute Alarm Register/Binary Counter 1 Alarm Register
RMINCNT/BCNT1: Minute counter/Binary counter 1 RHRAR/BCNT2AR: Hour Alarm Register/Binary Counter 2 Alarm Register
RHRCNT/BCNT2: Hour counter/Binary counter 2 RWKAR/BCNT3AR: Day-of-week Alarm Register/Binary Counter 3 Alarm Register
RWKCNT/BCNT3: Day-of-week counter/Binary counter 3 RDAYAR/BCNT0AER: Date Alarm Register/Binary Counter 0 Alarm Enable Register
RDAYCNT: Date counter RMONAR/BCNT1AER: Month Alarm Register/Binary Counter 1 Alarm Enable Register
RMONCNT: Month counter RYRAR/BCNT2AER: Year Alarm Register/Binary Counter 2 Alarm Enable Register
RYRCNT: Year counter RYRAREN/BCNT3AER: Year Alarm Enable Register/Binary Counter 3 Alarm Enable Register
RCR1: RTC Control Register 1
RCR2: RTC Control Register 2
RCR4: RTC Control Register 4
RADJ: Time Error Adjustment Register
RFRH/RFRL: Frequency Register
b7 b6 b5 b4 b3 b2 b1 b0
x: Undefined
The R64CNT counter is used in both calendar count mode and binary count mode. The 64-Hz counter (R64CNT)
generates the period for a second by counting up periods of the 128-Hz clock. The state in the sub-second range can be
confirmed by reading this counter.
This counter is set to 00h by an RTC software reset or an execution of a 30-second adjustment. To read this counter,
follow the procedure in section 23.3.5, Reading 64-Hz Counter and Time.
b7 b6 b5 b4 b3 b2 b1 b0
— SEC10[2:0] SEC1[3:0]
x: Undefined
The RSECCNT counter sets and counts the BCD-coded second value. It counts the carries generated once per second in
the 64-Hz counter.
The setting range is decimal 00 to 59. The RTC does not operate normally if any other value is set. Before writing to this
register, be sure to stop the count operation using the START bit in RCR2.
To read this counter, follow the procedure in section 23.3.5, Reading 64-Hz Counter and Time.
b7 b6 b5 b4 b3 b2 b1 b0
BCNT[7:0]
x: Undefined
BCNT0 is a read/write 32-bit binary counter b7 to b0 that performs count operation by a carry generated for each second
of the 64-Hz counter. Before writing to this register, be sure to stop the count operation using the START bit in RCR2. To
read this counter, follow the procedure in section 23.3.5, Reading 64-Hz Counter and Time.
b7 b6 b5 b4 b3 b2 b1 b0
— MIN10[2:0] MIN1[3:0]
x: Undefined
The RMINCNT counter sets and counts the BCD-coded minute value. It counts the carries generated once per minute in
the second counter.
A value from 00 through 59 (in BCD) can be specified. If a value outside this range is specified, the RTC does not
operate correctly. Before writing to this register, be sure to stop the count operation using the START bit in RCR2. To
read this counter, follow the procedure in section 23.3.5, Reading 64-Hz Counter and Time.
b7 b6 b5 b4 b3 b2 b1 b0
BCNT[15:8]
x: Undefined
BCNT1 is a read/write 32-bit binary counter b15 to b8 that performs count operation by a carry generated for each
second of the 64-Hz counter. Before writing to this register, be sure to stop the count operation using the START bit in
RCR2. To read this counter, follow the procedure in section 23.3.5, Reading 64-Hz Counter and Time.
b7 b6 b5 b4 b3 b2 b1 b0
— PM HR10[1:0] HR1[3:0]
x: Undefined
The RHRCNT counter sets and counts the BCD-coded hour value. It counts the carries generated once per hour in the
minute counter. The specifiable time differs based on the setting in the hours mode bit (RCR2.HR24):
When the RCR2.HR24 bit is 0 — from 00 to 11 (in BCD)
When the RCR2.HR24 bit is 1 — from 00 to 23 (in BCD).
If a value outside this range is specified, the RTC does not operate correctly. Before writing to this register, be sure to
stop the count operation using the START bit in RCR2. The PM bit is only enabled when the RCR2.HR24 bit is 0.
Otherwise, the setting in the PM bit has no effect. To read this counter, follow the procedure in section 23.3.5, Reading
64-Hz Counter and Time.
b7 b6 b5 b4 b3 b2 b1 b0
BCNT[23:16]
x: Undefined
The BCNT2 is a read/write 32-bit binary counter b23 to b16 that performs count operation by a carry generated for each
second of the 64-Hz counter. Before writing to this register, be sure to stop the count operation using the START bit in
RCR2. To read this counter, follow the procedure in section 23.3.5, Reading 64-Hz Counter and Time.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — DAYW[2:0]
x: Undefined
The RWKCNT counter sets and counts in the coded day-of-week value. It counts carries generated once per day in the
hour counter. A value from 0 through 6 can be specified. If a value outside of this range is specified, the RTC does not
operate correctly. Before writing to this register, be sure to stop the count operation using the START bit in RCR2. To
read this counter, follow the procedure in section 23.3.5, Reading 64-Hz Counter and Time.
b7 b6 b5 b4 b3 b2 b1 b0
BCNT[31:24]
x: Undefined
BCNT3 is a read/write 32-bit binary counter b31 to b24 that performs count operation by a carry generated for each
second of the 64-Hz counter. Before writing to this register, be sure to stop the count operation using the START bit in
RCR2. To read this counter, follow the procedure in section 23.3.5, Reading 64-Hz Counter and Time.
b7 b6 b5 b4 b3 b2 b1 b0
— — DATE10[1:0] DATE1[3:0]
x: Undefined
The RDAYCNT counter is used in calendar count mode to set and count the BCD-coded date value. It counts carries
generated once per day in the hour counter. The count operation depends on the month and whether the year is a leap
year. Leap years are determined according to whether the year counter (RYRCNT) value is divisible by 400, 100, and 4.
A value from 01 through 31 (in BCD) can be specified. If a value outside of this range is specified, the RTC does not
operate correctly. When specifying a value, the range of specifiable days depends on the month and whether the year is a
leap year. Before writing to this register, be sure to stop the count operation using the START bit in RCR2. To read this
counter, follow the procedure in section 23.3.5, Reading 64-Hz Counter and Time.
b7 b6 b5 b4 b3 b2 b1 b0
— — — MON10 MON1[3:0]
x: Undefined
The RMONCNT counter is used in calendar count mode to set and count the BCD-coded month value. It counts carries
generated once per month in the date counter.
A value from 01 through 12 (in BCD) can be specified. If a value outside of this range is specified, the RTC does not
operate correctly. Before writing to this register, be sure to stop the count operation using the START bit in RCR2. To
read this counter, follow the procedure in section 23.3.5, Reading 64-Hz Counter and Time.
— — — — — — — — YR10[3:0] YR1[3:0]
x: Undefined
The RYRCNT counter is used in calendar count mode to set and count the BCD-coded year value. It counts the carries
generated once per year in the month counter.
A value from 00 through 99 (in BCD) can be specified. If a value outside of this range is specified, the RTC does not
operate correctly. Before writing to this register, be sure to stop the count operation using the START bit in RCR2. To
read this counter, follow the procedure in section 23.3.5, Reading 64-Hz Counter and Time.
b7 b6 b5 b4 b3 b2 b1 b0
x: Undefined
RSECAR is an alarm register associated with the BCD-coded second counter RSECCNT. When the ENB bit is set to 1,
the RSECAR value is compared with the RSECCNT value. From the following alarm registers, only those selected with
the ENB bits set to 1 are compared with the associated counters:
RSECAR
RMINAR
RHRAR
RWKAR
RDAYAR
RMONAR
RYRAREN.
When all the respective values match, the IR flag associated with the RTC_ALM interrupt is set to 1. The RSECAR
values from 00 through 59 (in BCD) can be specified. If a value outside of this range is specified, the RTC does not
operate correctly. This register is set to 00h by an RTC software reset.
b7 b6 b5 b4 b3 b2 b1 b0
BCNTAR[7:0]
x: Undefined
BCNT0AR is a read/write alarm register associated with the 32-bit binary counter b7 to b0. This register is set to 00h by
an RTC software reset.
b7 b6 b5 b4 b3 b2 b1 b0
x: Undefined
RMINAR is an alarm register associated with the BCD-coded minute counter RMINCNT. When the ENB bit is set to 1,
the RMINAR value is compared with the RMINCNT value. From the following alarm registers, only those selected with
the ENB bits set to 1 are compared with the associated counters:
RSECAR
RMINAR
RHRAR
RWKAR
RDAYAR
RMONAR
RYRAREN.
When all the respective values match, the IR flag associated with the RTC_ALM interrupt is set to 1. The RMINAR
values from 00 through 59 (in BCD) can be specified. If a value outside of this range is specified, the RTC does not
operate correctly. This register is set to 00h by an RTC software reset.
b7 b6 b5 b4 b3 b2 b1 b0
BCNTAR[15:8]
x: Undefined
BCNT1AR is a read/write alarm register associated with the 32-bit binary counter from b15 to b8. This register is set to
00h by an RTC software reset.
b7 b6 b5 b4 b3 b2 b1 b0
x: Undefined
RHRAR is an alarm register associated with the BCD-coded hour counter RHRCNT. When the ENB bit is set to 1, the
RHRAR value is compared with the RHRCNT value. From the following alarm registers, only those selected with the
ENB bits set to 1 are compared with the associated counters:
RSECAR
RMINAR
RHRAR
RWKAR
RDAYAR
RMONAR
RYRAREN.
When all the respective values match, the IR flag associated with the RTC_ALM interrupt is set to 1. The specifiable
time differs according to the setting in the hours mode bit (RCR2.HR24):
When the RCR2.HR24 bit is 0 — From 00 to 11 (in BCD)
When the RCR2.HR24 bit is 1 — From 00 to 23 (in BCD).
If a value outside of this range is specified, the RTC does not operate correctly. When the RCR2.HR24 bit is 0, be sure to
set the PM bit. When the RCR2.HR24 bit is 1, the setting in the PM bit has no effect. This register is set to 00h by an
RTC software reset.
b7 b6 b5 b4 b3 b2 b1 b0
BCNTAR[23:16]
x: Undefined
BCNT2AR is a read/write alarm register associated with the 32-bit binary counter b23 to b16. This register is set to 00h
by an RTC software reset.
b7 b6 b5 b4 b3 b2 b1 b0
ENB — — — — DAYW[2:0]
x: Undefined
RWKAR is an alarm register associated with the coded day-of-week counter RWKCNT. When the ENB bit is set to 1,
the RWKAR value is compared with the RWKCNT value. From the following alarm registers, only those selected with
the ENB bits set to 1 are compared with the associated counters:
RSECAR
RMINAR
RHRAR
RWKAR
RDAYAR
RMONAR
RYRAREN.
When all the respective values match, the IR flag associated with the RTC_ALM interrupt is set to 1. The RWKAR
values from 0 through 6 (in BCD) can be specified. If a value outside of this range is specified, the RTC does not operate
correctly. This register is set to 00h by an RTC software reset.
b7 b6 b5 b4 b3 b2 b1 b0
BCNTAR[31:24]
x: Undefined
BCNT3AR is a read/write alarm register associated with the 32-bit binary counter b31 to b24. This register is set to 00h
by an RTC software reset.
b7 b6 b5 b4 b3 b2 b1 b0
x: Undefined
RDAYAR is an alarm register associated with the BCD-coded date counter RDAYCNT. When the ENB bit is set to 1, the
RDAYAR value is compared with the RDAYCNT value. From the following alarm registers, only those selected with the
ENB bits set to 1 are compared with the associated counters:
RSECAR
RMINAR
RHRAR
RWKAR
RDAYAR
RMONAR
RYRAREN.
When all the respective values match, the IR flag associated with the RTC_ALM interrupt is set to 1. The RDAYAR
values from 01 through 31 (in BCD) can be specified. If a value outside of this range is specified, the RTC does not
operate correctly. This register is set to 00h by an RTC software reset.
b7 b6 b5 b4 b3 b2 b1 b0
ENB[7:0]
x: Undefined
BCNT0AER is a read/write register to set the alarm enable associated with the 32-bit binary counter b7 to b0. The binary
counter (BCNT[31:0]) associated with the ENB[31:0] bits that are set to 1 is compared with the binary alarm register
(BCNTAR[31:0]), and when all match, the IR flag associated with the RTC_ALM interrupt becomes 1. This register is
set to 00h by an RTC software reset.
b7 b6 b5 b4 b3 b2 b1 b0
x: Undefined
RMONAR is an alarm register associated with the BCD-coded month counter RMONCNT. When the ENB bit is set to 1,
the RMONAR value is compared with the RMONCNT value. From the following alarm registers, only those selected
with the ENB bits set to 1 are compared with the associated counters:
RSECAR
RMINAR
RHRAR
RWKAR
RDAYAR
RMONAR
RYRAREN.
When all the respective values match, the IR flag associated with the RTC_ALM interrupt is set to 1. The RMONAR
values from 01 through 12 (in BCD) can be specified. If a value outside of this range is specified, the RTC does not
operate correctly. This register is set to 00h by an RTC software reset.
b7 b6 b5 b4 b3 b2 b1 b0
ENB[15:8]
x: Undefined
BCNT1AER is a read/write register for setting the alarm enable associated with the 32-bit binary counter b15 to b8. The
binary counter (BCNT[31:0]) associated with the ENB[31:0] bits that are set to 1 is compared with the binary alarm
register (BCNTAR[31:0]), and when all match, the IR flag associated with the RTC_ALM interrupt becomes 1. This
register is set to 00h by an RTC software reset.
— — — — — — — — YR10[3:0] YR1[3:0]
x: Undefined
RYRAR is an alarm register associated with the BCD-coded year counter RYRCNT. The RYRAR values from 00
through 99 (in BCD) can be specified. If a value outside of this range is specified, the RTC does not operate correctly.
This register is set to 0000h by an RTC software reset.
— — — — — — — — ENB[23:16]
x: Undefined
BCNT2AER is a read/write register for setting the alarm enable associated with the 32-bit binary counter b23 to b16. The
binary counter (BCNT[31:0]) associated with the ENB[31:0] bits that are set to 1 is compared with the binary alarm
register (BCNTAR[31:0]), and when all match, the IR flag associated with the RTC_ALM interrupt becomes 1. This
register is set to 0000h by an RTC software reset.
b7 b6 b5 b4 b3 b2 b1 b0
ENB — — — — — — —
x: Undefined
When the ENB bit in RYRAREN is set to 1, the RYRAR value is compared with the RYRCNT value. From the
following alarm registers, only those selected with the ENB bits set to 1 are compared with the associated counters:
RSECAR
RMINAR
RHRAR
RWKAR
RDAYAR
RMONAR
RYRAREN.
When all the respective values match, the IR flag associated with the RTC_ALM interrupt is set to 1.This register is set to
00h by an RTC software reset.
b7 b6 b5 b4 b3 b2 b1 b0
ENB[31:24]
x: Undefined
BCNT3AER is a read/write register for setting the alarm enable associated with the 32-bit binary counter b31 to b24. The
binary counter (BCNT[31:0]) associated with the ENB[31:0] bits that are set to 1 is compared with the binary alarm
register (BCNTAR[31:0]), and when all match, the IR flag associated with the RTC_ALM interrupt becomes 1. This
register is set to 00h by an RTC software reset.
b7 b6 b5 b4 b3 b2 b1 b0
x: Undefined
Note 1. When LOCO is selected (RCR4.RCKSEL = 1) while PES[3:0] = 0110b, a periodic interrupt is generated every 1/128 second.
The RCR1 register is used in both calendar count mode and in binary count mode. Bits AIE, PIE, and PES[3:0] are
updated synchronously with the count source. When the RCR1 register is modified, check that all the bits are updated
before proceeding.
b7 b6 b5 b4 b3 b2 b1 b0
x: Undefined
The RCR2 register is related to hours mode, automatic adjustment function, enabling RTCOUT output, 30-second
adjustment, RTC software reset, and controlling count operation.
b7 b6 b5 b4 b3 b2 b1 b0
x: Undefined
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — RCKSE
L
Value after reset: 0 0 0 0 0 0 0 x
x: Undefined
The RCR4 register selects the count source and is used in both calendar count mode and in binary count mode.
When the RCKSEL bit is set to 0, the time is counted with the sub-clock oscillator. When the bit is set to 1, the time is
counted with LOCO.
— — — — — — — — — — — — — — — RFC16
x: Undefined
RFC[15:0]
x: Undefined
b7 b6 b5 b4 b3 b2 b1 b0
PMADJ[1:0] ADJ[5:0]
x: Undefined
Adjustment is performed by the addition to or subtraction from the prescaler. If the Automatic Adjustment Enable bit
(RCR2.AADJE) is 0, adjustment is performed when writing to the RADJ. If the RCR2.AADJE bit is 1, adjustment is
performed in the interval specified by the Automatic Adjustment Period Select bit (RCR2.AADJP).
The current adjustment by software (disabling automatic adjustment) might be invalid if the following adjustment value
is specified within 320 cycles of the count source after the register setting. To perform adjustment consecutively, wait for
320 cycles or more of the count source after the register setting, then specify the next adjustment value.
RADJ is updated in synchronization with the count source. When RADJ is modified, check that all the bits are updated
before continuing with additional processing. This register is set to 00h by an RTC software reset. The setting of this
register is enabled only when the sub-clock oscillator is selected. When LOCO is selected, adjustment is not performed.
23.3 Operation
Power on
Clock and count mode settings Clock supply setting and count mode setting
No
START = 0 Wait for the RCR2.START bit to become 0
Yes
No (LOCO)
RCKSEL = 0
No
RCR2.CNTMD = Set value Wait for the RCR2.CNTMD bit to become set value
Yes
Execute RTC software reset Write 1 to the RCR2.RESET bit
No
RESET = 0 Wait for the RCR2.RESET bit to become 0
Yes
Note 1. This step is not required if the count mode is concurrently set by setting the START bit to 0.
No
START = 0 Wait for the RCR2.START bit to become 0
Yes
No
RESET = 0 Wait for the RCR2.RESET bit to become 0
Yes
No (LOCO)
RCKSEL = 0
Yes (sub-clock)
Set clock error
Set clock error adjustment values
adjustment values
No
START = 1 Wait for the RCR2.START bit to become 1
Yes
Note 1. This step is not required for the time-setting procedure because an RTC software reset is executed
in the clock setting procedure of the initial settings for the power supply.
No
ADJ30 = 0 Wait for the RCR2.ADJ30 bit to become 0
Yes
Disable the NVIC carry interrupt request Write 1 to the Interrupt Clear-Enable Register
associated with the RTC_CUP interrupt
Enable the RTC carry interrupt request Write 1 to the RCR1.CIE bit
Enable the RTC carry interrupt request Write 1 to the RCR1.CIE bit
Yes
Interrupt
No
Enable the RTC alarm interrupt request Write 1 to the RCR1.AIE bit
Wait for the completion of the alarm time Wait for 200 µs or more
setting
Disable the alarm interrupt request of Write 0 to the Interrupt Clear-Enable Register
the NVIC associated with the RTC_ALM interrupt
No
AIE = 0 Wait for the RCR1.AIE bit to be cleared to 0
Yes
Write 0 to the IELSRn.IR bit and write 1 to the
Interrupt Clear-Pending Register associated with the
Clear the interrupt flag
RTC_ALM interrupt because the flag might have
been set before the RCR1.AIE bit becomes 0
Alarm registers
Clock counters
Detail
Rising edges of the R64CNT signals
are detected in the same way
Interrupt flag
(the IELSRn.IR bit and Interrupt Set-Pending
Register associated with the RTC_CUP interrupt)
Note: If event linking from the RTC is used, only set the ELC after setting the RTC, for example, initialization and time
settings. Setting the RTC after the ELC can lead to output of unexpected event signals.
Note: Although alarm and periodic interrupts can still be output during Software Standby mode, the periodic event
signals for the ELC are not output.
Interrupts
are The set period elapses
generated
with the
specified
period An interrupt is generated Confirm generation of a periodic interrupt
Note 1. When an interrupt generation period changes while the periodic interrupt is used, an interrupt might be
generated at the completion of the setting. If the interrupt is generated immediately after the setting, the period is
not guaranteed for two interrupts including the current interrupt.
No
START = 0 Wait for the RCR2.START bit to become 0
Yes
No
RESET = 0 Wait for the RCR2.RESET bit to become 0
Yes
Disable interrupt requests Write 0 to the RCR1.AIE, CIE, and PIE bits
Note 1. This step is not required if the count mode is concurrently set by setting the START bit to 0.
WDT output
Reset control circuit
Clock frequency
divider
PCLKB/4
PCLKB PCLKB/64
PCLKB/128
WDT control circuit 14-bit down-counter
PCLKB/512
PCLKB/2048
PCLKB/8192
WDTCSTPR
WDTRR
WDTCR
WDTSR
(OFS0)
Count stop control output
in Sleep mode
Clock control circuit
b7 b6 b5 b4 b3 b2 b1 b0
Some constraints apply to writes to the WDTCR register. For details, see section 24.3.2, Controlling Writes to the
WDTCR, WDTRCR, and WDTCSTPR Registers.
In auto start mode, the settings in the WDTCR register are disabled, and the settings in the Option Function Select
Register 0 (OFS0) are enabled. The settings for the WDTCR register can also be made in the OFS0 register. For details,
see section 24.3.7, Association between Option Function Select Register 0 (OFS0) and WDT Registers.
Table 24.3 Relationship between timeout period and window start and end counter values
Timeout period Window start and end counter value
TOPS[1:0] bits Cycles Counter value 100% 75% 50% 25%
0 0 1024 03FFh 03FFh 02FFh 01FFh 00FFh
0 1 4096 0FFFh 0FFFh 0BFFh 07FFh 03FFh
1 0 8192 1FFFh 1FFFh 17FFh 0FFFh 07FFh
1 1 16384 3FFFh 3FFFh 2FFFh 1FFFh 0FFFh
Figure 24.2 RPSS[1:0] and RPES[1:0] bit settings and refresh-permitted period
b7 b6 b5 b4 b3 b2 b1 b0
RSTIR — — — — — — —
QS
Value after reset: 1 0 0 0 0 0 0 0
Some constraints apply to writes to the WDTRCR register. For details, see section 24.3.2, Controlling Writes to the
WDTCR, WDTRCR, and WDTCSTPR Registers.
In auto start mode, the WDTRCR register settings are disabled, and the settings in the Option Function Select register 0
(OFS0) are enabled. The settings for the WDTRCR register can also be made for the OFS0 register. For details, see
section 24.3.7, Association between Option Function Select Register 0 (OFS0) and WDT Registers.
b7 b6 b5 b4 b3 b2 b1 b0
SLCST — — — — — — —
P
Value after reset: 1 0 0 0 0 0 0 0
The WDTCSTPR register controls whether to stop the WDT counter in Sleep mode. Some restrictions apply to writes to
the WDTCSTPR register. For details, see section 24.3.2, Controlling Writes to the WDTCR, WDTRCR, and
WDTCSTPR Registers.
In auto start mode, the WDTCSTPR register settings are disabled, and the settings in the Option Function Select register
0 (OFS0) are enabled. The settings for the WDTCSTPR register can also be made for the OFS0 register. For details, see
section 24.3.7, Association between Option Function Select Register 0 (OFS0) and WDT Registers.
24.3 Operation
Counter value
100%
Refresh-
prohibited
75% period
Refresh-
50% permitted
period
25% Refresh-
prohibited
0% period
RES pin
Control
register (1) (2) (1) (2) (1) (2)
(WDTCR)
(1) Initial value
(2) Set value
Writing to the Writing to the Writing to the Writing to Writing to the
register is valid register is invalid *1 register is valid the register register is valid
is invalid *1
Refresh H
the counter L
(active-high)
Status flag
Refresh error H cleared
flag
(active-high) L
Interrupt request
(WDT_NMIUNDF) L
(active-high)
Reset output H
from WDT
L
(active-high)
Note 1. See section 24.3.2, Controlling Writes to the WDTCR, WDTRCR, and WDTCSTPR Registers.
However, if the down-counter underflows because the down-counter cannot be refreshed because of a program runaway,
of if a refresh error occurs because the counter was refreshed outside the refresh-permitted period, the WDT outputs the
reset signal or non-maskable interrupt request/interrupt request (WDT_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 restarts.
Reset output or interrupt request output can be selected in the WDT Reset Interrupt Request Select bit
(OFS0.WDTRSTIRQS). The interrupt enable that initiates NMI can be selected with the WDT Underflow/Refresh Error
Interrupt Enable bit (NMIER.WDTEN).
Figure 24.4 shows an example of operation (non-maskable interrupt) under the following conditions:
Auto start mode (OFS0.WDTSTRT = 0)
WDT behavior selection: interrupt (OFS0.WDTRSTIRQS = 0)
Non-maskable Interrupt: WDT Underflow/Refresh Error Interrupt Enable(NMIER.WDTEN = 1)
The window start position is 75% (OFS0.WDTRPSS[1:0] = 10b)
The window end position is 25% (OFS0.WDTRPES[1:0] = 10b)
Counter value
100%
Refresh-
prohibited
75% period
50% Refresh-
permitted
period
25% Refresh-
prohibited
0% period
RES pin
Refresh H
the counter
L
(active-high)
Status flag
Refresh error
H cleared
flag
(active-high) L
Interrupt request H
(WDT_NMIUNDF)
(active-high) L
Reset output
from WDT
(active-high) L
After a refresh operation (counting starts) or a write to WDTCR, WDTRCR, or WDTCSTPR, the protection signal in the
WDT becomes 1 to protect WDTCR, WDTRCR, and WDTCSTPR against subsequent write attempts. This protection is
released by a reset source of the WDT. With other reset sources, the protection is not released.
Figure 24.5 shows control waveforms produced in response to writing to the WDTCR.
RES pin
WDTCR register 33F3h (initial value) 00F3h 00F3h 33F3h (initial value)
Register
protection signal
(internal signal) WDTCR register is protected
(writing-disabled period)
Writing is possible
Figure 24.5 Control waveforms produced in response to writes to the WDTCR register
Peripheral clock
(PCLKB)
Refresh Invalid
synchronization
signal
Refresh signal
(after synchronization Refresh request
with count cycle)
Refreshing
Figure 24.6 WDT refresh operation waveforms when WDTCR.CKS[3:0] = 0100b, WDTCR.TOPS[1:0] = 01b
Peripheral clock
(PCLKB)
Refreshing
Bits WDTSR.CNTVAL
(n + 1)h (n)h (n - 1)h (n - 1)h 0FFFh
[13:0]
WDTSR.CNTVAL
[13:0] read signal
(internal signal)
WDTSR.CNTVAL
[13:0] read data xxxxh (n + 1)h (n)h (n)h 0FFFh
Figure 24.7 Read process for WDT down-counter value when WDTCR.CKS[3:0] = 0100b, WDTCR.TOPS[1:0] =
01b
24.3.7 Association between Option Function Select Register 0 (OFS0) and WDT
Registers
Table 24.5 lists the association between the Option Function Select Register 0 (OFS0) used in auto start mode, and the
registers used in register start mode. Do not change the OFS0 register setting during WDT operation. For details on the
Option Function Select Register 0 (OFS0), see section 7.2.1, Option Function Select Register 0 (OFS0).
Table 24.5 Association between Option Function Select Register 0 (OFS0) and the WDT registers
OFS0 register WDT registers
(enabled in auto start mode) (enabled in register start mode)
Control target Function OFS0.WDTSTRT = 0 OFS0.WDTSTRT = 1
Down-counter Timeout period selection OFS0.WDTTOPS[1:0] WDTCR.TOPS[1:0]
Clock division ratio selection OFS0.WDTCKS[3:0] WDTCR.CKS[3:0]
Window start position selection OFS0.WDTRPSS[1:0] WDTCR.RPSS[1:0]
Window end position selection OFS0.WDTRPES[1:0] WDTCR.RPES[1:0]
Reset output or interrupt Reset interrupt request selection OFS0.WDTRSTIRQS WDTRCR.RSTIRQS
request output
Count stop Sleep mode count stop control OFS0.WDTSTPCTL WDTCSTPR.SLCSTP
Note 1. Satisfy the frequency of the peripheral module clock (PCLKB) 4 × (the frequency of the count clock source after
division).
To use the IWDT, you must supply the IWDT-dedicated clock (IWDTCLK). 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
b7 b6 b5 b4 b3 b2 b1 b0
The IWDTRR register refreshes the down-counter of the IWDT. The down-counter of the IWDT is refreshed by writing
00h and then writing FFh 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 00h is written, the read value is 00h. When a value other than 00h is written, the read value is FFh. For details of
the refresh operation, see section 25.3.2, Refresh Operation.
the window start position (window start position > window end position). If the window end position is set to a value
greater than or equal to the window start position, the window start position setting is enabled and the window end
position is set to 0%.
Table 25.3 Relationship between timeout period and window start and end counter values
IWDTTOPS[1:0] bits Timeout period Window start and end counter value
b1 b0 Cycles Counter value 100% 75% 50% 25%
0 0 128 007Fh 007Fh 005Fh 003Fh 001Fh
0 1 512 01FFh 01FFh 017Fh 00FFh 007Fh
1 0 1024 03FFh 03FFh 02FFh 01FFh 00FFh
1 1 2048 07FFh 07FFh 05FFh 03FFh 01FFh
Figure 25.2 IWDTRPSS[1:0] and [IWDTRPES[1:0] bit settings and refresh-permitted period
25.3 Operation
Counter value
100%
Refresh-
prohibited period
75%
50% Refresh-
permitted period
25%
Refresh-
prohibited period
0%
RES pin
Underflow
Refresh error Refresh error
Status flag
Refresh error flag H cleared
(active-high) L
Interrupt request
(IWDT_NMIUNDF) H
(active-high) L
Reset output
from IWDT
(active-high) L
After FFh is written to the IWDTRR, refreshing the counter requires up to 4 cycles of the signal for counting (the IWDT-
Dedicated Clock Frequency Division Ratio Select bits (OFS0.IWDTCKS[3:0]) to determine how many cycles of the
IWDT-dedicated clock (IWDTCLK) make up 1 cycle for counting. To meet this requirement, writing FFh to the
IWDTRR must be completed 4 count cycles before the end of the refresh-permitted period or a counter underflow. The
value of the counter can be checked in the counter bits (IWDTSR.CNTVAL[13:0]).
[Example refreshing timings]
When the window start position is set to 01FFh, even if 00h is written to IWDTRR before 01FFh is reached (at
0202h, for example), refreshing occurs if FFh is written to IWDTRR after the value of the
IWDTSR.CNTVAL[13:0] bits reaches 01FFh
When the window end position is set to 01FFh, refreshing occurs if 0203h (4 count cycles before 01FFh) or a
greater value is read from the IWDTSR.CNTVAL[13:0] bits immediately after writing 00h → FFh to IWDTRR
When the refresh-permitted period continues until count 0000h, refreshing can be performed immediately before an
underflow. In this case, if 0003h (4 count cycles before an underflow) or a greater value is read from the
IWDTSR.CNTVAL[13:0] bits immediately after writing 00h → FFh to IWDTRR, no underflow occurs and
refreshing is performed.
Figure 25.4 shows the IWDT refresh-operation waveforms when PCLKB > IWDTCLK and the clock division ratio is
IWDTCLK.
Peripheral clock
(PCLKB)
IWDT-dedicated
clock (IWDTCLK)
Data written to
00h 54h 00h FFh
IWDTRR register
Invalid
Refresh
synchronization signal
Refresh signal
(after synchronization Refresh request
with IWDTCLK)
Refreshing
Figure 25.4 IWDT refresh operation waveforms when OFS0.IWDTCKS[3:0] = 0000b, OFS0.IWDTTOPS[1:0] =
11b
Peripheral clock
(PCLKB)
IWDT-dedicated
clock (IWDTCLK)
Refreshing
(after synchronization with IWDTCLK)
Counter value (n + 1)h (n)h (n - 1)h (n - 2)h (n - 3)h 07FFh 07FEh
Bits
IWDTSR.CNTVAL (n + 1)h (n)h (n - 1)h (n - 2)h (n - 3)h 07FFh
[13:0]
IWDTSR.CNTVAL
[13:0] read signal
(internal signal)
IWDTSR.CNTVAL
[13:0] read data xxxxh (n + 1)h (n)h (n - 2)h 07FFh
Figure 25.5 Processing for reading IWDT counter value when OFS0.IWDTCKS[3:0] = 0000b,
OFS0.IWDTTOPS[1:0] = 11b
VCC_USB_LDO
USB LDO
VCC_USB
Regulator
BC Battery charging
control controller
FIFO buffer
USB protocol controller
engine FIFO
controller
Memory
controller PCLKB
USB transceiver
USB clock (48 MHz) 1-port SRAM USB clock (48 MHz)
USB clock control
(16-bit width) PCLKB
Note 1. Do not enable the DMRPU and DPRPU bits at the same time.
Note 2. After writing 1 to the SCKE bit, read it and confirm it is set to 1.
When the DPRPU bit is set to 1, the bit forces a pull-up of the D+ line to notify the USB host that it attached. Changing
the DPRPU bit from 1 to 0 releases the pull-up, thereby notifying the USB host that it detached.
— — — — — — — — — — — — — — LNST[1:0]
Table 26.4 Status of USB data bus lines (D+ line, D- line)
LNST[1:0] bits During full-speed operation During low-speed operation
00b SE0 SE0
01b J-State K-State
10b K-State J-State
11b SE1 SE1
— — — — — — — WKUP — — — — — RHST[2:0]
FIFOPORT[15:0]
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. The valid bits depend on the MBW setting (CFIFOSEL.MBW) and BIGEND setting (CFIFOSEL.BIGEND). See Table 26.5 and
Table 26.6.
Access to the FIFO buffer for DCP control transfers is through the CFIFO port
There are two FIFO buffer states, one giving access rights to the CPU and the other to the serial interface engine
(SIE). When the SIE has access rights, the FIFO buffer cannot be accessed by the CPU.
The FIFO buffer cannot be accessed by the DTC.
When the DCP is the selected pipe, setting the BCLR bit to 1 allows the USBFS to clear the FIFO buffer regardless of
whether the CPU or SIE has access rights. To clear the buffer when the SIE has access rights, set the DCPCTR.PID[1:0]
bits to 00b (NAK response) before setting the BCLR bit to 1.
When the selected pipe is transmitting, if 1 is written to the BVAL flag and the BCLR bit simultaneously, the USBFS
clears the data that is already written, enabling transmission of a zero-length packet.
When the selected pipe is not the DCP, only write 1 to the BCLR bit while the FRDY bit in the CFIFO Port Control
Register is 1 (set by the USBFS).
When a status flag in the INTSTS0 register is set to 1 and the associated interrupt request enable bit setting in the
INTENB0 register is 1, the USBFS issues a USBFS interrupt request.
Regardless of the INTENB0 register setting, the status flag in the INTSTS0 register is set to 1 in response to a state
The BRDYENB register enables or disables the INTSTS0.BRDY bit to be set to 1 when the BRDY interrupt is detected
for each pipe.
When a status flag in the BRDYSTS is set to 1 and the associated PIPEnBRDYE bit (n = 0, 4 to 7) setting in the
BRDYENB register is 1, the INTSTS0.BRDY flag is set to 1. In this case, if the BRDYE bit in INTENB0 is 1, the
USBFS generates a BRDY interrupt request.
While at least one PIPEnBRDY bit indicates 1, the USBFS generates the BRDY interrupt request when the associated
interrupt enable bit in the BRDYENB register is changed from 0 to 1 by software.
The NRDYENB register enables or disables the INTSTS0.NRDY bit to be set to 1 when a NRDY interrupt is detected
for each pipe.
When a status flag in the NRDYSTS register is set to 1 and the associated PIPEnNRDYE (n = 0, 4 to 7) bit setting in the
NRDYENB register is 1, the INTSTS0.NRDY flag is set to 1. In this case, if the NRDYE bit in INTENB0 is 1, the
USBFS generates a NRDY interrupt request.
While at least one PIPEnNRDY bit indicates 1, the USBFS generates the NRDY interrupt request when the associated
interrupt enable bit in the NRDYENB register is changed from 0 to 1 by software.
The BEMPENB register enables or disables the INTSTS0.BEMP bit to be set to 1 when a BEMP interrupt is detected for
each pipe.
When a status flag in the BEMPSTS register is set to 1 and the associated PIPEnBEMPE (n = 0, 4 to 7) bit setting in the
BEMPENB register is 1, the INTSTS0.BEMP flag is set to 1. In this case, if the BEMPE bit in INTENB0 is 1, the
USBFS generates a BEMP interrupt request.
While at least one PIPEnBEMP bit indicates 1, the USBFS generates the BEMP interrupt request when the associated
interrupt enable bit in the BEMPENB register is changed from 0 to 1 by software.
— — — — — — — — — BRDY — EDGES — — — —
M TS
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Note 1. Confirm that this bit is 0 before stopping the clock supply to the USBFS.
VBINT RESM SOFR DVST CTRT BEMP NRDY BRDY VBSTS DVSQ[2:0] VALID CTSQ[2:0]
x: Don’t care
Note 1. The value is 0 when the MCU is reset and 1 after a USB bus reset.
Note 2. The value is 1 when the USB_VBUS pin is high and 0 when the USB_VBUS pin is low.
Note 3. The value is 000b when the MCU is reset and 001b after a USB bus reset.
Note 4. To clear the VBINT, RESM, SOFR, DVST, CTRT, or VALID bit, write 0 only to the bits to be cleared. Write 1 to
the other bits. Do not write 0 to the status bits indicating 0.
Note 5. The USBFS detects a change in the status indicated by the VBINT and RESM bits even while the clock supply is
stopped (SYSCFG.SCKE bit is 0), and it requests the interrupt when the associated interrupt request bit is 1.
Enable the clock supply before clearing the status through software.
For the conditions that cause the PIPEnBEMP status to be asserted, see section 26.3.3.3, BEMP interrupt.
The USBFS sets the BEMP bit to 0 when software writes 0 to all the PIPEnBEMP bits associated with the PIPEnBEMPE
bits that are set to 1. Writing 0 to the BEMP bit in software does not clear the bit.
Note 1. When the SOFCFG.BRDYM bit is set to 0, to clear the status indicated by the bits in BRDYSTS, write 0 only to the bits to be
cleared. Write 1 to the other bits.
Note 2. When the SOFCFG.BRDYM bit is set to 0, clear the BRDY Interrupts before accessing the FIFO.
Note 1. To clear the status indicated by the bits in NRDYSTS, write 0 only to the bits to be cleared. Write 1 to the other
bits.
Note 1. To clear the status indicated by the bits in BEMPSTS, write 0 only to the bits to be cleared. Write 1 to the other
bits.
— — — — — FRNM[10:0]
BREQUEST[7:0] BMREQUESTTYPE[7:0]
USBREQ stores setup requests for control transfers. The USBREQ stores the received values of bRequest and
bmRequestType.
USBREQ is initialized by a USB bus reset.
WVALUE[15:0]
USBVAL stores the received value of wValue. USBVAL is initialized by a USB bus reset.
WINDEX[15:0]
USBINDX stores setup requests for control transfers. The USBINDX stores the received wIndex value.
USBINDX is initialized by a USB bus reset.
WLENTUH[15:0]
USBLENG stores setup requests for control transfers. The received value of wLength is stored.
USBLENG is initialized by a USB bus reset.
— — — — — — — — SHTNA — — — — — — —
K
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Note 1. Only set this bit while the PID is NAK. Before setting this bit after changing DCPCTR.PID[1:0] bits for the DCP
from BUF to NAK, check that the DCPCTR.PBUSY bit is 0. However, if the PID[1:0] bits are changed to NAK by
the USBFS, checking the PBUSY bit through software is not required.
— — — — — — — — — MXPS[6:0]
Note 1. Only set the MXPS[6:0] bits while PID is NAK. Before setting these bits after changing the DCPCTR.PID[1:0] bits
for the DCP from BUF to NAK, check that the DCPCTR.PBUSY bit is 0. However, if the PID[1:0] bits are changed
to NAK by the USBFS, checking the PBUSY bit through software is not required. After modifying the MXPS[6:0]
bits and setting the DCP to the CURPIPE[3:0] bits in the CFIFO Port Select Register, clear the buffer by setting
the BCLR bit in the CFIFO Port Control Register to 1.
When this bit is set to 1 by software while the associated PID[1:0] bits are set to BUF, the USBFS completes the control
transfer status stage.
During control read transfers, the USBFS transmits the ACK handshake in response to the OUT transaction from the
USB host. During control write or no-data control transfers, it transmits the zero-length packet in response to the IN
transaction from the USB host. On detecting a SET_ADDRESS request, the USBFS operates in auto response mode
from the setup stage up to status stage completion regardless of the CCPL bit setting.
The USBFS changes the CCPL bit from 1 to 0 on receiving a new setup packet. Software cannot write 1 to the bit while
the INTSTS0.VALID bit is 1. The CCPL bit is initialized by a USB bus reset.
— — — — — — — — — — — — PIPESEL[3:0]
Set pipes 4 to 7 using the PIPESEL, PIPECFG, PIPEMAXP, PIPEnCTR, PIPEnTRE, and PIPEnTRN registers (n = 4 to
7).
After selecting the pipe with the PIPESEL register, set the pipe functions using PIPECFG and PIPEMAXP. The
PIPEnCTR, PIPEnTRE, and PIPEnTRN registers can be set independently of the pipe selection in the PIPESEL register.
Pipes 6 and 7
b15 b14
0 0: Pipe not used
0 1: Setting prohibited
1 0: Interrupt transfer
1 1: Setting prohibited.
Note 1. Only set the TYPE[1:0], SHTNAK, and EPNUM[3:0] bits while PID is NAK. Before setting these bits after
changing the PIPEnCTR.PID[1:0] bits for the selected pipe from BUF to NAK, check that the PIPEnCTR.PBUSY
bit is 0. However, if the PID[1:0] bits are changed to NAK by the USBFS, checking the PBUSY bit through
software is not required.
Note 2. Only set the BFRE, DBLB, and DIR bits while PID is NAK and before the pipe is selected in the CURPIPE[3:0]
bits in the CFIFO Port Select Register. Before setting these bits after changing the PIPEnCTR.PID[1:0] bits for
the selected pipe from BUF to NAK, check that the PIPEnCTR.PBUSY bit is 0. However, if the PID[1:0] bits are
changed to NAK by the USBFS, checking the PBUSY bit through software is not required.
Note 3. To change the BFRE, DBLB, and DIR bits after completing USB communication on the selected pipe, in addition
to the constraints described in Note 2., write 1 and then 0 to the PIPEnCTR.ACLRM bit continuously through
software to clear the FIFO buffer assigned to the selected pipe.
PIPECFG specifies the transfer type, FIFO buffer access direction, and endpoint numbers for pipes 4 to 7. It also selects
single or double buffer mode, and whether to continue or disable pipe operation at the end of transfer.
— — — — — — — MXPS[8:0]
0/1
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
*1
Note 1. The value of the MXPS[8:0] bits is 000h when no pipe is selected in the PIPESEL.PIPESEL[3:0] bits and 040h
when a pipe is selected.
Note 2. Only set the MXPS[8:0] bits while PID is NAK and before the pipe is selected in the CURPIPE[3:0] bits in the
CFIFO Port Select Register. Before setting these bits after changing the PIPEnCTR.PID[1:0] bits for the selected
pipe from BUF to NAK, check that the PIPEnCTR.PBUSY bit is 0. However, if the PID[1:0] bits are changed to
NAK by the USBFS, checking the PBUSY bit through software is not required.
PIPEnCTR can be set for any pipe selection in the PIPESEL register.
PIPEnCTR (n = 6 and 7)
— — — — — — TRENB TRCLR — — — — — — — —
Note: Set each bit in PIPEnTRE while PID is NAK. Before setting these bits after changing the PIPEnCTR.PID[1:0] bits
for the selected pipe from BUF to NAK, check that the PIPEnCTR.PBUSY bit is 0. However, if the PID[1:0] bits
are changed to NAK by the USBFS, checking the PBUSY bit through software is not required.
TRNCNT[15:0]
The PIPEnTRN registers retain their current setting during a USB bus reset.
— — — — — — — — VDCEN — — — — — — VDDUS
BE
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
IDMSINKE0 bit (D- Pin 0.6 V Input Detection (Comparator and Sink) Control)
When the IDMSINKE0 bit is set to 1, the USBFS detects whether VDMSRC (0.6 V), output from the host to D- on
primary detection, is connected, or whether VDPSRC (0.6 V), output from the device to D+, is connected to D- by the
host.
IDPSINKE0 bit (D+ Pin 0.6 V Input Detection (Comparator and Sink) Control)
When the IDPSINKE0 bit is set to 1, the USBFS detects whether VDMSRC (0.6 V), output from the device to D-, is
connected to D+ (DCP) by the host.
— — — — — — — — — — — — — — — UCKSE
LC
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Note 1. When UCKSELC = 1, the user trimming function cannot be used. For information on the user trimming function,
see section 9, Clock Generation Circuit.
26.3 Operation
Table 26.11 Control settings for the USBFS data bus resistors
SYSCFG register settings
DPRPU bit DMRPU bit D- D+ Function
0 0 Open Open Not in use
1 0 Open Pull-up Full-speed
0 1 Pull-up Open Low-speed
Other settings — — Setting prohibited
Input the same voltage as VCC to VCC_USB_LDO and VCC_USB VCC 3.0 V to 3.6 V
VCC_
USB_LDO
USB LDO
regulator
VCC_USB
BC
control
USB_DP
0 0
USB_DM
VDCEN VDDUSBE
USBFS
USB transceiver
This MCU
Figure 26.2 Example of power supply connection when the USB LDO regulator is not used
VCC_USB_LDO
*1
USB LDO
regulator
1.0 µF
VCC_USB
BC
control
USB_DP
1 1
USB_DM
VDCEN VDDUSBE
USBFS
USB transceiver
This MCU
Note 1. Make sure that the resistance of the connected wiring is 0.5 Ω or less to connect a capacitor of ESR ≤ 1 Ω.
Figure 26.3 Example of power supply connection when the USB LDO regulator is used (BC used)
VCC_USB_LDO
*1 USB LDO
Regulator
1.0 µF VCC_USB
BC
control
USB_DP
1 0
USB_DM
VDCEN VDDUSBE
USBFS
USB
transceiver
This MCU
Note 1. Make sure that the resistance of the connected wiring is 0.5 Ω or less to connect a capacitor of ESR ≤ 1 Ω.
Figure 26.4 Example of power supply connection when the USB LDO regulator is used (BC not used)
External connection
MCU
USB_VBUS*1 100
1 M 0.1 µF *2
USB
transceiver
RPU RPU
VBUS
ZDRV
USB_DP
D+
USB_DM
D–
ZDRV
External connection
MCU Each system power USB
supply (3.3 V) B connector
System power *2
supply (3.3 V) Regulator VBUS
USB_VBUS*1
USB
transceiver
RPU RPU
ZDRV
USB_DP
D+
USB_DM
D–
ZDRV
External connection
MCU USB
B connector
USB_VBUS*1
VBUS
USB
transceiver
RPU RPU
ZDRV
USB_DP
D+
USB_DM
D–
ZDRV
External connection
Charging IC
supporting Battery
MCU Charging v1.2
SCL0
SCL0
Charging battery
SDA0
SDA0
USB_VBUS*3 *1, *4
VBUS
10 k
*2
0.1 µF
RPU RPU
VBUS
ZDRV
USB_DP
D+
USB_DM
D–
ZDRV
Figure 26.8 Functional connection sample of USB connector with Battery Charging v1.2 supported
26.3.2 Interrupts
Table 26.12 lists the interrupt sources in the USBFS. When an interrupt generation condition is satisfied and the interrupt
output is enabled using the associated interrupt enable register, a USBFS interrupt request is issued to the Interrupt
Controller Unit (ICU) and a USBFS interrupt is generated. See section 13, Interrupt Controller Unit (ICU).
SET_ADDRESS detected
SET_CONFIGURATION
detected
INTENB0 INTSTS0
Control Transfer End
VBSE
VBINT
Control Transfer Error
RSME
USBFS_USBI
RESM
Control Transfer Setup Receive
SOFE
SOFR
BEMP interrupt enable register
DVSE
b7 b4 b0
DVST
Edge/level
detector CTRE
CTRT b7
BEMPE
BEMP BEMP interrupt
status register
NRDYE
b4
NRDY
b0
BRDYE
BRDY NRDY interrupt enable register
b7 b4 b0
b7
NRDY interrupt
status register
b4
b0
b7
BRDY interrupt
status register
b4
b0
The BRDY interrupt status of the selected pipe can be set to 0 by writing 0 to the corresponding
BRDYSTS.PIPEnBRDY bit through software. In this case, the other PIPEnBRDY bits should be set to 1.
In this mode, do not modify the PIPECFG.BFRE bit setting until all data for a single transfer is processed. When
modification to the PIPECFG.BFRE bit is required before processing completes, clear all FIFO buffers for the pipe with
the PIPEnCTR.ACLRM bit.
(1) Example of zero-length packet reception or data packet reception when BFRE = 0 (single-buffer mode)
FIFO buffer status Ready for reception Ready for read access
BRDY interrupt
(BRDYSTS.PIPEnBRDY bit)
BRDY interrupt
(BRDYSTS.PIPEnBRDY bit)
FIFO buffer status Ready for transmission Ready for write access
BRDY interrupt
(BRDYSTS.PIPEnBRDY bit)
Note 1. The FIFO buffer becomes ready for read access when a packet is received while no data remains unread in the FIFO
buffer in the CPU.
Note 2. A transfer ends in any of the following conditions:
(1) When a short packet including a zero-length packet is received.
(2) When the number of packets specified in the transaction counter are received.
The internal BEMP interrupt request is not generated on any of the following conditions:
When the CPU has already started writing data to the FIFO buffer of the CPU on completion of transmitting data
from one FIFO buffer in double buffer mode
When the buffer is cleared (emptied) by setting the PIPEnCTR.ACLRM or the BCLR bit in the CFIFO Port
Control Register to 1
When an IN transfer (zero-length packet transmission) is performed during the control transfer status stage.
FIFO buffer status Ready for transmission Ready for write access
(there is no data to be
transmitted)
BEMP interrupt
(BEMPSTS.PIPEnBEMP bit)
USB bus OUT token packet Data packet (maximum STALL handshake
packet size over)
BEMP interrupt
(BEMPSTS.PIPEnBEMP bit)
Powered Suspended
state state
(DVSQ = 000b) (DVSQ = 100b)
SET_ADDRESS
execution SET_ADDRESS execution (Address > 0)
(Address = 0) (DVST is set to 1)
(DVST is set to 1)
Suspended state detection
(DVST is set to 1)
Address Suspended
state state
(DVSQ = 010b) (DVSQ = 110b)
Configured Suspended
state state
(DVSQ = 011b) (DVSQ = 111b)
Note: For the transition indicated in solid line, the DVST bit is set to 1. For the transition indicated in dashed line,
the RESM bit is set to 1.
Setup token
reception
CTSQ = 110b
control transfer 5
sequence error Error Error detection and setup token
Setup token detection
reception reception are valid at all stages
in this frame
Setup
token
reception
ACK ACK
trans- CTSQ = 001b CTSQ = 010b trans-
CTSQ = 000b mission OUT token mission CTSQ = 000b
1 control read 2 control read 4
setup stage idle stage
data stage status stage
4
ACK ACK
transmission CTSQ = 011b IN token CTSQ = 100b reception
1 control write 3 control write
data stage status stage
ACK ACK
transmission CTSQ = 101b reception
1 no data control
status stage
The USBFS can write to the PID[1:0] bits because of specific transaction results as described in the following section.
In addition, the USBFS automatically detects the direction bit, (bmRequestType bit [8]), and the request data length
(wLength) of the received USB request. The USBFS distinguishes between control read transfers, control write transfers,
and no-data control transfers, and it control stage transitions. For an incorrect sequence, a sequence error occurs in the
control transfer stage transition interrupt, and the interrupt is reported to software. For the stage control of the USBFS,
see Figure 26.14.
26.3.12.1 Processing
The following processing is required when operating the USBFS module as a portable device for battery charging:
1. Detect when the data lines (D+ and D-) have made contact and start the processing for primary detection.
2. After primary detection starts, wait 40 ms for masking, then check the D- voltage level to confirm the primary
detection result.
3. If the charger is detected during primary detection, start secondary detection.
4. After secondary detection starts, wait 40 ms for masking, then check the D+ voltage level to confirm the secondary
detection result.
For step 1., after VBUS is detected using the VBINT and VBSTS bits:
1. Wait for 300 to 900 ms, then set the VDPSRCE0 and IDMSINKE0 bits in the USBBCCTRL0 register.
2. You can also set the IDPSRCE0 bit.
3. After a change from high to low on the D+ line is detected using the LNST[1:0] bits, clear the IDPSRCE0 bit, and
set the VDPSRCE0 and IDMSINKE0 bits simultaneously*1.
For step 2., set the VDPSRCE0 and IDMSINKE0 bits and wait 40 ms, then use the CHGDETSTS0 bit to verify the
primary detection result*2.
For step 3., if the CHGDETSTS0 bit is set in step 2., verify that the charger is detected, then clear the VDPSRCE0 and
IDMSINKE0 bits, and set the VDMSRCE0 and IDPSINKE0 bits.
For step 4., set the VDMSRCE0 and IDPSINKE0 bits and wait for 40 ms, then use the PDDETSTS0 bit to verify the
secondary detection result.
Figure 26.15 shows the process flow.
Note 1. The Battery Charging specification describes two implementation methods for data contact detection (D+/D- line
contact check). One method is to detect a change to logic low due to the pull-down resistor of the host device
when the D+ and D- lines have made contact with the target, while the D+ line is held at logic high by applying a
current of 7 to 13 μA on the D+ line. The other method is to wait for 300 to 900 ms after VBUS is detected.
Note 2. During primary detection, when the voltage on the D- line is detected to be 0.25 to 0.4 V or above and 0.8 to 2.0
V or below, the target device is recognized as the host device for battery charging, that is, charging downstream
port. When using a USB transceiver in which the CHGDETSTS0 bit only indicates that the voltage on the D- line
is 0.25 to 0.4 V or above, add the processing to check that the voltage on D- line is 0.8 V to 2.0 V or below using
the LNST[1:0] bits, as required.
Detect VBUS
Primary
Set VDPSRCE0 and
Detection
IDMSINKE0 bits
CHGDETSTS0 = 1
No
Yes
Target is SDP
PDDETSTS = 1
No
Yes
Target is CDP
Target is DCP
26.4.2 Clearing the Interrupt Status Register on Exiting Software Standby Mode
Because the input buffer is always enabled in Software Standby mode, an unexpected interrupt might occur under the
following conditions:
When the interrupt is enabled in Normal mode
When the interrupt is disabled in Software Standby mode
When the input level of pin that cancels software standby is changed in Software Standby mode.
These conditions might cause the associated interrupt flag in the Interrupt Status Register to set unexpectedly. After the
MCU exits Software Standby mode, the unexpected interrupt might be sent to the interrupt controller. To avoid this,
always clear the INTSTS0 register in the canceling sequence.
26.4.3 Clearing the Interrupt Status Register after Setting the Port Function
The input buffer is invalid before setting by the PmnPFS.PSEL[4:0] and PmnPFS.PMR ports are set up, so the internal
signal is fixed to high or low. The input buffer is enabled after the port is set so that the external pin state is propagated to
the MCU. An unexpected interrupt might occur at this time, causing the VBINT bit in INTSTS0 to set to 1. To avoid a
malfunction, always clear the INTSTS0 register after setting up the ports.
Bus interface
Internal
Module data bus
peripheral bus
SIMR1/2/3
SISR
SNFR
SCI0_DCUF
(snooze end request)
External clock
SCKn
Address(es): SCI0.RDR 4007 0005h, SCI1.RDR 4007 0025h, SCI9.RDR 4007 0125h
b7 b6 b5 b4 b3 b2 b1 b0
RDR is an 8-bit register that stores receive data. When one frame of serial data is received, it is transferred from RSR to
RDR, and the RSR register can receive more data. Because RSR and RDR function as a double buffer, continuous
received operations can be performed.
Read the RDR only once after a receive data full interrupt (SCIn_RXI) occurs.
Note: If the next frame of data is received before reading the received data from RDR, an overrun error occurs. The
CPU cannot write to the RDR.
Address(es): SCI0.RDRHL 4007 0010h, SCI1.RDRHL 4007 0030h, SCI9.RDRHL 4007 0130h
RDRHL is a 16-bit register that stores receive data. Use this register when asynchronous mode and 9-bit data length are
selected.
The lower 8 bits of RDRHL are the shadow register of RDR, so access to RDRHL affects the RDR register. Access to the
RDRHL register is prohibited if 7-bit or 8-bit data length is selected.
After one frame of data is received, the received data is transferred from RSR to the RDR or RDRHL register, allowing
the RSR register to receive more data.
The RSR and RDRHL registers form a double-buffered structure to enable continuous reception. RDRHL should be read
only when a receive data full interrupt (SCIn_RXI) request is issued. An overrun error occurs when the next frame of
data is received before the received data is read from RDRHL. The CPU cannot write to the RDRHL register. Bits [15:9]
of the RDRHL register are fixed to 0. These bits are read as 0. The write value should be 0.
SCI0.FRDRHL
SCI0.FRDRH SCI0.FRDRL
Note 1. If this flag is read, it indicates the same value as that read from the SSR_FIFO register. Write 0 to the SSR_FIFO
register to clear the flag.
FRDRHL is a 16-bit register that consists of the 8-bit FRDRH and FRDRL registers.
FRDRH and FRDRL constitute a 16-stage FIFO register that stores serial receive data and related status information
readable by software. This register is only valid in asynchronous mode, including multi-processor mode or clock
synchronous mode.
The SCI completes reception of one frame of serial data by transferring the received data from the RSR register into
FRDRH and FRDRL for storage. Continuous reception is executed until 16 stages are stored. If data is read when there is
no received data in FRDRH and FRDRL, the value is undefined. When FRDRH and FRDRL are full of receive data,
subsequent serial receive data is lost. The CPU can read from FRDRH and FRDRL but cannot write to them.
Reading 1 from the RDF, ORER, or DR flag of the FRDRH register is the same as reading from those bits in the
SSR_FIFO register. When writing 0 to clear a flag in the SSR_FIFO register after reading the FRDRH register, write 0
only to the flag that is to be cleared and write 1 to the other flags.
When reading both the FRDRH and FRDRL registers, read in the order from FRDRH to FRDRL. The FRDRHL register
can be accessed in 16-bit units.
Address(es): SCI0.TDR 4007 0003h, SCI1.TDR 4007 0023h, SCI9.TDR 4007 0123h
b7 b6 b5 b4 b3 b2 b1 b0
Address(es): SCI0.TDRHL 4007 000Eh, SCI1.TDRHL 4007 002Eh, SCI9.TDRHL 4007 012Eh
TDRHL is a 16-bit register that stores transmit data. Use this register when asynchronous mode and 9-bit data length are
selected.
The lower 8 bits of TDRHL are the shadow register of TDR , so access to TDRHL affects the TDR register. Access to the
TDRHL register is prohibited if 7-bit or 8-bit data length is selected. When empty space is detected in the TSR register,
the transmit data stored in the TDRHL registers is transferred to TSR and transmission starts.
The TSR and TDRHL registers have a double-buffered structure to support continuous transmission. When the next data
to be transmitted is stored in TDRHL after one frame of data is transmitted, the transmitting operation continues by
transferring the data from the TDRHL register to the TSR register.
The CPU can read and write to the TDRHL register. Bits [15:9] in TDRHL are fixed to 1. These bits are read as 1. The
write value should be 1.
Write transmit data to the TDRHL register only once when a transmit data empty interrupt (SCIn_TXI) request is issued.
SCI0.FTDRHL
SCI0.FTDRH SCI0.FTDRL
— — — — — — MPBT TDAT[8:0]
FTDRHL is a 16-bit register that consists of 8-bit FTDRH and FTDRL registers.
FTDRH and FTDRL constitute a 16-stage FIFO register that stores data for serial transmission and multi-processor
transfer bit. This register is valid only in asynchronous mode, including multi-processor mode or clock synchronous
mode.
When the SCI detects that the Transmit Shift Register (TSR) is empty, it transmits data written in the FTDRH and
FTDRL registers to the TSR register and starts serial transmission. Continuous serial transmission is executed until no
transmit data is left in FTDRH and FTDRL. When FTDRHL is full of transmit data, no more data can be written. If
writing new data is attempted, the data is ignored. The CPU can write to the FTDRH and FTDRL registers but cannot
read them.
When writing to both the FTDRH and FTDRL registers, write in the order from FTDRH to FTDRL.
27.2.9 Serial Mode Register (SMR) for Non-Smart Card Interface mode
(SCMR.SMIF = 0)
Address(es): SCI0.SMR 4007 0000h, SCI1.SMR 4007 0020h, SCI9.SMR 4007 0120h
b7 b6 b5 b4 b3 b2 b1 b0
The SMR register sets the communication format and clock source for the on-chip baud rate generator.
27.2.10 Serial Mode Register for Smart Card Interface Mode (SMR_SMCI)
(SCMR.SMIF = 1)
Address(es): SCI0.SMR_SMCI 4007 0000h, SCI1.SMR_SMCI 4007 0020h, SCI9.SMR_SMCI 4007 0120h
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. n is the decimal notation of the value of n in BRR, see section 27.2.17, Bit Rate Register (BRR).
Note 2. Writable only when SCR_SMCI.TE = 0 and SCR_SMCI.RE = 0 (both serial transmission and reception are
disabled).
The SMR_SMCI register sets the communication format and clock source for the on-chip baud rate generator.
27.2.11 Serial Control Register (SCR) for Non-Smart Card Interface Mode
(SCMR.SMIF = 0)
Address(es): SCI0.SCR 4007 0002h, SCI1.SCR 4007 0022h, SCI9.SCR 4007 0122h
b7 b6 b5 b4 b3 b2 b1 b0
The SCR controls operation and the clock source selection for transmission and reception.
When FIFO operation is selected and reception is halted by setting the RE bit to 0, the RDF, ORER, FER, PER, and DR
flags in SSR_FIFO are not affected and the previous values are saved.
27.2.12 Serial Control Register for Smart Card Interface Mode (SCR_SMCI)
(SCMR.SMIF = 1)
Address(es): SCI0.SCR_SMCI 4007 0002h, SCI1.SCR_SMCI 4007 0022h, SCI9.SCR_SMCI 4007 0122h
b7 b6 b5 b4 b3 b2 b1 b0
When GM in SMR_SMCI = 1:
b1 b0
0 0: Output fixed low
x 1: Output clock
1 0: Output fixed high.
b2 TEIE Transmit End Interrupt Enable This bit should be 0 in smart card interface mode R/W
b3 MPIE Multi-Processor Interrupt Enable This bit should be 0 in smart card interface mode R/W
b4 RE Receive Enable 0: Serial reception is disabled R/W*2
1: Serial reception is enabled.
b5 TE Transmit Enable 0: Serial transmission is disabled R/W*2
1: Serial transmission is enabled.
b6 RIE Receive Interrupt Enable 0: SCIn_RXI and SCIn_ERI interrupt requests are R/W
disabled
1: SCIn_RXI and SCIn_ERI interrupt requests are
enabled.
The SCR_SMCI sets transmission and reception control, interrupt control, and clock source selection for transmission
and reception.
For details on interrupt requests, see section 27.10, Interrupt Sources.
27.2.13 Serial Status Register (SSR) for Non-Smart Card Interface and Non-FIFO Mode
(SCMR.SMIF = 0 and FCR.FM = 0)
Address(es): SCI0.SSR 4007 0004h, SCI1.SSR 4007 0024h, SCI9.SSR 4007 0124h
b7 b6 b5 b4 b3 b2 b1 b0
The SSR register provides the SCI status flags and transmission/reception multi-processor bits.
27.2.14 Serial Status Register for Non-Smart Card Interface and FIFO Mode
(SSR_FIFO) (SCMR.SMIF = 0 and FCR.FM = 1)
b7 b6 b5 b4 b3 b2 b1 b0
The SSR_FIFO register provides SCI with FIFO mode status flags.
specified receive triggering number, and that no next data is received after 15 ETUs (element time units) from the last
stop bit in asynchronous mode. This flag is valid only in asynchronous mode, including multi-processor mode, and when
FIFO operation is selected.
In clock synchronous mode, this flag is not set to 1.
[Setting condition]
When FRDRHL contains less data than the specified receive triggering number, and no next data is received after
15 ETUs*1 from the last stop bit, and the SSR_FIFO.FER and SSR_FIFO.PER flags are 0.
[Clearing conditions]
When 1 is read from DR and 0 is written after all received data are read
When the FCR.FM bit is changed from 0 to 1.
Note 1. This is equivalent to 1.5 frames in the 8-bit format with one stop bit (ETU).
The DR flag is only set to 1 when FIFO is selected in asynchronous mode, including multi-processor mode. It is
not set to 1 in other operation modes.
When the SCR.RE bit is set to 0 (serial reception is disabled), the FER flag is not affected and keeps its previous value.
27.2.15 Serial Status Register for Smart Card Interface Mode (SSR_SMCI)
(SCMR.SMIF = 1)
Address(es): SCI0.SSR_SMCI 4007 0004h, SCI1.SSR_SMCI 4007 0024h, SCI9.SSR_SMCI 4007 0124h
b7 b6 b5 b4 b3 b2 b1 b0
The SSR_SMCI register provides SCI with smart card interface mode status flags.
[Setting condition]
When a parity error is detected during reception. Although receive data is transferred to RDR when a parity error
occurs, no SCIn_RXI interrupt request occurs. After the PER flag is set to 1, the next receive data is not transferred
to RDR.
[Clearing condition]
When 0 is written to PER after 1 is read. After writing 0 to the PER flag, read it to verify that its value is 0.
When the RE bit in SCR_SMCI is set to 0 (serial reception is disabled), the PER flag is not affected and keeps its
previous value.
Address(es): SCI0.SCMR 4007 0006h, SCI1.SCMR 4007 0026h, SCI9.SCMR 4007 0126h
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. Writable only when the TE and RE bits in SCR/SCR_SMCI are 0 (both serial transmission and reception are
disabled).
Note 2. The setting is invalid and a fixed data length of 8 bits is used in modes other than asynchronous mode.
Note 3. LSB-first should be selected and the value of the MSB bit [7] in TDR cannot be transmitted.
The SCMR register selects the smart card interface and communication format.
Address(es): SCI0.BRR 4007 0001h, SCI1.BRR 4007 0021h, SCI9.BRR 4007 0121h
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. Adjust the bit rate so that the high and low-level widths of the SCLn output in simple IIC mode satisfy the I2C bus
standard.
Table 27.6 Calculating widths at high and low level for SCL
Mode SCL Formula (result in seconds)
Simple IIC Width at high level (minimum value) 2n-1
1
(N + 1) × 4 × 2 ×7× 6
PCLKB × 10
Width at low level (minimum value) 2n-1
1
(N + 1) × 4 × 2 ×8× 6
PCLKB × 10
Table 27.9 and Table 27.10 list examples of BRR (N) settings in asynchronous mode. Table 27.11 lists the maximum bit
rate selectable for each operating frequency. Table 27.15 lists examples of BRR (N) settings in smart card interface
mode.
Table 27.17 lists examples of BRR (N) settings in simple IIC mode. In smart card interface mode, the number of base
clock cycles S in a 1-bit data transfer time can be selected. For details, see section 27.6.4, Receive Data Sampling Timing
and Reception Margin. Table 27.12 and Table 27.14 list the maximum bit rates with external clock input.
When either the Asynchronous Mode Base Clock Select (ABCS) bit or the Baud Rate Generator Double-Speed Mode
Select (BGDM) bit in the Serial Extended Mode Register (SEMR) is set to 1 in asynchronous mode, the bit rate becomes
twice the value listed in Table 27.16. When both of those bits are set to 1, the bit rate becomes four times the listed value.
Table 27.9 Examples of BRR settings for different bit rates in asynchronous mode (1)
Operating frequency PCLKB (MHz)
8 9.8304 10 12 12.288
Bit rate
(bps) n N Error (%) n N Error (%) n N Error (%) n N Error (%) n N Error (%)
110 2 141 0.03 2 174 -0.26 2 177 -0.25 2 212 0.03 2 217 0.08
150 2 103 0.16 2 127 0.00 2 129 0.16 2 155 0.16 2 159 0.00
300 1 207 0.16 1 255 0.00 2 64 0.16 2 77 0.16 2 79 0.00
600 1 103 0.16 1 127 0.00 1 129 0.16 1 155 0.16 1 159 0.00
1200 0 207 0.16 0 255 0.00 1 64 0.16 1 77 0.16 1 79 0.00
2400 0 103 0.16 0 127 0.00 0 129 0.16 0 155 0.16 0 159 0.00
4800 0 51 0.16 0 63 0.00 0 64 0.16 0 77 0.16 0 79 0.00
9600 0 25 0.16 0 31 0.00 0 32 -1.36 0 38 0.16 0 39 0.00
19200 0 12 0.16 0 15 0.00 0 15 1.73 0 19 -2.34 0 19 0.00
31250 0 7 0.00 0 9 -1.70 0 9 0.00 0 11 0.00 0 11 2.40
38400 — — — 0 7 0.00 0 7 1.73 0 9 -2.34 0 9 0.00
Table 27.10 Examples of BRR settings for various bit rates in asynchronous mode (2)
Operating frequency PCLKB (MHz)
20
Bit rate (bps) n N Error (%)
110 3 88 -0.25
150 3 64 0.16
300 2 129 0.16
600 2 64 0.16
1200 1 129 0.16
2400 1 64 0.16
4800 0 129 0.16
9600 0 64 0.16
19200 0 32 -1.36
31250 0 19 0.00
38400 0 15 1.73
Table 27.11 Maximum bit rate for each operating frequency in asynchronous mode (1 of 2)
SEMR settings SEMR settings
Maximum Maximum
PCLKB BGDM ABCS ABCSE bit rate PCLKB BGDM ABCS ABCSE bit rate
(MHz) bit bit bit n N (bps) (MHz) bit bit bit n N (bps)
8 0 0 0 0 0 250000 17.2032 0 0 0 0 0 537600
1 0 0 0 500000 1 0 0 0 1075200
1 0 0 0 0 1 0 0 0 0
1 0 0 0 1000000 1 0 0 0 2150400
Don’t Don’t 1 0 0 1333333 Don’t Don’t 1 0 0 2867200
care care care care
9.8304 0 0 0 0 0 307200 18 0 0 0 0 0 562500
1 0 0 0 614400 1 0 0 0 1125000
1 0 0 0 0 1 0 0 0 0
1 0 0 0 1228800 1 0 0 0 2250000
Don’t Don’t 1 0 0 1638400 Don’t Don’t 1 0 0 3000000
care care care care
Table 27.11 Maximum bit rate for each operating frequency in asynchronous mode (2 of 2)
SEMR settings SEMR settings
Maximum Maximum
PCLKB BGDM ABCS ABCSE bit rate PCLKB BGDM ABCS ABCSE bit rate
(MHz) bit bit bit n N (bps) (MHz) bit bit bit n N (bps)
10 0 0 0 0 0 312500 19.6608 0 0 0 0 0 614400
1 0 0 0 625000 1 0 0 0 1228800
1 0 0 0 0 1 0 0 0 0
1 0 0 0 1250000 1 0 0 0 2457600
Don’t Don’t 1 0 0 1666666 Don’t Don’t 1 0 0 3276800
care care care care
12 0 0 0 0 0 375000 20 0 0 0 0 0 625000
1 0 0 0 750000 1 0 0 0 1250000
1 0 0 0 0 1 0 0 0 0
1 0 0 0 1500000 1 0 0 0 2500000
Don’t Don’t 1 0 0 2000000 Don’t Don’t 1 0 0 3333333
care care care care
12.288 0 0 0 0 0 384000 - - - - - - -
1 0 0 0 768000
1 0 0 0 0
1 0 0 0 1536000
Don’t Don’t 1 0 0 2048000
care care
14 0 0 0 0 0 437500 - - - - - - -
1 0 0 0 875000
1 0 0 0 0
1 0 0 0 1750000
Don’t Don’t 1 0 0 2333333
care care
16 0 0 0 0 0 500000 - - - - - - -
1 0 0 0 1000000
1 0 0 0 0
1 0 0 0 2000000
Don’t Don’t 1 0 0 2666666
care care
Table 27.12 Maximum bit rate with external clock input in asynchronous mode
Maximum bit rate (bps)
PCLKB (MHz) External input clock (MHz) SEMR.ABCS = 0 SEMR.ABCS = 1
8 2.0000 125000 250000
9.8304 2.4576 153600 307200
10 2.5000 156250 312500
12 3.0000 187500 375000
12.288 3.0720 192000 384000
14 3.5000 218750 437500
16 4.0000 250000 500000
17.2032 4.3008 268800 537600
18 4.5000 281250 562500
19.6608 4.9152 307200 614400
20 5.0000 312500 625000
Table 27.13 BRR settings for different bit rates in clock synchronous and simple SPI modes
Operating frequency PCLKB (MHz)
8 10 16 20
Bit rate (bps) n N n N n N n N
110 x x x x x x x x
250 3 124 — — 3 249 x x
500 2 249 — — 3 124 — —
1k 2 124 — — 2 249 — —
2.5 k 1 199 1 249 2 99 2 124
5k 1 99 1 124 1 199 1 249
10 k 0 199 0 249 1 99 1 124
25 k 0 79 0 99 0 159 0 199
50 k 0 39 0 49 0 79 0 99
100 k 0 19 0 24 0 39 0 49
250 k 0 7 0 9 0 15 0 19
500 k 0 3 0 4 0 7 0 9
1M 0 1 0 3 0 4
2.5 M x x 0 0*1 x x 0 1
5M x x x x x x 0 0*1
7.5 M x x x x x x x x
x: Setting prohibited.
—: Can be set, but an error will occur.
Note 1. Continuous transmission or reception is impossible. After transmitting or receiving one frame of data, a 1-bit
period elapses before starting to transmit or receive the next frame of data. The output of the synchronization
clock is stopped for a 1-bit period. Therefore, it takes 9 bits worth of time to transfer one frame (8 bits) of data,
and the average transfer rate is 8/9 times the bit rate.
Table 27.14 Maximum bit rate with external clock input in clock synchronous and simple SPI modes
PCLKB (MHz) External input clock (MHz) Maximum bit rate (Mbps)
8 1.3333 1.3333333
10 1.6667 1.6666667
12 2.0000 2.0000000
14 2.3333 2.3333333
16 2.6667 2.6666667
18 3.0000 3.0000000
20 3.3333 3.3333333
Table 27.15 BRR settings for different bit rates in smart card interface mode, n = 0, S = 372
Operating frequency PCLKB (MHz)
7.1424 10.00 10.7136 13.00
bit rate (bps) n N Error (%) n N Error (%) n N Error (%) n N Error (%)
9600 0 0 0.00 0 1 -30 0 1 -25 0 1 -8.99
Table 27.16 Maximum bit rate for each operating frequency in smart card interface mode, S = 32
PCLKB (MHz) Maximum bit rate (bps) n N
10.00 156250 0 0
10.7136 167400 0 0
13.00 203125 0 0
16.00 250000 0 0
18.00 281250 0 0
20.00 312500 0 0
Table 27.17 BRR settings for different bit rates in simple IIC mode
Operating frequency PCLKB (MHz)
8 10 16
Bit rate (bps) n N Error (%) n N Error (%) n N Error (%)
10 k 0 24 0.0 0 30 0.8 1 12 -3.8
25 k 0 9 0.0 0 12 -3.8 1 4 0.0
50 k 0 4 0.0 0 5 4.2 1 2 -16.7
100 k*1 0 2 -16.7 0 3 -21.9 0 4 0.0
250 k 0 0 0.0 0 0 25.0 0 1 0.0
350 k — — — — — — — — —
400 k*1 — — — — — — — — —
Note 1. The bit rate of 100 kbps and 400 kbps indicates the set value at which the error is on the minus side.
Table 27.18 Minimum widths at high and low level for SCL at different bit rates in simple IIC mode
Operating frequency PCLKB (MHz)
8 10 16
Min. Widths at Min. Widths at Min. Widths at
Bit rate High/Low Level High/Low Level High/Low Level
(bps) n N for SCL (μs) n N for SCL (μs) n N for SCL (μs)
10 k 0 24 43.75/50.00 0 30 43.40/49.60 1 12 45.5/52.00
25 k 0 9 17.50/20.00 0 12 18.2/20.80 1 4 17.50/20.00
50 k 0 4 8.75/10.00 0 5 8.40/9.60 1 2 10.50/12.00
100 k 0 2 5.25/6.00 0 3 5.60/6.40 0 4 4.38/5.00
250 k 0 0 1.75/2.00 0 0 1.40/1.60 0 1 1.75/2.00
350 k — — — — — — — — —
400 k — — — — — — — — —
Address(es): SCI0.MDDR 4007 0012h, SCI1.MDDR 4007 0032h, SCI9.MDDR 4007 0132h
b7 b6 b5 b4 b3 b2 b1 b0
Table 27.19 Relationship between MDDR setting (M) and bit rate (B) when bit rate modulation function is used
SEMR settings
BGDM ABCS ABCSE
Mode bit bit bit BRR setting Error
Asynchronous, 0 0 0 PCLKB × 106 Error PCLKB × 106
multi- (%)
N= 64 × 22n-1 × (256 / M) × –1 2n-1 × (256 / M) × (N + 1) – 1 } × 100
processor = { B × 64 × 2
transfer B
1 0 0
Error
PCLKB × 106 PCLKB × 106
(%)
N= –1 – 1 } × 100
0 1 0 32 × 22n-1 × (256 / M) × = { B × 32 × 22n-1 × (256 / M) × (N + 1)
B
Note 1. Do not use this function in clock synchronous mode and in the highest speed settings in simple SPI mode
(SMR.CKS[1:0] = 00b, SCR.CKE[1] = 0, and BRR = 0).
Note 2. Adjust the bit rate so that the widths at high and low level of the SCLn output in simple IIC mode satisfy the I2C
standard.
Table 27.20 and Table 27.21 list examples of N settings in BRR and M settings in MDDR in asynchronous mode.
Table 27.20 Examples of BRR and MDDR settings for different bit rates in asynchronous mode (1)
Operating frequency PCLKB (MHz)
8 9.8304 10
Bit rate BGDM Error BGDM Error BGDM Error
(bps) n N M bit (%) n N M bit (%) n N M bit (%)
38400 0 5 236 0 0.03 0 7 (256)*1 0 0.00 0 10 173 1 -0.01
57600 0 3 236 0 0.03 0 4 240 0 0.00 0 4 236 0 0.03
115200 0 1 236 0 0.03 0 1 192 0 0.00 0 4 236 1 0.03
230400 0 0 236 0 0.03 0 0 192 0 0.00 0 1 189 1 0.14
460800 0 0 236 1 0.03 0 0 192 1 0.00 0 0 189 1 0.14
Note 1. In this example, the ABCS and ABCSE in SEMR are 0. SEMR.BRME = 0 (M = 256) disables the bit rate
modulation function.
Table 27.21 Examples of BRR and MDDR settings for different bit rates in asynchronous mode (2)
Operating frequency PCLKB (MHz)
19.6608 20
Bit Rate (bps) n N M BGDMbit Error (%) n N M BGDMbit Error (%)
38400 0 15 (256)*1 0 0.00 0 10 173 0 -0.01
57600 0 9 240 0 0.00 0 9 236 0 0.03
115200 0 4 240 0 0.00 0 4 236 0 0.03
230400 0 1 192 0 0.00 0 4 236 1 0.03
460800 0 0 192 0 0.00 0 0 189 0 0.14
Note 1. In this example, the ABCS and ABCSE bits in SEMR are 0. SEMR.BRME = 0 (M = 256) disables the bit rate
modulation function.
Address(es): SCI0.SEMR 4007 0007h, SCI1.SEMR 4007 0027h, SCI9.SEMR 4007 0127h
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. Writable only when TE in SCR/SCR_SMCI = 0 and RE in SCR/SCR_SMCI = 0 (both serial transmission and
reception are disabled).
SEMR selects the clock source for a 1-bit period in asynchronous mode.
Address(es): SCI0.SNFR 4007 0008h, SCI1.SNFR 4007 0028h, SCI9.SNFR 4007 0128h
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — NFCS[2:0]
b2 b0
0 0 0: The clock signal divided by 1 is used with the noise filter.
In simple IIC mode, the standard settings for the clock source of the
on-chip baud rate generator selected by the SMR.CKS[1:0] bits are
as follows:
b2 b0
0 0 1: The clock signal divided by 1 is used with the noise filter
0 1 0: The clock signal divided by 2 is used with the noise filter
0 1 1: The clock signal divided by 4 is used with the noise filter
1 0 0: The clock signal divided by 8 is used with the noise filter.
Other settings are prohibited.
b7 to b3 — Reserved These bits are read as 0. The write value should be 0. R/W
Note 1. Writing to these bits is only possible when the RE and TE bits in SCR/SCR_SMCI are 0 (serial reception and
transmission disabled).
Address(es): SCI0.SIMR1 4007 0009h, SCI1.SIMR1 4007 0029h, SCI9.SIMR1 4007 0129h
b7 b6 b5 b4 b3 b2 b1 b0
IICDL[4:0] — — IICM
SIMR1 selects simple IIC mode and the number of delay stages for the SDAn output.
Address(es): SCI0.SIMR2 4007 000Ah, SCI1.SIMR2 4007 002Ah, SCI9.SIMR2 4007 012Ah
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. Writing to these bits is only possible when the RE and TE bits in the SCR are 0 (serial reception and transmission
disabled).
SIMR2 selects how reception and transmission are controlled in simple IIC mode.
The SCL clock signal is not synchronized if the IICCSC bit is 0. The SCLn clock signal is generated according to the rate
selected in the BRR register regardless of the level being input on the SCLn pin.
Set the IICCSC bit to 1 except during debugging.
Address(es): SCI0.SIMR3 4007 000Bh, SCI1.SIMR3 4007 002Bh, SCI9.SIMR3 4007 012Bh
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. Only generate a start condition after checking the bus state and confirming that it is free.
Note 2. Generate a restart or stop condition after checking the bus state and confirming that it is busy.
Note 3. Do not set more than one of the IICSTAREQ, IICRSTAREQ, and IICSTPREQ bits to 1 at a given time.
Note 4. Write only 0. When 1 is written, the value is ignored.
Note 5. Execute the generation of a condition after the value of the IICSTIF flag is 0.
Note 6. Do not write 0 to this bit while it is 1. Generation of a condition is suspended by writing 0 to this bit while it is 1.
Address(es): SCI0.SISR 4007 000Ch, SCI1.SISR 4007 002Ch, SCI9.SISR 4007 012Ch
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — IICACK
R
Value after reset: 0 0 x x 0 x 0 0
x: Undefined
Address(es): SCI0.SPMR 4007 000Dh, SCI1.SPMR 4007 002Dh, SCI9.SPMR 4007 012Dh
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. Writing to these bits is only possible when the RE and TE bits in the SCR are 0 (both serial transmission and
reception are disabled).
Note 2. Only 0 can be written to this bit to clear the flag.
SPMR selects the extension settings in asynchronous and clock synchronous modes.
FCR selects the FIFO mode, resets FTDRHL/FRDRHL, selects the FIFO data trigger number of transmission/reception,
and selects the RTS output active trigger number.
— — — T[4:0] — — — R[4:0]
Address(es): SCI0.CDR 4007 001Ah, SCI1.CDR 4007 003Ah, SCI9.CDR 4007 013Ah
— — — — — — — CMPD[8:0]
The CDR register sets the compare data for the address match function.
Address(es): SCI0.DCCR 4007 0013h, SCI1.DCCR 4007 0033h, SCI9.DCCR 4007 0133h
b7 b6 b5 b4 b3 b2 b1 b0
Address(es): SCI0.SPTR 4007 001Ch, SCI1.SPTR 4007 003Ch, SCI9.SPTR 4007 013Ch
b7 b6 b5 b4 b3 b2 b1 b0
The SPTR register provides confirmation of the serial reception pin (RXDn) status and sets transmission pin (TXDn)
status. This register can only be used in asynchronous mode.
The TXDn pin status is determined by the combination of SCR.TE, SPTR.SPB2IO, and SPTR.SPB2DT bit settings, as
shown in Table 27.22.
x: Don’t care.
Note: Use the SPTR register in asynchronous mode only. Using this register in any other mode is not guaranteed.
Idle state
(mark state)
1 LSB MSB 1
Figure 27.2 Data format in asynchronous serial communications with 8-bit data, parity, and 2 stop bits
0 0 0 0 1
S 9-bit data STOP STOP
0 0 1 0 0
S 9-bit data P STOP
0 0 1 0 1
S 9-bit data P STOP STOP
1 0 0 0 0
S 8-bit data STOP
1 0 0 0 1
S 8-bit data STOP STOP
1 0 1 0 0
S 8-bit data P STOP
1 0 1 0 1
S 8-bit data P STOP STOP
1 1 0 0 0
S 7-bit data STOP
1 1 0 0 1
S 7-bit data STOP STOP
1 1 1 0 0
S 7-bit data P STOP
1 1 1 0 1
S 7-bit data P STOP STOP
0 0 — 1 1
S 9-bit data MPB STOP STOP
1 0 — 1 0
S 8-bit data MPB STOP
1 0 — 1 1
S 8-bit data MPB STOP STOP
1 1 — 1 0
S 7-bit data MPB STOP
1 1 — 1 1
S 7-bit data MPB STOP STOP
S: Start bit
STOP: Stop bit
P: Parity bit
MPB: Multi-processor bit
27.3.2 Receive Data Sampling Timing and Reception Margin in Asynchronous Mode
In asynchronous mode, the SCI operates on a base clock with a frequency of 16 times*1 the bit rate.
In reception, the SCI samples the falling edge of the start bit using the base clock, and performs internal synchronization.
Because receive data is sampled on the rising edge of the 8th pulse*1 of the base clock, data is latched at the middle of
each bit, as shown in Figure 27.3. The reception margin in asynchronous mode is determined by the following formula
(1):
1 D - 0.5
M= (0.5 - ) - (L - 0.5) F - (1 + F) × 100 [%] ... Formula (1)
2N N
M: Reception margin
N: Ratio of bit rate to clock
N = 16 when SEMR.ABCSE = 0 and SEMR.ABCS = 0
N = 8 when SEMR.ABCS = 1, N = 6 when SEMR.ABCSE = 1
D: Duty cycle of clock (D = 0.5 to 1.0)
L: Frame length (L = 9 to 13)
F: Absolute value of clock frequency deviation
Assuming the values of F = 0 and D = 0.5 in formula (1), the reception margin is determined by the following formula:
This represents the computed value. Renesas recommends that a margin of 20% to 30% should be allowed in system
design.
Note 1. In this example, the SEMR.ABCS bit is 0 and SEMR.ABCSE bit is 0. When the ABCS bit is 1, and the ABCSE bit
is 0, a frequency of 8 times the bit rate is used as a base clock, and receive data is sampled on the rising edge of
the 4th pulse of the base clock.
When the ABCSE bit is 1, a frequency of 6 times the bit rate is used as a base clock, and receive data is sampled
on the rising edge of the 3rd pulse of the base clock.
16 clock pulses
8 clock pulses
0 7 15 0 7 15 0
Internal base clock
Synchronization
sampling timing
Data sampling
timing
27.3.3 Clock
Either an internal clock generated by the on-chip baud rate generator or an external clock input to the SCKn pin can be
selected as the SCI transfer clock, based on the SMR.CM bit and the SMR.CKE[1:0] bit settings.
When an external clock is input to the SCKn pin, the clock frequency must be 16 times the bit rate (when SEMR.ABCS
= 0) or 8 times the bit rate (when SEMR.ABCS = 1).
When the SCI uses its internal clock, the clock can be output from the SCKn pin. The frequency of the clock output in
this case is equal to the bit rate, and the phase is such that the rising edge of the clock is in the middle of the transmit data,
as Figure 27.4 shows.
SCKn
TXDn 0 D0 D1 D2 D3 D4 D5 D6 D7 0/1 1 1
1 frame
Figure 27.4 Phase relationship between output clock and transmit data in asynchronous mode when
SCMR.CHR1 = 1, SMR.CHR = 0, PE = 1, MP = 0, STOP = 1
(a) Non-FIFO selected when all of the following conditions are satisfied
The value of the SCR.RE bit is 1
Reception is not in progress
There is no receive data yet to be read
The ORER, FER, and PER flags in the SSR register are all 0.
(b) FIFO selected when all of the following conditions are satisfied
The value of the SCR.RE bit is 1
The amount of receive data written in FRDRHL is equal to or less than the specified receive triggering number
The ORER bit in the SSR_FIFO register (ORER in FRDRH) is 0.
[Conditions for high-level output]
SCIn_AM
SCI0_DCUF
DCME
DCMF flag
RDRF flag
DPER flag
DFER flag
RDR
(a) Example of compare mismatched between receive data and CDR (8-bit length/parity/non multi-processor mode)
1 Start bit Stop bit Start bit Stop bit Start bit
0 D0 D1 D7 Parity 1 0 D0 D1 D7 Parity 1 0
SCIn_AM
SCI0_DCUF
DCME
DCMF flag
MPIE
Clear the flag
SCIn_RXI interrupt flag
(ICU.IELSRn.IR)
RDRF flag
DFER flag
RDR Data2
(b) Example of compare matched between receive data and CDR (8-bit length/parity/non multi-processor mode)
SCIn_AM
SCI0_DCUF
DCME
DCMF flag
RDRF flag
DPER flag
DFER flag
RDR
The data in which MPB is 0 is If compare mismatched, Not stored to RDR, if CDR
detected as mismatch The flag is not set setting value mismatched
with receive data
(a) Example of compare mismatched between receive data and CDR (8-bit length/IDSEL = 1/multi-processor mode)
1 Start bit MPB Stop bit Start bit Stop bit Start bit
0 D0 D1 D7 1 1 0 D0 D1 D7 MPB 1 0
SCIn_AM
SCI0_DCUF
DCME
DCMF flag
MPIE
Clear the flag
SCIn_RXI interrupt flag
(ICU.IELSRn.IR)
RDRF flag
DFER flag
RDR Data2
Non-address match
DCME = 0
If error occurs, Not stored to RDR, if CDR and non multi- Stored receive data
the flag is set setting value matched with processor, and
receive data set to the flag
(b) Example of compare matched between receive data and CDR (8-bit length/IDSEL = 1/multi-processor mode)
Note: When the SCR.RE bit is set to 0, the ORER, FER, RDRF, RDF, PER, and DR flags in SSR/SSR_FIFO, and the
RDR and RDRHL registers are not initialized. When the SCR.TE bit is set to 0, the TEND flag for the selected
FIFO buffer is not initialized.
Note: In non-FIFO mode, switching the value of the SCR.TE bit from 1 to 0 or 0 to 1 while the SCR.TIE bit is 1 leads to
the generation of an SCIn_TXI interrupt request.
Set the SCR.TIE, RIE, TE, RE, and [2] Set the clock selection in SCR.
TEIE bits to 0 When the clock output is selected in asynchronous mode,
the clock is output immediately after SCR settings are made.
Set the FCR.FM bit to 0 [1] [3] Set the SIMR1.IICM bit to 0.
Set the SPMR.CKPH and CKPOL bits to 0.
Step [3] can be skipped if the values have not changed from
Set the SCR.CKE[1:0] bits [2] the initial values.
Initialization completion
Figure 27.7 Example SCI initialization flow in asynchronous mode with non-FIFO selected
Start initialization [1] Set the FCR.FM, TFRST, and RFRST bits to 1.
This enables FIFO mode and clears the FIFOs.
Set the trigger values in FCR.TTRG[3:0], RTRG[3:0], and
Set the SCR.TIE, RIE, TE, RE, and
RSTRG[3:0] bits.
TEIE bits to 0
Set the FCR.TFRST and RFRST bits to 0 [7] [8] Specify the I/O port settings to enable input and output
functions as required for TXDn, RXDn, and SCKn pins.
Initialization completion
Figure 27.8 Example SCI initialization flow in asynchronous mode with FIFO selected
Figure 27.9, Figure 27.10, and Figure 27.11 show an example flow of serial transmission in asynchronous mode.
SSR.TEND flag
SCIn_TXI interrupt Data written to TDR in SCIn_TXI interrupt Data written to TDR in Data written to TDR in
request generated SCIn_TXI interrupt request generated SCIn_TXI interrupt SCIn_TXI interrupt
handling routine handling routine handling routine
Note 1. See section 13, Interrupt Controller Unit (ICU) for information on the associated interrupt event number.
Figure 27.9 Example of operation for serial transmission in asynchronous mode (1) with 8-bit data, parity bit,
1 stop bit, CTS function not used, and at the beginning of transmission
CTSn_RTSn pin
Data
Start bit Parity bit Stop bit
SSR.TEND flag
Figure 27.10 Example operation of serial transmission in asynchronous mode (2) with 8-bit data, parity bit, 1
stop bit, CTS function used, and at the beginning of transmission
Data
Start bit Parity bit Stop bit
SCIn_TXI interrupt Data written to TDR in Data written to TDR in SCIn_TXI SCIn_TEI interrupt
request generated SCIn_TXI interrupt interrupt handling routine request generated
handling routine (set the TIE bit to 0 and the TEIE bit to
1 after writing the last data)
SCIn_TXI interrupt
request generated
1 frame
Note 1. See section 13, Interrupt Controller Unit (ICU) for information on the associated interrupt event number.
Figure 27.11 Example operation of serial transmission in asynchronous mode (3) with 8-bit data, parity bit, 1
stop bit, CTS function not used, and from the middle of transmission until transmission
completion
No
SCIn_TEI interrupt
Yes
End
Figure 27.12 Example of serial transmission flow in asynchronous mode with non-FIFO selected
Figure 27.13 Data format written to FTDRH and FTDRL with FIFO selected
In serial transmission, the SCI operates as described in this section. When the TE bit is set to 1, the high level for one
frame (preamble) is output to TXDn.
1. The SCI transfers data from FTDRL*1 to TSR when data is written to FTDRL*1 in the SCIn_TXI interrupt handling
routine. The amount of data that can be written to FTDRL is 16 minus FDR.T[4:0] bytes. The SCIn_TXI interrupt
request at the beginning of transmission is generated when the TE and TIE bits in SCR are set to 1 simultaneously
by a single instruction.
2. Transmission starts after the SPMR.CTSE bit is set to 0 (CTS function is disabled) and a low level on the
CTSn_RTSn pin causes data transfer from FTDRL*1 to TSR. When the amount of transmit data written in FTDRL
is equal to or less than the specified transmit triggering number, SSR_FIFO.TDFE is set to 1. If the SCR.TIE bit is
1, an SCIn_TXI interrupt request is generated. Continuous transmission is possible by writing the next transmit data
to FTDRL*1 in the SCIn_TXI interrupt handling routine before transmission of the current transmit data is
complete. When SCIn_TEI interrupt requests are in use, set the SCR.TIE bit to 0 (an SCIn_TXI interrupt request is
disabled) and the SCR.TEIE bit to 1 (an SCIn_TEI interrupt request is enabled) after the last of the data to be
transmitted is written to FTDRL*1 *2 from the handling routine for SCIn_TXI requests.
3. Data is sent from the TXDn pin in the following order:
a. Start bit
b. Transmit data
c. Parity bit or multi-processor bit (can be omitted depending on the format)
d. Stop bit.
4. On output of the stop bit, the SCI checks whether non-transmitted data remains in FTDRL*3.
5. When data is set to FTDRL*3, setting the SPMR.CTSE bit to 0 (CTS function is disabled) or a low-level input on
the CTSn_RTSn pin causes transfer of the next transmit data from FTDRL*1 to TSR and transmission of the stop
bit, after which serial transmission of the next frame starts.
6. If data is not set in FTDRL*3, the TEND flag in SSR_FIFO is set to 1, the stop bit is sent, and the mark state is
entered where 1 is output. If the SCR.TEIE bit is 1, the TEND flag in SSR_FIFO is set to 1 and an SCIn_TEI
interrupt request is generated.
Note 1. Write data to the FTDRH and FTDRL registers when 9-bit data length is selected.
Note 2. Write data in order from FTDRH to FTDRL when 9-bit data length is selected.
Note 3. The SCI only checks for an update to the FTDRL register and not the FTDRH register when 9-bit data length is
selected.
Figure 27.14 shows an example flow of serial transmission in asynchronous mode with FIFO selected.
End
Note 1. When data length is 9 bits, FTDRH and FTDRL registers are used.
Note 2. When data length is 9 bits, write in order from FTDRH to FTDRL.
Figure 27.14 Example of serial transmission flow in asynchronous mode with FIFO selected
Note 1. Only read data in the RDRHL register when 9-bit data length is selected.
SSR.FER flag
Note 1. See section 13, Interrupt Controller Unit (ICU) for details on the associated interrupt event number.
Figure 27.15 Example of SCI operation for serial reception in asynchronous mode (1) when RTS function is
not used, and with 8-bit data, parity bit, and 1 stop bit
SSR.FER flag
CTSn_RTSn pin
1 frame
Note 1. See section 13, Interrupt Controller Unit (ICU) for details on the associated interrupt event number.
Figure 27.16 Example of SCI operation for serial reception in asynchronous mode (2) when RTS function is
used, and with 8-bit data, parity bit, and 1 stop bit
Table 27.24 lists the states of the flags in the SSR register and receive data handling when a receive error is detected.
If a receive error is detected, an SCIn_ERI interrupt request is generated but an SCIn_RXI interrupt request is not
generated. Data reception cannot be resumed while the receive error flag is 1. Also, set the ORER, FER, and PER flags to
0 before resuming reception. In addition, be sure to read the RDR or the RDRHL register during overrun error
processing. When a reception is forcibly terminated by setting the SCR.RE bit to 0 during operation, read the RDR or
RDRHL register because the received data that is not yet read might be left in RDR or RDRHL.
Figure 27.17 and Figure 27.18 show example flows for serial data reception.
Table 27.24 Flags in SSR Status Register and receive data handling
Flags in the SSR Status Register
ORER FER PER Receive data Receive error type
1 0 0 Lost Overrun error
0 1 0 Transferred to RDR*1 Framing error
0 0 1 Transferred to RDR*1 Parity error
1 1 0 Lost Overrun error + framing error
1 0 1 Lost Overrun error + parity error
0 1 1 Transferred to RDR*1 Framing error + parity error
1 1 1 Lost Overrun error + framing error + parity error
Note 1. Only read data in the RDRHL register when 9-bit data length is selected.
Initialization [1]
No
All data received ? [5]
Yes
End
Figure 27.17 Example flow of serial reception in asynchronous mode with non-FIFO selected (1)
[3]
Error processing
No
SSR.ORER flag = 1?
Yes
No
SSR.FER flag = 1?
Yes
Yes
Break?
No
No
SSR.PER flag = 1?
Yes
Read the SSR.ORER, PER, and FER flags [8] [ 8 ] Confirming that the error flag is cleared:
Read the error flag to confirm that its value is 0.
End
Note: The RDR register becomes the RDRHL register when 9-bit data length is selected.
Figure 27.18 Example flow of serial reception in asynchronous mode with non-FIFO selected (2)
Figure 27.19 Data format stored to FRDRH and FRDRL with FIFO selected
In serial data reception, the SCI operates as follows:
1. When the value of the SCR.RE bit becomes 1, the output signal on the CTSn_RTSn pin goes low.
2. When the SCI monitors the communications line and detects a start bit, it performs internal synchronization, stores
receive data in RSR, and checks the parity bit and stop bit.
3. When the FRDRL register is full, an overrun error occurs. If an overrun error occurs, the ORER flag in SSR_FIFO
is set to 1. When the SCR.RIE bit is 1, an SCIn_ERI interrupt request is generated. Receive data is not transferred to
FRDRL*1.
4. If a parity error is detected, the PER flag and receive data are transferred to FRDRL*1. When the RIE bit is set to 1,
an SCIn_ERI interrupt request is generated.
5. If a frame error is detected, the FER flag and receive data are transferred to FRDRL*1. When a RIE bit is set to 1, an
SCIn_ERI interrupt request is generated.
6. After a frame error is detected and when SCI detects that the continuous receive data is for one frame, reception
stops.
7. When the amount of data stored in the FRDRL register falls below the specified receive triggering number, and the
next data is not received after 15 ETUs from the last stop bit in asynchronous mode, the SSR_FIFO.DR bit is set to
1. When the RIE bit is 1 and the FCR.DRES bit is 0, SCI generates an SCIn_RXI interrupt request. When the
FCR.DRES bit is 1, SCI generates an SCIn_ERI interrupt request.
8. When reception finishes successfully, receive data is transferred to FRDRL*1. The RDF bit is set to 1 when the
amount of receive data written to FRDRHL is equal to or greater than the specified receive triggering number.
When the SCR.RIE bit is 1, an SCIn_RXI interrupt request is generated. Continuous reception is enabled by reading
the receive data transferred to FRDRL*2 in the SCIn_RXI interrupt handling routine, before an overrun error
occurs. If the received data that is transferred to FRDRL*3 is less than the RTS trigger number, the CTSn_RTSn pin
outputs low.
Note 1. Only read data in the FRDRH and FRDRL registers when 9-bit data length is selected.
Note 2. Read data in the order from FRDRH to FRDRL when 9-bit data length is selected.
Note 3. The SCI only checks for an update to the FRDRL register and not to the FRDRH register when 9-bit data length
is selected.
Start data reception [2] [3] Receive error processing and break detection:
If a receive error occurs, an SCIn_ERI interrupt
is generated. A break can be detected by
Read ORER*1, PER, FER, And DR*1 reading the SPTR.RXDMON bit. An error is
flags in SSR_FIFO [2]
identified by reading the ORER*1, PER, DR*1,
and FER flags in SSR_FIFO. After performing
the appropriate error processing, be sure to set
the ORER*1 flag to 0. Reception cannot be
resumed if ORER*1 flag is set to 1. The
SSR_FIFO.ORER*1 flag = 1, Yes
SSR_FIFO.PER flag = 1, reception operation is continuous, even when
SSR_FIFO.FER flag = 1, or FER = 1 or PER = 1 or DR*1 = 1.
DR*1flag = 1 ? [3]
[4] Read the receive data in FRDRHL in the
Error processing SCIn_RXI interrupt handling routine. The receive
data stored in the FRDRHL register is read until
(Continued to next page) the number of stored data is below the
No
FCR.RTRG[3:0] value. Confirm the number of
receive data bits in the FIFO by reading the
No FDR.R[4:0] bits.
SCIn_RXI interrupt ?
Yes
End
Figure 27.20 Example flow of serial reception in asynchronous mode with FIFO selected (1)
[3]
Error processing
No
SSR_FIFO.ORER flag = 1?
Yes
No
SSR_FIFO.FER flag = 1?
Yes
Yes
Break?
No
Yes
[ 8 ] Framing error processing/parity error processing:
All error occurrence data stored in the FRDRHL
Parity error processing [8] register is read or write 1 to the FCR.RFRST bit and
empty the FRDRHL register.
No
[ 9 ] Reading of the receive data (when FCR.DRES is 1):
SSR_FIFO .DR flag = 1? All receive data stored in the FRDRHL register is read.
Yes
Read receive data in the
[9]
FRDRHL register
End
Figure 27.21 Example flow of serial reception in asynchronous mode with FIFO selected (2)
Transmitting
station
Communication line
Serial data
01h AAh
(MPB = 1) (MPB = 0)
Figure 27.22 Example of communication using multi-processor format with transmission of data AAh to
receiving station A
Initialization [1]
No
Break output? [4]
Yes
Set TXD port functions
End
Figure 27.23 Example flow of multi-processor serial transmission with non-FIFO selected
Figure 27.24 Data format written to FTDRH and FTDRL in multi-processor mode with FIFO selected
Figure 27.25 shows an example flow of multi-processor data transmission with FIFO selected. In the ID transmission
cycle, the ID must be transmitted with the FTDRH.MPBT bit set to 1. In the data transmission cycle, the data must be
transmitted with the MPBT bit set to 0. The rest of the operations are the same as in asynchronous mode with non-FIFO
selected.
Yes
Set TXD port functions
End
Figure 27.25 Example flow of serial transmission in multi-processor mode with FIFO selected
0 D0 D1 D7 1 1 0 D0 D1 D7 0 1 Idle state
(mark state)
MPIE
MPIE = 0 SCIn_RXI interrupt RDR data read in MPIE bit set to 1 again SCIn_RXI interrupt
request (multi-processor SCIn_RXI interrupt when the received ID request not generated.
interrupt) generated handling routine does not match the ID of RDR retains the state.
the receiving station itself
(a) When the received ID does not match the ID of the receiving station itself
0 D0 D1 D7 1 1 0 D0 D1 D7 0 1 Idle state
(mark state)
MPIE
MPIE = 0 SCIn_RXI interrupt RDR data read in Since the received ID matches MPIE bit set to 1 again
request (multi-processor SCIn_RXI interrupt the ID of the receiving station
interrupt) generated handling routine itself, reception continued and
data received in SCIn_RXI
interrupt handling routine
(b) When the received ID matches the ID of the receiving station itself
Note 1. See section 13, Interrupt Controller Unit (ICU) for information on the associated interrupt event number.
Figure 27.26 Example of SCI reception with 8-bit data, multi-processor bit, and 1 stop bit
Initialization [1]
[1] SCI initialization:
Set data reception.
Yes
FER flag = 1 or ORER flag = 1
No
Yes
Read receive data in RDR
No [5]
All data received?
Error processing
Yes
Set RE and RIE bits in SCR to 0 (Continued to next page)
End
Note 1. The RDR register becomes the RDRHL register when 9-bit data length is selected.
Figure 27.27 Example flow of multi-processor serial reception with non-FIFO selected (1)
[5]
Error processing
No
SSR.ORER flag = 1?
Yes
No
SSR.FER flag = 1?
Yes
Yes
Break?
No
Read the SSR.ORER, PER, and FER flags [8] [ 8 ] Confirming that the error flag is cleared:
Read the error flag to confirm that its value is 0.
End
Note 1. The RDR register becomes the RDRHL register when 9-bit data length is selected.
Figure 27.28 Example flow of multi-processor serial reception with non-FIFO selected (2)
Note: When data length is 7 bits, 0 is always read for FRDRHL[8] and FRDRHL[7].
When data length is 8 bits, 0 is always read for FRDRHL[8].
FRDRHL[15] bit is read as an indefinite value.
Figure 27.29 Data format stored to FRDRH and FRDRL in multi-processor mode with FIFO selected
Figure 27.30 shows an example flow for multi-processor data reception with FIFO selected.
When the SCR.MPIE bit is set to 1, reading communication data is skipped until reception of communication data in
which the multi-processor bit is set to 1. When communication data in which the multi-processor bit is set to 1 is
received, the received data, MPB and associated errors are transferred to FRDRHL. The SCR.MPIE bit is automatically
cleared, and non multi-processor reception continues.
If a frame error occurs and the SSR_FIFO.FER flag is set to 1, the SCI continues data reception. The rest of the
operations are the same as in asynchronous mode with non-FIFO selected.
Set MPIE bit in SCR to 1 [2] [3] SCI status confirmation and reception and
comparison of ID:
SCI stores first data (MPB = 1), after which all
received data are stored in FRDRHL.
No
SCIn_RXI interrupt? [3] RDF is set to 1 and an SCIn_RXI interrupt
request is generated when the amount of
receive data which is equal to or greater than
Yes
the specified receive triggering number stored
in FRDRHL.
Read receive data and flags in FRDRHL*1 When the amount of data stored in the Receive
FIFO Data Register (FRDRHL) falls below the
specified receive triggering number and
Yes received data is equal to or greater than 1, and
FER flag = 1 or ORER flag = 1
no new data is received after the elapse of 15
ETUs from the last stop bit, SSR_FIFO.DR is
No set to 1. An SCIn_RXI Interrupt request is
generated when FCR.DRES bit is 0.
Read data in FRDRHL at the first SCIn_RXI
ID of receiving station itself? interrupt, and compare it with the ID of the
No receiving station itself.
If the ID does not match the ID of the receiving
Yes
Receive data is still station itself, read until the data with MPB = 1,
Yes in FRDRHL ? and compare the next ID. If the data does not
have MPB = 1 in FRDRHL, set MPIE to 1 again,
No and wait for another SCIn_RXI interrupt
request.
No
SCIn_RXI interrupt? [4]
[4] Data reception at an SCIn_RXI interrupt:
Read data in FRDRHL once in the SCIn_RXI
Yes interrupt routine.
Read receive data and flags in FRDRHL*1 [5] Receive error processing and break detection:
If a receive error occurs, an error is identified by
reading the ORER and FER flags in SSR_FIFO.
Yes
FER flag = 1 or ORER flag = 1? After performing the appropriate error
processing, be sure to set the
SSR_FIFO.ORER and SSR_FIFO.FER flags to
No 0. Reception cannot be resumed if the ORER
flag in SSR_FIFO is set to 1. When a framing
error occurs, a break can be detected by
reading the SPTR.RXDMON bit.
No
All data received? [5]
Error processing
Yes
(same as Figure 27.28)
End
Note 1. If FRDRH and FRDRL are used instead of FRDRHL, read in the order from FRDRH to FRDRL.
Figure 27.30 Example flow of serial reception in multi-processor mode with FIFO selected
LSB MSB
Serial data Bit 0 Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7
Figure 27.31 Data format in clock synchronous serial communications with LSB-first
27.5.1 Clock
Either an internal clock generated by the on-chip baud rate generator or an external synchronization clock input at the
SCKn pin can be selected based on the SCR.CKE[1:0] setting.
When the SCI operates on an internal clock, the synchronization clock is output from the SCKn pin. Eight
synchronization clock pulses are output in the transfer of one character. When no transfer is performed, the clock is held
high. However, when only data reception is performed while the CTS function is disabled, the synchronization clock
output starts when the SCR.RE bit is set to 1. The synchronization clock stops when it is held high*1 and when an
overrun error occurs, or when the SCR.RE bit is set to 0.
When only data reception occurs and the CTS function is enabled, the clock output does not start when the SCR.RE bit is
set to 1 and the CTSn_RTSn input is high. The synchronization clock output starts when the SCR.RE bit is set to 1 and
the CTSn_RTSn input is low. When the CTSn_RTSn input is high on completion of the frame reception, the
synchronization clock output stops when it goes high. If the CTSn_RTSn input continues to be low, the synchronization
clock stops when it goes high*1 and when an overrun error occurs, or when the SCR.RE bit is set to 0.
Note 1. The signal is held high when SPMR.CKPH = 0 and SPMR.CKPOL = 0, or when SPMR.CKPH = 1 and
SPMR.CKPOL = 1.
It is held low when SPMR.CKPH = 0 and SPMR.CKPOL = 1, or when SPMR.CKPH = 1 and SPMR.CKPOL = 0.
(a) Non-FIFO selected when all of the following conditions are satisfied
The value of the RE or TE bit in the SCR is 1
When serial communication is enabled
There is no received data available to be read when the SCR.RE bit is 1
Transmit data is written when the SCR.TE bit is 1 and SCR.CKE[1] bit is 0
Data is available for transmission in the TSR register when the SCR.TE bit is 1 and SCR.CKE[1] bit is 1
The ORER flag in SSR is 0.
(b) FIFO selected when all of the following conditions are satisfied
The value of the RE or TE bit in the SCR is 1
When serial communication is enabled
The amount of receive data written in FRDRHL is less than the specified CTSn_RTSn output triggering number
when SCR.RE = 1
Data that has not been transmitted is available in FTDRHL when the SCR.TE bit is 1 and SCR.CKE[1] bit is 0
Data is available for transmission in TSR when SCR.TE bit is 1 and SCR.CKE[1] bit is 1
The ORER flag in SSR_FIFO is 0.
[Conditions for high-level output]
Start initialization
Set the SCR.CKE[1:0] bits [ 2 ] [2] Set the clock selection in SCR.
Note: In simultaneous transmit and receive operations, the TE and RE bits in SCR must both be set to 0 or set to 1
simultaneously.
Figure 27.32 Example flow of SCI initialization in clock synchronous mode with non-FIFO selected
Start initialization
[1] Set the FCR.FM, TFRST, and RFRST bits to 1.
This enables FIFO mode and clears the FIFOs.
Set the SCR.TIE, RIE, TE, RE, and Set the trigger values in FCR.TTRG[3:0], RTRG[3:0], and
TEIE bits to 0 RSTRG[3:0] bits.
Set the data transmission/reception format in [6] Write the value obtained by correcting a bit rate error in
SMR, SCMR, and SEMR [4] MDDR. This step is not required if the BRME bit in SEMR is
set to 0 or an external clock is used.
Set a value in BRR [5] [7] Set the FCR.TFRST and RFRST bits to 0.
[8] Specify the I/O port settings to enable input and output
Set a value in MDDR [6] functions as required for the TXDn, RXDn, and SCKn pins.
[9] Set the SCR.TE or RE bit to 1. Also set the SCR.TIE and
RIE bits.
Set the FCR.TFRST and RFRST bits to 0 [7]
Setting the TE and RE bits allows TXDn and RXDn to be
used.
Initialization completion
Note: In simultaneous transmit and receive operations, the TE and RE bits in SCR should both be set to 0 or set to 1
simultaneously.
Figure 27.33 Example flow of SCI initialization in clock synchronous mode with FIFO selected
to be transmitted is written to the TDR from the handling routine for SCIn_TXI requests.
3. 8-bit data is sent from the TXDn pin in synchronization with the output clock when the clock output mode is
specified, and in synchronization with the input clock when the use of an external clock is specified. Output of the
clock signal is suspended until the input CTS signal is low and while the CTSE bit in SPMR is 1.
4. The SCI checks for update to the TDR on output of the last bit.
5. When TDR is updated, the next transmit data is transferred from TDR to TSR, and serial transmission of the next
frame starts.
6. If TDR is not updated, set the SSR.TEND flag to 1. The TXDn pin keeps the output state of the last bit. If the TEIE
bit in SCR is 1, an SCIn_TEI interrupt request is generated and the SCKn pin is held high.
Figure 27.34, Figure 27.35, and Figure 27.36 show example flows of serial data transmission.
Transmission does not start while a receive error flag (ORER, FER, or PER in SSR) is set to 1. Be sure to set the receive
error flags to 0 before starting transmission.
Note: Setting the SCR.RE bit to 0 does not clear the receive error flags.
Synchronization clock
SCR.TE bit
SSR.TEND flag
1 frame
Note 1. See section 13, Interrupt Controller Unit (ICU) for information on the associated interrupt event number.
Figure 27.34 Example of serial data transmission in clock synchronous mode when the CTS function is not
used at the beginning of transmission
CTSn_RTSn pin
Synchronization clock
SCR.TE bit
SSR.TEND flag
1 frame
Note 1. See section 13, Interrupt Controller Unit (ICU) for information on the associated interrupt event number.
Figure 27.35 Example of serial data transmission in clock synchronous mode when the CTS function is used
at the beginning of transmission
Synchronization
clock
SSR.TEND flag
SCIn_TXI Data written to TDR in SCIn_TXI Data written to TDR in SCIn_TXI SCIn_TEI
interrupt request SCIn_TXI interrupt interrupt interrupt handling routine interrupt request
generated handling routine request (Set the TIE bit to 0 and the TEIE generated
generated bit to 1 after writing the last data)
1 frame
Note 1. See section 13, Interrupt Controller Unit (ICU) for information on the associated interrupt event number.
Figure 27.36 Example of serial data transmission in clock synchronous mode from the middle of transmission
until transmission completion
No
SCIn_TEI Interrupt?
Yes
End
Note: When the external clock is in use (the value of the SCR.CKE[1:0] bits is 10b or 11b), the rising edge on the SCK pin for
the last bit sets the SSR.TEND flag to 1. Setting the SCR.TE bit to 0 immediately after this might lead to insufficient hold
time for received data on the receiver side.
Figure 27.37 Example flow of serial transmission in clock synchronous mode with non-FIFO selected
4. The SCI checks whether non-transmitted data remains in FTDRL on the output of the stop bit.
5. When FTDRL is updated, the next transmit data is transferred from FTDRL to TSR and serial transmission of the
next frame starts.
6. If FTDRL is not updated, the SSR_FIFO.TEND flag is set to 1. The TXDn pin keeps the output state of the last bit.
If the TEIE bit in SCR is 1, an SCIn_TEI interrupt request is generated and the SCKn pin is held high.
Note 1. In clock synchronous mode, FTDRH is not used.
Yes
End
Note: When the external clock is in use (the value of the SCR.CKE[1:0] bits is 10b or 11b), the rising edge on the SCK pin for
the last bit sets the SSR_FIFO.TEND flag to 1. Setting the SCR.TE bit to 0 immediately after this might lead to
insufficient hold time for received data on the receiver side.
Figure 27.38 Example flow of serial transmission in clock synchronous mode with FIFO selected
Synchronization
clock
SSR.ORER flag
1 frame
Note 1. See section 13, Interrupt Controller Unit (ICU) for information on the associated interrupt event number.
Figure 27.39 Example operation of serial reception in clock synchronous mode (1) when RTS function is not
used
Synchronization
clock
SSR.ORER flag
SCIn_RXI RDR data read in SCIn_RXI interrupt RDR data read in SCIn_RXI
interrupt request SCIn_RXI interrupt request generated interrupt handling routine
generated handling routine
CTSn_RTSn pin
1 frame
Note 1. See section 13, Interrupt Controller Unit (ICU) for information on the associated interrupt event number.
Figure 27.40 Example operation of serial reception in clock synchronous mode (2) when RTS function is used
Data transfer cannot resume while the receive error flag is 1. Therefore, clear the ORER, FER, and PER flags in SSR to
0 before resuming data reception. Additionally, be sure to read the RDR register during overrun error processing. When
a data reception is forcibly terminated by setting the SCR.RE bit to 0 during operation, read the RDR register because
received data that is not yet read might be left in the RDR register.
Figure 27.41 shows an example flow of serial data reception.
Yes
[3] [4] Read the receive data in RDR once in the receive
SSR.ORER = 1
data full interrupt (SCIn_RXI) request handling
routine.
No Error processing
[5] Serial reception continuation procedure:
(Continued below) To continue serial reception, before the MSB bit [7]
of the current frame is received, finish reading the
No receive data in RDR. The RDR data can also be
SCIn_RXI interrupt
read by activating the DTC by an SCIn_RXI
interrupt request.
Yes
[6] Processing in response to an overrun error:
Read the RDR. In combination with step [7], this
Read receive data in RDR [4] enables correct reception of the next frame
possible.
End
End
Figure 27.41 Example flow of serial reception in clock synchronous mode with non-FIFO selected
End
End
Note 1. ORER can also read from FRDRH.ORER. However, to clear the ORER flag, write 0 to the associated bit in the SSR_FIFO
register.
Note 2. All receive data is an integer multiple of the FIFO triggering number.
Figure 27.42 Example flow of serial reception in clock synchronous mode with FIFO selected
End
Note: When switching from transmit or receive operation to simultaneous transmit and receive operations, first set the TIE,
RIE, TE, RE, and TEIE bits in SCR to 0, then set TIE, RIE, TE, and RE bits to 1, simultaneously.
Figure 27.43 Example flow of simultaneous serial transmission and reception in clock synchronous mode with
non-FIFO selected
Note 1. ORER can also read from FRDRH.ORER. To clear the ORER flag, write 0 to SSR_FIFO.ORER.
Note 2. All receive data must be an integer multiple of the FIFO triggering number.
Figure 27.44 Example flow of simultaneous serial transmission and reception in clock synchronous mode with
FIFO selected
VCC VCC
TXDn
I/O
RXDn Data line
SCKn CLK
Clock line
Port RST
Reset line
IC card
Main unit of the device to
be connected
In normal transmission/reception
Ds D0 D1 D2 D3 D4 D5 D6 D7 Dp
Ds D0 D1 D2 D3 D4 D5 D6 D7 Dp DE
Ds D0 D1 D2 D3 D4 D5 D6 D7 Dp
Figure 27.47 Direct convention with SDIR in SCMR = 0, SINV in SCMR = 0, and PM in SMR_SMCI = 0
Ds D7 D6 D5 D4 D3 D2 D1 D0 Dp
Figure 27.48 Inverse convention with SDIR in SCMR = 1, SINV in SCMR = 1, and PM in SMR_SMCI = 1
1 D - 0.5
M = (0.5 - ) - (L - 0.5) F - (1 + F) × 100 [%]
2N N
Assuming values of F = 0, D = 0.5, and N = 372 in the specified formula, the reception margin is determined by the
following formula:
M = {0.5 - 1 / (2 × 372)} × 100 [%] = 49.866%
Base clock
Synchronization sampling
timing
Figure 27.49 Receive data sampling timing in smart card interface mode when clock frequency is 372 times the
bit rate
Start initialization
Set SPMR.CKPH, CKPOL [4] [ 4 ] Set the transmission or reception format in SPMR.
Set SMR_SMCI.GM, BLK, PM, BCP[1:0], [ 5 ] Set the operation mode and the transmission or
[5]
CKS[1:0], and set SMR_SMCI.PE to 1 reception format in SMR_SMCI.
Set SCMR.BCP2, SDIR, SINV [ 6 ] Set the transmission or reception format in SCMR.
[6]
Set the I/O port functions [9] [ 10 ] Set the SCR_SMCI.CKE[1:0]. Although the function
depends on SMR_SMCI.GM, when the CKE[0] bit is
set to 1, the clock is output from the SCKn pin.
Set a value in SCR_SMCI.CKE[1:0] [ 10 ]
[ 11 ] Set the TE or RE bit in SCR_SMCI to 1, then set the
TIE and RIE bits in SCR_SMCI. Do not simultaneously
Set SCR_SCMI.TE or RE to 1, and [ 11 ] set the TE and RE bits to 1 if self-diagnosis is not used.
set SCR_SMCI.TIE, RIE
Initialization completed
Figure 27.50 Example flow of SCI initialization in smart card interface mode
Figure 27.51 shows a timing diagram when data transmission is performed by transitioning to smart card interface mode
according to the flow in Figure 27.50. Figure 27.51 shows when the GM bit in SMR_SMCI is set to 0. The timing in
Figure 27.51 shows when the port is connected as SCKn pin and TXDn pin, the pins are Hi-Z because CKE[0] bit in
SCR_SMCI is 0.
Start the clock output to the SCK pin by setting CKE[0] bit in SCR_SMCI to 1, then start data transmission by writing
transmit data after setting TE bit in SCR_SMCI to 1. When the TE bit in SCR_SMCI changes from 0 to 1, there is a
preamble period for one frame before data transmission starts. In smart card interface mode, the TXDn pin is Hi-Z during
the preamble period. Pull-up or pull-down for the SCKn and TXDn pins is required outside the MCU.
In the smart card interface mode, even when the TE and RE bits in SCR_SMCI are 0, the clock is continuously output if
the clock output setting is used.
SCKn
Hi-Z
SCR.TE
Preamble period Data transfer
TXDn Ds D0 D1
Hi-Z
Figure 27.51 Example timing of data transmission in smart card interface mode
(n + 1)th transfer
nth transfer frame Retransfer frame frame
(DE)
Ds D0 D1 D2 D3 D4 D5 D6 D7 Dp DE Ds D0 D1 D2 D3 D4 D5 D6 D7 Dp Ds D0 D1 D2 D3 D4
[2] [4]
SSR_SMCI.ERS flag
[1] [3]
Figure 27.52 Data retransfer operation in smart card interface transmission mode
Note: The SSR_SMCI.TEND flag is set at different timings depending on the SMR_SMCI.GM bit setting.
I/O data Ds D0 D1 D2 D3 D4 D5 D6 D7 Dp DE
11.0 ETU
When GM bit in SMR_SMCI = 1
Start
Initialization
No
SSR_SMCI.ERS flag = 0?
Yes
Error processing
No
SCIn_TXI interrupt?
Yes
No
Write all transmit data?
Yes
No
SSR_SMCI.ERS flag = 0?
Yes
Error processing
No
SCIn_TXI interrupt?
Yes
End
In reception, setting the RIE bit to 1 allows an SCIn_RXI interrupt request to be generated. The DTC is activated by an
SCIn_RXI interrupt request if the SCIn_RXI interrupt request is previously specified as a source of DTC activation,
allowing the transfer of receive data.
If an error occurs during reception and either the ORER or PER flag in SSR_SMCI is set to 1, a receive error interrupt
(SCIn_ERI) request is generated. Clear the error flag after the error occurrence. If an error occurs, the DTC is not
activated and receive data is skipped. Therefore, the number of bytes of receive data specified in the DTC is transferred.
If a parity error occurs and the PER flag is set to 1 during reception, the receive data is transferred to RDR, therefore
allowing the data to be read.
When a reception is forced to terminate by setting the SCR_SMCI.RE bit to 0 during operation, read the RDR register
because the received data that is not yet read might be left in the RDR.
Note: For operations in block transfer mode, see section 27.3.9, Serial Data Reception in Asynchronous Mode.
(n + 1)th transfer
nth transfer frame Retransfer frame frame
Ds D0 D1 D2 D3 D4 D5 D6 D7 Dp DE Ds D0 D1 D2 D3 D4 D5 D6 D7 Dp Ds D0 D1 D2 D3 D4
[2] [4]
SSR_SMCI.PER flag
[1] [3]
Figure 27.55 Data retransfer operation in smart card interface reception mode
Start
Initialization
No
SSR_SMCI.ORER = 0 and
SSR_SMCI.PER = 0
Yes
Error processing
No
SCIn_RXI interrupt
Yes
No
All data received
Yes
Set bits RIE and RE
in SCR_SMCI to 0
End
Base clock
CKE[0]
When GM = 0
SCK
When GM = 1
1 7 1 1 8 1 1 1
1 7 1 1 8 1 1 1
n (n = 1 or larger)
10-bit address format transmission
11110b + SLA
S (2 bits) W# A SLA (8 bits) A DATA (8 bits) A A/A# P
1 7 1 1 8 1 8 1 1 1
n (n = 1 or larger)
10-bit address format reception
11110b + SLA 11110b + SLA
S (2 bits) W# A SLA (8 bits) A Sr (2 bits) R A DATA (8 bits) A A# P
1 7 1 1 8 1 1 7 1 1 8 1 1 1
n (n = 1 or larger)
MSB LSB
SDAn D7 to D1 D0 D7 to D1 D0 D7 to D1 D0
SCLn 1 to 7 8 9 1 to 7 8 9 1 to 7 8 9
The level on the SCLn line falls (from high level to low level), the IICSTAREQ bit in SIMR3 is set to 0, and a start-
condition generated interrupt is output.
Writing 1 to the IICRSTAREQ bit in SIMR3 causes the generation of a restart condition. The generation of a restart
condition proceeds through the following operations:
The SDAn line is released and the SCLn line is kept at a low level
The period at low level for the SCLn line is set as half of a bit period at the bit rate determined by the BRR setting
The SCLn line is released (transition from low level to high level)
When a high level is detected on the SCLn line, the setup time for the restart condition is set as half of a bit period at
the bit rate determined by the BRR setting
The level on the SDAn line falls (from high level to low level)
The hold time for the restart condition is set as half of a bit period at the bit rate determined by the BRR setting
The level on the SCLn line falls (from high level to low level), the IICRSTAREQ bit in SIMR3 is set to 0, and a
restart-condition generated interrupt is output.
Writing 1 to the IICSTPREQ bit in SIMR3 causes the generation of a stop condition. The generation of a stop condition
proceeds through the following operations:
The level on the SDAn line falls (from high level to low level) and the SCLn line is kept at a low level
The period at a low level for the SCLn line is set as half of a bit period at the bit rate determined by the BRR setting
The SCLn line is released (transition from low level to high level)
When a high level is detected on the SCLn line, the setup time for the stop condition is set as half of a bit period at
the bit rate determined by the BRR setting
The SDAn is released (transition from low to high level), the IICSTPREQ bit in SIMR3 is set to 0, and a stop-
condition generated interrupt is output.
Figure 27.60 shows the timing of operations in the generation of start, restart, and stop conditions.
SCLn
SDAn
SIMR3.IICSTAREQ
SIMR3.IICRSTAREQ
SIMR3.IICSTPREQ
SIMR3.IICSDAS[1:0]
11b 01b 00b 01b 00b 01b 11b
SIMR3.IICSCLS[1:0]
Figure 27.60 Timing of operations to generate start, restart, and stop conditions
SCLn line
Counting is stopped until the SCLn Counting is stopped while the SCLn
line being at the high level is seen in line is at the low level
the SCI
[1] Set the I/O ports to allow use (on N-channel open-drain
Start of initialization output pins) of the SCLn and SDAn pin functions.
[4] Write the value for the targeted bit rate to BRR.
Set up the transfer or reception format in [3]
SMR and SCMR
[5] Write the value obtained by correcting a bit rate error in
MDDR. This step is not required if the BRME bit in
Set the value in BRR [4] SEMR is cleared to 0.
[7] Set the RE and TE bits in the SCR to 1. Then, set the
Start of transmission or reception
SCR.TIE, RIE, and TEIE bits (for transmission and
when the SIMR2.IICINTM bit is 1, set the RIE bit to 0).
Setting the TE and RE bits to 1 enables the SCLn and
SDAn pin functions.
SCLn
Reception of ACK
Note 1. See section 13, Interrupt Controller Unit (ICU) for information on the associated interrupt event number.
Figure 27.64 Example 1 operation for master transmission in simple IIC mode with 7-bit slave addresses,
transmission interrupts, and reception interrupts
When the SIMR2.IICINTM bit is set to 0, using ACK/NACK interrupts during master transmission, the DTC is activated
by the ACK interrupt as the trigger and the required number of data bytes are transmitted. When a NACK is received,
error processing, such as transmission stop and retransmission, is performed using the NACK interrupt as the trigger.
SCLn
Generation of SCIn_TXI
Acceptance of SCIn_TXI
SCIn_RXI interrupt flag interrupt request
interrupt request
(IELSRn.IR*1)
Generation of SCIn_RXI Acceptance of SCIn_RXI
STI interrupt flag
interrupt request interrupt request
(IELSRn.IR*1)
Note 1. See section 13, Interrupt Controller Unit (ICU) for information on the associated interrupt event number.
Figure 27.65 Example 2 operation for master transmission in simple IIC mode with 7-bit slave addresses, ACK
interrupts, and NACK interrupts
No
STI interrupt?
Yes
Write the slave address and value for the [ 4 ] Confirming ACK response from the slave device:
[3]
R/W bit in TDR Check the SISR.IICACKR bit. If SISR.IICACKR is 0, it
indicates that the slave device responded with ACK and
operations proceed. If SISR.IICACKR is 1, it indicates that
there was no response from the slave device so the next
No
SCIn_TXI interrupt? transition is to generate a stop condition.
Yes
No
SCIn_TXI interrupt?
Yes
[ 5 ] Continuing with serial transmission:
No
All data transmitted? [5] When transmission is to continue, write additional
transmit data to TDR. Except for the first data to be
Yes transmitted, a TXI interrupt request can activate
the DTC to handle writing of data to TDR.
No
STI interrupt?
Yes
End
Note: In simple IIC mode, the SCIn_TXI interrupt is generated when communication completes.
Figure 27.66 Example procedure for master transmission in simple IIC mode with transmission interrupts and
reception interrupts
Start
condition Slave address (7 bits) R Received data Stop condition
SCLn
SCIn_TXI interrupt flag SCIn_RXI is assumed to have been disabled Generation of SCIn_RXI interrupt request
(IELSRn.IR*1) by setting SCR.RIE = 0.
Note 1. See section 13, Interrupt Controller Unit (ICU) for information on the associated interrupt event number.
Figure 27.67 Example operation for master reception in simple IIC mode with 7-bit slave addresses,
transmission interrupts, and reception interrupts
No
SISR.IICACKR = 0? [4] [ 7 ] Generation of a stop condition.
Yes
Set SIMR2.IICACKT to 0.
Set SCR.RIE to 1.
Yes
Next data is the last?
[5]
No Set SIMR2.IICACKT to 1 [6]
Write FFh as dummy data to TDR
Write FFh as dummy data to TDR
No
SCIn_RXI interrupt?
No
SCIn_RXI interrupt?
Yes
Yes
Read received data from RDR
Read received data from RDR
No
SCIn_TXI interrupt? No
SCIn_TXI interrupt?
Yes
Yes
No
STI interrupt?
Yes
End
Note: In simple IIC mode, the TXI interrupt request is generated when communication is complete.
Figure 27.68 Example flow of master reception in simple IIC mode with transmission interrupts and reception
interrupts
MOSIn (output)
Device 3 (slave)
SSn (input)
SCKn (input)
MISOn (output)
MOSIn (input)
Note 1. The SSn input is not required in a single-master system (the interface is used with
the setting SPMR.SSE = 0).
Figure 27.69 Example connections using simple SPI mode in single master mode with SPMR.SSE = 0
Table 27.25 Pin states by mode and input level on the SSn pin
Mode Input on SSn pin State of TXDn pin State of RXDn pin State of SCKn pin
Master mode*1 High Output for data Input for received data Clock output*3
(transfer can proceed) transmission*2
Low High-impedance Input for received data High-impedance
(transfer cannot proceed) (but disabled)
Slave mode High Input for received data High-impedance Clock input
(transfer cannot proceed) (but disabled) (but disabled)
Low Input for received data Output for data Clock input
(transfer can proceed) transmission
Note 1. When there is only a single master (SPMR.SSE = 0), transfer is possible regardless of the input level on the SSn
pin. This is equivalent to the input of a high level on the SSn pin. Because the SSn pin function is not required,
the pin is available for other purposes.
Note 2. The MOSIn pin output is in a high-impedance state when serial transmission is disabled (SCR.TE = 0).
Note 3. The SCKn pin output is in a high-impedance state when serial transmission is disabled (SCR.TE and RE = 00b)
in a multi-master configuration (SPMR.SSE = 1).
SSn pin
(slave)
SCKn pin
(CKPOL = 0)
SCKn pin
(CKPOL = 1)
MOSIn pin Bit 0 Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7
MISOn pin Bit 0 Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7
SSn pin
(slave)
SCKn pin
(CKPOL = 0)
SCKn pin
(CKPOL = 1)
MOSIn pin Bit 0 Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7
MISOn pin Bit 0 Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7
Figure 27.70 Relation between clock signal and transmit or receive data in simple SPI mode
Changing the value of the TE bit from 1 to 0 or from 0 to 1 when the TIE bit in the SCR register is 1 at the same time,
leads to the generation of a transmit data empty interrupt (SCIn_TXI).
Do not use this function in clock synchronous mode and in the highest speed settings in simple SPI mode
(SMR.CKS[1:0] = 00b, SCR.CKE[1] = 0, and BRR = 0).
Internal clock
(bit rate counter input)
160 clocks among 256 clocks are evenly enabled (96 clocks are disabled) by setting MDDR
Internal clock
(bit rate counter input)
This figure shows an example when 1-bit interval is corrected to 52/32 (1-bit interval is evenly corrected to 256/160)
(b) The bit rate is corrected (160/256) using the bit rate modulation function
Figure 27.71 Example of internal base clock using bit rate modulation function
27.10.1 Buffer Operations for SCIn_TXI and SCIn_RXI Interrupts (non-FIFO selected)
If the conditions for an SCIn_TXI and SCIn_RXI interrupt are satisfied while the interrupt status flag in the ICU is 1, the
ICU does not output the interrupt request but saves it internally, with a capacity for saving one request per source.
When the interrupt status flag in the ICU becomes 0, the interrupt request retained within the ICU is output. The
internally retained interrupt request is automatically discarded when the actual interrupt is output. Clearing of the
associated interrupt enable bit (the TIE or RIE bit in the SCR/SCR_SMCI) can also be used to discard an internally
retained interrupt request.
27.10.2 Buffer Operations for SCIn_TXI and SCIn_RXI Interrupts (FIFO selected)
When an interrupt status flag in the ICU is set to 1, the SCIn_TXI and SCIn_RXI interrupts do not output interrupt
requests to the ICU. When an interrupt status flag of the ICU is set to 0, and if the conditions for SCIn_TXI and
SCIn_RXI interrupts are satisfied, an interrupt request is generated.
An SCIn_TXI interrupt request is not generated by setting SCR.TE to 1 when SCR.TIE is 0 or by setting SCR.TIE to 1
when SCR.TE is 1.*2
When new data is not written by the time of transmission of the last bit of the current transmit data and SCR.TEIE is 1,
the SSR.TEND flag becomes 1 and an SCIn_TEI interrupt request is generated. Additionally, when SCR.TE is 1, the
SSR.TEND flag saves the value 1 until additional transmit data are written to the TDR or TDRHL register*1, and setting
the SCR.TEIE bit to 1 leads to the generation of an SCIn_TEI interrupt request.
Writing data to the TDR or TDRHL register*1 leads to clearing of the SSR.TEND flag and, after a certain time,
discarding of the SCIn_TEI interrupt request.
If the SCR.RIE bit is 1, an SCIn_RXI interrupt request is generated when received data is stored in the RDR. An
SCIn_RXI interrupt request can activate the DTC to handle data transfer.
Setting any of the ORER, FER, and PER flags in the SSR to 1 when the SCR.RIE bit is 1 leads to the generation of an
SCIn_ERI interrupt request. An SCIn_RXI interrupt request is not generated at this time. Clearing all three flags (ORER,
FER, and PER) leads to discarding of the SCIn_ERI interrupt request.
Note 1. When asynchronous mode and 9-bit data length are selected.
Note 2. To temporarily prohibit SCIn_TXI interrupts on transmission of the last of the data when a new round of
transmission is to be started, after handling the transmission-completed interrupt, control activation of the
interrupt by using the Interrupt Request Enable bit in the ICU rather than using the SCR.TIE bit. This approach
can prevent the suppression of SCIn_TXI interrupt requests in the transfer of new data.
Note 1. The interrupt flag is only ORER when in clock synchronous mode and simple SPI mode.
Note 1. The interrupt flag is only ORER when in clock synchronous mode and simple SPI mode.
Data transmission or reception using the DTC is also possible in smart card interface mode. In transmission, when the
SSR_SMCI.TEND flag is set to 1, an SCIn_TXI interrupt request is generated. The SCIn_TXI interrupt request activates
the DTC allowing the transfer of transmit data if the SCIn_TXI request is previously specified as a source of DTC
activation. The TEND flag is automatically set to 0 when the DTC transfers the data.
If an error occurs, the SCI automatically retransmits the same data. During the retransmission, the TEND flag is kept at 0
and the DTC is not activated. Therefore, the SCI and DTC automatically transmit the specified number of bytes,
including retransmission when errors occur. However, the SSR_SMCI.ERS flag is not automatically cleared to 0 at error
occurrence. Therefore, the ERS flag must be cleared by previously setting the SCR_SMCI.RIE bit to 1 to enable an
SCIn_ERI interrupt request to be generated at error occurrence.
When transmitting or receiving data using the DTC, always enable the DTC before setting the SCI. For DTC settings, see
section 16, Data Transfer Controller (DTC).
In reception, an SCIn_RXI interrupt request is generated when receive data is set to RDR. The SCIn_RXI interrupt
request activates the DTC allowing the transfer of receive data if the SCIn_RXI request is previously specified as a
source of DTC activation. If an error occurs, the error flag is set. Therefore, the DTC is not activated and an SCIn_ERI
interrupt request is issued to the CPU instead. The error flag must be cleared.
Note: Activation of the DTC is only possible when the SIMR2.IICINTM bit is 1 (use reception and transmission
interrupts).
TXDn/SDAn,
RXDn/SCLn
Internal signal
Mismatch
Match D Q
CLK
cmp
TXDn/SDAn,
RXDn/SCLn
inputs D Q D Q
(2) Reception
Start of transmission
No [2] Set the I/O port function and SPTR register settings
SSR/SSR_FIFO/SSR_SMCI.TEND = 1?
to switch the TXDn pin to operate as a general I/O
port.
Yes
[3] Set SCR/SCR_SMCI.TE bit to 0. If SCR/
Set the I/O port function and the SPTR register [2] SCR_SMCI.TIE = 1 and SCR/SCR_SMCI.TEIE = 1,
these are set to 0 simultaneously with the SCR.TE
bit.
SCR/SCR_SMCI.TE bit = 0 [3]
[4] This includes the setting for the module-stop state.
No
Change operating mode?
Initialization
SCR/SCR_SMCI.TE bit = 1
Figure 27.73 Example flow of transition to Software Standby mode during transmission
Transition to
Software Standby Software Standby mode
mode canceled
SPTR.SPB2IO bit
SCR/SCR_SMCI.TE bit
The level at transition to
Software Standby mode is
retained
TXDn output pin Port input/output High output Stop The level before transition to
Software Standby mode is output
Port SCI TXDn output
The TXDn pin status when
TE = 0, can be controlled by
The TXDn output pin state the SPTR register
(low or high level) after
SPTR.SPB2DT bit set value
PmnPFS.PMR bit setting is
set in the SPTR register
Figure 27.74 Port pin states during transition to Software Standby mode with internal clock and
asynchronous transmission
SCR/SCR_SMCI.TE bit
TXDn output pin Port input/output Last TXDn bit retained Port input/output The level before transition to
Marking output Software Standby mode is output
Figure 27.75 Port pin states during transition to Software Standby mode with internal clock and clock
synchronous transmission
Data reception
No [1]
SCIn_RXI interrupt? [ 1 ] Received data is invalid
Yes
SCR/SCR_SMCI.RE = 0
No
Change operating mode?
Yes
Initialization SCR/SCR_SMCI.RE = 1
Figure 27.76 Example flow of transition to Software Standby mode during reception
Data reception
No [1]
SCIn_RXI interrupt? [ 1 ] Received data is invalid
Yes
SCR/SCR_SMCI.RE = 0
DCCR.DCME = 1
SCR/SCR_SMCI.RE = 1
No
Change operating mode?
Yes
Initialization
Figure 27.77 Example flow of transition to Software Standby mode during reception with address match
27.14.5 Receive Error Flags and Transmit Operations in Clock Synchronous and Simple
SPI Modes
Transmission cannot start when a receive error flag (ORER) in SSR/SSR_FIFO is set to 1, even when data is written to
TDR or FTDRL*1. Be sure to set the receive error flags to 0 before starting transmission.
Note: The receive error flags cannot be set to 0 if serial reception is disabled by setting the RE bit in SCR/SCR_SMCI
to 0.
Note 1. Do not use the FTDRH register in simple SPI mode.
Set t 1 PCLKB cycle + data output delay time for the slave (tDO) + setup time for the master (tSU)
Update TDR before bit [7] (D7) starts to transmit when continuous
transmission is performed on the external clock
Synchronous clock
(external clock)
t
Set t 4 cycles of the PCLKB if TDR is updated after bit [7] (D7) starts to transmit when continuous transmission is
performed on the external clock
t
Synchronous clock
(external clock)
Note 1. See section 13, Interrupt Controller Unit (ICU) for information on the corresponding interrupt event number.
Figure 27.78 Restrictions on the use of external clock in clock synchronous transmission
27.14.9 External Clock Input in Clock Synchronous Mode and Simple SPI Mode
In clock synchronous mode and simple SPI mode, the external clock (SCKn) must be input as follows:
High-pulse period, low-pulse period = 2 PCLKB cycles or more, period = 6 PCLKB cycles or more.
SCKn
(CKPOL = 0)
SCKn
(CKPOL = 1)
SCIn_RXI interrupt
source
Figure 27.79 Timing of SCIn_RXI interrupt in simple SPI mode with clock delay
Also wait at least 5 PCLKB cycles from the input of the low level on the SSn pin to the start of the external clock
input.
Provide an external clock signal to the master for the data length for transfer
Control the input on the SSn pin before the start and after the end of data transfer
When the input level on the SSn pin changes from low to high while a character is being transferred, set the TE and
RE bits in the SCR to 0 and, after restoring the settings, restart transfer of the first byte.
27.14.12 Note on Stopping Reception When Using the RTS Function in Asynchronous
Mode
One clock cycle of PCLK is required for the time from setting the SCR.RE bit to 0 to stopping the RTS signal generator
in asynchronous mode.
When reading the RDR (or RDRHL) register after setting the SCR.RE bit to 0, confirm that the SCR.RE bit has been set
to 0 before reading the RDR (or RDRHL) register to prevent these two processes form being performed consecutively.
Note 1. This function is only available for IIC channel IIC0. IIC1 is not supported.
PCLKB
CKS[2:0]
PS
ICMR1
BC[2:0]
IIC (PCLKB/1 to PCLKB/128)
Output
SCLn control Transfer clock ICBRH
generator ICBRL
CLO SCLE
Noise SCLI
canceller
SCLn, SDAn ICCR1
NF[1:0] NFE
IICRST
Transmission/ SDAI
reception control ST, RS, SP
circuit ICCR2
DLCS
PS BBSY, MST, TRS
WAIT, RDRFS
ICFER
IIC, IIC/2
SDDL[2:0]
SDA output delay control ICMR2
SARU0 SARL0
TMOF
Timeout circuit
ICIER
Event output
Interrupt request
Interrupt generator (IICn_TXI, IICn_TEI, IICn_RXI,
IICn_EEI, IIC0_WUI)
SCL SCL
SCLin
SCLout#
SDA SDA
SDAin
SDAout#
SDA
SDA
SCL
SCL
(Master) SCLin SCLin
SCLout# SCLout#
SDAin SDAin
SDAout# SDAout#
(Slave 1) (Slave 2)
Figure 28.2 I/O pin connection to the external circuit (I2C bus configuration example)
The input level of the signals for IIC is CMOS when I2C bus is selected (ICMR3.SMBS = 0), or TTL when SMBus is
selected (ICMR3.SMBS = 1).
b7 b6 b5 b4 b3 b2 b1 b0
SDAO bit (SDA Output Control/Monitor) and SCLO bit (SCL Output Control/Monitor)
The SDAO and SCLO bits directly control the SDAn and SCLn signals output from the IIC.
When writing to these bits, also write 0 to the SOWP bit. Setting these bits results in input to the IIC by the input buffer.
When slave mode is selected, a start condition might be detected and the bus might be released, depending on the bit
settings.
Do not rewrite these bits during a start condition, stop condition, restart condition, or during transmission or reception.
Operation after rewriting under the specified conditions is not guaranteed. When reading these bits, the state of signals
output from the IIC can be read.
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. The MST and TRS bits can be written to when the ICMR1.MTWP bit is set to 1.
Note: Only set the ST bit to 1 (start condition request) when the BBSY flag is set to 0 (bus free state). Arbitration might
be lost if the ST bit is set to 1 when the BBSY flag is 1 (bus busy state).
[Clearing conditions]
When 0 is written to the RS bit
When a restart condition is issued (a start condition is detected)
When the AL (arbitration-lost) flag in ICSR2 is set to 1
When 1 is written to the IICRST bit in ICCR1 to apply an IIC reset or an internal reset.
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. Rewrite the BC[2:0] bits and set the BCWP bit to 0 at the same time.
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. The setting DLCS = 1 (IIC/2) is only valid when SCL is low. When SCL is high, the DLCS = 1 setting is invalid
and the clock source becomes the internal reference clock (IIC).
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. Write to the ACKBT bit only when the ACKWP bit is 1. If software writes 1 to both the ACKWP and ACKBT bits at
the same time, the ACKBT bit is not set to 1.
Note 2. The WAIT and RDRFS bits are valid only in receive mode (invalid in transmit mode).
Note: Set the noise range to be filtered out by the noise filter within a range less than the SCLn line high-level period or
low-level period. If the noise range is set to a value of [SCL clock width: high-level period or low-level period,
whichever is shorter] - [1.5 internal reference clock (IIC) cycles + analog noise filter: 120 ns (reference values)]
or more, the SCL clock is regarded as noise by the noise filter function of the IIC, which might prevent the IIC
from operating normally.
read each time a single-byte data is received. This enables receive operation in byte units.
Note: When the value of the WAIT bit is to be read, be sure to read the ICDRR register first.
b7 b6 b5 b4 b3 b2 b1 b0
b7 b6 b5 b4 b3 b2 b1 b0
b7 b6 b5 b4 b3 b2 b1 b0
b7 b6 b5 b4 b3 b2 b1 b0
b7 b6 b5 b4 b3 b2 b1 b0
When a start condition is detected while the ST bit in ICCR2 is 1 (start condition requested) or the internal SDA
output state does not match the SDAn line level
When the ST bit in ICCR2 is 1 (start condition issue requested), with the BBSY flag in ICCR2 set to 1.
When NACK arbitration-lost detection is enabled (ICFER.NALE = 1):
When the internal SDA output state does not match the SDAn line level on the rising edge of the SCL clock in the
ACK period during NACK transmission in receive mode.
When slave arbitration-lost detection is enabled (ICFER.SALE = 1):
When the internal SDA output state does not match the SDAn line level on the rising edge of the SCL clock, except
for the ACK period during data transmission in slave transmit mode.
[Clearing conditions]
When 0 is written to the AL flag after reading AL = 1
When 1 is written to the IICRST bit in ICCR1 to initiate an IIC reset or an internal reset.
Table 28.4 Relationship between arbitration-lost generation sources and arbitration-lost enable functions
ICFER ICSR2
MALE NALE SALE AL Error Arbitration-lost generation source
1 x x 1 Start condition When internal SDA output state does not match SDAn line level when a
issuance error start condition is detected while the ST bit in ICCR2 is 1
When ST in ICCR2 is set to 1 and BBSY in ICCR2 is 1
1 Transmit data When transmit data including slave address does not match the bus state
mismatch in master transmit mode
x 1 x 1 NACK When ACK is detected during transmission of NACK in master or slave
transmission receive mode
mismatch
x x 1 1 Transmit data When transmit data does not match the bus state in slave transmit mode
mismatch
x: Don’t care
When 1 is written to the IICRST bit in ICCR1 to initiate an IIC reset or an internal reset.
Note: When the NACKF flag is set to 1 while the NACKE bit in ICFER is 1, the IIC suspends data transmission or
reception. In this case, if the TDRE flag is 0 (next transmit data written), data is transferred to the ICDRS register
and the ICDRT register becomes empty on the rising edge of the 9th clock cycle, but the TDRE flag is not set to 1.
b7 b6 b5 b4 b3 b2 b1 b0
b7 b6 b5 b4 b3 b2 b1 b0
When 1 is written to the WUSEN bit after detecting a wakeup event with ICWUR.WUE bit set to 1 and WUSYF
flag set to 0
When a stop condition is detected with the WUSEN bit set to 1, before detecting a wakeup event with the WUSYF
flag set to 0 and the ICWUR.WUE bit set to 1
When ICCR1.ICE is 0 and IICRST is 1 (IIC reset)
When ICWUR.WUE is 0.
[Clearing condition]
When the ICCR2.BBSY flag is 0 with the ICWUR.WUE bit set to 1, after writing 0 to the WUSEN bit.
b7 b6 b5 b4 b3 b2 b1 b0
SVA[6:0] SVA0
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — SVA[1:0] FS
b7 b6 b5 b4 b3 b2 b1 b0
— — — BRL[4:0]
ICBRL is a 5-bit register that sets the low-level period of the SCL clock. ICBRL also generates the data setup time for
automatic SCL low-hold operation, see section 28.9, Automatic Low-Hold Function for SCL.
b7 b6 b5 b4 b3 b2 b1 b0
— — — BRH[4:0]
ICBRH is a 5-bit register that sets the high-level period of the SCL clock. ICBRH is valid in master mode.
Table 28.6 Example of ICBRH/ICBRL settings for transfer rate when SCLE = 0
Transfer rate (kbps) CKS[2:0] BRH[4:0] BRL[4:0] PCLKB[MHz] NF[1:0] Computation expression
100 011 15 (EFh) 18 (F2h) 32 — 1)
400 001 9 (E9h) 20 (F4h) 32 — 1)
Note: SCLn line rising time (tr): 100 kbps or less, [Sm]: 1000 ns, 400 kbps or less, [Fm]: 300 ns.
SCLn line falling time (tf): 400 kbps or less, [Sm/Fm]: 300 ns.
Table 28.7 Example of ICBRH/ICBRL settings for transfer rate when SCLE = 1 and NFE = 0
Transfer rate (kbps) CKS[2:0] BRH[4:0] BRL[4:0] PCLKB[MHz] NF[1:0] Computation expression
100 011 14 (EEh) 17 (F1h) 32 — 4)
400 001 8 (E8h) 19 (F3h) 32 — 4)
Note: SCLn line rising time (tr): 100 kbps; Sm: 1000 ns, 400 kbps; Fm: 300 ns
SCLn line falling time (tf): 400 kbps; Sm/Fm: 300 ns
Table 28.8 Example of ICBRH/ICBRL settings for transfer rate when SCLE = 1 and NFE = 1
Transfer rate (kbps) CKS[2:0] BRH[4:0] BRL[4:0] PCLKB[MHz] NF[1:0] Computation expression
100 011 12 (ECh) 15 (EFh) 32 01b 5)
400 001 6 (E6h) 17 (F1h) 32 01b 5)
Note: SCLn line rising time (tr): 100 kbps; Sm: 1000 ns, 400 kbps; Fm: 300 ns.
SCLn line falling time (tf): 400 kbps; Sm/Fm: 300 ns.
b7 b6 b5 b4 b3 b2 b1 b0
When ICDRT detects a space in the I2C-Bus Shift Register (ICDRS), it transfers the transmit data that was written to
ICDRT to ICDRS and starts transmitting data in transmit mode.
The double-buffer structure of ICDRT and ICDRS allows continuous transmit operation if the next transmit data is
written to ICDRT while the ICDRS data is being transmitted.
ICDRT can always be read and written to. Write transmit data to ICDRT once when a transmit data empty interrupt
(IICn_TXI) request is generated.
b7 b6 b5 b4 b3 b2 b1 b0
When 1 byte of data is received, the received data is transferred from the I2C Bus Shift Register (ICDRS) to ICDRR to
enable the next data to be received.
The double-buffer structure of ICDRS and ICDRR allows continuous receive operation if the received data is read from
ICDRR while ICDRS is receiving data. ICDRR cannot be written to. Read data from ICDRR when a receive data full
interrupt (IICn_RXI) request is generated.
If ICDRR receives the next receive data before the current data is read from ICDRR while the RDRF flag in ICSR2 is 1,
the IIC automatically holds the SCL low for 1 clock cycle before the RDRF flag is set to 1 again.
b7 b6 b5 b4 b3 b2 b1 b0
28.3 Operation
1 7 1 1 8 1 1 1
n (n = 1 or more)
1 7 1 1 8 1 8 1 1 1
n (n = 1 or more)
S 11110b + SLA (2 bits) W# A SLA (8 bits) A Sr 11110b + SLA (2 bits) R A DATA (8 bits) A A/A# P
1 7 1 1 8 1 1 7 1 1 8 1 1 1
n (n = 1 or more)
n: Number of transfer frames
SCLn 1 to 7 8 9 1 to 7 8 9 1 to 7 8 9
SDAn
S: Start condition. The master device drives the SDAn line low from high while the SCLn line is high.
SLA: Slave address, by which the master device selects a slave device
R/W#: Indicates the direction of data transfer: from the slave device to the master device when R/W# is 1, or from the master device
to the slave device when R/W# is 0
A: Acknowledge. The receive device drives the SDAn line low. In master transmit mode, the slave device returns acknowledge.
In master receive mode, the master device returns acknowledge.
A#: Not Acknowledge. The receive device drives the SDAn line high.
Sr: Restart condition. The master device drives the SDAn line low from high after the setup time elapses with the SCLn line high.
DATA: Transmitted or received data
P: Stop condition. The master device drives the SDAn line high from low when the SCLn line is high.
Initial settings
End
y = 0 to 2
Note 1. When the IIC is used only in slave mode, set the ICBRL register to a value longer than
the data setup time.
Note 2. Set these registers as required.
master transmit mode. If the ICSR2.NACKF flag is 1, indicating that no slave device recognized the address or
there was an error in communications, write 1 to the ICCR2.SP bit to issue a stop condition.
To transmit data with an address in the 10-bit format, start by writing 1111 0b, the two upper bits of the slave
address, and W (= 0) to ICDRT as the first address transmission. For the second address transmission, write the 8
lower bits of the slave address to ICDRT.
4. Check that the TDRE flag in ICSR2 is 1, then write the transmit data to the ICDRT register. The IIC automatically
holds the SCLn line low until the transmit data is ready or a stop condition is issued.
5. After all bytes of transmit data are written to the ICDRT register, wait until the value in the TEND flag in ICSR2
returns to 1, then set the SP bit in ICCR2 to 1 (stop condition requested). On receiving a stop condition request, the
IIC issues the stop condition. For details, see section 28.11.3, Issuing a Stop Condition.
6. On detecting the stop condition, the IIC automatically sets the MST and TRS bits in ICCR2 to 00b and enters slave
receive mode. Additionally, the IIC automatically sets the TDRE and TEND flags to 0, and sets the STOP flag in
ICSR2 to 1.
7. Check that the ICSR2.STOP flag is 1, then set the ICSR2.NACKF and STOP flags to 0 for the next transfer
operation.
Master transmission
No
ICCR2.BBSY = 0?
[2] Check I2C bus occupation and issue
Yes a start condition.
ICCR2.ST = 1
ICSR2.NACKF = 0?
No
Yes
No
ICSR2.TDRE = 1?
[3] Transmit slave address and W (first byte).
Yes [4] Check ACK and set transmit data.
Write data to ICDRT
No
All data transmitted?
Yes
No
ICSR2.TEND = 1?
Yes
[5] Check end of last data transmission
ICSR2.STOP = 0 and issue a stop condition.
ICCR2.SP = 1
No
ICSR2.STOP = 1? [6] Check stop condition issuance.
Yes
ICSR2.NACKF = 0
[7] Execute processing for the next transfer
operation.
ICSR2.STOP = 0
S 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4
SCLn
TRS Transmit data (7-bit address + W) Transmit data (DATA 1) Transmit data (DATA 2)
TDRE
TEND
RDRF
ACKBT 0 (ACK)
START
ST
Figure 28.7 Master transmit operation timing (1) with 7-bit address format
S 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4
SCLn
TRS Transmit data (upper 10 bits + W) Transmit data (lower 10 bits) Transmit data (DATA 1)
TDRE
TEND
RDRF
ACKBT 0 (ACK)
START
ST
Figure 28.8 Master transmit operation timing (2) with 10-bit address format
7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 P
SCLn
BBSY
MST
TEND
RDRF
ACKBT 0 (ACK)
STOP
SP
4. Dummy read the ICDRR after confirming that the RDRF flag in ICSR2 is 1. Doing so causes the IIC to start output
of the SCL clock and start data reception.
5. After 1 byte of data is received, the RDRF flag in ICSR2 is set to 1 on the rising edge of the 8th or 9th cycle of the
SCL clock, as selected in the RDRFS bit in ICMR3. Reading ICDRR produces the received data, and automatically
sets the RDRF flag is to 0. The value of the acknowledgment field received during the 9th cycle of the SCL clock is
returned as the value set in the ICMR3.ACKBT bit. If the next byte to be received is the next to last byte, set the
ICMR3.WAIT bit to 1 for wait insertion before reading ICDRR, containing the second byte from the last. In
addition to enabling NACK output, even when interrupts or other operations result in delays in setting the
ICMR3.ACKBT bit to 1 (NACK) in step (6), this fixes the SCLn line to low on the rising edge of the 9th clock cycle
in reception of the last byte, which enables the issue of a stop condition.
6. When the ICMR3.RDRFS bit is 0, and the slave device must be notified that it is to end transfer for data reception
after transfer of the next and final byte, set the ICMR3.ACKBT bit to 1 (NACK).
7. After reading the second-to-last byte from the ICDRR register, if the value of the ICSR2.RDRF flag is 1, write 1 to
the SP bit in ICCR2 (to request stop condition), then read the last byte from ICDRR. When ICDRR is read, the IIC
is released from the wait state and issues the stop condition after low-level output in the 9th clock cycle is complete
or the SCLn line is released from the low-hold state.
8. On detecting the stop condition, the IIC automatically sets the MST and TRS bits in ICCR2 to 00b and enters slave
receive mode. Additionally, detection of the stop condition sets the ICSR2.STOP flag to 1.
9. Check that the ICSR2.STOP flag is 1, then set the NACKF and STOP flags in ICSR2 to 0 for the next transfer
operation.
No
ICCR2.BBSY = 0?
(2) Check I2 C bus occupation and issue a start condition.
Yes
ICCR2.ST = 1
No
ICSR2.TDRE = 1?
Yes
W rite to the ICDRT register
(3) Transm it the slave address followed by
R and check ACK.
No
ICSR2.RDRF = 1?
Yes
No
ICSR2.NACKF = 0?
Yes
ICM R3.W AIT = 1 (4) Set to W AIT.
Yes
Next data = last byte?
No
Dum m y read the ICDRR register
(5) Set to NACK.
W hen receiving 2 bytes, perform dum m y
read.
No
ICSR2.RDRF = 1?
Yes
Set ICM R3.ACKBT
(6) Read received data
Read the ICDRR register W hen receiving 1 byte, perform
dumm y read.
No
ICSR2.RDRF = 1?
Yes
ICSR2.STOP = 0 ICSR2.STOP = 0
(7) Read the last data,
release SCL by the ACKBT setting,
ICCR2.SP = 1 ICCR2.SP = 1 and generate a stop condition.
ICSR2.NACKF = 0
Figure 28.10 Example of master reception flow with 7-bit address format, and 1 or 2 bytes
Master reception
No
ICCR2.BBSY = 0?
[2] Check I2C bus occupation and issue a start condition.
Yes
ICCR2.ST = 1
No
ICSR2.TDRE = 1?
Yes
Write data to ICDRT
Yes
No
ICSR2.NACKF = 0?
Yes
Perform dummy read of ICDRR [4] Perform dummy read.
No
ICSR2.RDRF = 1?
Yes
Yes
Next data = Final byte - 1?
No
Yes [5] Read received data and prepare for receiving final data.
Next data = Final byte - 2?
No
ICMR3.WAIT = 1
Read ICDRR
Set ICMR3.ACKBT
[6] Set the acknowledgment and read data of (final
byte - 1 byte).
Read ICDRR
No
ICSR2.RDRF = 1?
Yes
ICSR2.STOP = 0 ICSR2.STOP = 0
[7] Read final data and issue a stop condition.
ICCR2.SP = 1 ICCR2.SP = 1
ICMR3.WAIT = 0
No
ICSR2.STOP = 1? [8] Check stop condition issuance.
Yes
ICSR2.NACKF = 0
[9] Execute processing for the next transfer
operation.
ICSR2.STOP = 0
Figure 28.11 Example master reception flow with 7-bit address format, and 3 or more bytes
SCLn
MST
TDRE
Receive data (7-bit address + R) Receive data (DATA 1)
TEND
RDRF
ICDRR XXXX (Initial value/last data for reception) XXXX (Initial value/last data for reception) DATA 1
ACKBT 0 (ACK)
START
ST
Figure 28.12 Master receive operation timing (1) with 7-bit address format, when RDRFS = 0
Automatic low hold (to prevent wrong transmission) Master transmit mode Master receive mode
S 1 to 7 8 9 1 to 8 9 Sr 1 2 3 4 5 6 7 8 9 1 2 3 4
SCLn
MST
TRS Transmit data (upper 10 bits + W)Transmit data (lower 10 bits) Transmit data (upper 10 bits + R)
TDRE
Transmit data (upper 10 bits + R)
TEND
RDRF
ICDRR XXXX (Initial value/last data for reception) XXXX (Initial value/last data for reception)
ACKBT 0 (ACK)
START
ST
RS
Figure 28.13 Master receive operation timing (2) with 10-bit address format, when RDRFS = 0
BBSY
MST
TRS
TDRE
TEND Receive data (DATA n-2) Receive data (DATA n-1) Receive data (DATA n)
RDRF
STOP
SP
WAIT
Read ICDRR
Write 1 Read ICDRR Write 1 Read ICDRR Write 1 Clear Clear
(last data for reception
to WAIT (DATA n-2) to ACKBT (DATA n-1) to SP WAIT to 0 STOP to 0
[DATA n])
[5] [6] [7] [9]
Slave transmission
No
ICSR2.NACKF = 0?
Yes
No
ICSR2.TDRE = 1?
Yes
Write data to ICDRT [2], [3] Check ACK and set transmit data.
Checking of ACK not necessary immediately after
address is received.
No
All data transmitted?
Yes
No
ICSR2.TEND = 1?
Yes
No
ICSR2.STOP = 1? [5] Check stop condition detection.
Yes
ICSR2.NACKF = 0
ICSR2.STOP = 0
Slave receive mode Slave transmit mode Automatic low hold (to prevent wrong transmission)
S 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4
SCLn
MST
TRS Transmit data (DATA 1) Transmit data (DATA 2)
TDRE
TEND
RDRF
AASy
ICDRT XXXX (Initial value/last data for transmission) DATA 1 DATA 2 DATA 3
ACKBT 0 (ACK)
START
NACKF
Figure 28.16 Slave transmit operation timing (1) with 7-bit address format
7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 P
SCLn
MST
TRS Transmit data (DATA n-1) Transmit data (DATA n)
TDRE
TEND
RDRF
AASy
ACKBT 0 (ACK)
STOP
NACKF
Slave reception
No
ICSR2.STOP = 0?
Yes
No No
ICSR2.RDRF = 1? ICSR2.RDRF = 1?
[2], [3], [4] Read receive data
Yes Yes (dummy read first).
Yes
Read ICDRR Read ICDRR (last data)
No
All data received?
Yes
No
ICSR2.STOP = 1? [5] Check stop condition detection.
Yes
[6] Execute processing for the next
ICSR2.STOP = 0 transfer.
SCLn
MST
TRS
TDRE
Receive data (7-bit address + W) Receive data (DATA 1)
TEND
RDRF
AASy
ICDRR XXXX (Initial value/last data for reception) 7-bit address + W DATA 1
ACKBT 0 (ACK)
START
NACKF
[3] [3][4]
Figure 28.19 Slave receive operation timing (1) with 7-bit address format, when RDRFS = 0
7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 P
SCLn
MST
TRS
TDRE
Receive data (DATA n-2) Receive data (DATA n-1) Receive data (DATA n)
TEND
RDRF
AASy
ACKBT 0 (ACK)
STOP
NACKF
SCLn
ICBRL ICBRL
[SCL synchronization]
Counter clear Counter clear
SCLn
ICBRH: I2C Bus Bit Rate High-Level register (SCL clock high-level period counter)
ICBRL: I2C Bus Bit Rate Low-level register (SCL clock low-level period counter)
Figure 28.21 Generation and synchronization of SCL signal from the IIC
Analog noise filter delay time + PCLKB sampling error (1 PCLKB (max))
Digital noise filter delay time (NFE, NF[1:0] settings = 0.5 PCLKB (min), 1 IIC to 4 IIC (max))
Transmit mode
SDA output delay time (DLCS, SDDL[2:0] settings = 0 (min) to 14 IIC (max))
SDA output release timing
S 8 9
SCLn
SDAn b7 to b1 b0 ACK/NACK
Receive mode
SDA output release timing
1 to 7 8 9 P
SCLn
SDAn b7 to b1 b0 ACK/NACK
Master mode
SCLn ST 1 2 to 8 9 RS 1 to 9 SP
SDAn b7 b6 to b0 ACK/NACK
*1 *1 *1
BBSY
ST
Note 1. The output delay function is set by the DLCS and SDDL[2:0] bits when a start (ST), restart (RS), or stop (SP) condition
is issued.
Mismatch
Match D Q
CLK
Com-
parator
PCLKB
D Q D Q D Q D Q D Q
S 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5
SCLn
SDAn 7-bit slave address W ACK Data (DATA 1) ACK Data (DATA 2)
BBSY
Address match
AASy
Receive data (7-bit address) Receive data (DATA 1)
TRS
TDRE
RDRF
S 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5
SCLn
SDAn 7-bit slave address R ACK Data (DATA 1) ACK Data (DATA 2)
BBSY
Address match
AASy Transmit data (DATA 1) Transmit data (DATA 2)
TRS
TDRE
RDRF
Figure 28.24 AASy flag set timing with 7-bit address format
S 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5
SCLn
1 1 1 1 0 Upper 2 bits W ACK 10-bit slave address (lower 8 bits) ACK Data
SDAn
BBSY
Address match
AASy
Receive data (lower addresses)
TRS
TDRE
RDRF
Read ICDRR
(Dummy read [lower addresses])
S 1 2 3 4 5 6 7 8 9 1 to 8 9 Sr 1 2 3 4 5 6 7 8 9
SCLn
SDAn 1 1 1 1 0 Upper 2 bits W ACK Lower 8 bits ACK R 1 1 1 1 0 Upper 2 bits R ACK
BBSY
Address match
AASy
Receive data (lower addresses)
TRS
TDRE
RDRF
Read ICDRR
(Dummy read [lower addresses])
Figure 28.25 AASy flag set timing with 10-bit address format
[When SAR0L = 7-bit address, SAR1L = 7-bit address, and SAR2 = 10-bit address (1)]
S 1 2 3 4 5 6 7 8 9 1 to 8 9 Sr 1 2 3 4 5 6 7 8 9
SCLn
SDAn 7-bit slave address (SAR0L) R/W# ACK DATA ACK 7-bit slave address (SAR1L) R/W# ACK
BBSY
Address mismatch
AAS0 Address match
Address match
AAS1
AAS2
[When SAR0L = 7-bit address, SAR1L = 7-bit address, and SAR2 = 10-bit address (2)]
S 1 2 3 4 5 6 7 8 9 1 to 8 9 Sr 1 2 3 4 5 6 7 8 9
SCLn
SDAn 7-bit slave address (SAR1L) R/W# ACK DATA ACK 1 1 1 1 0 Upper 2 bits W ACK
BBSY
AAS0
AAS1 Address match Address mismatch
AAS2
[When SAR0L = 7-bit address, SAR1L = 7-bit address, and SAR2 = 10-bit address (3)]
S 1 2 3 4 5 6 7 8 9 1 to 8 9 Sr 1 2 3 4 5 6 7 8 9
SCLn
SDAn 1 1 1 1 0 Upper 2 bits W ACK Lower 8 bits ACK 7-bit slave address (SAR0L) R/W# ACK
BBSY
Address match
AAS0
AAS1
Figure 28.26 AASy flag set and clear timing with 7-bit and 10-bit address formats mixed
S 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5
SCLn
BBSY
AAS0
Receive data (7-bit address) Receive data (DATA 1)
AAS1
AAS2
Figure 28.27 Timing of GCA flag setting during reception of general call address
[Device-ID reception]
S 1 2 3 4 5 6 7 8 9 1 to 8 9 Sr 1 2 3 4 5 6 7 8 9
SCLn
BBSY
Slave address match
AASy
TDRE
RDRF
Read ICDRR
(Dummy read [7-bit address/lower 10 bits])
[When address received after a restart condition is detected does not match the device-ID ]
S 1 2 3 4 5 6 7 8 9 1 to 8 9 Sr 1 2 3 4 5 6 7 8 9
SCLn
SDAn 1 1 1 1 1 0 0 W ACK Address ACK 7-bit slave address (other station) R/W ACK
BBSY
Receive data (7-bit address/lower 10 bits) Slave address match Slave address mismatch
AASy
Device-ID mismatch
Device-ID match (1111 100b + W)
DID
RDRF
Read ICDRR
(Dummy read [7-bit address/lower 10 bits])
[When address before the device-ID + R does not match the slave address]
S 1 2 3 4 5 6 7 8 9 1 to 8 9 Sr 1 2 3 4 5 6 7 8 9
SCLn
AASy
Device-ID match (1111 100b + R) Device-ID match (1111 100b + R)
DID
The previous value is retained.
TDRE
RDRF
Figure 28.28 AASy/DID flag set and clear timing during reception of device ID
S 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5
SCLn
BBSY
AAS0
Receive data (7-bit address) Receive data (DATA 1)
AAS1
AAS2
Figure 28.29 HOA flag set timing during reception of host address
Note 1. Switching timing from PCLKB asynchronous operation to PCLKB synchronous operation is the falling edge of the
9th clock of the SCL.
Note 2. Switching timing from PCLKB asynchronous operation to PCLKB synchronous operation is the falling edge of the
8th clock of the SCL.
Note 1. Between the 9th clock cycle and 1st clock cycle during wakeup, WAIT = 1 is invalid.
If the transition from Software Standby mode or Snooze mode is triggered by an interrupt other than a wakeup interrupt,
for example the IRQn, the WUF flag is not set to 1. Figure 28.31 shows an operation example.
No
BBSY = 0 [1] [1] Wait until I2C bus is open and stay in standby state.
Yes
Yes
IICRST = 0 (& ICE = 1) [2] [2] Negate internal reset (if asserted).
WUACK setting, WUIE = 1 [3] [3] Set up WUACK for the desired wakeup mode. Enable wakeup interrupt.
WUE = 1 [4] [4] Enable wakeup function.
WUSEN = 0 [5] [5] The IIC operating state is changed from PCLKB synchronous
to PCLKB asynchronous.
No
WUASYF = 1
Yes
ICIER = 00h [6] [6] Disable all interrupt requests except WUI.
WFI instruction [7] [7] Stop PCLKB to IIC. IIC continues to receive.
Wakeup interrupt
[8] [8] Start system clock and PCLKB supply to IIC on wakeup interrupt
(address match).
No
WUF = 1 [9] [9] Wait for WUF = 1.
Yes
WUSEN = 1 [10] [10] The IIC operating state is changed from PCLKB asynchronous
to PCLKB synchronous.
No
WUSYF = 1
Yes
WUF = 0 [11] [11] Write 0 to WUF. Read and check that WUF = 0 before returning
from the interrupt handling.
No
WUF = 0
Yes
No
TRS = 1 Slave receive processing
Yes
Figure 28.30 Example operation of normal wakeup mode 1 when wakeup is triggered by a wakeup interrupt on
match of the slave address
Note: See Precautions on the use of the wakeup function.
Yes [2]
WUSEN = 0*1
No
Yes [3]
Continue slave mode
No
Wakeup interrupt
WUSEN = 1 [4] WUSEN = 1
Figure 28.31 Example operation of normal wakeup modes 1 and 2 when wakeup is triggered by an interrupt
other than IIC wakeup interrupt, for example, the IRQn
Note: For details on the IIC initial settings, see section 28.3.2, Initial Settings.
[Normal wakeup mode 1] As with normal operation, an ACK response when there is a match with its own slave address of the IIC, and SCL held low until the return.
Before wakeup: Own slave ACK response. During wakeup: SCL held low on 9th SCL. After wakeup: Continue normal operation.
Software Standby Active
Active Software Standby (before wakeup) (during wakeup) Active (after wakeup)
Continue to receive after returning (WAIT = 0)
WFI command WUACK = 0 (ACK return) WUF 0 clear ICDRR read ICDRR read
WUSEN 0 write ST WUSEN 1 write (0 write after 1 read) SP
WUI interrupt
WUF
AAS0
RDRF
TRS
WUSEN
WUI interrupt
WUF
AAS0
TDRE
TRS
WUSEN
Note: n = 0
If the transaction from Software Standby mode or Snooze mode is triggered by an interrupt other than a wakeup
interrupt, for example IRQn. WUF is not set to 1. Figure 28.31shows an operation example.
No
BBSY = 0 [1] [1] Wait until I2C bus is open and stay in standby state.
Yes
Yes
IICRST = 0 (& ICE = 1) [2] [2] Negate internal reset (if asserted).
WUACK setting, WUIE = 1 [3] [3] Set up WUACK for the desired wakeup mode. Enable wakeup interrupt.
WUE = 1 [4] [4] Enable wakeup function.
WUSEN = 0 [5] [5] The IIC operating state is changed from PCLKB synchronous
to PCLKB asynchronous.
No
WUASYF = 1
Yes
ICIER = 00h [6] [6] Disable all interrupt requests except WUI.
WFI instruction [7] [7] Stop PCLKB to IIC. IIC continues to receive.
Wakeup interrupt
[8] [8] Start system clock and PCLKB supply to IIC on wakeup interrupt
(address match).
No
WUF = 1 [9] [9] Wait for WUF = 1.
Yes
WUSEN = 1 [10] [10] The IIC operating state is changed from PCLKB asynchronous
to PCLKB synchronous.
No
WUSYF = 1
Yes
WUF = 0 [11] [11] Write 0 to WUF. Read and check that WUF = 0 before returning
from the interrupt handling.
No
WUF = 0
Yes
No
TRS = 1 Slave receive processing
Yes
Figure 28.33 Example operation of normal wakeup mode 2 when wakeup is triggered by a wakeup interrupt on
match of the slave address
Note: See Precautions on the use of the wakeup function.
[Normal wakeup mode 2] IIC holds SCL low until wakeup on its own slave match. ACK response after wakeup.
Before wakeup: Own slave – response. During wakeup: SCL held low between 8th and 9th SCL. After wakeup: Normal operation continues after own slave ACK response.
Software Standby Active
Active Software Standby (before wakeup) (during wakeup) Active (after wakeup)
WUI interrupt
WUF
AAS0
RDRF
TRS
WUSEN
WUASYF
WUI interrupt
WUF
AAS0
TDRE
TRS
WUSEN
WUASYF
28.8.3 Command Recovery Mode and EEP Response Mode (Special Wakeup Modes)
This section describes the behavior, timing, and an example operation in the command recovery and EEP response
modes.
In the command recovery and EEP response modes, the SCLn line is not held low during the wakeup period (after the
rise of the 9th clock cycle of SCL). Therefore, other IIC devices can use the I2C bus during this period.
A wakeup interrupt triggered by the match of the slave address initiates the transition to normal operation as follows:
Before wakeup: In response to data received with its own slave address, the IIC returns ACK (command recovery
mode) or NACK (EEP response mode).
During wakeup: The SCLn line is not held low.
After wakeup: Normal operation continues after IIC initialization.
If the slave address does not match, the slave operation continues.
Note: Because the SCLn line is not held low during wakeup, transmission or reception of the data that follows the slave
address is not possible.
Note: The command recovery and EEP response modes are internal reset states (ICE = IICRST = 1). Therefore, the
match of the slave address does not set the flags HOA, GCA, AAS0, AAS1, and AAS2 in the ICSR1 register.
Figure 28.35 shows an example operation in command recovery and EEP response modes. Figure 28.37 shows the
detailed timing.
If the transaction from Software Standby mode or Snooze mode is triggered by an interrupt other than a wakeup
interrupt, for example the IRQn, the WUF flag is not set to 1. Figure 28.36 shows an operation example.
No
BBSY = 0 [1] [1] Wait until I2C bus is open and stay in standby state.
Yes
WUACK setting, WUIE = 1 [3] [3] Set up WUACK for the desired wakeup mode. Enable wakeup interrupt.
WUSEN = 0 [5] [5] The IIC operating state is changed from PCLKB synchronous to PCLKB asynchronous.
No
WUASYF = 1
Yes
ICIER = 00h [6] [6] Disable all interrupt requests except WUI.
WFI instruction [7] [7] Stop PCLKB to IIC. IIC continues to receive.
Wakeup interrupt
[8] [8] Start system clock and PCLKB supply to the IIC with wakeup
interrupt (address match).
No
WUF = 1 [9] [9] Wait for WUF = 1.
Yes
WUSEN = 1 [10] [10] The IIC operating state is changed from PCLKB asynchronous to PCLKB
synchronous.
No
WUSYF = 1
Yes
WUF = 0 [11] [11] Write 0 to WUF. Read and check that WUF = 0 before returning from the interrupt
handling.
No
WUF = 0
Yes
ICE = 0 & IICRST = 1 [14] [14] Reset IIC (ICE = 0 & IICRST = 1).
*1
ICE = IICRST = 1, initialize [15] [15] Reset IIC (internal reset: ICE = 1 & IICRST = 1). Initial settings.
ICE = 1 & IICRST = 0 [16] [16] Negate the internal reset.
Figure 28.35 Example operation of command recovery and EEP response modes when wakeup is triggered by
a wakeup interrupt on match of the slave address
Note: See Precautions on the use of the wakeup function.
WFI instruction
No
WUSYF = 1 From here, the sequence is the same as
step [9] onward, as in Figure 28.35.
Yes
WUIE = 0 [5]
WUE = 0 [6]
Figure 28.36 Example operation of command recovery and EEP response modes when wakeup is triggered by
an interrupt other than IIC wakeup interrupt, for example, the IRQn
[Command return mode and EEP response mode] Reply ACK/NACK in the period from wakeup start to wakeup processing.
Reply ACK if own slave is specified again after IICRST release after wakeup.
Before wakeup: Own slave ACK/NACK response. During wakeup: No SCL-low hold. After wakeup: Continue normal operation.
Software Standby
Active Software Standby (before wakeup) active (during wakeup) Active (after wakeup)
WFI command
WUSEN 0 write WUSEN 1 write WUF 0 clear
SCLn 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6
BC 0 0
BBSY
START
WUI interrupt
WUF
AAS0
TDRE/
RDRF
WUSEN
WUASYF
BBSY
Transmit data (7-bit address + W) Transmit data (DATA 1) Transmit data (DATA 2)
AASy
TRS
TDRE
RDRF
Automatic low-hold
[Slave transmit mode] Automatic low-hold (to prevent wrong transmission) (to prevent wrong
transmission)
S 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3
SCLn
TDRE
RDRF
S 1 2 3 4 5 6 7 8 9 P S 1 2 3 4 5 6 7 8 9
SCLn
TRS
TDRE
NACKF
Write data to ICDRT register Write data to ICDRT Write 1 Clear Write data to ICDRT Write data to ICDRT
(7-bit address + W) register (DATA 1) to SP bit NACKF flag register register (DATA 1)
(7-bit address + W)
[Slave transmit mode] Automatic low-hold (to prevent wrong transmission) Bus free time
(ICBRL)
S 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 P
SCLn
TDRE
NACKF
Write data to ICDRT Write data to ICDRT Write 1 to SP bit Clear NACKF flag
register (DATA 1) register (DATA 2)
(1) 1-byte receive operation and automatic low-hold function using the WAIT bit
When the WAIT bit in ICMR3 is set to 1, the IIC performs a 1-byte receive operation using the WAIT bit function.
Additionally, when the ICMR3.RDRFS bit is 0, the IIC automatically sends the ACKBT bit value in ICMR3 for the
acknowledge bit in the period from the falling edge of the 8th SCL clock cycle to the falling edge of the 9th SCL clock
cycle, and automatically holds the SCLn line low on the falling edge of the 9th SCL clock cycle using the WAIT bit
function. This low-hold is released by reading data from ICDRR, which enables byte-wise receive operation.
The WAIT bit function is enabled for receive frames after a match with the IIC slave address, including the general call
address and host address, is obtained in master receive mode or slave receive mode.
(2) 1-byte receive operation (ACK/NACK transmission control) and automatic low-hold function
using the RDRFS bit
When the RDRFS bit in ICMR3 is set to 1, the IIC performs a 1-byte receive operation using the RDRFS bit function.
When the RDRFS bit is set to 1, the RDRF flag in ICSR2 is set to 1 (receive data full) on the rising edge of the 8th SCL
clock cycle, and the SCLn line is automatically held low on the falling edge of the 8th SCL clock cycle. This low-hold is
released by writing a value to the ACKBT bit in ICMR3, but cannot be released by reading data from ICDRR, which
enables receive operation through the ACK or NACK transmission control based on the data received in byte units.
The RDRFS bit function is enabled for receive frames after a match with the IIC slave address, including the general call
address and host address, is obtained in master receive mode or slave receive mode.
Automatic low-hold
[RDRFS = 0, WAIT = 0]
(to prevent failure to receive data)
9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4
SCLn
RDRF
RDRF
RDRF
ACKBT
RDRF
ACKBT
Figure 28.40 Automatic low-hold operation in receive mode using RDRFS and WAIT bits
When a start condition is issued successfully, if the transmit data including the address bits (internal SDA output level)
and the level on the SDAn line does not match (high output as the internal SDA output, meaning the SDAn pin is in the
high-impedance state) and a low level is detected on the SDAn line, the IIC loses the arbitration.
After a loss in arbitration of mastership, the IIC immediately enters slave receive mode. If a slave address, including the
general call address, matches its own address at this time, the IIC continues in slave operation.
A loss in arbitration of mastership is detected when the following conditions are met while the MALE bit in ICFER is 1
(master arbitration-lost detection enabled).
[Master arbitration-lost conditions]
Mismatching of the internal level for output on SDA and the level on the SDAn line after a start condition was
issued by setting the ICCR2.ST bit to 1 while the BBSY flag in ICCR2 is set to 0 (erroneous issuing of a start
condition)
Setting the ICCR2.ST bit to 1 (start condition double-issue error) while the BBSY flag is 1
When the transmit data excluding acknowledge (internal SDA output level) does not match the level on the SDAn
line in master transmit mode (MST = 1 and TRS = 1 in ICCR2).
SDAn 1
S 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5
SCLn
TRS
AL
AASy
TDRE
Clear AL to 0
[When data transmission conflicts after general call address is sent] Transmit data mismatch Release SCL/SDA
(arbitration lost)
S 1 2 3 4 5 6 7 8 9 1 2 3 4 5
SCLn
SDAn 0 0 0 0 0 0 0 W ACK 1
S 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5
SCLn
BBSY
MST
Receive data
TRS
AL
Read ICDRR
Bus free (BBSY = 0) start condition issuance (ST = 1) error Bus busy (BBSY =1) start condition issuance (ST = 1) error
SDA mismatch
PCLKB PCLKB PCLKB
S 1 S 1 2 S 1 2 6 7 8 9 1
SCLn SCLn SCLn
ST ST ST
AL AL AL
28.10.2 Function to Detect Loss of Arbitration during NACK Transmission (NALE Bit)
This function causes arbitration to be lost if the internal SDA output level does not match the level on the SDAn line
during transmission of NACK in receive mode. Arbitration is lost because of a conflict between NACK and ACK
transmissions when two or more master devices receive data from the same slave device simultaneously in a multi-
master system. Such conflict occurs when multiple master devices send or receive the same information through a single
slave device. Figure 28.43 shows an example of arbitration-lost detection during transmission of NACK.
2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5
SCLn
BBSY
MST
Receive data Receive data
TRS
AL
RDRFS
RDRF
ACKBT
occurs, master A cannot detect the ACK transmitted by master B and issues a stop condition. Therefore, the stop
condition issue conflicts with the SCL clock output of master B, which disrupts communication.
When the IIC receives ACK during transmission of NACK, it detects a defeat in conflict with other master devices and
causes arbitration to be lost. If arbitration is lost during transmission of NACK, the IIC immediately cancels the slave
match condition and enters slave receive mode. This prevents a stop condition from being issued, preventing a
communication failure on the bus.
Similarly, in the ARP command processing of SMBus, the function to detect loss of arbitration during transmission of
NACK is also available to eliminate the extra clock cycle processing, such as FFh transmission processing, which is
required if the UDID (Unique Device Identifier) of the assigned address does not match in the Get UDID general
processing after the Assign Address command.
The IIC detects arbitration-lost during transmission of NACK when the following condition is met with the NALE bit in
ICFER set to 1 (arbitration-lost detection during NACK transmission enabled).
[Condition for arbitration-lost during NACK transmission]
When the internal SDA output level does not match the SDAn line (ACK is received) during transmission of NACK
(ACKBT = 1 in ICMR3).
2 3 4 5 6 7 8 9 1 2 3 4 5
SCLn
2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6
SCLn
BBSY
MST
TRS
AL
TDRE
SCLn SCLn Sr
S Issue start 9
Issue restart
SDAn condition SDAn condition
ACK/NACK
IIC IIC
BBSY BBSY
MST MST
TRS TRS
TDRE TDRE
START START
ST RS
Write to ICDRT (7 bits address + R/W#) Write to ICDRT (7 bits address + R/W#)
Write 1 to ST bit Write 1 to RS bit
Accept restart condition issuance
Accept start condition issuance
Figure 28.45 Start and restart condition issue timing using the ST and RS bits
Figure 28.46 shows the operation timing when a restart condition is issued after the master transmission.
To issue a restart condition after the master transmission:
1. Initialize the IIC using the procedure in section 28.3.2, Initial Settings.
2. Read the IICR2.BBSY flag to check that the bus is open, then set the ICCR2.ST bit to 1 (start condition request). On
receiving the request, the IIC issues a start condition. At the same time, the BBSY and the START flags in ICSR2
are automatically set to 1 and the ST bit is automatically set to 0. If the start condition is detected and the internal
levels for the SDA output state and the levels on the SDAn line match while the ST bit is 1, the IIC recognizes that
a start condition is successfully issued as requested by the ST bit. The MST and TRS bits in ICCR2 are
automatically set to 1, placing the IIC in master transmit mode. The TDRE flag in ICSR2 is also automatically set to
1 when the ICCR2.TRS bit is set to 1.
3. Check that the ICSR2.TDRE flag is 1, then write the value for transmission (the slave address and the R/W# bit) to
the ICDRT register. After the transmit data are written to the ICDRT register, the TDRE flag is automatically set to
0, the data is transferred from the ICDRT register to the ICDRS register, and the TDRE flag again sets to 1. After
the byte containing the slave address and R/W# bit has been transmitted, the value of the TRS bit is automatically
updated to select master transmit or master receive mode according to the value of the transmitted R/W# bit. If the
value of the R/W# bit is 0, the IIC continues in master transmit mode. If the NACKF.ICSR2 flag is 1 at this time,
indicating that no slave device recognized the address or there was an error in communications, write 1 to
ICCR2.SP bit to issue a stop condition.
To transmit data with an address in the 10-bit format, start by writing 1111 0b, the 2 upper bits of the slave address,
and W (= 0) to the ICDRT register as the first address transmission. Then, as the second address transmission, write
the 8 lower bits of the slave address to the ICDRT register.
4. After confirming that the ICSR2.TDRE flag is 1, write the data for transmission to the ICDRT register. The IIC
automatically holds the SCLn line low until data for transmission is ready, and a restart condition or a stop condition
is issued.
5. After all bytes of data for transmission are written to the ICDRT register, wait until the value of the ICSR2.TEND
flag returns to 1. Then, after checking that the ICSR2.START flag is 1, set the ICSR2.START flag to 0.
6. Set the ICCR2.RS bit to 1 (restart condition request). On receiving the request, the IIC issues a restart condition.
7. After checking that the ICSR2.START flag is 1, write the value for transmission (the slave address and the R/W#
bit) to the ICDRT register.
MST
TRS Transmit data (7-bit address + W) Transmit data (DATA 1) Transmit data (7-bit address + R)
TDRE
TEND
RDRF
ACKBT 0 (ACK)
START
ST
RS
Write data to
Write data to Clear Write data to
Write 1 ICDRT Write 1
ICDRT START ICDRT
to ST (7-bit address + W) (DATA 1) to RS
to 0 (7-bit address + R)
(2) (3) (4) (5) (6) (7)
SCLn 8 9 P
Issue stop
SDAn b0 ACK/NACK condition
IIC
BBSY
MST
TRS
TDRE
STOP
SP
continues to count unless the SCLn line changes. If the internal counter overflows because no SCLn line changes, the IIC
can detect the timeout and report the bus hung state.
This timeout function is enabled when the ICFER.TMOE bit is 1. It detects a hung state when the SCLn line is stuck low
or high during the following conditions:
The bus is busy (ICCR2.BBSY flag is 1) in master mode (ICCR2.MST bit is 1)
The IIC slave address is detected (ICSR1 register is not 00h) and the bus is busy (ICCR2.BBSY flag is 1) in slave
mode (ICCR2.MST bit is 0)
The bus is open (ICCR2.BBSY flag is 0) while a start condition is requested (ICCR2.ST bit is 1).
The internal counter of the timeout function uses the internal reference clock (IIC) set in the CKS[2:0] bits in ICMR1 as
a count source. It functions as a 16-bit counter when long mode is selected (TMOS = 0 in ICMR2) or a 14-bit counter
when short mode is selected (TMOS = 1).
The SCLn line level (low, high, or both levels) during which this counter is activated can be selected in the TMOH and
TMOL bits in ICMR2. If both TMOL and TMOH bits are set to 0, the internal counter is disabled.
[Timeout function]
Start internal Start internal Start internal Start internal Start internal Start internal
counter counter counter counter counter counter
Clear internal Clear internal Clear internal Clear internal Clear internal Clear internal Clear internal
counter counter counter counter counter counter counter
IIC
BBSY
TMOE
TMOH
TMOL
[Example operation when TMOH = 1 and TMOL = 1] When a stat condition is issued In the slave-address matched state
14-bit counter 16-bit counter
Clear internal counter Start internal counter overflows
overflows
TMOS = 0 TMOS = 1
7 8 9 P S 1 2 7 8 9 1 2
A/NA Bus free time 7-bit slave address R/W# ACK Data
BBSY
ST
TMOE
TMOF
Figure 28.48 Timeout function using the TMOE, TMOS, TMOH, and TMOL bits
When the CLO bit in ICCR1 is set to 1 in master mode, a single cycle of the SCL clock at the transfer rate specified in the
CKS[2:0] bits in ICMR1, the BRH[4:0] bits in ICBRH, and the BRL[4:0] bits in ICBRL, is output as an extra clock
cycle. After output of this single cycle of the SCL clock, the CLO bit is automatically set to 0. If the BBSY flag is 1, SCL
terminal keeps low output, if BBSY flag is 0, SCL terminal keeps high output.
Additional clock cycles can be output consecutively by writing 1 to the CLO bit with software after reading the bit as 0.
When the IIC module is in master mode and the slave device is holding the SDAn line low because synchronization with
the slave device is lost due to the effects of noise, the output of a stop condition is not possible. This function can be used
to output extra cycles of SCL one by one to make the slave device release the SDAn line from being held low, and
recover the bus from an unusable state. Release of the SDAn line by the slave device can be monitored by reading the
SDAI bit in ICCR1. After confirming the release of the SDAn line by the slave device, complete communications by
reissuing the stop condition.
[Output conditions for using the CLO bit in ICCR1]:
When the bus is free (BBSY flag in ICCR2 = 0) or in master mode (MST = 1 and BBSY = 1 in ICCR2)
When the communication device does not hold the SCLn line low.
Figure 28.49 shows the operation timing of the extra SCL clock cycle output function (CLO bit).
IIC
BBSY
MST
TRS
CLO
Figure 28.49 Extra SCL clock cycle output function using the CLO bit
For the SMBus device default address (1100 001b), use one of the slave address registers L0 to L2 (SARL0, SARL1, and
SARL2), and set the associated FS bit (7-bit or 10-bit address format select) in SARUy (y = 0 to 2) to 0 (7-bit address
format).
When transmitting the UDID (Unique Device Identifier), set the SALE bit in ICFER to 1 to enable the slave arbitration-
lost detection function.
SMBus standard TLOW:SEXT: Total clock low-level extended period (slave device)
TLOW:MEXT: Total clock low-level extended period (master device)
Start Stop
TLOW:SEXT
S 1 2 7 8 9 1 2 7 8 9 1 2 7 8 9 P
SCLn
SDAn 7-bit slave address R/W# ACK Data ACK Data A/NA
BBSY
TDRE
TEND
RDRF
RDRFS
START
STOP
Table 28.10 lists details of the interrupt requests. The receive data full and transmit data empty interrupts can activate
data transfer by the DTC.
Note: There is a delay between the execution of a write instruction for a peripheral module by the CPU and the actual
writing to the module. When an interrupt flag is cleared or masked, read the relevant flag again to check whether
clearing or masking is complete, and then return from interrupt handling. Not doing so creates the possibility of
repeated processing of the same interrupt.
Note 1. Because IICn_TXI is an edge-detected interrupt, it does not require clearing. Additionally, the TDRE flag in
ICSR2 (condition for IICn_TXI) is automatically set to 0 when transmit data is written to ICDRT or a stop condition
is detected (STOP = 1 in ICSR2).
Note 2. Because IICn_RXI is an edge-detected interrupt, it does not require clearing. Additionally, the RDRF flag in
ICSR2 (condition for IICn_RXI) is automatically set to 0 when data is read from ICDRR.
Note 3. When using the IICn_TEI interrupt, clear the TEND flag in ICSR2 in the IICn_TEI interrupt handling.
The TEND flag in ICSR2 is automatically set to 0 when transmit data is written to ICDRT or a stop condition is
detected (STOP = 1 in ICSR2).
Note 4. Only channel 0 has a wakeup function, so IIC0_WUI is for channel 0 only.
Note 5. Channel number (n = 0, 1).
Acceptance
CRX0
filter
Protocol
controller
ID priority
CTX0 Mailboxes
transmission
controller
fCANCLK
Baud rate Timer
prescaler
(BRP)
Peripheral module clock
(PCLKB)
System clock ICLK
— — RBOC BOM[1:0] SLPM CANM[1:0] TSPS[1:0] TSRC TPM MLM IDFM[1:0] MBM
Note 1. Write to the BOM[1:0], TSPS[1:0], TPM, MLM, IDFM[1:0], and MBM bits in CAN reset mode.
Note 2. Set the RBOC bit to 1 in the bus-off state.
Note 3. This bit automatically sets to 0 after being set to 1. It should be read as 0.
Note 4. Set the TSRC bit to 1 in CAN operation mode.
Note 5. When the CANM[1:0] and SLPM bits are changed, check STR to ensure that the mode is switched. Do not
change the CANM[1:0] bits or SLPM bit until the mode is switched.
Note 6. Write to the SLPM bit in CAN reset mode or CAN halt mode. When changing the SLPM bit, write 0 or 1 only to the
SLPM bit.
specification (ISO11898-1). In ID priority transmit mode, mailboxes 0 to 31 (in normal mailbox mode), and mailboxes 0
to 23 (in FIFO mailbox mode), and the transmit FIFO are compared for the IDs of mailboxes configured for
transmission. If two or more mailbox IDs are the same, the mailbox with the smaller number has higher priority.
Only the next message to be transmitted from the transmit FIFO is included in the transmission arbitration. If a FIFO
message is currently being transmitted, the next pending message within the transmit FIFO is included in the
transmission arbitration.
When TPM is 1, mailbox number transmit mode is selected and the transmit mailbox with the smallest number has the
highest priority. In FIFO mailbox mode, the transmit FIFO has lower priority than normal mailboxes (0 to 23).
Note 1. The transmit FIFO is controlled by the TFCR register. The MCTL_TXj registers associated with mailboxes 24 to 27 are
disabled. MCTL_TX24 to MCTL_TX27 cannot be used by the transmit FIFO.
Note 2. The receive FIFO is controlled by the RFCR register. The MCTL_RXj registers associated with mailboxes 28 to 31 are
disabled. MCTL_RX28 to MCTL_RX31 cannot be used by the receive FIFO.
Note 3. See the MIER_FIFO register for information on the FIFO interrupts.
Note 4. The bits in MKIVLR associated with mailboxes 24 to 31 are disabled. Set these bits to 0.
Note 5. The transmit and receive FIFOs can be used for both data frames and remote frames.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
TSEG1[3:0] — — BRP[9:0]
For details about setting the bit timing, see section 29.4, Data Transfer Rate Configuration. Set the BCR register before
entering CAN halt mode or CAN operation mode from CAN reset mode. After the setting is made once, this register can
be written to in CAN reset mode or CAN halt mode. A 32-bit read/write access must be performed carefully so as not to
change bits [7:0].
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — SID[10:0] EID[17:0]
EID[17:0]
x: Undefined
For the mask function in FIFO mailbox mode, see section 29.6, Acceptance Filtering and Masking Functions.
Write to MKR0 to MKR7 registers in CAN reset mode or CAN halt mode.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
EID[17:0]
x: Undefined
Note 1. When the CTLR.IDFM[1:0] bits are any value other than 10b, the IDE bit should be written with 0 and read as 0.
FIDCR0 and FIDCR1 are enabled when the MBM bit in CTLR is set to 1 (FIFO mailbox mode). In FIFO mailbox mode,
the EID[17:0], SID[10:0], RTR, and IDE bits in mailbox 28 to mailbox 31 are disabled. Write to the FIDCR0 and
FIDCR1 registers in CAN reset or CAN halt mode. For information on using FIDCR0 and FIDCR1, see section 29.6,
Acceptance Filtering and Masking Functions.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
MB31 MB30 MB29 MB28 MB27 MB26 MB25 MB24 MB23 MB22 MB21 MB20 MB19 MB18 MB17 MB16
MB15 MB14 MB13 MB12 MB11 MB10 MB9 MB8 MB7 MB6 MB5 MB4 MB3 MB2 MB1 MB0
x: Undefined
Each bit in MKIVLR is associated with a mailbox of the same number. Bit [0] in the MKIVLR register corresponds to
mailbox 0 (MB0), and bit [31] corresponds to mailbox 31 (MB31).
Note: Set bits [31:24] to 0 in FIFO mailbox mode.
When a bit is set to 1, the corresponding acceptance mask register becomes invalid for the associated mailbox. When a
mask invalid bit is set to 1, a message is received by the associated mailbox only if the receive message ID matches the
mailbox ID exactly. Write to MKIVLR in CAN halt mode.
4005 0200h + 16 × j + 4 —
The previous value of each mailbox is saved unless a new message is received.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
EID[17:0]
x: Undefined
Note 1. If the mailbox receives a standard ID message, the EID bits in the mailbox are undefined.
Note 2. The IDE bit is enabled when the IDFM[1:0] bits in CTLR are 10b (mixed ID mode). When the IDFM[1:0] bits are
any value other than 10b, the IDE bit should be written with 0 and read as 0.
— — — — — — — — — — — — DLC[3:0]
x: Undefined
x: Don’t care
Note 1. If the mailbox receives a message with data length (set in DLC[3:0]) of n bytes, where n is less than 8, the data in
the DATAn to DATA7 registers in the mailbox is undefined. DATA0 to DATA7 are data registers for this mailbox.
For example, if data length is 6 bytes (DLC[3:0] = 6h), the data in DATA6 and DATA7 registers is undefined.
b7 b6 b5 b4 b3 b2 b1 b0
DATA0
b7 b6 b5 b4 b3 b2 b1 b0
DATA1
b7 b6 b5 b4 b3 b2 b1 b0
DATA2
b7 b6 b5 b4 b3 b2 b1 b0
DATA3
b7 b6 b5 b4 b3 b2 b1 b0
DATA4
b7 b6 b5 b4 b3 b2 b1 b0
DATA5
b7 b6 b5 b4 b3 b2 b1 b0
DATA6
b7 b6 b5 b4 b3 b2 b1 b0
DATA7
x: Undefined
Note 1. If the mailbox receives a message with n bytes, where n is less than 8 bytes, the DATAn to DATA7 values in the
mailbox are undefined. For example, if the received data length is 6 bytes, the values of DATA6 and DATA7 are
undefined.
Note 2. If the mailbox receives a remote frame, the previous values of DATA0 to DATA7 in the mailbox are saved.
TSH[7:0] TSL[7:0]
x: Undefined
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
MB31 MB30 MB29 MB28 MB27 MB26 MB25 MB24 MB23 MB22 MB21 MB20 MB19 MB18 MB17 MB16
MB15 MB14 MB13 MB12 MB11 MB10 MB9 MB8 MB7 MB6 MB5 MB4 MB3 MB2 MB1 MB0
x: Undefined
The MIER register can enable interrupts for each mailbox independently. This register is available in normal mailbox
mode. Do not access this register in FIFO mailbox mode.
Each bit is associated with a mailbox with the same number. These bits enable or disable transmission and reception
complete interrupts for the associated mailboxes as follows:
Bit [0] in MIER is associated with mailbox 0 (MB0)
Bit [31] in MIER is associated with mailbox 31 (MB31).
Write to MIER only when the associated MCTL_TXj or MCTL_RXj (j = 0 to 31) register is 00h and the associated
mailbox does not process a transmission or reception abort request.
29.2.8 Mailbox Interrupt Enable Register for FIFO Mailbox Mode (MIER_FIFO)
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — MB29 MB28 — — MB25 MB24 MB23 MB22 MB21 MB20 MB19 MB18 MB17 MB16
MB15 MB14 MB13 MB12 MB11 MB10 MB9 MB8 MB7 MB6 MB5 MB4 MB3 MB2 MB1 MB0
x: Undefined
Note 1. No interrupt request is generated when the receive FIFO becomes a buffer warning because it is full.
Note 2. Buffer warning indicates a state in which the third message is stored in the receive FIFO.
The MIER_FIFO register can enable interrupts for each mailbox and FIFO independently. This register is available in
FIFO mailbox mode. Do not access this register in normal mailbox mode.
The MB0 to MB23 bits are associated with the mailbox of the same number. These bits enable or disable transmission
and reception complete interrupts for the associated mailboxes.
Bit [0] in MIER_FIFO is associated with mailbox 0 (MB0)
Bit [23] in MIER_FIFO is associated with mailbox 23 (MB23).
MB24, MB25, MB28 and MB29 specify whether the transmit and receive FIFO interrupts are enabled or disabled, and
the timing when interrupt requests are generated.
Write to the MIER_FIFO register only when the associated MCTL_TXj or MCTL_RXj (j = 0 to 31) register is 00h and
the associated mailbox does not process a transmission or reception abort request. In addition, change the bits in
MIER_FIFO for the associated FIFO only when all the following conditions are true:
The TFE bit in TFCR is 0 and the TFEST bit is 1
The RFE bit in RFCR is 0 and the RFEST flag in RFCR is 1.
Transmit mode (when the TRMREQ bit is 1 and the RECREQ bit is 0)
b7 b6 b5 b4 b3 b2 b1 b0
The MCTL_TXj register sets mailbox j to transmit or receive mode. In transmit mode, MCTL_TXj also controls and
indicates the transmission status. Do not access MCTL_TXj if mailbox j is in receive mode. Only write to MCTL_TXj in
CAN operation mode or CAN halt mode. Do not use the MCTL_TX24 to MCTL_TX31 registers in FIFO mailbox mode.
The TRMABT flag is not set to 1 when data transmission is complete. The SENTDATA flag is set to 1 and the TRMABT
flag is set to 0 through a software write.
Receive mode (when the TRMREQ bit is 0 and the RECREQ bit is 1)
b7 b6 b5 b4 b3 b2 b1 b0
The MCTL_RXj register sets mailbox j to transmit or receive mode. In receive mode, MCTL_RXj also controls and
indicates the reception status.
Do not access MCTL_RXj if mailbox j is in transmit mode. Only write to MCTL_RXj in CAN operation mode or CAN
halt mode. Do not use the MCTL_RX24 to MCTL_RX31 registers in FIFO mailbox mode.
b7 b6 b5 b4 b3 b2 b1 b0
Write to the RFCR register in CAN operation mode or CAN halt mode.
message lost) through a software write during 5 PCLKB cycles following the 6th bit of EOF, due to hardware protection.
RFCR.RFEST flag
RFCR.RFWST flag
RFCR.RFFST bit
RFPCR
Figure 29.2 Receive FIFO mailbox operation with bits [29:28] in MIER_FIFO = 01b or 11b
b7 b6 b5 b4 b3 b2 b1 b0
x: Undefined
When the receive FIFO is not empty, write FFh to the RFPCR register through software to increment the CPU pointer to
the next mailbox location. Do not write to RFPCR when the RFE bit in RFCR is 0 (receive FIFO disabled).
Both the CAN and CPU pointers increment when a new message is received and the RFFST flag is 1 (receive FIFO is
full) in overwrite mode. When RFMLF flag is 1 in this condition, the CPU pointer cannot be incremented on a software
write to RFPCR.
b7 b6 b5 b4 b3 b2 b1 b0
Write to the TFCR register in CAN operation mode or CAN halt mode.
On completion of transmission, on a CAN bus error, CAN bus arbitration-lost, or entry to CAN halt mode if a
message from the transmit FIFO is scheduled for the next transmission or already in transmission.
Before setting the TFE bit to 1 again, ensure that the TFEST bit is set to 1. After setting the TFE bit to 1, write transmit
data to mailbox 24.
Do not set the TFE bit to 1 in normal mailbox mode (MBM bit in CTLR = 0).
TFCR.TFEST flag
TFCR.TFFST bit
TFPCR
Figure 29.3 Transmit FIFO mailbox operation when bits [25:24] in MIER_FIFO = 01b or 11b
b7 b6 b5 b4 b3 b2 b1 b0
x: Undefined
When the transmit FIFO is not full, write FFh to the TFPCR register through software to increment the CPU pointer for
the transmit FIFO to the next mailbox location.
Do not write to TFPCR when the TFE bit in TFCR is 0 (transmit FIFO disabled).
— RECST TRMST BOST EPST SLPST HLTST RSTST EST TABST FMLST NMLST TFST RFST SDST NDST
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — MBSM[1:0]
Write to the MSMR register in CAN operation mode or CAN halt mode.
b7 b6 b5 b4 b3 b2 b1 b0
SEST — — MBNST[4:0]
b7 b6 b5 b4 b3 b2 b1 b0
x: Undefined
The bits that are set to 1 in the CSSR register are encoded by an 8/3 encoder (the LSB position has the higher priority)
and output to the MBNST[4:0] bits in the MSSR register. The MSSR register outputs the updated value whenever it is
read by software.
Write to CSSR only when the MSMR.MBSM[1:0] bits are 11b (channel search mode). Write to CSSR in CAN operation
mode or CAN halt mode.
Figure 29.4 shows the write and read operations of the CSSR and MSSR registers.
Address
b7 b6 b3 b0
CSSR 0 1 0 0 1 0 0 1 4005 0851h
8/3 encoder
4005 0852h
MSSR b7 b2 b0
(1st read) 0 0 0 0 0 0 0 0 (Search result: Channel no. 0 read)
Figure 29.4 Write and read operations of the CSSR and MSSR registers
The value of CSSR is also updated whenever MSSR is read. On this read, the value prior to conversion by the 8/3
encoder can be read.
x: Undefined
The acceptance filter support unit (ASU) can be used for data table (8 bits × 256) searches. In the data table, all standard
IDs that are created are set to be valid or invalid in bit units. When AFSR is written with data in 16-bit units including the
SID[10:0] bits in MBj_ID (j = 0 to 31), in which a received standard ID is stored, a decoded row (byte offset) position
and column (bit) position for data table search can be read. The ASU can be used for standard (11-bit) IDs only.
The ASU is enabled in the following cases:
When the IDs to be received cannot be masked by the acceptance filter.
For example, if the IDs to be received are 078h, 087h, and 111h.
When there are too many IDs to receive, and the software filtering time is expected to be shortened.
Note: The AFSR register cannot be set in CAN reset mode.
Figure 29.5 shows the write and read operations in the AFSR register.
Address
b15 b8 b7 b0
When writing*1 SID SID SID SID SID SID SID SID SID SID SID
10 9 8 7 6 5 4 3 2 1 0 4005 0856h
3/8 decoder
b15 b8 b7 b0
SID SID SID SID SID SID SID SID
When reading 10 9 8 7 6 5 4 3 4005 0856h
Column (bit) position in data table Row (byte offset) position in data table
Note 1. Write the same value as the 16-bit unit data, including the SID[10:0] bits in MBj_ID (j = 0 to 31).
b7 b6 b5 b4 b3 b2 b1 b0
The EIER register independently enables or disables the error interrupt for each error interrupt source. Write to EIER in
CAN reset mode.
b7 b6 b5 b4 b3 b2 b1 b0
Table 29.7 Behavior of BOEIF and BORIF flags for each CTLR.BOM[1:0] setting
11b Set to 1 if normal bus-off recovery occurs before the CANM[1:0] bits are
set to 10b (CAN halt mode)
b7 b6 b5 b4 b3 b2 b1 b0
The RECR register indicates the value of the receive error counter. See the CAN specification (ISO11898-1) for the
increment and decrement conditions of the receive error counter. The value of RECR in the bus-off state is undefined.
b7 b6 b5 b4 b3 b2 b1 b0
The TECR register indicates the value of the transmit error counter. See the CAN specification (ISO11898-1) for the
increment and decrement conditions of the transmit error counter. The value of TECR in the bus-off state is undefined.
b7 b6 b5 b4 b3 b2 b1 b0
The ECSR register indicates whether an error occurred on the CAN bus. See the CAN specification (ISO11898-1) for the
conditions when each error occurs.
Clear all of the bits, except for EDPM, to 0 through a software write. If the ECSR bit is set to 1 by the CAN module at the
same time that software writes 0 to it, the bit is set to 1.
Reading the TSR register returns the current value of the 16-bit free-running time stamp counter. The time stamp counter
reference clock is configured in the TSPS[1:0] bits in CTLR. The counter stops in CAN sleep mode and CAN halt mode,
and is initialized in CAN reset mode. The time stamp counter value is stored in the TSL[7:0] and TSH[7:0] bits in the
MBj_TS register when a received message is stored in a receive mailbox.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — TSTM[1:0] TSTE
The TCR register controls the CAN test mode. Write to TCR in CAN halt mode only.
CTX0 CRX0
Recessive level
CTX0 CRX0
(internal) (internal)
CAN transceiver
CTX0 CRX0
ACK
CTX0 CRX0
(internal) (internal)
CTX0 CRX0
Recessive level
ACK
CTX0 CRX0
(internal) (internal)
CPU reset
CANM[1:0]
= 01b, 11b CAN operation mode
CAN halt mode
(bus-off state)
CANM[1:0] = 10b*1
Note 1. The transition timing from the bus-off state to CAN halt mode depends on the setting of the CTLR.BOM[1:0] bits.
When the CTLR.BOM[1:0] bits are 01b, the state transition occurs immediately after entering the bus-off state.
When the CTLR.BOM[1:0] bits are 10b, the state transition occurs at the end of the bus-off state.
When the CTLR.BOM[1:0] bits are 11b, the state transition occurs at the setting of the CTLR.CANM[1:0] bits to 10b (CAN halt
mode).
Note 2. Change the CTLR.SLPM bit to set or cancel CAN sleep mode.
EIER
BCR
CSSR
ECSR (only the EDPM bit)
MBj_ID, MBj_DL, MBj_Dm and MBj_TS
MKRk
FIDCR0 and FIDCR1
MKIVLR
AFSR
RFPCR
TFPCR.
Table 29.8 Operation in CAN reset mode and CAN halt mode
Operation mode Receiver Transmitter Bus-off
CAN reset mode CAN module enters CAN reset CAN module enters CAN reset CAN module enters CAN reset mode
(forced transition) mode without waiting for the end mode without waiting for the end without waiting for the end of bus-off
CA79 of message reception of message transmission recovery
CAN reset mode CAN module enters CAN reset CAN module enters CAN reset CAN module enters CAN reset mode
CANM[1:0] = 01b mode without waiting for the end mode after waiting for the end of without waiting for the end of bus-off
of message reception message transmission*1,*4 recovery
CAN halt mode CAN module enters CAN halt CAN module enters CAN halt When the BOM[1:0] bits are 00b:
mode after waiting for the end of mode after waiting for the end of A halt request from the software is
message reception*2,*3 message transmission*1,*4 accepted only after bus-off recovery
When the BOM[1:0] bits are 01b:
CAN module automatically enters CAN
halt mode without waiting for the end of
bus-off recovery, regardless of a halt
request from software
When the BOM[1:0] bits are 10b:
CAN module automatically enters CAN
halt mode after waiting for the end of
bus-off recovery, regardless of a halt
request from software
When the BOM[1:0] bits are 11b:
CAN module enters CAN halt mode,
without waiting for the end of bus-off
recovery, if a halt is requested by
software during bus-off.
Note 1. If transmission of multiple messages is requested, a mode transition occurs after completion of the first transmission. If the
CAN reset mode is being requested during suspend transmission, mode transition occurs when the bus is idle, the next
transmission ends, or the CAN module becomes a receiver.
Note 2. If the CAN bus is locked at the dominant level, the program can detect this state by monitoring the BLIF flag in EIFR.
Note 3. If a CAN bus error occurs during reception after CAN halt mode is requested, the CAN module transitions to CAN halt mode.
Note 4. If a CAN bus error or arbitration-lost occurs during transmission after CAN reset mode or CAN halt mode is requested, the CAN
module transitions to the requested CAN mode.
Idle mode
STR.TRMST = 0
STR.RECST = 0
Transmission SOF
starts detected
Transmission Reception
completed completed
Transmit mode Receive mode
STR.TRMST = 1 STR.TRMST = 0
STR.RECST = 0 STR.RECST = 1
Arbitration lost
(3) When the CTLR.BOM[1:0] bits = 01b (automatic transition to CAN halt mode on bus-off entry)
The CAN module enters CAN halt mode when it reaches the bus-off state. The BORIF flag is not set to 1.
(4) When CTLR.BOM[1:0] bits = 10b (automatic transition to CAN halt mode on bus-off end)
The CAN module enters CAN halt mode when it completes recovery from bus-off. The BORIF flag is set to 1.
(5) When CTLR.BOM[1:0] bits = 11b (automatic transition to CAN halt mode through software)
and the CTLR.CANM[1:0] bits = 10b (CAN halt mode) during bus-off state
The CAN module enters CAN halt mode when it is in the bus-off state and the CANM[1:0] bits are set to 10b (CAN halt
mode). The BORIF flag is not set to 1. If the CANM[1:0] bits are not set to 10b during bus-off, the same behavior as (1)
applies.
Baud rate
fCAN
EXTAL prescaler fCANCLK
1 / (P + 1)
P = 0 to 1023
fCAN: CAN system clock
P: Value selected in BRP[9:0] bits in BCR (P = 0 to 1023)
fCANCLK: CAN communication clock (fCANCLK = fCAN / (P + 1))
Bit time
SS TSEG1 TSEG2
Sample point
fCAN fCANCLK
= =
Data transfer rate Baud rate prescaler division value*1 × Tq count for 1 bit time Tq count for 1 bit time
[bps]
Note 1. Division value of baud rate prescaler = P + 1 (P: 0 to 1023), where P is the BRP[9:0] setting in BCR.
Address
b7 b0
IDE RTR SID10 SID9 SID8 SID7 SID6 4005 0200h + 16 j + 0
SID5 SID4 SID3 SID2 SID1 SID0 EID17 EID16 4005 0200h + 16 j + 1
EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 4005 0200h + 16 j + 2
EID7 EID6 EID5 EID4 EID3 EID2 EID1 EID0 4005 0200h + 16 j + 3
4005 0200h + 16 j + 4
Address
b7 b0
SID10 SID9 SID8 SID7 SID6 4005 0400h + 4 k + 0
SID5 SID4 SID3 SID2 SID1 SID0 EID17 EID16 4005 0400h + 4 k + 1
EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 4005 0400h + 4 k + 2
EID7 EID6 EID5 EID4 EID3 EID2 EID1 EID0 4005 0400h + 4 k + 3
MKRk register
Address
b7 b0
IDE RTR SID10 SID9 SID8 SID7 SID6 4005 0420h + 4 n + 0
SID5 SID4 SID3 SID2 SID1 SID0 EID17 EID16 4005 0420h + 4 n + 1
EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 4005 0420h + 4 n + 2
EID7 EID6 EID5 EID4 EID3 EID2 EID1 EID0 4005 0420h + 4 n + 3
FIDCRn register
Mailbox 0 Mailbox 0
MKR0 register MKR0 register
Mailbox 3 Mailbox 3
Mailbox 4 Mailbox 4
MKR1 register MKR1 register
Mailbox 7 Mailbox 7
Mailbox 8 Mailbox 8
MKR2 register MKR2 register
Mailbox 11 Mailbox 11
Mailbox 12 Mailbox 12
MKR3 register MKR3 register
Mailbox 15 Mailbox 15
Mailbox 16 Mailbox 16
MKR4 register MKR4 register
Mailbox 19 Mailbox 19
Mailbox 20 Mailbox 20
MKR5 register MKR5 register
Mailbox 23 Mailbox 23
Mailbox 24 Mailbox 24
MKR6 register
MKR6 register Transmit FIFO
FIDCR0 register
Mailbox 27 Mailbox 27
Mailbox 28 Mailbox 28
MKR7 register
MKR7 register Receive FIFO
FIDCR1 register
Mailbox 31 Mailbox 31
ID setting in MBj_ID
Setting in MKIVLR*2 Mask bit values
(j = 0 to 31)*1
0: IDs not compared
1: IDs compared
ID value of received Setting in MKRk
message (k = 0 to 7)
Note 1. The settings in FIDCR0 and FIDCR1 are used in FIFO mailbox mode.
Note 2. Invalid in FIFO mailboxes.
j = 0 to 31
29.7.1 Reception
Figure 29.18 shows an operation example of data frame reception in overwrite mode.
The example shows the overwriting of the first message when the CAN module receives two consecutive CAN messages
that match the receiving conditions in MCTL_RXj (j = 0 to 31).
SOF CRC ACK EOF IFS SOF CRC ACK EOF IFS
CAN bus
MCTL_RXj
INVALDATA
MCTL_RXj
NEWDATA
MCTL_RXj
MSGLOST
CAN0 reception
complete interrupt
STR.
RECST
CAN0 error
interrupt
j = 0 to 31
SOF CRC ACK EOF IFS SOF CRC ACK EOF IFS
CAN bus
MCTL_RXj.INVALDATA
MCTL_RXj.NEWDATA
MCTL_RXj.MSGLOST
CAN0 reception
complete interrupt
STR.RECST
CAN0 error
interrupt
j = 0 to 31
29.7.2 Transmission
Figure 29.20 shows an operation example of data frame transmission.
CAN bus
MCTL_TXj
TRMACTIVE
MCTL_TXj
SENTDATA
MCTL_TXk
TRMREQ
Mailbox k
MCTL_TXk
TRMACTIVE
MCTL_TXk
SENTDATA
CAN0 transmission
complete interrupt
STR.
TRMST
j, k = 0 to 31, j k
Note 1. If arbitration is lost after the CAN module starts transmission, the TRMACTIVE flag is set to 0. Transmission
scanning is performed again to search for the highest-priority transmit mailbox from the beginning of the CRC
delimiter. If an error occurs either during transmission or following arbitration-lost, transmission scanning is
performed again to search for the highest-priority transmit mailbox from the start of the CRC delimiter.
29.8 Interrupts
The CAN module provides the following interrupts for each channel:
CAN0 reception complete interrupt for mailboxes 0 to 31 (CAN0_RXM)
CAN0 transmission complete interrupt for mailboxes 0 to 31 (CAN0_TXM)
CAN0 receive FIFO interrupt (CAN0_RXF)
CAN0 transmit FIFO interrupt (CAN0_TXF)
CAN0 error interrupt (CAN0_ERS).
Eight interrupt sources are available for the CAN0 error interrupts. Check the EIFR register to determine the interrupt
sources:
Bus error
Error-warning
Error-passive
Bus-off entry
Bus-off recovery
Receive overrun
Overload frame transmission
Bus lock.
Table 29.11 lists the CAN interrupts.
Note 1. In master reception, when the RSPCK auto-stop function is enabled, an overrun error does not occur because
the transfer clock is stopped on overrun error detection.
Bus interface
Internal
Module data bus peripheral bus
SPDR/SPDR_HA
SPDCR
Parity circuit
SPCKD
SSLND
SPND
SPCR2
Shift register SPCMD0
Selector Transmission/
reception controller
Normal
Event output
Clock
Loopback
Loopback
Loopback 2 Slave
Normal Master
MISOn
SPIn_SPTI
SPIn_SPRI
Loopback Slave
Loopback 2 SPIn_SPII
SPIn_SPEI
SSLn0
SPIn_SPTEND
SSLn1 to SSLn3
RSPCKn
b7 b6 b5 b4 b3 b2 b1 b0
If the SPCR.MSTR, SPCR.MODFEN, or SPCR.TXMD bit is changed while the SPCR.SPE bit is 1, do not perform
subsequent operations.
The SSLn0 to SSLn3 pins are not used in clock synchronous operation. The RSPCKn, MOSIn, and MISOn pins handle
communications. For clock synchronous operation in master mode (SPCR.MSTR = 1), the SPCMD0.CPHA bit can be
set to either 0 or 1. For clock synchronous operation in slave mode (SPCR.MSTR = 0), set the CPHA bit to 1. Do not
perform the operations if the CPHA bit is set to 0 when clock synchronous operation is in slave mode.
b7 b6 b5 b4 b3 b2 b1 b0
If the contents of SSLP are changed when the SPCR.SPE bit is 1, do not perform subsequent operations.
b7 b6 b5 b4 b3 b2 b1 b0
If the contents of SPPCR are changed when the SPCR.SPE bit is 1, do not perform subsequent operations.
b7 b6 b5 b4 b3 b2 b1 b0
[Setting condition]
Master mode:
When conditions 1. and 2. in the master mode, in the clearing conditions, are not satisfied.
Slave mode:
When the SPCR.SPE bit is 1, enabling the SPI function.
[Clearing conditions]
Master mode:
When condition 1. or conditions 2. and 3. are satisfied.
1. The SPCR.SPE bit is 0, indicating that the SPI is initialized.
2. The transmit buffer (SPTX) is empty, indicating that data for the next transfer is not set.
3. The SPI internal sequencer is in the idle state, indicating that operations up to the next-access delay are complete.
Slave mode:
When condition 1. is satisfied.
[Setting condition]
When the serial transfer begins with the SPCR.MSTR bit set to 0 (slave mode), SPCR.SPE bit set to 1, and the
transmission data not prepared, triggering an underrun error.
[Clearing condition]
When SPSR is read while this flag is 1, and then 0 is written to this flag.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
The SPDR/SPDR_HA register is the interface with the buffers that hold data for transmission and reception by the SPI.
When accessing this register in words (SPLW = 1), access the SPDR register. When accessing it in halfwords (SPLW =
0), access the SPDR_HA register.
The transmit buffer (SPTX) and receive buffer (SPRX) are independent but are both mapped to SPDR/SPDR_HA.
Figure 30.2 shows the configuration of the SPDR/SPDR_HA register.
Transmit buffer
SPTX
Internal peripheral bus
SPDR/SPDR_HA
SPRX
(a) Writing
Data written to SPDR/SPDR_HA is written to a transmit buffer SPTX. This is not affected by the value of the
SPDCR.SPRDTD bit, unlike when reading from SPDR/SPDR_HA.
Figure 30.3 shows the configuration of the bus interface with the transmit buffer when writing to SPDR/SPDR_HA.
SPDR/SPDR_HA
SPTX
(b) Reading
SPDR/SPDR_HA can be accessed to read the value of a receive buffer (SPRX) or a transmit buffer (SPTX). The setting
in the SPI Receive or Transmit Data Select bit in the SPI Data Control Register (SPDCR.SPRDTD) selects whether
reading is from the receive or transmit buffer.
Figure 30.4 shows the configuration of a bus interface with the receive and transmit buffers for reading from SPDR/
SPDR_HA.
SPDR/SPDR_HA
0 SPRX
1 SPTX
SPRDTD
b7 b6 b5 b4 b3 b2 b1 b0
The SPBR register sets the bit rate in master mode. If the contents of the SPBR register are changed while both the
SPCR.MSTR and SPCR.SPE bits are 1, do not perform subsequent operations.
When the SPI is in slave mode, the bit rate depends on the bit rate of the input clock, regardless of the settings in the
SPBR and the SPCMD0.BRDV[1:0] bits (bit rate division setting). Use bit rates that satisfy the electrical characteristics
of the device.
The bit rate is determined by combination of the SPBR and SPCMD0.BRDV[1:0] settings in the SPI Command Register.
The equation for calculating the bit rate is as follows:
f (PCLKB)
Bit rate =
2 × (n + 1) × 2N
In the equation, n denotes an SPBR setting (0, 1, 2, …, 255), and N denotes a BRDV[1:0] setting (0, 1, 2, or 3).
Table 30.3 lists examples of the relationship between the SPBR settings, BRDV[1:0] settings, and bit rates.
Table 30.3 Relationship between SPBR settings, BRDV[1:0] settings, and bit rates (1 of 2)
SPBR register (n) BRDV[1:0] bits (N) Division ratio Bit rate when PCLKB = 32 MHz
0 0 2 16.0 Mbps
1 0 4 8.00 Mbps
2 0 6 5.33 Mbps
Table 30.3 Relationship between SPBR settings, BRDV[1:0] settings, and bit rates (2 of 2)
SPBR register (n) BRDV[1:0] bits (N) Division ratio Bit rate when PCLKB = 32 MHz
3 0 8 4.00 Mbps
4 0 10 3.20 Mbps
5 0 12 2.67 Mbps
5 1 24 1.33 Mbps
5 2 48 667 kbps
5 3 96 333 kbps
255 3 4096 7.81 kbps
b7 b6 b5 b4 b3 b2 b1 b0
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — SCKDL[2:0]
SPCKD specifies the RSPCK delay, the period from the beginning of SSLni signal assertion to RSPCK oscillation, when
the SPCMD0.SCKDEN bit is 1. If the contents of SPCKD are changed while both the SPCR.MSTR and SPCR.SPE bits
are 1, do not perform subsequent operations.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — SLNDL[2:0]
The SSLND register specifies the SSL negation delay, the period from the transmission of a final RSPCK edge to the
negation of the SSLni signal during a serial transfer by the SPI in master mode. If the contents of SSLND are changed
while both the SPCR.MSTR and SPCR.SPE bits are 1, do not perform subsequent operations.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — SPNDL[2:0]
The SPND register specifies the next-access delay, the non-active period of the SSLni signal after termination of a serial
transfer, when the SPCMD0.SPNDEN bit is 1. If the contents of SPND are changed while both the SPCR.MSTR and
SPCR.SPE bits are 1, do not perform subsequent operations.
b7 b6 b5 b4 b3 b2 b1 b0
If the SPPE, SPOE, or SCKASE bit in SPCR2 is changed while the SPCR.SPE bit is 1, do not perform subsequent
operations.
The SPCMD0 register specifies the transfer format for the SPI in master mode.
Set this register while the transmit buffer is empty (SPSR.SPTEF is 1 and the data for the next transfer is not set), and
before the setting of the data to be transmitted when this register is referenced.
If the contents of SPCMD0 are changed while the SPCR.SPE bit is 1, do not perform subsequent operations.
30.3 Operation
In this section, the serial transfer period refers to the period from the beginning of driving valid data to the fetching of
the final valid data.
The SPI in single-master mode (SPI operation) or multi-master mode (SPI operation) determines the MOSI signal values
during the SSL negation period based on the MOIFE and MOIFV bit settings in SPPCR, as listed in Table 30.6.
Table 30.6 MOSI signal value determination during SSL negation period
MOIFE bit MOIFV bit MOSIn signal value during SSL negation period
0 0, 1 Final data from previous transfer
1 0 Low
1 1 High
30.3.3.1 Single master and single slave with the MCU as a master
Figure 30.5 shows a single-master and single-slave SPI system configuration example where the MCU is the master. In
the single-master and single-slave configuration, the SSLn0 to SSLn3 outputs of the MCU (master) are not used. The
SSL input of the SPI slave is fixed to the low level, and the SPI slave stays selected.*1
The MCU (master) drives the RSPCKn and MOSIn signals. The SPI slave drives the MISO signal.
Note 1. In the transfer format used when SPCMD0.CPHA is 0, the SSL signal for some slave devices cannot be fixed to
an active level. In this case, always connect the SSLni output of the MCU to the SSL input of the slave device.
RSPCKn SPCK
MOSIn MOSI
MISOn MISO
SSLn0 SSL
SSLn1
SSLn2
SSLn3
Figure 30.5 Single-master/single-slave configuration example with the MCU as the master
30.3.3.2 Single master and single slave with the MCU as a slave
Figure 30.6 shows a single-master and single-slave SPI system configuration example where the MCU is a slave. When
the MCU operates as a slave, the SSLn0 pin is used as SSL input. The SPI master drives the SPCK and MOSI signals.
The MCU (slave) drives the MISOn signals.*1
In the single-slave configuration in which the SPCMD0.CPHA bit is set to 1, the SSLn0 input of the MCU (slave) is
fixed to the low level, and the MCU (slave) stays selected. This enables serial transfer (Figure 30.7).
SPCK RSPCKn
MOSI MOSIn
MISO MISOn
SSL SSLn0
SSLn1
SSLn2
SSLn3
Figure 30.6 Single-master/single-slave configuration example with the MCU as a slave and CPHA = 0
SPCK RSPCK
RSPCKn
MOSI MOSI
MOSIn
MISO MISOn
MISO
SSL SSLn0
SSL0
SSLn1
SSL1
SSLn2
SSL2
SSLn3
SSL3
Figure 30.7 Single-master/single-slave configuration example with the MCU as a slave and CPHA = 1
30.3.3.3 Single master and multi slave with the MCU as a master
Figure 30.8 shows a single-master/multi-slave SPI system configuration example where the MCU is a master. In the
example, the SPI system includes the MCU (master) and four slaves (SPI slave 0 to SPI slave 3).
The RSPCKn and MOSIn outputs of the MCU (master) are connected to the RSPCK and MOSI inputs of SPI slave 0 to
SPI slave 3. The MISO outputs of SPI slave 0 to SPI slave 3 are all connected to the MISOn input of the MCU (master).
SSLn0 to SSLn3 outputs of the MCU (master) are connected to the SSL inputs of SPI slave 0 to SPI slave 3, respectively.
The MCU (master) drives RSPCKn, MOSIn, and SSLn0 to SSLn3 pins. Of the SPI slave 0 to SPI slave 3, the slave that
receives low-level input into the SSL input drives the MISO signal.
RSPCKn SPCK
MOSIn MOSI
MISOn MISO
SSLn0 SSL
SSLn1
SSLn2
SSLn3
SPI slave 1
SPCK
MOSI
MISO
SSL
SPI slave 2
SPCK
MOSI
MISO
SSL
SPI slave 3
SPCK
MOSI
MISO
SSL
SPCK RSPCK
RSPCKn
MOSI MOSI
MOSIn
MISO MISOn
MISO
SSLX SSLn0
SSL0
SSLY SSLn1
SSL1
SSLn2
SSL2
SSLn3
SSL3
MCU (slave Y)
RSPCK
RSPCKn
MOSIn
MOSI
MISOn
MISO
SSLn0
SSL0
SSLn1
SSL1
SSLn2
SSL2
SSLn3
SSL3
RSPCKn RSPCK
RSPCKn
MOSIn MOSI
MOSIn
MISOn MISO
MISOn
SSLn0 SSLn0
SSL0
SSLn1 SSLn1
SSL1
SSLn2 SSLn2
SSL2
SSLn3 SSLn3
SSL3
Port Y Port X
SPI slave 1
SPCK
MOSI
MISO
SSL
SPI slave 2
SPCK
MOSI
MISO
SSL
30.3.3.6 Master and slave in clock synchronous mode with the MCU as a master
Figure 30.11 shows a master and slave in clock synchronous mode where the MCU is a master. In this configuration,
SSLn0 to SSLn3 of the MCU (master) are not used.
The MCU (master) drives the RSPCKn and MOSIn signals. The SPI slave drives the MISO signal.
RSPCKn SPCK
MOSIn MOSI
MISOn MISO
SSLn0 SSL
SSLn1
SSLn2
SSLn3
Figure 30.11 Configuration example of master/slave in clock synchronous mode with the MCU as a master
30.3.3.7 Master and slave in clock synchronous mode with the MCU as a slave
Figure 30.12 shows a master and slave in clock synchronous mode configuration where the MCU is a slave. When the
MCU operates as a slave in clock synchronous mode, the MCU (slave) drives the MISOn signal and the SPI master
drives the SPCK and MOSI signals. SSLn0 to SSLn3 of the MCU (slave) are not used.
The MCU (slave) can only execute serial transfer in the single-slave configuration when SPCMD0.CPHA is set to 1.
SPCK RSPCK
RSPCKn
MOSI MOSIn
MOSI
MISO MISOn
MISO
SSL SSLn0
SSL0
SSLn1
SSL1
SSLn2
SSL2
SSLn3
SSL3
Figure 30.12 Configuration example of master and slave in clock synchronous mode with the MCU as a slave
and CPHA = 1
SPCMD0.SPB[3:0]
SPCMD0.SPB[3:0]
Transfer start
Transmit buffer
Bit 31 Bit 0
T31 T30 T29 T28 T27 T26 T25 T24 T23 T08 T07 T06 T05 T04 T03 T02 T01 T00
Copy
Output T31 T30 T29 T28 T27 T26 T25 T24 T23 T08 T07 T06 T05 T04 T03 T02 T01 T00
Bit 31 Bit 0
Shift register
Transfer end
Shift register
Bit 31 Bit 0
R31 R30 R29 R28 R27 R26 R25 R24 R23 R08 R07 R06 R05 R04 R03 R02 R01 R00 Input
Copy
R31 R30 R29 R28 R27 R26 R25 R24 R23 R08 R07 R06 R05 R04 R03 R02 R01 R00
Bit 31 Bit 0
Receive buffer
Figure 30.14 MSB-first transfer with 32-bit data and parity disabled
Transfer start
Transmit buffer
Bit 31 Bit 23 Bit 0
T31 T30 T29 T28 T27 T26 T25 T24 T23 T08 T07 T06 T05 T04 T03 T02 T01 T00
Output Copy
T31 T30 T29 T28 T27 T26 T25 T24 T23 T08 T07 T06 T05 T04 T03 T02 T01 T00
Transfer end
Shift register
Bit 31 Bit 24 Bit 23 Bit 0
R00 Input
T31 T30 T29 T28 T27 T26 T25 T24 R23 R08 R07 R06 R05 R04 R03 R02 R01
Copy
T31 T30 T29 T28 T27 T26 T25 T24 R23 R08 R07 R06 R05 R04 R03 R02 R01 R00
Figure 30.15 MSB-first transfer with 24-bit data and parity disabled
Transfer start
Transmit buffer
Bit 31 Bit 0
T31 T30 T29 T28 T27 T26 T25 T24 T23 T08 T07 T06 T05 T04 T03 T02 T01 T00
Copy
Output T00 T01 T02 T03 T04 T05 T06 T07 T08 T23 T24 T25 T26 T27 T28 T29 T30 T31
Bit 31 Bit 0
Shift register
Transfer end
Shift register
Bit 31 Bit 0
R00 R01 R02 R03 R04 R05 R06 R07 R08 R23 R24 R25 R26 R27 R28 R29 R30 R31 Input
Copy
R31 R30 R29 R28 R27 R26 R25 R24 R23 R08 R07 R06 R05 R04 R03 R02 R01 R00
Bit 31 Bit 0
Receive buffer
Figure 30.16 LSB-first transfer with 32-bit data and parity disabled
Transfer start
Transmit buffer
Bit 31 Bit 0
T31 T30 T29 T28 T27 T26 T25 T24 T23 T08 T07 T06 T05 T04 T03 T02 T01 T00
Copy
Output T00 T01 T02 T03 T04 T05 T06 T07 T08 T23 T24 T25 T26 T27 T28 T29 T30 T31
Bit 31 Bit 0
Shift register
Transfer end
Input
Shift register
Bit 31 Bit 0
R00 R01 R02 R03 R04 R05 R06 R07 R08 R23 T24 T25 T26 T27 T28 T29 T30 T31
Copy
T31 T30 T29 T28 T27 T26 T25 T24 R23 R08 R07 R06 R05 R04 R03 R02 R01 R00
Bit 31 Bit 0
Receive buffer
Figure 30.17 LSB-first transfer with 24-bit data and parity disabled
Transfer start
Transmit buffer
Bit 31 Bit 0
T31 T30 T29 T28 T27 T26 T25 T24 T23 T08 T07 T06 T05 T04 T03 T02 T01 T00
Parity calculated
Parity added
T31 T30 T29 T28 T27 T26 T25 T24 T23 T08 T07 T06 T05 T04 T03 T02 T01 P
Copy
Output T31 T30 T29 T28 T27 T26 T25 T24 T23 T08 T07 T06 T05 T04 T03 T02 T01 P
Bit 31 Bit 0
Shift register
Transfer end
Shift register
Bit 31 Bit 0
R31 R30 R29 R28 R27 R26 R25 R24 R23 R08 R07 R06 R05 R04 R03 R02 R01 P Input
Copy
R31 R30 R29 R28 R27 R26 R25 R24 R23 R08 R07 R06 R05 R04 R03 R02 R01 P
Bit 31 Bit 0
Receive buffer
Figure 30.18 MSB-first transfer with 32-bit data and parity enabled
Transfer start
Transmit buffer
Bit 31 Bit 23 Bit 0
T31 T30 T29 T28 T27 T26 T25 T24 T23 T08 T07 T06 T05 T04 T03 T02 T01 T00
Parity added
T31 T30 T29 T28 T27 T26 T25 T24 T23 T08 T07 T06 T05 T04 T03 T02 T01 P
Copy
Output
T31 T30 T29 T28 T27 T26 T25 T24 T23 T08 T07 T06 T05 T04 T03 T02 T01 P
Transfer end
Shift register
Bit 31 Bit 24 Bit 23 Bit 0
T31 T30 T29 T28 T27 T26 T25 T24 R23 R08 R07 R06 R05 R04 R03 R02 R01 P Input
Copy
T31 T30 T29 T28 T27 T26 T25 T24 R23 R08 R07 R06 R05 R04 R03 R02 R01 P
Figure 30.19 MSB-first transfer with 24-bit data and parity enabled
Transfer start
Transmit buffer
Bit 31 Bit 0
T31 T30 T29 T28 T27 T26 T25 T24 T23 T08 T07 T06 T05 T04 T03 T02 T01 T00
Bit 31 Bit 0
P T30 T29 T28 T27 T26 T25 T24 T23 T08 T07 T06 T05 T04 T03 T02 T01 T00
Copy
Output T00 T01 T02 T03 T04 T05 T06 T07 T08 T23 T24 T25 T26 T27 T28 T29 T30 P
Bit 31 Bit 0
Shift register
Transfer end
Shift register
Bit 31 Bit 0
R00 R01 R02 R03 R04 R05 R06 R07 R08 R23 R24 R25 R26 R27 R28 R29 R30 P Input
Copy
P R30 R29 R28 R27 R26 R25 R24 R23 R08 R07 R06 R05 R04 R03 R02 R01 R00
Bit 31 Bit 0
Receive buffer
Figure 30.20 LSB-first transfer with 32-bit data and parity enabled
Transfer start
Transmit buffer
Bit 31 Bit 0
T31 T30 T29 T28 T27 T26 T25 T24 T23 T08 T07 T06 T05 T04 T03 T02 T01 T00
Bit 31 Bit 0
T31 T30 T29 T28 T27 T26 T25 T24 P T08 T07 T06 T05 T04 T03 T02 T01 T00
Copy
Output T00 T01 T02 T03 T04 T05 T06 T07 T08 P T24 T25 T26 T27 T28 T29 T30 T31
Bit 31 Bit 0
Shift register
Transfer end
Input
Shift register
Bit 31 Bit 0
R00 R01 R02 R03 R04 R05 R06 R07 R08 P T24 T25 T26 T27 T28 T29 T30 T31
Copy
T31 T30 T29 T28 T27 T26 T25 T24 P R08 R07 R06 R05 R04 R03 R02 R01 R00
Bit 31 Bit 0
Receive buffer
Figure 30.21 LSB-first transfer with 24-bit data and parity enabled
Start End
Serial transfer period
RSPCK
1 2 3 4 5 6 7 8
cycle
RSPCK
RSPCKn
(CPOL = 0)
RSPCK
RSPCKn
(CPOL = 1)
Sampling
timing
MOSIn
MOSI
MISOn
MISO
SSLni
SSLi
t1 t2 t3
Start End
Serial transfer period
RSPCK cycle 1 2 3 4 5 6 7 8
RSPCKn
(CPOL = 0)
RSPCKn
(CPOL = 1)
Sampling
timing
MOSIn
MISOn
SSLni
t1 t2 t3
SPDR_HA access W W
RSPCKn
(CPHA = 1, CPOL = 0)
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
Receive buffer
Empty Full
state
SPIn_SPRI
(1)
SPRF
OVRF
(2)
The operation of the flags at timings (1) and (2) in Figure 30.24 is as follows:
1. When a serial transfer ends with the SPDR/SPDR_HA receive buffer empty, the SPI generates a receive buffer full
interrupt request (SPIn_SPRI), the SPI sets the SPSR.SPRF flag to 1, and the received data is copied from the shift
register to the receive buffer.
2. When a serial transfer ends with the SPDR/SPDR_HA receive buffer holding data that was received in the previous
serial transfer, the SPI sets the SPSR.OVRF flag to 1 and discards the received data in the shift register.
SPDR_HA access W W
RSPCKn
(CPHA = 1, CPOL = 0)
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
TXMD
(TXMD = 1) (1)
Receive buffer
Empty
state
SPIn_SPRI
(2)
SPRF
OVRF
(3)
SPDR_HA access W W R
RSPCKn
(CPHA = 0, CPOL = 0) 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
Transmit buffer state Empty Full Empty Full Empty
(1) (2) (3) (4)
SPIn_SPTI
SPTEF
SPRF
Figure 30.26 Operation example of SPIn_SPTI and SPIn_SPRI interrupts when CPHA = 0 and CPOL = 0
SPDR_HA access W W R
RSPCKn
(CPHA = 1, CPOL = 0) 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
Transmit buffer state Empty Full Empty Full Empty
(1) (2) (3) (4)
SPIn_SPTI
SPTEF
SPRF
Figure 30.27 Operation example of SPIn_SPTI and SPIn_SPRI interrupts when CPHA = 1 and CPOL = 0
The operation of the SPI at timings (1) to (5) in Figure 30.27 is as follows:
(1) When transmit data is written to SPDR/SPDR_HA with the transmit buffer of SPDR/SPDR_HA empty and data for
the next transfer not set, the SPI writes data to the transmit buffer and clears the SPSR.SPTEF flag to 0.
(2) If the shift register is empty, the SPI copies data in the transmit buffer to the shift register, generates a transmit
buffer empty interrupt request (SPIn_SPTI), and sets the SPSR.SPTEF flag to 1. How a serial transfer is started
depends on the SPI mode. For details, see section 30.3.10, SPI Operation, and section 30.3.11, Clock Synchronous
Operation.
(3) When transmit data is written to SPDR/SPDR_HA either by the transmit buffer empty interrupt routine, or by the
processing of the transmit buffer empty using the SPTEF flag, the SPI writes data to the transmit buffer and clears
the SPTEF flag to 0. Because the serially transferred data is stored in the shift register, the SPI does not copy the
data in the transmit buffer to the shift register.
(4) When the serial transfer ends with the SPDR/SPDR_HA receive buffer empty, the SPI copies the receive data in the
shift register to the receive buffer, generates a receive buffer full interrupt request (SPIn_SPRI), and sets the SPRF
flag to 1. Because the shift register is empty on completion of the serial transfer, when the transmit buffer was full
before the serial transfer ended, the SPI sets the SPTEF flag to 1 and copies data in the transmit buffer to the shift
register. Even when received data is not copied from the shift register to the receive buffer in an overrun error status,
on completion of the serial transfer, the SPI determines that the shift register is empty, so data transfer from the
transmit buffer to the shift register is enabled.
(5) When SPDR/SPDR_HA is read either by the receive buffer full interrupt routine or by the processing of the receive
buffer full interrupt using the SPRF flag, the receive data can be read.
If SPDR/SPDR_HA is written to when the transmit buffer holds untransmitted data (SPTEF flag is 0), the SPI does not
update data in the transmit buffer. When writing to SPDR/SPDR_HA, make sure to use either a transmit buffer empty
interrupt request or to process a transmit buffer empty interrupt using the SPTEF flag. To use a transmit buffer empty
interrupt, set the SPTIE bit in SPCR to 1. If the SPI function is disabled (SPCR.SPE bit is 0), set the SPTIE bit to 0.
When serial transfer ends with the receive buffer full (SPRF flag is 1), the SPI does not copy data from the shift register
to the receive buffer, and detects an overrun error (see section 30.3.8, Error Detection). To prevent a receive data overrun
error, read the received data using a receive buffer full interrupt request before the next serial transfer ends. To use an SPI
receive buffer full interrupt, set the SPCR.SPRIE bit to 1.
Transmission and reception interrupts or the associated IELSRm.IR flags in the ICU, where m is the interrupt vector
number, can be used to confirm the states of the transmit and receive buffers. Similarly, the SPTEF and SPRF flags can
be used to confirm the states of the transmit and receive buffers. See section 13, Interrupt Controller Unit (ICU) for the
interrupt vector numbers.
Table 30.7 Relationship between non-normal transfer operations and SPI error detection function
Operation Occurrence condition SPI operation Error detection
1 SPDR/SPDR_HA is written when the transmit buffer The contents of the transmit buffer are kept None
is full Write data is missing.
2 SPDR/SPDR_HA is read when the receive buffer is The contents of the receive buffer and None
empty previously received data are output
3 Serial transfer is started in slave mode when the SPI Serial transfer is suspended Underrun error
is not able to transmit data Transmit or receive data is missing
Driving of the MISOA output signal is stopped
SPI function is disabled.
4 Serial transfer terminates when the receive buffer is The contents of the receive buffer are kept Overrun error
full Receive data is missing.
5 An incorrect parity bit is received during full-duplex The parity error flag is asserted Parity error
synchronous serial communications with the parity
function enabled
6 The SSLn0 input signal is asserted when the serial Driving of the RSPCKn, MOSIn, and SSLn1 to Mode fault error
transfer is idle in multi-master mode SSLn3 output signals is stopped
SPI function is disabled.
7 The SSLn0 input signal is asserted during serial Serial transfer is suspended Mode fault error
transfer in multi-master mode Transmit or receive data is missing
Driving of the RSPCKn, MOSIn, and SSLn1 to
SSLn3 output signals is stopped
SPI function is disabled.
8 The SSLn0 input signal is negated during serial Serial transfer is suspended Mode fault error
transfer in slave mode Transmit or receive data is missing
Driving of the MISOn output signal is stopped
SPI function is disabled.
In operation 1 described in Table 30.7, the SPI does not detect an error. To prevent data omission during writes to SPDR/
SPDR_HA, the writes to SPDR/SPDR_HA must be executed using a transmit buffer empty interrupt request (when
SPSR.SPTEF flag is 1). Similarly, the SPI does not detect an error in operation 2. To prevent extraneous data from being
read, SPDR/SPDR_HA reads must be executed using an SPI receive buffer full interrupt request (when SPSR.SPRF flag
is 1).
For information on the other errors, see the following sections:
SPSR access R W
SPDR_HA access R
RSPCKn
(CPHA = 1, CPOL = 0)
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
(4)
OVRF
(1)
SPDR_HA access R
RSPCK RSPCK
cycle 1 2 3 4 5 6 7 8 cycle 1 2 3 4 5 6 7 8
Clock is stopped
RSPCKn
(CPOL = 0)
(2)
RSPCKn
(CPOL = 1)
Sampling
timing
MOSIn
MISOn
SSLni
t1 t2 t3 t1 t2
Receive buffer Em
Empty Full pty Full
state
SPRF
(Receive buffer full flag)
Receive buffer
OVRF read
Low (1)
(Overrun error flag)
Output: Undefined (0 or 1)
SPI transfer format (CPHA = 1) t1: SPI clock delay register (SPCKD)
Input: don’t care
t2: SPI slave select negation delay register (SSLND)
t3: SPI next-access delay register (SPND)
Figure 30.29 Clock stop waveform when serial transfer continues while receive buffer is full in master mode
with CPHA = 1
SPDR_HA access R
RSPCK RSPCK
cycle 1 2 3 4 5 6 7 8 cycle 1 2 3 4 5 6 7 8
Clock is stopped
RSPCKn
(CPOL = 0)
(2)
RSPCKn
(CPOL = 1)
Sampling
timing
MOSIn
MISOn
SSLni
t1 t2 t3 t1 t2
Receive buffer Em
Empty Full pty Full
state
SPRF
(Receive buffer full flag)
Receive buffer
OVRF read
Low (1)
(Overrun error flag)
Output: Undefined (0 or 1)
SPI transfer format (CPHA = 0) t1: SPI clock delay register (SPCKD)
Input: don’t care
t2: SPI slave select negation delay register (SSLND)
t3: SPI next-access delay register (SPND)
Figure 30.30 Clock stop waveform when serial transfer continues while receive buffer is full in master mode
with CPHA = 0
The operation of the flags at timings (1) and (2) in Figure 30.29 and Figure 30.30 is as follows:
(1) When the receive buffer is full, an overrun error does not occur because the RSPCK clock is stopped.
(2) If SPDR/SPDR_HA is read while the clock is stopped, data in the receive buffer can be read. The RSPCK clock
restarts after reading the receive buffer (after SPSR.SPRF is set to 0).
Figure 30.31 shows an example operation of the OVRF and PERF flags. The SPSR access shown in Figure 30.31
indicates the condition of access to the SPSR register, where W denotes a write cycle, and R a read cycle. In the example,
full-duplex synchronous serial communications is performed while the SPCR.TXMD bit is 0 and the SPCR2.SPPE bit is
1. The SPI performs an 8-bit serial transfer in which the SPCMD0.CPHA bit is 1 and the SPCMD0.CPOL bit is 0. The
numbers given for RSPCKn in the waveform represent the number of RSPCK cycles, such as the number of transferred
bits.
SPSR access R W
RSPCKn
(CPHA = 1, CPOL = 0)
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
PERF (2)
(1)
OVRF (3)
When the MODF flag is 1, writing 1 to the SPE bit is ignored by the SPI. To enable the SPI function after the detection of
an underrun error, the MODF flag must be set to 0.
Table 30.8 Relationship between the SCKDEN bit, SPCKD, and RSPCK delay
SPCMD0.SCKDEN bit SPCKD.SCKDL[2:0] bits RSPCK delay
0 000b to 111b 1 RSPCK
1 000b 1 RSPCK
001b 2 RSPCK
010b 3 RSPCK
011b 4 RSPCK
100b 5 RSPCK
101b 6 RSPCK
110b 7 RSPCK
111b 8 RSPCK
Table 30.9 Relationship between the SLNDEN bit, SSLND, and SSL negation delay
SPCMD0.SLNDEN bit SSLND.SLNDL[2:0] bits SSL negation delay
0 000b to 111b 1 RSPCK
1 000b 1 RSPCK
001b 2 RSPCK
010b 3 RSPCK
011b 4 RSPCK
100b 5 RSPCK
101b 6 RSPCK
110b 7 RSPCK
111b 8 RSPCK
Table 30.10 Relationship between the SPNDEN bit, SPND, and next-access delay (1 of 2)
SPCMD0.SPNDEN bit SPND.SPNDL[2:0] bits Next-access delay
0 000b to 111b 1 RSPCK + 2 PCLKB
Table 30.10 Relationship between the SPNDEN bit, SPND, and next-access delay (2 of 2)
SPCMD0.SPNDEN bit SPND.SPNDL[2:0] bits Next-access delay
1 000b 1 RSPCK + 2 PCLKB
001b 2 RSPCK + 2 PCLKB
010b 3 RSPCK + 2 PCLKB
011b 4 RSPCK + 2 PCLKB
100b 5 RSPCK + 2 PCLKB
101b 6 RSPCK + 2 PCLKB
110b 7 RSPCK + 2 PCLKB
111b 8 RSPCK + 2 PCLKB
Set SPI Bit Rate Register (SPBR) • Set transfer bit rate
Figure 30.32 Example of initialization flow in master mode for SPI operation
Transmission processing
Start
Pre-transfer processing transmission
processing
Transmit buffer
empty interrupt (SPIn_SPTI) No
or
*1
Clear the SPSR.MODF, OVRF, SPSR.SPTEF = 1
[1] Clear error sources
PERF, and UDRF flags
Yes
SPCR.SPTIE = 0,
Proceed to Proceed to Proceed to SPCR2.SPIIE
Yes =1
transmission reception error or
processing processing processing SPCR.SPTIE = 0,
*2
SPCR2.SPIIE = 0
Yes
SPCR.SPE = 0,
SPCR2.SPIIE = 0
End of
transmission
processing
Note 1. Before writing data for transmission to SPDR/SPDR_HA, check the transmit buffer empty interrupt by reading the SPSR.SPTEF flag,
if the flag for polling is used.
Note 2. Setting the idle interrupt is prohibited (SPCR2.SPIIE = 0), if the flag for polling is used.
Note 3. Wait more than 1 PCLKB after writing data for transmission to SPDE and before starting to poll PSR.IDLNF, if the flag for polling is
used.
Start reception
End of initial settings processing
Receive buffer No
Clear the SPSR.MODF, OVRF,
[1] Clear error sources full interrupt (SPIn_SPRI)
PERF, and UDRF flags
or
SPSR.SPRF = 1
[3] Set the SPE bit to enabled Read receive data from SPDR/SPDR_HA
Enable the required interrupts at
Set SPCR.SPE = 1 the same time.
Set SPTIE, SPRIE, and SPEIE Using the interrupt is prohibited if
No
the flag for polling is used.
Has the last of the
data been read
Error processing
Yes
Repeat the transfer processing [6] Run the initialization processing again
The final sampling timing changes depending on the bit length of transfer data. In slave mode, the SPI data length is
determined by the SPCMD0.SPB[3:0] bit setting. The polarity of the SSLn0 input signal is determined by the
SSLP.SSL0P bit setting. For details on the SPI transfer format, see section 30.3.5, Transfer Format.
Start of initialization in
slave mode
Set SPI Slave Select Polarity • Set polarity of SSLn0 input signal
Register (SSLP)
End of initialization in
slave mode
Figure 30.36 Example initialization flow in slave mode for SPI operation
Start
End of initial settings transmission
processing
Note 1. Before writing data for transmission to SPDR/SPDR_HA, check the transmit buffer empty interrupt by reading SPSR.SPTEF flag, if
the flag for polling is used.
Start reception
End of initial settings processing
Yes
Set SPCR2.SPIIE = 0 [2] Disable idle interrupts
[3] Set the SPE bit to enabled. Read receive data from SPDR/SPDR_HA
Enable the required interrupts at
Set SPCR.SPE = 1 the same time.
Set SPTIE, SPRIE, and SPEIE Using the interrupt is prohibited if
the flag for polling is used. Has the last of the No
data been read
End of reception
processing
Error processing
Error interrupt
(SPIn_SPEI) or No
Clear the SPSR.MODF, OVRF, SPSR.MODF/OVRF/PERF
UDRF, and PERF flags [1] Clear error sources =1
Yes
Repeat the transfer processing [5] Run the initialization processing again
Start of initialization in
master mode
Set SPI Bit Rate Register (SPBR) • Set transfer bit rate
End of initialization in
master mode
Figure 30.40 Example of initialization flow in master mode for clock synchronous operation
Figure 30.41 Example of initialization flow in slave mode for clock synchronous operation
Table 30.11 SPLP2 and SPLP bit settings and received data
SPPCR.SPLP2 bit SPPCR.SPLP bit Received data
0 0 Input data from the MOSIn or MISOn pin
0 1 Inverted transmit data
1 0 Transmit data
1 1 Transmit data
Transmission
Shift register
(MOSIn/MISOn)
Loopback
Loopback 2
Normal
Reception
(MISOn/MOSIn)
Figure 30.42 Configuration of shift register I/O paths in loopback mode for master mode
Start of self-diagnosis of
parity circuit
No parity error
No parity error
(2) Underrun
This event signal is output in response to an underrun when a serial transfer starts while the transmission data is not
ready, and the SPCR.MSTR bit is 0, and the SPCR.SPE bit is 1. Under these conditions, the MODF and UDRF flags are
set to 1.
(3) Overrun
This event signal is output in response to an overrun when a serial transfer completes while the reception buffer contains
unread data, and the SPCR.TXMD bit is 0. Under these conditions, the OVRF flag is set to 1.
Whether the operation is in master mode or slave mode, an event is not output if 0 is written to the SPCR.SPE bit in
transmission or the SPCR.SPE bit is cleared by the mode fault or underrun error.
30.5.4 Restrictions on Mode Fault, Underrun, Overrun, or Parity Error Event Output
Using the mode fault, underrun, overrun, or parity error event is prohibited if the SPI is in multi-master mode (the
SPCR.SPMS bit is 0, the SPCR.MSTR bit is 1, and the SPCR.MODFEN bit is 1).
Note 1. The circuit cannot divide data used in CRC calculations. Write data in 8-bit or 32-bit units.
Data bus
CRCDOR/ CRCCR0
CRCDOR_HA/
CRCDOR_BY CRC snoop block
CRCDIR/ =?
CRCDIR_BY
CRCCR1
Address bus
b7 b6 b5 b4 b3 b2 b1 b0
b7 b6 b5 b4 b3 b2 b1 b0
CRCSE CRCS — — — — — —
N WR
Value after reset: 0 0 0 0 0 0 0 0
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
The CRCDIR register is a read/write 32-bit register to write data for CRC-32 or CRC-32C calculation. The
CRCDIR_BY (CRCDIR[31:24]) is a read/write 8-bit register to write data for CRC-8, CRC-16, or CRC-CCITT
calculation.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
The CRCDOR register is a read/write 32-bit register for CRC-32 or CRC-32C calculation.
The CRCDOR_HA (CRCDOR[31:16]) register is a read/write 16-bit register for CRC-16 or CRC-CCITT calculation.
The CRCDOR_BY (CRCDOR[31:24]) register is a read/write 8-bit register for CRC-8 calculation.
Because its initial value is 0000 0000h, rewrite the CRCDOR/CRCDOR_HA/CRCDOR_BY register to perform the
calculations using a value other than the initial value.
Data written to the CRCDIR/CRCDIR_BY register is CRC calculated and the result is stored in the CRCDOR/
CRCDOR_HA/CRCDOR_BY register. If the CRC code is calculated following transferred data and the result is 0000
0000h, there is no CRC error.
— — CRCSA[13:0]
31.3 Operation
3. Read the calculation result in the CRC Data Output Register (CRCDOR_HA)
CRC code = F78Fh
F 7 8 F F 0
3. Read the calculation result in the CRC Data Output Register (CRCDOR_HA)
CRC code = EF1Fh
Clear CRCDOR/CRCDOR_HA/CRCDOR_BY
6. Read the calculation result in the CRC Data Output Register (CRCDOR_HA)
CRC code = 0000h no error
Clear CRCDOR/CRCDOR_HA/CRCDOR_BY
6. Read the calculation result in the CRC Data Output Register (CRCDOR_HA)
CRC code = 0000h no error
CRC calculation is performed 1 byte at a time. When the target I/O register address is accessed in words (16 bits) or long
words (32 bits), the CRC code is generated on the lower byte (1 byte) of data.
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
Table 32.1 lists the ADC16 specifications, Table 32.2 lists the functions, and Figure 32.1 shows a block diagram.
BGR VREFADC
VREFH0
A/D data register A/D control register
VREFL0
Power generator
(for self-diagnosis)
Internal reference voltage
MUX
SBIAS/VREFI
Analog
AN023
MUX
Synchronous trigger
AN007 (ELC_AD00, ELC_AD01)
Analog
AN005
AMP1O/AN003
AN001 Asynchronous trigger
(ADTRG0)
SDADC24 + + +
OPAMP0 OPAMP1 OPAMP2
circuit
- - -
OPAMP circuit
The following conditions determine the formats for data in the ADDRy, ADDBLDR, ADDBLDRA, ADDBLDRB,
ADTSDR, and ADOCDR registers:
The setting of the Average Count Select bits (ADADC.ADC[2:0]) (once, twice, three times, four times, or 16 times
setting).
AD[15:0]
AD[15:0]
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — DIAGST[1:0]
To enter A/D-converted value average mode when in double trigger mode, select the channel using the DBLANS[4:0]
bits in the ADANSA0 and ADANSA1 registers.
Table 32.4 Relationship between DBLANS bit settings and double-trigger enabled channels (single-ended input
mode)
Note: A/D converted data from the self-diagnosis function, temperature sensor output, and internal reference voltage
cannot be used in double trigger mode.
Note 1. The reference voltage of SDADC24 is SBIAS/VREFI. When not using SDADC24, SBIAS/VREFI cannot be A/D
converted. For SBIAS/VREFI setting, see section 33, 24-Bit Sigma-Delta A/D Converter (SDADC24).
Table 32.5 Relationship between DBLANS bit settings and double-trigger enabled channels (differential input
mode)
The A/D conversion results from the duplication channel (selected in DBLANS[4:0] bits) started by the first trigger
are stored in the A/D Data Register y and those started by the second trigger are stored in the A/D Data Duplication
Register.
When the DBLE bit is set (double trigger mode is selected), the channels specified in the ADANSA0 and ADANSA1
registers are invalid. Double trigger mode is deselected by setting DBLE bit to 0. When DBLE bit is set to 1 again, the
double-trigger mode operation is the same as the first time when scanning with the first trigger.
Do not select double trigger mode in continuous scan mode. Software triggering cannot be used in double trigger mode.
Always set the ADST bit to 0 before setting the DBLE bit. In other words, do not set the DBLE bit at the same time as
writing 1 to the ADST bit.
Table 32.6 Selectable targets for A/D Conversion depending on settings of scan mode and double trigger
mode
Targets for A/D conversion
Analog input Internal
Scan mode Double trigger (including Analog input Temperature reference
setting mode setting Self-diagnosis group A) (group B) sensor output voltage
Single scan DBLE = 0 x
DBLE = 1 x (1 ch only) x x x
Continuous scan DBLE = 0 x x x
DBLE = 1 x x x x x
Group scan DBLE = 0 x x
DBLE = 1 x (1 ch only) x x
The ANSAn bits (n = 00 to 08) in the ADANSA0 register or the DBLANS[4:0] bits in the ADCSR register
The ANSBn bits (n = 00 to 08) in the ADANSB0 register.
For channels on which the A/D conversion is performed and for which average mode is not selected, a normal 1-time
conversion is executed and the conversion result is stored in the A/D Data Register.
When the ADANIM.ANIM[n] bit is set to 1 to select differential input, average mode operation based on the setting of
even channel associated with ADANIM.ANIM[n] bit is enabled.
Example: When ADANIM.ANIM[0] = 1, set the ADADS0[1:0] bits to 01b.
When ADANIM.ANIM[1] = 1, set the ADADS0[3:2] bits to 01b.
When ADANIM.ANIM[2] = 1, set the ADADS0[5:4] bits to 01b.
When ADANIM.ANIM[3] = 1, set the ADADS0[7:6] bits to 01b.
Only set the ADADS0 register bits when the ADCSR.ADST bit is 0.
Continuous
conversion count
1 time AN000 AN001 AN002 AN003 AN004 AN005 AN006 AN007 AN000 AN001 AN002
Conversion in progress
Figure 32.2 Scan conversion sequence with ADADC.ADC[2:0] = 011b, ADADS0.ADS02 = 1, and
ADADS0.ADS06 = 1
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — ADC[2:0]
— — TRSA[5:0] — — TRSB[5:0]
Table 32.9 lists the A/D conversion start sources selected in the TRSA[5:0] bits.
TSSAD bit (Temperature Sensor Output A/D- Converted Value Average Mode Select)
When the TSSAD bit is set to 1, A/D conversion of the temperature sensor output is selected and performed successively
for the number of times specified in the ADC[2:0] bits in ADADC. The mean value is returned to the ADTSDR register.
Only set the TSSAD bit when the ADCSR.ADST bit is 0.
OCSAD bit (Internal Reference Voltage A/D- Converted Value Average Mode Select)
When the OCSAD bit is set to 1, A/D conversion of the internal reference voltage is selected and performed successively
for the number of times specified in the ADC[2:0] bits in the ADADC register. The mean value is returned to the
ADOCDR register.
Only set the OCSAD bit while the ADCSR.ADST bit is 0.
b7 b6 b5 b4 b3 b2 b1 b0
SST[7:0]
The ADSSTRn register sets the sampling time for analog input. If one state is 1 ADCLK (A/D conversion clock) cycle
and the ADCLK clock is 32 MHz, then one state is 31.25 ns. The initial value is 13 states.
The sampling time can be adjusted if the impedance of the analog input signal source is too high to secure sufficient
sampling time, or if the ADCLK clock is slow.
When the ADANIM.ANIM[n] bit is set to 1 to select differential input, select the even channel associated with ANIM[n]
bit.
Example: When ADANIM.ANIM[0] = 1, ADSSTR00.SST[7:0] bits are used.
When ADANIM.ANIM[1] = 1, ADSSTR02.SST[7:0] bits are used.
When ADANIM.ANIM[2] = 1, ADSSTR04.SST[7:0] bits are used.
When ADANIM.ANIM[3] = 1, ADSSTR06.SST[7:0] bits are used.
The lower limit of the sampling time setting depends on the frequency ratio:
If the frequency ratio of PCLKB to PCLKD (ADCLK) = 1:1, the sampling time must be set to a value of more
than 5 states
If the frequency ratio of PCLKB to PCLKD (ADCLK) = 1:2 or 1:4, the sampling time must be set to a value of
more than 6 states.
Table 32.10 shows the relationship between the A/D Sampling State Register n and the associated channels. For details,
see section 32.3.8, Analog Input Sampling and Scan Conversion Time.
Only set the SST[7:0] bits when the ADCSR.ADST bit is 0.
Table 32.10 Relationship between A/D Sampling State Register n and associated channels
Bit name Associated channels
ADSSTR00.SST[7:0] bits*1 AN000
ADSSTR01.SST[7:0] bits AN001
ADSSTR02.SST[7:0] bits AN002
ADSSTR03.SST[7:0] bits AN003
ADSSTR04.SST[7:0] bits AN004
ADSSTR05.SST[7:0] bits AN005
ADSSTR06.SST[7:0] bits AN006
ADSSTR07.SST[7:0] bits AN007
ADSSTR08.SST[7:0] bits AN008
ADSSTRL.SST[7:0] bits AN016 to AN023, SBIAS/VREFI
ADSSTRT.SST[7:0] bits Temperature sensor output*2
ADSSTRO.SST[7:0] bits Internal reference voltage*2
Note 1. When the self-diagnosis function is selected, the sampling time set in the ADSSTR00.SST[7:0] bits is applied.
Note 2. When the temperature sensor output or the internal reference voltage is converted, set the sampling time to more
than 5 μs. Because the maximum SST[7:0] value is 255 states, the ADCLK frequency must be such that the
resulting sampling time is 32 MHz or at least 5 μs.
b7 b6 b5 b4 b3 b2 b1 b0
— — PCHG[1:0] ADNDIS[3:0]
Note 1. Even analog input channels from AN000 to AN008 or from AN016 to AN023.
Note 2. Odd analog input channels from AN000 to AN007.
The ADDISCR register selects either precharge or discharge, and the period of precharge or discharge for the A/D
disconnection detection assist function. Only set the ADDISCR register when the ADCSR.ADST bit is 0.
When the temperature sensor output or internal reference voltage is converted, the A/D converter executes discharge
automatically. This operation is achieved by setting the ADDISCR register to 0Fh (15 ADCLK) when ADEXICR.OCSA
or TSSA is set to 1. After executing discharge, the A/D converter executes sampling. The required sampling time is 5 μs
or more.
Disable the disconnection detection assist function if any of the following functions are used:
Temperature sensor
Internal reference voltage
A/D Self-diagnosis
Reference voltage of SDADC24 (SBIAS/VREFI)
Differential input mode.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — ADIC[1:0]
Note 1. The ADCSR.ADCS[1:0] bits must be set to 01b (group scan mode) before setting the PGS bit to 1. If these bits
are set to any other values, proper operation is not guaranteed.
Note 2. When the GBRP bit is set to 1, single scan is performed continuously for group B regardless of the GBRSCN bit.
When the GBRSCN bit is set to 0, triggers input during A/D conversion are ignored. Only set the GBRSCN bit when the
ADCSR.ADST bit is 0.
The setting of the GBRSCN bit is valid when the PGS bit is 1.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — CMPO CMPTS
CA A
Value after reset: 0 0 0 0 0 0 0 0
CMPLCHA08 correspond to AN000, AN004, and AN008, respectively. When the comparison result of each analog
input meets the set condition, the ADCMPSR0.CMPSTCHAn bit is set to 1 and a compare interrupt (ADC160_CMPAI)
is generated.
When the ADANIM.ANIM[n] bit is set to 1 to select differential input, select the even channel associated with ANIM[n]
bit.
Example: When ADANIM.ANIM[0] = 1, set the ADCMPLR0[1:0] bits to 01b.
When ADANIM.ANIM[1] = 1, set the ADCMPLR0[3:2] bits to 01b.
When ADANIM.ANIM[2] = 1, set the ADCMPLR0[5:4] bits to 01b.
When ADANIM.ANIM[3] = 1, set the ADCMPLR0[7:6] bits to 01b.
ADCMPDR0 value A/D-converted value Not met ADCMPDR0 value < A/D-converted value Met
ADCMPDR0 value > A/D-converted value Met ADCMPDR0 value A/D-converted value Not met
CMPLCHAn = 1
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — CMPLO CMPLT
CA SA
Value after reset: 0 0 0 0 0 0 0 0
CMPLTSA bit (Compare Window A Temperature Sensor Output Comparison Condition Select)
The CMPLTSA bit specifies comparison conditions when the temperature sensor output is the target of the window A
comparison condition. When the temperature sensor output comparison result meets the set condition, the
ADCMPSER.CMPSTTSA flag is set to 1 and a compare interrupt (ADC160_CMPAI) is generated.
CMPLOCA bit (Compare Window A Internal Reference Voltage Comparison Condition Select)
The CMPLOCA bit specifies comparison conditions when the internal reference voltage is the target of the window A
comparison condition. When the internal reference voltage comparison result meets the set condition, the
ADCMPSER.CMPSTOCA flag is set to 1 and a compare interrupt (ADC160_CMPAI) is generated.
The ADCMPDR0/1 register specifies the reference data when the compare window A function is used. ADCMPDR0
register sets the lower reference for window A, and ADCMPDR1 register sets the upper reference for window A.
The ADWINULB and ADWINLLB registers specify the reference data when the compare window B function is used.
ADWINLLB register sets the lower reference for window B, and ADWINULB register sets the upper reference for
window B.
ADCMPDR0/1, ADWINULB, and ADWINLLB are read/write registers.
ADCMPDR0/1, ADWINULB, and ADWINLLB are writable even during A/D conversion. The reference data can be
dynamically modified by rewriting register values during A/D conversion*1.
Set these registers so that the upper reference is not less than the lower reference (ADCMPDR1 ≥ ADCMPDR0,
ADWINULB ≥ ADWINLLB). ADCMPDR1 and ADWINULB are not used when the window function is disabled.
Note 1. The lower and the upper references are changed when each register is written. For example, when the upper
reference value and the lower reference value are changed, the MCU compares the upper reference (after
rewrite), and the lower reference (before rewrite) with the A/D conversion result. See Figure 32.4. If the
comparison during the rewriting of these two references is erroneous, then rewrite these reference values when
both ADCSR.ADST and the target Compare Window Operation Enable bit (ADCMPCR.CMPAE or
ADCMPCR.CMPBE) is 0.
Compare the reference Compare the upper reference Compare the reference
before rewrite (after rewrite) after rewrite
and the lower reference
(before rewrite)
Figure 32.4 Comparison between upper reference and lower reference before and after a rewrite
The ADCMPDR0/1, ADWINLLB, and ADWINULB registers use different formats depending on the following
conditions:
The value of the A/D-Converted Value Average Channel Select bits (A/D-converted value average mode selected
or not selected)
Set ADCMPDR0, ADCMPDR1, ADWINLLB, and ADWINULB in the two’s complement format. Values within a
range of 8000h to 7FFFh (-32768 to 32767) can be set. However, the data output range varies with analog inputs to
be A/D-converted. Therefore, set these registers according to the output range shown in Table 32.13.
32.2.29 A/D Compare Function Window A Extended Input Channel Status Register
(ADCMPSER)
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — CMPST CMPST
OCA TSA
Value after reset: 0 0 0 0 0 0 0 0
b7 b6 b5 b4 b3 b2 b1 b0
CMPLB — CMPCHB[5:0]
ADWINLLB value A/D-converted value Not met ADWINLLB value < A/D-converted value Met
ADWINLLB value > A/D-converted value Met ADWINLLB value A/D-converted value Not met
CMPLB = 1
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — CMPST
B
Value after reset: 0 0 0 0 0 0 0 0
32.2.32 A/D Compare Function Window A/B Status Monitor Register (ADWINMON)
b7 b6 b5 b4 b3 b2 b1 b0
b7 b6 b5 b4 b3 b2 b1 b0
The VREFADC output voltage is output to the VREFH0 pin. When using VREFADC, do not input voltage to VREFH0.
To stabilize the VREFADC output voltage, connect the VREFH0 pin to VREFL0 pin through a capacitor (1µF).
x: Don’t care
— — — — — — — — — — — — ANIM[3:0]
b7 b6 b5 b4 b3 b2 b1 b0
CALEX CALMO — — — — — —
E N
Value after reset: 0 0 0 0 0 0 0 0
32.3 Operation
Table 32.13 A/D conversion result output ranges of each A/D conversion
ADCER.ADINV Output range Output range
A/D conversion Input mode (data inversion) (hexadecimal) (decimal)
Temperature sensor Single-ended x 0000h to 7FFFh 0 to 32767
Internal reference voltage Single-ended x 0000h to 7FFFh 0 to 32767
Self-diagnosis - x 8000h to 7FFFh -32768 to 32767
AN000, AN002, AN004, AN006 Single-ended x 0000h*1 to 7FFFh 0*1 to 32767
Differential x 8000h to 7FFFh -32768 to 32767
AN001, AN003, AN005, AN007 Single-ended 1 0000h*1 to 7FFFh 0*1 to 32767
0 8000h to 0000h*2 -32768 to 0*2
Differential x 8000h to 7FFFh -32768 to 32767
AN008, AN016 to AN023, SBIAS/VREFI Single-ended x 0000h to 7FFFh 0 to 32767
x: Don’t care
Note: A/D conversion result of odd channels AN000 to AN007 in single-ended mode can be inverted according to the
ADCER.ADINV bit setting value. Therefore, the A/D conversion results can be stored in the A/D data registers in
the same output range as even channels AN000 to AN008 or AN016 to AN023.
Note 1. If the analog input voltage is lower than VREFL0 by swing of the input voltage, the data output from the ADC is a
negative value.
Note 2. If the analog input voltage is lower than VREFL0 by swing of the input voltage, the data output from the ADC is a
positive value.
The relationship between A/D conversion result range and compare window setting range is shown with the analog
inputs in Figure 32.6 to Figure 32.8.
A/D conversion
Analog input A/D data register Compare window
result
VREFH0
+215 - 1
Analog
Input
0
VREFL0
(= 0 V)
Digital
Output
-215
-VREFH0
Figure 32.6 Relationship between A/D output range and compare window setting range in differential input
mode
A/D conversion
Analog input A/D data register Compare window
result
VREFH0
+215 - 1
Analog
Input
0
VREFL0
(= 0 V)
Digital
Output
-215
-VREFH0
Figure 32.7 Relationship between A/D output range and compare window setting range in single-ended input
mode (excluding AN001, AN003, AN005, and AN007)
A/D conversion
Analog input A/D data register Compare window
result
VREFH0
+215 - 1
Analog
Input
Digital
Output 0
VREFL0
(= 0 V)
-215
-VREFH0
A/D conversion
Analog input A/D data register Compare window
result
VREFH0
+215 - 1
Analog
Input
0
VREFL0
(= 0 V)
Digital
Output
-215
-VREFH0
Figure 32.8 Relationship between A/D output range and compare window setting range in single-ended input
mode (AN001, AN003, AN005, and AN007)
Interrupt generated
Figure 32.9 Example of single scan mode operation when AN004 to AN006 are selected
(AN004 to AN006: single-ended mode)
ADDR3 Invalid
Stored (2)
ADDR4 A/D conversion result 3
ADDR5 Invalid
(3)
ADC160_ADI
Interrupt generated
When ADANIM.ANIM[3:0] = 6h (AN002 to AN005: Differential input selected)
When ADANSA0 = 0015h
Figure 32.10 Example of single scan mode operation when AN000, AN002 to AN005 are selected
(AN000: single-ended mode, AN002 to AN005: differential input mode)
Stored (2)
ADRD Self-diagnostic A/D conversion result
Stored (3)
ADDR0 A/D conversion result 1
Stored (3)
ADDR7 A/D conversion result 2
(4)
ADC160_ADI
Interrupt generated
Figure 32.11 Example of basic operation in single scan mode when AN000 and AN007 are selected with self-
diagnosis
ADST
ADC160_ADI
Interrupt generated
Figure 32.12 Example of basic operation in single scan mode when temperature sensor output or internal
reference voltage is selected
Trigger
(ELC_AD00) A/D conversion A/D conversion
performed once performed once
A/D conversion
Set Set
ADST started
(1) Gain (4)
A/D conversion correction
time (3) A/D conversion time (7)
time
Channel 3 Gain Gain
(AN003)
Waiting for conversion A/D conversion 1 correction 1 Waiting for conversion A/D conversion 2 correction 2 Waiting for conversion
Stored (2)
ADDR3 A/D conversion result 1
Stored (5)
ADDBLDR A/D conversion result 2
(6)
ADC160_ADI
Interrupt generated
Note: In the figure, AN003 is set to be duplicated and the ELC_AD00 trigger is selected.
Figure 32.13 Example of operation in single scan mode with double trigger mode selected when AN003 is
duplicated
ELC_AD00 ELC_AD01
Trigger
ELC_AD00/ELC_AD01
A/D conversion A/D conversion
performed once performed once
A/D conversion
Set Set
ADST started
(1) (4)
A/D conversionGain correction A/D conversion
Gain correction
time time (3) time (7)
time
Channel 3 Gain Gain
(AN003)
Waiting for conversion A/D conversion 1 correction 1 Waiting for conversion A/D conversion 2 correction 2 Waiting for conversion
Stored (2)
ADDR3 A/D conversion result 1
Stored (5)
ADDBLDR A/D conversion result 2
Stored (2)
ADDBLDRA A/D conversion result 1
Stored (5)
ADDBLDRB A/D conversion result 2
(6)
ADC160_ADI
Interrupt generated
Figure 32.14 Example of extended operation in double trigger mode (1) with duplication selected for AN003,
and ELC_AD00/ELC_AD01 selected
Figure 32.15 Example of basic operation in continuous scan mode with AN000 to AN002 selected
Channel 2 Gain
(AN002) Waiting for conversion A/D conversion 2 correction 2 Waiting for conversion
(2) Stored (2) Stored
ADRD Self-diagnostic A/D conversion result 1 Self-diagnostic A/D conversion result 2
(3) Stored
ADDR1 A/D conversion result 1
(3) Stored
ADDR2 A/D conversion result 2
(4)
ADC160_ADI
Interrupt generated
Figure 32.16 Example of basic operation in continuous scan mode when AN001 and AN002 are selected with
self-diagnosis
Timer count
Time
(1) Group A scanned (3)
ELC_AD00 (2)
ADC160_ADI interrupt
ADC160_GBADI interrupt
Figure 32.17 Example of basic operation in group scan mode with synchronous triggers from ELC
Timer count
Time
(3) (5)
ELC_AD01 Group A scanned Group A scanned
ADC160_ADI interrupt
(2)
ADC160_GBADI interrupt
Figure 32.18 Example of operation in group scan mode with double trigger mode using synchronous triggers
from the ELC
Start
Yes
Yes
To disable trigger input, set the ADSTRGR register to 3F3Fh Set the ADCSR.ADST bit to 0
(set the TRSA[5:0] bits and the TRSB[5:0] bits to 3Fh and (A/D conversion stop state).
3Fh, respectively).
Yes
End
Table 32.14 Control of A/D conversion operations based on the ADGSPCR.GBRSCN bit settings
A/D conversion operation Trigger input ADGSPCR.GBRSCN = 0 ADGSPCR.GBRSCN = 1
When A/D conversion for Input of trigger for group A Trigger input is ignored Trigger input is ignored
group A is in progress
Input of trigger for group B Trigger input is ignored A/D conversion is performed on
group B after A/D conversion on
group A completes
When A/D conversion for Input of trigger for group A Group B conversion stops and Group B conversion stops and
group B is in progress group A conversion starts group A conversion starts
Group B conversion starts after
group A conversion completes.
Input of trigger for group B Trigger input is ignored Trigger input is ignored
The following sequence describes the operations in group scan mode with group A priority control (for example,
(ADGSPCR.GBRSCN = 1 and ADGSPCR.GBRP = 0) when channel 0 is selected for group A and channels 1 to 3 are
selected for group B.
1. When input of a trigger for group B sets the ADCSR.ADST bit to 1 (A/D conversion start), conversion for the ANn
channels selected in the ADANSB0 and ADANSB1 registers starts in order from the channel with the smallest
number n.
2. On completion of A/D conversion and the gain correction, the result is stored in the associated A/D Data Register y
(ADDRy).
3. When a group A trigger is input while A/D conversion for group B is in progress, and A/D conversion for group B
is discontinued with the ADCSR.ADST bit remains 1, A/D conversion for the ANn channels selected in the
ADANSA0 and ADANSA1 registers starts in order from the channel with the smallest number n.
If A/D conversion and gain correction are not completed when the conversion of group B is interrupted, the
A/D conversion result is not stored in the A/D Data Register (ADDRy).
4. On completion of A/D conversion and the gain correction on a single channel, the result is stored in the associated
A/D Data Register y (ADDRy).
5. An ADC160_ADI interrupt request is generated.
6. A/D conversion for the ANn channels in group B selected in the ADANSB0 and ADANSB1 registers restarts in
order from the channel with the smallest number n with the ADCSR.ADST bit remains 1.
7. On completion of A/D conversion and the gain correction on a single channel, the result is stored in the associated
A/D Data Register y (ADDRy).
8. An ADC160_GBADI interrupt request is generated if the setting of the ADCSR.GBADIE bit is 1 (group B scan end
interrupt is enabled).
9. The ADCSR.ADST bit is automatically cleared and the 16-bit A/D converter enters the wait state when A/D
conversion and gain correction are complete.
First A/D conversion on group B A/D conversion on group A Second A/D conversion on group B
(Group B is activated by a group B trigger) under group A priority control (Group B is automatically activated for rescanning)
Group A
Channel 0 (AN000) Waiting for conversion A/D conversion A1 Gain
correction A1 Waiting for conversion
(3)
Group B (6)
Channel 1 (AN001) Waiting for conversion A/D conversion B1 Gain
correction B1 Waiting for conversion A/D conversion B4 Gain
correction B4 Waiting for conversion
Gain
Channel 2 (AN002) Waiting for conversion A/D conversion B2 Gain
correction B2 Waiting for conversion A/D conversion B5 correction B5 Waiting for conversion
Channel 3 (AN003) Waiting for conversion A/D conversion B3*1 Waiting for conversion A/D conversion B6 Gain
correction B6
Waiting for conversion
(4) Stored
ADDR0 A/D conversion result A1
(5)
ADC160_ADI
Interrupt generated
(8)
ADC160_GBADI
Interrupt generated
Note 1. Converted data from A/D conversion B3 is ignored.
Figure 32.20 Example operation with group A priority control (1), when ADGSPCR.GBRSCN = 1 and
ADGSPCR.GBRP = 0
The following sequence is an example operation when a group A trigger is input again during rescanning operation on
group B. In this example, channel 0 is selected for group A and channels 1 to 3 are selected for group B when operation
on group A is given priority (ADGSPCR.GBRSCN = 1, ADGSPCR.GBRP = 0).
1. When a group B trigger input sets the ADCSR.ADST bit to 1 (A/D conversion start), conversion for the ANn
channels of group B selected in the ADANSB0 and ADANSB1 registers starts in order from the channel with the
smallest number n.
2. On completion of A/D conversion and the gain correction on a single channel, the result is stored in the associated
A/D Data Register y (ADDRy).
3. When a group A trigger is input while A/D conversion for group B is in progress, A/D conversion for group B is
discontinued with the ADCSR.ADST bit remains 1. If A/D conversion and gain correction are not complete when
the conversion of group B is interrupted, the A/D conversion result is not stored in the A/D Data Register (ADDRy).
4. A/D conversion for the ANn group A channels selected in the ADANSA0 and ADANSA1 registers starts in order
from the channel with the smallest number n.
5. On completion of A/D conversion and the gain correction on a single channel, the result is stored in the associated
A/D Data Register y (ADDRy).
6. An ADC160_ADI interrupt request is generated.
7. If the ADGSPCR.GBRSCN bit is 1, when the A/D conversion and the gain correction of group A are complete, the
ADCSR.ADST bit remains 1 and group B is rescanned. A/D conversion for the ANn group B channels selected in
the ADANSB0 and ADANSB1 registers starts again in order from the channel with the smallest number n.
8. On completion of A/D conversion and the gain correction on a single channel, the result is stored in the associated
A/D Data Register y (ADDRy).
9. When a group A trigger is input while A/D conversion on group B is rescanning, A/D conversion for group B is
discontinued with the ADCSR.ADST bit remains 1.
10. A/D conversion for the ANn group A channels selected in the ADANSA0 and ADANSA1 registers starts in order
from the channel with the smallest number n.
11. On completion of A/D conversion and the gain correction on a single channel, the result is stored in the associated
A/D Data Register y (ADDRy).
12. An ADC160_ADI interrupt request is generated.
13. If the ADGSPCR.GBRSCN bit is 1 when the A/D conversion and the gain correction of group A are complete, the
ADCSR.ADST bit remains 1 and group B is rescanned. A/D conversion for the ANn group B channels selected in
the ADANSB0 and ADANSB1 registers starts again in order from the channel with the smallest number n.
14. If a group A trigger is input during A/D conversion on group B for rescanning, steps 9. to 13. are repeated. If a
group A trigger is not input, the ADCSR.ADST bit is cleared automatically on completion and the gain correction
of A/D conversion on group B and the ADC16 enters a wait state.
Trigger for
group A
Trigger for
group B
A/D conversion
ADST started (1)
Group A (10)
Channel 0 (AN000) Waiting for conversion A/D Conversion A1 Gain
corrction A1 Waiting for conversion A/D Conversion A2 Gain
corrction A2 Waiting for conversion
(4) (13)
Group B (7)
Channel 1 (AN001) Waiting for conversion A/D Conversion B1 Gain
corrction B1 Waiting for conversion A/D Conversion B4 Gain
correction B4 Waiting for conversion A/D Conversion B7
ADDR3
ADC160_ADI
(6) Interrupt generated (12) Interrupt generated
ADC160_GBADI
Figure 32.21 Example operation with group A priority control (2), when ADGSPCR.GBRSCN = 1 and
ADGSPCR.GBRP = 0
The following sequence is an example of a rescanning operation in which a group B trigger is input during A/D
conversion on group A. In this example, channels 1 to 3 are selected for group A and channel 0 is selected for group B
when operation on group A is given priority (ADGSPCR.GBRSCN = 1, ADGSPCR.GBRP = 0).
1. When input of a group A trigger sets the ADCSR.ADST bit to 1 (A/D conversion start), conversion for the ANn
channels selected in the ADANSA0 and ADANSA1 registers starts in order from the channel with the smallest
number n.
2. On completion of A/D conversion and the gain correction on a single channel, the result is stored in the associated
A/D Data Register y (ADDRy).
3. If a group B trigger is input during A/D conversion on group A, group B conversion can be performed after the
group A conversion and gain correction complete. However, if group A triggers are input continuously, the scan
operation on group B is canceled by group A and is not performed.
4. On completion of the group A conversion and gain correction, an ADC160_ADI interrupt request is generated
without register setting.
5. On completion of the group A conversion and gain correction, the ADCSR.ADST bit remains 1 and group B is
rescanned. A/D conversion for the ANn channels of group B selected in the ADANSB0 and ADANSB1 registers
starts in order from the channel with the smallest number n.
6. On completion of A/D conversion and the gain correction on a single channel, the result is stored in the associated
A/D Data Register y (ADDRy).
7. On completion of the rescanning operation and the gain correction on group B, an ADC160_GBADI interrupt
request is generated if the setting of the ADCSR.GBADIE bit is 1 (group B scan end interrupt is enabled).
8. The ADCSR.ADST bit is automatically cleared and the 16-bit A/D converter enters the wait state when A/D
conversion and gain correction are complete.
Trigger for
group A
Trigger for
group B (3)
A/D conversion
started
ADST (1)
(8)
Group A
Channel 1 (AN001) Waiting for conversion A/D Conversion A1 Gain
correction A1 Waiting for conversion
Group B (5)
Channel 0 (AN000) Waiting for conversion A/D Conversion B1 Gain
correction B1
Waiting for
conversion
(6) Stored
ADDR0 Conversion
result B1
(2) Stored
ADDR1 Conversion result A1
(2) Stored
ADDR2 Conversion result A2
(2) Stored
ADDR3 Conversion result A3
ADC160_ADI
(4) Interrupt generated
ADC160_GBADI
(7)
Interrupt generated
Figure 32.22 Example operation with group A priority control (3), when ADGSPCR.GBRSCN = 1 and
ADGSPCR.GBRP = 0
The following sequence is an example of operation with group A priority control in which channel 0 is selected for group
A and channels 1 to 3 are selected for group B (ADGSPCR.GBRSCN = 0, ADGSPCR.GBRP = 0).
1. When input of a group B trigger sets the ADCSR.ADST bit to 1 (A/D conversion start), conversion for the ANn
channels selected in the ADANSB0 and ADANSB1 registers starts in order from the channel with the smallest
number n.
2. On completion of A/D conversion and the gain correction on a single channel, the result is stored in the associated
A/D Data Register y (ADDRy).
3. If a group A trigger is input while A/D conversion for group B is in progress, A/D conversion for group B is
discontinued with the ADCSR.ADST bit remains 1. Next, A/D conversion for the ANn channels selected in the
ADANSA0 and ADANSA1 registers starts in order from the channel with the smallest number n.
4. On completion of A/D conversion and the gain correction on a single channel, the result is stored in the associated
A/D Data Register y (ADDRy).
5. An ADC160_ADI interrupt request is generated.
6. The ADCSR.ADST bit is automatically cleared and the 16-bit A/D converter enters the wait state when A/D
conversion and gain correction are complete.
Trigger for
group A
Trigger for
group B
Group A
Gain
Channel 0 (AN000) Waiting for conversion A/D Conversion A1 correction A1 Waiting for conversion
Group B
Channel 1 (AN001) Waiting for conversion A/D Conversion B1 Gain
correction B1 Waiting for conversion
(2) Stored
ADDR1 Conversion result B1
(2) Stored
ADDR2 Conversion result B2
ADDR3
ADC160_ADI
(5) Interrupt generated
ADC160_GBADI
Note 1. Converted data from A/D conversion B3 is ignored.
Figure 32.23 Example operation with group A priority control (4), when ADGSPCR.GBRSCN = 0 and
ADGSPCR.GBRP = 0
The following sequence is an example of operation with group A priority control in which channel 0 is selected for group
A and channels 1 to 3 are selected for group B (ADGSPCR.GBRP = 1).
1. The ADCSR.ADST bit is set to 1 (A/D conversion start) when ADGSPCR.GBRP bit is set to 1, and conversion for
the ANn channels selected in the ADANSB0 and ADANSB1 registers starts in order from the channel with the
smallest number n.
2. On completion of A/D conversion and the gain correction on a single channel, the result is stored in the
corresponding A/D Data Register y (ADDRy).
3. If a group A trigger is input while A/D conversion for group B is in progress, A/D conversion for group B is
discontinued with the ADCSR.ADST bit remains 1. Next, A/D conversion for the ANn channels selected in the
ADANSA0 and ADANSA1 registers starts in order from the channel with the smallest number n.
4. On completion of A/D conversion and the gain correction on a single channel, the result is stored in the associated
A/D Data Register y (ADDRy).
5. An ADC160_ADI interrupt request is generated.
6. A/D conversion for the ANn channels in group B selected in the ADANSB0 and ADANSB1 registers restarts in
order from the channel with the smallest number n and the ADCSR.ADST bit remains 1.
7. On completion of A/D conversion and the gain correction on a single channel, the result is stored in the associated
A/D Data Register y (ADDRy).
8. An ADC160_GBADI interrupt request is generated if the ADCSR.GBADIE bit is 1.
9. A/D conversion for the ANn channels in group B selected in the ADANSB0 and ADANSB1 registers restarts in
order from the channel with the smallest number n and the ADCSR.ADST bit remains 1. Steps 6. to 9. are repeated
as long as the ADGSPCR.GBRP bit remains 1. Setting the ADCSR.ADST bit to 0 is prohibited while the
ADGSPCR.GBRP bit is set to 1. To forcibly stop A/D conversion when ADGSPCR.GBRP = 1, follow the
A/D conversion on group B A/D conversion on group A A/D conversion on group B A/D conversion on group B
(GBRP=1) (Under group priority operation) (GBRP=1) (GBRP=1)
GBRP
Trigger for
group A
Trigger for
group B
A/D conversion
ADST started
(1)
Group A
Channel 0 (AN000) Waiting for conversion A/D Conversion A1 Gain
correction A1 Waiting for conversion
(3)
Group B (6) (9)
Channel 1 (AN001) Waiting for conversion A/D Conversion B1 Gain
correction B1 Waiting for conversion A/D Conversion B4 Gain
correction B4 Waiting for conversion A/D Conversion B7 Gain
correction B7
Waiting for
conversion
Channel 3 (AN003) Waiting for conversion A/D Conversion B3*1 Waiting for conversion A/D Conversion B6 Gain
correction B6 Waiting for conversion
(4) Stored
ADDR0 Conversion result A1
(2) Stored (7) Stored Stored
ADDR1 Conversion result B1 Conversion result B4 Conversion
result B7
(2) Stored (7) Stored
ADDR2 Conversion result B2 Conversion result B5
(7) Stored
ADDR3 Conversion result B6
ADC160_GBADI
(8) Interrupt generated
Figure 32.24 Example operation with group A priority control (5) when ADGSPCR.GBRP = 1
Interrupt
A/D conversion repeated processing
ADDR2
ADDR3
Flag read
(3) (Condition matched) Cleared
(3) (Condition not matched)
CMPSTCH00
Flag read Cleared
(3) (Condition not matched)
CMPSTCH01
(3) (Condition matched)
CMPSTCH02
CMPSTCH03
(3) (6)
ADC160_CMPAI
ADC160_CMPBI
Interrupt generated
Figure 32.25 Example of compare function operation when AN000 to AN003 are compared
Setting start
General setting
[Example]
A/D conversion setting ADANSA0 = 0003h // Channel selection (channel 0, 1)
ADSTRGR = 0900h // AD conversion trigger selection (TRSA[5:0] = 09h)
ADCSR = 0200h // Single scanning, synchronous trigger permission
Window B setting [Example] When Window B comparison is used [Example] When Window B comparison is not used
ADWINLLB = 0001h // Window B lower limit setting ADWINLLB = 0000h // Window B lower limit setting
ADWINULB = 00FFh // Window B upper limit setting ADWINULB = 0000h // Window B upper limit setting
ADCMPBNSR = 01h // Window B compare channel selection ADCMPBNSR = 3Fh // Window B compare channel non-selection
[Example]
Function enable setting ADCMPCR = 4A00h // Window A/B enabled, compound condition OR setting
Setting stop
Figure 32.26 Setting example when using event output of the compare function
For event output usage when using only window A for the compare function, note the following:
Enable both window A and window B (ADCMPCR.CMPAE = 1, ADCMPCR.CMPBE = 1)
Set the compound condition of window A and B to the OR condition (ADCMPCR.CMPAB[1:0] = 00b)
Set the compared channel of window B to Do not select (ADCMPBNSR.CMPCHB[5:0] = 111111b)
Set the compare condition of window B to 0 < results < 0 means always mismatch (ADCMPCR.WCMPE = 1,
ADWINLLB[15:0] = ADWINULB[15:0] = 0000h, and ADCMPBNSR.CMPLB = 1).
Figure 32.27 shows an example event output operation of the compare function.
A scan end event (ADC160_ADI) is output at the same time as single scan and the gain correction completion. A match
or mismatch event (ADC160_WCMPM/ADC160_WCMPUM) is output with a clock delay of 1 PCLKB cycle set in
ADCMPCR.CMPAB[1:0].
Note: The match and mismatch events are exclusive, so both events do not output simultaneously.
When CMPAB set to 10b: Scanning performed once Scanning performed once
Set Set
A/D conversion
ADST starts
(1)
Channel 0 Waiting for A/D conversion 1 Gain Waiting for conversion A/D conversion 3 Gain Waiting for conversion
(AN000) conversion collection 1 collection 3
Channel 1 Waiting for conversion A/D conversion 2 Gain A/D conversion 4 Gain
Waiting for conversion Waiting for conversion
(AN001) collection 2 collection 4
Stored
MONCOMB
After 1 PCLKB
ADC160_WCMPM
ADC160_WCMPUM
ADC160_CMPAI
ADC160_CMPBI
ADC160_ADI
Figure 32.27 Event output operation example of the compare function when AN000 and AN001 are compared
Note: Event output of the compare function outputs match/mismatch from the comparison results of window A and
window B, as set in ADCMPCR.CMPAB[1:0].
Note: The comparison result of window A is the logical addition of the comparison results of comparison target
channels of window A. The comparison results of window A and B are updated by each A/D conversion, and are
kept even when single scan ends. To clear the comparison results to 0, set ADCMPCR.CMPAE and
ADCMPCR.CMPBE bit to 0.
Table 32.15 Times for conversion during scanning (in numbers of ADCLK and PCLKB cycles)
Type/Conditions
Asynchronous Software
Parameter Symbol Synchronous trigger*5 trigger trigger Unit
Scan start A/D Group B is to be stopped tD 2 PCLKB + 6 ADCLK, — — Cycl
processing conversion on (Group A is activated after 5 PCLKB + 3 ADCLK*6 e
time*1, *2 group A under group B is stopped due to
group A an A/D conversion source
priority control of group A)
Group B is not to be 2 PCLKB + 4 ADCLK — —
stopped (activation by an
A/D conversion source of
group A)
A/D A/D conversion for self- 2 PCLKB + 6 ADCLK 4 PCLKB + 6 ADCLK
conversion diagnosis is to be started 6 ADCLK
when self-
diagnosis is
enabled
Other than above 2 PCLKB + 4 ADCLK 2 PCLKB + 4 ADCLK
4 ADCLK
Disconnection detection assistance processing time*7 tDIS The setting of ADNDIS[3:0] (initial value = 0h) × ADCLK*3
Self- Sampling time tDIAG tSPL The setting of ADSSTR00*4 (initial value = 0Dh) × ADCLK
diagnosis
conversion Time for conversion by successive tSAM 18 ADCLK
processing approximation
time*1
A/D Sampling time tCONV tSPL The setting of ADSSTRn*4 (n = 00 to 08, L, T, O) (initial value
conversion = 0Dh) × ADCLK
processing
time*1 Time for conversion by successive tSAM 18 ADCLK
approximation
Scan end processing time*1 tED 1 PCLKB + 3 ADCLK,
2 PCLKB + 2 ADCLK*6
Gain correction time*1 tGAIN 10 ADCLK
Note 1. See Figure 32.27 and Figure 32.28 for example of times tD, tDIAG, tCONV, tGAIN and tED. tD and tED are the
maximum time.
Note 2. This is the maximum time required from software writing or trigger input to A/D conversion start.
Note 3. The value is fixed to Fh (15 ADCLK) when the temperature sensor output or internal reference voltage is A/D-
converted.
Note 4. The ADSSTRn register setting should satisfy the sampling time of electrical characteristics.
Note 5. This does not include the time consumed in the path from timer output to trigger input.
Note 6. If ADCLK is faster than PCLKB (PCLKB to ADCLK frequency ratio = 1:2 or 1:4).
Note 7. See Figure 32.30 for example of times tDIS.
Interrupt
GAIN Closing
A/D converter Standby DIAG conversion A/D conversion correction processing
GAIN
correction
Interrupt
A/D converter Standby DIAG conversion A/D conversion A/D conversion DIAG conversion A/D conversion
GAIN GAIN GAIN GAIN
correction correction correction correction
Figure 32.28 Scan conversion timing when activated by software or synchronous trigger input (ELC)
Single scan tS C A N
tD tD IA G tC O N V tG AIN tED
P C LK
E xternal trigger
tG A IN
A D S T bit
Interrupt
P C LK
E xternal trigger
tG A IN tG A IN tG A IN +tED tG A IN
AD S T bit
Interrupt
Figure 32.29 Scan conversion timing when activated by asynchronous trigger input (ADTRG0)
ADST
Gain correction time (10ADCLK)
tGAIN
A/D conversion
Sampling time Conversion time Sampling time Conversion time
operation
tDIS tDIS
Disconnection detection assist time (0 to 15 cycles of ADCLK) Disconnection detection assist time (0 to 15 cycles of ADCLK)
Figure 32.30 A/D conversion operation when disconnection detection assist function is used
ON
Precharge
Precharge control signal
Example of the
external circuit *1
OFF
Discharge
VREFH0
control signal
R = 1M
Note 1. The converted result should be used after full evaluation because the resulting data on disconnection varies depending
on the external circuit.
OFF
Precharge
control signal
ON
Discharge
control signal
Analog input
ANn Discharge
VREFL0
Example of the
external circuit *1
Note 1. The converted result should be used after full evaluation because the resulting data on disconnection varies depending
on the external circuit.
PCLKB
4 states
Asynchronous trigger
Internal trigger signal
ADST bit
32.3.13 Starting A/D Conversion with a Synchronous Trigger from Peripheral Module
The A/D conversion can be started by a synchronous trigger (ELC). To start the A/D conversion by a synchronous
trigger:
1. Set the ADCSR.TRGE bit to 1.
2. Set the ADCSR.EXTRG bit to 0.
3. Select the relevant sources in the ADSTRGR.TRSA[5:0] and ADSTRGR.TRSB[5:0] bits.
A/D converter Waiting for conversion C-DAC linearity error calculation Gain error calculation Waiting for conversion
(2)
ADC160_ADI
Interrupt generated
Figure 32.34 Example of calibration operation (C-DAC linearity error calculation and gain error calculation)
Figure 32.35 shows the software flow and an operation example.
START START
Set the
ADICR.ADIC[1:0] bits to 11b
No No
ADCSR.ADST = 0? ADCSR.ADST = 0?
Yes Yes
Set the Set the
ADCALEXE.CALEXE bit to 1 ADCALEXE.CALEXE bit to 1
Yes Yes
END END
Table 32.16 Required calibration time (shown as the number of ADCLK and PCLKB cycles)
Parameter Symbol Software trigger Unit
Calibration start delay time tSDCAL 9 PCLKB + 3 ADCLK*1 Cycle
C-DAC linearity error calculation time tCDAC 770,048 ADCLK
Gain error correction calculation time tGAIN 4,864 ADCLK
Calibration end delay time tEDCAL 3 PCLKB + 15 ADCLK*2
Calibration time tCAL Approx. 24.22*3 ms
Calibration
tCAL
Software trigger
ADST
Closing
A/D converter Standby C-DAC linearity error calculation Gain error calculation processing
ELC event
activation
Interrupt
request
request
Compare
Double Function Interrupt request or
DTC
Scan mode trigger mode Window A/B ELC event Function
Single scan mode Deselect Deselect ADC160_ADI*1 ADC160_ADI is generated at the end of single scan
Select Deselect ADC160_ADI*1 ADC160_ADI is generated at the end of scans in the even-numbered
times
Continuous scan Deselect Deselect ADC160_ADI*1 ADC160_ADI is generated at the end of all the selected channels
mode scan
Group scan mode Deselect Deselect ADC160_ADI*1 ADC160_ADI is generated at the end of group A scan
Select Deselect ADC160_ADI*1 ADC160_ADI is generated at the end of Group A scans in the even-
numbered times
Calibration mode Deselect Deselect ADC160_ADI*2 ADC160_ADI is generated at the end of calibration.
For details on DTC settings, see section 16, Data Transfer Controller (DTC).
reference voltage. Set these reference voltages before starting A/D conversion. For details on reference voltage setting,
see section 32.2.33, A/D Dedicated Reference Voltage Circuit Control Register (VREFAMPCNT). Figure 32.37 shows
the startup flow of VREFADC.
VREFAMPCNT.BGREN = 1
VREFAMPCNT.OLDETEN = 1
VREFAMPCNT.VREFADCEN = 1
Note 1. For details of stabilization wait time, see section 47, Electrical Characteristics.
Start
Yes
To disable trigger inputs, set the ADSTRGR register to
3F3Fh (set the TRSA[5:0] and TRSB[5:0] bits to 3Fh and To disable trigger inputs, set the
ADSTRGR.TRSA[5:0] bits to 3Fh
3Fh, respectively)
When the event of scan end is setting at the ELC, set the
ELSRn.ELS bit to 00h
End
Figure 32.38 Procedure for clearing the ADCSR.ADST bit through software
AVCC0
VREFH0
*3
*2 0.1 µF
Rin
*1 AN000 to AN008
AN016 to AN023
AVSS0
*3
10 µF
VREFL0
10 µF 0.1 µF
Figure 32.39 Example protection circuit for analog inputs when VREFH0 is selected as the high-potential
reference voltage for the ADC16
Figure 32.40 shows an example protection circuit for analog inputs when VREFADC is selected as the high-potential
reference voltage for the ADC16.
AVCC0
VREFH0
*3
*2 0.1 µF
Rin
*1 AN000 to AN008
AN016 to AN023
AVSS0
*3
1 µF
VREFL0
10 µF 0.1 µF
Figure 32.40 Example protection circuit for analog inputs when VREFADC is selected as the high-potential
reference voltage for the ADC16
32.7.11 Port Setting when Using the 16-bit A/D Converter Input
When using the 16-bit A/D converter, do not use PORT0 and PORT5 as general I/O, peripheral functions I/O, and IRQn
inputs. Also, when using the normal-precision channels, do not use P100 to P107 as general I/O, peripheral functions
I/O, and IRQn inputs.
Table 32.18 OPAMP, ACMPHS, and SDADC24 pins that should not be selected during A/D conversion
Target of 16-bit A/D conversion OPAMP ACMPHS SDADC24
AN000 AMP0+ IVCMP0 —
AN001 AMP0- IVREF0 —
AN004 AMP1- IVREF1 —
AN005 AMP1+ IVCMP1 —
AN006 AMP2- — —
AN007 AMP2+ — —
AN016 — IVCMP2 ANSD0P
AN017 — IVREF2 ANSD0N
AN018 — — ANSD1P
AN019 — — ANSD1N
AN020 — — ANSD2P
AN021 — — ANSD2N
AN022 — — ANSD3P
AN023 — — ANSD3N
Note 1. The number of channels that can simultaneously perform A/D conversion is up to 5 channels.
A DRE G
ADREG
C = 0.47 μF
(-50% to +20% )
A V CC1
+ ADBGR
-
S B IA S/V RE FI
C = 0.22 μF
(-20% to +20% )
Referenc e for s igma -delta A /D c onv erter and
D/ A conv erter for offs et v oltage adjus tment
+
-
V B IA S
A VSS
A V SS A VSS
A V SS A V SS S ampling
Cloc k
Div ider S DA DCCLK
A NS D1P + Calibration
+ +
Control
A NS D1N -
-
A NS D2P +
A NS D2N - A /D conv ers ion res ult
nd
+
-
2 Order
Offs et S INC3
A NS D3P + sigma-delta Calibration A /D data regis ter
A djus t Digital Filter
-
+ A /D c onv erter
A NS D3N -
Note: Only set the STC1 register when ADC1.SDADTMD, ADC2.SDADST, and CLBSSR.CLBSS bits are 0.
Note 1. These bits must be set while the SDADCCLK clock is stopped (SYSTEM.SDADCCKCR.SDADCCKEN = 0) and the ADBGR is
powered off (STC2.BGRPON = 0).
b7 b6 b5 b4 b3 b2 b1 b0
Note: Only set the STC2 register when the ADC1.SDADTMD, ADC2.SDADST, and CLBSSR.CLBSS bits are 0.
Address(es): SDADC24.PGAC0 4009 C008h, SDADC24.PGAC1 4009 C00Ch, SDADC24.PGAC2 4009 C010h, SDADC24.PGAC3 4009 C014h,
SDADC24.PGAC4 4009 C018h
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
Table 33.3 shows the offset voltage dOFR (value calculated by converting the output voltage of the D/A converter for
offset voltage adjustment into input).
PGACTM[4:0] and PGACTN[2:0] bits (Coefficient (m, n) selection of the A/D conversion count (N) in
AUTOSCAN)
The PGACTM[4:0] bits are used to set the coefficient (m) that determines the A/D conversion count (N) in 1
9000
8000
7000
Number of A/D conversions
6000
5000
4000
3000
2000
1000
0
0 32 64 96 128 160 192 224
Number of levels
Figure 33.2 Correlation between the number of levels and A/D conversion count
When PGAASN = 1:
N = (32 × n) + m
(m and n correspond to the values set for this register).
PGAASN bit (Selection of the mode for specifying the number of A/D conversions in ADSCAN)
The PGAASN bit is used to select the A/D conversion count (1 to 8,032 or 1 to 255 (linear)) in 1 AUTOSCAN cycle.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
Note: Only set bits in the ADC1 register except the SDADTMD bit, when ADC1.SDADTMD, ADC2.SDADST, and
CLBSSR.CLBSS bits are 0. Only set the SDADTMD bit when ADC2.SDADST and CLBSSR.CLBSS bits are 0.
selected. When the PGACn.PGACTN[2:0] = 000b and the PGACn.PGACTM[4:0] = 00000b, one-shot mode takes
precedence (n = 0 to 4).
SDADBMP[4:0] bits (A/D conversion control of the signal from input multiplexer)
The SDADBMP[4:0] bits are used to allow or stop A/D conversion of signals from the input multiplexers for the
respective bits.
Table 33.4 shows the SDADBMP[n] bit and PGACn register associated with each input channel.
Table 33.4 SDADBMP[n] bit and PGACn register associated with each input channel
Analog input pin
A/D conversion control bit of Input Multiplexer n Setting
Positive side Negative side signal from the input multiplexer register
ANSD0P ANSD0N SDADBMP[0] PGAC0
ANSD1P ANSD1N SDADBMP[1] PGAC1
ANSD2P ANSD2N SDADBMP[2] PGAC2
ANSD3P ANSD3N SDADBMP[3] PGAC3
Internal OPAMP 0 (AMP0O) Internal OPAMP 1 (AMP1O) SDADBMP[4] PGAC4
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — SDADS
T
Value after reset: 0 0 0 0 0 0 0 0
Note: Only set the ADC2 register when ADC1.SDADTMD and CLBSSR.CLBSS bits are 0.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
SDADC
— — — — SDADCRC[2:0] RS SDADCRD[23:16]
SDADCRD[15:0]
Note 1. The maximum or minimum value of the register becomes the conversion result.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
SDAD
— — — — SDADMVC[2:0] MVS SDADMVD[23:16]
SDADMVD[15:0]
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — CLBMD[1:0]
Note: Only set the CLBC register when the CLBSSR.CLBSS bit is 0.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — CLBST
Note: Only set the CLBSTR register when ADC1.SDADTMD, ADC2.SDADST, and CLBSSR.CLBSS bits are 0.
If an A/D conversion request is made by a software trigger (ADC2.SDADST = 1) or a hardware trigger while calibration
is running (CLBSSR.CLBSS = 1), calibration takes priority and A/D conversion does not start. A/D conversion requests
are not held during calibration and calibration does not start during A/D conversion.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — CLBSS
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — CLBB0 CLBPR
WI O
Value after reset: 0 0 0 0 0 0 0 0
Address(es): SDADC24.GCVLR0 4009 C048h, SDADC24.GCVLR1 4009 C04Ch, SDADC24.GCVLR2 4009 C050h, SDADC24.GCVLR3 4009 C054h,
SDADC24.GCVLR4 4009 C058h
GCVL[15:0]
Address(es): SDADC24.OCVLR0 4009 C05Ch, SDADC24.OCVLR1 4009 C060h, SDADC24.OCVLR2 4009 C064h, SDADC24.OCVLR3 4009 C068h,
SDADC24.OCVLR4 4009 C06Ch
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
— — — — — — — — OCVL[23:16]
OCVL[15:0]
33.3 Operation
A sigma-delta A/D converter with a programmable gain instrumentation amplifier is built into the SDADC24. Signals
from the input multiplexers (5 channels) pass through the programmable gain instrumentation amplifier (PGA) and enter
the sigma-delta A/D converter. The A/D conversion results are filtered through the SINC3 digital filter and stored in an
output register. A/D conversion is performed by the SDADC24 reference clock generated by the SDADCCLK.
Set the STC1.CLKDIV[3:0] bits so that the SDADC24 reference clock is output at 4 MHz. In normal A/D conversion
mode, the oversampling frequency is 1 MHz. In low-power A/D conversion mode, the oversampling frequency is 0.125
MHz.
A/D conversion is performed based on the AUTOSCAN built-in sequencer. The data rate (output frequency of A/D
conversion results) can also be set for each channel. For details on the processing flow, see section 33.4, Control Flows.
Figure 33.3 shows a block diagram of the SDADC24.
Register for clock and power supply Registers for A/D converter conversion results and average values
Startup Control Register 1 (STC1) Sigma-Delta A/D Conversion Result Register (ADCR)
SDADLPM CLKDIV[3:0]
SDADCRC[2:0] SDADCRS
VREFSEL VSBIAS[3:0]
SDADCRD[23:0]
SDADMVD[23:0]
Input Multiplexer n Setting registers (PGACn) (n = 0 to 4)
PGAGC[4:0]
PGAOFS[4:0]
ANSD0P +
Input Multiplexer n Setting registers (PGACn) (n = 0 to 4)
ANSD0N - PGAOSR[2:0]
ANSD1P +
ANSD1N -
A/D conversion A/D Conversion Result
+
ANSD2P +
2nd sigma- result correction Register
ANSD2N - PGA delta A/D SINC3
Digital filter Calibration Control Register (CLBC)
ANSD3P + converter CLBMD[1:0]
- Correction factor
ANSD3N - calculation Calibration Status Register (CLBSSR)
CLBSS
OPAMP0 +
Clock
OPAMP1 -
A/D converter
Sigma-Delta A/D Converter Control Register 1 (ADC1)
control
SDADBMP[4:0] SDADTMD SDADSCM
(AUTOSCAN)
PGASLFT PGADISC PGADISA
PGAAVE[1:0] PGAAVN[1:0]
PGACVE PGAREV
33.3.1 ADBGR
ADBGR supplies the VREF reference voltage to the ADREG and SBIAS circuits. The supplied VREF reference voltage
is then used as the reference voltage of the sigma-delta A/D converter, the reference voltage of the offset adjustment D/A
converter inside PGA, and the internal bias voltage connected to the input multiplexer (VBIAS).
33.3.2 ADREG
ADREG supplies power to PGA and sigma-delta A/D converter by using the output voltage of ADBGR as the reference.
The output voltage is 2.1 V (typical). The output pin of ADREG requires an external capacitor of 0.47 μF (recommended
value).
AVCC1
VREF -
Amplifier *1
+ SBIAS/VREFI
0.22 µF
Protect VSBIAS[3:0]
Providing to
VBIAS, PGA, AVSS1
sigma-delta
A/D converter
Note 1. The amplifier is turned off when the external VREF mode (STC1.VREFSEL = 1) is selected.
*1
Transition time of one step (STTS)
± 3%
(Excluding SVA)
*1 *1
Transition time of one step (STTS) Transition time of one step (STTS)
Note 1. For details of the STTS time, see section 47, Electrical Characteristics.
Figure 33.5 Changing of the voltage setting for sensors (VSBIAS) in units of 0.2 V (1 step) when turning
SBIAS on
33.3.4 VBIAS
VBIAS supplies the internal bias voltage (VBIAS = 1.0 V (typical)) to the input multiplexer. The internal bias voltage
(VBIAS) is used as the reference voltage in single-ended input mode. For details, see section 33.3.6.3, Range of input
voltage in single-ended input mode.
ANSD0P
ANSD0N
ANSD1P
ANSD1N
+
ANSD2P PGA
ANSD2N
-
ANSD3P
ANSD3N
OPAMP0
OPAMP1
VBIAS
Offset
+- 2nd Order
sigma-delta
Adjust A/D
-+ converter
0mV
VBIAS +
VBIAS +
+- 2nd Order
Offset sigma-delta
Adjust A/D
-+ converter
0mV
-
ANSDnN
or +
OPAMP1
Expression 1:
Expression 2:
When dOFR = 0 mV, the input signal can take the differential input voltage at full scale. When VSIG = VID (full-scale
differential input voltage), VCOM can be represented using Expression 3.
Expression 3:
ANSDnP or OPAMP0
ANSDnN or OPAMP1
1.8 V
+0.4 V / (GTOTAL)
VSIG
VCOM
-0.4 V / (GTOTAL)
0.2 V
Ex.) GTOTAL = GSET1 = ×1, dOFR = 0 mV Ex.) GTOTAL = GSET1 = ×2, dOFR = 0 mV
+0.4 V +0.2 V
1.8 V 1.8 V
1.4 V
VCOM VCOM
0.6 V
0.2 V 0.2 V
-0.4 V -0.2 V
VIP GSET2
+ VOP1
± 164 mV
5 bit
VIN VON1
VOP1
VIP
+VOFR × A/D Converter
VCOM VCOM
GSET2 full scale
VIN
VON1
Vdiff = ± VSIG
Vdiff = ± (VSIG × GSET1)
Input differential signal 1st amplifier output Vdiff = {± (VSIG × GSET1) + VOFR} × GSET2
Figure 33.9 Transition of differential input voltage for each channel of the PGA
ANSDnP, ANSDnN,
OPAMP0, OPAMP1 Ex.) dOFR = 0 mV
+0.8 V
1.8 V
Internal
1.0 V
VBIAS
0.2 V
-0.8 V
33.3.7 Input Voltage for the SDADC24 and Results of A/D Conversion
This section describes the input voltage for the SDADC24 and the results of A/D conversion. Figure 33.11 shows a result
of A/D conversion when the range of input voltage for the A/D converter is full scale.
Differential input mode Single-ended input mode (positive side) Single-ended input mode (negative side)
Single-ended input mode (reversing the A/D conversion results of
single-ended input (negative side)
-0.8 V / (GTOTAL)
0
Analog input*1 223 223
0V
+0.8 V / (GTOTAL)
Note 1. The analog input in the differential input mode means the voltage difference obtained by subtracting the negative
channel from the positive channel. The input voltage range of positive channel and negative channel are 0.2 V to
1.8 V.
Figure 33.11 Input voltage for the SDADC24 and results of A/D conversion
Table 33.7 Input voltage for the SDADC24 and results of A/D conversion
Single-ended input mode (positive side)
Single-ended input mode (reversing the
A/D conversion results of single-ended Single-ended input mode (negative
Differential input mode input (negative side)) side)
A/D conversion A/D conversion A/D conversion
Input voltage for result Input voltage for result Input voltage for result
the SDADC24*1 (2’s complement) the SDADC24 (straight binary) the SDADC24 (straight binary)
+0.8 V / (GTOTAL) 223 - 1 +0.8 V + 1.0 V 224 - 1 +0.8 V + 1.0 V 0
0V 0 1.0 V 223 1.0 V 223
-0.8 V / (GTOTAL) -223 -0.8 V + 1.0 V 0 -0.8 V + 1.0 V 224 - 1
Note: The results shown in Table 33.7 can be calculated using the following expressions:
- Differential input mode
- Input voltage for the SDADC24 = (1.6 V / GTOTAL) × (ADCDATA1 / 224)
- ADCDATA1: 2’s complement for the result of 24-bit A/D conversion (ADCR.SDADCRD[23:0])
- Single-ended input mode
- Input voltage for the SDADC24 (positive side or reversing the A/D conversion results of
single-ended input (negative side)) = 1.6 V × (ADCDATA2 / 224) + 0.2 V
- Input voltage for the SDADC24 (negative side) = 1.6 V × (1 - ADCDATA2 / 224) + 0.2 V
- ADCDATA2: Straight binary value for the result of 24-bit A/D conversion (ADCR.SDADCRD[23:0])
Note 1. The input voltage for the SDADC24 in the differential input mode means the voltage difference obtained by
subtracting the negative channel from the positive channel. The input voltage range of positive channel and
negative channel are 0.2 V to 1.8 V.
Table 33.8 Relationship between control register settings and AUTOSCAN operation modes (1 of 2)
ADC1.SDADTMD ADC1.SDADSCM PGACn.PGACTN[2:0] PGACn.PGACTM[4:0]
Selection of A/D
conversion trigger Selection of A/D conversion count A/D conversion count
signal autoscan mode setting bit n setting bit m Trigger Operation mode
0 0 ≠0 ≠0 Software Continuous scan
0 0 ≠0 0 Software Continuous scan
0 0 0 ≠0 Software Continuous scan
Table 33.8 Relationship between control register settings and AUTOSCAN operation modes (2 of 2)
ADC1.SDADTMD ADC1.SDADSCM PGACn.PGACTN[2:0] PGACn.PGACTM[4:0]
Selection of A/D
conversion trigger Selection of A/D conversion count A/D conversion count
signal autoscan mode setting bit n setting bit m Trigger Operation mode
0 0 0 0 Software Continuous scan
(scan stops when
one shot ends) *1
0 1 ≠0 ≠0 Software Single scan
0 1 ≠0 0 Software Single scan
0 1 0 ≠0 Software Single scan
0 1 0 0 Software Single scan (scan
stops when one shot
ends) *1
1 0 ≠0 ≠0 Hardware Single scan *2
1 0 ≠0 0 Hardware Single scan *2
1 0 0 ≠0 Hardware Single scan *2
1 0 0 0 Hardware Single scan (scan
stops when one shot
ends) *1
1 1 ≠0 ≠0 Hardware Single scan
1 1 ≠0 0 Hardware Single scan
1 1 0 ≠0 Hardware Single scan
1 1 0 0 Hardware Single scan (scan
stops when one shot
ends) *1
Note 1. If the PGACn.PGACTN[2:0] bits are set to 000b and the PGACn.PGACTM[4:0] bits are set to 00000b, one shot
operation takes precedence.
Note 2. If a hardware trigger is selected, only single-scan mode is used.
SDADST
Start AUTOSCAN
ADC results invalid channel 0 channel 1 channel 2 channel 3 channel 4 channel 0 channel 1
ADCR Repeat until
ADAR SDADST = 0
1 sample period
A/D conversion
end interrupt
settling time1 settling time2
SDADST
Start AUTOSCAN
ADC results invalid channel 0 channel 2 channel 4 channel 0 channel 2 channel 4 channel 0 ...
ADCR Repeat until
ADAR SDADST = 0
A/D conversion
end interrupt
A/D automatic scan
completion interrupt
SDADST
Start AUTOSCAN Stop automatically
ADCR
ADAR Channel 2
(1-time conversion)
A/D conversion
end interrupt
SDADST
Start AUTOSCAN
ADC results invalid channel 1
ADCR Continue until
ADAR SDADST = 0
A/D conversion
end interrupt
A/D automatic scan
completion interrupt
Figure 33.15 Example for continuous conversion using the same channel
SDADST
Start AUTOSCAN Stop automatically
ADC results Invalid Channel 0 Channel 1 Channel 2 Channel 3 Channel 4 Invalid
ADCR
ADAR
A/D conversion
end interrupt
A/D automatic scan
completion interrupt
3
1 1 - Z-M
H (z) = x
M 1 - Z-1
Note: The settling time is automatically generated by the AUTOSCAN built-in sequencer.
Note: 3T is the time that is 3 times as long as the sampling time (3 × 1 / fout).
Note 1. Normal A/D conversion mode: 4 MHz, low-power A/D conversion mode: 500 kHz.
34 34 34 24
+ + + to register
(fout = Fin/M)
- - - Gain adjust
Z-1 Z-1 Z-1 (= bit shift)
-20 -20
-40 -40
H [dB]
H [dB]
-60 -60
-80 -80
-100 -100
-120 -120
0 20 40 60 80 100 120 0 5 10 15 20 25 30
f [kHz] f [kHz]
Note: The correction factors are not calculated for the channels set in single-ended input mode.
Note 1. VIDOCAL and VIDGCAL must be used in a range that satisfies the min and max of VIDGCAL - VIDOCAL.
Table 33.12 Required calibration time shown as the number of SDADC24 reference clock and PCLKB cycles
Internal calibration time External offset calibration External gain calibration
Parameter Symbol [cycle] time [cycle] time [cycle]
Calibration start delay time tSDCAL 1 PCLKB + 4 tSDADC24 *1 1 PCLKB + 4 tSDADC24 *1 1 PCLKB + 4 tSDADC24 *1
Offset error correction factor tOFCAL 6658 tSDADC24 6658 tSDADC24 -
calculation time
Gain error correction factor tGCAL 6662 tSDADC24 - 6676 tSDADC24
calculation time
Calibration end delay time tEDCAL 6 PCLKB + 21 tSDADC24 *2 6 PCLKB + 5 tSDADC24 *2 6 PCLKB + 5 tSDADC24 *2
Calibration time tCAL 7 PCLKB + 25 tSDADC24 + 7 PCLKB + 6667 tSDADC24 *3 7 PCLKB + 6685 tSDADC24 *3
(13320 tSDADC24) × CH *3
Note: tSDADC24: SDADC24 reference clock (normal A/D conversion mode: 4 MHz, low-power A/D conversion mode:
500 kHz).
Note: CH: Number of calibration channel.
Note 1. Maximum time from software write to A/D conversion start.
Note 2. Maximum time from calibration end to interrupt output.
Note 3. Maximum calibration time.
tCAL
CLBSS
A/D converter Standby Offset error correction factor Gain error correction factor Closing
calculation calculation processing
Table 33.13 A/D conversion results when there is a disconnection or the current supply of input is less than 0.8
μA (typical)
A/D conversion results
Precharge Discharge
Single-ended input mode (positive side) Approximately 224 - 1 Approximately 0
Single-ended input mode (reversing the A/D conversion results of
single-ended input (negative side))
Single-ended input mode (negative side) Approximately 0 Approximately 224 - 1
AVCC1
External circuit
example *1 Off Control signal of
Discharge
AVCC1
On
+
Disconnection On PGA
Analog Input VBIAS
-
Note 1. Use this function after proper evaluation because the conversion result obtained when a
disconnection exists differs depending on the external circuit.
Figure 33.20 Example of detecting disconnection when precharge is selected in single-ended input mode
(positive side)
AVCC1
On Control signal of
Discharge
VBIAS On
+
Analog Input
PGA
On
-
Disconnection
External circuit
example *1
Note 1. Use this function after adequate evaluation because the conversion result obtained when a
disconnection exists differs depending on the external circuit.
Figure 33.21 Example of detecting disconnection when discharge is selected in single-ended input mode
(negative side)
Note: Use the disconnection detection assist function in single-ended input mode (PGACn.PGASEL = 1). For details,
see section 33.4.4, Disconnection Detection Assist Flow. In the disconnection detection assist, do not set the
value of dOFR to a value other than 0 mV (PGACn.PGAOFS[4:0] = 00000b (n = 0 to 4)).
GSET2
VBIAS +
Offset +-
GSET1 A/D
Adjust converter
-+
0 mV
-
VBIAS +
PGA Disconnection
self-diagnosis detection
3 4 Calibration
Power
1 2 6 7 8
activation
STC2.ADCPON = 1 Turn on the power of VBIAS, PGA, and sigma-delta A/D converter.
Set PGACn.PGACTM[4:0]
Set the A/D conversion count.
Set PGACn.PGACTN[2:0]
PGACn.PGAOFS[4:0] = 00000b Set DAC output voltage for offset adjustment to 0 mV.
Abort Yes
A/D conversion
No
Yes
*1
Check A/D conversion results Check the self-diagnosis results.
ADC1.PGASLFT = 0
End PGA offset self-diagnosis Section where the execution or setting order
cannot be changed
Note 1. The results of PGA offset self-diagnosis can be checked from A/D conversion results.
ADC1.PGADISC = 0 or 1
Set disconnection detection assist.
ADC1.PGADISA = 1
Yes
Abort
A/D conversion
No
ADC2.SDADST = 0 Stop A/D conversion (optional).
A/D scan completion
No interrupt
Yes
Completed on the
positive and Note: This step must be performed once for
No negative sides all single-ended input whether the
channel is on the positive side or
negative side.
Yes
Set to "do not detect disconnection".
ADC1.PGADISA = 0
Note 1. The disconnection detection status can be checked from the A/D conversion results.
Calibration completion
No interrupt
Yes
Start external calibration Note: Select only one channel as the target channel.
Set DAC output voltage for offset adjustment to 0 mV.
Calculate the calibration correction factor.
Select differential input.
PGACn.PGAOFS[4:0] = 00000b
Select Enable calibration
PGACn.PGASEL = 0
Set only one channel to PGACn.PGACVE = 1.
Set PGACn.PGACVE
Set remaining channels to PGACn.PGACVE = 0.
Calibration completion
No interrupt
Yes
Select external gain calibration mode.
Note: Before starting calibration, set the input
CLBMD[1:0] = 10b
voltage for gain calibration of the target
channel.
Calibration completion
No interrupt
Yes
Note: To perform external calibration for multiple channels, repeat this flow for each channel.
Start sigma-delta
A/D converter conversion
ADC2.SDADST = 1 or
hardware trigger *1 Start A/D conversion.
No
A/D conversion or
A/D scan completion
No interrupt
ADC2.SDADST = 0
(only if ADC 1.SDADTMD = 0) Stop A/D conversion (optional).
Yes
A/D conversion
terminated with the
No current settings
Yes
End sigma-delta
A/D converter conversion
Section where the execution or setting order
cannot be changed
ADC2.SDADST = 0,
Stop A/D conversion.
ADC1.SDADTMD = 0
Wait time :
Wait time for the internal ending
Normal A/D conversion mode: 3.0 µs
process
Low-power normal A/D conversion mode: 24 µs
Reset release
No Use SDADC24 in
differential input mode
Yes
No
Have you ever performed a calibration?
Yes
Yes
Set 1 to the CLBB0WI bit in the CLBPR register Set 1 to the CLBB0WI bit in the CLBPR register
Set 1 to the CLBPRO bit in the CLBPR register Set 1 to the CLBPRO bit in the CLBPR register
Copy the calibration correction value stored in the data Store the calibration correction value (GCVLRn and
flash to the GCVLRn and OCVLRn registers (n = 0 to 4) OCVLRn registers (n = 0 to 4)) to the data flash
Clear the CLBPRO bit in the CLBPR register Clear the CLBPRO bit in the CLBPR register
Clear the CLBB0WI bit in the CLBPR register Clear the CLBB0WI bit in the CLBPR register
33.4.10 Flows for Independently Activating and for Switching/Stopping the Sensor
Reference Voltage
Figure 33.33 shows the flows for independently activating, and for switching/stopping the sensor reference voltage.
Flow for independently activating the sensor reference voltage and flow for
10
switching/stopping the sensor reference voltage
Note: To use the sigma-delta A/D converter for A/D conversion, stop the independent
Start activating the sensor
operation of the sensor reference voltage, and then restart it according to
reference voltage
the sigma-delta activation flow.
SDADCCR.SDADCCKEN = 1
Provide the input clock for the 24-bit Sigma-Delta A/D converter.
(system control register)
No
STC2.ADFPWDS = 0
Note 1. For details of the STTS time, see section 47, Electrical Characteristics.
Figure 33.33 Flows for independently activating and for switching/stopping the sensor reference voltage
33.5.4 A/D Conversion Operation Mode and SDADC24 Reference Clock Division
Setting
The A/D conversion operation mode setting (STC1.SDADLPM bit setting) and the SDADC24 reference clock division
setting (STC1.CLKDIV[3:0] bit settings) must be changed before the ADBGR power is turned on (STC2.BGRPON = 0).
In addition, set the STC1.CLKDIV[3:0] bits so that the SDADC24 reference clock is output at 4 MHz. If the clock is not
output at 4 MHz, A/D conversion cannot be performed normally.
33.5.6 Oversampling Ratio, PGA Gain, and Offset Voltage (dOFR) Setting
In single-ended input mode, use the following settings:
dOFR = 0 mV, GTOTAL = 1, oversampling ratio = 256
In addition, set dOFR = 0 mV for the following operations:
Disconnection detection assist
Self-diagnosis of PGA offset
Calibration.
Table 33.14 ADC16 and ACMPHS pins that should not be selected during SDADC24 conversion
Target of SDADC24 conversion ADC16 ACMPHS
ANSD0P AN016 IVCMP2
ANSD0N AN017 IVREF2
ANSD1P AN018 -
ANSD1N AN019 -
ANSD2P AN020 -
ANSD2N AN021 -
ANSD3P AN022 -
ANSD3N AN023 -
Bus interface
AVCC0 ADC16
DAADSCR
synchronous D/A
AVSS0 conversion
DAVREFCR
DADPR
VREFH
DADR0
DACR
DAPC
PmnPFS
ACMPHS
DA12_0
+
-
Control circuit
Charge
OPAMP>
pump
+
-
OPAMP0
PmnPFS: Port mn Pin Function Select Register. For details, see section 18, I/O Ports.
For connection to OPAMP and ACMPHS, see section 37, Operational Amplifier (OPAMP) and section 38, High-Speed Analog Comparator (ACMPHS).
DADR0: D/A Data Register 0 DAADSCR: D/A A/D Synchronous Start Control Register
DACR: D/A Control Register DAVREFCR: D/A VREF Control Register
DADPR: DADR0 Format Select Register DAPC: D/A Switch Charge Pump Control Register
The DADR0 register is a 16-bit read/write register that stores data for D/A conversion. When an analog output is
enabled, the values in DADR0 register are converted and output to the analog output pins.
The 12-bit data can be formatted as left- or right-justified by setting the DADPR.DPSEL bit. In right-justified format
(DADPR.DPSEL = 0), the lower 12 bits, [11:0], are valid. In left-justified format (DADPR.DPSEL = 1), the upper 12
bits, [15:4], are valid.
b7 b6 b5 b4 b3 b2 b1 b0
— DAOE0 — — — — — —
Only set this register while the ADC16 is halted when DAADSCR.DAADST = 1 (interference reduction between D/A
and A/D conversions is enabled). Only set DACR while ADCSR.ADST = 0 and after selecting the software trigger as the
ADC16 trigger.
b7 b6 b5 b4 b3 b2 b1 b0
DPSEL — — — — — — —
b7 b6 b5 b4 b3 b2 b1 b0
DAADS — — — — — — —
T
Value after reset: 0 0 0 0 0 0 0 0
To reduce interference between the D/A and A/D conversion, the DAADSCR register switches on or off the
synchronization of the D/A conversion start with the synchronous D/A conversion enable input signal from the ADC16
trigger.
Only set this register while the ADC16 is halted (ADCSR.ADST = 0) and the software trigger is selected as the ADC16
trigger.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — REF[2:0]
The D/A VREF Control Register (DAVREFCR) selects the reference voltage of the DAC12.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — PUMPE
N
Value after reset: 0 0 0 0 0 0 0 0
34.3 Operation
The DAC12 includes D/A conversion circuit. When the DAOE0 bit in the DACR register is set to 1, the DAC12 is
enabled and the conversion result is output.
The following example shows D/A conversion. Figure 34.2 shows the timing of this operation.
1. Set the MOCOCR.MCSTP bit to 0 (MOCO operating).
2. Set the DAPC.PUMPEN bit to 1 (charge pump enabled). When operating in subosc-speed mode, the following
additional steps are required:
a. Set the MOCOCR.MCSTP bit to 1.
b. Power control mode change to subosc-speed mode.
3. Wait for the charge pump stabilization time*1.
4. Select the D/A output terminal to analog mode (controlled by the PmnPFS.ASEL bit settings).
5. Select the D/A output terminal (controlled by the PmnPFS.PMR and PmnPFS.PSEL[4:0] bits settings).
6. When the charge pump is enabled, wait for the switching stabilization time*1.
7. Set the data for D/A conversion in the DADR0 register and the data format in the DADPR.DPSEL bit.
8. Set the DACR.DAOE0 bit to 1 to start D/A conversion. The conversion result is output from the analog output pin
DA12_0 after the conversion time tDCONV elapses. The conversion result continues to be output until DADR0 is
written to again or the DAOE0 bit is set to 0. The output value is expressed by the following formula:
9. To start another conversion, write another value to DADR0. The conversion result is output after the conversion
time tDCONV elapses.
When the DAADSCR.DAADST bit is 1 (interference reduction between D/A and A/D conversion is enabled), a
maximum of one A/D conversion time is required for D/A conversion to start. When ADCLK is faster than the
peripheral clock, a longer time might be required.
10. To disable analog output, set the DAOE0 bit to 0.
Note: Steps 1. to 6. are for when AVCC0 < 2.7 V and the DAC12 output level is output to a pin. When AVCC0 ≥ 2.7 V
and the DAC12 output level is to a pin, steps 1., 2., 3., and 6. are not necessary. Steps 1. to 6. must not be
performed when using DAC12 output as ACMPHS or OPAMP input. The MOCOCR.MCSTP bit setting is
optional.
Note 1. See section 47, Electrical Characteristics for details of the charge pump stabilization time and the switching
stabilization time.
DACR.DAOE0
Conversion
Conversion result result (2)
DA12_0 (1)
High-impedance state
tDCONV tDCONV
ADCLK
PCLKB
ADST bit
(1)
DAADSCR.DAADST bit
(2)
DACR.DAOE0 bit
DA12_0 signal
Post-D/A conversion Post-D/A conversion
value A output value C output
34.6.4 Restriction on Usage when Interference Reduction between D/A and A/D
Conversion is Enabled
When the DAADSCR.DAADST bit is 1, enabling interference reduction between D/A and A/D conversion do not place
the ADC16 in the module-stop state. Doing so can halt D/A conversion in addition to A/D conversion.
ADC16
ELC event signal synchronous D/A
(ELC_DA80, ELC_DA81) conversion
+
-
ACMPLP0
+
PmnPFS: Port mn Pin Function Select Register. For details, see section18, I/O Ports. OPAMP -
ACMPLP1
+
For connection to OPAMP, ACMPHS and ACMPLP, see section 37, Operational Amplifier (OPAMP),
-
section 38, High-Speed Analog Comparator (ACMPHS), and section 39, Low Power Analog Comparator (ACMPLP). OPAMP2
ACMPHS
+ +
- -
OPAMP1
b7 b6 b5 b4 b3 b2 b1 b0
DACS[7:0]
The DACSn register is an 8-bit read/write register to store data for D/A conversion. When D/A conversion is enabled, the
value in the DACSn register is converted and output to an analog output pin.
b7 b6 b5 b4 b3 b2 b1 b0
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — DACAD
ST
Value after reset: 0 0 0 0 0 0 0 0
To reduce interference between the D/A and A/D conversion, the DACADSCR register switches on or off the
synchronization of the D/A conversion start with the synchronous D/A conversion enable input signal from the ADC16
trigger.
Only set this register while the ADC16 is halted (ADCSR.ADST = 0) and the software trigger is selected as the ADC16
trigger.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — PUMPE
N
Value after reset: 0 0 0 0 0 0 0 0
35.3 Operation
10. To start another conversion, write another value to DACS0 register. The conversion result is output after the
conversion time elapses.
When the DACADSCR.DACADST bit is 1 (interference reduction between D/A and A/D conversion is enabled), a
maximum of one A/D conversion time is required for D/A conversion to start. When ADCLK is faster than the
peripheral clock, a longer time might be required.
11. To disable analog output, set the DAM.DACE0 bit to 0.
Note: If the DAM.DACE0 bit is set to 1, 0, and then 1 in order, after the last 1 is set and the conversion time elapses, an
analog voltage is output to the DA8_0 pin.
Note: If the DACS0 register is rewritten during the conversion time, the current D/A conversion is canceled and
conversion is started again with the rewritten value.
Note: Steps 1. to 6. is performed when AVCC0 < 2.7 V and the DAC8 output level is output to a pin. When AVCC0 ≥ 2.7
V and the DAC8 output level is output to a pin, steps 1., 2., 3. and 6. are not necessary. Steps 1. to 6. must not be
performed when using DAC8 output as ACMPHS, ACMPLP, or OPAMP input. The MOCOCR.MCSTP bit setting
is optional.
Note 1. See section 47, Electrical Characteristics for details of the charge pump stabilization time and the switching
stabilization time.
DAMDn bit
Operating clock
Write to the DACSn register
enabled
ELC_DA8n
Note: n = 0, 1
If the ADC16 is in progress (ADCSR.ADST = 1) when the DACSn register is modified, D/A conversion starts on
A/D conversion completion. If the DACSn register is modified twice during A/D conversion, the first update might
not be converted.
Note: The A/D sampling time must be longer than 3 PCLKB cycles. For details on the A/D sampling time, see section
32, 16-Bit A/D Converter (ADC16).
ADCLK
PCLKB
ADST bit
16-bit A/D converter
synchronous D/A
conversion enable input
signal (internal signal)
DA8_n signal
Post-D/A conversion Post-D/A conversion
value A output value C output
Note: n = 0, 1
Temperature sensor
Control circuit
b7 b6 b5 b4 b3 b2 b1 b0
TSCDRH[7:0]
The TSCDRH register stores temperature sensor calibration data measured for each MCU at factory shipment.
Temperature sensor calibration data is a digital value obtained using the ADC16 to convert the voltage output by the
temperature sensor under the condition Ta = Tj = 125°C and AVCC0 = 3.3 V. The TSCDRH register stores the upper 8
bits of the converted value.
b7 b6 b5 b4 b3 b2 b1 b0
TSCDRL[7:0]
The TSCDRL register stores temperature sensor calibration data measured for each MCU at factory shipment.
Temperature sensor calibration data is a digital value obtained using the ADC16 to convert the voltage output by the
temperature sensor under the condition Ta = Tj = 125°C and AVCC0 = 3.3 V. The TSCDRL register stores the lower 8
bits.
± 12.0
± 10.0
± 8.0
Error [°C]
± 6.0
± 4.0
± 2.0
± 0.0
-40 -20 0 20 40 60 80 100 120
DA12_0
AMP2+
AMP1+
AMP0PS
AMP1-
AMP0+/ AMP0+
+
DA12_0/AN000
AMP0O/
AMP0 AN002
AMP2-
-
AMP1+
AMP1-
AMP0+
AMP0MS <ACMPLP>
AMP0-/ AMP0- +
AN001 - ACMPLP0
AMP2+
+
AMP2-
- ACMPLP1
AMP1+
AMP0OS
AMP1-
PUMP0EN
<SDADC24>
DA8_0 24-bit
AMP2+
sigma-delta
A/D converter
AMP2- AMP1PS
AMP1+/ AMP1+
DA8_0/AN005
AMP1-
+
AMP1O/
AMP1 AN003
AMP1-/ AMP1-
AN004 -
AMP1MS
PUMP1EN
DA8_1
AMP2+/ AMP2+
AMP2PS
DA8_1/AN007
AMP2-
+
AMP2O/
AMP2 AN008
AMP2-/ AMP2-
-
AN006
AMP2MS
PUMP2EN
<ADC16>
16-bit
A/D converter
PFS.P500PFS
<DAC12>
DAC12.DAPC
12-bit DAC
PFS.P002PFS AGT1 compare match A
MUX
AMPE[n]
PFS.P013PFS
IREFE
<DAC8>
AMPTRS[1:0] AMPTRMn[1:0] AMPMON[n] AMPSP[1:0]
DAC8.DACPC
8-bit DAC
channel 1
8-bit DAC
channel 0
n = 0 to 2
AMPSP[1:0]: Bits in AMPMC IREFE, AMPE[n]: Bits in AMPC
AMPTRMn[1:0]: Bits in AMPTRM AMPMON[n]: Bits in AMPMON
AMPTRS[1:0]: Bits in AMPTRS PUMPnEN: Bits in AMPCPC
DA12_0
A M P2+
A M P1+
AM P0PS
A M P 1-
AM P0+/ A M P0+
+
D A 1 2 _ 0 /A N 0 0 0
AM P0O /
AMP0 AN002
A M P 2-
-
A M P1+
A M P 1-
A M P0+
AM P0M S <ACM PLP>
A M P 0 -/ A M P 0- +
AN 001 - ACM PLP0
A M P2+
A M P 2- <SD AD C24>
AM P1+/ A M P1+ 2 4 -b it
D A 8 _ 0 /A N 0 0 5 AM P0O S s ig m a - d e lta
A M P 1-
A /D c o n v e r te r
A M P 1 -/
AN 004 PU M P0EN
AM P2+/
D A 8 _ 1 /A N 0 0 7
A M P 2 -/
AN 006 <A D C 16>
1 6 -b it
A /D c o n v e rte r
P F S .P 5 0 0 P F S
<D AC12>
D A C 1 2 .D A P C
1 2 - b it D A C
P F S .P 0 0 2 P F S
P F S .P 0 1 3 P F S
<D AC8>
D A C 8 .D A C P C
8 -b it D A C
channel 1
8 -b it D A C
channel 0
<ACMPLP>
+
- ACMPLP1
DA8_0
AMP2+
<SDADC24>
AMP1MS
AMP2+/
DA8_1/AN007
PUMP1EN <ADC16>
AMP2-/
AN006
16-bit
A/D converter
PFS.P002PFS
PFS.P013PFS
<DAC8>
DAC8.DACPC
8-bit DAC
channel 1
8-bit DAC
channel 0
DA8_1
AMP2MS
<ADC16>
PUMP2EN
16-bit
A/D converter
PFS.P002PFS
<DAC8>
DAC8.DACPC
8-bit DAC
channel 1
b7 b6 b5 b4 b3 b2 b1 b0
AMPSP[1:0] — — — — — —
Note: Set the AMPSP[1:0] bits while the AMPC register is 00h (OPAMP and reference current generator are stopped).
Note: User offset trimming cannot be used in low-power mode. When AMPSP[1:0] = x0b, set the AMPUTOTE register
to 00h.
b7 b6 b5 b4 b3 b2 b1 b0
Note: A 16-bit A/D conversion end trigger is always generated at the end of A/D conversion.
Note 1. When using an activation trigger to activate the OPAMP, first specify settings related to the AGT, set the
AMPTRS register, then use the AMPC register to set the OPAMP Operation Control bit to be activated to 1
(operational amplifier wait state is enabled).
Note 2. When changing the set values of AMPTRMn[1:0] bits, make sure that the AMPE[n] bit in the AMPC register is 0
(OPAMPn is stopped).
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — AMPTRS[1:0]
Note 1. Do not change the value of the AMPTRS register after setting the AMPTRM register.
Table 37.2 shows the operational amplifier activation triggers associated with events.
b7 b6 b5 b4 b3 b2 b1 b0
IREFE — — — — AMPE[2:0]
Note 1. Operation of the reference current circuit is also enabled regardless of the IREFE bit setting. Set the bits to 0 for
a unit that is not to be used.
Before setting the bits to 1, set the switches in the AMPnMS, AMPnPS, and AMP0OS registers. When AVCC0 <
2.7 V, after setting the switches, wait for the charge pump stabilization time, then set these bits to 1. For details
on the stabilization wait time, see section 47, Electrical Characteristics.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — AMPMON[2:0]
Note: This register is used to asynchronously reflect whether each OPAMPn is operating or stopped. To determine the
OPAMP state, read this register continuously to determine when the bit state changes. After that, read this
register again to confirm whether the state of OPAMP has changed. When an activation trigger or 16-bit A/D
conversion end trigger synchronized with the clock or a software trigger in the other interrupt routine is used to
control the OPAMP, the timing to operate or stop the OPAMP can be estimated, such as for checking normal
operation. In this case, read this register after 1 CPU/peripheral clock cycle when the associated trigger or
interrupt affecting the OPAMP state occurs.
b7 b6 b5 b4 b3 b2 b1 b0
Note: When AVCC0 < 2.7 V, before setting the value of these bits, set the PUMP0EN bit in AMPCPC register to 1
(charge pump for AMP0 is enabled) and wait for the stabilization time. For details on the stabilization time, see
section 47, Electrical Characteristics.
Note: When AMPCPC.PUMP0EN = 1, do not set a total of five or more bits to 1 between the AMP0OS, AMP0PS, and
AMP0MS registers.
Note 1. When connecting to AMP1+ pin, do not output DAC8 channel 0 output level to a pin.
Note 2. When connecting to AMP2+ pin, do not output DAC8 channel 1 output level to a pin.
b7 b6 b5 b4 b3 b2 b1 b0
Note: When AVCC0 < 2.7 V, before setting the value of these bits, set the PUMP0EN bit in AMPCPC register to 1
(charge pump for AMP0 is enabled) and wait for the stabilization time. For details on the stabilization time, see
section 47, Electrical Characteristics.
Note: When AMPCPC.PUMP0EN = 1, do not set a total of five or more bits to 1 between the AMP0OS, AMP0PS, and
AMP0MS registers.
Note 1. The AMPMS7 and AMPMS0 to AMPMS4 bits must not be set to 1 at the same time. Write 80h to this register
when configuring a voltage follower. Only set the AMPMS7 bit to 1.
When an operational amplifier input pin is connected to the AMP0 minus input, the OPAMP0 output is not
connected to the AMP0 minus input if AMPMS7 = 1.
b7 b6 b5 b4 b3 b2 b1 b0
Note: When AVCC0 < 2.7 V, before setting the value of these bits, set the PUMP0EN bit in the AMPCPC register to 1
(charge pump for AMP0 is enabled) and wait for the stabilization time. For details on the stabilization time, see
section 47, Electrical Characteristics.
Note: When AMPCPC.PUMP0EN = 1, do not set a total of five or more bits to 1 between the AMP0OS, AMP0PS, and
AMP0MS registers.
Note 1. To connect the DAC12 to the input pin of the OPAMP, set the DAOE0 bit of the DACR register to 1.
When an operational amplifier input pin is connected to the AMP0 plus input, the DAC12 output is not connected
to the AMP0 plus input if AMPPS7 = 1.
b7 b6 b5 b4 b3 b2 b1 b0
AMPM — — — — — — AMPM
S7 S0
Value after reset: 0 0 0 0 0 0 0 0
Note: When AVCC0 < 2.7 V, before setting the value of these bits, set the PUMP1EN bit in the AMPCPC register to 1
(charge pump for AMP1 is enabled) and wait for the stabilization time. For details on the stabilization time, see
section 47, Electrical Characteristics.
Note: When AMPCPC.PUMP1EN = 1, do not set a total of five or more bits to 1 between the AMP1PS and AMP1MS
registers.
Note 1. The AMPMS7 and AMPMS0 bits must not be set to 1 at the same time. Write 80h to this register when
configuring a voltage follower. Only set the AMPMS7 bit to 1.
When an operational amplifier input pin is connected to the AMP1 minus input, the OPAMP1 output is not
b7 b6 b5 b4 b3 b2 b1 b0
Note: When AVCC0 < 2.7 V, before setting the value of these bits, set the PUMP1EN bit in the AMPCPC register to 1
(charge pump for AMP1 is enabled) and wait for the stabilization time. For details on the stabilization time, see
section 47, Electrical Characteristics.
Note: When AMPCPC.PUMP1EN = 1, do not set a total of five or more bits to 1 between the AMP1PS and AMP1MS
registers.
Note 1. To connect the DAC8 channel 0 to the input pin of AMP1, set the DACE0 bit of the DAM register to 1.
When an operational amplifier input pin is connected to the AMP1 plus input, the DAC8 channel 0 output is not
connected to the AMP1 plus input if AMPPS7 = 1.
b7 b6 b5 b4 b3 b2 b1 b0
AMPM — — — — — — AMPM
S7 S0
Value after reset: 0 0 0 0 0 0 0 0
Note: When AVCC0 < 2.7 V, before setting the value of these bits, set the PUMP2EN bit in the AMPCPC register to 1
(charge pump for AMP2 is enabled), wait for the stabilization time. For details on the stabilization time, see
section 47, Electrical Characteristics.
Note: When AMPCPC.PUMP2EN = 1, do not set a total of two or more bits to 1 between the AMP2PS and AMP2MS
registers.
Note 1. The AMPMS7 and AMPMS0 bits must not be set to 1 at the same time. Write 80h to this register when
b7 b6 b5 b4 b3 b2 b1 b0
Note: When AVCC0 < 2.7 V, before setting the value of these bits, set the PUMP2EN bit in the AMPCPC register to 1
(charge pump for AMP2 is enabled) and wait for the stabilization time. For details on the stabilization time, see
section 47, Electrical Characteristics.
Note: When AMPCPC.PUMP2EN = 1, do not set a total of two or more bits to 1 between AMP2PS and AMP2MS
registers.
Note 1. To connect the DAC8 channel 1 to the input pin of the AMP2, set the DACE1 bit of the DAM register to 1.
When an operational amplifier input pin is connected to the AMP2 plus input, the DAC8 channel 1 output is not
connected to the AMP2 plus input if AMPPS7 = 1.
b7 b6 b5 b4 b3 b2 b1 b0
b7 b6 b5 b4 b3 b2 b1 b0
Note: For procedure on user offset trimming, see section 37.9, User Offset Trimming.
Note: User offset trimming cannot be used in low-power mode. When AMPMC.AMPSP[1:0] = x0b, set the AMPUTOTE
register to 00h.
Address(es): OPAMP.AMP0OTP 4008 6818h, OPAMP.AMP1OTP 4008 681Ah, OPAMP.AMP2OTP 4008 681Ch
b7 b6 b5 b4 b3 b2 b1 b0
— — — TRMP[4:0]
Note: There is an initial value set at factory shipment for each operation mode of each OPAMP. Therefore, when
changing the mode (changing the values of AMPSP[1:0] bits in the AMPMC register) after user offset trimming, it
is necessary to execute user offset trimming again in that mode.
Note: User offset trimming cannot be used in low-power mode (AMPMC.AMPSP[1:0] = x0b).
Address(es): OPAMP.AMP0OTN 4008 6819h, OPAMP.AMP1OTN 4008 681Bh, OPAMP.AMP2OTN 4008 681Dh
b7 b6 b5 b4 b3 b2 b1 b0
— — — TRMN[4:0]
37.3 Operation
Status 2 (2) Activate the OPAMP by setting the AMPE[n] bit in the AMPC register
Reference current is (3) Activate the OPAMP by an activation trigger
supplied
OPAMP is stopped
(6) Stop the reference current circuit by setting the IREFE bit
in the AMPC register
(4) Activate the OPAMP and reference current circuit
simultaneously by setting the AMPE[n] and IREFE bits in Status 3
Status 1 the AMPC register Reference current is supplied
Reference current supply (5) Activate the OPAMP and reference current circuit OPAMP is operating
is stopped simultaneously by an activation trigger
All OPAMPs are stopped
AMPSP[1:0] = x0b*1 AMPSP[1:0] = 11b*1
Low-power mode High-speed mode
Note 1. Set the AMPSP[1:0] bits in the AMPMC register and the AMPTRS and AMPTRM registers in status 1.
Note 2. To only stop the OPAMP at the end of 16-bit A/D conversion, preset operation of the reference current circuit to enabled
(operate the OPAMP by status 2).
MCSTP in
MOCOCR register *2
*2
PUMPnEN in
AMPCPC register *2 Set AMPnMS, AMPnPS, and AMP0OS registers,
before enabling AMPE[n] bit in the AMPC register.
AMPnMS register
AMPnPS register 00 Any setting
AMP0OS register
*2
AMPSP[1:0] in
AMPMC register Any setting
AMPTRS[1:0] in
AMPTRS register Setting disabled
AMPTRMn[1:0]
in AMPTRM register xx 00
AMPE[n] in
AMPC register
Figure 37.6 OPAMP control operation when software trigger mode is used for control, and when the
reference current circuit and OPAMP are activated or stopped by software trigger mode
MCSTP in
MOCOCR register *2
*2
PUMPnEN in
AMPCPC register*2 Set AMPnMS, AMPnPS, and AMP0OS registers,
before enabling AMPE[n] bit in the AMPC register
AMPnMS register
AMPnPS register 00 Any setting
AMP0OS register *2
AMPTRMn[1:0] xx 01
in AMPTRM register
Activation trigger m
IREFE in
AMPC register
AMPE[n] in
AMPC register
*1
Wait for Wait for
Reference current circuit state Stopped stabilization Stable operation Stopped stabilization Stable operation
OPAMPn state Stopped Wait for stabilization Stable operation Stopped Wait for stabilization
Figure 37.7 OPAMP control operation when activation trigger mode is used for activation, and when the
reference current circuit and OPAMP are activated by an activation trigger and stopped by setting
the AMPC register
MCSTP in
MOCOCR register *2
*2
PUMPnEN in
AMPCPC register *2 Set AMPnMS, AMPnPS, and AMP0OS registers,
before enabling AMPE[n] bit in the AMPC register
AMPnMS register
AMPnPS register 00 Any setting
AMP0OS register
*2
AMPSP[1:0] in
Any setting
AMPMC register
AMPTRS[1:0] in
xx Any setting
AMPTRS register
AMPTRMn[1:0] xx 11
in AMPTRM register
Activation trigger m
IREFE in
AMPC register
AMPE[n] in
AMPC register
*1
Reference current circuit state Stopped Wait for Wait for
stabilization Stable operation Stopped stabilization Stable operation
OPAMPn state Stopped Wait for stabilization Stable operation Stopped Wait for stabilization
Figure 37.8 OPAMP control operation with activation and A/D trigger mode (1), and with the reference current
circuit and OPAMP activated by an activation trigger and stopped by a 16-bit A/D conversion end
(trigger)
MCSTP in
MOCOCR register *2
*2
PUMPnEN in
AMPCPC register *2 Set AMPnMS, AMPnPS, and AMP0OS registers,
before enabling AMPE[n] bit in the AMPC register
AMPnMS register
AMPnPS register 00 Any setting
AMP0OS register
*2
AMPSP[1:0] in
Any setting
AMPMC register
AMPTRS[1:0] in
xx Any setting
AMPTRS register
AMPTRMn[1:0]
xx 11
in AMPTRM register
Activation trigger m
IREFE in
AMPC register
The amplifier is stopped by setting the AMPC register.
AMPE[n] in
AMPC register
*1
Reference current circuit state Stopped Wait for
stabilization Stable operation Stopped Wait for
stabilization Stable operation
OPAMPn state Stopped Wait for stabilization Stable operation Stopped Wait for stabilization
Figure 37.9 OPAMP control operation with activation and A/D trigger mode (2), and with the reference current
circuit and OPAMP stopped by setting the AMPC register to be activated by an activation trigger
and stopped by a 16-bit A/D conversion end (trigger)
AMPnMS 00h
AMPnPS 00h Set AMPnMS, AMPnPS, and AMP0OS registers.
AMP0OS = Any value
AMPC.AMPE[n] = 1 Generate a software trigger for OPAMPn
(start operation of the OPAMP)
*1
If the charge pump is enabled, wait for the charge
Stabilization wait time
pump stabilization time.
Stabilization wait time Wait for the stabilization wait time.
Note: For details on the stabilization wait time, see section 47, Electrical Characteristics.
Note 1. When AVCC0 < 2.7 V, these steps are required. For details on the charge pump stabilization wait time, see section 47,
Electrical Characteristics.
Figure 37.10 Procedure to start and stop OPAMP in software trigger mode
*1
Stabilization wait time If the charge pump is enabled, wait for the charge
pump stabilization time. Wait for an activation trigger
Note 1. When AVCC0 < 2.7 V, these steps are required. For details on the charge pump stabilization wait time, see
section 47, Electrical Characteristics.
Figure 37.11 Procedure to start and stop OPAMP in activation trigger mode
Note 1. When AVCC0 < 2.7 V, these steps are required. For details on the charge pump stabilization wait time, see
section 47, Electrical Characteristics.
Figure 37.12 Procedure to activate OPAMP using an activation trigger and to stop OPAMP with a 16-bit A/D
conversion end trigger
Initial settings
Figure 37.13 Procedure to change OPAMP switches in the AMPnMS, AMPnPS and AMP0OS registers during
OPAMP operation
AMPn+
+
Connect AMPn AMPnO
-
Vin
Disconnect ADC16
Connect
16-bit
SAR ADC
Connect
(b) Connection diagram for ADC16 operation of the voltage follower as input of Vin output level
AMPn+
+
Connect AMPn AMPnO
-
Vin
Connect ADC16
Connect
16-bit
SAR ADC
Disconnect
Note: To select the ADC16 input, see section 32, 16-Bit A/D Converter (ADC16).
Vin = 100mV Vin is the external input level. Vin = AVDD - 100mV Change the Vin level.
Convert with ADC16 The Vin level is converted. Convert with ADC16 The Vin level is converted.
A is the converted value of Vin level, A is the converted value of Vin level,
A = the converted value, m is the bit number that is the target for A = the converted value, m is the bit number that is the target for
m=4 trimming and is the number of the m=4 trimming and is the number of the
MSB of the TRMP. MSB of the TRMN.
The voltage follower output level The voltage follower output level
Convert with ADC16 using Vin as an input is converted. Convert with ADC16 using Vin as an input is converted.
No No
A B A B
Yes Yes
Move the trimming target to the Move the trimming target to the
AMPnOTP.TRMP[m] = 0 AMPnOTN.TRMN[m] = 0 next bit.
next bit.
m=m-1 Change m to the next bit of TRMP. m=m-1 Change m to the next bit of TRMN.
No No
m<0 m<0
Yes Yes
Finish
Note 1. User offset trimming cannot be used in low-power mode. When AMPMC.AMPSP[1:0] = x0b, set
the AMPUTOTE register to 00h.
Inside LSI
ADC16
16-bit
SAR ADC
AMPnO
AMPnPS.AMPPSm
AMPn+ or AMPn- +
AMPn
-
AMPnMS.AMPMS7
n = 0 to 2, m = 0 to 3
Inside LSI
AMP1O
AMP0PS.AMPPS0
AMP1PS.AMPPS1
AMP0+ +
AMP0 +
- AMP1
AMP0MS.AMPMS7 -
AMP1MS.AMPMS7
AMP0OS.AMPOS1
AMP1+
16-bit
SAR ADC
AMP0O/
AN002
AMP0- AMP0MS.AMPMS0
AMP1- AMP0MS.AMPMS2
AMP1+ AMP0MS.AMPMS3
AMP2- AMP0MS.AMPMS4
Gain changed by
setting each switch
AMP0PS.AMPPS0
AMP0+
Voltage source +
AMP0
-
16-bit
SAR ADC
AMP1- AMP0OS.AMPOS0
AMP1+ AMP0OS.AMPOS1
AMP2- AMP0OS.AMPOS2
AMP2+ AMP0OS.AMPOS3
Gain changed by
setting each switch
AMP0PS.AMPPS7
+
AMP0+ AMP0MS.AMPMS1 AMP0
Current source -
DAC12
12-bit DAC
Inside LSI
Select the D/A Converter output to be input to OPAMP
AMP0PS.AMPPS7
AMP0PS.AMPPS3
AMP0PS.AMPPS2
AMP0PS.AMPPS0
AMP0+
/DA12_0
+
AMP0
-
AMP0MS.AMPMS7
AMP0O
AMP1PS.AMPPS7
AMP1PS.AMPPS3
AMP1PS.AMPPS1
AMP1+
/DA8_0
+
AMP1
-
AMP1MS.AMPMS7
AMP1O
AMP2PS.AMPPS7
AMP2PS.AMPPS1
AMP2+
/DA8_1
+
AMP2
-
AMP2MS.AMPMS7
AMP2O
Select whether to output the D/A
Converter output to the terminal
PFS.P500PFS
DAC12
12-bit DAC
PFS.P002PFS
PFS.P013PFS
DAC8
8-bit DAC
channel 1
8-bit DAC
channel 0
Figure 37.20 Using the configurable amplifier as a D/A converter output amplifier
IVREF5
IVREF4 CRVS5 CRVS4 CRVS3 CRVS2 CRVS1 CRVS0 CPOE
IVREF3
IVREF2
IVREF1 CMPOUT0
IVREF0
CMPMON
-
IVCMP2
0 Noise reduction
IVCMP1 + filter (same value
sampled 3 times)
Edge ACMP_HS0
IVCMP0 1 selector event request
Comparator
input selection
HCMPON COE CINV CDFS1 CDFS0 CEG1 CEG0
Note 1. When the output level of DAC8 channel 0 is not output to pin (DA8_0), it can be used as AN005 analog input.
Note 2. When the output level of DAC12 is not output to pin (DA12_0), it can be used as AN000 analog input.
Note 3. Internal reference voltage.
Note 4. When using for ACMPHS input, it cannot be selected as A/D conversion target.
Note 5. When using for ACMPHS input, it cannot be selected as analog reference voltage supply pin for DAC12.
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. Change CDFS[1:0] and CINV bits only after disabling the ACMPHS output (COE = 0).
Note 2. If the CDFS[1:0] and CINV bits are changed, an ACMPHS interrupt request and an ELC event can be generated.
Before changing these bits, set the ELC.ELSRn register to 0000h (the ACMPHS output is not linked). After
changing these bits, set the IR flag in the ICU.IELSRn register to 0 to clear the interrupt status.
Note 3. If the CDFS[1:0] bits are changed from 00b (noise filter not used) to a value other than 00b (noise filter used),
perform sampling four times, update the filter output, then use the ACMPHS interrupt request or the ELC event.
Note 4. A stabilization wait time is required to permit ACMPHS operation after enabling it (HCMPON = 1).
The operation stabilization wait time for ACMPHS0 is 1 μs.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — CMPSEL[2:0]
Note 1. Use the following procedure to modify the CMPSEL[2:0] bits. Writing a value other than 0000 0000b while the
value of the CMPSEL0 register is not 0000 0000b is invalid. Writing 1 to two or more bits is also invalid. In both
cases, the previous value is retained.
To change the CMPSEL[2:0] bits:
1. Set the CMPCTL.COE bit to 0.
2. Set the CMPSEL0 register to 0000 0000b.
3. Set a new value in the CMPSEL[2:0] bits, with 1 set in only one of the bits.
4. Wait for the input switching stabilization wait time of 200 ns.
5. Set the CMPCTL.COE bit to 1.
6. Clear IR flag in the ICU.IELSRn register to clear the interrupt status.
Note 2. For details, see Table 38.2, Input source configuration of the ACMPHS.
b7 b6 b5 b4 b3 b2 b1 b0
— — CRVS[5:0]
Note 1. Use the following procedure to modify the CRVS[5:0] bits. Writing a value other than 0000 0000b while the value
of the CMPSEL1 register is not 0000 0000b is invalid. Writing 1 to two or more bits is also invalid. In both cases,
the previous value is retained.
To change the CRVS[5:0] bits:
1. Set the CMPCTL.COE bit to 0.
2. Set the CMPSEL1 register to 0000 0000b.
3. Set a new value in the CRVS[5:0] bits, with 1 set in only one of the bits.
4. Wait for the input switching stabilization wait time of 200 ns.
5. Set the CMPCTL.COE bit to 1.
6. Set the IR flag in the ICU.IELSRn register to clear the interrupt status.
Note 2. For details, see Table 38.2, Input source configuration of the ACMPHS.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — CMPM
ON
Value after reset: 0 0 0 0 0 0 0 0
Note 1. When ACMPHS operation is enabled (HCMPON = 1 and COE = 1) but the noise filter is not in use (CDFS[1:0] =
00b), ensure that the CMPMON bit is read twice and the values are only used after the two consecutive values
match.
b7 b6 b5 b4 b3 b2 b1 b0
VREFE — — — — — — CPOE
N
Value after reset: 0 0 0 0 0 0 0 0
38.3 Operation
The ACMPHS compares a reference voltage to an analog input voltage. Operation is not guaranteed when the register
values are changed during ACMPHS operation. Table 38.3 shows the procedures for setting the registers associated with
the ACMPHS.
Note 1. After ACMPHS0 is set, an unnecessary interrupt might occur until operation becomes stable, so initialize the
interrupt flag.
Note 2. After ACMPHS0 is set, an unnecessary interrupt might occur until operation becomes stable, so initialize the
event link select.
Figure 38.2 shows an example of ACMPHS operation. The VCOUT output becomes 1 when the analog input voltage is
higher than the reference input voltage, and the VCOUT output becomes 0 when the analog input voltage is lower than
the reference voltage. When the ACMPHS output changes, an interrupt request and an ELC event are output.
Analog input voltage (V)
ACMP_HS0 High
ELC event output Low
Comparator interrupt
request output
(A) (B) (A) (B)
1
IELSRn.IR flag in ICU
0
(A) (B) (A)
(B)
Set to 0 by software
High
VCOUT output
Low
Sampling time
CMPOUT0
From ACMPHS*1
PCLKB 01
Sampling clock
PCLKB/8 10
0 CPLOUT0
1
1 Single-edge
CMPREF0 00
0 0 detection
DAC8 channel 0 output IVREF0 else 0 ACMP_LP0
1 interrupt request/
CRVS1, 0 & ASEL Noise reduction 1 ELC event request
filter (same value Both-edge
CMPIN0
sampled 3 times) detection
AMP0O IVCMP0
Note 1. ACMPHS and ACMPLP results are output to the VCOUT pin.
Figure 39.1 ACMPLP block diagram when window function is disabled in standard mode
PCLKB 01
Sampling clock
PCLKB/8 10
PCLKB/32 11
0 CPLOUT0
1
CMPREF0
DAC8 channel 0 output IVREF0
1 Single-edge
CRVS1, 0 & ASEL 00
0 detection
CMPIN0 else 0 ACMP_LP0
interrupt request/
AMP0O IVCMP0 Noise reduction 1 ELC event request
CMPSEL1, 0 & ASEL
filter (same value Both-edge
sampled 3 times) detection
PCLKB/32 11
PCLKB/8 10
Sampling clock
PCLKB 01
Note 1. ACMPHS and ACMPLP results are output to the VCOUT pin.
Figure 39.2 ACMPLP block diagram when window function is enabled in window function mode
Note 1. ACMPHS0 and ACMPLPn (n = 0, 1) results are output to the VCOUT pin.
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. Window function mode cannot be set when low-speed mode is selected (the SPDMD bit in the COMPOCR
register is 0).
Note 2. In window function mode, the reference voltage in the comparator is selected regardless of this bit setting.
Note 3. The initial value is 0 immediately after a reset is released. However, the value is undefined when C0ENB is set to
0 and C1ENB is set to 0 after operation of the comparator is enabled once.
When the reference level is equal to the input level, the bit value is undefined.
Note 4. The setting is valid only when in standard mode. When in window function mode, IVREF0 or IVREF1 is selected
regardless of this bit setting.
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. If bits CiFCK[1:0], CiEPO, and CiEDG (i = 0, 1) are modified, an ACMPLP interrupt request and an ELC event
request can be generated. Change these bits only after setting event link to deselected. Also, be sure to clear the
associated interrupt request flag.
b7 b6 b5 b4 b3 b2 b1 b0
Note 1. ACMPHS0 and ACMPLPn (n = 0, 1) results are bundled on the VCOUT pin.
Note 2. When rewriting the SPDMD bit, be sure to set the CiENB bit (i = 0, 1) in the COMPMDR register to 0 in advance.
b7 b6 b5 b4 b3 b2 b1 b0
— — CMPSEL[5:4] — — CMPSEL[1:0]
b7 b6 b5 b4 b3 b2 b1 b0
39.3 Operation
ACMPLP0 and ACMPLP1 operate independently, and their operations are the same. Operation is not guaranteed when
the values of their associated registers are changed during the comparator operation. Table 39.3 shows the procedure for
setting the ACMPLP associated registers.
Figure 39.3 shows an operating example of the ACMPLPi (i = 0, 1) when window function is disabled. The reference
input voltage (IVREFi) or internal reference voltage (Vref) and the analog input voltage (IVCMPi) are compared as
follows:
If the analog input voltage is higher than the reference voltage, the COMPMDR.CiMON bit is set to 1.
If the analog input voltage is lower than the reference voltage, the CiMON bit is set to 0.
ACMPLPi outputs an interrupt to the ICU. For details on the interrupt, see section 39.5, ACMPLP Interrupts. ACMPLPi
also outputs an event signal to the ELC to activate other modules. For details on the ELC, see section 39.6, ELC Event
Output. Do not change the values of the registers during the comparison.
Reference voltage
1
COMPMDR.CiMON bit (i = 0, 1)
0
IELSRn.IR flag 1
in ICU 0 (A) (B) (A)
Set to 0 by software
Reference voltage
(IVREF1)
Reference voltage
(IVREF0)
COMPMDR.CiMON bit (i = 0, 1) 1
0
Set to 0 by software
PCLKB 01
Sampling clock
PCLKB/8 10
PCLKB/32 11
1
0 CPLOUT1
0 CPLOUT0
1
1 Single-edge
00
0 detection
else 0 ACMP_LP0
interrupt request/
Noise reduction 1 ELC event request
ACMPLP0 signal filter (same value Both-edge
sampled 3 times) detection
PCLKB/32 11
PCLKB/8 10
Sampling clock
PCLKB 01
Sampling timing
MCU MCU
Ground Ground
Metal enclosure Metal enclosure
Electrical insulator
(panel)
Electrode
board MCU
(transmission)
Touch electrode MCU (reception)
Operation enabled
System control block Status
supply
Power
b7 b6 b5 b4 b3 b2 b1 b0
Only set the CTSUCAP and CTSUSNZ bits when the CTSUSTRT bit is 0. These bits can be set at the same time that
measurement operation starts.
Note 1. The state can be read from the CTSUST.CTSUSTC[2:0] flags as follows:
During measurement: CTSUST.CTSUSTC[2:0] flags ≠ 000b
While waiting for an external trigger: CTSUST.CTSUSTC[2:0] flags = 000b.
If software sets the CTSUSTRT bit to 1 when the bit is already 1, the write is ignored and operation continues. To force
operation to stop through software when the CTSUSTRT bit is 1, set the CTSUSTRT bit to 0 and the CTSUINIT bit to 1
at the same time.
Note: Settings other than those listed in the table are prohibited.
To start measurement from the suspended state, set the CTSUSNZ bit to 0, then set the CTSUSTRT bit to 1. To suspend
the module after measurement stops, set the CTSUSNZ bit to 1.
b7 b6 b5 b4 b3 b2 b1 b0
b7 b6 b5 b4 b3 b2 b1 b0
b7 b6 b5 b4 b3 b2 b1 b0
CTSUSST[7:0]
b7 b6 b5 b4 b3 b2 b1 b0
— — CTSUMCH0[5:0]
Note 1. Writing to these bits is only enabled in self-capacitance single scan mode (CTSUCR1.CTSUMD[1:0] = 00b).
b7 b6 b5 b4 b3 b2 b1 b0
— — CTSUMCH1[5:0]
b7 b6 b5 b4 b3 b2 b1 b0
CTSUCHAC0[7:0]
b7 b6 b5 b4 b3 b2 b1 b0
CTSUCHAC1[7:0]
b7 b6 b5 b4 b3 b2 b1 b0
CTSUCHAC2[7:0]
b7 b6 b5 b4 b3 b2 b1 b0
CTSUCHAC3[7:0]*1
Note 1. The MCU does not support TS26 to TS31 pins. Therefore, CTSUCHAC3[2] to CTSUCHAC3[7] are read as 0.
The write value should be 0.
b7 b6 b5 b4 b3 b2 b1 b0
CTSUCHTRC0[7:0]
b7 b6 b5 b4 b3 b2 b1 b0
CTSUCHTRC1[7:0]
b7 b6 b5 b4 b3 b2 b1 b0
CTSUCHTRC2[7:0]
b7 b6 b5 b4 b3 b2 b1 b0
CTSUCHTRC3[7:0]*1
Note 1. The MCU does not support the TS26 to TS31 pins. Therefore, CTSUCHTRC3[2] to CTSUCHTRC3[7] are read
as 0. The write value should be 0.
b7 b6 b5 b4 b3 b2 b1 b0
— — CTSUSSCNT[1: — — CTSUSSMOD[1
0] :0]
Value after reset: 0 0 0 0 0 0 0 0
b7 b6 b5 b4 b3 b2 b1 b0
When using the CTSUCR0.CTSUINIT bit to clear an overflow flag, make sure that the CTSUCR0.CTSUSTRT bit is 0.
— — — — CTSUSSDIV[3:0] — — — — — — — —
Table 40.5 Relationship between base clock frequencies and CTSUSSDIV[3:0] bit settings (1 of 2)
Base clock frequency fb (MHz) CTSUSSDIV[3:0] bit setting
4.00 ≤ fb 0000b
2.00 ≤ fb < 4.00 0001b
1.33 ≤ fb < 2.00 0010b
1.00 ≤ fb < 1.33 0011b
0.80 ≤ fb < 1.00 0100b
0.67 ≤ fb < 0.80 0101b
0.57 ≤ fb < 0.67 0110b
0.50 ≤ fb < 0.57 0111b
0.44 ≤ fb < 0.50 1000b
0.40 ≤ fb < 0.44 1001b
0.36 ≤ fb < 0.40 1010b
0.33 ≤ fb < 0.36 1011b
0.31 ≤ fb < 0.33 1100b
Table 40.5 Relationship between base clock frequencies and CTSUSSDIV[3:0] bit settings (2 of 2)
Base clock frequency fb (MHz) CTSUSSDIV[3:0] bit setting
0.29 ≤ fb < 0.31 1101b
0.27 ≤ fb < 0.29 1110b
fb < 0.27 1111b
CTSUSNUM[5:0] CTSUSO[9:0]
Note 1. Do not set the CTSUSDPA[4:0] bits to 00000b while the high-pass noise reduction function is turned off
(CTSUSDPRS.CTSUSOFF = 1) in mutual-capacitance full scan mode (CTSUCR1.CTSUMD[1:0] = 11b).
After a CTSU_CTSUWR interrupt is generated, write first to the CTSUSSC register, next to the CTSUSO0 register, and
then to the CTSUSO1 register. The write to the CTSUSO1 register causes a transition to Status 3. Set all of the bits in a
single operation when writing to the CTSUSO1 register.
CTSUSC[15:0]
After a CTSU_CTSURD interrupt occurs, read first from the CTSUSC counter, then from the CTSURC counter.
CTSURC[15:0]
After a CTSU_CTSURD interrupt is generated, read first from the CTSUSC counter, then from the CTSURC counter.
Status 3 continues until the CTSURC counter is read, even if the stabilization time specified for Status 3 elapses.
40.3 Operation
Reference
electric VCC
Power potential
-
supply
+
Control
LPF TSCAP current ICO Counter
Sensor
(electrode) SW1
Note 1. n = 00 to 27
Reference
electric VCC
Power potential
-
supply
+
Control
LPF TSCAP ICO Counter
current
Sensor SW1
(electrode)
Sensor drive pulse
TSn*1
Switched
SW2
capacitor filter
i = fCV
Note 1. n = 00 to 27
Reference
electric VCC
Power potential
-
supply
+
Control
LPF TSCAP ICO Counter
current
Sensor
(electrode) Turn SW1 off
Note 1. n = 00 to 27
Number of counts
Not touching
0
Figure 40.7 Change in measured value when finger is touching and not touching
Key 1 Key 2
TS03
Transmit pin
Discharge external LPF Discharge the external LPF capacitor connected to the MCU by using the TSCAP pin as
capacitor the I/O port function and driving it low for the specified time.
connected to TSCAP pin
Set the associated pin to TSn (n = 00 to 27) by setting the Port mn Pin Function Select
register of the I/O port function (PmnPFS.PSEL[4:0] = 01100b), and set the pin to the
Set I/O port peripheral function by setting the Port Mode Control bit for the I/O port (PMR)
(PmnPFS.PMR = 1).
Enable the module clock by setting the MSTPC3 bit in Module Stop Control Register C
Enable CTSU input clock (MSTPCRC) to 0.
Set the CTSU power supply operating mode and capacity adjustment.
When operating the CTSU while VCC is 2.4 V or lower, set the
Set CTSU power supply
CTSUCR1.CTSUATUNE0 bit.
Set the CTSUCR1.CTSUATUNE1 bit according to electrostatic capacitance generated
in the electrode connected to the TSn pin.
Set CTSU base clock Use the CTSUCR1.CTSUCLK[1:0] and CTSUSO1.CTSUSDPA[4:0] bits to set the base
clock.
Supply power to the CTSU and connect the LPF capacitor to the TSCAP pin.
Power on CTSU Write 1 to the CTSUCR1.CTSUPON bit and 1 to the CTSUCR1.CTSUCSW bit at the
same time.
After data is written, wait until charging of the external LPF capacitor connected to the
Wait for stabilization TSCAP pin stabilizes.
Status 3
Sensor drive pulse output start/
sensor stabilization wait period*2 Condition for transition to Status 4:
CTSUST.CTSUDTSR flag = 0 when the sensor stabilization wait elapses
after supply of the sensor drive pulse starts.
Status 4
Measurement start/
measurement period Condition for transition to Status 5:
The measurement time elapses after measurement started.
For details on the measurement time, see section 40.3.3.1, Sensor
stabilization wait time and measurement time.
Status 5
Measurement completed Condition for transition to Status 1:
After 2 operating clocks elapse.
Note 1. When using the DTC or ICU to set the registers during CTSU_CTSUWR interrupt handling, write to the CTSUSO1 register last.
Note 2. If the CTSUST.CTSUDTSR flag = 1, wait until the previous measurement result is transferred.
Initial settings
CTSUCR1 register:
Set CTSU registers • CTSUCR1.CTSUCLK[1:0] bits: Operating clock can be selected
• CTSUCR1.CTSUMD[1:0] bits: Set these bits to 00b
CTSUSDPRS register:
• CTSUSDPRS.CTSUSOFF bit: High-pass noise prevention can be turned off
• CTSUSDPRS.CTSUPRMODE[1:0] bits: Set the number of base pulses for synchronous noise prevention
Power supply stabilization • CTSUSDPRS.CTSUPRRATIO[3:0] bits: Set the measurement time for synchronous noise prevention
time has elapsed after CTSUSST register: Set the sensor stabilization time
CTSUPON = 1 CTSUCHAC0 to CTSUCHAC3 registers: Set the enabled channel
CTSUMCH0 register: Set the measurement channel
No
CTSU_CTSUWR
interrupt generated?
No
CTSU_CTSURD
generated?
Touch determination
processing When a software trigger is used, the CTSUCR0.CTSUSTRT bit sets to 0 when CTSU operation stops
Figure 40.12 Software flow and operation example of self-capacitance single scan mode
Operating clock
CTSUCR0.CTSUSTRT bit
CTSUMCH0 register 63 5 63
CTSUST.CTSUSTC[2:0]
0 1 2 3 4 (During current/count value conversion) 5 1 0
flags (status)
CTSU_CTSUWR interrupt
CTSU_CTSURD interrupt
CTSU_CTSUFN interrupt
Figure 40.13 Timing of self-capacitance single scan mode when the measurement start condition is a software
trigger
The following sequence describes the operation shown in Figure 40.13:
1. After the initial settings are made, operation is started by writing 1 to the CTSUCR0.CTSUSTRT bit.
2. After the channel to be measured is determined according to the preset conditions, a request to set the associated
channel (CTSU_CTSUWR) is output.
3. On completion of writing the measurement channel settings (CTSUSSC, CTSUSO0, and CTSUSO1 registers), the
sensor drive pulse is output, and the sensor ICO clock and the reference ICO clock operate.
4. After the sensor stabilization wait time and the measurement time elapse and measurement stops, a measurement
result read request (CTSU_CTSURD) is output.
5. A measurement end interrupt (CTSU_CTSUFN) is output and measurement stops (transition to Status 0).
Table 40.6 lists the touch pin states in self-capacitance single scan mode.
Initial settings
No
CTSU_CTSUWR
interrupt generated?
No
CTSU_CTSURD
generated?
Touch determination
When a software trigger is used, the CTSUCR0.CTSUSTRT bit sets to 0 when CTSU operation stops.
processing
Receive Channels
Channel 7 Channel 6 Channel 5 Channel 4 Channel 3 Channel 2 Channel 1 Channel 0
Figure 40.14 Software flow and operation example of self-capacitance multi-scan mode
Operating clock
CTSUCR0.CTSUSTRT bit
CTSUMCH0 register 63 0 1 2 N 63
CTSU_CTSUWR interrupt
CTSU_CTSURD interrupt
CTSU_CTSUFN interrupt
Figure 40.15 Timing of self-capacitance multi-scan mode when the measurement start condition is a software
trigger
The following sequence describes the operation shown in Figure 40.15:
1. After the initial settings are made, operation is started by writing 1 to the CTSUCR0.CTSUSTRT bit.
2. After the channel to be measured is determined according to the preset conditions, a request to set the associated
channel (CTSU_CTSUWR) is output.
3. On completion of writing the measurement channel settings (CTSUSSC, CTSUSO0, and CTSUSO1 registers), the
sensor drive pulse is output, and the sensor ICO clock and the reference ICO clock operate.
4. After the sensor stabilization wait time and the measurement time elapse and measurement stops, a measurement
result read request (CTSU_CTSURD) is output.
5. After the channel to be measured next is determined, a request to set the associated channel (CTSU_CTSUWR) is
output.
6. After the stabilization wait time elapses and when the previous measurement is read, the result is cleared and
measurement starts.
7. On completion of all channel measurements, a measurement end interrupt (CTSU_CTSUFN) is output and
measurement stops (transition to Status 0).
Table 40.7 lists the touch pin states in self-capacitance multi-scan mode.
Initial settings
CTSUCR1 register:
Set CTSU registers • CTSUCR1.CTSUCLK[1:0] bits: Operating clock can be selected
• CTSUCR1.CTSUMD[1:0] bits: Set these bits to 11b
CTSUSDPRS register:
• CTSUSDPRS.CTSUSOFF bit: High-pass noise prevention can be turned off
• CTSUSDPRS.CTSUPRMODE[1:0] bits: Set the number of base pulses for synchronous noise
prevention
• CTSUSDPRS.CTSUPRRATIO[3:0] bits: Set the measurement time for synchronous noise prevention
CTSUSST register: Set the sensor stabilization time
Power supply stabilization CTSUCHAC0 to CTSUCHAC3 registers: Set the enabled channels
time has elapsed after CTSUCHTRC0 to CTSUCHTRC3 registers: Allocate transmission or reception to the TSn pins
CTSUPON = 1
No
CTSU_CTSUWR
interrupt generated?
No
CTSU_CTSURD
generated? Repeat for the number of
the measurement channels
Read the first CTSUSC counter Transferred by the DTC
measurement result CTSURC counter when the DTC is selected
No
CTSU_CTSURD
generated?
Touch determination
processing When a software trigger is used, the CTSUCR0.CTSUSTRT bit sets to 0 when CTSU operation stops.
Receive Channels
Channel 3 Channel 2 Channel 1 Channel 0
Channel 4
Channel 7
Figure 40.16 Software flow and operation example of mutual-capacitance full scan mode
Operating clock
CTSUCR0.CTSUSTRT bit
CTSUMCH0 register
63 0
(Receive channel)
CTSUMCH1 register
63 0 1 2 3 4 5
(Transmit channel)
CTSUST.CTSUSTC[2:0] 4 (During current/count value
0 1 2 3 4 (During current/count value conversion) 5 1 3 5 1 2
flags (Status) conversion)
CTSUST.CTSUPS flag
CTSU_CTSUWR interrupt
CTSU_CTSURD interrupt
CTSU_CTSUFN interrupt
Figure 40.17 Timing of mutual-capacitance full scan mode when the measurement start condition is a software
trigger
The following sequence describes the operation shown in Figure 40.17:
1. After the initial settings are made, operation is started by writing 1 to the CTSUCR0.CTSUSTRT bit.
2. After the channel to be measured is determined according to the preset conditions, a request to set the associated
channel (CTSU_CTSUWR) is output.
3. On completion of writing the measurement channel settings (CTSUSSC, CTSUSO0, and CTSUSO1 registers), the
sensor drive pulse is output and the sensor ICO clock and the reference ICO clock operate. At the same time, a
rising edge pulse is output to the transmit pin on the measurement channel for the high-level period of the sensor
drive pulse.
4. After the sensor stabilization wait time and the measurement time elapse and measurement stops, a measurement
result read request (CTSU_CTSURD) is output.
5. The same channel, measurement is performed by outputting a pulse that becomes a falling edge during the high-
level period of the sensor drive pulse.
6. After the same channel is measured twice, the channel to be measured next is determined and measured in the same
way.
7. On completion of all channel measurements, a measurement end interrupt (CTSU_CTSUFN) is output and
measurement stops (transition to Status 0).
The CTSU Mutual Capacitance Status Flag (CTSUST.CTSUPS bit) changes when Status 5 transitions to Status 1.
Table 40.8 lists the touch pin states in mutual-capacitance full scan mode.
Operating clock
CTSUCR0.CTSUSTRT bit
(4)
CTSUST.CTSUSTC[2:0] flags
0 1 2 3 4 5 1 0
(status)
CTSU_CTSUWR interrupt
CTSU_CTSURD interrupt
CTSU_CTSUFN interrupt
40.3.3.2 Interrupts
The CTSU supports the following interrupts:
Write request interrupt for setting registers for each channel (CTSU_CTSUWR)
Measurement data transfer request interrupt (CTSU_CTSURD)
Measurement end interrupt (CTSU_CTSUFN).
(1) Write request interrupt for setting registers for each channel (CTSU_CTSUWR)
Store the settings for each measurement channel in the SRAM, and set up the DTC or ICU transfer associated with the
CTSU_CTSUWR interrupt in advance. The CTSU_CTSUWR interrupt is output when Status 1 transitions to Status 2.
Write the settings for the selected channel from the SRAM to the CTSUSSC, CTSUSO0, and CTSUSO1 registers
(Figure 40.19). Because write access to the CTSUSO1 register controls the transition to the next status, be sure to set this
register last.
Transfer
Channel 1
Figure 40.19 Example of DTC transfer operation using the CTSU_CTSUWR interrupt
The registers to be set (CTSUSSC, CTSUSO0, and CTSUSO1) are allocated at sequential addresses. On
CTSU_CTSUWR interrupt generation, set up the operation as follows:
Transfer destination address: CTSUSSC register address
Handling at the transfer destination address: Transfer 2-byte data three times for a single interrupt. The address of
the start byte is fixed.
Transfer source address: CTSUSSC register data storage address for the lowest number channel in the settings
stored in the SRAM
Handling at the transfer source address: Transfer 2-byte data three times for a single interrupt. The address of the
first byte is continued from the previous interrupt handling.
Number of transfers: Transfer three times with one interrupt.
Transfer
Channel 1
Figure 40.20 Example of DTC transfer operation using the CTSU_CTSURD interrupt
The measurement result registers, CTSUSC and CTSURC counters, used as transfer sources, are allocated at sequential
addresses. On CTSU_CTSURD interrupt generation, set up the operation as follows:
Transfer source address: CTSUSC counter address
Handling at the transfer source address: Transfer 2-byte data twice for a single interrupt. The start address is fixed.
Transfer destination address: CTSUSC counter data storage address for the lowest number channel in the settings
stored in the SRAM
Handling at the transfer destination address: Transfer 2-byte data twice for a single interrupt. The start address
continues from the previous interrupt handling.
Number of transfers: Transfer twice with one interrupt.
PCLKB
CTSU_CTSUFN interrupt
CTSUSTRT
DODIR
Internal peripheral bus
Operation
DOC_DOPCI
circuit
DODSR
OMS[1:0]
DOCR
b7 b6 b5 b4 b3 b2 b1 b0
DODIR is a 16-bit read/write register that stores 16-bit data used in all operations.
DODSR is a 16-bit read/write register that stores 16-bit data used as a reference in data comparison mode. This register
also stores the results of operations in data addition and subtraction modes.
41.3 Operation
Write 1 to
DOCR.DOPCFCL bit
1
DOCR.DOPCF bit
0
Write 1 to
DOCR.DOPCFCL bit
1
DOCR.DOPCF bit
0
Write 1 to
DOCR.DOPCFCL bit
1
DOCR.DOPCF bit
0
41.4 Interrupt Request and Output to the Event Link Controller (ELC)
The DOC outputs an event signal to the ELC under the following conditions:
Compared values either match or mismatch
Data addition result is greater than FFFFh
Data subtraction result is less than 0000h.
This signal can be used to initiate operations by other modules selected in advance and can also be used as an interrupt
request. When an event signal is generated, the Data Operation Circuit Flag (DOCR.DOPCF) is set to 1.
42. SRAM
42.1 Overview
The MCU provides an on-chip, high-speed SRAM module with either parity-bit checking or Error Correction Code
(ECC). The first 16-KB area of SRAM0 is subject to ECC. Parity check is performed on the other areas.
Table 42.1 lists the SRAM specifications.
Note: SRAM0 (without ECC) and Trace_RAM are shared. For the Trace_RAM specifications, see the ARM®
CoreSight™ MTB-M23 Technical Reference Manual (ARM DDI 0564C).
Note 1. For details, see section 42.3.6, Access Cycle.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — OAD
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 enabled before
writing to this register. Do not write to the PARIOAD register while accessing the SRAM.
b7 b6 b5 b4 b3 b2 b1 b0
KW[6:0] SRAMP
RCR
Value after reset: 0 0 0 0 0 0 0 0
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — ECCMOD[1:0]
The ECCMODE register specifies the ECC operating mode. The ECC Protection Register (ECCPRCR) protects this
register against writes. Before writing to this register, set the ECCPRCR bit in the ECCPRCR register to 1 (write
protection disabled). Do not write to the ECCMODE register while accessing the SRAM.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — ECC2E
RR
Value after reset: 0 0 0 0 0 0 0 0
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — E1STS
EN
Value after reset: 0 0 0 0 0 0 0 0
The ECC1STSEN register enables or disables updating of the ECC 1-bit Error Status Register (ECC1STS) in response to
a 1-bit error ECC error in the SRAM0 (ECC area).
The ECC Protection Register (ECCPRCR) protects this register against writes. Before writing to this bit, set the
ECCPRCR bit in the ECCPRCR register to 1 (write protection disabled).
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — ECC1E
RR
Value after reset: 0 0 0 0 0 0 0 0
b7 b6 b5 b4 b3 b2 b1 b0
KW[6:0] ECCPR
CR
Value after reset: 0 0 0 0 0 0 0 0
b7 b6 b5 b4 b3 b2 b1 b0
KW2[6:0] ECCPR
CR2
Value after reset: 0 0 0 0 0 0 0 0
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — TSTBY
P
Value after reset: 0 0 0 0 0 0 0 0
The ECC Protection Register 2 (ECCPRCR2) protects this register against writes. Before writing to this bit, set the
ECCPRCR2 bit in the ECCPRCR2 register to 1 (write protection disabled). Do not write to the ECCETST register while
accessing the SRAM.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — OAD
The ECC Protection Register (ECCPRCR) protects this register against writes. Before writing to this bit, set the
ECCPRCR bit in the ECCPRCR register to 1 (write protection disabled). Do not write to the ECCOAD register while
accessing the SRAM.
The MTB for trace is limited from 2000 4000h to 2000 7FFFh.
Note: Do not attempt to access reserved or unused address locations. This can result in UNPREDICTABLE behavior.
42.3 Operation
Start
Write F1h to the SRAM0 (ECC area) Protection Register and enable writes to the
SRAM-related registers
Write 03h to the SRAM0 (ECC area) Operating Mode Control Register and set the
ECC enable mode
Write 4-byte data to the target address. The 7-bit ECC code is automatically updated.
Write 00h to the SRAM0 (ECC area) Operating Mode Register and set the ECC
disable mode
Write F1h to SRAM0 (ECC area) Protection Register 2 (for ECC test)
and enable writes to the SRAM-related registers
Write 01h to the SRAM0 (ECC area) Test Control Register and enable the ECC
bypass
Read with 32-bit data size at the target address to get 7-bit-ECC
To generate 1-bit/2-bit ECC error, reverse 1-bit/2-bit of the data read in the previous
process and write the data back to the target address in 32 bits
Write 00h to the ECC Test Control Register and disable the ECC bypass
Write 03h to the SRAM0 (ECC area) Operating Mode Control Register and set the
ECC enable mode
Read the target address and confirm the generation of the ECC error by the ECC
1-bit/2-bit Error Status Register
End
Yes
RPERF*1 = 1
No
Yes
Parity error
generated
No No
Parity error
generated
Yes
Normal SRAM
Reset generated
operation error handling
Note 1. RPERF: SRAM Parity Error Reset Detect Flag (RSTSR1.RPERF bit)
Figure 42.2 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
Normal SRAM
operation error handling
Note 1. RPEST: SRAM Parity Error Interrupt Status Flag (NMISR.RPEST bit)
Figure 42.3 Flow of SRAM parity check when SRAM parity interrupt is enabled
Table 43.1 Code flash memory and data flash memory specifications
Parameter Code flash memory Data flash memory
Memory capacity 256 KB of user area 8 KB of data area
Read cycle 32 MHz < ICLK frequency ≤ 48 MHz A read operation takes 6 FCLK cycles in bytes
Cache hit: 1 cycle (FCLK frequency ≤ 32 MHz)
Cache miss: 2, 3 cycles
ICLK frequency ≤ 32 MHz
Cache hit: 1 cycle
Cache miss: 1 cycle.
Value after erasure FFh FFh
Programming/erasing method Programming and erasure of code and data flash memory through the FCB commands
specified in the registers
Programming by dedicated flash-memory programmer through a serial interface (serial
programming)
Programming of flash memory by user program (self-programming).
Security function Protection against illicit tampering with or reading of data in flash memory
Protection Protection against erroneous overwriting of flash memory
Background operations (BGOs) Code flash memory can be read during data flash memory programming
Units of programming and erasure 64-bit units for programming in user area 8-bit units for programming in data area
2-KB units for erasure in user area. 1-KB units for erasure in data area.
Other functions Interrupts accepted during self-programming
An expansion area of flash memory (option bytes) can be set in the initial MCU settings
On-board programming Programming in serial programming mode (SCI boot mode):
Asynchronous serial interface (SCI9) used
Transfer rate adjusted automatically.
Programming by a routine for code and data flash memory programming within the user
program:
Allows code and data flash memory programming without resetting the system.
Note 1. USB boot mode does not exist with 32-pin products.
Memory bus 1
Memory bus 3
Flash ready
Flash
interrupt FCB Code flash memory
cache
(FCU_FRDYI)
Read address
0003 FFFFh
Block 127 (2 KB)
: 256 KB
Block 64 (2 KB)
0002 0000h
0001 FFFFh Block 63 (2 KB)
: 128 KB
Block 0 (2 KB)
0000 0000h
Table 43.2 Read and P/E addresses of the code flash memory
Size of code flash memory Read address P/E address Number of blocks
256 KB 0000 0000h to 0003 FFFFh 0000 0000h to 0003 FFFFh 0 to 127
The data area of the data flash memory is divided into 1-KB blocks, with each being a unit for erasure. Figure 43.3 shows
the mapping of the data flash memory, and Table 43.3 shows the read, programming and erasure addresses of the data
flash memory.
: 8 KB
Block 0 (1 KB)
4010 0000h FE00 0000h
Table 43.3 Read and P/E addresses of the data flash memory
Size of data flash memory Read address P/E address Number of blocks
8 KB 4010 0000h to 4010 1FFFh FE00 0000h to FE00 1FFFh 0 to 7
43.3.1 Overview
The flash cache (FCACHE) speeds up read access from the bus master to the flash memory. The FCACHE includes:
FCACHE1, for CPU instruction fetch
FCACHE2, for CPU operand access and DTC
FLPF, for prefetch access of CPU instruction fetch.
Registers
Flash cache 1
Code flash
Flash cache 2
memory
Prefetch buffer
— — — — — — — — — — — — — — — FCACH
EEN
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
The FCACHEE.FCACHEEN bit enables or disables the flash cache function for FCACHE1, FCACHE2, and FLPF. This
bit does not affect FCACHEIV.FCACHEIV. When FCACHE is enabled, the HPROT[3] bit setting determines whether it
is cacheable or non-cacheable. See section 14.5, Notes on using Flash Cache for details on HPROT[3].
— — — — — — — — — — — — — — — FCACH
EIV
Value after reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
When 1 is written to the FCACHEIV.FCACHEIV bit, flash cache data in FCACHE1, FCACHE2, and FLPF is
invalidated.
b7 b6 b5 b4 b3 b2 b1 b0
— — — — — — — DFLEN
The DFLCTL register is used to enable or disable access to the data flash. After setting the DFLCTL.DFLEN bit, data
flash stop recovery time (tDSTOP) is required before reading the data flash or entering the data flash P/E mode.
Setup time for each operating mode:
High-speed operating mode: 5 µs
Middle-speed operating mode: 720 ns
Low-speed operating mode: 720 ns
Low-voltage operating mode: 10 µs
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
The FMIFRT is a read-only register that stores a base address of the Unique ID register, Part Numbering register and
MCU Version register. The FMIFRT should be read in 32-bit units. The base address of the RA2A1 MCU is
0x0100_3C00.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
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.
b31 b30 b29 b28 b27 b26 b25 b24 b23 b22 b21 b20 b19 b18 b17 b16
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 described in Product list. The first
character ("R", 0x52 in ASCII code) of the part number is stored in the byte with the smallest address (FMIFRT + 24h).
Example of product part number: R7FA2A1AB3CFM
Address(es): FMIFRT+44h
b7 b6 b5 b4 b3 b2 b1 b0
The MCUVER is a read-only register that stores the MCU version. The MCUVER register should be read in 8-bit units.
The higher the value, the newer the MCU version.
43.5 Operation
Use the FCACHEE register to set up and enable flash operation. To set up the flash cache and prepare to rewrite the flash
memory:
1. Disable the flash cache by resetting FCACHEE.FCACHEEN.*1
2. Set the MEMWAIT.MEMWAIT bit as required for the ICLK frequency and set the power control mode in the
OPCCR and SOPCCR registers.
3. Invalidate the flash cache by setting FCACHEIV.FCACHEIV.
4. Check that FCACHEIV.FCACHEIV is 0.
5. Enable the flash cache by setting FCACHEE.FCACHEEN.
Note: Do not change operation mode (read mode, wait mode) when the flash cache is enabled.
Note 1. It is not necessary to disable the flash cache on the first setup after reset.
Reset state
Se
tO
e
n-
od
ch
m
et
p i
ing
s
de
Re
at
Reset
bu
R
er
g
es
op
m
et
od
al
m
e
r
No
t
Se
Note 1. USB boot mode does not exist with 32-pin products.
Note 1. USB boot mode does not exist with 32-pin products.
Note 1. USB boot mode does not exist with 32-pin products.
The on-chip flash memory supports the ID code security function. Authentication of ID codes is a security function for
use with serial programming and with SWD programming. Table 43.9 lists the security functions supported by the on-
chip flash memory, and Table 43.10 lists the available operations and security settings.
Bit
offset 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0030h ID[127:96]
002Ch
0028h ID[95:64]
0024h
0020h ID[63:32]
001Ch
0018h ID[31:0]
0014h
0010h FAWE[11:0] FAWS[11:0]
000Ch
0008h FSPR BTFLG
0000 3FFFh
New startup Original startup
No program
program program
(alternate area)
(alternate area) (default area)
0000 1FFFh
Original startup Original startup New startup
program program program
(default area) (default area) (alternate area)
0000 0000h
(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
0003 FFFFh
…
Disabled
Block 8
0000 4000h
0000 3FFFh Block 7
(end block)
Block 6
Access
Enabled
Window
Block 5
Block 4
0000 2000h (start block)
0000 1FFFh
Block 3
Block 2
Disabled
Block 1
Block 0
0000 0000h
43.10 Protection
The types of protection provided include:
Software protection
Error protection
Boot program protection.
Note: Serial programming mode is not executed when security MPU is enabled.
Note 1. USB boot mode does not exist with 32-pin products.
Host
Boot programming
tools and Boot program
programming data
On-chip SCI
Status
Host or
Self-powered flash
programming Rs
USB_DP
software and data
for programming
USBFS On-chip SRAM
Rs USB_DM
Data transfer
USB_VBUS
Reception
RS-232C Level
USB converter Transmission
Microcontroller
Host machine
USB
Microcontroller
Host machine
43.13 Self-Programming
43.13.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.
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 Table 43.12. 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.
Note 1. A non-maskable interrupt is an NMI pin interrupt, oscillation stop detection interrupt, WDT underflow or refresh
error, IWDT underflow or refresh error, voltage monitor 1 interrupt, voltage monitor 2 interrupt, SRAM parity error,
SRAM ECC error, MPU bus slave error, MPU bus master error, or CPU stack pointer monitor.
46.2 Operation
Table 46.1 lists the LDO mode pin settings, and Figure 46.1 shows the LDO mode settings. In LDO mode, the internal
voltage is generated from VCC.
VCC VCL
0.1 µF
(each VCC LDO 4.7 µF
pin)
VSS VSS
Internal
logic and memory
Note 1. Ports P000, P111, P112, P205, P206, P301, P401, P407, and P409 are 5 V tolerant.
Do not input signals or an I/O pull-up power supply while the device is not powered. The current injection that results from input
of such a signal or I/O pull-up might cause malfunction and the abnormal current that passes in the device at this time might
cause degradation of internal elements.
Note 2. See section 47.2.1, Tj/Ta Definition.
Note 3. Contact Renesas Electronics sales office for information on derating operation when Ta = +85°C to +105°C. Derating is the
systematic reduction of load for improved reliability.
Note 4. The upper limit of the operating temperature is 85°C or 105°C, depending on the product. For details, see section 1.3, Part
Numbering.
Note 5. Use AVCC0 and AVCC1 under the same conditions:
AVCC0 = AVCC1
Caution: Permanent damage to the MCU may result if absolute maximum ratings are exceeded.
To preclude any malfunctions due to noise interference, insert capacitors with high frequency
characteristics between the VCC and VSS pins, between the AVCC0 and AVSS0 pins, between the
AVCC1 and AVSS1 pins, between the VCC_USB and VSS_USB pins, between the VREFH and VREFL
pins, and between the VREFH0 and VREFL0 pins when VREFH0 is selected as the high potential
reference voltage for the ADC16. Place capacitors of the following value as close as possible to every
power supply pin and use the shortest and heaviest possible traces:
- VCC and VSS: about 0.1 μF
- AVCC0 and AVSS0: about 0.1 μF
- AVCC1 and AVSS1: about 0.1 μF
- VREFH and VREFL: about 0.1 μF
- VREFH0 and VREFL0: about 10 μF.
Also, connect capacitors as stabilization capacitance.
Connect the VCL pin to a VSS pin by a 4.7 μF capacitor. Connect the VREFH0 pin to a VREFL0 pin by
1 µF (-25% to +25%) capacitor when VREFADC is selected as the high potential reference voltage of
the ADC16. Connect the ADREG pin to a AVSS1 pin by a 0.47 µF (-50% to +20%) capacitor. Connect
the SBIAS/VREFI pin to a AVSS1 pin by a 0.22 µF (-20% to +20%) capacitor. Every capacitor must be
placed close to the pin.
Note 1. Use AVCC0, AVCC1, and VCC under the following conditions:
AVCC0, AVCC1, and VCC can be set individually within the operating range when VCC ≥ 2.2 V and AVCC0 = AVCC1 ≥ 2.2 V.
AVCC0 = AVCC1 = VCC when VCC < 2.2 V or AVCC0 = AVCC1 < 2.2 V.
Note 2. When powering on the VCC and AVCC0 and AVCC1 pins, power them on at the same time or the VCC pin first and then the
AVCC0 and AVCC1 pins.
Note 3. The condition when using external input for the reference voltage of SDADC24.
47.2 DC Characteristics
Note: Make sure that Tj = Ta + θja × total power consumption (W), where total power consumption = (VCC - VOH) × ΣIOH + VOL × ΣIOL
+ ICCmax × VCC.
Note 1. The upper limit of operating temperature is 85°C or 105°C, depending on the product. For details, see section 1.3, Part
Numbering. If the part number shows the operation temperature at 85°C, then the maximum value of Tj is 105°C, otherwise it is
125°C.
Note 1. SCL0_A, SCL0_B, SCL0_C, SDA0_A, SDA0_C, SCL1_B, SCL1_C, SDA1_B, SDA1_C (total 9 pins)
Note 2. SCL0_A, SCL0_B, SCL0_C, SDA0_A, SDA0_B, SDA0_C, SCL1_A, SCL1_B, SCL1_C, SDA1_A, SDA1_B, SDA1_C, SDA1_D
(total 13 pins)
Note 3. P000, P111, P112, P205, P206, P301, P401, P407, P409 (total 9 pins)
Note 1. This is the value when low driving ability is selected with the Port Drive Capability bit in the PmnPFS register.
Note 2. This is the value when middle driving ability is selected with the Port Drive Capability bit in the PmnPFS register.
Note 3. Except for Ports P200, P214, P215, which are input ports.
Note 4. This is the value when middle driving ability for IIC Fast mode and SPI is selected with the Port Drive Capability bit in PmnPFS
register.
Note 5. For details on the permissible output current used with CTSU, see section 47.12, CTSU Characteristics.
Caution: To protect the reliability of the MCU, the output current values should not exceed the values in Table
47.5. The average output current indicates the average current value measured during 100 μs.
Note 1. SCL0_A, SCL0_B, SCL0_C, SDA0_A, SDA0_B, SDA0_C, SCL1_A, SCL1_B, SCL1_C, SDA1_A, SDA1_B, SDA1_C, SDA1_D
(total 13 pins).
Note 2. This is the value when middle driving ability is selected with the Port Drive Capability bit in the PmnPFS register.
Note 3. Based on characterization data, not tested in production.
Note 4. Except for P200, P214, P215, which are input ports.
Note 5. This is the value when middle driving ability for IIC and SPI is selected with the Port Drive Capability bit in PmnPFS register for
P407, P408, and P409.
Note 6. Except for P212, P213.
Note 1. SCL0_A, SCL0_B, SCL0_C, SDA0_A, SDA0_B, SDA0_C, SCL1_A, SCL1_B, SCL1_C, SDA1_A, SDA1_B, SDA1_C, SDA1_D
(total 13 pins).
Note 2. This is the value when middle driving ability is selected with the Port Drive Capability bit in the PmnPFS register.
Note 3. Based on characterization data, not tested in production.
Note 4. Except for P200, P214, P215, which are input ports.
Note 5. This is the value when middle driving ability for IIC and SPI is selected with the Port Drive Capability bit in PmnPFS register for
P407, P408, and P409.
Note 6. Except for P212, P213.
Note 1. Except for ports P200, P214, P215, which are input ports.
Note 2. This is the value when middle driving ability for IIC and SPI is selected with the Port Drive Capability bit in the
PmnPFS register for P407, P408, and P409.
Note 3. Except for P212, P213.
IOH/IOL vs VOH/VOL
60
50
VCC = 5.5 V
40
30
20 VCC = 3.3 V
IOH/IOL [mA]
10 VCC = 2.7 V
VCC = 1.6 V
0
VCC = 1.6 V
-10
VCC = 2.7 V
-20
VCC = 3.3 V
-30
-40
-50
VCC = 5.5 V
-60
0 1 2 3 4 5 6
VOH/VOL [V]
Figure 47.2 VOH/VOL and IOH/IOL voltage characteristics at Ta = 25°C when low drive output is selected
(reference data, except for P914 and P915)
IOH/IOL vs VOH/VOL
Ta = -40C
2 Ta = 25C
Ta = 105C
1
IOH/IOL [mA]
-1
Ta = 105C
-2 Ta = 25C
Ta = -40C
-3
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
VOH/VOL [V]
Figure 47.3 VOH/VOL and IOH/IOL temperature characteristics at VCC = 1.6 V when low drive output is selected
(reference data, except for P914 and P915)
IOH/IOL vs VOH/VOL
20
15
Ta = -40C
Ta = 25C
10 Ta = 105C
5
IOH/IOL [mA]
-5
Ta = 105C
-10
Ta = 25C
Ta = -40C
-15
-20
0 0.5 1 1.5 2 2.5 3
VOH/VOL [V]
Figure 47.4 VOH/VOL and IOH/IOL temperature characteristics at VCC = 2.7 V when low drive output is selected
(reference data, except for P914 and P915)
IOH/IOL vs VOH/VOL
30
20 Ta = -40C
Ta = 25C
Ta = 105C
10
IOH/IOL [mA]
-10
Ta = 105C
Ta = 25C
-20
Ta = -40C
-30
0 0.5 1 1.5 2 2.5 3 3.5
VOH/VOL [V]
Figure 47.5 VOH/VOL and IOH/IOL temperature characteristics at VCC = 3.3 V when low drive output is selected
(reference data, except for P914 and P915)
IOH/IOL vs VOH/VOL
60
Ta = -40C
40 Ta = 25C
Ta = 105C
20
IOH/IOL [mA]
-20
Ta = 105C
-40
Ta = 25C
Ta = -40C
-60
0 1 2 3 4 5 6
VOH/VOL [V]
Figure 47.6 VOH/VOL and IOH/IOL temperature characteristics at VCC = 5.5 V when low drive output is selected
(reference data, except for P914 and P915)
IOH/IOL vs VOH/VOL
140
120
VCC = 5.5 V
100
80
60
VCC = 3.3 V
40
VCC = 2.7 V
IOH/IOL [mA]
20
VCC = 1.6 V
0
VCC = 1.6 V
-20
-40 VCC = 2.7 V
VCC = 3.3 V
-60
-80
-100
-120
VCC = 5.5 V
-140
0 1 2 3 4 5 6
VOH/VOL [V]
Figure 47.7 VOH/VOL and IOH/IOL voltage characteristics at Ta = 25°C when middle drive output is selected
(reference data, except for P914 and P915)
IOH/IOL vs VOH/VOL
6
Ta = -40C
Ta = 25C
Ta = 105C
4
2
IOH/IOL [mA]
-2
Ta = 105C
-4
Ta = 25C
Ta = -40C
-6
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
VOH/VOL [V]
Figure 47.8 VOH/VOL and IOH/IOL temperature characteristics at VCC = 1.6 V when middle drive output is
selected (reference data, except for P914 and P915)
IOH/IOL vs VOH/VOL
40
Ta = -40C
30 Ta = 25C
Ta = 105C
20
10
IOH/IOL [mA]
-10
-20
Ta = 105C
Ta = 25C
-30
Ta = -40C
-40
0 0.5 1 1.5 2 2.5 3
VOH/VOL [V]
Figure 47.9 VOH/VOL and IOH/IOL temperature characteristics at VCC = 2.7 V when middle drive output is
selected (reference data, except for P914 and P915)
IOH/IOL vs VOH/VOL
60
Ta = -40C
Ta = 25C
40 Ta = 105C
20
IOH/IOL [mA]
-20
Ta = 105C
-40 Ta = 25C
Ta = -40C
-60
0 0.5 1 1.5 2 2.5 3 3.5
VOH/VOL [V]
Figure 47.10 VOH/VOL and IOH/IOL temperature characteristics at VCC = 3.3 V when middle drive output is
selected (reference data, except for P914 and P915)
IOH/IOL vs VOH/VOL
140
120 Ta = -40C
Ta = 25C
100
Ta = 105C
80
60
40
IOH/IOL [mA]
20
0
-20
-40
-60
-80
Ta = 105C
-100
Ta = 25C
-120
Ta = -40C
-140
0 1 2 3 4 5 6
VOH/VOL [V]
Figure 47.11 VOH/VOL and IOH/IOL temperature characteristics at VCC = 5.5 V when middle drive output is
selected (reference data, except for P914 and P915)
47.2.7 Output Characteristics for P407, P408 and P409 I/O Pins (Middle Drive
Capacity)
IOH/IOL vs VOH/VOL
200
180 VCC = 5.5 V
160
140
120
100
80 VCC = 3.3 V
60
VCC = 2.7 V
40
IOH/IOL [mA]
20
0
-20
VCC = 2.7 V
-40
-60 VCC = 3.3 V
-80
-100
-120
-140
-160 VCC = 5.5 V
-180
-200
0 1 2 3 4 5 6
VOH/VOL [V]
Figure 47.12 VOH/VOL and IOH/IOL voltage characteristics at Ta = 25°C when middle drive output is selected
(reference data)
IOH/IOL vs VOH/VOL
60
Ta = -40C
Ta = 25C
40 Ta = 105C
20
IOH/IOL [mA]
-20
Ta = 105C
-40
Ta = 25C
Ta = -40C
-60
0 0.5 1 1.5 2 2.5 3
VOH/VOL [V]
Figure 47.13 VOH/VOL and IOH/IOL temperature characteristics at VCC = 2.7 V when middle drive output is
selected (reference data)
IOH/IOL vs VOH/VOL
100
Ta = -40C
80
Ta = 25C
60 Ta = 105C
40
20
IOH/IOL [mA]
0
-20
-40
Ta = 105C
-60
Ta = 25C
-80 Ta = -40C
-100
0 0.5 1 1.5 2 2.5 3 3.5
VOH/VOL [V]
Figure 47.14 VOH/VOL and IOH/IOL temperature characteristics at VCC = 3.3 V when middle drive output is
selected (reference data)
IOH/IOL vs VOH/VOL
220
Ta = -40C
180 Ta = 25C
140 Ta = 105C
100
60
IOH/IOL [mA]
20
-20
-60
-100
-140 Ta = 105C
Ta = 25C
-180
Ta = -40C
-220
0 1 2 3 4 5 6
VOH/VOL [V]
Figure 47.15 VOH/VOL and IOH/IOL temperature characteristics at VCC = 5.5 V when middle drive output is
selected (reference data)
IOL vs VOL
120
110
VCC = 5.5 V (Middle drive)
100
90
80
70
IOL [mA]
60
50 VCC = 3.3 V (Middle drive)
VCC = 5.5 V (Low drive)
40
VCC = 2.7 V (Middle drive)
30
20 VCC = 3.3 V (Low drive)
10
VCC = 2.7 V (Low drive)
0
0 1 2 3 4 5 6
VOL [V]
Note 1. Supply current values do not include output charge/discharge current from all pins. The values apply when internal pull-up
MOSs are in the off state.
Note 2. The clock source is HOCO.
Note 3. The clock source is MOCO.
Note 4. The clock source is the sub-clock oscillator.
Note 5. This does not include BGO operation.
Note 6. This is the increase for programming or erasure of the flash memory for data storage during program execution.
Note 7. FCLK, PCLKB, and PCLKD are set to divided by 64.
Note 8. FCLK, PCLKB, and PCLKD are the same frequency as that of ICLK.
Note 9. FCLK and PCLKB are set to be divided by 2 and PCLKD is the same frequency as that of ICLK.
Note 10. VCC = 3.3 V.
Note 11. The flash cache is operating.
30
15
Ta = 25Ԩ, ICLK = 48MHz*1
Ta = 105Ԩ, ICLK = 16MHz*2
10 Ta = 25Ԩ, ICLK = 32MHz*1
Ta = 105Ԩ, ICLK = 8MHz*2
Ta = 25Ԩ, ICLK = 16MHz*1
5 Ta = 105Ԩ, ICLK = 4MHz*2
Ta = 25Ԩ, ICLK = 8MHz*1
Ta = 25Ԩ, ICLK = 4MHz*1
0
㻝㻚㻡 㻞㻚㻜 㻞㻚㻡 㻟㻚㻜 㻟㻚㻡 㻠㻚㻜 㻠㻚㻡 㻡㻚㻜 㻡㻚㻡 㻢㻚㻜
VCC (V)
Ta = 25Ԩ, ICLK = 48MHz *1 Ta = 105Ԩ, ICLK = 48MHz *2
Ta = 25Ԩ, ICLK = 32MHz *1 Ta = 105Ԩ, ICLK = 32MHz *2
Ta = 25Ԩ, ICLK = 16MHz *1 Ta = 105Ԩ, ICLK = 16MHz *2
Ta = 25Ԩ, ICLK = 8MHz *1 Ta = 105Ԩ, ICLK = 8MHz *2
Ta = 25Ԩ, ICLK = 4MHz *1 Ta = 105Ԩ, ICLK = 4MHz *2
Note 1. All peripheral operations except any BGO operation are operating normally. This is the average of the actual
measurements of the sample cores during product evaluation.
Note 2. All peripheral operations except any BGO operation are operating at maximum. This is the average of the
actual measurements for the upper limit samples during product evaluation.
10
9
Ta = 105Ԩ, ICLK = 12MHz*2
8
7
Ta = 105Ԩ, ICLK = 8MHz*2
6
ICC (mA)
5
Ta = 25Ԩ, ICLK = 12MHz*1
4 Ta = 105Ԩ, ICLK = 4MHz*2
3 Ta = 25Ԩ, ICLK = 8MHz*1
Note 1. All peripheral operations except any BGO operation are operating normally. This is the average of the actual
measurements of the sample cores during product evaluation.
Note 2. All peripheral operations except any BGO operation are operating at maximum. This is the average of the
actual measurements for the upper limit samples during product evaluation.
1.6
1.4 Ta = 105Ԩ, ICLK = 1MHz*2
1.2
1.0
ICC (mA)
0.8
0.6
Ta = 25Ԩ, ICLK = 1MHz*1
0.4
0.2
0.0
㻝㻚㻡 㻞㻚㻜 㻞㻚㻡 㻟㻚㻜 㻟㻚㻡 㻠㻚㻜 㻠㻚㻡 㻡㻚㻜 㻡㻚㻡 㻢㻚㻜
VCC (V)
Note 1. All peripheral operations except any BGO operation are operating normally. This is the average of the actual
measurements of the sample cores during product evaluation.
Note 2. All peripheral operations except any BGO operation are operating at maximum. This is the average of the
actual measurements for the upper limit samples during product evaluation.
5.0
4.5 Ta = 105Ԩ, ICLK = 4MHz*2
4.0
3.5
3.0
ICC (mA)
Note 1. All peripheral operations except any BGO operation are operating normally. This is the average of the actual
measurements of the sample cores during product evaluation.
Note 2. All peripheral operations except any BGO operation are operating at maximum. This is the average of the
actual measurements for the upper limit samples during product evaluation.
180
160 Ta = 105Ԩ, ICLK = 32kHz*2
120
ICC(MA)
100
80
60
40
20
Ta = 25Ԩ, ICLK = 32kHz*1*3
0
㻝㻚㻡 㻞㻚㻜 㻞㻚㻡 㻟㻚㻜 㻟㻚㻡 㻠㻚㻜 㻠㻚㻡 㻡㻚㻜 㻡㻚㻡 㻢㻚㻜
VCC (V)
Note 1. All peripheral operations except any BGO operation are operating normally. This is the average of the actual
measurements of the sample cores during product evaluation.
Note 2. All peripheral operations except any BGO operation are operating at maximum. This is the average of the
actual measurements for the upper limit samples during product evaluation.
Note 3. MOCO and DAC are stopped.
Note 1. Supply current values do not include output charge/discharge current from all pins. The values apply when internal pull-up
MOS transistors are in the off state.
Note 2. The IWDT and LVD are not operating.
Note 3. VCC = 3.3 V.
Note 4. Includes the low-speed on-chip oscillator or sub-oscillation circuit current.
100
10
ICC (MA)
0.1
㻙㻠㻜 㻙㻞㻜 㻜 㻞㻜 㻠㻜 㻢㻜 㻤㻜 㻝㻜㻜
Ta (Ԩ)
10
0
㻙㻠㻜 㻙㻞㻜 㻜 㻞㻜 㻠㻜 㻢㻜 㻤㻜 㻝㻜㻜
Ta (Ԩ)
Note: Average value of the tested middle samples during product evaluation.
Note 1. The reference power supply current is included in the power supply current value for D/A conversion.
Note 2. Current is consumed only by the USBFS.
Note 3. Includes the current supplied from the pull-up resistor of the USB_DP pin to the pull-down resistor of the host device, in addition
to the current consumed by the MCU in the suspended state.
Note 4. When VCC = VCC_USB = 3.3 V.
Note 5. When the MCU is in Software Standby mode or the MSTPCRD.MSTPD16 (ADC160 module-stop bit) is in the module-stop
state.
Note 6. When the MCU is in the MSTPCRD.MSTPD17 (SDADC24 module-stop bit) is in the module-stop state.
Table 47.14 Rising and falling gradient and ripple frequency characteristics
Conditions: VCC = AVCC0 = AVCC1 = 1.6 to 5.5 V
The ripple voltage must meet the allowable ripple frequency fr(VCC) within the range between the VCC upper limit (5.5 V) and lower limit
(1.6 V).
When the VCC change exceeds VCC ± 10%, the allowable voltage change rising and falling gradient dt/dVCC must be met.
1 / fr(VCC)
VCC Vr(VCC)
47.3 AC Characteristics
47.3.1 Frequency
Note 1. The lower-limit frequency of FCLK is 1 MHz while programming or erasing the flash memory. When using FCLK
for programming or erasing the flash memory at below 4 MHz, the frequency can be set to 1 MHz, 2 MHz, or
3 MHz. A non-integer frequency such as 1.5 MHz cannot be set.
Note 2. The frequency accuracy of FCLK must be ± 3.5% during programming or erasing the flash memory. Confirm the
frequency accuracy of the clock source.
Note 3. The lower-limit frequency of PCLKD is 1 MHz when the ADC16 is in use.
Note 4. The upper-limit frequency of PCLKD is 32 MHz when the ADC16 is in use.
Note 5. The lower-limit frequency of PCLKB is 1 MHz when the SDADC24 is in use.
Note 6. See section 9, Clock Generation Circuit for the relationship of frequencies between ICLK, PCLKB, PCLKD, and
FCLK.
Note 7. The maximum value of operation frequency does not include internal oscillator errors. For details on the range for
guaranteed operation, see Table 47.20, Clock timing.
Note 1. The lower-limit frequency of FCLK is 1 MHz while programming or erasing the flash memory. When using FCLK
for programming or erasing the flash memory at below 4 MHz, the frequency can be set to 1 MHz, 2 MHz, or 3
MHz. A non-integer frequency such as 1.5 MHz cannot be set.
Note 2. The frequency accuracy of FCLK must be ± 3.5% while programming or erasing the flash memory. Confirm the
frequency accuracy of the clock source.
Note 3. The lower-limit frequency of PCLKD is 1 MHz when the ADC16 is in use.
Note 4. The lower-limit frequency of PCLKB is 1 MHz when the SDADC24 is in use.
Note 5. See section 9, Clock Generation Circuit for the relationship of frequencies between ICLK, PCLKB, PCLKD, and
FCLK.
Note 6. The maximum value of operation frequency does not include internal oscillator errors. For details on the range for
guaranteed operation, see Table 47.20, Clock timing.
Note 1. The lower-limit frequency of FCLK is 1 MHz while programming or erasing the flash memory.
Note 2. The frequency accuracy of FCLK must be ± 3.5% while programming or erasing the flash memory. Confirm the frequency
accuracy of the clock source.
Note 3. The lower-limit frequency of PCLKD is 1 MHz when the ADC16 is in use.
Note 4. The lower-limit frequency of PCLKB is 1 MHz when the SDADC24 is in use.
Note 5. See section 9, Clock Generation Circuit for the relationship of frequencies between ICLK, PCLKB, PCLKD, and FCLK.
Note 6. The maximum value of operation frequency does not include internal oscillator errors. For details on the range for guaranteed
operation, see Table 47.20, Clock timing.
Note 1. The lower-limit frequency of FCLK is 1 MHz while programming or erasing the flash memory. When using FCLK for
programming or erasing the flash memory at below 4 MHz, the frequency can be set to 1 MHz, 2 MHz, or 3 MHz. A non-integer
frequency such as 1.5 MHz cannot be set.
Note 2. The frequency accuracy of FCLK must be ± 3.5% during programming or erasing the flash memory. Confirm the frequency
accuracy of the clock source.
Note 3. The lower-limit frequency of PCLKD is 1 MHz when the ADC16 is in use.
Note 4. The lower-limit frequency of PCLKB is 1 MHz when the SDADC24 is in use.
Note 5. See section 9, Clock Generation Circuit for the relationship of frequencies between ICLK, PCLKB, PCLKD, and FCLK.
Note 6. The maximum value of operation frequency does not include internal oscillator errors. For details on the range for guaranteed
operation, see Table 47.20, Clock timing.
EXTAL external clock input frequency fEXTAL - - 20 MHz 2.4 ≤ VCC ≤ 5.5
Main clock oscillator oscillation frequency fMAIN 1 - 20 MHz 2.4 ≤ VCC ≤ 5.5
1 - 8 1.8 ≤ VCC < 2.4
1 - 4 1.6 ≤ VCC < 1.8
LOCO clock oscillation frequency fLOCO 27.8528 32.768 37.6832 kHz -
HOCO clock oscillation frequency fHOCO24 23.64 24 24.36 MHz Ta = -40 to -20°C
1.8 ≤ VCC ≤ 5.5
22.68 24 25.32 Ta = -40 to 85°C
1.6 ≤ VCC < 1.8
23.76 24 24.24 Ta = -20 to 85°C
1.8 ≤ VCC ≤ 5.5
23.52 24 24.48 Ta = 85 to 105°C
2.4 ≤ VCC ≤ 5.5
fHOCO32 31.52 32 32.48 Ta = -40 to -20°C
1.8 ≤ VCC ≤ 5.5
30.24 32 33.76 Ta = -40 to 85°C
1.6 ≤ VCC < 1.8
31.68 32 32.32 Ta = -20 to 85°C
1.8 ≤ VCC ≤ 5.5
31.36 32 32.64 Ta = 85 to 105°C
2.4 ≤ VCC ≤ 5.5
fHOCO48*3 47.28 48 48.72 Ta = -40 to -20°C
1.8 ≤ VCC ≤ 5.5
47.52 48 48.48 Ta = -20 to 85°C
1.8 ≤ VCC ≤ 5.5
47.04 48 48.96 Ta = 85 to 105°C
2.4 ≤ VCC ≤ 5.5
fHOCO64*4 63.04 64 64.96 Ta = -40 to -20°C
2.4 ≤ VCC ≤ 5.5
63.36 64 64.64 Ta = -20 to 85°C
2.4 ≤ VCC ≤ 5.5
62.72 64 65.28 Ta = 85 to 105°C
2.4 ≤ VCC ≤ 5.5
HOCO clock oscillation Except low-voltage tHOCO24 - - 37.1 μs Figure 47.27
stabilization time*5, *6 mode tHOCO32
tHOCO48 - - 43.3
tHOCO64 - - 80.6
Note 1. Time until the clock can be used after the Main Clock Oscillator stop bit (MOSCCR.MOSTP) is set to 0 (operating) when the
external clock is stable.
Note 2. After changing the setting of the SOSCCR.SOSTP bit to start sub-clock oscillator operation, only start using the sub-clock
oscillator after the sub-clock oscillation stabilization wait time elapsed. Use the oscillator wait time value recommended by the
oscillator manufacturer.
Note 3. The 48-MHz HOCO can be used within a VCC range of 1.8 V to 5.5 V.
Note 4. The 64-MHz HOCO can be used within a VCC range of 2.4 V to 5.5 V.
Note 5. This is a characteristic when the HOCOCR.HCSTP bit is cleared to 0 (oscillation) in the MOCO stop state.
When the HOCOCR.HCSTP bit is set to 0 (oscillation) during MOCO oscillation, this specification is shortened by 1 μs.
Note 6. Check OSCSF.HOCOSF to confirm whether stabilization time has elapsed.
tXcyc
tXH tXL
tXr tXf
LOCOCR.LCSTP
tLOCO
HOCOCR.HCSTP
tHOCOx*1
HOCO clock
Figure 47.27 HOCO clock oscillation start timing (started by setting the HOCOCR.HCSTP bit)
SOSCCR.SOSTP
tSUBOSC
VCC
RES
tRESWP
Internal reset
tRESWT
tRESW
RES
Internal reset
tRESWT2
tRESWIW, tRESWIR
Internal reset
tRESWT3
Note 1. The division ratio of ICK, FCK, and PCKx is the minimum division ratio within the allowable frequency range. The recovery time
is determined by the system clock source.
Note 2. The Main Clock Oscillator Wait Control Register (MOSCWTCR) is set to 05h.
Note 3. The Main Clock Oscillator Wait Control Register (MOSCWTCR) is set to 00h.
Note 4. The HOCO Clock Wait Control Register (HOCOWTCR) is set to 05h.
Note 5. The HOCO Clock Wait Control Register (HOCOWTCR) is set to 06h.
Note 1. The division ratio of ICK, FCK, and PCKx is the minimum division ratio within the allowable frequency range. The recovery time
is determined by the system clock source.
Note 2. The Main Clock Oscillator Wait Control Register (MOSCWTCR) is set to 05h.
Note 3. The Main Clock Oscillator Wait Control Register (MOSCWTCR) is set to 00h.
Note 4. The system clock is 12 MHz.
Note 1. The division ratio of ICK, FCK, and PCKx is the minimum division ratio within the allowable frequency range. The recovery time
is determined by the system clock source.
Note 2. The Main Clock Oscillator Wait Control Register (MOSCWTCR) is set to 05h.
Note 3. The Main Clock Oscillator Wait Control Register (MOSCWTCR) is set to 00h.
Note 1. The division ratio of ICK, FCK, and PCKx is the minimum division ratio within the allowable frequency range. The recovery time
is determined by the system clock source.
Note 2. The Main Clock Oscillator Wait Control Register (MOSCWTCR) is set to 05h.
Note 3. The Main Clock Oscillator Wait Control Register (MOSCWTCR) is set to 00h.
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
Oscillator
IRQ
Note 1. When SNZCR.SNZDTCEN bit is set to 1, ICLK is supplied to DTC and SRAM.
Figure 47.33 Recovery timing from Software Standby mode to Snooze mode
NMI
tNMIW
IRQ
tIRQW
47.3.6 I/O Ports, POEG, GPT, AGT, KINT, and ADC16 Trigger Timing
Note:
Table 47.29 I/O Ports, POEG, GPT, AGT, KINT, and ADC16 trigger timing
Test
Parameter Symbol Min Max Unit conditions
I/O Ports Input data pulse width tPRW 1.5 - tPcyc Figure 47.36
POEG POEG input trigger pulse width tPOEW 3 - tPcyc Figure 47.37
GPT Input capture pulse width Single edge tGTICW 1.5 - tPDcyc Figure 47.38
Dual edge 2.5 -
AGT AGTIO, AGTEE input cycle 2.7 V ≤ VCC ≤ 5.5 V tACYC*1 250 - ns Figure 47.39
2.4 V ≤ VCC < 2.7 V 500 - ns
1.8 V ≤ VCC < 2.4 V 1000 - ns
1.6 V ≤ VCC < 1.8 V 2000 - ns
AGTIO, AGTEE input high-level 2.7 V ≤ VCC ≤ 5.5 V tACKWH, 100 - ns
width, low-level width tACKWL
2.4 V ≤ VCC < 2.7 V 200 - ns
1.8 V ≤ VCC < 2.4 V 400 - ns
1.6 V ≤ VCC < 1.8 V 800 - ns
AGTIO, AGTO, AGTOA, AGTOB 2.7 V ≤ VCC ≤ 5.5 V tACYC2 62.5 - ns Figure 47.39
output cycle
2.4 V ≤ VCC < 2.7 V 125 - ns
1.8 V ≤ VCC < 2.4 V 250 - ns
ADC16 16-bit A/D converter trigger input pulse width tTRGW 1.5 - tPcyc Figure 47.40
Port
tPRW
tPOEW
Input capture
tGTICW
tACYC
tACKWL tACKWH
AGTIO, AGTEE
(input)
tACYC2
AGTIO, AGTO,
AGTOA, AGTOB
(output)
ADTRG0
tTRGW
KR00 to KR07
tKR
SCKn
(n = 0, 1, 9)
tScyc
SCKn
tTXD
TXDn
tRXS tRXH
RXDn
n = 0, 1, 9
Simple SCK clock cycle output (master) tSPcyc 4 65536 tPcyc Figure 47.44
SPI
SCK clock cycle input (slave) 6 65536
SCK clock high pulse width tSPCKWH 0.4 0.6 tSPcyc
Data input setup Master 2.7 V ≤ VCC ≤ 5.5 V tSU 45 - ns Figure 47.45 to
time Figure 47.48
2.4 V ≤ VCC < 2.7 V 55 -
1.8 V ≤ VCC < 2.4 V 80 -
1.6 V ≤ VCC < 1.8 V 110 -
Slave 2.7 V ≤ VCC ≤ 5.5 V 40 -
1.6 V ≤ VCC < 2.7 V 45 -
Data input hold time Master tH 33.3 - ns
Slave 40 -
SS input setup time tLEAD 1 - tSPcyc
VOH = 0.7 × VCC, VOL = 0.3 × VCC, VIH = 0.7 × VCC, VIL = 0.3 × VCC
SCKn
CKPOL = 0
output
SCKn
CKPOL = 1
output
tSU tH
MISOn
MSB IN DATA LSB IN MSB IN
input
MOSIn
MSB OUT DATA LSB OUT IDLE MSB OUT
output
(n = 0, 1, 9)
SCKn
CKPOL = 1
output
SCKn
CKPOL = 0
output
tSU tH
MISOn
MSB IN DATA LSB IN MSB IN
input
MOSIn
MSB OUT DATA LSB OUT IDLE MSB OUT
output
(n = 0, 1, 9)
tTD
SSn
input
tLEAD tLAG
SCKn
CKPOL = 0
input
SCKn
CKPOL = 1
input
tSA tOH tOD tREL
MISOn
MSB OUT DATA LSB OUT MSB IN MSB OUT
output
MOSIn
MSB IN DATA LSB IN MSB IN
input
(n = 0, 1, 9)
tTD
SSn
input
tLEAD tLAG
SCKn
CKPOL = 1
input
SCKn
CKPOL = 0
input
tSA tOH tOD tREL
MOSIn
MSB IN DATA LSB IN MSB IN
input
(n = 0, 1, 9)
VIH
SDAn
VIL
tSr tSf
tSP
SCLn
Test conditions:
VIH = VCC × 0.7, VIL = VCC × 0.3
VOL = 0.6 V, IOL = 6 mA
Note 1. S, P, and Sr indicate the following conditions:
S: Start condition
P: Stop condition
Sr: Restart condition
SPI MOSI and MISO Output 2.7 V ≤ VCC ≤ 5.5 V tDr, tDf - 10 ns Figure 47.51 to
rise and fall time Figure 47.56
2.4 V ≤ VCC < 2.7 V - 15
C = 30 pF
1.8 V ≤ VCC < 2.4 V - 20
1.6 V ≤ VCC < 1.8 V - 30
Input - 1 µs
SSL rise and fall Output 2.7 V ≤ VCC ≤ 5.5 V tSSLr, - 10 ns
time tSSLf
2.4 V ≤ VCC < 2.7 V - 15
1.8 V ≤ VCC < 2.4 V - 20
1.6 V ≤ VCC < 1.8 V - 30
Input - 1 µs
Slave access time 2.4 V ≤ VCC ≤ 5.5 V tSA - 2 × tPcyc + 100 ns Figure 47.55 and
Figure 47.56
1.8 V ≤ VCC < 2.4 V - 2 × tPcyc + 140
C = 30 pF
1.6 V ≤ VCC < 1.8 V - 2 × tPcyc + 180
Slave output release time 2.4 V ≤ VCC ≤ 5.5 V tREL - 2 × tPcyc + 100 ns
1.8 V ≤ VCC < 2.4 V - 2 × tPcyc + 140
1.6 V ≤ VCC < 1.8 V - 2 × tPcyc + 180
(n = A or B) VOH = 0.7 × VCC, VOL = 0.3 × VCC, VIH = 0.7 × VCC, VIL = 0.3 × VCC
tTD
SSLn0 to
SSLn3
output
tLEAD tLAG
tSSLr, tSSLf
RSPCKn
CPOL = 0
output
RSPCKn
CPOL = 1
output
tSU tH
MISOn
MSB IN DATA LSB IN MSB IN
input
MOSIn
MSB OUT DATA LSB OUT IDLE MSB OUT
output
(n = A or B)
Figure 47.51 SPI timing (master, CPHA = 0) (bit rate: PCLKB division ratio is set to any value other than 1/2)
tTD
SSLn0 to
SSLn3
output tLEAD tLAG
tSSLr, tSSLf
RSPCKn
CPOL = 0
output
RSPCKn
CPOL = 1
output
tSU tHF tHF
(n = A or B)
Figure 47.52 SPI timing (master, CPHA = 0) (bit rate: PCLKB division ratio is set to 1/2)
tTD
SSLn0 to
SSLn3
output
tLEAD tLAG
tSSLr, tSSLf
RSPCKn
CPOL = 0
output
RSPCKn
CPOL = 1
output
tSU tH
MISOn
MSB IN DATA LSB IN MSB IN
input
tOH tOD tDr, tDf
MOSIn
MSB OUT DATA LSB OUT IDLE MSB OUT
output
(n = A or B)
Figure 47.53 SPI timing (master, CPHA = 1) (bit rate: PCLKB division ratio is set to any value other than 1/2)
tTD
SSLn0 to
SSLn3
output
tLEAD tLAG
tSSLr, tSSLf
RSPCKn
CPOL = 0
output
RSPCKn
CPOL = 1
output
tSU tHF tH
MISOn
MSB IN DATA LSB IN MSB IN
input
tOH tOD tDr, tDf
MOSIn
MSB OUT DATA LSB OUT IDLE MSB OUT
output
(n = A or B)
Figure 47.54 SPI timing (master, CPHA = 1) (bit rate: PCLKB division ratio is set to 1/2)
tTD
SSLn0
input
tLEAD tLAG
RSPCKn
CPOL = 0
input
RSPCKn
CPOL = 1
input
tSA tOH tOD tREL
MISOn
MSB OUT DATA LSB OUT MSB IN MSB OUT
output
tSU tH tDr, tDf
MOSIn
MSB IN DATA LSB IN MSB IN
input
(n = A or B)
tTD
SSLn0
input
tLEAD tLAG
RSPCKn
CPOL = 0
input
RSPCKn
CPOL = 1
input
tSA tOH tOD tREL
MOSIn
MSB IN DATA LSB IN MSB IN
input
(n = A or B)
Note: tIICcyc: IIC internal reference clock (IICφ) cycle, tPcyc: PCLKB cycle
Note 1. Values in parentheses apply when ICMR3.NF[1:0] is set to 11b while the digital filter is enabled with ICFER.NFE set to 1.
VIH
SDA0 and SDA1
VIL
tBUF
tSCLH
tSTAH tSTAS tSP tSTOS
Note 1. When the EXTAL external clock input or an oscillator is used with division by 1 (the CKOCR.CKOSEL[2:0] bits are 011b and
the CKOCR.CKODIV[2:0] bits are 000b) to output from CLKOUT, specifications in Table 47.36 should be satisfied with 45% to
55% of input duty cycle.
Note 2. When MOCO is selected as the clock output source (the CKOCR.CKOSEL[2:0] bits are 001b), set the clock output division
ratio to be divided by 2 (the CKOCR.CKODIV[2:0] bits are 001b).
tCcyc
tCH
tCf
CLKOUT
tCr
tCL
Test conditions: VOH = VCC × 0.7, VOL = VCC × 0.3, IOH = -1.0 mA, IOL = 1.0 mA, C = 30 pF
tr tf
Observation
USB_DP point
50 pF
USB_DM
50 pF
Observation
USB_DP point
200 pF to
600 pF 3.6 V
1.5 K
USB_DM
200 pF to
600 pF Observation
point
Table 47.39 16-bit A/D conversion, power supply, and input range conditions
Conditions: VCC = AVCC0 = AVCC1 = 1.7 to 5.5 V, VREFH0 = 1.7 to 5.5 V, VSS = AVSS0 = AVSS1 = VREFL0 = 0 V
Reference voltage range applied to the VREFH0 and VREFL0.
Parameter Min Typ Max Unit Test conditions
High-potential reference voltage 1.5 3.3 AVCC0 V -
Low-potential reference voltage - AVSS0 - V -
Analog input voltage range 0 - VREFH0 V -
Input common-mode Acm 0 VREFH0/2 VREFH0 V Differential analog input
range
Analog input Cs - - 4.3 pF -
capacitance*2
Analog input resistance*1 Rs - - 0.7 kΩ High-precision channel
2.7 V ≤ AVCC0 ≤ 5.5 V
- - 1.5 High-precision channel
1.7 V ≤ AVCC0 < 2.7 V
- - 2.5 Normal-precision channel
2.7 V ≤ AVCC0 ≤ 5.5 V
- - 3.8 Normal-precision channel
1.7 V ≤ AVCC0 < 2.7 V
Note 1. These values are based on simulation. They are not production tested.
Note 2. Except for I/O input capacitance (Cin), see section 47.2.4, I/O VOH, VOL, and Other Characteristics.
MCU
Analog input
ANn Rs ADC16
Vi
Cin Cs
Note 1. These values are based on simulation. They are not production tested.
Note: The characteristics apply when no pin functions other than 16-bit A/D converter input are used. Offset error, full-scale error,
DNL differential non-linearity error, and INL integral non-linearity error do not include quantization errors.
Note 1. These values are based on simulation. They are not production tested.
Note: The characteristics apply when no pin functions other than 16-bit A/D converter input are used.
Note 1. THD = HD2 + HD3 + HD4 + HD5.
Note 2. These values are based on simulation. They are not production tested.
Note: The characteristics apply when no pin functions other than 16-bit A/D converter input are used.
Note 1. These values are based on simulation. They are not production tested.
Table 47.45 Internal reference voltage for 16-bit ADC (VREFADC) characteristics
Conditions: VCC = AVCC0 = AVCC1 = 1.7 V to 5.5 V, VSS = AVSS0 = AVSS1 = VREFL0 = 0 V
Note 1. Connect capacitors as stabilization capacitance between the VREFH0 and VREFL0 pins when VREFADC is used.
Note 2. These values are based on simulation. They are not production tested.
Note 1. The internal reference voltage cannot be selected for input channels when AVCC0 < 2.0 V.
Note 2. The 16-bit A/D internal reference voltage indicates the voltage when the internal reference voltage is input to the 16-bit A/D
converter.
Note 3. This is a parameter for ADC16 when the internal reference voltage is selected for an analog input channel in ADC16.
Note 1. The single-ended input mode supports only dOFR = 0 mV, GSET1 = 1, GSET2 = 1 and OSR = 256.
Table 47.48 Programmable gain instrumentation amplifier and sigma-delta A/D converter (1)
Conditions: VCC = AVCC0 = AVCC1 = 2.7 to 5.5 V, VSS = AVSS0 = AVSS1 = 0 V
Table 47.49 Programmable gain instrumentation amplifier and sigma-delta A/D converter (2)
Conditions: VCC = AVCC0 = AVCC1 = 2.7 to 5.5 V, VSS = AVSS0 = AVSS1 = 0 V
The electrical specifications are applied at differential input mode, external clock input used, FOS = 1 MHz, dOFR = 0 mV,
unless otherwise specified.
Parameter Symbol Min Typ Max Unit Test conditions
Signal to Noise Ratio*1,*3 SNR 83 86 - dB GSET1 = 1, OSR = 256
VID = 0 V GSET2 = 1
81 84 - dB GSET1 = 8, OSR = 1024
GSET2 = 4
Signal to Noise and SINAD 82 85 - dB GSET1 = 1, OSR = 256
Distortion Ratio*1, *2,*3 GSET2 = 1
fin = 50 Hz
79 82 - dB GSET1 = 8, OSR = 1024
GSET2 = 4
74 80 - dB GSET1 = 1, OSR = 256,
GSET2 = 1 Single-ended input mode
Note: The characteristics apply when no pin functions other than 24-bit sigma-delta A/D converter input are used.
Note 1. SNR and SINAD are the ratio to Full-Scale Range (FSR) of analog inputs. These do not include the noise of analog inputs.
Note 2. When VID is equal to ± 0.8 / GTOTAL actually, the digital output may overflow due to Gain Error (EG), Offset
Error (EOS), and so forth. As a result, SINAD is degraded. See Table 33.7 for the relation between analog input and digital
output.
Note 3. Not production tested but is guaranteed by the design and characterization.
SNR vs OSR
(Differential input mode, typical condition)
100
95
Signal to Noise Ratio (dB)
90
85
80
75
70
65
60
64 128 256 512 1024 2048
Oversampling Ratio (OSR)
SINAD vs OSR
(Differential input mode, typical condition)
Signal to Noise and Distortion Ratio (dB)
95
90
85
80
75
70
65
60
64 128 256 512 1024 2048
Oversampling Ratio (OSR)
Table 47.50 Programmable gain instrumentation amplifier and sigma-delta A/D converter (3) (1 of 2)
Conditions: VCC = AVCC0 = AVCC1 = 2.7 to 5.5 V, VSS = AVSS0 = AVSS1 = 0 V
The electrical specifications are applied at the differential input mode, with external clock input used, Fos = 1 MHz,
OSR = 256, and dOFR = 0 mV, unless otherwise specified.
Table 47.50 Programmable gain instrumentation amplifier and sigma-delta A/D converter (3) (2 of 2)
Conditions: VCC = AVCC0 = AVCC1 = 2.7 to 5.5 V, VSS = AVSS0 = AVSS1 = 0 V
The electrical specifications are applied at the differential input mode, with external clock input used, Fos = 1 MHz,
OSR = 256, and dOFR = 0 mV, unless otherwise specified.
Note: The characteristics apply when no pin functions other than 24-bit sigma-delta A/D converter input are used.
Note 1. Gain drift is calculated by (Max (EG (T (-40°C) to T (125°C))) - Min (EG (T (-40°C) to T (125°C)))) / (125°C - (-40°C))
Offset drift is calculated by (Max (EOS (T (-40°C) to T (125°C))) - Min (EOS (T (-40°C) to T (125°C)))) / (125°C - (-40°C)).
Note 2. Not production tested but is guaranteed by the design and characterization.
Table 47.51 2.1 V LDO linear regulator for ADC (ADREG) characteristics
Conditions: VCC = AVCC0 = AVCC1 = 2.7 to 5.5 V, VSS = AVSS0 = AVSS1 = 0 V
Connect the ADREG pin to a AVSS1 pin by a 0.47 μF (-50% to +20%) capacitor.
Note 1. Not production tested but is guaranteed by the design and characterization.
Note 2. Select the reference voltage output value for the sensor with STC1.VSBIAS[3:0].
Note 3. The load current of more than 1 mA is required because the output stage of SBIAS is Pch open drain. When the original load
current is small, additional external load resistance is required.
Note 1. These values are based on simulation. They are not production tested.
Note 1. These values are based on simulation. They are not production tested.
Main clock
tdr
OSTDSR.OSTDF
MOCO clock
ICLK
Table 47.58 Power-on reset circuit and voltage detection circuit characteristics (1)
Parameter Symbol Min Typ Max Unit Test Conditions
Voltage detection Power-on reset (POR) VPOR 1.27 1.42 1.57 V Figure 47.66,
level*1 Figure 47.67
Voltage detection circuit (LVD0)*2 Vdet0_0 3.68 3.85 4.00 V Figure 47.68
At falling edge
Vdet0_1 2.68 2.85 2.96
VCC
Vdet0_2 2.38 2.53 2.64
Vdet0_3 1.78 1.90 2.02
Vdet0_4 1.60 1.69 1.82
Voltage detection circuit (LVD1)*3 Vdet1_0 4.13 4.29 4.45 V Figure 47.69
At falling edge
Vdet1_1 3.98 4.16 4.30
VCC
Vdet1_2 3.86 4.03 4.18
Vdet1_3 3.68 3.86 4.00
Vdet1_4 2.98 3.10 3.22
Vdet1_5 2.89 3.00 3.11
Vdet1_6 2.79 2.90 3.01
Vdet1_7 2.68 2.79 2.90
Vdet1_8 2.58 2.68 2.78
Vdet1_9 2.48 2.58 2.68
Vdet1_A 2.38 2.48 2.58
Vdet1_B 2.10 2.20 2.30
Vdet1_C 1.84 1.96 2.05
Vdet1_D 1.74 1.86 1.95
Vdet1_E 1.63 1.75 1.84
Vdet1_F 1.60 1.65 1.73
Voltage detection circuit (LVD2)*4 Vdet2_0 4.11 4.31 4.48 V Figure 47.70
At falling edge
Vdet2_1 3.97 4.17 4.34
VCC
Vdet2_2 3.83 4.03 4.20
Vdet2_3 3.64 3.84 4.01
Note 1. These characteristics apply when noise is not superimposed on the power supply. When a setting causes this voltage detection
level to overlap with that of the voltage detection circuit, it cannot be specified whether LVD1 or LVD2 is used for voltage
detection.
Note 2. # in the symbol Vdet0_# denotes the value of the OFS1.VDSEL1[2:0] bits.
Note 3. # in the symbol Vdet1_# denotes the value of the LVDLVLR.LVD1LVL[4:0] bits.
Note 4. # in the symbol Vdet2_# denotes the value of the LVDLVLR.LVD2LVL[2:0] bits.
Table 47.59 Power-on reset circuit and voltage detection circuit characteristics (2)
Parameter Symbol Min Typ Max Unit Test Conditions
Wait time after power-on LVD0: enable tPOR - 1.7 - ms -
reset cancellation
LVD0: disable tPOR - 1.3 - ms -
tVOFF
VCC
VPOR
1.0 V
VPOR
VCC
1.0 V
tw(POR)
*1
Internal reset signal
(active-low)
tdet tPOR
Note 1. tw(POR) is the time required for a power-on reset to be enabled while the external power VCC is
being held below the valid voltage (1.0 V).
When VCC turns on, maintain tw(POR) for 1.0 ms or more.
tVOFF
tVOFF
LVCMPCR.LVD1E
Td(E-A)
LVD1
Comparator output
LVD1CR0.CMPE
LVD1SR.MON
Internal reset signal
(active-low)
When LVD1CR0.RN = 0
When LVD1CR0.RN = 1
tLVD1
tVOFF
LVCMPCR.LVD2E
Td(E-A)
LVD2
Comparator output
LVD2CR0.CMPE
LVD2SR.MON
Internal reset signal
(active-low)
When LVD2CR0.RN = 0
When LVD2CR0.RN = 1
tLVD2
Note 1. Period from when the comparator input channel is switched until the switched result reflects in its output.
Note 2. Period from when comparator operation is enabled (CPMCTL.HCMPON = 1) until the comparator satisfies the DC/AC
characteristics.
Note 3. The internal reference voltage cannot be selected for input channels when AVCC0 < 2.0 V.
Note 1. In window mode, be sure to satisfy the following condition: VIVREF1 - VIVREF0 0.2 V.
Note 2. The internal reference voltage cannot be selected for input channels when VCC < 2.0 V.
Note 1. These values are based on simulation. They are not production tested.
Note 1. The reprogram/erase cycle is the number of erasures for each block. When the reprogram/erase cycle is n times (n = 1,000),
erasing can be performed n times for each block. For instance, when 4-byte programming is performed 256 times for different
addresses in 1-KB blocks, and then the entire block is erased, the reprogram/erase cycle is counted as one. However,
programming the same address for several times as one erasure is not enabled (overwriting is prohibited).
Note 2. Characteristic when using the flash memory programmer and the self-programming library provided by Renesas Electronics.
Note 3. This result is obtained from reliability testing.
Note: Does not include the time until each operation of the flash memory is started after instructions are executed by software.
Note: The lower-limit frequency of FCLK is 1 MHz during programming or erasing the flash memory. When using FCLK at below
4 MHz, the frequency can be set to 1 MHz, 2 MHz, or 3 MHz. A non-integer frequency such as 1.5 MHz cannot be set.
Note: The frequency accuracy of FCLK must be ± 3.5% during programming or erasing the flash memory. Confirm the frequency
accuracy of the clock source.
Note: Does not include the time until each operation of the flash memory is started after instructions are executed by software.
Note: The lower-limit frequency of FCLK is 1 MHz during programming or erasing the flash memory. When using FCLK at below
4 MHz, the frequency can be set to 1 MHz, 2 MHz, or 3 MHz. A non-integer frequency such as 1.5 MHz cannot be set.
Note: The frequency accuracy of FCLK must be ± 3.5% during programming or erasing the flash memory. Confirm the frequency
accuracy of the clock source.
Note 1. The reprogram/erase cycle is the number of erasure for each block. When the reprogram/erase cycle is n times (n = 100,000),
erasing can be performed n times for each block. For instance, when 1-byte programming is performed 1,000 times for different
addresses in 1-byte blocks, and then the entire block is erased, the reprogram/erase cycle is counted as one. However,
programming the same address for several times as one erasure is not enabled. (overwriting is prohibited.)
Note 2. Characteristics when using the flash memory programmer and the self-programming library provided by Renesas Electronics.
Note 3. These results are obtained from reliability testing.
Note: Does not include the time until each operation of the flash memory is started after instructions are executed by software.
Note: The lower-limit frequency of FCLK is 1 MHz during programming or erasing the flash memory. When using FCLK at below
4 MHz, the frequency can be set to 1 MHz, 2 MHz, or 3 MHz. A non-integer frequency such as 1.5 MHz cannot be set.
Note: The frequency accuracy of FCLK must be ± 3.5% during programming or erasing the flash memory. Confirm the frequency
accuracy of the clock source.
Note: Does not include the time until each operation of the flash memory is started after instructions are executed by software.
Note: The lower-limit frequency of FCLK is 1 MHz during programming or erasing the flash memory. When using FCLK at below
4 MHz, the frequency can be set to 1 MHz, 2 MHz, or 3 MHz. A non-integer frequency such as 1.5 MHz cannot be set.
Note: The frequency accuracy of FCLK must be ± 3.5% during programming or erasing the flash memory. Confirm the frequency
accuracy of the clock source.
tSWCKcyc
tSWCKH
tSWCKf
SWCLK
tSWCKr
tSWCKL
SWCLK
tSWDS tSWDH
SWDIO
(Input)
tSWDD
SWDIO
(Output)
tSWDD
SWDIO
(Output)
tSWDD
SWDIO
(Output)
Note 1. Input is enabled if the pin is specified as the software standby canceling source while it is used as an external
interrupt pin.
Note 2. AGTIO output is enabled while LOCO or SOSC is selected as a count source.
JEITA Package Code RENESAS Code Previous Code MASS (Typ) [g]
P-LFQFP64-10x10-0.50 PLQP0064KB-C — 0.3
Unit: mm
HD
*1 D
48 33
49 32
*2 E
HE
64
17
1 16 NOTE 4
Index area
NOTE 3
F NOTE)
1. DIMENSIONS “*1” AND “*2” DO NOT INCLUDE MOLD FLASH.
2. DIMENSION “*3” DOES NOT INCLUDE TRIM OFFSET.
S 3. PIN 1 VISUAL INDEX FEATURE MAY VARY, BUT MUST BE
LOCATED WITHIN THE HATCHED AREA.
4. CHAMFERS AT CORNERS ARE OPTIONAL, SIZE MAY VARY.
y S
*3
bp Reference Dimensions in millimeters
e
M Symbol
Min Nom Max
D 9.9 10.0 10.1
E 9.9 10.0 10.1
A2 1.4
HD 11.8 12.0 12.2
HE 11.8 12.0 12.2
0.25
A 1.7
A2
A
A1 0.05 0.15
T
c 0.09 0.20
Lp T 0q 3.5q 8q
L1
e 0.5
Detail F
x 0.08
y 0.08
Lp 0.45 0.6 0.75
L1 1.0
HD
*1
D
24 17
NOTE)
1. DIMENSIONS "*1" AND "*2"
DO NOT INCLUDE MOLD FLASH.
16 2. DIMENSION "*3" DOES NOT
25
INCLUDE TRIM OFFSET.
bp
b1
HE
E
c1
c
*2 Reference Dimension in Millimeters
Symbol
Min Nom Max
D 6.9 7.0 7.1
Terminal cross section
E 6.9 7.0 7.1
32
9 A2 1.4
ZE
A2
A
c
b1 0.35
c 0.09 0.145 0.20
S
c1 0.125
A1
L
L1 0° 8°
e 0.8
y S Detail F
*3 x 0.20
e bp
x y 0.10
ZD 0.7
ZE 0.7
L 0.3 0.5 0.7
L1 1.0
b
S AB
w S B
D A ZD e
w S A
A1 A
e
E
B
D
E
B
y S
A
ZE
x4 1 2 3 4 5 6
Reference Dimension in Millimeters
v
Index mark Symbol
Index mark Min Nom Max
(Laser mark)
S D 5.0
E 5.0
v 0.15
w 0.20
A 1.4
A1 0.3 0.35 0.4
e 0.8
b 0.4 0.45 0.5
x 0.08
y 0.10
ZD 0.5
ZE 0.5
48PJN-A
P-HWQFN48-7x7-0.50 PWQN0048KB-A P48K8-50-5B4-6 0.13
36 25
37 24 DETAIL OF A PART
E A
48 13 A1 c2
1 12
INDEX AREA
y S
Referance Dimension in Millimeters
Symbol Min Nom Max
D 6.95 7.00 7.05
D2
E 6.95 7.00 7.05
Lp A EXPOSED DIE PAD A 0.80
1 12 A1 0.00
13 b 0.18 0.25 0.30
48
e 0.50
b x M S AB
2X
aaa C
36 25
37 24
INDEX AREA
(D/2 X E/2)
48 13
2X
aaa C
1 12
B E A
ccc C
C
SEATING PLANE
A (A3) A1
e b(48X) bbb C A B
48X
ddd C
eee C Dimension in Millimeters
Reference
Symbol
E2 fff C A B Min. Nom. Max.
1 12 A 䠉 䠉 0.80
EXPOSED A1 0.00 0.02 0.05
fff C A B 48 13 DIE PAD
A3 0.203 REF.
b 0.20 0.25 0.30
D 7.00 BSC
E 7.00 BSC
D2 e 0.50 BSC
L 0.30 0.40 0.50
K 0.20 䠉 䠉
D2 5.25 5.30 5.35
24 E2 5.25 5.30 5.35
37
aaa 0.15
36 25
bbb 0.10
L(48X) K(48X)
ccc 0.10
ddd 0.05
eee 0.08
fff 0.10
30 21
31 20 DETAIL OF A PART
E A
40 11 A1 c2
1 10
INDEX AREA
y S
Referance Dimension in Millimeters
Symbol Min Nom Max
D 5.95 6.00 6.05
D2
E 5.95 6.00 6.05
Lp A EXPOSED DIE PAD A 0.80
1 10 A1 0.00
b x M S AB
2X
aaa C
30 21
31 20
INDEX AREA
(D/2 X E/2)
40 11
2X
aaa C
1 10
B E A
ccc C
C
SEATING PLANE
A (A3) A1
e b(40X) bbb C A B
40X
ddd C
eee C Dimension in Millimeters
Reference
Symbol
E2 fff C A B Min. Nom. Max.
1 10 A 䠉 䠉 0.80
EXPOSED A1 0.00 0.02 0.05
fff C A B 40 11 DIE PAD
A3 0.203 REF.
b 0.18 0.25 0.30
D 6.00 BSC
D2 E 6.00 BSC
e 0.50 BSC
L 0.30 0.40 0.50
K 0.20 䠉 䠉
31 20
D2 4.45 4.50 4.55
30 21 E2 4.45 4.50 4.55
L(40X) K(40X) aaa 0.15
bbb 0.10
ccc 0.10
ddd 0.05
eee 0.08
fff 0.10
Table 3.2 shows the register access cycles for non-GPT modules.
Note 1. If the number of PCLK cycles is non-integer (for example 1.5), the minimum value is without the decimal point,
and the maximum value is rounded up to the decimal point. For example, 1.5 to 2. 5 is 1 to 3.
Note 2. When accessing a 16-bit register (FTDRHL, FRDRHL, FCR, FDR, LSR, and CDR), access is 2 cycles more than
the value shown in Table 3.2. When accessing an 8-bit register (FTDRH, FTDRL, FRDRH, and FRDRL), the
access cycles are as shown in Table 3.2.
Note 3. When accessing the 32-bit register (SPDR), access is 2 cycles more than the value in Table 3.2. When accessing
an 8-bit or 16-bit register (SPDR_HA), the access cycles are as shown in Table 3.2.
P101/AN017/ANSD0N
P103/AN019/ANSD1N
P105/AN021/ANSD2N
P107/AN023/ANSD3N
P100/AN016/ANSD0P
P102/AN018/ANSD1P
P104/AN020/ANSD2P
P106/AN022/ANSD3P
P110/CMPREF1
SBIAS/VREFI
P108/SWDIO
/IVCMP2
/IVREF2
ADREG
AVCC1
AVSS1
P112
P111
<SDADC24>
<OPAMP> ADREG
DA12_0 PUMP0EN
ANSD0P ADBGR SBIAS/VREFI
AMP2+
AMP1+ AMP0PS ANSD1P
AMP1- ANSD2P
P500/AN000/AMP0+ AMP0+ ANSD3P
+
/DA12_0/IVCMP0 AMP0 AMP0O
AMP2-
- 24-bit sigma-delta
AMP1+
AMP1-
A/D converter
ANSD0N
AMP0+
ANSD1N
P501/AN001/AMP0- AMP0- AMP0MS
ANSD2N
/IVREF0
AMP2+ ANSD3N
AMP2- AMP1O
AMP1+
AMP1- AMP0OS
P300/SWCLK
<ACMPHS>
AMP0O
P502/AN002/AMP0O
P301
Appendix 4. Connection Diagram of Analog Block
AMP1O
P015/AN003/AMP1O IVCMP0
IVCMP1
SBIAS/VREFI
AMP2+
AN016
AN017
AN018
AN019
AN020
AN021
AN022
AN023
VREFL0 AMP2PS P205
AMP2-
VREFH0 +
AMP2- AMP2 P206
P003/AN006/AMP2- -
VREFH0
P002/AN007/AMP2+ VCC_USB_LDO
/DA8_1 AMP2MS
BGR
VREFAMP VCC_USB
P914/USB_DP
AN000
AN002
AN004
P915/USB_DM
AN006
AN008 VSS_USB
<DAC12>
VREFH
16-bit A/D converter
AN001
AN003
DAPC.PUMPEN AN005
VREFH or VREFH0
AN007
VREFL0
R01UH0888EJ0110 Rev.1.10
ACMPLP signal
P500PFS
12-bit DAC
P002PFS <ACMPLP>
Temperature sensor output CMPIN1
DACPC.PUMPEN
AMP1O
VREFL Internal reference voltage +
CMPREF1 CMP1
ACMPHS signal
DA8_1 -
DAC12 signal
DAC8 signal
<DAC8>
P013PFS CMPIN0
8-bit DAC AMP0O
P001
channel 1 +
CMP0
CMPREF0
P000 -
8-bit DAC DA8_0
RA2A1 Group
Vref
channel 0
OPAMP signal
P109/CMPREF0
ADC16 signal
Figure 4.1
P215/XCIN
VCC
VCL
P212/EXTAL
P214/XCOUT
VSS
P400/CMPIN0
P401
P402
P403
P213/XTAL
P411
P410
P409
P408 /CMPIN1
P407
Page 1283 of 1294
Appendix 4. Connection Diagram of Analog Block
P101/AN017/ANSD0N
P103/AN019/ANSD1N
P105/AN021/ANSD2N
P100/AN016/ANSD0P
P102/AN018/ANSD1P
P104/AN020/ANSD2P
P110/CMPREF1
SBIAS/VREFI
P108/SWDIO
/IVCMP2
/IVREF2
ADREG
AVCC1
AVSS1
<SDADC24>
<OPAMP> ADREG
DA12_0 PUMP0EN
ANSD0P ADBGR SBIAS/VREFI
AMP2+
AMP1+ AMP0PS ANSD1P
AMP1- ANSD2P
P500/AN000/AMP0+ AMP0+
+
/DA12_0/IVCMP0 AMP0 AMP0O
- 24-bit sigma-delta
AMP1+
AMP1-
A/D converter
ANSD0N
AMP0+
ANSD1N
P501/AN001/AMP0- AMP0- AMP0MS
ANSD2N
/IVREF0
AMP1O
AMP1+
AMP1- AMP0OS
P300/SWCLK
<ACMPHS>
AMP0O
P502/AN002/AMP0O
AMP1O
P301
P015/AN003/AMP1O IVCMP0
IVCMP1
DA8_0 P302
PUMP1EN IVCMP2
SBIAS/VREFI
AN016
AN017
AN018
AN019
AN020
AN021
VREFL0
VREFH0
P206
VREFH0
VCC_USB_LDO
BGR
VREFAMP VCC_USB
P914/USB_DP
AN000
AN002
AN004
P915/USB_DM
VSS_USB
<DAC12>
VREFH
16-bit A/D converter
AN001
AN003
DAPC.PUMPEN AN005
VREFH or VREFH0
VREFL0
ACMPLP signal
P500PFS
R01UH0888EJ0110 Rev.1.10
12-bit DAC
P002PFS <ACMPLP>
Temperature sensor output CMPIN1
DACPC.PUMPEN
AMP1O
VREFL Internal reference voltage +
CMPREF1 CMP1
ACMPHS signal
DA8_1 -
DAC12 signal
DAC8 signal
<DAC8>
P013PFS CMPIN0
8-bit DAC AMP0O
channel 1 +
CMP0
CMPREF0
P000 -
8-bit DAC DA8_0
RA2A1 Group
Vref
channel 0
OPAMP signal
P109/CMPREF0
ADC16 signal
Figure 4.2
P215/XCIN
VCC
VCL
P213/XTAL
P212/EXTAL
P214 /XCOUT
VSS
P400/CMPIN0
P401
P409
P408 /CMPIN1
P407
Page 1284 of 1294
Appendix 4. Connection Diagram of Analog Block
P101/AN017/ANSD0N
P103/AN019/ANSD1N
P100/AN016/ANSD0P
P102/AN018/ANSD1P
P110/CMPREF1
SBIAS/VREFI
P108/SWDIO
/IVCMP2
/IVREF2
ADREG
AVCC1
AVSS1
<SDADC24>
<OPAMP> ADREG
DA12_0 PUMP0EN
ANSD0P ADBGR SBIAS/VREFI
AMP2+
AMP1+ AMP0PS ANSD1P
P500/AN000/AMP0+ AMP0+
+
/DA12_0/IVCMP0 AMP0 AMP0O
- 24-bit sigma-delta
AMP1+
A/D converter
ANSD0N
AMP0+
ANSD1N
P501/AN001/AMP0- AMP0- AMP0MS
/IVREF0
AMP1O
AMP1+
AMP0OS
P300/SWCLK
<ACMPHS>
AMP0O
P502/AN002/AMP0O
P301
IVCMP0
IVCMP1
DA8_0
PUMP1EN IVCMP2
SBIAS/VREFI
AN016
AN017
AN018
AN019
VREFL0
VREFH0
VREFH0
VCC_USB_LDO
BGR
VREFAMP VCC_USB
P914/USB_DP
AN000
AN002
P915/USB_DM
VSS_USB
<DAC12>
16-bit A/D converter
AN001
DAPC.PUMPEN AN005
VREFH or VREFH0
VREFL0
ACMPLP signal
P500PFS
R01UH0888EJ0110 Rev.1.10
12-bit DAC
P002PFS <ACMPLP>
Temperature sensor output CMPIN1
DACPC.PUMPEN
AMP1O
Internal reference voltage +
CMPREF1 CMP1
ACMPHS signal
DA8_1 -
DAC12 signal
DAC8 signal
<DAC8>
P013PFS CMPIN0
8-bit DAC AMP0O
channel 1 +
CMP0
CMPREF0
P000
8-bit DAC
-
DA8_0
RA2A1 Group
Vref
channel 0
OPAMP signal
P109/CMPREF0
ADC16 signal
Figure 4.3
P215/XCIN
P213/XTAL
VCC
VCL
P212/EXTAL
P214 /XCOUT
VSS
P400/CMPIN0
P408 /CMPIN1
P407
Page 1285 of 1294
Appendix 4. Connection Diagram of Analog Block
P101/AN017/ANSD0N
P100/AN016/ANSD0P
P110/CMPREF1
SBIAS/VREFI
P108 /SWDIO
/IVCMP2
/IVREF2
ADREG
AVCC1
AVSS1
<SDADC24>
<OPAMP> ADREG
DA12_0 PUMP0EN
ANSD0P ADBGR SBIAS/VREFI
AMP2+
AMP1+ AMP0PS
P500/AN000/AMP0+ AMP0+
+
/DA12_0/IVCMP0 AMP0O
AMP0
- 24-bit sigma-delta
AMP1+
A/D converter
ANSD0N
AMP0+
P501/AN001/AMP0- AMP0- AMP0MS
/IVREF0
P300/SWCLK
<ACMPHS>
AMP0O
P502/AN002/AMP0O
P301
IVCMP0
IVCMP2
AN016
AN017
SBIAS/VREFI
VREFL0
VREFH0
VREFH0
VCC_USB_LDO
BGR
VREFAMP VCC_USB
P914/USB_DP
AN000
AN002
P915/USB_DM
<DAC12>
16-bit A/D converter
AN001
DAPC.PUMPEN
VREFH or VREFH0
VREFL0
ACMPLP signal
P500PFS
R01UH0888EJ0110 Rev.1.10
12-bit DAC
P002PFS <ACMPLP>
Temperature sensor output CMPIN1
DACPC.PUMPEN
Internal reference voltage +
CMPREF1 CMP1
ACMPHS signal
DA8_1 -
DAC12 signal
DAC8 signal
<DAC8>
P013PFS CMPIN0
8-bit DAC AMP0O
channel 1 +
CMP0
CMPREF0
P000
8-bit DAC
-
DA8_0
Vref
RA2A1 Group
channel 0
SDADC24 signal
ADC16 signal
Figure 4.4
P215/XCIN
P214/XCOUT
VSS/VSS_USB
VCC
P400/CMPIN0
VCL
P213/XTAL
P212/EXTAL
P408/CMPIN1
P407
Page 1286 of 1294
Appendix 4. Connection Diagram of Analog Block
P101/AN017/ANSD0N
P100/AN016/ANSD0P
P110/CMPREF1
SBIAS/VREFI
P108/SWDIO
/IVCMP2
/IVREF2
ADREG
AVCC1
AVSS1
<SDADC24>
<OPAMP> ADREG
DA12_0 PUMP0EN
ANSD0P ADBGR SBIAS/VREFI
AMP2+
AMP1+ AMP0PS
P500/AN000/AMP0+ AMP0+
+
/DA12_0/IVCMP0 AMP0 AMP0O
- 24-bit sigma-delta
AMP1+
A/D converter
ANSD0N
AMP0+
P501/AN001/AMP0- AMP0- AMP0MS
/IVREF0
P300/SWCLK
<ACMPHS>
AMP0O
P502/AN002/AMP0O
P301
IVCMP0
IVCMP2
SBIAS/VREFI
AN016
AN017
VREFL0 P205
VREFH0
P206
VREFH0
BGR
VREFAMP
AN000
AN002
<DAC12>
16-bit A/D converter
AN001
DAPC.PUMPEN
VREFH or VREFH0
VREFL0
ACMPLP signal
P500PFS
R01UH0888EJ0110 Rev.1.10
12-bit DAC
P002PFS <ACMPLP>
Temperature sensor output CMPIN1
DACPC.PUMPEN
Internal reference voltage +
CMPREF1 CMP1
ACMPHS signal
DA8_1 -
DAC12 signal
DAC8 signal
<DAC8>
P013PFS CMPIN0
8-bit DAC AMP0O
channel 1 +
CMP0
CMPREF0
-
8-bit DAC DA8_0
RA2A1 Group
Vref
channel 0
OPAMP signal
P109/CMPREF0
ADC16 signal
Figure 4.5
VCC
VCL
P213/XTAL
P212/EXTAL
VSS
P400/CMPIN0
P408 /CMPIN1
P407
Revision History