Nothing Special   »   [go: up one dir, main page]

UPD70F3425-Renesas Electronics PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1050

To our customers,

Old Company Name in Catalogs and Other Documents

On April 1st, 2010, NEC Electronics Corporation merged with Renesas Technology
Corporation, and Renesas Electronics Corporation took over all the business of both
companies. Therefore, although the old company name remains in this document, it is a valid
Renesas Electronics document. We appreciate your understanding.

Renesas Electronics website: http://www.renesas.com

April 1st, 2010


Renesas Electronics Corporation

Issued by: Renesas Electronics Corporation (http://www.renesas.com)


Send any inquiries to http://www.renesas.com/inquiry.

www.DataSheet4U.com
Notice
1. All information included in this document is current as of the date this document is issued. Such information, however, is
subject to change without any prior notice. Before purchasing or using any Renesas Electronics products listed herein, please
confirm the latest product information with a Renesas Electronics sales office. Also, please pay regular and careful attention to
additional and different information to be disclosed by Renesas Electronics such as that disclosed through our website.
2. Renesas Electronics does not assume any liability for infringement of patents, copyrights, or other intellectual property rights
of third parties by or arising from the use of Renesas Electronics products or technical information described in this document.
No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights
of Renesas Electronics or others.
3. You should not alter, modify, copy, or otherwise misappropriate any Renesas Electronics product, whether in whole or in part.
4. Descriptions of circuits, software and other related information in this document are provided only to illustrate the operation of
semiconductor products and application examples. You are fully responsible for the incorporation of these circuits, software,
and information in the design of your equipment. Renesas Electronics assumes no responsibility for any losses incurred by
you or third parties arising from the use of these circuits, software, or information.
5. When exporting the products or technology described in this document, you should comply with the applicable export control
laws and regulations and follow the procedures required by such laws and regulations. You should not use Renesas
Electronics products or the technology described in this document for any purpose relating to military applications or use by
the military, including but not limited to the development of weapons of mass destruction. Renesas Electronics products and
technology may not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited
under any applicable domestic or foreign laws or regulations.
6. Renesas Electronics has used reasonable care in preparing the information included in this document, but Renesas Electronics
does not warrant that such information is error free. Renesas Electronics assumes no liability whatsoever for any damages
incurred by you resulting from errors in or omissions from the information included herein.
7. Renesas Electronics products are classified according to the following three quality grades: “Standard”, “High Quality”, and
“Specific”. The recommended applications for each Renesas Electronics product depends on the product’s quality grade, as
indicated below. You must check the quality grade of each Renesas Electronics product before using it in a particular
application. You may not use any Renesas Electronics product for any application categorized as “Specific” without the prior
written consent of Renesas Electronics. Further, you may not use any Renesas Electronics product for any application for
which it is not intended without the prior written consent of Renesas Electronics. Renesas Electronics shall not be in any way
liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for an
application categorized as “Specific” or for which the product is not intended where you have failed to obtain the prior written
consent of Renesas Electronics. The quality grade of each Renesas Electronics product is “Standard” unless otherwise
expressly specified in a Renesas Electronics data sheets or data books, etc.
“Standard”: Computers; office equipment; communications equipment; test and measurement equipment; audio and visual
equipment; home electronic appliances; machine tools; personal electronic equipment; and industrial robots.
“High Quality”: Transportation equipment (automobiles, trains, ships, etc.); traffic control systems; anti-disaster systems; anti-
crime systems; safety equipment; and medical equipment not specifically designed for life support.
“Specific”: Aircraft; aerospace equipment; submersible repeaters; nuclear reactor control systems; medical equipment or
systems for life support (e.g. artificial life support devices or systems), surgical implantations, or healthcare
intervention (e.g. excision, etc.), and any other applications or purposes that pose a direct threat to human life.
8. You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics,
especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation
characteristics, installation and other product characteristics. Renesas Electronics shall have no liability for malfunctions or
damages arising out of the use of Renesas Electronics products beyond such specified ranges.
9. Although Renesas Electronics endeavors to improve the quality and reliability of its products, semiconductor products have
specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Further,
Renesas Electronics products are not subject to radiation resistance design. Please be sure to implement safety measures to
guard them against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a
Renesas Electronics product, such as safety design for hardware and software including but not limited to redundancy, fire
control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures. Because
the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or system
manufactured by you.
10. Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental
compatibility of each Renesas Electronics product. Please use Renesas Electronics products in compliance with all applicable
laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the EU RoHS
Directive. Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with
applicable laws and regulations.
www.DataSheet4U.com
11. This document may not be reproduced or duplicated, in any form, in whole or in part, without prior written consent of Renesas
Electronics.
12. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this
document or Renesas Electronics products, or if you have any other inquiries.

(Note 1) “Renesas Electronics” as used in this document means Renesas Electronics Corporation and also includes its majority-
owned subsidiaries.
(Note 2) “Renesas Electronics product(s)” means any product developed or manufactured by or for Renesas Electronics.
User’s Manual

V850E/Dx3 - DJ3/DL3

32-bit Single-Chip Microcontroller

Hardware

V850E/DJ3: V850E/DL3:
µPD70F3421 µPD70F3427
µPD70F3422
µPD70F3423
µPD70F3424
µPD70F3425
µPD70F3426A

www.DataSheet4U.com

Document No. U17566EE5V1UM00


Date Published 9/11/09
© NEC Electronics 2009
Printed in Germany
www.DataSheet4U.com

2 V850E/Dx3 User’s Manual U17566EE5V1UM00


Notes for CMOS Devices
(1) Precaution against ESD for semiconductors
Strong electric field, when exposed to a MOS device, can cause destruction of
the gate oxide and ultimately degrade the device operation. Steps must be
taken to stop generation of static electricity as much as possible, and quickly
dissipate it once, when it has occurred. Environmental control must be
adequate. When it is dry, humidifier should be used. It is recommended to
avoid using insulators that easily build static electricity. Semiconductor devices
must be stored and transported in an anti-static container, static shielding bag
or conductive material. All test and measurement tools including work bench
and floor should be grounded. The operator should be grounded using wrist
strap. Semiconductor devices must not be touched with bare hands. Similar
precautions need to be taken for PW boards with semiconductor devices on it.

(2) Handling of unused input pins for CMOS


No connection for CMOS device inputs can be cause of malfunction. If no
connection is provided to the input pins, it is possible that an internal input level
may be generated due to noise, etc., hence causing malfunction. CMOS
devices behave differently than Bipolar or NMOS devices. Input levels of
CMOS devices must be fixed high or low by using a pull-up or pull-down
circuitry. Each unused pin should be connected to VDD or GND with a resistor,
if it is considered to have a possibility of being an output pin. All handling
related to the unused pins must be judged device by device and related
specifications governing the devices.

(3) Status before initialization of MOS devices


Power-on does not necessarily define initial status of MOS device. Production
process of MOS does not define the initial operation status of the device.
Immediately after the power source is turned ON, the devices with reset
function have not yet been initialized. Hence, power-on does not guarantee
out-pin levels, I/O settings or contents of registers. Device is not initialized until
the reset signal is received. Reset operation must be executed immediately
after power-on for devices having reset function.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 3


Legal Notes
• The information in this document is current as of <publishing month year>.
The information is subject to change without notice. For actual design-in,
refer to the latest publications of NEC Electronics data sheets or data books,
etc., for the most up-to-date specifications of NEC Electronics products. Not
all products and/or types are available in every country. Please check with
an NEC sales representative for availability and additional information.
• No part of this document may be copied or reproduced in any form or by any
means without prior written consent of NEC Electronics. NEC Electronics
assumes no responsibility for any errors that may appear in this document.
• NEC Electronics does not assume any liability for infringement of patents,
copyrights or other intellectual property rights of third parties by or arising
from the use of NEC Electronics products listed in this document or any
other liability arising from the use of such NEC Electronics products. No
license, express, implied or otherwise, is granted under any patents,
copyrights or other intellectual property rights of NEC Electronics or others.
• Descriptions of circuits, software and other related information in this
document are provided for illustrative purposes in semiconductor product
operation and application examples. The incorporation of these circuits,
software and information in the design of customer's equipment shall be
done under the full responsibility of customer. NEC Electronics assumes no
responsibility for any losses incurred by customers or third parties arising
from the use of these circuits, software and information.
• While NEC Electronics endeavors to enhance the quality, reliability and
safety of NEC Electronics products, customers agree and acknowledge that
the possibility of defects thereof cannot be eliminated entirely. To minimize
risks of damage to property or injury (including death) to persons arising
from defects in NEC Electronics products, customers must incorporate
sufficient safety measures in their design, such as redundancy, fire-
containment and anti-failure features.
• NEC Electronics products are classified into the following three quality
grades: “Standard”, “Special” and “Specific”.
The "Specific" quality grade applies only to NEC Electronics products
developed based on a customer-designated “quality assurance program” for
a specific application. The recommended applications of NEC Electronics
product depend on its quality grade, as indicated below. Customers must
check the quality grade of each NEC Electronics product before using it in a
particular application.
"Standard": Computers, office equipment, communications
equipment, test and measurement equipment, audio
and visual equipment, home electronic appliances,
machine tools, personal electronic equipment and
industrial robots.
"Special": Transportation equipment (automobiles, trains, ships,
etc.), traffic control systems, anti-disaster systems,
anti-crime systems, safety equipment and medical
www.DataSheet4U.com equipment (not specifically designed for life support).
"Specific": Aircraft, aerospace equipment, submersible repeaters,
nuclear reactor control systems, life support systems and
medical equipment for life support, etc.

4 V850E/Dx3 User’s Manual U17566EE5V1UM00


The quality grade of NEC Electronics products is “Standard” unless
otherwise expressly specified in NEC Electronics data sheets or data books,
etc. If customers wish to use NEC Electronics products in applications not
intended by NEC Electronics, they must contact NEC Electronics sales
representative in advance to determine NEC Electronics 's willingness to
support a given application.

Note 1. "NEC Electronics" as used in this statement means NEC Electronics


Corporation and also includes its majority-owned subsidiaries.
2. "NEC Electronics products" means any product developed or
manufactured by or for NEC Electronics (as defined above).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 5


Regional Information
Some information contained in this document may vary from country to
country. Before using any NEC product in your application, please contact the
NEC office in your country to obtain a list of authorized representatives and
distributors. They will verify:
• Device availability
• Ordering information
• Product release schedule
• Availability of related technical literature
• Development environment specifications (for example, specifications for
third-party tools and components, host computers, power plugs, AC supply
voltages, and so forth)
• Network requirements
In addition, trademarks, registered trademarks, export restrictions, and other
legal issues may also vary from country to country.
NEC Electronics Corporation
1753, Shimonumabe, Nakahara-ku,
Kawasaki, Kanagawa 211-8668, Japan
Tel: 044 4355111
http://www.necel.com/

[America] [Europe] [Asia & Oceania]

NEC Electronics America, Inc. NEC Electronics (Europe) GmbH NEC Electronics (China) Co., Ltd
2880 Scott Blvd. Arcadiastrasse 10 7th Floor, Quantum Plaza, No. 27
Santa Clara, CA 95050-2554,| 0472 Düsseldorf, Germany ZhiChunLu Haidian District,
U.S.A. Tel: 0211 65030 Beijing 100083, P.R.China
Tel: 408 5886000 http://www.eu.necel.com/ Tel: 010 82351155
http://www.am.necel.com/ http://www.cn.necel.com/
United Kingdom Branch
Cygnus House, Sunrise Parkway NEC Electronics Shanghai Ltd.
Linford Wood, Milton Keynes Room 2511-2512, Bank of China
MK14 6NP, U.K. Tower,
Tel: 01908 691133 200 Yincheng Road Central,
Pudong New Area,
Succursale Française Shanghai 200120, P.R. China
9, rue Paul Dautier, B.P. 52 Tel: 021 58885400
78142 Velizy-Villacoublay Cédex http://www.cn.necel.com/
France
Tel: 01 30675800 NEC Electronics Hong Kong Ltd.
12/F., Cityplaza 4,
Sucursal en España 12 Taikoo Wan Road, Hong Kong
Juan Esplandiu, 15 Tel: 2886 9318
28007 Madrid, Spain http://www.hk.necel.com/
Tel: 091 5042787
NEC Electronics Taiwan Ltd.
Tyskland Filial 7F, No. 363 Fu Shing North Road
Täby Centrum Taipei, Taiwan, R.O.C.
Entrance S (7th floor) Tel: 02 27192377
18322 Täby, Sweden
Tel: 08 6387200 NEC Electronics Singapore Pte. Ltd.
238A Thomson Road,
Filiale Italiana #12-08 Novena Square,
www.DataSheet4U.com Via Fabio Filzi, 25/A Singapore 307684
20124 Milano, Italy Tel: 6253 8311
Tel: 02 667541 http://www.sg.necel.com/

Branch The Netherlands NEC Electronics Korea Ltd.


Steijgerweg 6 11F., Samik Lavied’or Bldg., 720-2,
5616 HS Eindhoven, Yeoksam-Dong, Kangnam-Ku, Seoul,
The Netherlands 135-080, Korea Tel: 02-558-3737
Tel: 040 2654010 http://www.kr.necel.com/

6 V850E/Dx3 User’s Manual U17566EE5V1UM00


Preface
Readers This manual is intended for users who want to understand the functions of the
concerned microcontrollers.
Purpose This manual presents the hardware manual for the concerned microcontrollers.
Organization This system specification describes the following sections:
• Pin function
• CPU function
• Internal peripheral function
Module instances These microcontrollers may contain several instances of a dedicated module.
In general the different instances of such modules are identified by the index
“n”, where “n” counts from 0 to the number of instances minus one.
Legend Symbols and notation are used as follows:
• Weight in data notation: Left is high order column, right is low order
column
• Active low notation: xxx (pin or signal name is over-scored) or
/xxx (slash before signal name)
• Memory map address: High order at high stage and low order at low
stage

Note Additional remark or tip

Caution Item deserving extra attention

Numeric notation: • Binary: xxxx or xxxB


• Decimal: xxxx
• Hexadecimal: xxxxH or 0x xxxx
Prefixes representing powers of 2 (address space, memory capacity):
• K (kilo): 210 = 1024
• M (mega): 220 = 10242 = 1,048,576
• G (giga): 230 = 10243 = 1,073,741,824
Register contents: X, x = don’t care
Diagrams Block diagrams do not necessarily show the exact wiring in hardware but the
functional structure.
Timing diagrams are for functional explanation purposes only, without any
relevance to the real hardware implementation.
Further Information For further information see http://www.eu.necel.com.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 7


www.DataSheet4U.com

8 V850E/Dx3 User’s Manual U17566EE5V1UM00


Table of Contents

Chapter 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

1.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.2 Features Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.3 Product Series Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.4 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.5 Ordering Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

Chapter 2 Pin Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

2.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.1.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.1.2 Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.1.3 Noise elimination. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.2 Port Group Configuration Registers . . . . . . . . . . . . . . . . . . . . . . . 33
2.2.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.2.2 Pin function configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.2.3 Pin data input/output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.2.4 Configuration of electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.2.5 Alternative input selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.3 Port Types Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.4 Port Group Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
2.4.1 Port group configuration lists. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
2.4.2 Alphabetic pin function list. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
2.4.3 External memory interface of µPD70F3427 . . . . . . . . . . . . . . . . . . . . . . . . . 68
2.4.4 Port group 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
2.4.5 Port group 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
2.4.6 Port group 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
2.4.7 Port group 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
2.4.8 Port group 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
2.4.9 Port group 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
2.4.10 Port group 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
2.4.11 Port group 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
2.4.12 Port group 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
2.4.13 Port group 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
2.4.14 Port group 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
2.4.15 Port group 11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
2.4.16 Port group 12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
www.DataSheet4U.com
2.4.17 Port group 13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
2.4.18 Port group 14 (µPD70F3427 only) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
2.4.19 Port group AL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
2.4.20 Port group AH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
2.4.21 Port group CS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

User’s Manual U17566EE5V1UM00 1


Table of Contents

2.4.22 Port group CT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99


2.4.23 Port group DL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
2.4.24 Port group DH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
2.5 Noise Elimination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
2.5.1 Analog filtered inputs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
2.5.2 Digitally filtered inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
2.6 Pin Functions in Reset and Power Save Modes. . . . . . . . . . . 108
2.7 Recommended Connection of unused Pins . . . . . . . . . . . . . . 109
2.8 Package Pins Assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
2.8.1 µPD70F3421, µPD70F3422, µPD70F3423. . . . . . . . . . . . . . . . . . . . . . . . . 110
2.8.2 µPD70F3424, µPD70F3425, µPD70F3426A . . . . . . . . . . . . . . . . . . . . . . . 111
2.8.3 µPD70F3427 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

Chapter 3 CPU System Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113


3.1.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
3.2 CPU Register Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
3.2.1 General purpose registers (r0 to r31) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
3.2.2 System register set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
3.3 Operation Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
3.3.1 Normal operation mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
3.3.2 Flash programming mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
3.4 Address Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
3.4.1 CPU address space and physical address space . . . . . . . . . . . . . . . . . . . . 126
3.4.2 Program and data space. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
3.5 Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
3.5.1 Memory areas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
3.5.2 Fixed peripheral I/O area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
3.5.3 Recommended use of data address space. . . . . . . . . . . . . . . . . . . . . . . . . 134
3.6 Write Protected Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
3.7 Instructions and Data Access Times . . . . . . . . . . . . . . . . . . . . . 136

Chapter 4 Clock Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139


4.1.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
4.1.2 Clock monitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
4.1.3 Power save modes overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
www.DataSheet4U.com
4.1.4 Start conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
4.1.5 Start-up guideline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
4.2 Clock Generator Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
4.2.1 General clock generator registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
4.2.2 SSCG control registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

2 User’s Manual U17566EE5V1UM00


Table of Contents

4.2.3 Control registers for peripheral clocks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161


4.2.4 Control registers for power save modes . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
4.2.5 Clock monitor registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
4.3 Power Save Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
4.3.1 Power save modes description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
4.3.2 Clock Generator state transitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
4.3.3 Power save mode activation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
4.3.4 CPU operation after power save mode release . . . . . . . . . . . . . . . . . . . . . 193
4.4 Clock Generator Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
4.4.1 Internal and sub oscillator operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
4.4.2 Watch Timer and Watch Calibration Timer clocks . . . . . . . . . . . . . . . . . . . 196
4.4.3 Clock output FOUTCLK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
4.4.4 Default clock generator setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
4.4.5 Operation of the Clock Monitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198

Chapter 5 Interrupt Controller (INTC) . . . . . . . . . . . . . . . . . . . . . . . . . . . 201

5.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201


5.2 Non-Maskable Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
5.2.1 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
5.2.2 Restore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
5.2.3 Non-maskable interrupt status flag (NP) . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
5.2.4 NMI0 control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
5.3 Maskable Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
5.3.1 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
5.3.2 Restore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
5.3.3 Priorities of maskable interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
5.3.4 xxIC - Maskable interrupts control register . . . . . . . . . . . . . . . . . . . . . . . . . 239
5.3.5 IMR0 to IMR6 - Interrupt mask registers . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
5.3.6 ISPR - In-service priority register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
5.3.7 Maskable interrupt status flag (ID) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
5.3.8 External maskable interrupts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
5.3.9 Software interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
5.4 Edge and Level Detection Configuration . . . . . . . . . . . . . . . . . 257
5.5 Software Exception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
5.5.1 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
5.5.2 Restore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
5.5.3 Exception status flag (EP). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
5.6 Exception Trap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
www.DataSheet4U.com 5.6.1 Illegal opcode definition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
5.6.2 Debug trap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
5.7 Multiple Interrupt Processing Control . . . . . . . . . . . . . . . . . . . . 264
5.8 Interrupt Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
5.9 Periods in Which Interrupts Are Not Acknowledged . . . . . . 267

User’s Manual U17566EE5V1UM00 3


Table of Contents

Chapter 6 Flash Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269

6.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270


6.1.1 Flash memory address assignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
6.1.2 Flash memory erasure and rewrite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
6.1.3 Flash memory programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
6.1.4 Boot block swapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
6.2 Flash Self-Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
6.2.1 Flash self-programming registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
6.2.2 Interrupt handling during flash self-programming . . . . . . . . . . . . . . . . . . . . 277
6.3 Flash Programming via N-Wire . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
6.4 Flash Programming with Flash Programmer. . . . . . . . . . . . . . 279
6.4.1 Programming environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
6.4.2 Communication mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
6.4.3 Pin connection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
6.4.4 Programming method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285

Chapter 7 Bus and Memory Control (BCU, MEMC). . . . . . . . . . . . 289

7.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289


7.2 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
7.2.1 Memory banks and chip select signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
7.2.2 Chips select priority control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
7.2.3 Peripheral I/O area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
7.2.4 NPB access timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
7.2.5 Bus properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
7.2.6 Boundary operation conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
7.2.7 Initialization for access to external devices . . . . . . . . . . . . . . . . . . . . . . . . . 299
7.2.8 External bus mute function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
7.3 Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
7.3.1 BCU registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
7.3.2 Memory controller registers (µPD70F3427 only) . . . . . . . . . . . . . . . . . . . . 311
7.4 Page ROM Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
7.5 Configuration of Memory Access. . . . . . . . . . . . . . . . . . . . . . . . . 322
7.5.1 Endian format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
7.5.2 Wait function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
7.5.3 Idle state insertion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
7.6 External Devices Interface Timing . . . . . . . . . . . . . . . . . . . . . . . . 324
7.6.1 Writing to external devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
www.DataSheet4U.com 7.6.2 Reading from external devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
7.6.3 Read-write operation on external devices . . . . . . . . . . . . . . . . . . . . . . . . . . 329
7.6.4 Write-read operation on external devices . . . . . . . . . . . . . . . . . . . . . . . . . . 330
7.7 Page ROM Access Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
7.7.1 Half word/word access with 8-bit bus or word access with 16-bit bus . . . . 332
7.7.2 Byte access with 8-bit bus or byte/half word access with 16-bit bus. . . . . . 334

4 User’s Manual U17566EE5V1UM00


Table of Contents

7.8 Data Access Order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336


7.8.1 Access to 8-bit data busses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
7.8.2 Access to 16-bit data busses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342

Chapter 8 DMA Controller (DMAC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349

8.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349


8.2 Peripheral and CPU Clock Settings . . . . . . . . . . . . . . . . . . . . . . . 351
8.3 DMAC Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
8.3.1 DMA Source address registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
8.3.2 DMA destination address registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
8.3.3 DBCn - DMA transfer count registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
8.3.4 DADCn - DMA addressing control registers . . . . . . . . . . . . . . . . . . . . . . . . 358
8.3.5 DCHCn - DMA channel control registers . . . . . . . . . . . . . . . . . . . . . . . . . . 360
8.3.6 DRST - DMA restart register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
8.3.7 DTFRn - DMA trigger source select register . . . . . . . . . . . . . . . . . . . . . . . . 362
8.4 DMA setup and retrigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
8.4.1 DMA initial setup (status after system reset). . . . . . . . . . . . . . . . . . . . . . . . 365
8.4.2 DMA Retrigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
8.5 Automatic Restart Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
8.6 Transfer Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
8.7 Transfer Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
8.8 DMA Channel Priorities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
8.9 DMA Transfer Start Factors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
8.10 Forcible Interruption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
8.11 Forcible Termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
8.12 DMA Transfer Completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
8.13 Transfer Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
8.13.1 Single transfer mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
8.13.2 Block transfer mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
8.14 Cautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
8.14.1 Simultaneous program execution and DMA transfer with internal RAM . . . 374

Chapter 9 ROM Correction Function (ROMC) . . . . . . . . . . . . . . . . . . 375

9.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375


9.2 “Data Replacement” ROM Correction Unit. . . . . . . . . . . . . . . . 376
www.DataSheet4U.com 9.2.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
9.2.2 “Data Replacement” ROM correction operation . . . . . . . . . . . . . . . . . . . . . 377
9.2.3 Setting of ROM correction addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
9.2.4 “Data Replacement” ROM correction registers . . . . . . . . . . . . . . . . . . . . . . 382
9.3 “DBTRAP” ROM Correction Unit . . . . . . . . . . . . . . . . . . . . . . . . . 387
9.3.1 “DBTRAP” ROM correction operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388

User’s Manual U17566EE5V1UM00 5


Table of Contents

9.3.2 “DBTRAP” ROM correction registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390

Chapter 10 Code Protection and Security . . . . . . . . . . . . . . . . . . . . . . . 393

10.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393


10.2 Boot ROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
10.3 N-Wire Debug Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
10.4 Flash Writer and Self-Programming Protection . . . . . . . . . . . 395
10.5 Additional Firmware Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
10.5.1 ID-field. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
10.5.2 Checksum calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
10.5.3 Variable reset vector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396

Chapter 11 16-bit Timer/Event Counter P (TMP) . . . . . . . . . . . . . . . . 397

11.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397


11.2 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
11.3 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
11.4 TMP Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
11.5 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
11.5.1 Interval timer mode (TPnMD2 to TPnMD0 = 000). . . . . . . . . . . . . . . . . . . . 412
11.5.2 External event count mode (TPnMD2 to TPnMD0 = 001). . . . . . . . . . . . . . 421
11.5.3 External trigger pulse output mode (TPnMD2 to TPnMD0 = 010) . . . . . . . 430
11.5.4 One-shot pulse output mode (TPnMD2 to TPnMD0 = 011) . . . . . . . . . . . . 441
11.5.5 PWM output mode (TPnMD2 to TPnMD0 = 100) . . . . . . . . . . . . . . . . . . . . 448
11.5.6 Free-running timer mode (TPnMD2 to TPnMD0 = 101) . . . . . . . . . . . . . . . 457
11.5.7 Pulse width measurement mode (TPnMD2 to TPnMD0 = 110) . . . . . . . . . 474
11.5.8 Timer output operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
11.6 Operating Precautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
11.6.1 Capture operation in pulse width measurement and free-running mode . . 481
11.6.2 Count jitter for PCLK4 to PCLK7 count clocks . . . . . . . . . . . . . . . . . . . . . . 481

Chapter 12 16-bit Interval Timer Z (TMZ) . . . . . . . . . . . . . . . . . . . . . . . . . 483

12.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483


12.1.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
12.1.2 Principle of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
12.2 TMZ Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
12.3 Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
www.DataSheet4U.com 12.3.1 Steady operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
12.3.2 Timer start and stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491

Chapter 13 16-bit Multi-Purpose Timer G (TMG) . . . . . . . . . . . . . . . . 493

13.1 Features of Timer G . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493

6 User’s Manual U17566EE5V1UM00


Table of Contents

13.2 Function Overview of Each Timer Gn. . . . . . . . . . . . . . . . . . . . . 494


13.3 Basic Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496
13.4 TMG Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497
13.5 Output Delay Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
13.6 Explanation of Basic Operation . . . . . . . . . . . . . . . . . . . . . . . . . . 506
13.7 Operation in Free-Run Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507
13.8 Match and Clear Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
13.9 Edge Noise Elimination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529
13.10 Precautions Timer Gn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530

Chapter 14 16-bit Timer Y (TMY) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533

14.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533


14.1.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534
14.1.2 Principle of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
14.2 Registers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
14.3 Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
14.4 Output Timing Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541

Chapter 15 Watch Timer (WT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545

15.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545


15.1.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
15.1.2 Principle of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548
15.2 Watch Timer Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550
15.3 Watch Timer Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554
15.3.1 Timing of steady operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554
15.3.2 Watch Timer start-up. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555
15.4 Watch Calibration Timer Registers . . . . . . . . . . . . . . . . . . . . . . . 557
15.5 Watch Calibration Timer Operation . . . . . . . . . . . . . . . . . . . . . . . 562

Chapter 16 Watchdog Timer (WDT). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565

16.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565


16.1.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566
16.1.2 Principle of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566
16.1.3 Watchdog Timer clock. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567
www.DataSheet4U.com 16.1.4 Reset behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568
16.2 Watchdog Timer Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569

Chapter 17 Asynchronous Serial Interface (UARTA) . . . . . . . . . . . 575

17.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575

User’s Manual U17566EE5V1UM00 7


Table of Contents

17.2 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576


17.3 UARTA Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578
17.4 Interrupt Request Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585
17.5 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586
17.5.1 Data format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 586
17.5.2 SBF transmission/reception format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588
17.5.3 SBF transmission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590
17.5.4 SBF reception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590
17.5.5 UART transmission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592
17.5.6 Continuous transmission procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593
17.5.7 UART reception. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595
17.5.8 Reception errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596
17.5.9 Parity types and operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597
17.5.10 Receive data noise filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598
17.6 Baud Rate Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599
17.6.1 Baud Rate Generator configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599
17.6.2 Baud Rate Generator registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600
17.6.3 Baud rate calculation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602
17.6.4 Baud rate error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602
17.6.5 Baud rate setting example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602
17.6.6 Allowable baud rate range during reception . . . . . . . . . . . . . . . . . . . . . . . . 603
17.6.7 Baud rate during continuous transmission . . . . . . . . . . . . . . . . . . . . . . . . . 605
17.7 Cautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606
17.7.1 UARTAn behaviour during and after power save mode . . . . . . . . . . . . . . . 606
17.7.2 UARTAn behaviour during debugger break . . . . . . . . . . . . . . . . . . . . . . . . 606
17.7.3 UARTAn operation stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607

Chapter 18 Clocked Serial Interface (CSIB) . . . . . . . . . . . . . . . . . . . . . 609

18.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609


18.2 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610
18.3 CSIB Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611
18.4 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 620
18.4.1 Single transfer mode (master mode, transmission/reception mode). . . . . . 620
18.4.2 Single transfer mode (master mode, reception mode) . . . . . . . . . . . . . . . . 622
18.4.3 Continuous mode (master mode, transmission/reception mode) . . . . . . . . 623
18.4.4 Continuous mode (master mode, reception mode) . . . . . . . . . . . . . . . . . . . 624
18.4.5 Continuous reception mode (error) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625
18.4.6 Continuous mode (slave mode, transmission/reception mode) . . . . . . . . . 626
www.DataSheet4U.com
18.4.7 Continuous mode (slave mode, reception mode) . . . . . . . . . . . . . . . . . . . . 628
18.4.8 Clock timing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629
18.5 Output Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631
18.6 Operation Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632

8 User’s Manual U17566EE5V1UM00


Table of Contents

18.7 Baud Rate Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638


18.7.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638
18.7.2 Baud Rate Generator registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 638
18.7.3 Baud rate calculation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 640
18.8 Cautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
18.8.1 CSIBn behaviour during debugger break . . . . . . . . . . . . . . . . . . . . . . . . . . 641
18.8.2 CSIB operation stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 642

Chapter 19 I2C Bus (IIC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645

19.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645


19.2 I2C Pin Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646
19.3 I2C Pin Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647
19.4 I2C Pin Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649
19.5 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 651
19.6 IIC Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 654
19.7 I2C Bus Pin Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 669
19.8 I2C Bus Definitions and Control Methods . . . . . . . . . . . . . . . . . 669
19.8.1 Start condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 670
19.8.2 Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671
19.8.3 Transfer direction specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672
19.8.4 Acknowledge signal (ACK) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672
19.8.5 Stop condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 674
19.8.6 Wait signal (WAIT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675
19.9 I2C Interrupt Request Signals (INTIICn) . . . . . . . . . . . . . . . . . . . 677
19.9.1 Master device operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677
19.9.2 Slave device operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680
19.9.3 Slave device operation (when receiving extension code) . . . . . . . . . . . . . . 684
19.9.4 Operation without communication. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688
19.9.5 Arbitration loss operation (operation as slave after arbitration loss) . . . . . . 688
19.9.6 Operation when arbitration loss occurs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690
19.10 Interrupt Request Signal (INTIICn) . . . . . . . . . . . . . . . . . . . . . . . . 695
19.11 Address Match Detection Method . . . . . . . . . . . . . . . . . . . . . . . . 696
19.12 Error Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696
19.13 Extension Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697
19.14 Arbitration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698
www.DataSheet4U.com 19.15 Wakeup Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699
19.16 Communication Reservation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 700
19.16.1 Communication reservation function is enabled (IICFn.IICRSVn bit = 0) . . 700
19.16.2 Communication reservation function is disabled (IICFn.IICRSVn bit = 1). . 704
19.17 Cautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705

User’s Manual U17566EE5V1UM00 9


Table of Contents

19.18 Communication Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706


19.18.1 Master operation with communication reservation . . . . . . . . . . . . . . . . . . . 706
19.18.2 Master operation without communication reservation . . . . . . . . . . . . . . . . . 707
19.18.3 Slave operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 708
19.19 Timing of Data Communication . . . . . . . . . . . . . . . . . . . . . . . . . . 712

Chapter 20 CAN Controller (CAN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719

20.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 720


20.1.1 Overview of functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721
20.1.2 Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722
20.2 CAN Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723
20.2.1 Frame format. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723
20.2.2 Frame types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724
20.2.3 Data frame and remote frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724
20.2.4 Error frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731
20.2.5 Overload frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732
20.3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732
20.3.1 Determining bus priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732
20.3.2 Bit stuffing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733
20.3.3 Multi masters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733
20.3.4 Multi cast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734
20.3.5 CAN sleep mode/CAN stop mode function . . . . . . . . . . . . . . . . . . . . . . . . . 734
20.3.6 Error control function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734
20.3.7 Baud rate control function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 741
20.4 Connection with Target System . . . . . . . . . . . . . . . . . . . . . . . . . . 744
20.5 Internal Registers of CAN Controller . . . . . . . . . . . . . . . . . . . . . 745
20.5.1 CAN module register and message buffer addresses . . . . . . . . . . . . . . . . 745
20.5.2 CAN Controller configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746
20.5.3 CAN registers overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 747
20.5.4 Register bit configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749
20.6 Bit Set/Clear Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 752
20.7 Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754
20.8 CAN Controller Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790
20.8.1 Initialization of CAN module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790
20.8.2 Initialization of message buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790
20.8.3 Redefinition of message buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 790
20.8.4 Transition from initialization mode to operation mode. . . . . . . . . . . . . . . . . 792
20.8.5 Resetting error counter CnERC of CAN module. . . . . . . . . . . . . . . . . . . . . 793
www.DataSheet4U.com
20.9 Message Reception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 794
20.9.1 Message reception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 794
20.9.2 Receive data read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795
20.9.3 Receive history list function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796
20.9.4 Mask function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 798

10 User’s Manual U17566EE5V1UM00


Table of Contents

20.9.5 Multi buffer receive block function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 800


20.9.6 Remote frame reception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 801
20.10 Message Transmission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802
20.10.1 Message transmission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 802
20.10.2 Transmit history list function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 804
20.10.3 Automatic block transmission (ABT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 806
20.10.4 Transmission abort process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 808
20.10.5 Remote frame transmission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 809
20.11 Power Saving Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810
20.11.1 CAN sleep mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 810
20.11.2 CAN stop mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 813
20.11.3 Example of using power saving modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . 814
20.12 Interrupt Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 815
20.13 Diagnosis Functions and Special Operational Modes. . . . . 816
20.13.1 Receive-only mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 816
20.13.2 Single-shot mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 817
20.13.3 Self-test mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 818
20.13.4 Receive/transmit operation in each operation mode. . . . . . . . . . . . . . . . . . 819
20.14 Time Stamp Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 820
20.14.1 Time stamp function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 820
20.15 Baud Rate Settings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821
20.15.1 Baud rate setting conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821
20.15.2 Representative examples of baud rate settings . . . . . . . . . . . . . . . . . . . . . 825
20.16 Operation of CAN Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829

Chapter 21 A/D Converter (ADC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 857

21.1 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 857


21.2 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 859
21.3 ADC Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 861
21.4 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 869
21.4.1 Basic operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 869
21.4.2 Trigger mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 870
21.4.3 Operation modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 871
21.4.4 Power-fail compare mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 873
21.5 Cautions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 876
21.6 How to Read A/D Converter Characteristics Table . . . . . . . . 878
www.DataSheet4U.com
Chapter 22 Stepper Motor Controller/Driver (Stepper-C/D) . . . . 883

22.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 883


22.1.1 Driver overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 883
22.2 Stepper Motor Controller/Driver Registers. . . . . . . . . . . . . . . . 886

User’s Manual U17566EE5V1UM00 11


Table of Contents

22.3 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 891


22.3.1 Stepper Motor Controller/Driver operation . . . . . . . . . . . . . . . . . . . . . . . . . 891
22.4 Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 894
22.4.1 Timer counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 894
22.4.2 Automatic PWM phase shift . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 895

Chapter 23 LCD Controller/Driver (LCD-C/D) . . . . . . . . . . . . . . . . . . . . 897

23.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 897


23.1.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 898
23.1.2 LCD panel addressing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 899
23.2 LCD-C/D Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 900
23.3 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 904
23.3.1 Common signals and segment signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . 904
23.3.2 Activation of LCD segments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 906
23.4 Display Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 906

Chapter 24 LCD Bus Interface (LCD-I/F) . . . . . . . . . . . . . . . . . . . . . . . . . 911

24.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 911


24.1.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 912
24.1.2 LCD Bus Interface access modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 913
24.1.3 Access types to the LBDATA0 register . . . . . . . . . . . . . . . . . . . . . . . . . . . . 913
24.1.4 Interrupt generation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 914
24.2 LCD Bus Interface Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 915
24.3 Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 922
24.3.1 Timing dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 922
24.3.2 LCD Bus I/F states during and after accesses . . . . . . . . . . . . . . . . . . . . . . 923
24.3.3 Writing to the LCD bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 923
24.3.4 Reading from the LCD bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 926
24.3.5 Write-Read-Write sequence on the LCD bus . . . . . . . . . . . . . . . . . . . . . . . 928

Chapter 25 Sound Generator (SG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 929

25.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 929


25.1.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 930
25.1.2 Principle of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 931
25.2 Sound Generator Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 932
25.3 Sound Generator Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 939
25.3.1 Generating the tone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 939
www.DataSheet4U.com
25.3.2 Generating the volume information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 940
25.4 Sound Generator Application Hints . . . . . . . . . . . . . . . . . . . . . . 945
25.4.1 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 945
25.4.2 Start and stop sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 945
25.4.3 Change sound volume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 945

12 User’s Manual U17566EE5V1UM00


Table of Contents

25.4.4 INTSG0 interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 945


25.4.5 Constant sound volume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 946
25.4.6 Generate special sounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 946

Chapter 26 Power Supply Scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947

26.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947


26.2 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 949
26.2.1 Devices µPD70F3421, µPD70F3422, µPD70F3423. . . . . . . . . . . . . . . . . . 949
26.2.2 Devices µPD70F3424, µPD70F3425, µPD70F3426A . . . . . . . . . . . . . . . . 950
26.2.3 Device µPD70F3427 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 951
26.3 Voltage regulators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 952

Chapter 27 Reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 953

27.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 953


27.1.1 General reset performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 954
27.1.2 Reset at power-on. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 957
27.1.3 External RESET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 958
27.1.4 Reset by Watchdog Timer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 959
27.1.5 Reset by Clock Monitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 959
27.1.6 Software reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 959
27.2 Reset Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 960

Chapter 28 Voltage Comparator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 963

28.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 963


28.1.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 964
28.1.2 Comparison results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 964
28.1.3 Stand-by mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 964
28.2 Voltage Comparator Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . 965
28.3 Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 967

Chapter 29 On-Chip Debug Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 969

29.1 Functional Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 969


29.1.1 Debug functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 969
29.1.2 Security function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 971
29.2 Controlling the N-Wire Interface . . . . . . . . . . . . . . . . . . . . . . . . . . 974
29.3 N-Wire Enabling Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 976
29.3.1 Starting normal operation after RESET and RESPOC . . . . . . . . . . . . . . . . 976
www.DataSheet4U.com
29.3.2 Starting debugger after RESET and RESPOC . . . . . . . . . . . . . . . . . . . . . . 976
29.3.3 N-Wire activation by RESET pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 977
29.4 Connection to N-Wire Emulator . . . . . . . . . . . . . . . . . . . . . . . . . . 978
29.4.1 KEL connector. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 978
29.5 Restrictions and Cautions on On-Chip Debug Function . . 982

User’s Manual U17566EE5V1UM00 13


Table of Contents

Appendix A Registers Access Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 985

Appendix B Special Function Registers . . . . . . . . . . . . . . . . . . . . . . . . . . 997

Revision History. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1021

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1025

www.DataSheet4U.com

14 User’s Manual U17566EE5V1UM00


Chapter 1 Introduction

V850E/Dx3 series The V850E/Dx3 is a product series in NEC Electronics’ V850 family of single-
chip microcontrollers designed for automotive applications. Beside the V850E/
Dx3 - DJ3/DL3 the product series comprises the V850E/DG3 devices. For
further information about V850E/DG3 refer to the user’s manual
“V850E/Dx3 - DG3”
Document number U18349EE

1.1 General

The V850E/Dx3 single-chip microcontroller devices make the performance


gains attainable with 32-bit RISC-based controllers available for embedded
control applications. The integrated V850 CPU offers easy pipeline handling
and programming, resulting in compact code size comparable to 16-bit CISC
CPUs.
The V850E/Dx3 provide an excellent combination of general purpose
peripheral functions, like serial communication interfaces (UARTs, Clocked
Serial Interfaces), timers, and measurement inputs (A/D Converter), with
dedicated CAN network support.
The devices offer specific power-saving modes to manage the power
consumption effectively under varying conditions.
Thus equipped, the V850E/Dx3 product line is ideally suited for automotive
applications, like dashboard or body. It is also an excellent choice for other
applications where a combination of sophisticated peripheral functions and
CAN network support is required.

(1) V850E CPU


The V850E CPU core is a RISC processor. Through the use of basic
instructions that can be executed in one clock period combined with an
optimized pipeline architecture, it achieves marked improvements in instruction
execution speed.
In addition, to make it ideal for use in digital control applications, a 32-bit
hardware multiplier enables this CPU to support multiply instructions,
saturated multiply instructions, bit operation instructions, etc.
Through two-byte basic instructions and instructions compatible with high level
languages, the object code efficiency in a C compiler is increased, and
program size can be reduced.
Further, because the on-chip interrupt controller provides high-speed interrupt
response and processing, this device is well suited for high level real-time
control applications.

www.DataSheet4U.com (2) On-chip flash memory


The V850E/Dx3 microcontrollers have on-chip flash memory. It is possible to
program the controllers directly in the target environment where they are
mounted.
With this feature, system development time can be reduced and system
maintainability after shipping can be markedly improved.

User’s Manual U17566EE5V1UM00 15


Chapter 1 Introduction

(3) A full range of software development tools


A development system is available that includes an optimized C compiler,
debugger, in-circuit emulator, simulator, system performance analyzer, and
other elements.

1.2 Features Summary

The following table provides a quick summary of the most outstanding


features.

Table 1-1 V850E/Dx3 features summary (1/4)


CPU
Core V850E1
Number of instructions 81
Minimum instruction execution time • 15.625 ns (@ φ = 64 MHz) (µPD70F3424, µPD70F3425,
µPD70F3426A, µPD70F3427)a
• 31.25 ns (@ φ = 32 MHz) ( µPD70F3421, µPD70F3422,
µPD70F3423)a
General registers 32 registers (32 bits each)
Instruction set
V850E (compatible with V850 plus additional powerful instructions for reducing code and increasing execution
speed)
Signed multiplication (16 bits × 16 bits →32 bits or 32 bits × 32 bits →64 bits): 1 to 2 clocks
Saturated operation instructions (with overflow/underflow detection)
32-bit shift instructions: 1 clock
Bit manipulation instructions
Load/store instructions with long/short format
Signed load instructions
Internal flash memory
Size • 2 MB (µPD70F3426A)
• 1 MB (µPD70F3427, µPD70F3425)
• 512 KB (µPD70F3424, µPD70F3423)
• 384 KB (µPD70F3422)
• 256 KB (µPD70F3421)
Flash protection • N-Wire security function
• external programmer security function
Secure self programming
Internal data RAM
Size • 84 KB (µPD70F3426A)
• 60 KB (µPD70F3427)
• 32 KB (µPD70F3425)
www.DataSheet4U.com • 24 KB (µPD70F3424)
• 20 KB (µPD70F3423)
• 16 KB (µPD70F3422)
• 12 KB (µPD70F3421)

16 User’s Manual U17566EE5V1UM00


Introduction Chapter 1

Table 1-1 V850E/Dx3 features summary (2/4)


Clock Generator
Internal spread-spectrum PLL (SSCG) 12-fold/16-fold, up to 64 MHz ± 5 % bc
Internal PLL 8-fold, 32 MHz
CPU frequency range • up to 64 MHz (µPD70F3424, µPD70F3425,
µPD70F3426A, µPD70F3427)ac
• up to 32 MHz (µPD70F3421, µPD70F3422,
µPD70F3423)ac
Peripheral frequency range up to 16 MHz
Main crystal frequency range (main oscillator) 4 MHz
Sub oscillator 32 KHz (typ.)
Internal oscillator 240 KHz (typ.)
Clock supervision 2 channels:
• main oscillator monitor
• sub oscillator monitor
Auxiliary frequency output
Built-in power saving modes
HALT / IDLE / WATCH / Sub-WATCH / STOP
External memory bus interface (µPD70F3427 only)
Address/data separated busses 24/32-bit
Chip select signals 4
DMA Controller
Number of channels 4
I/O ports
Input/output ports • µPD70F3427: 101
• all others: 98
Input ports 16
A/D Converter
Number of channels • 16 (µPD70F3424, µPD70F3425, µPD70F3426A,
µPD70F3427)
• 12 (µPD70F3421, µPD70F3422, µPD70F3423)
Resolution 10-bit
Conversion modes • Continuous select mode
• Continuous scan mode
• Timer trigger mode
• Software trigger mode
Analog input channels shared with digital input port functionality

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 17


Chapter 1 Introduction

Table 1-1 V850E/Dx3 features summary (3/4)


Serial interfaces
Synchronous: CSI (CSIB) • 3 channels (µPD70F3424, µPD70F3425, µPD70F3426A,
µPD70F3427)
• 2 channels (µPD70F3421, µPD70F3422, µPD70F3423)
Asynchronous: UART (UARTA) 2 channels with LIN support
2
I C (IIC) 2 channels
CAN (CAN) • 3 channels with 32 message buffers each
(µPD70F3421, µPD70F3422, µPD70F3423,
µPD70F3424, µPD70F3425, µPD70F3427)
• 2 channels with 32 message buffers each
(µPD70F3426A)
Timers
16-bit multi purpose timer/event counter (TMP) 4 channels
16-bit multi purpose timer/counter (TMG) • 3 channels
16-bit multi purpose timer/counter (TMZ) • 10 channels (µPD70F3424, µPD70F3425,
µPD70F3426A, µPD70F3427)
• 6 channels (µPD70F3421, µPD70F3422, µPD70F3423)
16-bit PWM/PFM timer (TMY) 1 channel
Watch Timer (WT) 1 channel
Watch Calibration Timer (WCT) 1 channel
Watchdog Timer (WDT) 1 channel
LCD Controller/Driver (µPD70F3421, µPD70F3422, µPD70F3423)
Segment signal output max. 40
Common signal output max. 4
Modes 1/4 duty, 1/3 bias
LCD Bus Interface
Bus width 8-bit parallel
Bus control modes 2 modes:
• RD strobe and WR strobe (“mod80”)
• RD/WR signal and data strobe (“mod68”)
Transfer speed 100 KHz to 3.2 MHz
Stepper Motor Controller/Driver
Number of channels 6
Resolution 8-bit and 8-bit + 1
Sound Generator
Number of channels 1
Volume 9-bit volume level accuracy
Sound frequency 245 Hz to 6 KHz with min. resolution of ± 20 Hz
Sound duration 256 steps

www.DataSheet4U.com

18 User’s Manual U17566EE5V1UM00


Introduction Chapter 1

Table 1-1 V850E/Dx3 features summary (4/4)


Interrupts and exceptions
Non-maskable interrupts 2 sources
Maskable interrupts • 92 sources (µPD70F3424, µPD70F3425, µPD70F3426A,
µPD70F3427)
• 84 sources (µPD70F3421, µPD70F3422, µPD70F3423)
Software exceptions 32 sources
Exception trap 2 sources
ROM Correction
Number of channels 8 channels by DBTRAP
On-chip debug interface
Number of interfaces 1
Connection of an external N-Wire emulator
Internal Voltage Comparators
Number of channels 2
Power supply supervision
Power-On-Clear Generates reset at power-up and in case of power loss
Single supply operating voltage
Range 4.0 V to 5.5 V a
Temperature range
Range Ta = –40 to +85°C
• @ φ = 67.2 MHz (µPD70F3424, µPD70F3425,
µPD70F3426A, µPD70F3427)a
• @ φ = 32 MHz (µPD70F3421, µPD70F3422,
µPD70F3423)a
Package
Package • µPD70F3427: 208-pin QFP
• all others: 144-pin QFP
Package size • µPD70F3427: 28 mm × 28 mm
• all others: 20 mm × 20 mm
Pin pitch 0.5 mm
Technology
CMOS
a)
refer to Data Sheet
b) The maximum CPU frequency as specified in the Data Sheet must not be exceeded.
c) Center output frequency of the SSCG, can be modulated up to +/- 5%.

Note The CAN controller of this device fulfils the requirements according ISO 11898.
Additionally, the CAN controller was tested according to the test procedures
required by ISO 16845. The CAN controller has successfully passed all test
patterns. Beyond these test patterns, other tests like robustness tests and
processor interface tests as recommended by C&S/FH Wolfenbuettel have
www.DataSheet4U.com been performed with success.

User’s Manual U17566EE5V1UM00 19


Chapter 1 Introduction

1.3 Product Series Overview


Table 1-2 shows the common and different features of the microcontrollers.

Table 1-2 V850E/Dx3 product series overview


V850E/DL3 V850E/DJ3
Part number
µPD70F3427 µPD70F3426A µPD70F3425 µPD70F3424 µPD70F3423 µPD70F3422 µPD70F3421
Internal Flash 1 MB +
1 MB 1 MB 512 KB 384 KB 256 KB
memory 1 MBa
RAM 60 KB +
60 KB 32 KB 24 KB 20 KB 16 KB 12 KB
24 KBa
External memory interface provided –

DMA 4 ch

Operating Main oscillator with SSCGc 67.2 MHz max. 32 MHz max.
clockb
Internal oscillator 240 KHz typ.

Sub oscillator 32 KHz typ.

I/O ports Input/Output 101 98

Input 16

A/D converter 16 channels 12 channels

Timers TMZ 10 channels 6 channels

TMP 4 channels

TMG 3 channels

TMY 1 channel

WDT 1 channel

Watch provided

Watch calibration provided

Serial CAN 3 channels 2 channels 3 channels


interfaces
UARTA 2 channels

CSIB 3 channels 2 channels

I2C 2 channels

Interrupts External (maskable) 8 channels 7 channels

Internal (maskable) 84 channels 77 channels

NMI 2 channels (1 external, 1 internal)

Other ROM Correction by DBTRAP 2x8


8 channels 8 channels
functions channels

Power-On-Clear provided
Voltage Comparator 2 channels

Clock supervision 2 channels

Sound Generator 1 channel


Stepper Motor
6 channels
Controller/Driver
LCD-Controller/Driver none 40 x 4

LCD Bus Interface provided

Auxiliary frequency output provided


On-Chip debug provided
www.DataSheet4U.com
Operating voltageb 3.5 V to 5.5 V

Package 208-pin QFP 144-pin LQFP


a)
The additional 1 MB flash memory respectively 24 KB RAM is accessible via the VSB, and thus the access
requires an additional CPU clock cycle.
b)
Refer to the Data Sheet.
c)
SSCG: spread spectrum clock generator

20 User’s Manual U17566EE5V1UM00


Introduction Chapter 1

1.4 Description

Figure 1-1 provides a functional block diagram of the V850E/DJ3


(µPD70F3421, µPD70F3422, µPD70F3423, µPD70F3424, µPD70F3425,
µPD70F3426A) microcontrollers.

Power and Reset

VCMP0, VCMP1 2 x Voltage Reset POC Power supply


VCMPO0, VCMPO1 Comparator

Note 7 Memory
NMI Note 1 CPU
ROM
INTP0 to INTP6 Interrupt Correction
Flash
Controller CPU Core
INTP7Note 1
Note 8

VSB (V850 System Bus)


RAM Note 9

ROM correction
Serial Interfaces System Controller
1 MB
RXDA0, RXDA1 VSB
2 x UARTA Flash
TXDA0, TXDA1 BRG
Standby Controller
SIB0, SIB1, SIB2Note 2 Note 2
Bus Note 10
SOB0, SOB1, SOB2Note 2 3/2 x CSIB
SCKB0, SCKB1, SCKB2Note 2
Control
BRG
Unit 24 KB
Note 5 On-Chip Debug Unit VSB
CRXD0, CRXD1, CRXD2Note 5 DMA RAM
3/2 x CAN
CTXD0, CTXD1, CTXD2Note 5
SDA0, SDA1
2 x I2C Bus
SCL0, SCL1
Bridge
NPB (NEC Peripheral Bus)

Control Interfaces
Note 3
ANI0-ANI11 Ports
10-bit ADC
Note 3
ANI12-ANI15 16/12
channels
AVREF
P50 to P57

P70 to P715

P90 to P97
P100 to P107
P110 to P117
P120 to P127
P130 to P137
P30 to P37
P40 to P47

P60 to P67

P80 to P87
P00 to P07
P16 to P17
P20 to P27

SM11 to SM14
SM21 to SM24
SM31 to SM34 Stepper
Motor
SM41 to SM44 C/D
Clock Generator
SM51 to SM54
Internal oscillator
SM61 to SM64

SGO/SGOF XT1
SGOA SG0
Sub oscillator
XT2
SEG0 to SEG39 Note24
Note 16-bit Timer
COM0 to COM3 LCD C/D
TMY0 X1
DBD0 to DBD7 Note 1 Main oscillator
X2
DBRD LCD Bus I/F
DBWR
16-bit Timer
TMZ0 - TMZ5 Clock Generator
Timers RESET
Note 6 Spread Spectrum PLL
TIG01 to TIG04
16-bit Timer FOUT
TIG11 to TIG14 PLL
TMZ6 - TMZ9 FOUT
TIG20 to TIG25

16-bit Timer Watch


TMG0 - TMG2 Main and
and
16-bit Timer Sub oscillator
TOG01 to TOG04 Watch Calibration
WCT Supervision
TOG11 to TOG14 Timer
TOG21 to TOG24

TIP00, TIP01
16-bit Timer
TIP10, TIP11 WT Auxiliary Functions
TIP20, TIP21
TIP30, TIP31 16-bit Timer
TMP0 - TMP3 DMS
TOP00, TOP01
Watchdog DRST
TOP10, TOP11 N-Wire DDI
TOP20, TOP21 Timer debug I/F DDO
TOP30, TOP31
DCK
www.DataSheet4U.com

Figure 1-1 V850E/DJ3 (µPD70F3421, µPD70F3422, µPD70F3423, µPD70F3424,


µPD70F3425, µPD70F3426A) block diagram

User’s Manual U17566EE5V1UM00 21


Chapter 1 Introduction

Table 1-3 summarizes the different features of the of the V850E/DJ3


(µPD70F3421, µPD70F3422, µPD70F3423, µPD70F3424, µPD70F3425,
µPD70F3426A) microcontrollers, marked as “Notes” in Figure 1-1.

Table 1-3 Feature set differences


Note Feature µPD70F3426A µPD70F3425 µPD70F3424 µPD70F3423 µPD70F3422 µPD70F3421
1 INTP7 √ √ √ — — —
2 CSIB2 √ √ √ — — —
3 ANI12
√ √ √ — — —
to ANI15
4 LCD-C/D — — — √ √ √
5 CAN2 — √ √ √ √ √
6 TMZ6
√ √ √ — — —
to TMZ9
7 Flash 1 MB 1 MB 512 KB 512 KB 384 KB 256 KB
8 RAM 60 KB 32 KB 24 KB 20 KB 16 KB 12 KB
9 VSB Flash 1 MB — — — — —
10 VSB RAM 24 KB — — — — —

www.DataSheet4U.com

22 User’s Manual U17566EE5V1UM00


Introduction Chapter 1

Figure 1-2 provides a functional block diagram of the V850E/DL3 µPD70F3427


microcontroller.

Power and Reset

VCMP0, VCMP1 2 x Voltage Reset POC Power supply


VCMPO0, VCMPO1 Comparator

Memory
CPU
NMI ROM
Interrupt Flash
Correction
INTP0 to INTP7 Controller CPU Core

RAM
Serial Interfaces A0 to A23
System Controller
D0 to D15
RXDA0, RXDA1 D16 to D31
2 x UARTA
CS0, CS1
TXDA0, TXDA1 BRG
Standby Controller Memory CS3, CS4
SIB0, SIB1, SIB2 Controller BE3 to BE0
Bus
SOB0, SOB1, SOB2 3 x CSIB RD
SCKB0, SCKB1, SCKB2
Control
BRG WR
Unit
CRXD0, CRXD1, CRXD2
On-Chip Debug Unit WAIT
3 x CAN DMA BCLK
CTXD0, CTXD1, CTXD2

SDA0, SDA1
SCL0, SCL1 2 x I2C Bus
Bridge
NPB (NEC Peripheral Bus)

Control Interfaces

10-bit ADC Ports


ANI0-ANI15 16
channels
P50 to P57

P70 to P715

P90 to P97
P100 to P107
P110 to P117
P120 to P127
P130 to P137
P140 to P142
P30 to P37
P40 to P47

P60 to P67

P80 to P87
P00 to P07
P16 to P17
P20 to P27

SM11 to SM14
SM21 to SM24
SM31 to SM34 Stepper
Motor
SM41 to SM44 C/D
Clock Generator
SM51 to SM54
Internal oscillator
SM61 to SM64

SGO/SGOF Sound XT1


Generator Sub oscillator
SGOA XT2

DBD0 to DBD7
X1
DBRD LCD Bus I/F Main oscillator
X2
DBWR
16-bit Timer
TMY0
Clock Generator
Timers RESET
Spread Spectrum PLL
TIG01 to TIG04
16-bit Timer FOUT
TIG11 to TIG14 TMZ0 - TMZ9 PLL FOUT
TIG20 to TIG25
16-bit Timer Watch Main and
TMG0 - TMG2 and Sub oscillator
16-bit Timer Watch Calibration
TOG01 to TOG04 WCT Supervision
Timer
TOG11 to TOG14
TOG21 to TOG24

TIP00, TIP01
16-bit Timer
TIP10, TIP11 WT Auxiliary Functions
TIP20, TIP21
TIP30, TIP31 16-bit Timer
TMP0 - TMP3 DMS
TOP00, TOP01
Watchdog N-Wire DRST
TOP10, TOP11
Timer DDI
TOP20, TOP21 debug I/F DDO
TOP30, TOP31
DCK

Figure 1-2
www.DataSheet4U.com V850E/DL3 (µPD70F3427) block diagram

User’s Manual U17566EE5V1UM00 23


Chapter 1 Introduction

Structure of the In the diagram, the building blocks are grouped according to their function.
diagram
At the top of the diagram, you find the functions for controlling power supply
and reset.
The upper right-hand section shows the building blocks of the CPU system and
the memory interface components. The I/O ports are summarized below that
section.
The left-hand section of the block diagram identifies the interfaces to
peripherals and also the built-in timers. All these components are connected to
and can be controlled via the internal bus.
The Clock Generator, depicted in the lower right-hand section, plays a central
role. It generates and monitors not only the clocks for the CPU and the
peripheral interfaces, but also governs the power save modes that can be
entered when the device is not in use.

Structure of the This manual explains how to use the V850E/Dx3 microcontroller devices. It
manual provides comprehensive information about the building blocks, their features,
and how to set registers in order to enable or disable specific functions.
The manual provides individual chapters for the building blocks. These
chapters are organized according to the grouping in the diagram.
• Core functions
“Pin Functions“ on page 27
“CPU System Functions“ on page 113
“Clock Generator“ on page 139
“Interrupt Controller (INTC)“ on page 201
• Memory access
“Flash Memory“ on page 269
“Bus and Memory Control (BCU, MEMC)“ on page 289
“DMA Controller (DMAC)“ on page 349
“ROM Correction Function (ROMC)“ on page 375
“Code Protection and Security“ on page 393
• Timers
“16-bit Timer/Event Counter P (TMP)“ on page 397
“16-bit Interval Timer Z (TMZ)“ on page 483
“16-bit Multi-Purpose Timer G (TMG)“ on page 493
“Watch Timer (WT)“ on page 545
“Watchdog Timer (WDT)“ on page 565
• Serial interfaces
“Asynchronous Serial Interface (UARTA)“ on page 575
“Clocked Serial Interface (CSIB)“ on page 609
“I2C Bus (IIC)“ on page 645
“CAN Controller (CAN)“ on page 719
www.DataSheet4U.com
• Control interfaces
“A/D Converter (ADC)“ on page 857
“Stepper Motor Controller/Driver (Stepper-C/D)“ on page 883
“LCD Controller/Driver (LCD-C/D)“ on page 897
“LCD Bus Interface (LCD-I/F)“ on page 911
“Sound Generator (SG)“ on page 929

24 User’s Manual U17566EE5V1UM00


Introduction Chapter 1

• Power and reset


“Power Supply Scheme“ on page 1
“Reset“ on page 953
“Voltage Comparator“ on page 963
• Auxiliary functions
“On-Chip Debug Unit“ on page 969

1.5 Ordering Information

Table 1-4 V850E/Dx3 ordering information


NEC order code Pin/package Memory size Remarks
UPD70F3421GJ(A)-GAE-QS-AX 144 pin LQFP 256 KB flash –
UPD70F3422GJ(A)-GAE-QS-AX 144 pin LQFP 384 KB flash –
UPD70F3423GJ(A)-GAE-QS-AX 144 pin LQFP 512 KB flash –
UPD70F3424GJ(A)-GAE-QS-AX 144 pin LQFP 512 KB flash –
UPD70F3425GJ(A)-GAE-QS-AX 144 pin LQFP 1 MB flash –
UPD70F3426AGJ(A)-GAE-QS-AX 144 pin LQFP 2 MB flash VSB flash and RAM
UPD70F3427GD(A)-LML-QS-AX 208 pin QFP 1 MB flash External bus I/F

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 25


Chapter 1 Introduction

www.DataSheet4U.com

26 User’s Manual U17566EE5V1UM00


Chapter 2 Pin Functions

This chapter lists the ports of the microcontroller. It presents the configuration
of the ports for alternative functions. Noise elimination on input signals is
explained and a recommendation for the connection of unused pins is given at
the end of the chapter.

2.1 Overview

The microcontroller offers various pins for input/output functions, so-called


ports. The ports are organized in port groups.
To allocate other than general purpose input/output functions to the pins,
several control registers are provided.
For a description of the terms pin, port or port group, see “Terms“ on page 32.
Features summary • Number of ports and port groups:

Number of ports
Device Number of port groups
I/O ports Input ports
µPD70F3427 101 16 15
all others 98 16 14

• 5V I/O:
Can be used as 3V I/O with degraded electrical parameters. Please refer to
the Data Sheet.
• 24 high-drive ports for direct stepper motor drive.
• Configuration possible for individual pins.
• The following features can be selected for most of the pins:
– One out of two input thresholds
– One out of two input characteristics (Schmitt and non-Schmitt)
– Output current limit
– Open drain emulation
• The following registers are offered for most of the ports:
– Direct register for reading the pin values
– Port register with selectable read source (for improved bit set / bit clear
capabilities)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 27


Chapter 2 Pin Functions

2.1.1 Description

This microcontroller has the port groups shown below.

P00 P70

Port group 0 to to Port group 7


P07 P715

P80
P16
Port group 1 to Port group 8
P17
P87

P20 P90
Port group 2 to to Port group 9
P27 P97

P30 P100
Port group 3 to to Port group 10
P37 P107

P40 P110
Port group 4 to to Port group 11
P47 P117

P50 P120
Port group 5 to to Port group 12
P57 P127

P60 P130
Port group 6 to to Port group 13
P67 P137

P140
to Port group 14
(µPD70F3427 only)
P142

External memory
MEM-I/F interface
(µPD70F3427 only)

Figure 2-1 Port groups

www.DataSheet4U.com

28 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Port group overview Table 2-1 gives an overview of the port groups. For each port group it shows
the supported functions in port mode and in alternative mode. Any port group
can operate in 8-bit or 1-bit units. Port group 7 can additionally operate in
16-bit units.

Table 2-1 Functions of each port group (1/2)


Port Function
group
name Port mode Alternative mode

0 8-bit input/output • External interrupt 0 to 6


• Non maskable interrupt
• N-Wire debug interface reset
• Output state of internal Voltage Comparators 0
and 1
1 2-bit input/output • I2C0 data/clock line
2 8-bit input/output • Timer TMG0 to TMG1 channels
• I2C1 data/clock line
• LCD controller segment signal output
(µPD70F3421, µPD70F3422, µPD70F3423 only)
3 8-bit input/output • UARTA0 transmit/receive data,
• UARTA1 transmit/receive data
• I2C1 data/clock line
• LCD controller segment signal output
(µPD70F3421, µPD70F3422, µPD70F3423 only)
• Timer TMG2 channels
• Timer TMP0 to TMP3 channels
• External memory interface data lines 18, 19
(µPD70F3427 only)
4 8-bit input/output • Clocked Serial Interface CSIB0 data/clock line
• Clocked Serial Interface CSIB1 data/clock line
• External interrupt 6
• LCD controller segment signal output
(µPD70F3421, µPD70F3422, µPD70F3423 only)
• CAN0 transmit/receive data
5 8-bit input/output • External interrupt 7 (µPD70F3424, µPD70F3425,
µPD70F3426A, µPD70F3427 only)
• Sound Generator outputs
• Frequency output
• N-Wire interface signals
• CAN1 transmit/receive data
• UARTA1 transmit/receive data
6 8-bit input/output • Timer TMP0 to TMP3 channels
• Timer TMG2 channels
• LCD controller segment signal output
(µPD70F3421, µPD70F3422, µPD70F3423 only)
• I2C0 data/clock line
www.DataSheet4U.com 7 16-bit input • A/D Converter input
- µPD70F3424, µPD70F3425, µPD70F3426A,
µPD70F3427: 16 channels
- µPD70F3421, µPD70F3422, µPD70F3423: 12
channels

User’s Manual U17566EE5V1UM00 29


Chapter 2 Pin Functions

Table 2-1 Functions of each port group (2/2)


Port Function
group
name Port mode Alternative mode

8 8-bit input/output • Clocked Serial Interface CSIB2 data/clock line


(µPD70F3424, µPD70F3425, µPD70F3426A,
µPD70F3427 only)
• LCD controller segment signal output
(µPD70F3421, µPD70F3422, µPD70F3423 only)
• Timer TMY0 output
• Frequency output
• Inverted frequency output
• External interrupt 7 (µPD70F3424, µPD70F3425,
µPD70F3426A, µPD70F3427 only)
• UARTA0 transmit/receive data
• External memory interface data lines 16, 17
(µPD70F3427 only)
9 8-bit input/output • LCD Bus I/F data lines (µPD70F3424,
µPD70F3425, µPD70F3426A, µPD70F3427 only)
• Clocked Serial Interface CSIB1 data/clock line
• Clocked Serial Interface CSIB2 data/clock line
(µPD70F3424, µPD70F3425, µPD70F3426A,
µPD70F3427 only)
• LCD controller segment/common signal output
(µPD70F3421, µPD70F3422, µPD70F3423 only)
• External memory interface data lines 24 to 31
(µPD70F3427 only)
10 8-bit input/output • Timer TMP0 to TMP3 channels
• LCD Bus I/F read/write strobe
• LCD controller segment signal output
(µPD70F3421, µPD70F3422, µPD70F3423 only)
• Clocked Serial Interface CSIB0 data/clock line
• External memory interface data lines 20 to 23
(µPD70F3427 only)
11 8-bit input/output • Stepper Motor Controller/Driver outputs
• Timer TMG2 channels (µPD70F3424,
µPD70F3425, µPD70F3426A, µPD70F3427 only)
• Sound Generator outputs
12 8-bit input/output • Stepper Motor Controller/Driver outputs
13 8-bit input/output • Stepper Motor Controller/Driver outputs
• Timer TMG0 to TMG1 channels
14 3-bit input/output External memory interface for µPD70F3427 only:
• Bus clock
• Byte enable 2, 3
MEM-I/F – External memory interface (µPD70F3427 only):
• Address lines 0 to 23
• Chip selects 0, 1, 3, 4
www.DataSheet4U.com • Read/write strobe
• Data wait request
• Byte enable 0, 1
• Data lines 0 to 15

30 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Pin configuration To define the function and the electrical characteristics of a pin, several control
registers are provided.
• For a general description of the registers, see “Port Group Configuration
Registers“ on page 33.
• For every port, detailed information on the configuration registers is given in
“Port Group Configuration“ on page 54.
There are three types of control circuits, defined as port types. For a
description of the port types, see “Port Types Diagrams“ on page 49.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 31


Chapter 2 Pin Functions

2.1.2 Terms

In this section, the following terms are used:


• Pin
Denotes the physical pin. Every pin is uniquely denoted by its pin number.
A pin can be used in several modes. Depending on the selected mode, a pin
name is allocated to the pin.
• Port group
Denotes a group of pins. The pins of a port group have a common set of port
mode control registers.
• Port mode / Port
A pin in port mode works as a general purpose input/output pin. It is then
called “port”.
The corresponding name is Pnm. For example, P07 denotes port 7 of port
group 0. It is referenced as “port P07”.
• Alternative mode
In alternative mode, a pin can work in various non-general purpose input/
output functions, for example, as the input/output pin of on-chip peripherals.
The corresponding pin name depends on the selected function. For
example, pin INTP0 denotes the pin for one of the external interrupt inputs.
Note that for example P00 and INTP0 denote the same physical pin. The
different names indicate the function in which the pin is being operated.
• Port type
A control circuit evaluates the settings of the configuration registers. There
are different types of control circuits, called “port types”.

2.1.3 Noise elimination

The input signals at some pins are passing a filter to remove noise and
glitches. The microcontroller supports both analog and digital filters. The
analog filters are always applied to the input signals, whereas the digital filters
can be enabled/disabled by control registers.
See “Noise Elimination“ on page 104 for a detailed description.

www.DataSheet4U.com

32 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

2.2 Port Group Configuration Registers

This section starts with an overview of all configuration registers and then
presents all registers in detail. The configuration registers are classified in the
following groups:
• “Pin function configuration“ on page 34
• “Pin data input/output“ on page 39
• “Configuration of electrical characteristics“ on page 41
• “Alternative input selection“ on page 44

2.2.1 Overview

For the configuration of the individual pins of the port groups, the following
registers are used:

Table 2-2 Registers for port group configuration


Register name Shortcut Function
Port mode register PMn Pin function configuration
Port mode control register PMCn
Port function control register PFCn
Port LCD control register PLCDCn
On-chip debug mode register OCDM
Port register Pn Pin data input/output
Port read control register PRCn
Port pin read register PPRn
Port drive strength control register PDSCn Configuration of electrical
characteristics
Port input characteristic control register PICCn
Port input level control register PILCn
Port open drain control register PODCn
Peripheral function select register PFSR0 to PFSR3 Alternative input selection

n = 0 to 14

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 33


Chapter 2 Pin Functions

2.2.2 Pin function configuration

The registers for pin function configuration define the general function of a pin:
• input mode or output mode
• port mode or alternative mode
• selection of one of the alternative output functions ALT1-OUT/ALT2-OUT
• pin usage for LCD Controller/Driver output LCD_OUT
• normal mode or on-chip debug mode (N-Wire interface)
An overview of the register settings is given in the table below.

Table 2-3 Pin function configuration (overview)


Registers
Function I/O
OCDM PLCDC PMC PFC PM
Port mode (output) X 0 O
0
Port mode (input) X 1 I
Alternative output 1 mode 0 0 0 O
Alternative output 2 mode 0 1 1 0 O
Alternative input mode X 1 I
LCD signal output
1 X X X O
(segment or common signal)
On-chip debug modea 1 X X X X I/O
a) In on-chip debug mode, the corresponding pins are automatically set as input or output pins to
provide the N-Wire interface. In this mode the configuration of these pins can not be changed
by the pin configuration registers.

w w w . D a t a S h e e t 4 U . c o m

34 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

(1) PMn - Port mode register


The 8-bit PMn register specifies whether the individual pins of the port group n
are in input mode or in output mode.
Access This register can be read/written in 8-bit and 1-bit units.
Address see “Port Group Configuration“ on page 54
Initial Value FFH. This register is initialized by any reset.

7 6 5 4 3 2 1 0
PMn7 PMn6 PMn5 PMn4 PMn3 PMn2 PMn1 PMn0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 2-4 PMn register contents


Bit position Bit name Function
7 to 0 PMn[7:0] Specifies input/output mode of the corresponding pin
0: Output mode (output enabled)
1: Input mode (output disabled)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 35


Chapter 2 Pin Functions

(2) PMCn - Port mode control register


The PMCn register specifies whether the individual pins of port group n are in
port mode or in alternative mode.
For port groups with up to eight ports, this is an 8-bit register. For port groups
with up to 16 ports, this is a 16-bit register.
Access This register can be read/written in 8-bit and 1-bit units.
16-bit registers can also be read/written in 16-bit units.
Address see “Port Group Configuration“ on page 54
Initial Value 00H or 0000H. This register is initialized by any reset.

7 6 5 4 3 2 1 0
PMCn7 PMCn6 PMCn5 PMCn4 PMCn3 PMCn2 PMCn1 PMCn0
R/W R/W R/W R/W R/W R/W R/W R/W

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PMCn15 PMCn14 PMCn13 PMCn12 PMCn11 PMCn10 PMCn9 PMCn8 PMCn7 PMCn6 PMCn5 PMCn4 PMCn3 PMCn2 PMCn1 PMCn0
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W

Table 2-5 PMCn register contents


Bit position Bit name Function
7 to 0 PMCn[7:0] Specifies the operation mode of the corresponding pin
or or 0: Port mode
15 to 0 PMC[15:0] 1: Alternative mode

(3) PFCn - Port function control register


If a pin is in alternative mode and serves as an output pin (PMn.PMnm = 0)
some pins offer two output functions ALT1-OUT and ALT2-OUT.
The 8-bit PFCn register specifies which output function of a pin is to be used.
Access This register can be read/written in 8-bit and 1-bit units.
Address see “Port Group Configuration“ on page 54
Initial Value PFC0: 20H

other PFCn: 00H


This register is initialized by any reset.
7 6 5 4 3 2 1 0
PFCn7 PFCn6 PFCn5 PFCn4 PFCn3 PFCn2 PFCn1 PFCn0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 2-6 PFCn register contents


www.DataSheet4U.com Bit position Bit name Function
7 to 0 PFCn[7:0] Specifies the output function of the pin
0: Alternative output mode 1 (ALT1-OUT)
1: Alternative output mode 2 (ALT2-OUT)
See “Port Group Configuration“ on page 54 for a list of
the possible output modes.

36 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

(4) PLCDCn - Port LCD control register


Some port groups comprise pins for signal output of the LCD Controller Driver.
For those port groups, the 8-bit PLCDCn register specifies whether an
individual pin of port group n serves as an output pin of the LCD Controller/
Driver or not.
Access This register can be read/written in 8-bit and 1-bit units.
Address see “Port Group Configuration“ on page 54
Initial Value 00H. This register is initialized by any reset.

7 6 5 4 3 2 1 0
PLCDCn7 PLCDCn6 PLCDCn5 PLCDCn4 PLCDCn3 PLCDCn2 PLCDCn1 PLCDCn0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 2-7 PLCDCn register contents


Bit position Bit name Function
7 to 0 PLCDCn[7:0] Enables LCD function of the pin:
0: Pin is not allocated to the LCD Controller/Driver.
Pin function is specified in PMn, PMCn and PFCn
1: Pin serves as an output pin of the LCD Controller/
Driver. Data is output directly from buffers of the
LCD Controller/Driver. Bit Pn.Pnm is neglected.

Note If PLCDCn.PLCDCnm = 1, the settings of the bits m in registers PMn, PMCn,


and PFCn are neglected.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 37


Chapter 2 Pin Functions

(5) OCDM - On-chip debug mode register


The 8-bit OCDM register specifies whether dedicated pins of the
microcontroller operate in normal operation mode or can be used for on-chip
debugging (N-Wire interface). The setting of this register concerns only those
pins that can be used for the N-Wire interface: P05/DRST, P52/DDI, P53/DDO,
P54/DCK, and P55/DMS.
To make these pins available for on-chip debugging, bit OCDM.OCDM0 must
be set while pin DRST is high. If the on-chip debug mode is selected, the
corresponding pins are automatically set as input or output pins, respectively.
Setting of bits PMn.PMnm is not necessary.
For more details refer to “On-Chip Debug Unit“ on page 969.
Access This register can be read/written in 8-bit and 1-bit units.
Address FFFF F9FCH
Initial Value 00H/01H:
• After Power-On Clear reset, the normal operation mode is selected
(OCDM.OCDM0 = 0).
• After external reset, the dedicated pins are available for on-chip debugging
(OCDM.OCDM0 = 1).
• After any other reset, bit OCDM0 holds the same value as before the reset.
7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 OCDM0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 2-8 OCDM register contents


Bit position Bit name Function
0 OCDM0 Enables/disables N-Wire interface:
0: Pins are used in normal operation mode (port
mode or alternative mode).
1: Pins are used in on-chip debug mode.

Note If the pins P05/DRST, P52/DDI, P53/DDO, P54/DCK, and P55/DMS are used
as N-Wire interface pins their configuration can not be changed by the pin
configuration registers.

www.DataSheet4U.com

38 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

2.2.3 Pin data input/output

If a pin is in port mode, the registers for pin data input/output specify the input
and output data.

(1) Pn - Port register


In port mode (PMCn.PMCnm=0), data is input from or output to an external
device by writing or reading the Pn register.
For port groups with up to eight ports, this is an 8-bit register. For port groups
with up to 16 ports, this is a 16-bit register.
Access This register can be read/written in 8-bit and 1-bit units.
16-bit registers can also be read/written in 16-bit units.
Address see “Port Group Configuration“ on page 54
Initial Value 00H or 0000H. This register is cleared by any reset.

Note After reset, the ports are in input mode (PMn.PMnm = 1). The read input value
is determined by the port pins.

7 6 5 4 3 2 1 0
Pn7 Pn6 Pn5 Pn4 Pn3 Pn2 Pn1 Pn0
R/W R/W R/W R/W R/W R/W R/W R/W

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Pn15 Pn14 Pn13 Pn12 Pn11 Pn10 Pn9 Pn8 Pn7 Pn6 Pn5 Pn4 Pn3 Pn2 Pn1 Pn0
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W

Table 2-9 Pn register contents


Bit position Bit name Function
7 to 0 Pn[7:0] Data, see Table 2-10 for details.
or or
15 to 0 Pn[15:0]

Note The value written to register Pn is retained until a new value is written to
register Pn.

Data is written to or read from the Pn register as follows:

Table 2-10 Writing/reading register Pn


Function PRC PM I/O
Write to Pn
X 0 O
and output contents of Pn to pins
Write to Pn
X 1 I
without affecting the pin status
w w w . D a t a S h e e t 4 U . c o m
Read from Pn
0 1 I
and thus read the pin status
Read from Pn X 0 O
and disregard the pin status
1 1 I

User’s Manual U17566EE5V1UM00 39


Chapter 2 Pin Functions

(2) PRCn - Port read control register


In input mode (PMn.PMnm = 1), the 8-bit PRCn register specifies whether the
pin status or the contents of register Pn are read (see also Table 2-10). Each
PRCn register contains only one control bit which defines the read source of all
ports of the entire port group n.
Access This register can be read/written in 8-bit and 1-bit units.
Address see “Port Group Configuration“ on page 54
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
X X X X X X X PRCn0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 2-11 PRCn register contents


Bit position Bit name Function
0 PRCn0 Specifies which data are to be read in port group n:
0: Pin status is read
1: Contents of Pn are read

Note If PMn.PMnm = 0, the contents of Pn are read in any case - independent of


PRCn.PRCnm.

(3) PPRn - Port pin read register


The 8-bit PPRn register reflects the actual pin value, independent of the control
registers set-up.
Access This register is read-only, in 8-bit and 1-bit units.
16-bit registers can also be read in 16-bit units.
Address see “Port Group Configuration“ on page 54
Initial Value 00H or 0000H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
PPRn7 PPRn6 PPRn5 PPRn4 PPRn3 PPRn2 PPRn1 PPRn0
R R R R R R R R

Table 2-12 PPRn register contents


Bit position Bit name Function
7 to 0 PPRn[7:0] Actual pin value

www.DataSheet4U.com

40 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

2.2.4 Configuration of electrical characteristics

The registers for the configuration of electrical characteristics are briefly


described in the following. For details refer to the Data Sheet.

(1) PDSCn - Port drive strength control register


The 8-bit PDSCn register selects the output current limiting function for high- or
low-drive strength.
Access This register can be read/written, in 8-bit and 1-bit units.
Address see “Port Group Configuration“ on page 54
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
PDSCn7 PDSCn6 PDSCn5 PDSCn4 PDSCn3 PDSCn2 PDSCn1 PDSCn0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 2-13 PDSCn register contents


Bit position Bit name Function
7 to 0 PDSCn[7:0] Specifies output current limiting function:
0: Limit 1.
1: Limit 2.

For the detailed specification of "Limit 1" and "Limit 2" refer to the Data Sheet.

(2) PICCn - Port input characteristic control register


The 8-bit PICCn register selects between Schmitt Trigger or non-Schmitt
Trigger input characteristics.
Access This register can be read/written in 8-bit and 1-bit units.
Address see “Port Group Configuration“ on page 54
Initial Value FFH. This register is cleared by any reset.

7 6 5 4 3 2 1 0
PICCn7 PICCn6 PICCn5 PICCn4 PICCn3 PICCn2 PICCn1 PICCn0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 2-14 PICCn register contents


Bit position Bit name Function
7 to 0 PICCn[7:0] Specifies Trigger input characteristics:
0: non-Schmitt Trigger
1: Schmitt Trigger

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 41


Chapter 2 Pin Functions

(3) PILCn - Port input level control register


The PILCn register selects between different input characteristics for Schmitt
Trigger (PICCn.PICCnm = 1) and non-Schmitt Trigger (PICCn.PICCnm = 0).
For port groups with up to eight ports, this is an 8-bit register. For port groups
with up to 16 ports, this is a 16-bit register.
Access This register can be read/written in 8-bit and 1-bit units.
16-bit registers can also be read/written in 16-bit units.
Address see “Port Group Configuration“ on page 54
Initial Value 00H
This register is initialized by any reset.
7 6 5 4 3 2 1 0
PILCn7 PILCn6 PILCn5 PILCn4 PILCn3 PILCn2 PILCn1 PILCn0
R/W R/W R/W R/W R/W R/W R/W R/W

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PILCn1 PILCn1 PILCn1 PILCn1 PILCn1 PILCn1
PILCn9 PILCn8 PILCn7 PILCn6 PILCn5 PILCn4 PILCn3 PILCn2 PILCn1 PILCn0
5 4 3 2 1 0
R R R R R R R R R R R R R R R R

Table 2-15 PILCn register contents


Bit position Bit name Function
7 to 0 PILCn[7:0] Selects the input level:
or or for Schmitt Trigger (PICCn.PICCnm = 1):
15 to 0 PILC[15:0] 0: Schmitt 1
1: Schmitt 2
for non-Schmitt Trigger (PICCn.PICCnm = 0):
0: CMOS1
1: CMOS2

www.DataSheet4U.com

42 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

(4) PODCn - Port open drain control register


The PODCn register selects the output buffer function as push-pull or open-
drain emulation.
Access This register can be read/written in 8-bit and 1-bit units.
Address see “Port Group Configuration“ on page 54
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
PODCn7 PODCn6 PODCn5 PODCn4 PODCn3 PODCn2 PODCn1 PODCn0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 2-16 PODCn register contents


Bit position Bit name Function
7 to 0 PODCn[7:0] Specifies the output buffer function:
0: push-pull
1: open drain emulation output mode

If open drain emulation is enabled the output function of concerned pin is


automatically enabled as well, independently of the PMn.PMnm setting.

Caution Depending on the capacitive load applied to an output pin Pnm (PMnm = 0) in
open-drain emulation (PODCnm = 1) a change from low to high level may take
a remarkable rise time.
Hence a read of the port pin status
• via the PPRn register or
• Pn register with PRCn = 0 (pin status read)
immediately after setting Pnm to high level may still return low level at Pnm.
Particular attention is needed when a read-modify-write instruction (SET1,
CLR1, NOT1) is executed after setting Pnm = 1 (with PRCn0 = 0) to
manipulate another port pin of the same port group n during the rise time of the
Pnm output.
In this case the read of Pnm may show 0 (though it should be 1) and the 0 is
written back to Pnm at the end of the read-modify-write instruction.
Consequently Pnm may never reach high level at the output pin.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 43


Chapter 2 Pin Functions

2.2.5 Alternative input selection

Alternative input functions of CSIB0…CSIB2, UART0…UART1, I2C0, I2C1,


INTP6, INTP7, TMP0…TMP3 and TMG0…TMG2 are provided on two pins
each. Thus you can select on which pin the alternative function should appear.
For this purpose, four peripheral function select registers PFSRk (k = 0 to 3)
are provided.

Note The selection of the alternative input function is done by a different circuit than
the selection of the alternative output function. Therefore, the registers for
selecting the alternative input functions (PFSR) are not reflected in the block
diagrams of the port types in chapter “Port Types Diagrams“ on page 49.

www.DataSheet4U.com

44 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

(1) PFSR0 - Peripheral function select register


The 8-bit PFSR0 register selects the alternative input paths for the peripheral
functions CSIB0…2, I2C0, I2C1, INTP6 and INTP7.
Access This register can be read/written in 8-bit units.
Address FFFF F720H
Initial Value 01H. This register is initialized by any reset.

7 6 5 4 3 2 1 0
a
PFSR07 PFSR06 PFSR05 PFSR04 0 PFSR02 PFSR01 PFSR00
R/W R/W R/W R/W R R/W R/W R/W
a)
This bit may be written, but write is ignored.

Table 2-17 PFSR0 register contents


Bit position Bit name Function
7 PFSR07 Specifies the alternative input path for INTP7:
0: INTP7 is input from P50 (INTP7_0)
1: INTP7 is input from P84 (INTP7_1)
6 PFSR06 Specifies the alternative input path for INTP6:
0: INTP6 is input from P07 (INTP6_0)
1: INTP6 is input from P40 (INTP6_1)
5 PFSR05 Specifies the alternative input path for I2C1:
0: SCL1 is input from P21 (SCL1_0)
SDA1 is input from P20 (SDA1_0)
1: SCL1 is input from P31 (SCL1_1)
SDA1 is input from P30 (SDA1_1)
4 PFSR04 Specifies the alternative input path for I2C0:
0: SCL0 is input from P17 (SCL0_0)
SDA0 is input from P16 (SDA0_0)
1: SCL0 is input from P64 (SCL0_1)
SDA0 is input from P65 (SDA0_1)
2 PFSR02 Specifies the alternative input path for CSIB2:
0: SCKB2 is input from P82 (SCKB2_0)
SIB2 is input from P80 (SIB2_0)
1: SCKB2 is input from P96 (SCKB2_1)
SIB2 is input from P94 (SIB2_1)
1 PFSR01 Specifies the alternative input path for CSIB1:
0: SCKB1 is input from P45 (SCKB1_0)
SIB1 is input from P43 (SIB1_0)
1: SCKB1 is input from P92 (SCKB1_1)
SIB1 is input from P90 (SIB1_1)
0 PFSR00 Specifies the alternative input path for CSIB0:
0: SCKB0 is input from P42 (SCKB0_0)
SIB0 is input from P40 (SIB0_0)
1: SCKB0 is input from P107 (SCKB0_1)
SIB0 is input from P105 (SIB0_1)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 45


Chapter 2 Pin Functions

(2) PFSR1 - Peripheral function select register


The 8-bit PFSR1 register selects the alternative input paths for the peripheral
functions TMP0…3.
Access This register can be read/written in 8-bit units.
Address FFFF F722H
Initial Value 01H. This register is initialized by any reset.

7 6 5 4 3 2 1 0
PFSR17 PFSR16 PFSR15 PFSR14 PFSR13 PFSR12 PFSR11 PFSR10
R/W R/W R/W R/W R/W R/W R/W R/W

Table 2-18 PFSR1 register contents


Bit position Bit name Function
7 PFSR17 Specifies the alternative input path for timer channel 1
of TMP3:
0: TIP31 is input from P67 (TIP31_0)
1: TIP31 is input from P102 (TIP31_1)
6 PFSR16 Specifies the alternative input path for timer channel 0
of TMP3:
0: TIP30 is input from P65 (TIP30_0)
1: TIP30 is input from P103 (TIP30_1)
5 PFSR15 Specifies the alternative input path for timer channel 1
of TMP2:
0: TIP21 is input from P66 (TIP21_0)
1: TIP21 is input from P103 (TIP21_1)
4 PFSR14 Specifies the alternative input path for timer channel 0
of TMP2:
0: TIP20 is input from P64 (TIP20_0)
1: TIP20 is input from P102 (TIP20_1)
3 PFSR13 Specifies the alternative input path for timer channel 1
of TMP1:
0: TIP11 is input from P63 (TIP11_0)
1: TIP11 is input from P100 (TIP11_1)
2 PFSR12 Specifies the alternative input path for timer channel 0
of TMP1:
0: TIP10 is input from P62 (TIP10_0)
1: TIP10 is input from P101 (TIP10_1)
1 PFSR11 Specifies the alternative input path for timer channel 1
of TMP0:
0: TIP01 is input from P61 (TIP01_0)
1: TIP01 is input from P101 (TIP01_1)
0 PFSR10 Specifies the alternative input path for timer channel 0
of TMP0:
0: TIP00 is input from P60 (TIP00_0)
1: TIP00 is input from P100 (TIP00_1)

www.DataSheet4U.com

46 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

(3) PFSR2 - Peripheral function select register


The 8-bit PFSR2 register selects the alternative input paths for the peripheral
functions TMG0 and TMG1.
Access This register can be read/written in 8-bit units.
Address FFFF F724H
Initial Value 01H. This register is initialized by any reset.

7 6 5 4 3 2 1 0
PFSR27 PFSR26 PFSR25 PFSR24 PFSR23 PFSR22 PFSR21 PFSR20
R/W R/W R/W R/W R/W R/W R/W R/W

Table 2-19 PFSR2 register contents


Bit position Bit name Function
7 PFSR27 Specifies the alternative input path for timer channel 4
of TMG1:
0: TIG14 is input from P27 (TIG14_0)
1: TIG14 is input from P137 (TIG14_1)
6 PFSR26 Specifies the alternative input path for timer channel 2
of TMG1:
0: TIG13 is input from P26 (TIG13_0)
1: TIG13 is input from P136 (TIG13_1)
5 PFSR25 Specifies the alternative input path for timer channel 2
of TMG1:
0: TIG12 is input from P25 (TIG12_0)
1: TIG12 is input from P135 (TIG12_1)
4 PFSR24 Specifies the alternative input path for timer channel 1
of TMG1:
0: TIG11 is input from P24 (TIG11_0)
1: TIG11 is input from P134 (TIG11_1)
3 PFSR23 Specifies the alternative input path for timer channel 4
of TMG0:
0: TIG04 is input from P23 (TIG04_0)
1: TIG04 is input from P133 (TIG04_1)
2 PFSR22 Specifies the alternative input path for timer channel 3
of TMG0:
0: TIG03 is input from P22 (TIG03_0)
1: TIG03 is input from P132 (TIG03_1)
1 PFSR21 Specifies the alternative input path for timer channel 2
of TMG0:
0: TIG02 is input from P21 (TIG02_0)
1: TIG02 is input from P131 (TIG02_1)
0 PFSR20 Specifies the alternative input path for timer channel 1
of TMG0:
0: TIG01 is input from P20 (TIG01_0)
1: TIG01 is input from P130 (TIG01_1)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 47


Chapter 2 Pin Functions

(4) PFSR3 - Peripheral function select register


The 8-bit PFSR3 register selects the alternative input paths for the peripheral
functions TMG2, UARTA0 and UARTA1.
Access This register can be read/written in 8-bit units.
Address FFFF F726H
Initial Value 01H. This register is initialized by any reset.

7 6 5 4 3 2 1 0
0 0 PFSR35 PFSR34 PFSR33 PFSR32 PFSR31 PFSR30
Ra Ra R/W R/W R/W R/W R/W R/W
a) These bits may be written, but write is ignored.

Table 2-20 PFSR3 register contents


Bit position Bit name Function
5 PFSR35 Specifies the alternative input path for UARTA1:
0: RXDA1 is input from P33 (RXDA1_0)
1: RXDA1 is input from P56 (RXDA1_1)
4 PFSR34 Specifies the alternative input path for UARTA0:
0: RXDA0 is input from P31 (RXDA0_0)
1: RXDA0 is input from P87 (RXDA0_1)
3 PFSR33 Specifies the alternative input path for timer channel 4
of TMG2:
0: TIG24 is input from P37 (TIG24_0)
1: TIG24 is input from P63 (TIG24_1)
2 PFSR32 Specifies the alternative input path for timer channel 3
of TMG2:
0: TIG23 is input from P36 (TIG23_0)
1: TIG23 is input from P67 (TIG23_1)
1 PFSR31 Specifies the alternative input path for timer channel 2
of TMG2:
0: TIG22 is input from P35 (TIG22_0)
1: TIG22 is input from P66 (TIG22_1)
0 PFSR30 Specifies the alternative input path for timer channel 1
of TMG2:
0: TIG21 is input from P34 (TIG21_0)
1: TIG21 is input from P61 (TIG21_1)

www.DataSheet4U.com

48 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

2.3 Port Types Diagrams

The control circuits that evaluate the settings of the configuration registers are
of different types. This chapter presents the block diagrams of all port types.

(1) Port type M

Note 4

PDSCnm

Note 5

PICCnm

Note 6

PILCnm

PMCnm

PMnm

PODCnm
Note 3

PFCnm
ENABLE

ALT1-OUT 0
1 Pnm
ALT2-OUT 1

Pnm 0
1
0 ENABLE
0
1
PRD

PRCn0

internal
RESET

PPRRD
Note 1

ALT-IN Analog Filter

www.DataSheet4U.com Note 2

PLCDCnm LCDBUFEN

Figure 2-2 Block diagram: port type M

User’s Manual U17566EE5V1UM00 49


Chapter 2 Pin Functions

Note 1. The analog filter is provided only for alternative external interrupt ports
P00–04, P06, P07, P40.
The µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427 provides
analog filters additionally at P50 and P84.
2. Bit PLCDCn.PLCDCnm is only provided with µPD70F3421, µPD70F3422
and µPD70F3423 for pins with an alternative function as LCD Controller/
Driver output ports P20–27, P32–37, P43–45, P60–67, P80–83, P85–87,
P90–97, P104–107.
3. The PFCn register is available only for port groups P0, P3, P5, P6, P13.
4. The PDSCn register is not available for port groups 11, 12, 13 and 14.
The bits PDSC3[3:2], PDSC8[7:6], PDSC10[7:4] are not available for
µPD70F3427.
5. The bits PICC3[3:2], PICC8[7:6], PICC10[7:4] are not available for
µPD70F3427.
6. The bits PILC3[3:2], PILC8[7:6], PILC10[7:4] are not available for
µPD70F3427.

www.DataSheet4U.com

50 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

(2) Port type Q

Note 1

PDSCnm

Note 2

PICCnm

Note 3

PILCnm

PMCnm

PMnm

PODCnm

PFCnm

ENABLE
ALT1-OUT 0
1 Pnm
ALT2-OUT 1

Pnm 0
1
0 ENABLE
0
1
PRD

PRCn0

internal
RESET

PPRRD

LCD Bus LCD Bus


I/F read I/F write

Figure 2-3 Block diagram: port type Q

Note 1. The PDSC9 register is not available for µPD70F3427.


www.DataSheet4U.com
2. The PICC9 register is not available for µPD70F3427.
3. The PILC9 register is not available for µPD70F3427.

User’s Manual U17566EE5V1UM00 51


Chapter 2 Pin Functions

(3) Port type R


This port type holds for pins that can be used for on-chip debugging with the
N-Wire interface.

PDSCnm

PICCnm

PILCnm

OCDM

PMnm

PODCnm

PFCnm

ENABLE
DDO 1 Pnm

Pnm 0
1
0 ENABLE
0
1
PRD

PRCn0

internal
RESET
1 0
PFC0.PDC05
PPRRD

DDI, DMS, DCK, DRST

Figure 2-4
www.DataSheet4U.com Block diagram: port type R

Note If OCDM.OCDM0 = 1, the corresponding pins are operating in on-chip debug


mode. The pins are automatically set as input or output pins, respectively.
Setting of bits PMn.PMnm is not necessary.
For more details refer to “On-Chip Debug Unit“ on page 969.

52 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

(4) Port type B


This port type holds for pins that only work in input mode. Pins of port type B
are used for the corresponding alternative input function A/D converter input.
At the same time, the pin status can also be read via the port register Pn, so
that the pin also works in port function.

PILCnm

PMCnm
AIN select
Pnm
ADC input

PRD

Figure 2-5 Block diagram: port type B

A/D conversion of the level at Pnm is independent of any register settings. For
reading the pin status via the Pn register PMCnm has to be set to 0.
Since the accuracy of an A/D conversion may degrade when Pn is read during
the sampling time of the A/D converter, it is recommended to disable the port
pin read by PMCnm = 1 during A/D conversion.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 53


Chapter 2 Pin Functions

2.4 Port Group Configuration

This section provides an overview of the port groups (Table 2-21, Table 2-22)
and of the pin functions (Table 2-23 on page 62). In Table 2-73 on page 108 it
is listed how the pin functions change if the microcontroller is reset or if it is in
one of the standby modes.
In the subsections, for every port group the settings of the configuration
registers is listed. Further, the addresses and initial values of the configuration
registers are given. See “Port group 0“ on page 69 to “Port group 13“ on
page 93.

www.DataSheet4U.com

54 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

2.4.1 Port group configuration lists

Following tables provide overviews of the functions available at each port pin:
• Table 2-21 for µPD70F3421, µPD70F3422, µPD70F3423
• Table 2-22 for µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427

Table 2-21 Port group list for µPD70F3421, µPD70F3422, µPD70F3423 (1/4)
Alternative outputs
Port group Alternative Port
Port name ALT1_OUT/ALT2_OUT/
name inputs type
LCD_OUT
P00 – INTP0/NMI M
P01 – INTP1 M
P02 – INTP2 M
P03 – INTP3 M
0
P04 – INTP4 M
P05 – DRST R
P06 – INTP5 M
P07 VCMPO0/VCMPO1 INTP6 M
P16 SDA0/CTXD2 SDA0 M
1
P17 SCL0 SCL0/CRXD2 M
P20 SDA1/TOG01/SEG0 TIG01/SDA1 M
P21 SCL1/TOG02/SEG1 TIG02/SCL1 M
P22 TOG03/SEG2 TIG03 M
P23 TOG04/SEG3 TIG04 M
2
P24 TOG11/SEG4 TIG11 M
P25 TOG12/SEG5 TIG12 M
P26 TOG13/SEG6 TIG13 M
P27 TOG14/SEG7 TIG14 M
P30 TXDA0/SDA1 SDA1 M
P31 SCL1 RXDA0/SCL1 M
P32 TXDA1/SEG31 – M
P33 SEG29 RXDA1 M
3
P34 TOP01/TOG21/SEG8 TIG21 M
P35 TOP21/TOG22/SEG9 TIG22 M
P36 TOP31/TOG23/SEG10 TIG23 M
P37 TOP11/TOG24/SEG11 TIG24 M
P40 – SIB0/INTP6 M
P41 SOB0 – M
P42 SCKB0 SCKB0 M

www.DataSheet4U.com P43 SEG22 SIB1 M


4
P44 SOB1/SEG21 – M
P45 SCKB1/SEG20 SCKB1 M
P46 – CRXD0 M
P47 CTXD0 – M

User’s Manual U17566EE5V1UM00 55


Chapter 2 Pin Functions

Table 2-21 Port group list for µPD70F3421, µPD70F3422, µPD70F3423 (2/4)
Alternative outputs
Port group Alternative Port
Port name ALT1_OUT/ALT2_OUT/
name inputs type
LCD_OUT
P50 FOUT/SGOA – M
P51 SGO – M
P52 – DDI R
P53 DDO – R
5
P54 – DCK R
P55 – DMS R
P56 – RXDA1/CRXD1 M
P57 TXDA1/CTXD1 – M
P60 TOP00/SEG12 TIP00/TIG20 M
P61 TOP01/TOG21/SEG13 TIP01/TIG21 M
P62 TOP10/SEG14 TIP10/TIG25 M
P63 TOP11/TOG24/SEG15 TIP11/TIG24 M
6
P64 SCL0/TOP20/SEG16 TIP20/SCL0 M
P65 SDA0/TOP30/SEG17 TIP30/SDA0 M
P66 TOP21/TOG22/SEG18 TIP21/TIG22 M
P67 TOP31/TOG23/SEG19 TIP31/TIG23 M
P70 – ANI0 B
P71 – ANI1 B
P72 – ANI2 B
P73 – ANI3 B
P74 – ANI4 B
P75 – ANI5 B
P76 – ANI6 B
P77 – ANI7 B
7
P78 – ANI8 B
P79 – ANI9 B
P710 – ANI10 B
P711 – ANI11 B
P712 – – B
P713 – – B
P714 – – B
P715 – – B
P80 SEG26 – M
P81 SEG25 – M
P82 SEG24 – M
www.DataSheet4U.com
P83 TOY0/FOUT/SEG23 – M
8
P84 TOY0 – M
P85 FOUT/SEG27 – M
P86 TXDA0/SEG30 – M
P87 SEG28 RXDA0 M

56 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Table 2-21 Port group list for µPD70F3421, µPD70F3422, µPD70F3423 (3/4)
Alternative outputs
Port group Alternative Port
Port name ALT1_OUT/ALT2_OUT/
name inputs type
LCD_OUT
P90 DBD0/SEG36 DBD0/SIB1 Q
P91 DBD1/SEG37/SOB1 DBD1 Q
P92 DBD2/SEG38/SCKB1 DBD2/SCKB1 Q
P93 DBD3/SEG39 DBD3 Q
9
P94 DBD4/COM0 DBD4 Q
P95 DBD5/COM1 DBD5 Q
P96 DBD6/COM2 DBD6 Q
P97 DBD7/COM3 DBD7 Q
P100 TOP00/TOP11 TIP00/TIP11 M
P101 TOP01/TOP10 TIP01/TIP10 M
P102 TOP20/TOP31 TIP20/TIP31 M
P103 TOP21/TOP30 TIP21/TIP30 M
10
P104 DBRD/SEG35 – M
P105 DBWR/SEG34 SIB0 M
P106 SOB0/SEG33 – M
P107 SCKB0/SEG32 SCKB0 M
P110 SM11/TOG21 – M
P111 SM12/TOG22 – M
P112 SM13/TOG23 – M
P113 SM14/TOG24 – M
11
P114 SM21/SGO – M
P115 SM22/SGOA – M
P116 SM23 – M
P117 SM24 – M
Note: Port group 11 is equipped with high drive buffers for stepper motor control.
P120 SM51 – M
P121 SM52 – M
P122 SM53 – M
P123 SM54 – M
12
P124 SM61 – M
P125 SM62 – M
P126 SM63 – M
P127 SM64 – M
Note: Port group 12 is equipped with high drive buffers for stepper motor control.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 57


Chapter 2 Pin Functions

Table 2-21 Port group list for µPD70F3421, µPD70F3422, µPD70F3423 (4/4)
Alternative outputs
Port group Alternative Port
Port name ALT1_OUT/ALT2_OUT/
name inputs type
LCD_OUT
P130 SM31/TOG01 TIG01 M
P131 SM32/TOG02 TIG02 M
P132 SM33/TOG03 TIG03 M
P133 SM34/TOG04 TIG04 M
13
P134 SM41/TOG11 TIG11 M
P135 SM42/TOG12 TIG12 M
P136 SM43/TOG13 TIG13 M
P137 SM44/TOG14 TIG14 M
Note: Port group 13 is equipped with high drive buffers for stepper motor control.

Table 2-22 Port group list for µPD70F3424, µPD70F3425, µPD70F3426A,


µPD70F3427 (1/4)
Port group Alternative outputs Alternative Port
Port name
name ALT1_OUT/ALT2_OUT inputs type
P00 – INTP0/NMI M
P01 – INTP1 M
P02 – INTP2 M
P03 – INTP3 M
0
P04 – INTP4 M
P05 – DRST R
P06 – INTP5 M
P07 VCMPO0/VCMPO1 INTP6 M
a
P16 SDA0/CTXD2 SDA0 M
1
P17 SCL0 SCL0/CRXD2a M
P20 SDA1/TOG01 TIG01/SDA1 M
P21 SCL1/TOG02 TIG02/SCL1 M
P22 TOG03 TIG03 M
P23 TOG04 TIG04 M
2
P24 TOG11 TIG11 M
P25 TOG12 TIG12 M
P26 TOG13 TIG13 M
P27 TOG14 TIG14 M
P30 TXDA0/SDA1 SDA1 M
P31 SCL1 RXDA0/SCL1 M
P32 TXDA1/D18b D18b M
www.DataSheet4U.com P33 D19b RXDA1/D19b M
3
P34 TOP01/TOG21 TIG21 M
P35 TOP21/TOG22 TIG22 M
P36 TOP31/TOG23 TIG23 M
P37 TOP11/TOG24 TIG24 M

58 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Table 2-22 Port group list for µPD70F3424, µPD70F3425, µPD70F3426A,


µPD70F3427 (2/4)
Port group Alternative outputs Alternative Port
Port name
name ALT1_OUT/ALT2_OUT inputs type
P40 – SIB0/INTP6 M
P41 SOB0 – M
P42 SCKB0 SCKB0 M
P43 – SIB1 M
4
P44 SOB1 – M
P45 SCKB1 SCKB1 M
P46 – CRXD0 M
P47 CTXD0 – M
P50 FOUT/SGOA INTP7 M
P51 SGO – M
P52 – DDI R
P53 DDO – R
5
P54 – DCK R
P55 – DMS R
P56 – RXDA1/CRXD1 M
P57 TXDA1/CTXD1 – M
P60 TOP00 TIP00/TIG20 M
P61 TOP01/TOG21 TIP01/TIG21 M
P62 TOP10 TIP10/TIG25 M
P63 TOP11/TOG24 TIP11/TIG24 M
6
P64 SCL0/TOP20 TIP20/SCL0 M
P65 SDA0/TOP30 TIP30/SDA0 M
P66 TOP21/TOG22 TIP21/TIG22 M
P67 TOP31/TOG23 TIP31/TIG23 M
P70 – ANI0 B
P71 – ANI1 B
P72 – ANI2 B
P73 – ANI3 B
P74 – ANI4 B
P75 – ANI5 B
P76 – ANI6 B
P77 – ANI7 B
7
P78 – ANI8 B
P79 – ANI9 B
P710 – ANI10 B
www.DataSheet4U.com
P711 – ANI11 B
P712 – ANI12 B
P713 – ANI13 B
P714 – ANI14 B
P715 – ANI15 B

User’s Manual U17566EE5V1UM00 59


Chapter 2 Pin Functions

Table 2-22 Port group list for µPD70F3424, µPD70F3425, µPD70F3426A,


µPD70F3427 (3/4)
Port group Alternative outputs Alternative Port
Port name
name ALT1_OUT/ALT2_OUT inputs type
P80 – SIB2 M
P81 SOB2 – M
P82 SCKB2 SCKB2 M
P83 TOY0/FOUT – M
8
P84 TOY0 INTP7 M
P85 FOUT – M
P86 TXDA0/D16b D16 b
M
P87 D17b RXDA0/D17b M
P90 DBD0/D24b DBD0/SIB1/
Q
D24b
P91 DBD1/SOB1/D25b DBD1/D25b Q
b
P92 DBD2/SCKB1/D26 DBD2/SCKB1/
Q
D26b
P93 DBD3/D27b DBD3/D27b Q
9
P94 DBD4/D28b DBD4/SIB2/
Q
D28b
P95 DBD5/SOB2/D29b DBD5/D29b Q
P96 DBD6/SCKB2/D30b DBD6/SCKB2/
Q
D30b
P97 DBD7/D31b DBD7/D31b Q
P100 TOP00/TOP11 TIP00/TIP11 M
P101 TOP01/TOP10 TIP01/TIP10 M
P102 TOP20/TOP31 TIP20/TIP31 M
P103 TOP21/TOP30 TIP21/TIP30 M
10
P104 DBRD/D20b D20b M
P105 DBWR/D21b SIB0/D21b M
b
P106 SOB0/D22 D22b M
P107 SCKB0/D23b SCKB0/D23b M
P110 SM11/TOG21 – M
P111 SM12/TOG22 – M
P112 SM13/TOG23 – M
P113 SM14/TOG24 – M
11
P114 SM21/SGO – M
P115 SM22/SGOA – M
P116 SM23 – M
P117 SM24 – M
www.DataSheet4U.com Note: Port group 11 is equipped with high drive buffers for stepper motor control.

60 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Table 2-22 Port group list for µPD70F3424, µPD70F3425, µPD70F3426A,


µPD70F3427 (4/4)
Port group Alternative outputs Alternative Port
Port name
name ALT1_OUT/ALT2_OUT inputs type
P120 SM51 – M
P121 SM52 – M
P122 SM53 – M
P123 SM54 – M
12
P124 SM61 – M
P125 SM62 – M
P126 SM63 – M
P127 SM64 – M
Note: Port group 12 is equipped with high drive buffers for stepper motor control.
P130 SM31/TOG01 TIG01 M
P131 SM32/TOG02 TIG02 M
P132 SM33/TOG03 TIG03 M
P133 SM34/TOG04 TIG04 M
13
P134 SM41/TOG11 TIG11 M
P135 SM42/TOG12 TIG12 M
P136 SM43/TOG13 TIG13 M
P137 SM44/TOG14 TIG14 M
Note: Port group 13 is equipped with high drive buffers for stepper motor control.
P140 BCLK – M
14b P141 BE2 – M
P142 BE3 – M
– A[23:0] –
– CS0, CS1, CS3, CS4 –
– WR –
MEM-I/Fb – RD –
– BE0, BE1 –
– D[15:0] –
– WAIT –
a) not available on µPD70F3426A
b) µPD70F3427 only

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 61


Chapter 2 Pin Functions

2.4.2 Alphabetic pin function list

Table 2-23 provides a list of all pin function names in alphabetic order.

Table 2-23 Alphabetic pin functions list (1/6)


Port

Pin name I/O Pin function µPD70F3421, µPD70F3424, µPD70F3426A µPD70F3427


µPD70F3422, µPD70F3425
µPD70F3423
A0 to A23 External memory interface – no ports
O
address lines 0 to 23
ANI0 to ANI11 A/D Converter input 0 to P70 to P711
I
11
ANI12 to A/D Converter input 12 to – P712 to P715
I
ANI15 15
AVDD – ADC supply voltage no ports
AVREF ADC reference voltage no ports

input
AVSS – ADC ground no ports
BE0, BE1 External memory interface – no ports
O
byte enable signals 0, 1
BE2 External memory interface – P141
O
byte enable signal 2
BE3 External memory interface – P142
O
byte enable signal 3
BCLK External memory interface – P140
O clock signal (µPD70F3427
only)
BVDD50, I/O buffer supply voltage no ports

BVDD51
BVSS50, I/O buffer supply ground no ports

BVSS51
COM0 to LCD common lines 0 to 3 P94 to P97 –
O
COM3
CRXD0 I CAN0 receive data P46
CRXD1 I CAN1 receive data P56
CRXD2 I CAN2 receive data P17 – P17
CS0, CS1, O External memory interface – no ports
CS3, CS4 chip select signals)
CTXD0 O CAN0 transmit data P47
CTXD1 O CAN1 transmit data P57
CTXD2 O CAN2 transmit data P16 – P16
D0 to D15 I/O External memory interface – no ports
data lines 0 to 15
www.DataSheet4U.com

62 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Table 2-23 Alphabetic pin functions list (2/6)


Port

Pin name I/O Pin function µPD70F3421, µPD70F3424, µPD70F3426A µPD70F3427


µPD70F3422, µPD70F3425
µPD70F3423
D16 I/O External memory interface – P86
data lines 16 to 31
D17 P87
D18 P32
D19 P33
D20 to D23 P104 to P107
D24 to D31 P90 to P97
DBD0 to I/O LCD Bus I/F data lines 0 to P90 to P97
DBD7 7
DBRD O LCD Bus I/F read strobe P104
DBWR O LCD Bus I/F write strobe P105
DCK I N-Wire interface clock P54
DDI I N-Wire interface debug P52
data input
DDO O N-Wire interface debug P53
data output
DMS I N-Wire interface debug P55
mode select input
DRST I N-Wire debug interface P05
reset
DVDD50 – LCD Bus I/F supply no ports
voltage
DVSS50 – LCD Bus I/F supply ground no ports
DVDD51 – LCD Bus I/F, D[31:16] – no ports
ports supply voltage
DVSS51 – LCD Bus I/F, D[31:16] – no ports
ports supply ground
FLMD0 I Primary operating mode no port
select pin
FLMD1 I Secondary operating P07
mode select pin
FOUT O Frequency output P50, P85
FOUT O Inverted frequency output P83
INTP0 to I External interrupts 0 to 6 P00 to P04
INTP4
INTP5 I External interrupts 5 P06
INTP6 I External interrupts 5 P07, P40
INTP7 I External interrupt 7 – P50, P84
MVDD50 -
www.DataSheet4U.com – External memory interface – no ports
MVDD54 supply voltage
MVSS50 - – External memory interface – no ports
MVSS54 supply ground
NMI I Non-maskable interrupt P00

User’s Manual U17566EE5V1UM00 63


Chapter 2 Pin Functions

Table 2-23 Alphabetic pin functions list (3/6)


Port

Pin name I/O Pin function µPD70F3421, µPD70F3424, µPD70F3426A µPD70F3427


µPD70F3422, µPD70F3425
µPD70F3423
RD O External memory interface – no ports
read strobe
REGC0 to – External capacitor no ports
REGC2 connection
RESET I Reset input no ports
RXDA0 I UARTA0 receive data P31, P87
RXDA1 I UARTA1 receive data P33, P56
SCKB0 I/O Clocked Serial Interface P42, P107
CSIB0 clock line
SCKB1 I/O Clocked Serial Interface P45, P92
CSIB1 clock line
SCKB2 I/O Clocked Serial Interface – P82, P96
CSIB2 clock line
SCL0 I/O I2C0 clock line P17, P64
SCL1 I/O I2C1 clock line P21, P31
SDA0 I/O I2C0 data line P16, P65
2C1
SDA1 I/O I data line P20, P30
SEG0 to O LCD segment lines 0 to 39 P20 to P27 –
SEG7
SEG8 to O P34 to P37
SEG11
SEG12 to O P60 to P67
SEG19
SEG20 O P45
SEG21 O P44
SEG22 O P43
SEG23 O P83
SEG24 O P82
SEG25 O P81
SEG26 O P80
SEG27 O P85
SEG28 O P87
SEG29 O P33
SEG30 O P86
SEG31 O P32
SEG32 O P107
SEG33
www.DataSheet4U.com O P106
SEG34 O P105
SEG35 O P104
SEG36 to O P90 to P93
SEG39
SGO O Sound Generator output P51, P114

64 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Table 2-23 Alphabetic pin functions list (4/6)


Port

Pin name I/O Pin function µPD70F3421, µPD70F3424, µPD70F3426A µPD70F3427


µPD70F3422, µPD70F3425
µPD70F3423
SGOA O Sound Generator P50, P115
amplitude PWM output
SIB0 I Clocked Serial Interface P40, P105
CSIB0 data input
SIB1 I Clocked Serial Interface P43, P90
CSIB1 data input
SIB2 I Clocked Serial Interface – P80, P94
CSIB2 data input
SM11 O Stepper motor 1 output sin + P110
SM12 O Stepper motor 1 output sin – P111
SM13 O Stepper motor 1 output cos + P112
SM14 O Stepper motor 1 output cos – P113
SM21 O Stepper motor 2 output sin + P114
SM22 O Stepper motor 2 output sin – P115
SM23 O Stepper motor 2 output cos + P116
SM24 O Stepper motor 2 output cos – P117
SM31 O Stepper motor 3 output sin + P130
SM32 O Stepper motor 3 output sin – P131
SM33 O Stepper motor 3 output cos + P132
SM34 O Stepper motor 3 output cos – P133
SM41 O Stepper motor 4 output sin + P134
SM42 O Stepper motor 4 output sin – P135
SM43 O Stepper motor 4 output cos + P136
SM44 O Stepper motor 4 output cos – P137
SM51 O Stepper motor 5 output sin + P120
SM52 O Stepper motor 5 output sin – P121
SM53 O Stepper motor 5 output cos + P122
SM54 O Stepper motor 5 output cos – P123
SM61 O Stepper motor 6 output sin + P124
SM62 O Stepper motor 6 output sin – P125
SM63 O Stepper motor 6 output cos + P126
SM64 O Stepper motor 6 output cos – P127
SMVDD50, – Stepper Motor Controller/ no ports
SMVDD51 Driver supply voltage
SMVSS50, – Stepper Motor Controller/ no ports
SMVSS51 Driver ground
www.DataSheet4U.com
SOB0 O Clocked Serial Interface P41, P106
CSIB0 data output
SOB1 O Clocked Serial Interface P44, P91
CSIB1 data output
SOB2 O Clocked Serial Interface – P81, P95
CSIB2 data output

User’s Manual U17566EE5V1UM00 65


Chapter 2 Pin Functions

Table 2-23 Alphabetic pin functions list (5/6)


Port

Pin name I/O Pin function µPD70F3421, µPD70F3424, µPD70F3426A µPD70F3427


µPD70F3422, µPD70F3425
µPD70F3423
TIG01 to I Timer TMG0 channels 1 to P20 to P23, P130 to P133
TIG04 4 input
TIG11 to I Timer TMG1 channels 1 to P24 to P27, P134 to P137
TIG14 4 input
TIG20 I Timer TMG2 channels 0 to P60
5 input
TIG21 I P34, P61
TIG22 I P35, P66
TIG23 I P36, P67
TIG24 I P37, P63
TIG25 I P62
TIP00 I Timer TMP0 channel 0 P60, P100
input
TIP01 I Timer TMP0 channel 1 P61, P101
input
TIP10 I Timer TMP1 channel 0 P62, P101
input
TIP11 I Timer TMP1 channel 1 P63, P100
input
TIP20 I Timer TMP2 channel 0 P64, P102
input
TIP21 I Timer TMP2 channel 1 P66, P103
input
TIP30 I Timer TMP3 channel 0 P65, P103
input
TIP31 I Timer TMP3 channel 1 P67, P102
input
TOG01 to O Timer TMG0 channels 1 to P20 to P23, P130 to P133
TOG04 4 output
TOG11 to O Timer TMG1 channels 1 to P24 to P27, P134 to P137
TOG14 4 output
TOG21 O Timer TMG2 channels 1 to P34, P61, P110
4 output
TOG22 P35, P66, P111
TOG23 P36, P67, P112
TOG24 P37, P63, P113
TOP00 O Timer TMP0 channel 0 P60, P100
output
TOP01 O Timer TMP0 channel 1 P34, P61, P101
output
TOP10
www.DataSheet4U.com O Timer TMP1 channel 0 P62, P101
output
TOP11 O Timer TMP1 channel 1 P37, P63, P100
output
TOP20 O Timer TMP2 channel 0 P64, P102
output

66 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Table 2-23 Alphabetic pin functions list (6/6)


Port

Pin name I/O Pin function µPD70F3421, µPD70F3424, µPD70F3426A µPD70F3427


µPD70F3422, µPD70F3425
µPD70F3423
TOP21 O Timer TMP2 channel 1 P35, P66, P103
output
TOP30 O Timer TMP3 channel 0 P65, P103
output
TOP31 O Timer TMP3 channel 1 P36, P67, P102
output
TOY0 O Timer TMY0 output P83, P84
TXDA0 O UARTA0 transmit data P30, P86
TXDA1 O UARTA1 transmit data P32, P57
VCMP0 I Voltage Comparator 0 no ports
input
VCMP1 I Voltage Comparator 1 no ports
input
VCMPO0 O Output state of internal P07
Voltage Comparator 0
VCMPO1 O Output state of internal P07
Voltage Comparator 1
VDD50 to – Core supply voltage no ports
VDD52
VSS50 to – Core supply ground no ports
VSS52
WAIT I External memory interface – no ports
data wait request
WR O External memory interface – no ports
write strobe
X1, X2 – Main oscillator terminals no ports
XT1, XT2 – Sub-oscillator terminals no ports

Note Alternative input functions of CSIB0…CSIB2, UART0…UART1, I2C0, I2C1,


INTP6, INTP7, TMP0…TMP3 and TMG0…TMG2 are provided on two pins
each. Thus you can select on which pin the alternative function should appear.
Refer to “Alternative input selection“ on page 44.

Caution The WAIT pin must be connected to MVDD5n via a pull-up resistor in any case.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 67


Chapter 2 Pin Functions

2.4.3 External memory interface of µPD70F3427

The µPD70F3427 is equipped with an external memory interface. The data


bus width can be chosen between 16-bit D[15:0] and 32-bit D[31:0].
The signals of the external memory interface are partly shared with ports
respectively alternative functions and are controlled by different means, as
listed in Table 2-24.
The upper data bus lines D[31:16] are made available by setting
PMC.PMC143 = 1. Thus this bit changes the interface from 16- to 32-bit mode.
All other bus interface signals are available via group 14 (also usable as 3-bit I/
O port) and the permanent MEM-I/F group.

Table 2-24 External memory interface pin control


Port Ext. memory I/F Mode control
Group Name signal Port/alternative Ext. Memory I/F
3 P32 D18 PMC.PMC143 = 0 PMC.PMC143 = 1
P33 D19
8 P86 D16
P87 D17
9 P90 D24
P91 D25
P92 D26
P93 D27
P94 D28
P95 D29
P96 D30
P97 D31
10 P104 D20
P105 D21
P106 D22
P107 D23
14 P140 BCLK PMC.PMC140 = 0 PMC.PMC140 = 1
P141 BE2 PMC.PMC141 = 0 PMC.PMC141 = 1
P142 BE3 PMC.PMC142 = 0 PMC.PMC142 = 1
MEM-I/F – A[23:0] – permanent
D[15:0]
WR
CS0, CS1,
CS3, CS4
RD
www.DataSheet4U.com WAIT
BE0, BE1

68 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

2.4.4 Port group 0

• Port group 0 is an 8-bit port group. In alternative mode, it comprises pins for
the following functions:
• External interrupt (INTP0 to INTP6)
• Non-maskable interrupt (NMI)
• N-Wire debug interface reset (DRST)
• Output state of internal Voltage Comparators 0 and 1 (VCMPO0, VCMPO1)
Port group 0 includes the following pins:
Table 2-25 Port group 0: pin functions and port types
Pin functions in different modes
Port mode Alternative mode On-chip
(PMCnm = 0) (PMCnm = 1) debug mode Pin function
(OCDM0 = 1) Port type
Output mode (PMnm = 0) Input mode after reset
(PMnm = 1)
PFCnm = 0 PFCnm = 1
ALT1-OUT ALT2_OUT
P00 (I/O) - INTP0/NMI – P00 (I) M
P01 (I/O) - INTP1 – P01 (I) M
P02 (I/O) – INTP2 – P02 (I) M
P03 (I/O) – INTP3 – P03 (I) M
P04 (I/O) – INTP4 – P04 (I) M
P05 (I/O) – – DRST (I) P05 or
R
DRST (I)a
P06 (I/O) – INTP5 – P06 (I) M
P07 (I/O) VCMPO0 VCMPO1 INTP6 – P07 (I) M
a)
The pin function after reset depends on the reset source, that means on bit OCDM.OCDM0. Refer to “OCDM
- On-chip debug mode register“ on page 38 and to the “On-Chip Debug Unit“ on page 969.

Note 1. The alternative input function of INTP6 is provided on two pins. Thus you
can select on which pin the alternative function should appear.
Refer to “Alternative input selection“ on page 44.
2. The setting of bit OCDM.OCDM0 applies only to pins of port type R.
3. For configuring P00 as NMI and/or INTP0 refer also to “Edge and Level
Detection Configuration“ on page 257.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 69


Chapter 2 Pin Functions

Table 2-26 Port group 0: configuration registers


Initial
Register Address Used bits
value
PM0 FFFF F420H FFH PM07 PM06 PM05 PM04 PM03 PM02 PM01 PM00
PMC0 FFFF F440H 00H PMC07 PMC06 X PMC04 PMC03 PMC02 PMC01 PMC00
a
PFC0 FFFF F460H 20H PFC07 X PDC05 X X X X X
OCDM FFFF F9FCH 00H/ 0 0 0 0 0 0 0 OCDM0
01Hb
P0 FFFF F400H 00H P07 P06 P05 P04 P03 P02 P01 P00
PRC0 FFFF F3E0H 00H X X X X X X X PRC00 c
PPR0 FFFF F3C0H 00H PPR07 PPR06 PPR05 PPR04 PPR03 PPR02 PPR01 PPR00
PDSC0 FFFF F300H 00H PDSC07 PDSC06 PDSC05 PDSC04 PDSC03 PDSC02 PDSC01 PDSC00
PICC0 FFFF F380H FFH PICC07 PICC06 PICC05 PICC04 PICC03 PICC02 PICC01 PICC00
PILC0 FFFF F3A0H 00 H PILC07 PILC06 PILC05 PILC04 PILC03 PILC02 PILC01 PILC00
PODC0 FFFF F360H 00H PODC07 PODC06 PODC05 PODC04 PODC03 PODC02 PODC01 PODC00
a)
Note that PDC05 is used to connect/disconnect the internal pull-down resistor at pin P05/DRST.
b)
Depends on the reset source (Refer to “OCDM - On-chip debug mode register“ on page 38 and to“On-Chip
Debug Unit“ on page 969.
c)
The setting of PRC00 is valid for the entire port group.

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.

www.DataSheet4U.com

70 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

2.4.5 Port group 1

Port group 1 is a 2-bit port group. In alternative mode, it comprises pins for the
following functions:
• I2C0 data/clock line (SDA0/SCL0)
Port group 1 includes the following pins:
Table 2-27 Port group 1: pin functions and port types
Pin functions in different modes
Port mode Alternative mode
(PMCnm = 0) (PMCnm = 1) Pin function
Port type
output mode (PMnm = 0) Input mode after reset
(PMnm = 1)
PFCnm = 0 PFCnm = 1
ALT1-OUT ALT2-OUT
P16 (I/O) SDA0a CTXD2b SDA0 P16 (I) M
a SCL0/CRXD2b
P17 (I/O) SCL0 P17 (I) M
a)
xInI2C function mode open drain emulation has to be enabled (PODC1.PODC16 = 1 and
PODC1.PODC17 = 1). Thus output function is enabled automatically, although
PMnm = 1.
b) not available on µPD70F3426A

Note Alternative input functions SDA0 and SCL0 are provided on two pins each.
Thus you can select on which pin the alternative function should appear. If
alternative functions SDA0/SCL0 are used at P16/17, make sure to set also
PFSR0.PFSR04 = 0.
Refer to “Alternative input selection“ on page 44.

Table 2-28 Port group 1: configuration registers


Initial
Register Address Used bits
value
PM1 FFFF F422 H FF H PM17 PM16 X X X X X X
PMC1 FFFF F442 H 00 H PMC17 PMC16 X X X X X X
PFC1 a FFFF F462 H 00 H X PFC16 X X X X X X
P1 FFFF F402 H 00 H P17 P16 X X X X X X
PRC1 FFFF F3E2 H 00 H X X X X X X X PRC10 b
PPR1 FFFF F3C2 H 00 H PPR17 PPR16 X X X X X X
PDSC1 FFFF F302 H 00 H PDSC17 PDSC16 X X X X X X
PICC1 FFFF F382 H FF H PICC17 PICC16 X X X X X X
PILC1 FFFF F3A2 H 00 H PILC17 PILC16 X X X X X X
PODC1 FFFF F362 H 00 H PODC17 PODC16 X X X X X X
a)
not available on µPD70F3426A
b)
The setting of PRC10 is valid for the entire port group.

w w w . D a t a S h e e t 4 U . c o m
Access All 8-bit registers can be accessed in 8-bit or 1-bit units.

User’s Manual U17566EE5V1UM00 71


Chapter 2 Pin Functions

2.4.6 Port group 2

Port group 2 is an 8-bit port group. In alternative mode, it comprises pins for
the following functions:
• Timer TMG0 to TMG1 channels
(TIG01 to TIG04, TOG01 to TOG04, TIG11 to TIG14, TOG11 to TOG14)
• I2C1 data/clock line (SDA1, SCL1)
• LCD controller segment signal output (SEG0 to SEG7) (µPD70F3421,
µPD70F3422, µPD70F3423 only)
Port group 2 includes the following pins:
Table 2-29 Port group 2: pin functions and port types
Pin functions in different modes
Port mode Alternative mode LCD mode
(PMCnm = 0) (PMCnm = 1) (PLCDCnm = 1)a Pin function
Port type
Output mode (PMnm = 0) Input mode after reset
(PMnm = 1)
PFCnm = 0 PFCnm = 1
ALT1-OUT ALT2-OUT
P20 (I/O) SDA1b TOG01 TIG01/SDA1 SEG0a P20 (I) M
b
P21 (I/O) SCL1 TOG02 TIG02/SCL1 SEG1a P21 (I) M
P22 (I/O) TOG03 TIG03 SEG2a P22 (I) M
P23 (I/O) TOG04 TIG04 SEG3a P23 (I) M
a
P24 (I/O) TOG11 TIG11 SEG4 P24 (I) M
P25 (I/O) TOG12 TIG12 SEG5a P25 (I) M
P26 (I/O) TOG13 TIG13 SEG6a P26 (I) M
a
P27 (I/O) TOG14 TIG14 SEG7 P27 (I) M
a) µPD70F3421, µPD70F3422, µPD70F3423 only
b) In I2C function mode open drain emulation has to be enabled (PODC2.PODC20 = 1 and
PODC2.PODC21 = 1). Thus output function is enabled automatically, although PMnm = 1.

Note 1. For pins that support only one alternative output mode, the PFCnm bit is
not available.
2. Alternative input functions of I2C1 (SDA1, SCL1) and of TMG0…TMG1 are
provided on two pins each. Thus you can select on which pin the
alternative function should appear. If alternative functions SDA1/SCL1 are
used at P20/21 make sure to set also PFSR0.PFSR05 = 0.
Refer to “Alternative input selection“ on page 44.

www.DataSheet4U.com

72 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Table 2-30 Port group 2: Configuration registers


Initial
Register Address Used bits
value
PM2 FFFF F424 H FF H PM27 PM26 PM25 PM24 PM23 PM22 PM21 PM20
PMC2 FFFF F444 H 00 H PMC27 PMC26 PMC25 PMC24 PMC23 PMC22 PMC21 PMC20
PFC2 FFFF F464 H 00 H X X X X X X PFC21 PFC20
PLCDC2 a FFFF F344 H 00 H PLCDC27 PLCDC26 PLCDC25 PLCDC24 PLCDC23 PLCDC22 PLCDC21 PLCDC20
P2 FFFF F404 H 00 H P27 P26 P25 P24 P23 P22 P21 P20
PRC2 FFFF F3E4 H 00 H X X X X X X X PRC20 b
PPR2 FFFF F3C4 H 00 H PPR27 PPR26 PPR25 PPR24 PPR23 PPR22 PPR21 PPR20
PDSC2 FFFF F304 H 00 H PDSC27 PDSC26 PDSC25 PDSC24 PDSC23 PDSC22 PDSC21 PDSC20
PICC2 FFFF F384 H FF H PICC27 PICC26 PICC25 PICC24 PICC23 PICC22 PICC21 PICC20
PILC2 FFFF F3A4 H 00 H PILC27 PILC26 PILC25 PILC24 PILC23 PILC22 PILC21 PILC20
PODC2 FFFF F364 H 00 H PODC27 PODC26 PODC25 PODC24 PODC23 PODC22 PODC21 PODC20
a)
µPD70F3421, µPD70F3422, µPD70F3423 only
b)
The setting of PRC20 is valid for the entire port group.

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 73


Chapter 2 Pin Functions

2.4.7 Port group 3

Port group 3 is an 8-bit port group. In alternative mode, it comprises pins for
the following functions:
• UARTA0 transmit/receive data (TXDA0, RXDA0)
• UARTA1 transmit/receive data (TXDA1, RXDA1)
• I2C1 data/clock line (SDA1, SCL1)
• LCD controller segment signal output (SEG8 to SEG11, SEG29, SEG31)
(µPD70F3421, µPD70F3422, µPD70F3423 only)
• Timer TMG2 channels (TIG21 to TIG24, TOG21 to TOG24)
• Timer TMP0 to TMP3 channels (TOP01 to TOP31)
• External memory interface data lines D[19:18] (µPD70F3427 only)
Port group 3 includes the following pins
Table 2-31 Port group 3: pin functions and port types
Pin functions in different modes
Port mode Alternative mode LCD mode External
(PMCnm (PMCnm = 1) (PLCDCnm memory Pin
Port
= 0) = 1)a interface function
Output mode (PMnm = 0) Input mode type
mode after reset
(PMnm = 1)
PFCnm = 0 PFCnm = 1 (PMC143
ALT1-OUT ALT2-OUT = 1)b
P30 (I/O) TXDA0 SDA1c SDA1 – por t/alternative P30 (I)
M
mode
P31 (I/O) SCL1c RXDA0/SCL1 – por t/alternative P31 (I)
M
mode
P32 (I/O) TXDA1 – SEG31a D18b P32 (I) M
P33 (I/O) – RXDA1 SEG29a D19b P33 (I) M
a
P34 (I/O) TOP01 TOG21 TIG21 SEG8 por t/alternative P34 (I)
M
mode
P35 (I/O) TOP21 TOG22 TIG22 SEG9a por t/alternative P35 (I)
M
mode
P36 (I/O) TOP31 TOG23 TIG23 SEG10a por t/alternative P36 (I)
M
mode
P37 (I/O) TOP11 TOG24 TIG24 SEG11a por t/alternative P37 (I)
M
mode
a)
µPD70F3421, µPD70F3422, µPD70F3423 only
b)
µPD70F3427 only
c) In I2C function mode open drain emulation has to be enabled (PODC3.PODC30 = 1 and
PODC3.PODC31 = 1). Thus output function is enabled automatically, although PMnm = 1.

Note 1. For pins that support only one alternative output mode, the PFCnm bit is
not available.
www.DataSheet4U.com
2. Alternative input functions of I2C1 (SDA1, SCL1), TMP0…TMP3, TMG2
and UARTA0…UARTA1 are provided on two pins each. Thus you can
select on which pin the alternative function should appear. If alternative
functions SDA1/SCL1 are used at P30/31 make sure to set also
PFSR0.PFSR05 = 1.
Refer to “Alternative input selection“ on page 44.

74 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Table 2-32 Port group 3: configuration registers


Initial
Register Address Used bits
value
PM3 FFFF F426 H FF H PM37 PM36 PM35 PM34 PM33 PM32 PM31 PM30
PMC3 FFFF F446 H 00 H PMC37 PMC36 PMC35 PMC34 PMC33 PMC32 PMC31 PMC30
PFC3 FFFF F466 H 00 H PFC37 PFC36 PFC35 PFC34 X X X PFC30
PLCDC3 a FFFF F346 H 00 H PLCDC37 PLCDC36 PLCDC35 PLCDC34 PLCDC33 PLCDC32 X X
P3 FFFF F406 H 00 H P37 P36 P35 P34 P33 P32 P31 P30
PRC3 FFFF F3E6 H 00 H X X X X X X X PRC30 b
PPR3 FFFF F3C6 H 00 H PPR37 PPR36 PPR35 PPR34 PPR33 PPR32 PPR31 PPR30
c c
PDSC3 FFFF F306 H 00 H PDSC37 PDSC36 PDSC35 PDSC34 PDSC33 PDSC32 PDSC31 PDSC30
PICC3 FFFF F386 H FF H PICC37 PICC36 PICC35 PICC34 PICC33 c PICC32 c PICC31 PICC30
PILC3 FFFF F3A6 H 00 H PILC37 PILC36 PILC35 PILC34 PILC33 c PILC32 c PILC31 PILC30
PODC3 FFFF F366 H 00 H PODC37 PODC36 PODC35 PODC34 PODC33 PODC32 PODC31 PODC30
a)
µPD70F3421, µPD70F3422, µPD70F3423 only
b)
The setting of PRC30 is valid for the entire port group.
c)
not available for µPD70F3427

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 75


Chapter 2 Pin Functions

2.4.8 Port group 4

Port group 4 is an 8-bit port group. In alternative mode, it comprises pins for
the following functions:
• Clocked Serial Interface CSIB0 data/clock line (SIB0, SOB0, SCKB0)
• Clocked Serial Interface CSIB1 data/clock line (SIB1, SOB1, SCKB1)
• External interrupt (INTP6)
• LCD controller segment signal output (SEG20 to SEG22) (µPD70F3421,
µPD70F3422, µPD70F3423
• CAN0 transmit/receive data (CTXD0, CRXD0)
Port group 4 includes the following pins:
Table 2-33 Port group 4: pin functions and port types
Pin functions in different modes
Port mode Alternative mode LCD mode
Pin function
(PMCnm = 0) (PMCnm = 1) (PLCDCnm = 1)a Port type
after reset
Output mode Input mode
(PMnm = 0) (PMnm = 1)
P40 (I/O) – INTP6/SIB0 – P40 (I) M
P41 (I/O) SOB0 – – P41 (I) M
P42 (I/O) SCKB0 SCKB0 – P42 (I) M
P43 (I/O) – SIB1 SEG22a P43 (I) M
P44 (I/O) SOB1 – SEG21a P44 (I) M
P45 (I/O) SCKB1 SCKB1 SEG20a P45 (I) M
P46 (I/O) – CRXD0 – P46 (I) M
P47 (I/O) CTXD0 – – P47 (I) M
a)
µPD70F3421, µPD70F3422, µPD70F3423 only

Note Alternative input functions of INTP6, CSIB0, and CSIB1 are provided on two
pins each. Thus you can select on which pin the alternative function should
appear.
Refer to “Alternative input selection“ on page 44.

www.DataSheet4U.com

76 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Table 2-34 Port group 4: configuration registers


Initial
Register Address Used bits
value
PM4 FFFF F428 H FF H PM47 PM46 PM45 PM44 PM43 PM42 PM41 PM40
PMC4 FFFF F448 H 00 H PMC47 PMC46 PMC45 PMC44 PMC43 PMC42 PMC41 PMC40
PLCDC4 a FFFF F348 H 00 H X X PLCDC45 PLCDC44 PLCDC43 X X X
P4 FFFF F408 H 00 H P47 P46 P45 P44 P43 P42 P41 P40
PRC4 FFFF F3E8 H 00 H X X X X X X X PRC40 b
PPR4 FFFF F3C8 H 00 H PPR47 PPR46 PPR45 PPR44 PPR43 PPR42 PPR41 PPR40
PDSC4 FFFF F308 H 00 H PDSC47 PDSC46 PDSC45 PDSC44 PDSC43 PDSC42 PDSC41 PDSC40
PICC4 FFFF F388 H FF H PICC47 PICC46 PICC45 PICC44 PICC43 PICC42 PICC41 PICC40
PILC4 FFFF F3A8 H 00 H PILC47 PILC46 PILC45 PILC44 PILC43 PILC42 PILC41 PILC40
PODC4 FFFF F368 H 00 H PODC47 PODC46 PODC45 PODC44 PODC43 PODC42 PODC41 PODC40
a)
µPD70F3421, µPD70F3422, µPD70F3423 only
b)
The setting of PRC40 is valid for the entire port group.

Note It is recommended to configure the ports used for CAN data transmit CTXDn to
its highest drive strength to Limit2 by PDSCn.PDSCnm = 1 for CAN baud rates
above 200 Kbit/sec.

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 77


Chapter 2 Pin Functions

2.4.9 Port group 5

Port group 5 is an 8-bit port group. In alternative mode, it comprises pins for
the following functions:
• External interrupt (INTP7) (µPD70F3424, µPD70F3425, µPD70F3426A,
µPD70F3427 only)
• Sound Generator outputs (SGO, SGOA)
• Frequency output (FOUT)
• N-Wire interface signals (DDI, DDO, DCK, DMS)
• CAN1 transmit/receive data (CTXD1, CRXD1)
• UARTA1 transmit/receive data (TXDA1, RXDA1)
Port group 5 includes the following pins:
Table 2-35 Port group 5: pin functions and port types
Pin functions in different modes
Port mode Alternative mode On-chip
(PMCnm = 0) (PMCnm = 1) debug mode Pin function
(OCDM0 = 1) Port type
Output mode (PMnm = 0) Input mode after reset
(PMnm = 1)
PFCnm = 0 PFCnm = 1
ALT1-OUT ALT2-OUT
P50 (I/O) FOUT SGOA INTP7a – P50 (I) M
P51 (I/O) SGO – – P51 (I) M
P52 (I/O) – – DDI (I) P52 or DDI (I)b R
P53 (I/O) – – DDO (O) P53 (I) or
R
DDO (O)b
P54 (I/O) – – DCK (I) P54 or DCK (I)b R
P55 (I/O) – – DMS(I) P55 or DMS(I)b R
P56 (I/O) – CRXD1 – P56 (I)
M
/RXDA1
P57 (I/O) TXDA1 CTXD1 – – P57 (I) M
a) µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427 only
b)
The pin function after reset depends on the reset source, that means on bit OCDM.OCDM0. Refer to “OCDM
- On-chip debug mode register“ on page 38 and to the “On-Chip Debug Unit“ on page 969.

Note 1. For pins that support only one alternative output mode, the PFCnm bit is
not available.
2. The setting of bit OCDM.OCDM0 applies only to pins of port type R.
3. Alternative input functions of UARTA1 and INTP7 are provided on two pins
each. Thus you can select on which pin the alternative function should
appear.
Refer to “Alternative input selection“ on page 44.

www.DataSheet4U.com

78 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Table 2-36 Port group 5: configuration registers


Initial
Register Address Used bits
value
PM5 FFFF F42A H FF H PM57 PM56 PM55 PM54 PM53 PM52 PM51 PM50
PMC5 FFFF F44A H 00 H PMC57 PMC56 X X X X PMC51 PMC50
PFC5 FFFF F46A H 00 H PFC57 X X X X X X PFC50
OCDM FFFF F9FC H 00 H /01 H 0 0 0 0 0 0 0 OCDM0
P5 FFFF F40A H 00 H P57 P56 P55 P54 P53 P52 P51 P50
PRC5 FFFF F3EA H 00 H X X X X X X X PRC50 a
PPR5 FFFF F3CA H 00 H PPR57 PPR56 PPR55 PPR54 PPR53 PPR52 PPR51 PPR50
PDSC5 FFFF F30A H 00 H PDSC57 PDSC56 PDSC55 PDSC54 PDSC53 PDSC52 PDSC51 PDSC50
PICC5 FFFF F38A H FF H PICC57 PICC56 PICC55 PICC54 PICC53 PICC52 PICC51 PICC50
PILC5 FFFF F3AA H 00 H PILC57 PILC56 PILC55 PILC54 PILC53 PILC52 PILC51 PILC50
PODC5 FFFF F36A H 00 H PODC57 PODC56 PODC55 PODC54 PODC53 PODC52 PODC51 PODC50
a)
The setting of PRC50 is valid for the entire port group.

Note It is recommended to configure the ports used for CAN data transmit CTXDn to
its highest drive strength to Limit2 by PDSCn.PDSCnm = 1 for CAN baud rates
above 200 Kbit/sec.

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 79


Chapter 2 Pin Functions

2.4.10 Port group 6

Port group 6 is an 8-bit port group. In alternative mode, it comprises pins for
the following functions:
• Timer TMP0 to TMP3 channels (TIP00 to TIP31, TOP00 to TOP31)
• Timer TMG2 channels (TIG20 to TIG25, TOG21 to TOG24)
• LCD controller segment signal output (SEG12 to SEG19) (µPD70F3421,
µPD70F3422, µPD70F3423 only)
• I2C0 data/clock line (SDA0, SCL0)
Port group 6 includes the following pins:
Table 2-37 Port group 6: pin functions and port types
Pin functions in different modes
Port mode Alternative mode LCD mode
(PMCnm = 0) (PMCnm = 1) (PLCDCnm = 1)a Pin function
Port type
Output mode (PMnm = 0) Input mode after reset
(PMnm = 1)
PFCnm = 0 PFCnm = 1
ALT1-OUT ALT2-OUT
P60 (I/O) TOP00 TIP00/TIG20 SEG12a P60 (I) M
a
P61 (I/O) TOP01 TOG21 TIP01/TIG21 SEG13 P61 (I) M
P62 (I/O) TOP10 TIP10/TIG25 SEG14a P62 (I) M
P63 (I/O) TOP11 TOG24 TIP11/TIG24 SEG15a P63 (I) M
b
P64 (I/O) SCL0 TOP20 SCL0/TIP20 SEG16a P64 (I) M
P65 (I/O) SDA0b TOP30 SDA0/TIP30 SEG17a P65 (I) M
P66 (I/O) TOP21 TOG22 TIP21/TIG22 SEG18a P66 (I) M
a
P67 (I/O) TOP31 TOG23 TIP31/TIG23 SEG19 P67 (I) M
a) µPD70F3421, µPD70F3422, µPD70F3423 only
b) In I2C function mode open drain emulation has to be enabled (PODC6.PODC64 = 1 and
PODC6.PODC65 = 1). Thus output function is enabled automatically, although PMnm = 1.

Note 1. For pins that support only one alternative output mode, the PFCnm bit is
not available.
2. Alternative input functions of I2C0 (SDA0, SCL0), TMP0…TMP3 and
TMG2 are provided on two pins each. Thus you can select on which pin
the alternative function should appear. If alternative functions SDA0/SCL0
are used at P64/65 make sure to set also PFSR0.PFSR04 = 1.
Refer to “Alternative input selection“ on page 44.

www.DataSheet4U.com

80 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Table 2-38 Port group 6: configuration registers


Initial
Register Address Used bits
value
PM6 FFFF F42C H FF H PM67 PM66 PM65 PM64 PM63 PM62 PM61 PM60
PMC6 FFFF F44C H 00 H PMC67 PMC66 PMC65 PMC64 PMC63 PMC62 PMC61 PMC60
PFC6 FFFF F46C H 00 H PFC67 PFC66 PFC65 PFC64 PFC63 X PFC61 X
PLCDC6 a FFFF F34C H 00 H PLCDC67 PLCDC66 PLCDC65 PLCDC64 PLCDC63 PLCDC62 PLCDC61 PLCDC60
P6 FFFF F40C H 00 H P67 P66 P65 P64 P63 P62 P61 P60
PRC6 FFFF F3EC H 00 H X X X X X X X PRC60 b
PPR6 FFFF F3CC H 00 H PPR67 PPR66 PPR65 PPR64 PPR63 PPR62 PPR61 PPR60
PDSC6 FFFF F30C H 00 H PDSC67 PDSC66 PDSC65 PDSC64 PDSC63 PDSC62 PDSC61 PDSC60
PICC6 FFFF F38C H FF H PICC67 PICC66 PICC65 PICC64 PICC63 PICC62 PICC61 PICC60
PILC6 FFFF F3AC H 00 H PILC67 PILC66 PILC65 PILC64 PILC63 PILC62 PILC61 PILC60
PODC6 FFFF F36C H 00 H PODC67 PODC66 PODC65 PODC64 PODC63 PODC62 PODC61 PODC60
a)
µPD70F3421, µPD70F3422, µPD70F3423, only
b)
The setting of PRC60 is valid for the entire port group.

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 81


Chapter 2 Pin Functions

2.4.11 Port group 7

Port group 7 is a 16-bit port group. It includes pins for the A/D Converter input.
The pins of this port group only work in input mode (port type B). They are
used for their alternative input function A/D converter input. At the same time,
the pin status can also be read via the port register Pn, so that the pin also
works in port mode.
Port group 7 includes the following pins:
Table 2-39 Port group 7: pin functions and port types
Pin functions in different modes
Port mode Alternative input Pin function after
Port type
(PMCnm = 0) mode reset
(PMCnm = 1)
P70 (I) ANI0 P70 (I) B
P71 (I) ANI1 P71 (I) B
P72 (I) ANI2 P72 (I) B
P73 (I) ANI3 P73 (I) B
P74 (I) ANI4 P74 (I) B
P75 (I) ANI5 P75 (I) B
P76 (I) ANI6 P76 (I) B
P77 (I) ANI7 P77 (I) B
P78 (I) ANI8 P78 (I) B
P79 (I) ANI9 P79 (I) B
P710 (I) ANI10 P710 (I) B
P711 (I) ANI11 P711 (I) B
P712 (I) ANI12a P712 (I) B
a
P713 (I) ANI13 P713 (I) B
P714 (I) ANI14a P714 (I) B
P715 (I) ANI15a P715 (I) B
a)
µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427 only

Note All pins of port group 7 always function in alternative input mode, i.e. A/D
conversion of the level at P7m is independent of any register settings.
For reading the pin status via the P7 register PMC7m has to be set to 0.
Since the accuracy of an A/D conversion may degrade when P7 is read during
the sampling time of the A/D converter, it is recommended to disable the port
pin read by PMC7m = 1 during A/D conversion.

www.DataSheet4U.com

82 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Table 2-40 Port group 7: configuration registers


Initial
Register Address Used bits
value
PMC7L FFFF F44E H 00 H PMC77 PMC76 PMC75 PMC74 PMC73 PMC72 PMC71 PMC70
a a a a
PMC7H FFFF F44F H 00 H PMC715 PMC714 PMC713 PMC712 PMC711 PMC710 PMC79 PMC78
PMC7 FFFF F44E H a
0000 H PMC715 to PMC78 (PMC7H) PMC77 to PMC70 (PMC7L)
(16 bit)
P7L FFFF F40E H 00 H P77 P76 P75 P74 P73 P72 P71 P70
P7H FFFF F40F H 00 H P715 P714 P713 P712 P711 P710 P79 P78
P7 FFFF F04E H 0000 H P715 to PMC78 (P7H) P77 to P70 (P7L)
(16 bit)
PILC7L FFFF F3AE H 00 H PILC77 PILC76 PILC75 PILC74 PILC73 PILC72 PILC71 PILC70
PILC7H FFFF F3AF H 00 H PILC715 PILC714 PILC713 PILC712 PILC711 PILC710 PILC79 PILC78
PILC7 FFFF F44E H 0000 H PILC715 to PILC78 (PILC7H) PILC77 to PILC70 (PILC7L)
(16 bit)
a)
PMC715 to PMC712 are available for µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427 only.

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.


All 16-bit registers can be accessed in 16-bit units.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 83


Chapter 2 Pin Functions

2.4.12 Port group 8

Port group 8 is an 8-bit port group. In alternative mode, it comprises pins for
the following functions:
• Clocked Serial Interface CSIB2 data/clock line (SIB2, SOB2, SCKB2)
(µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427 only)
• LCD controller segment signal output (SEG23 to SEG28, SEG30)
(µPD70F3421, µPD70F3422, µPD70F3423 only)
• Timer TMY0 output (TOY0)
• Frequency output (FOUT)
• Inverted frequency output (FOUT)
• External interrupt (INTP7) (µPD70F3424, µPD70F3425, µPD70F3426A,
µPD70F3427 only)
• UARTA0 transmit/receive data (TXDA0, RXDA0)
• External memory interface data lines D[17:16] (µPD70F3427 only)
Port group 8 includes the following pins:
Table 2-41 Port group 8: pin functions and port types
Pin functions in different modes
Port mode Alternative mode LCD mode External
(PMCnm = (PMCnm = 1) (PLCDCnm memory Pin
Port
0) = 1)a interface function
Output mode (PMnm = 0) Input mode type
mode after reset
(PMnm = 1)
PFCnm = 0 PFCnm = 1 (PMC143
ALT1-OUT ALT2-OUT = 1)b
P80 (I/O) – SIB2c SEG26a por t/alternative P80 (I)
M
mode
P81 (I/O) SOB2c – SEG25a por t/alternative P81 (I)
M
mode
P82 (I/O) SCKB2c SCKB2c SEG24a por t/alternative P82 (I)
M
mode
P83 (I/O) TOY0 FOUT – SEG23a por t/alternative P83 (I)
M
mode
P84 (I/O) TOY0 INTP7c – por t/alternative P84 (I)
M
mode
P85 (I/O) FOUT – SEG27a por t/alternative P85 (I)
M
mode
P86 (I/O) TXDA0 – SEG30a D16b P86 (I) M
a
P87 (I/O) – RXDA0 SEG28 D17b P87 (I) M
a) µPD70F3421, µPD70F3422, µPD70F3423 only
b) µPD70F3427 only
c)
µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427 only

Note 1. For pins that support only one alternative output mode, the PFCnm bit is
www.DataSheet4U.com not available.
2. Alternative input functions of CSIB2, UART0, and INTP7 are provided on
two pins each. Thus you can select on which pin the alternative function
should appear.
Refer to “Alternative input selection“ on page 44.

84 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Table 2-42 Port group 8: configuration registers


Initial
Register Address Used bits
value
PM8 FFFF F430 H FF H PM87 PM86 PM85 PM84 PM83 PM82 PM81 PM80
PMC8 FFFF F450 H 00 H PMC87 PMC86 PMC85 PMC84 PMC83 PMC82 PMC81 PMC80
PFC8 FFFF F470 H 00 H X X X X PFC83 X X X
PLCDC8 a FFFF F350 H 00 H PLCDC87 PLCDC86 PLCDC85 X PLCDC83 PLCDC82 PLCDC81 PLCDC80
P8 FFFF F410 H 00 H P87 P86 P85 P84 P83 P82 P81 P80
PRC8 FFFF F3F0 H 00 H X X X X X X X PRC80 b
PPR8 FFFF F3D0 H 00 H PPR87 PPR86 PPR85 PPR84 PPR83 PPR82 PPR81 PPR80
c c
PDSC8 FFFF F310 H 00 H PDSC87 PDSC86 PDSC85 PDSC84 PDSC83 PDSC82 PDSC81 PDSC80
PICC8 FFFF F390 H FF H PICC87 c PICC86 c PICC85 PICC84 PICC83 PICC82 PICC81 PICC80
PILC8 FFFF F3B0 H 00 H PILC87 c PILC86 c PILC85 PILC84 PILC83 PILC82 PILC81 PILC80
PODC8 FFFF F370 H 00 H PODC87 PODC86 PODC85 PODC84 PODC83 PODC82 PODC81 PODC80
a)
µPD70F3421, µPD70F3422, µPD70F3423 only
b)
The setting of PRC80 is valid for the entire port group.
c)
not available for µPD70F3427

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 85


Chapter 2 Pin Functions

2.4.13 Port group 9

Port group 9 is an 8-bit port group. In alternative mode, it comprises pins for
the following functions:
• LCD Bus Interface data lines (DBD0 to DBD7) (µPD70F3424, µPD70F3425,
µPD70F3426A, µPD70F3427 only)
• Clocked Serial Interface CSIB1 data/clock line (SCKB1, SOB1, SIB1)
• Clocked Serial Interface CSIB2 data/clock line (SCKB2, SOB2, SIB2)
(µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427 only)
• LCD controller segment signal output (SEG36 to SEG39) (µPD70F3421,
µPD70F3422, µPD70F3423 only)
• LCD controller common signal output (COM0 to COM4) (µPD70F3421,
µPD70F3422, µPD70F3423 only)
• External memory interface data lines D[31:24] (µPD70F3427 only)
Port group 9 includes the following pins:
Table 2-43 Port group 9: pin functions and port types
Pin functions in different modes
Port mode Alternative mode LCD mode External
(PMCnm = (PMCnm = 1) (PLCDCnm memory Pin
Port
0) = 1)a interface function
Output mode (PMnm = 0) Input mode type
mode after reset
(PMnm = 1)
PFCnm = 0 PFCnm = 1 (PMC143
ALT1-OUT ALT2-OUT = 1)b
P90 (I/O) DBD0 SIB1 SEG36a D24b P90 (I) Q
a
P91 (I/O) DBD1 SOB1 – SEG37 D25b P91 (I) Q
P92 (I/O) DBD2 SCKB1 SCKB1 SEG38a D26b P92 (I) Q
P93 (I/O) DBD3 – SEG39a D27b P93 (I) Q
c
P94 (I/O) DBD4 SIB2 COM0a D28b P94 (I) Q
P95 (I/O) DBD5 SOB2c – COM1a D29b P95 (I) Q
P96 (I/O) DBD6 SCKB2c SCKB2c COM2a D30b P96 (I) Q
a
P97 (I/O) DBD7 – COM3 D31b P97 (I) Q
a) µPD70F3421, µPD70F3422, µPD70F3423 only
b)
µPD70F3427 only
c)
µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427 only

Note 1. For pins that support only one alternative output mode, the PFCnm bit is
not available.
2. Alternative input functions of CSIB1…CSIB2 are provided on two pins
each. Thus you can select on which pin the alternative function should
appear.
Refer to “Alternative input selection“ on page 44.
3. Though DBD0-7 is a bidirectional bus PMnm must be set to "0", i.e. to
www.DataSheet4U.com output mode, when the port is used as LCD bus I/F bus DBD0-7. The
change of the direction is performed automatically, when data is read from
the external bus.

86 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Table 2-44 Port group 9: configuration registers


Initial
Register Address Used bits
value
PM9 FFFF F432 H FF H PM97 PM96 PM95 PM94 PM93 PM92 PM91 PM90
PMC9 FFFF F452 H 00 H PMC97 PMC96 PMC95 PMC94 PMC93 PMC92 PMC91 PMC90
PFC9 FFFF F472 H a a b b
00 H X PFC96 PFC95 X X PFC92 PFC91 X
PLCDC9 c FFFF F352 H 00 H PLCDC97 PLCDC96 PLCDC95 PLCDC94 PLCDC93 PLCDC92 PLCDC91 PLCDC90
P9 FFFF F412 H 00 H P97 P96 P95 P94 P93 P92 P91 P90
PRC9 FFFF F320 H 00 H X X X X X X X PRC90 d
PPR9 FFFF F3D2 H 00 H PPR97 PPR96 PPR95 PPR94 PPR93 PPR92 PPR91 PPR90
e
PDSC9 FFFF F312 H 00 H PDSC97 PDSC96 PDSC95 PDSC94 PDSC93 PDSC92 PDSC91 PDSC90
PICC9 e FFFF F392 H FF H PICC97 PICC96 PICC95 PICC94 PICC93 PICC92 PICC91 PICC90
PILC9 e FFFF F3B2 H 00 H PILC97 PILC96 PILC95 PILC94 PILC93 PILC92 PILC91 PILC90
PODC9 FFFF F372 H 00 H PODC97 PODC96 PODC95 PODC94 PODC93 PODC92 PODC91 PODC90
a)
µPD703424, µPD70F3425, µPD703426A, µPD70F3427 only
b)
Refer to caution below.
c)
µPD70F3421, µPD70F3422, µPD70F3422 only
d) The setting of PRC90 is valid for the entire port group.
e) not available for µPD70F3427

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.

Caution Though the LCD Bus Interface data lines DBD[7:0] are not available for
µPD70F3421, µPD70F3422, and µPD70F3423 PFC91 and PFC92 must be
set to 1 for making SOB1 and SCKB1 externally available.
Thus initialize
PFC9 = x6H

always when the CSIB1 is used on port group 9.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 87


Chapter 2 Pin Functions

2.4.14 Port group 10

Port group 10 is an 8-bit port group. In alternative mode, it comprises pins for
the following functions:
• Timer TMP0 to TMP3 (TOP00 to TOP31, TIP00 to TIP31)
• LCD Bus Interface read/write strobe (DBRD, DBWR) (µPD70F3424,
µPD70F3425, µPD70F3426A, µPD70F3427 only)
• LCD controller segment signal output (SEG32 to SEG35)(µPD70F3421,
µPD70F3422, µPD70F3423 only)
• Clocked Serial Interface CSIB0 data/clock line (SIB0, SOB0, SCKB0)
• External memory interface data lines D[23:20] (µPD70F3427 only)
Port group 10 includes the following pins
Table 2-45 Port group 10: pin functions and port types
Pin functions in different modes
Port mode Alternative mode LCD mode External
(PMCnm = (PMCnm = 1) (PLCDCnm memory Pin
Port
0) = 1)a interface function
Output mode (PMnm = 0) Input mode type
mode after reset
(PMnm = 1)
PFCnm = 0 PFCnm = 1 (PMC143
ALT1-OUT ALT2-OUT = 1)b
P100 (I/O) TOP00 TOP11 TIP00/TIP11 – por t/alternative P100 (I)
M
mode
P101 (I/O) TOP01 TOP10 TIP01/TIP10 – por t/alternative P101 (I)
M
mode
P102 (I/O) TOP20 TOP31 TIP20/TIP31 – por t/alternative P102 (I)
M
mode
P103 (I/O) TOP21 TOP30 TIP21/TIP30 – por t/alternative P103 (I)
M
mode
P104(I/O) DBRDc – SEG35a D20b P104(I) M
c
P105 (I/O) DBWR SIB0 SEG34a D21b P105 (I) M
P106 (I/O) SOB0 – SEG33a D22b P106 (I) M
P107 (I/O) SCKB0 SCKB0 SEG32a D23b P107 (I) M
a)
µPD70F3421, µPD70F3422, µPD70F3423 only
b)
µPD70F3427 only
c) µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427 only

Note 1. For pins that support only one alternative output mode, the PFCnm bit is
not available.
2. Alternative input functions of CSIB0 and TMP0…TMP3 are provided on
two pins each. Thus you can select on which pin the alternative function
should appear.
Refer to “Alternative input selection“ on page 44.

www.DataSheet4U.com

88 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Table 2-46 Port group 10: configuration registers


Initial
Register Address Used bits
value
PM10 FFFF F434 H FF H PM107 PM106 PM105 PM104 PM103 PM102 PM101 PM100
PMC10 FFFF F454 H 00 H PMC107 PMC106 PMC105 PMC104 PMC103 PMC102 PMC101 PMC100
PFC10 FFFF F474 H 00 H X X X X PFC103 PFC102 PFC101 PFC100
a
PLCDC10 FFFF F354 H 00 H PLCDC107 PLCDC106 PLCDC105 PLCDC104 X X X X
P10 FFFF F414 H 00 H P107 P106 P105 P104 P103 P102 P101 P100
PRC10 FFFF F3F4 H 00 H X X X X X X X PRC100 b
PPR10 FFFF F3D4 H 00 H PPR107 PPR106 PPR105 PPR104 PPR103 PPR102 PPR101 PPR100
PDSC10 FFFF F314 H 00 H PDSC107 c PDSC106 c PDSC105 c PDSC104 c PDSC103 PDSC102 PDSC101 PDSC100
PICC10 FFFF F394 H FF H PICC107 c PICC106 c PICC105 c PICC104 c PICC103 PICC102 PICC101 PICC100
PILC10 FFFF F3B4 H 00 H PILC107 c PILC106 c PILC105 c PILC104 c PILC103 PILC102 PILC101 PILC100
PODC10 FFFF F374 H 00 H PODC107 PODC106 PODC105 PODC104 PODC103 PODC102 PODC101 PODC100
a)
µPD70F3421, µPD70F3422, µPD70F3423 only
b)
The setting of PRC100 is valid for the entire port group.
c) not available for µPD70F3427

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 89


Chapter 2 Pin Functions

2.4.15 Port group 11

Port group 11 is an 8-bit port group. In alternative mode, it comprises pins for
the following functions:
• Stepper Motor Controller/Driver outputs (SM11 to SM14, SM21 to SM24)
• Timer TMG2 channels (TOG21 to TOG24)
• Sound Generator outputs (SGO, SGOA)
Port group 11 includes the following pins:
Table 2-47 Port group 11: pin functions and port types
Pin functions in different modes
Port mode Alternative mode
(PMCnm = 0) (PMCnm = 1) Pin function
Port type
Output mode (PMnm = 0) Input mode after reset
(PMnm = 1)
PFCnm = 0 PFCnm = 1
ALT1-OUT ALT2-OUT
P110 (I/O) SM11 TOG21 – P110 (I) M
P111 (I/O) SM12 TOG22 – P111 (I) M
P112 (I/O) SM13 TOG23 – P112 (I) M
P113 (I/O) SM14 TOG24 – P113 (I) M
P114 (I/O) SM21 SGO – P114 (I) M
P115 (I/O) SM22 SGOA – P115 (I) M
P116 (I/O) SM23 – P116 (I) M
P117 (I/O) SM24 – P117 (I) M

Note 1. For pins that support only one alternative output mode, the PFCnm bit is
not available.
2. Alternative input functions of TMG2 are provided on two pins each. Thus
you can select on which pin the alternative function should appear.
Refer to “Alternative input selection“ on page 44.
3. Port group 11 is equipped with high driver buffers for stepper motor control.

www.DataSheet4U.com

90 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Table 2-48 Port group 11: configuration registers


Initial
Register Address Used bits
value
PM11 FFFF F436 H FF H PM117 PM116 PM115 PM114 PM113 PM112 PM111 PM110
PMC11 FFFF F456 H 00 H PMC117 PMC116 PMC115 PMC114 PMC113 PMC112 PMC111 PMC110
PFC11 FFFF F476 H 00 H X X PFC115 PFC114 PFC113 PFC112 PFC111 PFC110
P11 FFFF F416 H 00 H P117 P116 P115 P114 P113 P112 P111 P110
PRC11 FFFF F3F6 H 00 H X X X X X X X PRC110 a
PPR11 FFFF F3D6 H 00 H PPR117 PPR116 PPR115 PPR114 PPR113 PPR112 PPR111 PPR110
PICC11 FFFF F396 H FF H PICC117 PICC116 PICC115 PICC114 PICC113 PICC112 PICC111 PICC110
PILC11 FFFF F3B6 H 00 H PILC117 PILC116 PILC115 PILC114 PILC113 PILC112 PILC111 PILC110
PODC11 FFFF F376 H 00 H PODC117 PODC116 PODC115 PODC114 PODC113 PODC112 PODC111 PODC110
a)
The setting of PRC110 is valid for the entire port group.

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 91


Chapter 2 Pin Functions

2.4.16 Port group 12

Port group 12 is an 8-bit port group. In alternative mode, it comprises pins for
the following functions:
• Stepper Motor Controller/Driver outputs (SM51 to SM54, SM61 to SM64)
Port group 12 includes the following pins:
Table 2-49 Port group 12: pin functions and port types
Pin functions in different modes
Port mode Alternative mode
Pin function
(PMCnm = 0) (PMCnm = 1) Port type
after reset
Output mode Input mode
(PMnm = 0) (PMnm = 1)
P120 (I/O) SM51 – P120 (I) M
P121 (I/O) SM52 – P121 (I) M
P122 (I/O) SM53 – P122 (I) M
P123 (I/O) SM54 – P123 (I) M
P124 (I/O) SM61 – P124 (I) M
P125 (I/O) SM62 – P125 (I) M
P126 (I/O) SM63 – P126 (I) M
P127 (I/O) SM64 – P127 (I) M

Note Port group 12 is equipped with high driver buffers for stepper motor control.

Table 2-50 Port group 12: configuration registers


Initial
Register Address Used bits
value
PM12 a FFFF F438 H FF H PM127 PM126 PM125 PM124 PM123 PM122 PM121 PM120
PMC12 FFFF F458 H 00 H PMC127 PMC126 PMC125 PMC124 PMC123 PMC122 PMC121 PMC120
P12 FFFF F418 H 00 H P127 P126 P125 P124 P123 P122 P121 P120
PRC12 FFFF F3F8 H 00 H X X X X X X X PRC120 b
PPR12 FFFF F3D8 H 00 H PPR127 PPR126 PPR125 PPR124 PPR123 PPR122 PPR121 PPR120
PICC12 FFFF F398 H FF H PICC127 PICC126 PICC125 PICC124 PICC123 PICC122 PICC121 PICC120
PILC12 FFFF F3B8 H 00 H PILC127 PILC126 PILC125 PILC124 PILC123 PILC122 PILC121 PILC120
PODC12 FFFF F378 H 00 H PODC127 PODC126 PODC125 PODC124 PODC123 PODC122 PODC121 PODC120
a) PM12 register has to be changed from its default value FFH to 00H in order to enable the stepper motor con-
troller/driver outputs.
b)
The setting of PRC120 is valid for the entire port group.

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.

www.DataSheet4U.com

92 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

2.4.17 Port group 13

Port group 13 is an 8-bit port group. In alternative mode, it comprises pins for
the following functions:
• Stepper Motor Controller/Driver outputs (SM31 to SM34, SM41 to SM44)
• Timer TMG0 to TMG1 channels (TIG01 to TIG04, TOG01 to TOG04, TIG11
to TIG14, TOG11 to TOG14)
Port group 13 includes the following pins:
Table 2-51 Port group 13: pin functions and port types
Pin functions in different modes
Port mode Alternative mode
(PMCnm = 0) (PMCnm = 1) Pin function
Port type
output mode (PMnm = 0) Input mode after reset
(PMnm = 1)
PFCnm = 0 PFCnm = 1
ALT1-OUT ALT2-OUT
P130 (I/O) SM31 TOG01 TIG01 P130 (I) M
P131 (I/O) SM32 TOG02 TIG02 P131 (I) M
P132 (I/O) SM33 TOG03 TIG03 P132 (I) M
P133 (I/O) SM34 TOG04 TIG04 P133 (I) M
P134 (I/O) SM41 TOG11 TIG11 P134 (I) M
P135 (I/O) SM42 TOG12 TIG12 P135 (I) M
P136 (I/O) SM43 TOG13 TIG13 P136 (I) M
P137 (I/O) SM44 TOG14 TIG14 P137 (I) M

Note 1. Alternative input functions of TMG0…TMG1 are provided on two pins


each. Thus you can select on which pin the alternative function should
appear.
Refer to “Alternative input selection“ on page 44.
2. Port group 13 is equipped with high driver buffers for stepper motor control.

Table 2-52 Port group 13: configuration registers


Initial
Register Address Used bits
value
PM13 FFFF F43A H FF H PM137 PM136 PM135 PM134 PM133 PM132 PM131 PM130
PMC13 FFFF F45A H 00 H PMC137 PMC136 PMC135 PMC134 PMC133 PMC132 PMC131 PMC130
PFC13 FFFF F47A H 00 H PFC137 PFC136 PFC135 PFC134 PFC133 PFC132 PFC131 PFC130
P13 FFFF F41A H 00 H P137 P136 P135 P134 P133 P132 P131 P130
PRC13 FFFF F3FA H 00 H X X X X X X X PRC130 a
PPR13 FFFF F3DA H 00 H PPR137 PPR136 PPR135 PPR134 PPR133 PPR132 PPR131 PPR130
PICC13 FFFF F39A H FF H PICC137 PICC136 PICC135 PICC134 PICC133 PICC132 PICC131 PICC130
PILC13 FFFF F3BA H 00 H PILC137 PILC136 PILC135 PILC134 PILC133 PILC132 PILC131 PILC130
www.DataSheet4U.com
PODC13 FFFF F37A H 00 H PODC137 PODC136 PODC135 PODC134 PODC133 PODC132 PODC131 PODC130
a)
The setting of PRC130 is valid for the entire port group.

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.

User’s Manual U17566EE5V1UM00 93


Chapter 2 Pin Functions

2.4.18 Port group 14 (µPD70F3427 only)

Port group 14 is a 3-bit port group. In alternative mode, it comprises pins for
the following functions:
• External memory interface bus clock BCLK
• External memory interface byte enable signals BE2, BE3
Port group 14 includes the following pins:
Table 2-53 Port group 14: pin functions and port types
Pin functions in different modes
Port mode Alternative mode
Pin function
(PMCnm = 0) (PMCnm = 1) Port type
after reset
Output mode Input mode
(PMnm = 0) (PMnm = 1)
P140 (I/O) BCLK – P140 (I) M
P141 (I/O) BE2 – P141 (I) M
P142 (I/O) BE3 – P142 (I) M

Table 2-54 Port group 14: configuration registers


Initial
Register Address Used bits
value
PM14 FFFF F43C H FF H X X X X X PM142 PM141 PM140
PMC14 FFFF F45C H 10 H X X X 1a PMC143 b PMC142 PMC141 PMC140
P14 FFFF F41C H 00 H X X X X X P142 P141 P140
PRC14 FFFF F3FC H 00 H X X X X X X X PRC140 c
PPR14 FFFF F3DC H 00 H X X X X X PPR142 PPR141 PPR140
a)
This bit is set to 1 after reset and cannot be changed.
b) PMC143 specifies the data bus width of the external memory interface:
- PMC143 = 0: 16-bit data bus D[15:0], D[31:16] pins of port groups 3, 8, 9, 10 operate in port/alternative mode
- PMC143 = 1: 32-bit data bus D[31:0], D[31:16] pins of port groups 3, 8, 9, 10 operate as data bus pins
c) The setting of PRC140 is valid for the entire port group.

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.

www.DataSheet4U.com

94 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

2.4.19 Port group AL

Port group AL is a 16-bit port group. In alternative mode, it comprises pins for
the external memory interface address lines 0 to 15.
This port group is externally only available for µPD70F3419 devices.

Caution For the µPD70F3418 this port group must be configured as output port mode.
Thus set following registers as shown below:
• port mode: PMCAL = 0000H

• output port: PMAL = 0000H

Port group AL includes the following pins:


Table 2-55 Port group AL: pin functions and port types
Pin functions in different modes
Port mode Alternative mode
Pin function
(PMCnm = 0) (PMCnm = 1) Port type
after reset
Output mode Input mode
(PMnm = 0) (PMnm = 1)
PAL0 (I/O) A0 - PAL0 (I) M
PAL1 (I/O) A1 - PAL1 (I) M
PAL2 (I/O) A2 - PAL2 (I) M
PAL3 (I/O) A3 - PAL3 (I) M
PAL4 (I/O) A4 - PAL4 (I) M
PAL5 (I/O) A5 - PAL5 (I) M
PAL6 (I/O) A6 - PAL6 (I) M
PAL7 (I/O) A7 - PAL7 (I) M
PAL8 (I/O) A8 - PAL8 (I) M
PAL9 (I/O) A9 - PAL9 (I) M
PAL10 (I/O) A10 - PAL10 (I) M
PAL11 (I/O) A11 - PAL11 (I) M
PAL12 (I/O) A12 - PAL12 (I) M
PAL13 (I/O) A13 - PAL13 (I) M
PAL14 (I/O) A14 - PAL14 (I) M
PAL15 (I/O) A15 - PAL15 (I) M

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 95


Chapter 2 Pin Functions

Table 2-56 Port group AL: configuration registers


Initial
Register Address Used bits
value
PMALL FFFF F020 H FF H PMAL7 PMAL6 PMAL5 PMAL4 PMAL3 PMAL2 PMAL1 PMAL0
PMALH FFFF F021 H FF H PMAL15 PMAL14 PMAL13 PMAL12 PMAL11 PMAL10 PMAL9 PMAL8
PMAL FFFF F020 H FFFF H PMAL15 to PMAL8 (PMALH) PMAL7 to PMAL0 (PMALL)
(16 bit)
PMCALL FFFF F040 H 00 H PMCAL7 PMCAL6 PMCAL5 PMCAL4 PMCAL3 PMCAL2 PMCAL1 PMCAL0
PMCALH FFFF F041 H 00 H PMCAL15 PMCAL14 PMCAL13 PMCAL12 PMCAL11 PMCAL10 PMCAL9 PMCAL8
PMCAL FFFF F040 H 0000 H PMCAL15 to PMCAL8 (PMCALH) PMCAL7 to PMCAL0 (PMCALL)
(16 bit)
PALL FFFF F000 H 00 H PAL7 PAL6 PAL5 PAL4 PAL3 PAL2 PAL1 PAL0
PALH FFFF F001 H 00 H PAL15 PAL14 PAL13 PAL12 PAL11 PAL10 PAL9 PAL8
PAL FFFF F000 H 0000 H PAL15 to PAL8 (PALH) PAL7 to PAL0 (PALL)
(16 bit)
PRCAL FFFF F2E0 H 00 H X X X X X X X PRCAL0 a
PPRALL FFFF F2C0 H 00 H PPRAL7 PPRAL6 PPRAL5 PPRAL4 PPRAL3 PPRAL2 PPRAL1 PPRAL0
PPRALH FFFF F2C1 H 00 H PPRAL15 PPRAL14 PPRAL13 PPRAL12 PPRAL11 PPRAL10 PPRAL9 PPRAL8
PPRAL FFFF F2C0 H 0000 H PPRAL15 to PPRAL8 (PPRALH) PPRAL7 to PPRAL0 (PPRALL)
(16 bit)
PDSCEAL FFFF F260 H 00 H X X X X X X X PDSCEAL0
PDSCAL FFFF F240 H 00 H X X X X X X X PDSCAL0
PICCAL FFFF F280 H FF H X X X X X X X PICCAL0
PILCAL FFFF F2A0 H 01 H X X X X X X X PILCAL0
a) The setting of PRCAL0 is valid for the entire port group.

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.


All 16-bit registers can be accessed in 16-bit units.

w w w . D a t a S h e e t 4 U . c o m

96 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

2.4.20 Port group AH

Port group AH is a 7-bit port group. In alternative mode, it comprises pins for
the external memory interface address lines 16 to 22.
This port group is externally only available for µPD70F3419 devices.

Caution For the µPD70F3418 this port group must be configured as output port mode.
Thus set following registers as shown below:
• port mode: PMCAH = 00H
• output port: PMAH = 00H

Port group AH includes the following pins:


Table 2-57 Port group AH: pin functions and port types
Pin functions in different modes
Port mode Alternative mode
Pin function
(PMCnm = 0) (PMCnm = 1) Port type
after reset
Output mode Input mode
(PMnm = 0) (PMnm = 1)
PAH0 (I/O) A16 - PAH0 (I) M
PAH1 (I/O) A17 - PAH1 (I) M
PAH2 (I/O) A18 - PAH2 (I) M
PAH3 (I/O) A19 - PAH3 (I) M
PAH4 (I/O) A20 - PAH4 (I) M
PAH5 (I/O) A21 - PAH5 (I) M
PAH6 (I/O) A22 - PAH6 (I) M

Table 2-58 Port group AH: configuration registers


Initial
Register Address Used bits
value
PMAH FFFF F022 H FF H – PMAH6 PMAH5 PMAH4 PMAH3 PMAH2 PMAH1 PMAH0
PMCAH FFFF F042 H 00 H – PMCAH6 PMCAH5 PMCAH4 PMCAH3 PMCAH2 PMCAH1 PMCAH0
PAH FFFF F002 H 00 H – PAH6 PAH5 PAH4 PAH3 PAH2 PAH1 PAH0
PRCAH FFFF F2E2 H 00 H – X X X X X X PRCAH0 a
PPRAH FFFF F2C2 H 00 H – PPRAH6 PPRAH5 PPRAH4 PPRAH3 PPRAH2 PPRAH1 PPRAH0
PDSCEAH FFFF F262 H 00 H – X X X X X X PDSCEAH0
PDSCAH FFFF F242 H 00 H – X X X X X X PDSCAH0
PICCAH FFFF F282 H FF H – X X X X X X PICCAH0

w w w . PILCAH
D a t a SFFFF
h eF2A2
e Ht 4 01UH . c – o m X X X X X X PILCAH0
a)
The setting of PRCAH0 is valid for the entire port group.

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.


All 16-bit registers can be accessed in 16-bit units.

User’s Manual U17566EE5V1UM00 97


Chapter 2 Pin Functions

2.4.21 Port group CS

Port group CS is a 3-bit port group. In alternative mode, it comprises pins for
the following functions:
• External memory interface chip select signals (CS0, CS3, CS4)
• External memory interface data wait request (WAIT)
This port group is externally only available for µPD70F3419 devices.

Caution For the µPD70F3418 this port group must be configured as output port mode.
Thus set following registers as shown below:
• port mode: PMCCS = 00H
• output port: PMCS = 00H

Port group CS includes the following pins:


Table 2-59 Port group CS: pin functions and port types
Pin functions in different modes
Port mode Alternative mode
Pin function
(PMCnm = 0) (PMCnm = 1) Port type
after reset
Output mode Input mode
(PMnm = 0) (PMnm = 1)
PCS0 (I/O) CS0 – PCS0 (I) M
PCS3 (I/O) CS3 – PCS3 (I) M
PCS4 (I/O) CS4 WAIT PCS4 (I) M

Table 2-60 Port group CS: configuration registers


Initial
Register Address Used bits
value
PMCS FFFF F028 H FF H X X X PMCS4 PMCS3 X X PMCS0
PMCCS FFFF F048 H 00 H X X X PMCCS4 PMCCS3 X X PMCCS0
PCS FFFF F008 H 00 H X X X PCS4 PCS3 X X PCS0
PRCCS FFFF F2E8 H 00 H X X X X X X X PRCCS0 a
PPRCS FFFF F2C8 H 00 H X X X PPRCS4 PPRCS3 X X PPRCS0
PDSCECS FFFF F268 H 00 H X X X X X X X PDSCECS0
PDSCCS FFFF F248 H 00 H X X X X X X X PDSCCS0
PICCCS FFFF F288 H FF H X X X X X X X PICCCS0
PILCCS FFFF F2A8 H 01 H X X X X X X X PILCCS0
a)
The setting of PRCCS0 is valid for the entire port group.

w w w . D a t a S h Access
e e t 4 UAll
. c8-bit
o m registers can be accessed in 8-bit or 1-bit units.

98 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

2.4.22 Port group CT

Port group CT is a 2-bit port group. In alternative mode, it comprises pins for
the external memory interface read/write strobe.
This port group is externally only available for µPD70F3419 devices.

Caution For the µPD70F3418 this port group must be configured as output port mode.
Thus set following registers as shown below:
• port mode: PMCCT = 00H
• output port: PMCT = 00H

Port group CT includes the following pins:


Table 2-61 Port group CT: pin functions and port types
Pin functions in different modes
Port mode Alternative mode
Pin function
(PMCnm = 0) (PMCnm = 1) Port type
after reset
Output mode Input mode
(PMnm = 0) (PMnm = 1)
PCT0 (I/O) WR – PCT0 (I) M
PCT4 (I/O) RD – PCT4 (I) M

Table 2-62 Port group CT: configuration registers


Initial
Register Address Used bits
value
PMCT FFFF F02A H FF H X X X PMCT4 X X X PMCT0
PMCCT FFFF F04A H 00 H X X X PMCCT4 X X X PMCCT0
PCT FFFF F00A H 00 H X X X PCT4 X X X PCT0
PRCCT FFFF F2EA H 00 H X X X X X X X PRCCT0 a
PPRCT FFFF F2CA H 00 H X X X PPRCT4 X X X PPRCT0
PDSCECT FFFF F26A H 00 H X X X X X X X PDSCECT0
PDSCCT FFFF F24A H 00 H X X X X X X X PDSCCT0
PICCCT FFFF F28A H FF H X X X X X X X PICCCT0
PILCCT FFFF F2AA H 01 H X X X X X X X PILCCT0
a)
The setting of PRCCT0 is valid for the entire port group.

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.

w w w . D a t a S h e e t 4 U . c o m

User’s Manual U17566EE5V1UM00 99


Chapter 2 Pin Functions

2.4.23 Port group DL

Port group DL is a 16-bit port group. In alternative mode, it comprises pins for
the external memory interface data lines 0 to 15.
This port group is externally only available for µPD70F3419 devices.

Caution For the µPD70F3418 this port group must be configured as output port mode.
Thus set following registers as shown below:
• port mode: PMCDL = 00H
• output port: PMDL = 00H

Port group DL includes the following pins:


Table 2-63 Port group DL: pin functions and port type
Pin functions in different modes
Pin function
Port mode Alternative mode Port type
after reset
(PMCnm = 0) (PMCnm = 1)
PDL0 (I/O) D0 PDL0 (I) M
PDL1 (I/O) D1 PDL1 (I) M
PDL2 (I/O) D2 PDL2 (I) M
PDL3 (I/O) D3 PDL3 (I) M
PDL4 (I/O) D4 PDL4 (I) M
PDL5 (I/O) D5 PDL5 (I) M
PDL6 (I/O) D6 PDL6 (I) M
PDL7 (I/O) D7 PDL7 (I) M
PDL8 (I/O) D8 PDL8 (I) M
PDL9 (I/O) D9 PDL9 (I) M
PDL10 (I/O) D10 PDL10 (I) M
PDL11 (I/O) D11 PDL11 (I) M
PDL12 (I/O) D12 PDL12 (I) M
PDL13 (I/O) D13 PDL13 (I) M
PDL14 (I/O) D14 PDL14 (I) M
PDL15 (I/O) D15 PDL15 (I) M

Note Though D0-15 is a bidirectional bus don’t care about PMnm. The change of the
input and output direction is performed automatically, when data is read from
or written to the external bus.

www.DataSheet4U.com

100 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Table 2-64 Port group DL: configuration registers


Initial
Register Address Used bits
value
PMDLL FFFF F024 H FF H PMDL7 PMDL6 PMDL5 PMDL4 PMDL3 PMDL2 PMDL1 PMDL0
PMDLH FFFF F025 H FF H PMDL15 PMDL14 PMDL13 PMDL12 PMDL11 PMDL10 PMDL9 PMDL8
PMDL FFFF F024 H FFFF H PMDL15 to PMDL8 (PMDLH) PMDL7 to PMDL0 (PMDLL)
(16 bit)
PMCDLL FFFF F044 H 00 H PMCDL7 PMCDL6 PMCDL5 PMCDL4 PMCDL3 PMCDL2 PMCDL1 PMCDL0
PMCDLH FFFF F045 H 00 H PMCDL15 PMCDL14 PMCDL13 PMCDL12 PMCDL11 PMCDL10 PMCDL9 PMCDL8
PMCDL FFFF F044 H 0000 H PMCDL15 to PMCDL8 (PMCDLH) PMCDL7 to PMCDL0 (PMCDLL)
(16 bit)
PDLL FFFF F004 H 00 H PDL7 PDL6 PDL5 PDL4 PDL3 PDL2 PDL1 PDL0
PDLH FFFF F005 H 00 H PDL15 PDL14 PDL13 PDL12 PDL11 PDL10 PDL9 PDL8
PDL FFFF F004 H 0000 H PDL15 to PDL8 (PDLH) PDL7 to PDL0 (PDLL)
(16 bit)
PRCDL FFFF F2E4 H 00 H X X X X X X X PRCDL0 a
PPRDLL FFFF F2C4 H 00 H PPRDL7 PPRDL6 PPRDL5 PPRDL4 PPRDL3 PPRDL2 PPRDL1 PPRDL0
PPRDLH FFFF F2C5 H 00 H PPRDL15 PPRDL14 PPRDL13 PPRDL12 PPRDL11 PPRDL10 PPRDL9 PPRDL8
PPRDL FFFF F2C4 H 0000 H PPRDL15 to PPRDL8 (PPRDLH) PPRDL7 to PPRDL0 (PPRDLL)
(16 bit)
PDSCEDL FFFF F264 H 00 H X X X X X X X PDSCEDL0
PDSCDL FFFF F244 H 00 H X X X X X X X PDSCDL0
PICCDL FFFF F284 H FF H X X X X X X X PICCDL0
PILCDL FFFF F2A4 H 01 H X X X X X X X PILCDL0
a) The setting of PRCDL0 is valid for the entire port group.

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.


All 16-bit registers can be accessed in 16-bit units.

w w w . D a t a S h e e t 4 U . c o m

User’s Manual U17566EE5V1UM00 101


Chapter 2 Pin Functions

2.4.24 Port group DH

Port group DH is a 16-bit port group. In alternative mode, it comprises pins for
the external memory interface data lines 16 to 31.
This port group is externally only available for µPD70F3419 devices.

Caution For the µPD70F3418 this port group must be configured as output port mode.
Thus set following registers as shown below:
• port mode: PMCDH = 00H
• output port: PMDH = 00H

Port group DH includes the following pins:


Table 2-65 Port group DH: pin functions and port types
Pin functions in different modes
Pin function
Port mode Alternative mode Port type
after reset
(PMCnm = 0) (PMCnm = 1)
PDH0 (I/O) D16 PDH0 (I) M
PDH1 (I/O) D17 PDH1 (I) M
PDH2 (I/O) D18 PDH2 (I) M
PDH3 (I/O) D19 PDH3 (I) M
PDH4 (I/O) D20 PDH4 (I) M
PDH5 (I/O) D21 PDH5 (I) M
PDH6 (I/O) D22 PDH6 (I) M
PDH7 (I/O) D23 PDH7 (I) M
PDH8 (I/O) D24 PDH8 (I) M
PDH9 (I/O) D25 PDH9 (I) M
PDH10 (I/O) D26 PDH10 (I) M
PDH11 (I/O) D27 PDH11 (I) M
PDH12 (I/O) D28 PDH12 (I) M
PDH13 (I/O) D29 PDH13 (I) M
PDH14 (I/O) D30 PDH14 (I) M
PDH15 (I/O) D31 PDH15 (I) M

Note Though D16-31 is a bidirectional bus don’t care about PMnm. The change of
the input and output direction is performed automatically, when data is read
from or written to the external bus.

www.DataSheet4U.com

102 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Table 2-66 Port group DH: configuration registers


Initial
Register Address Used bits
value
PMDHL FFFF F026 H FF H PMDH7 PMDH6 PMDH5 PMDH4 PMDH3 PMDH2 PMDH1 PMDH0
PMDHH FFFF F027 H FF H PMDH15 PMDH14 PMDH13 PMDH12 PMDH11 PMDH10 PMDH9 PMDH8
PMDH FFFF F026 H FFFF H PMDHL15 to PMDH8 (PMDHH) PMDH7 to PMDH0 (PMDHL)
(16 bit)
PMCDHL FFFF F046 H 00 H PMCDH7 PMCDH6 PMCDH5 PMCDH4 PMCDH3 PMCDH2 PMCDH1 PMCDH0
PMCDHH FFFF F047 H 00 H PMCDH15 PMCDH14 PMCDH13 PMCDH12 PMCDH11 PMCDH10 PMCDH9 PMCDH8
PMCDH FFFF F046 H 0000 H PMCDHL15 to PMCDH8 (PMCDHH) PMCDH7 to PMCDH0 (PMCDHL)
(16 bit)
PDHL FFFF F006 H 00 H PDH7 PDH6 PDH5 PDH4 PDH3 PDH2 PDH1 PDH0
PDHH FFFF F007 H 00 H PDH15 PDH14 PDH13 PDH12 PDH11 PDH10 PDH9 PDH8
PDH FFFF F006 H 0000 H PDH15 to PDH8 (PDHH) PDH7 to PDH0 (PDHL)
(16 bit)
PRCDH FFFF F2E6 H 00 H X X X X X X X PRCDH0 a
PPRDHL FFFF F2C6 H 00 H PPRDH7 PPRDH6 PPRDH5 PPRDH4 PPRDH3 PPRDH2 PPRDH1 PPRDH0
PPRDHH FFFF F2C7 H 00 H PPRDH15 PPRDH14 PPRDH13 PPRDH12 PPRDH11 PPRDH10 PPRDH9 PPRDH8
PPRDH FFFF F2C6 H 0000 H PPRDH15 to PPRDH8 (PPRDHH) PPRDH7 to PPRDH0 (PPRDHL)
(16 bit)
PDSCEDH FFFF F266 H 00 H X X X X X X X PDSCEDH0
PDSCDH FFFF F246 H 00 H X X X X X X X PDSCDH0
PICCDH FFFF F286 H FF H X X X X X X X PICCDH0
PILCDH FFFF F2A6 H 01 H X X X X X X X PILCDH0
a) The setting of PRCDH0 is valid for the entire port group.

Access All 8-bit registers can be accessed in 8-bit or 1-bit units.


All 16-bit registers can be accessed in 16-bit units.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 103


Chapter 2 Pin Functions

2.5 Noise Elimination

The input signals at some pins are passed through a filter to remove noise and
glitches. The microcontroller supports both analog and digital filters. The
analog filters are always applied to the input signals, whereas the digital filters
can be enabled/disabled by control registers.

2.5.1 Analog filtered inputs

The external interrupts INTP0…INTP7and NMI and the external RESET input
are passed through an analog filter to remove noise and glitches. The analog
filter suppresses input pulses that are shorter than a specified puls width (refer
to the Data Sheet). This assures the hold time for the external interrupt signals.
The analog filter operates in all modes (normal mode and standby modes). It is
only effective if the corresponding pin works in alternative input mode and not
as a general purpose I/O port.

2.5.2 Digitally filtered inputs

The inputs of the peripherals listed below are passed through a digital filter to
remove noise and glitches.
The digital filter operates in all modes, which have the PLL enabled. Thus, it
does not operate in Watch, Sub-watch and Idle mode. The digital filter is only
effective if the corresponding pin works in alternative input mode and not as a
general purpose I/O port.
The digital input filter is available for the following external signals:

Table 2-67 Digitally filtered external signals


Module Signal Comment
CSIB0 SIB0, SCKB0 For high clock rates of the Clocked Serial
Interface, the digital filter should be disabled.
CSIB1 SIB1, SCKB1
Otherwise, desired input pulses may be
CSIB2 SIB2, SCKB2 removed by the digital filter.
TMP0 TIP00, TIP01
TMP1 TIP10, TIP11
TMP2 TIP20, TIP21
TMP3 TIP30, TIP31
TMG0 TIG01 to TIG04
TMG1 TIG11 to TIG14
TMG2 TIG20 to TIG25

Note The Timers G provide additional digital noise filters at their capture inputs
www.DataSheet4U.com TIGn1 to TIGn4. Refer also to the Data Sheet for the minimum capture inputs
pulse widths.

104 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

Filter operation The input terminal signal is sampled with the sampling frequency fs. Spikes
shorter than 2 sampling cycles are suppressed and no internal signal is
generated. Pulses longer than 3 sampling cycles are recognized as valid
pulses and an internal signal is generated. For pulses between 2 and 3
sampling cycles, the behaviour is not defined. The filter operation is illustrated
in Figure 2-6.

Input terminal

Filter output

Figure 2-6 Digital noise removal example

The minimum input terminal pulse width to be validated is defined by the


sampling frequency fs. The sampling frequency fs is PCLK0.

Table 2-68 Digital noise removal features


Sampling frequency Minimum pulse width to
fs = PCLK0 generate an internal signal
16 MHz (PLL enabled) 0.125 – 0.1875 µsec
4 MHz (PLL disabled) 0.5 – 0.75 µsec

The digital filter function can be individually enabled for each of the
aforementioned external input signals. The filter is enabled/disabled by the
16-bit registers DFEN0 and DFEN1.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 105


Chapter 2 Pin Functions

(1) DFEN0 - Digital filter enable register


The 16-bit DFEN0 register enables/disables the digital filter for TMP0 to TMP3
and TMG0 input channels and for CSIB0 to CSIB2 input channels.
Access This register can be read/written in 16-bit, 8-bit and 1-bit units.
Address FFFF F710H
Initial Value 0000H. This register is cleared by any reset.

15 14 13 12 11 10 9 8
DFENC15 DFENC14 DFENC13 DFENC12 DFENC11 DFENC10 DFENC9 DFENC8
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
DFENC7 DFENC6 DFENC5 DFENC4 DFENC3 DFENC2 DFENC1 DFENC0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 2-69 DFEN0 register contents


Bit position Bit name Function
15 to 0 DFENC[15:0] Enables/disables the digital noise elimination filter for
the corresponding input signal:
0: Digital filter is disabled.
1: Digital filter is enabled.
For an assignment of bit positions to input signals see
table Table 2-70.

Table 2-70 Assignment of input signals to bit positions for register DFEN0
Bit
Bit name Input signal Description
position
0 DFENC0 SIB0 CSIB0 data inputa
1 DFENC1 SIB1 CSIB1 data inputa
2 DFENC2 SIB2 CSIB2 data inputa b
3 DFENC3 SCKIB0 CSIB0 clock inputa
4 DFENC4 SCKIB1 CSIB1 clock inputa-
5 DFENC5 SCKIB2 CSIB2 clock inputa b
6 DFENC6 TIP00 Timer TMP0 channel 0 capture input
7 DFENC7 TIP01 Timer TMP0 channel 1 capture input
8 DFENC8 TIP10 Timer TMP1 channel 0 capture input
9 DFENC9 TIP11 Timer TMP1 channel 1 capture input
10 DFENC10 TIP20 Timer TMP2 channel 0 capture input
11 DFENC11 TIP21 Timer TMP2 channel 1 capture input
12 DFENC12 TIP30 Timer TMP3 channel 0 capture input
13 DFENC13 TIP31 Timer TMP3 channel 1 capture input
www.DataSheet4U.com
14 DFENC14 TIG01 Timer TMG0 channel 1 capture input
15 DFENC15 TIG02 Timer TMG0 channel 2 capture input
a)
Note that the digital filter should be disabled for high clock rates of the clocked
serial interface. Otherwise, desired input pulses may be suspended by the digital
filter.
b)
µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427 only

106 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

(2) DFEN1 - Digital filter enable register


The 16-bit DFEN1 register enables/disables the digital filter for TMG0 to TMG2
and TMP0 to TMP1 input channels.
Access This register can be read/written in 16-bit, 8-bit and 1-bit units.
Address FFFF F712H
Initial Value 0000H. This register is cleared by any reset.

15 14 13 12 11 10 9 8
X X X X DFENC27 DFENC26 DFENC25 DFENC24
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
DFENC23 DFENC22 DFENC21 DFENC20 DFENC19 DFENC18 DFENC17 DFENC16
R/W R/W R/W R/W R/W R/W R/W R/W

Table 2-71 DFEN1 register contents


Bit position Bit name Function
11 to 0 DFENC[27:16] Enables/disables the digital noise elimination filter for
the corresponding input signal:
0: Digital filter is disabled.
1: Digital filter is enabled.
For an assignment of bit positions to input signals
see table Table 2-72.

Table 2-72 Assignment of input signals to bit positions for register DFEN1
Bit
Bit name Input signal Description
position
0 DFENC16 TIG03 Timer TMG0 channel 3 capture input
1 DFENC17 TIG04 Timer TMG0 channel 4 capture input
2 DFENC18 TIG11 Timer TMG1 channel 1 capture input
3 DFENC19 TIG12 Timer TMG1 channel 2 capture input
4 DFENC20 TIG13 Timer TMG1 channel 3 capture input
5 DFENC21 TIG14 Timer TMG1 channel 4 capture input
DFENC22 TIP00/TIG20 shared input:
6 Timer TMP0 channel 0 capture input /
Timer TMG2 channel 0 capture input
7 DFENC23 TIG21 Timer TMG2 channel 1 capture input
8 DFENC24 TIG22 Timer TMG2 channel 2 capture input
9 DFENC25 TIG23 Timer TMG2 channel 3 capture input
10 DFENC26 TIG24 Timer TMG2 channel 4 capture input
DFENC27 TIP10/TTIG25 shared input:
11 Timer TMP1 channel 0 capture input/
www.DataSheet4U.com Timer TMG2 channel 5 capture input

User’s Manual U17566EE5V1UM00 107


Chapter 2 Pin Functions

2.6 Pin Functions in Reset and Power Save Modes

The following table summarizes the status of the pins during reset and power
save modes and after release of these operating states in normal operation
mode, i.e. = 0.
The reset source makes a difference concerning the N-Wire debugger
interface pins DRST, DDI, DDO, DCK and DMS after reset release. An external
RESET or an internal Power-on-clear switches all pins to input port mode,
while all other internal reset sources make the pins available for the debugger.
In contrast to all other power save modes the HALT mode suspends only the
CPU operation and has no effect on any pin status.

Table 2-73 Pin functions during and after reset / power save modes

Operating status Pin status


Power-On- during • P05/DRST: P05 port input with internal pull-down resistor
Clear • all other pins: Hi-Z (3-state)
after • all ports Pnm: input port mode
• A[23:0], D[15:0], BE[1:0], RD, WR, WAIT: input
external during • P05/DRST: P05 port input with internal pull-down resistor
RESET • all other pins: Hi-Z (3-state)
after • P05/DRST: DRST input with internal pull-down resistor
• P52/DDI, P54/DCK, P55/DMS: DDI, DCK, DMS inputs
• P53/DDO: DDO output
• all ports Pnm: input port mode
• A[23:0], D[15:0], BE[1:0], RD, WR, WAIT: input
all other during • P05/DRST: P05 port input with internal pull-down resistor
reset • all other pins: Hi-Z (3-state)
sources
after • P05/DRST, P52/DDI, P54/DCK, P55/DMS, P53/DDO: no
change. same function as before reset
• all ports Pnm: input port mode
• A[23:0], D[15:0], BE[1:0], RD, WR, WAIT: input
HALT mode during same as before HALT mode
after
IDLE, during same as before power save mode:
WATCH, • Output signals are valid and output levels are remained.
Sub-WATC • Input signals with wake-up capabilitya are valid.
H, STOP
• Input signals without wake-up capability are ignored.
mode
after same as before power save mode
a) Inputs with wake-up capability: external interrupts (INTP0 to INTP7, NMI) and CAN
receive data (CRXD0, CRXD1)

Note For information about the status of the external memory I/F pins refer to
Chapter 7 on page 255.
www.DataSheet4U.com If flash programming mode is enabled by FLMD0 = 1, P07 is used as FLMD1
pin in input port mode during and after reset.

108 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

2.7 Recommended Connection of unused Pins

If a pin is not used, it is recommended to connect it as follows:


• output pins: leave open
• input pins: connect to VDD5 or VSS5

Sub oscillator If no sub oscillator crystal is connected , connect XT1 to Vss and leave XT2
connection open.

µPD70F3427 If the external memory interface of the µPD70F3427 is not used connect the
memory interface pins D[15:0] via pull-up or pull-down resistors to MVDD5n respectively MVSS5n.

Caution Note that the WAIT pin must be connected to MVDD5n via a pull-up resistor in
any case, also if the memory interface is used.

Note If the overall maximum output current of a concerned pin group exceeds its
maximum value the output buffer can be damaged. A placement of a series
resistor to prevent damage in case of accidentally enabled outputs is
recommended. Refer to the absolute maximum rating parameter in the Data
Sheet.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 109


Chapter 2 Pin Functions

2.8 Package Pins Assignment

The following sections show the location of pins in top view. Every pin is
labelled with its pin number and all possible pin names.

2.8.1 µPD70F3421, µPD70F3422, µPD70F3423

P67/TIG23/TIP31/TOG23/TOP31/SEG19
P66/TIG22/TIP21/TOG22/TOP21/SEG18

P63/TIG24/TIP11/TOG24/TOP11/SEG15

P61/TIG21/TIP01/TOG21/TOP01/SEG13

P37/TIG24/TOG24/TOP11/SEG11
P36/TIG23/TOG23/TOP31/SEG10
P35/TIG22/TOG22/TOP21/SEG9
P34/TIG21/TOG21/TOP01/SEG8
P62/TIG25/TIP10/TOP10/SEG14

P60/TIG20/TIP00/TOP00/SEG12
P65/TIP30/TOP30/SDA0/SEG17
P64/TIP20/TOP20/SCL0/SEG16
P105/SIB0/DBWR/SEG34

P27/TIG14/TOG14/SEG7
P26/TIG13/TOG13/SEG6
P25/TIG12/TOG12/SEG5
P24/TIG11/TOG11/SEG4
P91/DBD1/SOB1/SEG37

P83/TOY0/FOUT/SEG23
P90/DBD0/SIB1/SEG36

P107/SCKB0/SEG32
P104/DBRD/SEG35

P33/RXDA1/SEG29
P87/RXDA0/SEG28

P45/SCKB1/SEG20
P106/SOB0/SEG33

P32/TXDA1/SEG31
P86/TXDA0/SEG30

P85/FOUT/SEG27

P44/SOB1/SEG21
P43/SIB1/SEG22
P80/SEG26
P81/SEG25
P82/SEG24

BVDD51
BVSS51
108
107
106
105
104
103
102
101
100
99
98
97
96
95
94
93
92
91
90
89
88
87
86
85
84
83
82
81
80
79
78
77
76
75
74
73
P92/SCKB1/DBD2/SEG38 109 72 P23/TIG04/TOG04/SEG3
P93/DBD3/SEG39 110 71 P22/TIG03/TOG03/SEG2
P94/DBD4/COM0 111 70 P21/TIG02/TOG02/SCL1/SEG1
P95/DBD5/COM1 112 69 P20/TIG01/TOG01/SDA1/SEG0
P96/DBD6/COM2 113 68 P17/SCL0/CRXD2
P97/DBD7/COM3 114 67 P16/SDA0/CTXD2
DVDD50 115 66 VSS51
DVSS50 116 65 REGC1
VDD52 117 64 VDD51
REGC2 118 63 P30/TXDA0/SDA1
VSS52 119 62 P31/RXDA0/SCL1
FLMD0 120 61 P47/CTXD0
X1 121 60 P46/CRXD0
X2 122 59 P57/TXDA1/CTXD1
RESET
XT1
123
124
V850E / DJ3 58
57
P56/RXDA1/CRXD1
P42/SCKB0

P07/INTP6/VCMPO0/VCMPO1/FLMD1
XT2 125
126 µPD70F3421 56
55
P41/SOB0
P40/INTP6/SIB0
VCMP0 127 54 P100/TIP00/TIP11/TOP00/TOP11
VCMP1
P715
128
129
µPD70F3422 53
52
P101/TIP01/TIP10/TOP01/TOP10
P102/TIP20/TIP31/TOP20/TOP31
P714
P713
130
131 µPD70F3423 51
50
P103/TIP21/TIP30/TOP21/TOP30
BVSS50
P712 132 49 BVDD50
P711/AIN11 133 48 P51/SGO
P710/AIN10 134 47 P50/FOUT/SGOA
P79/AIN9 135 46 P84/TOY0
P78/AIN8 136 45 VSS50
P77/AIN7 137 44 REGC0
P76/AIN6 138 43 VDD50
P75/AIN5 139 42 P52/DDI
P74/AIN4 140 41 P53/DDO
P73/AIN3 141 40 P54/DCK
P72/AIN2 142 39 P55/DMS
P71/AIN1 143 38 P05/DRST
P70/AIN0 144 37 P00/INTP0/NMI
10

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
11
1
2
3
4
5
6
7
8
9
AVREF
AVDD
AVSS
P110/SM11/TOG21
P111/SM12/TOG22
P112/SM13/TOG23
-P113/SM14/TOG24
SMVDD50
SMVSS50
P114/SM21/SGO
P115/SM22/SGOA
P116/SM23
P117/SM24
P120/SM51
P121/SM52
P122/SM53
P123/SM54
P124/SM61
P125/SM62
P126/SM63
P127/SM64
P130/TIG01/SM31/TOG01
P131/TIG02/SM32/TOG02
P132/TIG03/SM33/TOG03
P133/TIG04/SM34/TOG04
SMVDD51
SMVSS51
P134/TIG11/SM41/TOG11
P135/TIG12/SM42/TOG12
P136/TIG13/SM43/TOG13
P137/TIG14/SM44/TOG14
P06/INTP5
P04/INTP4
P03/INTP3
P02/INTP2
P01/INTP1

Figure 2-7 Pin overview of µPD70F3421, µPD70F3422, µPD70F3423

www.DataSheet4U.com

110 User’s Manual U17566EE5V1UM00


Pin Functions Chapter 2

2.8.2 µPD70F3424, µPD70F3425, µPD70F3426A

P67/TIG23/TIP31/TOG23/TOP31
P66/TIG22/TIP21/TOG22/TOP21

P63/TIG24/TIP11/TOG24/TOP11

P61/TIG21/TIP01/TOG21/TOP01

P37/TIG24/TOG24/TOP11
P36/TIG23/TOG23/TOP31
P35/TIG22/TOG22/TOP21
P34/TIG21/TOG21/TOP01
P62/TIG25/TIP10/TOP10

P60/TIG20/TIP00/TOP00
P65/TIP30/TOP30/SDA0
P64/TIP20/TOP20/SCL0

P27/TIG14/TOG14
P26/TIG13/TOG13
P25/TIG12/TOG12
P24/TIG11/TOG11
P105/SIB0/DBWR
P91/SOB1/DBD1

P83/TOY0/FOUT
P90/SIB1/DBD0

P107/SCKB0
P104/DBRD

P33/RXDA1
P87/RXDA0

P82/SCKB2

P45/SCKB1
P106/SOB0

P32/TXDA1
P86/TXDA0

P85/FOUT

P81/SOB2

P44/SOB1
P80/SIB2

P43/SIB1

BVDD51
BVSS51
108
107
106
105
104
103
102
101
100
99
98
97
96
95
94
93
92
91
90
89
88
87
86
85
84
83
82
81
80
79
78
77
76
75
74
73
P92/SCKB1/DBD2 109 72 P23/TIG04/TOG04
P93/DBD3 110 71 P22/TIG03/TOG03
P94/SIB2/DBD4 111 70 P21/TIG02/TOG02/SCL1
P95/SOB2/DBD5 112 69 P20/TIG01/TOG01/SDA1
P96/SCK2/DBD6 113 68 P17/SCL0/CRXD2 Note
P97/DBD7 114 67 P16/SDA0/CTXD2 Note
DVDD50 115 66 VSS51
DVSS50 116 65 REGC1
VDD52 117 64 VDD51
REGC2 118 63 P30/TXDA0/SDA1
VSS52 119 62 P31/RXDA0/SCL1
FLMD0 120 61 P47/CTXD0
X1 121 60 P46/CRXD0
X2
RESET
122
123 V850E / DJ3 59
58
P57/TXDA1/CTXD1
P56/RXDA1/CRXD1
XT1 124 57 P42/SCKB0

P07/INTP6/VCMPO0/VCMPO1/FLMD1
XT2 125
126
µPD70F3424 56
55
P41/SOB0
P40/INTP6/SIB0
VCMP0 127 54 P100/TIP00/TIP11/TOP00/TOP11
VCMP1
P715/AIN15
128
129
µPD70F3425 53
52
P101/TIP01/TIP10/TOP01/TOP10
P102/TIP20/TIP31/TOP20/TOP31
P714/AIN14
P713/AIN13
130
131
µPD70F3426A 51
50
P103/TIP21/TIP30/TOP21/TOP30
BVSS50
P712/AIN12 132 49 BVDD50
P711/AIN11 133 48 P51/SGO
P710/AIN10 134 47 P50/INTP7/FOUT/SGOA
P79/AIN9 135 46 P84/INTP7/TOY0
P78/AIN8 136 45 VSS50
P77/AIN7 137 44 REGC0
P76/AIN6 138 43 VDD50
P75/AIN5 139 42 P52/DDI
P74/AIN4 140 41 P53/DDO
P73/AIN3 141 40 P54/DCK
P72/AIN2 142 39 P55/DMS
P71/AIN1 143 38 P05/DRST
P70/AIN0 144 37 P00/INTP0/NMI
10

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
11
1
2
3
4
5
6
7
8
9
AVREF
AVDD
AVSS
P110/SM11/TOG21
P111/SM12/TOG22
P112/SM13/TOG23
P113/SM14/TOG24
SMVDD50
SMVSS50
P114/SM21/SGO
P115/SM22/SGOA
P116/SM23
P117/SM24
P120/SM51
P121/SM52
P122/SM53
P123/SM54
P124/SM61
P125/SM62
P126/SM63
P127/SM64
P130/TIG01/SM31/TOG01
P131/TIG02/SM32/TOG02
P132/TIG03/SM33/TOG03
P133/TIG04/SM34/TOG04
SMVDD51
SMVSS51
P134/TIG11/SM41/TOG11
P135/TIG12/SM42/TOG12
P136/TIG13/SM43/TOG13
P137/TIG14/SM44/TOG14
P06/INTP5
P04/INTP4
P03/INTP3
P02/INTP2
P01/INTP1

Figure 2-8 Pin overview of µPD70F3424, µPD70F3425, µPD70F3426A

Note CRXD2, CTXD2 not available on µPD70F3426A

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 111


112
Chapter 2

www.DataSheet4U.com
P70/AIN0
P71/AIN1
P72/AIN2
P73/AIN3
P74/AIN4
P75/AIN5
P76/AIN6
P77/AIN7
P78/AIN8
P79/AIN9
P710/AIN10
P711/AIN11
P712/AIN12
P713/AIN13
P714/AIN14
P715/AIN15
VCMP1
VCMP0
P07/INTP6/VCMPO0/VCMPO1/FLMD1
XT2
XT1
RESET
X2
X1
FLMD0
VSS52
REGC2
VDD52
P85/FOUT
P80/SIB2
P81/SOB2
P82/SCKB2
P83/TOY0/FOUT
P43/SIB1
P44/SOB1
P45/SCKB1
P67/TIG23/TIP31/TOG23/TOP31
P66/TIG22/TIP21/TOG22/TOP21
P65/TIP30/TOP30/SDA0
P64/TIP20/TOP20/SCL0
P63/TIG24/TIP11/TOG24/TOP11
P62/TIG25/TIP10/TOP10
BVSS51
BVDD51
P61/TIG21/TIP01/TOG21/TOP01
P60/TIG20/TIP00/TOP00
P37/TIG24/TOG24/TOP11
P36/TIG23/TOG23/TOP31
P35/TIG22/TOG22/TOP21
P34/TIG21/TOG21/TOP01
P27/TIG14/TOG14
P26/TIG13/TOG13

Figure 2-9
208
207
206
205
204
203
202
201
200
199
198
197
196
195
194
193
192
191
190
189
188
187
186
185
184
183
182
181
180
179
178
177
176
175
174
173
172
171
170
169
168
167
166
165
164
163
162
161
160
159
158
157
AVREF 1 156 P25/TIG12/TOG12
AVDD 2 155 P24/TIG11/TOG11
AVSS 3 154 P23/TIG04/TOG04
P110/SM11/TOG21 4 153 P22/TIG03/TOG03
P111/SM12/TOG22 5 152 P21/TIG02/TOG02/SCL1
P112/SM13/TOG23 6 151 P20/TIG01/TOG01/SDA1
P113/SM14/TOG24 7 150 P17/SCL0/CRXD2
SMVDD50 8 149 P16/SDA0/CTXD2
SMVSS50 9 148 P30/TXDA0/SDA1
P114/SM21/SGO 10 147 P31/RXDA0/SCL1
P115/SM22/SGOA 11 146 P47/CTXD0
P116/SM23 12 145 P46/CRXD0
P117/SM24 13 144 P57/CTXD1/TXDA1
2.8.3 µPD70F3427

P120/SM51 14 143 P56/CRXD1/RXDA1


P121/SM52 15 142 P42/SCKB0
P122/SM53 16 141 P41/SOB0
P123/SM54 17 140 P40/INTP6/SIB0
P124/SM61 18 139 P100/TIP00/TIP11/TOP00/TOP11
P125/SM62 19 138 P101/TIP01/TIP10/TOP01/TOP10
P126/SM63 20 137 P102/TIP21/TIP31/TOP20/TOP31
P127/SM64 21 136 P103/TIP21/TIP30/TOP21/TOP30
P130/TIG01/SM31/TOG01 22 135 BVSS50

User’s Manual U17566EE5V1UM00


P131/TIG02/SM32/TOG02 23 134 BVDD50
P132/TIG03/SM33/TOG03 24 133 P51/SGO

Pin overview of µPD70F3427


P133/TIG04/SM34/TOG04 25 132 P50/INTP7/FOUT/SGOA
SMVDD51 26 131 P84/INTP7/TOY0
SMVSS51 27 130 P52/DDI
P134/TIG11/SM41/TOG11 28 129 P53/DDO
P135/TIG12/SM42/TOG12 29 128 P54/DCK
P136/TIG13/SM43/TOG13 30 127 P55/DMS
P137/TIG14/SM44/TOG14 31 126 P05/DRST
P97/DBD7/D31 32
V850E/DL3 125 P00/INTP0/NMI

µPD70F3427
P96/SCKB2/DBD6/D30 33 124 P01/INTP1
P95/SOB2/DBD5/D29 34 123 P02/INTP2
P94/SIB2/DBD4/D28 35 122 P03/INTP3
DVDD50 36 121 P04/INTP4
DVSS50 37 120 P06/INTP5
P93/DBD3/D27 38 119 A23
P92/SCKB1/DBD2/D26 39 118 A22
P91/SOB1/DBD1/D25 40 117 A21
P90/SIB1/DBD0/D24 41 116 A20
P107/SCKB0/D23 42 115 A19
P106/SOB0/D22 43 114 MVSS54
P105/SIB0/DBWR/D21 44 113 MVDD54
P104/DBRD/D20 45 112 A18
P33/RXDA1/D19 46 111 A17
DVDD51 47 110 A16
DVSS51 48 109 A15
P32/TXDA1/D18 49 108 A14
P87/RXDA0/D17 50 107 A13
P86/TXDA0/D16 51 106 A12
P142/BE3 52 105 A11

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

A0
A1
A2
A3
A4
A5
A6
A7
A8
A9

D0
D1
D2
D3
D4
D5
D6
D7
D8
D9

RD
WR
D11
A10

D10
D12
D13
D14
D15

BE1
BE0
CS4
CS3
CS1
CS0

WAIT
VSS50
VSS51

VDD50
VDD51

REGC0
REGC1

MVSS50
MVSS51
MVSS52
MVSS53

MVDD50
MVDD51
MVDD52
MVDD53

P141/BE2
P140/BCLK
Pin Functions
Chapter 3 CPU System Functions

This chapter describes the registers of the CPU, the operation modes, the
address space and the memory areas.

3.1 Overview

The CPU is founded on Harvard architecture and it supports a RISC instruction


set. Basic instructions can be executed in one clock period. Optimized five-
stage pipelining is supported. This improves instruction execution speed.
In order to make the microcontroller ideal for use in digital control applications,
a 32-bit hardware multiplier enables this CPU to support multiply instructions,
saturated multiply instructions, bit operation instructions, etc.
Features summary The CPU has the following special features:
• Memory space:
– 64 MB linear program space
– 4 GB linear data space
• 32 general purpose registers
• Internal 32-bit architecture
• Five-stage pipeline
• Efficient multiplication and division instructions
• Saturation logic (saturated operation instructions)
• Barrel shifter (32-bit shift in one clock cycle)
• Instruction formats: long and short
• Four types of bit manipulation instructions: set, clear, not, test

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 113


Chapter 3 CPU System Functions

3.1.1 Description

The figure below shows a block diagram of the microcontroller, focusing on the
CPU and modules that interact with the CPU directly. Table 3-1 lists the bus
types.

CPU
RCU interface

System controller

Instruction queue

V Multiplier
F (32 × 32 → 64)
B Program counter

General-purpose Barrel
registers shifter

Bus control unit


System registers ALU
(BCU) V
S
V B
D
B

DMA control unit

(DMAC)

Interrupt control unit

(INTC)

Bus bridge

(BBR)

Standby control unit

(STBC)

NPB

Figure 3-1 CPU system

The shaded busses are used for accessing the configuration registers of the
concerned modules.

Table 3-1 Bus types


www.DataSheet4U.com
Bus type Function
NPB – NEC Peripheral Bus Bus interface to the peripherals (internal bus).

114 User’s Manual U17566EE5V1UM00


CPU System Functions Chapter 3

Table 3-1 Bus types


Bus type Function
VSB – V850 System Bus Bus interface to the Memory Controller for access to external memory, additional
internal memory and to the NPB bus bridge BBR.
VFB – V850 Fetch Bus Interface to the internal flash.
VDB – V850 Data Bus Interface to the internal RAM.

3.2 CPU Register Set

There are two categories of registers:


• General purpose registers
• System registers
All registers are 32-bit registers. An overview is given in the figure below. For
details, refer to V850E1 User’s Manual Architecture.

31 0 31 0
r0 (Zero Register) EIPC (Status Saving Register during interrupt)
r1 (Reserved for Assembler) EIPSW (Status Saving Register during interrupt)
r2 (Interrupt Stack Pointer)
r3 (Stack Pointer (SP)) FEPC (Status Saving Register during NMI)
r4 (Global Pointer (GP)) FEPSW (Status Saving Register during NMI)
r5 (Text Pointer (TP))
r6
ECR (Interrupt/Execution Source Register)
r7
r8
PSW (Program Status Word)
r9
r1 0
CTPC (Status Saving Register during CALLT execution)
r1 1
CTPSW (Status Saving Register during CALLT execution)
r1 2
r1 3
DBPC (Status Saving Register during exception/debug trap)
r1 4
DBPSW (Status Saving Register during exception/debug trap)
r1 5
r1 6
r1 7 CTBP (CALLT Base Pointer)
r1 8
r1 9 PC (Program Counter)
r2 0
r2 1
r2 2
r2 3
r2 4
r2 5
r2 6
r2 7
r2 8
r2 9
r3 0 (Element Pointer (EP))
www.DataSheet4U.comr3 1 (Link Pointer (LP))

Figure 3-2 CPU register set

User’s Manual U17566EE5V1UM00 115


Chapter 3 CPU System Functions

Some registers are write protected. That means, writing to those registers is
protected by a special sequence of instructions. Refer to “Write Protected
Registers“ on page 135 for more details.

www.DataSheet4U.com

116 User’s Manual U17566EE5V1UM00


CPU System Functions Chapter 3

3.2.1 General purpose registers (r0 to r31)

Each of the 32 general purpose registers can be used as a data variable or


address variable.
However, the registers r0, r1, r3 to r5, r30, and r31 may implicitly be used by
the assembler/compiler (see table Table 3-2). For details refer to the
documentation of your assembler/compiler.

Table 3-2 General purpose registers


Register name Usage Operation
r0 Zero register Always holds 0. It is used for
operations using 0 and offset 0
addressing.a
r1 Assembler-reserved register Used for 32-bit direct addressing.b
r2 User address/data variable register
r3 Stack pointer (SP) Used to generate stack frame when
function is called.b
r4 Global pointer (GP) Used to access global variable in
data area.b
r5 Text pointer (TP) Used to indicate the start of the text
area (where program code is
located).b
r6 to r29 User address/data variable registers
r30 Element pointer (EP) Base pointer when memory is
accessed by means of instructions
SLD (short format load) and SST
(short format store).a
r31 Link pointer (LP) Used when calling a function.b
a) Registers r0 and r30 are used by dedicated instructions.
b)
Registers r1, r3, r4, r5, and r31 may be used by the assembler/compiler.

Caution Before using registers r1, r3 to r5, r30, and r31, their contents must be saved
so that they are not lost. The contents must be restored to the registers after
the registers have been used.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 117


Chapter 3 CPU System Functions

3.2.2 System register set

System registers control the status of the CPU and hold interrupt information.
Additionally, the program counter holds the instruction address during program
execution.
To read/write the system registers, use instructions LDSR (load to system
register) or STSR (store contents of system register), respectively, with a
specific system register number (regID) indicated below.
The program counter states an exception. It cannot be accessed via LDSR or
STSR instructions. No regID is allocated to the program counter.
Example STSR 0, r2
Stores the contents of system register 0 (EIPC) in general purpose register r2.
System register The table below gives an overview of all system registers and their system
numbers register number (regID). It shows whether a load/store instruction is allowed (×)
for the register or not (–).

Table 3-3 System register numbers


Operand specification
regID System register name Shortcut
LDSR STSR
0 Status saving register during interrupt EIPC
× ×
(stores contents of PC)
1 Status saving register during interrupt EIPSW
× ×
(stores contents of PSW)
2 Status saving register during non-maskable interrupts FEPC
× ×
(stores contents of PC)
3 Status saving register during non-maskable interrupts FEPSW
× ×
(stores contents of PSW)
4 Interrupt source register ECR – ×
5 Program status word PSW × ×
6 to 15 Reserved (operations that access these register numbers
– –
cannot be guaranteed).
16 Status saving register during CALLT execution CTPC
× ×
(stores contents of PC)
17 Status saving register during CALLT execution CTPSW
× ×
(stores contents of PSW)
18 Status saving register during exception/debug trap DBPC
×a ×
(stores contents of PC)
19 Status saving register during exception/debug trap DBPSW
×a ×
(stores contents of PSW)
20 CALLT base pointer CTBP × ×
21 to 31 Reserved (operations that access these register numbers
– –
cannot be guaranteed).
a)Reading from this register is only enabled between a DBTRAP exception (exception handler address
0000 0060H) and the exception handler terminating DBRET instruction. DBTRAP exceptions are generated
w w w . D aupon
t a ILGOP
S h eand
e ROM
t 4 UCorrection
. c o mdetections (refer to “Interrupt Controller (INTC)“ on page 201 and “ROM
Correction Function (ROMC)“ on page 375).

118 User’s Manual U17566EE5V1UM00


CPU System Functions Chapter 3

(1) PC - Program counter


The program counter holds the instruction address during program execution.
The lower 26 bits are valid, and bits 31 to 26 are fixed to 0. If a carry occurs
from bit 25 to 26, it is ignored. Branching to an odd address cannot be
performed. Bit 0 is fixed to 0.
Access This register can not be accessed by any instruction.
Initial Value 0000 0000H. The program counter is cleared by any reset.

31 26 25 1 0
fixed to 0 instruction address during execution 0

(2) EIPC, FEPC, DBPC, CTPC - PC saving registers


The PC saving registers save the contents of the program counter for different
occasions, see Table 3-4.
When one of the occasions listed in Table 3-4 occurs, except for some
instructions, the address of the instruction following the one being executed is
saved to the saving registers.
For more details refer to Table 3-9 on page 123 and to the “Interrupt Controller
(INTC)“ on page 201.

All PC saving registers are built up as the PC, with the initial value 0xxx xxxxH
(x = undefined).

Table 3-4 PC saving registers


Register Shortcut Saves contents of PC in case of
Status saving register EIPC • software exception
during interrupt • maskable interrupt
Status saving register FEPC • non-maskable interrupt
during non-maskable
interrupts
Status saving register DBPCa • exception trap
during exception/debug • debug trap
trap • debug break
• during a single-step operation
Status saving register CTPC • execution of CALLT instruction
during CALLT execution
a) Reading from this register is only enabled between a DBTRAP exception (excep-
tion handler address 0000 0060H) and the exception handler terminating DBRET
instruction. DBTRAP exceptions are generated upon ILGOP and ROM Correction
detections (refer to “Interrupt Controller (INTC)“ on page 201 and “ROM Correction
Function (ROMC)“ on page 375).

Note When multiple interrupt servicing is enabled, the contents of EIPC or FEPC
must be saved by program—because only one PC saving register for
www.DataSheet4U.com maskable interrupts and non-maskable interrupts is provided, respectively.

Caution When setting the value of any of the PC saving registers, use even values
(bit 0 = 0). If bit 0 is set to 1, the setting of this bit is ignored.
This is because bit 0 of the program counter is fixed to 0.

User’s Manual U17566EE5V1UM00 119


Chapter 3 CPU System Functions

(3) PSW - Program status word


The 32-bit program status word is a collection of flags that indicates the status
of the program (result of instruction execution) and the status of the CPU.
If the bits in the register are modified by the LDSR instruction, the PSW will
take on the new value immediately after the LDSR instruction has been
executed.
Initial Value 0000 0020H. The program status is initialized by any reset.

31 8 7 6 5 4 3 2 1 0
fixed to 0 NP EP ID SAT CY OV S Z
R R R/W R/W R/W R/W R/W R/W R/W R/W

Table 3-5 PSW register contents


Bit position Flag Function
7 NP Indicates that non-maskable interrupt (NMI) servicing is in progress.
This flag is set when NMI request is acknowledged, and multiple interrupt
servicing is disabled.
0: NMI servicing is not in progress.
1: NMI servicing is in progress.
6 EP Indicates that exception processing is in progress.
This flag is set when an exception occurs. Even when this bit is set, interrupt
requests can be acknowledged.
0: Exception processing is not in progress.
1: Exception processing is in progress.
5 ID Indicates whether a maskable interrupt request can be acknowledged.
0: Interrupts enabled.
1: Interrupts disabled.
Note: Setting this flag will disable interrupt requests even while the LDSR
instruction is being executed.
4 SATa For saturated operation processing instructions only:
Indicates that the operation result is saturated due to overflow.
0: Not saturated.
1: Saturated.
Note: 1. This is a cumulative flag: The bit is not automatically cleared if
subsequent instructions lead to not saturated results.
To clear this bit, use the LDSR instruction to set PSW.SAT = 0.
2. In a general arithmetic operation this bit is neglected. It is neither
set nor cleared.
3 CY Carry/borrow flag.
Indicates whether a carry or borrow occurred as a result of the operation.
0: Carry or borrow did not occur
1: Carry or borrow occurred.
2 OVa Overflow flag.
Indicates whether an overflow occurred as a result of the operation.
0: Overflow did not occur.
1: Overflow occurred.
1
www.DataSheet4U.com Sa Sign flag.
Indicates whether the result of the operation is negative.
0: Result is positive or zero.
1: Result is negative.
0 Z Zero flag.
Indicates whether the result of the operation is zero.
0: Result is not zero.
1: Result is zero.

120 User’s Manual U17566EE5V1UM00


CPU System Functions Chapter 3

a)
In the case of saturate instructions, the SAT, S, and OV flags will be set according to the result of the operation
as shown in the table below. Note that the SAT flag is set only when the OV flag has been set during a satu-
rated operation.

Saturated operation The following table shows the setting of flags PWS.SAT, PWS.OV, and PWS.S,
instructions depending on the status of the operation result.

Table 3-6 Saturation-processed operation result


Flag status Saturation-processed
Status of operation result
SAT OV S operation result

Maximum positive value exceeded 1 1 0 7FFF FFFFH


Maximum negative value exceeded 1 1 1 8000 0000H
Positive (maximum not exceeded) 0 Operation result itself
xa 0
Negative (maximum not exceeded) 1
a)
Retains the value before operation.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 121


Chapter 3 CPU System Functions

(4) EIPSW, FEPSW, DBPSW, CTPSWPSW saving registers


The PSW saving registers save the contents of the program status word for
different occasions, see Table 3-4.
When one of the occasions listed in Table 3-4 occurs, the current value of the
PSW is saved to the saving registers.
All PSW saving registers are built up as the PSW, with the initial value
0000 0xxxH (x = undefined).

Table 3-7 PSW saving registers


Register Shortcut Saves contents of PSW in case of
Status saving register EIPSW • software exception
during interrupt • maskable interrupt
Status saving register FEPSW • non-maskable interrupt
during non-maskable
interrupts
Status saving register DBPSWa • exception trap
during exception/debug • debug trap
trap • debug break
• during a single-step operation
Status saving register CTPSW • execution of CALLT instruction
during CALLT execution
a)
Reading from this register is only enabled between a DBTRAP exception (excep-
tion handler address 0000 0060H) and the exception handler terminating DBRET
instruction. DBTRAP exceptions are generated upon ILGOP and ROM Correction
detections (refer to “Interrupt Controller (INTC)“ on page 201 and “ROM Correction
Function (ROMC)“ on page 375).

Note When multiple interrupt servicing is enabled, the contents of EIPSW or


FEPSW must be saved by program—because only one PSW saving register
for maskable interrupts and non-maskable interrupts is provided, respectively.

Caution Bits 31 to 26 of EIPC and bits 31 to 12 and 10 to 8 of EIPSW are reserved for
future function expansion (fixed to 0).When setting the value of EIPC, FEPC, or
CTPC, use even values (bit 0 = 0).
If bit 0 is set to 1, the setting of this bit is ignored. This is because bit 0 of the
program counter is fixed to 0.

www.DataSheet4U.com

122 User’s Manual U17566EE5V1UM00


CPU System Functions Chapter 3

(5) ECR - Interrupt/exception source register


The 32-bit ECR register displays the exception codes if an exception or an
interrupt has occurred. With the exception code, the interrupt/exception source
can be identified.
For a list of interrupts/exceptions and corresponding exception codes, see
Table 3-9 on page 123.
Initial Value 0000 0000H. This register is cleared by any reset.

31 26 25 0
FECC EICC

Table 3-8 ECR register contents


Bit
Bit name Function
position
31 to 16 FECC Exception code of non-maskable interrupt (NMI)
15 to 0 EICC Exception code of exception or maskable interrupts

The following table lists the exception codes.

Table 3-9 Interrupt/execution codes


Interrupt/Exception Source Value
Exception Handler
Classification restored to
Name Trigger Code Address
EIPC/FEPC
Non-maskable interrupts NMI0 Interrupt 0010H 0000 0010H next PC
(NMI) input (see Note)
NMI1 Interrupt 0020H 0000 0020H next PC
input (see Note)
NMI2 Interrupt 0030H 0000 0030H next PC
input (see Note)
Maskable interrupt refer to Interrupt refer to • higher 16 bits: next PC
“Interrupt “Interrupt 0000H (see Note)
Controller Controller • lower 16 bits:
(INTC)“ (INTC)“ on exception code
on page 201
page 201
Software TRAP0n TRAP Exception 004nH 0000 0040H next PC
exception (n = 0 to FH) instruction
TRAP1n TRAP Exception 005nH 0000 0050H next PC
(n = 0 to FH) instruction
Exception trap (ILGOP) Illegal Exception 0060H 0000 0060H next PC
instruction
code
Debug trap DBTRAP Exception 0060H 0000 0060H next PC
instruction

www.DataSheet4U.com If an interrupt (maskable or non-maskable) is acknowledged during instruction


execution, generally, the address of the instruction following the one being
executed is saved to the saving registers, except when an interrupt is
acknowledged during execution of one of the following instructions:
• load instructions (SLD.B, SLD.BU, SLD.H, SLD.HU, SLD.W)
• divide instructions (DIV, DIVH, DIVU, DIVHU)

User’s Manual U17566EE5V1UM00 123


Chapter 3 CPU System Functions

• PREPARE, DISPOSE instruction (only if an interrupt is generated before the


stack pointer is updated)
In this case, the address of the interrupted instruction is restored to the EIPC
or FEPC, respectively. Execution is stopped, and after the completion of
interrupt servicing the execution is resumed.

(6) CTBP - CALLT base pointer


The 32-bit CALLT base pointer is used with the CALLT instruction. The register
content is used as a base address to generate both a 32-bit table entry
address and a 32-bit target address.
Initial Value Undefined

31 30 29 28 27 26 25 1 0
0 0 0 0 0 0 base address 0
a
R Ra Ra Ra Ra Ra R/W R
a)
These bits may be written, but write is ignored.

www.DataSheet4U.com

124 User’s Manual U17566EE5V1UM00


CPU System Functions Chapter 3

3.3 Operation Modes

This section describes the operation modes of the CPU and how the modes
are specified.
The following operation modes are available:
• Normal operation mode
• Flash programming mode
After reset release, the microcontroller starts to fetch instructions from an
internal boot ROM which contains the internal firmware. The firmware checks
the FLMD0 pin, and optionally also the FLMD1 pin, to set the operation mode
after reset release according to Table 3-10.

Table 3-10 Selection of operation modes


Pins
FLMD1 Operation Mode
FLMD0
(P07)
0 X Normal operation mode (fetch from flash)
0 Flash programming mode
1
1 Setting prohibited

Note The FLMD1 pin function is shared with the P07 pin.

3.3.1 Normal operation mode

In normal operation mode, the internal flash memory is not re-programmed.


After reset release, the firmware acquires the user's reset vector from the flash
memory. The reset vector contains the start address of the user’s program
code. The firmware branches to that address. Program execution is started.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 125


Chapter 3 CPU System Functions

3.3.2 Flash programming mode

In flash programming mode, the internal flash memory is erased and


re-programmed.
After reset release, the firmware initiates loading of the user's program code
from the external flash programmer and programs the flash memory.
After detaching the external flash programmer, the microcontroller can be
started up with the new user's program in normal operation mode.
For more information see section “Flash Memory“ on page 269.

3.4 Address Space

In the following sections, the address space of the CPU is explained. Size and
addresses of CPU address space and physical address space are explained.
The address range of data space and program space together with their wrap-
around properties are presented.

3.4.1 CPU address space and physical address space

The CPU supports the following address space:


• 4 GB CPU address space
With the 32-bit general purpose registers, addresses for a 4 GB memory
can be generated. This is the maximum address space supported by the
CPU.
• 64 MB physical address space
The CPU provides 64 MB physical address space. That means that a
maximum of 64 MB internal or external memory can be accessed.
Any 32-bit address is translated to its corresponding physical address by
ignoring bits 31 to 26 of the address. Thus, 64 addresses point to the same
physical memory address. In other words, data at the physical address
0000 0000H can additionally be accessed by addresses 0400 0000H,
0800 0000H, …, F800 0000H, or FC00 0000H.

The 64 MB physical address space is seen as 64 images in the 4 GB CPU


address space:

www.DataSheet4U.com

126 User’s Manual U17566EE5V1UM00


CPU System Functions Chapter 3

CPU address space


FFFF FFFFH

Image

FC00 0000H
FBFF FFFFH

Image

Physical address space


F800 0000H x3FF FFFFH
Peripheral I/O
F7FF FFFFH x3FF F000H
VDB RAM
Image x3FF 0000H

0800 0000H VSB area


07FF FFFFH (Flash, RAM
external memory)

Image
VFB Flash/ROM
x000 0000H

0400 0000H
03FF FFFFH

Image

0000 0000H

Figure 3-3 Images in the CPU address space

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 127


Chapter 3 CPU System Functions

3.4.2 Program and data space

The CPU allows the following assignment of data and instructions to the CPU
address space:
• 4 GB as data space
The entire CPU address space can be used for operand addresses.
• 64 MB as program space
Only the lower 64 MB of the CPU address space can be used for instruction
addresses. When an instruction address for a branch instruction is
calculated and moved to the program counter (PC), then bits 31 to 26 are
set to zero.
Figure 3-4 shows the assignment of the CPU address space to data and
program space.

CPU address space


FFFF FFFFH

Data area
(4 GB linear)

0400 0000H
03FF FFFFH

Program area
(64 MB linear)

0000 0000H

Figure 3-4 CPU address space

www.DataSheet4U.com

128 User’s Manual U17566EE5V1UM00


CPU System Functions Chapter 3

(1) Wrap-around of data space


If an operand address calculation exceeds 32 bits, only the lower 32 bits of the
result are considered. Therefore, the addresses 0000 0000H and FFFF FFFFH
are contiguous addresses. This results in a wrap-around of the data space:

Data space
FFFF FFFEH

FFFF FFFFH
(+) (-)
0000 0000H direction direction

0000 0001H
Data space

Figure 3-5 Wrap-around of data space

(2) Wrap-around of program space


If an instruction address calculation exceeds 26 bits, only the lower 26 bits of
the result are considered. Therefore, the addresses 0000 0000H and
03FF FFFFH are contiguous addresses. This results in a wrap-around of the
program space:

Program space
03FF FFFEH

03FF FFFFH
(+) (-)
0000 0000H direction direction

0000 0001H
Program space

Figure 3-6 Wrap-around of program space

www.DataSheet4U.com
Caution No instruction can be fetched from the 4 KB area of 03FF F000H to
03FF FFFFH because this area is defined as peripheral I/O area. Therefore, do
not execute any branch to this area.

User’s Manual U17566EE5V1UM00 129


Chapter 3 CPU System Functions

3.5 Memory

In the following sections, the memory of the CPU is introduced. Specific


memory areas are described and a recommendation for the usage of the
address space is given.

3.5.1 Memory areas

The internal memory of the CPU provides several areas:


• Internal VFB flash area
• Internal VDB RAM area
• Internal VSB flash area
• Internal VSB RAM area
• External memory area
• Internal fixed peripheral I/O area
• Programmable peripheral I/O area
The areas are briefly described below.

(1) Internal VFB flash areas


Table 3-11 summarizes the size and addresses of the flash memories, which
are accessible via the VFB (V850 Fetch Bus).

Table 3-11 VFB flash memory


Device Flash Address range
µPD70F3421 256 KB 0000 0000H to 0003 FFFFH
µPD70F3422 384 KB 0000 0000H to 0005 FFFFH
µPD70F3423 512 KB 0000 0000H to 0007 FFFFH
µPD70F3424 512 KB 0000 0000H to 0007 FFFFH
µPD70F3425 1 MB 0000 0000H to 000F FFFFH
µPD70F3426A 1 MB 0000 0000H to 000F FFFFH
µPD70F3427 1 MB 0000 0000H to 000F FFFFH

(2) Internal VDB RAM area


After reset The internal VDB RAM consists of several separated RAM blocks. If a reset
occurs while writing to one RAM block, only the contents of that RAM block
may be corrupted. The contents of the other RAM blocks remain unaffected.
Table 3-12 summarizes the VDB (V850 Data Bus) RAM blocks compilation and
their address assignment.

Table 3-12 Internal VDB RAM areas (1/2)


www.DataSheet4U.com
Block
Device RAM size
Number Size Address
µPD70F3421 12 KB 0 4 KB 03FF 0000H – 03FF 0FFFH
1 8 KB 03FF 1000H – 03FF 2FFFH

130 User’s Manual U17566EE5V1UM00


CPU System Functions Chapter 3

Table 3-12 Internal VDB RAM areas (2/2)


Block
Device RAM size
Number Size Address
µPD70F3422 16 KB 0 8 KB 03FF 0000H – 03FF 1FFFH
1 8 KB 03FF 2000H – 03FF 3FFFH
µPD70F3423 20 KB 0 8 KB 03FF 0000H – 03FF 1FFFH
1 8 KB 03FF 2000H – 03FF 3FFFH
2 4 KB 03FF 4000H – 03FF 4FFFH
µPD70F3424 24 KB 0 8 KB 03FF 0000H – 03FF 1FFFH
1 8 KB 03FF 2000H – 03FF 3FFFH
2 8 KB 03FF 4000H – 03FF 5FFFH
µPD70F3425a 32 KB 0 16 KB 03FF 0000H – 03FF 3FFFH
1 16 KB 03FF 4000H – 03FF 7FFFH
µPD70F3426A 60 KB 0 16 KB 03FF 0000H – 03FF 3FFFH
µPD70F3427
1 16 KB 03FF 4000H – 03FF 7FFFH
2 16 KB 03FF 8000H – 03FF BFFFH
3 12 KB 03FF C000H – 03FF EFFFH
a)
The µPD70F3425’s 32 KB RAM area 03FF 0000H to 03FF 7FFFH is mirrored to
the subsequent area 03FF 8000H to 03FF FFFFH. Since the upper 4 KB
03FF F000H to 03FF FFFFH is used to access the fixed peripheral I/O area, the
RAM mirror must not be used to access the RAM.

Note that the internal firmware, which is processed after reset, uses some
RAM (refer to “General reset performance“ on page 954).

(3) Internal VSB flash area (µPD70F3426A only)


The µPD70F3426A provides additional flash memory, accessible via the VSB
(V850 System Bus).

Table 3-13 Internal VSB flash memory


Device Flash size Address range
µPD70F3426A 1 MB 0010 0000H to 001F FFFFH

(4) Internal VSB RAM area (µPD70F3426A only)


The µPD70F3426A provides additional RAM, accessible via the VSB (V850
System Bus).

Table 3-14 Internal VSB RAM


Block
Device RAM size
Number Size Address
µPD70F3426A 24 KB 0 12 KB 0060 0000H – 0060 2FFFH
www.DataSheet4U.com 1 12 KB 0060 3000H – 0060 5FFFH

(5) External memory area (µPD70F3427 only)


All address areas that do not address any internal memory or peripheral I/O
registers can be used as external memory area.

User’s Manual U17566EE5V1UM00 131


Chapter 3 CPU System Functions

Access to the external memory area uses the chip select (CS) signals
assigned to each memory area.
For access to external memory, see “Bus and Memory Control (BCU, MEMC)“
on page 289.

3.5.2 Fixed peripheral I/O area

The 4 KB area between addresses 03FF F000H and 03FF FFFFH is provided
as the fixed peripheral I/O area. Accesses to these addresses are passed over
to the NPB bus (internal bus).

The following registers are memory-mapped to the peripheral I/O area:


• All registers of peripheral functions
• Registers of timers
• Configuration registers of interrupt, DMA, bus and memory controllers
• Configuration registers of the clock controller
For a list of all peripheral I/O registers, see “Special Function Registers“ on
page 997.

Note 1. Because the physical address space covers 64 MB, the address bits
A[31:26] are not considered. Thus, this address space can also be
addressed via the area FFFF 0000H to FFFF FFFFH. This has the
advantage that the area can be indirectly addressed by an offset and the
zero base r0.
Therefore, in this manual, all addresses of peripheral I/O registers in the
4 KB peripheral I/O area are given in the range FFFF F000H to
FFFF FFFFH instead of 03FF F000H to 03FF FFFFH.
2. The fixed peripheral I/O area is mirrored to the upper 4 KB of the
programmable peripheral I/O area PPA - regardless of the base address of
the PPA. If data is written to one area, it appears also in the other area.
3. Program fetches cannot be executed from any peripheral I/O area.
4. Word registers, that means 32-bit registers, are accessed in two half word
accesses. The lower two address bits are ignored.
5. For registers in which byte access is possible, if half word access is
executed:
• During read operation: The higher 8 bits become undefined.
• During write operation: The lower 8 bits of data are written to the
register.

Caution 1. Addresses that are not defined as registers are reserved for future
expansion. If these addresses are accessed, the operation is undefined and
not guaranteed.
2. For DMA transfer, the fixed peripheral I/O area 03FF F000H to 03FF FFFFH
www.DataSheet4U.com
cannot be specified as the source/destination address. Be sure to use the
RAM area 0FFF F000H to 0FFF FFFFH for source/destination address of
DMA transfer.

132 User’s Manual U17566EE5V1UM00


CPU System Functions Chapter 3

(1) Programmable peripheral I/O area


A 16 KB area is provided as a programmable peripheral I/O area (PPA). The
PPA can be freely located. The base address of the programmable peripheral
I/O area is specified by the initialization of the peripheral area selection control
register (BPC).
See “Bus and Memory Control (BCU, MEMC)“ on page 289 for details.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 133


Chapter 3 CPU System Functions

3.5.3 Recommended use of data address space

When accessing operand data in the data space, one register has to be used
for address generation. This register is called pointer register. With relative
addressing, an instruction can access operand data at all addresses that lie in
the range of ±32 KB relative to the address in the pointer register.
By this offset addressing method load/store instructions can be
accommodated in a single 32-bit instruction word, resulting in faster program
execution and smaller code size.
To enhance the efficiency of using the pointer in consideration of the memory
map, the following is recommended:
For efficient use of the relative addressing feature, the data segments should
be located in the address range FFFF F800H to 0000 0000H and 0000 0000H
to 0000 7FFFH. The peripheral I/O registers and the internal RAM is aligned to
the upper bound, thus the registers and a part of the RAM can be addressed
via relative addressing, with base address 0 (r0).
It is recommended to locate flash memory data segments in the area up to
0000 7FFFH, so access to these constant data can utilize also relative
addressing.
Use the r0 register as pointer register for operand addressing. Since the r0
register is fixed to zero by hardware, it can be used as a pointer register and, at
the same time, for any other purposes, where a zero register is required. Thus,
no other general purpose register has to be reserved as pointer register.

0000 7FFFH

Internal flash area +32 KB


(1 MB)

(r0=)0000 0000H
Fixed
peripheral I/O area
FFFF F000H (4 KB)
FFFF EFFFH -32 KB
Internal RAM area
(28 KB)

FFFF 8000H
FFFF 7FFFH

Internal RAM area


(32 KB)

FFFF 0000H

www.DataSheet4U.com

Figure 3-7 Example application of wrap-around

134 User’s Manual U17566EE5V1UM00


CPU System Functions Chapter 3

3.6 Write Protected Registers

Write protected registers are protected from inadvertent write access due to
erroneous program execution, etc. Write access to a write protected register is
only given immediately after writing to a corresponding write enable register.
For a write access to the write protected registers you have to use the following
instructions:
1. Store instruction (ST/SST instruction)
2. Bit operation instruction (SET1/CLR1/NOT1 instruction)
When reading write protected registers, no special sequence is required.
The following table gives an overview of the write protected registers and their
corresponding write enable registers.
For some registers, incorrect store operations can be checked by a flag of the
corresponding status register. This is also marked in the table below.

Example Start the Watchdog Timer


The following example shows how to write to the write protected register
WDTM. The example starts the Watchdog Timer.

do {
_WPRERR = 0;

DI();
WCMD = 0x5A;
WDTM = 0x80;
EI();

} while (_WPRERR != 0)

Note 1. Make sure that the compiler generates two consecutive assembler “store”
instructions to WCMD and WDTM from the associated C statements.
2. Special care must be taken when writing to registers PCS and PRCMD.
Please refer to “Clock Generator“ on page 139 for details.

Since any action between writing to a write enable register and writing to a
protected register destroys this sequence, the effects of interrupts and DMA
transfers have to be considered:
Interrupts In order to prevent any maskable interrupt to be acknowledged between the
two write instructions in question, shield this sequence by DI - EI (disable
interrupt - enable interrupt).
However, any non-maskable interrupt can still be acknowledged.
DMA In the above example, DMA transfers can still take place. They may destroy the
sequence.
If appropriate, you may disable DMA transfers in advance. Otherwise you must
check whether writing to the protected register was successful. To do so, check
the status via the status register, if available, or by reading back the protected
www.DataSheet4U.com
register.
The above examples checks WPHS.WPRERR for that purposes and repeats
the sequence until the write to WDTM was successful.

User’s Manual U17566EE5V1UM00 135


Chapter 3 CPU System Functions

3.7 Instructions and Data Access Times

The below Table 3-15 and Table 3-16 list the instruction execution and data
access cycles, required when accessing instructions or data in VFB flash, VDB
RAM and VSB flash/RAM.
The access time depends on the
• memory type (flash, RAM) and access bus (VFB, VDB, VSB)
• number of latency cycles for the memory type
• type of data (instructions/data)
• type of access (consecutive/random addresses)
• device, i.e. maximum clock frequency
In general the CPU is able to execute most instructions in one clock cycle
(single-cycle instructions), provided no additional clock cycles are required to
access the memory.
Note that for some instructions the CPU requires more clock cycles to execute
anyway (multi-cycle instructions), regardless of the memory access time.

The memory access time in a real application is deterministic, but can hardly
be predicted, as this heavily depends on the status of the microcontroller and
its components, the program flow and concurrent processes, like DMA
transfers, interrupts, accesses to peripheral registers via the NPB, etc.
Thus the figures in the below tables assume
• all busses (VFB, VDB, VSB, NPB) are not occupied, i.e. collision with other
bus traffic is excluded
• 32-bit instruction/data accesses to word-aligned - that means 32-bit
aligned - addresses
• data is not accessed via the same bus as the instruction is fetched from
• no wait states for the external memory interface timing

Consequently “1 clock cycle” means: the instruction/data access takes one


CPU clock cycle and the CPU is supplied with an instruction/data in each
clock: the memory access time is invisible and has no effect.

Instruction The given numbers of cycles in Table 3-15 describe the time required to
execution execute a single-cycle instruction, fetched from the respective memory:
• Consecutive access
describes the number of cycles required to fetch instructions from the
memory on consecutive addresses.
• Random access
describes the number of cycles required to access the memory in case
instructions are accessed on random, i.e. non-consecutive, addresses. In
case of instruction flow branches a CPU’s pipeline break occurs and an
additional cycle is required to refill the pipeline. The table figures include
this cycle.
www.DataSheet4U.com In case instructions and data are accessed via the same bus, all accesses -
instruction fetch and data access - are regarded as random accesses.

µPD70F3426A VSB If an instruction is to be fetched from the VSB flash while an access to the NPB
flash is ongoing, the instruction fetch is stopped and completely restarted. This

136 User’s Manual U17566EE5V1UM00


CPU System Functions Chapter 3

means 3 additional cycles are necessary for each unsuccessful VSB flash
instruction fetch.

Table 3-15 Single-cycle instructions execution times in CPU clock cycles


µPD70F3421
µPD70F3424
Memory Access type µPD70F3427 µPD70F3426A µPD70F3422
µPD70F3425
µPD70F3423
VFB flash Consecutive 1 1 1 1
a a a
Random 4 4 4 2a
VDB RAM Consecutive 1 1 1 1
Random 2a 2 a
2 a
2a
VSB flash Consecutive – • 2 (32-bit instructions) – –
• 1 (16-bit instructions)
Random – 5a – –
VSB RAM Consecutive – 2 – –
Random – 3a – –
a)
These values include the additional clock cycle, caused by the CPU’s pipeline break

Data access The given numbers of cycles in Table 3-16 describe the time additionally
required when an instruction accesses data in the respective memory.
Note that data accesses are always random accesses.

Table 3-16 Additional time for data accesses in CPU clock cycles
Data µPD70F3421
Instruction µPD70F3424
access µPD70F3427 µPD70F3426A µPD70F3422
code fetch bus µPD70F3425
memory µPD70F3423
VFB flash VFB 4 4 4 1
VDB RAM VFB/VSB 0 0 0 0
VSB flash VFB – 4 – –
VSB RAM VFB – • 1 (single access) – –
• 3 (multiple access)

w w w . D a t a S h e e t 4 U . c o m

User’s Manual U17566EE5V1UM00 137


Chapter 3 CPU System Functions

www.DataSheet4U.com

138 User’s Manual U17566EE5V1UM00


Chapter 4 Clock Generator

The clock generator provides the clock signals needed by the CPU and the
on-chip peripherals.

4.1 Overview

The clock generator can generate the required clock signals from the following
sources:
• Main oscillator - a built-in oscillator with external crystal and a nominal
frequency of 4 MHz
• Sub oscillator - a built-in oscillator with external crystal and a nominal
frequency of 32 kHz
• Internal oscillator - an internal oscillator without external components and a
nominal frequency of 240 kHz

Features summary Special features of the clock generator are:


• Choice of oscillators to reduce power consumption in stand-by mode
• Frequency multiplication by two PLL synthesizers:
– Fixed frequency PLL for accurate timings
– Spread spectrum PLL (SSCG) for reduced electromagnetic interference
• Individual clock source selection for CPU and groups of peripherals
• Five specific power save modes:
– HALT mode
– IDLE mode
– WATCH mode
– Sub-WATCH mode
– STOP mode
• Vital system registers are write-protected by a special write sequence
• Direct main oscillator clock feed-through for watch clock correction support
• Separate clock monitors for main and sub oscillator to detect oscillator
malfunction

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 139


Chapter 4 Clock Generator

4.1.1 Description

The clock generator is built up as illustrated in the following figure.

CKC.SCEN PCC.CKS[1:0]
CKC.PLLEN
PCC.CLS
PLLCLK
PCC.MFRC
PLL 1/2 0
x8 1 Standby VBCLK CPU System
X1 MainOSC MOCLK
X2
4 MHz

SSCG SSCCLK
1/n 0
1 Standby PCLK0 AFCAN
0
Int.OSC ROCLK CKC.DEN
n=1,2,3,4,6,8 1/2 1 PCLK1 UARTA
~200 KHz
SCFC0,SCFC1,SCFMC SCPS.VBSPS[2:0]
CKC.PERIC CSIB
XT1 PRS0 /20 TMZ
SubOSC 0 SBCLK Standby PCLK2
32 KHz
1 /21 PCLK3 TMP
XT2
....... ....... WCT
PCC.SOSCP
PCC.FRC ICC.IICSEL0 /213 SG
PCLK15

SOCLK
1
0 0 Standby IICLK IIC
1/2 1
n=1/ 3.5/ 4.5
ICC.IICSEL1
ICC.IICPS[2:0]
0
fSSCGPS
0
1
Standby SPCLK0 Stepper C/D
0
1/n 1
1/2 1
SPCLK1 TMG
TMY
n=1,2,3,4,6,8 0
Standby PRS1 /20
1/4 1
SPCLK2 CSIB
SCPS.SPSPS[2:0] /21 SPCLK3 LCD I/F
....... .......
LCD C/D
SCC.SPSEL1 SCC.SPSEL0 /213
SPCLK15 ADC
FCC.FOCS[2:0]

FOUTCLK Port
1
0 n=1,2,4,8,16,
FCC.FOEN 32,64,128
FCC.FOSOS
FCC.FOCKS[1:0]
TCC.WTSOS
TCC.WTSEL0
LCDCLK LCD C/D
n=1,2,4,8,16,32,64,128
/2 1
WTCLK Watch Timer
1/n 0

TCC.WTSEL1
TCC.WTPS[2:0]
1
1 Standby 0
WDTCLK
Watchdog
0 1/n
0 1
n=1,2,4,8,16,32, Timer
64,128
WCC.SOSCW WCC.WDTSEL0
WCC.WPS[2:0]
WCC.WDTSEL1 Watch
1
WCTCLK Calibration
PCLK1 0
Timer
PSM.CMODE

Figure 4-1 Block diagram of the Clock Generator

The left-hand side of the figure shows how the three oscillators can be
connected to the CPU, the two PLLs, and to certain peripheral modules.
Software-controlled selectors allow you to specify the signal paths.
PLL The integrated PLL synthesizer multiplies the frequency of the main oscillator
by eight. This yields a frequency of 32 MHz. The CPU can use the PLL output
directly. The output frequency of the PLL divided by two can supply the
peripherals of the microcontroller and also the CPU.
SSCG The spread spectrum clock generator (SSCG) can generate a frequency-
modulated clock (modulation frequency and width can be chosen) that helps to
eliminate electromagnetic interference (EMI). The SSCG includes a
programmable frequency multiplier/divider that can multiply the frequency of
the main oscillator by up to 16.
The SSCG can supply the CPU system and some of the peripherals.
www.DataSheet4U.com

140 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

(1) CPU clocks


The CPU can be clocked directly by any of the oscillators, or by the output of
one of the PLLs.
The following table gives an overview of the available CPU clocks.

Table 4-1 Clock sources and frequencies for the CPU


Clock source Frequency Device Description
Internal osc all Default clock source after reset release. Selectable as clock
~240 kHz
source for Sub-WATCH mode release.
Sub osc 32 kHz all Selectable as clock source for Sub-WATCH mode release.
Main osc all Always selected after power save mode release except on
Sub-WATCH mode release or default clock setting.a On
4 MHz
Sub-WATCH mode release or default clock setting, main or
sub oscillator can be selected.
PLL 16 MHz all fmain × 8/2b can be selected for CPU clock supply.
32 MHz fmain × 8/1b can be selected for CPU clock supply.
SSCG 8 MHzc all fmain × 12/6d can be selected for CPU clock supply.
16 MHzc fmain × 16/4d can be selected for CPU clock supply.
24 MHzc fmain × 12/2d can be selected for CPU clock supply.
32 MHzc fmain × 16/2d can be selected for CPU clock supply.
48 MHzc µPD70F3424, fmain × 12/1d can be selected for CPU clock supply.
µPD70F3425,
fmain × 16/1d can be selected for CPU clock supply.
64 MHzc µPD70F3426A,
µPD70F3427
a) See also “CPU operation after power save mode release“ on page 193
b)
Multiplication is performed by the PLL, the division by the PLL post scaler.
c)
Center output frequency of the SSCG, can be modulated up to +/- 5%.
d) Multiplication is performed by the SSCG, the division by the SSCG post scaler.

(2) Peripheral clocks


The right-hand side of Figure 4-1 on page 140 shows how the clocks for the
peripheral modules are generated and distributed.
PCLK clocks Peripherals that require precise timings are connected to PCLKn signals.
Such peripherals are the CAN controllers, the UARTs, the Timers Z and P, and
the clocked serial interfaces CSIB. The Watch Calibration Timer WCT can be
connected to PCLK1 or directly to the main oscillator.
The clocks PCLK0…1 can be derived from the main oscillator or the PLL
output. The PCLK2…15 clocks are always derived from the main oscillator.
SPCLK clocks Peripherals that tolerate or demand a spread spectrum clock (like PWM output
timers) are connected to SPCLKn signals.
Such peripherals are the Stepper Motor Controller/Driver, the Timers G and Y,
the sound generator, the clocked serial interfaces CSIB (CSIB can also be
www.DataSheet4U.com connected to a PCLK), the LCD Bus I/F and Controller/Driver, and the A/D
converter.
The clocks SPCLK0…1 can be derived from the main oscillator, the SSCG, or
the PLL. The SPCLK2…15 clocks can be derived from the main oscillator or
the SSCG.

User’s Manual U17566EE5V1UM00 141


Chapter 4 Clock Generator

IICLK clock The clock IICLK for the I2C interface has it’s own programmable frequency
divider. The clock source can be chosen from the PLL, SSCG or main
oscillator.

(3) Special clocks


The figure shows also some special clock signals. These are dedicated clocks
for the LCD controller/driver, Watch Timer, Watchdog Timer, and Watch
Calibration Timer. These clocks are directly derived from the oscillators and
bypass the PLLs.
LCDCLK The LCD Controller/Driver can be clocked by SPCLK7, SPCLK9, or LCDCLK.
WTCLK This is the clock for the Watch Timer. It forms the time base for updating the
internal bookkeeping of daytime and calendar.
Note that LCDCLK and WTCLK have a common source and a fixed frequency
ratio (1/1 or 1/2).
WCTCLK This is the clock for the Watch Calibration Timer WCT. The WCT is used in
conjunction with the Watch Timer for calibrating the time base during power
save modes by utilizing the main oscillator as the stable clock source.
WCTCLK can also be derived from PCLK1.
FOUTCLK FOUTCLK is a clock signal that can be used for external devices. It is
connected to the pin FOUT and can provide almost any of the internal clock
frequencies (not phase-synchronized). FOUTCLK must be enabled before it
can be used.
WDTCLK This is the clock for the Watchdog Timer that is used for recovering from a
system deadlock. WDTCLK is available (and hence the Watchdog Timer
running) as long as the chosen clock source is active. Optionally WDTCLK can
be stopped during a power save mode.

(4) Stand-by control


In the block diagram, you find also boxes labelled “Standby”. These boxes
symbolize the switches that are used to disable circuits when the
microcontroller enters one of the various power save modes.
The following clocks are subject to automatic stand-by control:
CPU system clock, PCLK, SPCLK, IICLK optionally WDTCLK.
The following clocks can be operating during power save modes (stand-by) as
long as their clock oscillator source is available:
FOUTCLK, LCDCLK, WTCLK, WCTCLK, optionally WDTCLK.

4.1.2 Clock monitors

The microcontroller contains clock monitors to monitor the operation of the 4


MHz main oscillator and the 32 KHz sub oscillator. In case of malfunction,
www.DataSheet4U.com
these monitors can generate a system reset.
The monitors require that the built-in internal oscillator is active. For details see
“Operation of the Clock Monitors“ on page 198.

142 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

4.1.3 Power save modes overview

The microcontroller provides the following stand-by modes: HALT, IDLE,


WATCH, Sub-WATCH, and STOP. Application systems which are designed in a
way that they switch between these modes according to operation purposes,
reduce power consumption efficiently.
The following explanations provide a general overview and refer to the default
settings. Some settings can be changed, for example the activity of the watch
and watchdog clocks and hence the connected timers.
For details, please refer to “Power save modes description“ on page 179 and
the register descriptions.

HALT mode In this mode, the clock supply to the CPU is suspended while other on-chip
peripherals continue to operate. Combining this mode with the normal
operating mode results in intermittent operation and reduces the overall
system power consumption.
This mode is entered by executing the HALT instruction.
All other power save modes are entered by setting the registers PSM and PSC.
IDLE mode In this mode, the clock distribution is stopped and hence the whole system.
The oscillators, Clock Generator (PLL, SSCG, frequency multipliers, dividers),
Watch Timer, and Watchdog Timer remain operating.
This mode allows quick return to the normal operating mode in response to a
release signal, because it is not necessary to wait for oscillators or PLLs to
settle.
This mode provides low power consumption. Power is only consumed by the
oscillators (main oscillator, sub oscillator), Clock Generator (PLL and SSCG),
and Watch Timer / Watchdog Timer.
WATCH mode In this mode, the Clock Generator (PLL and SSCG) stops operation.
Therefore, the entire system except Watch Timer / Watchdog Timer stops.
This mode provides low power consumption. Power is only consumed by the
oscillators (main oscillator, sub oscillator), and the Watch Timer / Watchdog
Timer circuits.
Sub-WATCH mode In this mode, not only the Clock Generator is stopped but also the main
oscillator. Watch Timer / Watchdog Timer are switched to the sub or internal
oscillator. Therefore, the entire system except Watch Timer / Watchdog Timer
stops.
This mode provides very low power consumption. Power is only consumed by
the sub oscillator and Watch Timer / Watchdog Timer circuits.
STOP mode In this mode, the entire system stops.
This mode provides ultra-low power consumption. Power is only consumed by
leakage current and the sub oscillator (if a crystal is connected).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 143


Chapter 4 Clock Generator

4.1.4 Start conditions

After any reset release, the internal oscillator is always selected as the clock
source. The oscillation stabilization time for the internal oscillator is ensured by
hardware. The CPU clock VBCLK is derived from the internal oscillator.
Several clocks are operating based on the internal oscillator clock after reset.
As soon as the main oscillator, which is started by the internal firmware, is
stable the source of these clocks is automatically changed to the main
oscillator. Therefore depending on the firmware operation and the main
oscillator stabilization time these clocks may already be operating with the
main oscillator, when the user’s program is started.
Internal firmware starts the main oscillator. PLL and SSCG remain stopped.
When the firmware passes control to the application software, software has to
ensure that the main oscillator has stabilized and to start the PLL and SSCG.

Note Clock supply for most peripherals is not available unless the main oscillator
operates.
CPU access to peripherals that have no clock supply may cause system
deadlock.

Table 4-2 Clock Generator status after reset release


Item Status Remarks
Main oscillator stopped started by internal firmware
Sub oscillator operates
Internal oscillator operates
SSCG stopped
PLL stopped
VBCLK (CPU system) operates based on internal oscillator clock
IICLK operates based on internal/main oscillator clocka
PCLK0, PCLK1 operates based on internal/main oscillator clocka
PCLK2…PCLK15 operates based on internal/main oscillator clocka
SPCLK0, SPCLK1 operates based on internal/main oscillator clocka
SPCLK2…SPCLK15 operates based on internal/main oscillator clocka
FOUTCLK operates based on internal/main oscillator clocka
LCDCLK / WTCLK operatesb based on internal/main oscillator clocka
WDTCLK operates based on internal/main oscillator clocka
WCTCLK operates based on internal/main oscillator clocka
a)
Starts with internal oscillator, automatically changed to main oscillator, when main
oscillator stable.
b)
If the reset was caused by Power-On Clear (POC) or external RESET, the
clock source for LCDCLK and WTCLK is set to internal oscillator. If the re-
set was caused by a different source, the clock selection for LCDCLK / WT-
www.DataSheet4U.com CLK remains unchanged.

144 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

4.1.5 Start-up guideline

After reset release, the internal firmware starts the main oscillator, but hands
over control to the user’s software without ensuring that the main oscillator has
stabilized.
After that, the user’s software will typically:
1. Ensure that the main oscillator has stabilized (check CGSTAT.OSCSTAT).
2. Switch the source of LCDCLK/WTCLK and WDTCLK to main oscillator (if
desired).
3. Start the PLL (set CKC.PLLEN) and wait until the PLL has stabilized (refer
to the Data Sheet).
4. If the SSCG is going to be used:
Write SSCG registers to set up the SSCG. This is only possible when the
SSCG is switched off.
Start the SSCG (set CKC.SCEN) and wait until the SSCG has stabilized
(refer to the Data Sheet).
5. Write the PCC register to specify the SSCG as the clock source for the
CPU.
6. Set up the clock sources for the peripherals according to application
requirements.
7. The default value of following registers must be changed after reset:
– ADA0M1.bit7 = 1 (refer to “ADC Registers“ on page 861)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 145


Chapter 4 Clock Generator

4.2 Clock Generator Registers

The Clock Generator is controlled and operated by means of the following


registers (the list is sorted according to memory allocation):

Table 4-3 Clock Generator register overview


Write-protected
Register name Shortcut Address
by register
PSC write protection register PRCMD FFFF F1FCH
Power save control register PSC FFFF F1FEH PRCMD
Stand-by control register STBCTL FFFF FCA2H STBCTLP
Stand-by control protection register STBCTLP FFFF FCAAH
Sub oscillator clock monitor control register CLMCS FFFF F71AH
Command protection register PHCMD FFFF F800H
Peripheral status register PHS FFFF F802H
Power save mode register PSM FFFF F820H
Clock Generator control register CKC FFFF F822H PHCMD
Clock Generator status register CGSTAT FFFF F824H
Watchdog timer clock control register WCC FFFF F826H PHCMD
Processor clock control register PCC FFFF F828H PHCMD
SSCG Frequency modulation control register SCFMC FFFF F82AH
SSCG Frequency control 0 register SCFC0 FFFF F82CH
SSCG Frequency control 1 register SCFC1 FFFF F82EH
SSCG post scaler control register SCPS FFFF F830H
SPCLK control register SCC FFFF F832H PHCMD
FOUTCLK control register FCC FFFF F834H PHCMD
Watch Timer clock control register TCC FFFF F836H PHCMD
IIC clock control register ICC FFFF F838H PHCMD
Set default clock register SDC FFFF F83CH PHCMD
Main oscillator clock monitor mode register CLMM FFFF F870H PRCMDCMM
Sub oscillator clock monitor mode register CLMS FFFF F878H PRCMDCMS
CLMM write protection register PRCMDCMM FFFF FCB0H
CLMS write protection register PRCMDCMS FFFF FCB2H

Note Some registers are write-protected to avoid inadvertent changes. Data can be
written to these registers only in a special sequence of instructions, so that the
register contents is not easily rewritten in case of a program hang-up.
Writing to a protected register is only possible immediately after writing to the
associated write protection register.

www.DataSheet4U.com

146 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

The subsequent register descriptions are grouped as follows:


• General Clock Generator Registers:
– “CKC - Clock Generator control register“ on page 148
– “CGSTAT - Clock Generator status register“ on page 149
– “PHCMD - Command protection register“ on page 150
– “PHS - Peripheral status register“ on page 151
– “PCC - Processor clock control register“ on page 152
– “SDC - Set default clock register“ on page 154
• SSCG Control Registers:
– “SCFC0 - SSCG frequency control register 0“ on page 156
– “SCFC1 - SSCG frequency control register 1“ on page 157
– “SCFMC - SSCG frequency modulation control register“ on page 158
– “SCPS - SSCG post scaler control register“ on page 160
• Control Registers for Peripheral Clocks:
– “WCC - Watchdog Timer clock control register“ on page 161
– “TCC - Watch Timer clock control register“ on page 163
– “SCC - SPCLK control register“ on page 165
– “FCC - FOUTCLK control register“ on page 166
– “ICC - IIC clock control register“ on page 168
• Control Registers for Power Save Modes:
– “PSM - Power save mode register“ on page 169
– “PSC - Power save control register“ on page 172
– “PRCMD - PSC write protection register“ on page 173
– “STBCTL- Stand-by control register“ on page 174
– “STBCTLP - Stand-by control protection register“ on page 174
• Clock Monitor Registers:
– “CLMM - Main oscillator clock monitor mode register“ on page 175
– “PRCMDCMM - CLMM write protection register“ on page 176
– “CLMS - Sub oscillator clock monitor register“ on page 177
– “PRCMDCMS - CLMS write protection register“ on page 177
– “CLMCS - Sub oscillator clock monitor control register“ on page 178

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 147


Chapter 4 Clock Generator

4.2.1 General clock generator registers

The general Clock Generator registers control and reflect the operation of the
Clock Generator.

(1) CKC - Clock Generator control register


The 8-bit CKC register controls the clock management.
Access This register can be read/written in 8-bit units.
Writing to this register is protected by a special sequence of instructions.
Please refer to “PHCMD - Command protection register“ on page 150 for
details.
Address FFFF F822H.
Initial Value 00H. The register is initialized by any reset.

7 6 5 4 3 2 1 0
PLLEN SCEN DEN 0 PERIC 0 0 0
a a
R/W R/W R/W R R/W R Ra Ra
a) These bits may be written, but write is ignored.

Table 4-4 CKC register contents


Bit position Bit name Function
7 PLLENa PLL enable:
0: PLL disabled.
1: PLL on.
It is not possible to clear this bit by writing to the register. The bit is automatically
cleared in WATCH, Sub-WATCH, or STOP mode, or if bit SDC.SDCR is set to 1.
6 SCENa SSCG enable:
0: SSCG disabled.
1: SSCG on.
It is not possible to clear this bit by writing to the register. The bit is automatically
cleared in WATCH, Sub-WATCH, or STOP mode, or if bit SDC.SDCR is set to 1.
5 DEN SSCG dithering mode enable:
0: SSCG uses fixed multiplication factor determined by SCFC0, SCFC1
1: SSCG is in dithering mode. The base frequency, determined by the registers
SCFC0, SCFC1, is modulated according to the setup of register SCFMC.
DEN must not be toggled while SCEN is 1.
3 PERIC Clock source selection for PCLK0/1:
0: Main oscillator is clock source for peripheral clocks PCLK0, PCLK1.
1: PLL (x4) is clock source for peripheral clocks PCLK0, PCLK1.
This bit is automatically cleared in WATCH, Sub-WATCH, or STOP mode, or if bit
SDC.SDCR is set to 1.
a) Before enabling PLLEN or SCEN, make sure that the main oscillator is running and has settled (see also CG-
STAT register). The CPU must operate on the sub, internal or main oscillator clock when setting PLLEN or
SCEN to 1. Before selecting the SSCG / PLL outputs as clock sources for peripherals, ensure by software that
the SSCG / PLL stabilization time has elapsed.The stabilization times are defined in the Data Sheet.
www.DataSheet4U.com

148 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

(2) CGSTAT - Clock Generator status register


The 8-bit CGSTAT register is read-only. It indicates the status of the main
oscillator and the status of the clock generator after wake-up from power save
mode.
Access This register can be read in 8-bit units.
Address FFFF F824H.
Initial Value 0000 1101B. The register is initialized by any reset.

7 6 5 4 3 2 1 0
CMPLPSM 0 0 0 1 1 OSCSTAT 1
R R R R R R R R

Table 4-5 CGSTAT register contents


Bit position Bit name Function
7 CMPLPSM Completed power save mode entry:
0: Power save mode configuration not completed.
1: Power save mode configuration completed.
This bit is cleared when the clock generator has accepted a power save mode
request. However if CGSTAT.CMLPSM was already 0 before a power save mode
request it can not be used as an indicator that the clock generator has accepted
this power save mode request.
This bit is set when the clock generator has completely set up it's power save
mode configuration, i.e. all registers are set up, PLL and SSCG are switched off.
However if CGSTAT.CMLPSM was already 1 before a power save mode request it
can not be used as the only indicator that the clock generator has completed
power save mode configuration.
If the clock generator has not accepted a power save mode request this bit
remains unchanged.
Refer also to ““CPU operation after power save mode release“ on page 193”.
1 OSCSTAT Main oscillator status indicator (determined by counter):
0: Main oscillator has not settled.
1: Main oscillator has stabilized.
The OSCSTAT flag is cleared whenever the main oscillator is switched to stand-by
mode due to entering the Sub-WATCH or STOP mode.
After the main oscillator is restarted, the oscillation stabilization counter will count
up from 0 to 40.960 (approx. 10ms @ 4 MHz) to assure stable oscillator
operation. When the oscillation stabilization counter reaches 40.960, the counter
is stopped, and the OSCSTAT flag is set.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 149


Chapter 4 Clock Generator

(3) PHCMD - Command protection register


The 8-bit PHCMD register is write-only. It is used to protect other registers from
unintended writing.
Access This register must be written in 8-bit units.
Address FFFF F800H.
Initial Value The contents of this register is undefined.
7 6 5 4 3 2 1 0
x x x x x x x x
W W W W W W W W

PHCMD protects the registers that may have a significant influence on the
application system from inadvertent write access, so that the system does not
stop in case of a program hang-up.
Any data written to this register is ignored. Only the write action is monitored.
After writing to the PHCMD register, you are permitted to write once to one of
the protected registers. This must be done immediately after writing to the
PHCMD register. After the second write action, or if the second write action
does not follow immediately, all protected registers are write-locked again.

Caution In case a high level programming language is used, make sure that the
compiler translates the two write instructions to PHCMD and the protected
register into two consecutive assembler “store” instructions.

With this method, the protected registers can only be rewritten in a specific
sequence. Illegal write access to a protected register is inhibited.
The following registers are protected by PHCMD:

– CKC: Clock control register


– FCC: FOUTCLK control register
– ICC: I2C clock control register
– PCC: Processor clock control register
– SCC: SPCLK control register
– TCC: Watch Timer clock control register
– WCC: Watchdog timer clock control register
– SDC: Set default clock register

An invalid write attempt to one of the above registers sets the error flag
PHS.PRERR. PHS.PRERR is also set, if a write access to PHCMD is not
immediately followed by an access to one of the protected registers.

www.DataSheet4U.com

150 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

(4) PHS - Peripheral status register


The 8-bit PHS register indicates the status of a write attempt to a register
protected by PHCMD (see also “PHCMD - Command protection register“ on
page 150).
Access This register can be read/written in 8-bit units.
Address FFFF F802H.
Initial Value 00H. The register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 PRERR
a a a a a a a
R R R R R R R R/W
a) These bits may be written, but write is ignored.

Table 4-6 PHS register contents


Bit position Bit name Function
0 PRERR Write error status:
0: Write access was successful.
1: Write access failed.
You can clear this register by writing 0 to it. Setting this register to 1 by software is
not possible.

Note PHS.PRERR is set, if a write access to register PHCMD is not directly followed
by a write access to one of the write-protected registers.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 151


Chapter 4 Clock Generator

(5) PCC - Processor clock control register


The 8-bit PCC register controls the CPU clock. This register can be changed
only once after reset or power save mode release.
Access This register can be read/written in 8-bit units.
Writing to this register is protected by a special sequence of instructions.
Please refer to “PHCMD - Command protection register“ on page 150 for
details.
Address FFFF F828H.
Initial Value 10H. The register is initialized by any reset.

7 6 5 4 3 2 1 0
FRC 0 MFRC CLS 0 SOSCP CKS1 CKS0
R/W Ra R/W Ra Ra R/W R/W R/W
a) These bits may be written, but write is ignored.

Table 4-7 PCC register contents (1/2)


Bit position Bit name Function
7 FRC Sub oscillator circuit: Control of internal return resistance
0: Resistor connected.
1: Resistor disconnected.
Set FRC only to 1, if the sub oscillator is not used.
5 MFRC Main oscillator circuit: Control of internal return resistance
0: Resistor connected.
1: Resistor disconnected.
Do not change the initial setting. To ensure correct operation of the main oscillator,
the internal feed-back resistor must remain connected.
4 CLS Processor clock source monitor flag:
0: Main oscillator operation—source can be the output of main oscillator, PLL, or
SSCG (selection through CKS[1:0]). The main oscillator is enabled by the
internal firmware.
1: Sub clock operation: 32 kHz sub or 240kHz internal oscillator (selection
through bit SOSCP). This is the default after reset.
It is not possible to set this bit to 1 by writing to the register.
On Sub-WATCH release, the CLS bit is set to the state of PSM.OSCDIS. This is the
only way to set CLS to 1, which means, the main oscillator remains stopped and the
CPU is supplied with the sub clock chosen by SOSCP.
CLS is automatically cleared when the processor clock source is changed by writing
to PCC.CKS[1:0].
If CLS is 1, the bits CKS[1:0] have no meaning.
2 SOSCP Sub clock selection:
0: internal oscillator is used for sub clock operation.
1: sub oscillator is used for sub clock operation.
This setting takes effect when bit CLS is 1.

Caution: Do not specify the sub oscillator, if the sub oscillator is not enabled or
not connected.

www.DataSheet4U.com

152 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

Table 4-7 PCC register contents (2/2)


Bit position Bit name Function
1 to 0 CKS[1:0] Processor clock connection:
CKS1 CKS0 Selected clock connection

0 0 Main oscillator

0 1 SSCG

1 0 PLL (main oscillator frequency x4)

1 1 PLL (main oscillator frequency x8)

As long as PCC.CLS = 1 these bits are ignored. For changing the processor clock
source these bits must be written. By this CLS is set to 0 automatically.

Note 1. Switching to an unstable or not available clock is not protected by


hardware. You must monitor the CGSTAT register or count the required
stabilization time by software before switching to make sure not to select
an unstable clock source.
Ensure also that the stabilization times of the PLL and SSCG (refer to the
Data Sheet) have elapsed before using any PLL or SSCG output clock.
2. Switching to sub clock after Sub-WATCH and WATCH mode release or
writing 1 to SDC.SDCR is monitored in the CLS flag. The CLS flag can not
be changed to 1 by software.
3. FRC, MFRC and SOSCP are not changed when power save modes are
entered or released.

Write protection Write protection of this register is achieved in two ways:


• The register can be written only once after any reset.
• The register is protected by a special sequence via the PHCMD register.
A fail of a write by the special sequence is reflected by PHS.PRERR = 1.
If a write is correctly performed by the special sequence after the register has
already once been written successfully PHS.PRERR remains 0, though the
write has been ignored.
PHS.PRERR shows violations of the special sequence only. It does not reflect
attempts to write the register more than once after reset or power save mode
wake-up.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 153


Chapter 4 Clock Generator

(6) SDC - Set default clock register


The 8-bit SDC register can be used to reset the Clock Generator to default
state. This is the state that is set after power save mode release.
Depending on the flags PSM.OSCDIS and PCC.SOSCP, the main, sub, or
internal oscillator becomes the CPU clock source. Both PLL and SSCG are
disabled, and all CPU and peripheral clock selections as well as the SSCG
setup can be rewritten.
Access This register can be read/written in 8-bit units.
Writing to this register is protected by a special sequence of instructions.
Please refer to “PHCMD - Command protection register“ on page 150 for
details.
Address FFFF F83CH.
Initial Value 00H. The register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 SDCR
Ra R a
Ra Ra Ra Ra Ra R/W
a) These bits may be written, but write is ignored.

Table 4-8 SDC register contents


Bit position Bit name Function
0 SDCR Set default Clock Generator configuration:
0: Normal operation.
1: Establish default clock settings.
The bit SDC.SDCR can be set by writing 1. Clearing SDC.SDCR by writing 0 is not
possible, but is done automatically after default clock settings are completed.

Setting SDC.SDCR has the following effects:


• SDC.SDCR remains set until the default clock setting procedure has
finished. After that, it is automatically cleared.
• Depending on the bits PSM.OSCDIS and PCC.SOSCP, either main, sub, or
internal oscillator is chosen as the clock source of the CPU.
• CKC.PERIC is cleared—the main oscillator is the clock source for PCLK0/1.
• SCC.SPSEL[1:0] is cleared—the main oscillator is the clock source for all
SPCLK clocks.
• ICC.IICSEL[1:0] is cleared—the main oscillator is the clock source for IICLK.
• CKC.PLLEN and CKC.SCEN are cleared—but PLL and SSCG are not
stopped.

Note 1. For further information concerning default clock setting refer to “Power
save mode activation“ on page 191.
2. As long as SDC.SDCR is set, do not access any Clock Generator register
except SDC.
www.DataSheet4U.com

154 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

4.2.2 SSCG control registers

This section describes the registers used for controlling the spread spectrum
Clock Generator SSCG.
For modulating the SSCG output clock it’s dithering mode must be enabled by
CKC.DEN = 1.
Reconfiguration of The SSCG control registers SCFC0, SCFC1 and SCFMC can only be rewritten
SSCG registers with new settings if the SSCG is switched off, i.e. if
• the SSCG is disabled by CKC.SCEN = 0
• the SSCG is safely switched off after a power save mode wake-up. Refer to
“CPU operation after power save mode release“ on page 193 for a
procedure to ensure that the SSCG is switched off after wake-up.
During operation of the SSCG the registers may only be rewritten with the
values, they already have.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 155


Chapter 4 Clock Generator

(1) SCFC0 - SSCG frequency control register 0


The 8-bit SCFC0 register controls the frequency modulation of the SSCG. It
determines the SSCG output frequency and is used in conjunction with
register SCFC1.

The center SSCG output frequency is fSSCGc = (4 MHz × N/M) / 2. This


register defines the divisor “m” and thus M = m + 1.
Access This register can be read/written in 8-bit or 1-bit units.
Address FFFF F82CH.
Initial Value 52H. The register is initialized by any reset.

7 6 5 4 3 2 1 0
0a SCFC06 SCFC05 SCFC04 SCFC03 SCFC02 SCFC01 SCFC00
R/W R/W R/W R/W R/W R/W R/W R/W
a) The default value “0” of this bit must not be altered.

Table 4-9 SCFC0 register contents


Bit position Bit name Function
6 to 5 SCFC0[6:5] Must be set to 01B
4 to 3 SCFC0[4:3] Must be set according to Table 4-10
2 to 0 SCFC0[2:0] Determines the divisor m

Note 1. This register can only be rewritten with a new value if the SSCG is
switched off. Refer to the explanation at the beginning of this section.
2. The initial value of this register must be changed after reset.
Frequency If dithering mode is disabled (CKC.DEN = 0) the SSCG outputs its center
calculation frequency fSSCGc:

fSSCGc = (4 MHz x N/M) / 2


where:
• M = m + 1 = SCFC0.SCFC0[2:0] + 1
• N = n + 1 = SCFC1.SCFC1[6:0] + 1
The values to be written into SCFC0 and SCFC1 are restricted. Possible
combinations are:

Table 4-10 Supported settings of N (n) and M (m)

fSSCGmax M (m) N (n) SCFC0 SCFC1


48 MHz 4 (3) 96 (95) 2BH DFH
64 MHz 3 (2) 96 (95) 32H DFH

www.DataSheet4U.com

156 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

(2) SCFC1 - SSCG frequency control register 1


The 8-bit SCFC1 register controls the frequency multiplication of the SSCG. It
determines the SSCG output frequency and is used in conjunction with
register SCFC0.
The center SSCG output frequency is fSSCGc = (4 MHz × N/M) / 2. This
register defines the factor “n” and thus N = n + 1.
Access This register can be read/written in 8-bit or 1-bit units.
Address FFFF F82EH.
Initial Value EBH. The register is initialized by any reset.

7 6 5 4 3 2 1 0
1 SCFC16 SCFC15 SCFC14 SCFC13 SCFC12 SCFC11 SCFC10
R/W R/W R/W R/W R/W R/W R/W R/W

Table 4-11 SCFC1 register contents


Bit position Bit name Function
6 to 0 SCFC1[6:0] Determines the factor n

Note 1. Bits 7 is set to 1 and must not be changed.


2. This register can only be rewritten with a new value if the SSCG is
switched off. Refer to the explanation at the beginning of this section.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 157


Chapter 4 Clock Generator

(3) SCFMC - SSCG frequency modulation control register


The 8-bit SCFMC register controls the frequency modulation of the SSCG in
dithering mode (when CKC.DEN = 1).
Access This register can be read/written in 8-bit or 1-bit units.
Address FFFF F82AH.
Initial Value 00H. The register is initialized by any reset.

7 6 5 4 3 2 1 0
0 0 0 SCFMC4 SCFMC3 SCFMC2 SCFMC1 SCFMC0
R R R R/W R/W R/W R/W R/W

Table 4-12 SCFMC register contents


Bit position Bit name Function
4 to 2 SCFMC[4:2] Frequency modulation range control:
SCFMC4 SCFMC3 SCFMC2 FM range

0 0 0 ± 0.5 % (typical value)

0 0 1 ± 1.0 % (typical value)

0 1 0 ± 2.0 % (typical value)

0 1 1 ± 3.0 % (typical value)

1 0 0 ± 4.0 % (typical value)

1 0 1 ± 5.0 % (typical value)

other settings prohibited

1 to 0 SCFMC[1:0] Frequency modulation frequency control:


SCFMC1 SCFMC0 Modulation frequency

0 0 40 kHz (typical value)

0 1 50 kHz (typical value)

1 0 60 kHz (typical value)

1 1 prohibited

Note 1. This register can only be rewritten with a new value if the SSCG is
switched off. Refer to the explanation at the beginning of this section.
2. The given modulation ranges and frequencies are typical values. Refer
also to the Data Sheet.

In dithering mode, the SSCG output frequency fSSCG varies according to the
FM range, specified by SCFMC[4:2], around it’s center value:
www.DataSheet4U.com
fSSCG = fSSCGc ± (FM range)
The time of one full cycle is given by the period of the modulation frequency
specified in SCFMC[1:0].

158 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

Example If:
• SCFC0 = 2BH, SCFC1 = DFH: center frequency fSSCGc = 48 MHz
• [SCFMC[4:2]] = 101B: FM range = 5 %
• [SCFMC[1:0]] = 01B: modulation frequency = 50 KHz
Then:
• The SSCG frequency is swept between about 45.6 MHz and 50.4 MHz.
• One sweep cycle takes typically 20 µs.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 159


Chapter 4 Clock Generator

(4) SCPS - SSCG post scaler control register


The 8-bit SCPS register controls the two independent SSCG post scalers
(frequency dividers) for the CPU system clock VBCLKand for the modulated
peripheral clocks SPCLK.
Access This register can be read/written in 8-bit or 1-bit units.
Address FFFF F830H.
Initial Value 21H. The register is initialized by any reset.

7 6 5 4 3 2 1 0
0 SPSPS2 SPSPS1 SPSPS0 0 VBSPS2 VBSPS1 VBSPS0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 4-13 SCPS register contents


Bit position Bit name Function
6 to 4 SPSPS[2:0] SSCG clock divider selection for generating SPCLK0:
SPSPS2 SPSPS1 SPSPS0 Clock divider setting

0 0 0 SPCLK0 = SSCG out frequency / 1

0 0 1 SPCLK0 = SSCG out frequency / 2

0 1 0 SPCLK0 = SSCG out frequency / 3

0 1 1 SPCLK0 = SSCG out frequency / 4

1 0 0 not supported

1 0 1 SPCLK0 = SSCG out frequency / 6

1 1 0 not supported

1 1 1 SPCLK0 = SSCG out frequency / 8

2 to 0 VBSPS[2:0] SSCG clock divider selection for generating VBCLK:


VBSPS2 VBSPS1 VBSPS0 Clock divider setting

0 0 0 VBCLK = SSCG out frequency / 1

0 0 1 VBCLK = SSCG out frequency / 2

0 1 0 VBCLK = SSCG out frequency / 3

0 1 1 VBCLK = SSCG out frequency / 4

1 0 0 not supported

1 0 1 VBCLK = SSCG out frequency / 6

1 1 0 not supported

1 1 1 VBCLK = SSCG out frequency / 8

www.DataSheet4U.com
Note This register can only be written when the SSCG enable bit CKC.SCEN is
cleared (SSCG switched off).

160 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

4.2.3 Control registers for peripheral clocks

This section describes the registers used for specifying the sources and
operation modes for the clocks provided for the on-chip peripherals.
These clocks are the clocks for the Watchdog and Watch Timers, the SPCLKn
clocks, FOUTCLK, and IICLK.

Note Be aware that the WCC register controls not only the generation of the
Watchdog Timer clock. It defines also the run/stop mode of the sub and
internal oscillators when certain power save modes are entered.

(1) WCC - Watchdog Timer clock control register


The 8-bit WCC register controls the Watchdog Timer clock. This register can
be changed only once after any reset.
Writing to this register is protected by a special sequence of instructions.
Please refer to “PHCMD - Command protection register“ on page 150 for
details.
Access This register can be read/written in 8-bit units.
Address FFFF F826H.

Initial Value 00H. The register is initialized by any reset.

7 6 5 4 3 2 1 0
SOSTP WPS2 WPS1 WPS0 ROSTP SOSCW WDTSEL1 WDTSEL0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 4-14 WCC register contents (1/2)


Bit position Bit name Function
7 SOSTP Sub oscillator STOP mode control
1: Sub oscillator will stop when STOP mode is entered.
0: Sub oscillator will not stop when STOP mode is entered.
6 to 4 WPS[2:0] WDT clock divider selection:
WPS2 WPS1 WPS0 Clock divider setting

0 0 0 1

0 0 1 1/2

0 1 0 1/4

0 1 1 1/8

1 0 0 1 / 16

1 0 1 1 / 32

1 1 0 1 / 64

1 1 1 1 / 128
www.DataSheet4U.com

3 ROSTP Internal oscillator stop control:


1: Internal oscillator stops if WATCH, Sub-WATCH or STOP mode is entered
0: Internal oscillator always operates

User’s Manual U17566EE5V1UM00 161


Chapter 4 Clock Generator

Table 4-14 WCC register contents (2/2)


Bit position Bit name Function
2, 0 SOSCW, Watchdog Timer clock source selection:
WDTSEL0
SOSCW WDTSEL0 WDT clock source

0 0 Internal oscillator

1 0 Sub oscillator

0 1 Main oscillator

1 1 Setting prohibited

By default, the sub oscillator is disabled in STOP mode (see bit SOSTP). If SOSTP
is 1, choose main or internal oscillator before entering STOP mode.

Caution: Do not specify the sub oscillator, if the sub oscillator is not enabled or
not connected.

1 WDTSEL1 Watchdog Timer clock stand-by control


0: WDTCLK stops in IDLE, WATCH, Sub-WATCH and STOP modes.
1: WDTCLK operates as long as the selected clock source operates.

Note 1. For security reasons, the WCC register should always be programmed
after reset, even if the default settings are used.
2. Watch and Watchdog Timer clocks are not gated during the sub oscillator
stabilization period after STOP-mode release. This may generate spikes
on the clock supply of the watch and Watchdog Timers.

Write protection Write protection of this register is achieved in two ways:


• The register can be written only once after Power-On-Clear reset or external
RESET.
• The register is protected by a special sequence via the PHCMD register.
A fail of a write by the special sequence is reflected by PHS.PRERR = 1.
If a write is correctly performed by the special sequence after the register has
already once been written successfully PHS.PRERR remains 0, though the
write has been ignored.
PHS.PRERR shows violations of the special sequence only. It does not reflect
attempts to write the register more than once after reset.

www.DataSheet4U.com

162 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

(2) TCC - Watch Timer clock control register


The 8-bit TCC register determines the Watch Timer and LCD controller clock
source and the setting of the associated clock dividers. This register can be
changed only once after Power-On-Clear reset or external RESET.
Access This register can be read/written in 8-bit units.
Writing to this register is protected by a special sequence of instructions.
Please refer to “PHCMD - Command protection register“ on page 150 for
details.
Address FFFF F836H.
Initial Value 00H. The register is initialized at power-on and by external RESET.

7 6 5 4 3 2 1 0
0 WTPS2 WTPS1 WTPS0 0 WTSOS WTSEL1 WTSEL0
Ra R/W R/W R/W Ra R/W R/W R/W
a) These bits may be written, but write is ignored.

Table 4-15 TCC register contents (1/2)


Bit position Bit name Function
6 to 4 WTPS[2:0] LCDCLK clock divider selection:
WTPS2 WTPS1 WTPS0 Clock divider setting

0 0 0 1

0 0 1 1/2

0 1 0 1/4

0 1 1 1/8

1 0 0 1 / 16

1 0 1 1 / 32

1 1 0 1 / 64

1 1 1 1 / 128

1 WTSEL1 WTCLK (Watch Timer clock) divider setting:


0: WTCLK = LCDCLK.
1: WTCLK = LCDCLK / 2.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 163


Chapter 4 Clock Generator

Table 4-15 TCC register contents (2/2)


Bit position Bit name Function
2, 0 WTSOS, Clock source for Watch Timer and LCD controller:
WTSEL0
WTSOS WTSEL0 Clock source

0 0 Internal oscillator

1 0 Sub oscillator

0 1 Main oscillator

1 1 Setting prohibited

By default, the sub oscillator is disabled in STOP mode (see bit WCC.SOSTP). If
WCC.SOSTP is 1, choose main or internal oscillator before entering STOP mode.

Caution: Do not specify the sub oscillator, if the sub oscillator is not enabled or
not connected.

Note Only POC and external RESET can clear the TCC register. Only one write
access to TCC is allowed after reset release. Once the TCC has been written,
it ignores new write accesses until the next POC or external RESET is issued.

Write protection Write protection of this register is achieved in two ways:


• The register can be written only once after Power-On-Clear reset or external
RESET.
• The register is protected by a special sequence via the PHCMD register.
A fail of a write by the special sequence is reflected by PHS.PRERR = 1.
If a write is correctly performed by the special sequence after the register has
already once been written successfully PHS.PRERR remains 0, though the
write has been ignored.
PHS.PRERR shows violations of the special sequence only. It does not reflect
attempts to write the register more than once after reset.

www.DataSheet4U.com

164 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

(3) SCC - SPCLK control register


The 8-bit SCC register selects the SPCLK sources.
Access This register can be read/written in 8-bit or 1-bit units.
Writing to this register is protected by a special sequence of instructions.
Please refer to “PHCMD - Command protection register“ on page 150 for
details.
Address FFFF F832H.
Initial Value 00H. The register is initialized by entering WATCH, Sub-WATCH, or STOP
mode, or if control bit SDC.SDCR is set.
7 6 5 4 3 2 1 0
0 0 0 0 0 0 SPSEL1 SPSEL0
R R R R R R R/W R/W

Bit position Bit name Function


1 to 0 SPSEL[1:0] Source selection for generating the SPCLK clocks:
Clock sources
SPSEL1 SPSEL0
SPCLK0 SPCLK1 SPCLK2

0 0 Main osc Main osc Main osc

0 1 PLL / 2 PLL / 4 Main osc

1 0 not supported

1 1 SSCGPS SSCGPS / 2 SSCGPS / 4

Note 1. “Main osc” is the clock MOCLK provided by the main oscillator.
2. “PLL” is the clock PLLCLK provided by the PLL.
“SSCGPS“ is the clock provided by the SSCG post scaler for SPCLK (see also
“SCPS - SSCG post scaler control register“ on page 160

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 165


Chapter 4 Clock Generator

(4) FCC - FOUTCLK control register


The 8-bit FCC register configures the output clock FOUTCLK that can be used
for external devices.
Access This register can be read/written in 8-bit or 1-bit units.
Writing to this register is protected by a special sequence of instructions.
Please refer to “PHCMD - Command protection register“ on page 150 for
details.
Address FFFF F834H.
Initial Value 00H. The register is initialized by any reset.

7 6 5 4 3 2 1 0
FOEN FOCS2 FOCS1 FOCS0 0 FOSOS FOCKS1 FOCKS0
R/W R/W R/W R/W R R/W R/W R/W

Table 4-16 FCC register contents


Bit position Bit name Function
7 FOEN Output clock FOUTCLK enable:
0: FOUTCLK is disabled.
1: FOUTCLK is enabled.
6 to 4 FOCS[2:0] Output clock divider setting for FOUTCLK:
FOCS2 FOCS1 FOCS0 Clock divider setting

0 0 0 FOUTCLK = selected clock source / 1

0 0 1 FOUTCLK = selected clock source / 2

0 1 0 FOUTCLK = selected clock source / 4

0 1 1 FOUTCLK = selected clock source / 8

1 0 0 FOUTCLK = selected clock source / 16

1 0 1 FOUTCLK = selected clock source / 32

1 1 0 FOUTCLK = selected clock source / 64

1 1 1 FOUTCLK = selected clock source / 128

2 to 0 FOSOS, Clock source selection for FOUTCLK:


FOCKS[1:0]
FOSOS FOCKS1 FOCKS0 Clock source

x 0 0 Main oscillator

x 0 1 SSCG

x 1 0 PLL

0 1 1 Internal oscillator

1 1 1 Sub oscillator
www.DataSheet4U.com
Caution: Do not specify the sub oscillator, if the sub oscillator is not enabled or not
connected.

166 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

Note 1. FOUTCLK is not influenced by stand-by modes of the microcontroller. It


runs as long as it is enabled and the selected clock source operates.
Application software must stop FOUTCLK by clearing the FOEN bit to
minimize power consumption in stand-by modes.
2. There is an upper frequency limit for the output buffer of the FOUTCLK
function. Do not select a frequency higher than the maximum output buffer
frequency. Please refer to the Data Sheet for the frequency limit.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 167


Chapter 4 Clock Generator

(5) ICC - IIC clock control register


The 8-bit ICC register determines the I2C clock source and the clock divider
setting for IICLK.
Access This register can be read/written in 8-bit units.
Writing to this register is protected by a special sequence of instructions.
Please refer to “PHCMD - Command protection register“ on page 150 for
details.
Address FFFF F838H.
Initial Value 00H. The register is cleared by any reset.

7 6 5 4 3 2 1 0
0 IICPS2 IICPS1 IICPS0 0 0 IICSEL1 IICSEL0
Ra R/W R/W R/W a
R Ra R/W R/W
a) These bits may be written, but write is ignored.

Table 4-17 ICC register contents


Bit position Bit name Function
6 to 4 IICPS[2:0] Divider setting for IICLK:
IICPS2 IICPS1 IICPS0 Clock divider setting

0 0 0 1

1 0 1 1 / 3.5

1 1 1 1 / 4.5

other settings not supported

1 to 0 IICSEL[1:0] Clock source for IICLK:


IICSEL1 IICSEL0 Clock source

0 0 Main oscillator

0 1 SSCG / 2

1 x PLL

Note 1. On release of WATCH, Sub-WATCH and STOP mode or when the


SDC.SDCR bit is set, IICSEL[1:0] is cleared—the main oscillator is
selected as the IIC clock source.
Pay attention if PSM.OSCDIS = 1 before entering any of the above power
save modes, because the main oscillator will be disabled. Therefore the
I2C interface will have no clock supply after power save mode release.

2. The connected I2C interfaces must be disabled before switching


www.DataSheet4U.com IICPS[2:0]. To switch the IICPS bits, first disable the I2C interface by
clearing the enable bit in the IIC control register, then switch IICPS[2:0] and
finally re-enable the IIC interface.

168 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

4.2.4 Control registers for power save modes

The registers described in this section control the begin and end of the power
save modes IDLE, WATCH, Sub-WATCH, and STOP.
Please refer to “Power save mode activation“ on page 191 for instructions and
an example on how to enter a power save mode.

(1) PSM - Power save mode register


The 8-bit PSM register specifies the power save mode and controls the clock
generation after reset and Sub-WATCH mode release. In addition, it specifies
the source of the Watch Calibration Timer clock WCTCLK.
Access This register can be read/written in 8-bit or 1-bit units.
Address FFFF F820H.
Initial Value 08H. The register is initialized by any reset.
Since the main oscillator is started by the internal firmware are reset, PSM
enters the user’s program with the setting 00H.

7 6 5 4 3 2 1 0
0 CMODE 0 0 OSCDIS 0 PSM1 PSM0
R R/W R R R/W R R/W R/W

Table 4-18 PSM register contents (1/3)


Bit position Bit name Function
6 CMODE Watch Calibration Timer clock selection:
0: PCLK1.
1: Main oscillator.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 169


Chapter 4 Clock Generator

Table 4-18 PSM register contents (2/3)


Bit position Bit name Function
3 OSCDIS Main oscillator disable/enable control during and after power save mode:
0: Main oscillator enabled.
1: Main oscillator disabled.

Caution: If OSCDIS is set to 1, the main oscillator clock supply for the Watch
Timer and the LCD Controller/Driver are stopped immediately.
Thus these function stop their operation immediately as well, when the
main oscillator is used as the clock source.

OSCDIS determines also the behaviour of the main oscillator during and after
power save mode. The effect of this bit differs, depending on the power save mode.
• Sub-WATCH mode
During Sub-WATCH mode the main oscillator is always stopped. OSCDIS
determines whether the main oscillator shall be started and chosen as CPU clock
source or should remain stopped after Sub-WATCH mode release.
0: Main oscillator enable.
The main oscillator is started after Sub-WATCH mode release and the CPU is
supplied with the main oscillator clock, after the oscillation stabilization time has
elapsed.
1: Main oscillator disable.
The main oscillator remains stopped after Sub-WATCH release.
The CPU is supplied with the selected sub clock—either sub oscillator or
internal oscillator (see bit PCC.SOSCP).
Since the reset value of OSCDIS is 1 and PCC.SOSCP is 0 the CPU starts
always with the internal oscillator clock after reset release.
In both cases, the application software must start the main oscillator by clearing
the OSCDIS bit. After the oscillator stabilization time has elapsed (see bit
CGSTAT.OSCSTAT), the main oscillator can be used as system clock source by
setting the PCC register accordingly.
• WATCH mode
This bit determines whether the main oscillator shall be stopped or remain in
operation during WATCH mode. In either case after WATCH mode release the CPU
is operating on the main oscillator.
0: Main oscillator enable.
The main oscillator is operating during WATCH mode.
After WATCH mode release the CPU is supplied with the main oscillator clock.
1: Main oscillator disable.
The main oscillator is stopped during WATCH mode.
After WATCH mode release the main oscillator is started and the CPU is
supplied with the main oscillator clock, after the oscillation stabilization time has
elapsed.

Note: In case the main oscillator is chosen as the CPU clock after power save
mode release (i.e. after Sub-WATCH mode release with OSCDIS = 0 or
after WATCH mode release) the start-up phase of the CPU differs
depending on the history of the main oscillator status indicator
CGSTAT.OSCSTAT.
– main oscillator never used before
If the main oscillator has never been stable before entering and releasing
power save mode (CGSTAT.OSCSTAT has never been set to 1), the CPU
www.DataSheet4U.com starts operation on the internal oscillator. After the main oscillator has
become stable, it is used as the CPU clock.
– main oscillator already used before
If the main oscillator has already been stable before entering and releasing
power save mode (CGSTAT.OSCSTAT has already been set to 1), the CPU
starts operation on main oscillator, after the main oscillator has become
stable.

170 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

Table 4-18 PSM register contents (3/3)


Bit position Bit name Function
1 to 0 PSM[1:0] Power save mode selection:
PSM1 PSM0 Power save mode

0 0 IDLE

0 1 STOP

1 0 WATCH

1 1 Sub-WATCH mode (main oscillator shut down)

It is not possible to switch to IDLE or WATCH mode when the CPU is operated by a
sub clock. If IDLE or WATCH mode is selected during sub clock operation, the Sub-
WATCH mode will be entered.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 171


Chapter 4 Clock Generator

(2) PSC - Power save control register


The 8-bit PSC register is used to enter or leave the power save mode specified
in register PSM.
Access This register can be read/written in 8-bit or 1-bit units.
Writing to this register is protected by a special sequence of instructions.
Please refer to “PRCMD - PSC write protection register“ on page 173 for
details.
Address FFFF F1FEH.
Initial Value 00H. The register is cleared by any reset.

7 6 5 4 3 2 1 0
0 NMIWDTM NMI0M INTM 0 0 STP 0
R R/W R/W R/W R R R/W R

Table 4-19 PSC register contents


Bit position Bit name Function
6 NMIWDTM Mask for non-maskable interrupt request from WDT:
0: Permit NMIWDT request during power save mode.
1: Prohibit NMIWDT request during power save mode.
5 NMI0M Mask for non-maskable interrupt request 0:
0: Permit external NMI0 request during power save mode
1: Prohibit external NMI0 request during power save mode.
4 INTM Mask for maskable interrupt request:
0: Permit maskable interrupt requests during power save mode.a
1: Prohibit maskable interrupt requests during power save mode.
1 STP Enter/release power save mode:
0: Power save mode is released.
1: Power save mode is entered.
a)
Only dedicated maskable interrupts have wake-up capability, refer to “Power save modes description“ on
page 179.

Note 1. If bits 7, 3, 2, and 0 are not set to 0, proper operation of the controller can
not be guaranteed.
2. PSC.STP is automatically cleared when the controller is awakened from
power save mode.
3. Entering a power save mode requires some attention, refer to “Power save
mode activation“ on page 191.

www.DataSheet4U.com

172 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

(3) PRCMD - PSC write protection register


The 8-bit PRCMD register protects the register PSC from inadvertent write
access, so that the system does not stop in case of a program hang-up.
After data has been written to the PRCMD register, the first write access to
register PSC is valid. All subsequent write accesses are ignored. Thus, the
value of PSC can only be rewritten in a specified sequence, and illegal write
access is inhibited.
Access This register can only be written in 8-bit units.
Address FFFF F1FCH
Initial Value The contents of this register is undefined.
7 6 5 4 3 2 1 0
x x x x x x x x
W W W W W W W W

Caution Before writing to PRCMD, make sure that all DMA channels are disabled.
Otherwise, a direct memory access could occur between the write access to
PRCMD and the write access to PSC. If that happens, the power save mode
may not be entered.

Caution In case a high level programming language is used, make sure that the
compiler translates the two write instructions to PRCMD and PSC into two
consecutive assembler “store” instructions.

w w w . D a t a S h e e t 4 U . c o m

User’s Manual U17566EE5V1UM00 173


Chapter 4 Clock Generator

(4) STBCTL- Stand-by control register


The 8-bit STBCTL register is used to control the stand-by function of the
voltage regulators.
Access This register can be read/written in 8-bit or 1-bit units.
Writing to this register is protected by a special sequence of instructions.
Please refer to “STBCTLP - Stand-by control protection register“ on page 174
for details.
Address FFFF FCA2H.
Initial Value 00H. The register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 0 0 STYCD STBYMD
R R R R R R R/W R/W

Table 4-20 STBCTL register contents


Bit position Bit name Function
1 STBYCD Enable stand-by function of VDD50 and VDD51 voltage regulators:
0: Stand-by function disabled
1: Stand-by function enabled
2 STBYMD Enable stand-by function of VDD52 voltage regulator:
0: Stand-by function disabled
1: Stand-by function enabled

In order to reduce the power consumption during power save modes the stand-
by function of the voltage regulators should be enabled during the initialization.
If a dedicated microcontroller does not include any of the voltage regulators
dedicated to the controls bit STBCTL.STBYCD andSTBCTL.STBYMD, the
status of the control bit has no function. Thus the initialization for enabling the
stand-by functions by STBCTL = 03H can be retained. For further details
concerning voltage regulators refer to “Power Supply Scheme“ on page 1.

(5) STBCTLP - Stand-by control protection register


The 8-bit STBCTLP register protects the register STBCTL from inadvertent
write access.
After data has been written to the STBCTLP register, the first write access to
register STBCTL is valid. All subsequent write accesses are ignored. Thus, the
value of STBCTL can only be rewritten in a specified sequence, and illegal
write access is inhibited.
Access This register can only be written in 8-bit units.
Address FFFF FCAAH

Initial Value The contents of this register is undefined.


7 6 5 4 3 2 1 0
X X X X X X X X
w w w . D a t a S h e e t 4 U . c o m
W W W W W W W W

174 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

4.2.5 Clock monitor registers

The following registers are used to control the monitor circuits of the main
oscillator clock and the sub oscillator clock.
Please refer to “Operation of the Clock Monitors“ on page 198 for
supplementary information.

(1) CLMM - Main oscillator clock monitor mode register


The 8-bit CLMM register is used to enable the monitor for the main oscillator
clock.
Access This register can be read/written in 8-bit or 1-bit units.
Writing to this register is protected by a special sequence of instructions.
Please refer to “PRCMDCMM - CLMM write protection register“ on page 176
for details.
Address FFFF F870H.

Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 CLMEM
R R R R R R R R/W

Table 4-21 CLMM register contents


Bit position Bit name Function
0 CLMEM Clock monitor enable:
0: Clock monitor for main oscillator disabled.
1: Clock monitor for main oscillator enabled.
This bit can only be cleared by reset.

Note CLMM.CLMEM can be set at any time. However, the clock monitor is only
activated after the main oscillator has stabilized, indicated by
CGSTAT.OSCSTAT = 1.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 175


Chapter 4 Clock Generator

(2) PRCMDCMM - CLMM write protection register


The 8-bit PRCMDCMM register protects the register CLMM from inadvertent
write access, so that the system does not stop in case of a program hang-up.
After data has been written to the PRCMDCMM register, the first write access
to register CLMM is valid. All subsequent write accesses are ignored. Thus,
the value of CLMM can only be rewritten in a specified sequence, and illegal
write access is inhibited.
Access This register can only be written in 8-bit units.
Address FFFF FCB0H
Initial Value The contents of this register is undefined.
7 6 5 4 3 2 1 0
X X X X X X X X
W W W W W W W W

After writing to the PRCMDCMM register, you are permitted to write once to
CLMM. The write access to CLMM must happen with the immediately following
instruction.

Caution In case a high level programming language is used, make sure that the
compiler translates the two write instructions to PRCMDCMM and CLMM into
two consecutive assembler “store” instructions.

w w w . D a t a S h e e t 4 U . c o m

176 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

(3) CLMS - Sub oscillator clock monitor register


The 8-bit CLMS register is used to enable the monitor for the sub oscillator
clock.
Access This register can be read/written in 8-bit or 1-bit units.
Writing to this register is protected by a special sequence of instructions.
Please refer to “PRCMDCMS - CLMS write protection register“ on page 177
for details.
Address FFFF F878H.
Initial Value 00H. The register is initialized by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 CLMES
R R R R R R R R/W

Table 4-22 CLMS register contents


Bit position Bit name Function
0 CLMES Clock monitor enable:
0: Clock monitor for sub oscillator disabled.
1: Clock monitor for sub oscillator enabled.
This bit can only be cleared by reset.

Note Setting CLMS.CLMES to 1 does not start the sub oscillator clock monitor. To
start the clock monitor CLMCS.CMRT has to be set to 1 afterwards.
CLMCS.CMRT must not be set before the sub oscillator has stabilized.

(4) PRCMDCMS - CLMS write protection register


The 8-bit PRCMDCMS register protects the register CLMS from inadvertent
write access, so that the system does not stop in case of a program hang-up.
After data has been written to the PRCMDCMS register, the first write access
to register CLMS is valid. All subsequent write accesses are ignored. Thus, the
value of CLMS can only be rewritten in a specified sequence, and illegal write
access is inhibited.
Access This register can only be written in 8-bit units.
Address FFFF FCB2H
Initial Value The contents of this register is undefined.
7 6 5 4 3 2 1 0
X X X X X X X X
W W W W W W W W

After writing to the PRCMDCMS register, you are permitted to write once to
CLMS. The write access to CLMS must happen with the immediately following
instruction.
w w w . D a t a S h e e t 4 U . c o m

Caution In case a high level programming language is used, make sure that the
compiler translates the two write instructions to PRCMDCMS and CLMS into
two consecutive assembler “store” instructions.

User’s Manual U17566EE5V1UM00 177


Chapter 4 Clock Generator

(5) CLMCS - Sub oscillator clock monitor control register


The 8-bit CLMCS register is used to start the monitor of the sub oscillator
clock.
Access This register can be read/written in 8-bit or 1-bit units.
Address FFFF F71AH.
Initial Value 00H. The register is initialized by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 CMRT
R R R R R R R R/W

Table 4-23 CLMCS register contents


Bit position Bit name Function
0 CMRT Sub oscillator clock monitor start:
0: Clock monitor for sub oscillator off.
1: Clock monitor for sub oscillator on.

Setting CLMCS.CMRT to 1 generates a trigger to activate the sub oscillator


clock monitor.

Note 1. The sub oscillator clock monitor can only be started, if it has been enabled
by setting CLMS.CLMES to 1.
2. Make sure that the sub oscillator stabilization time has elapsed before
starting the clock monitor.

Caution Starting the sub oscillator clock monitor requires a special procedure. Refer to
“Operation of the Clock Monitors“ on page 198.

www.DataSheet4U.com

178 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

4.3 Power Save Modes

This chapter describes the various power save modes and how they are
operated. For details see:
• “Power save modes description“ on page 179
• “Power save mode activation“ on page 191
• “CPU operation after power save mode release“ on page 193

4.3.1 Power save modes description

This section explains the various power save modes in detail.


During power save During all power save modes, the pins behave as follows:
mode • All output pins retain their function. That means all outputs are active,
provided the required clock source is available.
• All input pins remain as input pins.
• All input pins with stand-by wake-up capability remain active, the function of
all others is disabled.
During all power save modes, the main and sub oscillator clock monitors
remain active, provided that the monitored oscillator is operating. If the
oscillator is switched off during stand-by, the associated clock monitor enters
stand-by as well.
Wake-up signals The following signals can awake the controller from power save modes IDLE,
WATCH, Sub-WATCH, STOP:
• Reset signals
– external RESET
– Power-On-Clear reset RESPOC
– Watchdog Timer reset RESWDT
The Watchdog Timer must be configured to generate the reset WDTRES
in case of overflow (WDTM.WDTMODE = 1) and it’s input clock WDTCLK
must be active during stand-by.
– Clock monitors resets RESCMM, RESCMS
The main oscillator respectively sub oscillator must be active during
stand-by.
• Non maskable interrupts
– NMI0
The appropriate port must be configured correctly.
– NMIWDT
The Watchdog Timer must be configured to generate the in case of
overflow (WDTM.WDTMODE = 0) and it’s input clock WDTCLK must be
active during stand-by.
• Maskable interrupts
www.DataSheet4U.com
– external interrupts INTPn
The appropriate port must be configured correctly.
– CAN wake up interrupts INTCnWUP
The appropriate port and the CAN (CnCTRL.PSMODE[1:0] = 01B) must
be configured correctly.

User’s Manual U17566EE5V1UM00 179


Chapter 4 Clock Generator

– Watch Timer interrupts INTWTnUV


The Watch Timer clock WTCLK must be active and the Watch Timer must
be enabled.
– Watch Calibration Timer interrupt INTTM01
The Watch Calibration Timer clock WCTCLK must be active and the
Watch Calibration Timer must be enabled.
– Voltage Comparators interrupts INTVCn
The Voltage Comparators must be enabled.
– CSIB receive interrupts INTCBnR
The CSIB must be operated in slave reception mode and the appropriate
ports must be configured correctly.
Note that not all these signals are available in all power save modes.
The following signals can awake the controller from the power save mode
HALT, provided the appropriate ports and modules are correctly configured
and the required clocks are active:
• all reset signals
• the non-maskable interrupts NMI0, NMIWDT
• all maskable interrupts

To grant wake-up capability to maskable interrupts these interrupts have to be


unmasked by setting the dedicated mask flags xxMK to 0 (refer to “Interrupt
Controller (INTC)“ on page 201).
A general disable of maskable interrupts acknowledgement (“DI”, i.e.
PSW.ID = 1) does not affect their wake-up capability.
After power save After power save mode release, the clock source for CPU operation should be
mode checked. If the user application issues a wake-up request immediately after
power save mode request, the power save mode may not be entered and the
clock sources remain as programmed before the stand-by request.
After power save mode release, the same procedure as for system reset is
required to set up the clock supply for the application.

Note In the following tables the clock status "operates" does not necessarily mean
that the functions that use this clock source are operating as well.

www.DataSheet4U.com

180 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

(1) HALT mode


The HALT mode can be entered from normal run mode. In HALT mode, all
clock settings remain unchanged. Only the CPU clock is suspended and hence
program execution.

Table 4-24 Clock Generator status in HALT mode


Item Status Remarks
Main oscillator unchanged
Sub oscillator operates
Internal oscillator operates
SSCG unchanged
PLL unchanged
VBCLK (CPU system) suspended Clock setup is unchanged
IICLK unchanged
PCLK0, PCLK1 unchanged
PCLK2…PCLK15 unchanged
SPCLK0, SPCLK1 unchanged
SPCLK2…SPCLK15 unchanged
FOUTCLK unchanged
WTCLK / LCDCLK unchanged
WDTCLK unchanged
WCTCLK unchanged

The HALT mode can be released by any unmasked maskable interrupt, NMI or
system reset.
On HALT mode release, all clock settings remain unchanged. The CPU clock
resumes operation.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 181


Chapter 4 Clock Generator

(2) IDLE mode


The IDLE mode can be entered from any run mode. The main oscillator must
be operating. IDLE mode can not be entered if the CPU is clocked by the sub
or internal oscillator.
In IDLE mode, the clock distribution is stopped (refer to the “Standby” switches
in Figure 4-1, “Block diagram of the Clock Generator,” on page 140).
The states of all clock sources, that means, sub and internal oscillator as well
as SSCG and PLL, remain unchanged. If a clock source was operating before
entering IDLE mode, it continues operating.

Table 4-25 Clock Generator status in IDLE mode


Item Status Remarks
Main oscillator unchanged
Sub oscillator operates
Internal oscillator operates
SSCG unchanged
PLL unchanged
VBCLK (CPU system) stopped
IICLK stopped
PCLK0, PCLK1 stopped
PCLK2…PCLK15 stopped
SPCLK0, SPCLK1 stopped
SPCLK2…SPCLK15 stopped
FOUTCLK unchanged
WTCLK / LCDCLK unchanged
WDTCLK unchanged
WCTCLK unchanged/stopped Depends on clock selector
PSM.CMODE

The IDLE mode can be released by


• the unmasked maskable interrupts INTPn, INTCnWUP, INTWTnUV,
INTTM01, INTVCn, INTCBnR
• NMI0, NMIWDT
• RESET, RESPOC, RESWDT, RESCMM, RESCMS
On IDLE mode release, the CPU clock and peripheral clocks are supplied by
the main oscillator.

www.DataSheet4U.com

182 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

(3) WATCH mode


In WATCH mode, the clock supply for the CPU system and the majority of
peripherals is stopped.
The main oscillator continues operation. PLL and SSCG are stopped. By
default, internal oscillator and sub oscillator operation is not affected. For
exceptions see “Internal and sub oscillator operation“ on page 196.

Table 4-26 Clock Generator status in WATCH mode


Item Status Remarks
Main oscillator unchanged/stopped Stopped if PSM.OSCDIS = 1
Sub oscillator operates
Internal oscillator operates/stopped Stopped if WCC.ROSTP = 1
SSCG stopped
PLL stopped
VBCLK (CPU system) stopped
IICLK stopped
PCLK0, PCLK1 stopped
PCLK2…PCLK15 stopped
SPCLK0, SPCLK1 stopped
SPCLK2…SPCLK15 stopped
FOUTCLK unchanged/stopped Stopped, if the selected clock
source stops
WTCLK / LCDCLK unchanged/stopped Stopped, if the selected clock
source stops
WDTCLK unchanged/stopped Stopped, if the selected clock
source stops
WCTCLK unchanged/stopped Depends on clock selector
PSM.CMODE

The WATCH mode can be released by


• the unmasked maskable interrupts INTPn, INTCnWUP, INTWTnUV,
INTTM01, INTVCn, INTCBnR
• NMI0, NMIWDT
• RESET, RESPOC, RESWDT, RESCMM, RESCMS
On WATCH mode release, the CPU starts operation using the following
clocks:
• if PSM.OSCDIS = 1: sub clock source selected before WATCH mode was
entered, that means, either internal oscillator or sub oscillator (defined by
PCC.SOSCP)
• if PSM.OSCDIS = 0: main oscillator
If the internal oscillator was stopped before entering the WATCH mode, the
oscillation stabilization time for the internal oscillator is ensured by hardware
www.DataSheet4U.com after WATCH mode release.
PLL and SSCG remain stopped after WATCH release.
Peripheral clock supply is switched to main oscillator supply, if
PSM.OSCDIS = 0, otherwise the internal oscillator is used for peripheral
clocks.

User’s Manual U17566EE5V1UM00 183


Chapter 4 Clock Generator

(4) Sub-WATCH mode


In Sub-WATCH mode, the clock supply for the CPU and the majority of
peripherals is stopped. Main oscillator, PLL, and SSCG are stopped. By
default, internal oscillator and sub oscillator operation is not influenced. For
exceptions see “Internal and sub oscillator operation“ on page 196.

Table 4-27 Clock Generator status in Sub-WATCH mode


Item Status Remarks
Main oscillator stopped
Sub oscillator operates
Internal oscillator operates/stopped Stopped if WCC.ROSTP = 1
SSCG stopped
PLL stopped
VBCLK (CPU system) stopped
IICLK stopped
PCLK0, PCLK1 stopped
PCLK2…PCLK15 stopped
SPCLK0, SPCLK1 stopped
SPCLK2…SPCLK15 stopped
FOUTCLK unchanged Stopped, if the selected clock source
stops
WTCLK / LCDCLK unchanged Stopped, if the selected clock source
stops
WDTCLK unchanged/stopped Stopped, if the selected clock source
stops
WCTCLK stopped

The Sub-WATCH mode can be released by


• the unmasked maskable interrupts INTPn, INTCnWUP, INTWTnUV,
INTVCn, INTCBnR
• NMI0, NMIWDT
• RESET, RESPOC, RESWDT, RESCMM, RESCMS
On Sub-WATCH mode release, the CPU starts operation using the following
clocks:
• if PSM.OSCDIS = 1: sub clock source selected before Sub-WATCH mode
was entered, that means, either internal oscillator or sub oscillator (defined
by PCC.SOSCP)
• if PSM.OSCDIS = 0: main oscillator
If the internal oscillator was stopped before entering the Sub-WATCH mode,
the oscillation stabilization time for the internal oscillator is ensured by
hardware after Sub-WATCH release.
PLL and SSCG remain stopped after Sub-WATCH release.
www.DataSheet4U.com
Peripheral clock supply is switched to main oscillator supply, if
PSM.OSCDIS = 0, otherwise the internal oscillator is used for peripheral
clocks.

184 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

(5) STOP mode


In STOP mode, all clock sources are stopped, except sub and internal
oscillator. These can be configured in register WCC to stop as well. No clock is
available, and no internal self-timed processes operates.

Table 4-28 Clock Generator status in STOP mode


Item Status Remark
Main oscillator stopped
Sub oscillator operates/stopped Stopped if WCC.SOSTP = 1
Internal oscillator operates/stopped Stopped if WCC.ROSTP = 1
SSCG stopped
PLL stopped
VBCLK (CPU system) stopped
IICLK stopped
PCLK0, PCLK1 stopped
PCLK2…PCLK15 stopped
SPCLK0, SPCLK1 stopped
SPCLK2…SPCLK15 stopped
FOUTCLK stopped
WTCLK / LCDCLK stopped
WDTCLK unchanged/stopped Stopped, if the selected clock
source stops
WCTCLK stopped

The STOP mode can be released by


• the unmasked maskable interrupts INTPn, INTCnWUP, INTVCn, INTCBnR
• NMI0, NMIWDT
• RESET, RESPOC, RESWDT, RESCMM, RESCMS
On STOP mode release, the CPU clock and peripheral clocks are supplied by
the main oscillator.

(6) Clock status summary


Table 4-29 on page 186 summarizes the status of all clocks delivered by the
Clock Generator in the different states.
“Normal” describes all status except reset and power save modes.
The HALT mode is not listed in the table. It does not change any of the table
items, but stops only the CPU core operation.
Below the table you find the explanation of the terms used in the table.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 185


186
Table 4-29 Status of oscillators and Clock Generator output clocks (1/2)

Clock Reset IDLE STOP WATCH Sub- Sub-


Macro Condition Reset Normal IDLE STOP WATCH
Chapter 4

signal release release release release WATCH WATCH

www.DataSheet4U.com
Oscillators
Main-osc – OSCDIS=0 n.a. on on on on on
stop on stop
OSCDIS=1 stop stop n.a. stop n.a. stop
Sub-osc – SOSTP=1 n.a. stop
on on on on on
SOSTP=0 on on
Internal-osc – ROSTP=1 n.a. stop stop stop
on on on on on
ROSTP=0 on on on on
SSCG/PLL
SSCG – – scen scen
stby stby stby stby
PLL – – pllen pllen
Clock Generator output clocks

User’s Manual U17566EE5V1UM00


CPU VBCLK CLS/CKS = 000B MOCLK MOCLK MOCLK MOCLK MOCLK
system
CLS/CKS = 001B n.a. SSCCLK n.a. n.a. n.a. n.a.
clock off off off off
CLS/CKS = 01xB PLLCLK n.a. n.a. n.a. n.a.
CLS/CKS = 1xxB off ROCLK SBCLK n.a. n.a. n.a. SBCLK
a
Peripheral PCLK0 PERIC=0 off MOCLK MOCLK MOCLK MOCLK MOCLK MOCLK
clocks PCLK1 off off off off
PERIC=1 n.a. PLLCLK PLLCLK n.a. n.a. n.a.
PCLK2 - –
off MOCLKa MOCLK off MOCLK off MOCLK off MOCLK off MOCLK
PCLK15
SPCLK0 SPSEL[1:0]=00B off MOCLKa MOCLK MOCLK MOCLK MOCLK MOCLK
SPCLK1
SPSEL[1:0]=01B PLLCLK off PLLCLK off n.a. off n.a. off n.a.
n.a.
SPSEL[1:0]=11B SSCCLK SSCCLK n.a. n.a. n.a.
a
SPCLK2 - SPSEL1=0 off MOCLK MOCLK MOCLK MOCLK MOCLK MOCLK
SPCLK15 off off off off
SPSEL1=1 n.a. PLLCLK PLLCLK n.a. n.a. n.a.
Clock Generator
Table 4-29 Status of oscillators and Clock Generator output clocks (2/2)
Clock Reset IDLE STOP WATCH Sub- Sub-
Macro Condition Reset Normal IDLE STOP WATCH
signal release release release release WATCH WATCH

www.DataSheet4U.com
Watch WCTCLK CMODE=0 off MOCLKa PCLK1 off PCLK1 PCLK1 off PCLK1 PCLK1
Calibration off off
CMODE=1 n.a. MOCLK MOCLK MOCLK MOCLK MOCLK MOCLK MOCLK
Clock Generator

Timer
Watchdog WDTCLK SOSC=0 WDTSEL1=0 off ROSCK off off off off
Timer WDTSEL0=0 ROSCK ROSCK ROSCK ROSCK ROSCK
WDTSEL1=1 ROSCK ROSCK ROSCK
n.a. ROSCK
(offb) (offb) (offb)
SOSC=1 WDTSEL1=0 off off off off
WDTSEL0=0 n.a. SOCLK SOCLK SOCLK SOCLK SOCLK
WDTSEL1=1 SOCLK
SOCLK SOCLK SOCLK
(offb)
SOSC=x WDTSEL1=0 off off
WDTSEL0=1 n.a. MOCLK MOCLK off MOCLK MOCLK off MOCLK
WDTSEL1=1 MOCLK MOCLK
I2C IICLK IICSEL[1:0]=00B off MOCLKa MOCLK MOCLK MOCLK MOCLK MOCLK
IICSEL[1:0]=01B SSCSCK off SSCSCK off n.a. off n.a. off n.a.
n.a.

User’s Manual U17566EE5V1UM00


IICSEL[1:0]=1xB PLLSCK PLLSCK n.a. n.a. n.a.
Watch WTCLK WTSOS/WTSEL0=00B ROSCK ROSCK ROSCK
ROSCK ROSCK ROSCK ROSCK ROSCK ROSCK
Timer LCDCLK (offb) (offb) (offb)
LCD-C/D
WTSOS/WTSEL0=10B SOCLK
SOCLK SOCLK SOCLK SOCLK SOCLK SOCLK SOCLK
(offb)
n.a.
WTSOS/WTSEL0=x1B MOCLK MOCLK
MOCLK MOCLK off MOCLK MOCLK MOCLK
(offc) (offc)
Port FOUTCLK FOSOS/FOCKS1/0=x00B off MOCLK MOCLK MOCLKLCD-C/D MOCLK MOCLK
FOSOS/FOCKS1/0=x01B SSCCLK SSCCLK SSCCLK SSCCLK SSCCLK
FOSOS/FOCKS1/0=x10B PLLCLK PLLCLK PLLCLK PLLCLK PLLCLK
n.a.
FOSOS/FOCKS1/0=011B ROCLK ROCLK ROCLK ROCLK ROCLK
FOSOS/FOCKS1/0=111B SOCLK SOCLK SOCLK SOCLK SOCLK
a) After reset release these clocks are supplied with the internal ROCLK. When the main oscillator is stable, these clocks are automatically changed to MOCLK.
b)
ROCLK (SOCLK) remains clock source, but internal oscillator (sub oscillator) may be stopped in the respective power save mode by WCC.ROSTP = 1 (WCC.SOSTP = 1).
c)
MOSCLK remains clock source, but main oscillator may be stopped in the respective power save mode by PSM.OSCDIS = 1.

187
Chapter 4
In the table following terms are used:

188
stop: Oscillator stopped MOCLK: Main oscillator clock
Chapter 4

on: Oscillator operating ROCLK: Internal oscillator clock

www.DataSheet4U.com
stby: PLL/SSCG in standby, no clock output SOCLK: Sub oscillator clock
pllen/scen: PLL/SSCG generates clock output SBCLK: Sub clock
– PCC.SOSCP = 0: ROCLK
– PCC.SOSCP = 1: SOCLK
off: Clock inactive PLLCLK: PLL output clock
n.a. not applicable (control bits are deter- SSCGCLK: SSCG output clock
mined by hardware)

User’s Manual U17566EE5V1UM00


Clock Generator
Reset

www.DataSheet4U.com
CLS = 1
Clock Generator

SOSCP = 0
VBCLK states
(1)

CLS = 0, CKS[1:0] = 1xB CLS = 0, CKS[1:0] = 01B CLS = 0, CKS[1:0] = 00B

PLL SSCG Sub-clock MainOSC MainOSC


PCC write PCC write
VBCLK = PLLCLK VBCLK = SSCCLK VBCLK = SBCLK
(x4 or x8) PCC.SOSCP = prohibited permitted
0: SBCLK = ROCLK
1: SBCLK = SOCLK VBCLK = MOCLK VBCLK = MOCLK

PSM PSM PSM Wake-up PSM PSM Wake-up


entry entry entry OSCDIS = 1 entry entry
VBCLK state transitions

User’s Manual U17566EE5V1UM00


PSM[1:0] = 10B PSM[1:0] = 00B PSM[1:0] = 11B PSM[1:0] = 01B
4.3.2 Clock Generator state transitions

OSCDIS
WATCH mode IDLE mode =1
Sub-WATCH mode STOP mode
MainOSC = unchanged/off MainOSC = unchanged/off MainOSC = on/off MainOSC = off
SubOSC = on SubOSC = on SubOSC = on SubOSC = on
IntOSC = on/off IntOSC = on/off IntOSC = on/off OSCDIS IntOSC = on/off
=0

OSCDIS OSCDIS
PSM states
=1 =0

SDC.SDCR = 1

189
Chapter 4
Chapter 4 Clock Generator

(2) Main oscillator state transitions

Reset

MainOSC
started by F/W

PSM release from


MainOSC - STOP (PSM[1:0] = 01B)
stabilization - SDC.SDCR = 1 and OSCDIS = 0

Stabilization counter
expired

PSM entry with


- PSM[1:0] = 01B (STOP) PSM release from
MainOSC - PSM[1:0] = 11B (Sub-WATCH) MainOSC - Sub-WATCH (PSM[1:0] = 11B) and OSCDIS = 1
operating - PSM[1:0] = 10B (WATCH) and OSCDIS = 1 stopped - SDC.SDCR = 1 and OSCDIS = 1
- SDC.SDCR = 1

PSM release from


- Sub-WATCH (PSM[1:0] = 11B) and OSCDIS = 0
- WATCH (PSM[1:0] = 10B)
- SDC.SDCR = 1 and OSCDIS = 0

(3) Internal oscillator states

PSM entry with

Reset IntOSC - PSM[1:0] = 01B (STOP) and ROSTP = 1 IntOSC


- PSM[1:0] = 11B (Sub-WATCH) and ROSTP = 1
operating - PSM[1:0] = 10B (WATCH) and ROSTP = 1 stopped

PSM release

(4) Sub oscillator states

Reset SubOSC PSM entry with SubOSC


- PSM[1:0] = 01B (STOP) and SCSTP = 1
operating stopped

www.DataSheet4U.com
PSM release

190 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

4.3.3 Power save mode activation

In the following procedures for securely entering a power save mode are
described.
Stepper-C/D shut In order to minimize power consumption during power save modes the Stepper
down Motor Controller/Driver needs to be shut down in a special sequence. Refer to
“MCNTCn0, MCNTCn1 - Timer mode control registers“ on page 887.

(1) HALT mode


For entering the HALT mode proceed as follows:
1. Mask all interrupts which shall not have wake-up capability by
xxIC.xxMK = 1 and discard all possibly pending interrupts by xxIC.xxIF = 0.
2. Unmask all interrupts which shall have wake-up capability by
xxIC.xxMK = 0.
3. Execute the “halt” instruction.
4. Insert at least five “nop” instruction after the “halt” instruction.

(2) WATCH, Sub-WATCH, STOP and IDLE mode


For entering these power save mode proceed as follows:
1. In case maskable interrupts shall be used for wake-up unmask these
interrupts by IMRm.xxMK = 0 (refer to “IMR0 to IMR6 - Interrupt mask
registers“ on page 252).
2. Mask all other interrupts, i.e.
– none wake-up capable interrupts
– wake-up capable interrupts which shall not be used for wake-up
by IMRm.xxMK = 1. This prevents the power save mode entry procedure
from being interrupted by these interrupts.
3. It is recommended to disable interrupt acknowledgement by the “di”
instruction.
4. Specify the desired power save mode in PSM.PSM[1:0].
5. Enable writing to the write-protected register PSC by writing to PRCMD.
6. Write to PSC for specifying permitted wake-up events and activate the
power save mode by setting PSC.STP to 1.

Example The following example shows how to initialize and enter a WATCH, Sub-
WATCH, STOP or IDLE power save mode.
First the desired power save mode is specified (WATCH mode in this example,
that means PSM.PSM[1:0] = 10B).
The PSC register is a write-protected register, and the PRCMD register is the
corresponding write-enable register. PRCMD has to be written immediately
before writing to PSC.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 191


Chapter 4 Clock Generator

In this example, maskable interrupts are permitted to leave the power save
mode.

1. // xxIC.xxMK = 0 // mask all none wake-up interrupts


2. // xxIC.xxMK = 1 // unmask all wake-up interrupts
3. di
4. mov 0x02,r10
5. st.b r10,PSM[r0] // PSM.PSM[1:0] = 10B: WATCH mode
6. mov 0x62,r10
7. st.b r10,PRCMD[r0] // enable write to PSC
8. st.b r10,PSC[r0] // wake up by maskable interrupts
// and enter power save mode
9. nop
10. nop
11. nop
12. nop
13. nop
14. // after wake-up
15. // xxIC.xxIF = 0 // discard all unwanted pending interrupts
16. ei

Be aware of the following notes when entering power save mode using the
above sequence:

Note 1. It is recommended to disable maskable interrupt acknowledgement in


general by the “di” instruction (step 3.) to prevent any pending interrupt
from being served during the power save mode set-up procedure. This
makes it also possible to completely control the process after wake-up,
since no pending interrupt will be unintentional acknowledged. Before
enabling interrupt acknowledgement by the “ei” instruction (step 16.) after
wake-up, all unwanted interrupts can be discarded by setting xxIC.xxIF = 0
(step 15.).
Since the wake-up capability of the unmasked wake-up interrupts is not
affected by “di”, such interrupts shall be masked (step 1.) by
IMRm.xxMK = 1.
2. The store instruction to PRCMD will not allow to acknowledge any interrupt
until processing of the subsequent instruction is complete. That means, an
interrupt will not be acknowledged before the store to PSC. This
presupposes that both store instructions are performed consecutively, as
shown in the above example.
If another instruction is placed between steps 7 and 8, an interrupt request
may be acknowledged in between, and the power save mode may not be
entered.
However if the “di” instruction was executed before (step 3.) none interrupt
will be acknowledged anyway.
3. At least 5 “nop” instructions must follow the power down mode setting, that
means after the write to PSC. The microcontroller requires this time to
www.DataSheet4U.com enter power down mode.
4. The data written to the PRCMD register must be the same data that shall
be written to the write-protected register afterwards.
The above example ensures this method, since the contents of r10 is first
written to PRCMD and then immediately to PSC.

192 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

5. Make sure that all DMA channels are disabled. Otherwise a DMA could
happen between steps 7 and 8, and the power down mode may not be
entered at all.
Further on do not perform write operations to PRCMD and write-protected
registers by DMA transfers.
6. No special sequence is required for reading the PSC register.

Caution If a wake-up event occurs within the 5 “nop” instructions after a power save
mode request (PSC.STP = 1) the microcontroller is immediately returning from
power save mode, but may have not at all or only partly entered the power
save mode. Following three situations can occur:
1. power save mode request not accepted
wake-up configuration not established, PLL/SSCG are operating
2. power save mode request accepted, but not completed
wake-up configuration established, but PLL/SSCG operating
3. power save mode request accepted and completed
wake-up configuration established, PLL/SSCG stopped

4.3.4 CPU operation after power save mode release

Clock Generator re- The clock for the CPU system can be switched only once after reset, power
configuration save mode release, or the default clock setup request (SDC.SDCR = 1).
The clocks for the Watchdog Timer, Watch Timer, and LCD Controller/Driver
can be switched only once after system reset.
Access to peripherals that have no clock supply in Sub-WATCH mode may
cause system deadlock. This can happen if the main oscillator remains
disabled.

Wake-up Wake-up configuration established means that all registers and clock paths are
configuration set to their wake-up state.

The software should check after wake-up whether the expected wake-up
configuration has been completely established. This can be achieved by
observing
• following clock generator registers, which are modified by power save mode
entry and wake-up
– after WATCH, Sub-WATCH, STOP wake-up following bits are cleared:
CKC.PLLEN, CKC.SCEN, CKC.PERIC, SCC.SEL, ICC.SEL
– after IDLE or STOP wake-up following bits are cleared:
PCC.CLS, PCC.CKS
– after Sub-WATCH or WATCH wake-up
PCC.CLS/PCC.CKS = 000B, if PSM.OSCDIS = 0
PCC.CLS/PCC.CKS = 100B, if PSM.OSCDIS = 1
www.DataSheet4U.com
• the “completed power save mode” bit CGSTAT.CMPLPSM
– CGSTAT.CMPLPSM = 0 if a power save mode request has been
accepted but not completed, wake-up configuration established, but PLL/

User’s Manual U17566EE5V1UM00 193


Chapter 4 Clock Generator

SSCG operating (provided that CGSTAT.CMPLPSM = 1 before power


save mode request)
– CGSTAT.CMPLPSM = 1 if a power save mode has been completely
entered, wake-up configuration established, PLL/SSCG stopped
(provided that a power save mode request has been accepted before, i.e.
CGSTAT.CMPLPSM = 1 →0)
Note that CGSTAT.CMPLPSM is set to 0 if a power save mode request is
accepted. If it was 0 before it does not change it’s state.
Table 4-30 summarizes the different configurations.

Table 4-30 Power save mode wake-up configurations

CGSTAT.CMPLPSM Registers and


Configuration after wake-up
before PSM-RQ b after wake-up clock pathsa

0 not changed PSM-RQ not accepted

0 PSM-RQ accepted
changed configuration done, but PLL/
SSCG operating
not changed not possible

1 PSM-RQ accepted
changed configuration done, PLL/SSCG
off
1 not changed not possible

0 PSM-RQ accepted
changed configuration done, but PLL/
SSCG operating
not changed PSM-RQ not accepted

1 PSM-RQ accepted
changed configuration done, PLL/SSCG
off
a)
A change of a register’s contents can only be taken as an indicator if it is before
power save mode request different to the wake-up configuration.
b)
PSM-RQ: power save mode request (PSC.STP = 1)

If the power save mode request was accepted the entire clock generator can
be reconfigured after wake-up. Afterwards set CKC.PLLEN = 1 and
CKC.SCEN = 1 and wait the stabilization times before using the PLL and
SSCG as clock sources.

Set default clock If the power save mode wake-up configuration is entered by setting
SDC.SDCR = 1 all registers and clock paths settings are performed, but the
PLL and SSCG are still operating, that means CGSTAT.PSM remains
unchanged.
The entire clock generator can be reconfigured, i.e. all registers can be written.
If the SSCG configuration shall not be changed, set CKC.PLLEN = 1 and
www.DataSheet4U.com CKC.SCEN = 1. The SSCG respectively PLL can be used immediately as
clock sources without waiting the stabilization times.
If the SSCG configuration shall be changed, rewrite the SSCG configuration
registers, set CKC.PLLEN = 1 and CKC.SCEN = 1. In this case make sure the
stabilization times has elapsed before using the PLL or SSCG as clock
sources.

194 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

After IDLE and On return from IDLE or STOP mode, the bits PCC.CLS, PCC.CKS1, and
STOP PCC.CKS2 are cleared. After IDLE mode, the main oscillator is still running; on
return from STOP mode, it is automatically started.
As a result, the main oscillator is chosen and enabled as the source for the
CPU system clock VBCLK.

After WATCH In WATCH mode the main oscillator operation depends on PSM.OSCDIS:
• If PSM.OSCDIS was 0 before entering WATCH mode the main oscillator
remains active. After WATCH mode release the main oscillator is chosen as
the CPU system clock.
• If PSM.OSCDIS was 1 before entering WATCH mode the main oscillator is
stopped during WATCH mode. After WATCH mode release the main
oscillator is automatically started, the oscillator stabilization time is waited
and the main oscillator is chosen as the CPU system clock.

After Sub-WATCH In Sub-WATCH mode the main oscillator is stopped. On return from Sub-
WATCH, PCC.CLS is set to the status of PSM.OSCDIS.
• If PSM.OSCDIS was 0 before entering Sub-WATCH, the main oscillator is
started and chosen as the source for the CPU system clock (PCC.CLS = 0,
PCC.CKS[1:0] = 00B).
• If PSM.OSCDIS was 1 before entering Sub-WATCH, the main oscillator
remains stopped, and the CPU is clocked by a sub clock (PCC.CLS = 1,
PCC.CKS[1:0] = xxB).
“Sub clock” means the clocks supplied by either the 32 KHz sub oscillator or
the 200 kHz internal oscillator. The selection must be made in the PCC
register before entering the Sub-WATCH or WATCH mode:
• PCC.SOSCP = 0: Internal oscillator
• PCC.SOSCP = 1: Sub oscillator
Software can switch from sub clock CPU operation to normal run mode (by
enabling the main oscillator by PSM.OSCDIS = 0) or re-enter Sub-WATCH
respectively WATCH mode.
After HALT On return from HALT mode the CPU resumes operation with the same clock
settings as before HALT was entered.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 195


Chapter 4 Clock Generator

4.4 Clock Generator Operation

4.4.1 Internal and sub oscillator operation

By default, sub and internal oscillator operate during all power save modes.
However, it can be specified in the WCC register that the sub oscillator stops in
STOP mode (WCC.SOSTP).
It can also be specified that the internal oscillator stops in WATCH, Sub-
WATCH, and STOP mode (WCC.ROSTP).
These bits can be written once after system reset, independent of the reset
source.

4.4.2 Watch Timer and Watch Calibration Timer clocks

The Watch Timer input clock WTCLK can be derived directly from the main,
sub, or internal oscillator. Therefore, the WT can be operating in all power save
modes.
Because PCLK1 is stopped during power save modes, the Watch Calibration
Timer input clock WCTCLK can be directly connected to the main oscillator
output.

Note WCTCLK is not available in Sub-WATCH and STOP mode where the main
oscillator is stopped. These modes must be released before the WCT can
operate.

4.4.3 Clock output FOUTCLK

The Clock Generator output signal FOUTCLK supplies a clock for external
components. It can be derived from any internal clock source, that means
internal oscillator, sub oscillator, main oscillator, PLL, or SSCG.A dedicated
frequency divider is available to scale the output clock down.
FOUTCLK must be enabled by register setting (FCC.FOEN = 1). It is not
influenced by the power save modes. But FOUTCLK stops, if the selected
clock source stops.
After reset release, FOUTCLK is disabled (register FCC is cleared), and the
pin FOUT put in input mode.

Note 1. If you change the configuration of FOUTCLK or enable/disable the


selected clock source while FOUTCLK is active, glitches or irregular clock
periods may appear at the output pin.
2. The clock signal FOUTCLK cannot be used to synchronize external
circuitry to other output signals of the microcontroller—it has no specified
www.DataSheet4U.com
phase relation to other output signals.
3. There is an upper frequency limit for the output buffer of the FOUTCLK
function. Do not select a frequency higher than the maximum output buffer
frequency. Please refer to the Data Sheet for the frequency limit.

196 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

4.4.4 Default clock generator setup

The Clock Generator can be reset to the clock settings that are used by default
after power save mode release. This is done by setting bit SDC.SDCR.
For this kind of reset, it is not necessary to enter a power save mode, and no
wake-up signal is required.
If reset to defaults is requested, CKC.PLLEN and CKC.SCEN are cleared.
However the PLL and SSCG remain active. The CPU clock source is switched
to sub, internal, or main oscillator (depending on the bits PSM.OSCDIS and
PCC.SOSCP). Peripheral clock sources are switched to main oscillator. For
details see “SDC - Set default clock register“ on page 154.
This feature reduces the total power consumption of peripherals and CPU.
It provides also a way to stop the PLL and SSCG. These PLLs must be
stopped if the clock sources for the CPU or peripherals shall be changed.

Note While the clock sources are switched, the peripheral clocks are suspended.
Therefore, the timing of peripheral modules may be inaccurate until the reset
has finished.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 197


Chapter 4 Clock Generator

4.4.5 Operation of the Clock Monitors

The microcontroller provides two separate clock monitors to watch the activity
of the main oscillator and the sub oscillator.

(1) Description
The functional block diagram is shown below.

main osc fM CLKM_MAIN

CGSTAT.OSCSTAT start
output RESCMM

fR
EN
CLMM.CLMEM

sub osc fM CLKM_SUB

CLMCS.CMRT start
output RESCMS

internal osc fR
EN
CLMS.CLMES

Figure 4-2 Clock Monitors block diagram

The clock monitors use the internal oscillator (fR) for monitoring the main and
sub oscillators (fM).
If the main oscillator clock monitor detects a malfunction of the main oscillator
(no pulse), it generates the reset request RESCMM. If the sub oscillator clock
monitor detects a malfunction of the sub oscillator, it generates the reset
request RESCMS.

(2) Start and stop


Before the clock monitors can be started, they have to be enabled by setting
CLMM.CLMEM and CLMS.CLMES to 1.

Main oscillator After enabling CLMM.CLMEM = 1 the main oscillator monitor is automatically
monitor start started as soon as the main oscillator is stable, indicated by
CGSTAT.OSCSTAT = 1.
www.DataSheet4U.com

Sub oscillator After enabling CLMM.CLMES = 1 the sub oscillator monitor must be started by
monitor start software by setting CLMCS.CMRT to 1.
After starting the sub oscillator clock monitor by CLMCS.CMRT = 1 clear
CLMCS.CMRT by software.

198 User’s Manual U17566EE5V1UM00


Clock Generator Chapter 4

Since CLMCS.CMRT = 1 is synchronized with the internal oscillator any


change of this bit has to be maintained for at least 65 internal oscillator periods
TROSC = 1/fROSC to become effective. Therefore a wait period has to be
assured before this bit is changed again.
Proceed as follows to start the sub oscillator clock monitor:
1. After reset enable sub oscillator clock monitor:
PRCMDCM = FFHpermit write to CLMS
CLMS.CLMES = 1enable sub oscillator clock monitor
2. Make sure the sub oscillator is stable.
3. Start sub oscillator clock monitor after reset and after power save mode
wake-up:
CLMCS.CMRT = 1
4. Wait for 65 internal oscillator periods TROSC before resetting CMRT:
wait (65 x max(TROSC))
5. Clear CLMCS.CMRT:
CLMCS.CMRT = 0
6. Before CMRT should be set to 1 again, wait for 65 internal oscillator
periods TROSC:
wait (65 x max(TROSC))

Note that the minimum internal oscillator frequency min(fROSC) (max(TROSC))


has to be taken into account for the wait time in steps (3) and (5).

Caution The sub oscillator clock monitor is sometimes already started by setting
CLMS.CLMES = 1, i.e. without CLMCS.CMRT = 1.
In these cases it would not be required to start the sub oscillator by setting
CLMCS.CMRT = 1 additionally.

Since it is unpredictable whether the clock monitor has already started after
CLMS.CLMES = 1 the procedure described above should be followed in any
case.

(3) Operation during and after power save modes


Main oscillator If the main oscillator is stopped, its clock monitor changes to stand-by. When
stopped the main oscillator is restarted after power save mode release, the main
oscillator clock monitor restarts automatically.
Sub oscillator If the sub oscillator is stopped, its clock monitor stops.
stopped
When the sub oscillator is restarted after power save mode release, the sub
oscillator clock monitor does not start automatically.
Software must ensure that the sub oscillator stabilization time has elapsed and
then start the monitor by setting CLMCS.CMRT to 1.
Internal oscillator If the internal oscillator is stopped, both clock monitors’ operation is
stopped suspended. Their operation is automatically resumed as soon as the internal
www.DataSheet4U.com oscillator is restarted.

User’s Manual U17566EE5V1UM00 199


Chapter 4 Clock Generator

www.DataSheet4U.com

200 User’s Manual U17566EE5V1UM00


Chapter 5 Interrupt Controller (INTC)

This controller is provided with a dedicated Interrupt Controller (INTC) for


interrupt servicing and can process a large amount of maskable and two non-
maskable interrupt requests.
An interrupt is an event that occurs independently of program execution, and
an exception is an event whose occurrence is dependent on program
execution. Generally, an exception takes precedence over an interrupt.
This controller can process interrupt requests from the on-chip peripheral
hardware and external sources. Moreover, exception processing can be
started by the TRAP instruction (software exception) or by generation of an
exception event (i.e. fetching of an illegal opcode) (exception trap).
Eight levels of software-programmable priorities can be specified for each
interrupt request. Starting of interrupt servicing takes no fewer than 5 system
clocks after the generation of an interrupt request.

5.1 Features

• Interrupts
– Non-maskable interrupts: 2 sources
– Maskable interrupts:

µPD70F3421, µPD70F3422, µPD70F3424, µPD70F3425,


Interrupt source
µPD70F3423 µPD70F3426A, µPD70F3427
Internal 69 85
peripherals
External 7 8
Software 2 2

– 8 levels of programmable priorities (maskable interrupts)


– Multiple interrupt control according to priority
– Masks can be specified for each maskable interrupt request
– Noise elimination, edge detection and valid edge specification, level
detection for external interrupt request signals
– Wake-up capable
(analogue noise elimination for external interrupt request signals)
– NMI and INTP0 share the same pin
• Exceptions
– Software exceptions: 2 channels with each 16 sources
www.DataSheet4U.com – Exception traps: 2 sources (illegal opcode exception and debug trap)

User’s Manual U17566EE5V1UM00 201


Chapter 5 Interrupt Controller (INTC)

Table 5-1 Interrupt/exception source list (1/4)


Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Reset Interrupt RESET RESET input Pin – 0000H 00000000H undef.
Non- Interrupt NMI0 NMI Input PORT – 0010H 00000010H nextPC
maskable
NMIWDT Watchdog Timer WDT – 0020H 00000020H nextPC
NMI2 Unused – – 0030H 00000030H nextPC
Software Exception TRAP0n TRAP instruction 004nH
– – 00000040H nextPC
exception (n = 0 to F H ) (n = 0 to F H )

Exception TRAP1n TRAP instruction 005nH


– – 00000050H nextPC
(n = 0 to F H ) (n = 0 to F H )

Exception Exception ILGOP/ Illegal opcode/


– – 0060H 00000060H nextPC
trap DBTRAP DBTRAP instruction
Maskable Interrupt INTVC0 Voltage Comparator 0 AC0 0 0080H 00000080H next PC
Interrupt INTVC1 Voltage Comparator 1 AC1 1 0090H 00000090H next PC
Interrupt INTWT0UV WT0 underflow WT0 2 00A0H 000000A0H next PC
Interrupt INTWT1UV WT1 underflow WT1 3 00B0H 000000B0H next PC
Interrupt Reserved Reserved – 4 00C0H 000000C0H next PC
Interrupt INTTM01 Watch calibration timer
WCT 5 00D0H 000000D0H next PC
capture compare
Interrupt INTP0 External interrupt 0 PORT 6 00E0H 000000E0H next PC
Interrupt INTP1 External interrupt 1 PORT 7 00F0H 000000F0H next PC
Interrupt INTP2 External interrupt 2 PORT 8 0100H 00000100H next PC
Interrupt INTP3 External interrupt 3 PORT 9 0110H 00000110H next PC
Interrupt INTP4 External interrupt 4 PORT 10 0120H 00000120H next PC
Interrupt INTP5 External interrupt 5 PORT 11 0130H 00000130H next PC
Interrupt INTP6 External interrupt 6 PORT 12 0140H 00000140H next PC
Interrupt INTTZ0UV TMZ0 underflow TMZ0 13 0150H 00000150H next PC
Interrupt INTTZ1UV TMZ1 underflow TMZ1 14 0160H 00000160H next PC
Interrupt INTTZ2UV TMZ2 underflow TMZ2 15 0170H 00000170H next PC
Interrupt INTTZ3UV TMZ3 underflow TMZ3 16 0180H 00000180H next PC
Interrupt INTTZ4UV TMZ4 underflow TMZ4 17 0190H 00000190H next PC
Interrupt INTTZ5UV TMZ5 underflow TMZ5 18 01A0H 000001A0H next PC
Interrupt INTTP0OV TMP0 overflow TMP0 19 01B0H 000001B0H next PC
Interrupt INTTP0CC0 TMP0 capture compare
TMP0 20 01C0H 000001C0H next PC
channel 0
Interrupt INTTP0CC1 TMP0 capture compare
TMP0 21 01D0H 000001D0H next PC
channel 1
Interrupt INTTP1OV TMP1 overflow TMP1 22 01E0H 000001E0H next PC
www.DataSheet4U.com
Interrupt INTTP1CC0 TMP1 capture compare
TMP1 23 01F0H 000001F0H next PC
channel 0
Interrupt INTTP1CC1 TMP1 capture compare
TMP1 24 0200H 00000200H next PC
channel 1
Interrupt INTTP2OV TMP2 overflow TMP2 25 0210H 00000210H next PC

202 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

Table 5-1 Interrupt/exception source list (2/4)


Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Maskable Interrupt INTTP2CC0 TMP2 capture compare
TMP2 26 0220H 00000220H next PC
channel 0
Interrupt INTTP2CC1 TMP2 capture compare
TMP2 27 0230H 00000230H next PC
channel 1
Interrupt INTTP3OV TMP3 overflow TMP3 28 0240H 00000240H next PC
Interrupt INTTP3CC0 TMP3 capture compare
TMP3 29 0250H 00000250H next PC
channel 0
Interrupt INTTP3CC1 TMP3 capture compare
TMP3 30 0260H 00000260H next PC
channel 1
Interrupt INTTG0OV0 TMG0 overflow interrupt 0 TMG0 31 0270H 00000270H next PC
Interrupt INTTG0OV1 TMG0 overflow interrupt 1 TMG0 32 0280H 00000280H next PC
Interrupt INTTG0CC0 TMG0 capture compare
TMG0 33 0290H 00000290H next PC
channel 0
Interrupt INTTG0CC1 TMG0 capture compare
TMG0 34 02A0H 000002A0H next PC
channel 1
Interrupt INTTG0CC2 TMG0 capture compare
TMG0 35 02B0H 000002B0H next PC
channel 2
Interrupt INTTG0CC3 TMG0 capture compare
TMG0 36 02C0H 000002C0H next PC
channel 3
Interrupt INTTG0CC4 TMG0 capture compare
TMG0 37 02D0H 000002D0H next PC
channel 4
Interrupt INTTG0CC5 TMG0 capture compare
TMG0 38 02E0H 000002E0H next PC
channel 5
Interrupt INTTG1OV0 TMG1 overflow interrupt 0 TMG1 39 02F0H 000002F0H next PC
Interrupt INTTG1OV1 TMG1 overflow interrupt 1 TMG1 40 0300H 00000300H next PC
Interrupt INTTG1CC0 TMG1 capture compare
TMG1 41 0310H 00000310H next PC
channel 0
Interrupt INTTG1CC1 TMG1 capture compare
TMG1 42 0320H 00000320H next PC
channel 1
Interrupt INTTG1CC2 TMG1 capture compare
TMG1 43 0330H 00000330H next PC
channel 2
Interrupt INTTG1CC3 TMG1 capture compare
TMG1 44 0340H 00000340H next PC
channel 3
Interrupt INTTG1CC4 TMG1 capture compare
TMG1 45 0350H 00000350H next PC
channel 4
Interrupt INTTG1CC5 TMG1 capture compare
TMG1 46 0360H 00000360H next PC
channel 5
Interrupt INTTY0UV0 TMY0 channel 0 underflow TMY0 47 0370H 00000370H next PC
Interrupt INTTY0UV1 TMY0 channel 1underflow TMY0 48 0380H 00000380H next PC
Interrupt INTAD ADC end of conversion ADC 49 0390H 00000390H next PC
www.DataSheet4U.com
Interrupt INTC0ERR CAN0 error interrupt CAN0 50 03A0H 000003A0H next PC
Interrupt INTC0WUP CAN0 wake up interrupt CAN0 51 03B0H 000003B0H next PC
Interrupt INTC0REC CAN0 receive interrupt CAN0 52 03C0H 000003C0H next PC
Interrupt INTC0TRX CAN0 transmit interrupt CAN0 53 03D0H 000003D0H next PC

User’s Manual U17566EE5V1UM00 203


Chapter 5 Interrupt Controller (INTC)

Table 5-1 Interrupt/exception source list (3/4)


Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Maskable Interrupt INTCB0RE CSIB0 receive error
CSIB0 54 03E0H 000003E0H next PC
interrupt
Interrupt INTCB0R CSIB0 receive complete
CSIB0 55 03F0H 000003F0H next PC
interrupt
Interrupt INTCB0T CSIB0 transmit interrupt CSIB0 56 0400H 00000400H next PC
Interrupt INTUA0RE UARTA0 receive error
UARTA0 57 0410H 00000410H next PC
interrupt
Interrupt INTUA0R UARTA0 receive complete
UARTA0 58 0420H 00000420H next PC
interrupt
Interrupt INTUA0T UARTA0 transmit interrupt UARTA0 59 0430H 00000430H next PC
Interrupt INTUA1RE UARTA1 receive error
UARTA1 60 0440H 00000440H next PC
interrupt
Interrupt INTUA1R UARTA1 receive complete
UARTA1 61 0450H 00000450H next PC
interrupt
Interrupt INTUA1T UARTA1 transmit interrupt UARTA1 62 0460H 00000460H next PC
Interrupt INTIIC0 IIC0 interrupt IIC0 63 0470H 00000470H next PC
Interrupt INTIIC1 IIC1 interrupt IIC1 64 0480H 00000480H next PC
Interrupt INTSG0 SG0 interrupt SG0 65 0490H 00000490H next PC
Interrupt INTDMA0 DMA0 transmission end DMA0 66 04A0H 000004A0H next PC
Interrupt INTDMA1 DMA1 transmission end DMA1 67 04B0H 000004B0H next PC
Interrupt INTDMA2 DMA2 transmission end DMA2 68 04C0H 000004C0H next PC
Interrupt INTDMA3 DMA3 transmission end DMA3 69 04D0H 000004D0H next PC
Interrupt INT70 not generated by hardware a — 70 04E0H 000004E0H next PC
Interrupt INT71 not generated by hardware a — 71 04F0H 000004F0H next PC
Interrupt INTP7 External interrupt 7 PORT 72 0500H 00000500H next PC
Interrupt INTC1ERR CAN1 error interrupt CAN1 73 0510H 00000510H next PC
Interrupt INTC1WUP CAN1 wake up interrupt CAN1 74 0520H 00000520H next PC
Interrupt INTC1REC CAN1 receive interrupt CAN1 75 0530H 00000530H next PC
Interrupt INTC1TRX CAN1 transmit interrupt CAN1 76 0540H 00000540H next PC
Interrupt INTTZ6UV TMZ6 underflow TMZ6 77 0550H 00000550H next PC
Interrupt INTTZ7CUV TMZ7 underflow TMZ7 78 0560H 00000560H next PC
Interrupt INTTZ8UV TMZ8 underflow TMZ8 79 0570H 00000570H next PC
Interrupt INTTZ9UV TMZ9 underflow TMZ9 80 0580H 00000580H next PC
Interrupt INTTG2OV0 TMG2 overflow interrupt 0 TMG2 81 0590H 00000590H next PC
Interrupt INTTG2OV1 TMG2 overflow interrupt 1 TMG2 82 05A0H 000005A0H next PC
Interrupt INTTG2CC0 TMG2 capture compare
TMG2 83 05B0H 000005B0H next PC
channel 0
www.DataSheet4U.com
Interrupt INTTG2CC1 TMG2 capture compare
TMG2 84 05C0H 000005C0H next PC
channel 1
Interrupt INTTG2CC2 TMG2 capture compare
TMG2 85 05D0H 000005D0H next PC
channel 2
Interrupt INTTG2CC3 TMG2 capture compare
TMG2 86 05E0H 000005E0H next PC
channel 3

204 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

Table 5-1 Interrupt/exception source list (4/4)


Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Maskable Interrupt INTTG2CC4 TMG2 capture compare
TMG2 87 05F0H 000005F0H next PC
channel 4
Interrupt INTTG2CC5 TMG2 capture compare
TMG2 88 0600H 00000600H next PC
channel 5
Interrupt INTCB1RE CSIB1 receive error
CSIB1 89 0610H 00000610H next PC
interrupt
Interrupt INTCB1R CSIB1 receive complete
CSIB1 90 0620H 00000620H next PC
interrupt
Interrupt INTCB1T CSIB1 transmit interrupt CSIB1 91 0630H 00000630H next PC
Interrupt INTCB2RE CSIB2 receive error
CSIB2 92 0640H 00000640H next PC
interrupt
Interrupt INTCB2R CSIB2 receive complete
CSIB2 93 0650H 00000650H next PC
interrupt
Interrupt INTCB2T CSIB2 transmit interrupt CSIB2 94 0660H 00000660H next PC
Interrupt INTLCD LCDBUSIF transmit interrupt LCDBUSIF 95 0670H 00000670H next PC
Interrupt INTC2ERR CAN2 error interrupt CAN2 96 0680H 00000680H next PC
Interrupt INTC2WUP CAN2 wake up interrupt CAN2 97 0690H 00000690H next PC
Interrupt INTC2REC CAN2 receive interrupt CAN2 98 06A0H 000006A0H next PC
Interrupt INTC2TRX CAN2 transmit interrupt CAN2 99 06B0H 000006B0H next PC
a)
These interrupts can be used as software triggered interrupts.

Default priority: The priority order when two or more maskable interrupt requests are
generated at the same time.
The highest priority is 0.
1. Restored PC:
The value of the PC saved to EIPC or FEPC when interrupt/exception
processing is started. However, the value of the PC saved when an inter-
rupt is acknowledged during division (DIV, DIVH, DIVU, DIVHU) instruction
execution is the value of the PC of the current instruction (DIV, DIVH, DIVU,
DIVHU).
2. nextPC:
The PC value that starts the processing following interrupt/exception
processing.
3. The execution address of the illegal instruction when an illegal opcode
exception occurs is calculated by (Restored PC – 4).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 205


Chapter 5 Interrupt Controller (INTC)

Table 5-2 µPD70F3420 (OTF), µPD70F3421, µPD70F3421 (OTF), µPD70F3422,


µPD70F3422, (OTF), µPD70F3423 interrupt/exception source list (1/4)
Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Reset Interrupt RESET RESET input Pin – 0000 H 00000000 H a undef.
Non- Interrupt NMI0 NMI Input PORT – 0010 H 00000010 H nextPC
maskable
NMIWDT Watchdog Timer WDT – 0020 H 00000020 H nextPC
NMI2 Unused – – 0030 H 00000030 H nextPC
Software Exception TRAP0n TRAP instruction 004nH
– – 00000040 H nextPC
exception (n = 0 to F H ) (n = 0 to F H )

Exception TRAP1n TRAP instruction 005nH


– – 00000050 H nextPC
(n = 0 to F H ) (n = 0 to F H )

Exception Exception ILGOP/ Illegal opcode/


– – 0060 H 0 H 00000060 H nextPC
trap DBTRAP DBTRAP instruction
Maskable Interrupt INTVC0 Voltage Comparator 0 AC0 0 0080 H 00000080 H next PC
Interrupt INTVC1 Voltage Comparator 1 AC1 1 0090 H 00000090 H next PC
Interrupt INTWT0UV WT0 underflow WT0 2 00A0 H 000000A0 H next PC
Interrupt INTWT1UV WT1 underflow WT1 3 00B0 H 000000B0 H next PC
Interrupt Reserved Reserved – 4 00C0 H 000000C0 H next PC
Interrupt INTTM01 Watch calibration timer
WCT 5 00D0 H 000000D0 H next PC
capture compare
Interrupt INTP0 External interrupt 0 PORT 6 00E0 H 000000E0 H next PC
Interrupt INTP1 External interrupt 1 PORT 7 00F0 H 000000F0 H next PC
Interrupt INTP2 External interrupt 2 PORT 8 0100 H 00000100 H next PC
Interrupt INTP3 External interrupt 3 PORT 9 0110 H 00000110 H next PC
Interrupt INTP4 External interrupt 4 PORT 10 0120 H 00000120 H next PC
Interrupt INTP5 External interrupt 5 PORT 11 0130 H 00000130 H next PC
Interrupt INTP6 External interrupt 6 PORT 12 0140 H 00000140 H next PC
Interrupt INTTZ0UV TMZ0 underflow TMZ0 13 0150 H 00000150 H next PC
Interrupt INTTZ1UV TMZ1 underflow TMZ1 14 0160 H 00000160 H next PC
Interrupt INTTZ2UV TMZ2 underflow TMZ2 15 0170 H 00000170 H next PC
Interrupt INTTZ3UV TMZ3 underflow TMZ3 16 0180 H 00000180 H next PC
Interrupt INTTZ4UV TMZ4 underflow TMZ4 17 0190 H 00000190 H next PC
Interrupt INTTZ5UV TMZ5 underflow TMZ5 18 01A0 H 000001A0 H next PC
Interrupt INTTP0OV TMP0 overflow TMP0 19 01B0 H 000001B0 H next PC
Interrupt INTTP0CC0 TMP0 capture compare
TMP0 20 01C0 H 000001C0 H next PC
channel 0
Interrupt INTTP0CC1 TMP0 capture compare
TMP0 21 01D0 H 000001D0 H next PC
channel 1
www.DataSheet4U.com
Interrupt INTTP1OV TMP1 overflow TMP1 22 01E0 H 000001E0 H next PC
Interrupt INTTP1CC0 TMP1 capture compare
TMP1 23 01F0 H 000001F0 H next PC
channel 0
Interrupt INTTP1CC1 TMP1 capture compare
TMP1 24 0200 H 00000200 H next PC
channel 1

206 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

Table 5-2 µPD70F3420 (OTF), µPD70F3421, µPD70F3421 (OTF), µPD70F3422,


µPD70F3422, (OTF), µPD70F3423 interrupt/exception source list (2/4)
Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Maskable Interrupt INTTP2OV TMP2 overflow TMP2 25 0210 H 00000210 H next PC
Interrupt INTTP2CC0 TMP2 capture compare
TMP2 26 0220 H 00000220 H next PC
channel 0
Interrupt INTTP2CC1 TMP2 capture compare
TMP2 27 0230 H 00000230 H next PC
channel 1
Interrupt INTTP3OV TMP3 overflow TMP3 28 0240 H 00000240 H next PC
Interrupt INTTP3CC0 TMP3 capture compare
TMP3 29 0250 H 00000250 H next PC
channel 0
Interrupt INTTP3CC1 TMP3 capture compare
TMP3 30 0260 H 00000260 H next PC
channel 1
Interrupt INTTG0OV0 TMG0 overflow interrupt 0 TMG0 31 0270 H 00000270 H next PC
Interrupt INTTG0OV1 TMG0 overflow interrupt 1 TMG0 32 0280 H 00000280 H next PC
Interrupt INTTG0CC0 TMG0 capture compare
TMG0 33 0290 H 00000290 H next PC
channel 0
Interrupt INTTG0CC1 TMG0 capture compare
TMG0 34 02A0 H 000002A0 H next PC
channel 1
Interrupt INTTG0CC2 TMG0 capture compare
TMG0 35 02B0 H 000002B0 H next PC
channel 2
Interrupt INTTG0CC3 TMG0 capture compare
TMG0 36 02C0 H 000002C0 H next PC
channel 3
Interrupt INTTG0CC4 TMG0 capture compare
TMG0 37 02D0 H 000002D0 H next PC
channel 4
Interrupt INTTG0CC5 TMG0 capture compare
TMG0 38 02E0 H 000002E0 H next PC
channel 5
Interrupt INTTG1OV0 TMG1 overflow interrupt 0 TMG1 39 02F0 H 000002F0 H next PC
Interrupt INTTG1OV1 TMG1 overflow interrupt 1 TMG1 40 0300 H 00000300 H next PC
Interrupt INTTG1CC0 TMG1 capture compare
TMG1 41 0310 H 00000310 H next PC
channel 0
Interrupt INTTG1CC1 TMG1 capture compare
TMG1 42 0320 H 00000320 H next PC
channel 1
Interrupt INTTG1CC2 TMG1 capture compare
TMG1 43 0330 H 00000330 H next PC
channel 2
Interrupt INTTG1CC3 TMG1 capture compare
TMG1 44 0340 H 00000340 H next PC
channel 3
Interrupt INTTG1CC4 TMG1 capture compare
TMG1 45 0350 H 00000350 H next PC
channel 4
Interrupt INTTG1CC5 TMG1 capture compare
TMG1 46 0360 H 00000360 H next PC
channel 5
Interrupt INTTY0UV0 TMY0 channel 0 underflow TMY0 47 0370 H 00000370 H next PC
www.DataSheet4U.com
Interrupt INTTY0UV1 TMY0 channel 1underflow TMY0 48 0380 H 00000380 H next PC

User’s Manual U17566EE5V1UM00 207


Chapter 5 Interrupt Controller (INTC)

Table 5-2 µPD70F3420 (OTF), µPD70F3421, µPD70F3421 (OTF), µPD70F3422,


µPD70F3422, (OTF), µPD70F3423 interrupt/exception source list (3/4)
Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Maskable Interrupt INTAD ADC end of conversion ADC 49 0390 H 00000390 H next PC
Interrupt INTC0ERR CAN0 error interrupt CAN0 50 03A0 H 000003A0 H next PC
Interrupt INTC0WUP CAN0 wake up interrupt CAN0 51 03B0 H 000003B0 H next PC
Interrupt INTC0REC CAN0 receive interrupt CAN0 52 03C0 H 000003C0 H next PC
Interrupt INTC0TRX CAN0 transmit interrupt CAN0 53 03D0 H 000003D0 H next PC
Interrupt INTCB0RE CSIB0 receive error
CSIB0 54 03E0 H 000003E0 H next PC
interrupt
Interrupt INTCB0R CSIB0 receive complete
CSIB0 55 03F0 H 000003F0 H next PC
interrupt
Interrupt INTCB0T CSIB0 transmit interrupt CSIB0 56 0400 H 00000400 H next PC
Interrupt INTUA0RE UARTA0 receive error
UARTA0 57 0410 H 00000410 H next PC
interrupt
Interrupt INTUA0R UARTA0 receive complete
UARTA0 58 0420 H 00000420 H next PC
interrupt
Interrupt INTUA0T UARTA0 transmit interrupt UARTA0 59 0430 H 00000430 H next PC
Interrupt INTUA1RE UARTA1 receive error
UARTA1 60 0440 H 00000440 H next PC
interrupt
Interrupt INTUA1R UARTA1 receive complete
UARTA1 61 0450 H 00000450 H next PC
interrupt
Interrupt INTUA1T UARTA1 transmit interrupt UARTA1 62 0460 H 00000460 H next PC
Interrupt INTIIC0 IIC0 interrupt IIC0 63 0470 H 00000470 H next PC
Interrupt INTIIC1 IIC1 interrupt IIC1 64 0480 H 00000480 H next PC
Interrupt INTSG0 SG0 interrupt SG0 65 0490 H 00000490 H next PC
Interrupt INTDMA0 DMA0 transmission end DMA0 66 04A0 H 000004A0 H next PC
Interrupt INTDMA1 DMA1 transmission end DMA1 67 04B0 H 000004B0 H next PC
Interrupt INTDMA2 DMA2 transmission end DMA2 68 04C0 H 000004C0 H next PC
Interrupt INTDMA3 DMA3 transmission end DMA3 69 04D0 H 000004D0 H next PC
Interrupt INT70 not generated by hardware b — 70 04E0 H 000004E0 H next PC
Interrupt INT71 not generated by hardware a — 71 04F0 H 000004F0 H next PC
Interrupt Reserved Reserved — 72 0500 H 00000500 H next PC
Interrupt INTC1ERR CAN1 error interrupt CAN1 73 0510 H 00000510 H next PC
Interrupt INTC1WUP CAN1 wake up interrupt CAN1 74 0520 H 00000520 H next PC
Interrupt INTC1REC CAN1 receive interrupt CAN1 75 0530 H 00000530 H next PC
Interrupt INTC1TRX CAN1 transmit interrupt CAN1 76 0540 H 00000540 H next PC

www.DataSheet4U.com

208 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

Table 5-2 µPD70F3420 (OTF), µPD70F3421, µPD70F3421 (OTF), µPD70F3422,


µPD70F3422, (OTF), µPD70F3423 interrupt/exception source list (4/4)
Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Maskable Interrupt Reserved Reserved — 77 ... 88 0xx0 H 00000xx0 H next PC
Interrupt INTCB1RE CSIB1 receive error
CSIB1 89 0610 H 00000610 H next PC
interrupt
Interrupt INTCB1R CSIB1 receive complete
CSIB1 90 0620 H 00000620 H next PC
interrupt
Interrupt INTCB1T CSIB1 transmit interrupt CSIB1 91 0630 H 00000630 H next PC
Interrupt Reserved Reserved — 92 ... 95 0xx0 H 00000xx0 H next PC
Interrupt INTC2ERR CAN2 error interrupt c CAN2 96 0680 H 00000680 H next PC
Interrupt INTC2WUP CAN2 wake up interrupt c CAN2 97 0690 H 00000690 H next PC
Interrupt INTC2REC CAN2 receive interrupt c CAN2 98 06A0 H 000006A0 H next PC
Interrupt INTC2TRX CAN2 transmit interrupt c CAN2 99 06B0 H 000006B0 H next PC
a)
The internal firmware starts after reset at 0000 0000H. The firmware starts the user’s program
- for OTF devices at address 0000 0000H
- for flash memory devices at the address obtained from the variable reset vector
b)
These interrupts can be used as software triggered interrupts.
c) µPD70F3423 only

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 209


Chapter 5 Interrupt Controller (INTC)

Table 5-3 µPD70F3424, µPD70F3425, µPD70F3426, µPD70F3427 interrupt/


exception source list (1/4)
Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Reset Interrupt RESET RESET input Pin – 0000H 00000000Ha undef.
Non- Interrupt NMI0 NMI Input PORT – 0010H 00000010H nextPC
maskable
NMIWDT Watchdog Timer WDT – 0020H 00000020H nextPC
NMI2 Unused – – 0030H 00000030H nextPC
Software Exception TRAP0n TRAP instruction 004nH
– – 00000040H nextPC
exception (n = 0 to F H ) (n = 0 to F H )

Exception TRAP1n TRAP instruction 005nH


– – 00000050H nextPC
(n = 0 to F H ) (n = 0 to F H )

Exception Exception ILGOP/ Illegal opcode/


– – 0060H 00000060H nextPC
trap DBTRAP DBTRAP instruction
Maskable Interrupt INTVC0 Voltage Comparator 0 AC0 0 0080H 00000080H next PC
Interrupt INTVC1 Voltage Comparator 1 AC1 1 0090H 00000090H next PC
Interrupt INTWT0UV WT0 underflow WT0 2 00A0H 000000A0H next PC
Interrupt INTWT1UV WT1 underflow WT1 3 00B0H 000000B0H next PC
Interrupt Reserved Reserved – 4 00C0H 000000C0H next PC
Interrupt INTTM01 Watch calibration timer
WCT 5 00D0H 000000D0H next PC
capture compare
Interrupt INTP0 External interrupt 0 PORT 6 00E0H 000000E0H next PC
Interrupt INTP1 External interrupt 1 PORT 7 00F0H 000000F0H next PC
Interrupt INTP2 External interrupt 2 PORT 8 0100H 00000100H next PC
Interrupt INTP3 External interrupt 3 PORT 9 0110H 00000110H next PC
Interrupt INTP4 External interrupt 4 PORT 10 0120H 00000120H next PC
Interrupt INTP5 External interrupt 5 PORT 11 0130H 00000130H next PC
Interrupt INTP6 External interrupt 6 PORT 12 0140H 00000140H next PC
Interrupt INTTZ0UV TMZ0 underflow TMZ0 13 0150H 00000150H next PC
Interrupt INTTZ1UV TMZ1 underflow TMZ1 14 0160H 00000160H next PC
Interrupt INTTZ2UV TMZ2 underflow TMZ2 15 0170H 00000170H next PC
Interrupt INTTZ3UV TMZ3 underflow TMZ3 16 0180H 00000180H next PC
Interrupt INTTZ4UV TMZ4 underflow TMZ4 17 0190H 00000190H next PC
Interrupt INTTZ5UV TMZ5 underflow TMZ5 18 01A0H 000001A0H next PC
Interrupt INTTP0OV TMP0 overflow TMP0 19 01B0H 000001B0H next PC
Interrupt INTTP0CC0 TMP0 capture compare
TMP0 20 01C0H 000001C0H next PC
channel 0
Interrupt INTTP0CC1 TMP0 capture compare
TMP0 21 01D0H 000001D0H next PC
channel 1
Interrupt INTTP1OV TMP1 overflow TMP1 22 01E0H 000001E0H next PC
www.DataSheet4U.com
Interrupt INTTP1CC0 TMP1 capture compare
TMP1 23 01F0H 000001F0H next PC
channel 0
Interrupt INTTP1CC1 TMP1 capture compare
TMP1 24 0200H 00000200H next PC
channel 1
Interrupt INTTP2OV TMP2 overflow TMP2 25 0210H 00000210H next PC

210 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

Table 5-3 µPD70F3424, µPD70F3425, µPD70F3426, µPD70F3427 interrupt/


exception source list (2/4)
Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Maskable Interrupt INTTP2CC0 TMP2 capture compare
TMP2 26 0220H 00000220H next PC
channel 0
Interrupt INTTP2CC1 TMP2 capture compare
TMP2 27 0230H 00000230H next PC
channel 1
Interrupt INTTP3OV TMP3 overflow TMP3 28 0240H 00000240H next PC
Interrupt INTTP3CC0 TMP3 capture compare
TMP3 29 0250H 00000250H next PC
channel 0
Interrupt INTTP3CC1 TMP3 capture compare
TMP3 30 0260H 00000260H next PC
channel 1
Interrupt INTTG0OV0 TMG0 overflow interrupt 0 TMG0 31 0270H 00000270H next PC
Interrupt INTTG0OV1 TMG0 overflow interrupt 1 TMG0 32 0280H 00000280H next PC
Interrupt INTTG0CC0 TMG0 capture compare
TMG0 33 0290H 00000290H next PC
channel 0
Interrupt INTTG0CC1 TMG0 capture compare
TMG0 34 02A0H 000002A0H next PC
channel 1
Interrupt INTTG0CC2 TMG0 capture compare
TMG0 35 02B0H 000002B0H next PC
channel 2
Interrupt INTTG0CC3 TMG0 capture compare
TMG0 36 02C0H 000002C0H next PC
channel 3
Interrupt INTTG0CC4 TMG0 capture compare
TMG0 37 02D0H 000002D0H next PC
channel 4
Interrupt INTTG0CC5 TMG0 capture compare
TMG0 38 02E0H 000002E0H next PC
channel 5
Interrupt INTTG1OV0 TMG1 overflow interrupt 0 TMG1 39 02F0H 000002F0H next PC
Interrupt INTTG1OV1 TMG1 overflow interrupt 1 TMG1 40 0300H 00000300H next PC
Interrupt INTTG1CC0 TMG1 capture compare
TMG1 41 0310H 00000310H next PC
channel 0
Interrupt INTTG1CC1 TMG1 capture compare
TMG1 42 0320H 00000320H next PC
channel 1
Interrupt INTTG1CC2 TMG1 capture compare
TMG1 43 0330H 00000330H next PC
channel 2
Interrupt INTTG1CC3 TMG1 capture compare
TMG1 44 0340H 00000340H next PC
channel 3
Interrupt INTTG1CC4 TMG1 capture compare
TMG1 45 0350H 00000350H next PC
channel 4
Interrupt INTTG1CC5 TMG1 capture compare
TMG1 46 0360H 00000360H next PC
channel 5
Interrupt INTTY0UV0 TMY0 channel 0 underflow TMY0 47 0370H 00000370H next PC
Interrupt INTTY0UV1 TMY0 channel 1underflow TMY0 48 0380H 00000380H next PC
www.DataSheet4U.com
Interrupt INTAD ADC end of conversion ADC 49 0390H 00000390H next PC
Interrupt INTC0ERR CAN0 error interrupt CAN0 50 03A0H 000003A0H next PC
Interrupt INTC0WUP CAN0 wake up interrupt CAN0 51 03B0H 000003B0H next PC
Interrupt INTC0REC CAN0 receive interrupt CAN0 52 03C0H 000003C0H next PC
Interrupt INTC0TRX CAN0 transmit interrupt CAN0 53 03D0H 000003D0H next PC

User’s Manual U17566EE5V1UM00 211


Chapter 5 Interrupt Controller (INTC)

Table 5-3 µPD70F3424, µPD70F3425, µPD70F3426, µPD70F3427 interrupt/


exception source list (3/4)
Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Maskable Interrupt INTCB0RE CSIB0 receive error
CSIB0 54 03E0H 000003E0H next PC
interrupt
Interrupt INTCB0R CSIB0 receive complete
CSIB0 55 03F0H 000003F0H next PC
interrupt
Interrupt INTCB0T CSIB0 transmit interrupt CSIB0 56 0400H 00000400H next PC
Interrupt INTUA0RE UARTA0 receive error
UARTA0 57 0410H 00000410H next PC
interrupt
Interrupt INTUA0R UARTA0 receive complete
UARTA0 58 0420H 00000420H next PC
interrupt
Interrupt INTUA0T UARTA0 transmit interrupt UARTA0 59 0430H 00000430H next PC
Interrupt INTUA1RE UARTA1 receive error
UARTA1 60 0440H 00000440H next PC
interrupt
Interrupt INTUA1R UARTA1 receive complete
UARTA1 61 0450H 00000450H next PC
interrupt
Interrupt INTUA1T UARTA1 transmit interrupt UARTA1 62 0460H 00000460H next PC
Interrupt INTIIC0 IIC0 interrupt IIC0 63 0470H 00000470H next PC
Interrupt INTIIC1 IIC1 interrupt IIC1 64 0480H 00000480H next PC
Interrupt INTSG0 SG0 interrupt SG0 65 0490H 00000490H next PC
Interrupt INTDMA0 DMA0 transmission end DMA0 66 04A0H 000004A0H next PC
Interrupt INTDMA1 DMA1 transmission end DMA1 67 04B0H 000004B0H next PC
Interrupt INTDMA2 DMA2 transmission end DMA2 68 04C0H 000004C0H next PC
Interrupt INTDMA3 DMA3 transmission end DMA3 69 04D0H 000004D0H next PC
Interrupt INT70 not generated by hardware b — 70 04E0H 000004E0H next PC
a
Interrupt INT71 not generated by hardware — 71 04F0H 000004F0H next PC
Interrupt INTP7 External interrupt 7 PORT 72 0500H 00000500H next PC
Interrupt INTC1ERR CAN1 error interrupt CAN1 73 0510H 00000510H next PC
Interrupt INTC1WUP CAN1 wake up interrupt CAN1 74 0520H 00000520H next PC
Interrupt INTC1REC CAN1 receive interrupt CAN1 75 0530H 00000530H next PC
Interrupt INTC1TRX CAN1 transmit interrupt CAN1 76 0540H 00000540H next PC
Interrupt INTTZ6UV TMZ6 underflow TMZ6 77 0550H 00000550H next PC
Interrupt INTTZ7CUV TMZ7 underflow TMZ7 78 0560H 00000560H next PC
Interrupt INTTZ8UV TMZ8 underflow TMZ8 79 0570H 00000570H next PC
Interrupt INTTZ9UV TMZ9 underflow TMZ9 80 0580H 00000580H next PC
Interrupt INTTG2OV0 TMG2 overflow interrupt 0 TMG2 81 0590H 00000590H next PC
Interrupt INTTG2OV1 TMG2 overflow interrupt 1 TMG2 82 05A0H 000005A0H next PC
Interrupt INTTG2CC0 TMG2 capture compare
www.DataSheet4U.com TMG2 83 05B0H 000005B0H next PC
channel 0
Interrupt INTTG2CC1 TMG2 capture compare
TMG2 84 05C0H 000005C0H next PC
channel 1
Interrupt INTTG2CC2 TMG2 capture compare
TMG2 85 05D0H 000005D0H next PC
channel 2

212 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

Table 5-3 µPD70F3424, µPD70F3425, µPD70F3426, µPD70F3427 interrupt/


exception source list (4/4)
Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Maskable Interrupt INTTG2CC3 TMG2 capture compare
TMG2 86 05E0H 000005E0H next PC
channel 3
Interrupt INTTG2CC4 TMG2 capture compare
TMG2 87 05F0H 000005F0H next PC
channel 4
Interrupt INTTG2CC5 TMG2 capture compare
TMG2 88 0600H 00000600H next PC
channel 5
Interrupt INTCB1RE CSIB1 receive error
CSIB1 89 0610H 00000610H next PC
interrupt
Interrupt INTCB1R CSIB1 receive complete
CSIB1 90 0620H 00000620H next PC
interrupt
Interrupt INTCB1T CSIB1 transmit interrupt CSIB1 91 0630H 00000630H next PC
Interrupt INTCB2RE CSIB2 receive error
CSIB2 92 0640H 00000640H next PC
interrupt
Interrupt INTCB2R CSIB2 receive complete
CSIB2 93 0650H 00000650H next PC
interrupt
Interrupt INTCB2T CSIB2 transmit interrupt CSIB2 94 0660H 00000660H next PC
Interrupt INTLCD LCDBUSIF transmit interrupt LCDBUSIF 95 0670H 00000670H next PC
Interrupt INTC2ERR c CAN2 error interrupt CAN2 96 0680H 00000680H next PC
Interrupt INTC2WUP c CAN2 wake up interrupt CAN2 97 0690H 00000690H next PC
Interrupt INTC2REC c CAN2 receive interrupt CAN2 98 06A0H 000006A0H next PC
Interrupt INTC2TRX c CAN2 transmit interrupt CAN2 99 06B0H 000006B0H next PC
a)
The internal firmware starts after reset at 0000 0000H. The firmware starts the user’s program
- for OTF devices at address 0000 0000H
- for flash memory devices at the address obtained from the variable reset vector
b)
These interrupts can be used as software triggered interrupts.
c) µPD70F3424, µPDF3427 only

Default priority: The priority order when two or more maskable interrupt requests are
generated at the same time.
The highest priority is 0.
1. Restored PC:
The value of the PC saved to EIPC or FEPC when interrupt/exception
processing is started. However, the value of the PC saved when an inter-
rupt is acknowledged during division (DIV, DIVH, DIVU, DIVHU) instruction
execution is the value of the PC of the current instruction (DIV, DIVH, DIVU,
DIVHU).
2. nextPC:
The PC value that starts the processing following interrupt/exception
www.DataSheet4U.com
processing.
3. The execution address of the illegal instruction when an illegal opcode
exception occurs is calculated by (Restored PC – 4).

User’s Manual U17566EE5V1UM00 213


Chapter 5 Interrupt Controller (INTC)

Table 5-4 µPD70F3421, µPD70F3422, µPD70F3423 interrupt/exception source list


(1/4)
Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Reset Interrupt RESET RESET input Pin – 0000H 00000000H undef.
Non- Interrupt NMI0 NMI Input PORT – 0010H 00000010H nextPC
maskable
NMIWDT Watchdog Timer WDT – 0020H 00000020H nextPC
NMI2 Unused – – 0030H 00000030H nextPC
Software Exception TRAP0n TRAP instruction 004nH
– – 00000040H nextPC
exception (n = 0 to F H ) (n = 0 to F H )

Exception TRAP1n TRAP instruction 005nH


– – 00000050H nextPC
(n = 0 to F H ) (n = 0 to F H )

Exception Exception ILGOP/ Illegal opcode/


– – 0060H 00000060H nextPC
trap DBTRAP DBTRAP instruction
Maskable Interrupt INTVC0 Voltage Comparator 0 AC0 0 0080H 00000080H next PC
Interrupt INTVC1 Voltage Comparator 1 AC1 1 0090H 00000090H next PC
Interrupt INTWT0UV WT0 underflow WT0 2 00A0H 000000A0H next PC
Interrupt INTWT1UV WT1 underflow WT1 3 00B0H 000000B0H next PC
Interrupt Reserved Reserved – 4 00C0H 000000C0H next PC
Interrupt INTTM01 Watch calibration timer
WCT 5 00D0H 000000D0H next PC
capture compare
Interrupt INTP0 External interrupt 0 6 00E0H 000000E0H next PC
Interrupt INTP1 External interrupt 1 7 00F0H 000000F0H next PC
Interrupt INTP2 External interrupt 2 8 0100H 00000100H next PC
Interrupt INTP3 External interrupt 3 PORT 9 0110H 00000110H next PC
Interrupt INTP4 External interrupt 4 10 0120H 00000120H next PC
Interrupt INTP5 External interrupt 5 11 0130H 00000130H next PC
Interrupt INTP6 External interrupt 6 12 0140H 00000140H next PC
Interrupt INTTZ0UV TMZ0 underflow TMZ0 13 0150H 00000150H next PC
Interrupt INTTZ1UV TMZ1 underflow TMZ1 14 0160H 00000160H next PC
Interrupt INTTZ2UV TMZ2 underflow TMZ2 15 0170H 00000170H next PC
Interrupt INTTZ3UV TMZ3 underflow TMZ3 16 0180H 00000180H next PC
Interrupt INTTZ4UV TMZ4 underflow TMZ4 17 0190H 00000190H next PC
Interrupt INTTZ5UV TMZ5 underflow TMZ5 18 01A0H 000001A0H next PC
Interrupt INTTP0OV TMP0 overflow 19 01B0H 000001B0H next PC
Interrupt INTTP0CC0 TMP0 capture compare
20 01C0H 000001C0H next PC
channel 0 TMP0
Interrupt INTTP0CC1 TMP0 capture compare
21 01D0H 000001D0H next PC
channel 1
www.DataSheet4U.com
Interrupt INTTP1OV TMP1 overflow 22 01E0H 000001E0H next PC
Interrupt INTTP1CC0 TMP1 capture compare
23 01F0H 000001F0H next PC
channel 0 TMP1
Interrupt INTTP1CC1 TMP1 capture compare
24 0200H 00000200H next PC
channel 1

214 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

Table 5-4 µPD70F3421, µPD70F3422, µPD70F3423 interrupt/exception source list


(2/4)
Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Maskable Interrupt INTTP2OV TMP2 overflow 25 0210H 00000210H next PC
Interrupt INTTP2CC0 TMP2 capture compare
26 0220H 00000220H next PC
channel 0 TMP2
Interrupt INTTP2CC1 TMP2 capture compare
27 0230H 00000230H next PC
channel 1
Interrupt INTTP3OV TMP3 overflow 28 0240H 00000240H next PC
Interrupt INTTP3CC0 TMP3 capture compare
29 0250H 00000250H next PC
channel 0 TMP3
Interrupt INTTP3CC1 TMP3 capture compare
30 0260H 00000260H next PC
channel 1
Interrupt INTTG0OV0 TMG0 overflow interrupt 0 31 0270H 00000270H next PC
Interrupt INTTG0OV1 TMG0 overflow interrupt 1 32 0280H 00000280H next PC
Interrupt INTTG0CC0 TMG0 capture compare
33 0290H 00000290H next PC
channel 0
Interrupt INTTG0CC1 TMG0 capture compare
34 02A0H 000002A0H next PC
channel 1
Interrupt INTTG0CC2 TMG0 capture compare TMG0 35 02B0H 000002B0H next PC
channel 2
Interrupt INTTG0CC3 TMG0 capture compare
36 02C0H 000002C0H next PC
channel 3
Interrupt INTTG0CC4 TMG0 capture compare
37 02D0H 000002D0H next PC
channel 4
Interrupt INTTG0CC5 TMG0 capture compare
38 02E0H 000002E0H next PC
channel 5
Interrupt INTTG1OV0 TMG1 overflow interrupt 0 39 02F0H 000002F0H next PC
Interrupt INTTG1OV1 TMG1 overflow interrupt 1 40 0300H 00000300H next PC
Interrupt INTTG1CC0 TMG1 capture compare
41 0310H 00000310H next PC
channel 0
Interrupt INTTG1CC1 TMG1 capture compare
42 0320H 00000320H next PC
channel 1
Interrupt INTTG1CC2 TMG1 capture compare TMG1 43 0330H 00000330H next PC
channel 2
Interrupt INTTG1CC3 TMG1 capture compare
44 0340H 00000340H next PC
channel 3
Interrupt INTTG1CC4 TMG1 capture compare
45 0350H 00000350H next PC
channel 4
Interrupt INTTG1CC5 TMG1 capture compare
46 0360H 00000360H next PC
channel 5
Interrupt INTTY0UV0 TMY0 channel 0 underflow 47 0370H 00000370H next PC
www.DataSheet4U.com TMY0
Interrupt INTTY0UV1 TMY0 channel 1 underflow 48 0380H 00000380H next PC
Interrupt INTAD ADC end of conversion ADC 49 0390H 00000390H next PC

User’s Manual U17566EE5V1UM00 215


Chapter 5 Interrupt Controller (INTC)

Table 5-4 µPD70F3421, µPD70F3422, µPD70F3423 interrupt/exception source list


(3/4)
Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Maskable Interrupt INTC0ERR CAN0 error interrupt 50 03A0H 000003A0H next PC
Interrupt INTC0WUP CAN0 wake up interrupt 51 03B0H 000003B0H next PC
CAN0
Interrupt INTC0REC CAN0 receive interrupt 52 03C0H 000003C0H next PC
Interrupt INTC0TRX CAN0 transmit interrupt 53 03D0H 000003D0H next PC
Interrupt INTCB0RE CSIB0 receive error
54 03E0H 000003E0H next PC
interrupt
Interrupt INTCB0R CSIB0 receive complete CSIB0
55 03F0H 000003F0H next PC
interrupt
Interrupt INTCB0T CSIB0 transmit interrupt 56 0400H 00000400H next PC
Interrupt INTUA0RE UARTA0 receive error
57 0410H 00000410H next PC
interrupt
Interrupt INTUA0R UARTA0 receive complete UARTA0
58 0420H 00000420H next PC
interrupt
Interrupt INTUA0T UARTA0 transmit interrupt 59 0430H 00000430H next PC
Interrupt INTUA1RE UARTA1 receive error
60 0440H 00000440H next PC
interrupt
Interrupt INTUA1R UARTA1 receive complete UARTA1
61 0450H 00000450H next PC
interrupt
Interrupt INTUA1T UARTA1 transmit interrupt 62 0460H 00000460H next PC
Interrupt INTIIC0 IIC0 interrupt IIC0 63 0470H 00000470H next PC
Interrupt INTIIC1 IIC1 interrupt IIC1 64 0480H 00000480H next PC
Interrupt INTSG0 SG0 interrupt SG0 65 0490H 00000490H next PC
Interrupt INTDMA0 DMA0 transmission end DMA0 66 04A0H 000004A0H next PC
Interrupt INTDMA1 DMA1 transmission end DMA1 67 04B0H 000004B0H next PC
Interrupt INTDMA2 DMA2 transmission end DMA2 68 04C0H 000004C0H next PC
Interrupt INTDMA3 DMA3 transmission end DMA3 69 04D0H 000004D0H next PC
a
Interrupt INT70 not generated by hardware — 70 04E0H 000004E0H next PC
Interrupt INT71 not generated by hardware a — 71 04F0H 000004F0H next PC
Interrupt Reserved Reserved — 72 0500H 00000500H next PC
Interrupt INTC1ERR CAN1 error interrupt 73 0510H 00000510H next PC
Interrupt INTC1WUP CAN1 wake up interrupt 74 0520H 00000520H next PC
CAN1
Interrupt INTC1REC CAN1 receive interrupt 75 0530H 00000530H next PC
Interrupt INTC1TRX CAN1 transmit interrupt 76 0540H 00000540H next PC
Interrupt Reserved Reserved — 77 0550H 00000550H next PC
— 78 0560H 00000560H next PC
— 79 0570H 00000570H next PC
www.DataSheet4U.com
— 80 0580H 00000580H next PC

216 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

Table 5-4 µPD70F3421, µPD70F3422, µPD70F3423 interrupt/exception source list


(4/4)
Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Maskable Interrupt INTTG2OV0 TMG2 overflow interrupt 0 81 0590H 00000590H next PC
Interrupt INTTG2OV1 TMG2 overflow interrupt 1 82 05A0H 000005A0H next PC
Interrupt INTTG2CC0 TMG2 capture compare
83 05B0H 000005B0H next PC
channel 0
Interrupt INTTG2CC1 TMG2 capture compare
84 05C0H 000005C0H next PC
channel 1
Interrupt INTTG2CC2 TMG2 capture compare TMG2 85 05D0H 000005D0H next PC
channel 2
Interrupt INTTG2CC3 TMG2 capture compare
86 05E0H 000005E0H next PC
channel 3
Interrupt INTTG2CC4 TMG2 capture compare
87 05F0H 000005F0H next PC
channel 4
Interrupt INTTG2CC5 TMG2 capture compare
88 0600H 00000600H next PC
channel 5
Interrupt INTCB1RE CSIB1 receive error
89 0610H 00000610H next PC
interrupt
Interrupt INTCB1R CSIB1 receive complete CSIB1
90 0620H 00000620H next PC
interrupt
Interrupt INTCB1T CSIB1 transmit interrupt 91 0630H 00000630H next PC
Interrupt Reserved Reserved — 92 0640H 00000640H next PC
— 93 0650H 00000650H next PC
— 94 0660H 00000660H next PC
Interrupt INTLCD LCDBUSIF transmit interrupt LCDBUSIF 95 0670H 00000670H next PC
Interrupt INTC2ERR CAN2 error interrupt 96 0680H 00000680H next PC
Interrupt INTC2WUP CAN2 wake up interrupt 97 0690H 00000690H next PC
CAN2
Interrupt INTC2REC CAN2 receive interrupt 98 06A0H 000006A0H next PC
Interrupt INTC2TRX CAN2 transmit interrupt 99 06B0H 000006B0H next PC
a)
These interrupts can be used as software triggered interrupts.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 217


Chapter 5 Interrupt Controller (INTC)

Table 5-5 µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427 interrupt/


exception source list (1/4)
Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Reset Interrupt RESET RESET input Pin – 0000H 00000000H undef.
Non- Interrupt NMI0 NMI Input PORT – 0010H 00000010H nextPC
maskable
NMIWDT Watchdog Timer WDT – 0020H 00000020H nextPC
NMI2 Unused – – 0030H 00000030H nextPC
Software Exception TRAP0n TRAP instruction 004nH
– – 00000040H nextPC
exception (n = 0 to F H ) (n = 0 to F H )

Exception TRAP1n TRAP instruction 005nH


– – 00000050H nextPC
(n = 0 to F H ) (n = 0 to F H )

Exception Exception ILGOP/ Illegal opcode/


– – 0060H 00000060H nextPC
trap DBTRAP DBTRAP instruction
Maskable Interrupt INTVC0 Voltage Comparator 0 AC0 0 0080H 00000080H next PC
Interrupt INTVC1 Voltage Comparator 1 AC1 1 0090H 00000090H next PC
Interrupt INTWT0UV WT0 underflow WT0 2 00A0H 000000A0H next PC
Interrupt INTWT1UV WT1 underflow WT1 3 00B0H 000000B0H next PC
Interrupt Reserved Reserved – 4 00C0H 000000C0H next PC
Interrupt INTTM01 Watch calibration timer
WCT 5 00D0H 000000D0H next PC
capture compare
Interrupt INTP0 External interrupt 0 6 00E0H 000000E0H next PC
Interrupt INTP1 External interrupt 1 7 00F0H 000000F0H next PC
Interrupt INTP2 External interrupt 2 8 0100H 00000100H next PC
Interrupt INTP3 External interrupt 3 PORT 9 0110H 00000110H next PC
Interrupt INTP4 External interrupt 4 10 0120H 00000120H next PC
Interrupt INTP5 External interrupt 5 11 0130H 00000130H next PC
Interrupt INTP6 External interrupt 6 12 0140H 00000140H next PC
Interrupt INTTZ0UV TMZ0 underflow TMZ0 13 0150H 00000150H next PC
Interrupt INTTZ1UV TMZ1 underflow TMZ1 14 0160H 00000160H next PC
Interrupt INTTZ2UV TMZ2 underflow TMZ2 15 0170H 00000170H next PC
Interrupt INTTZ3UV TMZ3 underflow TMZ3 16 0180H 00000180H next PC
Interrupt INTTZ4UV TMZ4 underflow TMZ4 17 0190H 00000190H next PC
Interrupt INTTZ5UV TMZ5 underflow TMZ5 18 01A0H 000001A0H next PC
Interrupt INTTP0OV TMP0 overflow 19 01B0H 000001B0H next PC
Interrupt INTTP0CC0 TMP0 capture compare
20 01C0H 000001C0H next PC
channel 0 TMP0
Interrupt INTTP0CC1 TMP0 capture compare
21 01D0H 000001D0H next PC
channel 1
Interrupt INTTP1OV TMP1 overflow 22 01E0H 000001E0H next PC
www.DataSheet4U.com
Interrupt INTTP1CC0 TMP1 capture compare
23 01F0H 000001F0H next PC
channel 0 TMP1
Interrupt INTTP1CC1 TMP1 capture compare
24 0200H 00000200H next PC
channel 1

218 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

Table 5-5 µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427 interrupt/


exception source list (2/4)
Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Maskable Interrupt INTTP2OV TMP2 overflow 25 0210H 00000210H next PC
Interrupt INTTP2CC0 TMP2 capture compare
26 0220H 00000220H next PC
channel 0 TMP2
Interrupt INTTP2CC1 TMP2 capture compare
27 0230H 00000230H next PC
channel 1
Interrupt INTTP3OV TMP3 overflow 28 0240H 00000240H next PC
Interrupt INTTP3CC0 TMP3 capture compare
29 0250H 00000250H next PC
channel 0 TMP3
Interrupt INTTP3CC1 TMP3 capture compare
30 0260H 00000260H next PC
channel 1
Interrupt INTTG0OV0 TMG0 overflow interrupt 0 31 0270H 00000270H next PC
Interrupt INTTG0OV1 TMG0 overflow interrupt 1 32 0280H 00000280H next PC
Interrupt INTTG0CC0 TMG0 capture compare
33 0290H 00000290H next PC
channel 0
Interrupt INTTG0CC1 TMG0 capture compare
34 02A0H 000002A0H next PC
channel 1
Interrupt INTTG0CC2 TMG0 capture compare TMG0 35 02B0H 000002B0H next PC
channel 2
Interrupt INTTG0CC3 TMG0 capture compare
36 02C0H 000002C0H next PC
channel 3
Interrupt INTTG0CC4 TMG0 capture compare
37 02D0H 000002D0H next PC
channel 4
Interrupt INTTG0CC5 TMG0 capture compare
38 02E0H 000002E0H next PC
channel 5
Interrupt INTTG1OV0 TMG1 overflow interrupt 0 39 02F0H 000002F0H next PC
Interrupt INTTG1OV1 TMG1 overflow interrupt 1 40 0300H 00000300H next PC
Interrupt INTTG1CC0 TMG1 capture compare
41 0310H 00000310H next PC
channel 0
Interrupt INTTG1CC1 TMG1 capture compare
42 0320H 00000320H next PC
channel 1
Interrupt INTTG1CC2 TMG1 capture compare TMG1 43 0330H 00000330H next PC
channel 2
Interrupt INTTG1CC3 TMG1 capture compare
44 0340H 00000340H next PC
channel 3
Interrupt INTTG1CC4 TMG1 capture compare
45 0350H 00000350H next PC
channel 4
Interrupt INTTG1CC5 TMG1 capture compare
46 0360H 00000360H next PC
channel 5
Interrupt INTTY0UV0 TMY0 channel 0 underflow 47 0370H 00000370H next PC
www.DataSheet4U.com TMY0
Interrupt INTTY0UV1 TMY0 channel 1 underflow 48 0380H 00000380H next PC
Interrupt INTAD ADC end of conversion ADC 49 0390H 00000390H next PC

User’s Manual U17566EE5V1UM00 219


Chapter 5 Interrupt Controller (INTC)

Table 5-5 µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427 interrupt/


exception source list (3/4)
Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Maskable Interrupt INTC0ERR CAN0 error interrupt 50 03A0H 000003A0H next PC
Interrupt INTC0WUP CAN0 wake up interrupt 51 03B0H 000003B0H next PC
CAN0
Interrupt INTC0REC CAN0 receive interrupt 52 03C0H 000003C0H next PC
Interrupt INTC0TRX CAN0 transmit interrupt 53 03D0H 000003D0H next PC
Interrupt INTCB0RE CSIB0 receive error
54 03E0H 000003E0H next PC
interrupt
Interrupt INTCB0R CSIB0 receive complete CSIB0
55 03F0H 000003F0H next PC
interrupt
Interrupt INTCB0T CSIB0 transmit interrupt 56 0400H 00000400H next PC
Interrupt INTUA0RE UARTA0 receive error
57 0410H 00000410H next PC
interrupt
Interrupt INTUA0R UARTA0 receive complete UARTA0
58 0420H 00000420H next PC
interrupt
Interrupt INTUA0T UARTA0 transmit interrupt 59 0430H 00000430H next PC
Interrupt INTUA1RE UARTA1 receive error
60 0440H 00000440H next PC
interrupt
Interrupt INTUA1R UARTA1 receive complete UARTA1
61 0450H 00000450H next PC
interrupt
Interrupt INTUA1T UARTA1 transmit interrupt 62 0460H 00000460H next PC
Interrupt INTIIC0 IIC0 interrupt IIC0 63 0470H 00000470H next PC
Interrupt INTIIC1 IIC1 interrupt IIC1 64 0480H 00000480H next PC
Interrupt INTSG0 SG0 interrupt SG0 65 0490H 00000490H next PC
Interrupt INTDMA0 DMA0 transmission end DMA0 66 04A0H 000004A0H next PC
Interrupt INTDMA1 DMA1 transmission end DMA1 67 04B0H 000004B0H next PC
Interrupt INTDMA2 DMA2 transmission end DMA2 68 04C0H 000004C0H next PC
Interrupt INTDMA3 DMA3 transmission end DMA3 69 04D0H 000004D0H next PC
a
Interrupt INT70 not generated by hardware — 70 04E0H 000004E0H next PC
Interrupt INT71 not generated by hardware a — 71 04F0H 000004F0H next PC
Interrupt INTP7 External interrupt 7 PORT 72 0500H 00000500H next PC
Interrupt INTC1ERR CAN1 error interrupt 73 0510H 00000510H next PC
Interrupt INTC1WUP CAN1 wake up interrupt 74 0520H 00000520H next PC
CAN1
Interrupt INTC1REC CAN1 receive interrupt 75 0530H 00000530H next PC
Interrupt INTC1TRX CAN1 transmit interrupt 76 0540H 00000540H next PC
Interrupt INTTZ6UV TMZ6 underflow TMZ6 77 0550H 00000550H next PC
Interrupt INTTZ7CUV TMZ7 underflow TMZ7 78 0560H 00000560H next PC
Interrupt INTTZ8UV TMZ8 underflow TMZ8 79 0570H 00000570H next PC
www.DataSheet4U.com
Interrupt INTTZ9UV TMZ9 underflow TMZ9 80 0580H 00000580H next PC

220 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

Table 5-5 µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427 interrupt/


exception source list (4/4)
Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Maskable Interrupt INTTG2OV0 TMG2 overflow interrupt 0 81 0590H 00000590H next PC
Interrupt INTTG2OV1 TMG2 overflow interrupt 1 82 05A0H 000005A0H next PC
Interrupt INTTG2CC0 TMG2 capture compare
83 05B0H 000005B0H next PC
channel 0
Interrupt INTTG2CC1 TMG2 capture compare
84 05C0H 000005C0H next PC
channel 1
Interrupt INTTG2CC2 TMG2 capture compare TMG2 85 05D0H 000005D0H next PC
channel 2
Interrupt INTTG2CC3 TMG2 capture compare
86 05E0H 000005E0H next PC
channel 3
Interrupt INTTG2CC4 TMG2 capture compare
87 05F0H 000005F0H next PC
channel 4
Interrupt INTTG2CC5 TMG2 capture compare
88 0600H 00000600H next PC
channel 5
Interrupt INTCB1RE CSIB1 receive error
89 0610H 00000610H next PC
interrupt
Interrupt INTCB1R CSIB1 receive complete CSIB1
90 0620H 00000620H next PC
interrupt
Interrupt INTCB1T CSIB1 transmit interrupt 91 0630H 00000630H next PC
Interrupt INTCB2RE CSIB2 receive error
92 0640H 00000640H next PC
interrupt
Interrupt INTCB2R CSIB2 receive complete CSIB2
93 0650H 00000650H next PC
interrupt
Interrupt INTCB2T CSIB2 transmit interrupt 94 0660H 00000660H next PC
Interrupt INTLCD LCDBUSIF transmit interrupt LCDBUSIF 95 0670H 00000670H next PC
Interrupt INTC2ERR b CAN2 error interrupt 96 0680H 00000680H next PC
Interrupt INTC2WUP b CAN2 wake up interrupt 97 0690H 00000690H next PC
CAN2
Interrupt INTC2REC b CAN2 receive interrupt 98 06A0H 000006A0H next PC
Interrupt INTC2TRX b CAN2 transmit interrupt 99 06B0H 000006B0H next PC
a) These interrupts can be used as software triggered interrupts.
b)
not available on µPD70F3426A

Default priority: The priority order when two or more maskable interrupt requests are
generated at the same time.
The highest priority is 0.
1. Restored PC:
The value of the PC saved to EIPC or FEPC when interrupt/exception
www.DataSheet4U.com processing is started. However, the value of the PC saved when an inter-
rupt is acknowledged during division (DIV, DIVH, DIVU, DIVHU) instruction
execution is the value of the PC of the current instruction (DIV, DIVH, DIVU,
DIVHU).
2. nextPC:
The PC value that starts the processing following interrupt/exception
processing.

User’s Manual U17566EE5V1UM00 221


Chapter 5 Interrupt Controller (INTC)

3. The execution address of the illegal instruction when an illegal opcode


exception occurs is calculated by (Restored PC – 4).

www.DataSheet4U.com

222 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

Table 5-6 Interrupt/exception source list (1/3)


Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Reset Interrupt RESET RESET input Pin – 0000H 00000000H undef.
Non- Interrupt NMI0 NMI Input PORT – 0010H 00000010H nextPC
maskable
NMIWDT Watchdog Timer WDT – 0020H 00000020H nextPC
NMI2 Unused – – 0030H 00000030H nextPC
Software Exception TRAP0n TRAP instruction 004nH
– – 00000040H nextPC
exception (n = 0 to F H ) (n = 0 to F H )

Exception TRAP1n TRAP instruction 005nH


– – 00000050H nextPC
(n = 0 to F H ) (n = 0 to F H )

Exception Exception ILGOP/ Illegal opcode/


– – 0060H 00000060H nextPC
trap DBTRAP DBTRAP instruction
Maskable Interrupt Reserved Reserved — 0...1 0xx0H 00000xx0H nextPC
Interrupt INTWT0UV WT0 underflow WT0 2 00A0H 000000A0H next PC
Interrupt INTWT1UV WT1 underflow WT1 3 00B0H 000000B0H next PC
Interrupt Reserved Reserved – 4 00C0H 000000C0H next PC
Interrupt INTTM01 Watch calibration timer
WCT 5 00D0H 000000D0H next PC
capture compare
Interrupt INTP0 External interrupt 0 PORT 6 00E0H 000000E0H next PC
Interrupt INTP1 External interrupt 1 PORT 7 00F0H 000000F0H next PC
Interrupt INTP2 External interrupt 2 PORT 8 0100H 00000100H next PC
Interrupt INTP3 External interrupt 3 PORT 9 0110H 00000110H next PC
Interrupt Reserved Reserved — 10...12 0xx0H 00000xx0H nextPC
Interrupt INTTZ0UV TMZ0 underflow TMZ0 13 0150H 00000150H next PC
Interrupt INTTZ1UV TMZ1 underflow TMZ1 14 0160H 00000160H next PC
Interrupt INTTZ2UV TMZ2 underflow TMZ2 15 0170H 00000170H next PC
Interrupt INTTZ3UV TMZ4 underflow TMZ3 16 0180H 00000180H next PC
Interrupt INTTZ4UV TMZ4 underflow TMZ4 17 0190H 00000190H nextPC
Interrupt INTTZ5UV TMZ5 underflow TMZ5 18 01A0H 00000190H nextPC
Interrupt INTTP0OV TMP0 overflow TMP0 19 01B0H 000001B0H next PC
Interrupt INTTP0CC0 TMP0 capture compare
TMP0 20 01C0H 000001C0H next PC
channel 0
Interrupt INTTP0CC1 TMP0 capture compare
TMP0 21 01D0H 000001D0H next PC
channel 1
Interrupt Reserved Reserved — 22...30 0xx0H 00000xx0H nextPC
Interrupt INTTG0OV0 TMG0 overflow interrupt 0 TMG0 31 0270H 00000270H next PC
Interrupt INTTG0OV1 TMG0 overflow interrupt 1 TMG0 32 0280H 00000280H next PC
Interrupt INTTG0CC0 TMG0 capture compare
www.DataSheet4U.com TMG0 33 0290H 00000290H next PC
channel 0
Interrupt INTTG0CC1 TMG0 capture compare
TMG0 34 02A0H 000002A0H next PC
channel 1
Interrupt INTTG0CC2 TMG0 capture compare
TMG0 35 02B0H 000002B0H next PC
channel 2

User’s Manual U17566EE5V1UM00 223


Chapter 5 Interrupt Controller (INTC)

Table 5-6 Interrupt/exception source list (2/3)


Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Maskable Interrupt INTTG0CC3 TMG0 capture compare
TMG0 36 02C0H 000002C0H next PC
channel 3
Interrupt INTTG0CC4 TMG0 capture compare
TMG0 37 02D0H 000002D0H next PC
channel 4
Interrupt INTTG0CC5 TMG0 capture compare
TMG0 38 02E0H 000002E0H next PC
channel 5
Interrupt INTTG1OV0 TMG1 overflow interrupt 0 TMG1 39 02F0H 000002F0H next PC
Interrupt INTTG1OV1 TMG1 overflow interrupt 1 TMG1 40 0300H 00000300H next PC
Interrupt INTTG1CC0 TMG1 capture compare
TMG1 41 0310H 00000310H next PC
channel 0
Interrupt INTTG1CC1 TMG1 capture compare
TMG1 42 0320H 00000320H next PC
channel 1
Interrupt INTTG1CC2 TMG1 capture compare
TMG1 43 0330H 00000330H next PC
channel 2
Interrupt INTTG1CC3 TMG1 capture compare
TMG1 44 0340H 00000340H next PC
channel 3
Interrupt INTTG1CC4 TMG1 capture compare
TMG1 45 0350H 00000350H next PC
channel 4
Interrupt INTTG1CC5 TMG1 capture compare
TMG1 46 0360H 00000360H next PC
channel 5
Interrupt Reserved Reserved — 47...48 0xx0H 00000xx0H next PC
Interrupt INTAD ADC end of conversion ADC 49 0390H 00000390H next PC
Interrupt INTC0ERR CAN0 error interrupt CAN0 50 03A0H 000003A0H next PC
Interrupt INTC0WUP CAN0 wake up interrupt CAN0 51 03B0H 000003B0H next PC
Interrupt INTC0REC CAN0 receive interrupt CAN0 52 03C0H 000003C0H next PC
Interrupt INTC0TRX CAN0 transmit interrupt CAN0 53 03D0H 000003D0H next PC
Interrupt INTCB0RE CSIB0 receive error
CSIB0 54 03E0H 000003E0H next PC
interrupt
Interrupt INTCB0R CSIB0 receive complete
CSIB0 55 03F0H 000003F0H next PC
interrupt
Interrupt INTCB0T CSIB0 transmit interrupt CSIB0 56 0400H 00000400H next PC
Interrupt INTUA0RE UARTA0 receive error
UARTA0 57 0410H 00000410H next PC
interrupt
Interrupt INTUA0R UARTA0 receive complete
UARTA0 58 0420H 00000420H next PC
interrupt
Interrupt INTUA0T UARTA0 transmit interrupt UARTA0 59 0430H 00000430H next PC
Interrupt INTUA1RE UARTA1 receive error
UARTA1 60 0440H 00000440H next PC
interrupt
Interrupt INTUA1R UARTA1 receive complete
UARTA1 61 0450H 00000450H next PC
www.DataSheet4U.com interrupt
Interrupt INTUA1T UARTA1 transmit interrupt UARTA1 62 0460H 00000460H next PC
Interrupt INTIIC0 IIC0 interrupt IIC0 63 0470H 00000470H next PC

224 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

Table 5-6 Interrupt/exception source list (3/3)


Interrupt/Exception Source
Classific Default Exception Handler Restored
Type Generating
ation Name Generating Source Priority Code Address PC
Unit
Maskable Interrupt Reserved Reserved — 64...69 0xx0H 00000xx0H next PC
Interrupt INT70 not generated by hardware a — 70 04E0H 000004E0H next PC
a
Interrupt INT71 not generated by hardware — 71 04F0H 000004F0H next PC
Interrupt Reserved Reserved — 72...88 0xx0H 00000xx0H next PC
Interrupt INTCB1RE CSIB1 receive error
CSIB1 89 0610H 00000610H next PC
interrupt
Interrupt INTCB1R CSIB1 receive complete
CSIB1 90 0620H 00000620H next PC
interrupt
Interrupt INTCB1T CSIB1 transmit interrupt CSIB1 91 0630H 00000630H next PC
a)
These interrupts can be used as software triggered interrupts.

Default priority: The priority order when two or more maskable interrupt requests are
generated at the same time.
The highest priority is 0.
1. Restored PC:
The value of the PC saved to EIPC or FEPC when interrupt/exception
processing is started. However, the value of the PC saved when an inter-
rupt is acknowledged during division (DIV, DIVH, DIVU, DIVHU) instruction
execution is the value of the PC of the current instruction (DIV, DIVH, DIVU,
DIVHU).
2. nextPC:
The PC value that starts the processing following interrupt/exception
processing.
3. The execution address of the illegal instruction when an illegal opcode
exception occurs is calculated by (Restored PC – 4).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 225


Chapter 5 Interrupt Controller (INTC)

5.2 Non-Maskable Interrupts

A non-maskable interrupt request is acknowledged unconditionally, even when


interrupts are in the interrupt disabled (DI) status.
Non-maskable interrupts of this microcontroller are available for the following
two requests:
• NMI0: NMI pin input
• NMIWDT: Non-maskable Watchdog Timer interrupt request
When the valid edge specified by the ESEL0, ESEL00 and ESEL01 bits of the
Interrupt mode register 0(INTM0) is detected on the NMI pin, the interrupt
occurs.
The Watchdog Timer interrupt request is only effective as non-maskable
interrupt if the WDTMODE bit of the Watchdog Timer mode register (WDTM) is
set 0.
If multiple non-maskable interrupts are generated at the same time, the highest
priority servicing is executed according to the following priority order (the lower
priority interrupt is ignored):
NMIWDT > NMI0
Note that if a NMI from port pin or NMIWDT request is generated while NMI
from port pin is being serviced, the service is executed as follows.

(1) If a NMI0 is generated while NMI0 is being serviced


The new NMI0 request is held pending regardless of the value of the PSW.NP
bit. The pending NMIVC request is acknowledged after servicing of the current
NMI0 request has finished (after execution of the RETI instruction).

(2) If a NMIWDT request is generated while NMI0 is being serviced


If the PSW.NP bit remains set (1) while NMI0 is being serviced, the new
NMIWDT request is held pending. The pending NMIWDT request is
acknowledge after servicing of the current NMI0 request has finished (after
execution of the RETI instruction).
If the PSW.NP bit is cleared (0) while NMI0 is being serviced, the newly
generated NMIWDT request is executed (NMI0 servicing is halted).

Caution 1. Although the values of the PC and PSW are saved to an NMI status save
register (FEPC, FEPSW) when a non-maskable interrupt request is
generated, only the NMI0 can be restored by the RETI instruction at this
time. Because NMIWDT cannot be restored by the RETI instruction, the
system must be reset after servicing this interrupt.
2. If PSW.NP is cleared to 0 by the LDSR instruction during non-maskable
interrupt servicing, a NMI0 interrupt afterwards cannot be acknowledged
www.DataSheet4U.com correctly.

226 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

NMI0 and NMIWDT requests generated


simultaneously

Main routine

NMIWDT servicing

NMI0 and NMIWDT


requests
(generated System reset
simultaneously)

Figure 5-1 Example of non-maskable interrupt request acknowledgement operation:


multiple NMI requests generated at the same time

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 227


Chapter 5 Interrupt Controller (INTC)

NMI being
NMI request generated during NMI servicing
serviced
NMI0 NMIWDT
NMI0 NMI0 request generated during NMIWDT request generated
NMI0 servicing during NMI0 servicing
(NP = 1 retained before NMI1
request)

Main routine Main routine

NMI0 servicing NMI0 servicing

NMI0 request NMIWDT request (Held pending)


(Held pending)
NMI0 request NMI0 request

NMIWDT servicing
Servicing of
pending NMI0

System reset

NMIWDT request generated


during NMI0 servicing (NP=0
set before NMIWDT request)

Main routine NMIWDT


NMI0 servicing
servicing

NP = 0
NMI0 NMIWDT
request
request
System reset

NMIWDT request generated


during NMI0 servicing (NP=0
set after NMIWDT request)

Main routine NMIWDT


NMI0 servicing
servicing
(Held
NMIWDT pending)
NMI0 request
request NP = 0

System reset

NMIWDT NMI0 request generated during NMI1 request generated


NMIWDT servicing during NMIWDT servicing

Main routine Main routine


NMIWDT NMIWDT
servicing servicing

NMI0 request (Invalid) NMIWDT request (Invalid)


NMIWDT
NMIWDT request
request System reset
System reset

Figure 5-2 Example of non-maskable interrupt request acknowledgement operation:


NMI request generated during NMI servicing

www.DataSheet4U.com

228 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

5.2.1 Operation

If a non-maskable interrupt is generated, the CPU performs the following


processing, and transfers control to the handler routine:
(1) Saves the restored PC to FEPC.

(2) Saves the current PSW to FEPSW.

(3) Writes exception code 0010H to the higher halfword (FECC) of ECR.

(4) Sets the NP and ID bits of the PSW and clears the EP bit.

(5) Sets the handler address corresponding to the non-maskable interrupt to


the PC, and transfers control.
The processing configuration of a non-maskable interrupt is shown in
Figure 5-3.

NMI input
INTC
acknowledgement
Non-maskable interrupt
request
CPU processing

1
PSW.NP

FEPC ← Restored PC
FEPSW ← PSW
ECR.FECC ← Exception
code
PSW.NP ←1
PSW.EP ←0
PSW.ID ←1
PC ← NMI-Handler
address

Interrupt service Interrupt request pending

Figure 5-3 Processing configuration of non-maskable interrupt

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 229


Chapter 5 Interrupt Controller (INTC)

5.2.2 Restore

(1) NMI0
Execution is restored from the non-maskable interrupt (NMI0) processing by
the RETI instruction.
When the RETI instruction is executed, the CPU performs the following
processing, and transfers control to the address of the restored PC.
<1> Restores the values of the PC and the PSW from FEPC and FEPSW,
respectively, because the EP bit of the PSW is 0 and the NP bit of the
PSW is 1.
<2> Transfers control back to the address of the restored PC and PSW.

Figure 5-4 illustrates how the RETI instruction is processed.

RETI instruction

1
PSW.EP

1
PSW.NP

PC EIPC PC FEPC
PSW EIPSW PSW FEPSW

Original processing restored

Figure 5-4 RETI instruction processing

Caution When the PSW.EP bit and PSW.NP bit are changed by the LDSR instruction
during non-maskable interrupt processing, in order to restore the PC and PSW
correctly during recovery by the RETI instruction, it is necessary to set
PSW.EP back to 0 and PSW.NP back to 1 using the LDSR instruction
immediately before the RETI instruction.

www.DataSheet4U.com
Note The solid line indicates the CPU processing flow.

(2) NMIWDT
Restoring by RETI instruction is not possible. Perform a system reset after
interrupt servicing.

230 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

5.2.3 Non-maskable interrupt status flag (NP)

The NP flag is a status flag that indicates that non-maskable interrupt (NMI)
processing is under execution.
This flag is set when an NMI interrupt has been acknowledged, and masks all
interrupt requests and exceptions to prohibit multiple interrupts from being
acknowledged.

31 8 7 6 5 4 3 2 1 0 Initial value

PSW 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 NP EP ID SAT CY OV S Z 00000020H

Bit position Bit name Function


7 NP Indicates whether NMI interrupt processing is in progress.
0: No NMI interrupt processing
1: NMI interrupt currently being processed

5.2.4 NMI0 control

The NMI0 can be configured to generate an NMI upon a rising, falling or both
edges at the NMI pin. To enable respectively disable the NMI0 and to configure
the edge refer to “Edge and Level Detection Configuration“ on page 257.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 231


Chapter 5 Interrupt Controller (INTC)

5.3 Maskable Interrupts

Maskable interrupt requests can be masked by interrupt control registers.


If two or more maskable interrupt requests are generated at the same time,
they are acknowledged according to the default priority. In addition to the
default priority, eight levels of priorities can be specified by using the interrupt
control registers (programmable priority control).
When an interrupt request has been acknowledged, the acknowledgement of
other maskable interrupt requests is disabled and the interrupt disabled (DI)
status is set.
When the EI instruction is executed in an interrupt processing routine, the
interrupt enabled (EI) status is set, which enables servicing of interrupts having
a higher priority than the interrupt request in progress (specified by the
interrupt control register). Note that only interrupts with a higher priority will
have this capability; interrupts with the same priority level cannot be nested.
However, if multiple interrupts are executed, the following processing is
necessary.
(1) Save EIPC and EIPSW in memory or a general-purpose register before
executing the EI instruction.
(2) Execute the DI instruction before executing the RETI instruction, then
reset EIPC and EIPSW with the values saved in (1).

5.3.1 Operation

If a maskable interrupt occurs by INT input, the CPU performs the following
processing, and transfers control to a handler routine:
(1) Saves the restored PC to EIPC.
(2) Saves the current PSW to EIPSW.

(3) Writes an exception code to the lower halfword of ECR (EICC).

(4) Sets the ID bit of the PSW and clears the EP bit.

(5) Sets the handler address corresponding to each interrupt to the PC, and
transfers control.

The processing configuration of a maskable interrupt is shown in Figure 5-5.

www.DataSheet4U.com

232 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

INT input

INTC accepted
No
xxIF = 1

Yes

No
xxMK = 0
Is the interrupt
mask released?
Yes

Priority higher than No


that of interrupt currently
processed?

Yes

Priority higher No
than that of other interrupt
request?

Yes
Highest default
priority of interrupt requests No
with the same priority?

Yes

Maskable interrupt request Interrupt request pending

CPU processing

1
PSW.NP

0
1
PSW.ID

EIPC restored PC Interrupt request pending


EIPSW PSW
ECR.EICC exception code
PSW.EP 0
PSW.ID 1
PC handler address

Interrupt processing

Figure 5-5 Maskable interrupt processing

Note For the ISPR register, see “ISPR - In-service priority register“ on page 255.

www.DataSheet4U.com An INT input masked by the Interrupt Controllers and an INT input that occurs
while another interrupt is being processed (when PSW.NP = 1 or PSW.ID = 1)
are held pending internally by the Interrupt Controller. In such case, if the
interrupts are unmasked, or when PSW.NP = 0 and PSW.ID = 0 as set by the
RETI and LDSR instructions, input of the pending INT starts the new maskable
interrupt processing.

User’s Manual U17566EE5V1UM00 233


Chapter 5 Interrupt Controller (INTC)

5.3.2 Restore

Recovery from maskable interrupt processing is carried out by the RETI


instruction.
When the RETI instruction is executed, the CPU performs the following steps,
and transfers control to the address of the restored PC.
(1) Restores the values of the PC and the PSW from EIPC and EIPSW
because the EP bit of the PSW is 0 and the NP bit of the PSW is 0.

(2) Transfers control to the address of the restored PC and PSW.

Figure 5-6 illustrates the processing of the RETI instruction.

RETI instruction

1
PSW.EP

1
PSW.NP

PC EIPC PC FEPC
PSW EIPSW PSW FEPSW
Corresponding 0
bit of ISPRNote

Restores original processing

Figure 5-6 RETI instruction processing

Note 1. For the ISPR register, see “ISPR - In-service priority register“ on page 255.
2. The solid lines show the CPU processing flow.

Caution When the PSW.EP bit and the PSW.NP bit are changed by the LDSR
instruction during maskable interrupt processing, in order to restore the PC
and PSW correctly during recovery by the RETI instruction, it is necessary to
set PSW.EP back to 0 and PSW.NP back to 0 using the LDSR instruction
immediately before the RETI instruction.
www.DataSheet4U.com

234 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

5.3.3 Priorities of maskable interrupts

This microcontroller provides multiple interrupt servicing in which an interrupt


is acknowledged while another interrupt is being serviced. Multiple interrupts
can be controlled by priority levels.
There are two types of priority level control: control based on the default
priority levels, and control based on the programmable priority levels that are
specified by the interrupt priority level specification bit (xxPRn) of the interrupt
control register (xxICn). When two or more interrupts having the same priority
level specified by the xxPRn bit are generated at the same time, interrupts are
serviced in order depending on the priority level allocated to each interrupt
request type (default priority level) beforehand. For more information, refer to
the interrupt/exception source list table. The programmable priority control
customizes interrupt requests into eight levels by setting the priority level
specification flag.
Note that when an interrupt request is acknowledged, the ID flag of PSW is
automatically set to 1. Therefore, when multiple interrupts are to be used, clear
the ID flag to 0 beforehand (for example, by placing the EI instruction in the
interrupt service program) to set the interrupt enable mode.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 235


Chapter 5 Interrupt Controller (INTC)

Main routine

Processing of a Processing of b
EI
EI

Interrupt request a Interrupt


(level 3) request b Interrupt request b is acknowledged because the
(level 2) priority of b is higher than that of a and interrupts are
enabled.

Processing of c

Interrupt request c Interrupt request d


(level 3) (level 2) Although the priority of interrupt request d is higher
than that of c, d is held pending because interrupts
are disabled.
Processing of d

Processing of e
EI

Interrupt request e Interrupt request f


(level 2) Interrupt request f is held pending even if interrupts are
(level 3)
enabled because its priority is lower than that of e.

Processing of f

Processing of g
EI

Interrupt request g Interrupt request h


(level 1) (level 1) Interrupt request h is held pending even if interrupts are
enabled because its priority is the same as that of g.

Processing of h

Figure 5-7 Example of processing in which another interrupt request is issued


while an interrupt is being processed (1/2)

Caution The values of the EIPC and EIPSW registers must be saved before executing
multiple interrupts. When returning from multiple interrupt servicing, restore the
values of EIPC and EIPSW after executing the DI instruction.
www.DataSheet4U.com

Note 1. <a> to <u> in the figure are the temporary names of interrupt requests
shown for the sake of explanation.

236 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

2. The default priority in the figure indicates the relative priority between two
interrupt requests.

Main routine

Processing of i
EI EI Processing of k
Interrupt
Interrupt request i request j
(level 2) (level 3)
Interrupt request j is held pending because its
Interrupt request k
priority is lower than that of i.
(level 1)
k that occurs after j is acknowledged because it
has the higher priority.

Processing of j

Processing of l

Interrupt requests m and n are held pending


Interrupt
request m because processing of l is performed in the
(level 3) interrupt disabled status.
Interrupt request l
Interrupt request n
(level 2) (level 1)
Pending interrupt requests are acknowledged after
Processing of n processing of interrupt request l.
At this time, interrupt requests n is acknowledged
first even though m has occurred first because the
priority of n is higher than that of m.

Processing of m

Processing of o
EI Processing of p
Interrupt request o Processing of q
Interrupt EI Processing of r
(level 3) Interrupt EI
request p
(level 2) request q Interrupt
(level 1) request r
(level 0)

If levels 3 to 0 are acknowledged

Processing of s Pending interrupt requests t and u are


acknowledged after processing of s.
Interrupt Because the priorities of t and u are the same, u is
request t acknowledged first because it has the higher
Note 1
Interrupt request s (level 2) default priority, regardless of the order in which the
(level 1) Interrupt request u interrupt requests have been generated.
Note 2
(level 2)

Processing of u

Processing of t

www.DataSheet4U.com
Figure 5-8 Example of processing in which another interrupt request is issued
while an interrupt is being processed (2/2)

User’s Manual U17566EE5V1UM00 237


Chapter 5 Interrupt Controller (INTC)

Caution The values of the EIPC and EIPSW registers must be saved before executing
multiple interrupts. When returning from multiple interrupt servicing, restore the
values of EIPC and EIPSW after executing the DI instruction.

Note 1. Lower default priority


2. Higher default priority

Main routine

EI
Interrupt request a (level 2)
Interrupt request b (level 1)
Interrupt request c (level 1) NMI request Processing of interrupt request b . Interrupt request b and c are
acknowledged first according to

. their priorities.
Because the priorities of b and c are
the same, b is acknowledged first
Default priority Processing of interrupt request c according to the default priority.
a>b>c

Processing of interrupt request a

Figure 5-9 Example of processing interrupt requests simultaneously generated

Caution The values of the EIPC and EIPSW registers must be saved before executing
multiple interrupts. When returning from multiple interrupt servicing, restore the
values of EIPC and EIPSW after executing the DI instruction.

Remark <a> to <c> in the figure are the temporary names of interrupt requests shown
for the sake of explanation.

www.DataSheet4U.com

238 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

5.3.4 xxIC - Maskable interrupts control register

An interrupt control register is assigned to each interrupt request (maskable


interrupt) and sets the control conditions for each maskable interrupt request.
Access This register can be read/written in 8-bit or 1-bit units.
Address FFFF F110H to FFFF F18EH (refer to Table 5-11 on page 247)
Initial Value 47H

7 6 5 4 3 2 1 0
xxIF xxMK 0 0 0 xxPR2 xxPR1 xxPR0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 5-7 xxIC register contents


Bit position Bit name Function
7 xxIF This is an interrupt request flag.
0: Interrupt request not issued
1: Interrupt request issued
The flag xxIFn is reset automatically by the hardware if an interrupt request is
acknowledged.
6 xxMK This is an interrupt mask flag.
0: Enables interrupt processing
1: Disables interrupt processing (pending)
2 to 0 xxPR2 to 8 levels of priority order are specified for each interrupt.
xxPR0
xxPR2 xxPR1 xxPR0 Interrupt priority specification bit
0 0 0 Specifies level 0 (highest)
0 0 1 Specifies level 1
0 1 0 Specifies level 2
0 1 1 Specifies level 3
1 0 0 Specifies level 4
1 0 1 Specifies level 5
1 1 0 Specifies level 6
1 1 1 Specifies level 7 (lowest)

Note xx: identification name of each peripheral unit (VC0-VC1, WT0UV-WT1UV,


TM01, P0-P7, TZ0UV-TZ9UV, TP0OV-TP3OV, TP0CC0-TP3CC0, TP0CC1-
TP3CC1, TG0OV0-TG2OV0, TG0OV1-TG2OV1, TG0CC0-TG2CC0,
TG0CC1-TG2CC1, TG0CC2-TG2CC2, TG0CC3-TG2CC3, TG0CC4-
TG2CC4, TG0CC5-TG2CC5, TY0CC0, TY0CC1, AD, C0ERR-C2ERR,
C0WUP-C2WUP, C0REC-C2REC, C0TRX-C2TRX, CB0RE-CB2RE, CB0R-
CB2R, CB0T-CB2T, UA0RE-UA1RE, UA0R-UA1R, UA0T-UA1T, IIC0-IIC1,
SG0, DMA0-DMA3, INT70, INT71, LCD)

www.DataSheet4U.com The address and bit of each interrupt control register are shown in the
following table.

User’s Manual U17566EE5V1UM00 239


Chapter 5 Interrupt Controller (INTC)

Table 5-8 Addresses and bits of interrupt control registers (1/3)


Bit
Address Register
7 6 5 4 3 2 1 0
FFFFF110H VC0IC VC0IF VC0MK 0 0 0 VC0PR2 VC0PR1 VC0PR0
FFFFF112 H VC1IC VC1IF VC1MK 0 0 0 VC1PR2 VC1PR1 VC1PR0
FFFFF114 H WT0UVIC WT0UVIF WT0UVMK 0 0 0 WT0UVPR2 WT0UVPR1 WT0UVPR0
FFFFF116 H WT1UVIC WT1UVIF WT1UVMK 0 0 0 WT1UVPR2 WT1UVPR1 WT1UVPR0
FFFFF11A H TM01IC TM01IF TM01MK 0 0 0 TM01PR2 TM01PR1 TM01PR0
FFFFF11C H P0IC P0IF P0MK 0 0 0 P0PR2 P0PR1 P0PR0
FFFFF11E H P1IC P1IF P1MK 0 0 0 P1PR2 P1PR1 P1PR0
FFFFF120H P2IC P2IF P2MK 0 0 0 P2PR2 P2PR1 P2PR0
FFFFF122 H P3IC P3IF P3MK 0 0 0 P3PR2 P3PR1 P3PR0
FFFFF124 H P4IC P4IF P4MK 0 0 0 P4PR2 P4PR1 P4PR0
FFFFF126 H P5IC P5IF P5MK 0 0 0 P5PR2 P5PR1 P5PR0
FFFFF128 H P6IC P6IF P6MK 0 0 0 P6PR2 P6PR1 P6PR0
FFFFF12A H TZ0UVIC TZ0UVIF TZ0UVMK 0 0 0 TZ0UVPR2 TZ0UVPR1 TZ0UVPR0
FFFFF12C H TZ1UVIC TZ1UVIF TZ1UVMK 0 0 0 TZ1UVPR2 TZ1UVPR1 TZ1UVPR0
FFFFF12E H TZ2UVIC TZ2UVIF TZ2UVMK 0 0 0 TZ2UVPR2 TZ2UVPR1 TZ2UVPR0
FFFFF130H TZ3UVIC TZ3UVIF TZ3UVMK 0 0 0 TZ3UVPR2 TZ3UVPR1 TZ3UVPR0
FFFFF132 H TZ4UVIC TZ4UVIF TZ4UVMK 0 0 0 TZ4UVPR2 TZ4UVPR1 TZ4UVPR0
FFFFF134 H TZ5UVIC TZ5UVIF TZ5UVMK 0 0 0 TZ5UVPR2 TZ5UVPR1 TZ5UVPR0
FFFFF136 H TP0OVIC TP0OVIF TP0OVMK 0 0 0 TP0OVPR2 TP0OVPR1 TP0OVPR0
FFFFF138 H TP0CC0IC TP0CC0IF TP0CC0MK 0 0 0 TP0CC0PR2 TP0CC0PR1 TP0CC0PR0
FFFFF13A H TP0CC1IC TP0CC1IF TP0CC1MK 0 0 0 TP0CC1PR2 TP0CC1PR1 TP0CC1PR0
FFFFF13C H TP1OVIC TP1OVIF TP1OVMK 0 0 0 TP1OVPR2 TP1OVPR1 TP1OVPR0
FFFFF13E H TP1CC0IC TP1CC0IF TP1CC0MK 0 0 0 TP1CC0PR2 TP1CC0PR1 TP1CC0PR0
FFFFF140H TP1CC1IC TP1CC1IF TP1CC1MK 0 0 0 TP1CC1PR2 TP1CC1PR1 TP1CC1PR0
FFFFF142 H TP2OVIC TP2OVIF TP2OVMK 0 0 0 TP2OVPR2 TP2OVPR1 TP2OVPR0
FFFFF144 H TP2CC0IC TP2CC0IF TP2CC0MK 0 0 0 TP2CC0PR2 TP2CC0PR1 TP2CC0PR0
FFFFF146 H TP2CC1IC TP2CC1IF TP2CC1MK 0 0 0 TP2CC1PR2 TP2CC1PR1 TP2CC1PR0
FFFFF148 H TP3OVIC TP3OVIF TP3OVMK 0 0 0 TP3OVPR2 TP3OVPR1 TP3OVPR0
FFFFF14A H TP3CC0IC TP3CC0IF TP3CC0MK 0 0 0 TP3CC0PR2 TP3CC0PR1 TP3CC0PR0
FFFFF14C H TP3CC1IC TP3CC1IF TP3CC1MK 0 0 0 TP3CC1PR2 TP3CC1PR1 TP3CC1PR0
FFFFF14E H TG0OV0IC TG0OV0IF TG0OV0MK 0 0 0 TG0OV0PR2 TG0OV0PR1 TG0OV0PR0
FFFFF150H TG0OV1IC TG0OV1IF TG0OV1MK 0 0 0 TG0OV1PR2 TG0OV1PR1 TG0OV1PR0
FFFFF152 H TG0CC0IC TG0CC0IF TG0CC0MK 0 0 0 TG0CC0PR2 TG0CC0PR1 TG0CC0PR0
FFFFF154 H TG0CC1IC TG0CC1IF TG0CC1MK 0 0 0 TG0CC1PR2 TG0CC1PR1 TG0CC1PR0
FFFFF156 H TG0CC2IC TG0CC2IF TG0CC2MK 0 0 0 TG0CC2PR2 TG0CC2PR1 TG0CC2PR0
www.DataSheet4U.com
FFFFF158 H TG0CC3IC TG0CC3IF TG0CC3MK 0 0 0 TG0CC3PR2 TG0CC3PR1 TG0CC3PR0
FFFFF15A H TG0CC4IC TG0CC4IF TG0CC4MK 0 0 0 TG0CC4PR2 TG0CC4PR1 TG0CC4PR0
FFFFF15C H TG0CC5IC TG0CC5IF TG0CC5MK 0 0 0 TG0CC5PR2 TG0CC5PR1 TG0CC5PR0
FFFFF15E H TG1OV0IC TG1OV0IF TG1OV0MK 0 0 0 TG1OV0PR2 TG1OV0PR1 TG1OV0PR0
FFFFF160H TG1OV1IC TG1OV1IF TG1OV1MK 0 0 0 TG1OV1PR2 TG1OV1PR1 TG1OV1PR0

240 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

Table 5-8 Addresses and bits of interrupt control registers (2/3)


Bit
Address Register
7 6 5 4 3 2 1 0
FFFFF162 H TG1CC0C TG1CC0IF TG1CC0MK 0 0 0 TG1CC0PR2 TG1CC0PR1 TG1CC0PR0
FFFFF164 H TG1CC1IC TG1CC1IF TG1CC1MK 0 0 0 TG1CC1PR2 TG1CC1PR1 TG1CC1PR0
FFFFF166 H TG1CC2IC TG1CC2IF TG1CC2MK 0 0 0 TG1CC2PR2 TG1CC2PR1 TG1CC2PR0
FFFFF168 H TG1CC3IC TG1CC3IF TG1CC3MK 0 0 0 TG1CC3PR2 TG1CC3PR1 TG1CC3PR0
FFFFF16A H TG1CC4IC TG1CC4IF TG1CC4MK 0 0 0 TG1CC4PR2 TG1CC4PR1 TG1CC4PR0
FFFFF16C H TG1CC5IC TG1CC5IF TG1CC5MK 0 0 0 TG1CC5PR2 TG1CC5PR1 TG1CC5PR0
FFFFF16E H TY0UV0IC TY0UV0IF TY0UV0MK 0 0 0 TY0UV0PR2 TY0UV0PR1 TY0UV0PR0
FFFFF170H TY0UV1IC TY0UV1IF TY0UV1MK 0 0 0 TY0UV1PR2 TY0UV1PR1 TY0UV1PR0
FFFFF172 H ADIC ADIF ADMK 0 0 0 ADPR2 ADPR1 ADPR0
FFFFF174 H C0ERRIC C0ERRIF C0ERRMK 0 0 0 C0ERRPR2 C0ERRPR1 C0ERRPR0
FFFFF176 H C0WUPIC C0WUPIF C0WUPMK 0 0 0 C0WUPPR2 C0WUPPR1 C0WUPPR0
FFFFF178 H C0RECIC C0RECIF C0RECMK 0 0 0 C0RECPR2 C0RECPR1 C0RECPR0
FFFFF17A H C0TRXIC C0TRXIF C0TRXMK 0 0 0 C0TRXPR2 C0TRXPR1 C0TRXPR0
FFFFF17C H CB0REIC CB0REIF CB0REMK 0 0 0 CB0REPR2 CB0REPR1 CB0REPR0
FFFFF17E H CB0RIC CB0RIF CB0RMK 0 0 0 CB0RPR2 CB0RPR1 CB0RPR0
FFFFF180H CB0TIC CB0TIF CB0TMK 0 0 0 CB0TPR2 CB0TPR1 CB0TPR0
FFFFF182 H UA0REIC UA0REIF UA0REMK 0 0 0 UA0REPR2 UA0REPR1 UA0REPR0
FFFFF184 H UA0RIC UA0RIF UA0RMK 0 0 0 UA0RPR2 UA0RPR1 UA0RPR0
FFFFF186 H UA0TIC UA0TIF UA0TMK 0 0 0 UA0TPR2 UA0TPR1 UA0TPR0
FFFFF188 H UA1REIC UA1REIF UA1REMK 0 0 0 UA1REPR2 UA1REPR1 UA1REPR0
FFFFF18A H UA1RIC UA1RIF UA1RMK 0 0 0 UA1RPR2 UA1RPR1 UA1RPR0
FFFFF18C H UA1TIC UA1TIF UA1TMK 0 0 0 UA1TPR2 UA1TPR1 UA1TPR0
FFFFF18E H IIC0IC IIC0IF IIC0MK 0 0 0 IIC0PR2 IIC0PR1 IIC0PR0
FFFFF190H IIC1IC IIC1IF IIC1MK 0 0 0 IIC1PR2 IIC1PR1 IIC1PR0
FFFFF192 H SG0IC SG0IF SG0MK 0 0 0 SG0PR2 SG0PR1 SG0PR0
FFFFF194 H DMA0IC DMA0IF DMA0MK 0 0 0 DMA0PR2 DMA0PR1 DMA0PR0
FFFFF196 H DMA1IC DMA1IF DMA1MK 0 0 0 DMA1PR2 DMA1PR1 DMA1PR0
FFFFF198 H DMA2IC DMA2IF DMA2MK 0 0 0 DMA2PR2 DMA2PR1 DMA2PR0
FFFFF19A H DMA3IC DMA3IF DMA3MK 0 0 0 DMA3PR2 DMA3PR1 DMA3PR0
FFFFF19C H INT70IC INT70IF INT70MK 0 0 0 INT70PR2 INT70PR1 INT70PR0
FFFFF19E H INT71IC INT71IF INT71MK 0 0 0 INT71PR2 INT71PR1 INT71PR0
FFFFF1A0H P7IC P7IF P7MK 0 0 0 P7PR2 P7PR1 P7PR0
FFFFF1A2 H C1ERRIC C1ERRIF C1ERRMK 0 0 0 C1ERRPR2 C1ERRPR1 C1ERRPR0
FFFFF1A4 H C1WUPIC C1WUPIF C1WUPMK 0 0 0 C1WUPPR2 C1WUPPR1 C1WUPPR0
FFFFF1A6 H C1RECIC C1RECIF C1RECMK 0 0 0 C1RECPR2 C1RECPR1 C1RECPR0
FFFFF1A8 H
www.DataSheet4U.com C1TRXIC C1TRXIF C1TRXMK 0 0 0 C1TRXPR2 C1TRXPR1 C1TRXPR0
FFFFF1AA H TZ6UVIC TZ6UVIF TZ6UVMK 0 0 0 TZ6UVPR2 TZ6UVPR1 TZ6UVPR0
FFFFF1AC H TZ7UVIC TZ7UVIF TZ7UVMK 0 0 0 TZ7UVPR2 TZ7UVPR1 TZ7UVPR0
FFFFF1AE H TZ8UVIC TZ8UVIF TZ8UVMK 0 0 0 TZ8UVPR2 TZ8UVPR1 TZ8UVPR0
FFFFF1B0H TZ9UVIC TZ9UVIF TZ9UVMK 0 0 0 TZ9UVPR2 TZ9UVPR1 TZ9UVPR0

User’s Manual U17566EE5V1UM00 241


Chapter 5 Interrupt Controller (INTC)

Table 5-8 Addresses and bits of interrupt control registers (3/3)


Bit
Address Register
7 6 5 4 3 2 1 0
FFFFF1B2 H TG2OV0IC TG2OV0IF TG2OV0MK 0 0 0 TG2OV0PR2 TG2OV0PR1 TG2OV0PR0
FFFFF1B4 H TG2OV1IC TG2OV1IF TG2OV1MK 0 0 0 TG2OV1PR2 TG2OV1PR1 TG2OV1PR0
FFFFF1B6 H TG2CC0IC TG2CC0IF TG2CC0MK 0 0 0 TG2CC0PR2 TG2CC0PR1 TG2CC0PR0
FFFFF1B8 H TG2CC1IC TG2CC1IF TG2CC1MK 0 0 0 TG2CC1PR2 TG2CC1PR1 TG2CC1PR0
FFFFF1BA H TG2CC2IC TG2CC2IF TG2CC2MK 0 0 0 TG2CC2PR2 TG2CC2PR1 TG2CC2PR0
FFFFF1BC H TG2CC3IC TG2CC3IF TG2CC3MK 0 0 0 TG2CC3PR2 TG2CC3PR1 TG2CC3PR0
FFFFF1BE H TG2CC4IC TG2CC4IF TG2CC4MK 0 0 0 TG2CC4PR2 TG2CC4PR1 TG2CC4PR0
FFFFF1C0H TG2CC5IC TG2CC5IF TG2CC5MK 0 0 0 TG2CC5PR2 TG2CC5PR1 TG2CC5PR0
FFFFF1C2 H CB1REIC CB1REIF CB1REMK 0 0 0 CB1REPR2 CB1REPR1 CB1REPR0
FFFFF1C4 H CB1RIC CB1RIF CB1RMK 0 0 0 CB1RPR2 CB1RPR1 CB1RPR0
FFFFF1C6 H CB1TIC CB1TIF CB1TMK 0 0 0 CB1TPR2 CB1TPR1 CB1TPR0
FFFFF1C8 H CB2REIC CB2REIF CB2REMK 0 0 0 CB2REPR2 CB2REPR1 CB2REPR0
FFFFF1CA H CB2RIC CB2RIF CB2RMK 0 0 0 CB2RPR2 CB2RPR1 CB2RPR0
FFFFF1CC H CB2TIC CB2TIF CB2TMK 0 0 0 CB2TPR2 CB2TPR1 CB2TPR0
FFFFF1CE H LCDIC LCDIF LCDMK 0 0 0 LCDPR2 LCDPR1 LCDPR0
FFFFF1D0H C2ERRIC C2ERRIF C2ERRMK 0 0 0 C2ERRPR2 C2ERRPR1 C2ERRPR0
FFFFF1D2 H C2WUPIC C2WUPIF C2WUPMK 0 0 0 C2WUPPR2 C2WUPPR1 C2WUPPR0
FFFFF1D4 H C2RECIC C2RECIF C2RECMK 0 0 0 C2RECPR2 C2RECPR1 C2RECPR0
FFFFF1D6 H C2TRXIC C2TRXIF C2TRXMK 0 0 0 C2TRXPR2 C2TRXPR1 C2TRXPR0

Table 5-9 Addresses and bits of interrupt control registers of µPD70F3420 (OTF),
µPD70F3421, µPD70F3421 (OTF), µPD70F3422, µPD70F3422 (OTF),
µPD70F3423 (1/3)
Bit
Address Register
7 6 5 4 3 2 1 0
FFFFF110 H VC0IC VC0IF VC0MK 0 0 0 VC0PR2 VC0PR1 VC0PR0
FFFFF112 H VC1IC VC1IF VC1MK 0 0 0 VC1PR2 VC1PR1 VC1PR0
FFFFF114 H WT0UVIC WT0UVIF WT0UVMK 0 0 0 WT0UVPR2 WT0UVPR1 WT0UVPR0
FFFFF116 H WT1UVIC WT1UVIF WT1UVMK 0 0 0 WT1UVPR2 WT1UVPR1 WT1UVPR0
FFFFF11A H TM01IC TM01IF TM01MK 0 0 0 TM01PR2 TM01PR1 TM01PR0
FFFFF11C H P0IC P0IF P0MK 0 0 0 P0PR2 P0PR1 P0PR0
FFFFF11E H P1IC P1IF P1MK 0 0 0 P1PR2 P1PR1 P1PR0
FFFFF120 H P2IC P2IF P2MK 0 0 0 P2PR2 P2PR1 P2PR0
FFFFF122 H P3IC P3IF P3MK 0 0 0 P3PR2 P3PR1 P3PR0
FFFFF124 H P4IC P4IF P4MK 0 0 0 P4PR2 P4PR1 P4PR0
FFFFF126 H
www.DataSheet4U.com P5IC P5IF P5MK 0 0 0 P5PR2 P5PR1 P5PR0
FFFFF128 H P6IC P6IF P6MK 0 0 0 P6PR2 P6PR1 P6PR0
FFFFF12A H TZ0UVIC TZ0UVIF TZ0UVMK 0 0 0 TZ0UVPR2 TZ0UVPR1 TZ0UVPR0
FFFFF12C H TZ1UVIC TZ1UVIF TZ1UVMK 0 0 0 TZ1UVPR2 TZ1UVPR1 TZ1UVPR0
FFFFF12E H TZ2UVIC TZ2UVIF TZ2UVMK 0 0 0 TZ2UVPR2 TZ2UVPR1 TZ2UVPR0
FFFFF130 H TZ3UVIC TZ3UVIF TZ3UVMK 0 0 0 TZ3UVPR2 TZ3UVPR1 TZ3UVPR0

242 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

Table 5-9 Addresses and bits of interrupt control registers of µPD70F3420 (OTF),
µPD70F3421, µPD70F3421 (OTF), µPD70F3422, µPD70F3422 (OTF),
µPD70F3423 (2/3)
Bit
Address Register
7 6 5 4 3 2 1 0
FFFFF132 H TZ4UVIC TZ4UVIF TZ4UVMK 0 0 0 TZ4UVPR2 TZ4UVPR1 TZ4UVPR0
FFFFF134 H TZ5UVIC TZ5UVIF TZ5UVMK 0 0 0 TZ5UVPR2 TZ5UVPR1 TZ5UVPR0
FFFFF136 H TP0OVIC TP0OVIF TP0OVMK 0 0 0 TP0OVPR2 TP0OVPR1 TP0OVPR0
FFFFF138 H TP0CC0IC TP0CC0IF TP0CC0MK 0 0 0 TP0CC0PR2 TP0CC0PR1 TP0CC0PR0
FFFFF13A H TP0CC1IC TP0CC1IF TP0CC1MK 0 0 0 TP0CC1PR2 TP0CC1PR1 TP0CC1PR0
FFFFF13C H TP1OVIC TP1OVIF TP1OVMK 0 0 0 TP1OVPR2 TP1OVPR1 TP1OVPR0
FFFFF13E H TP1CC0IC TP1CC0IF TP1CC0MK 0 0 0 TP1CC0PR2 TP1CC0PR1 TP1CC0PR0
FFFFF140 H TP1CC1IC TP1CC1IF TP1CC1MK 0 0 0 TP1CC1PR2 TP1CC1PR1 TP1CC1PR0
FFFFF142 H TP2OVIC TP2OVIF TP2OVMK 0 0 0 TP2OVPR2 TP2OVPR1 TP2OVPR0
FFFFF144 H TP2CC0IC TP2CC0IF TP2CC0MK 0 0 0 TP2CC0PR2 TP2CC0PR1 TP2CC0PR0
FFFFF146 H TP2CC1IC TP2CC1IF TP2CC1MK 0 0 0 TP2CC1PR2 TP2CC1PR1 TP2CC1PR0
FFFFF148 H TP3OVIC TP3OVIF TP3OVMK 0 0 0 TP3OVPR2 TP3OVPR1 TP3OVPR0
FFFFF14A H TP3CC0IC TP3CC0IF TP3CC0MK 0 0 0 TP3CC0PR2 TP3CC0PR1 TP3CC0PR0
FFFFF14C H TP3CC1IC TP3CC1IF TP3CC1MK 0 0 0 TP3CC1PR2 TP3CC1PR1 TP3CC1PR0
FFFFF14E H TG0OV0IC TG0OV0IF TG0OV0MK 0 0 0 TG0OV0PR2 TG0OV0PR1 TG0OV0PR0
FFFFF150 H TG0OV1IC TG0OV1IF TG0OV1MK 0 0 0 TG0OV1PR2 TG0OV1PR1 TG0OV1PR0
FFFFF152 H TG0CC0IC TG0CC0IF TG0CC0MK 0 0 0 TG0CC0PR2 TG0CC0PR1 TG0CC0PR0
FFFFF154 H TG0CC1IC TG0CC1IF TG0CC1MK 0 0 0 TG0CC1PR2 TG0CC1PR1 TG0CC1PR0
FFFFF156 H TG0CC2IC TG0CC2IF TG0CC2MK 0 0 0 TG0CC2PR2 TG0CC2PR1 TG0CC2PR0
FFFFF158 H TG0CC3IC TG0CC3IF TG0CC3MK 0 0 0 TG0CC3PR2 TG0CC3PR1 TG0CC3PR0
FFFFF15A H TG0CC4IC TG0CC4IF TG0CC4MK 0 0 0 TG0CC4PR2 TG0CC4PR1 TG0CC4PR0
FFFFF15C H TG0CC5IC TG0CC5IF TG0CC5MK 0 0 0 TG0CC5PR2 TG0CC5PR1 TG0CC5PR0
FFFFF15E H TG1OV0IC TG1OV0IF TG1OV0MK 0 0 0 TG1OV0PR2 TG1OV0PR1 TG1OV0PR0
FFFFF160 H TG1OV1IC TG1OV1IF TG1OV1MK 0 0 0 TG1OV1PR2 TG1OV1PR1 TG1OV1PR0
FFFFF162 H TG1CC0C TG1CC0IF TG1CC0MK 0 0 0 TG1CC0PR2 TG1CC0PR1 TG1CC0PR0
FFFFF164 H TG1CC1IC TG1CC1IF TG1CC1MK 0 0 0 TG1CC1PR2 TG1CC1PR1 TG1CC1PR0
FFFFF166 H TG1CC2IC TG1CC2IF TG1CC2MK 0 0 0 TG1CC2PR2 TG1CC2PR1 TG1CC2PR0
FFFFF168 H TG1CC3IC TG1CC3IF TG1CC3MK 0 0 0 TG1CC3PR2 TG1CC3PR1 TG1CC3PR0
FFFFF16A H TG1CC4IC TG1CC4IF TG1CC4MK 0 0 0 TG1CC4PR2 TG1CC4PR1 TG1CC4PR0
FFFFF16C H TG1CC5IC TG1CC5IF TG1CC5MK 0 0 0 TG1CC5PR2 TG1CC5PR1 TG1CC5PR0
FFFFF16E H TY0UV0IC TY0UV0IF TY0UV0MK 0 0 0 TY0UV0PR2 TY0UV0PR1 TY0UV0PR0
FFFFF170 H TY0UV1IC TY0UV1IF TY0UV1MK 0 0 0 TY0UV1PR2 TY0UV1PR1 TY0UV1PR0
FFFFF172 H ADIC ADIF ADMK 0 0 0 ADPR2 ADPR1 ADPR0
FFFFF174 H C0ERRIC C0ERRIF C0ERRMK 0 0 0 C0ERRPR2 C0ERRPR1 C0ERRPR0
www.DataSheet4U.com
FFFFF176 H C0WUPIC C0WUPIF C0WUPMK 0 0 0 C0WUPPR2 C0WUPPR1 C0WUPPR0
FFFFF178 H C0RECIC C0RECIF C0RECMK 0 0 0 C0RECPR2 C0RECPR1 C0RECPR0
FFFFF17A H C0TRXIC C0TRXIF C0TRXMK 0 0 0 C0TRXPR2 C0TRXPR1 C0TRXPR0
FFFFF17C H CB0REIC CB0REIF CB0REMK 0 0 0 CB0REPR2 CB0REPR1 CB0REPR0
FFFFF17E H CB0RIC CB0RIF CB0RMK 0 0 0 CB0RPR2 CB0RPR1 CB0RPR0

User’s Manual U17566EE5V1UM00 243


Chapter 5 Interrupt Controller (INTC)

Table 5-9 Addresses and bits of interrupt control registers of µPD70F3420 (OTF),
µPD70F3421, µPD70F3421 (OTF), µPD70F3422, µPD70F3422 (OTF),
µPD70F3423 (3/3)
Bit
Address Register
7 6 5 4 3 2 1 0
FFFFF180 H CB0TIC CB0TIF CB0TMK 0 0 0 CB0TPR2 CB0TPR1 CB0TPR0
FFFFF182 H UA0REIC UA0REIF UA0REMK 0 0 0 UA0REPR2 UA0REPR1 UA0REPR0
FFFFF184 H UA0RIC UA0RIF UA0RMK 0 0 0 UA0RPR2 UA0RPR1 UA0RPR0
FFFFF186 H UA0TIC UA0TIF UA0TMK 0 0 0 UA0TPR2 UA0TPR1 UA0TPR0
FFFFF188 H UA1REIC UA1REIF UA1REMK 0 0 0 UA1REPR2 UA1REPR1 UA1REPR0
FFFFF18A H UA1RIC UA1RIF UA1RMK 0 0 0 UA1RPR2 UA1RPR1 UA1RPR0
FFFFF18C H UA1TIC UA1TIF UA1TMK 0 0 0 UA1TPR2 UA1TPR1 UA1TPR0
FFFFF18E H IIC0IC IIC0IF IIC0MK 0 0 0 IIC0PR2 IIC0PR1 IIC0PR0
FFFFF190 H IIC1IC IIC1IF IIC1MK 0 0 0 IIC1PR2 IIC1PR1 IIC1PR0
FFFFF192 H SG0IC SG0IF SG0MK 0 0 0 SG0PR2 SG0PR1 SG0PR0
FFFFF194 H DMA0IC DMA0IF DMA0MK 0 0 0 DMA0PR2 DMA0PR1 DMA0PR0
FFFFF196 H DMA1IC DMA1IF DMA1MK 0 0 0 DMA1PR2 DMA1PR1 DMA1PR0
FFFFF198 H DMA2IC DMA2IF DMA2MK 0 0 0 DMA2PR2 DMA2PR1 DMA2PR0
FFFFF19A H DMA3IC DMA3IF DMA3MK 0 0 0 DMA3PR2 DMA3PR1 DMA3PR0
FFFFF19C H INT70IC INT70IF INT70MK 0 0 0 INT70PR2 INT70PR1 INT70PR0
FFFFF19E H INT71IC INT71IF INT71MK 0 0 0 INT71PR2 INT71PR1 INT71PR0
FFFFF1A2 H C1ERRIC C1ERRIF C1ERRMK 0 0 0 C1ERRPR2 C1ERRPR1 C1ERRPR0
FFFFF1A4 H C1WUPIC C1WUPIF C1WUPMK 0 0 0 C1WUPPR2 C1WUPPR1 C1WUPPR0
FFFFF1A6 H C1RECIC C1RECIF C1RECMK 0 0 0 C1RECPR2 C1RECPR1 C1RECPR0
FFFFF1A8 H C1TRXIC C1TRXIF C1TRXMK 0 0 0 C1TRXPR2 C1TRXPR1 C1TRXPR0
FFFFF1C2 H CB1REIC CB1REIF CB1REMK 0 0 0 CB1REPR2 CB1REPR1 CB1REPR0
FFFFF1C4 H CB1RIC CB1RIF CB1RMK 0 0 0 CB1RPR2 CB1RPR1 CB1RPR0
FFFFF1C6 H CB1TIC CB1TIF CB1TMK 0 0 0 CB1TPR2 CB1TPR1 CB1TPR0
FFFFF1D0 H C2ERRIC a C2ERRIF C2ERRMK 0 0 0 C2ERRPR2 C2ERRPR1 C2ERRPR0
FFFFF1D2 H C2WUPIC a C2WUPIF C2WUPMK 0 0 0 C2WUPPR2 C2WUPPR1 C2WUPPR0
FFFFF1D4 H C2RECIC a C2RECIF C2RECMK 0 0 0 C2RECPR2 C2RECPR1 C2RECPR0
FFFFF1D6 H C2TRXIC a C2TRXIF C2TRXMK 0 0 0 C2TRXPR2 C2TRXPR1 C2TRXPR0
a)
µPD70F3423 only

Table 5-10 Addresses and bits of interrupt control registers of µPD70F3424,


µPD70F3425, µPD70F3426, µPD70F3427 (1/4)
Bit
Address Register
7 6 5 4 3 2 1 0
FFFFF110 H VC0IC VC0IF VC0MK 0 0 0 VC0PR2 VC0PR1 VC0PR0
www.DataSheet4U.com
FFFFF112 H VC1IC VC1IF VC1MK 0 0 0 VC1PR2 VC1PR1 VC1PR0
FFFFF114 H WT0UVIC WT0UVIF WT0UVMK 0 0 0 WT0UVPR2 WT0UVPR1 WT0UVPR0
FFFFF116 H WT1UVIC WT1UVIF WT1UVMK 0 0 0 WT1UVPR2 WT1UVPR1 WT1UVPR0
FFFFF11A H TM01IC TM01IF TM01MK 0 0 0 TM01PR2 TM01PR1 TM01PR0
FFFFF11C H P0IC P0IF P0MK 0 0 0 P0PR2 P0PR1 P0PR0

244 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

Table 5-10 Addresses and bits of interrupt control registers of µPD70F3424,


µPD70F3425, µPD70F3426, µPD70F3427 (2/4)
Bit
Address Register
7 6 5 4 3 2 1 0
FFFFF11E H P1IC P1IF P1MK 0 0 0 P1PR2 P1PR1 P1PR0
FFFFF120 H P2IC P2IF P2MK 0 0 0 P2PR2 P2PR1 P2PR0
FFFFF122 H P3IC P3IF P3MK 0 0 0 P3PR2 P3PR1 P3PR0
FFFFF124 H P4IC P4IF P4MK 0 0 0 P4PR2 P4PR1 P4PR0
FFFFF126 H P5IC P5IF P5MK 0 0 0 P5PR2 P5PR1 P5PR0
FFFFF128 H P6IC P6IF P6MK 0 0 0 P6PR2 P6PR1 P6PR0
FFFFF12A H TZ0UVIC TZ0UVIF TZ0UVMK 0 0 0 TZ0UVPR2 TZ0UVPR1 TZ0UVPR0
FFFFF12C H TZ1UVIC TZ1UVIF TZ1UVMK 0 0 0 TZ1UVPR2 TZ1UVPR1 TZ1UVPR0
FFFFF12E H TZ2UVIC TZ2UVIF TZ2UVMK 0 0 0 TZ2UVPR2 TZ2UVPR1 TZ2UVPR0
FFFFF130 H TZ3UVIC TZ3UVIF TZ3UVMK 0 0 0 TZ3UVPR2 TZ3UVPR1 TZ3UVPR0
FFFFF132 H TZ4UVIC TZ4UVIF TZ4UVMK 0 0 0 TZ4UVPR2 TZ4UVPR1 TZ4UVPR0
FFFFF134 H TZ5UVIC TZ5UVIF TZ5UVMK 0 0 0 TZ5UVPR2 TZ5UVPR1 TZ5UVPR0
FFFFF136 H TP0OVIC TP0OVIF TP0OVMK 0 0 0 TP0OVPR2 TP0OVPR1 TP0OVPR0
FFFFF138 H TP0CC0IC TP0CC0IF TP0CC0MK 0 0 0 TP0CC0PR2 TP0CC0PR1 TP0CC0PR0
FFFFF13A H TP0CC1IC TP0CC1IF TP0CC1MK 0 0 0 TP0CC1PR2 TP0CC1PR1 TP0CC1PR0
FFFFF13C H TP1OVIC TP1OVIF TP1OVMK 0 0 0 TP1OVPR2 TP1OVPR1 TP1OVPR0
FFFFF13E H TP1CC0IC TP1CC0IF TP1CC0MK 0 0 0 TP1CC0PR2 TP1CC0PR1 TP1CC0PR0
FFFFF140 H TP1CC1IC TP1CC1IF TP1CC1MK 0 0 0 TP1CC1PR2 TP1CC1PR1 TP1CC1PR0
FFFFF142 H TP2OVIC TP2OVIF TP2OVMK 0 0 0 TP2OVPR2 TP2OVPR1 TP2OVPR0
FFFFF144 H TP2CC0IC TP2CC0IF TP2CC0MK 0 0 0 TP2CC0PR2 TP2CC0PR1 TP2CC0PR0
FFFFF146 H TP2CC1IC TP2CC1IF TP2CC1MK 0 0 0 TP2CC1PR2 TP2CC1PR1 TP2CC1PR0
FFFFF148 H TP3OVIC TP3OVIF TP3OVMK 0 0 0 TP3OVPR2 TP3OVPR1 TP3OVPR0
FFFFF14A H TP3CC0IC TP3CC0IF TP3CC0MK 0 0 0 TP3CC0PR2 TP3CC0PR1 TP3CC0PR0
FFFFF14C H TP3CC1IC TP3CC1IF TP3CC1MK 0 0 0 TP3CC1PR2 TP3CC1PR1 TP3CC1PR0
FFFFF14E H TG0OV0IC TG0OV0IF TG0OV0MK 0 0 0 TG0OV0PR2 TG0OV0PR1 TG0OV0PR0
FFFFF150 H TG0OV1IC TG0OV1IF TG0OV1MK 0 0 0 TG0OV1PR2 TG0OV1PR1 TG0OV1PR0
FFFFF152 H TG0CC0IC TG0CC0IF TG0CC0MK 0 0 0 TG0CC0PR2 TG0CC0PR1 TG0CC0PR0
FFFFF154 H TG0CC1IC TG0CC1IF TG0CC1MK 0 0 0 TG0CC1PR2 TG0CC1PR1 TG0CC1PR0
FFFFF156 H TG0CC2IC TG0CC2IF TG0CC2MK 0 0 0 TG0CC2PR2 TG0CC2PR1 TG0CC2PR0
FFFFF158 H TG0CC3IC TG0CC3IF TG0CC3MK 0 0 0 TG0CC3PR2 TG0CC3PR1 TG0CC3PR0
FFFFF15A H TG0CC4IC TG0CC4IF TG0CC4MK 0 0 0 TG0CC4PR2 TG0CC4PR1 TG0CC4PR0
FFFFF15C H TG0CC5IC TG0CC5IF TG0CC5MK 0 0 0 TG0CC5PR2 TG0CC5PR1 TG0CC5PR0
FFFFF15E H TG1OV0IC TG1OV0IF TG1OV0MK 0 0 0 TG1OV0PR2 TG1OV0PR1 TG1OV0PR0
FFFFF160 H TG1OV1IC TG1OV1IF TG1OV1MK 0 0 0 TG1OV1PR2 TG1OV1PR1 TG1OV1PR0
FFFFF162 H TG1CC0C
www.DataSheet4U.com TG1CC0IF TG1CC0MK 0 0 0 TG1CC0PR2 TG1CC0PR1 TG1CC0PR0
FFFFF164 H TG1CC1IC TG1CC1IF TG1CC1MK 0 0 0 TG1CC1PR2 TG1CC1PR1 TG1CC1PR0
FFFFF166 H TG1CC2IC TG1CC2IF TG1CC2MK 0 0 0 TG1CC2PR2 TG1CC2PR1 TG1CC2PR0
FFFFF168 H TG1CC3IC TG1CC3IF TG1CC3MK 0 0 0 TG1CC3PR2 TG1CC3PR1 TG1CC3PR0
FFFFF16A H TG1CC4IC TG1CC4IF TG1CC4MK 0 0 0 TG1CC4PR2 TG1CC4PR1 TG1CC4PR0
FFFFF16C H TG1CC5IC TG1CC5IF TG1CC5MK 0 0 0 TG1CC5PR2 TG1CC5PR1 TG1CC5PR0

User’s Manual U17566EE5V1UM00 245


Chapter 5 Interrupt Controller (INTC)

Table 5-10 Addresses and bits of interrupt control registers of µPD70F3424,


µPD70F3425, µPD70F3426, µPD70F3427 (3/4)
Bit
Address Register
7 6 5 4 3 2 1 0
FFFFF16E H TY0UV0IC TY0UV0IF TY0UV0MK 0 0 0 TY0UV0PR2 TY0UV0PR1 TY0UV0PR0
FFFFF170 H TY0UV1IC TY0UV1IF TY0UV1MK 0 0 0 TY0UV1PR2 TY0UV1PR1 TY0UV1PR0
FFFFF172 H ADIC ADIF ADMK 0 0 0 ADPR2 ADPR1 ADPR0
FFFFF174 H C0ERRIC C0ERRIF C0ERRMK 0 0 0 C0ERRPR2 C0ERRPR1 C0ERRPR0
FFFFF176 H C0WUPIC C0WUPIF C0WUPMK 0 0 0 C0WUPPR2 C0WUPPR1 C0WUPPR0
FFFFF178 H C0RECIC C0RECIF C0RECMK 0 0 0 C0RECPR2 C0RECPR1 C0RECPR0
FFFFF17A H C0TRXIC C0TRXIF C0TRXMK 0 0 0 C0TRXPR2 C0TRXPR1 C0TRXPR0
FFFFF17C H CB0REIC CB0REIF CB0REMK 0 0 0 CB0REPR2 CB0REPR1 CB0REPR0
FFFFF17E H CB0RIC CB0RIF CB0RMK 0 0 0 CB0RPR2 CB0RPR1 CB0RPR0
FFFFF180 H CB0TIC CB0TIF CB0TMK 0 0 0 CB0TPR2 CB0TPR1 CB0TPR0
FFFFF182 H UA0REIC UA0REIF UA0REMK 0 0 0 UA0REPR2 UA0REPR1 UA0REPR0
FFFFF184 H UA0RIC UA0RIF UA0RMK 0 0 0 UA0RPR2 UA0RPR1 UA0RPR0
FFFFF186 H UA0TIC UA0TIF UA0TMK 0 0 0 UA0TPR2 UA0TPR1 UA0TPR0
FFFFF188 H UA1REIC UA1REIF UA1REMK 0 0 0 UA1REPR2 UA1REPR1 UA1REPR0
FFFFF18A H UA1RIC UA1RIF UA1RMK 0 0 0 UA1RPR2 UA1RPR1 UA1RPR0
FFFFF18C H UA1TIC UA1TIF UA1TMK 0 0 0 UA1TPR2 UA1TPR1 UA1TPR0
FFFFF18E H IIC0IC IIC0IF IIC0MK 0 0 0 IIC0PR2 IIC0PR1 IIC0PR0
FFFFF190 H IIC1IC IIC1IF IIC1MK 0 0 0 IIC1PR2 IIC1PR1 IIC1PR0
FFFFF192 H SG0IC SG0IF SG0MK 0 0 0 SG0PR2 SG0PR1 SG0PR0
FFFFF194 H DMA0IC DMA0IF DMA0MK 0 0 0 DMA0PR2 DMA0PR1 DMA0PR0
FFFFF196 H DMA1IC DMA1IF DMA1MK 0 0 0 DMA1PR2 DMA1PR1 DMA1PR0
FFFFF198 H DMA2IC DMA2IF DMA2MK 0 0 0 DMA2PR2 DMA2PR1 DMA2PR0
FFFFF19A H DMA3IC DMA3IF DMA3MK 0 0 0 DMA3PR2 DMA3PR1 DMA3PR0
FFFFF19C H INT70IC INT70IF INT70MK 0 0 0 INT70PR2 INT70PR1 INT70PR0
FFFFF19E H INT71IC INT71IF INT71MK 0 0 0 INT71PR2 INT71PR1 INT71PR0
FFFFF1A0 H P7IC P7IF P7MK 0 0 0 P7PR2 P7PR1 P7PR0
FFFFF1A2 H C1ERRIC C1ERRIF C1ERRMK 0 0 0 C1ERRPR2 C1ERRPR1 C1ERRPR0
FFFFF1A4 H C1WUPIC C1WUPIF C1WUPMK 0 0 0 C1WUPPR2 C1WUPPR1 C1WUPPR0
FFFFF1A6 H C1RECIC C1RECIF C1RECMK 0 0 0 C1RECPR2 C1RECPR1 C1RECPR0
FFFFF1A8 H C1TRXIC C1TRXIF C1TRXMK 0 0 0 C1TRXPR2 C1TRXPR1 C1TRXPR0
FFFFF1AA H TZ6UVIC TZ6UVIF TZ6UVMK 0 0 0 TZ6UVPR2 TZ6UVPR1 TZ6UVPR0
FFFFF1AC H TZ7UVIC TZ7UVIF TZ7UVMK 0 0 0 TZ7UVPR2 TZ7UVPR1 TZ7UVPR0
FFFFF1AE H TZ8UVIC TZ8UVIF TZ8UVMK 0 0 0 TZ8UVPR2 TZ8UVPR1 TZ8UVPR0
FFFFF1B0 H TZ9UVIC TZ9UVIF TZ9UVMK 0 0 0 TZ9UVPR2 TZ9UVPR1 TZ9UVPR0
FFFFF1B2 H TG2OV0IC
www.DataSheet4U.com TG2OV0IF TG2OV0MK 0 0 0 TG2OV0PR2 TG2OV0PR1 TG2OV0PR0
FFFFF1B4 H TG2OV1IC TG2OV1IF TG2OV1MK 0 0 0 TG2OV1PR2 TG2OV1PR1 TG2OV1PR0
FFFFF1B6 H TG2CC0IC TG2CC0IF TG2CC0MK 0 0 0 TG2CC0PR2 TG2CC0PR1 TG2CC0PR0
FFFFF1B8 H TG2CC1IC TG2CC1IF TG2CC1MK 0 0 0 TG2CC1PR2 TG2CC1PR1 TG2CC1PR0
FFFFF1BA H TG2CC2IC TG2CC2IF TG2CC2MK 0 0 0 TG2CC2PR2 TG2CC2PR1 TG2CC2PR0
FFFFF1BC H TG2CC3IC TG2CC3IF TG2CC3MK 0 0 0 TG2CC3PR2 TG2CC3PR1 TG2CC3PR0

246 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

Table 5-10 Addresses and bits of interrupt control registers of µPD70F3424,


µPD70F3425, µPD70F3426, µPD70F3427 (4/4)
Bit
Address Register
7 6 5 4 3 2 1 0
FFFFF1BE H TG2CC4IC TG2CC4IF TG2CC4MK 0 0 0 TG2CC4PR2 TG2CC4PR1 TG2CC4PR0
FFFFF1C0 H TG2CC5IC TG2CC5IF TG2CC5MK 0 0 0 TG2CC5PR2 TG2CC5PR1 TG2CC5PR0
FFFFF1C2 H CB1REIC CB1REIF CB1REMK 0 0 0 CB1REPR2 CB1REPR1 CB1REPR0
FFFFF1C4 H CB1RIC CB1RIF CB1RMK 0 0 0 CB1RPR2 CB1RPR1 CB1RPR0
FFFFF1C6 H CB1TIC CB1TIF CB1TMK 0 0 0 CB1TPR2 CB1TPR1 CB1TPR0
FFFFF1C8 H CB2REIC CB2REIF CB2REMK 0 0 0 CB2REPR2 CB2REPR1 CB2REPR0
FFFFF1CA H CB2RIC CB2RIF CB2RMK 0 0 0 CB2RPR2 CB2RPR1 CB2RPR0
FFFFF1CC H CB2TIC CB2TIF CB2TMK 0 0 0 CB2TPR2 CB2TPR1 CB2TPR0
FFFFF1CE H LCDIC LCDIF LCDMK 0 0 0 LCDPR2 LCDPR1 LCDPR0
FFFFF1D0 H C2ERRIC a C2ERRIF C2ERRMK 0 0 0 C2ERRPR2 C2ERRPR1 C2ERRPR0
FFFFF1D2 H C2WUPIC a C2WUPIF C2WUPMK 0 0 0 C2WUPPR2 C2WUPPR1 C2WUPPR0
FFFFF1D4 H C2RECIC a C2RECIF C2RECMK 0 0 0 C2RECPR2 C2RECPR1 C2RECPR0
FFFFF1D6 H C2TRXIC a C2TRXIF C2TRXMK 0 0 0 C2TRXPR2 C2TRXPR1 C2TRXPR0
a) µPD70F3424, µPD70F3427 only

Table 5-11 Addresses and bits of interrupt control registers (1/3)


Bit
Address Register
7 6 5 4 3 2 1 0
FFFFF110 H VC0IC VC0IF VC0MK 0 0 0 VC0PR2 VC0PR1 VC0PR0
FFFFF112 H VC1IC VC1IF VC1MK 0 0 0 VC1PR2 VC1PR1 VC1PR0
FFFFF114 H WT0UVIC WT0UVIF WT0UVMK 0 0 0 WT0UVPR2 WT0UVPR1 WT0UVPR0
FFFFF116 H WT1UVIC WT1UVIF WT1UVMK 0 0 0 WT1UVPR2 WT1UVPR1 WT1UVPR0
FFFFF11A H TM01IC TM01IF TM01MK 0 0 0 TM01PR2 TM01PR1 TM01PR0
FFFFF11C H P0IC P0IF P0MK 0 0 0 P0PR2 P0PR1 P0PR0
FFFFF11E H P1IC P1IF P1MK 0 0 0 P1PR2 P1PR1 P1PR0
FFFFF120 H P2IC P2IF P2MK 0 0 0 P2PR2 P2PR1 P2PR0
FFFFF122 H P3IC P3IF P3MK 0 0 0 P3PR2 P3PR1 P3PR0
FFFFF124 H P4IC P4IF P4MK 0 0 0 P4PR2 P4PR1 P4PR0
FFFFF126 H P5IC P5IF P5MK 0 0 0 P5PR2 P5PR1 P5PR0
FFFFF128 H P6IC P6IF P6MK 0 0 0 P6PR2 P6PR1 P6PR0
FFFFF12A H TZ0UVIC TZ0UVIF TZ0UVMK 0 0 0 TZ0UVPR2 TZ0UVPR1 TZ0UVPR0
FFFFF12C H TZ1UVIC TZ1UVIF TZ1UVMK 0 0 0 TZ1UVPR2 TZ1UVPR1 TZ1UVPR0
FFFFF12E H TZ2UVIC TZ2UVIF TZ2UVMK 0 0 0 TZ2UVPR2 TZ2UVPR1 TZ2UVPR0
FFFFF130 H TZ3UVIC TZ3UVIF TZ3UVMK 0 0 0 TZ3UVPR2 TZ3UVPR1 TZ3UVPR0
www.DataSheet4U.com
FFFFF132 H TZ4UVIC TZ4UVIF TZ4UVMK 0 0 0 TZ4UVPR2 TZ4UVPR1 TZ4UVPR0
FFFFF134 H TZ5UVIC TZ5UVIF TZ5UVMK 0 0 0 TZ5UVPR2 TZ5UVPR1 TZ5UVPR0
FFFFF136 H TP0OVIC TP0OVIF TP0OVMK 0 0 0 TP0OVPR2 TP0OVPR1 TP0OVPR0
FFFFF138 H TP0CC0IC TP0CC0IF TP0CC0MK 0 0 0 TP0CC0PR2 TP0CC0PR1 TP0CC0PR0
FFFFF13A H TP0CC1IC TP0CC1IF TP0CC1MK 0 0 0 TP0CC1PR2 TP0CC1PR1 TP0CC1PR0

User’s Manual U17566EE5V1UM00 247


Chapter 5 Interrupt Controller (INTC)

Table 5-11 Addresses and bits of interrupt control registers (2/3)


Bit
Address Register
7 6 5 4 3 2 1 0
FFFFF13C H TP1OVIC TP1OVIF TP1OVMK 0 0 0 TP1OVPR2 TP1OVPR1 TP1OVPR0
FFFFF13E H TP1CC0IC TP1CC0IF TP1CC0MK 0 0 0 TP1CC0PR2 TP1CC0PR1 TP1CC0PR0
FFFFF140 H TP1CC1IC TP1CC1IF TP1CC1MK 0 0 0 TP1CC1PR2 TP1CC1PR1 TP1CC1PR0
FFFFF142 H TP2OVIC TP2OVIF TP2OVMK 0 0 0 TP2OVPR2 TP2OVPR1 TP2OVPR0
FFFFF144 H TP2CC0IC TP2CC0IF TP2CC0MK 0 0 0 TP2CC0PR2 TP2CC0PR1 TP2CC0PR0
FFFFF146 H TP2CC1IC TP2CC1IF TP2CC1MK 0 0 0 TP2CC1PR2 TP2CC1PR1 TP2CC1PR0
FFFFF148 H TP3OVIC TP3OVIF TP3OVMK 0 0 0 TP3OVPR2 TP3OVPR1 TP3OVPR0
FFFFF14A H TP3CC0IC TP3CC0IF TP3CC0MK 0 0 0 TP3CC0PR2 TP3CC0PR1 TP3CC0PR0
FFFFF14C H TP3CC1IC TP3CC1IF TP3CC1MK 0 0 0 TP3CC1PR2 TP3CC1PR1 TP3CC1PR0
FFFFF14E H TG0OV0IC TG0OV0IF TG0OV0MK 0 0 0 TG0OV0PR2 TG0OV0PR1 TG0OV0PR0
FFFFF150 H TG0OV1IC TG0OV1IF TG0OV1MK 0 0 0 TG0OV1PR2 TG0OV1PR1 TG0OV1PR0
FFFFF152 H TG0CC0IC TG0CC0IF TG0CC0MK 0 0 0 TG0CC0PR2 TG0CC0PR1 TG0CC0PR0
FFFFF154 H TG0CC1IC TG0CC1IF TG0CC1MK 0 0 0 TG0CC1PR2 TG0CC1PR1 TG0CC1PR0
FFFFF156 H TG0CC2IC TG0CC2IF TG0CC2MK 0 0 0 TG0CC2PR2 TG0CC2PR1 TG0CC2PR0
FFFFF158 H TG0CC3IC TG0CC3IF TG0CC3MK 0 0 0 TG0CC3PR2 TG0CC3PR1 TG0CC3PR0
FFFFF15A H TG0CC4IC TG0CC4IF TG0CC4MK 0 0 0 TG0CC4PR2 TG0CC4PR1 TG0CC4PR0
FFFFF15C H TG0CC5IC TG0CC5IF TG0CC5MK 0 0 0 TG0CC5PR2 TG0CC5PR1 TG0CC5PR0
FFFFF15E H TG1OV0IC TG1OV0IF TG1OV0MK 0 0 0 TG1OV0PR2 TG1OV0PR1 TG1OV0PR0
FFFFF160 H TG1OV1IC TG1OV1IF TG1OV1MK 0 0 0 TG1OV1PR2 TG1OV1PR1 TG1OV1PR0
FFFFF162 H TG1CC0C TG1CC0IF TG1CC0MK 0 0 0 TG1CC0PR2 TG1CC0PR1 TG1CC0PR0
FFFFF164 H TG1CC1IC TG1CC1IF TG1CC1MK 0 0 0 TG1CC1PR2 TG1CC1PR1 TG1CC1PR0
FFFFF166 H TG1CC2IC TG1CC2IF TG1CC2MK 0 0 0 TG1CC2PR2 TG1CC2PR1 TG1CC2PR0
FFFFF168 H TG1CC3IC TG1CC3IF TG1CC3MK 0 0 0 TG1CC3PR2 TG1CC3PR1 TG1CC3PR0
FFFFF16A H TG1CC4IC TG1CC4IF TG1CC4MK 0 0 0 TG1CC4PR2 TG1CC4PR1 TG1CC4PR0
FFFFF16C H TG1CC5IC TG1CC5IF TG1CC5MK 0 0 0 TG1CC5PR2 TG1CC5PR1 TG1CC5PR0
FFFFF16E H TY0CC0IC TY0CC0IF TY0CC0MK 0 0 0 TY0CC0PR2 TY0CC0PR1 TY0CC0PR0
FFFFF170 H TY0CC1IC TY0CC1IF TY0CC1MK 0 0 0 TY0CC1PR2 TY0CC1PR1 TY0CC1PR0
FFFFF172 H ADIC ADIF ADMK 0 0 0 ADPR2 ADPR1 ADPR0
FFFFF174 H C0ERRIC C0ERRIF C0ERRMK 0 0 0 C0ERRPR2 C0ERRPR1 C0ERRPR0
FFFFF176 H C0WUPIC C0WUPIF C0WUPMK 0 0 0 C0WUPPR2 C0WUPPR1 C0WUPPR0
FFFFF178 H C0RECIC C0RECIF C0RECMK 0 0 0 C0RECPR2 C0RECPR1 C0RECPR0
FFFFF17A H C0TRXIC C0TRXIF C0TRXMK 0 0 0 C0TRXPR2 C0TRXPR1 C0TRXPR0
FFFFF17C H CB0REIC CB0REIF CB0REMK 0 0 0 CB0REPR2 CB0REPR1 CB0REPR0
FFFFF17E H CB0RIC CB0RIF CB0RMK 0 0 0 CB0RPR2 CB0RPR1 CB0RPR0
FFFFF180 H CB0TIC CB0TIF CB0TMK 0 0 0 CB0TPR2 CB0TPR1 CB0TPR0
FFFFF182 H
www.DataSheet4U.com UA0REIC UA0REIF UA0REMK 0 0 0 UA0REPR2 UA0REPR1 UA0REPR0
FFFFF184 H UA0RIC UA0RIF UA0RMK 0 0 0 UA0RPR2 UA0RPR1 UA0RPR0
FFFFF186 H UA0TIC UA0TIF UA0TMK 0 0 0 UA0TPR2 UA0TPR1 UA0TPR0
FFFFF188 H UA1REIC UA1REIF UA1REMK 0 0 0 UA1REPR2 UA1REPR1 UA1REPR0
FFFFF18A H UA1RIC UA1RIF UA1RMK 0 0 0 UA1RPR2 UA1RPR1 UA1RPR0

248 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

Table 5-11 Addresses and bits of interrupt control registers (3/3)


Bit
Address Register
7 6 5 4 3 2 1 0
FFFFF18C H UA1TIC UA1TIF UA1TMK 0 0 0 UA1TPR2 UA1TPR1 UA1TPR0
FFFFF18E H IIC0IC IIC0IF IIC0MK 0 0 0 IIC0PR2 IIC0PR1 IIC0PR0
FFFFF190 H IIC1IC IIC1IF IIC1MK 0 0 0 IIC1PR2 IIC1PR1 IIC1PR0
FFFFF192 H SG0IC SG0IF SG0MK 0 0 0 SG0PR2 SG0PR1 SG0PR0
FFFFF194 H DMA0IC DMA0IF DMA0MK 0 0 0 DMA0PR2 DMA0PR1 DMA0PR0
FFFFF196 H DMA1IC DMA1IF DMA1MK 0 0 0 DMA1PR2 DMA1PR1 DMA1PR0
FFFFF198 H DMA2IC DMA2IF DMA2MK 0 0 0 DMA2PR2 DMA2PR1 DMA2PR0
FFFFF19A H DMA3IC DMA3IF DMA3MK 0 0 0 DMA3PR2 DMA3PR1 DMA3PR0
FFFFF19C H INT70IC INT70IF INT70MK 0 0 0 INT70PR2 INT70PR1 INT70PR0
FFFFF19E H INT71IC INT71IF INT71MK 0 0 0 INT71PR2 INT71PR1 INT71PR0
FFFFF1A0 H P7IC a P7IF P7MK 0 0 0 P7PR2 P7PR1 P7PR0
FFFFF1A2 H C1ERRIC C1ERRIF C1ERRMK 0 0 0 C1ERRPR2 C1ERRPR1 C1ERRPR0
FFFFF1A4 H C1WUPIC C1WUPIF C1WUPMK 0 0 0 C1WUPPR2 C1WUPPR1 C1WUPPR0
FFFFF1A6 H C1RECIC C1RECIF C1RECMK 0 0 0 C1RECPR2 C1RECPR1 C1RECPR0
FFFFF1A8 H C1TRXIC C1TRXIF C1TRXMK 0 0 0 C1TRXPR2 C1TRXPR1 C1TRXPR0
FFFFF1AA H TZ6UVIC a TZ6UVIF TZ6UVMK 0 0 0 TZ6UVPR2 TZ6UVPR1 TZ6UVPR0
FFFFF1AC H TZ7UVIC a TZ7UVIF TZ7UVMK 0 0 0 TZ7UVPR2 TZ7UVPR1 TZ7UVPR0
FFFFF1AE H TZ8UVIC a TZ8UVIF TZ8UVMK 0 0 0 TZ8UVPR2 TZ8UVPR1 TZ8UVPR0
FFFFF1B0 H TZ9UVIC a TZ9UVIF TZ9UVMK 0 0 0 TZ9UVPR2 TZ9UVPR1 TZ9UVPR0
FFFFF1B2 H TG2OV0IC TG2OV0IF TG2OV0MK 0 0 0 TG2OV0PR2 TG2OV0PR1 TG2OV0PR0
FFFFF1B4 H TG2OV1IC TG2OV1IF TG2OV1MK 0 0 0 TG2OV1PR2 TG2OV1PR1 TG2OV1PR0
FFFFF1B6 H TG2CC0IC TG2CC0IF TG2CC0MK 0 0 0 TG2CC0PR2 TG2CC0PR1 TG2CC0PR0
FFFFF1B8 H TG2CC1IC TG2CC1IF TG2CC1MK 0 0 0 TG2CC1PR2 TG2CC1PR1 TG2CC1PR0
FFFFF1BA H TG2CC2IC TG2CC2IF TG2CC2MK 0 0 0 TG2CC2PR2 TG2CC2PR1 TG2CC2PR0
FFFFF1BC H TG2CC3IC TG2CC3IF TG2CC3MK 0 0 0 TG2CC3PR2 TG2CC3PR1 TG2CC3PR0
FFFFF1BE H TG2CC4IC TG2CC4IF TG2CC4MK 0 0 0 TG2CC4PR2 TG2CC4PR1 TG2CC4PR0
FFFFF1C0 H TG2CC5IC TG2CC5IF TG2CC5MK 0 0 0 TG2CC5PR2 TG2CC5PR1 TG2CC5PR0
FFFFF1C2 H CB1REIC CB1REIF CB1REMK 0 0 0 CB1REPR2 CB1REPR1 CB1REPR0
FFFFF1C4 H CB1RIC CB1RIF CB1RMK 0 0 0 CB1RPR2 CB1RPR1 CB1RPR0
FFFFF1C6 H CB1TIC CB1TIF CB1TMK 0 0 0 CB1TPR2 CB1TPR1 CB1TPR0
FFFFF1C8 H CB2REIC a CB2REIF CB2REMK 0 0 0 CB2REPR2 CB2REPR1 CB2REPR0
FFFFF1CA H CB2RIC a CB2RIF CB2RMK 0 0 0 CB2RPR2 CB2RPR1 CB2RPR0
FFFFF1CC H CB2TIC a CB2TIF CB2TMK 0 0 0 CB2TPR2 CB2TPR1 CB2TPR0
FFFFF1CE H LCDIC LCDIF LCDMK 0 0 0 LCDPR2 LCDPR1 LCDPR0
FFFFF1D0 H C2ERRIC b C2ERRIF C2ERRMK 0 0 0 C2ERRPR2 C2ERRPR1 C2ERRPR0
FFFFF1D2 H
www.DataSheet4U.com C2WUPIC a C2WUPIF C2WUPMK 0 0 0 C2WUPPR2 C2WUPPR1 C2WUPPR0
FFFFF1D4 H C2RECIC a C2RECIF C2RECMK 0 0 0 C2RECPR2 C2RECPR1 C2RECPR0
FFFFF1D6 H C2TRXIC a C2TRXIF C2TRXMK 0 0 0 C2TRXPR2 C2TRXPR1 C2TRXPR0
a) µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427 only
b)
not available on µPD70F3426A

User’s Manual U17566EE5V1UM00 249


Chapter 5 Interrupt Controller (INTC)

Table 5-12 Addresses and bits of interrupt control registers (1/2)


Bit
Address Register
7 6 5 4 3 2 1 0
FFFFF114 H WT0UVIC WT0UVIF WT0UVMK 0 0 0 WT0UVPR2 WT0UVPR1 WT0UVPR0
FFFFF116 H WT1UVIC WT1UVIF WT1UVMK 0 0 0 WT1UVPR2 WT1UVPR1 WT1UVPR0
FFFFF11A H TM01IC TM01IF TM01MK 0 0 0 TM01PR2 TM01PR1 TM01PR0
FFFFF11C H P0IC P0IF P0MK 0 0 0 P0PR2 P0PR1 P0PR0
FFFFF11E H P1IC P1IF P1MK 0 0 0 P1PR2 P1PR1 P1PR0
FFFFF120 H P2IC P2IF P2MK 0 0 0 P2PR2 P2PR1 P2PR0
FFFFF122 H P3IC P3IF P3MK 0 0 0 P3PR2 P3PR1 P3PR0
FFFFF12A H TZ0UVIC TZ0UVIF TZ0UVMK 0 0 0 TZ0UVPR2 TZ0UVPR1 TZ0UVPR0
FFFFF12C H TZ1UVIC TZ1UVIF TZ1UVMK 0 0 0 TZ1UVPR2 TZ1UVPR1 TZ1UVPR0
FFFFF12E H TZ2UVIC TZ2UVIF TZ2UVMK 0 0 0 TZ2UVPR2 TZ2UVPR1 TZ2UVPR0
FFFFF130 H TZ3UVIC TZ3UVIF TZ3UVMK 0 0 0 TZ3UVPR2 TZ3UVPR1 TZ3UVPR0
FFFFF132 H TZ4UVIC TZ4UVIF TZ4UVMK 0 0 0 TZ4UVPR2 TZ4UVPR1 TZ4UVPR0
FFFFF134 H TZ5UVIC TZ5UVIF TZ5UVMK 0 0 0 TZ5UVPR2 TZ5UVPR1 TZ5UVPR0
FFFFF136 H TP0OVIC TP0OVIF TP0OVMK 0 0 0 TP0OVPR2 TP0OVPR1 TP0OVPR0
FFFFF138 H TP0CC0IC TP0CC0IF TP0CC0MK 0 0 0 TP0CC0PR2 TP0CC0PR1 TP0CC0PR0
FFFFF13A H TP0CC1IC TP0CC1IF TP0CC1MK 0 0 0 TP0CC1PR2 TP0CC1PR1 TP0CC1PR0
FFFFF14E H TG0OV0IC TG0OV0IF TG0OV0MK 0 0 0 TG0OV0PR2 TG0OV0PR1 TG0OV0PR0
FFFFF150 H TG0OV1IC TG0OV1IF TG0OV1MK 0 0 0 TG0OV1PR2 TG0OV1PR1 TG0OV1PR0
FFFFF152 H TG0CC0IC TG0CC0IF TG0CC0MK 0 0 0 TG0CC0PR2 TG0CC0PR1 TG0CC0PR0
FFFFF154 H TG0CC1IC TG0CC1IF TG0CC1MK 0 0 0 TG0CC1PR2 TG0CC1PR1 TG0CC1PR0
FFFFF156 H TG0CC2IC TG0CC2IF TG0CC2MK 0 0 0 TG0CC2PR2 TG0CC2PR1 TG0CC2PR0
FFFFF158 H TG0CC3IC TG0CC3IF TG0CC3MK 0 0 0 TG0CC3PR2 TG0CC3PR1 TG0CC3PR0
FFFFF15A H TG0CC4IC TG0CC4IF TG0CC4MK 0 0 0 TG0CC4PR2 TG0CC4PR1 TG0CC4PR0
FFFFF15C H TG0CC5IC TG0CC5IF TG0CC5MK 0 0 0 TG0CC5PR2 TG0CC5PR1 TG0CC5PR0
FFFFF15E H TG1OV0IC TG1OV0IF TG1OV0MK 0 0 0 TG1OV0PR2 TG1OV0PR1 TG1OV0PR0
FFFFF160 H TG1OV1IC TG1OV1IF TG1OV1MK 0 0 0 TG1OV1PR2 TG1OV1PR1 TG1OV1PR0
FFFFF162 H TG1CC0C TG1CC0IF TG1CC0MK 0 0 0 TG1CC0PR2 TG1CC0PR1 TG1CC0PR0
FFFFF164 H TG1CC1IC TG1CC1IF TG1CC1MK 0 0 0 TG1CC1PR2 TG1CC1PR1 TG1CC1PR0
FFFFF166 H TG1CC2IC TG1CC2IF TG1CC2MK 0 0 0 TG1CC2PR2 TG1CC2PR1 TG1CC2PR0
FFFFF168 H TG1CC3IC TG1CC3IF TG1CC3MK 0 0 0 TG1CC3PR2 TG1CC3PR1 TG1CC3PR0
FFFFF16A H TG1CC4IC TG1CC4IF TG1CC4MK 0 0 0 TG1CC4PR2 TG1CC4PR1 TG1CC4PR0
FFFFF16C H TG1CC5IC TG1CC5IF TG1CC5MK 0 0 0 TG1CC5PR2 TG1CC5PR1 TG1CC5PR0
FFFFF172 H ADIC ADIF ADMK 0 0 0 ADPR2 ADPR1 ADPR0
FFFFF174 H C0ERRIC C0ERRIF C0ERRMK 0 0 0 C0ERRPR2 C0ERRPR1 C0ERRPR0
FFFFF176 H C0WUPIC C0WUPIF C0WUPMK 0 0 0 C0WUPPR2 C0WUPPR1 C0WUPPR0
www.DataSheet4U.com
FFFFF178 H C0RECIC C0RECIF C0RECMK 0 0 0 C0RECPR2 C0RECPR1 C0RECPR0
FFFFF17A H C0TRXIC C0TRXIF C0TRXMK 0 0 0 C0TRXPR2 C0TRXPR1 C0TRXPR0
FFFFF17C H CB0REIC CB0REIF CB0REMK 0 0 0 CB0REPR2 CB0REPR1 CB0REPR0
FFFFF17E H CB0RIC CB0RIF CB0RMK 0 0 0 CB0RPR2 CB0RPR1 CB0RPR0
FFFFF180 H CB0TIC CB0TIF CB0TMK 0 0 0 CB0TPR2 CB0TPR1 CB0TPR0

250 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

Table 5-12 Addresses and bits of interrupt control registers (2/2)


Bit
Address Register
7 6 5 4 3 2 1 0
FFFFF182 H UA0REIC UA0REIF UA0REMK 0 0 0 UA0REPR2 UA0REPR1 UA0REPR0
FFFFF184 H UA0RIC UA0RIF UA0RMK 0 0 0 UA0RPR2 UA0RPR1 UA0RPR0
FFFFF186 H UA0TIC UA0TIF UA0TMK 0 0 0 UA0TPR2 UA0TPR1 UA0TPR0
FFFFF188 H UA1REIC UA1REIF UA1REMK 0 0 0 UA1REPR2 UA1REPR1 UA1REPR0
FFFFF18A H UA1RIC UA1RIF UA1RMK 0 0 0 UA1RPR2 UA1RPR1 UA1RPR0
FFFFF18C H UA1TIC UA1TIF UA1TMK 0 0 0 UA1TPR2 UA1TPR1 UA1TPR0
FFFFF18E H IIC0IC IIC0IF IIC0MK 0 0 0 IIC0PR2 IIC0PR1 IIC0PR0
FFFFF19C H INT70IC INT70IF INT70MK 0 0 0 INT70PR2 INT70PR1 INT70PR0
FFFFF19E H INT71IC INT71IF INT71MK 0 0 0 INT71PR2 INT71PR1 INT71PR0
FFFFF1C2 H CB1REIC CB1REIF CB1REMK 0 0 0 CB1REPR2 CB1REPR1 CB1REPR0
FFFFF1C4 H CB1RIC CB1RIF CB1RMK 0 0 0 CB1RPR2 CB1RPR1 CB1RPR0
FFFFF1C6 H CB1TIC CB1TIF CB1TMK 0 0 0 CB1TPR2 CB1TPR1 CB1TPR0

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 251


Chapter 5 Interrupt Controller (INTC)

5.3.5 IMR0 to IMR6 - Interrupt mask registers

These registers set the interrupt mask state for the maskable interrupts.
The xxMK bit of the IMRm (m = 0 to 6) registers is equivalent to the xxMK bit of
the xxIC register.

Caution IMask bits without function, indicated with “1”, must not be altered. Make sure
to set them “1” when writing to the register.

Access These registers can be read/written in 16-bit and 8-bit units.


The address of the lower 8-bit register IMRmL is equal to that of the 16-bit
IMRm register, and the higher 8-bit register IMRmH can be accessed on the
following address (address (IMRm) + 1).
Address IMR0, IMR0L: FFFF F100H IMR0H: FFFF F101H
IMR1, IMR1L: FFFF F102H IMR0H: FFFF F101H
IMR2, IMR2L: FFFF F104H IMR0H: FFFF F101H
IMR3, IMR3L: FFFF F106H IMR0H: FFFF F101H
IMR4, IMR4L: FFFF F108H IMR0H: FFFF F101H
IMR5, IMR5L: FFFF F10AH IMR0H: FFFF F101H
IMR6, IMR6L: FFFF F10CH IMR0H: FFFF F101H

Initial Value FFFFH

15 14 13 12 11 10 9 8
IMR0 TZ2UVMK TZ1UVMK TZ0UVMK P6MK P5MK P4MK P3MK P2MK
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
P1MK P0MK TM01MK 1 WT1UVMK WT0UVMK VC1MK VC0MK
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
IMR1 TG0OV0MK TP3CC1MK TP3CC0MK TP3OVMK TP2CC1MK TP2CC0MK TP2OVMK TP1CC1MK
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
TP1CC0MK TP1OVMK TP0CC1MK TP0CC0MK TP0OVMK TZ5UVMK TZ4UVMK TZ3UVMK
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
IMR2 TY0UV0MK TG1CC5MK TG1CC4MK TG1CC3MK TG1CC2MK TG1CC1MK TG1CC0MK TG1OV1MK
www.DataSheet4U.com
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
TG1OV0MK TG0CC5MK TG0CC4MK TG0CC3MK TG0CC2MK TG0CC1MK TG0CC0MK TG0OV1MK
R/W R/W R/W R/W R/W R/W R/W R/W

252 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

7 6 5 4 3 2 1 0
IMR3 IIC0MK UA1TMK UA1RMK UA1REMK UA0TMK UA0RMK UA0REMK CB0TMK
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
CB0RMK CB0REMK C0TRXMK C0RECMK C0WUPMK C0ERRMK ADMK TY0UV1MK
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
IMR4 TZ8UVMK TZ7UVMK TZ6UVMK C1TRXMK C1RECMK C1WUPMK C1ERRMK P7MK
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
INT71MK INT70MK DMA3MK DMA2MK DMA1MK DMA0MK SG0MK IIC1MK
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
IMR5 LCDMK CB2TMK CB2RMK CB2REMK CB1TMK CB1RMK CB1REMK TG2CC5MK
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
TG2CC4MK TG2CC3MK TG2CC2MK TG2CC1MK TG2CC0MK TG2OV1MK TG2OV0MK TZ9UVMK
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
IMR6 1 1 1 1 1 1 1 1
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
1 1 1 1 C2TRXMK C2RECMK C2WUPMK C2ERRMK
R/W R/W R/W R/W R/W R/W R/W R/W

For µPD70F3421, µPD70F3422, µPD70F3423 only:

7 6 5 4 3 2 1 0
IMR4 1 1 1 C1TRXMK C1RECMK C1WUPMK C1ERRMK 1
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
INT71MK INT70MK DMA3MK DMA2MK DMA1MK DMA0MK SG0MK IIC1MK
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
IMR5 LCDMK 1 1 1 CB1TMK CB1RMK CB1REMK TG2CC5MK
www.DataSheet4U.com
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
TG2CC4MK TG2CC3MK TG2CC2MK TG2CC1MK TG2CC0MK TG2OV1MK TG2OV0MK 1
R/W R/W R/W R/W R/W R/W R/W R/W

User’s Manual U17566EE5V1UM00 253


Chapter 5 Interrupt Controller (INTC)

For µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427 only:

7 6 5 4 3 2 1 0
IMR4 TZ8UVMK TZ7UVMK TZ6UVMK C1TRXMK C1RECMK C1WUPMK C1ERRMK P7MK
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
INT71MK INT70MK DMA3MK DMA2MK DMA1MK DMA0MK SG0MK IIC1MK
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
IMR5 LCDMK CB2TMK CB2RMK CB2REMK CB1TMK CB1RMK CB1REMK TG2CC5MK
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
TG2CC4MK TG2CC3MK TG2CC2MK TG2CC1MK TG2CC0MK TG2OV1MK TG2OV0MK TZ9UVMK
R/W R/W R/W R/W R/W R/W R/W R/W

For µPD70F3421, µPD70F3422, µPD70F3423, µPD70F3424, µPD70F3425,


µPD70F3427 only:

7 6 5 4 3 2 1 0
IMR6 1 1 1 1 1 1 1 1
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
1 1 1 1 C2TRXMK C2RECMK C2WUPMK C2ERRMK
R/W R/W R/W R/W R/W R/W R/W R/W

Bit position Bit name Function


15 to 0 xxMK Interrupt mask flag.
0: Interrupt servicing enabled
1: Interrupt servicing disabled (pending)

Note xx: identification name of each peripheral unit (VC0-VC1, WT0UV-WT1UV,


TM01, P0-P7, TZ0UV-TZ9UV, TP0OV-TP3OV, TP0CC0-TP3CC0, TP0CC1-
TP3CC1, TG0OV0-TG2OV0, TG0OV1-TG2OV1, TG0CC0-TG2CC0,
TG0CC1-TG2CC1, TG0CC2-TG2CC2, TG0CC3-TG2CC3, TG0CC4-
TG2CC4, TG0CC5-TG2CC5, TY0CC0, TY0CC1, ADC0ERR-C2ERR,
C0WUP-C2WUP, C0REC-C2REC, C0TRX-C2TRX, CB0RE-CB2RE, CB0R-
CB2R, CB0T-CB2T, UA0RE-UA1RE, UA0R-UA1R, UA0T-UA1T, IIC0-IIC1,
SG0, DMA0-DMA3, INT70, INT71, LCD)

www.DataSheet4U.com

254 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

5.3.6 ISPR - In-service priority register

This register holds the priority level of the maskable interrupt currently
acknowledged. When an interrupt request is acknowledged, the bit of this
register corresponding to the priority level of that interrupt request is set to 1
and remains set while the interrupt is serviced.
When the RETI instruction is executed, the bit corresponding to the interrupt
request having the highest priority is automatically reset to 0 by hardware.
However, it is not reset to 0 when execution is returned from non-maskable
interrupt servicing or exception processing.
This register is read-only in 8-bit or 1-bit units.
This register can be read/written in 8-bit or 1-bit units.
Address FFFF F19AH
Initial Value 00H

7 6 5 4 3 2 1 0
ISPR7 ISPR6 ISPR5 ISPR4 ISPR3 ISPR2 ISPR1 ISPR0
R/W R/W R/W R/W R/W R/W R/W R/W

Bit position Bit name Function


7 to 0 ISPR7 to Indicates priority of interrupt currently acknowledged
ISPR0 0: Interrupt request with priority n not acknowledged
1: Interrupt request with priority n acknowledged

Note n = 0 to 7 (priority level)

5.3.7 Maskable interrupt status flag (ID)

The ID flag is bit 5 of the PSW and this controls the maskable interrupt’s
operating state, and stores control information regarding enabling or disabling
of interrupt requests.
Initial Value 0000 0020H. The program status is initialized by any reset.

31 8 7 6 5 4 3 2 1 0
fixed to 0 NP EP ID SAT CY OV S Z
R R R/W R/W R/W R/W R/W R/W R/W R/W

Bit position Bit name Function


5 ID Indicates whether maskable interrupt processing is enabled or disabled.
0: Maskable interrupt request acknowledgement enabled
1: Maskable interrupt request acknowledgement disabled (pending)
This bit is set to 1 by the DI instruction and reset to 0 by the EI instruction. Its value
is also modified by the RETI instruction or LDSR instruction when referencing to
www.DataSheet4U.com PSW.
Non-maskable interrupt requests and exceptions are acknowledged regardless of
this flag. when a maskable interrupt is acknowledged, the ID flag is automatically
set to 1 by hardware.
The interrupt request generated during the acknowledgement disabled period
(ID = 1) is acknowledged when the PIFn bit of PICn register is set to 1, and the ID
flag is reset to 0.

User’s Manual U17566EE5V1UM00 255


Chapter 5 Interrupt Controller (INTC)

5.3.8 External maskable interrupts

This microcontroller provides maskable external interrupts INTPn with the


following features:
• Analog input filter (refer to “Analog filtered inputs“ on page 104)
• Interrupt detection selectable for each interrupt input:
– Rising edge
– Falling edge
– Both edges: rising and falling edge
– High level
– Low level
• Wakeup capability from stand-by mode of INTPn upon
– Rising edge
– Falling edge
– Both edges: rising and falling edge
For configuration of the external interrupt events refer to “Edge and Level
Detection Configuration“ on page 257.

5.3.9 Software interrupts

This microcontroller provides maskable software interrupts to for processing of


an interrupt service routine by the application software.
For initiating a software interrupt the interrupt request flag xxIC.xxIF of the
concerned software interrupt “xx” must be set to 1. The following processing is
identical to that of all other maskable interrupts.

www.DataSheet4U.com

256 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

5.4 Edge and Level Detection Configuration

The microcontroller provides the maskable external interrupts INTPn and one
non-maskable interrupt (NMI).
INTPn can be configured to generate interrupts upon edges or levels, the NMI
can be set up to react on edges.

(1) INTM0 to INTM3 - External interrupt configuration register


External interrupt function is configured by the registers INTM0…INTM3.
Access These registers can be read/written in 8-bit and 1-bit units.
Address INTM0: FFFF F700H
INTM1: FFFF F702H
INTM2: FFFF F704H
INTM3: FFFF F706H
Initial Value 00H

7 6 5 4 3 2 1 0
INTM0 0 ELSEL1 ESEL11 ESEL10 NMIEN ELSEL0 ESEL01 ESEL00
R R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
INTM1 0 ELSEL3 ESEL31 ESEL30 0 ELSEL2 ESEL21 ESEL20
R R/W R/W R/W R R/W R/W R/W

7 6 5 4 3 2 1 0
INTM2 0 ELSEL5 ESEL51 ESEL50 0 ELSEL4 ESEL41 ESEL40
R R/W R/W R/W R R/W R/W R/W

7 6 5 4 3 2 1 0
INTM3 0 ELSEL7 ESEL71 ESEL70 0 ELSEL6 ESEL61 ESEL60
R R/W R/W R/W R R/W R/W R/W

The register bits ELSELn, ESELn1 and ESELn0 configure the INTPn interrupt
function:

ELSELn ESELn1 ESELn0 Function


0 0 0 falling edge
0 0 1 rising edge
0 1 0 prohibited to use
0 1 1 falling and rising edge
www.DataSheet4U.com 1 0 0 low level detection
1 0 1 high level detection
1 1 0 low level detection
1 1 1 high level detection

User’s Manual U17566EE5V1UM00 257


Chapter 5 Interrupt Controller (INTC)

The NMI and INTP0 share the same pin. The register bits NMIEN, ESEL0,
ESEL01 and ESEL00 configure the NMI and INTP0 interrupt function:

Function
NMIEN ESEL0 ESEL01 ESEL00
NMI INTP0
0 0 0 falling edge
0 0 1 rising edge
0 1 0 prohibited
0 1 1 both edges
0 masked
1 0 0 low level
1 0 1 high level
1 1 0 low level
1 1 1 high level
0 0 0 falling edge falling edge
0 0 1 rising edge rising edge
0 1 0 prohibited prohibited
0 1 1 both edges both edges
1
1 0 0 falling edge low level
1 0 1 rising edge high level
1 1 0 prohibited low level
1 1 1 both edges high level

Caution The NMI configuration bits INTM0.NMIEN and INTM0.ESEL0[1:0] can only be
changed if INTM0.NMIEN = 0.
Due to INTM0.NMIEN = 0 after reset the NMI function is disabled and must be
enabled by the application software. Once enabled, the NMI function cannot be
disabled by software.
Specify INTM0.ESEL0[1:0] before or at the same time with setting
INTM0.NMIEN = 1.
Note that INTM0.ESEL0 can be written independently of INTM0.NMIEN.

www.DataSheet4U.com

258 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

5.5 Software Exception

A software exception is generated when the CPU executes the TRAP


instruction, and can be always acknowledged.

5.5.1 Operation

If a software exception occurs, the CPU performs the following processing, and
transfers control to the handler routine:
(1) Saves the restored PC to EIPC.

(2) Saves the current PSW to EIPSW.


(3) Writes an exception code to the lower 16 bits (EICC) of ECR (interrupt
source).

(4) Sets the EP and ID bits of the PSW.


(5) Sets the handler address (00000040H or 00000050H) corresponding to
the software exception to the PC, and transfers control.

Figure 5-10 illustrates the processing of a software exception.

TRAP instructionNote

EIPC restored PC
EIPSW PSW
ECR.EICC exception code
CPU processing PSW.EP 1
PSW.ID 1
PC handler address

Exception processing

Figure 5-10 Software exception processing

Note TRAP Instruction Format: TRAP vector (the vector is a value from 0 to 1FH.)

www.DataSheet4U.com The handler address is determined by the TRAP instruction’s operand (vector).
If the vector is 0 to 0FH, it becomes 00000040H, and if the vector is 10H to 1FH,
it becomes 00000050H.

User’s Manual U17566EE5V1UM00 259


Chapter 5 Interrupt Controller (INTC)

5.5.2 Restore

Recovery from software exception processing is carried out by the RETI


instruction.
By executing the RETI instruction, the CPU carries out the following
processing and shifts control to the restored PC’s address.
(1) Loads the restored PC and PSW from EIPC and EIPSW because the EP
bit of the PSW is 1.

(2) Transfers control to the address of the restored PC and PSW.

Figure 5-11 illustrates the processing of the RETI instruction.

RETI instruction

1
PSW.EP

1
PSW.NP

PC EIPC PC FEPC
PSW EIPSW PSW FEPSW

Original processing restored

Figure 5-11 RETI instruction processing

Caution When the PSW.EP bit and the PSW.NP bit are changed by the LDSR
instruction during the software exception processing, in order to restore the PC
and PSW correctly during recovery by the RETI instruction, it is necessary to
set PSW.EP back to 1 using the LDSR instruction immediately before the RETI
instruction.

www.DataSheet4U.com Note The solid lines show the CPU processing flow.

260 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

5.5.3 Exception status flag (EP)

The EP flag is bit 6 of PSW, and is a status flag used to indicate that exception
processing is in progress. It is set when an exception occurs.
Initial Value 0000 0020H. The program status is initialized by any reset.

31 8 7 6 5 4 3 2 1 0
fixed to 0 NP EP ID SAT CY OV S Z
R R R/W R/W R/W R/W R/W R/W R/W R/W

Bit position Bit name Function


6 EP Shows that exception processing is in progress.
0: Exception processing not in progress.
1: Exception processing in progress.

5.6 Exception Trap

An exception trap is an interrupt that is requested when an illegal execution of


an instruction takes place. For this microcontroller, an illegal opcode exception
(ILGOP: Illegal Opcode Trap) is considered as an exception trap.

5.6.1 Illegal opcode definition

The illegal instruction has an opcode (bits 10 to 5) of 111111B, a sub-opcode


(bits 23 to 26) of 0111B to 1111B, and a sub-opcode (bit 16) of 0B. An
exception trap is generated when an instruction applicable to this illegal
instruction is executed.

31 27 26 23 22 16 15 11 10 5 4 0

0 1 1 1
× × × × × to × × × × × × 0 × × × × × 1 1 1 1 1 1 × × × × ×
1 1 1 1

Note ×: Arbitrary

(1) Operation
If an exception trap occurs, the CPU performs the following processing, and
transfers control to the handler routine:
(1) Saves the restored PC to DBPC.
(2) Saves the current PSW to DBPSW.
www.DataSheet4U.com
(3) Sets the NP, EP, and ID bits of the PSW.

(4) Sets the handler address (00000060H) corresponding to the exception


trap to the PC, and transfers control.
Figure 5-12 illustrates the processing of the exception trap.

User’s Manual U17566EE5V1UM00 261


Chapter 5 Interrupt Controller (INTC)

Exception trap (ILGOP) occurs

DBPC restored PC
DBPSW PSW
PSW.NP 1
PSW.EP 1
CPU processing
PSW.ID 1
PC 00000060H

Exception processing

Figure 5-12 Exception trap processing

(2) Restore
Recovery from an exception trap is carried out by the DBRET instruction. By
executing the DBRET instruction, the CPU carries out the following processing
and controls the address of the restored PC.
(1) Loads the restored PC and PSW from DBPC and DBPSW.
(2) Transfers control to the address indicated by the restored PC and PSW.
Figure 5-13 illustrates the restore processing from an exception trap.

DBRET instruction

PC DBPC
PSW DBPSW

Jump to address of restored PC

Figure 5-13
www.DataSheet4U.com Restore processing from exception trap

262 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

5.6.2 Debug trap

The debug trap is an exception that can be acknowledged every time and is
generated by execution of the DBTRAP instruction.
When the debug trap is generated, the CPU performs the following processing.

(1) Operation
When the debug trap is generated, the CPU performs the following processing,
transfers control to the debug monitor routine, and shifts to debug mode.
(1) Saves the restored PC to DBPC.

(2) Saves the current PSW to DBPSW.

(3) Sets the NP, EP and ID bits of the PSW.

(4) Sets the handler address (00000060H) corresponding to the debug trap
to the PC and transfers control.

Figure 5-14 illustrates the processing of the debug trap.

DBTRAP instruction

DBPC restored PC
DBPSW PSW
PSW.NP 1
CPU processing PSW.EP 1
PSW.ID 1
PC 00000060H

Exception processing

Figure 5-14 Debug trap processing

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 263


Chapter 5 Interrupt Controller (INTC)

(2) Restore
Recovery from a debug trap is carried out by the DBRET instruction. By
executing the DBRET instruction, the CPU carries out the following processing
and controls the address of the restored PC.
(1) Loads the restored PC and PSW from DBPC and DBPSW.
(2) Transfers control to the address indicated by the restored PC and PSW.
Figure 5-15 illustrates the restore processing from a debug trap.

DBRET instruction

PC DBPC
PSW DBPSW

Jump to address of restored PC

Figure 5-15 Restore processing from debug trap

5.7 Multiple Interrupt Processing Control

Multiple interrupt processing control is a process by which an interrupt request


that is currently being processed can be interrupted during processing if there
is an interrupt request with a higher priority level, and the higher priority
interrupt request is received and processed first.
If there is an interrupt request with a lower priority level than the interrupt
request currently being processed, that interrupt request is held pending.
Maskable interrupt multiple processing control is executed when an interrupt
has an enable status (ID = 0). Thus, if multiple interrupts are executed, it is
necessary to have an interrupt enable status (ID = 0) even for an interrupt
processing routine.
If a maskable interrupt enable or a software exception is generated in a
maskable interrupt or software exception service program, it is necessary to
save EIPC and EIPSW.
This is accomplished by the following procedure.

www.DataSheet4U.com

264 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

(1) Acknowledgment of maskable interrupts in service program


Service program of maskable interrupt or exception

...
...
• EIPC saved to memory or register
• EIPSW saved to memory or register
• EI instruction (interrupt acknowledgment enabled)
...
...
Higher priority maskable interrupt
acknowledgment
...
...
• DI instruction (interrupt acknowledgment disabled)
• Saved value restored to EIPSW
• Saved value restored to EIPC
• RETI instruction

(2) Generation of exception in service program


Service program of maskable interrupt or exception

...
...
• EIPC saved to memory or register
• EIPSW saved to memory or register
...
• TRAP instruction
...
TRAP/exception acknowledgment
...
...
• Saved value restored to EIPSW
• Saved value restored to EIPC
• RETI instruction

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 265


Chapter 5 Interrupt Controller (INTC)

The priority order for multiple interrupt processing control has 8 levels, from 0
to 7 for each maskable interrupt request (0 is the highest priority), but it can be
set as desired via software. Setting of the priority order level is done using the
PPRn0 to PPRn2 bits of the interrupt control request register (PlCn), which is
provided for each maskable interrupt request. After system reset, an interrupt
request is masked by the PMKn bit and the priority order is set to level 7 by the
PPRn0 to PPRn2 bits.
The priority order of maskable interrupts is as follows.
(High) Level 0 > Level 1 > Level 2 > Level 3 > Level 4 >
Level 5 > Level 6 > Level 7 (Low)

Interrupt processing that has been suspended as a result of multiple


processing control is resumed after the processing of the higher priority
interrupt has been completed and the RETI instruction has been executed.
A pending interrupt request is acknowledged after the current interrupt
processing has been completed and the RETI instruction has been executed.

Caution In a non-maskable interrupt processing routine (time until the RETI instruction
is executed), maskable interrupts are suspended and not acknowledged.

5.8 Interrupt Response Time

The following table describes the interrupt response time (from interrupt
generation to start of interrupt processing).
Except in the following cases, the interrupt response time is a minimum of 5
clocks.
• During software or hardware STOP mode
• When an external bus is accessed
• When there are two or more successive interrupt request non-sampling
instructions (see “Periods in Which Interrupts Are Not Acknowledged“ on
page 267).
• When the interrupt control register is accessed

www.DataSheet4U.com

266 User’s Manual U17566EE5V1UM00


Interrupt Controller (INTC) Chapter 5

5 system clocks

VBCLK (Input)

Interrupt request

Instruction 1 IF ID EX MEM WB
Instruction 2 IFX IDX
Interrupt acknowledgement operation INT1 INT2 INT3 INT4
Instruction (first instruction of IF ID EX
interrupt service routine)

Figure 5-16 Pipeline operation at interrupt request acknowledgment (outline)

Note INT1 to INT4: Interrupt acknowledgement processing


IFx: Invalid instruction fetch
IDx: Invalid instruction decode

Note If the same interrupt occures during the interrupt acknowledge time of 5 cycles,
this new interrupt will discarded. The next interrupt of the same source will only
be registered after these 5 cycles.

Table 5-13 Interrupt response time


Interrupt response time (internal system clocks)
Condition
Internal interrupt External interrupt
Minimum 5 5 + analog delay time The following cases are exceptions:
• In IDLE/software STOP mode
• External bit access
Maximum 11 11 + analog delay time • Two or more interrupt request non-
sample instructions are executed
• Access to interrupt control register

5.9 Periods in Which Interrupts Are Not Acknowledged

An interrupt is acknowledged while an instruction is being executed. However,


no interrupt will be acknowledged between an interrupt non-sample instruction
and the next instruction.
The interrupt request non-sampling instructions are as follows:
• EI instruction
• DI instruction
www.DataSheet4U.com • LDSR reg2, 0x5 instruction (for PSW)
• The store instruction for the maskable interrupt control registers (xxIC), in-
service priority register (ISPR), and command register (PRCMD).

User’s Manual U17566EE5V1UM00 267


Chapter 5 Interrupt Controller (INTC)

www.DataSheet4U.com

268 User’s Manual U17566EE5V1UM00


Chapter 6 Flash Memory

The µPD70F3421, µPD70F3422, µPD70F3423, µPD70F3424, µPD70F3425,


µPD70F3426A and µPD70F3427 microcontrollers are equipped with internal
flash memory. The flash memory is attached to the V850 Fetch Bus (VFB)
interface of the V850E CPU core, or in case of more than 1 MB flash memory
for the µPD70F3426A additionally to the V850 System Bus (VSB). It is used for
program code and storage of constant data.

When fetching an instruction, 4 bytes of the VFB flash memory can be


accessed in 1 clock, and 4 bytes of the VSB flash memory can be accessed in
2 clocks.

The flash memory can be written mounted on the target board (on-board
write), by connecting a dedicated flash programmer to the target system.
Flash memory is commonly used in the following development environments
and applications:
• For altering software after solder-mounting of the microcontroller on the
target system.
• For differentiating software in small-scale production of various models.
• For data adjustment when starting mass production.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 269


Chapter 6 Flash Memory

6.1 Overview

Features summary • Internal VFB flash memory:


– µPD70F3427, µPD70F3426A, µPD70F3425: 1 MB
– µPD70F3424, µPD70F3423: 512 KB
– µPD70F3422: 384 KB
– µPD70F3421: 256 KB
• Internal VSB flash memory:
– µPD70F3426A: 1 MB
• µPD70F3427, µPD70F3425, µPD70F3424 operation speed:
up to 67.2 MHz by 2-way interleaved access
– 4-byte/1 CPU clock cycle access for consecutive instruction fetches
– 4-byte/4 CPU clock cycles access for random instruction and data fetches
• µPD70F3426A operation speed :
up to 67.2 MHz by 2-way interleaved access
Internal VFB flash memory:
– 4-byte/1 CPU clock cycle access for consecutive instruction fetches
– 4-byte/4 CPU clock cycles access for random instruction and data fetches
Internal VSB flash memory:
– 4-byte/2 CPU clock cycle access for consecutive instruction fetches
– 4-byte/5 CPU clock cycles access for random instruction and data fetches
• µPD70F3423, µPD70F3422, µPD70F3421 operation speed:
up to 25.2 MHz by 2-way interleaved access
– 4-byte/1 CPU clock cycle access for consecutive instruction fetches
– 4-byte/3 CPU clock cycles access for random instruction and data fetches
• All-blocks batch erase or single block erase
• Erase/write with single power supply
• Communication with dedicated flash programmer via various serial
interfaces
• On-board and off-board programming
• Flash memory programming by self-programming

www.DataSheet4U.com

270 User’s Manual U17566EE5V1UM00


Flash Memory Chapter 6

6.1.1 Flash memory address assignment

The 1 MB VFB flash memory of µPD70F3427, µPD70F3426A, and


µPD70F3425 is made up of 256 blocks. Figure 6-1 shows the address
assignment of the flash memory blocks.

0010 0000H
Block 255 (4 KB)
000F F000 H
Block 254 (4 KB)
000F E000H

0000 2000H
Block 1 (4 KB)
0000 1000H
Block 0 (4 KB)
0000 0000H

Figure 6-1 Address assignment of µPD70F3427, µPD70F3426A, and µPD70F3425


flash memory blocks

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 271


Chapter 6 Flash Memory

The 512 KB flash memory of µPD70F3424, and µPD70F3423 is made up of


128 blocks. Figure 6-2 shows the address assignment of the flash memory
blocks.

0008 0000H
Block 127 (4 KB)
0007 F000 H
Block 126 (4 KB)
0007 E000H

0000 2000H
Block 1 (4 KB)
0000 1000H
Block 0 (4 KB)
0000 0000H

Figure 6-2 Address assignment of µPD70F3424, and µPD70F3423 flash memory


blocks

The 384 KB flash memory of µPD70F3422 is made up of 96 blocks. Figure 6-3


shows the address assignment of the flash memory blocks.

0006 0000H
Block 95 (4 KB)
0005 F000H
Block 94 (4 KB)
0005 E000H

0000 2000H
Block 1 (4 KB)
0000 1000H
www.DataSheet4U.com Block 0 (4 KB)
0000 0000H

Figure 6-3 Address assignment of µPD70F3422 flash memory blocks

272 User’s Manual U17566EE5V1UM00


Flash Memory Chapter 6

The 256 KB flash memory of µPD70F3421 is made up of 64 blocks. Figure 6-4


shows the address assignment of the flash memory blocks.

0004 0000H
Block 63 (4 KB)
0003 F000H
Block 62 (4 KB)
0003 E000H

0000 2000H
Block 1 (4 KB)
0000 1000H
Block 0 (4 KB)
0000 0000H

Figure 6-4 Address assignment of µPD70F3421 flash memory blocks

6.1.2 Flash memory erasure and rewrite

The following functions can be carried out by use of the flash memory self-
programming library.

(1) Flash memory erasure


According to it’s block structure the flash memory can be erased in two
different modes.
• All-blocks batch erasure
Following areas can be erased all together:
– µPD70F3427, µPD70F3426A, µPD70F3425: 0000 0000H to 000F FFFFH
– µPD70F3424, µPD70F3423: 0000 0000H to 0007 FFFFH
– µPD70F3422: 0000 0000H to 0005 FFFFH
– µPD70F3421: 0000 0000H to 0003 FFFFH
• Block erasure
Each 4 KB flash memory block can be erased separately.

(2) Flash memory rewrite


www.DataSheet4U.com Once a complete block has been erased it can be rewritten in units of 8 byte.
Each unit can be rewritten only once after erasure of the complete block.

User’s Manual U17566EE5V1UM00 273


Chapter 6 Flash Memory

6.1.3 Flash memory programming

The internal flash memory can be programmed in three different ways:


• Programming via self-programming
• Programming via N-Wire interface
• Programming with external flash programmer
While the self-programming mode can be initiated from the normal operation
mode the external flash programmer mode is entered immediately after
release of a system reset. Refer to “Operation Modes“ on page 125 for details
on how to enter normal operation or external flash programming mode.

6.1.4 Boot block swapping

The microcontrollers with flash memory support secure boot block swapping.
This will swap two 32 KB blocks at the bottom end (starting from address
0000 0000H) of the Flash Memory. The block size is fixed and can not be
changed.
For comprehensive information concerning secure boot block swapping refer
to the application note “Self-Programming” (document nr. U16929EE), which
explains also the functions of the self-programming library. The latest version
of this document can be loaded via the URL
http://www.eu.necel.com/updates

www.DataSheet4U.com

274 User’s Manual U17566EE5V1UM00


Flash Memory Chapter 6

6.2 Flash Self-Programming

The internal flash memory can be programmed via the secure self-program-
ming facility. This feature enables the user’s application to re-program the flash
memory. The self-programming functions are part of the internal firmware,
which resides in an extra internal ROM. The user’s application can call the self-
programming functions via the self-programming library, provided by NEC.

Caution During self-programming make sure to disable all ROM correction facilities, as
enabled ROM corrections may conflict with the internal firmware.

Start of self- The self-programming functions can be started out of the normal user mode of
programming the microcontroller.
Self-programming must be in particular enabled in order to avoid unintended
re-programming of the flash. Two ways to enable self-programming are
provided:
• by setting the external FLMD0 pin to high level
This requires some external components or wiring, e.g. connecting an
output port to FLMD0.
• by setting an internal register bit
This way does not need any special external components or wiring.
The following registers are used to enable self-programming internally by
software.

6.2.1 Flash self-programming registers

For safety reasons flash self-programming needs to be explicitly enabled by


use of two registers:

Table 6-1 Flash self-programming enable register overview


Register name Shortcut Address
Self-programming enable control register SELFEN FFFF FCA0H
Self-programming enable protection register SELFENP FFFF FCA8H

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 275


Chapter 6 Flash Memory

(1) SELFEN - Self-programming enable control register


The 8-bit SELFEN register enables the self-programming functions by
software. It is an internal substitute to enabling self-programming by rising the
FLMD0 pin to high level.
Access This registers can be read/written in 8-bit or 1-bit units.

Writing to this register is protected by a special sequence of instructions.


Please refer to “SELFENP - Self-programming enable protection register“ on
page 276 for details.
Address FFFF FCA0H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 FLEN
R R R R R R R R/W

Bit position Bit name Function


0 FLEN Enable self-programming
0: Flash write/erase function is controlled by the
FLMD0 pin
1: Flash write/erase function is enabled

(2) SELFENP - Self-programming enable protection register


The 8-bit SELFENP register protects the register SELFEN from inadvertent
write access, so that the system does not stop in case of a program hang-up.
After data has been written to the SELFENP register, the first write access to
register SELFEN is valid. All subsequent write accesses are ignored. Thus, the
value of SELFEN can only be rewritten in a specified sequence, and illegal
write access is inhibited.
Access This registers can be written in 8-bit units.
Address FFFF FCA8H
Initial Value The contents of this register is undefined.
7 6 5 4 3 2 1 0
X X X X X X X X
W W W W W W W W

Caution In case a high level programming language is used, make sure that the
compiler translates the two write instructions to SELFENP and SELFEN into
two consecutive assembler “store” instructions.

w w w . D a t a S h e e t 4 U . c o m
Peripherals and All peripheral functions of the microcontroller continue operation during the
pin functions self-programming process. Further the functions of all pins do not change.

276 User’s Manual U17566EE5V1UM00


Flash Memory Chapter 6

6.2.2 Interrupt handling during flash self-programming

This microcontroller provides functions to maintain interrupt servicing during


the self-programming procedure.
It is recommended to refer to the application note “Self-Programming”
(document nr. U16929EE) for comprehensive information concerning flash
self-programming, which explains also the functions of the self-programming
library. The latest version of this document can be loaded via the URL
http://www.ee.nec.de/updates

Since neither the interrupt vector table nor the interrupt handler routines, which
are normally located in the flash memory, are accessible during self-
programming, interrupt acknowledges have to be re-routed to non-flash
memory, i.e. to the internal RAM or - for µPD70F3427 only - to the external
memory.
Therefore two prerequisites are necessary to enable interrupt servicing during
self-programming:
• The concerned interrupt handler routine needs to be copied to the internal
RAM, respectively external memory.
• The concerned interrupt acknowledge has to be re-routed to that handler.
The internal firmware and the self-programming library provide functions to
initialize and process such interrupts.
The interrupt handler routines can be copied from flash to the internal RAM,
respectively external memory, by use of the SelfLib_UsrIntToRam self-
programming library function.
The addresses of the interrupt handler routines are set up via the
SelfLib_RegisterInt self-programming library function.

Note 1. Note that this special interrupt handling adds some interrupt latency time.
2. Special interrupt handling is done only during the flash programming
environment is activated. If self-programming is deactivated, the normal
interrupt vector table in the flash memory is used.
All interrupt vectors are relocated to one entry point in the internal RAM:
• New entry point of all maskable interrupts is the 1st address of the internal
RAM. A handler routine must check the interrupt source. The interrupt
request source can be identified via the interrupt/exception source register
ECR.EICC (refer to “System register set“ on page 118)
• New entry point of all non maskable interrupts is the word address following
the maskable interrupt entry, i.e. the second address of the internal RAM.
The interrupt request source can be identified via the interrupt/exception
source register ECR.FECC (refer to“System register set“ on page 118).
In general a jump to a special handler routine will be placed at the 1st and 2nd
internal RAM address, which identifies the interrupt sources and branches to
the correct interrupt service routine.
www.DataSheet4U.com The function serving the interrupt needs to be compiled as an interrupt function
(i.e. terminate with a RETI instruction, save/restore all used registers, etc.).

User’s Manual U17566EE5V1UM00 277


Chapter 6 Flash Memory

6.3 Flash Programming via N-Wire

The microcontroller’s flash memory is programmable via the N-Wire debug


interface.
Programming of the flash memory can be performed by the debug tool running
on the host machine.

Caution Programming the flash memory during debug sessions by the debug tool adds
to the performed number of write/erase cycles of the flash memory.
Thus devices used for debugging shall not be used for mass production
purposes afterwards.

www.DataSheet4U.com

278 User’s Manual U17566EE5V1UM00


Flash Memory Chapter 6

6.4 Flash Programming with Flash Programmer

A dedicated flash programmer can be used for on-board or off-board writing of


the flash memory.

(1) On-board programming


The contents of the flash memory can be rewritten with the microcontroller
mounted on the target system. Mount a connector that connects the flash
programmer on the target system.
A CSI or a UART interface can optionally be used for the communication
between the external flash programmer and the V850 microcontroller.
All signals, including clock and power supply, can be provided by the external
flash programmer. However, an on-board clock to the X1 input may be used
instead of the clock, provided by the flash programmer.

(2) Off-board programming


The flash memory of the microcontroller can be written before the device is
mounted on the target system, by using a dedicated program adapter
(FA series).
All signals, including clock and power supply, are provided by the external flash
programmer.

Note The FA series is a product of Naito Densei Machida Mfg. Co., Ltd.

6.4.1 Programming environment

The necessary environment to write a program to the flash memory of the


microcontroller is shown below.

FLMD0 (FLMD1Note)
Axxxx VDD
XXXXXX

RS-232-C
XXXX YYYY

Bxxxxx
XXXX

Cxxxxxx

STAT VE
XXX YYY

XXXXX

USB
PG-FP4 (Flash Pro4)
VSS
RESET
flash programmer V850
UART/CSIB microcontroller
Host machine
HS

Note: FLMD1 connection may be replaced by a pull-down resistor on the board

Figure 6-5 Environment to write program to flash memory


www.DataSheet4U.com
A host machine is required for controlling the flash programmer.
Following microcontroller serial interfaces can be used as the interface
between the flash programmer and the microcontroller:
• asynchronous serial interface UART
• clocked serial interface CSIB

User’s Manual U17566EE5V1UM00 279


Chapter 6 Flash Memory

If the CSIB interface is used with handshake, the flash programmer’s HS signal
is connected to a certain V850 port. The port used as the handshake port is
given in Table 6-2.
Flash memory programming off-board requires a dedicated program adapter.
UARTA0 or CSIB0 is used as the interface between the flash programmer and
the microcontroller. Flash memory programming off-board requires a
dedicated program adapter (FA series).

6.4.2 Communication mode

The communication between the flash programmer and the microcontroller


utilizes the Asynchronous Serial Interface UARTA0 or the synchronous serial
interface CSIB0.
For programming via the synchronous serial interface CSIB0 without
handshake and with handshake modes are supported. In the latter mode the
port pin P84 is used for the programmer’s handshake signal HS.

(1) UARTA0
Transfer rate: 4.800 to 153.600 bps

FLMD0 (FLMD1Note) FLMD0 (FLMD1Note)

VDD VDD
Axxxx
XXXXXX
XXXX YYYY

Bxxxxx

GND VSS
XXXX

Cxxxxxx

STATVE
XXX YYY

XXXXX

PG-FP4 (Flash Pro4)

RESET RESET
flash programmer RXD TXDA0 V850
TXD RXDA0 microcontroller

Note: FLMD1 connection may be replaced by a pull-down resistor on the board

Figure 6-6 Communication with flash programmer via UARTA0

www.DataSheet4U.com

280 User’s Manual U17566EE5V1UM00


Flash Memory Chapter 6

(2) CSIB0 without handshake


Serial clock: up to 2.5 MHz (MSB first)

FLMD0 (FLMD1Note) FLMD0 (FLMD1Note)

VDD VDD
Axxxx GND VSS

XXXXXX
XXXX YYYY

Bxxxxx

XXXX
Cxxxxxx

RESET RESET
STATVE

XXXXX
XXX YYY

PG-FP4 (Flash Pro4)

SI SOB0
flash programmer SO SIB0 V850
microcontroller
SCK SCKB0

Note: FLMD1 connection may be replaced by a pull-down resistor on the board

Figure 6-7 Communication with flash programmer via CSIB0 without handshake

(3) CSIB0 with handshake (CSIB0 + HS)


Serial clock: Up to 2.5 MHz (MSB first)

FLMD0 (FLMD1Note) FLMD0 (FLMD1Note)

VDD VDD
GND VSS
Axxxx
XXXXXX
XXXX YYYY

Bxxxxx

RESET RESET
XXXX

Cxxxxxx

STATVE
XXX YYY

XXXXX

PG-FP4 (Flash Pro4)

SI SOB0
flash programmer SO SIB0 V850
SCK SCKB0 microcontroller

HS P84
Note: FLMD1 connection may be replaced by a pull-down resistor on the board

Figure 6-8 Communication with flash programmer via CSIB0 with handshake

The flash programmer outputs a transfer clock and the microcontroller


operates as a slave.

If the PG-FP4 is used as the flash programmer, it generates the following


signals for the microcontroller. For details, refer to the PG-FP4 User’s Manual
(U15260E).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 281


Chapter 6 Flash Memory

Table 6-2 Signals generated by flash programmer PG-FP4


PG-FP4 Controller Connection
Signal
I/O Pin function Pin name UARTA0 CSIB0 CSIB0 + HS
name
FLMD0 Output Write enable/disable, FLMD0   
mode setting
FLMD1 Output Mode setting FLMD1 × × ×
VDD I/O VDD voltage generation/voltage VDD   
monitor
GND – Ground VSS   
CLK Output Clock output to the controller X1 × × ×
RESET Output Reset signal RESET   
SI/RxD Input Receive signal SOB0/   
TXDA0
SO/TxD Output Transmit signal SIB0/RXDA0   
SCK Output Transfer clock SCKB0 ×  
HS Input Handshake signal for CSIB0 + P84 × × 
HS communication

Note : must be connected


×: does not need to be connected

www.DataSheet4U.com

282 User’s Manual U17566EE5V1UM00


Flash Memory Chapter 6

6.4.3 Pin connection

A connector must be mounted on the target system to connect the flash


programmer for on-board writing. In addition, a function to switch between the
normal operation mode and flash memory programming mode must be
provided on the board.
When the flash memory programming mode is set, all the pins not used for
flash memory programming are in the same status as immediately after reset.

(1) Connection to flash programmer


In the normal operation mode, 0 V is input to the FLMD0 pin. The pull-down
resistor at the FLMD0 pin ensures normal operation mode if no flash
programmer is connected. In the flash memory programming mode, the VDD
write voltage is supplied to the FLMD0 pin. Additionally the FLMD1 pin, shared
with port P07, has to hold 0 V level.
An example of connection of the FLMD0 and FLMD1 pins is shown below.
Alternatively the FLMD1 pin may also be connected directly to the FLMD1
signal of the flash programmer.

Table 6-3 Operation mode settings


Pins
Operation mode
FLMD0 FLMD1 (P07)
0 X Normal operation mode (fetch from flash)
1 0 Flash programming mode
1 Setting prohibited

PG-FP4 μPD70F34xx

FLMD0 FLMD0

FLMD1 FLMD1

PG-FP4 μPD70F34xx

FLMD0 FLMD0

FLMD1 FLMD1

www.DataSheet4U.com

Figure 6-9 Example of connection to flash programmer PG-FP4 in CSI and UART
mode

User’s Manual U17566EE5V1UM00 283


Chapter 6 Flash Memory

(2) Serial interface pins


The pins used by each serial interface are shown in the table below.

Table 6-4 Pins used by each serial interface


Serial interface Pins
UARTA0 TXDA0, RXDA0 at pins P30/P31
CSIB0 SOB0, SIB0, SCKB0 at pins P40 - P42
CSIB0 + HS SOB0, SIB0, SCKB0, P84

In flash programming mode the output drive strength control of the pins
TXDA0, SOB0 and P84 is disabled. By this means the port pins provide
maximum driver capability in order to maximize the transmission data rate to
the flash programmer.

Caution 1. Since the output drive strength control of the pins TXDA0, SOB0 and P84 is
disabled during programming these pins are not short-circuit proof any
more. Short circuits at these pins may permanently damage the device.
2. If other devices are connected to the serial interface pins in use for flash
memory programming in on-board programming mode take care that the
concerned signals do not conflict with the signals of the flash programmer
and the microcontroller. Output pins of the other devices must be isolated or
set in high impedance state. Ensure that the other devices do not
malfunction because of flash programmer signals.
3. Pay attention in particular if the flash programmer’s RESET signal is
connected also to an on-board reset generation circuit. The reset output of
the reset generator may ruin the flash programming process and may need
to be isolated.
4. All the port pins, including the pin connected to the flash programmer, go
into an output high-impedance state in the flash memory programming
mode. If there is a problem such as that an external device connected to a
port prohibits the output high-impedance state, connect the port to VDD or
VSS via a resistor.
5. Connect all oscillator pins in the same way as in the normal operation mode.
6. Supply the same power to all power supply pins, including reference
voltages, power regulator pins, etc., as in the normal operation mode.

www.DataSheet4U.com

284 User’s Manual U17566EE5V1UM00


Flash Memory Chapter 6

6.4.4 Programming method

In the following the flash programming flow is described, if the CSI or the UART
is used as the communication interface.

(1) Flash memory control


The procedure to manipulate the flash memory is illustrated below.

Figure 6-10 Flash memory manipulation procedure

(2) Flash memory programming mode


To rewrite the contents of the flash memory by using the flash programmer, set
the microcontroller in the flash memory programming mode.
To set this mode, set the FLMD0 and FLMD1 pins as shown in Table 6-6 and
release RESET.

The communication interface is chosen by applying a specified number of


pulses to the MODE pin after reset release. Note that this is handled by the
flash programmer.
Figure 6-11 gives an example how the UARTA0 is established for the
communication between the flash programmer and the microcontroller.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 285


Chapter 6 Flash Memory

VDD

VDD
0V
VDD
RESET (input)
0V

VDD
FLMD1 (input)
0V
VDD

FLMD0 (input)
0V
(Note)
VDD
RXDA0 (input)
0V
VDD

TXDA0 (output)
0V Oscillation Communication
stabilization mode selection

Power Reset Flash control command communication


supply release (such as erase and write)
ON

Figure 6-11 Flash memory programming mode start-up

Note The number of clocks to be inserted differs depending on the chosen


communication mode. For details, refer to Table 6-5.

(3) Selecting communication mode


The communication mode is selected by applying a specified number of pulses
to the MODE pin after the flash memory programming mode is set. These
MODE pulses are generated by the flash programmer.
The relationship between the number of pulses and the communication mode
is shown in the table below.

Table 6-5 Communication modes


MODE Communication
Remark
pulses mode
0 UARTA0 Communication rate: 9,600 bps (after reset),
LSB first
8 CSIB0 microcontroller operates as slave, MSB first
11 CSIB0 + HS microcontroller operates as slave, MSB first
Others - Setting prohibited
www.DataSheet4U.com
Note When UARTA0 is selected, the receive clock is calculated based on the reset
command that is sent from the flash programmer after reception of the MODE
pulses.

286 User’s Manual U17566EE5V1UM00


Flash Memory Chapter 6

(4) Communication commands


The microcontroller communicates with the flash programmer via commands.
The commands sent to the microcontroller are called commands, and the
response signals sent by the microcontroller to the flash programmer are
called response commands.

Axxxx
Command

XXXXXX
XXXX YYYY
Bxxxxx

Response

XXXX
Cxxxxxx

STATVE

XXX YYY

XXXXX
PG-FP4 (Flash Pro4)

command
flash programmer V850
microcontroller

Figure 6-12 Communication commands

The following table lists the flash memory control commands of the
microcontroller. All these commands are issued by the flash programmer, and
the microcontroller performs the corresponding processing.

Table 6-6 Flash memory control commands


Support
Classification Command name Function
CSIB CSIB + HS UARTA
Blank check Block blank check Checks erasure status of entire
√ √ √
command memory.
Erase Chip erase command Erase all memory contents
including area that holds security
√ √ √
flags, reset vector and other flash
options
Block erase command Erases memory contents of
√ √ √
specified block.
Write Write command Writes data by specifying write
address and number of bytes to
√ √ √
be written, and executes verify
check.
Verify Verify command Compares input data with all
√ √ √
memory contents.
Read Read command √ √ √ Read flash memory contents
System setting Reset command √ √ √ Escapes from each status.
and control
Oscillation frequency Sets oscillation frequency.
√ √ √
setting command
Baud rate setting Sets baud rate when UART is
– – √
command used.
Silicon signature Reads silicon signature
√ √ √
command information.
www.DataSheet4U.com Version acquisition Reads version information of
√ √ √
command device.
Status command √ √ – Acquires operation status.
Security setting Sets security of chip erasure,
√ √ √
command block erasure, and writing.

User’s Manual U17566EE5V1UM00 287


Chapter 6 Flash Memory

The microcontroller returns a response command to the command issued by


the flash programmer. The response commands sent by the microcontroller
are listed below.

Table 6-7 Response commands


Response command name Function
ACK Acknowledges command/data.
NAK Acknowledges illegal command/data.

www.DataSheet4U.com

288 User’s Manual U17566EE5V1UM00


Chapter 7 Bus and Memory Control (BCU, MEMC)

Besides providing access to on-chip peripheral I/Os, the µPD70F3427


microcontroller device supports access to external memory devices (such as
external ROM and RAM) and external I/O. The Bus Control Unit BCU and
Memory Controller MEMC control the access to on-chip peripheral I/Os and to
external devices.
Since the BCU controls access to the on-chip peripherals, the registers BPC
and VSWC have to be set up correctly for all devices.

Note Throughout this chapter, the individual chip select areas are identified by “k”
(k = 0 to 7), for example CSk for the chip select signal k or BEC.BEk0 for
setting the endian format of chip select area k.

7.1 Overview

The following external devices can be connected to the microcontroller device:


• SRAM / RAM
• ROM
• External I/O

Features summary The bus and memory control of the microcontroller device provides:
• 24 address signals (A0 to A23)
• Selectable data bus width for each chip select area
(8 bits, 16 bits and 32 bits)
• 4 chip select signals externally available (CS0, CS1, CS3 and CS4)
• Access to memory takes a minimum of two CPU clock cycles
• Up to 3 address setup wait states can be inserted for each chip select area
• Up to 7 data wait states can be inserted for each chip select area
(programmable wait)
• External data wait function through WAIT pin
• Up to 3 idle states can be inserted for each chip select area
• Up to 2 write strobe delay cycles can be inserted
• Direct Memory Access (DMA) support
• External bus mute function

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 289


Chapter 7 Bus and Memory Control (BCU, MEMC)

• Page ROM controller


– Direct connection to 8-bit/16-bit/32-bit page ROM supported
– Page ROM controller handles page widths from 8 to 128 bytes
– On-page judgement function
– Masking addresses can be changed by register setting
– Register for controlling the programmable wait during page access
– Supported page access depends on data bus width:
Data bus width Supported page access
32 bit 2/4/8/16/32 x 32 bits
16 bit 4/8/16/32/64 x 16 bits
8 bit 8/16/32/64/128 x 8 bits

7.2 Description

The figure below shows a block diagram of the modules that are necessary for
accessing on-chip peripherals, external memory, or external I/O.

µPD70F3426A
only

VSB Flash

µPD70F3426A
only

VSB RAM

µPD70F3427 A[23:0]
only
VFB CPU D[31:0]
CS0
CS1
CS3
VDB Bus CS4
Control Memory BE0 External
Unit VSB Controller BE1 Device
DMA (BCU) (MEMC) BE2
Controller BE3
RD
WR
Bus Bridge WAIT
(BBR) BCLK

Internal Bus (NPB)

On-chip Peripheral I/O

www.DataSheet4U.com

Figure 7-1 Block diagram of Bus and Memory Controller

Busses The busses are abbreviated as follows:


• NPB: NEC peripheral bus

290 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

• VSB: V850 system bus


• VDB: V850 data bus
• VFB: V850 fetch bus
BCU The Bus Control Unit (BCU) controls the access to on-chip peripherals, to
external memory controller (MEMC), the VSB RAM and VSB Flash of the
µPD70F3426A device.
For access to external devices, the BCU generates the necessary control
signals (chip select signals) for the Memory Controller.
Memory Controller The 64 MB address range is divided into 2-MB, 4-MB and 8-MB memory
banks. Each of the memory banks can be assigned to an external device via
the chip area select control registers CSC0 and CSC1.
If an instruction uses such an address, a chip select signal is generated. The
device supports four chip select signals (CS0, CS1, CS3 and CS4). Each chip
select signal covers a certain address range, also called “chip select area”. For
details see “Memory banks and chip select signals“ on page 292.
Additional byte enable signals BE0 to BE3 indicate valid data on any of the four
bytes of the 32-bit data bus D[31:0].
The Memory Controller generates the control signals for access to the external
devices. For example, it generates the read strobe (RD) and the write strobe
(WR). From the 26 bit address of the CPU, the lower 24 bits are passed to the
external device.
If two chip select signals are specified in the CSCn registers for a single
memory bank, the priority control selects one of the chip select signals. The
priority order is given in “CSCn - Chip area select control registers“ on
page 305.
The external signals of the Memory Controller and their state during and after
reset are listed in the following table:

Table 7-1 Memory Controller external connections and reset states


State State
Signal name I/O Function
during reset after reset
A[23:0] O Hi-Z (3-state) O Address bus
D[31:16] I/O Hi-Z (3-state) Port input Data bus
D[15:0] Hi-Z (3-state) I
CS0 O Hi-Z (3-state) O Chip select signal
CS1
CS3
CS4
BE0 O Hi-Z (3-state) O Byte enable signal
BE1
BE2 O Hi-Z (3-state) Port input
BE3
www.DataSheet4U.com RD O Hi-Z (3-state) O Read strobe
WR O Hi-Z (3-state) O Write strobe
BCLK O Hi-Z (3-state) Port input Bus clock

All port pins are in input port mode after reset. Refer to “Pin Functions“ on
page 27.

User’s Manual U17566EE5V1UM00 291


Chapter 7 Bus and Memory Control (BCU, MEMC)

ROMC To access external ROM with page access function (page ROM), the Page
ROM Controller (ROMC) is provided. It can handle page widths from 8 to 128
bytes.
For more details, see “Page ROM Controller“ on page 320.

Note If the concerned pins are configured as external memory bus pins change
between input and output is performed automatically by memory controller’s
read and write operations.

Configuration The microcontroller device supports interfacing with various memory devices.
To make the bus and Memory Controller suitable for the connected device, the
endian format, wait functions and idle state insertions can be configured.
For a detailed description, see “Configuration of Memory Access“ on
page 322.

7.2.1 Memory banks and chip select signals

The 64 MB address range is divided into memory banks. Each memory bank
is assigned to one or more chip select (CSn) signals. If a memory bank is
configured for external access, access to that memory bank generates the
corresponding chip select signal (see Figure 7-3 on page 294). The
combination of memory banks that activate the same chip select signal is
called chip select area.
µPD70F3426A Figure 7-2 shows the memory map of the µPD70F3426A.
The 1 MB VSB Flash memory is mapped to the address range 0010 0000H to
001F FFFFH within bank 0. CS0 is assigned to the VSB Flash memory.
The 24 KB VSB RAM memory is mapped to the address range 0060 0000H to
0060 5FFFH within bank 3. CS2 is assigned to the VSB RAM memory.

For access to the VSB Flash and VSB RAM the concerned BCU registers have
to be set up as shown in Figure 7-2
For details about the control settings refer to the description of the registers.

Table 7-2 BCU register settings for µPD70F3426A VSB Flash and VSB RAM access
Control bit Required setting Comment
CSC0.CS0[3:0] 0001B • bank 0 assigned to CS0 for VSB Flash
• default, don’t change
CSC0.CS2[3:0] 1000B • bank 3 assigned to CS2 for VSB RAM
• no default, must be changed
BEC.BE00 0 • little endian for VSB Flash
• default, don’t change
BEC.BE20 0 • little endian for VSB RAM
• default, don’t change
www.DataSheet4U.com

292 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

03FF FFFFH 03FF FFFFH


Bank 15 Peripheral I/O area
(2 MB) (4 KB)
03E0 0000H 03FF F000H
Bank 14 VDB RAM
(2 MB) (60 KB)
CS7 03C0 0000H 03FF 0000H
CS5 Bank 13 Programmable peripheral
(2 MB) I/O area (PPA)
03A0 0000H (16 KB) Note
03FE C000H
Bank 12
(2 MB) Reserved
CS6 0380 0000H
03E0 0000H

Bank 11
(4 MB)

0340 0000H

Bank 10
(4 MB)

CS4 0300 0000H

Bank 9
(8 MB)

0280 0000H

Bank 8
(8 MB)

0200 0000H

Bank 7
(8 MB)

0180 0000H

Bank 6
(8 MB)

CS3

0100 0000H

Bank 5
(4 MB)

00C0 0000H

CS1
Bank 4
(4 MB)
0060 5FFFH
0080 0000H VSB RAM
Bank 3 CS2
(2 MB) ( 24 KB)
0060 0000H 0060 0000H
Bank 2 001F FFFFH
(2 MB) VSB Flash
CS0 0040 0000H
CS2
CS0
Bank 1 ( 1 MB)
(2 MB) 0010 0000H
0020 0000H
www.DataSheet4U.com Bank 0 VFB Flash
000F FFFFH

(2 MB) (1 MB)
0000 0000H 0000 0000H

Note: The shown address range of the PPA assumes the BPC register to be set to 8FFBH.

Figure 7-2 Memory banks and chip select signals for µPD70F3426A

User’s Manual U17566EE5V1UM00 293


Chapter 7 Bus and Memory Control (BCU, MEMC)

03FF FFFFH 03FF FFFFH


Bank 15 Peripheral I/O area
(2 MB) (4 KB)
03E0 0000H 03FF F000H
Bank 14 VDB RAM
(2 MB) (60 KB)
CS7 03C0 0000H 03FF 0000H
CS5 Bank 13 Programmable peripheral
(2 MB) I/O area (PPA)
03A0 0000H (16 KB) Note
03FE C000H
Bank 12
(2 MB) Reserved
CS6 0380 0000H
03E0 0000H

Bank 11 03DF FFFFH


(4 MB) External memory area
CS4
0340 0000H Bank 12 to 14
0380 0000H
Bank 10
(4 MB) 037F FFFFH

External memory area


CS4 0300 0000H CS4
Bank 10, 11
0300 0000H

02FF FFFFH
Bank 9
(8 MB)

0280 0000H
External memory area
CS4
Bank 8, 9

Bank 8
(8 MB)

0200 0000H
0200 0000H
01FF FFFFH

Bank 7
(8 MB)

External memory area


0180 0000H CS3
Bank 6, 7

Bank 6
(8 MB)

CS3

0100 0000H
0100 0000H
00FF FFFFH

Bank 5
(4 MB)
External memory area
00C0 0000H CS1, CS3
Bank 4, 5
CS1
Bank 4
(4 MB)
0080 0000H
0080 0000H
Bank 3 007F FFFFH
(2 MB) External memory area
0060 0000H
CS0, CS1, CS3
Bank 2 Bank 2, 3
(2 MB)
CS0 0040 0000H 0040 0000H
CS2 Bank 1
(2 MB)
www.DataSheet4U.com 0020 0000H
000F FFFFH
Bank 0 VFB Flash
(2 MB) (1 MB)
0000 0000H 0000 0000H

Note: The shown address range of the PPA assumes the BPC register to be set to 8FFBH.

Figure 7-3 Memory banks and chip select signals for µPD70F3427

294 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

7.2.2 Chips select priority control

The chip select signals CS0 to CS7 can be assigned to overlapping memory
areas by setting the chip select area control registers CSC0 and CSC1. The
chip select priority control rules the generation of chip select signals in this
case.
Access to internal resources, which are concurrently mapped to an external
memory areas overrules the external access. As a consequence, the assigned
CSn signal is not generated externally.
If different chip select signals are set (CSC0.CSCkm = 1) for the same memory
bank, the priority order is as follows:
• internal resources > CS0 > CS2 > CS1 > CS3
• internal resources > CS7 > CS5 > CS6 > CS4
Examples:
• If both chip select signal CS0 and CS1 are set for memory bank 2, only the
chip select signal CS0 will be generated.
• If during access to bank 2 CS2 should not be active, activate CS0 for this
bank (CSC0.CS02 = 1). Due to the priority order, only chip select signal
CS0 will be active for bank 2.

7.2.3 Peripheral I/O area

Two areas of the address range are reserved for the registers of the on-chip
peripheral functions. These areas are called “peripheral I/O areas”:

Table 7-3 Peripheral I/O areas


Name Address range Size
Fixed peripheral I/O area 03FF F000H to 03FF FFFFH 4 KB
Programmable peripheral Can be allocated at arbitrary addresses. 16 KB
I/O area (PPA) Base address is defined in the BPC register.

(1) Fixed peripheral I/O area


The fixed peripheral I/O area holds the registers of the on-chip peripheral I/O
functions.

Note Because the address space covers 64 MB, the address bits A[31:26] are not
considered. Therefore, in this manual, all addresses of peripheral I/O registers
in the 4 KB peripheral I/O area are given in the range FFFF F000H to
FFFF FFFFH instead of 03FF F000H to 03FF FFFFH.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 295


Chapter 7 Bus and Memory Control (BCU, MEMC)

(2) Programmable peripheral I/O area (PPA)


The usage and the address range of the PPA is configurable. The PPA extends
the fixed peripheral I/O area and assigns an additional 12 KB address space
for accessing on-chip peripherals.
The figure below illustrates the programmable peripheral I/O area (PPA).

3FF FFFFH
Peripheral
I/O register
(4 KB) NPB (NEC Peripheral Bus)
3FF F000H
3FF EFFFH

same area
base + 3FFFH x3FFFH
Programmable Peripheral
peripheral I/O area
I/O register (4 KB) x3000H
(16 KB) x2FFFH
base of PPA
Programmable
peripheral x1200H
I/O area x11FFH Dedicated area for
x0000H FCAN controller
000 0000H

Figure 7-4 Programmable peripheral I/O area

The CAN modules registers and message buffers are allocated to the PPA.
Refer to “CAN module register and message buffer addresses“ on page 745
for information how the calculate the register and message buffer addresses of
the CAN modules.

Caution If the programmable peripheral I/O area overlaps one of the following areas,
the programmable peripheral I/O area becomes ineffective:
• Peripheral I/O area
• ROM area
• RAM area

Note 1. The fixed peripheral I/O area is mirrored to the upper 4 KB of the
programmable peripheral I/O area – regardless of the base address of the
PPA. If data is written in one area, data having the same contents is also
written in the other area.
2. All address definitions in this manual that refer to the programmable
peripheral area assume that the base address of the PPA is 03FE C000H,
that means BPC = 8FFBH.

www.DataSheet4U.com

296 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

7.2.4 NPB access timing

All accesses to the peripheral I/O areas are passed over to the NPB bus via
the VSB - NPB bus bridge BBR. Read and write access times to registers via
the NPB depend on the register (refer to “Registers Access Times“ on
page 985), the system clock VBCLK and the setting of the VSWC register.
The CPU operation during an access to a register via the NPB depends also
on the kind of peripheral I/O area:
• Fixed peripheral I/O area
During a read or write access the CPU operation stops until the access via
the NPB is completed.
• Programmable peripheral I/O area
During a read access the CPU operation stops until the read access via the
NPB is completed.
During a write access the CPU operation continues operation, provided any
preceded NPB access is already finished. If a preceded NPB access is still
ongoing the CPU stops until this access is finished and the NPB is cleared.

Caution Pay attention at write accesses to NPB peripheral I/O registers via the
programmable peripheral I/O area.
Since the CPU may continue operation, even though the data has not yet been
transferred to its destination register, inconsistencies may occur between the
program flow and the status of the registers.
In particular register set-ups which change an operational status of a certain
module require special notice, like, for instance, masking/unmasking of
interrupts via maskable interrupt control registers xxIC, enabling/disabling
timers, etc.

7.2.5 Bus properties

This section summarizes the properties of the external bus.

(1) Bus width


The microcontroller device accesses external memory and external I/O in 8-bit,
16-bit, or 32-bit units.
The data bus size for each chip select area is specified in the local bus size
configuration register (LBS).
The operation for each type of access is given in “Access to 8-bit data busses“
on page 336 and in “Access to 16-bit data busses“ on page 342.

(2) Bus priority order


www.DataSheet4U.com There are three kinds of external bus cycles as shown below. The DMA cycle
has the highest priority, followed by the operand data access, and instruction
fetch, in that order.

User’s Manual U17566EE5V1UM00 297


Chapter 7 Bus and Memory Control (BCU, MEMC)

Table 7-4 Bus priority order


Priority External bus cycle Bus master
High DMA cycle DMA Controller
Operand data access CPU
Low Instruction fetch CPU

(3) Bus access


The number of CPU clocks necessary for accessing each resource –
independent of the bus width – is as follows:

Table 7-5 Number of bus access clocks


External
Bus cycle configuration Internal RAM External I/O
memory
Instruction fetch Normal access 1a – 2b
Branch 1 – 2b
Operand data access 1 3b 2b
a) In case of contention with data access, the instruction fetch from internal RAM
takes 2 clocks.
b)
This is the minimum value.

7.2.6 Boundary operation conditions

The microcontroller device has the following boundary operation conditions:

(1) Program space


Instruction fetches from the internal peripheral I/O area are inhibited and yield
NOP operations.
If a branch instruction exists at the upper limit of the internal RAM area, a pre-
fetch operation (invalid fetch) that straddles over the internal peripheral I/O
area does not occur.

(2) Data space


The microcontroller device is provided with an address misalign function.
By this function, data of any format (word: 32 bit, halfword: 16 bit, byte: 8 bit)
can be placed to any address in memory, even though the address is not
aligned to the data format (that means address 4n for words, address 2n for
halfwords).
• Unaligned halfword data access
When the LSB of the address is A0 =1, two byte accesses are performed.
• Unaligned word data access
When the LSB of the address is A0 =1, two byte and one halfword accesses
www.DataSheet4U.com are performed. In total it takes 3 bus cycles.
– When the LSBs of the address are A[1:0] =10B, two halfword accesses
are performed.

Note Accessing data on misaligned addresses takes more than one bus cycle to
complete data read/write. Consequently, the bus efficiency will drop.

298 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

7.2.7 Initialization for access to external devices

To enable access to external devices, initialize the following registers after any
reset.
1. Chip area select control registers CSCn
Define the memory banks that are allocated to external devices. Memory
banks that are not allocated to external devices, must be deactivated.
2. Bus cycle type configuration registers BCTn
Specify the external devices that are connected to the microcontroller
device. For memory banks that are not allocated to external devices, the
corresponding bits in registers BCT0 and BCT1 should be reset.
3. LOcal bus size configuration register LBS
Set the data bus width for the active chip select areas.
4. Data wait control registers DWCn
Set the number of data wait states with respect to the starting bus cycle.
5. Bus cycle control register BCC
Set the number of idle states for each chip select area.
6. Page ROM configuration register PRC
If page ROM mode is selected (BCTn.BTk0 = 1), set whether a page ROM
cycle is on-page or off-page.
7. Endian configuration register (BEC)
Set the endian format for each chip select area.
8. Address setup wait control register (ASC)
Set the number of address setup wait states for each chip select area.
9. Read delay control register (RDDLY)
Activate the delay of the rising edge of RD strobe, as required.

Caution 1. Do not change these registers after initialization.


2. Do not access external devices before initialization is finished.

7.2.8 External bus mute function

If no access via the external memory interface is performed the external bus is
set into a mute status. During mute the external bus interface pins take
following states:
• A[22:0]: hold the address of the last external access
• D[31:0]: 3-state
• WR, RD, CS0, CS1, CS3, CS4: high level (inactive state)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 299


Chapter 7 Bus and Memory Control (BCU, MEMC)

7.3 Registers

Access to on-chip peripherals, to external memory, and to external I/O is


controlled and operated by registers of the Bus Control Unit (BCU) and of the
Memory Controller (MEMC):

Table 7-6 Bus and memory control register overview


Module Register name Shortcut Address
Bus Control Unit (BCU) Peripheral area selection control register BPC FFFF F064H
Internal peripheral function wait control VSWC FFFF F06EH
register
Chip area select control registers CSC0 FFFF F060H
CSC1 FFFF F062H
Endian configuration register BEC FFFF F068H
µPD70F3427 only:
Memory Controller Bus cycle configuration registers BCT0 FFFF F480H
(MEMC)
BCT1 FFFF F482H
Address setup wait control register ASC FFFF F48AH
Local bus size configuration register LBS FFFF F48EH
Data wait control registers DWC0 FFFF F484H
DWC1 FFFF F486H
Bus cycle control register BCC FFFF F488H
Bus mode control register BMC FFFF F498H
Read delay control register RDDLY FFFF FF00H
Page ROM configuration register PRC FFFF F49AH

www.DataSheet4U.com

300 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

7.3.1 BCU registers

The following registers are part of the BCU. They define the usage of the
programmable peripheral I/O area (PPA), the data bus width, the endian format
of word data, and they control access to external devices.

(1) BPC - Peripheral area selection control register


The 16-bit BPC register defines whether the programmable peripheral I/O area
(PPA) is used or not and determines the starting address of the PPA.
Access This register can be read/written in 16-bit units.
Address FFFF F064H
Initial Value 0000H

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
PA15 0 PA13 PA12 PA11 PA10 PA9 PA8 PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0

Table 7-7 BPC register contents


Bit Position Bit Name Function
15 PA15 Select usage of programmable peripheral I/O area (PPA).
0: PPA disabled
1: PPA enabled
13 to 0 PA[13:0] Bits PA[13:0] specify bits 27 to 14 of the starting address of the PPA. The other bits
of the address are fixed to 0.

Caution Bit 14 must always be 0.


The base address PBA of the programmable peripheral area sets the start
address of the 16 KB PPA in a range of 256 MB. The 256 MB page is mirrored
16 times to the entire 32-bit address range.

The base address PBA is calculated by

PBA = BPC.PA[13:0] x 214


Table 7-8 shows how the base address PBA of the programmable peripheral
area is assembled.

Table 7-8 Address range of programmable peripheral area (16 KB)


31 … 28 27 … 14 13 … 1 0 bit
0 … 0 BPC.PA[13:0] 1 … 1 1
… … …
0 … 0 BPC.PA[13:0] 0 … 0 1
0 … 0 BPC.PA[13:0] 0 … 0 0 PBA
www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 301


Chapter 7 Bus and Memory Control (BCU, MEMC)

Note The recommended setting for the BPC register is 8FFBH. With this
configuration the programmable peripheral area is mapped to the address
range 03FE C000H to 03FE FFFFH. With this setting the CAN message buffer
registers are accessible via the addresses given in “CAN Controller (CAN)“ on
page 719.
The fixed peripheral area is mirrored to the address range 03FE E000H to
03FE FFFFH.

www.DataSheet4U.com

302 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

(2) VSWC - Internal peripheral function wait control register


The 8-bit VSWC register defines the wait states inserted when accessing
peripheral special function registers via the internal bus. Both address setup
and data wait states are based on the system clock.
Access This register can be read/written in 8-bit or 1-bit units.
Address FFFF F06EH
Initial Value 77H

7 6 5 4 3 2 1 0
0 SUWL2 SUWL1 SUWL0 0 VSWL2 VSWL1 VSWL0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 7-9 VSWC register contents


Bit position Bit name Function
6 to 4 SUWL[2:0] Address setup wait for internal bus:
SUWL2 SUWL1 SUWL0 Number of address setup wait states

0 0 0 0

0 0 1 1 CPU system clock (VBCLK)

0 1 0 2 CPU system clock (VBCLK)

0 1 1 3 CPU system clock (VBCLK)

1 0 0 4 CPU system clock (VBCLK)

1 0 1 5 CPU system clock (VBCLK)

1 1 0 6 CPU system clock (VBCLK)

1 1 1 7 CPU system clock (VBCLK)

2 to 0 VSWL[2:0] Data wait for internal bus:


VSWL2 VSWL1 VSWL0 Number of data wait states

0 0 0 0

0 0 1 1 CPU system clock (VBCLK)

0 1 0 2 CPU system clock (VBCLK)

0 1 1 3 CPU system clock (VBCLK)

1 0 0 4 CPU system clock (VBCLK)

1 0 1 5 CPU system clock (VBCLK)

1 1 0 6 CPU system clock (VBCLK)

1 1 1 7 CPU system clock (VBCLK)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 303


Chapter 7 Bus and Memory Control (BCU, MEMC)

The following setups are recommended for VSWC:

Table 7-10 Recommended timing for internal bus

System
≤ 16 MHz ≤ 25 MHz ≤ 33 MHz ≤ 50 MHz ≤ 66 MHz
clocka fVBCLK
SUWL 0 0 1 1 1
VSWL 0 1 1 2 3
VSWC 00H 01H 11H 12H 13H
a) When deriving the system clock from the modulated clock of the SSCG, the maxi-
mum clock determines the correct register setting.

www.DataSheet4U.com

304 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

(3) CSCn - Chip area select control registers


The 16-bit registers CSC0 and CSC1 assign the chip select signals CS0 to
CS3 and CS4 to CS7 to memory blanks (see also “Memory banks and chip
select signals“ on page 292). If a bit in CSCn is set, access to the
corresponding memory bank will generate the corresponding chip select signal
and activate the Memory Controller.
If several chip select signals are assigned to identical memory areas, a priority
control rules the generation of the signals (refer to “Chips select priority
control“ on page 295).
Access These registers can be read/written in 16-bit units.
Address CSC0: FFFF F060H
CSC1: FFFF F062H
Initial Value 2C11H
These registers must be initialized as described in Table 7-13 and Table 7-14.

CSC0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CS33 CS32 CS31 CS30 CS23 CS22 CS21 CS20 CS13 CS12 CS11 CS10 CS03 CS02 CS01 CS00
CS3 CS2 CS1 CS0

CSC1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CS43 CS42 CS41 CS40 CS53 CS52 CS51 CS50 CS63 CS62 CS61 CS60 CS73 CS72 CS71 CS70
CS4 CS5 CS6 CS7

The register contents in Table 7-11 and Table 7-12 read as follows:
• CSkm = 0: Corresponding chip select signal is not active during access to
memory bank.
• CSkm = 1: Corresponding chip select signal is active during access to
memory bank.

Caution To initialize an external memory area after a reset, registers CSCn have to be
set. Do not change these registers after initialization. Do not access external
devices before initialization is finished.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 305


Chapter 7 Bus and Memory Control (BCU, MEMC)

Table 7-11 CSC0 register contents


Chip select
Bit Position Bit Name Access to memory bank
signal
15 CS33 7
14 CS32 6
CS3
13 CS31 4 or 5
12 CS30 0, 1, 2 or 3
11 CS23 3
10 CS22 2
CS2
9 CS21 1
8 CS20 0
7 CS13 5
6 CS12 4
CS1
5 CS11 2 or 3
0 CS10 0 or 1
3 CS03 3
2 CS02 2
CS0
1 CS01 1
0 CS00 0

Table 7-12 CSC1 register contents


Chip select
Bit Position Bit Name Access to memory bank
signal
15 CS43 8
14 CS42 9
CS4
13 CS41 10 or 11
12 CS40 12, 13, 14 or 15
11 CS53 12
10 CS52 13
CS5
9 CS51 14
8 CS50 15
7 CS63 10
6 CS62 11
CS6
5 CS61 12 or 13
0 CS60 14 or 15
3 CS73 12
2 CS72 13
CS7
1 CS71 14
w w w . D a t a S h e e t 4 U . c o 0m CS70 15

306 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

Initialization Initialize the CSCn registers as shown in


• Table 7-13 for µPD70F3426A
• Table 7-14 for µPD70F3427
A

Table 7-13 Initialization of the µPD70F3426A CSCn registers


Bits Set to value Comment
CSC0.CS0[3:0] 0001B CS0 assigned to bank 0 to VSB Flash memory
010 0000H - 01F FFFFH.

CSC0.CS0[3:0] must be left with their default


value 1000B.
CSC0.CS1[3:0] 1000B CSC0.CS1[3:0] must be left with their default
value 1000B.
CSC0.CS2[3:0] 1000B CS2 assigned to bank 3 to VSB RAM memory
060 0000H - 060 5FFFH.

Caution: CSC0.CS2[3:0] must be changed


to 1000B (default value is 1100B).

CSC0.CS3[3:0] 0010B CSC0.CS3[3:0] must be left with their default


value 0010B.
CSC1.CS4[3:0] 0010B CSC1.CS4[3:0] must be left with their default
value 0010B.
CSC1.CS5[3:0] 1100B CSC1.CS5[3:0] must be left with their default
value 1100B.
CSC1.CS6[3:0] 0001B CSC1.CS6[3:0] must be left with their default
value 0001B.
CSC1.CS7[3:0] 0001B CSC1.CS7[3:0] must be left with their default
value 0001B.

Caution For the µPD70F3426A the CSC0 register must be changed to 2811H and
CSC1 must be left with its default value 2C11H. Do not modify these registers
after setting CSC0 = 2811H.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 307


Chapter 7 Bus and Memory Control (BCU, MEMC)

Table 7-14 Initialization of the µPD70F3427 CSCn registers


Bits Set to value Comment
CSC0.CS0[3:0] xx00B Set CSC0.CS0[3:2] as required to assign CS0
to bank 2 to 3 to external memory
040 0000H - 07F FFFFH.

Caution: CSC0.CS0[1:0] must be changed


to 00B (default value is 01B).

CSC0.CS1[3:0] xxx0B Set CSC0.CS1[3:1] as required to assign CS1


to bank 2 to 5 to external memory
040 0000H - 0FF FFFFH.

Caution: CSC0.CS10 must be changed to 0


(default value is 1).

CSC0.CS2[3:0] 1100B CSC0.CS2[3:0] must be left with their default


value 1100B.
CSC0.CS3[3:0] xxx0B Set CSC0.CS3[3:1] as required to assign CS3
to bank 4 to 7 to external memory
080 0000H - 1FF FFFFH.

CSC0.CS30 must be left with its default value


0.
CSC1.CS4[3:0] xxx0B Set CSC1.CS4[3:1] as required to assign CS4
to bank 8 to 11 to external memory
200 0000H - 37F FFFFH.

CSC0.CS40 must be left with its default value


0.
CSC0.CS5[3:0] 1100B CSC0.CS5[3:0] must be left with their default
value 1100B.
CSC1.CS6[3:0] 0001B CSC0.CS6[3:0] must be left with their default
value 0001B.
CSC1.CS7[3:0] 0001B CSC0.CS7[3:0] must be left with their default
value 0001B.

www.DataSheet4U.com

308 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

(4) BEC - Endian configuration register


The 16-bit BEC register defines the endian format in which word data in the
memory is processed. Each chip select area is controlled separately.
Access This register can be read/written in 16-bit units.
Address FFFF F068H
Initial Value 0000H
This register must be initialized as described in Table 7-16 and Table 7-17.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 BE70 0 BE60 0 BE50 0 BE40 0 BE30 0 BE20 0 BE10 0 BE00
CS7 CS6 CS5 CS4 CS3 CS2 CS1 CS0

Table 7-15 BEC register contents


Bit Position Bit Name Function
14, 12, 10, BEk0 Sets the endian format for processing of word data for each chip select area.
8, 6, 4, 0 0: Little endian
1: Big endian

Caution 1. The bits marked with 0 must always be 0.

2. To initialize an external memory area after a reset, register BEC has to be


set. Do not change this register after initialization. Do not access external
devices before initialization is finished.

Note 1. Accesses to all internal resources are fixed to little endian format.
2. Different chip select signals can be active for the same memory bank. The
priority order defines, which chip select signal is valid.
3. Set the chip select area which is specified as the programmable peripheral
I/O area to little endian format.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 309


Chapter 7 Bus and Memory Control (BCU, MEMC)

Initialization Initialize the BEC register as shown in


• Table 7-16 for µPD70F3426A
• Table 7-17 for µPD70F3427

Table 7-16 Initialization of the µPD70F3426A BEC register


Bits Set to value Comment
BEC.BE00 0 Endian format for VSB Flash memory: little
endian
BEC.BE00 must be left with their default value
0
BEC.BE10 0B BEC.BE10 must be left with their default value
0
BEC.BE20 0 Endian format for VSB RAM: little endian
BEC.BE20 must be left with their default value
0
BEC.BE30 0B BEC.BE30 must be left with their default value
0
BEC.BE40 0B BEC.BE40 must be left with their default value
0
BEC.BE50 0B BEC.BE50 must be left with their default value
0
BEC.BE60 0B BEC.BE60 must be left with their default value
0
BEC.BE70 0B BEC.BE70 must be left with their default value
0

Caution For the µPD70F3426A the BEC register must be left with its default value
0000H. Do not modify this register.

Table 7-17 Initialization of the µPD70F3427 BEC register


Bits Set to value Comment
BEC.BE00 xB Set as required
BEC.BE10 xB Set as required
BEC.BE20 0B BEC.BE20 must be left with their default value
0
BEC.BE30 xB Set as required
BEC.BE40 xB Set as required
BEC.BE50 0B BEC.BE50 must be left with their default value
0
BEC.BE60 0B BEC.BE60 must be left with their default value
0
BEC.BE70 0B BEC.BE70 must be left with their default value
www.DataSheet4U.com 0

310 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

7.3.2 Memory controller registers (µPD70F3427 only)

The following registers are part of the Memory Controller. They specify the
type of external device that is connected, the number of data wait states, the
number of address wait states, the number of idle states, and they control
features for page ROM.

(1) BCTn - Bus cycle configuration registers


The 16-bit BCT0 register specifies the external devices that are connected to
the microcontroller device. The register enables the operation of the Memory
Controller for each chip select signal.
Access These registers can be read/written in 16-bit units.
Address BCT0: FFFF F480H
BCT1: FFFF F482H
Initial Value 0000H

BCT0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ME3 0 0 BT30 ME2 0 0 BT20 ME1 0 0 BT10 ME0 0 0 BT00
CS3 CS2 CS1 CS0

BCT1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ME7 0 0 BT70 ME6 0 0 BT60 ME5 0 0 BT50 ME4 0 0 BT40
CS7 CS6 CS5 CS4

Table 7-18 BCTn register contents


Bit Position Bit Name Function
15, 11, 7, 3 MEk Enables/disables Memory Controller operation for
chip select area k.
0: Operation disabled
1: Operation enabled
12, 8, 4, 0 BTk0 Specifies the devices that are connected to chip
select area k.
0: SRAM or external I/O connected
1: Page ROM connected

Caution 1. The bits marked with 0 must always be 0.


2. To initialize an external memory area after a reset, registers BCTn have to
be set. Do not change this register after initialization. Do not access external
devices before initialization is finished.

www.DataSheet4U.com
Low power mode Setting the Memory Controller into low power mode by changing the bit
BMC.PWDN impacts the BCTn registers as follows:
• entering low power mode by setting BMC.PWDN = 1

User’s Manual U17566EE5V1UM00 311


Chapter 7 Bus and Memory Control (BCU, MEMC)

– bits BCTn.BTm are set to 0


– bits BCTn.MEm are retained
– bus clock is stopped
• entering normal operation mode by setting BMC.PWDN = 0
– bits BCTn.MEm are set to 0
– bus clock is started
Thus after entering and leaving the low power mode, the BCTn registers hold
their initial values 0000H.

(2) LBS - Local bus size configuration register


The 16-bit LBS register controls the data bus width for each chip select area.
Access This register can be read/written in 16-bit units.
Address FFFF F48EH
Initial Value AAAAH.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
LB71 LB70 LB61 LB60 LB51 LB50 LB41 LB40 LB31 LB30 LB21 LB20 LB11 LB10 LB01 LB00
CS7 CS6 CS5 CS4 CS3 CS2 CS1 CS0

Table 7-19 LBS register contents


Bit position Bit name Function
15 to 0 LBk[1:0] Sets the data bus width for each chip select area.
LBk1 LBk0 Data bus size

0 0 8 bit

0 1 16 bit

1 0 32 bit

1 1 prohibited

www.DataSheet4U.com

312 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

(3) ASC - Address setup wait control register


The 16-bit ASC register controls the number of wait states between address
setup and the first access cycle (T1). Each chip select area is controlled
separately. A maximum of three address setup wait states is possible.
Address setup wait states can be inserted when accessing
• SRAM
• page ROM
Access This register can be read/written in 16-bit units.
Address FFFF F48AH
Initial Value FFFFH: After system setup, by default, three address setup wait states are
inserted for each chip select area.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
AC71 AC70 AC61 AC60 AC51 AC50 AC41 AC40 AC31 AC30 AC21 AC20 AC11 AC10 AC01 AC00
CS7 CS6 CS5 CS4 CS3 CS2 CS1 CS0

Table 7-20 ASC register contents


Bit position Bit name Function
15 to 0 ACk[1:0] Sets the number of address setup wait states for each chip select area.
ACk[1:0] Wait states inserted after address setup

00B No wait state inserted

01B 1 wait state

10B 2 wait states

11B 3 wait states

Note 1. During address setup wait, the external wait function (WAIT pin) is
disabled.
2. For access to internal memory, the setting of register ASC is neglected. No
wait states are inserted after address setup.

Caution To initialize an external memory area after a reset, this register has to be set.
Do not access external devices before initialization is finished. Do not change
this register while an external device is accessed.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 313


Chapter 7 Bus and Memory Control (BCU, MEMC)

(4) DWCn - Data wait control registers


The 16-bit DWCn registers control the number of wait states after the first
access cycle (T1). Each chip select area is controlled separately. A maximum
of seven data wait states is possible.
Access This register can be read/written in 16-bit units.
Address DWC0: FFFF F484H
DWC1: FFFF FFE0H
Initial Value 7777H: After system setup, by default, seven data wait states are inserted for
each chip select area.

DWC0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 DW32 DW31 DW30 0 DW22 DW21 DW20 0 DW12 DW11 DW10 0 DW02 DW01 DW00
CS3 CS2 CS1 CS0

DWC1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 DW72 DW71 DW70 0 DW62 DW61 DW60 0 DW52 DW51 DW50 0 DW42 DW41 DW40
CS7 CS6 CS5 CS4

Table 7-21 DWCn registers contents


Bit position Bit name Function
15 to 0 DWk[2:0] Sets the number of wait states after the first access cycle (T1) for each chip
select area.
DWk[2:0] Number of inserted wait states

000B No wait state inserted

001B 1 wait state

010B 2 wait states

011B 3 wait states

... ...

111B 7 wait states

Note 1. For access to internal memory, programmable waits are not carried out.
2. During page ROM on-page access, wait control is performed according to
PRC register setting.

Caution To initialize an external memory area after a reset, this register has to be set.
www.DataSheet4U.com Do not access external devices before initialization is finished. Do not change
this register while an external device is accessed.

314 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

(5) BCC - Bus cycle control register


The 16-bit BCC register controls the number of idle states inserted after the T2
cycle. Each chip select area is controlled separately. A maximum of three idle
states is possible.
Idle states can be inserted when accessing SRAM , external I/O, external
ROM, or page ROM.
Access This register can be read/written in 16-bit units.
Address FFFF F488H
Initial Value FFFFH. After system reset, three idle states are inserted.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
BC71 BC70 BC61 BC60 BC51 BC50 BC41 BC40 BC31 BC30 BC21 BC20 BC11 BC10 BC01 BC00
CS7 CS6 CS5 CS4 CS3 CS2 CS1 CS0

Table 7-22 BCC register contents


Bit position Bit name Function
15 to 0 BCk[1:0] Sets the number of idle states for each chip select area.
BCk[1:0] Inserted idle states

00B No idle state inserted

01B 1 idle state

10B 2 idle states

11B 3 idle states

Note For access to internal memory, no idle states are inserted.

Caution To initialize an external memory area after a reset, this register has to be set.
Do not access external devices before initialization is finished. Do not change
this register while an external device is accessed.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 315


Chapter 7 Bus and Memory Control (BCU, MEMC)

(6) BMC- Bus mode control register


The 8-bit BMC register controls the operation of the memory interface and its
clock supply.
Access This register can be read/written in 8- and 1-bit units.
Address FFFF F498H
Initial Value 00H

7 6 5 4 3 2 1 0
a
0 0 0 0 0 PDWN 0 CKM0
R R R R R R R R/W
a)
The default value “0” of bit 1 must not be changed.

Table 7-23 BMC register contents


Bit
Bit name Function
position
0 CKM0 Memory interface clock selection
0: VBCLK
1: VBCLK/2
2 PDWN Operation mode selection:
0: Normal operation
1: Low power mode (operation is stopped and memory
interface output signals are set to inactive levels)

Caution 1. To initialize an external memory area after a reset, this register has to be
set. Do not access external devices before initialization is finished. Do not
change this register while an external device is accessed.
2. If the CPU system clock VBCLK is chosen above 32 MHz the memory
interface clock must be set to VBCLK/2, i.e. BMC.CKM0 = 1.
3. When changing the BMC.CKM0 bit, it is necessary to set
VSWC.VSWL[2:0] = 111B before accessing the BMC register.

4. If only the BMC.PDWN bit is changed, the presetting of the VSWC register
is unnecessary.
5. When BMC.PDWN bit is set to "1", the BMC.CKM0 bit is reset to “0” and the
following registers of the memory controller are reset
BCT0, BCT1 →reset value 0000H
DWC0, DWC1 →reset value 7777H
BCC →reset value FFFFH
ASC →reset value FFFFH
LBS →reset value AAAAH
PRC →reset value 7000H
Therefore, it is necessary to initialize all registers again after return from
power down mode. When the BCM.CKM0 bit is changed again, the
www.DataSheet4U.com presetting of the VSWC register is also necessary.

316 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

Example for setting the BMC.CMK0 bit

ld.b VSWC[r0],r11 // save the origin VSWC register setting


ori 0x07,r11,r10 // set VSWC.VSWL[2:0] bits to 1
st.b r10,VSWC[r0]
set1 0,BMC[r0] // set the CMK0 bit to 1
st.b r11,VSWC[r0] // restore the origin VSWC register setting

(7) RDDLY - Read delay control register


The 8-bit RDDLY register controls the delay of the read strobe RD of the
external memory interface’s CS1 area. It provides the option to delay the rising
edge of the RD by a half of the bus clock cycle BCLK.
Access This register can be read/written in 8- and 1-bit units.
Address FFFF FF00H
Initial Value 00H

7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 RDDLYEN
R R R R R R R R/W

Table 7-24 RDDLY register contents


Bit
Bit name Function
position
0 RDDLYEN Read strobe control.
0: Rising RD edge not delayed
1: Rising RD edge delayed by half BCLK clock cycle

Caution 1. To initialize an external memory area after a reset, this register has to be
set. Do not access external devices before initialization is finished. Do not
change this register while an external device is accessed.
2. Read strobe delay can only be applied to the CS1 area.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 317


Chapter 7 Bus and Memory Control (BCU, MEMC)

(8) PRC - Page ROM configuration register


The 16-bit PRC register controls whether a page ROM cycle is on-page or
off-page.
The register specifies the address mask. Masked address bits are not
considered when deciding between on-page or off-page access. Set the mask
according to the number of continuously readable bits.
For page access (cycle is on-page) the register defines the number of inserted
data wait cycles.
Access This register can be read/written in 16-bit units.
Address FFFF F49AH
Initial Value 7000H

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 PRW2 PRW1 PRW0 0 0 0 0 0 0 0 0 MA6 MA5 MA4 MA3
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W

Table 7-25 PRC register contents


Bit position Bit name Function
14 to 12 PRW[2:0] Page ROM on-page wait control.
Sets the number of data waits corresponding to the internal system clock.
PRW[2:0] Inserted data wait states

000B No wait state inserted

001B 1 wait state

010B 2 wait states

011B 3 wait states

... ...

111B 7 wait states

Note: The number of wait states defined in the PRC register is only valid if on-page
access is enabled.
If on-page is disabled, the number of wait states is defined by registers DWC0
and DWC1.
3 to 0 MA[6:3] Mask address.
Setting bits MA6 to MA3 masks the corresponding addresses A6 to A3.
Number of continuously readable bits

MA6 MA5 MA4 MA3 bus width: bus width: bus width:
8 bits 16 bits 32 bits
LBk[1:0]=00B LBk[1:0]=01B LBk[1:0]=10B
0 0 0 0 8 x 8 bits 4 x 16 bits 2 x 32 bits

0 0 0 1 16 x 8 bits 8 x 16 bits 4 x 32 bits


www.DataSheet4U.com 0 0 1 1 32 x 8 bits 16 x 16 bits 8 x 32 bits

0 1 1 1 64 x 8 bits 32 x 16 bits 16 x 32 bits

1 1 1 1 128 x 8 bits 64 x 16 bits 32 x 32 bits

318 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

Note To initialize an external memory area after a reset, register PRC has to be set if
page ROM mode is selected. Do not change this register after initialization. Do
not access external page ROM devices before initialization is finished.

Caution To initialize an external memory area after a reset, this register has to be set.
Do not access external devices before initialization is finished. Do not change
this register while an external device is accessed.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 319


Chapter 7 Bus and Memory Control (BCU, MEMC)

7.4 Page ROM Controller

In page ROM mode the microcontroller reads consecutive data from one page
by inserting the wait cycles defined by PRC.PRW[2:0] instead of wait cycles
defined in registers DWC0 and DWC1.
The page ROM controller decides whether a page ROM cycle is on-page or
off-page. To do so, it buffers the address of the previous cycle and compares it
with the address of the current cycle. If the compare result proves that the read
access is on-page the read cycle is performed with wait cycles defined by
PRC.PRW[2:0].
In the page ROM configuration register (PRC), one or more of the address bits
(A3 to A6) are set as masking addresses (no comparison is made for these
addresses). The masking address is chosen according to the configuration of
the connected page ROM and the number of continuously readable bits.
Wait control for normal access (off-page) and page access (on-page) is
specified by different registers: For page access, wait control is performed
according to PRC register setting. For normal access, wait control is performed
according to DWC0 and DWC1 register settings.
The following figures show the on-page/off-page judgment during page ROM
connection for a 16-Mbit page ROM and for different data bus widths.

(1) 8-bit data bus width


The page size or the number of continuously readable bits is 32 x 8 bit. To
provide 32 addresses, a 5-bit on-page address is required. Therefore, set
PRC.MA[6:3] = 0011B.

Internal address latch


(immediately preceding A22 ... ... ... A7 A6 A5 A4 A3
address)

MA6 MA5 MA4 MA3


PRC register setting
0 0 1 1

Comparison

A22 A21 A20 A19 A7 A6 A5 A4 A3 A2 A1 A0


Output address

Page ROM address A20 A19 A7 A6 A5 A4 A3 A2 A1 A0

Off-page address On-page address

Figure 7-5 16-Mbit page ROM (2 M × 8 bits), page size 32 x 8 bit


www.DataSheet4U.com
(2) 16-bit data bus width
The page size or the number of continuously readable bits is 8 x 16 bit. To
provide 8 addresses, a 3-bit on-page address is required. Therefore, set
PRC.MA[6:3] = 0001B.

Note For a 16-bit data bus, bit A0 of the output address is not used.

320 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

Internal address latch


(immediately preceding A22 ... ... ... A7 A6 A5 A4 A3
address)

MA6 MA5 MA4 MA3


PRC register setting
0 0 0 1

Comparison

A22 A21 A20 A19 A7 A6 A5 A4 A3 A2 A1 A0


Output address

Page ROM address A19 A18 A6 A5 A4 A3 A2 A1 A0

Off-page address On-page address

Figure 7-6 16-Mbit page ROM (1 M × 16 bits), page size 8 x 16 bit

(3) 32-bit data bus width


The page size or the number of continuously readable bits is 2 x 32 bit. To
provide 2 addresses, a 1-bit on-page address is required. Therefore, set
PRC.MA[6:3] = 0000B.

Note For a 32-bit data bus, bits A0 and A1 of the output address are not used.

Internal address latch


(immediately preceding A22 ... ... ... A7 A6 A5 A4 A3
address)

MA6 MA5 MA4 MA3


PRC register setting
0 0 0 0

Comparison

A22 A21 A20 A19 A7 A6 A5 A4 A3 A2 A1 A0


Output address

Page ROM address A18 A17 A5 A4 A3 A2 A1 A0

Off-page address On-page address

www.DataSheet4U.com
Figure 7-7 16-Mbit page ROM (512 k × 32 bits), page size 2 x 32 bit

User’s Manual U17566EE5V1UM00 321


Chapter 7 Bus and Memory Control (BCU, MEMC)

7.5 Configuration of Memory Access

The microcontroller device supports interfacing with various memory devices.


Therefore, the endian format, wait functions and idle state insertions can be
configured.

7.5.1 Endian format

The endian format is specified with the endian configuration register (BEC). It
defines the byte order in which word data is stored.
"Big endian" means that the high-order byte of the word is stored in memory at
the lowest address, and the low-order byte at the highest address. Therefore,
the base address of the word addresses the high-order byte:

bit number 31 24 23 16 15 8 7 0

byte position Byte 0 Byte 1 Byte 2 Byte 3

access via
<base> + 3 <base> + 2 <base> + 1 <base>
addresses

Figure 7-8 Big endian addresses within a word

"Little Endian" means that the low-order byte of the word is stored in memory
at the lowest address, and the high-order byte at the highest address.
Therefore, the base address of the word addresses the low-order byte:

bit number 31 24 23 16 15 8 7 0

byte position Byte 3 Byte 2 Byte 1 Byte 0

access via
<base> + 3 <base> + 2 <base> + 1 <base>
addresses

Figure 7-9 Little endian addresses within a word

7.5.2 Wait function

Several wait functions are supported:

(1) Address setup wait


The microcontroller device allows insertion of address setup wait states before
the first access cycle (T1 state). The number of address setup wait states can
be set with the address setup wait control register ASC for each CS area.
Address setup wait states can be inserted when accessing SRAM or page
www.DataSheet4U.com ROM.

322 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

(2) Programmable wait function


With the purpose of realizing easy interfacing with low-speed memory or with
I/Os, it is possible to insert up to seven data wait states after the first access
cycle (T1 state).
The number of wait states can be specified by data wait control registers
DWC0 and DWC1.
For on-page access of a page ROM, wait control is performed according to
page ROM configuration register (PRC) setting. The settings of registers
DWC0 and DWC1 are neglected.

(3) External wait function


Each read or write operation takes at least two cycles (T1 and T2). To stretch
the access cycle for accessing slow external devices, any number of wait
states (TW) can be inserted under external control of the WAIT signal.
The WAIT signal can be set asynchronously from the system clock. The WAIT
signal is sampled at the rising edge of the clock in the T1 and TW states.
Depending on the level of the WAIT signal at sampling timing, a wait state is
inserted or not.

(4) Relationship between programmable wait and external wait


If both programmable wait and external wait (WAIT) are applied, an OR
relation gives the resulting number of wait cycles. Figure 7-10 shows that as
long as any of the two waits is active, a wait cycle will be performed.

T1 TW TW TW T2

BCLK

WAIT pin

Wait by WAIT pin

Programmable wait

Wait control

Figure 7-10 Example of wait insertion

Note The circles indicate the sampling timing.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 323


Chapter 7 Bus and Memory Control (BCU, MEMC)

7.5.3 Idle state insertion

To facilitate interfacing with low-speed memory devices, an idle state (TI) can
be inserted between two bus cycles, that means after the T2 state. Idle states
are inserted to meet the data output float delay time on memory read access
for each CS space.
Idle states are used to guarantee the interval until the external data bus is
released by memory. The next bus cycle is started after the idle state(s).
Idle states can be inserted after T2 state when accessing SRAM, external I/O,
external ROM, or page ROM.
The number of idle states can be specified by program using the bus cycle
control register (BCC).

7.6 External Devices Interface Timing

This section presents examples of write and read operations. The states are
abbreviated as:
• T1 and T2 states: Basic states for access.
• TW state: Wait state that is inserted according to the DWC0 and DWC1
register settings and according to the WAIT input.
• TASW state: Address setting wait state that is inserted according to the
ASC register settings.
• TI state: Idle state that is inserted according to the BCC register settings.

Note For access to page ROM, see “Page ROM Access Timing“ on page 331.

www.DataSheet4U.com

324 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

7.6.1 Writing to external devices

This section shows typical sequences of writing data to external devices.

(1) Write with external wait cycle

T1 T2 T1 TW T2

BCLK

A[23:0]/BE[3:0]
Address/BE[3:0] Address/BE[3:0]
(output)

CSk (output)

RD (output)

WR (output)

D]31:0] (I/O) Data Data

WAIT (input)

Figure 7-11 Timing: write data

Register settings:
• BCTm.BTk0 = 0 (connected external device is SRAM or external I/O)
• ASC.ACk[1:0] = 00B (no address setup wait states inserted)
• DWCm.DWk[2:0] = 000B (no programmable data wait states inserted)
• BCC.BCk[1:0] = 00B (no idle states inserted)

Note 1. The circles indicate the sampling timing.


2. The broken line indicates the high-impedance state (bus is not driven).

The data has to be stable at the rising edge of the WR signal. For details refer
to the Data Sheet.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 325


Chapter 7 Bus and Memory Control (BCU, MEMC)

(2) Write with address setup wait and idle state insertion

TASW T1 T2 TI

BCLK

A[23:0]/BE[3:0]
Address/BE[3:0]
(output)

CSk (output)

RD (output)

WR (output)

D[31:0] (I/O) Data

WAIT (input)

Figure 7-12 Timing: write data with address setup wait and idle state insertion

Register settings:
• BCTm.BTk0 = 0 (connected external device is SRAM or external I/O)
• ASC.ACk[1:0] = 01B (one address setup wait state inserted)
• DWCm.DWk[2:0] = 000B (no programmable data wait states inserted)
• BCC.BCk[1:0] = 01B (one idle state inserted)

Note 1. The circles indicate the sampling timing.


2. The broken line indicates the high-impedance state (bus is not driven).

The data has to be stable at the rising edge of the WR signal. For details refer
to the Data Sheet.

www.DataSheet4U.com

326 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

7.6.2 Reading from external devices

This section shows typical sequences of reading data from external devices.

(1) Read with external wait cycle

T1 T2 T1 TW T2

BCLK

A[23:0]/BE[3:0]
Address/BE[3:0] Address/BE[3:0]
(output)

CSk (output)

RD (output)

WR (output)

D[31:0] (I/O) Data Data

WAIT (input)

Figure 7-13 Timing: read data

Register settings:
• BCTm.BTk0 = 0 (connected external device is SRAM or external I/O)
• ASC.ACk[1:0] = 00B (no address setup wait states inserted)
• DWCm.DWk[2:0] = 000B (no programmable data wait states inserted)
• BCC.BCk[1:0] = 00B (no idle states inserted)

Note 1. The circles indicate the sampling timing.


2. The broken line indicates the high-impedance state (bus is not driven).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 327


Chapter 7 Bus and Memory Control (BCU, MEMC)

(2) Read with address setup wait and idle state insertion

TASW T1 T2 TI

BCLK

A[23:0]/BE[3:0]
Address/BE[3:0]
(output)

CSk (output)

RD (output)

WR (output)

D[31:0] (I/O) Data

WAIT (input)

Figure 7-14 Timing: read data with address setup wait and idle state insertion

Register settings:
• BCTm.BTk0 = 0 (connected external device is SRAM or external I/O)
• ASC.ACk[1:0] = 01B (one address setup wait state inserted)
• DWCm.DWk[2:0] = 000B (no programmable data wait states inserted)
• BCC.BCk[1:0] = 01B (one idle state inserted)

Note 1. The circles indicate the sampling timing.


2. The broken line indicates the high-impedance state (bus is not driven).

www.DataSheet4U.com

328 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

7.6.3 Read-write operation on external devices

T1 T2 T1 T2

BCLK

A[23:0]/BE[3:0]
Address/BE[3:0]
(output)

CSk (output)

RD (output)

WR (output)

D[31:0] (I/O) DataData

WAIT (input)

Figure 7-15 Read-write operation

Register settings:
• BCTm.BTk0 = 0 (connected external device is SRAM or external I/O)
• ASC.ACk[1:0] = 00B (no address setup wait states inserted)
• DWCm.DWk[2:0] = 000B (no programmable data wait states inserted)
• BCC.BCk[1:0] = 00B (no idle states inserted)

Note 1. The circles indicate the sampling timing.


2. The broken line indicates the high-impedance state (bus is not driven).

The data has to be stable at the rising edge of the WR signal. For details refer
to the Data Sheet.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 329


Chapter 7 Bus and Memory Control (BCU, MEMC)

7.6.4 Write-read operation on external devices

T1 T2 T1 T2

BCLK

A[23:0]/BE[3:0]
Address/BE[3:0]
(output)

CSk (output)

RD (output)

WR (output)

D[31:0] (I/O) Data Data

WAIT (input)

Figure 7-16 Write-read operation

Register settings:
• BCTm.BTk0 = 0 (connected external device is SRAM or external I/O)
• ASC.ACk[1:0] = 00B (no address setup wait states inserted)
• DWCm.DWk[2:0] = 000B (no programmable data wait states inserted)
• BCC.BCk[1:0] = 00B (no idle states inserted)

Note 1. The circles indicate the sampling timing.


2. The broken line indicates the high-impedance state (bus is not driven).

The data has to be stable at the rising edge of the WR signal. For details refer
to the Data Sheet.

www.DataSheet4U.com

330 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

7.7 Page ROM Access Timing

This section presents examples of read operations on page ROM. The states
are abbreviated as:
• T1 and T2 states: Basic states for access.
• TW state: Wait state that is inserted according to the DWC0 and DWC1
register settings and according to the WAIT input.
• TOW state: Wait state that is inserted according to the PRC.PRW[2:0]
settings and according to the WAIT input.
• TO1 and TO2: On-page states
• TASW state: Address setting wait state that is inserted according to the
ASC register settings.
• TI state: Idle state that is inserted according to the BCC register settings.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 331


Chapter 7 Bus and Memory Control (BCU, MEMC)

7.7.1 Half word/word access with 8-bit bus or word access with 16-
bit bus

(1) Read operation


Note that during on-page access, less data wait states are inserted than during
off-page access.

T1 TW TW T2 TO1 TOW TO2

BCLK

A[23:0]/BE[3:0]
(output) Off-page address/BE[3:0] On-page address/BE[3:0]

CSk (output)

RD (output)

WR (output)

D[7:0] (I/O)
Data Data
D[15:0] (I/O)

WAIT (input)

Figure 7-17 Reading page ROM

• Register settings:
• BCTm.BTk0 = 1 (connected external device is page ROM)
• ASC.ACk[1:0] = 00B (no address setup wait states inserted)
• DWCm.DWk[2:0] = 010B (two programmable data wait states for off-page
access inserted)
• PRC.PRW[2:0] = 001B (one programmable data wait state for on-page
access inserted)
• BCC.BCk[1:0] = 00B (no idle states inserted)

Note 1. The circles indicate the sampling timing.


2. The broken line indicates the high-impedance state (bus is not driven).

www.DataSheet4U.com

332 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

(2) Read operation with address setup wait states and idle state insertion

TASW T1 T2 TASW TO1 TO2 TI

BCLK

A[23:0]/BE[3:0]
Off-page address/BE[3:0] On-page address/BE[3:0]
(output)

CSk (output)

RD (output)

WR (output)

D[7:0] (I/O)
Data Data
D[15:0] (I/O)

WAIT (input)

01B
BCC.BCk[1:0] 00B

Figure 7-18 Reading page ROM with address setup wait states and idle state
insertion

Register settings:
• BCTm.BTk0 = 1 (connected external device is page ROM)
• ASC.ACk[1:0] = 01B (one address setup wait state inserted)
• DWCm.DWk[2:0] = 000B (no programmable data wait states for off-page
access inserted)
• PRC.PRW[2:0] = 000B (no programmable data wait states for on-page
access inserted)
• BCC.BCk[1:0] : see Figure 7-18

Note 1. The circles indicate the sampling timing.


2. The broken line indicates the high-impedance state (bus is not driven).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 333


Chapter 7 Bus and Memory Control (BCU, MEMC)

7.7.2 Byte access with 8-bit bus or byte/half word access with 16-
bit bus

(1) Read operation


Note that during on-page access, less data wait states are inserted than during
off-page access.

T1 TW TW T2 TO1 TOW TO2

BCLK

A[23:0]/BE[3:0]
Off-page address/BE[3:0] On-page address/BE[3:0]
(output)

CSk (output)

RD (output)

WR (output)

D[7:0] (I/O)
Data Data
D[15:0] (I/O)

WAIT (input)

Figure 7-19 Reading page ROM

Register settings:
• BCTm.BTk0 = 1 (connected external device is page ROM)
• ASC.ACk[1:0] = 00B (no address setup wait states inserted)
• DWCm.DWk[2:0] = 010B (two programmable data wait states for off-page
access inserted)
• PRC.PRW[2:0] = 001B (one programmable data wait state for on-page
access inserted)
• BCC.BCk[1:0] = 00B (no idle states inserted)

Note 1. The circles indicate the sampling timing.


2. The broken line indicates the high-impedance state (bus is not driven).

www.DataSheet4U.com

334 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

(2) Read operation with address setup wait states and idle state insertion

TASW T1 T2 TASW TO1 TO2 TI

BCLK

A[23:0]/BE[3:0]
Off-page address/BE[3:0] On-page address/BE[3:0]
(output)

CSk (output)

RD (output)

WR (output)

D[7:0] (I/O)
Data Data
D[15:0] (I/O)

WAIT (input)

01B
BCC.BCk[1:0] 00B

Figure 7-20 Reading page ROM with address setup wait states and idle state
insertion

Register settings:
• BCTm.BTk0 = 1 (connected external device is page ROM)
• ASC.ACk[1:0] = 01B (one address setup wait state inserted)
• DWCm.DWk[2:0] = 000B (no programmable data wait states for off-page
access inserted)
• PRC.PRW[2:0] = 000B (no programmable data wait states for on-page
access inserted)
• BCC.BCk[1:0] : see Figure 7-20

Note 1. The circles indicate the sampling timing.


2. The broken line indicates the high-impedance state (bus is not driven).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 335


Chapter 7 Bus and Memory Control (BCU, MEMC)

7.8 Data Access Order

7.8.1 Access to 8-bit data busses

This section shows how byte, half word and word accesses are performed for
an 8-bit data bus.

(1) Byte access (8 bits)

(a) Little endian

Address Address
7 7 7 7
2n 2n + 1
0 0 0 0
Byte data External Byte data External
data bus data bus

Figure 7-21 Left: Access to even address (2n)


Right: Access to odd address (2n + 1)

(b) Big endian

Address Address
7 7 7 7
2n 2n + 1
0 0 0 0
Byte data External Byte data External
data bus data bus

Figure 7-22 Left: Access to even address (2n)


Right: Access to odd address (2n + 1)

www.DataSheet4U.com

336 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

(2) Halfword access (16 bits)

(a) Little endian

1-st Access 2-nd Access 1-st Access 2-nd Access

15 15 15 15

Address Address Address Address


8 8 8 8
7 7 7 7 7 7 7 7
2n 2n + 1 2n + 1 2n + 2
0 0 0 0 0 0 0 0
Halfword External Halfword External Halfword External Halfword External
data data bus data data bus data data bus data data bus

Figure 7-23 Left: Access to even address (2n)


Right: Access to odd address (2n + 1)

(b) Big endian

1-st Access 2-nd Access 1-st Access 2-nd Access

15 15 15 15

Address Address 8 Address 8 Address


8 8
7 7 7 7 7 7 7 7
2n 2n + 1 2n + 1 2n + 2
0 0 0 0 0 0 0 0
Halfword External Halfword External Halfword External Halfword External
data data bus data data bus data data bus data data bus

Figure 7-24 Left: Access to even address (2n)


Right: Access to odd address (2n + 1)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 337


Chapter 7 Bus and Memory Control (BCU, MEMC)

(3) Word access (32 bits)

(a) Little endian

1-st Access 2-nd Access 3-rd Access 4-th Access

31 31 31 31

24 24 24 24
23 23 23 23

16 16 16 16
15 15 15 15

8 Address 8 Address 8 Address 8 Address


7 7 7 7 7 7 7 7
4n 4n + 1 4n + 2 4n + 3
0 0 0 0 0 0 0 0
Word data External Word data External Word data External Word data External
data bus data bus data bus data bus

Figure 7-25 Access to address 4n

1-st Access 2-nd Access 3-rd Access 4-th Access

31 31 31 31

24 24 24 24
23 23 23 23

16 16 16 16
15 15 15 15

8 Address 8 Address 8 Address 8 Address


7 7 7 7 7 7 7 7
4n + 1 4n + 2 4n + 3 4n + 4
0 0 0 0 0 0 0 0
Word data External Word data External Word data External Word data External
data bus data bus data bus data bus

Figure 7-26 Access to address 4n + 1

www.DataSheet4U.com

338 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

1-st Access 2-nd Access 3-rd Access 4-th Access


31 31 31 31

24 24 24 24
23 23 23 23

16 16 16 16
15 15 15 15

8 Address 8 Address 8 Address 8 Address


7 7 7 7 7 7 7 7
4n + 2 4n + 3 4n + 4 4n + 5
0 0 0 0 0 0 0 0
Word data External Word data External Word data External Word data External
data bus data bus data bus data bus

Figure 7-27 Access to address 4n + 2

1-st Access 2-nd Access 3-rd Access 4-th Access


31 31 31 31

24 24 24 24
23 23 23 23

16 16 16 16
15 15 15 15

8 Address 8 Address 8 Address 8 Address


7 7 7 7 7 7 7 7
4n + 3 4n + 4 4n + 5 4n + 6
0 0 0 0 0 0 0 0
Word data External Word data External Word data External Word data External
data bus data bus data bus data bus

Figure 7-28 Access to address 4n + 3

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 339


Chapter 7 Bus and Memory Control (BCU, MEMC)

(b) Big endian

1-st Access 2-nd Access 3-rd Access 4-th Access


31 31 31 31

24 24 24 24
23 23 23 23

16 16 16 16
15 15 15 15

8 Address 8 Address 8 Address 8 Address


7 7 7 7 7 7 7 7
4n 4n + 1 4n + 2 4n + 3
0 0 0 0 0 0 0 0
Word data External Word data External Word data External Word data External
data bus data bus data bus data bus

Figure 7-29 Access to address 4n

1-st Access 2-nd Access 3-rd Access 4-th Access


31 31 31 31

24 24 24 24
23 23 23 23

16 16 16 16
15 15 15 15

8 Address 8 Address 8 Address 8 Address


7 7 7 7 7 7 7 7
4n + 1 4n + 2 4n + 3 4n + 4
0 0 0 0 0 0 0 0
Word data External Word data External Word data External Word data External
data bus data bus data bus data bus

Figure 7-30 Access to address 4n + 1

www.DataSheet4U.com

340 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

1-st Access 2-nd Access 3-rd Access 4-th Access


31 31 31 31

24 24 24 24
23 23 23 23

16 16 16 16
15 15 15 15

8 Address 8 Address 8 Address 8 Address


7 7 7 7 7 7 7 7
4n + 2 4n + 3 4n + 4 4n + 5
0 0 0 0 0 0 0 0
Word data External Word data External Word data External Word data External
data bus data bus data bus data bus

Figure 7-31 Access to address 4n + 2

1-st Access 2-nd Access 3-rd Access 4-th Access


31 31 31 31

24 24 24 24
23 23 23 23

16 16 16 16
15 15 15 15

8 Address 8 Address 8 Address 8 Address


7 7 7 7 7 7 7 7
4n + 3 4n + 4 4n + 5 4n + 6
0 0 0 0 0 0 0 0
Word data External Word data External Word data External Word data External
data bus data bus data bus data bus

Figure 7-32 Access to address 4n + 3

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 341


Chapter 7 Bus and Memory Control (BCU, MEMC)

7.8.2 Access to 16-bit data busses

This section shows how byte, half word and word accesses are performed for a
16 bit data bus.
Access all data in order starting from the lower order side.

(1) Byte access (8 bits)

(a) Little endian

Address Address
15 15
2n + 1
8 8
7 7 7 7
2n
0 0 0 0
Byte data External Byte data External
data bus data bus

Figure 7-33 Left: Access to even address (2n)


Right: Access odd address (2n + 1)

(b) Big endian

Address Address
15 15
2n
8 8
7 7 7 7
2n + 1
0 0 0 0
Byte data External Byte data External
data bus data bus

Figure 7-34 Left: Access to even address (2n)


Right: Access to odd address (2n + 1)

www.DataSheet4U.com

342 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

(2) Halfword access (16 bits)

(a) Little endian

1-st Access 2-nd Access

Address Address Address


15 15 15 15 15 15
2n + 1 2n + 1
8 8 8 8 8 8
7 7 7 7 7 7
2n 2n + 2
0 0 0 0 0 0
Halfword External Halfword External Halfword External
data data bus data data bus data data bus

Figure 7-35 Left: Access to even address (2n)


Right: Access to odd address (2n + 1)

(b) Big endian

1-st Access 2-nd Access

Address Address Address


15 15 15 15 15 15
2n 2n + 2
8 8 8 8 8 8
7 7 7 7 7 7
2n + 1 2n + 1
0 0 0 0 0 0
Halfword External Halfword External Halfword External
data data bus data data bus data data bus

Figure 7-36 Left: Access to even address (2n)


Right: Access to odd address (2n + 1)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 343


Chapter 7 Bus and Memory Control (BCU, MEMC)

(3) Word access (32 bits)

(a) Little endian


1-st Access 2-nd Access

31 31

24 24
23 23

Address Address
16 16
15 15 15 15
4n + 1 4n + 3
8 8 8 8
7 7 7 7
4n 4n + 2
0 0 0 0
Word data External Word data External
data bus data bus

Figure 7-37 Access to address 4n

1-st Access 2-nd Access 3-rd Access

31 31 31

24 24 24
23 23 23

Address Address Address


16 16 16
15 15 15 15 15 15
4n + 1 4n + 3
8 8 8 8 8 8
7 7 7 7 7 7
4n + 2 4n + 4
0 0 0 0 0 0
Word data External Word data External Word data External
data bus data bus data bus

Figure 7-38 Access to address 4n + 1

www.DataSheet4U.com

344 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

1-st Access 2-nd Access

31 31

24 24
23 23

Address Address
16 16
15 15 15 15
4n + 3 4n + 5
8 8 8 8
7 7 7 7
4n + 2 4n + 4
0 0 0 0
Word data External Word data External
data bus data bus

Figure 7-39 Access to address 4n + 2

1-st Access 2-nd Access 3-rd Access

31 31 31

24 24 24
23 23 23

Address Address Address


16 16 16
15 15 15 15 15 15
4n + 3 4n + 5
8 8 8 8 8 8
7 7 7 7 7 7
4n + 4 4n + 6
0 0 0 0 0 0
Word data External Word data External Word data External
data bus data bus data bus

Figure 7-40 Access to address 4n + 3

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 345


Chapter 7 Bus and Memory Control (BCU, MEMC)

(b) Big endian


1-st Access 2-nd Access

31 31

24 24
23 23

Address Address
16 16
15 15 15 15
4n 4n + 2
8 8 8 8
7 7 7 7
4n + 1 4n + 3
0 0 0 0
Word data External Word data External
data bus data bus

Figure 7-41 Access to address 4n

1-st Access 2-nd Access 3-rd Access

31 31 31

24 24 24
23 23 23

Address Address Address


16 16 16
15 15 15 15 15 15
4n + 2 4n + 4
8 8 8 8 8 8
7 7 7 7 7 7
4n + 1 4n + 3
0 0 0 0 0 0
Word data External Word data External Word data External
data bus data bus data bus

Figure 7-42 Access to address 4n + 1

www.DataSheet4U.com

346 User’s Manual U17566EE5V1UM00


Bus and Memory Control (BCU, MEMC) Chapter 7

1-st Access 2-nd Access


31 31

24 24
23 23

Address Address
16 16
15 15 15 15
4n + 2 4n + 4
8 8 8 8
7 7 7 7
4n + 3 4n + 5
0 0 0 0
Word data External Word data External
data bus data bus

Figure 7-43 Access to address 4n + 2

1-st Access 2-nd Access 3-rd Access


31 31 31

24 24 24
23 23 23

Address Address Address


16 16 16
15 15 15 15 15 15
4n + 4 4n + 6
8 8 8 8 8 8
7 7 7 7 7 7
4n + 3 4n + 5
0 0 0 0 0 0
Word data External Word data External Word data External
data bus data bus data bus

Figure 7-44 Access to address 4n + 3

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 347


Chapter 7 Bus and Memory Control (BCU, MEMC)

www.DataSheet4U.com

348 User’s Manual U17566EE5V1UM00


Chapter 8 DMA Controller (DMAC)

The microcontroller includes a direct memory access (DMA) controller (DMAC)


that executes and controls DMA transfers.

Note Throughout this chapter, the individual channels of the DMA Controller are
identified by “n”.

The DMAC controls data transfer between memory and I/O or among I/Os,
based on DMA requests issued by the on-chip peripheral I/O, or software
triggers.

8.1 Features

• Four independent DMA channels


• Transfer units: 8, 16 and 32 bits

• Maximum transfer count: 65536 (216)


• Two transfer modes independently selectable for each DMA channel
– Single transfer mode
– Block transfer mode
• Transfer requests
– Requests by dedicated peripheral interrupts of
– µPD70F3421, µPD70F3422, µPD70F3423: CSIB0, CSIB1, UARTA0,
UARTA1, IIC0, IIC1, TMG0, TMP0, TMP1, TMZ0, TMZ1, TMZ2, ADC
– µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427:
CSIB0…CSIB2, UARTA0, UARTA1, IIC0, IIC1, TMG0, TMP0, TMP1,
TMZ0, TMZ1, TMZ2, LCDIF, ADC
– Requests by software trigger
• Transfer objects

Source \ VSB Flash VSB RAM external memory


Destination Internal RAM (µPD70F3426A) (µPD70F3426A) (µPD70F3427) Peripherals
Internal RAM – √ √ √ √
VSB Flash
– – – – –
(µPD70F3426A)
VSB RAM
√ √ √ – √
(µPD70F3426A)
external memory
√ – – √ √
(µPD70F3427)
w w w . D Peripherals
a t a S h e e √t 4 U . c o √m √ √ √

User’s Manual U17566EE5V1UM00 349


Chapter 8 DMA Controller (DMAC)

Caution Special care must be taken when using the internal RAM as DMA source or
destination. Refer to “Simultaneous program execution and DMA transfer with
internal RAM“ on page 374.

• DMA transfer completion flag


• Automatic restart function
• Forcible DMA termination by NMI

www.DataSheet4U.com

350 User’s Manual U17566EE5V1UM00


DMA Controller (DMAC) Chapter 8

8.2 Peripheral and CPU Clock Settings

In order to ensure safe capture of DMA trigger signals from the involved
peripheral functions, a certain minimum relation between the operation clock of
the concerned peripheral function and the CPU system has to be regarded.
In the following table the minimum CPU system clock frequency fVBCLK is given
for all peripheral functions operation clocks.

Table 8-1 Peripheral functions and CPU system clocks for DMA transfers (1/2)
SPCLKn, PCLKn Minimum
configuration Input clock
Peripheral Clock controller settings fVBCLK
[MHz]
Peripheral clock Source [MHz]
ADC SCC = 00H SPCLK0 MainOsc 4 6.00
SCC = 01H PLL/2 16 24.00
SCC= 03H fSSCGPS 16 24.00
SCPS.SPSPS[2:0] = 011B
SSCG: 64 MHz
SCC = 03H fSSCGPS 12 18.00
SCPS.SPSPS[2:0] = 011B
SSCG: 48 MHz
UARTA CKC.PERIC = 0 PCLK1 MainOsc 4 6.00
CKC.PERIC = 1 PLL/4 8 12.00
PCLK2 MainOsc 4 6.00
PCLK3 MainOsc/2 2 3.00
PCLK4 MainOsc/4 1 1.5
PCLK5 MainOsc/8 0.5 0.75
PCLK6 MainOsc/16 0.25 0.38
PCLK7 MainOsc/32 0.125 0.19
PCLK8 MainOsc/64 0.0625 0.09
CSIB CKC.PERIC = 0 PCLK1 MainOsc 4 6.00
CKC.PERIC = 1 PLL/4 8 12.00
PCLK2 MainOsc 4 6.00
PCLK3 MainOsc/2 2 3.00
PCLK4 MainOsc/4 1 1.50
PCLK5 MainOsc/8 0.5 0.75
PCLK6 MainOsc/16 0.250 0.38
SCC = 00H SPCLK1 MainOsc max. 4 6.00
via Baud Rate min. 0.002 0.003
Generator
SCC = 01H PLL/4 max. 8 12.00
min. 0.002 0.003
SCC = 03H fSSCGPS/2 max. 8 12.00
www.DataSheet4U.com
SCPS.SPSPS[2:0] = 011B min. 0.002 0.003
SSCG: 64 MHz
SCC = 03H fSSCGPS/2 max. 8 12.00
SCPS.SPSPS[2:0] = 011B min. 0.002 0.003
SSCG: 48 MHz

User’s Manual U17566EE5V1UM00 351


Chapter 8 DMA Controller (DMAC)

Table 8-1 Peripheral functions and CPU system clocks for DMA transfers (2/2)
SPCLKn, PCLKn Minimum
configuration Input clock
Peripheral Clock controller settings fVBCLK
[MHz]
Peripheral clock Source [MHz]
IIC ICC = 00H IICLK MainOsc 4 6.00
ICC = 72H PLL / 4.5 7.11 10.67
ICC = 71H, (SSCG/2) / 4.5 7.11 10.67
SSCG: 64 MHz
ICC = 51H, (SSCG/2) / 3.5 6.86 10.29
SSCG: 48 MHz
TMZ all settings PCLK1 MainOsc 4 6.00
TMP CKC.PERIC = 0 PCLK0 MainOsc 4 6.00
1 PLL/2 16 24.00
TMG SCC = 00H SPCLK0 MainOsc 4 6.00
SCC = 01H PLL/2 16 24.00
SCC = 03H fSSCGPS 16 24.00
SCPS.SPSPS[2:0] = 011B
SSCG: 64 MHz
SCC = 03H fSSCGPS 12 18.00
SCPS.SPSPS[2:0] = 011B
SSCG: 48 MHz
LCDIF SCC = 00H SPCLK0 MainOsc 4 6.00
SPCLK1 MainOsc 4 6.00
SPCLK2 MainOsc 4 6.00
SPCLK5 MainOsc/ 0.5 0.75
SCC = 01H SPCLK0 PLL/2 16 24.00
SPCLK1 PLL/4 8 12.00
SPCLK2 MainOsc 4 6.00
SPCLK5 MainOsc/ 0.5 0.75
SCC = 03H SPCLK0 fSSCGPS 16 24.00
SCPS.SPSPS[2:0] = 011B
SPCLK1 fSSCGPS/2 8 12.00
SSCG: 64 MHz
SPCLK2 fSSCGPS/4 4 6.00
SPCLK5 fSSCGPS/32 0.5 0.75
SCC = 03H SPCLK0 fSSCGPS 12 18.00
SCPS.SPSPS[2:0] = 011B
SPCLK1 fSSCGPS/2 6 9
SSCG: 48 MHz
SPCLK2 fSSCGPS/4 3 4.50
SPCLK5 fSSCGPS/32 0.375 0.56

www.DataSheet4U.com

352 User’s Manual U17566EE5V1UM00


DMA Controller (DMAC) Chapter 8

8.3 DMAC Registers

8.3.1 DMA Source address registers

These registers are used to set the DMA source addresses (28 bits each) for
DMA channel n. They are divided into two 16-bit registers, DSAHn and DSALn.
Since these registers are configured as 2-stage FIFO buffer registers, a new
source address for DMA transfer can be specified during DMA transfer (refer to
“Automatic Restart Function“ on page 366).

Caution DMA transfers of misaligned 16-bit/32-bit data is not supported.

(1) DSAHn - DMA source address registers Hn


Access These registers can be read/written in 16-bit units.
Address DSAH0: FFFF F082H
DSAH1: FFFF F08AH
DSAH2: FFFF F092H
DSAH3: FFFF F09AH
Initial Value undefined

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
IR 0 0 0 SA27 SA26 SA25 SA24 SA23 SA22 SA21 SA20 SA19 SA18 SA17 SA16
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W

Table 8-2 DSAHn register contents


Bit position Bit name Function
15 IR Specifies the DMA source address.
0: External memory or On-chip peripheral I/O
1: Internal RAM
11 to 0 SA27 to Sets the DMA source addresses (A27 to A16).
SA16 During DMA transfer, it stores the next DMA transfer source address.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 353


Chapter 8 DMA Controller (DMAC)

(2) DSALn - DMA source address registers Ln


Access These registers can be read/written in 16-bit units.
Address DSAL0: FFFF F080H
DSAL1: FFFF F088H
DSAL2: FFFF F090H
DSAL3: FFFF F098H

Initial Value undefined

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
SA15 SA14 SA13 SA12 SA11 SA10 SA9 SA8 SA7 SA6 SA5 SA4 SA3 SA2 SA1 SA0
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W

Table 8-3 DSALn register contents


Bit position Bit name Function
15 to 0 SA15 to Sets the DMA source address (A15 to A0). During DMA transfer, it stores the next
SA0 DMA transfer source address.

www.DataSheet4U.com

354 User’s Manual U17566EE5V1UM00


DMA Controller (DMAC) Chapter 8

8.3.2 DMA destination address registers

These registers are used to set the DMA destination address (28 bits each) for
DMA channel n. They are divided into two 16-bit registers, DDAHn and
DDALn.
Since these registers are configured as 2-stage FIFO buffer registers, a new
destination address for DMA transfer can be specified during DMA transfer
(refer to “Automatic Restart Function“ on page 366).

Caution DMA transfers of misaligned 16-bit/32-bit data is not supported.

(1) DDAHn - DMA destination address registers Hn


Access These registers can be read/written in 16-bit units.
Address DDAH0: FFFF F086H
DDAH1: FFFF F08EH
DDAH2: FFFF F096H
DDAH3: FFFF F09EH
Initial Value undefined

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
IR 0 0 0 DA27 DA26 DA25 DA24 DA23 DA22 DA21 DA20 DA19 DA18 DA17 DA16
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W

Table 8-4 DDAHn register contents


Bit position Bit name Function
15 IR Specifies the DMA destination address.
0: External memory or On-chip peripheral I/O
1: Internal RAM
11 to 0 DA27 to Sets the DMA destination addresses (A27 to A16). During DMA transfer, it stores
DA16 the next DMA transfer destination address.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 355


Chapter 8 DMA Controller (DMAC)

(2) DDALn - DMA destination address registers Ln


Access These registers can be read/written in 16-bit units.
Address DDAL0: FFFF F084H
DDAL1: FFFF F08CH
DDAL2: FFFF F094H
DDAL3: FFFF F09CH

Initial Value undefined

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DA15 DA14 DA13 DA12 DA11 DA10 DA9 DA8 DA7 DA6 DA5 DA4 DA3 DA2 DA1 DA0
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W

Table 8-5 DDALn regsiter contents


Bit position Bit name Function
15 to 0 DA15 to Sets the DMA destination address (A15 to A0). During DMA transfer, it stores the
DA0 next DMA transfer destination address.

www.DataSheet4U.com

356 User’s Manual U17566EE5V1UM00


DMA Controller (DMAC) Chapter 8

8.3.3 DBCn - DMA transfer count registers

These 16-bit registers are used to set the transfer counts for DMA channels n.
They store the remaining transfer counts during DMA transfer.
Since these registers are configured as 2-stage FIFO buffer registers, a new
DMA transfer count for DMA transfer can be specified during DMA transfer
(refer to “Automatic Restart Function“ on page 366).
During DMA transfer these registers are decremented by 1 for each transfer
that is performed. DMA transfer is terminated when an underflow occurs (from
0 to FFFFH). On terminal count these registers are rewritten with the value that
was set to the DBCn master register before.
Access These registers can be read/written in 16-bit units.
Address DBC0: FFFF F0C0H
DBC1: FFFF F0C2H
DBC2: FFFF F0C4H
DBC3: FFFF F0C6H
Initial Value undefined

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
BC15 BC14 BC13 BC12 BC11 BC10 BC9 BC8 BC7 BC6 BC5 BC4 BC3 B2C BC1 BC0
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W

Table 8-6 DBCn register contents


Bit position Bit name Function
15 to 0 BC15 to Sets the transfer count. It stores the remaining transfer count during DMA transfer.
BC0
DBCn States
0000H Transfer count 1 or remaining transfer count
0001H Transfer count 2 or remaining transfer count
: :
FFFFH Transfer count 65,536 (216) or remaining transfer count

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 357


Chapter 8 DMA Controller (DMAC)

8.3.4 DADCn - DMA addressing control registers

These 16-bit registers are used to control the DMA transfer modes for DMA
channel n.
Access These registers can be read/written in 16-bit units.
Address DADC0: FFFF F0D0H
DADC1: FFFF F0D2H
DADC2: FFFF F0D4H
DADC3: FFFF F0D6H
Initial Value 0000H

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DS1 DS0 0 0 0 0 0 0 SAD1 SAD0 DAD1 DAD0 TM1 TM0 0 0
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W

Table 8-7 DADCn register contents

Bit position Bit name Function

15, 14 DS1, DS0 Sets the transfer data size for DMA transfer.
DS1 DS0 Transfer data size
0 0 8 bits
0 1 16 bits
1 0 32 bits
1 1 Setting prohibited
For the peripheral I/O and programmable peripheral I/O registers, ensure the
transfer size matches the access size.
7, 6 SAD1, Sets the count direction of the source address for DMA channel n.
SAD0
SAD1 SAD0 Count direction
0 0 Increment
0 1 Decrement
1 0 Fixed
1 1 Setting prohibited

5, 4 DAD1, Sets the count direction of the destination address for DMA channel n.
DAD0
DAD1 DAD0 Count direction
0 0 Increment
0 1 Decrement
1 0 Fixed
1 1 Setting prohibited

3, 2 TM1, TM0 Sets the transfer mode during DMA transfer.


www.DataSheet4U.com
TM1 TM0 Transfer mode
0 0 Single transfer mode
0 1 Setting prohibited
1 0 Setting prohibited
1 1 Block transfer mode

358 User’s Manual U17566EE5V1UM00


DMA Controller (DMAC) Chapter 8

Caution These registers cannot be accessed during DMA operation.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 359


Chapter 8 DMA Controller (DMAC)

8.3.5 DCHCn - DMA channel control registers

These 8-bit registers are used to control the DMA transfer operating mode for
DMA channel n.
Access These registers can be read/written in 8-bit or 1-bit units. (However, bit 7 is
read only and bits 2 and 1 are write only. If bits 2 and 1 are read, the read
value is always 0.)
Address DCHC0: FFFF F0E0H
DCHC1: FFFF F0E2H
DCHC2: FFFF F0E4H
DCHC3: FFFF F0E6H
Initial Value 00H

7 6 5 4 3 2 1 0
TCn 0 0 0 MLEn INITn STGn ENn
R/W R/W R/W R/W R/W R/W R/W R/W

Table 8-8 DCHCn register contents


Bit position Bit name Function
7 TCn The Terminal Count status bit TC indicates whether DMA transfer through DMA
channel n has ended or not. It is read-only, and is set to 1 when DMA transfer ends
and cleared (0) when it is read.
0: DMA transfer had not ended.
1: DMA transfer had ended.
3 MLEn When the Multi Link Enable bit MLE is set to 1 at terminal count output, the ENn bit
is not cleared to 0 and the DMA transfer enable state is retained (refer to
“Automatic Restart Function“ on page 366). Moreover, the next DMA transfer
request can be accepted even when the TCn bit is not read, that means it is not
cleared.
When this bit is cleared to 0 at terminal count output, the ENn bit is cleared to 0 and
the DMA transfer disable state is entered. At the next DMA request, the setting of
the ENn bit to 1 and the reading of the TCn bit are required.
2 INITn When this bit is set to 1, DMA transfer is forcibly terminated.
1 STGn If this bit is set to 1 in the DMA transfer enable state (TCn bit = 0, ENn bit = 1),
DMA transfer is started.
0 ENn Specifies whether DMA transfer through DMA channel n is to be enabled or
disabled.
0: DMA transfer disabled
1: DMA transfer enabled
If MLEn=0, this bit is cleared to 0 when DMA transfer ends.
If MLEn=1, this bit is not cleared and the next DMA transfer is automatically
restarted (refer to “Automatic Restart Function“ on page 366).
This bit is also cleared to 0 when DMA transfer is forcibly terminated by means of
setting the INITn bit to 1 or by NMI input.

www.DataSheet4U.com

360 User’s Manual U17566EE5V1UM00


DMA Controller (DMAC) Chapter 8

8.3.6 DRST - DMA restart register

The ENn bit of this register and the ENn bit of the DCHCn register are linked to
each other. This provides a fast way to check the status of all DMA channels.
Access This register can be read/written in 8-bit or 1-bit units.
Address FFFF F0F2H
Initial Value 00H

7 6 5 4 3 2 1 0
0 0 0 0 EN3 EN2 EN1 EN0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 8-9 DRST register contents


Bit position Bit name Function
3 to 0 EN3 to EN0 Specifies whether DMA transfer through DMA channel n is to be enabled or
disabled. This bit is cleared to 0 when DMA transfer is completed in accordance
with the terminal count output.
It is also cleared to 0 when DMA transfer is forcibly terminated by setting the
INITn bit to 1 or by NMI input.
0: DMA transfer disabled
1: DMA transfer enabled

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 361


Chapter 8 DMA Controller (DMAC)

8.3.7 DTFRn - DMA trigger source select register

The 8-bit DMA trigger source selection registers are used to control the DMA
transfer triggers for the individual DMA channels. These triggers initiate DMA
transfer requests received from built-in peripheral hardware.
Interrupt signals are used as DMA transfer requests.
Access This register can be read/written in 8-bit or 1-bit units.
Address DTFR0: FFFF FE00H
DTFR1: FFFF FE02H
DTFR2: FFFF FE04H
DTFR3: FFFF FE06H
Initial Value 00H

7 6 5 4 3 2 1 0
DRQn DOFLn DMACTn 0a 0a IFCn2 IFCn1 IFCn0
R/W R/W Note R/W Note R/W R/W R/W R/W R/W
a)
The default value “0” of this bit must not be changed!

Note DRQn and DOFLn are set by hardware.


DRQn and DOFLn can be reset by software. Setting these bits by software is
not possible. A “0” must be written to the respective bit location to reset these
bits.

The bits DTFRn.IFCn[2:0] select the interrupts to be used as DMA trigger


sources according to the following table
:

n 0 1 2 3
IFCn2 IFCn1 IFCn0 Channel 0 Channel 1 Channel 2 Channel 3
0 0 0 INTCB1R INTCB2Ra INTCB1R INTCB2Ra
0 0 1 INTCB1T INTCB2Ta INTCB1T INTCB2Ta
0 1 0 INTCB0R INTCB0T INTCB0R INTCB0T
0 1 1 INTUA0R INTUA0R INTUA0T INTUA0T
1 0 0 INTUA1R INTUA1R INTUA1T INTUA1T
1 0 1 INTTZ0UV INTTZ0UV INTTZ1UV INTTZ2UV
1 1 0 INTIIC0 INTLCD INTIIC1 INTLCD
1 1 1 INTTP0CC1 INTTP1CC1 INTTG0CC1 INTAD
a) µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427 only

Caution If the DMA trigger source is changed by modifying DTFRn.IFCn[2:0] bits while
DMA channel n is active, a DMA request may be set accidentally.
Proceed in any of the two ways when changing the DMA trigger source:
www.DataSheet4U.com
1. Disable the DMA channel n by DCHCn.ENn = 0 before changing the DMA
trigger source DTFRn.IFCn[2:0].

362 User’s Manual U17566EE5V1UM00


DMA Controller (DMAC) Chapter 8

2. Set the DMA request bit DTFRn.DRQn = 0 in parallel to changing


DTFRn.IFCn[2:0], i.e. within the same write operation. Thus DTFRn must
be written in 8-bit access mode. Do not change DTFRn.IFCn[2:0] with
single-bit instructions.

The following list details the functions of the individual DMA trigger sources
referenced in the above table.
• INTCB2R...INTCB0R
The receive interrupts of the Clocked Serial Interfaces CSIB2…CSIB0 are
used as DMA trigger sources. In case of a receive overflow condition no
DMA trigger will be issued. The receive error interrupt of the respective
CSIB INTCBnRE should be enabled to inform the application software about
the overflow condition.
• INTCB2T…INTCB0T
The transmit interrupts of the Clocked Serial Interfaces CSIB2…CSIB0 are
used as DMA trigger sources.
• INTUA1R, INTUA0R
The receive interrupts of the Asynchronous Serial Interfaces UARTA1 or
UARTA0 are used as DMA trigger sources.
In case of a receive overflow, or a framing or parity error condition, no DMA
trigger will be issued. The receive error interrupt INTUAnRE of the
respective UARTn should be enabled to inform the application software
about the error condition. These interrupts are also generated upon
reception of an SBF in LIN mode.
• INTUA1T, INTUA0T
The transmit interrupts of the Asynchronous Serial Interfaces UARTA1 or
UARTA0 are used as DMA trigger sources.
• INTLCD
The interrupt signal of the LCD Bus Interface macro is used to trigger the
DMA transfer.
• INTIIC0, INTIIC1
The interrupts of the I2C Interfaces IIC0, IIC1 are used to trigger the
respective DMA channel.

DRQn DMA request


0 No DMA transfer request is pending for channel n
1 DMA transfer request is pending for channel n

DOFLn DMA request overflow


0 DMA transfer request overflow did not occur for channel n
1 DMA transfer request overflow occurred for channel n

Note For more information concerning correct handling of DRQn and DOFLn during
www.DataSheet4U.com DMA initialization and retrigger refer to “DMA setup and retrigger“ on
page 365.

User’s Manual U17566EE5V1UM00 363


Chapter 8 DMA Controller (DMAC)

DMACTn DMA active count


DMACTn=0 must be set if internal RAM is not specified as source or
0
destination
DMACTn=1 must be set if internal RAM is specified as source or
1
destination

Set DMACTn according to the following table:

Source \ VSB Flash VSB RAM external memory


Destination Internal RAM (µPD70F3426A) (µPD70F3426A) (µPD70F3427) Peripherals
Internal RAM – √ √ √ √
VSB Flash
– – – – –
(µPD70F3426A)
VSB RAM
√ √ √ – √
(µPD70F3426A)
external memory
√ – – √ √
(µPD70F3427)
Peripherals √ √ √ √ √

Caution Special care must be taken when using the internal RAM as DMA source or
destination. Refer to “Simultaneous program execution and DMA transfer with
internal RAM“ on page 374.

w w w . D a t a S h e e t 4 U . c o m

364 User’s Manual U17566EE5V1UM00


DMA Controller (DMAC) Chapter 8

8.4 DMA setup and retrigger

The following describes the correct initial DMA setup and the process for
retriggering the DMA process.

8.4.1 DMA initial setup (status after system reset)

1. Disable DMA interrupts INTDMAn in interrupt control registers by setting


DMAnIC.DMAnMK = 1.
2. Configure DMA source address register DSAHn and set bit DSAHn.IR = 1
if the DMA source address is located inside the internal RAM area.
3. Configure DMA source address register DSALn.
4. Configure DMA destination address register DDAHn and set bit
DDAHn.IR = 1 if the DMA destination address is located inside the internal
RAM area.
5. Configure DMA destination address register DDALn.
6. Configure DMA transfer count register DBCn.
7. Select transfer data size, count direction of the source address, count
direction of the destination address and transfer mode by setting DSn,
DADn, SADn and TMn of DADCn.
8. Select whether target and/or destination addresses are RAM-located,
select DMA transfer complete mode and select trigger source by setting
DMACTn, TCOMODEn and IFCn of DTFRn.
9. Always clear the DRQn and DOFLn flags of DTFRn register regardless if
these are already cleared or not.
10. Clear DMA interrupt requests in interrupt control registers by setting
DMAnIC.DMAnIF = 0.
11. Enable the DMA transfer by setting DCHCn.ENn = 1 or the respective bit of
the DRST register.
12. DMAn transfer is then triggered either by request from the respective
peripheral or by setting the software trigger bit DCHCn.STGn = 1.
If software trigger is used, steps 11 and 12 can be done simultanously by
setting DCHCn = 03H.

8.4.2 DMA Retrigger

1. Disable DMA interrupts INTDMAn in interrupt control registers by setting


DMAnIC.DMAnMK = 1.
2. Read TCn of DCHCn to clear it.
3. Always clear the DRQn and DOFLn flags of DTFRn register regardless if
these are already cleared or not.
4. Clear DMA interrupt requests in interrupt control registers DMAnIC
(n=0..3).
5. Enable the DMA transfer by setting DCHCn.ENn or the respective bit of the
www.DataSheet4U.com DRST registers.
6. DMAn transfer is triggered either by request from the respective peripheral
or by setting the software trigger bit DCHCn.STGn = 1.
If software trigger is used, steps 5 and 6 can be done simultaneously by setting
DCHCn = 0x03.

User’s Manual U17566EE5V1UM00 365


Chapter 8 DMA Controller (DMAC)

8.5 Automatic Restart Function

The DMA source address registers (DSAHn, DSALn), DMA destination


address registers (DDAHn, DDALn), and DMA transfer count register (DBCn)
are buffer registers with a 2-stage FIFO structure, named master and slave
register.
The setup data of the slave registers is always used for the current DMA
transfer, while the master registers may hold a new setup to be used
automatically after the first DMA transfer has completed.
When the terminal count DCHCn.TCn=1 is issued, the slave registers are
automatically rewritten with the values of the master registers.
Therefore, during DMA transfer, transfer is automatically started when a new
DMA transfer setting is made for these registers and the MLEn bit of the
DCHCn register is set (however, the DMA transfer end interrupt is issued even
if DMA transfer is automatically started).
This mode is called multi link mode and is configured by DCHCn.MLEn=1.
If DMA channel n is disabled (DCHCn.ENn=0), writing to DSAH/Ln, DDAH/Ln,
DBCn stores the data to the master and slave registers.
Writing the next DMA transfer setup data to the master registers only - and to
keep the first setup data in the slave registers - is possible after
• the DMA channel n has been enabled (DCHCn.ENn=1) and
• the first DMA trigger interrupt for channel n has occurred.
The new setup data will become effective after
• the previous DMA transfer has completed (DCHC.TCn=1, INTDMAn) and
• the next following DMA trigger interrupt for channel n has occurred.
Note that the terminal count flag DCHC.TCn does not need to be cleared in
multi link mode (DCHC.MLEn = 1) for starting up the next DMA transfer
automatically.

Figure 8-1 shows the configuration of the buffer register.

Data read
Internal bus

Data write Master Slave Address/


register register count
controller

Figure 8-1
www.DataSheet4U.com Buffer register configuration

Caution DMA transfer with activated MLE function can only be used in conjunction with
hardware requests. Therefore it is not allowed to start a DMA transfer by
software trigger (DCHCn.STGn) when DCHCn.MLEn is set.

366 User’s Manual U17566EE5V1UM00


DMA Controller (DMAC) Chapter 8

8.6 Transfer Type

All DMA transfers of this microcontroller are two-cycle transfers.


In two-cycle transfer, data transfer is performed in two cycles: a read cycle
(source to DMAC) and a write cycle (DMAC to destination).
In the first cycle, the source address is output and reading is performed from
the source to the DMAC. In the second cycle, the transfer destination address
is output and writing is performed from the DMAC to the transfer destination.

8.7 Transfer Object

The following transfer objects can be specified as source and destination:

Table 8-10 Transfer objects

Source \
Destination Internal RAM Peripherals
Internal RAM – √
Peripherals √ √

w w w . D a t a S h e e t 4 U . c o m

User’s Manual U17566EE5V1UM00 367


Chapter 8 DMA Controller (DMAC)

8.8 DMA Channel Priorities

The DMA channel priorities are fixed as follows.

DMA channel 0 > DMA channel 1 > … > DMA channel n

In the single-step transfer mode, the DMA Controller releases the buses after
each byte/half-word/word transfer. If a higher priority DMA transfer request is
issued while the bus is released, the higher priority DMA transfer request is
acknowledged.
In the block transfer mode, the channel used for transfer is never switched.

8.9 DMA Transfer Start Factors

There are two types of DMA transfer start factors, as shown below.

(1) Request from on-chip peripheral I/O


If the ENn and the TCn bits of the DCHCn register are set as shown below, and
an interrupt request is issued from the on-chip peripheral I/O that is set in the
DTFRn register, the DMA transfer starts.
• ENn bit = 1
• TCn bit = 0

(2) Request from software


If the STGn, the ENn and the TCn bits of the DCHCn register are set as
follows, the DMA transfer starts.
• STGn bit = 1
• ENn bit = 1
• TCn bit = 0

Note For more information concerning correct DMA initialization and retrigger refer
to “DMA setup and retrigger“ on page 365.

8.10 Forcible Interruption

DMA transfer can be forcibly interrupted by NMI input during DMA transfer. At
such a time, the DMAC clears the ENn bit of the DCHCn register of all
channels and the DMA transfer disabled state is entered. An NMI request can
www.DataSheet4U.com then be acknowledged after the DMA transfer executed during NMI input is
terminated.
In block transfer mode, the DMA transfer request is held in the DMAC. If the
ENn bit is set back to "1", the DMA transfer is resumed from the point where it
was interrupted.

368 User’s Manual U17566EE5V1UM00


DMA Controller (DMAC) Chapter 8

In the single transfer mode, if the ENn bit is set back to "1", the next DMA
transfer request is acknowledged and DMA transfer is resumed.

NMI (input)

Forcible Transfer Forcible


interruption restart interruption
DMA transfer DMA transfer stop DMA transfer DMA transfer stop

EN0 bit of DCHC0 register

Figure 8-2 Example of forcible interruption of DMA transfer

Caution The resumed DMA transfer after NMI interruption cannot be executed with new
settings. New settings for a DMA transfer can be validated either after the end
of the current transfer or after the transfer has been forcibly terminated by
setting the INITn bit of the DCHCn register.

8.11 Forcible Termination

In addition to the forcible interruption operation by means of the NMI input,


DMA transfer can be forcibly terminated by the INITn bit of the DCHCn register.
The following is an example of the operation of a forcible termination.
Figure 8-3 shows a block transfer of channel 3 which begins during the DMA
block transfer of DMA channel 2. The block transfer of DMA channel 2 is
forcibly terminated by setting the INIT2 bit of its DCHC2 control register.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 369


Chapter 8 DMA Controller (DMAC)

DSAL2, DSAH2, DCHC2


DDAL2, DDAH2 (INIT2 bit = 1)

Set register Set register


DMA Transfer
Request CH2
EN2 bit = 1 EN2 bit → 0
TC2 bit = 0 TC2 bit = 0
DSAL3, DSAH3,
DDAL3, DDAH3

Set register
DMA Transfer
Request CH3
EN3 bit = 1 EN3 bit → 0
TC3 bit = 0 TC3 bit → 1

CPU CPU CPU CPU DMA2 DMA2 DMA2 DMA2 DMA2 CPU DMA3 DMA3 DMA3 DMA3 CPU CPU CPU

DMA channel 3 terminal count


DMA channel 3 transfer begins
DMA channel 2 transfer is forcibly terminated
and the bus is released

Figure 8-3 DMA transfer forcible termination example 1

Note The next condition can be set even during DMA transfer because the DSAn,
DDAn, and DBCn registers are buffered registers. However, the setting to the
DADCn register is invalid (refer to “Automatic Restart Function“ on page 366
and “DADCn - DMA addressing control registers“ on page 358).

Figure 8-4 shows a forcible termination of a block transfer operation of DMA


channel 1. A transfer containing a new configuration is executed.

DSAL1, DSAH1, DSAL1, DSAH1, DCHC1 DADC1,


DDAL1, DDAH1 DDAL1, DDAH1 (INIT1 bit = 1) DCHC1
Set register Set register Set register Set register
DMA Transfer
Request CH1
EN1 bit = 1 EN1 bit → 0 EN1 bit → 1 EN1 bit → 0
TC1 bit = 0 TC1 bit = 0 TC1 bit = 0 TC1 bit → 1

CPU CPU CPU CPU DMA1 DMA1 DMA1 DMA1 DMA1 DMA1 CPU CPU CPU CPU DMA1 DMA1 DMA1 CPU

DMA channel 1 transfer is forcibly DMA channel 1


terminated and the bus is released terminal count

Figure 8-4 DMA transfer forcible termination example 2

Note Since the DSALn, DSAHn, DDALn, DDAHn and DBCn registers are buffered
www.DataSheet4U.com
registers, the next transfer condition can be set even during a DMA transfer.
However, a setting in the DADCn register is ignored (refer to “Automatic
Restart Function“ on page 366)

370 User’s Manual U17566EE5V1UM00


DMA Controller (DMAC) Chapter 8

8.12 DMA Transfer Completion

When DMA transfer ends and the TCn bit of the DCHCn register is set, a DMA
transfer end interrupt (INTDMAn) is issued to the Interrupt Controller (INTC).

8.13 Transfer Mode

8.13.1 Single transfer mode

In single transfer mode, the DMAC releases the bus after each byte/halfword/
word transfer. If there is a subsequent DMA transfer request, transfer is
performed again once. This operation continues until a terminal count occurs.
When the DMAC has released the bus, if another higher priority DMA transfer
request is issued, the higher priority DMA request always takes precedence.
However, if a lower priority DMA transfer request is generated within one clock
after the end of a single transfer, even if the previous higher priority DMA
transfer request signal stays active, this request is not prioritized and the next
DMA transfer after the bus is released for the CPU is a transfer based on the
newly generated, lower priority DMA transfer request.
Figure 8-5 shows a DMAC transfer in single transfer mode. In this example the
DMA channel 3 is used for a single transfer.

DMA Transfer
Request CH3

Note Note Note Note

CPU CPU DMA3 CPU DMA3 CPU DMA3 CPU CPU CPU CPU CPU CPU DMA3 CPU DMA3 CPU CPU CPU

DMA chan nel 3 terminal count

Figure 8-5 Single transfer example 1

Note The bus is always released

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 371


Chapter 8 DMA Controller (DMAC)

Figure 8-6 shows DMAC transfers in single transfer mode in which a higher
priority DMA transfer request is generated. DMA channels 0 to 2 are used for a
block transfer and channel 3 is used for a single transfer.

DMA Transfer
Request CH0

DMA Transfer
Request CH1

DMA Transfer
Request CH2

DMA Transfer
Request CH3

Note Note Note Note

CPU CPU CPU DMA3 CPU DMA0 DMA0 CPU DMA1 DMA1 CPU DMA2 DMA2 CPU DMA3 CPU DMA3

DMA channel 1 DMA channel 3


terminal count terminal count
DMA channel 0 DMA channel 2
terminal count terminal count

Figure 8-6 Single transfer example 2

Note The bus is always released

Figure 8-7 shows a DMA transfer example in single transfer mode in which a
lower priority DMA transfer request is generated within one clock after the end
of a single transfer. DMA channels 0 and 3 are used for the single transfer
example. When two DMA transfer request signals are activated at the same
time, the two DMA transfers are performed alternately.

DMA Transfer
Request CH0

DMA Transfer
Request CH3
Note Note Note Note Note Note Note

CPU CPU DMA0 CPU DMA0 CPU DMA3 CPU DMA0 CPU DMA3 CPU DMA0 CPU DMA0 CPU DMA0 CPU CPU

DMA channel 3 DMA channel 0


terminal count terminal count

Figure 8-7 Single transfer example 3

www.DataSheet4U.com Note The bus is always released

372 User’s Manual U17566EE5V1UM00


DMA Controller (DMAC) Chapter 8

Figure 8-8 shows a single transfer mode example in which two or more lower
priority DMA transfer requests are generated within one clock after the end of a
single transfer. DMA channels 0, 2 and 3 are used for this single transfer
example. When three or more DMA transfer request signals are activated at
the same time always the two highest priority DMA transfers are performed
alternately.

DMA Transfer
Request CH0

DMA Transfer
Request CH2
DMA Transfer
Request CH3

Note Note Note Note Note Note Note Note Note

CPU DMA3 CPU DMA3 CPU DMA2 CPU DMA0 CPU DMA2 CPU DMA0 CPU DMA2 CPU DMA3 CPU DMA2 CPU DMA3 CPU CPU

DMA channel 0 DMA channel 3


terminal count terminal count
DMA channel 2
terminal count

Figure 8-8 Single transfer example 4

Note The bus is always released

8.13.2 Block transfer mode

In the block transfer mode, once transfer begins, the DMAC continues the
transfer operation without releasing the bus until a terminal count occurs. No
other DMA requests are acknowledged during block transfer.
After the block transfer ends and the DMAC releases the bus and another DMA
transfer can be acknowledged.
Figure 8-9 shows a block transfer mode example. It is a block transfer mode
example in which a higher priority DMA transfer request is generated. DMA
channels 2 and 3 are used for the block transfer example.

DMA Transfer
Request CH2

DMA Transfer
Request CH3

CPU CPU CPU DMA3 DMA3 DMA3 DMA3 DMA3 DMA3 DMA3 DMA3 CPU DMA2 DMA2 DMA2 DMA2 DMA2

www.DataSheet4U.com The bus is always released

DMA channel 3
terminal count

Figure 8-9 Block transfer example

User’s Manual U17566EE5V1UM00 373


Chapter 8 DMA Controller (DMAC)

8.14 Cautions

8.14.1 Simultaneous program execution and DMA transfer with


internal RAM

(1) Details
When a DMA transfer with the internal RAM as source or destination and one
of the following instructions are fetched from the internal RAM and executed,
the CPU may deadlock:
• • bit manipulation instructions (SET1, CLR1, or NOT1) on any target data
(RAM, SFR, etc)
• - instructions with misaligned access to data in the internal RAM misaligned
access means
– access to 32-bit (word) data on addresses with lower 2 address bits
unequal 0
– access to 16-bit (half-word) data on addresses with lowest address bit
unequal 0
Once the CPU has entered this deadlock state only a reset can be
acknowledged, neither maskable nor non-maskable interrupts will be
acknowledged anymore.
This situation does not occur if no instruction is fetched from the internal RAM,
or no DMA transfer is performed on the internal RAM.

(2) Workaround
Implement any of the following workarounds:
• Do not perform any DMA transfers with the internal RAM when an
instruction allocated in the internal RAM is being executed.
• Do not execute an instruction allocated in the internal RAM when a DMA
transfer with the internal RAM is being performed.
• Disable DMA transfer when the CPU is executing instruction code that is
allocated in the internal RAM.
• Do not use either a bit manipulation instruction or a misaligned memory
access.

www.DataSheet4U.com

374 User’s Manual U17566EE5V1UM00


Chapter 9 ROM Correction Function (ROMC)

This microcontroller features following ROM correction facilities:


• “Data Replacement” ROM correction:
– 1 x 6 channels for VFB flash memory and ROM
The individual channels of each “Data Replacement” ROM correction are
identified by “n” (n = 0 to 5)
• “DBTRAP” ROM correction:
– 1x 8 channels for VFB flash memory
– 1 x 8 channels for VSB flash memory (for µPD70F3426A only)
The individual channels of each “DBTRAP” ROM correction are identified by
“m” (m = 0 to 7)

Caution During self-programming make sure to disable all ROM correction facilities, as
enabled ROM corrections may conflict with the internal firmware.

9.1 Overview

The ROM Correction Function is used to replace part of the internal flash
memory with user defined data.
By using this function, program bugs found in the internal flash memory can
be corrected.
The “DBTRAP” ROM correction unit substitutes an instruction fetched from
flash memory by the DBTRAP instruction. Thus a DBTRAP exception is
excited and program execution branches to the DBTRAP vector 0000 0060H.
Note that the “DBTRAP” ROM correction unit is utilized by the N-Wire on-chip
debug unit. Therefore ROM corrections by DBTRAP are not available, when N-
Wire on-chip debugging is performed.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 375


Chapter 9 ROM Correction Function (ROMC)

9.2 “Data Replacement” ROM Correction Unit

9.2.1 Features

• 6 correction channels for VFB flash/ROM (n = 0 to 5)


• Programmable correction address for each channel
• Programmable correction value for each channel (the value can be an
instructions as well as data)
• Correction of aligned and unaligned instructions/data
• Correction of halfwords and words
• Enable/disable of each channel individually by software

VFB address bus

Correction
address register
CORADRn

Correction
value register
CORVALn ROM/Flash
Comparator

ROM/Flash
data

CORCTL0.CORENn CORVAL
- VFB
ROM/Flash data data bus
replacement
CORCTL1.HWn

Figure 9-1 “Data Replacement” ROM correction block diagram

www.DataSheet4U.com

376 User’s Manual U17566EE5V1UM00


ROM Correction Function (ROMC) Chapter 9

9.2.2 “Data Replacement” ROM correction operation

The “Data Replacement” ROM correction unit compares the address on the
V850 fetch bus (VFB) with the contents of the programmable correction
address registers CORADRn. If an address matches, a programmable value
(instructions or data) is put on the V850 fetch bus instead of the ROM contents.
If no address matches, the ROM contents is passed on the fetch bus as
normal.

The V850E architecture supports 16-bit as well as 32-bit instructions/data with


support of aligned and unaligned instruction/data placement. Figure 9-2 shows
the different alignments of code/data inside the ROM.

(a) (c)
Addr Addr

8 8

4 4
INSTR32_HI INSTR32_LO INSTR16
0 0
2 2

(b) (d)
Addr Addr

8 8
INSTR32_HI
4 4
INSTR32_LO INSTR16
0 0
2 2

Figure 9-2 Alignment of instructions and data in the internal ROM/flash

(a) 32-bit word aligned data replacement


The 32-bit wide code/data is aligned to a word boundary. Upper and lower
halfword are replaced directly by the 32-bit correction value.

Data on VFB

0xDDDD 0xCCCC
HWn CORENn

0 1
Addr

8
CORADRn CORVALn
4
0x00 1000 0xDDDD 0xCCCC 0xBBBB 0xAAAA
www.DataSheet4U.com 0x00 1000 0
internal address calculator Address
on ROM content
CORADRn
0x00 1000 Address VFB
& 0x3F FFFC
match!
CORADRn
+ 0x00 0002 0x00 1002

Figure 9-3 32-bit word aligned data replacement

User’s Manual U17566EE5V1UM00 377


Chapter 9 ROM Correction Function (ROMC)

(b) 32-bit word unaligned data replacement


The 32-bit wide code/data is not aligned to a word boundary. For the first VFB
access the upper half word is replaced by the lower 16-bit of the correction
value (refer to Figure 9-4 (a)). For the second VFB access the lower halfword is
replaced by the upper 16-bit of the correction value (refer to Figure 9-4 (b)).

(a)

Data on VFB

0xCCCC
HWn CORENn

0 1 Addr

8
CORADRn CORVALn 0xBBBB
4
0x00 1002 0xDDDD 0xCCCC 0xAAAA
0x00 1000 0
2
internal address calculator Address
on ROM content
CORADRn
0x00 1000 Address VFB
& 0x3F FFFC
match!
CORADRn
+ 0x00 0002 0x00 1004

(b)

Data on VFB

0xDDDD

HWn CORENn

0 1 Addr

8
CORADRn CORVALn 0xBBBB
0x00 1004 4
0x00 1002 0xDDDD 0xCCCC Address 0xAAAA
on 0
2
VFB
internal address calculator
CORADRn Address ROM content
& 0x3F FFFC 0x00 1000
match!
CORADRn
+ 0x00 0002 0x00 1004

Figure 9-4 32-bit word unaligned data replacement

www.DataSheet4U.com

378 User’s Manual U17566EE5V1UM00


ROM Correction Function (ROMC) Chapter 9

(c) 16-bit halfword aligned data replacement


The 16-bit wide code/data can be replaced directly by the 16-bit correction
value. The upper halfword is not replaced but the original ROM contents is put
on the fetch bus.

Data on VFB

0xCCCC
HWn CORENn

1 1
Addr

8
CORADRn CORVALn
4
0x00 1000 0xCCCC 0xAAAA
0x00 1000 0
2
internal address calculator Address
on ROM content
CORADRn
0x00 1000 Address VFB
& 0x3F FFFC
match!
CORADRn
+ 0x00 0002 0x00 1002

Figure 9-5 16-bit halfword aligned data replacement

(d) 16-bit halfword unaligned data replacement


The 16-bit wide code/data can be replaced directly by the 16-bit correction
value. The lower halfword is not replaced but the original ROM contents is put
on the fetch bus.

Data on VFB

0xDDDD
HWn CORENn

1 1
Addr

8
CORADRn CORVALn
4
0x00 1002 0xDDDD 0xBBBB
0x00 1000 0
2
internal address calculator Address
CORADRn Address on ROM content
0x00 1000
& 0x3F FFFC
match! VFB
CORADRn
+ 0x00 0002 0x00 1004

Figure 9-6 16-bit halfword unaligned data replacement

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 379


Chapter 9 ROM Correction Function (ROMC)

9.2.3 Setting of ROM correction addresses

The CPU supports access to (32-bit) word and (16-bit) half word aligned and
unaligned instructions and data.
Aligned words have an address with the lowest two address bits equal 00B, i.e.
ADDRESS modulo 4 = 00B.
Any access to the ROM is always performed on word aligned addresses. As a
consequence access to an unaligned word yields two accesses.
The word in Figure 9-7 is accessed in two cycles via address 0x00 and 0x04.

0x08
WORD_H 0x04

WORD_L 0x00

Figure 9-7 Unaligned word addressing

Consequently a ROM correction of an unaligned word is also split into two


steps (refer to “32-bit word unaligned data replacement“ on page 378).

Caution Any (32-bit) aligned word must not contain correction targets of more than one
ROM correction channel.

In case of an unaligned word correction (CORCTL1.HWn=0), i.e.


CORADRn mod 4 = 10B, any part (word or half word) of the following two
aligned words must not be specified as any other correction address:
• CORADRn div 4
• (CORADRn div 4) + 4

Following consequence applies:


The correction address of an unaligned word must have a distance of at least 6
byte to all other correction addresses, i.e. CORADRn ≥ CORADRm + 6.
One exception consists in the following case. If an unaligned halfword
correction address CORADRm (CORCTL1.HWn = 1) precedes in terms of the
addresses an unaligned word correction CORADRn (CORCTL1.HWn = 0), a
distance of 4 byte is sufficient: CORADRn ≥ CORADRm + 4.
If the setting of ROM correction addresses conflicts with the above, an
unaligned word correction shall be split into two halfword corrections. Thus
also halfwords of different correction words can be combined in order to
www.DataSheet4U.com correct them in a single aligned access cycle.
Table 9-1 illustrates different combinations and advises how to avoid above
conflicts.

380 User’s Manual U17566EE5V1UM00


ROM Correction Function (ROMC) Chapter 9

Unaligned word and halfword correction


HWORD1 WORD0_H x100B
WORD0_L HWORD0 x000B
combine for 2 aligned corrections
CORADRn = x000B CORVALn = WORD0_L << 16 + HWORD0
CORADRm = x100B CORVALm = HWORD1 << 16 + WORD0_H

Halfwords correction
HWORD3 HWORD2 xx00B
combine for 1 aligned access
CORADRn = x000B CORVALn = HWORD3 << 16 + HWORD2

Unaligned words correction


no correction target WORD1_H x100B
WORD1_L WORD2_H x100B
WORD2_L no correction target x000B
combine for 3 aligned corrections
CORADRn = 0000B CORVALn = WORD1_H
CORADRm = 0100B CORVALm = WORD1_L << 16 + WORD2_H
CORADRl = 1000B CORVALl = WORD2_L << 16

Isolated unaligned word correction


no correction target WORD0_H x100B
WORD0_L no correction target x000B
single unaligned correction
CORADRn = x010B CORVALn = WORD3_L << 16 + WORD3_H

Table 9-1 ROM correction address settings

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 381


Chapter 9 ROM Correction Function (ROMC)

9.2.4 “Data Replacement” ROM correction registers

(1) CORCTL0 - VFB flash/ROM “Data Replacement” ROM correction control


register 0
This register enables or disables the “Data Replacement” VFB flash/ROM
ROM correction of each channel.
Access This register can be read/written in 8- and 1-bit units.
Address FFFF F900H
Initial Value 00H

7 6 5 4 3 2 1 0
0 0 CORCEN5 CORCEN4 CORCEN3 CORCEN2 CORCEN1 CORCEN0
R R R/W R/W R/W R/W R/W R/W

Table 9-2 CORCTL0 register contents


Bit Position Bit Name Function
5 to 0 CORCENn ROM correction channel
0: ROM correction for channel n disabled
1: ROM correction for channel n enabled

ROM correction of channel n should only be enabled after the correction


address (CORADRn), the correction value (CORVALn) and the word/halfword
selection (CORCTL1) have been set.

(2) CORCTL1 - VFB flash/ROM “Data Replacement” ROM correction control


register 1
This register determines whether the word (32-bit) or halfword (16-bit) value of
CORVALn replaces the VFB flash/ROM contents.
Access This register can be read/written in 8- and 1-bit units.
Address FFFF F901H
Initial Value 00H

7 6 5 4 3 2 1 0
0 0 HW5 HW4 HW3 HW2 HW1 HW0
R R R/W R/W R/W R/W R/W R/W

Table 9-3 CORCTL1 register contents


Bit Position Bit Name Function
5 to 0 HWn Word - halfword
0: Word value of CORVALn replaces the flash/ROM contents
1: Halfword value of CORVALn replaces the flash/ROM contents

www.DataSheet4U.com
Note CORCTL1.HWn shall only be changed when the corresponding channel is
disabled (CORCTL0.CORCENn = 0).

382 User’s Manual U17566EE5V1UM00


ROM Correction Function (ROMC) Chapter 9

(3) CORADRnL - VFB flash/ROM “Data Replacement” ROM correction low


address register
These registers hold the lower 16 bit of the address where the VFB flash/ROM
ROM correction should be performed.
Access These registers can be read/written in 16- and 8-bit units.
Address CORADR0L, CORADR0LL: FFFF F910H CORADR0LH: FFFF F911H
CORADR1L, CORADR1LL: FFFF F914H CORADR1LH: FFFF F915H
CORADR2L, CORADR2LL: FFFF F918H CORADR2LH: FFFF F919H
CORADR3L, CORADR3LL: FFFF F91CH CORADR3LH: FFFF F91DH
CORADR4L, CORADR4LL: FFFF F920H CORADR4LH: FFFF F921H
CORADR5L, CORADR5LL: FFFF F924H CORADR5LH: FFFF F925H

Initial Value 0000H

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CORADRn[15:0] 0
R/W

Table 9-4 CORADRnL register contents


Bit Position Bit Name Function
15 to 0 CORADRn Lower 16 bit of the ROM correction address of channel n.
[15:0] Bit 0 is fixed to 0, writing to this bit is ignored.

Note CORADRnL shall only be changed when the corresponding channel is


disabled (CORCTL0.CORCENn = 0).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 383


Chapter 9 ROM Correction Function (ROMC)

(4) CORADRnH - VFB flash/ROM “Data Replacement” ROM correction high


address register
These registers hold the upper 6 bit of the address where the VFB flash/ROM
ROM correction should be performed.
Access These registers can be read/written in 16- and 8-bit units.
Address CORADR0H, CORADR0HL: FFFF F912H CORADR0HH: FFFF F913H
CORADR1H, CORADR1HL: FFFF F916H CORADR1HH: FFFF F917H
CORADR2H, CORADR2HL: FFFF F91AH CORADR2HH: FFFF F91BH
CORADR3H, CORADR3HL: FFFF F91EH CORADR3HH: FFFF F91FH
CORADR4H, CORADR4HL: FFFF F922H CORADR4HH: FFFF F923H
CORADR5H, CORADR5HL: FFFF F926H CORADR5HH: FFFF F927H

Initial Value 0000H

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 CORADRn[21:16]
R/W

Table 9-5 CORADRnH register contents


Bit Position Bit Name Function
5 to 0 CORADRn Lower 16 bit of the ROM correction address of channel n.
[21:16] Bits 15 to 6are fixed to 0, writing to these bits is ignored.

Caution The ROM correction address CORADRn[21:0] must not exceed the upper
address of the internal VSB ROM respectively VSB flash memory.
If the internal VSB ROM/flash memory size is less than 4 MB the appropriate
number of upper address bits of CORADRn[21:0] must be set to 0.
Example: If the internal VSB ROM/flash memory size is 1 MB,
CORADRn[21:20], i.e. bit 5 and 4 of the CORADRnH, must be set to 00B. The
allowed address range is 0000 0000H to 000F FFFFH.

Note CORADRnH shall only be changed when the corresponding channel is


disabled (CORCTL0.CORCENn = 0).

www.DataSheet4U.com

384 User’s Manual U17566EE5V1UM00


ROM Correction Function (ROMC) Chapter 9

(5) CORVALnL - VFB flash/ROM “Data Replacement” ROM correction value


register
These registers hold the lower 16 bit of the value that shall replace the original
value from the VFB flash/ROM.
Access These registers can be read/written in 16-bit units.
Address CORVAL0L: FFFF F930H
CORVAL1L: FFFF F934H
CORVAL2L: FFFF F938H
CORVAL3L: FFFF F93CH
CORVAL4L: FFFF F940H
CORVAL5L: FFFF F944H

Initial Value 0000H

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CORVALn[15:0]
R/W

Table 9-6 CORVALnL register contents


Bit Position Bit Name Function
15 to 0 CORVALn Lower 16 bit of the correction value to replace the ROM contents.
[15:0]

Note CORVALnL shall only be changed when the corresponding channel is disabled
(CORCTL0.CORCENn = 0).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 385


Chapter 9 ROM Correction Function (ROMC)

(6) CORVALnH - VFB flash/ROM “Data Replacement” ROM correction value


register
These registers hold the upper 16 bit of the value that shall replace the original
value from the VFB flash/ROM.
Access These registers can be read/written in 16-bit units.
Address CORVAL0H: FFFF F932H
CORVAL1H: FFFF F936H
CORVAL2H: FFFF F93AH
CORVAL3H: FFFF F93EH
CORVAL4H: FFFF F942H
CORVAL5H: FFFF F946H

Initial Value 0000H

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CORVALn[31:16]
R/W

Table 9-7 CORVALnH register contents


Bit Position Bit Name Function
15 to 0 CORVALn Upper 16 bit of the correction value to replace the ROM contents.
[31:16]

Note CORVALnH shall only be changed when the corresponding channel is


disabled (CORCTL0.CORCENn = 0).

www.DataSheet4U.com

386 User’s Manual U17566EE5V1UM00


ROM Correction Function (ROMC) Chapter 9

9.3 “DBTRAP” ROM Correction Unit

• 1x 8 channels for VFB flash memory and ROM


• 1 x 8 channels for VSB flash memory (for µPD70F3426A only)
• The individual channels of eachthe “DBTRAP” ROM correction unit are
identified by “m” (m = 0 to 7)
• Programmable correction address for each channel
• “DBTRAP” exception processing upon correction address match
• Enable/Disable of each channel individually by software

Caution The “DBTRAP” ROM correction unit is also used by the N-Wire on-chip debug
unit. Thus ROM correction will not be performed on these correction channels
when the microcontroller is operating in N-Wire debug mode.

Note In the following only the register names of the “DBTRAP” ROM correction unit
for the VFB flash/ROM is used for both “DBTRAP” ROM correction units, for
VFB flash/ROM and µPD70F3426A VSB flash memory.
• CORCN (VFB flash/ROM) stands also for µPD70F3426A’s COR2CN (VSB
flash memory)
• CORADn (VFB flash/ROM) stands also for µPD70F3426A’s COR2ADn
(VSB flash memory)

VFB address bus

Correction
address register
CORADm

DBTRAP
opcode ROM/Flash
Comparator

ROM/Flash
data

DBTRAP
- VFB
CORCN.CORENm ROM/Flash data data bus
replacement

Figure 9-8 “DBTRAP” ROM correction block diagram


www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 387


Chapter 9 ROM Correction Function (ROMC)

9.3.1 “DBTRAP” ROM correction operation

The “DBTRAP” ROM correction unit compares the address on the V850 fetch
bus (VFB) with the contents of the programmable correction address registers
CORADm. If an address matches, the DBTRAP instruction opcode is put on
the V850 fetch bus instead of the ROM contents. If no address matches, the
ROM contents is passed on the fetch bus as normal.
The DBTRAP exception branches to the DBTRAP/ILGOP exception handler
address 0000 0060H, which comprises the user’s ROM correction instructions.
Since the ROM correction routines for all correction channels are invoked at
the DBTRAP exception handler address 0000 0060H, the exception handler
has to evaluate first the right correction routine to be executed. This is done by
reading the DBPC register, which holds the address next to the correction
address of CORADm, which has caused the DBTRAP exception. If non of
CORADm matches DBPC - 2, DBTRAP was generated by an illegal opcode
detection event ILGOP. For further details concerning DBTRAP/ILGOP
handling refer to “Exception Trap“ on page 261.
Figure 9-9 outlines a typical program flow for using the “DBTRAP” ROM
correction.
1. If the address CORADm to be corrected and the fetch address of the
internal ROM memory match, the instruction code fetched from ROM is
replaced by the DBTRAP instruction.
2. When the DBTRAP instruction is executed, execution branches to address
0000 0060H.
3. The DBTRAP evaluation routine identifies the cause of the DBTRAP
exception and launches either the appropriate ROM correction routine or
the ILGOP handler.
4. In case several consecutive ROM instruction are replaced by ROM
correction code the return address in DBPC must be corrected. It may also
be required to correct some flags in the DBPSW register.
5. Return processing is started by the DBRET instruction.

www.DataSheet4U.com

388 User’s Manual U17566EE5V1UM00


ROM Correction Function (ROMC) Chapter 9

Reset & start

Initialize microcontroller

Set CORADm register

Load DBTRAP exception Read data for setting ROM


handler and correction from external
ROM correction code

Set CORCN register

No
CORENm bit = 1?

Yes Execute fetch code

Fetch address No
= CORADm?

Yes Execute fetch code

Change fetch code to


DBTRAP instruction

Execute DBTRAP instruction

Jump to address 0000 0060H

Branch to DBTRAP
evaluation routine

No
CORADm = DBPC-2?

Yes ILGOP processing


Branch to correction code address
of corresponding channel m

Execute correction code

Execute DBRET instruction

If necessary, correct:
- return address in DBPC
- flags in DBPSW

Notes: : Processing by user program (software)

: Processing by ROM correction (hardware)

www.DataSheet4U.com

Figure 9-9 ROM correction operation and program flow

User’s Manual U17566EE5V1UM00 389


Chapter 9 ROM Correction Function (ROMC)

9.3.2 “DBTRAP” ROM correction registers

(1) CORCN - VFB flash/ROM “DBTRAP” ROM correction control register


This register enables or disables the VFB flash/ROM ROM correction of each
channel.
Access This register can be read/written in 8- and 1-bit units.
Address FFFF F880H
Initial Value 0000H

7 6 5 4 3 2 1 0
COREN7 COREN6 COREN5 COREN4 COREN3 COREN2 COREN1 COREN0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 9-8 CORCN register contents


Bit Position Bit Name Function
7 to 0 CORENm ROM correction channel
0: ROM correction for channel m disabled
1: ROM correction for channel m enabled

Note ROM correction of channel n should only be enabled after the correction
address CORADm has been set.

(2) COR2CN - VSB flash “DBTRAP” ROM correction control register


(µPD70F3426A only)
This register enables or disables VSB flash memory ROM correction of each
channel.
Access This register can be read/written in 8- and 1-bit units.
Address FFFF F9D0H
Initial Value 0000H

7 6 5 4 3 2 1 0
COR2EN7 COR2EN6 COR2EN5 COR2EN4 COR2EN3 COR2EN2 COR2EN1 COR2EN0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 9-9 COR2CN register contents


Bit Position Bit Name Function
7 to 0 COR2ENm ROM correction channel
0: ROM correction for channel m disabled
1: ROM correction for channel m enabled

Note ROM correction of channel n should only be enabled after the correction
www.DataSheet4U.com address COR2ADm has been set.

390 User’s Manual U17566EE5V1UM00


ROM Correction Function (ROMC) Chapter 9

(3) CORADm - VFB flash/ROM “DBTRAP” ROM Correction address register


These registers hold the address where the VFB flash/ROM correction should
be performed.
Access These registers can be read/written in 32-bit (CORADm) and 16-bit units
(CORADmL for bits 15 to 0, CORADmH for bits 31 to 16).
Address CORAD0, CORAD0L: FFFF F840H CORAD0H: FFFF F842H
CORAD1, CORAD1L: FFFF F844H CORAD1H: FFFF F846H
CORAD2, CORAD2L: FFFF F848H CORAD2H: FFFF F84AH
CORAD3, CORAD3L: FFFF F84CH CORAD3H: FFFF F84EH
CORAD4, CORAD4L: FFFF F850H CORAD4H: FFFF F852H
CORAD5, CORAD5L: FFFF F854H CORAD5H: FFFF F856H
CORAD6, CORAD6L: FFFF F858H CORAD6H: FFFF F85AH
CORAD7, CORAD7L: FFFF F85CH CORAD7H: FFFF F85EH
Initial Value 0000 0000H

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CORADm[15:0] 0
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 0 0 0 0 0 0 0 0 0 0 0 CORADm[19:16]
R/W

Table 9-10 CORADm register contents


Bit Position Bit Name Function
19 to 0 CORADm Lower 16 bit of the ROM correction address of channel m.
[19:0] Bit 0 and bits 31 to 20 are fixed to 0, writing to these bits is ignored.

Caution The ROM correction address CORADm[19:0] must not exceed the upper
address of the internal ROM respectively flash memory.
If the internal ROM/flash memory size is less than 1 MB the appropriate
number of upper address bits of CORADm[19:0] must be set to 0.

Note CORADm shall only be changed when the corresponding channel is disabled
(CORCN.CORENm = 0).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 391


Chapter 9 ROM Correction Function (ROMC)

(4) COR2ADm - VSB flash “DBTRAP” ROM Correction address register


(µPD70F3426A only)
These registers hold the address where the VSB flash memory correction
should be performed.
Access These registers can be read/written in 32-bit (COR2ADm) and 16-bit units
(COR2ADmL for bits 15 to 0, COR2ADmH for bits 31 to 16).
Address COR2AD0, COR2AD0L: FFFF F8A0H COR2AD0H: FFFF F8A2H
COR2AD1, COR2AD1L: FFFF F8A4H COR2AD1H: FFFF F8A6H
COR2AD2, COR2AD2L: FFFF F8A8H COR2AD2H: FFFF F8AAH
COR2AD3, COR2AD3L: FFFF F8ACH COR2AD3H: FFFF F8AEH
COR2AD4, COR2AD4L: FFFF F8B0H COR2AD4H: FFFF F8B2H
COR2AD5, COR2AD5L: FFFF F8B4H COR2AD5H: FFFF F8B6H
COR2AD6, COR2AD6L: FFFF F8B8H COR2AD6H: FFFF F8BAH
COR2AD7, COR2AD7L: FFFF F8BCH COR2AD7H: FFFF F8BEH
Initial Value 0000 0000H

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
COR2ADm[15:0] 0
R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R/W R

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
0 0 0 0 0 0 0 0 0 0 0 0 COR2ADm[19:16]
R/W

Table 9-11 COR2ADm register contents


Bit Position Bit Name Function
19 to 0 COR2ADm Lower 16 bit of the ROM correction address of channel m.
[19:0] Bit 0 and bits 31 to 20 are fixed to 0, writing to these bits is ignored.

Caution The ROM correction address COR2ADm[19:0] must not exceed the upper
address of the internal VSB flash memory.

Note COR2ADm shall only be changed when the corresponding channel is disabled
(COR2CN.COR2ENm = 0).

www.DataSheet4U.com

392 User’s Manual U17566EE5V1UM00


Chapter 10 Code Protection and Security

10.1 Overview

The microcontroller supports various methods for protecting the program code
in the flash memory from undesired access, such as illegal read-out or illegal
reprogramming.
Some interfaces offer in general access to the internal flash memory: N-Wire
debug interface, external flash programmer interface, self-programming
facilities and test interfaces.
In the following the security relevant items are listed. The features to protect
the internal flash memory data from being read by unauthorized persons are
described.
For more information on the flash memory, see “Flash Memory“ on page 269.
The following sections give an overview about supported code protection
methods.

10.2 Boot ROM

Undesired access to the flash memory via the boot ROM is not possible.

10.3 N-Wire Debug Interface

In general, illegal read-out of the flash memory contents is possible via the
N-Wire debug interface. For protection of the flash memory, the usage of the
debug interface can be protected and it can be disabled. The debug interface is
protected via a 10-byte ID code and an internal flag (N-Wire use enable flag).
When the debugger is started, the status of a flag is queried (N-Wire use
enable flag). Set this flag to zero to disable the use of the N-Wire in-circuit
emulator.
When debugging is enabled (N-Wire use enable flag is set), you have to enter
a 10-byte ID code via the debugger. The code is compared with the ID code
stored in the internal flash memory. If the codes do not match, debugging is not
possible.
The N-Wire use enable flag can be set or reset while reprogramming the flash
by an external flash writer or with the self-programming feature. The flag is
located at bit 7 at address 0000 0079H.

You can specify your own 10-byte ID code and program it to the internal flash
www.DataSheet4U.com memory by an external flash writer or with the self-programming feature. The
ID code is located in the address range 0000 0070H to 0000 0079H.
The protection levels are summarized in Table 10-1

User’s Manual U17566EE5V1UM00 393


Chapter 10 Code Protection and Security

Table 10-1 Possible results of ID code comparison


N-Wire use enable flag ID code Protection Level
a
0 X Level 2: Full protection
N-Wire debug interface cannot be used.b
1 user-specific Level 1: ID code protection
ID code N-Wire debug interface can only be used
if the user enters the correct ID code.
ID code is all Level 0: No protection
onesc N-Wire debug interface can be used.
a)
Codes are not compared
b) Once the N-Wire debug interface has been set as “use-prohibited”, it cannot be
used until the flash memory is re-programmed.
c)
This is the default state after the flash memory has been erased.

Note 1. After you have set protection levels 1 or 2, set the “block erase disable flag”
in the flash extra area. Otherwise, an unauthorized person could erase the
block that contains the ID code or the “N-Wire use enable flag”,
respectively, and thus suspend the protection.
2. If an unauthorized user tries to find out the 10-byte ID by comparing all
possible ID codes, this will take up to 3.83 x 108 years at 100 MHz.

For more details refer to “Security function“ on page 971.

www.DataSheet4U.com

394 User’s Manual U17566EE5V1UM00


Code Protection and Security Chapter 10

10.4 Flash Writer and Self-Programming Protection

In general, illegal read-out and re-programming of the flash memory contents


is possible via the flash writer interface and the self-programming feature. For
protection of the flash memory, the following flags provide various protection
levels.
The flags can be set by flash programmers. For a description of flash memory
programming see “Flash Memory“ on page 269.

(1) Program protection flag (Program protection function)


Set this flag to disable the programming function via flash writer interface. This
flag does not affect the self-programming interface.
The flag is valid for the whole flash memory.

(2) Chip erase protection flag (Chip erase protection function)


Set this flag to disable the chip erase function via flash writer interface. This
flag does not affect the self-programming interface.

(3) Block erase protection flag (Block erase protection function)


Set this flag to disable the feature to erase single blocks via flash writer
interface. This flag does not affect the self-programming interface.
This flag does not affect the chip erase function.
The flag is valid for the whole flash memory.

(4) Read-out protection flag (Read-out protection function)


Set this flag to disable the feature that allows reading back the flash memory
via flash writer interface. This flag does not affect the self-programming
interface.
This flag is valid for the whole flash memory.

(5) Boot block cluster protection flag


Set this flag to disable erasure and rewrite of the boot block cluster.
The boot block cluster can not be manipulated in any way (no erase/write).
This applies in serial and self-programming mode.
Once this flag is set, it is impossible to reset this flag. Thus the boot block
cluster content can not be changed any more.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 395


Chapter 10 Code Protection and Security

10.5 Additional Firmware Functions

The internal firmware provides several additional features related to protection


and security. These are listed above.

10.5.1 ID-field

A dedicated 64-byte ID-field is provided to hold user defined information, like


for instance S/W versions.
The ID-field is stored in the user space of the flash memory, starting at address
0000 0800H.
The firmware allows to read the ID-field via an external flash programmer data
even if the read-out protection flag (refer to 10.4 on page 395) is set.

10.5.2 Checksum calculation

A dedicated firmware function calculates a checksum over the flash memory


contents.
The algorithm to calculate the checksum is “Standard CRC32”.
The checksum calculation starts from address 0000 0000H to the address
stored at 0000 0840H to 0000 0843H.

The bytes stored at 0000 0840H to 0000 0843H are subject to the checksum.
The 64-byte ID-field is not subject to this checksum.
The firmware allows to read the checksum via an external flash programmer
data even if the read-out protection flag (refer to 10.4 on page 395) is set.

10.5.3 Variable reset vector

The reset vector, determining the start of the user’s program is stored in an
“extra area” of the flash memory. This vector is configurable via an external
flash programmer and by self-programming.

www.DataSheet4U.com

396 User’s Manual U17566EE5V1UM00


Chapter 11 16-bit Timer/Event Counter P (TMP)

Timer P (TMP) is a 16-bit timer/event counter.

The V850E/Dx3 microcontrollers have following instances of the 16-bit timer/


event counter TMP:

TMP All devices


Instances 4
Names TMP0 to TMP3

Throughout this chapter, the individual instances of Timer P are identified by


“n”, for example TMPn, or TPnCTL0 for the TMPn control register 0.

11.1 Overview

An outline of TMPn is shown below.


• Clock selection: 8 ways
• Capture/trigger input pins: 2
• External event count input pins: 1
• External trigger input pins: 1
• Timer/counters: 1
• Capture/compare registers: 2
• Capture/compare match interrupt request signals: 2
• Timer output pins: 2

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 397


Chapter 11 16-bit Timer/Event Counter P (TMP)

11.2 Functions

TMPn has the following functions.


• Interval timer
• External event counter
• External trigger pulse output
• One-shot pulse output
• PWM output
• Free-running timer
• Pulse width measurement
• TMP0 and TMP1 can be used for triggering the DMA Controller.
• All TMPn can be optionally stopped when a breakpoint is hit during
debugging (refer to “On-Chip Debug Unit“ on page 969).

11.3 Configuration

TMPn includes the following hardware.

Internal bus

PCLK0 (16 MHz) TPnCNT


PCLK01=PCLK0/2Note (8 MHz)
PCLK02=PCLK0/4Note (4 MHz)
Selector

PCLK4 (1 MHz)
Selector

PCLK5 (500 KHz) 16-bit counter INTTPnOV


PCLK6 (250 KHz) Clear
PCLK7 (125 KHz)
controller

TPn0
Output

TPn1

CCR0
buffer
register CCR1 INTTPnCC0
buffer INTTPnCC1
register
detector

TIPn0 TPnCCR0
Edge

TIPn1 TPnCCR1

Internal bus

www.DataSheet4U.com
Figure 11-1 Block diagram of TMPn

398 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

The second (PCLK01) and the third (PCLK02) clock selector input is not
supplied from the Clock Generator, but derived from the first selector input
PCLK0 inside the timer P.
In case the PLL is disabled the PCLKx clocks are supplied from the main
oscillator, i.e.:
• PCLK0 = 4 MHz
• PCLK01 = PCLK0/2 = 2 MHz
• PCLK02 = PCLK0/4 = 1 MHz
For information about PCLKx, please refer to “Clock Generator“ on page 139.

(1) 16-bit counter


This 16-bit counter can count internal clocks or external events.
The count value of this counter can be read by using the TPnCNT register.
When the TPnCTL0.TPnCE bit = 0, the value of the 16-bit counter is FFFFH. If
the TPnCNT register is read at this time, 0000H is read.
Reset input clears the TPnCE bit to 0. Therefore, the 16-bit counter is set to
FFFFH.

(2) CCR0 buffer register


This is a 16-bit compare register that compares the count value of the 16-bit
counter.
When the TPnCCR0 register is used as a compare register, the value written
to the TPnCCR0 register is transferred to the CCR0 buffer register. When the
count value of the 16-bit counter matches the value of the CCR0 buffer
register, a compare match interrupt request signal (INTTPnCC0) is generated.
The CCR0 buffer register cannot be read or written directly.
The CCR0 buffer register is cleared to 0000H after reset, as the TPnCCR0
register is cleared to 0000H.

(3) CCR1 buffer register


This is a 16-bit compare register that compares the count value of the 16-bit
counter.
When the TPnCCR1 register is used as a compare register, the value written
to the TPnCCR1 register is transferred to the CCR1 buffer register. When the
count value of the 16-bit counter matches the value of the CCR1 buffer
register, a compare match interrupt request signal (INTTPnCC1) is generated.
The CCR1 buffer register cannot be read or written directly.
The CCR1 buffer register is cleared to 0000H after reset, as the TPnCCR1
register is cleared to 0000H.

(4) Edge detector


This circuit detects the valid edges input to the TIPn0 and TIPn1 pins. No
edge, rising edge, falling edge, or both the rising and falling edges can be
selected as the valid edge by using the TPnIOC1 and TPnIOC2 registers.
www.DataSheet4U.com
(5) Output controller
This circuit controls the output of the TOPn0 and TOPn1 pins. The output
controller is controlled by the TPnIOC0 register.

User’s Manual U17566EE5V1UM00 399


Chapter 11 16-bit Timer/Event Counter P (TMP)

(6) Selector
This selector selects the count clock for the 16-bit counter. Eight types of
internal clocks or an external event can be selected as the count clock.

www.DataSheet4U.com

400 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

11.4 TMP Registers

The TMPn are controlled and operated by means of the following registers:

Table 11-1 TMPn registers overview


Register name Shortcut Address
TMPn control registers 0 TPnCTL0 <base>
TMPn control registers 1 TPnCTL1 <base> + 1H
TMPn I/O control register 0 TPnIOC0 <base> + 2H
TMPn I/O control register 1 TPnIOC1 <base> + 3H
TMPn I/O control register 2 TPnIOC2 <base> + 4H
TMPn option registers 0 TPnOPT0 <base> + 5H
TMPn capture/compare registers 0 TPnCCR0 <base> + 6H
TMPn capture/compare registers 1 TPnCCR1 <base> + 8H
TMPn counter read buffer register TPnCNT <base> + AH

Table 11-2 TMPn register base address


Timer Base address
TMP0 FFFF F660H
TMP1 FFFF F670H
TMP2 FFFF F680H
TMP3 FFFF F690H

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 401


Chapter 11 16-bit Timer/Event Counter P (TMP)

(1) TPnCTL0 - TMPn control register 0


The TPnCTL0 register is an 8-bit register that controls the operation of TMPn.
Access This register can be read/written in 8-bit or 1-bit units.
Address <base>
Initial Value 00H. This register is initialized by any reset.
The same value can always be written to the TPnCTL0 register by software.
7 6 5 4 3 2 1 0
TPnCE 0 0 0 0 TPnCKS2 TPnCKS1 TPnCKS0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 11-3 TPnCTL0 register contents

Bit position Bit name Function


7 TPnCE TMPn operation disable/enable:
0: TMPn operation disabled (TMPn reset asynchronously: reset of
TPn0PT0.TPnOVF bit, 16-bit counter, timer output (TOPn0, TOPn1 pins)
1: TMPn operation enabled (TMPn operation starts)
2 to 0 TPnCKS[2:0] Internal count clock selection:
TPnCKS2 TPnCKS1 TPnCKS0 Internal count clock
0 0 0 PCLK0
0 0 1 PCLK01 = PCLK0/2
0 1 0 PCLK02 = PCLK0/4
0 1 1 Prohibited
1 0 0 PCLK4
1 0 1 PCLK5
1 1 0 PCLK6
1 1 1 PCLK7

Caution 1. Set the TPnCKS2 to TPnCKS0 bits when the TPnCE bit = 0.
2. When the value of the TPnCE bit is changed from 0 to 1, the TPnCKS2 to
TPnCKS0 bits can be set simultaneously.
3. Be sure to clear bits 3 to 6 to 0.

Note For information about PCLKx, please refer to “Clock Generator“ on page 139.

w w w . D a t a S h e e t 4 U . c o m

402 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(2) TPnCTL1 - TMPn control register 1


The TPnCTL1 register is an 8-bit register that controls the operation of TMPn.
Access This register can be read/written in 8-bit or 1-bit units.
Address <base> + 1H
Initial Value 00H. This register is initialized by any reset.

7 6 5 4 3 2 1 0
0 TPnEST TPnEEE 0 0 TPnMD2 TPnMD1 TPnMD0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 11-4 TPnCTL1 register contents

Bit position Bit name Function


6 TPnEST Software trigger control.
0: –
1: Generate a valid signal for external trigger input.
• In one-shot pulse output mode:
A one-shot pulse is output with writing 1 to the TPnEST bit as the trigger.
• In external trigger pulse output mode:
A PWM waveform is output with writing 1 to the TPnEST bit as the trigger.
5 TPnEEE Count clock selection:
0: Disable operation with external event count input.
(Perform counting with the count clock selected by the TPnCTL0.TPnCK0 to
TPnCK2 bits.)
1: Enable operation with external event count input.
(Perform counting at the valid edge of the external event count input signal.)
The TPnEEE bit selects whether counting is performed with the internal count
clock or the valid edge of the external event count input.
2 to 0 TPnMD[2:0] Timer mode selection:
TPnMD2 TPnMD1 TPnMD0 Timer mode
0 0 0 Interval timer
0 0 1 External event count
0 1 0 External trigger pulse output
0 1 1 One-shot pulse output
1 0 0 PWM output
1 0 1 Free-runnning timer
1 1 0 Pulse width measurement
1 1 1 Setting prohibited

Caution 1. The TPnEST bit is valid only in the external trigger pulse output mode or
one-shot pulse output mode. In any other mode, writing 1 to this bit is
www.DataSheet4U.com ignored.
2. External event count input is selected in the external event count mode
regardless of the value of the TPnEEE bit.

User’s Manual U17566EE5V1UM00 403


Chapter 11 16-bit Timer/Event Counter P (TMP)

3. Set the TPnEEE and TPnMD2 to TPnMD0 bits when the TPnCTL0.TPnCE
bit = 0. (The same value can be written when the TPnCE bit = 1.) The
operation is not guaranteed when rewriting is performed with the TPnCE
bit = 1. If rewriting was mistakenly performed, clear the TPnCE bit to 0 and
then set the bits again.
4. Be sure to clear bits 3, 4, and 7 to 0.

(3) TPnIOC0 - TMPn I/O control register 0


The TPnIOC0 register is an 8-bit register that controls the timer output
(TOPn0, TOPn1 pins).
Access This register can be read/written in 8-bit or 1-bit units.
Address <base> + 2H
Initial Value 00H. This register is initialized by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 TPnOL1 TPnOE1 TPnOL0 TPnOE0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 11-5 TPnIOC0 register contents

Bit position Bit name Function


3 TPnOL1 TOPn1 pin output level setting:
0: TOPn1 pin output inversion disabled
1: TOPn1 pin output inversion enabled
2 TPnOE1 TOPn1 pin output setting:
0: Timer output disable
– when TPnOL1 = 0: low level is output from TOPn1 pin
– when TPnOL1 = 1: high level is output from TOPn1 pin
1: Timer output enable
(A square wave is output from TOPn1 pin.)
1 TPnOL0 TOPn0 pin output level setting:
0: TOPn0 pin output inversion disabled
1: TOPn0 pin output inversion enabled
0 TPnOE0 TOPn0 pin output setting:
0: Timer output disable
– when TPnOL0 = 0: low level is output from TOPn0 pin
– when TPnOL0 = 1: high level is output from TOPn0 pin
1: Timer output enable
(A square wave is output from TOPn0 pin.)

Caution 1. Rewrite the TPnOL1, TPnOE1, TPnOL0, and TPnOE0 bits when the
TPnCTL0.TPnCE bit = 0. (The same value can be written when the TPnCE
bit = 1.) If rewriting was mistakenly performed, clear the TPnCE bit to 0 and
www.DataSheet4U.com then set the bits again.
2. Even if the TPnOLm bit is manipulated when the TPnCE and TPnOEm bits
are 0, the TOPnm pin output level varies (m = 0, 1).

404 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(4) TPnIOC1 - TMPn I/O control register 1


The TPnIOC1 register is an 8-bit register that controls the valid edge of the
capture trigger input signals (TIPn0, TIPn1 pins).
Access This register can be read/written in 8-bit or 1-bit units.
Address <base> + 3H
Initial Value 00H. This register is initialized by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 TPnIS3 TPnIS2 TPnIS1 TPnIS0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 11-6 TPnIOC1 register contents

Bit position Bit name Function


3 to 2 TPnIS[3:2] Capture trigger input signal (TIPn1 pin) valied edge setting:
TPnIS3 TPnIS2 Capture trigger valid edge of TIPn1
0 0 No edge detection (capture operation invalid)
0 1 Detection of rising edge
1 0 Detection of falling edge
1 1 Detection of both edges

1 to 0 TPnIS[1:0] Capture trigger input signal (TIPn0 pin) valied edge setting:
TPnIS1 TPnIS0 Capture trigger valid edge of TIPn0
0 0 No edge detection (capture operation invalid)
0 1 Detection of rising edge
1 0 Detection of falling edge
1 1 Detection of both edges

Caution 1. Rewrite the TPnIS3 to TPnIS0 bits when the TPnCTL0.TPnCE bit = 0. (The
same value can be written when the TPnCE bit = 1.) If rewriting was
mistakenly performed, clear the TPnCE bit to 0 and then set the bits again.
2. The TPnIS3 to TPnIS0 bits are valid only in the free-running timer mode and
the pulse width measurement mode. In all other modes, a capture operation
is not possible.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 405


Chapter 11 16-bit Timer/Event Counter P (TMP)

(5) TPnIOC2 - TMPn I/O control register 2


The TPnIOC2 register is an 8-bit register that controls the valid edge of the
external event count input signal (TIPn0 pin) and external trigger input signal
(TIPn0 pin).
Access This register can be read/written in 8-bit or 1-bit units.
Address <base> + 4H
Initial Value 00H. This register is initialized by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 TPnEES1 TPnEES0 TPnETS1 TPnETS0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 11-7 TPnIOC2 register contents

Bit position Bit name Function


3 to 2 TPnEES[1:0] External event count input signal (TIPn0 pin) valid edge setting:
TPnEES1 TPnEES0 External event count valid edge of TIPn0
0 0 No edge detection (external event invalid)
0 1 Detection of rising edge
1 0 Detection of falling edge
1 1 Detection of both edges

1 to 0 TPnETS[1:0] Capture trigger input signal (TIPn0 pin) valid edge setting:
TPnETS1 TPnETS0 External trigger input valid edge of TIPn0
0 0 No edge detection (external trigger invalid)
0 1 Detection of rising edge
1 0 Detection of falling edge
1 1 Detection of both edges

Caution 1. Rewrite the TPnEES1, TPnEES0, TPnETS1, and TPnETS0 bits when the
TPnCTL0.TPnCE bit = 0. (The same value can be written when the TPnCE
bit = 1.) If rewriting was mistakenly performed, clear the TPnCE bit to 0 and
then set the bits again.
2. The TPnEES1 and TPnEES0 bits are valid only when the
TPnCTL1.TPnEEE bit = 1 or when the external event count mode
(TPnCTL1.TPnMD2 to TPnCTL1.TPnMD0 bits = 001) has been set.

www.DataSheet4U.com

406 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(6) TPnOPT0 - TMPn option register 0


The TPnOPT0 register is an 8-bit register used to set the capture/compare
operation and detect an overflow.
Access This register can be read/written in 8-bit or 1-bit units.
Address <base> + 5H
Initial Value 00H. This register is initialized by any reset.

7 6 5 4 3 2 1 0
0 0 TPnCCS1 TPnCCS10 0 0 0 TPnOVF
R/W R/W R/W R/W R/W R/W R/W R/W

Table 11-8 TPnOPT0 register contents

Bit position Bit name Function


5 TPnCCS1 TPnCCR1 register capture/compare selection:
0: compare register selected
1: capture register selected
The TPnCCS1 bit setting is valid only in the free-running timer mode.
4 TPnCCS0 TPnCCR0 register capture/compare selection:
0: compare register selected
1: capture register selected
The TPnCCS0 bit setting is valid only in the free-running timer mode.
0 TPnOVF TMPn overflow detection flag:
Set (1): Overflow occurred
Reset (0): TPnOVF bit 0 written or TPnCTL0.TPnCE bit = 0
• The TPnOVF bit is reset when the 16-bit counter count value overflows from
FFFFH to 0000H in the free-running timer mode or the pulse width
measurement mode.
• An interrupt request signal (INTTPnOV) is generated at the same time that
the TPnOVF bit is set to 1. The INTTPnOV signal is not generated in modes
other than the free-running timer mode and the pulse width measurement
mode.
• The TPnOVF bit is not cleared even when the TPnOVF bit or the TPnOPT0
register are read when the TPnOVF bit = 1.
• The TPnOVF bit can be both read and written, but the TPnOVF bit cannot be
set to 1 by software. Writing 1 has no influence on the operation of TMPn.

Caution 1. Rewrite the TPnCCS1 and TPnCCS0 bits when the TPnCE bit = 0. (The
same value can be written when the TPnCE bit = 1.) If rewriting was
mistakenly performed, clear the TPnCE bit to 0 and then set the bits again.
2. Be sure to clear bits 1 to 3, 6, and 7 to 0.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 407


Chapter 11 16-bit Timer/Event Counter P (TMP)

(7) TPnCCR0 - TMPn capture/compare register 0


The TPnCCR0 register can be used as a capture register or a compare
register depending on the mode.
This register can be used as a capture register or a compare register only in
the free-running timer mode, depending on the setting of the
TPnOPT0.TPnCCS0 bit. In the pulse width measurement mode, the TPnCCR0
register can be used only as a capture register. In any other mode, this register
can be used only as a compare register.
The TPnCCR0 register can be read or written during operation.
Access This register can be read/written in 16-bit units.
Address <base> + 6H
Initial Value 0000H. This register is initialized by any reset.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CCR0 value
R/W

(a) Function as compare register


The TPnCCR0 register can be rewritten even when the TPnCTL0.TPnCE
bit = 1.
The set value of the TPnCCR0 register is transferred to the CCR0 buffer
register. When the value of the 16-bit counter matches the value of the CCR0
buffer register, a compare match interrupt request signal (INTTPnCC0) is
generated. If TOPn0 pin output is enabled at this time, the output of the TOPn0
pin is inverted.
When the TPnCCR0 register is used as a cycle register in the interval timer
mode, external event count mode, external trigger pulse output mode, one-
shot pulse output mode, or PWM output mode, the value of the 16-bit counter
is cleared (0000H) if its count value matches the value of the CCR0 buffer
register.

www.DataSheet4U.com

408 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(b) Function as capture register


When the TPnCCR0 register is used as a capture register in the free-running
timer mode, the count value of the 16-bit counter is stored in the TPnCCR0
register if the valid edge of the capture trigger input pin (TIPn0 pin) is detected.
In the pulse-width measurement mode, the count value of the 16-bit counter is
stored in the TPnCCR0 register and the 16-bit counter is cleared (0000H) if the
valid edge of the capture trigger input pin (TIPn0) is detected.
Even if the capture operation and reading the TPnCCR0 register conflict, the
correct value of the TPnCCR0 register can be read.
The following table shows the functions of the capture/compare register in
each mode, and how to write data to the compare register.

Table 11-9 Function of capture/compare register in each mode and how to write
compare register
Operation mode Capture/compare register How to write compare register
Interval timer Compare register Anytime write
External event counter Compare register Anytime write
External trigger pulse output Compare register Batch write
One-shot pulse output Compare register Anytime write
PWM output Compare register Batch write
Free-running timer Capture/compare register Anytime write
Pulse width measurement Capture register -

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 409


Chapter 11 16-bit Timer/Event Counter P (TMP)

(8) TPnCCR1 - TMPn capture/compare register 1


The TPnCCR1 register can be used as a capture register or a compare
register depending on the mode.
This register can be used as a capture register or a compare register only in
the free-running timer mode, depending on the setting of the
TPnOPT0.TPnCCS1 bit. In the pulse width measurement mode, the TPnCCR1
register can be used only as a capture register. In any other mode, this register
can be used only as a compare register.
The TPnCCR1 register can be read or written during operation.
Access This register can be read/written in 16-bit units.
Address <base> + 8H
Initial Value 0000H. This register is initialized by any reset.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
CCR1 value
R/W

(a) Function as compare register


The TPnCCR1 register can be rewritten even when the TPnCTL0.TPnCE
bit = 1.
The set value of the TPnCCR1 register is transferred to the CCR1 buffer
register. When the value of the 16-bit counter matches the value of the CCR1
buffer register, a compare match interrupt request signal (INTTPnCC1) is
generated. If TOPn1 pin output is enabled at this time, the output of the TOPn1
pin is inverted.

www.DataSheet4U.com

410 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(b) Function as capture register


When the TPnCCR1 register is used as a capture register in the free-running
timer mode, the count value of the 16-bit counter is stored in the TPnCCR1
register if the valid edge of the capture trigger input pin (TIPn1 pin) is detected.
In the pulse-width measurement mode, the count value of the 16-bit counter is
stored in the TPnCCR1 register and the 16-bit counter is cleared (0000H) if the
valid edge of the capture trigger input pin (TIPn1) is detected.
Even if the capture operation and reading the TPnCCR1 register conflict, the
correct value of the TPnCCR1 register can be read.
The following table shows the functions of the capture/compare register in
each mode, and how to write data to the compare register.

Table 11-10 Function of capture/compare register in each mode and how to write
compare register
Operationmode Capture/compare register How to write compare register
Interval timer Compare register Anytime write
External event counter Compare register Anytime write
External trigger pulse output Compare register Batch write
One-shot pulse output Compare register Anytime write
PWM output Compare register Batch write
Free-running timer Capture/compare register Anytime write
Pulse width measurement Capture register -

(9) TPnCNT - TMPn counter read buffer register


The TPnCNT register is a read buffer register that can read the count value of
the 16-bit counter.
If this register is read when the TPnCTL0.TPnCE bit = 1, the count value of
the 16-bit timer can be read.
The value of the TPnCNT register is cleared to 0000H when the TPnCE bit = 0.
If the TPnCNT register is read at this time, the value of the 16-bit counter
(FFFFH) is not read, but 0000H is read.
Access This register can be read only in 16-bit units.
Address <base> + AH
Initial Value 0000H. This register is initialized by any reset, as the TPnCE bit is cleared to 0.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
TPnCNT value
R

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 411


Chapter 11 16-bit Timer/Event Counter P (TMP)

11.5 Operation

TMPn can perform the following operations.

TPnCTL1.TPnEST Bit TIPn0 Pin Capture/ Compare Compare Register


Operation
(Software Trigger Bit) (Ext. Trigger Input) Register Setting Write
Interval timer mode Invalid Invalid Compare only Anytime write
External event count Invalid Invalid Compare only Anytime write
modeNote 1
External trigger pulse Valid Valid Compare only Batch write
output modeNote 2
One-shot pulse output Valid Valid Compare only Anytime write
modeNote 2
PWM output mode Invalid Invalid Compare only Batch write
Free-running timer mode Invalid Invalid Switching enabled Anytime write
Pulse width Invalid Invalid Capture only Not applicable
measurement
modeNote 2

Note 1. To use the external event count mode, specify that the valid edge of the
TIPn0 pin capture trigger input is not detected (by clearing the
TPnIOC1.TPnIS1 and TPnIOC1.TPnIS0 bits to “00”).
2. When using the external trigger pulse output mode, one-shot pulse output
mode, and pulse width measurement mode, select the internal clock as the
count clock (by clearing the TPnCTL1.TPnEEE bit to 0).

11.5.1 Interval timer mode (TPnMD2 to TPnMD0 = 000)

In the interval timer mode, an interrupt request signal (INTTPnCC0) is


generated at the specified interval if the TPnCTL0.TPnCE bit is set to 1. A
square wave whose half cycle is equal to the interval can be output from the
TOPn0 pin.
Usually, the TPnCCR1 register is not used in the interval timer mode.

Clear

Count clock Output


16-bit counter TOPn0 pin
selection controller

Match signal
INTTPnCC0 signal

TPnCE bit CCR0 buffer register

www.DataSheet4U.com TPnCCR0 register

Figure 11-2 Configuration of interval timer

412 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

FFFFH

D0 D0 D0 D0
16-bit counter

0000H

TPnCE bit

TPnCCR0 register D0

TOPn0 pin output

INTTPnCC0 signal

Interval (D0 + 1) Interval (D0 + 1) Interval (D0 + 1) Interval (D0 + 1)

Figure 11-3 Basic timing of operation in interval timer mode

When the TPnCE bit is set to 1, the value of the 16-bit counter is cleared from
FFFFH to 0000H in synchronization with the count clock, and the counter
starts counting. At this time, the output of the TOPn0 pin is inverted.
Additionally, the set value of the TPnCCR0 register is transferred to the CCR0
buffer register.
When the count value of the 16-bit counter matches the value of the CCR0
buffer register, the 16-bit counter is cleared to 0000H, the output of the TOPn0
pin is inverted, and a compare match interrupt request signal (INTTPnCC0) is
generated.
The interval can be calculated by the following expression.
Interval = (Set value of TPnCCR0 register + 1) × Count clock cycle

(1) Register setting for interval timer mode operation

(a) TMPn control register 0 (TPnCTL0)

TPnCE TPnCKS2 TPnCKS1 TPnCKS0


TPnCTL0 0/1 0 0 0 0 0/1 0/1 0/1

Select count clock


0: Stop counting
1: Enable counting

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 413


Chapter 11 16-bit Timer/Event Counter P (TMP)

(b) TMPn control register 1 (TPnCTL1)

TPnEST TPnEEE TPnMD2 TPnMD1 TPnMD0


TPnCTL1 0 0 0 0 0 0 0 0

0, 0, 0:
Interval timer mode

(c) TMPn I/O control register 0 (TPnIOC0)

TPnOL1 TPnOE1 TPnOL0 TPnOE0


TPnIOC0 0 0 0 0 0/1 0/1 0/1 0/1

0: Disable TOPn0 pin output


1: Enable TOPn0 pin output
Setting of output level with
operation of TOPn0 pin disabled
0: Low level
1: High level
0: Disable TOPn1 pin output
1: Enable TOPn1 pin output
Setting of output level with
operation of TOPn1 pin disabled
0: Low level
1: High level

(d) TMPn counter read buffer register (TPnCNT)


By reading the TPnCNT register, the count value of the 16-bit counter can be
read.

(e) TMPn capture/compare register 0 (TPnCCR0)


If the TPnCCR0 register is set to D0, the interval is as follows.
Interval = (D0 + 1) × Count clock cycle

(f) TMPn capture/compare register 1 (TPnCCR1)


Usually, the TPnCCR1 register is not used in the interval timer mode. However,
the set value of the TPnCCR1 register is transferred to the CCR1 buffer
register. A compare match interrupt request signal (INTTPnCC1) is generated
when the count value of the 16-bit counter matches the value of the CCR1
buffer register.
Therefore, mask the interrupt request by using the corresponding interrupt
www.DataSheet4U.com mask flag (TPnCCMK1).

Note TMPn I/O control register 1 (TPnIOC1), TMPn I/O control register 2
(TPnIOC2), and TMPn option register 0 (TPnOPT0) are not used in the interval
timer mode.

414 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(2) Interval timer mode operation flow

FFFFH

D0 D0 D0
16-bit counter

0000H

TPnCE bit

TPnCCR0 register D0

TOPn0 pin output

INTTPnCC0 signal

<1> <2>

<1> Count operation start flow

START

Register initial setting Initial setting of these registers is performed


TPnCTL0 register before setting the TPnCE bit to 1.
(TPnCKS0 to TPnCKS2 bits)
TPnCTL1 register,
TPnIOC0 register,
TPnCCR0 register

The TPnCKS0 to TPnCKS2 bits can be


TPnCE bit = 1
set at the same time when counting has
been started (TPnCE bit = 1).

<2> Count operation stop flow

The counter is initialized and counting is


TPnCE bit = 0 stopped by clearing the TPnCE bit to 0.

STOP

www.DataSheet4U.com
Figure 11-4 Software processing flow in interval timer mode

User’s Manual U17566EE5V1UM00 415


Chapter 11 16-bit Timer/Event Counter P (TMP)

(3) Interval timer mode operation timing

(a) Operation if TPnCCR0 register is set to 0000H


If the TPnCCR0 register is set to 0000H, the INTTPnCC0 signal is generated
at each count clock, and the output of the TOPn0 pin is inverted.
The value of the 16-bit counter is always 0000H.

Count clock

16-bit counter FFFFH 0000H 0000H 0000H 0000H

TPnCE bit

TPnCCR0 register 0000H

TOPn0 pin output

INTTPnCC0 signal

Interval time Interval time Interval time


Count clock cycle Count clock cycle Count clock cycle

(b) Operation if TPnCCR0 register is set to FFFFH


If the TPnCCR0 register is set to FFFFH, the 16-bit counter counts up to
FFFFH. The counter is cleared to 0000H in synchronization with the next
count-up timing. The INTTPnCC0 signal is generated and the output of the
TOPn0 pin is inverted. At this time, an overflow interrupt request signal
(INTTPnOV) is not generated, nor is the overflow flag (TPnOPT0.TPnOVF bit)
set to 1.

FFFFH

16-bit counter

0000H

TPnCE bit

TPnCCR0 register FFFFH

TOPn0 pin output

www.DataSheet4U.com INTTPnCC0 signal

Interval time Interval time Interval time


10000H × 10000H × 10000H ×
count clock cycle count clock cycle count clock cycle

416 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(c) Notes on rewriting TPnCCR0 register


To change the value of the TPnCCR0 register to a smaller value, stop counting
once and then change the set value.
If the value of the TPnCCR0 register is rewritten to a smaller value during
counting, the 16-bit counter may overflow.

FFFFH
D1 D1

16-bit counter
D2 D2 D2

0000H

TPnCE bit

TPnCCR0 register D1 D2

TPnOL0 bit L

TOPn0 pin output

INTTPnCC0 signal

Interval time (1) Interval time (NG) Interval


time (2)

Note 1. Interval time (1): (D1 + 1) × Count clock cycle


2. Interval time (NG): (10000H + D2 + 1) × Count clock cycle
3. Interval time (2): (D2 + 1) × Count clock cycle

If the value of the TPnCCR0 register is changed from D1 to D2 while the count
value is greater than D2 but less than D1, the count value is transferred to the
CCR0 buffer register as soon as the TPnCCR0 register has been rewritten.
Consequently, the value of the 16-bit counter that is compared is D2.
Because the count value has already exceeded D2, however, the 16-bit counter
counts up to FFFFH, overflows, and then counts up again from 0000H. When
the count value matches D2, the INTTPnCC0 signal is generated and the
output of the TOPn0 pin is inverted.
Therefore, the INTTPnCC0 signal may not be generated at the interval time
“(D1 + 1) × Count clock cycle” or “(D2 + 1) × Count clock cycle” originally
expected, but may be generated at an interval of
“(10000H + D2 + 1) × Count clock period”.
www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 417


Chapter 11 16-bit Timer/Event Counter P (TMP)

(d) Operation of TPnCCR1 register

TPnCCR1 register

Output
CCR1 buffer register TOPn1 pin
controller

Match signal
INTTPnCC1 signal
Clear

Count clock Output


16-bit counter TOPn0 pin
selection controller

Match signal
INTTPnCC0 signal

TPnCE bit CCR0 buffer register

TPnCCR0 register

Figure 11-5 Configuration of TPnCCR1 register

If the set value of the TPnCCR1 register is less than the set value of the
TPnCCR0 register, the INTTPnCC1 signal is generated once per cycle. At the
same time, the output of the TOPn1 pin is inverted.
The TOPn1 pin outputs a square wave with the same cycle as that output by
the TOPn0 pin.

www.DataSheet4U.com

418 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

FFFFH
D01 D01 D01 D01

16-bit counter
D11 D11 D11 D11

0000H

TPnCE bit

TPnCCR0 register D01

TOPn0 pin output

INTTPnCC0 signal

TPnCCR1 register D11

TOPn1 pin output

INTTPnCC1 signal

Figure 11-6 Timing chart when D01 ≥ D11

If the set value of the TPnCCR1 register is greater than the set value of the
TPnCCR0 register, the count value of the 16-bit counter does not match the
value of the TPnCCR1 register. Consequently, the INTTPnCC1 signal is not
generated, nor is the output of the TOPn1 pin changed.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 419


Chapter 11 16-bit Timer/Event Counter P (TMP)

FFFFH
D01 D01 D01 D01

16-bit counter

0000H

TPnCE bit

TPnCCR0 register D01

TOPn0 pin output

INTTPnCC0 signal

TPnCCR1 register D11

TOPn1 pin output

INTTPnCC1 signal L

Figure 11-7 Timing chart when D01 < D11

www.DataSheet4U.com

420 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

11.5.2 External event count mode (TPnMD2 to TPnMD0 = 001)

In the external event count mode, the valid edge of the external event count
input is counted when the TPnCTL0.TPnCE bit is set to 1, and an interrupt
request signal (INTTPnCC0) is generated each time the specified number of
edges have been counted. The TOPn0 pin cannot be used.
Usually, the TPnCCR1 register is not used in the external event count mode.

Clear

TIPn0 pin Edge


(external event 16-bit counter
detector
count input)
Match signal
INTTPnCC0 signal

TPnCE bit CCR0 buffer register

TPnCCR0 register

Figure 11-8 Configuration in external event count mode

FFFFH

D0 D0 D0
16-bit counter

0000H 16-bit counter D0 − 1 D0 0000 0001

External event
TPnCE bit count input
(TIPn0 pin input)

TPnCCR0 register D0 TPnCCR0 register D0

INTTPnCC0 signal INTTPnCC0 signal

External External External


event event event
count count count
interval interval interval
(D0) (D0 + 1) (D0 + 1)

Figure 11-9 Basic timing in external event count mode

www.DataSheet4U.com
Caution This figure shows the basic timing when the rising edge is specified as the
valid edge of the external event count input.

User’s Manual U17566EE5V1UM00 421


Chapter 11 16-bit Timer/Event Counter P (TMP)

When the TPnCE bit is set to 1, the value of the 16-bit counter is cleared from
FFFFH to 0000H. The counter counts each time the valid edge of external
event count input is detected. Additionally, the set value of the TPnCCR0
register is transferred to the CCR0 buffer register.
When the count value of the 16-bit counter matches the value of the CCR0
buffer register, the 16-bit counter is cleared to 0000H, and a compare match
interrupt request signal (INTTPnCC0) is generated.
The INTTPnCC0 signal is generated each time the valid edge of the external
event count input has been detected (set value of TPnCCR0 register + 1)
times.

(1) Register setting for operation in external event count mode

(a) TMPn control register 0 (TPnCTL0)

TPnCE TPnCKS2 TPnCKS1 TPnCKS0


TPnCTL0 0/1 0 0 0 0 0 0 0

0: Stop counting
1: Enable counting

(b) TMPn control register 1 (TPnCTL1)

TPnEST TPnEEE TPnMD2 TPnMD1 TPnMD0


TPnCTL1 0 0 1 0 0 0 0 1

0, 0, 1:
External event count mode
1: Count with external
event input signal

www.DataSheet4U.com

422 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(c) TMPn I/O control register 0 (TPnIOC0)

TPnOL1 TPnOE1 TPnOL0 TPnOE0


TPnIOC0 0 0 0 0 0/1 0/1 0 0
0: Disable TOPn0 pin output
0: Disable TOPn1 pin output
1: Enable TOPn1 pin output
Setting of output level with
operation of TOPn1 pin
disabled
0: Low level
1: High level

(d) TMPn I/O control register 2 (TPnIOC2)

TPnEES1 TPnEES0 TPnETS1 TPnETS0


TPnIOC2 0 0 0 0 0/1 0/1 0 0

Select valid edge


of external event
count input

(e) TMPn counter read buffer register (TPnCNT)


The count value of the 16-bit counter can be read by reading the TPnCNT
register.

(f) TMPn capture/compare register 0 (TPnCCR0)


If D0 is set to the TPnCCR0 register, the counter is cleared and a compare
match interrupt request signal (INTTPnCC0) is generated when the number of
external event counts reaches (D0 + 1).

(g) TMPn capture/compare register 1 (TPnCCR1)


Usually, the TPnCCR1 register is not used in the external event count mode.
However, the set value of the TPnCCR1 register is transferred to the CCR1
buffer register. When the count value of the 16-bit counter matches the value of
the CCR1 buffer register, a compare match interrupt request signal
(INTTPnCC1) is generated.
Therefore, mask the interrupt signal by using the interrupt mask flag
(TPnCCMK1).

www.DataSheet4U.com

Note TMPn I/O control register 1 (TPnIOC1) and TMPn option register 0 (TPnOPT0)
are not used in the external event count mode.

User’s Manual U17566EE5V1UM00 423


Chapter 11 16-bit Timer/Event Counter P (TMP)

Caution When the compare register TPnCCR0 (TPnCCR1) is set to 0000H and the
external event counter mode is started the first interrupt INTTPnCC0
(INTTPnCC1) occurs upon the first timer overflow (TPnCNT: FFFFH →0000H),
but not with the first external count event.
Afterwards the following interrupts INTTPnCC0 (INTTPnCC1) are generated
as specified, i.e. with each external count event.

www.DataSheet4U.com

424 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(2) External event count mode operation flow

FFFFH

D0 D0 D0
16-bit counter

0000H

TPnCE bit

TPnCCR0 register D0

INTTPnCC0 signal

<1> <2>

<1> Count operation start flow

START

Register initial setting Initial setting of these registers


TPnCTL0 register is performed before setting the
(TPnCKS0 to TPnCKS2 bits) TPnCE bit to 1.
TPnCTL1 register,
TPnIOC0 register,
TPnIOC2 register,
TPnCCR0 register,

The TPnCKS0 to TPnCKS2 bits can


TPnCE bit = 1
be set at the same time when counting
has been started (TPnCE bit = 1).

<2> Count operation stop flow

The counter is initialized and counting


TPnCE bit = 0 is stopped by clearing the TPnCE bit to 0.

STOP

Figure 11-10 Flow of software processing in external event count mode


www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 425


Chapter 11 16-bit Timer/Event Counter P (TMP)

(3) Operation timing in external event count mode

(a) Operation if TPnCCR0 register is set to 0000H


If the TPnCCR0 register is set to 0000H, the INTTPnCC0 signal is generated
each time the valid signal of the external event count signal has been detected.
The 16-bit counter is always 0000H.

External event count signal

16-bit counter FFFFH 0000H 0000H 0000H 0000H

TPnCE bit

TPnCCR0 register 0000H

INTTPnCC0 signal

External event External event External event


count signal count signal count signal
interval interval interval

(b) Operation if TPnCCR0 register is set to FFFFH


If the TPnCCR0 register is set to FFFFH, the 16-bit counter counts to FFFFH
each time the valid edge of the external event count signal has been detected.
The 16-bit counter is cleared to 0000H in synchronization with the next count-
up timing, and the INTTPnCC0 signal is generated. At this time, the
TPnOPT0.TPnOVF bit is not set.

FFFFH

16-bit counter

0000H

TPnCE bit

TPnCCR0 register FFFFH

INTTPnCC0 signal

External event External event External event


count signal count signal count signal
www.DataSheet4U.com interval interval interval

426 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(c) Notes on rewriting the TPnCCR0 register


To change the value of the TPnCCR0 register to a smaller value, stop counting
once and then change the set value.
If the value of the TPnCCR0 register is rewritten to a smaller value during
counting, the 16-bit counter may overflow.

FFFFH
D1 D1

16-bit counter
D2 D2 D2

0000H

TPnCE bit

TPnCCR0 register D1 D2

INTTPnCC0 signal

External event External event count signal External event


count signal interval (NG) count signal
interval (1) (10000H + D2 + 1) interval (2)
(D1 + 1) (D2 + 1)

If the value of the TPnCCR0 register is changed from D1 to D2 while the count
value is greater than D2 but less than D1, the count value is transferred to the
CCR0 buffer register as soon as the TPnCCR0 register has been rewritten.
Consequently, the value that is compared with the 16-bit counter is D2.
Because the count value has already exceeded D2, however, the 16-bit counter
counts up to FFFFH, overflows, and then counts up again from 0000H. When
the count value matches D2, the INTTPnCC0 signal is generated.
Therefore, the INTTPnCC0 signal may not be generated at the valid edge
count of “(D1 + 1) times” or “(D2 + 1) times” originally expected, but may be
generated at the valid edge count of “(10000H + D2 + 1) times”.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 427


Chapter 11 16-bit Timer/Event Counter P (TMP)

(d) Operation of TPnCCR1 register

TPnCCR1 register

Output
CCR1 buffer register TOPn1 pin
controller

Match signal
INTTPnCC1 signal
Clear

Edge
TIPn0 pin 16-bit counter
detector

Match signal
INTTPnCC0 signal

TPnCE bit CCR0 buffer register

TPnCCR0 register

Figure 11-11 Configuration of TPnCCR1 register

If the set value of the TPnCCR1 register is smaller than the set value of the
TPnCCR0 register, the INTTPnCC1 signal is generated once per cycle. At the
same time, the output signal of the TOPn1 pin is inverted.

FFFFH
D01 D01 D01 D01

16-bit counter
D11 D11 D11 D11

0000H

TPnCE bit

TPnCCR0 register D01

INTTPnCC0 signal

TPnCCR1 register D11

TOPn1 pin output

INTTPnCC1 signal

www.DataSheet4U.com

Figure 11-12 Timing chart when D01 ≥ D11

428 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

If the set value of the TPnCCR1 register is greater than the set value of the
TPnCCR0 register, the INTTPnCC1 signal is not generated because the count
value of the 16-bit counter and the value of the TPnCCR1 register do not
match. Nor is the output signal of the TOPn1 pin changed.

FFFFH
D01 D01 D01 D01

16-bit counter

0000H

TPnCE bit

TPnCCR0 register D01

INTTPnCC0 signal

TPnCCR1 register D11

TOPn1 pin output

INTTPnCC1 signal L

Figure 11-13 Timing chart when D01 < D11

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 429


Chapter 11 16-bit Timer/Event Counter P (TMP)

11.5.3 External trigger pulse output mode


(TPnMD2 to TPnMD0 = 010)

In the external trigger pulse output mode, 16-bit timer/event counter P waits for
a trigger when the TPnCTL0.TPnCE bit is set to 1. When the valid edge of an
external trigger input signal is detected, 16-bit timer/event counter P starts
counting, and outputs a PWM waveform from the TOPn1 pin.
Pulses can also be output by generating a software trigger instead of using the
external trigger. When using a software trigger, a square wave that has one
cycle of the PWM waveform as half its cycle can also be output from the
TOPn0 pin.

TPnCCR1 register
Edge Transfer
TIPn0 pin
detector
Output
S
CCR1 buffer register controller TOPn1 pin
R (RS-FF)
Software trigger
generation Match signal
INTTPnCC1 signal
Clear

Count Count
clock Output
start 16-bit counter TOPn0 pin
selection controller
control
Match signal
INTTPnCC0 signal

TPnCE bit CCR0 buffer register

Transfer

TPnCCR0 register

Figure 11-14 Configuration in external trigger pulse output mode

www.DataSheet4U.com

430 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

FFFFH
D0 D0 D0 D0

16-bit counter D1 D1 D1 D1

0000H

TPnCE bit

External trigger input


(TIPn0 pin input)

TPnCCR0 register D0

INTTPnCC0 signal

TOPn0 pin output


(software trigger)

TPnCCR1 register D1

INTTPnCC1 signal

TOPn1 pin output

Wait Active level Active level Active level


for width (D1) width (D1) width (D1)
trigger
Cycle (D0 + 1) Cycle (D0 + 1) Cycle (D0 + 1)

Figure 11-15 Basic timing in external trigger pulse output mode

16-bit timer/event counter P waits for a trigger when the TPnCE bit is set to 1.
When the trigger is generated, the 16-bit counter is cleared from FFFFH to
0000H, starts counting at the same time, and outputs a PWM waveform from
the TOPn1 pin.
If the trigger is generated again while the counter is operating, the counter is
cleared to 0000H and restarted.
The active level width, cycle, and duty factor of the PWM waveform can be
calculated as follows.
Active level width = (Set value of TPnCCR1 register) × Count clock cycle
Cycle = (Set value of TPnCCR0 register + 1) × Count clock cycle
Duty factor = (Set value of TPnCCR1 register)/(Set value of TPnCCR0 register + 1)
The compare match request signal INTTPnCC0 is generated when the 16-bit
counter counts next time after its count value matches the value of the CCR0
buffer register, and the 16-bit counter is cleared to 0000H. The compare match
interrupt request signal INTTPnCC1 is generated when the count value of the
16-bit counter matches the value of the CCR1 buffer register.

www.DataSheet4U.com The value set to the TPnCCRm register is transferred to the CCRm buffer
register when the count value of the 16-bit counter matches the value of the
CCRm buffer register and the 16-bit counter is cleared to 0000H.
The valid edge of an external trigger input signal, or setting the software trigger
(TPnCTL1.TPnEST bit) to 1 is used as the trigger.

User’s Manual U17566EE5V1UM00 431


Chapter 11 16-bit Timer/Event Counter P (TMP)

(1) Setting of registers in external trigger pulse output mode

(a) TMPn control register 0 (TPnCTL0)

TPnCE TPnCKS2 TPnCKS1 TPnCKS0


TPnCTL0 0/1 0 0 0 0 0/1 0/1 0/1

Select count clockNote


0: Stop counting
1: Enable counting

Note The setting is invalid when the TPnCTL1.TPnEEE bit = 1.

(b) TMPn control register 1 (TPnCTL1)

TPnEST TPnEEE TPnMD2 TPnMD1 TPnMD0


TPnCTL1 0 0/1 0/1 0 0 0 1 0

0, 1, 0:
External trigger pulse
output mode
0: Operate on count
clock selected by
TPnCKS0 to TPnCKS2 bits
1: Count with external
event input signal

Generate software trigger


when 1 is written

www.DataSheet4U.com

432 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(c) TMPn I/O control register 0 (TPnIOC0)

TPnOL1 TPnOE1 TPnOL0 TPnOE0


TPnIOC0 0 0 0 0 0/1 0/1 0/1 0/1

0: Disable TOPn0 pin output


1: Enable TOPn0 pin output
Settings of output level while
operation of TOPn0 pin is disabled
0: Low level
1: High level

0: Disable TOPn1 pin output


1: Enable TOPn1 pin output
Specifies active level of TOPn1
pin output
0: Active-high
1: Active-low
• When TPnOL1 bit = 0 • When TPnOL1 bit = 1

16-bit counter 16-bit counter

TOPn1 pin output TOPn1 pin output

(d) TMPn I/O control register 2 (TPnIOC2)

TPnEES1 TPnEES0 TPnETS1 TPnETS0


TPnIOC2 0 0 0 0 0/1 0/1 0/1 0/1

Select valid edge of


external trigger input
Select valid edge of
external event count input

(e) TMPn counter read buffer register (TPnCNT)


The value of the 16-bit counter can be read by reading the TPnCNT register.

(f) TMPn capture/compare registers 0 and 1 (TPnCCR0 and TPnCCR1)


If D0 is set to the TPnCCR0 register and D1 to the TPnCCR1 register, the cycle
and active level of the PWM waveform are as follows.
Cycle = (D0 + 1) × Count clock cycle
Active level width = D1 × Count clock cycle

www.DataSheet4U.com Note TMPn I/O control register 1 (TPnIOC1) and TMPn option register 0 (TPnOPT0)
are not used in the external trigger pulse output mode.

User’s Manual U17566EE5V1UM00 433


Chapter 11 16-bit Timer/Event Counter P (TMP)

(2) Operation flow in external trigger pulse output mode

FFFFH
D01 D01 D01
16-bit counter D00 D00 D11 D11 D00
D10 D10 D10 D10

0000H

TPnCE bit

External trigger input


(TIPn0 pin input)

TPnCCR0 register D00 D01 D00

CCR0 buffer register D00 D01 D00

INTTPnCC0 signal

TOPn0 pin output


(software trigger)

TPnCCR1 register D10 D10 D11 D10

CCR1 buffer register D10 D10 D11 D10

INTTPnCC1 signal

TOPn1 pin output

<1> <2> <3> <4> <5>

Figure 11-16 Software processing flow in external trigger pulse output mode (1/2)

www.DataSheet4U.com

434 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

<1> Count operation start flow <3> PnCCR0, TPnCCR1 register


setting change flow

Only writing of the TPnCCR1


START register must be performed when
the set duty factor is changed.
When the counter is cleared after
Setting of TPnCCR1 register setting, the value of the
TPnCCRm register is transferred
Register initial setting Initial setting of these to the CCRm buffer register.
TPnCTL0 registers is performed
(TPnCKS0 to TPnCKS2 bits) before setting the
TPnCTL1, TPnCE bit to 1.
TPnIOC0,
TPnIOC2,
TPnCCR0,
TPnCCR1
<4> PnCCR0, TPnCCR1 register
setting change flow
The TPnCKS0 to
TPnCKS2 bits can be
set at the same time
TPnCE bit = 1 when counting is When the counter is
enabled (TPnCE bit = 1). Setting of TPnCCR0 register cleared after setting,
Trigger wait status the value of the TPnCCRm
register is transferred to
the CCRm buffer register.

Setting of TPnCCR1 register

<2> TPnCCR0 and TPnCCR1 register


setting change flow <5> Count operation stop flow

TPnCCR1 register write TPnCE bit = 0 Counting is stopped.


Setting of TPnCCR0 register processing is necessary
only when the set
cycle is changed.

When the counter is STOP


Setting of TPnCCR1 register cleared after setting,
the value of the TPnCCRm
register is transferred to
the CCRm buffer register.

Figure 11-17 Software processing flow in external trigger pulse output mode (2/2)

(3) External trigger pulse output mode operation timing

(a) Note on changing pulse width during operation


To change the PWM waveform while the counter is operating, write the
TPnCCR1 register last.
Rewrite the TPnCCRm register after writing the TPnCCR1 register after the
INTTPnCC0 signal is detected.
www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 435


Chapter 11 16-bit Timer/Event Counter P (TMP)

FFFFH
D01 D01
16-bit counter D00 D00 D00 D11 D11
D10 D10 D10

0000H

TPnCE bit

External trigger input


(TIPn0 pin input)

TPnCCR0 register D00 D01

CCR0 buffer register D00 D01

INTTPnCC0 signal

TOPn0 pin output


(software trigger)

TPnCCR1 register D10 D11

CCR1 buffer register D10 D11

INTTPnCC1 signal

TOPn1 pin output

In order to transfer data from the TPnCCRm register to the CCRm buffer
register, the TPnCCR1 register must be written.
To change both the cycle and active level width of the PWM waveform at this
time, first set the cycle to the TPnCCR0 register and then set the active level
width to the TPnCCR1 register.
To change only the cycle of the PWM waveform, first set the cycle to the
TPnCCR0 register, and then write the same value to the TPnCCR1 register.
To change only the active level width (duty factor) of the PWM waveform, only
the TPnCCR1 register has to be set.
After data is written to the TPnCCR1 register, the value written to the
TPnCCRm register is transferred to the CCRm buffer register in
synchronization with clearing of the 16-bit counter, and is used as the value
compared with the 16-bit counter.
To write the TPnCCR0 or TPnCCR1 register again after writing the TPnCCR1
www.DataSheet4U.com
register once, do so after the INTTPnCC0 signal is generated. Otherwise, the
value of the CCRm buffer register may become undefined because the timing
of transferring data from the TPnCCRm register to the CCRm buffer register
conflicts with writing the TPnCCRm register.

436 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(b) 0%/100% output of PWM waveform


To output a 0% waveform, set the TPnCCR1 register to 0000H. If the set value
of the TPnCCR0 register is FFFFH, the INTTPnCC1 signal is generated
periodically.

Count clock

16-bit counter FFFF 0000 D0 − 1 D0 0000 0001 D0 − 1 D0 0000

TPnCE bit

TPnCCR0 register D0 D0 D0

TPnCCR1 register 0000H 0000H 0000H

INTTPnCC0 signal

INTTPnCC1 signal

TOPn1 pin output

To output a 100% waveform, set a value of (set value of TPnCCR0 register + 1)


to the TPnCCR1 register. If the set value of the TPnCCR0 register is FFFFH,
100% output cannot be produced.

Count clock

16-bit counter FFFF 0000 D0 − 1 D0 0000 0001 D0 − 1 D0 0000

TPnCE bit

TPnCCR0 register D0 D0 D0

TPnCCR1 register D0 + 1 D0 + 1 D0 + 1

INTTPnCC0 signal

INTTPnCC1 signal

TOPn1 pin output


www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 437


Chapter 11 16-bit Timer/Event Counter P (TMP)

(c) Conflict between trigger detection and match with TPnCCR1 register
If the trigger is detected immediately after the INTTPnCC1 signal is generated,
the 16-bit counter is immediately cleared to 0000H, the output signal of the
TOPn1 pin is asserted, and the counter continues counting. Consequently, the
inactive period of the PWM waveform is shortened.

16-bit counter FFFF 0000 D1 − 1 0000

External trigger input


(TIPn0 pin input)

TPnCCR1 register D1

INTTPnCC1 signal

TOPn1 pin output

Shortened

If the trigger is detected immediately before the INTTPnCC1 signal is


generated, the INTTPnCC1 signal is not generated, and the 16-bit counter is
cleared to 0000H and continues counting. The output signal of the TOPn1 pin
remains active. Consequently, the active period of the PWM waveform is
extended.

16-bit counter FFFF 0000 D1 − 2 0000 0001 D1 − 1 D1

External trigger input


(TIPn0 pin input)

TPnCCR1 register D1

INTTPnCC1 signal

TOPn1 pin output

Extended

www.DataSheet4U.com

438 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(d) Conflict between trigger detection and match with TPnCCR0 register
If the trigger is detected immediately after the INTTPnCC0 signal is generated,
the 16-bit counter is cleared to 0000H and continues counting up. Therefore,
the active period of the TOPn1 pin is extended by time from generation of the
INTTPnCC0 signal to trigger detection.

16-bit counter FFFF 0000 D0 − 1 D0 0000 0000

External trigger input


(TIPn0 pin input)

TPnCCR0 register D0

INTTPnCC0 signal

TOPn1 pin output

Extended

If the trigger is detected immediately before the INTTPnCC0 signal is


generated, the INTTPnCC0 signal is not generated. The 16-bit counter is
cleared to 0000H, the TOPn1 pin is asserted, and the counter continues
counting. Consequently, the inactive period of the PWM waveform is
shortened.

16-bit counter FFFF 0000 D0 − 1 D0 0000 0001

External trigger input


(TIPn0 pin input)

TPnCCR0 register D0

INTTPnCC0 signal

TOPn1 pin output

Shortened

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 439


Chapter 11 16-bit Timer/Event Counter P (TMP)

(e) Generation timing of compare match interrupt request signal


(INTTPnCC1)
The timing of generation of the INTTPnCC1 signal in the external trigger pulse
output mode differs from the timing of other INTTPnCC1 signals; the
INTTPnCC1 signal is generated when the count value of the 16-bit counter
matches the value of the TPnCCR1 register.

Count clock

16-bit counter D1 − 1 D1 − 1 D1 D1 + 1 D1 + 2

TPnCCR1 register D1

TOPn1 pin output

INTTPnCC1 signal

Usually, the INTTPnCC1 signal is generated in synchronization with the next


count up, after the count value of the 16-bit counter matches the value of the
TPnCCR1 register.
In the external trigger pulse output mode, however, it is generated one clock
earlier. This is because the timing is changed to match the timing of changing
the output signal of the TOPn1 pin.

www.DataSheet4U.com

440 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

11.5.4 One-shot pulse output mode (TPnMD2 to TPnMD0 = 011)

In the one-shot pulse output mode, 16-bit timer/event counter P waits for a
trigger when the TPnCTL0.TPnCE bit is set to 1. When the valid edge of an
external trigger input is detected, 16-bit timer/event counter P starts counting,
and outputs a one-shot pulse from the TOPn1 pin.
Instead of the external trigger, a software trigger can also be generated to
output the pulse. When the software trigger is used, the TOPn0 pin outputs the
active level while the 16-bit counter is counting, and the inactive level when the
counter is stopped (waiting for a trigger).

TPnCCR1 register
Edge Transfer
TIPn0 pin
detector
Output
S
CCR1 buffer register controller TOPn1 pin
R (RS-FF)
Software trigger
generation Match signal
INTTPnCC1 signal

Clear

Output
Count clock Count start S
16-bit counter controller TOPn0 pin
selection control R (RS-FF)

Match signal
INTTPnCC0 signal

TPnCE bit CCR0 buffer register

Transfer

TPnCCR0 register

Figure 11-18 Configuration in one-shot pulse output mode

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 441


Chapter 11 16-bit Timer/Event Counter P (TMP)

FFFFH
D0 D0 D0

16-bit counter
D1 D1 D1

0000H

TPnCE bit

External trigger input


(TIPn0 pin input)

TPnCCR0 register D0

INTTPnCC0 signal

TOPn0 pin output

TPnCCR1 register D1

INTTPnCC1 signal

TOPn1 pin output

Delay Active Delay Active Delay Active


(D1) level width (D0) level width (D1) level width
(D0 − D1 + 1) (D0 − D1 + 1) (D0 − D1 + 1)

Figure 11-19 Basic timing in one-shot pulse output mode

When the TPnCE bit is set to 1, 16-bit timer/event counter P waits for a trigger.
When the trigger is generated, the 16-bit counter is cleared from FFFFH to
0000H, starts counting, and outputs a one-shot pulse from the TOPn1 pin.
After the one-shot pulse is output, the 16-bit counter is set to FFFFH, stops
counting, and waits for a trigger. If a trigger is generated again while the one-
shot pulse is being output, it is ignored.
The output delay period and active level width of the one-shot pulse can be
calculated as follows.
Output delay period = (Set value of TPnCCR1 register) × Count clock cycle
Active level width =
(Set value of TPnCCR0 register – Set value of TPnCCR1 register + 1) × Count clock cycle

The compare match interrupt request signal INTTPnCC0 is generated when


the 16-bit counter counts after its count value matches the value of the CCR0
buffer register. The compare match interrupt request signal INTTPnCC1 is
generated when the count value of the 16-bit counter matches the value of the
CCR1 buffer register.
www.DataSheet4U.com The valid edge of an external trigger input or setting the software trigger
(TPnCTL1.TPnEST bit) to 1 is used as the trigger.

442 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(1) Setting of registers in one-shot pulse output mode

(a) TMPn control register 0 (TPnCTL0)

TPnCE TPnCKS2 TPnCKS1 TPnCKS0


TPnCTL0 0/1 0 0 0 0 0/1 0/1 0/1

Select count clockNote


0: Stop counting
1: Enable counting

Note The setting is invalid when the TPnCTL1.TPnEEE bit = 1.

(b) TMPn control register 1 (TPnCTL1)

TPnEST TPnEEE TPnMD2 TPnMD1 TPnMD0


TPnCTL1 0 0/1 0/1 0 0 0 1 1

0, 1, 1:
One-shot pulse output mode

0: Operate on count clock


selected by TPnCKS0 to
TPnCKS2 bits
1: Count external event
input signal

Generate software trigger


when 1 is written

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 443


Chapter 11 16-bit Timer/Event Counter P (TMP)

(c) TMPn I/O control register 0 (TPnIOC0)

TPnOL1 TPnOE1 TPnOL0 TPnOE0


TPnIOC0 0 0 0 0 0/1 0/1 0/1 0/1

0: Disable TOPn0 pin output


1: Enable TOPn0 pin output
Setting of output level while
operation of TOPn0 pin is disabled
0: Low level
1: High level

0: Disable TOPn1 pin output


1: Enable TOPn1 pin output
Specifies active level of
TOPn1 pin output
0: Active-high
1: Active-low

• When TPnOL1 bit = 0 • When TPnOL1 bit = 1

16-bit counter 16-bit counter

TOPn1 pin output TOPn1 pin output

(d) TMPn I/O control register 2 (TPnIOC2)

TPnEES1 TPnEES0 TPnETS1 TPnETS0


TPnIOC2 0 0 0 0 0/1 0/1 0/1 0/1

Select valid edge of


external trigger input
Select valid edge of
external event count input

(e) TMPn counter read buffer register (TPnCNT)


The value of the 16-bit counter can be read by reading the TPnCNT register.

(f) TMPn capture/compare registers 0 and 1 (TPnCCR0 and TPnCCR1)


If D0 is set to the TPnCCR0 register and D1 to the TPnCCR1 register, the active
level width and output delay period of the one-shot pulse are as follows.
www.DataSheet4U.com Active level width = (D1 - D0 + 1) × Count clock cycle
Output delay period = D1 × Count clock cycle

Note TMPn I/O control register 1 (TPnIOC1) and TMPn option register 0 (TPnOPT0)
are not used in the one-shot pulse output mode.

444 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(2) Operation flow in one-shot pulse output mode

FFFFH
D0 D0

16-bit counter
D1 D1

0000H

TPnCE bit

External trigger input


(TIPn0 pin input)

TPnCCR0 register D0

INTTPnCC0 signal

TPnCCR1 register D1

INTTPnCC1 signal

TOPn1 pin output

<1> <2>

<1> Count operation start flow

START

Register initial setting Initial setting of these registers is


TPnCTL0 performed before setting the TPnCE bit to 1.
(TPnCKS0 to TPnCKS2 bits)
TPnCTL1,
TPnIOC0,
TPnIOC2,
TPnCCR0,
TPnCCR1

The TPnCKS0 to TPnCKS2 bits


TPnCE bit = 1
can be set at the same time when
counting has been started (TPnCE bit = 1).
Trigger wait status

<2> Count operation stop flow

TPnCE bit = 0 Count operation is stopped

STOP
www.DataSheet4U.com

Figure 11-20 Software processing flow in one-shot pulse output mode

User’s Manual U17566EE5V1UM00 445


Chapter 11 16-bit Timer/Event Counter P (TMP)

(3) Operation timing in one-shot pulse output mode

(a) Note on rewriting TPnCCRm register


To change the set value of the TPnCCRm register to a smaller value, stop
counting once, and then change the set value.
If the value of the TPnCCRm register is rewritten to a smaller value during
counting, the 16-bit counter may overflow.

FFFFH
D00 D00 D00

16-bit counter D10 D10 D10 D01


D11
0000H

TPnCE bit

External trigger input


(TIPn0 pin input)

TPnCCR0 register D00 D01

INTTPnCC0 signal

TOPn0 pin output

TPnCCR1 register D10 D11

INTTPnCC1 signal

TOPn1 pin output

Delay Delay Delay


(D10) (D10) (10000H + D11)

Active level width Active level width Active level width


(D00 − D10 + 1) (D00 − D10 + 1) (D01 − D11 + 1)

When the TPnCCR0 register is rewritten from D00 to D01 and the TPnCCR1
register from D10 to D11 where D00 > D01 and D10 > D11, if the TPnCCR1 register
is rewritten when the count value of the 16-bit counter is greater than D11 and
less than D10 and if the TPnCCR0 register is rewritten when the count value is
greater than D01 and less than D00, each set value is reflected as soon as the
register has been rewritten and compared with the count value. The counter
counts up to FFFFH and then counts up again from 0000H. When the count
value matches D11, the counter generates the INTTPnCC1 signal and asserts
the TOPn1 pin. When the count value matches D01, the counter generates the
INTTPnCC0 signal, deasserts the TOPn1 pin, and stops counting.
www.DataSheet4U.com Therefore, the counter may output a pulse with a delay period or active period
different from that of the one-shot pulse that is originally expected.

446 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(b) Generation timing of compare match interrupt request signal


(INTTPnCC1)
The generation timing of the INTTPnCC1 signal in the one-shot pulse output
mode is different from other INTTPnCC1 signals; the INTTPnCC1 signal is
generated when the count value of the 16-bit counter matches the value of the
TPnCCR1 register.

Count clock

16-bit counter D1 − 2 D1 − 1 D1 D1 + 1 D1 + 2

TPnCCR1 register D1

TOPn1 pin output

INTTPnCC1 signal

Usually, the INTTPnCC1 signal is generated when the 16-bit counter counts up
next time after its count value matches the value of the TPnCCR1 register.
In the one-shot pulse output mode, however, it is generated one clock earlier.
This is because the timing is changed to match the change timing of the
TOPn1 pin.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 447


Chapter 11 16-bit Timer/Event Counter P (TMP)

11.5.5 PWM output mode (TPnMD2 to TPnMD0 = 100)

In the PWM output mode, a PWM waveform is output from the TOPn1 pin
when the TPnCTL0.TPnCE bit is set to 1.
In addition, a pulse with one cycle of the PWM waveform as half its cycle is
output from the TOPn0 pin.

TPnCCR1 register
Transfer
Output
S
CCR1 buffer register controller TOPn1 pin
R (RS-FF)

Match signal
INTTPnCC1 signal
Clear

Count Count
clock Output
start 16-bit counter TOPn0 pin
selection controller
control
Match signal
INTTPnCC0 signal

TPnCE bit CCR0 buffer register

Transfer

TPnCCR0 register

Figure 11-21 Configuration in PWM output mode

www.DataSheet4U.com

448 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

FFFFH
D01 D01
16-bit counter D00 D00 D00 D11 D11
D10 D10 D10

0000H

TPnCE bit

TPnCCR0 register D00 D01

CCR0 buffer register D00 D01

NTTPnCC0 signal

TOPn0 pin output

TPnCCR1 register D10 D11

CCR1 buffer register D10 D11

INTTPnCC1 signal

TOPn1 pin output

Active period Cycle Inactive period


(D10) (D00 + 1) (D00 − D10 + 1)

Figure 11-22 Basic timing in PWM output mode

When the TPnCE bit is set to 1, the 16-bit counter is cleared from FFFFH to
0000H, starts counting, and outputs a PWM waveform from the TOPn1 pin.
The active level width, cycle, and duty factor of the PWM waveform can be
calculated as follows.
Active level width = (Set value of TPnCCR1 register) × Count clock cycle
Cycle = (Set value of TPnCCR0 register + 1) × Count clock cycle
Duty factor = (Set value of TPnCCR1 register)/(Set value of TPnCCR0 register + 1)
The PWM waveform can be changed by rewriting the TPnCCRm register while
the counter is operating. The newly written value is reflected when the count
value of the 16-bit counter matches the value of the CCR0 buffer register and
the 16-bit counter is cleared to 0000H.
The compare match interrupt request signal INTTPnCC0 is generated when
the 16-bit counter counts next time after its count value matches the value of
the CCR0 buffer register, and the 16-bit counter is cleared to 0000H. The
compare match interrupt request signal INTTPnCC1 is generated when the
count value of the 16-bit counter matches the value of the CCR1 buffer
www.DataSheet4U.com
register.
The value set to the TPnCCRm register is transferred to the CCRm buffer
register when the count value of the 16-bit counter matches the value of the
CCRm buffer register and the 16-bit counter is cleared to 0000H.

User’s Manual U17566EE5V1UM00 449


Chapter 11 16-bit Timer/Event Counter P (TMP)

(1) Setting of registers in PWM output mode

(a) TMPn control register 0 (TPnCTL0)

TPnCE TPnCKS2 TPnCKS1 TPnCKS0


TPnCTL0 0/1 0 0 0 0 0/1 0/1 0/1

Select count clockNote


0: Stop counting
1: Enable counting

Note The setting is invalid when the TPnCTL1.TPnEEE bit = 1.

(b) TMPn control register 1 (TPnCTL1)

TPnEST TPnEEE TPnMD2 TPnMD1 TPnMD0


TPnCTL1 0 0 0 0 0 1 0 0

1, 0, 0:
PWM output mode

(c) TMPn I/O control register 0 (TPnIOC0)

TPnOL1 TPnOE1 TPnOL0 TPnOE0


TPnIOC0 0 0 0 0 0/1 0/1 0/1 0/1

0: Disable TOPn0 pin output


1: Enable TOPn0 pin output
Setting of output level while
operation of TOPn0 pin is disabled
0: Low level
1: High level

0: Disable TOPn1 pin output


1: Enable TOPn1 pin output
Specifies active level of TOPn1
pin output
0: Active-high
1: Active-low

• When TPnOL1 bit = 0 • When TPnOL1 bit = 1


www.DataSheet4U.com
16-bit counter 16-bit counter

TOPn1 pin output TOPn1 pin output

450 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(d) TMPn I/O control register 2 (TPnIOC2)

TPnEES1 TPnEES0 TPnETS1 TPnETS0


TPnIOC2 0 0 0 0 0/1 0/1 0 0

Select valid edge


of external event
count input.

(e) TMPn counter read buffer register (TPnCNT)


The value of the 16-bit counter can be read by reading the TPnCNT register.

(f) TMPn capture/compare registers 0 and 1 (TPnCCR0 and TPnCCR1)


If D0 is set to the TPnCCR0 register and D1 to the TPnCCR1 register, the cycle
and active level of the PWM waveform are as follows.
Cycle = (D0 + 1) × Count clock cycle
Active level width = D1 × Count clock cycle

Note TMPn I/O control register 1 (TPnIOC1) and TMPn option register 0 (TPnOPT0)
are not used in the PWM output mode.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 451


Chapter 11 16-bit Timer/Event Counter P (TMP)

(2) Operation flow in PWM output mode

FFFFH
D01 D01 D01
16-bit counter D00 D00 D11 D11 D00
D10 D10 D10 D10
0000H

TPnCE bit

TPnCCR0 register D00 D01 D00

CCR0 buffer register D00 D01 D00

INTTPnCC0 signal

TOPn0 pin output

TPnCCR1 register D10 D10 D11 D10

CCR1 buffer register D10 D10 D11 D10

INTTPnCC1 signal

TOPn1 pin output

<1> <2> <3> <4> <5>

Figure 11-23 Software processing flow in PWM output mode (1/2)

www.DataSheet4U.com

452 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

<1> Count operation start flow <3> TPnCCR0, TPnCCR1 register


setting change flow

Only writing of the TPnCCR1


START register must be performed
when the set duty factor is
changed. When the counter is
Setting of TPnCCR1 register cleared after setting, the
value of compare register m
Register initial setting Initial setting of these is transferred to the CCRm
TPnCTL0 registers is performed buffer register.
(TPnCKS0 to TPnCKS2 bits) before setting the
TPnCTL1, TPnCE bit to 1.
TPnIOC0,
TPnIOC2,
TPnCCR0,
TPnCCR1
<4> TPnCCR0, TPnCCR1 register
setting change flow
The TPnCKS0 to
TPnCKS2 bits can be
set at the same time
TPnCE bit = 1 when counting is When the counter is
enabled (TPnCE bit = 1). Setting of TPnCCR0 register cleared after setting,
the value of the TPnCCRm
register is transferred to the
CCRm buffer register.

Setting of TPnCCR1 register

<2> TPnCCR0, TPnCCR1 register


setting change flow <5> Count operation stop flow

TPnCCR1 write TPnCE bit = 0 Counting is stopped.


Setting of TPnCCR0 register processing is necessary
only when the set cycle
is changed.

When the counter is STOP


Setting of TPnCCR1 register cleared after setting,
the value of the TPnCCRm
register is transferred to the
CCRm buffer register.

Figure 11-24 Software processing flow in PWM output mode (1/2)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 453


Chapter 11 16-bit Timer/Event Counter P (TMP)

(3) PWM output mode operation timing

(a) Changing pulse width during operation


To change the PWM waveform while the counter is operating, write the
TPnCCR1 register last.
Rewrite the TPnCCRm register after writing the TPnCCR1 register after the
INTTPnCC1 signal is detected.

FFFFH
D01 D01
16-bit counter D00 D00 D00 D11 D11
D10 D10 D10

0000H

TPnCE bit

TPnCCR0 register D00 D01

CCR0 buffer register D00 D01

TPnCCR1 register D10 D11

CCR1 buffer register D10 D11

TOPn1 pin output

INTTPnCC0 signal

To transfer data from the TPnCCRm register to the CCRm buffer register, the
TPnCCR1 register must be written.
To change both the cycle and active level of the PWM waveform at this time,
first set the cycle to the TPnCCR0 register and then set the active level to the
TPnCCR1 register.
To change only the cycle of the PWM waveform, first set the cycle to the
TPnCCR0 register, and then write the same value to the TPnCCR1 register.
To change only the active level width (duty factor) of the PWM waveform, only
the TPnCCR1 register has to be set.
After data is written to the TPnCCR1 register, the value written to the
TPnCCRm register is transferred to the CCRm buffer register in
synchronization with clearing of the 16-bit counter, and is used as the value
compared with the 16-bit counter.
www.DataSheet4U.com
To write the TPnCCR0 or TPnCCR1 register again after writing the TPnCCR1
register once, do so after the INTTPnCC0 signal is generated. Otherwise, the
value of the CCRm buffer register may become undefined because the timing
of transferring data from the TPnCCRm register to the CCRm buffer register
conflicts with writing the TPnCCRm register.

454 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(b) 0%/100% output of PWM waveform


To output a 0% waveform, set the TPnCCR1 register to 0000H. If the set value
of the TPnCCR0 register is FFFFH, the INTTPnCC1 signal is generated
periodically.

Count clock

16-bit counter FFFF 0000 D00 − 1 D00 0000 0001 D00 − 1 D00 0000

TPnCE bit

TPnCCR0 register D00 D00 D00

TPnCCR1 register 0000H 0000H 0000H

INTTPnCC0 signal

INTTPnCC1 signal

TOPn1 pin output

To output a 100% waveform, set a value of (set value of TPnCCR0 register + 1)


to the TPnCCR1 register. If the set value of the TPnCCR0 register is FFFFH,
100% output cannot be produced.

Count clock

16-bit counter FFFF 0000 D00 − 1 D00 0000 0001 D00 − 1 D00 0000

TPnCE bit

TPnCCR0 register D00 D00 D00

TPnCCR1 register D00 + 1 D00 + 1 D00 + 1

INTTPnCC0 signal

www.DataSheet4U.com
INTTPnCC1 signal

TOPn1 pin output

User’s Manual U17566EE5V1UM00 455


Chapter 11 16-bit Timer/Event Counter P (TMP)

(c) Generation timing of compare match interrupt request signal


(INTTPnCC1)
The timing of generation of the INTTPnCC1 signal in the PWM output mode
differs from the timing of other INTTPnCC1 signals; the INTTPnCC1 signal is
generated when the count value of the 16-bit counter matches the value of the
TPnCCR1 register.

Count clock

16-bit counter D1 − 2 D1 − 1 D1 D1 + 1 D1 + 2

TPnCCR1 register D1

TOPn1 pin output

INTTPnCC1 signal

Usually, the INTTPnCC1 signal is generated in synchronization with the next


counting up after the count value of the 16-bit counter matches the value of the
TPnCCR1 register.
In the PWM output mode, however, it is generated one clock earlier. This is
because the timing is changed to match the change timing of the output signal
of the TOPn1 pin.

www.DataSheet4U.com

456 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

11.5.6 Free-running timer mode (TPnMD2 to TPnMD0 = 101)

In the free-running timer mode, 16-bit timer/event counter P starts counting


when the TPnCTL0.TPnCE bit is set to 1. At this time, the TPnCCRm register
can be used as a compare register or a capture register, depending on the
setting of the TPnOPT0.TPnCCS0 and TPnOPT0.TPnCCS1 bits.

Output
TPnCCR1 register TOPn1 pin output
controller
(compare)

Output
TOPn0 pin output
controller
TPnCCR0 register
(capture)
TPnCCS0, TPnCCS1 bits
(capture/compare selection)

Internal count clock Count


clock
16-bit counter INTTPnOV signal
Edge selection
TIPn0 pin
(external event detector
count input/ 0
TPnCE bit INTTPnCC1 signal
capture
1
trigger input) Edge
detector
0
TPnCCR0 register INTTPnCC0 signal
(capture) 1

TIPn1 pin Edge


(capture detector
trigger input) TPnCCR1 register
(compare)

Figure 11-25 Configuration in free-running timer mode

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 457


Chapter 11 16-bit Timer/Event Counter P (TMP)

When the TPnCE bit is set to 1, 16-bit timer/event counter P starts counting,
and the output signals of the TOPn0 and TOPn1 pins are inverted. When the
count value of the 16-bit counter later matches the set value of the TPnCCRm
register, a compare match interrupt request signal (INTTPnCCm) is generated,
and the output signal of the TOPnm pin is inverted.
The 16-bit counter continues counting in synchronization with the count clock.
When it counts up to FFFFH, it generates an overflow interrupt request signal
(INTTPnOV) at the next clock, is cleared to 0000H, and continues counting. At
this time, the overflow flag (TPnOPT0.TPnOVF bit) is also set to 1. Clear the
overflow flag to 0 by executing the CLR instruction by software.
The TPnCCRm register can be rewritten while the counter is operating. If it is
rewritten, the new value is reflected at that time, and compared with the count
value.

FFFFH
D00 D00
D01 D01
16-bit counter
D10 D10
D11 D11 D11
0000H

TPnCE bit

TPnCCR0 register D00 D01

INTTPnCC0 signal

TOPn0 pin output

TPnCCR1 register D10 D11

INTTPnCC1 signal

TOPn1 pin output

INTTPnOV signal

TPnOVF bit

Cleared to 0 by Cleared to 0 by Cleared to 0 by Cleared to 0 by


CLR instruction CLR instruction CLR instruction CLR instruction

Figure 11-26 Basic timing in free-running timer mode (compare function)

www.DataSheet4U.com

458 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

When the TPnCE bit is set to 1, the 16-bit counter starts counting. When the
valid edge input to the TIPnm pin is detected, the count value of the 16-bit
counter is stored in the TPnCCRm register, and a capture interrupt request
signal (INTTPnCCm) is generated.
The 16-bit counter continues counting in synchronization with the count clock.
When it counts up to FFFFH, it generates an overflow interrupt request signal
(INTTPnOV) at the next clock, is cleared to 0000H, and continues counting. At
this time, the overflow flag (TPnOPT0.TPnOVF bit) is also set to 1. Clear the
overflow flag to 0 by executing the CLR instruction by software.

FFFFH
D10 D11
D00 D12 D13
16-bit counter D01
D02
D03
0000H

TPnCE bit

TIPn0 pin input

TPnCCR0 register D00 D01 D02 D03

INTTPnCC0 signal

TIPn1 pin input

TPnCCR1 register D10 D11 D12 D13

INTTPnCC1 signal

INTTPnOV signal

TPnOVF bit

Cleared to 0 by Cleared to 0 by Cleared to 0 by


CLR instruction CLR instruction CLR instruction

Figure 11-27 Basic timing in free-running timer mode (capture function)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 459


Chapter 11 16-bit Timer/Event Counter P (TMP)

(1) Register setting in free-running timer mode

(a) TMPn control register 0 (TPnCTL0)

TPnCE TPnCKS2 TPnCKS1 TPnCKS0


TPnCTL0 0/1 0 0 0 0 0/1 0/1 0/1

Select count clockNote


0: Stop counting
1: Enable counting

Note The setting is invalid when the TPnCTL1.TPnEEE bit = 1

(b) TMPn control register 1 (TPnCTL1)

TPnEST TPnEEE TPnMD2 TPnMD1 TPnMD0


TPnCTL1 0 0 0/1 0 0 1 0 1

1, 0, 1:
Free-running mode

0: Operate with count


clock selected by
TPnCKS0 to TPnCKS2 bits
1: Count on external
event count input signal

(c) TMPn I/O control register 0 (TPnIOC0)

TPnOL1 TPnOE1 TPnOL0 TPnOE0


TPnIOC0 0 0 0 0 0/1 0/1 0/1 0/1

0: Disable TOPn0 pin output


1: Enable TOPn0 pin output
Setting of output level with
operation of TOPn0 pin disabled
0: Low level
1: High level
0: Disable TOPn1 pin output
1: Enable TOPn1 pin output
Setting of output level with
operation of TOPn1 pin disabled
www.DataSheet4U.com 0: Low level
1: High level

460 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(d) TMPn I/O control register 1 (TPnIOC1)

TPnIS3 TPnIS2 TPnIS1 TPnIS0


TPnIOC1 0 0 0 0 0/1 0/1 0/1 0/1

Select valid edge


of TIPn0 pin input
Select valid edge
of TIPn1 pin input

(e) TMPn I/O control register 2 (TPnIOC2)

TPnEES1 TPnEES0 TPnETS1 TPnETS0


TPnIOC2 0 0 0 0 0/1 0/1 0 0

Select valid edge of


external event count input

(f) TMPn option register 0 (TPnOPT0)

TPnCCS1 TPnCCS0 TPnOVF


TPnOPT0 0 0 0/1 0/1 0 0 0 0/1

Overflow flag
Specifies if TPnCCR0
register functions as
capture or compare register

Specifies if TPnCCR1
register functions as
capture or compare register

(g) TMPn counter read buffer register (TPnCNT)


The value of the 16-bit counter can be read by reading the TPnCNT register.

(h) TMPn capture/compare registers 0 and 1 (TPnCCR0 and TPnCCR1)


These registers function as capture registers or compare registers depending
on the setting of the TPnOPT0.TPnCCSm bit.
When the registers function as capture registers, they store the count value of
the 16-bit counter when the valid edge input to the TIPnm pin is detected.
www.DataSheet4U.com When the registers function as compare registers and when Dm is set to the
TPnCCRm register, the INTTPnCCm signal is generated when the counter
reaches (Dm + 1), and the output signal of the TOPnm pin is inverted.

User’s Manual U17566EE5V1UM00 461


Chapter 11 16-bit Timer/Event Counter P (TMP)

(2) Operation flow in free-running timer mode

(a) When using capture/compare register as compare register

FFFFH
D00 D00
D01 D01
16-bit counter
D10 D10
D11 D11 D11
0000H

TPnCE bit

TPnCCR0 register D00 D01

INTTPnCC0 signal

TOPn0 pin output

TPnCCR1 register D10 D11

INTTPnCC1 signal

TOPn1 pin output

INTTPnOV signal

TPnOVF bit

<1> Cleared to 0 by Cleared to 0 by Cleared to 0 by <3>


CLR instruction CLR instruction CLR instruction

<2> <2> <2>

Figure 11-28 Software processing flow in free-running timer mode (compare function)
(1/2)

www.DataSheet4U.com

462 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

<1> Count operation start flow

START

Register initial setting Initial setting of these registers


TPnCTL0 is performed before setting the
(TPnCKS0 to TPnCKS2 bits) TPnCE bit to 1.
TPnCTL1,
TPnIOC0,
TPnIOC2,
TPnOPT0,
TPnCCR0,
TPnCCR1

The TPnCKS0 to TPnCKS2 bits


TPnCE bit = 1 can be set at the same time
when counting has been started
(TPnCE bit = 1).

<2> Overflow flag clear flow

Read TPnOPT0 register


(check overflow flag).

NO
TPnOVF bit = 1

YES

Execute instruction to clear


TPnOVF bit (CLR TPnOVF).

<3> Count operation stop flow

Counter is initialized and


TPnCE bit = 0 counting is stopped by
clearing TPnCE bit to 0.

STOP

www.DataSheet4U.com

Figure 11-29 Software processing flow in free-running timer mode (compare function)
(2/2)

User’s Manual U17566EE5V1UM00 463


Chapter 11 16-bit Timer/Event Counter P (TMP)

(b) When using capture/compare register as capture register

FFFFH
D10 D11
D00 D12
16-bit counter D01
D02
D03
0000H

TPnCE bit

TIPn0 pin input

TPnCCR0 register 0000 D00 D01 D02 D03 0000

INTTPnCC0 signal

TIPn1 pin input

TPnCCR1 register 0000 D10 D11 D12 0000

INTTPnCC1 signal

INTTPnOV signal

TPnOVF bit

Cleared to 0 by Cleared to 0 by
<1> CLR instruction CLR instruction <3>

<2> <2>

Figure 11-30 Software processing flow in free-running timer mode (capture function)
(1/2)

www.DataSheet4U.com

464 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

<1> Count operation start flow

START

Register initial setting Initial setting of these registers


TPnCTL0 is performed before setting the
(TPnCKS0 to TPnCKS2 bits) TPnCE bit to 1.
TPnCTL1,
TPnIOC1,
TPnOPT0

The TPnCKS0 to TPnCKS2 bits can


TPnCE bit = 1 be set at the same time when counting
has been started (TPnCE bit = 1).

<2> Overflow flag clear flow

Read TPnOPT0 register


(check overflow flag).

NO
TPnOVF bit = 1

YES

Execute instruction to clear


TPnOVF bit (CLR TPnOVF).

<3> Count operation stop flow

Counter is initialized and


TPnCE bit = 0 counting is stopped by
clearing TPnCE bit to 0.

STOP

www.DataSheet4U.com

Figure 11-31 Software processing flow in free-running timer mode (capture function)
(2/2)

User’s Manual U17566EE5V1UM00 465


Chapter 11 16-bit Timer/Event Counter P (TMP)

(3) Operation timing in free-running timer mode

(a) Interval operation with compare register


When 16-bit timer/event counter P is used as an interval timer with the
TPnCCRm register used as a compare register, software processing is
necessary for setting a comparison value to generate the next interrupt request
signal each time the INTTPnCCm signal has been detected.

FFFFH
D02
D10
D00
16-bit counter D11 D03
D01 D12
D04
D13
0000H

TPnCE bit

TPnCCR0 register D00 D01 D02 D03 D04 D05

INTTPnCC0 signal

TOPn pin output

Interval period Interval period Interval period Interval period Interval period
(D00 + 1) (10000H + (D02 − D01) (10000H + (10000H +
D01 − D00) D03 − D02) D04 − D03)

TPnCCR1 register D10 D11 D12 D13 D14

INTTPnCC1 signal

TOPn1 pin output

Interval period Interval period Interval period Interval period


(D10 + 1) (10000H + (10000H + (10000H +
D11 − D10) D12 − D11) D13 − D12)

When performing an interval operation in the free-running timer mode, two


intervals can be set with one channel.
To perform the interval operation, the value of the corresponding TPnCCRm
register must be re-set in the interrupt servicing that is executed when the
INTTPnCCm signal is detected.
The set value for re-setting the TPnCCRm register can be calculated by the
following expression, where “Dm” is the interval period.
Compare register default value: Dm – 1
Value set to compare register second and subsequent time:
www.DataSheet4U.com Previous set value + Dm
(If the calculation result is greater than FFFFH, subtract 10000H from the
result and set this value to the register.)

466 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(b) Pulse width measurement with capture register


When pulse width measurement is performed with the TPnCCRm register
used as a capture register, software processing is necessary for reading the
capture register each time the INTTPnCCm signal has been detected and for
calculating an interval.

FFFFH
D02
D10
D00
16-bit counter D11 D03
D01 D12
D04
D13
0000H

TPnCE bit

TIPn0 pin input

TPnCCR0 register 0000H D00 D01 D02 D03 D04

INTTPnCC0 signal

Pulse interval Pulse interval Pulse interval Pulse interval Pulse interval
(D00) (10000H + (D02 − D01) (10000H + (10000H +
D01 − D00) D03 − D02) D04 − D03)

TIPn1 pin input

TPnCCR1 register 0000H D10 D11 D12 D13

INTTPnCC1 signal

Pulse interval Pulse interval Pulse interval Pulse interval


(D10) (10000H + (10000H + (10000H +
D11 − D10) D12 − D11) D13 − D12)

INTTPnOV signal

TPnOVF bit

Cleared to 0 by Cleared to 0 by Cleared to 0 by


CLR instruction CLR instruction CLR instruction

When executing pulse width measurement in the free-running timer mode, two
pulse widths can be measured with one channel.
To measure a pulse width, the pulse width can be calculated by reading the
value of the TPnCCRm register in synchronization with the INTTPnCCm
www.DataSheet4U.com signal, and calculating the difference between the read value and the
previously read value.

User’s Manual U17566EE5V1UM00 467


Chapter 11 16-bit Timer/Event Counter P (TMP)

(c) Processing of overflow when two capture registers are used


Care must be exercised in processing the overflow flag when two capture
registers are used. First, an example of incorrect processing is shown below.

FFFFH
D11
D10
16-bit counter
D00 D01

0000H

TPnCE bit

TIPn0 pin input

TPnCCR0 register D00 D01

TIPn1 pin input

TPnCCR1 register D10 D11

INTTPnOV signal

TPnOVF bit

<1> <2> <3> <4>

Figure 11-32 Example of incorrect processing when two capture registers are used

The following problem may occur when two pulse widths are measured in the
free-running timer mode.
<1> Read the TPnCCR0 register (setting of the default value of the TIPn0
pin input).
<2> Read the TPnCCR1 register (setting of the default value of the TIPn1
pin input).
<3> Read the TPnCCR0 register.
Read the overflow flag. If the overflow flag is 1, clear it to 0.
Because the overflow flag is 1, the pulse width can be calculated by
(10000H + D01 - D00).
<4> Read the TPnCCR1 register.
Read the overflow flag. Because the flag is cleared in <3>, 0 is read.
Because the overflow flag is 0, the pulse width can be calculated by
(D11 - D10) (incorrect).
www.DataSheet4U.com

When two capture registers are used, and if the overflow flag is cleared to 0 by
one capture register, the other capture register may not obtain the correct
pulse width.
Use software when using two capture registers. An example of how to use
software is shown below.

468 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

FFFFH
D11
D10
16-bit counter
D00 D01

0000H

TPnCE bit

INTTPnOV signal

TPnOVF bit

TPnOVF0 flagNote

TIPn0 pin input

TPnCCR0 register D00 D01

TPnOVF1 flagNote

TIPn1 pin input

TPnCCR1 register D10 D11

<1> <2> <3> <4> <5> <6>

Figure 11-33 Example when two capture registers are used (using overflow interrupt)

Note The TPnOVF0 and TPnOVF1 flags are set on the internal RAM by software.
<1> Read the TPnCCR0 register (setting of the default value of the TIPn0
pin input).
<2> Read the TPnCCR1 register (setting of the default value of the TIPn1
pin input).
<3> An overflow occurs. Set the TPnOVF0 and TPnOVF1 flags to 1 in the
overflow interrupt servicing, and clear the overflow flag to 0.
<4> Read the TPnCCR0 register.
Read the TPnOVF0 flag. If the TPnOVF0 flag is 1, clear it to 0.
Because the TPnOVF0 flag is 1, the pulse width can be calculated by
(10000H + D01 - D00).
<5> Read the TPnCCR1 register.
Read the TPnOVF1 flag. If the TPnOVF1 flag is 1, clear it to 0 (the
TPnOVF0 flag is cleared in <4>, and the TPnOVF1 flag remains 1).
www.DataSheet4U.com Because the TPnOVF1 flag is 1, the pulse width can be calculated by
(10000H + D11 - D10) (correct).
<6> Same as <3>

User’s Manual U17566EE5V1UM00 469


Chapter 11 16-bit Timer/Event Counter P (TMP)

FFFFH
D11
D10
16-bit counter
D00 D01

0000H

TPnCE bit

INTTPnOV signal

TPnOVF bit

TPnOVF0 flagNote

TIPn0 pin input

TPnCCR0 register D00 D01

TPnOVF1 flagNote

TIPn1 pin input

TPnCCR1 register D10 D11

<1> <2> <3> <4> <5> <6>

Figure 11-34 Example when two capture registers are used (without using overflow
interrupt)

Note The TPnOVF0 and TPnOVF1 flags are set on the internal RAM by software.
<1> Read the TPnCCR0 register (setting of the default value of the TIPn0
pin input).
<2> Read the TPnCCR1 register (setting of the default value of the TIPn1
pin input).
<3> An overflow occurs. Nothing is done by software.
<4> Read the TPnCCR0 register.
Read the overflow flag. If the overflow flag is 1, set only the TPnOVF1
flag to 1, and clear the overflow flag to 0.
Because the overflow flag is 1, the pulse width can be calculated by
(10000H + D01 - D00).
<5> Read the TPnCCR1 register.
Read the overflow flag. Because the overflow flag is cleared in <4>, 0
www.DataSheet4U.com is read.
Read the TPnOVF1 flag. If the TPnOVF1 flag is 1, clear it to 0.
Because the TPnOVF1 flag is 1, the pulse width can be calculated by
(10000H + D11 - D10) (correct).
<6> Same as <3>

470 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(d) Processing of overflow if capture trigger interval is long


If the pulse width is greater than one cycle of the 16-bit counter, care must be
exercised because an overflow may occur more than once from the first
capture trigger to the next. First, an example of incorrect processing is shown
below.

FFFFH
Dm0

16-bit counter

Dm1
0000H

TPnCE bit

TIPnm pin input

TPnCCRm register Dm0 Dm1

INTTPnOV signal

TPnOVF bit

1 cycle of 16-bit counter

Pulse width

<1> <2> <3> <4>

Figure 11-35 Example of incorrect processing when capture trigger interval is long

The following problem may occur when long pulse width is measured in the
free-running timer mode.

<1> Read the TPnCCRm register (setting of the default value of the
TIPnm pin input).
<2> An overflow occurs. Nothing is done by software.
<3> An overflow occurs a second time. Nothing is done by software.
<4> Read the TPnCCRm register.
Read the overflow flag. If the overflow flag is 1, clear it to 0.
Because the overflow flag is 1, the pulse width can be calculated by
(10000H + Dm1 - Dm0) (incorrect).
Actually, the pulse width must be (20000H + Dm1 - Dm0) because an
overflow occurs twice.

www.DataSheet4U.com If an overflow occurs twice or more when the capture trigger interval is long,
the correct pulse width may not be obtained.
If the capture trigger interval is long, slow the count clock to lengthen one cycle
of the 16-bit counter, or use software. An example of how to use software is
shown next.

User’s Manual U17566EE5V1UM00 471


Chapter 11 16-bit Timer/Event Counter P (TMP)

FFFFH
Dm0

16-bit counter

Dm1
0000H

TPnCE bit

TIPnm pin input

TPnCCRm register Dm0 Dm1

INTTPnOV signal

TPnOVF bit

Overflow 0H 1H 2H 0H
counterNote

1 cycle of 16-bit counter

Pulse width

<1> <2> <3> <4>

Figure 11-36 Example when capture trigger interval is long

Note The overflow counter is set arbitrarily by software on the internal RAM.

<1> Read the TPnCCRm register (setting of the default value of the
TIPnm pin input).
<2> An overflow occurs. Increment the overflow counter and clear the
overflow flag to 0 in the overflow interrupt servicing.
<3> An overflow occurs a second time. Increment (+1) the overflow
counter and clear the overflow flag to 0 in the overflow interrupt
servicing.
<4> Read the TPnCCRm register.
Read the overflow counter.
When the overflow counter is “N”, the pulse width can be calculated
by (N × 10000H + Dm1 – Dm0).
In this example, the pulse width is (20000H + Dm1 – Dm0) because an
overflow occurs twice.
Clear the overflow counter (0H).

www.DataSheet4U.com

472 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(e) Clearing overflow flag


The overflow flag can be cleared to 0 by clearing the TPnOVF bit to 0 with the
CLR instruction and by writing 8-bit data (bit 0 is 0) to the TPnOPT0 register.
To accurately detect an overflow, read the TPnOVF bit when it is 1, and then
clear the overflow flag by using a bit manipulation instruction.

(i) Operation to write 0 (without conflict with setting) (iii) Operation to clear to 0 (without conflict with setting)

Overflow Overflow
set signal L set signal L

0 write signal 0 write signal

Overflow flag Register


access signal Read Write
(TPnOVF bit)

Overflow flag
(TPnOVF bit)

(ii) Operation to write 0 (conflict with setting) (iv) Operation to clear to 0 (conflict with setting)

Overflow Overflow
set signal set signal

0 write signal 0 write signal

Overflow flag Register


access signal Read Write
(TPnOVF bit)

Overflow flag H
(TPnOVF bit)

To clear the overflow flag to 0, read the overflow flag to check if it is set to 1,
and clear it with the CLR instruction. If 0 is written to the overflow flag without
checking if the flag is 1, the set information of overflow may be erased by
writing 0 ((ii) in the above chart). Therefore, software may judge that no
overflow has occurred even when an overflow actually has occurred.
If execution of the CLR instruction conflicts with occurrence of an overflow
when the overflow flag is cleared to 0 with the CLR instruction, the overflow
flag remains set even after execution of the clear instruction.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 473


Chapter 11 16-bit Timer/Event Counter P (TMP)

11.5.7 Pulse width measurement mode (TPnMD2 to TPnMD0 = 110)

In the pulse width measurement mode, 16-bit timer/event counter P starts


counting when the TPnCTL0.TPnCE bit is set to 1. Each time the valid edge
input to the TIPnm pin has been detected, the count value of the 16-bit counter
is stored in the TPnCCRm register, and the 16-bit counter is cleared to 0000H.
The interval of the valid edge can be measured by reading the TPnCCRm
register after a capture interrupt request signal (INTTPnCCm) occurs.
Select either the TIPn0 or TIPn1 pin as the capture trigger input pin. Specify
“No edge detected” by using the TPnIOC1 register for the unused pins.
When an external clock is used as the count clock, measure the pulse width of
the TIPn1 pin because the external clock is fixed to the TIPn0 pin. At this time,
clear the TPnIOC1.TPnIS1 and TPnIOC1.TPnIS0 bits to 00 (capture trigger
input (TIPn0 pin): No edge detected).

Clear

Internal count clock Count


clock
16-bit counter INTTPnOV signal
Edge selection
TIPn0 pin
detector
(external
event count
INTTPnCC0 signal
TPnCE bit
input/capture
trigger input) Edge INTTPnCC1 signal
detector
TPnCCR0 register
(capture)
TIPn1 pin Edge
(capture detector
trigger input) TPnCCR1 register
(capture)

Figure 11-37 Configuration in pulse width measurement mode

www.DataSheet4U.com

474 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

FFFFH

16-bit counter

0000H

TPnCE bit

TIPnm pin input

TPnCCRm register 0000H D0 D1 D2 D3

INTTPnCCm signal

INTTPnOV signal
Cleared to 0 by
TPnOVF bit CLR instruction

Figure 11-38 Basic timing in pulse width measurement mode

When the TPnCE bit is set to 1, the 16-bit counter starts counting. When the
valid edge input to the TIPnm pin is later detected, the count value of the 16-bit
counter is stored in the TPnCCRm register, the 16-bit counter is cleared to
0000H, and a capture interrupt request signal (INTTPnCCm) is generated.
The pulse width is calculated as follows.
First pulse width = (D0 + 1) × Count clock cycle
Second and subsequent pulse width = (DN - DN - 1) × Count clock cycle
If the valid edge is not input to the TIPnm pin even when the 16-bit counter
counted up to FFFFH, an overflow interrupt request signal (INTTPnOV) is
generated at the next count clock, and the counter is cleared to 0000H and
continues counting. At this time, the overflow flag (TPnOPT0.TPnOVF bit) is
also set to 1. Clear the overflow flag to 0 by executing the CLR instruction via
software.
If the overflow flag is set to 1, the pulse width can be calculated as follows.
First pulse width = (D0 + 10001H) × Count clock cycle
Second pulse width and on = (10000H + DN - DN - 1) × Count clock cycle

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 475


Chapter 11 16-bit Timer/Event Counter P (TMP)

(1) Register setting in pulse width measurement mode

(a) TMPn control register 0 (TPnCTL0)

TPnCE TPnCKS2 TPnCKS1 TPnCKS0


TPnCTL0 0/1 0 0 0 0 0/1 0/1 0/1

Select count clockNote


0: Stop counting
1: Enable counting

Note Setting is invalid when the TPnEEE bit = 1.

(b) TMPn control register 1 (TPnCTL1)

TPnEST TPnEEE TPnMD2 TPnMD1 TPnMD0


TPnCTL1 0 0 0/1 0 0 1 1 0

1, 1, 0:
Pulse width measurement mode

0: Operate with count


clock selected by
TPnCKS0 to TPnCKS2 bits
1: Count external event
count input signal

(c) TMPn I/O control register 1 (TPnIOC1)

TPnIS3 TPnIS2 TPnIS1 TPnIS0


TPnIOC1 0 0 0 0 0/1 0/1 0/1 0/1

Select valid edge


of TIPn0 pin input

Select valid edge


of TIPn1 pin input

www.DataSheet4U.com

476 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(d) TMPn I/O control register 2 (TPnIOC2)

TPnEES1 TPnEES0 TPnETS1 TPnETS0


TPnIOC2 0 0 0 0 0/1 0/1 0 0

Select valid edge of


external event count input

(e) TMPn option register 0 (TPnOPT0)

TPnCCS1 TPnCCS0 TPnOVF


TPnOPT0 0 0 0 0 0 0 0 0/1

Overflow flag

(f) TMPn counter read buffer register (TPnCNT)


The value of the 16-bit counter can be read by reading the TPnCNT register.

(g) TMPn capture/compare registers 0 and 1 (TPnCCR0 and TPnCCR1)


These registers store the count value of the 16-bit counter when the valid edge
input to the TIPnm pin is detected.

Note TMPn I/O control register 0 (TPnIOC0) is not used in the pulse width
measurement mode.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 477


Chapter 11 16-bit Timer/Event Counter P (TMP)

(2) Operation flow in pulse width measurement mode

FFFFH

16-bit counter

0000H

TPnCE bit

TIPn0 pin input

TPnCCR0 register 0000H D0 D1 D2 0000H

INTTPnCC0 signal

<1> <2>

<1> Count operation start flow

START

Register initial setting Initial setting of these registers


TPnCTL0 is performed before setting the
(TPnCKS0 to TPnCKS2 bits), TPnCE bit to 1.
TPnCTL1,
TPnIOC1,
TPnIOC2,
TPnOPT0

Set TPnCTL0 register The TPnCKS0 to TPnCKS2 bits can


(TPnCE bit = 1) be set at the same time when counting
has been started (TPnCE bit = 1).

<2> Count operation stop flow

The counter is initialized and counting


TPnCE bit = 0 is stopped by clearing the TPnCE bit to 0.

STOP

Figure 11-39
www.DataSheet4U.com Software processing flow in pulse width measurement mode

478 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

(3) Operation timing in pulse width measurement mode

(a) Clearing overflow flag


The overflow flag can be cleared to 0 by clearing the TPnOVF bit to 0 with the
CLR instruction and by writing 8-bit data (bit 0 is 0) to the TPnOPT0 register.
To accurately detect an overflow, read the TPnOVF bit when it is 1, and then
clear the overflow flag by using a bit manipulation instruction.

(i) Operation to write 0 (without conflict with setting) (iii) Operation to clear to 0 (without conflict with setting)

Overflow Overflow
set signal L set signal L

0 write signal 0 write signal

Overflow flag Register


access signal Read Write
(TPnOVF bit)

Overflow flag
(TPnOVF bit)

(ii) Operation to write 0 (conflict with setting) (iv) Operation to clear to 0 (conflict with setting)

Overflow Overflow
set signal set signal

0 write signal 0 write signal

Overflow flag Register


access signal Read Write
(TPnOVF bit)

Overflow flag H
(TPnOVF bit)

To clear the overflow flag to 0, read the overflow flag to check if it is set to 1,
and clear it with the CLR instruction. If 0 is written to the overflow flag without
checking if the flag is 1, the set information of overflow may be erased by
writing 0 ((ii) in the above chart). Therefore, software may judge that no
overflow has occurred even when an overflow actually has occurred.
If execution of the CLR instruction conflicts with occurrence of an overflow
when the overflow flag is cleared to 0 with the CLR instruction, the overflow
flag remains set even after execution of the clear instruction.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 479


Chapter 11 16-bit Timer/Event Counter P (TMP)

11.5.8 Timer output operations

The following table shows the operations and output levels of the TOPn0 and
TOPn1 pins.

Table 11-11 Timer output control in each mode


Operation Mode TOPn1 Pin TOPn0 Pin
Interval timer mode Square wave output
External event count mode Square wave output –
External trigger pulse output mode External trigger pulse output Square wave output
One-shot pulse output mode One-shot pulse output
PWM output mode PWM output
Free-running timer mode Square wave output (only when compare function is used)
Pulse width measurement mode –

Table 11-12 Truth table of TOPn0 and TOPn1 pins under control of timer output
control bits
TPnIOC0.TPnOLm Bit TPnIOC0.TPnOEm Bit TPnCTL0.TPnCE Bit Level of TOPnm Pin
0 0 × Low-level output
1 0 Low-level output
1 Low level immediately before counting,
high level after counting is started
1 0 × High-level output
1 0 High-level output
1 High level immediately before counting,
low level after counting is started

www.DataSheet4U.com

480 User’s Manual U17566EE5V1UM00


16-bit Timer/Event Counter P (TMP) Chapter 11

11.6 Operating Precautions

11.6.1 Capture operation in pulse width measurement and free-


running mode

When the capture operation is used in pulse width measurement or free-run-


ning mode the first captured counter value of the capture registers TPnCCR0/
TPnCCR, i.e. after the timer is enabled (TPnCTL0.TPnCE = 1), may be FFFFH
instead of 0000H if the chosen count clock of the TMP is not the maximum, i.e.
if TPnCTL0.TPnCKS[2:0] ≠ 0.

11.6.2 Count jitter for PCLK4 to PCLK7 count clocks

When specifying PCLK4 to PCLK7 as the count clock, a jitter of maximum


± 1 period of PCLK0 may be applied to the counter’s count clock input.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 481


Chapter 11 16-bit Timer/Event Counter P (TMP)

www.DataSheet4U.com

482 User’s Manual U17566EE5V1UM00


Chapter 12 16-bit Interval Timer Z (TMZ)

Timer Z (TMZ) is a general purpose 16-bit timer/counter.

The V850E/Dx3 microcontrollers have following instances of the general


purpose Timer Z:

µPD70F3427, µPD70F3426A µPD70F3423, µPD70F3422


TMZ
µPD70F3425, µPD70F3424 µPD70F3421
Instances 10 6
Names TMZ0 to TMZ9 TMZ0 to TMZ5

Throughout this chapter, the individual instances of Timer Z are identified by


“n”, for example TMZn, or TZnCTL for the TMZn control register.

12.1 Overview

Each Timer Z has one down-counter. When the counter reaches zero, the
timer generates the maskable interrupt INTTZnUV.
The TMZ can be used as:
• Interval timer
• Free running timer

Features summary Special features of the TMZ are:


• One of six peripheral clocks can be selected
• One reload register
• Two readable counter registers
• When the device is in debug mode, the timer can be stopped at breakpoint
• TMZ0, TMZ1, and TMZ2 can be used for triggering the DMA Controller.
• TMZ5 can be used for triggering the A/D Converter.
• All TMZn can be optionally stopped when a breakpoint is hit during
debugging (refer to “On-Chip Debug Unit“ on page 969).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 483


Chapter 12 16-bit Interval Timer Z (TMZ)

12.1.1 Description

The TMZ has no external connections. It is built up as illustrated in the


following figure.

Internal bus

TZnCTL
TZCKS2 TZCKS1 TZCKS0 TZnR

TZnCNT1 TZnCNT0 Reload buffer

PCLK2 (4 MHz) CNTCLK


16-bit down counter
INTTZnUV
Selector

PCLK4 (1 MHz) TZnCNT


TZnCTL.TZCE
PCLK5 (0.5 MHz)
PCLK7 (125 KHz)
PCLK9 (31.250 KHz)

Figure 12-1 Block diagram of Timer Z (TMZn)

The control register TZnCTL allows you to choose the count clock CNTCLK
and to enable the timer. The latter is done by setting TZnCTL.TZCE to 1.
As soon as the timer is enabled, it is possible to write a start value to the reload
register TZnR.

12.1.2 Principle of operation

When it is enabled, the counter starts as soon as a non-zero value is written to


the reload register TZnR and copied to the reload buffer.
When the counter reaches zero, it generates an INTTZnUV interrupt, reloads
its start value from the reload buffer, and continues counting.
Two read-only registers (TZnCNT0 and TZnCNT1) provide the updated
counter value. For details about these registers please refer to “TZnCNT0 -
TMZn synchronized counter register“ on page 487 and “TZnCNT1 - TMZn
non-synchronized counter register“ on page 488.

www.DataSheet4U.com

484 User’s Manual U17566EE5V1UM00


16-bit Interval Timer Z (TMZ) Chapter 12

12.2 TMZ Registers

Each Timer Z is controlled and operated by means of the following four


registers:

Table 12-1 Timer Z registers overview


Register name Shortcut Address
Timer Z synchronized read register TZnCNT0 <base>
Timer Z non-synchronized read register TZnCNT1 <base> + 2H
Timer Z reload register TZnR <base> + 4H
Timer Z control register TZnCTL <base> + 6H

Table 12-2 Base addresses of Timer Z

Timer Base address


TMZ0 FFFF F600H
TMZ1 FFFF F608H
TMZ2 FFFF F610H
TMZ3 FFFF F618H
TMZ4 FFFF F620H
TMZ5 FFFF F628H
TMZ6 FFFF F630H
TMZ7 FFFF F638H
TMZ8 FFFF F640H
TMZ9 FFFF F648H

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 485


Chapter 12 16-bit Interval Timer Z (TMZ)

(1) TZnCTL - TMZn timer control register


The 8-bit TZnCTL register controls the operation of the Timer Z.
Access This register can be read/written in 8-bit or 1-bit units.
Address <base> + 6H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
TZCE 0 0 0 0 TZCKS2 TZCKS1 TZCKS0
R/W R R R R R/W R/W R/W

Table 12-3 TZnCTL register contents


Bit position Bit name Function
7 TZCE Timer Z counter enable:
0: Disable count operation (the timer stops immediately with the count value
0000H and does not operate).
1: Enable count operation (the timer starts when a non-zero start value is written
to the register TZnR after TZnCTL.TZCE=1).
2 to 0 TZCKS[2:0] Selects the counter clock CNTCLK:
TZCKS2 TZCKS1 TZCKS0 Counter clock selection

0 0 0 PCLK2 (4 MHz)

0 1 0 PCLK4 (1 MHz)

0 1 1 PCLK5 (0.5 MHz)

1 0 0 PCLK7 (0.125 MHz)

1 0 1 PCLK9 (31.250 KHz)

Others than above Setting prohibited

Note Change bits TZnCTL.TZCKS[2:0] only when TZnCTL.TZCE = 0.


When TZnCTL.TZCE = 0, it is possible to select the clock and enable the
counter with one write operation.

www.DataSheet4U.com

486 User’s Manual U17566EE5V1UM00


16-bit Interval Timer Z (TMZ) Chapter 12

(2) TZnCNT0 - TMZn synchronized counter register


The TZnCNT0 register is the synchronized register that can be used to read
the present value of the 16-bit counter.
“Synchronized” means that the read access via the internal bus is
synchronized with the maximum counter clock (PCLK2). The synchronization
process may cause a delay, but the resulting value is reliable.
Access This register is read-only, in 16-bit units.
Address <base> of TMZn
Initial Value 0000H. This register is cleared by any reset and when TZnCTL.TZCE = 0.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Updated counter value (synchronized)
R

Caution Reading TZnCNT0 immediately after start of the counter by setting TZnR > 0
may return 0000H instead of the correct counter value. Refer to (4) “TZnR -
Reload register“ for details.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 487


Chapter 12 16-bit Interval Timer Z (TMZ)

(3) TZnCNT1 - TMZn non-synchronized counter register


The TZnCNT1 register is the non-synchronized register that can be used to
read the present value of the corresponding 16-bit counter.
“Non-synchronized” means that the read access via the internal bus is not
synchronized with the counter clock. It returns the instantaneous value
immediately, with the risk that this value is just being updated by the counter
and therefore in doubt.
Access This register is read-only, in 16-bit units.
Address <base> + 2H
Initial Value 0000H. This register is cleared by any reset and when TZnCTL.TZCE = 0.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Instantaneous counter value (non-synchronized)
R

Note The value read from this register can be incorrect, because the read access is
not synchronized with the counter clock.
Therefore, this register shall be read multiple times within one period of the
counter clock cycle.
If the difference between the first and the second value is not greater than one,
you can consider the second value to be correct. If the difference between the
two values is greater than one, you have to read the register a third time and
compare the third value with the second. Again, the difference must not be
greater than one.
If the read accesses do not happen within one period of the counter clock
cycle, the difference between the last two values will usually be greater than
one. In this case, you can only repeat the procedure or estimate the updated
counter value.

Caution Reading TZnCNT1 immediately after start of the counter by setting TZnR > 0
may return 0000H instead of the correct counter value. Refer to (4) “TZnR -
Reload register“ for details.

www.DataSheet4U.com

488 User’s Manual U17566EE5V1UM00


16-bit Interval Timer Z (TMZ) Chapter 12

(4) TZnR - Reload register


The TZnR register is a dedicated register for setting the reload value of the
corresponding counter.
Access This register can be read/written in 16-bit units.
Address <base> + 4H
Initial Value 0000H. This register is cleared by any reset and when TZnCTL.TZCE = 0.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Down-counter load value
R/W

Note 1. TZnR can only be written when TZnCTL.TZCE = 1.


2. The load value must be non-zero (0001H … FFFFH).
3. To operate the timer in free running mode, set TZnR to FFFFH.
4. The first interval after starting the counter can require additional clock
cycles. For details refer to “Timer start and stop“ on page 491.
5. Transfer of the TZnR content after writing to TZnR requires additional clock
cycles, until the value is set to the counter register TZnCNT. Thus during
that transfer time TTrans reading of TZnCNT0 respectively TZnCNT1
returns 0000H instead of the correct value.
The transfer time TTrans depends on the chosen count clock and are given
in Table 12-4.

Table 12-4 Transfer times TTrans of TZnR to TZnCNT

TznR to TZnCNT transfer time TTrans


TZnCTL.TZCKS TCNTCLK period
minimum maximum
000B TPCLK2 TPCLK2 TPCLK2
010B 4 x TPCLK2 5 x TPCLK2 9 x TPCLK2
011B 8 x TPCLK2 9 x TPCLK2 17 x TPCLK2
100B 32 x TPCLK2 33 x TPCLK2 65 x TPCLK2
101B 128 x TPCLK2 128 x TPCLK2 257 x TPCLK2

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 489


Chapter 12 16-bit Interval Timer Z (TMZ)

12.3 Timing

The contents of the reload register TZnR can be changed at any time, provided
the timer is enabled. The contents is then copied to the reload buffer. However,
the counter reloads its start value from the buffer when the counter reaches 0.

Caution When specifying PCLK4, PLCK5, PCLK7 or PCLK9 as the count clock, a jitter
of maximum ± 1 period of PCLK2 may be applied to the TZnCNT counter’s
count clock input.

12.3.1 Steady operation

Steady operation is illustrated in the following figure.

D0 D0 D0

16-bit down D1 D1
counter value

0000H

Reload buffer D0 D1 D0

TZnR D0 D1 D0

INTTZnUV

Figure 12-2 Reload timing and interrupt generation

D0 and D1 are two different reload values.


Note that there is a delay between writing to TZnR and making the data
available in the reload buffer, depending on the previous reload value and the
chosen count clock.

www.DataSheet4U.com

490 User’s Manual U17566EE5V1UM00


16-bit Interval Timer Z (TMZ) Chapter 12

12.3.2 Timer start and stop

(1) Timer Z start


The Timer TZn is enabled by setting TZnCTL.TZCE to 1.
The subsequent write access to register TZnR with non-zero data starts the
timer. After that, it is prepared to load the value written to register TZnR into the
reload buffer and the counter.
The interval time, i.e. the time between the INTTZnUV interrupts, depends on
the chosen count clock TCNTCLK (selected by TZnCTL.TZCKS) and calculates
to
Tinterval = ([TZnR] + 1) × TCNTCLK

However the time of the first interval after starting the counter by setting
TZnR > 0 may be longer than the steady intervals afterwards.
The length of the first interval also depends on whether the counter has
already been enabled a certain time before it’s started.
In the following the interval times for both cases are given as a multiple of
TPCLK2, the period of the PCLK2 input clock.

TACmin, TACmax Since the access time to the TZnR register adds also to the uncertainty of the
first interval duration, the below tables contain two values, which are calculated
as follows:
• TACmin = (SUWL + VSWL + 3) x 1/fVBCLK
• TACmax = [2 x (SUWL + VSWL) + 4.5] x 1/fVBCLK
The values SUWL and VSWL depend on the chosen CPU system clock
VBCLK and are set up in the VSWC register (refer to “Bus and Memory
Control (BCU, MEMC)“ on page 255).
Note that the above access times assume that the NPB bus is not occupied
and the write access to TZnR is immediately passed to the Timer Z.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 491


Chapter 12 16-bit Interval Timer Z (TMZ)

Timer enabled Table 12-5 shows the interval times under following conditions:
• timer is enabled by TZnCTL.TZCE = 1
• timer is started by setting TZnR > 0 after at least 2 PCLK2 clock periods
after timer enable

Table 12-5 TMZ interval times (timer enabled since minimum 2 PCLK2 clocks)

TZnCTL TCNTCLK 1st interval


Following intervals
.TZCKS period minimum maximum
000B TPCLK2 TACmin + TACmax + ([TZnR]+1) x TPCLK2
([TZnR]+2) x TPCLK2 ([TZnR]+3) x TPCLK2
010B 4 x TPCLK2 TACmin + TACmax + 4 x ([TZnR]+1) x TPCLK2
(4[TZnR]+6) x TPCLK2 (4[TZnR]+11) x TPCLK2
011B 8 x TPCLK2 TACmin + TACmax + 8 x ([TZnR]+1) x TPCLK2
(8[TZnR]+10) x TPCLK2 (8[TZnR]+19) x TPCLK2
100B 32 x TPCLK2 TACmin + TACmax + 32 x ([TZnR]+1) x TPCLK2
(32[TZnR]+34) x TPCLK2 (32[TZnR]+67) x TPCLK2
101B 128 x TPCLK2 TACmin + TACmax + 128 x ([TZnR]+1) x TPCLK2
(128[TZnR]+130) x TPCLK2 (128[TZnR]+259) x TPCLK2

Timer disabled Table 12-6 shows the interval times under following conditions:
• timer disabled: TZnCTL.TZCE = 0
• timer is enabled by TZnCTL.TZCE = 1
• timer is started by setting TZnR > 0 immediately after enable, i.e. within 2
PCLK2 clock periods after timer enable

Table 12-6 TMZ interval times (timer started within 2 PCLK2 clocks after enable)

TZnCTL TCNTCLK 1st interval


Following intervals
.TZCKS period minimum maximum
000B TPCLK2 TACmin + TACmax + ([TZnR]+1) x TPCLK2
([TZnR]+4.5) x TPCLK2 ([TZnR]+6.5) x TPCLK2
010B 4 x TPCLK2 TACmin + TACmax + 4 x ([TZnR]+1) x TPCLK2
(4[TZnR]+7.5) x TPCLK2 (4[TZnR]+13.5) x TPCLK2
011B 8 x TPCLK2 TACmin + TACmax + 8 x ([TZnR]+1) x TPCLK2
(8[TZnR]+11.5) x TPCLK2 (8[TZnR]+21.5) x TPCLK2
100B 32 x TPCLK2 TACmin + TACmax + 32 x ([TZnR]+1) x TPCLK2
(32[TZnR]+35.5) x TPCLK2 (32[TZnR]+69.5) x TPCLK2
101B 128 x TPCLK2 TACmin + TACmax + 128 x ([TZnR]+1) x TPCLK2
(128[TZnR]+131.5) x TPCLK2 (128[TZnR]+261.5) x TPCLK2

(2) Timer Z stop


www.DataSheet4U.com
The timer stops when TZnCTL.TZCE is cleared. This write access is not
synchronized. The timer is immediately stopped, and its registers are reset.

492 User’s Manual U17566EE5V1UM00


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

The V850E/Dx3 microcontrollers have following instances of the 16-bit multi-


purpose Timer G:

TMG All devices


Instances 3
Names TMG0 to TMG2

Throughout this chapter, the individual instances of Timer G are identified by


“n”, for example TMGn, or TMGMn for the TMGn mode register.

Note Throughout this chapter, the following indexes are used:


• n: for each of the Timer G instances
• m = 1 to 4: for the free assignable Input/Output-channels
• x = 0, 1: for bit-index, i.e. one of the 2 counters of each Timer Gn
• y = 0 to 5: for all of the 6 capture/compare-channels

13.1 Features of Timer G

The timers Gn operate as:


• Pulse interval and frequency measurement counter
• Interval timer
• Programmable pulse output
• PWM output timer
• TMG0 can be used for triggering the DMA Controller.
One capture input of Timer G0 and one capture input of Timer G1 are
connected to the time stamp outputs of CAN0 and CAN1 modules and can
therefore be used for CAN time stamp functions.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 493


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

13.2 Function Overview of Each Timer Gn

• 16-bit timer/counter (TMGn0, TMGn1): 2 channels


• Bit length
– Timer Gn registers (TMGn0, TMGn1): 16 bits
• Capture/compare register (GCCny): 6
– 16-bit
– 2 registers are assigned fix to the corresponding one of the 2 counters
– 4 free assignable registers to one of the 2 counters
• Count clock division selectable by prescaler (frequency of peripheral clock:
fSPCLK0 = 16 MHz)
– In 8 steps from fSPCLK0/2 to fSPCLK0/256
• Interrupt request sources
– Edge detection circuit with noise elimination.
– Compare-match interrupt requests: 6 types
Perform comparison of capture/compare register with one of the 2
counters (TMGn0, TMGn1) and generate the INTCCGny (y = 0 to 5)
interrupt upon compare match.
– Timer counter overflow interrupt requests: 2 types
In free run mode the INTTMGn0 (INTTMGn1) interrupt is generated when
the count value of TMGn0 (TMGn1) toggles from FFFFH to 0000H.
– In match and clear mode the INTTMGn0 (INTTMGn1) interrupt is
generated when the count value of TMGn0 (TMGn1) matches the GCC0
(GCC1) value.
• PWM output function
– Control of the outputs of TOGn1 through TOGn4 pin in the compare
mode. PWM output can be performed using the compare match timing of
the GCCn1 to GCCn4 register and the corresponding timebase (TMGn0,
TMGn1).
• Output delay operation
– A clock-synchronized output delay can be added to the output signal of
pins TOGn1 to TOGn4.
– This is effective as an EMI counter measure.
• Edge detection and noise elimination filter
– External signals shorter than 1 count clock (fCOUNTn, not fSPCLK0) are
eliminated as noise.

Note The TIGn1 to TIGn4 and TOGn1 to TOGn4 are each alternative function pins.

The following figure shows the block diagram of Timer Gn.

www.DataSheet4U.com

494 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

fSCPLK0/1
fSCPLK0/2
fSCPLK0/4 INTTGnOV0
fSPCLK0 fSCPLK0/8 fCOUNT0
(16 MHz) fSCPLK0/16 TMGn0 (16-bit)
Clear
fSCPLK0/32 (Note 1)
fSCPLK0/64
fSCPLK0/128 INTTGnCC0

TIGn0 Noise Elimination GCCn0 (16-bit)


(Note 2) Edge Detection capture/compare
INTTGnCC1

Noise Elimination GCCn1 (16-bit) TO TOGn1


TIGn1 Edge Detection capture/compare Control
INTTGnCC2

Noise Elimination TOGn2


GCCn2 (16-bit) TO
TIGn2 Edge Detection capture/compare Control
INTTGnCC3

Noise Elimination GCCn3 (16-bit) TO TOGn3


TIGn3 capture/compare
Edge Detection Control
INTTGnCC4

Noise Elimination GCCn4 (16-bit) TO TOGn4


TIGn4
Edge Detection capture/compare Control
INTTGnCC5

TIGn5 Noise Elimination GCCn5 (16-bit)


(Note 3) Edge Detection capture/compare

fSCPLK0/1
fSCPLK0/2
fSCPLK0/4 (Note 1) INTTGnOV1
fSPCLK0 fSCPLK0/8 fCOUNT1 Clear
(16MHz) fSCPLK0/16 TMGn1 (16-bit)
fSCPLK0/32
fSCPLK0/64
fSCPLK0/128
www.DataSheet4U.com

Figure 13-1 Block Diagram of Timer Gn

User’s Manual U17566EE5V1UM00 495


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

Note 1. TMGn0/TMGn1 are cleared by GCCn0/GCCn5 register compare match.


2. TIGn0 differs:
– n = 0: TIG00 not connected
– n = 1: TIG10 not connected
– n = 2: TIG20 available as external capture input
3. TIGn5 differs:
– n = 0: CAN0 time stamp TSOUTCAN0 -> TIG05
– n = 1: CAN1 time stamp TSOUTCAN1 -> TIG15
– n = 2: TIG25 available as external capture input

13.3 Basic Configuration

The basic configuration is shown below.

Table 13-1 Timer Gn configuration list


Generated Capture Timer output
Count clock Register R/W
interrupt signal trigger PWM
TMGn0 R INTTMGn0 - -
fSPCLK0 TMGn1 R INTTMGn1 - -
fSPCLK0 /2, GCCn0 R/W INTCCGn0 TIGn0 -
fSPCLK0 /4,
fSPCLK0 /8, GCCn1 R/W INTCCGn1 TIGn1 TOGn1
fSPCLK0 /16, GCCn2 R/W INTCCGn2 TIGn2 TOGn2
fSPCLK0 /32,
fSPCLK0 /64, GCCn3 R/W INTCCGn3 TIGn3 TOGn3
fSPCLK0 /128 GCCn4 R/W INTCCGn4 TIGn4 TOGn4
GCCn5 R/W INTCCGn5 TIGn5 -

Note fSPCLK0: Internal peripheral clock

www.DataSheet4U.com

496 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

13.4 TMG Registers

The Timers Gn are controlled and operated by means of the following


registers:

Table 13-2 TMGn registers overview


Register name Shortcut Address
Timer Gn mode register TMGMn <base>
Timer Gn channel mode register TMGCMn <base> + 2H
Timer Gn output control register OCTLGn <base> + 4H
Timer Gn time base status register TMGSTn <base> + 6H
Timer Gn count register 0 TMG00 <base> + 8H
Timer Gn count register 1 TMG01 <base> + AH
Timer Gn capture/compare register 0 GCC00 <base> + CH
Timer Gn capture/compare register 1 GCC01 <base> + EH
Timer Gn capture/compare register 2 GCC02 <base> + 10H
Timer Gn capture/compare register 3 GCC03 <base> + 12H
Timer Gn capture/compare register 4 GCC04 <base> + 14H
Timer Gn capture/compare register 5 GCC05 <base> + 16H

Table 13-3 TMGn register base address


Timer Base address
TMG0 FFFF F6A0H
TMG1 FFFF F6C0H
TMG2 FFFF F6E0H

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 497


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

(1) TMGMn - Timer Gn mode register


Access This register can be read/written in 16-bit, 8-bit or 1-bit units.
The low byte TMGMn.bit[7:0] is accessible separately under the name
TMGMnL, the high byte TMGMn.bit[15:8] under the name TMGMnH.
Address TMGMn, TMGMnL: <base>
TMGMnH: <base> + 1H
Initial Value 0000H. This register is cleared by any reset.

15 14 13 12 11 10 9 8
POWERn OLDEn CSEn12 CSEn11 CSEn10 CSE002 CSEn01 CSEn00
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
CCSGn5 CCSGn0 0 0 CLRGn1 TMGn1E CLRGn0 TMGn0E
R/W R/W R/W R/W R/W R/W R/W R/W

Table 13-4 TMGMn register contents (1/2)


Bit
Bit name Function
position
15 POWERn Timer Gn Operation control.
0: operation Stop
the capture registers and TMGSTn register are cleared
the TOGnm pins are inactive all the time
1: operation enable
Note: At least 7 peripheral clocks (fSPCLK0) are needed to start the timer function
14 OLDEn Set Output Delay Operation.
0: Don’t perform output delay operation
1: Set output delay to n count-clocks

Caution: When the POWERn bit is set, the rewriting of this bit is prohibited!
Simultaneously writing with the POWERn bit is allowed.

Note: The delay operation is used for EMI counter measures.


13 to 8 CSEnx[2:0] Selects internal count clock of TMG
CSEnx2 CSEnx1 CSEnx0 Count clock
0 0 0 fSPCLK0
0 0 1 fSPCLK0/2
0 1 0 fSPCLK0/4
0 1 1 fSPCLK0/8
1 0 0 fSPCLK0/16
1 0 1 fSPCLK0/32
1 1 0 fSPCLK0/64
www.DataSheet4U.com 1 1 1 fSPCLK0/128

Caution: When the POWERn bit is set, the rewriting of this bits are prohibited!
Simultaneously writing with the POWERn bit is allowed.

498 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

Table 13-4 TMGMn register contents (2/2)


Bit
Bit name Function
position
7, 6 CCSGn5 Specifies the mode of the TMGn0 (TMGn1)(CCSGn5 for TMGn1, CCSGn0 for
CCSGn0 TMGn0):
0: Free-run mode for TMGn1 (TMGn0), GCCn5 (GCCn0) in capture mode (an
detected edge at pin TIGn5 (TIGn0) stores the value of TMGn1 (TMGn0) in
GCCn5 (GCCn0) and an interrupt INTCCGn5 (INTCCGn0) is output)
1: Match and Clear mode of the TMGn1 (TMGn0), GCCn5 (GCCn0) in compare
mode (when the data of GCCn5 (GCCn0) match the count value of the TMGn1
(TMGn0), the counter is cleared and the interrupt INTCCGn5 (INTCCGn0)
occurs)

Caution: When the POWERn bit is set, the rewriting of this bits are prohibited!
Simultaneously writing with the POWERn bit is allowed.

3, 1 CLRGnx Specifies software clear for TMGnx


0: Continue TMGnx operation
1: Clears (0) the count value of TMGnx, the corresponding TOGnx is deactivated.
Note: TMGnx starts 1 peripheral-clock after this bit is set this bit is not readable
(always read 0)
2, 0 TMGnxE Specifies TMGnx count operation enable/disable
0: Stop count operation the counter holds the immediate preceding value the
corresponding TOGnx is deactivated
1: Enable count operation
Note: 1. the counter needs at least 1 peripheral-clock (fSPCLK0) to stop
2. the counter needs at least 4 peripheral-clocks (fSPCLK0) to start

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 499


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

(2) TMGCMn - Timer Gn channel mode register


This register specifies the assigned counter (TMGn0 or TMGn1) for the
GCCnm register.
Furthermore it specifies the edge detection for the TIGny input pins.
Access This register can be read/written in 16-bit, 8-bit or 1-bit units.
The low byte TMGCMn.bit[7:0] is accessible separately under the name
TMGCMnL, the high byte TMGCMn.bit[15:8] under the name TMGCMnH.
Address TMGCMn, TMGCMnL: <base> + 2H
TMGCMnH: <base> + 3H
Initial Value 0000H. This register is cleared by any reset.

15 14 13 12 11 10 9 8
TBGn4 TBGn3 TBGn2 TBGn1 IEGn51 IEGn50 IEGn41 IEGn40
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
IEGn31 IEGn30 IEGn21 IEGn20 IEGn11 IEGn10 IEGn01 IEGn00
R/W R/W R/W R/W R/W R/W R/W R/W

Table 13-5 TMGCMn register contents


Bit position Bit name Function
15 to 12 TBGnm Assigns Capture/Compare registers GCCn1 to GCCn4 to one of the 2 counters
TMGn0 or TMGn1:
0: Set TMGn0 as the corresponding counter to GCCnm register and TIGnm/
TOGnm pin
1: Set TMGn1 as the corresponding counter to GCCnm register and TIGnm/
TOGnm pin
11 to 0 IEGny1, Specifies the valid edge of external capture signal input pin (TIGnm) for the capture
IEGny0 register performing capture-match with the assigned counter TMGn0 or TMGn1:

IEGny1 IEGny0 Valid edge


0 0 Falling edge
0 1 Rising edge
1 0 No edge detection performed
1 1 Both rising and falling edges

www.DataSheet4U.com

500 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

(3) OCTLGn - Timer Gn output control register


This register controls the timer output from the TOGnm pin and the capture or
compare modus for the GCCnm register.
Access This register can be read/written in 16-bit, 8-bit or 1-bit units.
The low byte OCTLGn.bit[7:0] is accessible separately under the name
OCTLGnL, the high byte OCTLGn.bit[15:8] under the name OCTLGnH.
Address OCTLGn, OCTLGnL: <base> + 4H
OCTLGnH: <base> + 5H
Initial Value 4444H. This register is cleared by any reset.

15 14 13 12 11 10 9 8
SWFGn4 ALVGn4 CCSGn4 0 SWFGn3 ALVGn3 CCSGn3 0
R/W R/W R/W R/W R/W R/W R/W R/W

7 6 5 4 3 2 1 0
SWFGn2 ALVGn2 CCSGn2 0 SWFGn1 ALVGn1 CCSGn1 0
R/W R/W R/W R/W R/W R/W R/W R/W

Caution 1. When the POWERn bit is set, the rewriting of CCSGnm is prohibited
2. When the POWERn bit and TMGn0E bit (TMGn1E bit) are set at the same
time, the rewriting of the ALVGnm bits is prohibited.

Table 13-6 OCTLGn register contents


Bit position Bit name Function
15, 11, 7, 3 SWFGnm Fixes the TOGnm pin output level according to the setting of ALVGnm bit.
0: disable TOGnm to inactive level
1: enable TOGnm
14, 10, 6, 2 ALVGnm Specifies the active level of the TGOnm pin output.
0: Active level is 0
1: Active level is 1

Caution: Don’t write this bit, before ENFGn0 or ENFGn1 of TMGSTn is 0, so first
clear TMGn0E or TMGn1E bit of the TMGMn register and check
ENFGn0 or ENFGn1 bit before writing.

13, 9, 5, 1 CCSGnm Specifies Capture/Compare mode selection:


0: Capture mode:
if external edge is detected the INTCCGnm interrupt occurs, the
corresponding counter value is written to GCCnm
1: Compare mode:
if GCCnm matches with corresponding timebase the INTCCGnm interrupt
occurs, if SWFGm is set the PWM output mode is set

www.DataSheet4U.com
Caution: Don’t write this bit, before POWERn bit of TMGMnH is 0.

User’s Manual U17566EE5V1UM00 501


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

(4) TMGSTn - Time base status register


The TMGSTn register indicates the status of TMGn0 and TMGn1. For the
CCFGny bit see “Operation in Free-Run Mode“ on page 507.
Access This register can be read in 8-bit or 1-bit units.
Address <base> + 6H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
ENFGn1 ENFGn0 CCFGn5 CCFGn4 CCFGn3 CCFGn2 CCFGn1 CCFGn0
R R R R R R R R

Table 13-7 TMGSTn register contents


Bit position Bit name Function
5 to 0 CCFGny Indicates TMGn0 or TMGn1 overflow status.
0: No overflow
1: Overflow

Caution: The CCFGny bit is set if a TMGnx overflow has occurred between
two capture input signals. This flag is only updated if the
corresponding GCCny register was read, so first read the GCCny
register and then read this flag if necessary

7 to 6 ENFGnx Indicates TMGnx operation.


0: indicates operation stopped
1: indicates operation

(5) TMGn0, TMGn1 - Timer Gn 16-bit counter registers


The features of the counters TMGn0 and TMGn1 are listed below:
• Free-running counter that enables counter clearing by compare match of
registers GCCn0/GCCn5
• Counter clear can be set by software.
• Counter stop can be set by software.
Access These registers can be read in 16-bit units.
Address TMGn0: <base> + 8H
TMGn1: <base> + AH
Initial Value 0000H. This register is cleared by any reset.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
TMGn0/TMGn1 value
R

www.DataSheet4U.com

502 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

(6) GCCn0, GCCn5 - Timer Gn capture/compare registers of the 2 counters


The GCCn0, GCCn5 registers are 16-bit capture/compare registers of Timer
Gn. These registers are fixed assigned to the counter registers:
• GCCn0 is fixed assigned to timebase TMGn0
• GCCn5 is fixed assigned to timebase TMGn1

Capture mode In the capture register mode, GCCn0 (GCCn5) captures the TMGn0 (TMGn1)
count value if an edge is detected at pin TIGn0 (TIGn5).

Compare mode In the compare register mode, GCCn0 (GCCn5) detects match with TMGn0
(TMGn1) and clears the assigned Timebase. So this “match and clear mode”
is used to reduce the number of valid bits of the counter TMGn0 (TMGn1).

Caution If in Compare Mode write to this registers before POWERn and ENFGnx bit
are "1" at the same time.

Access In capture mode, these registers can be read in 16-bit units.


In compare mode, these registers can be read/written in 16-bit units.
Address GCCn0: <base> + CH
GCCn5: <base> + 16H
Initial Value 0000H. These registers are cleared by any reset.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
GGCn0/GGCn5 value
R/W

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 503


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

(7) GCCn1 to GCCn4 - Timer G capture/compare registers with external


PWW-output function
The GCCn1 to GCCn4 registers are 16-bit capture/compare registers of Timer
Gn. They can be assigned to one of the two counters either TMGn0 or TMGn1.

Capture mode In the capture register mode, these registers capture the value of TMGn0 when
the TBGnm bit (m = 1 to 4) of the TMGCMnH register = 0. When the TBGnm
bit = 1, these registers hold the value of TMGn1.

Compare mode In compare mode, these registers represent the actual compare value and the
TOGnm-Output (m = 1 to 4) can generate a PWW if they are activated.

Access In capture mode, these registers can be read in 16-bit units.


In compare mode, these registers can be read/written in 16-bit units.
Address GCCn1: <base> + EH
GCCn2: <base> + 10H
GCCn3: <base> + 12H
GCCn4: <base> + 14H
Initial Value 0000H. These registers are cleared by any reset.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
GGCn1 to GGCn4 value
R/W

www.DataSheet4U.com

504 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

13.5 Output Delay Operation

When the OLDEn bit is set, different delays of count clock period are added to
the TOGnm pins:
Delay
Output pin
1/fCOUNT
TOGn1 0
TOGn2 1
TOGn3 2
TOGn4 3

The figure below shows the timing for the case where the count clock is set to
fSPCLK0/2. However, 0FFFH is set in GCCn0.

Similar delays are added also when a transition is made from the active to
inactive level. So, a relative pulse width is guaranteed.

f COUNT

TMGCn0 FFFEH FFFFH 0000H 0001H 0002H 0003H 0004H

TOGn1

TOGn2

TOGn3

TOGn4

Figure 13-2 Timing of Output delay operation

In this case the count clock is set to fSPCLK0/2.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 505


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

13.6 Explanation of Basic Operation

(1) Overview of the mode settings


The Timer Gn includes 2 channels of 16-bit counters (TMGn0/TMGn1), which
can operate as independently timebases. TMGn0 (TMGn1) can be set by
CCSGn0 bit (CCSGn5 bit) in the following modes:
• free-run mode
• match and clear mode
When a timer output (TOGnm) or INTCCGnm interrupt is used, one of the two
counters can be selected by setting the TBGnm bit (m = 1 to 4) of the
TMGCMHn register.
The tables below indicate the interrupt output and timer output states
dependent on the register setting values.

Table 13-8 Interrupt output and timer output states dependent on the register
setting values
Register setting value State of each output pin
CCSGn0 TBGnm SWFGnm CCSGnm INTTMGn0 INTCCGn0 INTCCGnm TOGnm
TIm edge
0
0 detection
Tied to inactive
0 1 GCCnm match
Overflow TI0 edge level
Free-run TIm edge
0 interrupt detection
mode detection
1
PWM
1 CMPGm match
(free run)
0
TIm edge
0
0 detection
1 Tied to inactive
1 GCCnm match
Match and Overflow GCCn0 level
clear interruptNote 1 matchNote 2 TIm edge
0
mode detection
1
PWM
1 CMPGm match
(match and clear)

Note 1. An interrupt is generated only when the value of the GCCn0 register is
FFFFH.
2. An interrupt is generated only when the value of the GCCn0 register is not
FFFFH.
3. The setting of the CCSGnm bit in combination with the SWFGnm bit sets
the mode for the timing of the actualization of new compare values.
• In compare mode the new compare value will be immediately active.
• In PWM mode the new compare value will be active first after the next
overflow or match & clear of the assigned counter (TMGn0, TMGn1).

www.DataSheet4U.com

506 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

Table 13-9 Interrupt output and timer output states dependent on the register
setting values
Register setting value State of each output pin
CCSGn5 TBGnm SWFGnm CCSGnm INTTMGn1 INTCCGn5 INTCCGnm TOGnm
TIm edge
0
0 detection
Tied to inactive
0 1 GCCnm match
Overflow TI5 edge level
Free-run TIm edge
0 interrupt detection
mode detection
1
PWM
1 CMPGm match
(free run)
1
TIm edge
0
0 detection
1 Tied to inactive
1 GCCnm match
Match and Overflow GCCn5 level
clear interruptNote 1 matchNote 2 TIm edge
0
mode detection
1
PWM
1 CMPGm match
(match and clear)

Note 1. An interrupt is generated only when the value of the GCCn5 register is
FFFFH.
2. An interrupt is generated only when the value of the GCCn5 register is not
FFFFH.
3. The setting of the CCSGnm bit in combination with the SWFGnm bit sets
the mode for the timing of the actualization of new compare values.
• In compare mode the new compare value will be immediately active.
• In PWM mode the new compare value will be active first after the next
overflow or match & clear of the assigned counter (TMGn0, TMGn1).

13.7 Operation in Free-Run Mode

This operation mode is the standard mode for Timer Gn operations. In this
mode the 2 counter TMGn0 and TMGn1 are counting up from 0000H to
FFFFH, generates an overflow and start again. In the match and clear mode,
which is described in Chapter 13.8 on page 518 the fixed assigned register
GCCn0 (GCCn5) is used to reduce the bit-size of the counter TMGn0
(TMGn1).

(1) Capture operation (free run)


Basic settings:
Bit Value Remark
CCSGn0 0 free run mode
www.DataSheet4U.com CCSGn5 0
SWFGnm 0 disable TOGnm
assign counter
for GCCnm
TBGnm X
0: TMGn0
1: TMGn1

User’s Manual U17566EE5V1UM00 507


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

(a) Example: Pulse width or period measurement of the TIGny input


signal (free run)

Capture setting method:


(1) When using one of the TOGn1 to TOGn4 pins, select the corresponding
counter with the TBGnm bit. When TIGn0 is used, the corresponding
counter is TMGn0. When TIGn5 is used, the corresponding counter is
TMGn1.

(2) Select a count clock cycle with the CSE12 to CSE10 bits (TMGn1) or
CSE02 to CSE02 bits (TMGn0).

(3) Select a valid TIGny edge with the IEGny1 and IEGny0 bits. A rising
edge, falling edge, or both edges can be selected.
(4) Start timer operation by setting POWERn bit and TMGn0E bit for TMGn0
or TMGn1E bit for TMGn1.

Capture operation:
(1) When a specified edge is detected, the value of the counter is stored in
GCCny and an edge detection interrupt (INTCCGny) is output.
(2) When the counter overflows, an overflow interrupt (INTTMGn0 or
INTTMGn1) is generated.

(3) If an overflow has occurred between capture operations, the CCFGny flag
is set when GCCny is read. Correct capture data by checking the value of
CCFGny.

Using CCFGny:
When using GCCny as a capture register, use the procedure below.
<1> After INTCCGny (edge detection interrupt) generation, read the
corresponding GCCny register.

<2> Check if the corresponding CCFGny bit of the TMGSTn register is set.

<3> If the CCFGny bit is set, the counter was cleared from the previous
captured value.
CCFGny is set when GCCny is read. So, after GCCny is read, the value of
CCFGny should be read. Using the procedure above, the value of CCFGny
corresponding to GCCny can be read normally.

Caution If two or more overflows occur between captures, a software-based measure


needs to be taken to count overflow interrupts (INTTMGn0, INTTMGn1).

www.DataSheet4U.com

508 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

fCOUNTx

TM G n0 0000H 0001H D0 D1 FFF FH 0000H D2 D3

C ount sta rt Cl ear

TI Gn0

GCCn0 D0 D1 D2 D3

INTTGnCC0

INTGnOV0

CCFGn0

N o overf low Overf low N o overf low

Figure 13-3 Timing when both edges of TIGn0 are valid (free run)

Note The figure above shows an image. In actual circuitry, 3 to 4 periods of the
count-up signal are required from the input of a waveform to TIGn0 until a
capture interrupt is output.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 509


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

(b) Timing of capture trigger edge detection


The Tin inputs are fitted with an edge-detection and noise-elimination circuit.
Because of this circuit, 3 periods to less than 4 periods of the count clock are
required from edge input until an interrupt signal is output and capture
operation is performed. The timing chart is shown below.
Basic settings (x = 0, 1 and y = 0 to 5):
Bit Value Remark
CSEx2 0
CSEx1 1 Count clock = fSPCLK0/4
CSEx0 0
IEGny1 1
detection of both edges
IEGny0 1

f COUNTx

TMGn0/TMGn1 t t +1 t+2 t+3 t+4 t+5 t+6 t+7 t+8

TIGn0

INTTGnCCy

GCCny t+4 t+7

3 count clock periods

Figure 13-4 Timing of capture trigger edge detection (free run)

www.DataSheet4U.com

510 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

(c) Timing of starting capture trigger edge detection


A capture trigger input signal (TIGny) is synchronized in the noise eliminator
for internal use.
Edge detection starts when 1 count clock period (fCOUNT) has been input after
timer count operation starts. (This is because masking is performed to prevent
the initial TIGny level from being recognized as an edge by mistake.). The
timing chart for starting edge detection is shown below.
Basic settings (x = 0, 1 and y = 0 to 5):
Bit Value Remark
CSEx2 0
CSEx1 1 Count clock = fSPCLK0/4
CSEx0 0
IEGny1 1
detection of both edges
IEGny0 1

Invalid ed ge i nput
E dge de tection s tart

f COUNTx

TM G0E (TM G1 E )

E NFG 0(E NFG1 )

count_up0(count_up1)

TMGn0/TMGn1 00 01H 00 02H 00 03H 00 04H 00 05H 00 06H

TIGny

INTTGnCCy

GCCny 00 05 H

Figure 13-5 Timing of starting capture trigger edge detection

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 511


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

(2) Compare operation (free run)


Basic settings (m = 1 to 4):
Bit Value Remark
CCSGn0 0
free run mode
CCSGn5 0
SWFGnm 0 disable TOGnm
Compare mode for
CCSGnm 1
GCCnm
assign counter
for GCCnm
TBGnm X
0: TMGn0
1: TMGn1

(a) Example: Interval timer (free run)

Setting method interval timer:


(1) An usable compare register is one of GCCn1 to GCCn4, and the
corresponding counter (TMGn0 or TMGn1) must be selected with the
TBGnm bit.

(2) Select a count clock cycle with the CSE12 to CSE10 bits (TMGn1
register) or CSE02 to CSE00 bits (TMGn0 register).

(3) Write data to GCCnm.

(4) Start timer operation by setting POWERn and TMGn0E (or TMGn1E).

Compare Operation:
(1) When the value of the counter matches the value of GCCnm (m = 0 to 4),
a match interrupt (INTCCGnm) is output.

(2) When the counter overflows, an overflow interrupt (INTTMGn0/


INTTMGn1) is generated.

ENFG0
FFFFH FFFFH FFFFH

Ma tch
TM G n0

GCCn1 N

INTTGnCC1

INTTGnOV0
www.DataSheet4U.com

Figure 13-6 Timing of compare mode (free run)

Data N is set in GCCn1, and the counter TMGn0 is selected.

512 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

(b) When the value 0000H is set in GCCnm


INTCCGnm is activated when the value of the counter becomes 0001H.
INTTMGn0/INTTMGn1 is activated when the value of the counter changes
from FFFFH to 0000H.
Note, however, that even if no data is set in GCCnm, INTCCGnm is activated
immediately after the counter starts.

(c) When the value FFFFH is set in GCCnm


INTCCGnm and INTTMGn0/INTTMGn1 are activated when the value of the
counter changes from FFFFH to 0000H.

(d) When GCCnm is rewritten during operation


When GCCn1 is rewritten from 5555H to AAAAH. TMGn0 is selected as the
counter.
The following operation is performed:

ENFG0
Ma tch

TM G n0 Ma tch

Reload in 5 periods

GCCn1 Slave register 5555H AAAAH

GCCn1 Master register 5555H AAAAH

INTTGnCC1

Figure 13-7 Timing when GCCn1 is rewritten during operation (free run)

Caution To perform successive write access during operation, for rewriting the GCCny
register (n = 1 to 4), you have to wait for minimum 7 peripheral clocks periods
(fSPCLK0).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 513


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

(3) PWM output (free run)


Basic settings (m = 1 to 4):
Bit Value Remark
CCSGn0 0
free run mode
CCSGn5 0
SWFGnm 1Note enable TOGnm
Compare mode for
CCSGnm 1Note
GCCnm
assign counter
for GCCnm
TBGnm X
0: TMGn0
1: TMGn1

Note The PWM mode is activated by setting the SWFGnm and the CCSGnm bit to
"1".

PWM setting method:


(1) An usable compare register is one of GCCn1 to GCCn4, and the
corresponding counter must be selected with the TBGnm bit.

(2) Select a count clock cycle with the CSE12 to CSE10 bits (TMGn1
register) or CSE02 to CSE00 bits (TMGn0 register).

(3) Specify the active level of a timer output (TOGnm pin) with the ALVGnm
bit.

(4) When using multiple timer outputs, the user can prevent TOGnm from
becoming active simultaneously by setting the OLDEn bit of TMGMHn
register to provide step-by-step delays for TOGnm. (This capability is
useful for reducing noise and current.)

(5) Write data to GCCnm.

(6) Start timer operation by setting POWERn bit and TMGn0E bit (or
TMGn1E bit).

PWM operation:
(1) When the value of the counter matches the value of GCCnm, a match
interrupt (INTCCGnm) is output.

(2) When the counter overflows, an overflow interrupt (INTTMGn0 or


INTTMGn1) is generated.
(3) TOGnm does not make a transition until the first overflow occurs. (Even if
the counter is cleared by software, TOGnm does not make a transition
until the next overflow occurs. After the first overflow occurs, TOGnm is
activated.

www.DataSheet4U.com
(4) When the value of the counter matches the value of GCCnm, TOGnm is
deactivated, and a match interrupt (INTCCGnm) is output. The counter is
not cleared, but continues count-up operation.

(5) The counter overflows, and INTTMGn0 or INTTMGn1 is output to activate


TOGnm. The counter resumes count-up operation starting with 0000H.

514 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

ENFG0

FFFFH FFFFH FFFFH

Ma tch
TM G n0

GCCn1 N

INTTGnCC1

INTTGnOV0

TOGn1 (ALVG1=1)

TOGn1 (ALVG1=0)

Figure 13-8 Timing of PWM operation (free run)

Data N is set in GCCn1, counter TMGn0 is selected.

(a) When 0000H is set in GCCnm (m = 1 to 4)


When 0000H is set in GCCnm, TOGnm is tied to the inactive level.
The figure below shows the state of TOGn1 when 0000H is set in GCCn1, and
TMGn0 is selected.

ENFG0

FFFFH FFFFH FFFFH

Ma tch
TM G n0
GCCn1
0000H

INTTGnCC1

INTTGnOV0
TOGn1(AL VG 1=1) Low
TOGn1(AL VG 1=0) High

Figure 13-9 Timing when 0000H is set in GCCnm (free run)

www.DataSheet4U.com GCCn1 and TMGn0 are selected.

User’s Manual U17566EE5V1UM00 515


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

(b) When FFFFH is set in GCCnm (m = 1 to 4)


When FFFFH is set in GCCnm, TOGnm outputs the inactive level for one clock
period immediately after each counter overflow (except the first overflow).
The figure shows the state of TOGn1 when FFFFH is set in GCCn1, and
TMGn0 is selected.

ENFG0
Ma tch
FFFFH FFFFH FFFFH

TM G n0

GCCn1 FFFFH

INTTGnCC1

INTTGnOV0

TOGn1(AL VG 1=1)

TOGn1(AL VG 1=0)

Figure 13-10 Timing when FFFFH is set in GCCnm (free run)

GCCn1 and TMGn0 are selected.

www.DataSheet4U.com

516 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

(c) When GCCnm is rewritten during operation (m = 1 to 4)


When GCCn1 is rewritten from 5555H to AAAAH, the operation shown below
is performed.
The figure below shows a case where TMGn0 is selected for GCCn1.

ENFG0

FFFFH FFFFH FFFFH


Ma tch Ma tch
Ma tch
TM G n0

GCCn1 Slave register 5555H AAAAH

GCCn1 Master register 5555H AAAAH

INTTGnCC1

INTTGnOV0

TOGn1(AL VG 1=1) 5555H AAAAH

TOGn1(AL VG 1=0)

Figure 13-11 Timing when GCCnm is rewritten during operation (free run)

GCCn1 and TMGn0 are selected.


If GCCn1 is rewritten to AAAAH after the second INTCCGn1 is generated as
shown in the figure above, AAAAH is reloaded to the GCCn1 register when the
next overflow occurs.
The next match interrupt (INTCCGn1) is generated when the value of the
counter is AAAAH. The pulse width also matches accordingly.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 517


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

13.8 Match and Clear Mode

The match and clear mode is mainly used reduce the number of valid bits of
the counters (TMGn0, TMGn1).
Therefore the fixed assigned register GCCn0 (GCCn1) is used to compare its
value with the counter TMGn0 (TMGn1). If the values match, than an interrupt
is generated and the counter is cleared. Than the counter starts up counting
again.

(1) Capture operation (match and clear)


Basic settings (m = 1 to 4):
Bit Value Remark
CCSGn0 1
match and clear mode
CCSGn5 1
SWFGnm 0 disable TOGnm
CCSGnm 0 Capture mode for GCCnm
assign counter
for GCCnm
TBGnm X
0: TMGn0
1: TMGn1

(a) Example: Pulse width measurement or period measurement of the


TIGnm input signal

Setting method:
(1) When using one of TOGn1 to TOGn4 pin, select the corresponding
counter with the TBGnm bit. When CCSGn0 = 1, TI0 cannot be used.
When CCSGn5 = 1, TIGn5 cannot be used.

(2) Select a count clock cycle with the CSE12 to CSE10 (TMGn1) bits or
CSE02 to CSE00 (TMGn0) bits.

(3) Select a valid TIGnm edge with the IEGnm1 and IEGnm0 bit. A rising
edge, falling edge, or both edges can be selected.

(4) Set an upper limit on the value of the counter in GCCn0 or GCCn5.

(5) Start timer operation by setting POWERn bit and TMGn0E bit (or
TMGn1E bit).

Operation:
(1) When a specified edge is detected, the value of the counter is stored in
GCCnm, and an edge detection interrupt (INTCCGnm) is output.

(2) When the value of GCCn0 or GCCn5 matches the value of the counter,
INTCCGn0 (INTCCGn5) is output, and the counter is cleared. This
operation is referred to as "match and clear".
www.DataSheet4U.com
(3) If a match and clear event has occurred between capture operations, the
CCFGny flag is set when GCCny is read. Correct capture data by
checking the value of CCFGny.

518 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

(b) Example: Capture where both edges of TIGnm are valid (match and
clear)
For the timing chart TMGn0 is selected as the counter corresponding to
TOGn1, and 0FFFH is set in GCCn0.

fCOUNTx

TMGn0 0000H 0001H D0 D1 0FF F H 0000H D2 D3

C ount start Cl ear

TIGn1

GCCn1 D0 D1 D2 D3

INTTGnCC1

INTTGnCC0

CCFG1

No "match and cl ea r" "Match and c lea r" No "match and cl ea r"

Figure 13-12 Timing when both edges of TIGnm are valid (match and clear)

Note The figure above shows an image. In actual circuitry, 3 to 4 periods of the
count-up signal (fCOUNT) are required from the input of a waveform to TOGn1
until a capture interrupt is output. (See Figure 13-4 on page 510.)

Caution If two or more match and clear events occur between captures, a software-
based measure needs to be taken to count INTCCGn0 or INTCCGn5.

(c) When 0000H is set in GCCn0 or GCCn5 (match and clear)


When 0000H is set in GCCn0 (GCCn5), the value of the counter is fixed at
0000H, and does not operate. Moreover, INTCCGn0 (INTCCGn5) continues to
be active.

(d) When FFFFH is set in GCCn0 or GCCn5 (match and clear)


When FFFFH is set in GCCn0 (GCCn5), operation equivalent to the free-run
mode is performed. When an overflow occurs, INTTMGn0 (INTTMGn1) is
generated, but INTCCGn0 (INTCCGn5) is not generated.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 519


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

(2) Compare operation (match and clear)


Basic settings (m = 1 to 4):
Bit Value Remark
CCSGn0 1
match and clear mode
CCSGn5 1
SWFGnm 0 disable TOGnm
Compare mode for
CCSGnm 1
GCCnm
assign counter
for GCCnm
TBGnm X
0: TMGn0
1: TMGn1

(a) Example: Interval timer (match and clear)

Setting Method
(1) An usable compare register is one of GCCn1 to GCCn4, and the
corresponding counter must be selected with the TBGnm bit.
(2) Select a count clock cycle with the CSE12 to CSE10 bits (TMGn1) or
CSE02 to CSE00 bits (TMGn0).

(3) Set an upper limit on the value of the counter in GCCn0 or GCCn5.
(4) Write data to GCCnm.

(5) Start timer operation by setting the POWERn bit and TMGxE bit (x = 0, 1).

Operation:
(1) When the value of the counter matches the value of GCCnm, a match
interrupt (INTCCGnm) is output.

(2) When the value of GCCn0 or GCCn5 matches the value of the counter,
INTCCGn0 (or INTCCGn5) is output, and the counter is cleared. This
operation is referred to as "match and clear".
(3) The counter resumes count-up operation starting with 0000H.

www.DataSheet4U.com

520 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

ENFG0

0FFFH 0FFFH 0FFFH


Ma tch
TM G n0

GCCn1 N

INTTGnCC1

INTTGnCC0

Figure 13-13 Timing of compare operation (match and clear)

In this example, the data N is set in GCCn1, and TMGn0 is selected.


0FFFH is set in GCCn0. Here, N < 0FFFH.

(b) When 0000H is set in GCCn0 or GCCn5 (match and clear)


When 0000H is set in GCCn0 or GCCn5, the value of the counter is fixed at
0000H, and does not operate. Moreover, INTCCGn0 (or INTCCGn5) continues
to be active.

(c) When FFFFH is set in GCCn0 or GCCn5 (match and clear)


When FFFFH is set in GCCn0 or GCCn5, operation equivalent to the free-run
mode is performed. When an overflow occurs, INTTMGn0 (or INTTMGn1) is
generated, but INTCCGn0 (or INTCCGn5) is not generated.

(d) When 0000H is set in GCCnm (m = 1 to 4) (match and clear)


INTCCGnm is activated when the value of the counter becomes 0001H.
Note, however, that even if no data is set in GCCnm, INTCCGnm is activated
immediately after the counter starts.

(e) When a value exceeding the value of GCCn0 or GCCn5 is set in


GCCnm (m = 1 to 4) (match and clear)
INTCCGnm is not generated.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 521


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

(f) When GCCnm (m = 1 to 4) is rewritten during operation (match and


clear)
When the value of GCCn1 is changed from 0555H to 0AAAH, the operation
described below is performed.
TMGn0 is selected as the counter, and 0FFFH is set in GCCn0.

ENFG0
Ma tch

TM G n0 Ma tch

Reload in 5 clock periods

GCCn1 Slave register 0555H 0AAAH

GCCn1 Master register 0555H 0AAAH

INTTGnCC1

Figure 13-14 Timing when GCCnm is rewritten during operation (match and clear)

Caution To perform successive write access during operation, for rewriting the GCCny
register, you have to wait for minimum 7 peripheral clocks periods (fSPCLK0).

(3) PMW output (match and clear)


Basic settings (m = 1 to 4):
Bit Value Remark
CCSGn0 1
match and clear mode
CCSGn5 1
SWFGnm 1Note enable TOGnm
Compare mode for
CCSGnm 1Note
GCCnm
assign counter
for GCCnm
TBGnm X
0: TMGn0
1: TMGn1

Note The PWM mode is activated by setting the SWFGnm and the CCSGnm bit to
www.DataSheet4U.com "1".

522 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

Setting Method:
(1) An usable compare register is one of GCCn1 to GCCn4, and the
corresponding counters TMGn0 or TMGn1 must be selected with the
TBGnm bit (m = 1 to 4).

(2) Select a count clock cycle with the CSE12 to CSE10 (TMGn1) bits or
CSE02 to CSE00 (TMGn0) bits.

(3) Specify the active level of a timer output (TOGnm) with the ALVGnm bit.

(4) When using multiple timer outputs, the user can prevent TOGnm from
making transitions simultaneously by setting the OLDEn bit of TMGMHn
register. (This capability is useful for reducing noise and current.)

(5) Set an upper limit on the value of the counter in GCCn0 or GCCn5.
(Timer Dn 0000H is forbidden)

(6) Write data to GCCnm.

(7) Start count operation by setting POWERn bit and TMGn0E bit (or
TMGn1E bit).

Operation of PWM (match and clear):


(1) When the value of the counter matches the value of GCCnm, a match
interrupt (INTCCGnm) is output.

Caution Do not set 0000H in GCCn0 or GCCn5 in match and clear modus.

(2) When the value of GCCn0 (GCCn5) matches the value of the counter,
INTCCGn0 (INTCCGn5) is output, and the counter is cleared. This
operation is referred to as "match and clear".

(3) TOGnm does not make a transition until the first match and clear event.

(4) TOGnm makes a transition to the active level after the first match and
clear event.

(5) When the value of the counter matches the value of GCCnm, TOGnm
makes a transition to the inactive level, and a match interrupt
(INTCCGnm) is output.

(6) When the next match and clear event occurs, INTCCGn0 (INTCCGn5) is
output, and the counter is cleared. The counter resumes count-up
operation starting with 0000H.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 523


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

Example where the data N is set, and the counter TMGn0 is selected.
0FFFH is set in GCCn0 and N < 0FFFH.

ENFG0

0FFFH 0FFFH 0FFFH


Ma tch
TM G n0

GCCn1 N

INTTGnCC1

INTTGnCC0

TOGn1(ALVG1=1)

TOGn1(ALVG1=0)

Figure 13-15 Timing of PWM operation (match and clear)

When 0000H is set in GCCn0 (GCCn5), the value of the counter is fixed at
0000H, and the counter does not operate. The waveform of INTCCGn0
(INTCCGn5) varies, depending on whether the count clock is the reference
clock or the sampling clock.

(a) When FFFFH is set in GCCn0 or GCCn5 (match and clear)


When FFFFH is set in GCCn0 (GCCn5), operation equivalent to the free-run
mode is performed. When an overflow occurs, INTTMGn0 (INTTMGn1) is
generated, but INTCCGn0 (INTCCGn5) is not generated.

www.DataSheet4U.com

524 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

(b) When 0000H is set in GCCnm (match and clear)


When 0000H is set in GCCnm, TOGnm is tied to the inactive level.
The figure below shows the state of TOGn1 when 0000H is set in GCCn1, and
TMGn0 is selected.
Note, however, that 0FFFH is set in GCCn0.

ENFG0

0FFFH 0FFFH 0FFFH


Ma tch
TM G n0

GCCn1 0000H

INTTGnCC1

INTGnCC0
TOGn1(ALVG1=1) Low

TOGn1(ALVG1=0) High

Figure 13-16 Timing when 0000H is set in GCCnm (match and clear)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 525


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

(c) When the same value as set in GCCn0 or GCCn5 is set in GCCnm
(match and clear)
When the same value as set in GCCn0 (GCCn5) is set in GCCnm, TOGnm
outputs the inactive level for only one clock period immediately after each
match and clear event (excluding the first match and clear event).
The figure below shows the state of TOGn1 when 0FFFH is set in GCCn0 and
GCCn1, and TMGn0 is selected.

ENFG0
Ma tch
0FFFH 0FFFH 0FFFH

TM G n0

GCCn1 0FFFH

INTTGnCC1

INTTGnCC0

TOGn1(ALVG1=1)

TOGn1(ALVG1=0)

Figure 13-17 Timing when the same value as set in GCCn0/GCCn5 is set in GCCnm
(match and clear)

www.DataSheet4U.com

526 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

(d) When a value exceeding the value set in GCCn0 or GCCn5 is set in
GCCnm (match and clear)
When a value exceeding the value set in GCCn0 (GCCn5) is set in GCCnm,
TOGnm starts and continues outputting the active level immediately after the
first match and clear event (until count operation stops.)
The figure shows the state of TOGn1 when 0FFFH is set in GCCn0, 1FFFH is
set in GCCn1, and TMGn0 is selected.

ENFG0

0FFFH 0FFFH 0FFFH

TMGn0

GCCn1 1FFFH

INTTGnCC1 Low

INTTGnCC0

TOGn1(ALVG1=1)

TOGn1(ALVG1=0)

Figure 13-18 Timing when the value of GCCnm exceeding GCCn0 or GCCn5
(match and clear)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 527


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

(e) When GCCnm is rewritten during operation (match and clear)


When GCCn1 is rewritten from 0555H to 0AAAH, the operation shown below is
performed.
The figure below shows a case where 0FFFH is set in GCCn0, and TMGn0 is
selected for GCCn1.

ENFG0

0FFFH 0FFFH 0FFFH


Ma tch
Ma tch
Ma tch
TM G n0

GCCn1 Slave register 0555H 0AAAH

GCCn1 Master register 0555H 0AAAH

INTTGnCC1

INTTGnCC0

TOGn1(ALVG1=1) 0555H 0AAAH

TOGn1(ALVG1=0)

Figure 13-19 Timing when GCCnm is rewritten during operation (match and clear)

If GCCn1 is rewritten to 0AAAH after the second INTCCGn1 is generated as


shown in the figure above, 0AAAH is reloaded to the GCCn1 register when the
next overflow occurs.
The next match interrupt (INTCCGn1) is generated when the value of the
counter is 0AAAH. The pulse width also matches accordingly.

www.DataSheet4U.com

528 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

13.9 Edge Noise Elimination

The edge detection circuit has a noise elimination function. This function
regards:
• a pulse not wider than 1 count clock period as a noise, and does not
detect it as an edge.
• a pulse not shorter than 2 count clock periods is detected normally as an
edge.
• a pulse wider than 1 count clock period but shorter than 2 count clock
periods may be detected as an edge or may be eliminated as noise,
depending on the timing.
(This is because the count-up signal of the counter is used for sampling
timing.) The upper figure below shows the timing chart for performing edge
detection. The lower figure below shows the timing chart for not performing
edge detection.
Basic settings (x = 0, 1 and y = 0 to 5):
Bit Value Remark
CSEx2 0
CSEx1 1 Count clock = fSPCLK0/4
CSEx0 0
IEGny1 1
detection of both edges
IEGny0 1

<Timing chart for performing e dge de tection>

f COUNTx

TMGn0/TMGn1 t t+1 t+2 t+3 t+4 t+5 t+6 t+7

TIGny

INTTGnCCy

GCCny t+4 t+6

<Timing chart for nois e el imination>

f COUNTx

TMGn0/TMGn1 t t+1 t+2 t+3 t+4 t+5 t+6 t+7

TIGny

INTTGnCCy

GCCny
www.DataSheet4U.com

Figure 13-20 Timing of edge detection noise elimination

User’s Manual U17566EE5V1UM00 529


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

13.10 Precautions Timer Gn

(1) When POWERn bit of TMGMHn register is set


The rewriting of the CSEn2 to CSEn0 bits of TMGMHn register is prohibited.
These bits set the prescaler for the Timer Gn counter.

The rewriting of the CCSGny bits (y = 0 to 5) is prohibited.


This bits (OCTLGnL and OCTLGnH registers) set the capture mode or the
compare mode to the GCCy register. For the GCCn0 register and the GCCn5
register these bits (TMGMLn register) set the “free run” or “match and clear”
mode of the TMGn0 and TMGn1 counter.

The rewriting of the TMGCMnL and the TMGCMHn register is prohibited.


These registers configure the counter (TMGn0 or TMGn1) for the GCCnm
register (m = 1 to 4) and define the edge detection for the TIGnm input pins
(falling, rising, both).

Even when POWERn bit is set, TOGnm output is switched by switching the
ALVGnm bit of OCTLGnL and OCTLGnH registers.
These bits configure the active level of the TOGnm pins (m = 1 to 4).

(2) When POWERn bit and TMGxE bit are set (x = 0, 1)


The rewriting of ALVGnm is prohibited (m = 1 to 4).
These bits configure the active level of the TOGnm pins (m = 1 to 4).

When in compare-mode the rewriting of the GCCn0 or GCCn5 register is


prohibited.
In compare mode these registers set the value for the “match and clear” mode
of the TMGn0 and TMGn1 counter.

(3) Functionality
When the POWERn bit is set to “0”, regardless of the SWFGnm bit (OCTLGnL
and OCTLGnH registers), the TOGnm pins are tied to the inactive level.
The SWFGnm bit enables or disables the output of the TOGnm pins. This bit
can be rewritten during timer operation.

The CLRGx bit (x = 0, 1) is a flag. If this bit is read, a "0" is read at all times.

www.DataSheet4U.com
This bit clears the corresponding counter (TMGn0 or TMGn1)

When GCCnm register (m = 1 to 4) are used in capture operation:


If two or more overflows of TMGn0 or TMGn1 occur between captures, a
software-based measure needs to be taken to count overflow interrupts
(INTTMGn0 or INTTMGn1).

530 User’s Manual U17566EE5V1UM00


16-bit Multi-Purpose Timer G (TMG) Chapter 13

If only one overflow is necessary, the CCFGny bits (y = 0 to 5) can be used for
overflow detection.

Only the overflow of the TMGn0 or TMGn1counter clears the CCFGny bit
(TMGSTn register). The software-based clearing via CLRGn0 or CLRGn1 bit
(TMGMLn register) doesn’t affect these bits.
The CCFGny bit is set if a TMGn0 (TMGn1) overflow occurs. This flag is only
updated if the corresponding GCCny register was read, so first read the
GCCny register and then read this flag if necessary.

(4) Timing
The delay of each timer output TOGnm (m = 1 to 4) varies according to the
setting of the count clock with the CSEx2 to CSEx0 bits (x = 0, 1).

In capture operation 3 to 4 periods of the count-clock (fCOUNT) signal are


required from the TIGny pin (y = 0 to 5) until a capture interrupt is output.

When TMGxE (x = 0, 1) is set earlier or simultaneously with POWERn bit, than


the Timer Gn needs 7 peripheral clock periods (fSPCLK0) to start counting.
When TMGxE (x = 0, 1) is set later than POWERn bit, than the Timer Gn
needs 4 peripheral clock periods (fSPCLK0) to start counting.

When a capture register (GCCny) is read, the capturing is disable during read
operation. This is intended to prevent undefined data during reading. So, if a
contention occurs between an external trigger signal and the read operation,
capture operation may be cancelled, and old data may be read.

GCCnm register (m = 1 to 4) in Compare mode:


After setting the POWERn bit you have to wait for 10 peripheral clock periods
(fSPCLK0) to perform write access to the GCCnm register (m = 1 to 4).

To perform successive write access during operation, for rewriting the GCCnm
register, you have to wait for minimum 7 peripheral clock periods (fSPCLK0).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 531


Chapter 13 16-bit Multi-Purpose Timer G (TMG)

www.DataSheet4U.com

532 User’s Manual U17566EE5V1UM00


Chapter 14 16-bit Timer Y (TMY)

Timer Y (TMY) is a two-stage 16-bit timer/counter.

The V850E/Dx3 microcontrollers have following instances of the two-stage 16-


bit timer/counter TMY:

TMY All devices


Instances 1
Names TMY0

Throughout this chapter, the individual instances of TMY are identified by “n”,
for example, TMYn, or TYnCTL for the TMYn control register.

14.1 Overview

Each Timer Y has two down-counters. They are named counter 0 and
counter 1 and operate alternately. When counter 0 reaches zero, it starts
counter 1 and waits until counter 1 expires. When counter 1 reaches zero, it
restarts counter 0.
The TMY can be used as:
• Generator of a pulse width modulated (PWM) signal
• Generator of a pulse and frequency modulated (PFM) signal
• Interval timer
• Free running timer

Features summary Special features of the TMY are:


• One of six clocks can be selected, individually for each of the two counters
• Two reload registers, one for each counter
• Four readable counter registers, two for each counter
• One timer output pin
• When the device is in debug mode, the timer can be stopped at breakpoint

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 533


Chapter 14 16-bit Timer Y (TMY)

14.1.1 Description

The TMY is built up as illustrated below.

Internal bus

TYnCTL TYnIOC
TYCKS12 TYCKS11 TYCKS10 TYCKS02 TYCKS01 TYCKS00 TYnR0 TYOL

TYnCNT01 TYnCNT00 Reload buffer

Reload INTTYnUV0
TYnCTL.TYCE

SPCLK1 (8 MHz) Clear


16-bit down counter S
Selector

Output control
SPCLK3 (2 MHz) TYnCNT0 Q

Selector
TYnCTL.TYCE
SPCLK4 (1 MHz) CE
TOYn
SPCLK5 (500 KHz) CE
SPCLK6 (250 KHz) 16-bit down counter Q
TYnCNT1 R
TYnCTL.TYCE Clear

TYnCTL.TYCE
TYnCTL.TYCE
Reload INTTYnUV1

TYnCNT11 TYnCNT10 Reload buffer

TYnR1

Internal bus

Figure 14-1 Block diagram of Timer Y (TMYn)

The control register TYnCTL is used to choose the clock sources for the two
counters and to enable the timer. The latter is done by setting bit
TYnCTL.TYnCE to 1.
The output pin TOYn provides the generated PWM or PFM signal. By default,
the high-level time of that signal is determined by counter 1, the low-level time
is determined by counter 0. However, the signal polarity can be inverted.

www.DataSheet4U.com

534 User’s Manual U17566EE5V1UM00


16-bit Timer Y (TMY) Chapter 14

14.1.2 Principle of Operation

When TMYn is enabled, the down-counter 0 starts counting as soon as a non-


zero value is written to the reload register TYnR0 and copied to the associated
reload buffer.
When counter 0 reaches zero, it generates the maskable interrupt
INTTYnUV0, reloads its start value from its reload buffer, and starts counter 1.
In the figure above, this is indicated by the CE (count enable) feedback
connection. After that, counter 0 waits for counter 1 to finish.

Note In order to avoid unintended timing of the output signal during the start-up
phase, counter 1 needs a non-zero start value before counter 0 expires
(underflows).

When counter 1 expires, it generates the maskable interrupt INTTYnUV1,


reloads its start value from the reload buffer of register TYnR1, and restarts
counter 0.
Four read-only registers provide the updated counter values. For details about
these registers refer to “TYnCNTm0 - TMYn synchronized counter registers“
on page 537 and “TYnCNTm1 - TMYn non-synchronized counter registers“ on
page 538
The output pin generates a rectangular signal that reflects the running times of
both counters. The signal polarity can be chosen.

14.2 Registers

The timers Y are controlled and operated by means of the following registers:

Table 14-1 TMYn registers overview


Register name Shortcut Address
Timer Y synchronized counter 0 read register TYnCNT00 <base>
Timer Y non-synchronized counter 0 read register TYnCNT01 <base> + 2H
Timer Y synchronized counter 1 read register TYnCNT10 <base> + 4H
Timer Y non-synchronized counter 1 read register TYnCNT11 <base> + 6H
Timer Y counter 0 reload register TYnR0 <base> + 8H
Timer Y counter 1 reload register TYnR1 <base> + AH
Timer Y I/O control register TYnIOC <base> + CH
Timer Y control register TYnCTL <base> + DH

Table 14-2 TMYn register base address


www.DataSheet4U.com Timer Base address
TMY0 FFFF F580H

User’s Manual U17566EE5V1UM00 535


Chapter 14 16-bit Timer Y (TMY)

(1) TYnCTL - TMYn timer control register


The 8-bit TYnCTL register controls the operation of the Timer Y.
Access This register can be read/written in 8-bit or 1-bit units.
Address <base> + DH
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
TYnCE 0 TYnCKS12 TYnCKS11 TYnCKS10 TYnCKS02 TYnCKS01 TYnCKS00
R/W R R/W R/W R/W R/W R/W R/W

Table 14-3 TYnCTL register contents


Bit position Bit name Function
7 TYnCE Timer Y counter enable:
0: Disable count operation (the timer stops immediately with the count values
0000H and does not operate).
1: Enable count operation (the timer starts when a non-zero start value is
written to the register TYnR0 after TYnCTL.TYnCE = 1).
5 to 0 TYnCKSm[2:0] Selects the clock of counter 0 and 1
TYnCKSm2 TYnCKSm1 TYnCKSm0 Counter clock selection

0 0 0 SPCLK1 (8 MHz)

0 1 0 SPCLK3 (2 MHz)

0 1 1 SPCLK4 (1 MHz)

1 0 0 SPCLK5 (500 KHz)

1 0 1 SPCLK6 (250 KHz)

Others than above Setting prohibited

Note 1. m = 0 identifies counter 0; m = 1 identifies counter 1.


2. Change bits TYnCTL.TYnCKSm[2:0] only when TYnCTL.TYnCE = 0.

www.DataSheet4U.com

536 User’s Manual U17566EE5V1UM00


16-bit Timer Y (TMY) Chapter 14

(2) TYnIOC - TMYn I/O control register


The TYnIOC register is an 8-bit register that controls the polarity of the timer
output signal.
Access This register can be read/written in 8-bit or 1-bit units.
Address <base> + CH
Initial Value 00H. This register is cleared by any reset and by TynCTL.TYnCE = 0.

7 6 5 4 3 2 1 0
0 0 0 0 TYnOL 0 0 0
R R R R R/W R R R

Table 14-4 TYnIOC register contents


Bit Position Bit Name Function
3 TYnOL Timer Y output level control:
0: Normal: Counter 0 generates a rising edge upon underflow, counter 1 a falling
edge.
1: Inverted: Counter 0 generates a falling edge upon underflow, counter 1 a rising
edge.

Note Change TYnIOC.TYnOL only when the timer is enabled (TYnCTL.TYnCE = 1).

(3) TYnCNTm0 - TMYn synchronized counter registers


The TYnCNTm0 register is the synchronized register that can be used to read
the value of the corresponding 16-bit counter m.

Note m = 0 identifies counter 0; m = 1 identifies counter 1.

“Synchronized” means that the read access via the internal bus is
synchronized with the maximum counter clock (SPCLK1). The synchronization
process may cause a delay, but the resulting value is reliable.
Access This register is read-only, in 16-bit units.
Address TYnCNT00: <base> of TMYn
TYnCNT10: <base> + 4H
Initial Value 0000H. This register is cleared by any reset and when TYnCTL.TYnCE = 0.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Updated counter value (synchronized)
R

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 537


Chapter 14 16-bit Timer Y (TMY)

(4) TYnCNTm1 - TMYn non-synchronized counter registers


The TYnCNTm1 register is the non-synchronized read register that can be
used to read the present value of the concerned 16-bit counter m.

Note m = 0 identifies counter 0; m = 1 identifies counter 1.

“Non-synchronized” means that the read access via the internal bus is not
synchronized with the counter clock. The read operation returns the
instantaneous value immediately, with the risk that this value is just being
updated by the counter and therefore in doubt.
Access This register is read-only, in 16-bit units.
Address TYnCNT01: <base> + 2H
TYnCNT11: <base> + 6H
Initial Value 0000H. This register is cleared by any reset and when TYnCTL.TYnCE = 0.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Instantaneous counter value (non-synchronized)
R

Note The value read from this register can be incorrect, because the read access is
not synchronized with the counter clock.
Therefore, this register shall be read multiple times within one period of the
counter clock cycle.
If the difference between the first and the second value is not greater than one,
you can consider the second value to be reliable. If the difference between the
two values is greater than one, you have to read the register a third time and
compare the third value with the second. Again, the difference must not be
greater than one.
If the read accesses do not happen within one period of the counter clock
cycle, the difference between the last two values will usually be greater than
one. In this case, you can only repeat the procedure or estimate the updated
counter value.

www.DataSheet4U.com

538 User’s Manual U17566EE5V1UM00


16-bit Timer Y (TMY) Chapter 14

(5) TYnRm - TMYn reload registers


The TYnRm registers are two 16-bit registers for setting the reload value of the
corresponding counters.

Note m = 0 identifies counter 0; m = 1 identifies counter 1.

Access These registers can be read/written in 16-bit units.


Address TYnR0: TMYn <base> + 8H
TYnR1: TMYn <base> + AH
Initial Value 0000H. This register is cleared by any reset and when bit TYnCTL.TYnCE = 0.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Down-counter load value
R/W

Note 1. TYnRm can only be written when bit TYnCTL.TYnCE = 1.


2. To start the counters, the reload values for TYnR0 and TYnR1 must be
greater than 1 (0002H … FFFFH).
3. To operate the timers in free running mode, set TYnRm to FFFFH.
4. If the registers have been cleared, it is recommended to set TYnR1 first
and then TYnR0.
5. Once TMYn is enabled, its counter 0 starts as soon as a non-zero start
value is written to register TYnR0. If this value is small (or the counter
frequency high), counter 0 may quickly expire and start counter 1.
If counter 1 has no start value at this point of time, it will simply wait until it
gets one. This may lead to an unexpected initial delay of the output signal.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 539


Chapter 14 16-bit Timer Y (TMY)

14.3 Timing

You can change the contents of the reload registers TYnRm at any time,
provided TYnCTL.TYnCE is 1. However, the counters reload their start values
when it reaches 0.
The following figure illustrates the timer operation.

D00 D00
D02

TYnCNT0
D01 D01 D01

0000H
Underflow

D10 D10
TYnCNT1 D11 D11 D11

0000H Underflow

TYnR0 D00 D01 D02

TYnR1 D10 D11 D12

TYOn

INTYnUV0

INTYnUV1

Figure 14-2 Timer Y Timing

D00, D01, and D02 are the load values for counter 0.
D10, D11, and D12 are the load values for counter 1.
The figure shows at which point in time the counters load their start values and
www.DataSheet4U.com
how they alternate. The output signal at pin TOYn is shown in normal mode (bit
TYnIOC.TYnOL = 0).

540 User’s Manual U17566EE5V1UM00


16-bit Timer Y (TMY) Chapter 14

14.4 Output Timing Calculations

This section provides information on how to calculate the output pulse duration
under various conditions.

Caution When specifying SPCLK3, SPLCK4, SPCLK5 or SPCLK6 as the count clock, a
jitter of maximum ± 1 period of SPCLK1 may be applied to the TYnCNT0 and
TYnCNT1 counter’s count clock input.

The first interval, that means the time until the first underflow, after starting the
counters can vary by one count clock period. Therefore, different equations are
given for the first and all other intervals, where applicable.

The following symbols are used:


TC0 (TC1) : Running time of counter 0 (1)
TPWM : Total PWM interval duration

TPWM01 (TPWM10) : PWM pulse length between INTTZnUV0 and


INTTZnUV1 (INTTZnUV1 and INTTZnUV0)
[TYnR0], [TYnR1] : Contents of TYnR0 (TYnR1), legal range 0001H
to FFFFH (1 to 65535)
[TYnCKS0], [TYnCKS1] : Contents of TYnCTL[2:0] (TYnCTL[5:3]), legal
range 0 to 5

(1) Counter running times

Running time of counter 0 (TC0) and counter 1 (TC1):


• First interval:

([TYnR0] × 2[TYnCKS0]) x 1/fSPCLK1 ≤TC0


≤(([TYnR0] + 1) × 2[TYnCKS0]) x 1/fSPCLK1

([TYnR1] × 2[TYnCKS1]) x 1/fSPCLK1 ≤TC1


≤(([TYnR1] + 1) × 2[TYnCKS1]) x 1/fSPCLK1
• All following intervals:

TC0 = (([TYnR0] + 1) × 2[TYnCKS0]) x 1/fSPCLK1

TC1 = (([TYnR1] + 1) × 2[TYnCKS1]) x 1/fSPCLK1

Example If [TYnR0] = 255 and [TYnCKS0] = 5, it takes 8192 periods of SPCLK1 until
counter 0 expires, i.e. 1024 ms with fSPCLK1 = 8 MHz
www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 541


Chapter 14 16-bit Timer Y (TMY)

(2) Total PWM interval length


TPWM is the time between two interrupts INTTZnUV0 (or INTTZnUV1).

If both counters use the same clock ([TYnCKS0] = [TYnCKS1]):


• First interval:

(([TYnR0] + [TYnR1]) × 2[TYnCKS0]) x 1/fSPCLK1 ≤TPWM


≤(([TYnR0] + [TYnR1] + 2) × 2[TYnCKS0]) x 1/fSPCLK1
• All following intervals:

TPWM = (([TYnR0] + [TYnR1] + 2) × 2[TYnCKS0]) x 1/fSPCLK1 =


(TC0 + TC1) x 1/fSPCLK1

Ι f both counters use different clocks:

([TYnR0] × 2[TYnCKS0] + [TYnR1]) × 2[TYnCKS1] + 2) x 1/fSPCLK1 ≤TPWM


≤(([TYnR0] + 1) × 2[TYnCKS0] + ([TYnR1] + 1) × 2[TYnCKS1] + 4) x 1/
fSPCLK1

(3) Pulse width TPWM01 between INTTYnUV0 and INTTYnUV1


If both counters use the same clock ([TYnCKS0] = [TYnCKS1]):
• First interval:

([TYnR1] × 2[TYnCKS1]) x 1/fSPCLK1 ≤TPWM01


≤(([TYnR1] + 1) × 2[TYnCKS1]) x 1/fSPCLK1
• All following intervals:

TPWM01 = ([TYnR1] + 1) × 2[TYnCKS1]


If both counters use different clocks:

([TYnR1] × 2[TYnCKS1] + 1) x 1/fSPCLK1 ≤TPWM01


≤(([TYnR1] + 1) × 2[TYnCKS1] + 2) x 1/fSPCLK1

Example If [TYnR1] = 255 and [TYnCKS1] = 2, then

– [TYnR1] × 2[TYnCKS1] = 1020


– ([TYnR1] + 1) × 2[TYnCKS1] = 1024
– TPWM01 is between 1021 and 1026 periods of SPCLK1, i.e. between
127,625 µs and 128,5 µs with fSPCLK1 = 8 MHz

(4) Pulse width TPWM10 between INTTYnUV1 and INTTYnUV0


If both counters use the same clock ([TYnCKS0] = [TYnCKS1]):
www.DataSheet4U.com
• First interval:

([TYnR0] × 2[TYnCKS0]) x 1/fSPCLK1 ≤TPWM10


≤(([TYnR0] + 1) × 2[TYnCKS0]) x 1/fSPCLK1

542 User’s Manual U17566EE5V1UM00


16-bit Timer Y (TMY) Chapter 14

• All following intervals:

TPWM10 = (([TYnR0] + 1) × 2[TYnCKS0]) x 1/fSPCLK1


If both counters use different clocks:

([TYnR0] × 2[TYnCKS0] + 1) x 1/fSPCLK1 ≤TPWM10


≤(([TYnR0] + 1) × 2[TYnCKS0] + 2) x 1/fSPCLK1

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 543


Chapter 14 16-bit Timer Y (TMY)

www.DataSheet4U.com

544 User’s Manual U17566EE5V1UM00


Chapter 15 Watch Timer (WT)

The Watch Timer (WT) generates interrupts at regular time intervals. These
interrupts are generally used as ticks for updating the internal daytime and
calendar.
The Watch Timer includes two identical counters. Throughout this chapter, the
counters are identified as WTn, where n = 0 to 1.

15.1 Overview

The Watch Timer consists of two 16-bit down-counters, WT0 and WT1, and
includes the Watch Calibration Timer WCT.
WT0 The load value that must be set for WT0 depends on the chosen clock
frequency and the desired time interval between two interrupts.
For example, WT0 can be set up to generate an interrupt every second
(INTWT0UV).
During normal operation, the clock of WT0 (WTCLK) is directly derived from
the precision main oscillator. It bypasses the PLL and SSCG.
However, the WTCLK can also be derived from the sub or internal oscillator.
This is useful if the main oscillator is switched off in order to save power.
WT1 WT1 is clocked by the interrupts generated by WT0. It can, for example,
generate an interrupt every hour (or whatever wake-up time is required).
This interrupt (INTWT1UV) can be used to escape from Sub-WATCH mode
and hence to revive the main oscillator if necessary.
WCT The sub or internal oscillators used in Sub_WATCH mode are not as stable as
the main oscillator. The time between two WT0 interrupts may be slightly
shorter or longer than desired.
Therefore a third timer - the Watch Calibration Timer (WCT) - can be used
occasionally to measure the time between two interrupts INTWT0UV.
WCT requires the main oscillator clock for this measurement. Its clock,
WCTCLK, always stops if the main oscillator stops, that means if STOP mode
or Sub-WATCH mode are entered.
Based on the measurement result, a new load value for WT0 can be
calculated. This is the solution to regain precise intervals between WT0
interrupts. After the adjustment of WT0, the system can return to Sub-WATCH
mode where the main oscillator is stopped.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 545


Chapter 15 Watch Timer (WT)

Features summary Special features of the Watch Timer are:


• Periodic interrupts (clock ticks) generated by two down-counters
• Two reload registers, one for each counter
• Choice of oscillators to reduce power consumption in stand-by mode
• Can operate in all power save modes
• Clock correction in stand-by mode by means of the Watch Calibration Timer
• In debug mode, the counters WT0 and WT1 can be stopped at breakpoint

Special features of the Watch Calibration Timer are:


• 16-bit counter register TM00
• 16-bit capture / compare register CR001
• Capture / trigger input for INTWT0UV with edge specification for INTWT0UV
interval measurement
• Capture / match interrupt request signal INTTM01

www.DataSheet4U.com

546 User’s Manual U17566EE5V1UM00


Watch Timer (WT) Chapter 15

15.1.1 Description

The following figure shows the structure of the Watch Timer and its connection
to the Watch Calibration Timer.

Internal bus

Watch WT0R WT1R


Timer

WT0CNT1 WT0CNT0 Reload buffer WT1CNT1 WT1CNT0 Reload buffer

Reload Reload

16-bit down-counter 16-bit down-counter INTWT1U


WTCLK
WT0 WT1 (long interval)

WT0CTL.CE WT1CTL.CE

INTWT0U
(short interval)

INTWT0U

Watch Calibration
Mode selector

Timer
Edge
CR001
detector INTTM01

on match
PRM00.ES00[1:0]

16-bit up-counter
WCTCLK TMC00.TMC00[3:2]
TM00

Internal bus

Figure 15-1 Watch Timer configuration

As shown in the figure, WT0 is clocked by WTCLK, a clock generated by the


Clock Generator. When WT0 counts down to zero, it generates the INTWT0UV
interrupt.
WT1 is clocked by the interrupts INTWT0UV. When WT1 reaches zero, it
generates the interrupt INTWT1UV.
Two control registers WTnCTL are used to enable the counters. This is done
by setting WTnCTL.WTCE to 1.
As soon as the counters are enabled, it is possible to write a start value to the
reload registers WT0R and WT1R.

WCT is a capture/compare timer. In this application, it measures the time


between two INTWT0UV interrupts. It is clocked by WCTCLK, another clock
generated by the Clock Generator.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 547


Chapter 15 Watch Timer (WT)

15.1.2 Principle of operation

In order to generate an interrupt every one or two seconds, WTCLK is usually


set to a frequency around 30 KHz. Then, a load value around 215 will yield a
running time of about 1 s.

(1) Operation control of WT0


The source and frequency of WTCLK are specified in the Clock Generator
register TCC.
The Clock Generator contains a programmable frequency divider that makes it
possible to scale down the selected clock source.

Note WTCLK uses the same clock source and clock divider as the LCD Controller/
Driver clock LCDCLK. The frequency fWTCLK can be the same as fLCDCLK or
fLCDCLK / 2. For details refer to “Clock Generator“ on page 139.

Typical settings and the resulting maximum time interval between two
interrupts are listed in the table below.

Table 15-1 Typical Settings of WTCLK


Clock source Clock divider setting WTCLK Frequency Max. period of INTWT0UVa
4 MHz main osc. 1 / 128 31.25 KHz 2.097 s
32 kHz sub osc. 1 32.768 KHz (typ.) 2.0 s
240 kHz internal osc. 1/8 30 KHz (typ.) 2.184533 s
a)
The maximum period corresponds to a counter load value of 216 – 1.

Note that you can double the maximum period by setting TCC.WTSEL1 to 1.
The clock input can be disabled (WT0CTL.WTCE = 0). This stops the Watch
Timer. After reset, the timer is also stopped.
When WT0 is enabled and a non-zero reload value is specified, the counter
decreases with every rising edge of WTCLK. When the counter reaches zero,
the interrupt INTWT0UV is active high for one clock cycle. Upon undeflow, i.e.
with the next clock, the timer reloads its start value and resumes down-
counting. The load value can be freely chosen

(2) Operation of WT1


Once WT1 is enabled and a non-zero reload value is specified, its counter
decreases with every interrupt INTWT0UV.
When WT1 reaches zero, it generates the interrupt INTWT1UV. Upon
undeflow, i.e. with the next clock, the timer reloads its load value and restarts
down-counting. The load value can be freely chosen.
Starting WT1 requires some attention. For further details refer to “Watch Timer
start-up“ on page 555.

www.DataSheet4U.com

548 User’s Manual U17566EE5V1UM00


Watch Timer (WT) Chapter 15

(3) Operation of WCT


The third counter WCT is used for clock correction. This counter is connected
to PCLK1 (8 MHz) or directly to the 4 MHz main oscillator. It is used to
measure the time between two INTWT0UV requests.
For this measurement, WCT is configured as a capture timer.
Once it is enabled, the WCT counter is increased with every rising edge of its
clock. When the value FFFFH is reached, the counter sets a flag and restarts
with 0000H.
The interrupt INTWT0UV from counter WT0 triggers the capture operation. At
every INTWT0UV, the count value is captured, and the interrupt INTTM01 is
generated. From the counter difference between two consecutive capture
events, the accuracy of the WTCLK can be measured, and WT0 or WT1,
respectively, can be corrected.
The WCT can be programmed to restart counting after the capture operation.

Note The WCT detects the valid edge of INTWT0UV by sampling its input signal
(the INTWT0UV interrupt line) with WCTCLK. The capture operation is only
performed if the same level after a valid edge is detected two times in series.
As a consequence, the time interval measurement will only work correctly if
fWTCLK < fWCTCLK / 2.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 549


Chapter 15 Watch Timer (WT)

15.2 Watch Timer Registers

The Watch Timer counters WT0 and WT1 are controlled and operated by
means of the following registers:

Table 15-2 WTn registers overview


Register name Shortcut Address
Watch timer synchronized read register WTnCNT0 <base>
Watch timer non-synchronized read register WTnCNT1 <base> + 2H
Watch timer reload register WTnR <base> + 4H
Watch timer control register WTnCTL <base> + 6H

Table 15-3 WTn register base addresses


Timer Base address
WT0 FFFF F560H
WT1 FFFF F570H

(1) WTnCTL - WTn timer control register


The 8-bit WTnCTL register controls the operation of the timer WTn.
Access This register can be read/written in 8-bit or 1-bit units.
Address <base> + 6H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
WTCE 0 0 0 0 0 0 0
R/W R R R R R R R

Table 15-4 WTnCTL register contents


Bit position Bit name Function
7 WTCE Watch timer counter enable:
0: Disable count operation (the timer stops immediately with the count value
0000H and does not operate).
1: Enable count operation.

Note 1. If WTnCTL.WTCE is 1, the counter starts after the counter's load value has
been written to the reload register WTnR. As long as WTnR is zero, no
counting is performed, and no interrupts INTWTnUV are generated.
2. The first interval from counter start to the first underflow takes at least four
clock cycles more than the following intervals. For details refer to “Watch
www.DataSheet4U.com Timer start-up“ on page 555.

550 User’s Manual U17566EE5V1UM00


Watch Timer (WT) Chapter 15

(2) WTnCNT0 - WTn synchronized counter register


The WTnCNT0 register is the synchronized register that can be used to read
the present value of the 16-bit counter.
“Synchronized” means that the read access via the internal bus is
synchronized with the counter clock. The synchronization process causes a
delay, but the resulting value is reliable.
Access This register is read-only, in 16-bit units.
Address <base> of WTn
Initial Value 0000H. This register is cleared by any reset and if WTnCTL.WTCE = 0.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Updated counter value (synchronized)
R

Note Due to the low frequencies of the counter clocks, the synchronization can take
about up to two WTCLK. For a quick response, it is recommended to read the
non-synchronized counter register WTnCNT1.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 551


Chapter 15 Watch Timer (WT)

(3) WTnCNT1 - WTn non-synchronized counter read register


The WTnCNT1 register is the non-synchronized register that can be used to
read the present value of the corresponding 16-bit counter.
“Non-synchronized” means that the read access via the internal bus is not
synchronized with the counter clock. It returns the instantaneous value
immediately, with the risk that this value is just being updated by the counter
and therefore in doubt.
Access This register is read-only, in 16-bit units.
Address <base> + 2H
Initial Value 0000H. This register is cleared by any reset and if WTnCTL.WTCE = 0.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Instantaneous counter value (non-synchronized)
R

Note The value read from this register can be incorrect, because the read access is
not synchronized with the counter clock.
Therefore, this register shall be read multiple times within one period of the
counter clock cycle.
If the difference between the first and the second value is not greater than one,
you can consider the second value to be correct. If the difference between the
two values is greater than one, you have to read the register a third time and
compare the third value with the second. Again, the difference must not be
greater than one.
If the read accesses do not happen within one period of the counter clock
cycle, the difference between the last two values will be greater than one. In
this case, you can only repeat the procedure or estimate the updated counter
value.
Reading the counter value via WTnCNT1 instead of WTnCNT0 is only
reasonable if the CPU clock is remarkably higher than WTCLK and the
overhead of multiple reading WTnCNT1 is justifiable.

www.DataSheet4U.com

552 User’s Manual U17566EE5V1UM00


Watch Timer (WT) Chapter 15

(4) WTnR - WTn reload register


The WTnR register is a dedicated register for setting the reload value of the
corresponding counter.
Access This register can be read/written in 16-bit units.
Address <base> + 4H
Initial Value 0000H. This register is cleared by any reset and if WTnCTL.WTCE = 0.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Down-counter load value
R/W

Note 1. WTnR can only be written if WTnCTL.WTCE = 1 (counter enabled).


2. The load value must be non-zero (0001H …FFFFH).
3. The contents of this register is automatically copied to the reload buffer.
The counters load their values from the respective buffers at underflow.
To ensure correct operation, this register shall not be written twice within
three cycles of the counter clock. A second write attempt within that time
span is ignored.
This time span of three cycles of the counter clock is stalled and not
cleared if WTnCTL.WTCE is cleared to 0. After restarting the counter by
setting WTnCTL.WTCE back to 1, the time span will continue to elapse,
but the counter will not be started automatically.
4. The value read from WTnR is the target start value. It is not necessarily
identical with the current start value that is stored in the reload buffer. The
buffer may not yet be updated.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 553


Chapter 15 Watch Timer (WT)

15.3 Watch Timer Operation

This section describes the operation of the Watch Timer counters in detail.

15.3.1 Timing of steady operation

The contents of the reload registers WTnR can be changed at any time,
provided the corresponding counter is enabled. The contents is then copied to
the reload buffer. The counters WTn reload their start value from the buffer
upon underflow.
This is illustrated in the following figure.

D0 D0 D0

16-bit down D1 D1
counter value

0000H

Reload buffer D0 D1 D0

WTnR D0 D1 D0

INTWTnUV

Figure 15-2 Reload timing and interrupt generation

D0 and D1 are two different reload values.


Note also that there is a delay between writing to WTnR and making the data
available in the reload buffer, depending on the previous reload value and the
chosen count clock.

www.DataSheet4U.com

554 User’s Manual U17566EE5V1UM00


Watch Timer (WT) Chapter 15

15.3.2 Watch Timer start-up

The first interval after starting WT0 and WT1 until their first underflow takes at
least four additional input clock cycles. At this point in time, the values of the
counter registers WTnCNT are not correct.
After the first automatic reload of the WTnR value, the counter registers
WTnCNT hold the correct number of clock cycles since the last underflow.
In the following, the start-up procedure of WT1 is described, because of its
higher relevance from an application point of view. However, all statements
refer also to WT0.
Start-up timing Starting WT1 correctly requires some attention in order to avoid wrong
calculation of the watch time.
If WT1 is used as an extended Watch Timer counter, two steps in the following
order are required:
• The counter has to be enabled by setting WT1CTL.WTCE = 1.
• The counter's reload register WT1R has to be set to a non-zero value.
Both actions consume a different amount of input clock cycles to become
effective, as shown in the following diagram.

INTWT0UV
INTWT0UV
0 1 2 3 4 5 6 7 8 9
S/W counter

WT1CTL.WTCE=1

WT1R WT1R = 0 WT1R > 0

stopped started
WT1 start
WTCE validation WT1R validation

Figure 15-3 WT1 start-up timing

To start the counter in a deterministic way, the above actions have to be


synchronized to the WT1 input clock, which is INTWT0UV. For that purpose it
is recommended to maintain a software counter that is increased inside the
INTWT0UV interrupt service routine. By this means, it is ensured that the
actions are performed at the correct point in time.

Setting WT1CTL.WTCE to 1 enables WT1. The write access can happen at


any time. Due to internal clock synchronization, it takes at least five complete
input clock cycles, that means four INTWT0UV intervals (WTCE validation time
0 –> 1 –> 2 –> 3 –> 4) to become effective. After that, WT1 is prepared to
acknowledge the reload value.
S/W counter state “4” indicates that the reload value can be written now
(WT1R > 0). This time, at least three complete input clock cycles (WTR1
www.DataSheet4U.com validation time 5 –> 6 –> 7 –>8) are required to take over the reload value from
WT1R to the reload buffer and to start counting. At S/W counter state “8” the
counter WT1CNT is preloaded with the WT1R contents.

User’s Manual U17566EE5V1UM00 555


Chapter 15 Watch Timer (WT)

As a consequence, register WT1CNT does not show the correct number of


INTWT0UV events after WT1R > 0, but a value of four less:
– 1 INTWT0UV cycle 4 –> 5 taken for the cycle WT1R is written
– 3 INTWT0UV cycles 5 –> 6 –> 7 –> 8 for WT1R validation time

The above calculation assumes that WT1R is written within one INTWT0UV
cycle, which is highly probable, considering INTWT0UV to be the "one second
tick".
However, it may happen that the write to WT1R is delayed because of other
circumstances (nested interrupts, DMA transfers, etc.) and may happen after
S/W counter state 3.
Thus, WT1 would start later, since the 3 clock WTR1 validation time is
maintained.
In order to recognize that situation, read the WT1CNT1 register and compare
its contents with the value written to WT1R. If both are equal, WTR1 has been
written before S/W counter state 3, add four when reading WT1CNT. If they are
not equal check again at next INTWT0UV and add the proper number of
correction cycles.

www.DataSheet4U.com

556 User’s Manual U17566EE5V1UM00


Watch Timer (WT) Chapter 15

15.4 Watch Calibration Timer Registers

The Watch Calibration Timer is controlled by means of the following registers:

Table 15-5 WCT registers overview


Register name Shortcut Address
WCT timer / counter read register TM00 <base>
WCT capture / compare register CR001 <base> + 4H
WCT mode control register TMC00 <base> + 6H
WCT prescaler mode register PRM00 <base> + 7H
WCT capture / compare control register CRC00 <base> + 8H

Table 15-6 WCT register base address


Timer Base address
WCT FFFF F5E0H

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 557


Chapter 15 Watch Timer (WT)

(1) TMC00 - WCT mode control register


The 8-bit TMC00 register controls the operation of the WCT.
Access This register can be read/written in 8-bit or 1-bit units.
Address <base> + 6H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 TMC003 TMC002 0 OVF00
R R R R R/W R/W R R/W

Table 15-7 TMC00 register contents


Bit position Bit name Function
3 to 2 TMC00[3:2] Operation mode selection:
TMC003 TMC002 Operating mode

0 0 Stop mode

Free-running mode. Generates interrupt on match


0 1
between TM00 and CR001.
1 x Setting prohibited.

0 OVF00 Counter overflow indicator:


0: No overflow
1: Overflow occurred

Note 1. If an attempt is made to change the setting of TMC00[3:2] while the timer is
running, these bits are cleared and the timer is stopped. If the timer is
stopped, you can change the operation mode.
2. The OVF00 bit is set if the counter reaches FFFFH and once more if the
counter continues with 0000H. Clearing OVF00 within that time has no
effect.

www.DataSheet4U.com

558 User’s Manual U17566EE5V1UM00


Watch Timer (WT) Chapter 15

(2) PRM00 - WCT prescaler mode register


The 8-bit PRM00 register is used to select the “valid edge” of INTWT0UV for
interval measurements.
Access This register can be read/written in 8-bit or 1-bit units.
Address <base> + 7H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 ES001 ES000 0 0 0 0
R R R/W R/W R R R R

Table 15-8 PRM00 register contents


Bit position Bit name Function
5 to 4 ES00[1:0] Edge selection:
ES001 ES000 Valid edge

0 0 Falling edge

0 1 Rising edge

1 0 Setting prohibited

1 1 Both rising and falling edges

All other bits are initialized as zero and must not be changed.

Note 1. If both edges of INTWT0UV are specified as valid, INTWT0UV interval


measurement is not possible.
2. Stop the timer before changing ES00[1:0].

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 559


Chapter 15 Watch Timer (WT)

(3) CRC00 - WCT capture / compare control register


The 8-bit CRC00 register controls the operation of the capture/compare
register CR001.
Access This register can be read/written in 8-bit or 1-bit units.
Address <base> + 8H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 0 CRC002 0 0
R R R R R R/W R/W R/W

Table 15-9 CRC00 register contents


Bit position Bit name Function
2 CRC002 Selects the operation mode of CR001:
0: Operates as a compare register.
1: Operates as capture register.

Note 1. Stop the timer before changing the contents of this register.
2. If both the rising edge and falling edge are specified as valid for the
INTWT0UV signal, the interval measurement does not work.
3. Be sure to set bits 7 to 3 and 1 to 0 to 0.

www.DataSheet4U.com

560 User’s Manual U17566EE5V1UM00


Watch Timer (WT) Chapter 15

(4) CR001 - WCT capture / compare register 1


The 16-bit CR001 register can be used as a capture register or as a compare
register. Whether it is used as a capture register or compare register is
specified in bit CRC00.CRC002.
• Compare mode:
In compare mode, the value written to CR001 is continually compared with
the count value of TM00. If the two values match, the interrupt request
INTTM01 is generated.
• Capture mode:
In capture mode, the count value of TM00 is copied to CR001 upon a valid
edge of INTWT0UV. Then, the interrupt INTTM01 is generated.
The valid edge of INTWT0UV can be selected as a capture trigger. The valid
edge is specified in PRM00.ES00[1:0].
In capture mode, a read access to register CR001 is not synchronized with
the counter operation. Read access and register update can occur
simultaneously. If that happens, CR001 holds the correct value, but the
value read is undefined.

Access In compare mode, this register can be read/written in 16-bit units. In capture
mode, it cannot be written.
Address <base> + 4H
Initial Value 0000H. This register is cleared by any reset.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Compare or captured value (captured from TM00)
R(W)

Note Stop the timer before changing the contents of this register.

(5) TM00 - WCT timer / counter read register


The TM00 register can be used to read the present value of the 16-bit up-
counter.
The counter is increased with every rising edge of the input clock. If the
counter value is read while the counter is running, input of the count clock is
temporarily stopped, and the counter value at this point is read.

Access This register is read-only, in 16-bit units.


Address <base>
Initial Value 0000H. This register is cleared by any reset, if the counter is stopped
(TMC00.TMC00[3:2] = 0), and if the counter is in INTWT0UV interval
measurement mode and a valid edge of INTWT0UV is detected.

www.DataSheet4U.com 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Counter value
R

If the counter overflows, it sets the flag TMC00.OVF00 to 1 and continues with
0000H.

User’s Manual U17566EE5V1UM00 561


Chapter 15 Watch Timer (WT)

15.5 Watch Calibration Timer Operation

The Watch Calibration Timer WCT is used to measure the time between two
successive occurrences of the Watch Timer WT0 underflow interrupt
INTWT0UV.
The WCT is supplied with the stable clock WCTCLK:
• WCTCLK = 4 MHz main oscillator, if PSM.CMODE = 1
• WCTCLK = 8 MHz PCLK1, if PSM.CMODE = 0
For further details refer to “Clock Generator“ on page 139.
The measured INTWT0UV interval time gives an indication about the accuracy
of the sub or internal oscillator. A correction value can be calculated to
calibrate WT0 and WT1 by changing their reload values.
The interval measurement can be performed in the WCT free-running
operating mode.
If a timer overflow can occur during the interval measurement, take care for
regarding also the overflow flag TMC00.OVF00 for calculating the interval
correctly.

The timer operating as a free-running counter performs following actions upon


detection of a the valid edge of INTWT0UV:
• it copies the present counter value of register TM00 to CR001,
• it generates the interrupt request INTTM01.
The valid edge (rising edge, falling edge) is specified in register PRM00. If both
edges are specified, CR001 cannot perform a capture operation.

Setup example TMC00 = 0000 0100B: Free running mode


CRC00 = 0000 0100B: CR001 as capture register with
INTWT0UV as capture signal
PRM00.ES00[1:0] = 01B: Rising edge
The following figure is not to scale but illustrates the operation.

www.DataSheet4U.com

562 User’s Manual U17566EE5V1UM00


Watch Timer (WT) Chapter 15

TWCTCLK

WCTCLK

TM00 0000H 0001H D0 D0 + 1 D1 D1 + 1 FFFFH 0000H D2 D3

INTWT0UV

CR001 D0 D1 D2 D3

INTTM01

OVF00

(D1 − D0) × TWCTCLK (10000H − D1 + D2) × TWCTCLK (D3 − D2) × TWCTCLK

Figure 15-4 Timing in free-running mode

As shown in the figure, the interrupt INTTM01 can be used as a trigger for
reading the register CR001.
The interval duration must be calculated from the difference between the
present and the previous value of CR001.

Note If TM00 overflows between two occurrences of INTWT0UV, that means


between two capture triggers, the overflow flag TMC00.OVF00 is set.
Therefore, check also TMC00.OVF00 when reading the second capture value
in order to calculate the interval correctly, because an overflow may happen
during the measurement.
Consider the chosen periods for INTWT0UV and of WCTCLK.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 563


Chapter 15 Watch Timer (WT)

www.DataSheet4U.com

564 User’s Manual U17566EE5V1UM00


Chapter 16 Watchdog Timer (WDT)

The Watchdog Timer is used to escape from a system deadlock or program


runaway. If it is not restarted within a certain time, the Watchdog Timer flows
over and interrupts or even resets the microcontroller.

16.1 Overview

The Watchdog Timer contains an up-counter that is driven by the Watchdog


Timer clock WDTCLK. This clock can be derived from the main oscillator, the
internal oscillator, or the sub oscillator. It’s frequency can be identical with the
frequency of the source clock or a fraction thereof.

Features summary The Watchdog Timer


• can generate the non-maskable interrupt NMIWDT
• can generate a hardware reset by means of the internal signal RESWDT

• has a programmable running time (set in terms of 2n multiples of WDTCLK


periods)
• is specially protected against inadvertent setup changes

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 565


Chapter 16 Watchdog Timer (WDT)

16.1.1 Description

The following figure shows a simplified block diagram.

Internal bus

SYSRES reset reset


WDCS WDCS2 WDCS1 WDCS0 WDTM RUN WDTMODE SYSRESWDT
SYSRESWDT

clear 220 / WDTCLK

WDTCLK Counter/Timer
219 / WDTCLK
218 / WDTCLK

217 / WDTCLK Runtime selector overflow Output NMIWDT


control
216 / WDTCLK RESWDT
circuit
15 /
2 WDTCLK

14 /
2 WDTCLK

213 / WDTCLK

Figure 16-1 Block diagram of the Watchdog Timer

As shown in the figure, the WDCS register controls the running time and the
WDTM register the operating mode.

The running time can be chosen between 213 and 220 times the period of the
Watchdog Timer clock WDTCLK.
The figure shows also, that the run and mode settings of the WDTM register
are only cleared by SYSRESWDT.

16.1.2 Principle of operation

Before the Watchdog Timer is started, its running time and mode have to be
configured.
The Watchdog Timer has two operating modes:
• Mode 0 (generate non-maskable interrupt NMIWDT)
• Mode 1 (generate reset request RESWDT)
The mode is defined by the bit WDTM.WDTMODE. The mode can only be
changed after SYSRESWDT, that means, after external RESET or Power-On
Clear.

www.DataSheet4U.com (1) Watchdog Timer mode 0 (generate non-maskable interrupt NMIWDT)


If WDTM.WDTMODE is 0, the Watchdog Timer is in interrupt-request mode.
This is the default after initialization.
Setting bit WDTM.RUN to 1 starts the counter. Without intervention, the timer
will now run until the specified time has elapsed and then generate the non-
maskable interrupt NMIWDT. After that, the counter is reset to zero and starts
counting again.

566 User’s Manual U17566EE5V1UM00


Watchdog Timer (WDT) Chapter 16

(2) Watchdog Timer mode 1 (generate reset request RESWDT)


If WDTM.WDTMODE is 1, the Watchdog Timer is in reset-request mode.
Setting bit WDTM.RUN to 1 starts the counter. Without intervention, the timer
will now run until the specified time has elapsed and then generate the internal
RESWDT signal. After that, the counter operation is stopped until the system
reset SYSRES or SYSRESWDT occurs.

(3) Watchdog Timer running


Once it is running, the Watchdog Timer cannot be stopped by software. It can
only be stopped by the reset signal SYSRESWDT. This signal is generated by
the Reset module at power-on and external RESET.
The way to prevent the timer from flowing over is writing to the register WDTM
before the specified time has elapsed. The write access resets the counter to
zero.

16.1.3 Watchdog Timer clock

The Watchdog Timer clock WDTCLK is generated by the Clock Generator. It


can be derived from the main, internal or sub oscillator.
The generation of WDTCLK is controlled by the WCC register of the Clock
Generator.
In this register, it is possible to choose the main, sub, or internal oscillator as
the clock source (WCC.SOSCW, WCC.WDTSEL0).
You can also choose a suitable frequency divider between 1 and 128
(WCC.WPS[2:0]).
WDTCLK is subject to a stand-by mode control. WDTCLK can optionally be
stopped in IDLE, WATCH, Sub-WATCH and STOP mode (WCC.WDTSEL1).
Please refer to “Clock Generator“ on page 139 for further details.

Note Once the timer has been started, do not switch off the selected clock source of
WDTCLK.

When the microcontroller is in HALT mode, the Watchdog Timer remains


active.
The activity in the other power save modes can be specified by the
WCC.WDTSEL1 control bit. By default (WCC.WDTSEL1 = 0), WDTCLK stops
during IDLE, WATCH, Sub-WATCH and STOP mode.
With WCC.WDTSEL1 = 1 WDTCLK operates as long as the selected clock
source operates.
When the WDTCLK resumes operation, the Watchdog Timer is not reset but
continues counting. To prevent a quick and unexpected overflow, it is
recommended to write to WDTM and thus clear the Watchdog Timer counter
before entering one of these power save modes.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 567


Chapter 16 Watchdog Timer (WDT)

16.1.4 Reset behavior

The reset of the Watchdog Timer is controlled by the two reset inputs SYSRES
and SYSRESWDT. The respective signals are generated by the Reset module.
Every reset sets the WDCS register to the longest possible running time.
SYSRESWDT The watchdog reset SYSRESWDT is used to initialize the Watchdog Timer.
This signal is generated at power-on and after external RESET.
After SYSRESWDT, all registers are set to their reset values, and the timer is
stopped. You have to write the required settings to the WDCS register and may
start the counter. Once the counter has been started, it cannot be
reprogrammed or stopped unless the next reset (SYSRES or SYSRESWDT)
occurs.
SYSRES SYSRES is generated by all reset sources.
SYSRES does not reset the register WDTM. That means, the timer status
(running or stopped) and mode (generate interrupt or reset request) remain
unchanged.
If the Watchdog Timer was running before SYSRES was released, the counter
is automatically cleared and restarts with the new timing.

Note 1. Every reset clears also the WCC register. That means, the WDTCLK has
the frequency of the 240 kHz internal oscillator. In combination with the
largest time factor (220), this yields a running time of 4.37 s.
2. After any reset, the write protection for WDCS is disabled. WDCS can be
written once to specify a shorter time interval. After that, the WDCS
register is write-protected.

www.DataSheet4U.com

568 User’s Manual U17566EE5V1UM00


Watchdog Timer (WDT) Chapter 16

16.2 Watchdog Timer Registers

The Watchdog Timer is controlled by means of the following registers:

Table 16-1 Watchdog Timer registers overview


Register name Shortcut Address
Watchdog Timer clock selection register WDCS <base>
Watchdog Timer command protection register WCMD <base> + 2H
Watchdog Timer mode register WDTM <base> + 4H
Watchdog Timer command status register WPHS <base> + 6H

The registers WDCS and WDTM are protected against accidental changes. A
special write procedure, employing the WCMD register, ensures that these
registers are not easily rewritten in case of a program hang-up.
Their contents can only be changed after a reset.
In addition, the registers are write-protected when the timer is running. Their
protection status is indicated in the WDTM register.

Table 16-2 WDT register base address


Timer Base address
WDT FFFF F590H

Note Only byte access is supported for the registers WDCS, WCMD and WDTM.
The registers are allocated at even addresses. Thus, they cannot be written by
a consecutive byte write sequence or a consecutive half word or word write
sequence.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 569


Chapter 16 Watchdog Timer (WDT)

(1) WDCS - WDT clock selection register


The 8-bit WDCS register is used to specify the running time of the Watchdog
Timer.
Access This register can be read/written in 8-bit or 1-bit units.
Writing to this register is protected by a special sequence of instructions.
Please refer to “WCMD - WDT command protection register“ on page 573 for
details.
Address <base>
Initial Value 07H. This register is initialized by SYSRESWDT and SYSRES.

7 6 5 4 3 2 1 0
WDCS2 WDCS1 WDCS0
R R R R R R/W R/W R/W

Table 16-3 WDCS register contents


Bit Position Bit Name Function
2 to 0 WDCS[2:0] Specifies the running time of the Watchdog Timer
WDCS2 WDCS1 WDCS0 Running time calculation

0 0 0 213 / fWDTCLK

0 0 1 214 / fWDTCLK

0 1 0 215 / fWDTCLK

0 1 1 216 / fWDTCLK

1 0 0 217 / fWDTCLK

1 0 1 218 / fWDTCLK

1 1 0 219 / fWDTCLK

1 1 1 220 / fWDTCLK

Note The WDCS register must be considered in conjunction with the WCC register
of the Clock Generator. The source and frequency of WDTCLK are defined in
the WCC register.

www.DataSheet4U.com

570 User’s Manual U17566EE5V1UM00


Watchdog Timer (WDT) Chapter 16

The running time depends on the frequency of the chosen clock. The following
table shows two examples for 4 MHz and 32 KHz.
Table 16-4 Running time examples
Time until overflow
WDCS2 WDCS1 WDCS0 Calculation fWDTCLK = 4 MHz (main fWDTCLK = 32 KHz (sub
oscillator) oscillator)
0 0 0 213 / fWDTCLK 2 ms 256 ms
0 0 1 214 / fWDTCLK 4.1 ms 512 ms
15
0 1 0 2 / fWDTCLK 8.2 ms 1.02 s
0 1 1 216 / fWDTCLK 16.4 ms 2.05 s
1 0 0 217 / fWDTCLK 32.8 ms 4.10 s
18 /
1 0 1 2 fWDTCLK 65.5 ms 8.20 s
1 1 0 219 / fWDTCLK 131 ms 16.38 s
1 1 1 220 / fWDTCLK 262 ms 32.77 s

These are just two examples for WDTCLK. The actual clock signal depends on
the clock divider settings and the external oscillator resonators.

Note Every reset sets the WDCS register to 07H, which means the longest time
interval.
After SYSRESWDT, the timer is always stopped and initialized. You can write a
smaller value to the register.
After SYSRES, the WDTM register is not cleared. If the Watchdog Timer was
running before SYSRES occurred, it remains active. To specify a shorter
interval:
1. Write one byte to the WCMD register (the value is ignored)
2. Immediately after that, write one byte with the desired value of WDCS[2:0]
to the WDCS register

The write operation resets the watchdog counter to zero, and it continues with
the new timing.

Note When the timer is active, WDCS can only be written once after reset. Then, the
register is locked until the next reset occurs (WDTM.LOCK_CS = 1).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 571


Chapter 16 Watchdog Timer (WDT)

(2) WDTM - WDT mode register


This register sets the operating mode of the Watchdog Timer and enables or
disables counting.
When the Watchdog Timer is running and shall not overflow, it is necessary to
write to WDTM before the specified running time has elapsed.
Access This register can be read/written in 8-bit units. Once the Watchdog Timer is
started (WDTM.RUN = 1), the contents of this register cannot be changed.
Writing to this register is protected by a special sequence of instructions.
Please refer to “WCMD - WDT command protection register“ on page 573 for
details.
Address <base> + 4H
Initial Value 00H. This register is cleared by SYSRESWDT. This stops the timer and
unlocks the registers. The register remains unchanged after SYSRES.
7 6 5 4 3 2 1 0
RUN LOCK_TM LOCK_CS 0 WDTMODE 0 0 0
R/W R R R R/W R R R

Table 16-5 WDTM register contents


Bit Position Bit Name Function
7 RUN Watchdog Timer running:
0: Timer stopped
1: Timer running (with the time interval specified in register WDCS)
6 LOCK_TM WDTM register protection status:
0: Register unlocked
1: Register locked (write-protected)
5 LOCK_CS WDCS register protection status:
0: Register unlocked
1: Register locked (write-protected)
3 WDTMODE Watchdog Timer operation mode:
0: Mode 0: Generates the non-maskable interrupt NMIWDT upon overflow
1: Mode 1: Generates RESWDT upon overflow

Note After SYSRESWDT, the timer is always stopped and initialized. You can
change the register contents by writing.
When the timer is running, you can also write to this register, but the write
operation does not change the register contents (WDTM.LOCK_TM = 1).
When the timer is running, the write access resets the counter.
To write to the WDTM register:
1. Write one byte to the WCMD register (the value is ignored).
2. Immediately after that, write one byte to the WDTM register (the value is
ignored).

With this procedure, restarting the counter is always possible, regardless of the
www.DataSheet4U.com register’s write protection status.

572 User’s Manual U17566EE5V1UM00


Watchdog Timer (WDT) Chapter 16

(3) WCMD - WDT command protection register


The 8-bit WCMD register is write-only. It is used to protect the WDTM and
WDCS registers from unintended writing.
Access This register can be written in 8-bit units.
Address <base> + 2H
Initial Value Undefined
7 6 5 4 3 2 1 0
x x x x x x x x
W W W W W W W W

Any data written to this register is ignored. Only the write action is monitored.
After writing to the WCMD register, you are permitted to write once to one of
the protected registers. This must be done immediately after writing to the
WCMD register. If the second write action does not follow immediately, the
protected registers are write-locked again. See also “Write Protected
Registers“ on page 135.
With this method, the protected registers can only be rewritten in a specific
sequence. Illegal write access to a protected register is inhibited.
The following registers are protected:
• WDCS: Watchdog clock selection register
• WDTM: Watchdog mode control register

An invalid write attempt to one of the above registers sets the error flag
WPHS.WPRERR. WPHS.WPRERR is also set, if a write access to WCMD is
not followed by an access to one of the protected registers.
Data read from the WCMD register is undefined.

Caution In case a high level programming language is used, make sure that the
compiler translates the two write instructions to WCMD and the protected
register into two consecutive assembler “store” instructions.

w w w . D a t a S h e e t 4 U . c o m

User’s Manual U17566EE5V1UM00 573


Chapter 16 Watchdog Timer (WDT)

(4) WPHS - WDT command status register


The WPHS register monitors the success of a write instruction to the WDTM
and WDCS registers.
If the write operation to WDTM or WDCS failed because WCMD was not
written immediately before writing to WDTM or WDCS, the WPRERR flag is
set.
Access This register can be read/written in 8-bit or 1-bit units. After a write access, the
register is cleared.
Address <base> + 6H
Initial Value 00H. This register is cleared by SYSRESWDT and any write access.

7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 WPRERR
R R R R R R R R

Table 16-6 WPHS register contents


Bit Position Bit Name Function
0 WPRERR Error flag:
0: No WDTM or WDCS register writing error has occurred
1: A WDTM or WDCS register writing error has occurred

www.DataSheet4U.com

574 User’s Manual U17566EE5V1UM00


Chapter 17 Asynchronous Serial Interface (UARTA)

The V850E/Dx3 microcontrollers have following instances of the universal


Asynchronous Serial Interface UARTA:

UARTA All devices


Instances 2
Names UARTA0 to UARTA1

Throughout this chapter, the individual instances of UARTA are identified by


“n”, for example, UARTAn, or UAnCTL0 for the UARTAn control register 0.

17.1 Features

• Transfer rate: 300 bps to 1000 kbps (using dedicated baud rate generator)
• Full-duplex communication:
– Internal UARTA receive data register n (UAnRX)
– Internal UARTA transmit data register n (UAnTX)
• 2-pin configuration:
– TXDAn: Transmit data output pin
– RXDAn: Receive data input pin
• Reception error output function
– Parity error
– Framing error
– Overrun error
• Interrupt sources: 3
– Reception complete interrupt (INTUAnR):
This interrupt occurs upon transfer of receive data from the shift register
to receive buffer register n after serial transfer completion, in the reception
enabled status.
– Transmission enable interrupt (INTUAnT):
This interrupt occurs upon transfer of transmit data from the transmit
buffer register to the shift register in the transmission enabled status.
– Receive error interrupt (INTUAnRE):
This interrupt occurs upon transfer of erroneous receive data.
• Character length: 7, 8 bits
www.DataSheet4U.com • Parity function: Odd, even, 0, none
• Transmission stop bit: 1, 2 bits
• On-chip dedicated baud rate generator
• MSB-/LSB-first transfer selectable
• Transmit/receive data inverted input/output possible

User’s Manual U17566EE5V1UM00 575


Chapter 17 Asynchronous Serial Interface (UARTA)

• 13 to 20 bits selectable for the SBF (Sync Break Field) in the LIN (Local
Interconnect Network) communication format
– Recognition of 11 bits or more possible for SBF reception in LIN
communication format
– SBF reception flag provided
• DMA support
Two different DMA trigger events in transmission mode (refer to “DMA
Controller (DMAC)“ on page 349)

17.2 Configuration

The block diagram of the UARTAn is shown below.

Internal bus
INTUAnT
INTUAnR
INTUAnRE
Reception unit Transmission unit
UAnRX UAnTX

Receive shift Transmit


Reception Transmission shift register
register
controller controller

Filter Baud rate Baud rate


Selector TXDAn
generator generator

Selector RXDAn

PCLK1 (8MHz)
selector

PCLK2 (4MHz)
Clock

PCLK8 (62.5kHz)
UAnCTL1
UAnCTL0 UAnSTR UAnOPT0
UAnCTL2

Internal bus

Figure 17-1 Block diagram of Asynchronous Serial Interface UARTAn

Note For the configuration of the baud rate generator, see Figure 17-11 on
page 599.

UARTAn consists of the following hardware units.


www.DataSheet4U.com

576 User’s Manual U17566EE5V1UM00


Asynchronous Serial Interface (UARTA) Chapter 17

(1) UARTAn control register 0 (UAnCTL0)


The UAnCTL0 register is an 8-bit register used to specify the UARTAn
operation.

(2) UARTAn control register 1 (UAnCTL1)


The UAnCTL1 register is an 8-bit register used to select the input clock for the
UARTAn.

(3) UARTAn control register 2 (UAnCTL2)


The UAnCTL2 register is an 8-bit register used to control the baud rate for the
UARTAn.

(4) UARTAn option control register 0 (UAnOPT0)


The UAnOPT0 register is an 8-bit register used to control serial transfer for the
UARTAn.

(5) UARTAn status register (UAnSTR)


The UAnSTRn register consists of flags indicating the error contents when a
reception error occurs. Each one of the reception error flags is set (to 1) upon
occurrence of a reception error and is reset (to 0) by reading the UAnSTR
register.

(6) UARTAn receive shift register


This is a shift register used to convert the serial data input to the RXDAn pin
into parallel data. Upon reception of 1 byte of data and detection of the stop bit,
the receive data is transferred to the UAnRX register.
This register cannot be manipulated directly.

(7) UARTAn receive data register (UAnRX)


The UAnRX register is an 8-bit register that holds receive data. When
7 characters are received, 0 is stored in the highest bit (when data is received
LSB first).
In the reception enabled status, receive data is transferred from the UARTAn
receive shift register to the UAnRX register in synchronization with the
completion of shift-in processing of 1 frame.
Transfer to the UAnRX register also causes the reception complete interrupt
request signal (INTUAnR) to be output.

(8) UARTAn transmit shift register


The transmit shift register is a shift register used to convert the parallel data
transferred from the UAnTX register into serial data.
When 1 byte of data is transferred from the UAnTX register, the shift register
data is output from the TXDAn pin.
This register cannot be manipulated directly.

(9) UARTAn transmit data register (UAnTX)


www.DataSheet4U.com The UAnTX register is an 8-bit transmit data buffer. Transmission starts when
transmit data is written to the UAnTX register. When data can be written to the
UAnTX register (when data of one frame is transferred from the UAnTX
register to the UARTAn transmit shift register), the transmission enable
interrupt request signal (INTUAnT) is generated.

User’s Manual U17566EE5V1UM00 577


Chapter 17 Asynchronous Serial Interface (UARTA)

17.3 UARTA Registers

The asynchronous serial interfaces UARTAn are controlled and operated by


means of the following registers:

Table 17-1 UARTAn registers overview

Register name Shortcut Address


UARTAn control register 0 UAnCTL0 <base>
UARTAn control register 1 UAnCTL1 <base> + 1H
UARTAn control register 2 UAnCTL2 <base> + 2H
UARTAn option control register 0 UAnOPT0 <base> + 3H
UARTAn status register UAnSTR <base> + 4H
UARTAn receive data register UAnRX <base> + 6H
UARTAn transmit data register UAnTX <base> + 7H

Table 17-2 UARTAn register base address


Timer Base address
UARTA0 FFFF FA00H
UARTA1 FFFF FA10H

www.DataSheet4U.com

578 User’s Manual U17566EE5V1UM00


Asynchronous Serial Interface (UARTA) Chapter 17

(1) UAnCTL0 - UARTAn control register 0


The UAnCTL0 register is an 8-bit register that controls the UARTAn serial
transfer operation.
Access This register can be read/written in 8-bit or 1-bit units.
Address <base>
Initial Value 10H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
UAnPWR UAnTXE UAnRXE UAnDIR UAnPS1 UAnPS0 UAnCL UAnSL
R/W R/W R/W R/W R/W R/W R/W R/W

Table 17-3 UAnCTL0 register contents (1/2)

Bit position Bit name Function


7 UAnPWR UARTAn operation disable/enable:
0: Disable UARTAn operation and reset the UARTAn asynchronously
1: Enable UARTAn operation
The UARTAn operation is controlled by the UAnPWR bit. The TXDAn pin output
is fixed to high level by clearing the UAnPWR bit to 0 (fixed to low level if
UAnOPT0.UAnTDL bit = 1).
6 UAnTXE Transmit operation disable/enable:
0: Disable transmit operation
1: Enable transmit operation
• To start transmission, set the UAnPWR bit to 1 and then set the UAnTXE bit
to 1.
• To stop transmission, clear the UAnTXE bit to 0 and then the UAnPWR bit to
0.
• To initialize the transmission unit, clear UAnTXE bit to 0, wait for two cycles
of the base clock, and then set UAnTXE bit to 1 again. Otherwise,
initialization may not be executed.
5 UAnRXE Receive operation disable/enable:
0: Disable receive operation
1: Enable receive operation
• To start reception, set the UAnPWR bit to 1 and then set the UAnRXE bit to
1.
• To stop reception, clear the UAnRXE bit to 0 and then the UAnPWR bit to 0.
• To initialize the reception unit, clear UAnRXE bit to 0, wait for two cycles of
the base clock, and then set UAnRXE bit to 1 again. Otherwise, initialization
may not be executed.
4 UAnDIR Transfer direction mode specification (MSB/LSB):
0: MSB first transfer
1: LSB first transfer

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 579


Chapter 17 Asynchronous Serial Interface (UARTA)

Table 17-3 UAnCTL0 register contents (2/2)

Bit position Bit name Function


3, 2 UAnPS[1:0] Parity selection
Parity selection during
UAnPS1 UAnPS0
transmission reception
0 0 No parity output Reception with no parity
0 1 0 parity output Reception with 0 parity
1 0 Odd parity output Odd parity check
1 1 Even parity output Even parity check
• This register is rewritten only when the UAnPWR bit = 0 or the UAnTXE bit =
the UAnRXE bit = 0.
• If “Reception with 0 parity” is selected during reception, a parity check is not
performed.
Therefore, since the UAnSTR.UAnPE bit is not set, no error interrupt is
output.
• When transmission and reception are performed in the LIN format, clear the
UAnPS1 and UAnPS0 bits to 00.
1 UAnCL Specification of data character length of 1 frame of transmit/receive data
0: 7 bits
1: 8 bits
This register can be rewritten only when the UAnPWR bit = 0 or the UAnTXE bit
=
the UAnRXE bit = 0.
0 UAnSL Specification of length of stop bit for transmit data
0: 1 bit
1: 2 bits
This register can be rewritten only when the UAnPWR bit = 0 or the UAnTXE bit
= the UAnRXE bit = 0.

Note For details of parity, see “Parity types and operations“ on page 597.

(2) UAnCTL1 - UARTAn control register 1


The UAnCTL1 register is an 8-bit register used to select the input clock for the
UARTAn.
For details, see “UAnCTL1 - UARTAn control register 1“ on page 600.

(3) UAnCTL2 - UARTAn control register 2


The UAnCTL2 register is an 8-bit register used to control the baud rate for the
UARTAn.
For details, see “UAnCTL2 - UARTAn control register 2“ on page 601.

www.DataSheet4U.com

580 User’s Manual U17566EE5V1UM00


Asynchronous Serial Interface (UARTA) Chapter 17

(4) UAnOPT0 - UARTAn option control register 0


The UAnOPT0 register is an 8-bit register that controls the serial transfer
operation of the UARTAn register.
Access This register can be read/written in 8-bit or 1-bit units.
Address <base> + 3H
Initial Value 14H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
UAnSRF UAnSRT UAnSTT UAnSBL2 UAnSBL1 UAnSBL0 UAnTDL UAnRDL
R/W R/W R/W R/W R/W R/W R/W R/W

Table 17-4 UAnOPT0 register contents (1/2)

Bit position Bit name Function


7 UAnSRF SBF reception flag:
0: When the UAnCTL0.UAnPWR bit = UAnCTL0.UAnRXE bit = 0 are set.
Also upon normal end of SBF reception.
1: During SBF reception
• SBF (Sync Brake Field) reception is judged during LIN communication.
• The UAnSRF bit is held at 1 when an SBF reception error occurs, and then
SBF reception is started again.
6 UAnSRT SBF reception trigger:
0: –
1: SBF reception trigger
• This is the SBF reception trigger bit during LIN communication, and when
read, “0” is always read. For SBF reception, set the UAnSRT bit (to 1) to
enable SBF reception.
• Set the UAnSRT bit after setting the UAnPWR bit = UAnRXE bit = 1.
5 UAnSTT SBF transmission trigger:
0: –
1: SBF transmission trigger a
• This is the SBF transmission trigger bit during LIN communication, and
when read, “0” is always read.
• Set the UAnSTT bit after setting the UAnPWR bit = UAnTXE bit = 1.
4 to 2 UAnSBL[2:0] SBF transmission length selection:
UAnSBL2 UAnSBL1 UAnSBL0 SBF transmission length
1 0 1 13-bit output (default value)
1 1 0 14-bit output
1 1 1 15-bit output
0 0 0 16-bit output
0 0 1 17-bit output
0 1 0 18-bit output
0 1 1 19-bit output
1 0 0 20-bit output
www.DataSheet4U.com
This register can be set when the UAnPWR bit = 0 or when the UAnTXE bit = 0.

User’s Manual U17566EE5V1UM00 581


Chapter 17 Asynchronous Serial Interface (UARTA)

Table 17-4 UAnOPT0 register contents (2/2)

Bit position Bit name Function


1 UAnTDL Transmit data level bit
0: Normal output of transfer data
1: Inverted output of transfer data
• The output level of the TXDAn pin can be inverted using the UAnTDL bit.
• This register can be set when the UAnPWR bit = 0 or when the UAnTXE bit
= 0.
0 UAnRDL Receive data level bit
0: Normal input of transfer data
1: Inverted input of transfer data
• The output level of the RXDAn pin can be inverted using the UAnRDL bit.
• This register can be set when the UAnPWR bit = 0 or the UAnRXE bit = 0.
a)
Before starting the SBF transmission by UAnOPT0.UAnSTT = 1 make sure that no data transfer is ongoing,
that means check that UAnSTR.UAnTSF = 0.

(5) UAnSTR - UARTAn status register


The UAnSTR register is an 8-bit register that displays the UARTAn transfer
status and reception error contents.
Access This register can be read or written in 8-bit or 1-bit units.
Address <base> + 4H
Initial Value 00H. This register is cleared by any reset.

The initialization conditions are shown below.

Register/Bit Initialization conditions


UAnSTR register • Reset
• UAnCTL0.UAnPWR = 0
UAnTSF bit • UAnCTL0.UAnTXE = 0
UAnPE, UAnFE, UAnOVE bits • 0 write
• UAnCTL0.UAnRXE = 0

7 6 5 4 3 2 1 0
UAnTSF 0 0 0 0 UAnPE UAnFE UAnOVE
a a
R R/W R/W R/W R/W R/W R/W R/Wa
a) These bits can only be cleared by writing, They cannot be set by writing 1 (even if
1 is written, the value is retained).

www.DataSheet4U.com

582 User’s Manual U17566EE5V1UM00


Asynchronous Serial Interface (UARTA) Chapter 17

Table 17-5 UAnSTR register contents

Bit position Bit name Function


7 UAnTSF Transfer status flag:
0: – When the UAnPWR bit = 0 or the UAnTXE bit = 0 has been set.
– When, following transfer completion, there was no next data transfer
from
UAnTX register
1: Write to UAnTXB bit
The UAnTSF bit is always 1 when performing continuous transmission. When
initializing the transmission unit, check that the UAnTSF bit = 0 before
performing initialization. The transmit data is not guaranteed when initialization
is performed while the UAnTSF bit = 1.
2 UAnPE Parity error flag:
0: – When the UAnPWR bit = 0 or the UAnRXE bit = 0 has been set.
– When 0 has been written
1: When parity of data and parity bit do not match during reception.
• The operation of the UAnPE bit is controlled by the settings of the
UAnCTL0.UAnPS1 and UAnCTL0.UAnPS0 bits.
• The UAnPE bit can be read and written, but it can only be cleared by writing
0 to it, and it cannot be set by writing 1 to it. When 1 is written to this bit, the
value is retained.
1 UAnFE Framing error flag
0: – When the UAnPWR bit = 0 or the UAnRXE bit = 0 has been set
– When 0 has been written
1: When no stop bit is detected during reception
• Only the first bit of the receive data stop bits is checked, regardless of the
value of the UAnCTL0.UAnSL bit.
• The UAnFE bit can be both read and written, but it can only be cleared by
writing 0 to it, and it cannot be set by writing 1 to it. When 1 is written to this
bit, the value is retained.
0 UAnOVE Overrun error flag
0: – When the UAnPWR bit = 0 or the UAnRXE bit = 0 has been set.
– When 0 has been written
1: When receive data has been set to the UAnRXB register and the next
receive operation is completed before that receive data has been read
• When an overrun error occurs, the data is discarded without the next receive
data being written to the receive buffer.
• The UAnOVE bit can be both read and written, but it can only be cleared by
writing 0 to it. When 1 is written to this bit, the value is retained.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 583


Chapter 17 Asynchronous Serial Interface (UARTA)

(6) UAnRX - UARTAn receive data register


The UAnRX register is an 8-bit buffer register that stores parallel data
converted by the receive shift register.
The data stored in the receive shift register is transferred to the UAnRX
register upon completion of reception of 1 byte of data.
During LSB-first reception when the data length has been specified as 7 bits,
the receive data is transferred to bits 6 to 0 of the UAnRX register and the MSB
always becomes 0. During MSB-first reception, the receive data is transferred
to bits 7 to 1 of the UAnRX register and the LSB always becomes 0.
When an overrun error (UAnOVE) occurs, the receive data at this time is not
transferred to the UAnRX register and is discarded.
Access This register can be read only in 8-bit units.
Address <base> + 6H
Initial Value FFH. This register is cleared by any reset.
In addition to reset input, the UAnRX register can be set to FFH by clearing the
UAnCTL0.UAnPWR bit to 0.
7 6 5 4 3 2 1 0
Receive data
R

(7) UAnTX - UARTAn transmit data register


The UAnTX register is an 8-bit register used to set transmit data.
Access This register can be read or written in 8-bit units.
Address <base> + 7H

Initial Value FFH. This register is cleared by any reset.

7 6 5 4 3 2 1 0
Transmit data
R/W

www.DataSheet4U.com

584 User’s Manual U17566EE5V1UM00


Asynchronous Serial Interface (UARTA) Chapter 17

17.4 Interrupt Request Signals

The following three interrupt request signals are generated from UARTAn:
• Reception complete interrupt request signal (INTUAnR)
• Receive error interrupt request signal (INTUAnRE)
• Transmission enable interrupt request signal (INTUAnT)

(1) Reception complete interrupt request signal (INTUAnR)


A reception complete interrupt request signal is output when data is shifted into
the receive shift register and transferred to the UAnRX register in the reception
enabled status.
In case of erroneous reception, the reception error interrupt INTUanRE is
generated instead of INTUAnR.
No reception complete interrupt request signal is generated in the reception
disabled status.

(2) Receive error interrupt request signal (INTUAnRE)


A receive error interrupt request is generated if an error condition occurred
during reception, as reflected by UAnSTR.UAnPE (parity error flag),
UAnSTR.UAnFE (framing error flag), UAnSTR.UAnOVE (overrun error flag).
Note that INTUAnR and INTUAnRE do exclude each other: upon correct
reception of data only INTUAnR is generated. In case of a reception error
INTUAnRE is generated only.

(3) Transmission enable interrupt request signal (INTUAnT)


If transmit data is transferred from the UAnTX register to the UARTAn transmit
shift register with transmission enabled, the transmission enable interrupt
request signal is generated.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 585


Chapter 17 Asynchronous Serial Interface (UARTA)

17.5 Operation

17.5.1 Data format

Full-duplex serial data reception and transmission is performed.


As shown in the figures below, one data frame of transmit/receive data
consists of a start bit, character bits, parity bit, and stop bit(s).
Specification of the character bit length within 1 data frame, parity selection,
specification of the stop bit length, and specification of MSB/LSB-first transfer
are performed using the UAnCTL0 register.
Moreover, control of UART output/inverted output for the TXDAn bit is
performed using the UAnOPT0.UAnTDL bit.
• Start bit..........................1 bit
• Character bits................7 bits/8 bits
• Parity bit ........................Even parity/odd parity/0 parity/no parity
• Stop bit ..........................1 bit/2 bits

(1) UARTA transmit/receive data format

(a) 8-bit data length, LSB first, even parity, 1 stop bit, transfer data: 55H

1 data frame

Start Parity Stop


bit D0 D1 D2 D3 D4 D5 D6 D7
bit bit

(b) 8-bit data length, MSB first, even parity, 1 stop bit, transfer data: 55H

1 data frame

Start Parity Stop


bit D7 D6 D5 D4 D3 D2 D1 D0
bit bit

www.DataSheet4U.com

586 User’s Manual U17566EE5V1UM00


Asynchronous Serial Interface (UARTA) Chapter 17

(c) 8-bit data length, MSB first, even parity, 1 stop bit, transfer data: 55H,
TXDAn inversion

1 data frame

Start Parity Stop


D7 D6 D5 D4 D3 D2 D1 D0
bit bit bit

(d) 7-bit data length, LSB first, odd parity, 2 stop bits, transfer data: 36H

1 data frame

Start Parity Stop Stop


D0 D1 D2 D3 D4 D5 D6
bit bit bit bit

(e) 8-bit data length, LSB first, no parity, 1 stop bit, transfer data: 87H

1 data frame

Start Stop
D0 D1 D2 D3 D4 D5 D6 D7
bit bit

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 587


Chapter 17 Asynchronous Serial Interface (UARTA)

17.5.2 SBF transmission/reception format

The UARTA has an SBF (Sync Break Field) transmission/reception control


function to enable use of the LIN function.
About LIN LIN stands for Local Interconnect Network and is a low-speed (1 to 20 kbps)
serial co
mmunication protocol intended to aid the cost reduction of an automotive
network.
LIN communication is single-master communication, and up to 15 slaves can
be connected to one master.
The LIN slaves are used to control the switches, actuators, and sensors, and
these are connected to the LIN master via the LIN network.
Normally, the LIN master is connected to a network such as CAN (Controller
Area Network).
In addition, the LIN bus uses a single-wire method and is connected to the
nodes via a transceiver that complies with ISO9141.
In the LIN protocol, the master transmits a frame with baud rate information
and the slave receives it and corrects the baud rate error. Therefore,
communication is possible when the baud rate error in the slave is ±15% or
less.
Figure 17-2 and Figure 17-3 outline the transmission and reception
manipulations of LIN.

Wake-up Synch Check


signal break Synch Ident DATA DATA SUM
frame field field field field field field

Sleep
bus

Note 3 Note 2 55H Data Data Data Data


8 bits Note 1 13 bits transmission transmission transmission transmission transmission

TXDAn (output)

SBF transmissionNote 4

INTUAnR
interrupt

Figure 17-2 LIN transmission manipulation outline

www.DataSheet4U.com Note 1. The interval between each field is controlled by software.


2. SBF output is performed by hardware. The output width is the bit length set
by the UAnOPT0.UAnSBL2 to UAnOPT0.UAnSBL0 bits. If even finer
output width adjustments are required, such adjustments can be
performed using the UAnCTLn.UAnBRS7 to UAnCTLn.UAnBRS0 bits.
3. 80H transfer in the 8-bit mode is substituted for the wakeup signal frame.

588 User’s Manual U17566EE5V1UM00


Asynchronous Serial Interface (UARTA) Chapter 17

4. A transmission enable interrupt request signal (INTUAnT) is output at the


start of each transmission. The INTUAnT signal is also output at the start
of each SBF transmission.

Wake-up Synch Check


signal break Synch Ident DATA DATA SUM
frame field field field field field field

Sleep
bus

Note 2 Data Data Note 5


13 bits SF reception ID reception transmission transmission Data transmission

SBF
TXDAn (output) Disable Enable
reception

Note 3

Reception interrupt (INTUAnR)


Note 1

Edge detection
Note 4

Capture timer Disable Enable

Figure 17-3 LIN reception manipulation outline

Note 1. The wakeup signal is sent by the pin edge detector, UARTAn is enabled,
and the SBF reception mode is set.
2. The receive operation is performed until detection of the stop bit. Upon
detection of SBF reception of 11 or more bits, normal SBF reception end is
judged, and an interrupt signal is output. Upon detection of SBF reception
of less than 11 bits, an SBF reception error is judged, no interrupt signal is
output, and the mode returns to the SBF reception mode.
3. If SBF reception ends normally, an interrupt request signal is output. The
timer is enabled by an SBF reception complete interrupt. Moreover, error
detection for the UAnSTR.UAnOVE, UAnSTR.UAnPE, and
UAnSTR.UAnFE bits is suppressed and UART communication error
detection processing and UARTAn receive shift register and data transfer
of the UAnRX register are not performed. The UARTAn receive shift
register holds the initial value, FFH.
4. The RXDAn pin is connected to TI (capture input) of the timer, the transfer
rate is calculated, and the baud rate error is calculated. The value of the
www.DataSheet4U.com
UAnCTL2 register obtained by correcting the baud rate error after dropping
UARTA enable is set again, causing the status to become the reception
status.
5. Check-sum field distinctions are made by software. UARTAn is initialized
following CSF reception, and the processing for setting the SBF reception
mode again is performed by software.

User’s Manual U17566EE5V1UM00 589


Chapter 17 Asynchronous Serial Interface (UARTA)

17.5.3 SBF transmission

When the UAnCTL0.UAnPWR bit = UAnCTL0.UAnTXE bit = 1, the


transmission enabled status is entered, and SBF transmission is started by
setting (to 1) the SBF transmission trigger (UAnOPT0.UAnSTT bit).
Thereafter, a low level the width of bits 13 to 20 specified by the
UAnOPT0.UAnSBL2 to UAnOPT0.UAnSBL0 bits is output. A transmission
enable interrupt request signal (INTUAnT) is generated upon SBF
transmission start. Following the end of SBF transmission, the UAnSTT bit is
automatically cleared. Thereafter, the UART transmission mode is restored.
Transmission is suspended until the data to be transmitted next is written to the
UAnTX register, or until the SBF transmission trigger (UAnSTT bit) is set.

Stop
1 2 3 4 5 6 7 8 9 10 11 12 13
bit

INTUAnT
interrupt

Setting of UAnSTT bit

Figure 17-4 SBF transmission

17.5.4 SBF reception

The reception enabled status is achieved by setting the UAnCTL0.UAnPWR bit


to 1 and then setting the UAnCTL0.UAnRX bit to 1.
The SBF reception wait status is set by setting the SBF reception trigger
(UAnOPT0.UAnSTR bit) to 1.
In the SBF reception wait status, similarly to the UART reception wait status,
the RXDAn pin is monitored and start bit detection is performed.
Following detection of the start bit, reception is started and the internal counter
counts up according to the set baud rate.
When a stop bit is received, if the SBF width is 11 or more bits, normal
processing is judged and a reception complete interrupt request signal
(INTUAnR) is output. The UAnOPT0.UAnSRF bit is automatically cleared and
SBF reception ends. Error detection for the UAnSTR.UAnOVE,
UAnSTR.UAnPE, and UAnSTR.UAnFE bits is suppressed and UART
communication error detection processing is not performed. Moreover, data
transfer of the UARTAn reception shift register and UAnRX register is not
performed and FFH, the initial value, is held. If the SBF width is 10 or fewer
bits, reception is terminated as error processing without outputting an interrupt,
and the SBF reception mode is returned to. The UAnSRF bit is not cleared at
www.DataSheet4U.com this time.

590 User’s Manual U17566EE5V1UM00


Asynchronous Serial Interface (UARTA) Chapter 17

(a) Normal SBF reception (detection of stop bit in more than 10.5 bits)

1 2 3 4 5 6 7 8 9 10 11

11.5

UAnSRF

INTUAnR
interrupt

(b) SBF reception error (detection of stop bit in 10.5 or fewer bits)

1 2 3 4 5 6 7 8 9 10

10.5

UA0SRF

INTUAnR
interrupt

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 591


Chapter 17 Asynchronous Serial Interface (UARTA)

17.5.5 UART transmission

A high level is output to the TXDAn pin by setting the UAnCTL0.UAnPWR bit to
1.
Next, the transmission enabled status is set by setting the UAnCTL0.UAnTXE
bit to 1, and transmission is started by writing transmit data to the UAnTX
register. The start bit, parity bit, and stop bit are automatically added.
Since the CTS (transmit enable signal) input pin is not provided in UARTAn,
use a port to check that reception is enabled at the transmit destination.
The data in the UAnTX register is transferred to the UARTAn transmit shift
register upon the start of the transmit operation.
A transmission enable interrupt request signal (INTUAnT) is generated upon
completion of transmission of the data of the UAnTX register to the UARTAn
transmit shift register, and thereafter the contents of the UARTAn transmit shift
register are output to the TXDAn pin.
Write of the next transmit data to the UAnTX register is enabled by generating
the INTUAnT signal.

Start Parity Stop


bit D0 D1 D2 D3 D4 D5 D6 D7
bit bit

INTUAnT

Note LSB first

www.DataSheet4U.com

592 User’s Manual U17566EE5V1UM00


Asynchronous Serial Interface (UARTA) Chapter 17

17.5.6 Continuous transmission procedure

UARTAn can write the next transmit data to the UAnTX register when the
UARTAn transmit shift register starts the shift operation. The transmit timing of
the UARTAn transmit shift register can be judged from the transmission enable
interrupt request signal (INTUAnT).
An efficient communication rate is realized by writing the data to be transmitted
next to the UAnTX register during transfer.

Caution During continuous transmission execution, perform initialization after checking


that the UAnSTR.UAnTSF bit is 0. The transmit data cannot be guaranteed
when initialization is performed while the UAnTSF bit is 1.

Start

Register settings

UAnTX write

No
Occurrence of transmission
interrupt?

Yes

Required number of No
writes performed?

Yes

End

Figure 17-5 Continuous transmission processing flow

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 593


Chapter 17 Asynchronous Serial Interface (UARTA)

TXDAn Start Data (1) Parity Stop Start Data (2) Parity Stop Start

UAnTX Data (1) Data (2) Data (3)

Transmission Data (2)


Data (1)
shift register

INTUAnT

UAnTSF

Figure 17-6 Continuous transmission operation timing —transmission start

UATTXD Parity Stop Start Data (n – 1) Parity Stop Start Data (n) Parity Stop

UAnTX Data (n – 1) Data (n)

Transmission Data (n – 1) Data (n) FF


shift register

INTUAnT

UAnTSF

UAnPWR or UAnTXE bit

Figure 17-7 Continuous transmission operation timing—transmission end

www.DataSheet4U.com

594 User’s Manual U17566EE5V1UM00


Asynchronous Serial Interface (UARTA) Chapter 17

17.5.7 UART reception

The reception wait status is set by setting the UAnCTL0.UAnPWR bit to 1 and
then setting the UAnCTL0.UAnRXE bit to 1. In the reception wait status, the
RXDAn pin is monitored and start bit detection is performed.
Start bit detection is performed using a two-step detection routine.
First the rising edge of the RXDAn pin is detected and sampling is started at
the falling edge. The start bit is recognized if the RXDAn pin is low level at the
start bit sampling point. After a start bit has been recognized, the receive
operation starts, and serial data is saved to the UARTAn receive shift register
according to the set baud rate.
When the reception complete interrupt request signal (INTUAnR) is output
upon reception of the stop bit, the data of the UARTAn receive shift register is
written to the UAnRX register. However, if an overrun error (UAnSTR.UAnOVE
bit) occurs, the receive data at this time is not written to the UAnRX register
and is discarded.
Even if a parity error (UAnSTR.UAnPE bit) or a framing error (UAnSTR.UAnFE
bit) occurs during reception, reception continues until the reception position of
the first stop bit, and INTUAnR is output following reception completion.

Start Parity Stop


bit D0 D1 D2 D3 D4 D5 D6 D7
bit bit

INTUAnR

UAnRX

Figure 17-8 UART reception

Caution 1. Be sure to read the UAnRX register even when a reception error occurs. If
the UAnRX register is not read, an overrun error occurs during reception of
the next data, and reception errors continue occurring indefinitely.
2. The operation during reception is performed assuming that there is only one
stop bit. A second stop bit is ignored.
3. When reception is completed, read the UAnRX register after the reception
complete interrupt request signal (INTUAnR) has been generated, and clear
the UAnPWR or UAnRXE bit to 0. If the UAnPWR or UAnRXE bit is cleared
to 0 before the INTUAnR signal is generated, the read value of the UAnRX
www.DataSheet4U.com
register cannot be guaranteed.

User’s Manual U17566EE5V1UM00 595


Chapter 17 Asynchronous Serial Interface (UARTA)

4. If receive completion processing (INTUAnR signal generation) of UARTAn


and the UAnPWR bit = 0 or UAnRXE bit = 0 conflict, the INTUAnR signal
may be generated in spite of these being no data stored in the UAnRX
register.
To complete reception without waiting INTUAnR signal generation, be sure
to clear (0) the interrupt request flag (UAnRIF) of the UAnRIC register, after
setting (1) the interrupt mask flag (UAnRMK) of the interrupt control register
(UAnRIC) and then set (1) the UAnPWR bit = 0 or UAnRXE bit = 0.

17.5.8 Reception errors

Errors during a receive operation are of three types: parity errors, framing
errors, and overrun errors. Data reception result error flags are set in the
UAnSTR register and a reception error interrupt request signal (INTUAnRE) is
output when an error occurs.
It is possible to ascertain which error occurred during reception by reading the
contents of the UAnSTR register.
Clear the reception error flag by writing 0 to it after reading it.

Table 17-6 Reception error causes


Error flag Reception error Cause
UAnPE Parity error Received parity bit does not match the setting
UAnFE Framing error Stop bit not detected
UAnOVE Overrun error Reception of next data completed before data was read from
receive buffer

Note Note that even in case of a parity or framing error, data is transferred from the
receive shift register to the receive data register UAnRX. Consequently the
data from UAnRX must be read. Otherwise an overrun error UAnSTR.UAnOVE
will occur at reception of the next data.
In case of an overrun error, the receive shift register data is not transferred to
UAnRX, thus the previous data is not overwritten.

www.DataSheet4U.com

596 User’s Manual U17566EE5V1UM00


Asynchronous Serial Interface (UARTA) Chapter 17

17.5.9 Parity types and operations

Caution When using the LIN function, fix the UAnPS1 and UAnPS0 bits of the
UAnCTL0 register to 00.

The parity bit is used to detect bit errors in the communication data. Normally
the same parity is used on the transmission side and the reception side.
In the case of even parity and odd parity, it is possible to detect odd-count bit
errors. In the case of 0 parity and no parity, errors cannot be detected.

(1) Even parity


• During transmission
The number of bits whose value is “1” among the transmit data, including
the parity bit, is controlled so as to be an even number. The parity bit values
are as follows.
– Odd number of bits whose value is “1” among transmit data:1
– Even number of bits whose value is “1” among transmit data:0
• During reception
The number of bits whose value is “1” among the reception data, including
the parity bit, is counted, and if it is an odd number, a parity error is output.

(2) Odd parity


• During transmission
Opposite to even parity, the number of bits whose value is “1” among the
transmit data, including the parity bit, is controlled so that it is an odd
number. The parity bit values are as follows.
– Odd number of bits whose value is “1” among transmit data: 0
– Even number of bits whose value is “1” among transmit data: 1
• During reception
The number of bits whose value is “1” among the receive data, including
the parity bit, is counted, and if it is an even number, a parity error is output.

(3) 0 parity
During transmission, the parity bit is always made 0, regardless of the transmit
data.
During reception, parity bit check is not performed. Therefore, no parity error
occurs, regardless of whether the parity bit is 0 or 1.

(4) No parity
No parity bit is added to the transmit data.
Reception is performed assuming that there is no parity bit. No parity error
occurs since there is no parity bit.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 597


Chapter 17 Asynchronous Serial Interface (UARTA)

17.5.10 Receive data noise filter

This filter samples the RXDAn pin using the base clock of the prescaler output.
When the same sampling value is read twice, the match detector output
changes and the RXDAn signal is sampled as the input data. Therefore, data
not exceeding 2 clock width is judged to be noise and is not delivered to the
internal circuit (see Figure 17-10). See “Base clock“ on page 599 regarding the
base clock.
Moreover, since the circuit is as shown in Figure 17-9, the processing that
goes on within the receive operation is delayed by 3 clocks in relation to the
external signal status.

Base clock (fUCLK)

Internal signal A Internal signal B


RXDAn In Q In Q In Q Internal signal C

Match
detector LD_EN

Figure 17-9 Noise filter circuit

Base clock

RXDAn (input)

Internal signal A

Internal signal B

Match Mismatch Match Mismatch


(judged as noise) (judged as noise)

Internal signal C

www.DataSheet4U.com
Figure 17-10 Timing of RXDAn signal judged as noise

598 User’s Manual U17566EE5V1UM00


Asynchronous Serial Interface (UARTA) Chapter 17

17.6 Baud Rate Generator

The dedicated baud rate generator consists of a source clock selector block
and an 8-bit programmable counter, and generates a serial clock during
transmission and reception with UARTAn. Regarding the serial clock, a
dedicated baud rate generator output can be selected for each channel.
There is an 8-bit counter for transmission and another one for reception.

17.6.1 Baud Rate Generator configuration

UAnPWR

PCLK1

PCLK2
UAnPWR, UAnTXEn bus (or UAnRXE bit)
PCLK3

PCLK4
Selector 8-bit counter
PCLK5 fUCLK
PCLK6

PCLK7

PCLK8 Match detector 1/2 Baud rate

UAnCTL1: UAnCTL2:
UAnCKS2 to UAnCKS0 UAnBRS7 to UAnBRS0

Figure 17-11 Configuration of baud rate generator

(a) Base clock


When the UAnCTL0.UAnPWR bit is 1, the clock selected by the
UAnCTL1.UAnCKS[2:0] bits is supplied to the 8-bit counter. This clock is
called the base clock. When the UAnPWR bit = 0, fUCLK is fixed to the low
level.

(b) Serial clock generation


A serial clock can be generated by setting the UAnCTL1 register and the
UAnCTL2 register.
The base clock is selected by UAnCTL1.UAnCKS2 to UAnCTL1.UAnCKS0
bits.
The frequency division value for the 8-bit counter can be set using the
www.DataSheet4U.com UAnCTL2.UAnBRS[7:0] bits.

User’s Manual U17566EE5V1UM00 599


Chapter 17 Asynchronous Serial Interface (UARTA)

17.6.2 Baud Rate Generator registers

(1) UAnCTL1 - UARTAn control register 1


The UAnCTL1 register is an 8-bit register that selects the UARTAn base clock.
Access This register can be read or written in 8-bit units.
Address <base> + 1H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 0 UAnCKS2 UAnCKS1 UAnCKS0
R R R R R R/W R/W R/W

Caution Clear the UAnCTL0.UAnPWR bit to 0 before rewriting the UAnCTL1 register.

Table 17-7 UAnCTL1 register contents

Bit position Bit name Function


2 to 0 UAnCKS[2:0] Base clock fUCLK selection:
UAnCKS2 UAnCKS1 UAnCKS0 Base clock fUCLK
0 0 0 PCLK1
0 0 1 PCLK2
0 1 0 PCLK3
0 1 1 PCLK4
1 0 0 PCLK5
1 0 1 PCLK6
1 1 0 PCLK7
1 1 1 PCLK8

w w w . D a t a S h e e t 4 U . c o m

600 User’s Manual U17566EE5V1UM00


Asynchronous Serial Interface (UARTA) Chapter 17

(2) UAnCTL2 - UARTAn control register 2


The UAnCTL2 register is an 8-bit register that selects the baud rate (serial
transfer speed) clock of UARTAn.
Access This register can be read or written in 8-bit units.
Address <base> + 1H
Initial Value FFH. This register is cleared by any reset.

7 6 5 4 3 2 1 0
UAnBRS7 UAnBRS6 UAnBRS5 UAnBRS4 UAnBRS3 UAnBRS2 UAnBRS1 UAnBRS0
R R R R R R/W R/W R/W

Caution Clear the UAnCTL0.UAnPWR bit to 0 or clear the UAnTXE and UAnRXE bits
to 00 before rewriting the UAnCTL2 register.

Table 17-8 UAnCTL2 register contents

Bit position Bit name Function


2 to 0 UAnBRS[7:0] Serial clock setting
UAn UAn UAn UAn UAn UAn UAn UAn
BR BR BR BR BR BR BR BR k Serial clock
S7 S6 S5 S4 S3 S2 S1 S0
0 0 0 0 0 0 x x x Setting
prohibited
0 0 0 0 0 1 0 0 4 fUCLK/4
0 0 0 0 0 1 0 1 5 fUCLK/5
0 0 0 0 0 1 1 0 6 fUCLK/6
: : : : : : : : : :
1 1 1 1 1 1 0 0 252 fUCLK/252
1 1 1 1 1 1 0 1 253 fUCLK/253
1 1 1 1 1 1 1 0 254 fUCLK/254
1 1 1 1 1 1 1 1 255 fUCLK/255

Note fUCLK: clock frequency selected by UAnCTL1.UAnCKS[2:0]

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 601


Chapter 17 Asynchronous Serial Interface (UARTA)

17.6.3 Baud rate calculation

The baud rate is obtained by the following equation.


fUCLK
Baud rate = --------------
- [bps]
2× k
fUCLK = Frequency of base clock selected by the UAnCTL1.UAnCKS[2:0]
k= Value set using the UAnCTL2.UAnBRS[7:0] bits
(k = 4, 5, 6, …, 255)

17.6.4 Baud rate error

The baud rate error is obtained by the following equation.


Actual baud rate (baud rate with error)
Error (%) = ( ---------------------------------------------------------------------------
Target baud rate (correct baud rate)
- – 1) × 100 [%]

Caution 1. The baud rate error during transmission must be within the error tolerance
on the receiving side.
2. The baud rate error during reception must satisfy the range indicated in (7)
Allowable baud rate range during reception.

Example Base clock frequency = 8MHz


Setting value of
- UAnDTL1.UAnCKS[2:0] = 001B (PCLK2 = 4MHz)
- UAnCTL2.UAnBRS[7:0] = 0000 1101B (k = 13)
Target baud rate = 153,600 bps
Baud rate = 4MHz/ (2 × 13) = 153,846 [bps]
Error = (153,846/153,600 – 1) × 100
= 0.160 [%]

17.6.5 Baud rate setting example

Table 17-9 Baud rate generator setting data (1/2)


Target Effective
UAnCTL1 UAnCTL2 Baud rate error
baud rate baud rate
(%)
[bps] Selector Divider Divider k [bps]

300 07H 128 68H 104 300.48 0.16


600 07H 128 34H 52 600.96 0.16
1,200 07H 128 1AH 26 1,201.92 0.16
www.DataSheet4U.com
2,400 07H 128 0DH 13 2,403.85 0.16
4,800 06H 64 0DH 13 4,807.69 0.16
9,600 05H 32 0DH 13 9,615.38 0.16
19,200 04H 16 0DH 13 19,230.77 0.16
31,250 05H 32 04H 4 31,250.00 0.00

602 User’s Manual U17566EE5V1UM00


Asynchronous Serial Interface (UARTA) Chapter 17

Table 17-9 Baud rate generator setting data (2/2)


38,400 03H 8 0DH 13 38,461.54 0.16
76,800 02H 4 0DH 13 76,923.08 0.16
153,600 01H 2 0DH 13 153,846.15 0.16
312,500 00H 1 0DH 13 307,692.31 –1.54

Note Table 17-9 assumes normal operation mode, i.e. PCLK1 = 8 MHz.

17.6.6 Allowable baud rate range during reception

The baud rate error range at the destination that is allowable during reception
is shown below.

Caution The baud rate error during reception must be set within the allowable error
range using the following equation.

Latch timing

UARTn
Start bit Bit 0 Bit 1 Bit 7 Parity bit Stop bit
transfer rate

FL
1 data frame (11 × FL)

Minimum
Start bit Bit 0 Bit 1 Bit 7 Parity bit Stop bit
allowable
transfer rate
FLmin

Maximum Start bit Bit 0 Bit 1 Bit 7 Parity bit Stop bit
allowable
transfer rate
FLmax

Figure 17-12 Allowable baud rate range during reception

As shown in Figure 17-12, the receive data latch timing is determined by the
counter set using the UAnCTL2 register following start bit detection. The
transmit data can be normally received if up to the last data (stop bit) can be
received in time for this latch timing.
www.DataSheet4U.com When this is applied to 11-bit reception, the following is the theoretical result.

FL = (Brate)-1
Brate: UARTAn baud rate
k: Setting value of UAnCTL2.UAnBRS[7:0]

User’s Manual U17566EE5V1UM00 603


Chapter 17 Asynchronous Serial Interface (UARTA)

FL: 1-bit data length


Latch timing margin: 2 clocks

Minimum allowable transfer rate:


k–2 21k + 2
FL min = 11 × FL – ------------ × FL = ------------------- × FL
2k 2k

Therefore, the maximum baud rate that can be received by the destination is
as follows.
–1 22k
BRmax = ( FLmin ⁄ 11 ) = ------------------- × Brate
21k + 2

Similarly, obtaining the following maximum allowable transfer rate yields the
following.
10
------ × FLmax = 11 × FL – k-----------
+ 2- 21k – 2
× FL = ------------------- × FL
11 2k 2k

21k – 2
FLmax = ------------------- × FL × 11
20k

Therefore, the minimum baud rate that can be received by the destination is as
follows.
–1 20k
BRmin = ( FLmax ⁄ 11 ) = ------------------- × Brate
21k – 2

Obtaining the allowable baud rate error for UARTAn and the destination from
the above-described equations for obtaining the minimum and maximum baud
rate values yields the following.

Table 17-10 Maximum/minimum allowable baud rate error


Division ratio (k) Maximum allowable baud rate error Minimum allowable baud rate error
4 +2.32% -2.43%
8 +3.52% -3.61%
20 +4.26% -4.30%
50 +4.56% -4.58%
100 +4.66% -4.67%
255 +4.72% -4.72%

Note 1. The reception accuracy depends on the bit count in 1 frame, the input clock
frequency, and the division ratio (k). The higher the input clock frequency
and the larger the division ratio (k), the higher the accuracy.
2. k: Setting value of UAnCTL2.UAnBRS[7:0]
www.DataSheet4U.com

604 User’s Manual U17566EE5V1UM00


Asynchronous Serial Interface (UARTA) Chapter 17

17.6.7 Baud rate during continuous transmission

During continuous transmission, the transfer rate from the stop bit to the next
start bit is usually 2 base clocks longer. However, timing initialization is
performed via start bit detection by the receiving side, so this has no influence
on the transfer result.

1 data frame Start bit of 2nd byte

Start bit Bit 0 Bit 1 Bit 7 Parity bit Stop bit Start bit Bit 0

FL FL FL FL FL FLstp FL FL

Figure 17-13 Transfer rate during continuous transfer

Assuming 1 bit data length: FL; stop bit length: FLstp; and base clock
frequency: fUCLK, we obtain the following equation.

FLstp = FL + 2/fUCLK

Therefore, the transfer rate during continuous transmission is as follows.

Transfer rate = 11 × FL + (2/fUCLK)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 605


Chapter 17 Asynchronous Serial Interface (UARTA)

17.7 Cautions

17.7.1 UARTAn behaviour during and after power save mode

When the clock supply to UARTAn is stopped (for example, in IDLE or STOP
mode), the operation stops with each register retaining the value it had
immediately before the clock supply was stopped. The TXDAn pin output also
holds and outputs the value it had immediately before the clock supply was
stopped. However, the operation is not guaranteed after the clock supply is
resumed. Therefore, after the clock supply is resumed, the circuits should be
initialized by setting the UAnCTL0.UAnPWR, UAnCTL0.UAnRXEn, and
UAnCTL0.UAnTXEn bits to 000.

17.7.2 UARTAn behaviour during debugger break

The UARTAn continues to operate in debugger break-mode, provided all


clocks are continuing.

Reception When the UARTAn is in reception mode and an external device is sending data
during debugger break-mode the UARTAn may produce an overflow error as it
continues to receive data during break-mode.
Thus the overflow error flag UAnSTR.UAnOVE may be set and the reception
error interrupt INTUAnRE may be generated. Further all following received
data are discarded.
Note that the reception error interrupt INTUAnRE will not be served during
break-mode, but after resuming run-mode, provided the interrupt controller is
configured accordingly.

Transmission If the debugger’s break-mode is entered while the UARTAn is transmitting data,
the transmission is completed, and finally a transmission enable interrupt
request INTUAnT is generated.
Note that the transmission enable interrupt INTUAnT will not be served during
break-mode, but after resuming run-mode, provided the interrupt controller is
configured accordingly.

DMA reception If the DMA controller is used to fetch received data from the UAnRX register,
the DMA controller continues to do so in debugger break-mode, but the data in
UAnRX is not tagged as already read. Thus the next receive data during break-
mode will generate an overflow error, as described above.
If the specified number of data units in the DBCn register has been fetched
from the UARTAn the DCHCn.TCn is set and the DMA completion interrupt
INTDMAn is generated. The INTDMAn request is served after resuming run-
mode.
www.DataSheet4U.com
Since the DMA trigger interrupt INTUAnR is not generated in case of an
overflow (the INTUAnRE interrupt is generated instead), no further DMA
triggers occur. Only the first received data in break-mode is transferred by the
DMA, all following data are discarded.

606 User’s Manual U17566EE5V1UM00


Asynchronous Serial Interface (UARTA) Chapter 17

DMA transmission If the DMA controller is used to write transmission data to the UAnTX register,
the DMA controller continues to do so in debugger break-mode. If the specified
number of data units in the DBCn register has been transferred to the UARTAn
the DCHCn.TCn is set and the DMA completion interrupt INTDMAn is
generated. The INTDMAn request is served after resuming run-mode.

17.7.3 UARTAn operation stop

If both of the following actions in UARTAn happen at the same time the
INTUAnR signal may be generated inadvertently and no data is stored in the
UAnRX register:
• INTUAnR is generated due to completion of a serial receive operation,
• UAnPWR bit or UAnRXE bit is cleared (set to 0).

Workaround To avoid the generation of the INTUAnR signal when UAnPWR bit or UAnRXE
bit is cleared (set to 0) do the following:
1. Set (set to 1) the interrupt mask flag (UAnRMK) of the interrupt control
register (UAnRIC),
2. Clear (set to 0) the UAnPWR bit or UAnRXE bit,
3. Clear (set to 0) the interrupt request flag (UAnRIF) of the UAnRIC register.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 607


Chapter 17 Asynchronous Serial Interface (UARTA)

www.DataSheet4U.com

608 User’s Manual U17566EE5V1UM00


Chapter 18 Clocked Serial Interface (CSIB)

The V850E/Dx3 microcontrollers have following instances of the clocked serial


interface CSIB:

µPD70F3427, µPD70F3426A, µPD70F3423, µPD70F3422,


CSIB
µPD70F3425, µPD70F3424 µPD70F3421
Instances 3 2
Names CSIB0 to CSIB2 CSIB0 to CSIB1

Throughout this chapter, the individual instances of clocked serial interface are
identified by “n”, for example CSIBn, or CBnCTL0 for the control register 0 of
CSIBn.

18.1 Features

• Transfer rate: 8 Mbps to 2 kbps (using dedicated baud rate generator)


The maximum transfer rate is the maximum transfer rate of the digital
circuitry. It does neither regard any output buffer driver strength limitation nor
the external capacitive load. Both might reduce the practically achievable
maximum baud rate.
• Master mode and slave mode selectable
• 8-bit to 16-bit transfer, 3-wire serial interface
• 3 interrupt request signals (INTCBnT, INTCBnR, INTCBnRE)
• Serial clock and data phase switchable
• Transfer data length selectable in 1-bit units between 8 and 16 bits
• Transfer data MSB-first/LSB-first switchable
• 3-wire transfer SOBn: Serial data output
SIBn: Serial data input
SCKBn: Serial clock input/output
Transmission mode, reception mode, and transmission/reception mode
specifiable
• DMA support
• Dedicated baud rate generator for each interface instance
• Modulated and stable clock sources available

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 609


Chapter 18 Clocked Serial Interface (CSIB)

18.2 Configuration

The following shows the block diagram of CSIBn.

Internal bus

CBnCTL1 CBnCTL0 CBnCTL2

SPCLK1 (8 MHz) CBnSTR

BRGn INTCBnT
Controller INTCBnR
Note INTCBnRE

PCLK1 (8 MHz)
Selector

PCLK2 (4 MHz)
PCLK3 (2 MHz)
PCLK4 (1 MHz) Phase control
PCLK5 (500 KHz)
PCLK6 (250 KHz)
CBnTX

SCKBn Phase
SO latch SOBn
control
SIBn Shift register

CBnRX

Figure 18-1 Block diagram of CSIBn

Note The clock is generated by the dedicated baud rate generator BRGn.

www.DataSheet4U.com

610 User’s Manual U17566EE5V1UM00


Clocked Serial Interface (CSIB) Chapter 18

18.3 CSIB Control Registers

The clocked serial interfaces CSIBn are controlled and operated by means of
the following registers:

Table 18-1 CSIBn registers overview

Register name Shortcut Address


CSIBn control register 0 CBnCTL0 <base>
CSIBn control register 1 CBnCTL1 <base> + 1H
CSIBn control register 2 CBnCTL2 <base> + 2H
CSIBn status register CBnSTR <base> + 3H
CSIBn receive data register CBnRX <base> + 4H
CSIBn transmit data register CBnTX <base> + 6H

Table 18-2 CSIBn register base address


Timer Base address
CSIB0 FFFF FD00H
CSIB1 FFFF FD10H
CSIB2 FFFF FD20H

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 611


Chapter 18 Clocked Serial Interface (CSIB)

(1) CBnCTL0 - CSIBn control register 0


CBnCTL0 is a register that controls the CSIBn serial transfer operation.
Access This register can be read/written in 8-bit or 1-bit units.
Address <base>
Initial Value 01H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
a a CBnDIRa CBnTMSa
CBnPWR CBnTXE CBnRXE 0 0 CBnSCE
R/W R/W R/W R/W R/W R/W R/W R/W
a)
These bits can only be rewritten when the CBnPWR bit = 0. However, CBnPWR
bit = 1 can also be set at the same time as rewriting these bits.

Table 18-3 CBnCTL0 register contents (1/2)

Bit position Bit name Function


7 CBnPWR CSIBn operation disable/enable:
0: Disable CSIBn operation and reset the CSIBn registers
1: Enable CSIBn operation
The CBnPWR bit controls the CSIBn operation and resets the internal circuit.
6 CBnTXE Transmit operation disable/enable:
0: Disable transmit operation
1: Enable transmit operation
The SOBn output is low level when the CBnTXE bit is 0.
5 CBnRXE Receive operation disable/enable:
0: Disable receive operation
1: Enable receive operation
When the CBnRXE bit is cleared to 0, no reception complete interrupt is output
even when the prescribed data is transferred in order to disable the receive
operation, and the receive data (CBnRX register) is not updated.

www.DataSheet4U.com

612 User’s Manual U17566EE5V1UM00


Clocked Serial Interface (CSIB) Chapter 18

Table 18-3 CBnCTL0 register contents (2/2)

Bit position Bit name Function


4 CBnDIR Transfer direction mode specification (MSB/LSB):
0: MSB first transfer
1: LSB first transfer
1 CBnTMS Transfer mode specification (MSB/LSB):
0: Single transfer mode
1: Continuous transfer mode
0 CBnSCE Specification of start transfer disable/enable:
0: Communication start trigger invalid
1: Communication start trigger valid
• In master mode
This bit enables or disables the communication start trigger.
(a)In single transmission or transmission/reception mode, or continuous
transmission or continuous transmission/reception mode
A communication operation can be started only when the CBnSCE bit is
1.
Set the CBnSCE bit to 1.
(b)In single reception mode
Clear the CBnSCE bit to 0 before reading the receive data
(CBnRX register).
If the CBnSCE bit is read while it is 1, the next communication operation
is started.
(c)In continuous reception mode
Clear the CBnSCE bit to 0 one communication clock before reception of
the last data is completed
The CBnSCE bit is not cleared to 0 one communication clock before the
completion of the last data reception, the next communication operation
is automatically started.
• In slave mode
This bit enables or disables the communication start trigger.
Set the CBnSCE bit to 1.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 613


Chapter 18 Clocked Serial Interface (CSIB)

(2) CBnCTL1 - CSIBn control register 1


CBnCTL1 is an 8-bit register that controls the CSIBn serial transfer operation.
Access This register can be read/written in 8-bit or 1-bit units.
Address <base> + 1H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 CBnCKP CBnDAP CBnCKS2 CBnCKS1 CBnCKS0
R/W R/W R/W R/W R/W R/W R/W R/W

Caution The CBnCTL1 register can be rewritten only when the


CBnCTL0.CBnPWR bit = 0.

Table 18-4 CBnCTL1 register contents

Bit
Bit name Function
position
4 CBnCKP Specification of data transmission/reception timing in relation to SCKBn.
3 CBnDAP Refer to Table 18-5.
2 to 0 CBnCKS[2:0] Communication clock setting
CBnCK CBnCK CBnCK Communication clock Mode
S2 S1 S0
0 0 0 fBRGn Master
0 0 1 fPCLK1 Master
0 1 0 fPCLK2 Master
0 1 1 fPCLK3 Master
1 0 0 fPCLK4 Master
1 0 1 fPCLK5 Master
1 1 0 fPCLK6 Master
1 1 1 External clock SCKBn Slave

www.DataSheet4U.com

614 User’s Manual U17566EE5V1UM00


Clocked Serial Interface (CSIB) Chapter 18

Table 18-5 Specification of data transmission/reception timing in relation to SCKBn


Communication type CBnCKP CBnDAP SIBn/SOBN timing in relation to SCKBn
Communication type 1 0 0

SCKBn (I/O)

SOBn (output) D7 D6 D5 D4 D3 D2 D1 D0

SIBn capture

Communication type 2 0 1
SCKBn (I/O)

SOBn (output) D7 D6 D5 D4 D3 D2 D1 D0

SIBn capture

Communication type 3 1 0
SCKBn (I/O)

(output) D7 D6 D5 D4 D3 D2 D1 D0

SIBn capture

Communication type 4 1 1
SCKBn (I/O)

(output) D7 D6 D5 D4 D3 D2 D1 D0

SIBn capture

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 615


Chapter 18 Clocked Serial Interface (CSIB)

(3) CBnCTL2 - CSIBn control register 2


CBnCTL2 is an 8-bit register that controls the number of CSIBn serial transfer
bits.
Access This register can be read/written in 8-bit units.
Address <base> + 2H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 CBnCL3 CBnCL2 CBnCL1 CBnCL0
R/W R/W R/W R/W R/W R/W R/W R/W

Caution The CBnCTL2 register can be rewritten only when the


CBnCTL0.CBnPWR bit = 0 or when both the CBnTXE and CBnRXE bits = 0.

Table 18-6 CBnCTL2 register contents

Bit
Bit name Function
position
3 to 0 CBnCL[3:0] Number of serial transfer bits
CBnCL3 CBnCL2 CBnCL1 CBnCL0 Number of serial transfer
bits
0 0 0 0 8 bits
0 0 0 1 9 bits
0 0 1 0 10 bits
0 0 1 1 11 bits
0 1 0 0 12 bits
0 1 0 1 13 bits
0 1 1 0 14 bits
0 1 1 1 15 bits
1 x x x 16 bits

Note If the number of transfer bits is other than 8 or 16, prepare and use data stuffed
from the LSB of the CBnTX and CBnRX registers.

w w w . D a t a S h e e t 4 U . c o m

616 User’s Manual U17566EE5V1UM00


Clocked Serial Interface (CSIB) Chapter 18

(a) Transfer data length change function


The CSIBn transfer data length can be set in 1-bit units between 8 and 16
bits using the CBnCTL2.CBnCL3 to CBnCTL2.CBnCL0 bits.
When the transfer bit length is set to a value other than 16 bits, set the data
to the CBnTX or CBnRX register starting from the LSB, regardless of
whether the transfer start bit is the MSB or LSB. Any data can be set for the
higher bits that are not used, but the receive data becomes 0 following
serial transfer.

SOBn
SIBn

15 10 9 0

Insertion of 0

Figure 18-2 (i) Transfer bit length = 10 bits, MSB first

SIBn SOBn

15 12 11 0

Insertion of 0

Figure 18-3 (ii) Transfer bit length = 12 bits, LSB first

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 617


Chapter 18 Clocked Serial Interface (CSIB)

(4) CBnSTR - CSIBn status register


CBnSTR is an 8-bit register that displays the CSIBn status.
Access This register can be read/written in 8-bit or 1-bit units.
Bit CBnTSF is read-only.
Address <base> + 3H
Initial Value 00H. This register is cleared by any reset.
In addition to reset input, the CBnSTR register can be initialized by clearing the
CBnCTL0.CBnPWR bit to 0.
7 6 5 4 3 2 1 0
CBnTSF 0 0 0 0 0 0 CBnOVE
R R/W R/W R/W R/W R/W R/W R/W

Table 18-7 CBnSTR register contents

Bit
Bit name Function
position
7 CBnTSF Communication status flag
0: Communication stopped
1: Communicating
During transmission, this register is set when data is prepared in the CBnTX
register, and during reception, it is set when a dummy read of the CBnRX
register is performed.
When transfer ends, this flag is cleared to 0 at the last edge of the clock.
0 CBnOVE Overrun error flag
0: No overrrun
1: Overrun
• An overrun error occurs when the next reception starts without performing
a CPU read of the value of the receive buffer, upon completion of the
receive operation.
The CBnOVE flag displays the overrun error occurrence status in this
case.
• The CBnOVE flag is cleared by writing 0 to it. It cannot be set even by
writing 1 to it.

Note In case of an overrun error, the reception error interrupt INTCBnRE behaves
different, depending on the transfer mode:
• Continuous transfer mode
The reception error interrupt INTCBnRE is generated instead of the
reception completion interrupt INTCBnR.
• Single transfer mode
No interrupt is generated.
In either case the overflow flag CBnSTR.CBnOVE is set to 1 and the previous
data in CBnRX will be overwritten with the new data.

www.DataSheet4U.com

618 User’s Manual U17566EE5V1UM00


Clocked Serial Interface (CSIB) Chapter 18

(5) CBnRX - CSIBn receive data register


The CBnRX register is a 16-bit buffer register that holds receive data.
Access This register can be read-only in 16-bit units.
If the transfer data length is 8 bits, the lower 8 bits of this register are read-only
in 8-bit units as the CBnRXL register.
Address <base> + 4H
Initial Value 0000H. This register is cleared by any reset.
In addition to reset input, the CBnRX register can be initialized by clearing (to
0) the CBnPWR bit of the CBnCTL0 register.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Receive data
R

The receive operation is started by reading the CBnRX register in the


reception enabled status.

(6) CBnTX - CSIB transmit data register


The CBnTX register is a 16-bit buffer register used to write the CSIBn transfer
data.
Access This register can be read/written in 16-bit units.
If the transfer data length is 8 bits, the lower 8 bits of this register are read/write
in 8-bit units as the CBnTXL register.
Address <base> + 6H
Initial Value 0000H. This register is cleared by any reset.
In addition to reset input, the CBnTX register can be initialized by clearing (to
0) the CBnPWR bit of the CBnCTL0 register.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Transmit data
R/W

The transmit operation is started by writing data to the CBnTX register in the
transmission enabled status.

Note The communication start conditions are shown below:


• Transmission mode (CBnTXE bit = 1, CBnRXE bit = 0):
Write to CBnTX register
• Transmission/reception mode (CBnTXE bit = 1, CBnRXE bit = 1):
Write to CBnTX register
• Reception mode (CBnTXE bit = 0, CBnRXE bit = 1):
Read from CBnRX register

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 619


Chapter 18 Clocked Serial Interface (CSIB)

18.4 Operation

18.4.1 Single transfer mode (master mode, transmission/reception


mode)

MSB first (CBnCTL0.CBnDIR bit = 0), communication type 1 (see 16.4 (2)
CSIBn control register 1 (CBnCTL1), transfer data length = 8 bits
(CBnCTL2.CBnCL3 to CBnCTL2.CBnCL0 bits = 0, 0, 0, 0)

CBnTX write (55H) CBnRX read (AAH)

SCKBn

CBnTX 55H (transmit data)

Shift ABH 56H ADH 5AH B5H 6AH D5H AAH 00H
register

CBnRX AAH 00H

INTCBnRNote

CBnTSF

CBnSCE

SIBn 1 0 1 0 1 0 1 0 (AAH)

SOBn 0 1 0 1 0 1 0 1 (55H)

(1) (5) (6) (7) (8)


(2)
(3)
(4)

(1) Clear the CBnCTL0.CBnPWR bit to 0.


(2) Set the CBnCTL1 and CBnCTL2 registers to specify the transfer mode.
(3) Set the CBnTXE, CBnRXE, and CBnSCE bits of the CBnCTL0 register to
1 at the same time as specifying the transfer mode using the CBnDIR bit,
to set the transmission/reception enabled status.
(4) Set the CBnPWR bit to 1 to enable the CSIBn operation.
(5) Write transfer data to the CBnTX register (transmission start).
(6) The reception complete interrupt request signal (INTCBnR) is output.
(7) Read the CBnRX register before clearing the CBnPWR bit to 0.
www.DataSheet4U.com (8) Check that the CBnSTR.CBnTSF bit = 0 and set the CBnPWR bit to 0 to
stop operation of CSIBn (end of transmission/reception).
To continue transfer, repeat steps (5) to (7) before (8).
In transmission mode or transmission/reception mode, communication is not
started by reading the CBnRX register.

620 User’s Manual U17566EE5V1UM00


Clocked Serial Interface (CSIB) Chapter 18

Note 1. In single transmission or single transmission/reception mode, the INTCBnT


signal is not generated. When communication is complete, the INTCBnR
signal is generated.
2. The processing of steps (3) and (4) can be set simultaneously.

Caution In case the CSIB interface is operating in


• single transmit/reception mode (CBnCTL0.CBnTMS = 0)
• communication type 2 respectively type 4 (CBnCTL1.CBnDAP = 1)
pay attention to following effect:
In case the next transmit should be initiated immediately after the occurrence
of the reception completion interrupt INTCBnR any write to the CBnTX register
is ignored as long as the communication status flag is still reflecting an ongoing
communication (CBnTSF = 1). Thus the new transmission will not be started.

For transmitting data continuously use one of the following options:


• Use continuous transfer mode (CBnCTL0.CBnTMS = 1). This is the only
usable mode for automatic transmission of data by the DMA controller.
• If single transfer mode (CBnCTL0.CBnTMS = 0) should be used,
CBnSTR.CBnTSF = 0 needs to be verified before writing data to the
CBnTX register.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 621


Chapter 18 Clocked Serial Interface (CSIB)

18.4.2 Single transfer mode (master mode, reception mode)

MSB first (CBnCTL0.CBnDIR bit = 0), communication type 1 (see 16.4 (2)
CSIBn control register 1 (CBnCTL1), transfer data length = 8 bits
(CBnCTL2.CBnCL3 to CBnCTL2.CBnCL0 bits = 0, 0, 0, 0)

CBnRX read (55H) CBnRX read (AAH)

SCKBn

CBnRX 55H (receive data) AAH 00H

Shift ABH 56H ADH 5AH B5H 6AH D5H AAH 00H
register

INTCBnR

SIBn 1 0 1 0 1 0 1 0 (AAH)

SOBn L

CBnTSF

CBnSCE

(1) (5) (6) (7)


(2) (8)
(3) (9)
(4)

(1) Clear the CBnCTL0.CBnPWR bit to 0.


(2) Set the CBnCTL1 and CBnCTL2 registers to specify the transfer mode.
(3) Set the CBnCTL0.CBnRXE and CBnCTL0.CBnSCE bits to 1,
CBnCTL0.TXE to 0, at the same time as specifying the transfer mode
using the CBnDIR bit, to set the reception enabled status.
(4) Set the CBnPWR bit to 1 to enable the CSIBn operation.
(5) Perform a dummy read of the CBnRX register (reception start trigger).
(6) The reception complete interrupt request signal (INTCBnR) is output.
(7) Set the CBnSCE bit to 0 to set the final receive data status.
(8) Read the CBnRX register.
(9) Check that the CBnSTR.CBnTSF bit = 0 and set the CBnPWR bit to 0 to
www.DataSheet4U.com stop the CSIBn operation (end of reception).

To continue transfer, repeat steps (5) and (6) before (7). (At this time, (5) is not
a dummy read, but a receive data read combined with the reception trigger.)

Note The processing of steps (3) and (4) can be set simultaneously.

622 User’s Manual U17566EE5V1UM00


Clocked Serial Interface (CSIB) Chapter 18

18.4.3 Continuous mode (master mode, transmission/reception


mode)

MSB first (CBnCTL0.CBnDIR bit = 0), communication type 3 (see 16.4 (2)
CSIBn control register 1 (CBnCTL1)), transfer data length = 8 bits
(CBnCTL2.CBnCL3 to CBnCTL2.CBnCL0 bits = 0, 0, 0, 0)

CBnTX 55H AAH

SCKBn

SOBn 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0

SIBn 1 1 0 0 1 1 0 0 1 0 0 1 0 1 1 0

INTCBnT

INTCBnR

CBnTSF

CBnSCE

Shift register CCH 96H 00H

SO latch

CBnRX CCH 96H 00H

(1) (5) (6) (7) (7) (8)


(2)
(3)
(4)

(1) Clear the CBnCTL0.CBnPWR bit to 0.


(2) Set the CBnCTL1 and CBnCTL2 registers to specify the transfer mode.
(3) Set the CBnTXE, CBnRXE, and CBnSCE bits of the CBnCTL0 register to
1 at the same time as specifying the transfer mode using the CBnDIR bit,
to set the transmission/reception enabled status.
(4) Set the CBnPWR bit to 1 to enable the CSIBn operation.
(5) Write transfer data to the CBnTX register (transmission start).
www.DataSheet4U.com (6) The transmission enable interrupt request signal (INTCBnT) is received
and transfer data is written to the CBnTX register.
(7) The reception complete interrupt request signal (INTCBnR) is output.
Read the CBnRX register before the next receive data arrives or before
the CBnPWR bit is cleared to 0.

User’s Manual U17566EE5V1UM00 623


Chapter 18 Clocked Serial Interface (CSIB)

(8) Check that the CBnSTR.CBnTSF bit = 0 and set the CBnPWR bit to 0 to
stop the operation of CSIBn (end of transmission/reception).
To continue transfer, repeat steps (5) to (7) before (8).
In transmission mode or transmission/reception mode, the communication is
not started by reading the CBnRX register.

18.4.4 Continuous mode (master mode, reception mode)

MSB first (CBnCTL0.CBnDIR bit = 0), communication type 2 (see 16.4 (2)
CSIBn control register 1 (CBnCTL1)), transfer data length = 8 bits
(CBnCTL2.CBnCL3 to CBnCTL2.CBnCL0 bits = 0, 0, 0, 0)

SCKBn

CBnSCE

SIBn 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0

L
SOBn

INTCnR

CBnTSF

Shift register 55H AAH 00H

CBnRX 55H AAH 00H

(1) (5) (6) (7)


(2)
(6) (8)
(3)
(4)

(1) Clear the CBnCTL0.CBnPWR bit to 0.


(2) Set the CBnCTL1 and CBnCTL2 registers to specify the transfer mode.
(3) Set the CBnCTL0.CBnRXE bit to 1 at the same time as specifying the
transfer mode using the CBnDIR bit, to set the reception enabled status.
(4) Set the CBnPWR bit to 1 to enable the CSIBn operation.
(5) Perform a dummy read of the CBnRX register (reception start trigger).
www.DataSheet4U.com (6) The reception complete interrupt request signal (INTCBnR) is output.
Read the CBnRX register before the next receive data arrives or before
the CBnPWR bit is cleared to 0.
(7) Set the CBnCTL0.CBnSCE bit = 0 while the last data being received to set
the final receive data status.

624 User’s Manual U17566EE5V1UM00


Clocked Serial Interface (CSIB) Chapter 18

(8) Check that the CBnSTR.CBnTSF bit = 0 and set the CBnPWR bit to 0 to
stop the operation of CSIBn (end of reception).
To continue transfer, repeat steps (5) and (6) before (7).

18.4.5 Continuous reception mode (error)

MSB first (CBnCTL0.CBnDIR bit = 0), communication type 2 (see 16.4 (2)
CSIBn control register 1 (CBnCTL1)), transfer data length = 8 bits
(CBnCTL2.CBnCL3 to CBnCTL2.CBnCL0 bits = 0, 0, 0, 0)

SCKBn

SIBn 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0

SOBn L

INTCBnR

INTCBnRE

CBnTSF

Shift register 55H AAH 00H

CBnRX 55H AAH 00H

CBnOVE

(1) (5) (6) (7) (8) (9) (10)


(2)
(3)
(4)

(1) Clear the CBnCTL0.CBnPWR bit to 0.


(2) Set the CBnCTL1 and CBnCTL2 registers to specify the transfer mode.
(3) Set the CBnCTL0.CBnRXE bit to 1 at the same time as specifying the
transfer mode using the CBnDIR bit, to set the reception enabled status.
(4) Set the CBnPWR bit = 1 to enable CSIBn operation.
(5) Perform a dummy read of the CBnRX register (reception start trigger).
(6) The reception complete interrupt request signal (INTCBnR) is output.
(7) If the data could not be read before the end of the next transfer, the
CBnSTR.CBnOVE flag is set to 1 upon the end of reception and the
reception error interrupt INTCBnRE is output.
www.DataSheet4U.com
(8) Overrun error processing is performed after checking that the
CBnOVE bit = 1 in the INTCBnRE interrupt servicing.
(9) Clear CBnOVE bit to 0.
(10)Check that the CBnSTR.CBnTSF bit = 0 and set the CBnPWR bit to 0 to
stop the operation CSIBn (end of reception).

User’s Manual U17566EE5V1UM00 625


Chapter 18 Clocked Serial Interface (CSIB)

18.4.6 Continuous mode (slave mode, transmission/reception


mode)

MSB first (CBnCTL0.CBnDIR bit = 0), communication type 2 (see 16.4 (2)
CSIBn control register 1 (CBnCTL1)), transfer data length = 8 bits
(CBnCTL2.CSnCL3 to CBnCTL2.CBnCL0 bits = 0, 0, 0, 0)

CBnTX 55H AAH

SCKBn

SOBn 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0

SIBn 1 1 0 0 1 1 0 0 1 0 0 1 0 1 1 0

INTCBnT

INTCBnR

CBnTSF

CBnSCE

Shift register CCH 96H 00H

SO latch

CBnRX CCH 96H 00H

(5)
(1) (6) (7) (7) (8)
(2)
(3)
(4)

(1) Clear the CBnCTL0.CBnPWR bit to 0.


(2) Set the CBnCTL1 and CBnCTL2 registers to specify the transfer mode.
(3) Set the CBnTXE, CBnRXE and CBnSCE bits of the CBnCTL0 register to 1
at the same time as specifying the transfer mode using the CBnDIR bit, to
set the transmission/reception enabled status.
www.DataSheet4U.com
(4) Set the CBnPWR bit to 1 to enable supply of the CSIBn operation.
(5) Write the transfer data to the CBnTX register.
(6) The transmission enable interrupt request signal (INTCBnT) is received
and the transfer data is written to the CBnTX register.
(7) The reception complete interrupt request signal (INTCBnR) is output.

626 User’s Manual U17566EE5V1UM00


Clocked Serial Interface (CSIB) Chapter 18

Read the CBnRX register.


(8) Check that the CBnSTR.CBnTSF bit = 0 and set the CBnPWR bit to 0 to
stop the operation of CSIBn (end of transmission/reception).
To continue transfer, repeat steps (5) to (7) before (8).

Note In order to start the entire data transfer the CBnTX register has to be written
initially, as done in step (5) above. If this step is omitted also no data will be
received.

Discontinued In case the CSIB is operating in continuous slave transmission mode


transmission (CBnCTL0.CBnTMS = 1, CBnCTL1.CBnCKS[2:0] = 111B) and new data is not
written to the CBnTX register the SOBn pin outputs the level of the last bit.
Table 18-4 outlines this behaviour.

CBnTX 55H AAH 96H

SCKBn

SOBn 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 0 1 0 1 1 0

INTCBnT

CBnTSF

(1) (2) (3) (4) (5) (6) (7)

Figure 18-4 Discontinued slave transmission

The example shows the situation that two data bytes (55H, AAH) are
transmitted correctly, but the third (96H) fails.
(1) Data 55H is written (by the CPU or DMA) to CBnTX.
(2) The master issues the clock SCKBn and transmission of 55H starts.
(3) INTCBnT is generated and the next data AAH is written to CBnTX
promptly, i.e. before the first data has been transmitted completely.
(4) Transmission of the second data AAH continues correctly and INTCBnT is
generated. But this time the next data is not written to CBnTX in time.
(5) Since there is no new data available in CBnTX, but the master continuous
to apply SCKBn clocks, SOBn remains at the level of the transmitted last
bit.
(6) New data (96H) is written to CBnTX.

(7) With the next SCKBn cycle transmission of the new data (96H) starts.
www.DataSheet4U.com
As a consequence the master receives a corrupted data byte from (5)
onwards, which is made up of a random number of the repeated last bit of the
former data and some first bits of the new data.

User’s Manual U17566EE5V1UM00 627


Chapter 18 Clocked Serial Interface (CSIB)

18.4.7 Continuous mode (slave mode, reception mode)

MSB first (CBnCTL0.CBnDIR bit = 0), communication type 1 (see 16.4 (2)
CSIBn control register 1 (CBnCTL1)), transfer data length = 8 bits
(CBnCTL2.CBnCL3 to CBnCTL2.CBnCL0 bits = 0, 0, 0, 0)

SCKBn

SIBn 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0

INTCBnR

CBnTSF

CBnSCE

Shift register 55H AAH 00H

CBnRX 55H AAH 00H

(1) (5) (6) (6) (7)


(2)
(3)
(4)

(1) Clear the CBnCTL0.CBnPWR bit to 0.


(2) Set the CBnCTL1 and CBnCTL2 registers to specify the transfer mode.
(3) Set the CBnCTL0.CBnRXE and CBnCTL0.CBnSCE bits to 1 at the same
time as specifying the transfer mode using the CBnDIR bit, to set the
reception enabled status.
(4) Set the CBnPWR bit = 1 to enable CSIBn operation.
(5) Perform a dummy read of the CBnRX register (reception start trigger).
(6) The reception complete interrupt request signal (INTCBnR) is output.
Read the CBnRX register.
(7) Check that the CBnSTR.CBnTSF bit = 0 and set the CBnPWR bit to 0 to
stop the operation of CSIBn (end of reception).
To continue transfer, repeat steps (5) and (6) before (7).

www.DataSheet4U.com

628 User’s Manual U17566EE5V1UM00


Clocked Serial Interface (CSIB) Chapter 18

18.4.8 Clock timing

SCKBn

SIBn
capture

SOBn D7 D6 D5 D4 D3 D2 D1 D0

Reg-R/W

INTCBnT
interruptNote 1
INTCBnR
interruptNote 2
CBnTSF

Figure 18-5 (i) Communication type 1 (CBnCKP = 0, CBnDAP = 0)

SCKBn

SIBn
capture

SOBn D7 D6 D5 D4 D3 D2 D1 D0

Reg-R/W

INTCBnT
interruptNote 1
INTCBnR
interruptNote 2

CBnTSF

Figure 18-6 (ii) Communication type 3 (CBnCKP = 1, CBnDAP = 0)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 629


Chapter 18 Clocked Serial Interface (CSIB)

SCKBn

SIBn
capture

SOBn D7 D6 D5 D4 D3 D2 D1 D0

Reg-R/W

INTCBnT
interruptNote 1
INTCBnR
interruptNote 2

CBnTSF

Figure 18-7 (iii) Communication type 2 (CBnCKP = 0, CBnDAP = 1)

SCKBn
SIBn
capture

SOBn D7 D6 D5 D4 D3 D2 D1 D0

Reg-R/W

INTCBnT
interruptNote 1

INTCBnR
interruptNote 2

CBnTSF

Figure 18-8 (iv) Communication type 4 (CBnCKP = 1, CBnDAP = 1)

Note 1. The INTCBnT interrupt is set when the data written to the transmit buffer is
transferred to the data shift register in the continuous transmission or
continuous transmission/reception modes. In the single transmission or
single transmission/reception modes, the INTCBnT interrupt request signal
is not generated, but the INTCBnR interrupt request signal is generated
upon completion of communication.
2. The INTCBnR interrupt occurs if reception is correctly completed and
receive data is ready in the CBnRX register while reception is enabled, and
if an overrun error occurs. In the single mode, the INTCBnR interrupt
request signal is generated even in the transmission mode, upon
www.DataSheet4U.com completion of communication.

630 User’s Manual U17566EE5V1UM00


Clocked Serial Interface (CSIB) Chapter 18

18.5 Output Pins

(1) SCKBn pin


When CSIBn operation is disabled (CBnCTL0.CBnPWR bit = 0), the SCKBn
pin output status is as follows.

CBnCKP CBnCKS2 CBnCKS1 CBnCKS0 SCKBn pin output


0 Don’t care Don’t care Don’t care Fixed to high level
1 1 1 1 High impedance
Other than above Fixed to low level

Note The output level of the SCKBn pin changes if any of the CBnCTL1.CBnCKP
and CBnCKS2 to CBnCKS0 bits is rewritten.

(2) SOBn pin


When CSIBn operation is disabled (CBnPWR bit = 0), the SOBn pin output
status is as follows.

CBnTXE CBnDAP CBnDIR SOBn pin output


0 × × Fixed to low level
1 0 × SOBn latch value (low level)
1 0 CBnTXn value (MSB)
1 CBnTXn value (LSB)

Note 1. The SOBn pin output changes when any one of the CBnCTL0.CBnTXE,
CBnCTL0.CBnDIR bits, and CBnCTL1.CBnDAP bit is rewritten.
2. × : don’t care

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 631


Chapter 18 Clocked Serial Interface (CSIB)

18.6 Operation Flow

(1) Single transmission

START

Initial setting (CBnCTL0Note,


CBnCTL1 registers, etc.)

Write CBnTX register


(start transfer).

No
INTCBnR generated?

Yes

Yes
Transfer data exists?

No

CBnPWR bit = 0
(CBnCTL0)

END

Note Set the CBnSCE bit to 1 in the initial setting.

Caution In the slave mode, data cannot be correctly transmitted if the next transfer
clock is input earlier than the CBnTX register is written.

www.DataSheet4U.com

632 User’s Manual U17566EE5V1UM00


Clocked Serial Interface (CSIB) Chapter 18

(2) Single reception

START

Initial setting (CBnCTL0Note,


CBnCTL1 registers, etc.)

CBnRX register dummy read


(start reception)

No
INTCBnR generated?

Yes

No
Last data?

Yes CBnRX register read

CBnSCE bit = 0
(CBnCTL0)

CBnRX register read

CBnPWR bit = 0
(CBnCTL0)

END

Note Set the CBnSCE bit to 1 in the initial setting.

Caution In the single mode, data cannot be correctly received if the next transfer clock
is input earlier than the CBnRX register is read.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 633


Chapter 18 Clocked Serial Interface (CSIB)

(3) Single transmission/reception

START

Initial setting (CBnCTL0Note 1,


CBnCTL1 registers, etc.)

Write CBnTX register


(start transfer).

No
INTCBnR generated?

Yes
Transmission/reception

Reception

Transmission
Read CBnRX register. Read CBnRX register.

No No No
Transfer end? Transfer end? Transfer end?

Yes Write CBnTX registerNote 2. Yes Write CBnTX registerNote 2. Yes Write CBnTX registerNote 2.

B A

CBnPWR bit = 0,
CBnTXE bit = CBnRXE bit = 0
(CBnCTL0)

END

Note 1. Set the CBnSCE bit to 1 in the initial setting.


2. If the next transfer is reception only, dummy data is written to the CBnTX
register.

Caution Even in the single mode, the CBnSTR.CBnOVE flag is set to 1. If only
transmission is used in the transmission/reception mode, therefore,
programming without checking the CBnOVE flag is recommended.

www.DataSheet4U.com

634 User’s Manual U17566EE5V1UM00


Clocked Serial Interface (CSIB) Chapter 18

(4) Continuous transmission

START

Initial setting (CBnCTL0Note,


CBnCTL1 registers, etc.)

Write CBnTX register


(start transfer).

No
INTCBnT generated?

Yes

Exists data to be Yes


transferred next?

No

No
CBnTSF bit = 0?
(CBnSTR)

Yes

CBnPWR bit = 0
(CBnCTL0)

END

Note Set the CBnSCE bit to 1 in the initial setting.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 635


Chapter 18 Clocked Serial Interface (CSIB)

(5) Continuous reception

START

Initial setting (CBnCTL0Note,


CBnCTL1 registers, etc.)

CBnRX register dummy read


(start reception)

No

No
INTCBnRE generated? INTCBnR generated? CBnRX register read

Yes Yes

CBnSCE bit = 0 Is data being No


(CBnCTL0) received last data?

Yes
CBnRX register read
CBnSCE bit = 0
(CBnCTL0)
CBnOVE bit clear
(CBnSTR)
CBnRX register read

No
INTCBnR generated?

Yes

CBnRX register read

END

Note Set the CBnSCE bit to 1 in the initial setting.

Caution In the master mode, the clock is output without limit when dummy data is read
from the CBnRX register. To stop the clock, execute the flow marked  in the
www.DataSheet4U.com above flowchart.
In the slave mode, malfunction due to noise during communication can be
prevented by executing the flow marked  in the above flowchart.
Before resuming communication, set the CBnCTL0.CBnSCE bit to 1, and read
dummy data from the CBnRX register.

636 User’s Manual U17566EE5V1UM00


Clocked Serial Interface (CSIB) Chapter 18

(6) Continuous transmission/reception

START

Initial setting (CBnCTL0Note,


CBnCTL1 registers, etc.)

Write CBnTX register.

No
INTCBnT generated?

Yes

Last data No
transferred?

Yes Write CBnTX register.

Yes
INTCBnR generated?

No CBnRX register read

No
INTCBnRE generated?

Data received No
Yes completely?

Yes
CBnRX register read

CBnOVE bit clear


(CBnSTR)

END

www.DataSheet4U.com

Note Set the CBnSCE bit to 1 in the initial setting.

User’s Manual U17566EE5V1UM00 637


Chapter 18 Clocked Serial Interface (CSIB)

18.7 Baud Rate Generator

18.7.1 Overview

Each CSIBn interface is equipped with a dedicated baud rate generator.

Selector
SPCLK1 8-bit timer counter
(1, 1/2, 1/4, 1/8)

BGnCS1, BGnCS0 Match detector 1/2 BRGnOUT

PRSCMn

18.7.2 Baud Rate Generator registers

The Baud Rate Generators BRGn are controlled and operated by means of the
following registers:

Table 18-8 BRGn registers overview

Register name Shortcut Address


BRGn prescaler mode register PRSMn <BRG_base>
BRGn prescaler compare register PRSCMn <BRG_base> + 1H

Table 18-9 BRGn register base address


Timer Base address <BRG_base>
BRG0 FFFF FDC0H
BRG1 FFFF FDE0H
BRG2 FFFF FDF0H

www.DataSheet4U.com

638 User’s Manual U17566EE5V1UM00


Clocked Serial Interface (CSIB) Chapter 18

(1) PRSMn - Prescaler mode registers


The PRSMn registers control generation of the baud rate signal for CSIB.
Access This register can be read/written in 8-bit or 1-bit units.
Address <BRG_base>
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 BGCEn 0 0 BGCSn1 BGCSn0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 18-10 PRSMn register contents

Bit position Bit name Function


4 BGCEn Baud rate output
0: disabled
1: enabled
1 to 0 BGCSn[1:0] Input clock selection
BGCSn1 BGCSn0 Input clock selection (fBGCSn) Setting value k
0 0 fSPCLK1 0
0 1 fSPCLK1/2 1
1 0 fSPCLK1/4 2
1 1 fSPCLK1/8 3

Caution 1. Do not rewrite the PRSMn register during operation.


2. Set the BGCSn[1:0] bits before setting the BGCEn bit to 1.

(2) PRSCMn - Prescaler compare registers


The PRSCMn registers are 8-bit compare registers.
Access This register can be read/written in 8-bit units.
Address <BRG_base> + 1H

Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
PRSCMn7 PRSCMn6 PRSCMn5 PRSCMn4 PRSCMn3 PRSCMn2 PRSCMn1 PRSCMn0
R/W

www.DataSheet4U.com
Caution 1. Do not rewrite the PRSCMn register during operation.
2. Set the PRSCMn register before setting the PRSMn.BGCEn bit to 1.

User’s Manual U17566EE5V1UM00 639


Chapter 18 Clocked Serial Interface (CSIB)

18.7.3 Baud rate calculation

The transmission/reception clock is generated by dividing the main clock. The


baud rate generated from the main clock is obtained by the following equation.

fSPCLK1
f BRGn = ---------------------------
-
k
2 × N× 2

Note fBRGn: BRGn count clock


fSPCLK1: Main clock oscillation frequency
k: PRSMn.BGCSn[1:0] register setting value (0 ≤k ≤3)
N: PRSCMn.PRSCMn[7:0] register value
if PRSCMn = 00H: N = 256.

www.DataSheet4U.com

640 User’s Manual U17566EE5V1UM00


Clocked Serial Interface (CSIB) Chapter 18

18.8 Cautions

18.8.1 CSIBn behaviour during debugger break

The CSIBn continues to operate in debugger break-mode, provided all clocks


are continuing.
The CSIBn continuous to operate during debugger break-mode
• in continuous reception/transmission mode
• in slave reception/transmission mode

Reception When the CSIBn is in reception mode and an external device is sending data
during debugger break-mode the CSIBn may produce an overflow error as it
continues to receive data during break-mode.
Thus the overflow error flag UCBnSTR.CBnOVE may be set and the reception
error interrupt INTCBnRE may be generated. Further all following received
data are discarded.
Note that the reception error interrupt INTCBnRE will not be served during
break-mode, but after resuming run-mode, provided the interrupt controller is
configured accordingly.

Transmission If the debugger’s break-mode is entered while the CSIBn is transmitting data,
the transmission is completed, and finally a transmission enable interrupt
request INTCBnT is generated.
Note that the transmission enable interrupt INTCNnT will not be served during
break-mode, but after resuming run-mode, provided the interrupt controller is
configured accordingly.

DMA reception If the DMA controller is used to fetch received data from the CBnRX register,
the DMA controller continues to do so in debugger break-mode, but the data in
CBnRX is not tagged as already read. Thus the next receive data during
break-mode will generate an overflow error, as described above.
If the specified number of data units in the DBCn register has been fetched
from the CSIBn the DCHCn.TCn is set and the DMA completion interrupt
INTDMAn is generated. The INTDMAn request is served after resuming run-
mode.
Since the DMA trigger interrupt INTCBnR is not generated in case of an
overflow (the INTCBnRE interrupt is generated instead), no further DMA
triggers occur. Only the first received data in break-mode is transferred by the
DMA, all following data are discarded.

DMA transmission If the DMA controller is used to write transmission data to the CBnTX register,
the DMA controller continues to do so in debugger break-mode. If the specified
number of data units in the DBCn register has been transferred to the CSIBn
www.DataSheet4U.com the DCHCn.TCn is set and the DMA completion interrupt INTDMAn is
generated. The INTDMAn request is served after resuming run-mode.

User’s Manual U17566EE5V1UM00 641


Chapter 18 Clocked Serial Interface (CSIB)

18.8.2 CSIB operation stop

(1) Details - Master mode operation


When any channel of CSIB is operated with a peripheral clock source different
to the clock source of the CPU, the CSIB may stop operating.
Depending on the CSIB operating configuration the CSIB behaves as
described below.
• Transmit mode or transmit/receive mode:
Any write to the related CBnTX0 register will no longer start a transmission
sequence. Furthermore the related transmission interrupt request will not be
generated.
• Receive mode:
Any read from the related CBnRX0 register will no longer start a receive
sequence. Furthermore the related receive interrupt request will not be
generated.
The described CSIBn stuck condition can be escaped by initiating a system
reset or by a sequential clear and set of the CBnCTL0.CBnPWR bit.

(2) Details - Slave mode operation


When any channel of CSIB is operated in slave mode and an external clock
signal is input via the SCKBn pin while no transmission or reception sequence
is in progress the CSIB may stop operating.
Depending on the CSIB operating configuration the CSIB behaves as
described below.
• Transmit mode or transmit/receive mode
Any further write to the CBnTX0 register followed by an external input clock
signal input will no longer start a transmission sequence. Furthermore the
related transmission interrupt request will not be generated.
• Receive mode:
Any read from the related CBnRX0 register followed by an external input
clock signal input will no longer start a receive sequence. Furthermore the
related receive interrupt request will not be generated.
The described CSIBn stuck condition can be escaped by initiating a system
reset or by a sequential clear and set of the CBnCTL0.CBnPWR bit.

(3) Workaround - Master mode operation


In order to avoid the CSIBn stuck condition in master mode use only the
following CPU clock to CSIBn input clock combinations:

SCC. CKC. BRGn clock CSIB clock


CPU clock source
SPSEL0 PERIC source (SPCLK1) input
4 MHz 0 0 4 MHz main osc PCLK6 .. 1,
main osc BRGn
0 1 4 MHz main osc PCLK6 .. 2,
BRGn
www.DataSheet4U.com
1 0 PLL PCLK6 .. 1
1 1 PLL PCLK6 .. 2
PLL 1 0 PLL BRGn
1 1 PCLK1, BRGn
SSCG 1 X PLL BRGn

642 User’s Manual U17566EE5V1UM00


Clocked Serial Interface (CSIB) Chapter 18

(4) Workaround - Slave mode operation


In order to avoid the CSIBn stuck condition in slave mode take the following
precautions.
• Transmit mode or transmit/receive mode:
Make sure the external CSIBn clock is not input in parallel when writing to
the CBnTX0 register after a transmission sequence is finished.
• Receive mode:
Make sure the external CSIBn clock is not input in parallel when reading
from the CBnRX0 register after a reception sequence is finished.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 643


Chapter 18 Clocked Serial Interface (CSIB)

www.DataSheet4U.com

644 User’s Manual U17566EE5V1UM00


Chapter 19 I2C Bus (IIC)

The V850E/Dx3 microcontrollers have following instances of the I2C Bus


interface IIC:

IIC All devices


Instances 2
Names IIC0 to IIC1

Throughout this chapter, the individual instances of I2C Bus interface are
identified by “n”, for example IICn, or IICCn for the IICn control register.

19.1 Features

The I²C provides a synchronous serial interface with the following features:
• Supports Master and Slave mode
• 8-bit data transfer
• Transfer speed
– up to 100 kbit/s (Standard Mode)
– up to 381kbit/s (Fast Mode)
• I2C root clock sources from main oscillator, PLL and SSCG
• Two wire interface
– SCLn: serial clock
– SDAn: serial data
• Noise filter on SCLn and SDAn input
– spikes with a width of less than one period of IICLK are suppressed
• IICn interrupts can be used for triggering the DMA Controller

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 645


Chapter 19 I2C Bus (IIC)

19.2 I2C Pin Configuration

The I2C function requires to define the pins SCL0 and SDA0 as input and open
drain output pins simultaneously. In the following the pin configuration registers
are listed to be set up properly for I2C:

• PFSR0.PFSR04 = 1/0: select input for I2C0


• PLCDC6.PLCDC64/65 = 0: no LCD output (if applicable)
• PMCn.PMCnm = 1: alternative mode
• Input type:
– PICCn.PICCnm = 0: non-Schmitt Trigger input for standard mode
– PICCn.PICCnm = 1: Schmitt Trigger input for fast-speed mode
• PILCn.PILCnm = 0: CMOS1 level
• PDSCn.PDSCnm = 1: drive strength control Limit2
• PODCn.PODCnm = 1: open drain output
• PMn.PMnm = 1: input mode
It is recommended to set the output mode as the last step.

Table 19-2 shows how to set up the registers for activating I2C0 from different
pin groups.

Table 19-1 I2C interface pins set up


I2Cn PFSR0 register Pins and pin group Register settings
I2C0 PFSR0.PFSR04 = 0 SDA0/SCL0 via P16/P17 PMC1.PMC1[7:6] = 11B
PICC1.PICC1[7:6] = 00B/11Ba
PILC1.PILC1[7:6] = 00B
PDSC1.PDSC1[7:6] = 11B
PODC1.PODC1[7:6] = 11B
PM1.PM1[7:6] = 11B
PFSR0.PFSR04 = 1 SCL0/SDA0 via P64/P65 PLCDC6.PLCDC6[5:4] = 00B
PMC6.PMC6[5:4] = 11B
PICC6.PICC6[5:4] = 00B/11Ba
PILC6.PILC6[5:4] = 00B
PDSC6.PDSC6[5:4] = 11B
PODC6.PODC6[5:4] = 11B
PM6.PM6[5:4] = 11B
a)
PICCnm = 00B for standard mode, PICCnm = 11B for fast-speed mode

www.DataSheet4U.com

646 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

19.3 I2C Pin Configuration

The I2C function requires to define the pins SCLn and SDAn as input and open
drain output pins simultaneously. In the following the pin configuration registers
are listed to be set up properly for I2C:

• PFSR0.PFSR04/5 = 1/0: select input for I2Cn (where applicable)


• PLCDCn.PLCDCnm = 0: no LCD output (where applicable)
• PFCn.PFCnm = 1/0: select ALT1-/ALT2-OUT (where applicable)
• PMCn.PMCnm = 1: alternative mode
• Input type:
– PICCn.PICCnm = 0: non-Schmitt Trigger input for standard mode
– PICCn.PICCnm = 1: Schmitt Trigger input for fast-speed mode
• PILCn.PILCnm = 0: CMOS1 level
• PDSCn.PDSCnm = 1: drive strength control Limit2
• PODCn.PODCnm = 1: open drain output
• PMn.PMnm = 1: input mode
It is recommended to set the output mode in the last step.

Table 19-2 shows how to set up the registers for activating I2C0 and I2C1 from
different pin groups.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 647


Chapter 19 I2C Bus (IIC)

Table 19-2 I2C interface pins set up


I2Cn PFSR0 register Pins and pin group Register settings
2
I C0 PFSR0.PFSR04 = 0 SDA0/SCL0 via P16/P17 PMC1.PMC1[7:6] = 11B
PICC1.PICC1[7:6] = 00B/11Ba
PILC1.PILC1[7:6] = 00B
PDSC1.PDSC1[7:6] = 11B
PODC1.PODC1[7:6] = 11B
PM1.PM1[7:6] = 11B
PFSR0.PFSR04 = 1 SCL0/SDA0 via P64/P65 PLCDC6.PLCDC6[5:4] = 00B
PFC6.PFC6[5:4] = 00B
PMC6.PMC65 = 1B
PICC6.PICC6[5:4] = 00B/11Ba
PILC6.PILC6[5:4] = 00B
PDSC6.PDSC6[5:4] = 11B
PODC6.PODC6[5:4] = 11B
PM6.PM6[5:4] = 11B
I2C1 PFSR0.PFSR05 = 0 SDA1/SCL1 via P20/P21 PLCDC2.PLCDC2[1:0] = 00B
PMC2.PMC2[1:0] = 11B
PICC2.PICC2[1:0] = 00B/11Ba
PILC2.PILC2[1:0] = 00B
PDSC2.PDSC2[1:0] = 11B
PODC2.PODC2[1:0] = 11B
PM2.PM2[1:0] = 11B
PFSR0.PFSR05 = 1 SDA1/SCL1 via P30/P31 PFC3.PFC30 = 1B
PMC3.PMC3[1:0] = 11B
PICC3.PICC3[1:0] = 00B/11Ba
PILC3.PILC3[1:0] = 00B
PDSC3.PDSC3[1:0] = 11B
PODC3.PODC3[1:0] = 11B
PM3.PM3[1:0] = 11B
a)
PICCnm = 00B for standard mode, PICCnm = 11B for fast-speed mode

www.DataSheet4U.com

648 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

19.4 I2C Pin Configuration

The I2C function requires to define the pins SCLn and SDAn as input and open
drain output pins simultaneously. In the following the pin configuration registers
are listed to be set up properly for I2C:

• PFSR0.PFSR04/5 = 1/0: select input for I2Cn (where applicable)


• PLCDCn.PLCDCnm = 0: no LCD output (where applicable)
• PFCn.PFCnm = 1/0: select ALT1-/ALT2-OUT (where applicable)
• PMCn.PMCnm = 1: alternative mode
• Input type:
– PICCn.PICCnm = 0: non-Schmitt Trigger input for standard mode
– PICCn.PICCnm = 1: Schmitt Trigger input for fast-speed mode
• PILCn.PILCnm = 0: CMOS1 level
• PDSCn.PDSCnm = 1: drive strength control Limit2
• PODCn.PODCnm = 1: open drain output
• PMn.PMnm = 1: input mode
It is recommended to set the output mode as the last step.

Table 19-2 shows how to set up the registers for activating I2C0 and I2C1 from
different pin groups.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 649


Chapter 19 I2C Bus (IIC)

Table 19-3 I2C interface pins set up


I2Cn PFSR0 register Pins and pin group Register settings
2
I C0 PFSR0.PFSR04 = 0 SDA0/SCL0 via P16/P17 PMC1.PMC1[7:6] = 11B
PICC1.PICC1[7:6] = 00B/11Ba
PILC1.PILC1[7:6] = 00B
PDSC1.PDSC1[7:6] = 11B
PODC1.PODC1[7:6] = 11B
PM1.PM1[7:6] = 11B
PFSR0.PFSR04 = 1 SCL0/SDA0 via P64/P65 PLCDC6.PLCDC6[5:4] = 00B
PFC6.PFC6[5:4] = 00B
PMC6.PMC6[5:4] = 11B
PICC6.PICC6[5:4] = 00B/11Ba
PILC6.PILC6[5:4] = 00B
PDSC6.PDSC6[5:4] = 11B
PODC6.PODC6[5:4] = 11B
PM6.PM6[5:4] = 11B
I2C1 PFSR0.PFSR05 = 0 SDA1/SCL1 via P20/P21 PLCDC2.PLCDC2[1:0] = 00B
PFC2.PFC2[1:0] = 00B
PMC2.PMC2[1:0] = 11B
PICC2.PICC2[1:0] = 00B/11Ba
PILC2.PILC2[1:0] = 00B
PDSC2.PDSC2[1:0] = 11B
PODC2.PODC2[1:0] = 11B
PM2.PM2[1:0] = 11B
PFSR0.PFSR05 = 1 SDA1/SCL1 via P30/P31 PFC3.PFC30 = 1B
PMC3.PMC3[1:0] = 11B
PICC3.PICC3[1:0] = 00B/11Ba
PILC3.PILC3[1:0] = 00B
PDSC3.PDSC3[1:0] = 11B
PODC3.PODC3[1:0] = 11B
PM3.PM3[1:0] = 11B
a) PICCnm = 00B for standard mode, PICCnm = 11B for fast-speed mode

www.DataSheet4U.com

650 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

19.5 Configuration

The block diagram of the I2C0n is shown below.

Internal bus

IIC status register n (IICSn)

MSTSn ALDn EXCn COIn TRCn ACKDn STDn SPDn


IIC control register n
(IICCn)

IICEn LRELn WRELnSPIEn WTIMn ACKEn STTn SPTn

Set

Note Slave address Clear Start condition


SDAn ( ) register n (SVAn) generator
Match signal
Noise
eliminator SO latch

IIC shift
DQ
register n (IICn) CLn1,
CLn0

Data hold Acknowledge


time correction output circuit
N-ch open-drain circuit
output
Wake-up controller

Acknowledge detector

Star t condition
detector

Stop condition
Note
SCLn ( ) detector

Noise Interrupt request


INTIICn
eliminator Serial clock counter signal generator

Serial clock Serial clock


controller wait controller Bus status
N-ch open-drain
output IICLKTC detector

IICLK Prescaler Prescaler


IICLKPS = IICLK to IICLK/5

OCKSENn OCKSTHn OCKSn1 OCKSn0 CLDn DADn SMCn DFCn CLn1 CLn0 CLXn STCFn IICBSYn STCENn IICRSVn

IIC division clock select IIC clock select IIC function expansion IIC flag register n
register m (OCKSn) register n (IICCLn) register n (IICXn) (IICFn)
Internal bus

Note: Schmitt Trigger input buffer for fast-speed mode, non Schmitt Trigger for standard mode

Figure 19-1 Block diagram of I2C0n

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 651


Chapter 19 I2C Bus (IIC)

A serial bus configuration example is shown below.

+VDD +VDD

Master CPU1 Serial data bus Master CPU2


SDA SDA
Slave CPU1 Slave CPU2
Serial clock
SCL SCL
Address 1 Address 2

SDA Slave CPU3

SCL Address 3

SDA Slave IC

SCL Address 4

SDA Slave IC

SCL Address N

Figure 19-2 Serial bus configuration example using I2C bus

I2C0n includes the following hardware.

(1) IIC shift register n (IICn)


The IICn register converts 8-bit serial data into 8-bit parallel data and vice
versa, and can be used for both transmission and reception.
Write and read operations to the IICn register are used to control the actual
transmit and receive operations.

(2) Slave address register n (SVAn)


The SVAn register sets local addresses when in slave mode.

(3) SO latch
The SO latch is used to retain the output level of the SDAn pin.
www.DataSheet4U.com
(4) Wakeup controller
This circuit generates an interrupt request when the address received by this
register matches the address value set to the SVAn register or when an
extension code is received.

652 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

(5) Prescaler
This selects the sampling clock to be used.

(6) Serial clock counter


This counter counts the serial clocks that are output and the serial clocks that
are input during transmit/receive operations and is used to verify that 8-bit data
was transmitted or received.

(7) Interrupt request signal generator


This circuit controls the generation of interrupt request signals (INTIICn).

An I2C interrupt is generated following either of two triggers:


• Falling edge of eighth or ninth clock of the serial clock (set by IICCn.WTIMn
bit)
• Interrupt occurrence due to stop condition detection (set by IICCn.SPIEn bit)

(8) Serial clock controller


In master mode, this circuit generates the clock output via the SCLn pin from
the sampling clock.

(9) Serial clock wait controller


This circuit controls the wait timing.

(10) ACK output circuit, stop condition detector, start condition detector, and
ACK detector
These circuits are used to output and detect various control signals.

(11) Data hold time correction circuit


This circuit generates the hold time for data corresponding to the falling edge
of the SCLn pin.

(12) Start condition generator


A start condition is issued when the IICCn.STTn bit is set.
However, in the communication reservation disabled status
(IICFn.IICRSVn = 1), this request is ignored and the IICFn.STCFn bit is set if
the bus is not released (IICFn.IICBSYn = 1).

(13) Bus status detector


Whether the bus is released or not is ascertained by detecting a start condition
and stop condition.
However, the bus status cannot be detected immediately after operation, so
set the bus status detector to the initial status by using the IICFn.STCENn bit.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 653


Chapter 19 I2C Bus (IIC)

19.6 IIC Registers

The I2C serial interfaces IICn are controlled and operated by means of the
following registers:

Table 19-4 IICn registers overview


Register name Shortcut Address
IICn shift register IICn <base>
IICn control register IICCn <base> + 2H
IICn slave address register SVAn <base> + 3H
IICn clock select register IICCLn <base> + 4H
IICn function expansion register IICXn <base> + 5H
IICn status register IICSn <base> + 6H
IICn flag register IICF0n <base> + AH
IICn division clock select registers OCKSn <base> + 20H

Table 19-5 IICn register base address


IICn Base address <base>
IIC0 FFFF FD80H
IIC1 FFFF FD90H

Note IICn control register


The IICCn registers enable/stop I2C operations, set the wait timing and other
I2C operations.
These registers can be read or written in 8-bit or 1-bit units. However, set the
SPIEn, WTIMn, and ACKEn bits when the IICn.IICEn bit is 0 or during the wait
period. When setting the IICn.IICEn bit from “0” to “1”, these bits can also be
set at the same time.

www.DataSheet4U.com

654 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

(1) IICCn - IICn control registers

The IICCn registers enable/stop I2Cn operations, set the wait timing, and set
other I2Cn operations.
Access This register can be read/written in 8-bit or 1-bit units.
Address <base> + 2H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
IICEn LRELn WRELn SPIEn WTIMn ACKEn STTn SPTn
R/W R/W R/W R/W R/W R/W R/W R/W

IICEn Specification of I2Cn operation enable/disable


0 Operation stopped. IICSn register reset Note. Internal operation stopped.
1 Operation enabled.
Condition for clearing (IICEn = 0) Condition for setting (IICEn = 1)
• Cleared by instruction • Set by instruction
• After reset

Note The IICS register, IICFn.STCFn and IICFn.IICBSYn bits, and IICCLn.CLDn
and IICCLn.DADn bits are reset.

LRELn Exit from communications


0 Normal operation
This exits from the current communication operation and sets stand-by mode. This setting is
automatically cleared after being executed. Its uses include cases in which a locally irrelevant
extension code has been received.
1
The SCLn and SDAn lines are set to high impedance.
The STTn and SPTn bits and the MSTSn, EXCn, COIn, TRCn, ACKDn, and STDn bits of the IICSn
register are cleared.
The stand-by mode following exit from communications remains in effect until the following communication entry
conditions are met.
• After a stop condition is detected, restart is in master mode.
• An address match occurs or an extension code is received after the start condition.
Condition for clearing (LRELn = 0) Condition for setting (LRELn = 1)
• Automatically cleared after execution • Set by instruction
• After reset

WRELn Wait cancellation control


0 Wait not cancelled
1 Wait cancelled. This setting is automatically cleared after wait is cancelled.
Condition for clearing (WRELn = 0) Condition for setting (WRELn = 1)
www.DataSheet4U.com
• Automatically cleared after execution • Set by instruction
• After reset

User’s Manual U17566EE5V1UM00 655


Chapter 19 I2C Bus (IIC)

SPIEn Enable/disable generation of interrupt request when stop condition is detected


0 Disabled
1 Enabled
Condition for clearing (SPIEn = 0) Condition for setting (SPIEn = 1)
• Cleared by instruction • Set by instruction
• After reset

WTIMn Control of wait and interrupt request generation


Interrupt request is generated at the eighth clock’s falling edge.
Master mode: After output of eight clocks, clock output is set to low level and wait is set.
Slave mode: After input of eight clocks, the clock is set to low level and wait is set for the master
0 device.
In order to generate the ninth clock on SCLn the wait status must be cancelled by writing to IICn or
setting IICCn.WRELn = 1. Consequently the ninth clock will be delayed until the wait status is
cancelled.
Interrupt request is generated at the ninth clock’s falling edge.
Master mode: After output of nine clocks, clock output is set to low level and wait is set.
1
Slave mode: After input of nine clocks, the clock is set to low level and wait is set for the master
device.
During address transfer, an interrupt occurs at the falling edge of the ninth clock regardless of this bit setting. This
bit setting becomes valid when the address transfer is completed. In master mode, a wait is inserted at the falling
edge of the ninth clock during address transfer. For a slave device that has received a local address, a wait is
inserted at the falling edge of the ninth clock after an ACK signal is issued. When the slave device has received
an extension code, however, a wait is inserted at the falling edge of the eighth clock.
Condition for clearing (WTIMn = 0) Condition for setting (WTIMn = 1)
• Cleared by instruction • Set by instruction
• After reset

ACKEn Acknowledgement control


0 Acknowledgment disabled.
Acknowledgment enabled. During the ninth clock period, the SDAn line is set to low level.
1
However, ACK is invalid in other than extension mode during address transfers.
Condition for clearing (ACKEn = 0) Condition for setting (ACKEn = 1)
• Cleared by instruction • Set by instruction
• After reset

www.DataSheet4U.com

656 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

STTn Start condition trigger


0 Start condition is not generated.
When bus is released (in STOP mode):
A start condition is generated (for starting as master). The SDAn line is changed from high level to
low level and then the start condition is generated. Next, after the rated amount of time has
elapsed, the SCLn line is changed to low level.
During communication with a third party:
If the communication reservation function is enabled (IICFn.IICRSVn = 0)
1 • This trigger functions as a start condition reserve flag. When set, it releases the bus and then
automatically generates a start condition.
If the communication reservation function is disabled (IICRSVn = 1)
• The IICFn.STCFn bit is set. This trigger does not generate a start condition.
In the wait state (when master device):
A restart condition is generated after the wait is released.
Cautions concerning set timing
For master reception: Cannot be set during transfer. Can be set only when the ACKEn bit has been set to 0
and the slave has been notified of final reception.
For master transmission: A start condition cannot be generated normally during the ACK period. Set during the
wait period.
For slave: Even when the communication reservation function is disabled
(IICRSVn bit = 1), the communication reservation status is entered.
Condition for clearing (STTn = 0) Note Condition for setting (STTn = 1)
• Cleared by loss in arbitration • Set by instruction
• Cleared after start condition is generated by master
device
• When the LRELn = 1 (communication save)
• When the IICEn= 0 (operation stop)
• After reset

Note The STTn bit is 0 if it is read immediately after data setting.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 657


Chapter 19 I2C Bus (IIC)

SPTn Stop condition trigger


0 Stop condition is not generated.
Stop condition is generated (termination of master device’s transfer).
After the SDAn line goes to low level, either set the SCLn line to high level or wait until it goes to
1
high level. Next, after the rated amount of time has elapsed, the SDAn line is changed from low
level to high level and a stop condition is generated.
Cautions concerning set timing
For master reception: Cannot be set during transfer.
Can be set only when the ACKEn bit has been set to 0 and during the wait period after
the slave has been notified of final reception.
For master transmission: A stop condition cannot be generated normally during the ACK period. Set during the
wait period.
• SPTn cannot be set at the same time as the STTn bit.
• The SPTn bit can be set only when in master mode Note 1.
• When the WTIMn bit has been set to 0 and the SPTn bit is set during the wait period that follows output of
eight clocks, note that a stop condition will be generated during the high-level period of the ninth clock.
When the ninth clock must be output to apply the ACK on the bus by the receiving device, proceed as follows:
- Change IICCn.WTIMn from 0 to 1 in order to receive an additional interrupt after the ninth clock.
- Cancel the wait state by IICCn.WRELn = 1 or by writing to the IICn register.
- Upon the interrupt after the ninth clock require to set the stop condition by IICCn.STPn = 1. By this the wait
status will be cancelled and the stop condition will be generated on the bus.
Condition for clearing (SPTn = 0) Note 2 Condition for setting (SPTn = 1)
• Cleared by loss in arbitration • Set by instruction
• Automatically cleared after stop condition is detected
• When the LRELn = 1 (communication save)
• When the IICEn = 0 (operation stop)
• After reset

Note 1. Set the SPTn bit only in master mode. However, when communication
reservation is enabled (IICFn.IICRSVn = 0), the SPTn bit must be set and
a stop condition generated before the first stop condition is detected
following the switch to the operation enabled status. For details, see
“Cautions“ on page 705.
2. Clearing the IICEn bit to 0 invalidates the signals of this flag.
3. The SPTn bit is 0 if it is read immediately after data setting.

Caution When the TRCn = 1, the WRELn bit is set during the ninth clock and wait is
canceled, after which the TRCn bit is cleared and the SDAn line is set to high
impedance.

www.DataSheet4U.com

658 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

(2) IICSn - IICn status registers

The IICSn registers indicate the status of the I2Cn bus.


Access This register can only be read in 8-bit or 1-bit units.
Address <base> + 6H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
MSTSn ALDn EXCn COIn TRCn ACKDn STDn SPDn
R R R R R R R R

MSTSn Master device status


0 Slave device status or communication stand-by status
1 Master device communication status
Condition for clearing (MSTSn = 0) Condition for setting (MSTSn = 1)
• When a stop condition is detected • When a start condition is generated
• When the ALDn = 1 (arbitration loss)
• Cleared by LRELn = 1 (communication save)
• When the IICEn bit changes from 1 to 0 (operation
stop)
• After reset

ALDn Arbitration loss detection


0 This status means either that there was no arbitration or that the arbitration result was a “win”.
1 This status indicates the arbitration result was a “loss”. The MSTSn bit is cleared.
Condition for clearing (ALDn = 0) Condition for setting (ALDn = 1)
• Automatically cleared after the IICSn register is read • When the arbitration result is a “loss”.
Note

• When the IICEn bit changes from 1 to 0 (operation


stop)
• After reset

Note Any bit manipulation instruction targetting this register also clears this bit.

EXCn Detection of extension code reception


0 Extension code was not received.
1 Extension code was received.
Condition for clearing (EXCn = 0) Condition for setting (EXCn = 1)
•When a start condition is detected • When the higher four bits of the received address
•When a stop condition is detected data are either “0000” or “1111” (set at the rising
•Cleared by LRELn = 1 (communication save) edge of the eighth clock).
•When the IICEn bit changes from 1 to 0 (operation
stop)
www.DataSheet4U.com
• After reset

User’s Manual U17566EE5V1UM00 659


Chapter 19 I2C Bus (IIC)

COIn Matching address detection


0 Addresses do not match.
1 Addresses match.
Condition for clearing (COIn = 0) Condition for setting (COIn = 1)
• When a start condition is detected • When the received address matches the local
• When a stop condition is detected address (SVAn register) (set at the rising edge of
• Cleared by LRELn bit = 1 (communication save) the eighth clock).
• When the IICEn bit changes from 1 to (operation
stop)
• After reset

TRCn Transmit/receive status detection


0 Receive status (other than transmit status). The SDAn line is set to high impedance.
Transmit status. The value in the SO latch is enabled for output to the SDAn line (valid starting at
1
the falling edge of the first byte’s ninth clock).
Condition for clearing (TRCn = 0) Condition for setting (TRCn = 1)
• When a stop condition is detected Master
• Cleared by LRELn = 1 (communication save)
• When a start condition is generated
• When the IICEn bit changes from 1 to 0 (operation
stop) Slave
• Cleared by WRELn = 1Note • When “1” is input by the first byte’s LSB
• When the ALDn bit changes from 0 to 1 (arbitration (transfer direction specification bit)
loss)
• After reset

Master
• When “1” is output to the first byte’s LSB
(transfer direction specification bit)
Slave
• When a start condition is detected
When not used for communication

ACKDn ACK detection


0 ACK was not detected.
1 ACK was detected.
Condition for clearing (ACKDn = 0) Condition for setting (ACKD = 1)
•When a stop condition is detected • After the SDAn bit is set to low level at the rising
•At the rising edge of the next byte’s first clock edge of the SCLn pin’s ninth clock
•Cleared by LRELn = 1 (communication save)
•When the IICEn bit changes from 1 to 0 (operation
stop)
• After reset
www.DataSheet4U.com
Note The TRCn bit is cleared and SDAn line becomes high impedance when the
WRELn bit is set and the wait state is canceled at the ninth clock by
TRCn = 1.

660 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

STDn Start condition detection


0 Start condition was not detected.
1 Start condition was detected. This indicates that the address transfer period is in effect
Condition for clearing (STDn = 0) Condition for setting (STDn = 1)
• When a stop condition is detected • When a start condition is detected
• At the rising edge of the next byte’s first clock
following address transfer
• Cleared by LRELn = 1 (communication save)
• When the IICEn bit changes from 1 to 0 (operation
stop)
• After reset

SPDn Stop condition detection


0 Stop condition was not detected.
Stop condition was detected. The master device’s communication is terminated and the bus is
1
released.
Condition for clearing (SPDn = 0) Condition for setting (SPDn = 1)
• At the rising edge of the address transfer byte’s first • When a stop condition is detected
clock following setting of this bit and detection of a
start condition
• When the IICEn bit changes from 1 to 0 (operation
stop)
• After reset

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 661


Chapter 19 I2C Bus (IIC)

(3) IICFn - IICn flag registers

The registers set the I2Cn operation mode and indicate the I2C bus status.
Access This register can be read/written in 8-bit or 1-bit units.
STCFn and IICBSYn bits are read-only.
Address <base> + AH
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
STCFn IICBSYn 0 0 0 0 STCENn IICRSVn
R R R/W R/W R/W R/W R/W R/W

IICRSVn enables/disables the communication reservation function.


The initial value of the IICBSYn bit is set by using the STCENn bit (see
“Cautions“ on page 705).

The IICRSVn and STCENn bits can be written only when operation of I2Cn is
disabled (IICCn.IICEn = 0). After operation is enabled, IICFn can be read.

STCFn STTn clear


0 Start condition issued
1 Start condition cannot be issued, STTn bit cleared
Condition for clearing (STCFn = 0) Condition for setting (STCFn = 1)
• Cleared by IICCn.STTn = 1 • When start condition is not issued and STTn flag
• After reset is cleared during communication reservation is
disabled (IICRSVn = 1).

IICBSYn I2Cn bus status


0 Bus released status
1 Bus communication status
Condition for clearing (IICBSYn = 0) Condition for setting (IICBSYn = 1)
• When stop condition is detected • When start condition is detected
• After reset • By setting the IICCn.IICEn bit when the STCENn =
0

STCENn Initial start enable trigger


Start conditions cannot be generated until a stop condition is detected following operation enable
0
(IICEn bit = 1).
Start conditions can be generated even if a stop condition is not detected following operation
1
enable (IICEn = 1).
Condition for clearing (STCENn = 0) Condition for setting (STCENn = 1)
• When start condition is detected • Setting by instruction
• After reset
www.DataSheet4U.com

662 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

IICRSVn Communication reservation function disable bit


0 Communication reservation enabled
1 Communication reservation disabled
Condition for clearing (IICRSVn = 0) Condition for setting (IICRSVn = 1)
• Clearing by instruction • Setting by instruction
• After reset

Note Bits 6 and 7 are read-only bits.

Caution 1. Write the STCENn bit only when operation is stopped


(IICEn = 0).
2. When the STCENn = 1, the bus released status (IICBSYn = 0) is recognized
regardless of the actual bus status immediately after the I2Cn bus operation
is enabled. Therefore, to issue the first start condition (STTn = 1), it is
necessary to confirm that the bus has been released, so as to not disturb
other communications.
3. Write the IICRSVn bit only when operation is stopped (IICEn = 0).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 663


Chapter 19 I2C Bus (IIC)

(4) IICCLn - IICn clock select registers

The IICCLn registers set the transfer clock for the I2Cn bus.
The SMCn, CLn1, and CLn0 bits are set by the combination of the IICXn.CLXn
bit and the OCKSTHn, OCKSn[1:0] bits of the OCKSn register (see “Transfer
rate setting“ on page 666).
Access This register can be read/written in 8-bit or 1-bit units.
CLDn and DADn bits are read-only.
Address <base> + 4H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 CLDn DADn SMCn DFCn CLn1 CLn0
R/W R/W R R R/W R/W R/W R/W

CLDn Detection of SCLn pin level (valid only when IICCn.IICEn = 1)


0 The SCLn pin was detected at low level.
1 The SCLn pin was detected at high level.
Condition for clearing (CLDn = 0) Condition for setting (CLDn = 1)
• When the SCLn pin is at low level • When the SCLn pin is at high level
• When the IICEn = 0 (operation stop)
• After reset

DADn Detection of SDAn pin level (valid only when IICEn = 1)


0 The SDAn pin was detected at low level.
1 The SDAn pin was detected at high level.
Condition for clearing (DADn = 0) Condition for setting (DAD0n = 1)
• When the SDAn pin is at low level • When the SDAn pin is at high level
• When the IICEn = 0 (operation stop)
• After reset

SMCn Operation mode switching


0 Operation in standard mode.
1 Operation in fast-speed mode.

DFCn Digital filter operation control


0 Digital filter off.
1 Digital filter on.
The digital filter can be used only in fast-speed mode.
In fast-speed mode, the transfer clock does not vary regardless of the DFCn bit setting (on/off).
The digital filter is used to eliminate noise in fast-speed mode.
www.DataSheet4U.com

664 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

(5) IICXn - IICn function expansion registers


The IICXn registers provide additional transfer data rate configuration in fast-
speed mode. Setting of the IICXn.CLXn is performed in combination with the
IICCLn.SMCn, IICCLn.CLn[1:0], OCKSn.OCKSTHn and OCKSn.OCKSn[1:0]
(refer to “Transfer rate setting“ on page 666)

Access This register can be read/written in 8-bit or 1-bit units.


Address <base> + 5H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 CLXn
R/W R/W R/W R/W R/W R/W R/W R/W

(6) OCKSn - IICn division clock select registers

The OCKSn registers control the I2Cn division clock.


Access This register can be read/written in 8-bit or 1-bit units.
Address <base> + 20H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 OCKSENn OCKSTHn 0 OCKSn1 OCKSn0
R/W R/W R/W R/W R/W R/W R/W R/W

OCKSENn Operation setting of I2C clock


0 Disable I2C division clock operation
1 Enable I2C division clock operation

OCKSTHn OCKSn1 OCKSn0 Output clock IICLKPS


0 0 0 IICLK/2
0 0 1 IICLK/3
0 1 0 IICLK/4
0 1 1 IICLK/5
1 0 0 IICLK
Other than above Setting prohibited

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 665


Chapter 19 I2C Bus (IIC)

(7) Transfer rate setting

The nominal transfer rate of the I2C interface is determined by the following
means:

• the root clock source for the I2C clock IICLK can be chosen as
– main oscillator (4 MHz): ICC.IICSEL1 = 0
– 32 MHz clock from the PLL: ICC.IICSEL1 = 1
• a prescaler in the Clock Generator divides the chosen clock source by
– 1.0: ICC.IICPS[2:0]=000B
– 3.5: ICC.IICPS[2:0]=101B
– 4.5: ICC.IICPS[2:0]=111B
The output clock IICLK supplies the IIC interface.
• The IICLK can be divided by 1 to 5, configured by OCKSn.OCKSTHn and
OCKSn.OCKSn[1:0] (refer to “OCKSn - IICn division clock select registers“
on page 665). The output clock of this divider is named IICLKPS.
• IICLK respectively IICLKPS is passed through another configurable divider
that finally outputs the clock for the serial transfer IICLKTC. This divider is
configured by IICCLn.CL[1:0] and IICXn.CLX0 according to the following
table:

Note The clock chosen as the input clock, that means IICLK or IICLKPS, must lie in
the range of 1 MHz to 10 MHz.

Transfer
IICXn.CLXn IICCLn.SMCn IICCLn.CLn1 IICCLn.CLn0 Input clock Mode
clock
0 0 0 0 fIICLKPS fIICLKPS/44 standard
0 1 fIICLKPS fIICLKPS/86 standard
1 0 fIICLK fIICLK/86. standard
1 1 fIICLKPS fIICLKPS/66 standard
1 0 0 fIICLKPS fIICLKPS/24 fast-speed
0 1 fIICLKPS fIICLKPS/24 fast-speed
1 0 fIICLK fIICLK/24 fast-speed
1 1 fIICLKPS fIICLKPS/18 fast-speed
1 0 x x n.a. n.a. n.a.
1 0 0 fIICLKPS fIICLKPS/12 fast-speed
0 1 fIICLKPS fIICLKPS/12 fast-speed
1 0 fIICLK fIICLK/12 fast-speed

www.DataSheet4U.com

666 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

Following table lists set-ups for some useful I2C transfer clocks.

Clock Generator Prescaler I2C module set-up Transfer


IICPS IICCLn. IICXn. IICCLn. clock
divisor OCKSn divisor divisor [KHz]
[2:0] SMCn CLXn CLn[1:0]
1 0000B =
101B 3.5 2 1 1 00B 12 380,95
10H
1 0010B =
101B 3.5 4 1 0 00B 24 95,24
12H
1 0010B =
111B 4.5 4 1 0 11B 18 98,77
12H

Note The calculations in the above table assumes that IICLK is 32 MHz
(IIC.IICSEL1 = 1)
Clock Stretching Heavy capacitive load and the dimension of the external pull-up resistor on the
I2C bus pins may yield extended rise times of the rising edge of SCLn and
SDAn. Since the controller senses the level of the I2C bus signals it recognizes
such situation and takes countermeasures by stretching the clock SCLn in
order to ensure proper high level time tSCLH of SCLn.
After the microcontroller releases the (open-drain) SCLn pin it waits until the
SCLn level exceeds the valid high level threshold VthH. Then it does not pull
SCLn to low level before the nominal high level time tSCLH_nom has elapsed.

This mechanism is the same used, when a slow I2C slave device is pulling
down SCLn to low level to initiate a wait state.
Figure 19-3 shows an example.

VthH
SCL signal

effective SCL
clock

tr tSCLH tSCLL tr

TSCL_nom

TSCL_eff

Figure 19-3 Clock Stretching of SCLn

www.DataSheet4U.com The effective clock frequency appearing at the SCLn pin calculates to
fSCL_eff = 1 / (TSCL_nom + tr)
With a nominal frequency of fSCL_nom = 395 KHz (TSCL_nom = 2.532 µs and a
rise time of tr = 135 ns the effective frequency is feff = 375 KHz.

User’s Manual U17566EE5V1UM00 667


Chapter 19 I2C Bus (IIC)

(8) IICn - IICn shift registers


The IICn registers are used for serial transmission/reception (shift operations)
synchronized with the serial clock.
A wait state is released by writing the IICn register during the wait period, and
data transfer is started.
Access This register can be read/written in 8-bit units.
Data should not be written to the IICn register during a data transfer.
Address <base>
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
Input/output data
R/W

(9) SVAn - IICn slave address registers

The SVAn registers hold the I2C bus’s slave addresses.


Access This register can be read/written in 8-bit units.
Bit 0 should be fixed to 0.
Address <base> + 3H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
Slave address
R/W

www.DataSheet4U.com

668 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

19.7 I2C Bus Pin Functions

The serial clock pin (SCLn) and serial data bus pin (SDAn) are configured as
follows.
• SCLn
This pin is used for serial clock input and output.

This pin is an N-ch open-drain output for both master and slave devices.
Input is Schmitt Trigger input for fast-speed mode respectively non Schmitt
Trigger for standard mode.
• SDAn
This pin is used for serial data input and output.
This pin is an N-ch open-drain output for both master and slave devices.
Input is Schmitt Trigger input for fast-speed mode respectively non Schmitt
Trigger for standard mode.
Since outputs from the serial clock line and the serial data bus line are N-ch
open-drain outputs, an external pull-up resistor is required.

PORTVDD Slave device

Master device
SCLn SCLn

Clock output (Clock output)


PORTVDD

(Clock input) ( ) ( ) Clock input


Note Note
SDAn SDAn

Data output Data output

Data input ( ) ( ) Data input


Note Note

Note: Schmitt Trigger input buffer for fast-speed mode, non Schmitt Trigger for standard mode

Figure 19-4 Pin configuration diagram

19.8 I2C Bus Definitions and Control Methods

www.DataSheet4U.com The following section describes the I2C bus’s serial data communication format
and the signals used by the I2C bus. The transfer timing for the “start

User’s Manual U17566EE5V1UM00 669


Chapter 19 I2C Bus (IIC)

condition”, “data”, and “stop condition” output via the I2C bus’s serial data bus
is shown below.

SCLn 1 to 7 8 9 1 to 7 8 9 1 to 7 8 9

SDAn

Start Address R/W ACK Data ACK Data ACK Stop


condition condition

Figure 19-5 I2C bus serial data transfer timing with stop termination

Instead of a stop condition the master may also send a repeated start
condition, when it wishes to keep hold of the bus and to start a new data
transfer.

SCLn 1 to 7 8 9 1 to 7 8 9 1 to 7 8 9

SDAn

Start Address R/W ACK Data ACK Data ACK Repeated start
condition condition

Figure 19-6 I2C bus serial data transfer timing with restart

The master device outputs the start condition, slave address, and stop
condition.
The acknowledge signal (ACK) can be output by either the master or slave
device (normally, it is output by the device that receives 8-bit data).
The serial clock (SCLn) is continuously output by the master device. However,
in the slave device, the SCLn pin’s low-level period can be extended and a wait
can be inserted.

19.8.1 Start condition

A start condition is met when the SCLn pin is high level and the SDAn pin
changes from high level to low level. The start condition for the SCLn and
SDAn pins is a signal that the master device outputs to the slave device when
starting a serial transfer. The slave device can detect the start condition.

www.DataSheet4U.com

670 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

H
SCLn

SDAn

Figure 19-7 Start condition

A start condition is output when the IICCn.STTn bit is set (1) after a stop
condition has been detected (IICSn.SPDn bit = 1). When a start condition is
detected, the IICSn.STDn bit is set (1). By setting IICCN.STTn=1 the master
device will also cancel its own wait status.

19.8.2 Addresses

The 7 bits of data that follow the start condition are defined as an address.
An address is a 7-bit data segment that is output in order to select one of the
slave devices that are connected to the master device via the bus lines.
Therefore, each slave device connected via the bus lines must have a unique
address.
The slave devices include hardware that detects the start condition and checks
whether or not the 7-bit address data matches the data values stored in the
SVAn register. If the address data matches the values of the SVAn register, the
slave device is selected and communicates with the master device until the
master device transmits a start condition or stop condition.

SCLn 1 2 3 4 5 6 7 8 9

SDAn AD6 AD5 AD4 AD3 AD2 AD1 AD0 R/W

Address
Note
INTIICn

Figure 19-8 Address

Note The interrupt request signal (INTIICn) is generated if a local address or


extension code is received during slave device operation.

www.DataSheet4U.com The slave address and the eighth bit, which specifies the transfer direction as
described in “Transfer direction specification“ on page 672, are written together
to IIC shift register n (IICn) and then output. Received addresses are written to
the IICn register.
The slave address is assigned to the higher 7 bits of the IICn register.

User’s Manual U17566EE5V1UM00 671


Chapter 19 I2C Bus (IIC)

19.8.3 Transfer direction specification

In addition to the 7-bit address data, the master device sends 1 bit that
specifies the transfer direction. When this transfer direction specification bit
has a value of 0, it indicates that the master device is transmitting data to a
slave device. When the transfer direction specification bit has a value of 1, it
indicates that the master device is receiving data from a slave device.

SCLn 1 2 3 4 5 6 7 8 9

SDAn AD6 AD5 AD4 AD3 AD2 AD1 AD0 R/W

Transfer direction specification


Note
INTIICn

Figure 19-9 Transfer direction specification

Note The INTIICn signal is generated if a local address or extension code is


received during slave device operation.

19.8.4 Acknowledge signal (ACK)

The acknowledge signal (ACK) is used by the transmitting and receiving


devices to confirm serial data reception.
The receiving device returns one ACK signal for each 8 bits of data it receives.
The transmitting device normally receives an ACK signal after transmitting 8
bits of data. However, when the master device is the receiving device, it does
not output an ACK signal after receiving the final data to be transmitted. The
transmitting device detects whether or not an ACK signal is returned after it
transmits 8 bits of data. When an ACK signal is returned, the reception is
judged as normal and processing continues. If the slave device does not return
an ACK signal, the master device outputs either a stop condition or a restart
condition and then stops the current transmission. Failure to return an ACK
signal may be caused by the following two factors.
(a) Reception was not performed normally.
(b) The final data was received.

When the receiving device sets the SDAn line to low level during the ninth
clock, the ACK signal becomes active (normal receive response).
When the IICCn.ACKEn bit is set to 1, automatic ACK signal generation is
enabled.
www.DataSheet4U.com
Transmission of the eighth bit following the 7 address data bits causes the
IICSn.TRCn bit to be set. When this TRCn bit’s value is 0, it indicates receive
mode. Therefore, the ACKEn bit should be set to 1.
When the slave device is receiving (when TRCn bit = 0), if the slave device
does not need to receive any more data after receiving several bytes, clearing

672 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

the ACKEn bit to 0 will prevent the master device from starting transmission of
the subsequent data.
Similarly, when the master device is receiving (when TRCn bit = 0) and the
subsequent data is not needed and when either a restart condition or a stop
condition should therefore be output, clearing the ACKEn bit to 0 will prevent
the ACK signal from being returned. This prevents the MSB from being output
via the SDAn line (i.e., stops transmission) during transmission from the slave
device.

SCL0n 1 2 3 4 5 6 7 8 9

SDA0n AD6 AD5 AD4 AD3 AD2 AD1 AD0 R/W ACK

Figure 19-10 ACK signal

When the local address is received, an ACK signal is automatically output in


synchronization with the falling edge of the SCLn pin’s eighth clock regardless
of the value of the ACKEn bit. No ACK signal is output if the received address
is not a local address.
The ACK signal output method during data reception is based on the wait
timing setting, as described below.
When 8-clock wait is selected (IICCn.WTIMn bit = 0):
The ACK signal is output at the falling edge of the SCLn pin’s eighth clock if
the ACKEn bit is set to 1 before wait cancellation.
When 9-clock wait is selected (IICCn.WTIMn bit = 1):
The ACK signal is automatically output at the falling edge of the SCLn pin’s
eighth clock if the ACKEn bit has already been set to 1.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 673


Chapter 19 I2C Bus (IIC)

19.8.5 Stop condition

When the SCLn pin is high level, changing the SDAn pin from low level to high
level generates a stop condition.
A stop condition is a signal that the master device outputs to the slave device
when serial transfer has been completed. When used as the slave device, the
start condition can be
detected.

H
SCLn

SDAn

Figure 19-11 Stop condition

A stop condition is generated when the IICCn.SPTn bit is set to 1. When the
stop condition is detected, the IICSn.SPDn bit is set to 1 and the INTIICn
signal is generated when the IICCn.SPIEn bit is set to 1. By setting
IICCN.STPn=1 the master device will also cancel its own wait status.

www.DataSheet4U.com

674 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

19.8.6 Wait signal (WAIT)

The wait signal (WAIT) is used to notify the communication partner that a
device (master or slave) is preparing to transmit or receive data (i.e., is in a
wait state).
Setting the SCLn pin to low level notifies the communication partner of the wait
status. When the wait status has been cancelled for both the master and slave
devices, the next data transfer can begin.

(1) When master device has a nine-clock wait and slave device has an eight-
clock wait (master: transmission, slave: reception, and IICCn.ACKEn
bit = 1)

Master (Tx)
Master returns to high
impedance but slave Wait after output
is in wait state (low level). of ninth clock.
IICn data write (cancel wait)
IICn

SCLn 6 7 8 9 1 2 3

Slave (Rx)
Wait after output
of eighth clock. FFH is written to IICn register or
IICCn.WRELn bit is set to 1.
IICn

SCLn

H
ACKEn

Transfer lines
Wait signal Wait signal
from slave from master
SCLn 6 7 8 9 1 2 3

SDAn D2 D1 D0 ACK D7 D6 D5

Figure 19-12 Wait signal (1/2)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 675


Chapter 19 I2C Bus (IIC)

(2) When master and slave devices both have a nine-clock wait
(master: transmission, slave: reception, and ACKEn bit = 1)

Master (Tx) Master and slave both wait


after output of ninth clock.
IICn data write (cancel wait)
IICn

SCLn 6 7 8 9 1 2 3

Slave (Rx)
FFH is written to IICn register
or WRELn bit is set to 1.
IICn

SCLn

ACKEn H

Wait signal
Transfer lines from master Wait signal
/slave from slave
SCLn 6 7 8 9 1 2 3

SDAn D2 D1 D0 ACK D7 D6 D5

Output according to previously set ACKEn bit value

Figure 19-13 Wait signal (2/2)

A wait may be automatically generated depending on the setting of the


IICCn.WTIMn bit.
Normally, when the IICCn.WRELn bit is set to 1 or when FFH is written to the
IICn register on the receiving side, the wait status is cancelled and the
transmitting side writes data to the IICn register to cancel the wait status.
The master device can also cancel its own wait status via either of the following
methods.
• By setting the IICCn.STTn bit to 1
• By setting the IICCn.SPTn bit to 1

www.DataSheet4U.com

676 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

19.9 I2C Interrupt Request Signals (INTIICn)

The following shows the value of the IICSn register at the INTIICn interrupt
request signal generation timing and at the INTIICn signal timing.

19.9.1 Master device operation

(1) Start ~ Address ~ Data ~ Data ~ Stop (normal transmission/reception)

<1> When WTIMn bit = 0

SPTn bit = 1

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK SP

▲1 ▲2 ▲3 ▲4 Δ5
▲1: IICSn register = 10XXX110B
▲2: IICSn register = 10XXX000B
▲3: IICSn register = 10XXX000B (WTIMn bit = 1)
▲4: IICSn register = 10XXXX00B
Δ 5: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

<2> When WTIMn bit = 1

SPTn bit = 1

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK SP

▲1 ▲2 ▲3 Δ4

▲1: IICSn register = 10XXX110B


▲2: IICSn register = 10XXX100B
▲3: IICSn register = 10XXXX00B
Δ 4: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2
www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 677


Chapter 19 I2C Bus (IIC)

(2) Start ~ Address ~ Data ~ Start ~ Address ~ Data ~ Stop (restart)

<1> When WTIMn bit = 0

STTn bit = 1 SPTn bit = 1


↓ ↓
ST AD6 to AD0 RW AK D7 to D0 AK ST AD6 to AD0 RW AK D7 to D0 AK SP

▲1 ▲2 ▲3 ▲4 ▲5 ▲6 Δ7
▲1: IICSn register = 10XXX110B
▲2: IICSn register = 10XXX000B (WTIMn bit = 1)
▲3: IICSn register = 10XXXX00B (WTIMn bit = 0)
▲4: IICSn register = 10XXX110B (WTIMn bit = 0)
▲5: IICSn register = 10XXX000B (WTIMn bit = 1)
▲6: IICSn register = 10XXXX00B
Δ 7: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

<2> When WTIMn bit = 1

STTn bit = 1 SPTn bit = 1


↓ ↓
ST AD6 to AD0 RW AK D7 to D0 AK ST AD6 to AD0 RW AK D7 to D0 AK SP

▲1 ▲2 ▲3 ▲4 Δ5
▲1: IICSn register = 10XXX110B
▲2: IICSn register = 10XXXX00B
▲3: IICSn register = 10XXX110B
▲4: IICSn register = 10XXXX00B
Δ 5: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

www.DataSheet4U.com

678 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

(3) Start ~ Code ~ Data ~ Data ~ Stop (extension code transmission)

<1> When WTIMn bit = 0

SPTn bit = 1

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK SP

▲1 ▲2 ▲3 ▲4 Δ5
▲1: IICSn register = 1010X110B
▲2: IICSn register = 1010X000B
▲3: IICSn register = 1010X000B (WTIMn bit = 1)
▲4: IICSn register = 1010XX00B
Δ 5: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

<2> When WTIMn bit = 1

SPTn bit = 1

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK SP

▲1 ▲2 ▲3 Δ4

▲1: IICSn register = 1010X110B


▲2: IICSn register = 1010X100B
▲3: IICSn register = 1010XX00B
Δ 4: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 679


Chapter 19 I2C Bus (IIC)

19.9.2 Slave device operation

(1) Start ~ Address ~ Data ~ Data ~ Stop

<1> When WTIMn bit = 0

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK SP

▲1 ▲2 ▲3 Δ4
▲1: IICSn register = 0001X110B
▲2: IICSn register = 0001X000B
▲3: IICSn register = 0001X000B
Δ 4: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

<2> When WTIMn bit = 1

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK SP

▲1 ▲2 ▲3 Δ4
▲1: IICSn register = 0001X110B
▲2: IICSn register = 0001X100B
▲3: IICSn register = 0001XX00B
Δ 4: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

www.DataSheet4U.com

680 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

(2) Start ~ Address ~ Data ~ Start ~ Address ~ Data ~ Stop

<1> When WTIMn bit = 0 (after restart, address match)

ST AD6 to AD0 RW AK D7 to D0 AK ST AD6 to AD0 RW AK D7 to D0 AK SP

▲1 ▲2 ▲3 ▲4 Δ5
▲1: IICSn register = 0001X110B
▲2: IICSn register = 0001X000B
▲3: IICSn register = 0001X110B
▲4: IICSn register = 0001X000B
Δ 5: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

<2> When WTIMn bit = 1 (after restart, address match)

ST AD6 to AD0 RW AK D7 to D0 AK ST AD6 to AD0 RW AK D7 to D0 AK SP

▲1 ▲2 ▲3 ▲4 Δ5
▲1: IICSn register = 0001X110B
▲2: IICSn register = 0001XX00B
▲3: IICSn register = 0001X110B
▲4: IICSn register = 0001XX00B
Δ 5: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 681


Chapter 19 I2C Bus (IIC)

(3) Start ~ Address ~ Data ~ Start ~ Code ~ Data ~ Stop

<1> When WTIMn bit = 0 (after restart, extension code reception)

ST AD6 to AD0 RW AK D7 to D0 AK ST AD6 to AD0 RW AK D7 to D0 AK SP

▲1 ▲2 ▲3 ▲4 Δ5
▲1: IICSn register = 0001X110B
▲2: IICSn register = 0001X000B
▲3: IICSn register = 0010X010B
▲4: IICSn register = 0010X000B
Δ 5: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

<2> When WTIMn bit = 1 (after restart, extension code reception)

ST AD6 to AD0 RW AK D7 to D0 AK ST AD6 to AD0 RW AK D7 to D0 AK SP

▲1 ▲2 ▲3 ▲4 ▲5 Δ6
▲1: IICSn register = 0001X110B
▲2: IICSn register = 0001XX00B
▲3: IICSn register = 0010X010B
▲4: IICSn register = 0010X110B
▲5: IICSn register = 0010XX00B
Δ 6: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

www.DataSheet4U.com

682 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

(4) Start ~ Address ~ Data ~ Start ~ Address ~ Data ~ Stop

<1> When WTIMn bit = 0 (after restart, address mismatch (= not extension code))

ST AD6 to AD0 RW AK D7 to D0 AK ST AD6 to AD0 RW AK D7 to D0 AK SP

▲1 ▲2 ▲3 Δ4
▲1: IICSn register = 0001X110B
▲2: IICSn register = 0001X000B
▲3: IICSn register = 00000X10B
Δ 4: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

<2> When WTIMn bit = 1 (after restart, address mismatch (= not extension code))

ST AD6 to AD0 RW AK D7 to D0 AK ST AD6 to AD0 RW AK D7 to D0 AK SP

▲1 ▲2 ▲3 Δ4

▲1: IICSn register = 0001X110B


▲2: IICSn register = 0001XX00B
▲3: IICSn register = 00000X10B
Δ 4: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 683


Chapter 19 I2C Bus (IIC)

19.9.3 Slave device operation (when receiving extension code)

(1) Start ~ Code ~ Data ~ Data ~ Stop

<1> When WTIMn bit = 0

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK SP

▲1 ▲2 ▲3 Δ4
▲1: IICSn register = 0010X010B
▲2: IICSn register = 0010X000B
▲3: IICSn register = 0010X000B
Δ 4: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

<2> When WTIMn bit = 1

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK SP

▲1 ▲2 ▲3 ▲4 Δ5
▲1: IICSn register = 0010X010B
▲2: IICSn register = 0010X110B
▲3: IICSn register = 0010X100B
▲4: IICSn register = 0010XX00B
Δ 5: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

www.DataSheet4U.com

684 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

(2) Start ~ Code ~ Data ~ Start ~ Address ~ Data ~ Stop

<1> When WTIMn bit = 0 (after restart, address match)

ST AD6 to AD0 RW AK D7 to D0 AK ST AD6 to AD0 RW AK D7 to D0 AK SP

▲1 ▲2 ▲3 ▲4 Δ5
▲1: IICSn register = 0010X010B
▲2: IICSn register = 0010X000B
▲3: IICSn register = 0001X110B
▲4: IICSn register = 0001X000B
Δ 5: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

<2> When WTIMn bit = 1 (after restart, address match)

ST AD6 to AD0 RW AK D7 to D0 AK ST AD6 to AD0 RW AK D7 to D0 AK SP

▲1 ▲2 ▲3 ▲4 ▲5 Δ6
▲1: IICSn register = 0010X010B
▲2: IICSn register = 0010X110B
▲3: IICSn register = 0010XX00B
▲4: IICSn register = 0001X110B
▲5: IICSn register = 0001XX00B
Δ 6: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 685


Chapter 19 I2C Bus (IIC)

(3) Start ~ Code ~ Data ~ Start ~ Code ~ Data ~ Stop

<1> When WTIMn bit = 0 (after restart, extension code reception)

ST AD6 to AD0 RW AK D7 to D0 AK ST AD6 to AD0 RW AK D7 to D0 AK SP

▲1 ▲2 ▲3 ▲4 Δ5
▲1: IICSn register = 0010X010B
▲2: IICSn register = 0010X000B
▲3: IICSn register = 0010X010B
▲4: IICSn register = 0010X000B
Δ 5: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

<2> When WTIMn bit = 1 (after restart, extension code reception)

ST AD6 to AD0 RW AK D7 to D0 AK ST AD6 to AD0 RW AK D7 to D0 AK SP

▲1 ▲2 ▲3 ▲4 ▲5 ▲6 Δ7
▲1: IICSn register = 0010X010B
▲2: IICSn register = 0010X110B
▲3: IICSn register = 0010XX00B
▲4: IICSn register = 0010X010B
▲5: IICSn register = 0010X110B
▲6: IICSn register = 0010XX00B
Δ 7: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

www.DataSheet4U.com

686 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

(4) Start ~ Code ~ Data ~ Start ~ Address ~ Data ~ Stop

<1> When WTIMn bit = 0 (after restart, address mismatch (= not extension code))

ST AD6 to AD0 RW AK D7 to D0 AK ST AD6 to AD0 RW AK D7 to D0 AK SP

▲1 ▲2 ▲3 Δ4
▲1: IICSn register = 0010X010B
▲2: IICSn register = 0010X000B
▲3: IICSn register = 00000X10B
Δ 4: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

<2> When WTIMn bit = 1 (after restart, address mismatch (= not extension code))

ST AD6 to AD0 RW AK D7 to D0 AK ST AD6 to AD0 RW AK D7 to D0 AK SP

▲1 ▲2 ▲3 ▲4 Δ5

▲1: IICSn register = 0010X010B


▲2: IICSn register = 0010X110B
▲3: IICSn register = 0010XX00B
▲4: IICSn register = 00000X10B
Δ 5: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 687


Chapter 19 I2C Bus (IIC)

19.9.4 Operation without communication

(1) Start ~ Code ~ Data ~ Data ~ Stop

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK SP

Δ1
Δ 1: IICSn register = 00000001B

Remarks 1. Δ: Generated only when SPIEn bit = 1


2. n = 0 to 2

19.9.5 Arbitration loss operation (operation as slave after


arbitration loss)

(1) When arbitration loss occurs during transmission of slave address data

<1> When WTIMn bit = 0

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK SP

▲1 ▲2 ▲3 Δ4
▲1: IICSn register = 0101X110B (Example: When ALDn bit is read during interrupt servicing)
▲2: IICSn register = 0001X000B
▲3: IICSn register = 0001X000B
Δ 4: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

<2> When WTIMn bit = 1

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK SP

▲1 ▲2 ▲3 Δ4
▲1: IICSn register = 0101X110B (Example: When ALDn bit is read during interrupt servicing)
▲2: IICSn register = 0001X100B
▲3: IICSn register = 0001XX00B
Δ 4: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
www.DataSheet4U.com X: don’t care
2. n = 0 to 2

688 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

(2) When arbitration loss occurs during transmission of extension code

<1> When WTIMn bit = 0

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK SP

▲1 ▲2 ▲3 Δ4
▲1: IICSn register = 0110X010B (Example: When ALDn bit is read during interrupt servicing)
▲2: IICSn register = 0010X000B
▲3: IICSn register = 0010X000B
Δ 4: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

<2> When WTIMn bit = 1

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK SP

▲1 ▲2 ▲3 ▲4 Δ5

▲1: IICSn register = 0110X010B (Example: When ALDn bit is read during interrupt servicing)
▲2: IICSn register = 0010X110B
▲3: IICSn register = 0010X100B
▲4: IICSn register = 0010XX00B
Δ 5: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 689


Chapter 19 I2C Bus (IIC)

19.9.6 Operation when arbitration loss occurs

(1) When arbitration loss occurs during transmission of slave address data

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK SP

▲1 Δ2
▲1: IICSn register = 01000110B (Example: When ALDn bit is read during interrupt servicing)
Δ 2: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
2. n = 0 to 2

(2) When arbitration loss occurs during transmission of extension code

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK SP

▲1 Δ2
▲1: IICSn register = 0110X010B (Example: When ALDn bit is read during interrupt servicing)
IICCn.LRELn bit is set to 1 by software
Δ 2: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

www.DataSheet4U.com

690 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

(3) When arbitration loss occurs during data transfer

<1> When WTIMn bit = 0

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK SP

▲1 ▲2 Δ3
▲1: IICSn register = 10001110B
▲2: IICSn register = 01000000B (Example: When ALDn bit is read during interrupt servicing)
Δ 3: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
2. n = 0 to 2

<2> When WTIMn bit = 1

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK SP

▲1 ▲2 Δ3

▲1: IICSn register = 10001110B


▲2: IICSn register = 01000100B (Example: When ALDn bit is read during interrupt servicing)
Δ 3: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
2. n = 0 to 2

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 691


Chapter 19 I2C Bus (IIC)

(4) When arbitration loss occurs due to restart condition during data
transfer

<1> Not extension code (Example: Address mismatch)

ST AD6 to AD0 RW AK D7 to Dn ST AD6 to AD0 RW AK D7 to D0 AK SP

▲1 ▲2 Δ3
▲1: IICSn register = 1000X110B
▲2: IICSn register = 01000110B (Example: When ALDn bit is read during interrupt servicing)
Δ 3: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. Dn = D6 to D0
n = 0 to 2

<2> Extension code

ST AD6 to AD0 RW AK D7 to Dn ST AD6 to AD0 RW AK D7 to D0 AK SP

▲1 ▲2 Δ3

▲1: IICSn register = 1000X110B


▲2: IICSn register = 0110X010B (Example: When ALDn bit is read during interrupt servicing)
IICCn.LRELn bit is set to 1 by software
Δ 3: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. Dn = D6 to D0
n = 0 to 2

(5) When arbitration loss occurs due to stop condition during data transfer

ST AD6 to AD0 RW AK D7 to Dn SP

▲1 Δ2

▲1: IICSn register = 1000X110B


Δ 2: IICSn register = 01000001B

www.DataSheet4U.com Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. Dn = D6 to D0
n = 0 to 2

692 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

(6) When arbitration loss occurs due to low level of SDAn pin when
attempting to generate a restart condition

When WTIMn bit = 1


STTn bit = 1

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK D7 to D0 AK SP

▲1 ▲2 ▲3 Δ4
▲1: IICSn register = 1000X110B
▲2: IICSn register = 1000XX00B
▲3: IICSn register = 01000100B (Example: When ALDn bit is read during interrupt servicing)
Δ 4: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

(7) When arbitration loss occurs due to a stop condition when attempting to
generate a restart condition

When WTIMn bit = 1


STTn bit = 1

ST AD6 to AD0 RW AK D7 to D0 AK SP

▲1 ▲2 Δ3
▲1: IICSn register = 1000X110B
▲2: IICSn register = 1000XX00B
Δ 3: IICSn register = 01000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 693


Chapter 19 I2C Bus (IIC)

(8) When arbitration loss occurs due to low level of SDAn pin when
attempting to generate a stop condition

When WTIMn bit = 1


SPTn bit = 1

ST AD6 to AD0 RW AK D7 to D0 AK D7 to D0 AK D7 to D0 AK SP

▲1 ▲2 ▲3 Δ4
▲1: IICSn register = 1000X110B
▲2: IICSn register = 1000XX00B
▲3: IICSn register = 01000000B (Example: When ALDn bit is read during interrupt servicing)
Δ 4: IICSn register = 00000001B

Remarks 1. ▲: Always generated


Δ: Generated only when SPIEn bit = 1
X: don’t care
2. n = 0 to 2

www.DataSheet4U.com

694 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

19.10 Interrupt Request Signal (INTIICn)

The setting of the IICCn.WTIMn bit determines the timing by which the INTIICn
register is generated and the corresponding wait control, as shown below.

Table 19-6 INTIICn generation timing and wait control


WTIMn Bit During Slave Device Operation During Master Device Operation
Data Data Data Data
Address Address
Reception Transmission Reception Transmission
0 9Notes 1, 2 8Note 2 8Note 2 9 8 8
1 9Notes 1, 2 9 Note 2
9Note 2
9 9 9

Note 1. The slave device’s INTIICn signal and wait period occur at the falling edge
of the ninth clock only when there is a match with the address set to the
SVAn register.
At this point, the ACK signal is output regardless of the value set to the
IICCn.ACKEn bit. For a slave device that has received an extension code,
the INTIICn signal occurs at the falling edge of the eighth clock.
When the address does not match after restart, the INTIICn signal is
generated at the falling edge of the ninth clock, but no wait occurs.
2. If the received address does not match the contents of the SVAn register
and an extension code is not received, neither the INTIICn signal nor a wait
occurs.
3. The numbers in the table indicate the number of the serial clock’s clock
signals. Interrupt requests and wait control are both synchronized with the
falling edge of these clock signals.

(1) During address transmission/reception


• Slave device operation:
Interrupt and wait timing are determined regardless of the WTIMn bit.
• Master device operation:
Interrupt and wait timing occur at the falling edge of the ninth clock
regardless of the WTIMn bit.

(2) During data reception


• Master/slave device operation: Interrupt and wait timing is determined
according to the WTIMn bit.

(3) During data transmission


• Master/slave device operation: Interrupt and wait timing is determined
according to the WTIMn bit.

w w w . D a t a S h e e t 4 U . c o m

User’s Manual U17566EE5V1UM00 695


Chapter 19 I2C Bus (IIC)

(4) Wait cancellation method


The four wait cancellation methods are as follows.
• By setting the IICCn.WRELn bit to 1
• By writing to the IICn register

• By start condition setting (IICCn.STTn bit = 1)Note

• By stop condition setting (IICCn.SPTn bit = 1)Note

Note Master only

When an 8-clock wait has been selected (WTIMn bit = 0), the output level of
the ACK signal must be determined prior to wait cancellation.

(5) Stop condition detection


The INTIICn signal is generated when a stop condition is detected.

19.11 Address Match Detection Method

In I2C bus mode, the master device can select a particular slave device by
transmitting the corresponding slave address.
Address match detection is performed automatically by hardware. The INTIICn
signal occurs when a local address has been set to the SVAn register and
when the address set to the SVAn register matches the slave address sent by
the master device, or when an extension code has been received.

19.12 Error Detection

In I2C bus mode, the status of the serial data bus pin (SDAn) during data
transmission is captured by the IICn register of the transmitting device, so the
data of the IICn register prior to transmission can be compared with the
transmitted IICn data to enable detection of transmission errors. A
transmission error is judged as having occurred when the compared data
values do not match.

www.DataSheet4U.com

696 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

19.13 Extension Code

• When the higher 4 bits of the receive address are either 0000 or 1111, the
extension code flag (IICSn.EXCn bit) is set for extension code reception and
an interrupt request signal (INTIICn) is issued at the falling edge of the
eighth clock.
The local address stored in the SVAn register is not affected.
• If 11110xx0 is set to the SVAn register by a 10-bit address transfer and
11110xx0 is transferred from the master device, the results are as follows.
Note that the INTIICn signal occurs at the falling edge of the eighth clock
– Higher four bits of data match: EXCn bit = 1
– Seven bits of data match: IICSn.COIn bit = 1
• Since the processing after the interrupt request signal occurs differs
according to the data that follows the extension code, such processing is
performed by software.
For example, when operation as a slave is not desired after the extension
code is received, set the IICCn.LRELn bit to 1 and the CPU will enter the
next communication wait state.

Table 19-7 Extension code bit definitions


Slave Address R/W Bit Description
0000 000 0 General call address
0000 000 1 Start byte
0000 001 X CBUS address
0000 010 X Address that is reserved for different bus format
1111 0xx X 10-bit slave address specification

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 697


Chapter 19 I2C Bus (IIC)

19.14 Arbitration

When several master devices simultaneously output a start condition (when


the IICCn.STTn bit is set to 1 before the IICSn.STDn bit is set to 1),
communication between the master devices is performed while the number of
clocks is adjusted until the data differs. This kind of operation is called
arbitration.
When one of the master devices loses in arbitration, an arbitration loss flag
(IICSn.ALDn bit) is set to 1 via the timing by which the arbitration loss
occurred, and the SCLn and SDAn lines are both set to high impedance, which
releases the bus.
Arbitration loss is detected based on the timing of the next interrupt request
signal (the eighth or ninth clock, when a stop condition is detected, etc.) and
the setting of the ALDn bit to 1, which is made by software.

For details of interrupt request timing, see“I2C Interrupt Request Signals


(INTIICn)“ on page 677.

Master 1

Hi-Z
SCLn

SDAn Hi-Z
Master 1 loses arbitration
Master 2

SCLn

SDAn

Transfer lines

SCLn

SDAn

Figure 19-14 Arbitration timing example

www.DataSheet4U.com

698 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

Table 19-8 Status during arbitration and interrupt request signal generation timing
Status During Arbitration Interrupt Request Generation Timing
Transmitting address transmission At falling edge of eighth or ninth clock following byte
transferNote 1
Read/write data after address transmission
Transmitting extension code
Read/write data after extension code transmission
Transmitting data
ACK signal transfer period after data reception
When restart condition is detected during data
transfer
When stop condition is detected during data When stop condition is output (when
transfer IICCn.SPIEn bit = 1)Note 2
When SDAn pin is low level while attempting to At falling edge of eighth or ninth clock following byte
output restart condition transferNote 1
When stop condition is detected while attempting When stop condition is output (when
to output restart condition IICCn.SPIEn bit = 1)Note 2
When DSA0n pin is low level while attempting to At falling edge of eighth or ninth clock following byte
output stop condition transferNote 1
When SCLn pin is low level while attempting to
output restart condition

Note 1. When the IICCn.WTIMn bit = 1, an interrupt request signal occurs at the
falling edge of the ninth clock. When the WTIMn bit = 0 and the extension
code’s slave address is received, an interrupt request signal occurs at the
falling edge of the eighth clock.
2. When there is a possibility that arbitration will occur, set the SPIEn bit to 1
for master device operation.

19.15 Wakeup Function

The I2C bus slave function is a function that generates an interrupt request
signal (INTIICn) when a local address and extension code have been received.
This function makes processing more efficient by preventing unnecessary
interrupt request signals from occurring when addresses do not match.
When a start condition is detected, wakeup stand-by mode is set. This wakeup
stand-by mode is in effect while addresses are transmitted due to the
possibility that an arbitration loss may change the master device (which has
output a start condition) to a slave device.
However, when a stop condition is detected, the IICCn.SPIEn bit is set
regardless of the wakeup function, and this determines whether interrupt
www.DataSheet4U.com request signals are enabled or disabled.

User’s Manual U17566EE5V1UM00 699


Chapter 19 I2C Bus (IIC)

19.16 Communication Reservation

19.16.1 Communication reservation function is enabled


(IICFn.IICRSVn bit = 0)

To start master device communications when not currently using the bus, a
communication reservation can be made to enable transmission of a start
condition when the bus is released.
There are two modes in which the bus is not used:
• when arbitration results in neither master nor slave operation
• when an extension code is received and slave operation is disabled
(acknowledge is not returned and the bus was released when the
IICCn.LRELn bit was set to 1).
If the IICCn.STTn bit is set to 1 while the bus is not used, a start condition is
automatically generated and a wait status is set after the bus is released (after
a stop condition is detected).
When the bus release is detected (when a stop condition is detected), writing
to the IICn register causes master address transfer to start. At this point, the
IICCn.SPIEn bit should be set to 1.
When STTn has been set to 1, the operation mode (as start condition or as
communication reservation) is determined according to the bus status.
• If the bus has been released:
start condition is generated
• If the bus has not been released (standby mode):
Communication reservation
To detect which operation mode has been determined for the STTn bit, set the
STTn bit to 1, wait for the wait period, then check the IICSn.MSTSn bit.
The wait periods, which should be set via software, are listed in Table 19-9.
These wait periods can be set by the SMCn, CLn1, and CLn0 bits of the
IICCLn register and the IICXn.CLXn bit.

www.DataSheet4U.com

700 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

Table 19-9 Wait periods with communication reservation function enabled


Prescaler I2 C I2C module set-up Waiting
module Transfer clock time in
IICNn. IICCLn IICCLn IICCLn Mode
OCKS IICLKPS input IICLKTC IICLK
clock CLXn .SMCn .CLn1 .CLn0 cycles
18H IICLK 0 0 0 0 IICLK/44 26
10H IICLK/2 0 0 0 0 1/2 * IICLK/44 52
11H IICLK/3 IICLKPS 0 0 0 0 1/3 * IICLK/44 standard 78
12H IICLK/4 0 0 0 0 14 * IICLK/44 104
13H IICLK/5 0 0 0 0 1/5 * IICLK/44 130

18H IICLK 0 0 0 1 IICLK/86 47


10H IICLK/2 0 0 0 1 1/2 * IICLK/86 94
11H IICLK/3 IICLKPS 0 0 0 1 1/3 * IICLK/86 141
standard
12H IICLK/4 0 0 0 1 14 * IICLK/86 188
13H IICLK/5 0 0 0 1 1/5 * IICLK/86 235
X X IICLK 0 0 1 0 IICLK/86 47

18H IICLK 0 0 1 1 IICLK/66 38


10H IICLK/2 0 0 1 1 1/2 * IICLK/66 76
11H IICLK/3 IICLKPS 0 0 1 1 1/3 * IICLK/66 standard 114
12H IICLK/4 0 0 1 1 14 * IICLK/66 152
13H IICLK/5 0 0 1 1 1/5 * IICLK/66 190

18H IICLK 0 1 0 X IICLK/24 16


10H IICLK/2 0 1 0 X 1/2 * IICLK/24 32
11H IICLK/3 IICLKPS 0 1 0 X 1/3 * IICLK/24 fast- 48
12H IICLK/4 0 1 0 X 14 * IICLK/24 speed 64
13H IICLK/5 0 1 0 X 1/5 * IICLK/24 80
X X IICLK 0 1 1 0 IICLK/24 16

18H IICLK 0 1 1 1 IICLK/18 13


10H IICLK/2 0 1 1 1 1/2 * IICLK/18 26
fast-
11H IICLK/3 IICLKPS 0 1 1 1 1/3 * IICLK/18 39
speed
12H IICLK/4 0 1 1 1 14 * IICLK/18 52
13H IICLK/5 0 1 1 1 1/5 * IICLK/18 65

18H IICLK 1 1 0 X IICLK/12 10


10H IICLK/2 1 1 0 X 1/2 * IICLK/12 20
www.DataSheet4U.com
11H IICLK/3 IICLKPS 1 1 0 X 1/3 * IICLK/12 fast- 30
12H IICLK/4 1 1 0 X 14 * IICLK/12 speed 40
13H IICLK/5 1 1 0 X 1/5 * IICLK/12 50
X X IICLK 1 1 1 0 IICLK/12 10

The communication reservation timing is shown below.

User’s Manual U17566EE5V1UM00 701


Chapter 19 I2C Bus (IIC)

STTn Write to
Program processing
=1 IICn

Communication Set SPDn Set


Hardware processing reservation
and INTIICn STDn

SCL0n 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6

SDA0n

Output by master with bus access

Figure 19-15 Communication reservation timing

Communication reservations are accepted via the following timing. After the
IICSn.STDn bit is set to 1, a communication reservation can be made by
setting the IICCn.STTn bit to 1 before a stop condition is detected.

SCL0n

SDA0n

STDn

SPDn

Standby mode

Figure 19-16 Timing for accepting communication reservations

The communication reservation flowchart is illustrated below.

www.DataSheet4U.com

702 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

DI

SET1 STTn Sets STTn bit (communication reservation).

Define communication Defines that communication reservation is in effect


reservation (defines and sets user flag to any part of RAM).

Wait Secures wait period set by software (see Table 17-16).

Note
(Communication reservation)
MSTSn bit = 0? Confirmation of communication reservation
Yes

No
(Generate start condition)
Cancel communication
Clears user flag.
reservation

IICn register ← xxH IICn register write operation

EI

Figure 19-17 Communication reservation flowchart

Note The communication reservation operation executes a write to the IICn register
when a stop condition interrupt request occurs.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 703


Chapter 19 I2C Bus (IIC)

19.16.2 Communication reservation function is disabled


(IICFn.IICRSVn bit = 1)

When the IICCn.STTn bit is set when the bus is not used in a communication
during bus communication, this request is rejected and a start condition is not
generated.
There are two modes in which the bus is not used:
• when arbitration results in neither master nor slave operation
• when an extension code is received and slave operation is disabled
(acknowledge is not returned and the bus was released when the
IICCn.LRELn bit was set to 1)
To confirm whether the start condition was generated or request was rejected,
check the IICFn.STCFn flag. The time shown in Table 19-10 is required until
the STCFn flag is set after setting the STTn bit to 1. Therefore, secure the time
by software.

Table 19-10 Wait periods with communication reservation function disabled


Prescaler I2C module set-up
Waiting time in
I2C module input clock IICNn. IICCLn IICCLn IICCLn
OCKS IICLKPS IICLK cycles
CLXn .SMCn .CLn1 .CLn0
18H IICLK X X 0 X 5
10H IICLK/2 X X 0 X 10
11H IICLK/3 IICLKPS X X 0 X 15
12H IICLK/4 X X 0 X 20
13H IICLK/5 X X 0 X 25
X X IICLK X X 1 0 5

w w w . D a t a S h e e t 4 U . c o m

704 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

19.17 Cautions

(1) When IICFn.STCENn bit = 0


Immediately after the I2C0n operation is enabled, the bus communication
status (IICFn.IICBSYn bit = 1) is recognized regardless of the actual bus
status. To execute master communication in the status where a stop condition
has not been detected, generate a stop condition and then release the bus
before starting the master communication.
Use the following sequence for generating a stop condition.
<1> Set the IICCLn register.
<2> Set the IICCn.IICEn bit.
<3> Set the IICCn.SPTn bit.

(2) When IICFn.STCENn bit = 1


Immediately after I2C0n operation is enabled, the bus released status
(IICBSYn bit = 0) is recognized regardless of the actual bus status. To issue
the first start condition (IICCn.STTn bit = 1), it is necessary to confirm that the
bus has been released, so as to not disturb other communications.

(3) When the IICCn.IICEn bit is set to 1 while communications with other devices
are in progress, the start condition may be detected depending on the status of
the communication line. Be sure to set the IICCn.IICEn bit to 1 when the
SCL0n and SDA0n lines are high level.

(4) Determine the operation clock frequency by the IICCLn, IICXn, and OCKSm
registers before enabling the operation (IICCn.IICEn bit = 1). To change the
operation clock frequency, clear the IICCn.IICEn bit to 0 once.

(5) After the IICCn.STTn and IICCn.SPTn bits have been set to 1, they must not
be reset without being cleared to 0 first.

(6) If transmission has been reserved, set the IICCN.SPIEn bit to 1 so that an
interrupt request is generated by the detection of a stop condition. After an
interrupt request has been generated, the wait status will be released by
writing communication data to I2Cn, then transferring will begin. If an interrupt
is not generated by the detection of a stop condition, transmission will halt in
the wait status because an interrupt request was not generated.
However, it is not necessary to set the SPIEn bit to 1 for the software to detect
the IICSn.MSTSn bit.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 705


Chapter 19 I2C Bus (IIC)

19.18 Communication Operations

19.18.1 Master operation with communication reservation

The following shows the flowchart for master communication when the
communication reservation function is enabled (IICFn.IICRSVn bit = 0) and the
master operation is started after a stop condition is detected
(IICFn.STCENn bit = 0).

START

IICCLn ← ××H
Select transfer clock

IICCn ← ××H
IICEn = SPIEn = WTIMn
= SPTn = 1

No
INTIICn = 1?

Yes (stop condition detection)

STTn = 1

Wait time is secured by Communication


Wait
software (see below Note)
No reservation

INTIICn = 1?
No
MSTSn = 1?
Yes
Yes (start condition generation)
No Yes
EXCn or COIn = 1?
Stop condition detection,
start condition generation by
communication reservation
Start IICn write transfer Slave operation

Yes

Yes No
No MSTSn = 1 & ALDn = 0? EXCn or COIn = 1? No
INTIICn = 1?

Yes

No
ACKDn = 1?

Generate stop condition


Yes (no slave with matching address)

Address transfer No (receive)


TRCn = 1?
completion
End
Yes (transmit)

Start IICn write transfer

No WTIMn = 0
ACKEn = 1
No
MSTSn = 1 & ALDn = 0? INTIICn = 1?

WRELn = 1
Yes Start reception
Data processing

No Yes No
Yes INTIICn = 1? MSTSn = 1 & ALDn = 0?
ACKDn = 1?

Yes
No
Data processing

No
Transfer completed? No
(restart) Transfer completed?
Yes
Yes
Generate stop condition
SPTn = 1
www.DataSheet4U.com ACKEn = 0

End

Figure 19-18 Master operation flowchart with communication reservation

Note Refer to Table 19-9 on page 701.

706 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

19.18.2 Master operation without communication reservation

The following shows the flowchart for master communication when the
communication reservation function is disabled (IICRSVn bit = 1) and the
master operation is started without detecting a stop condition
(STCENn bit = 1).

START

IICCLn ← ××H Transfer clock selection


IICFn ← ××H IICFn register setting

IICCn ← ××H
IICCn register initial setting
IICEn = SPIEn = WTIMn = 1

No
IICBSYn = 0?

Yes

STTn = 1

Wait time is secured by software


Insert wait
(see below Note)

No
STCFn = 0? Stop master communication

Yes Master communication is


stopped because bus is occupied
Start IICn write transfer Slave operation

Yes

No Yes No
INTIICn = 1? MSTSn = 1 & ALDn = 0? EXCn or COIn = 1? No

Yes

No (receive)
ACKDn = 1?

Yes Yes (address transfer completion)

Generate stop condition


TRCn = 1? (no slave with matching address)

Yes (transmit) WTIMn = 0


ACKEn = 1
End
Start IICn write transfer

WRELn = 1
No Start reception

MSTSn = 1 & ALDn = 0? Yes No


INTIICn = 1?

No Yes No
INTIICn = 1? MSTSn = 1 & ALDn = 0?
Yes
Data processing
Yes

Data processing
No
ACKDn = 1?

No
Yes Reception completed?

Yes

ACKEn = 0

No
Transfer completed?
(restart)
Yes
SPTn = 1
Generate stop condition

End
www.DataSheet4U.com

Figure 19-19 Master operation flowchart without communication reservation

Note Refer to Table 19-10 on page 704.

User’s Manual U17566EE5V1UM00 707


Chapter 19 I2C Bus (IIC)

19.18.3 Slave operation

The following shows the processing procedure of the slave operation.


Basically, the operation of the slave device is event-driven. Therefore,
processing by an INTIICn interrupt (processing requiring a significant change
of the operation status, such as stop condition detection during
communication) is necessary.
The following description assumes that data communication does not support
extension codes. Also, it is assumed that the INTIICn interrupt servicing
performs only status change processing and that the actual data
communication is performed during the main processing.

INTIICn signal Flag


Interrupt servicing
Setting, etc.
I2C Main processing

Data

Setting, etc.

Figure 19-20 Software outline during slave operation

Therefore, the following three flags are prepared so that the data transfer
processing can be performed by transmitting these flags to the main
processing instead of INTIICn signal.

(1) Communication mode flag


This flag indicates the following communication statuses.

• Clear mode:
Data communication not in progress
• Communication mode
Data communication in progress (valid address detection stop condition
detection, ACK signal from master not detected, address mismatch)

(2) Ready flag


This flag indicates that data communication is enabled. This is the same status
as an INTIICn interrupt during normal data transfer. This flag is set in the
interrupt processing block and cleared in the main processing block. The ready
flag for the first data for transmission is not set in the interrupt processing
block, so the first data is transmitted without clear processing (the address
match is regarded as a request for the next data).

www.DataSheet4U.com

708 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

(3) Communication direction flag


This flag indicates the direction of communication and is the same as the value
of IICSn.TRCn bit.
The following shows the operation of the main processing block during slave
operation.

Start I2C0n and wait for the communication enabled status. When
communication is enabled, perform transfer using the communication mode
flag and ready flag (the processing of the stop condition and start condition is
performed by interrupts, conditions are confirmed by flags).
For transmission, repeat the transmission operation until the master device
stops returning ACK signal. When the master device stops returning ACK
signal, transfer is complete.
For reception, receive the required number of data and do not return ACK
signal for the next data immediately after transfer is complete. After that, the
master device generates the stop condition or restart condition. This causes
exit from communications.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 709


Chapter 19 I2C Bus (IIC)

START

IICCLn ← XXH Selection of transfer flag


IICFn ← XXH IICFn register setting

IICCn ← XXH
IICEn = 1

No
Communication mode?

Yes
No ACKEn = WTIMn = 1
Communication
direction flag = 1?

Yes
WRELn = 1
WTIMn = 1

No
Communication mode?
Data processing
Yes
No
IICn ← data Ready?

Yes
No
Communication mode? Read data

Yes
No
Clear ready flag
Ready?

Yes
Data processing
Clear ready flag

No No
Transfer completed?
ACKDn = 1?

Yes
Yes

WRELn = 1 ACKEn = 0

Clear communication mode flag WRELn = 1

Figure 19-21 Slave operation flowchart (1)

www.DataSheet4U.com

The following shows an example of the processing of the slave device by an


INTIICn interrupt (it is assumed that no extension codes are used here).

710 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

During an INTIICn interrupt, the status is confirmed and the following steps are
executed.
<1> When a stop condition is detected, communication is terminated.
<2> When a start condition is detected, the address is confirmed. If the
address does not match, communication is terminated. If the address
matches, the communication mode is set and wait is released, and
operation returns from the interrupt (the ready flag is cleared).
<3> For data transmission/reception, when the ready flag is set, operation
returns from the interrupt while the IIC0n bus remains in the wait status.

Note <1> to <3> in the above correspond to <1> to <3> in Figure 19-22.

INTIICn generated

Yes <1>
SPDn = 1?

No

Yes <2>
STDn = 1?

No No
COIn = 1?
<3>
Yes
Set ready flag

Communication direction flag ← TRCn


Set communication mode flag

Interrupt servicing completed Clear ready flag

Interrupt servicing completed

Termination processing

LRELn = 1

Clear communication mode

Interrupt servicing completed


www.DataSheet4U.com

Figure 19-22 Slave operation flowchart (2)

User’s Manual U17566EE5V1UM00 711


Chapter 19 I2C Bus (IIC)

19.19 Timing of Data Communication

When using I2C bus mode, the master device outputs an address via the serial
bus to select one of several slave devices as its communication partner.
After outputting the slave address, the master device transmits the
IICSn.TRCn bit, which specifies the data transfer direction, and then starts
serial communication with the slave device.
The shift operation of the IICn register is synchronized with the falling edge of
the serial clock pin (SCLn). The transmit data is transferred to the SO latch and
is output (MSB first) via the SDAn pin.
Data input via the SDAn pin is captured by the IICn register at the rising edge
of the SCLn pin.
The data communication timing is shown below.

www.DataSheet4U.com

712 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

Processing by master device

IICn IICn ← address IICn ← data

ACKDn

STDn

SPDn

WTIMn H

ACKEn H

MSTSn

STTn

SPTn L

WRELn L

INTIICn

TRCn H Transmit

Transfer lines

SCL0n 1 2 3 4 5 6 7 8 9 1 2 3 4

SDA0n AD6 AD5 AD4 AD3 AD2 AD1 AD0 W ACK D7 D6 D5 D4


Start condition

Processing by slave device

IICn IICn ← FFH Note

ACKDn

STDn

SPDn

WTIMn H

ACKEn H

MSTSn L

STTn L

SPTn L

WRELn Note

INTIICn
(When EXCn = 1)
TRCn L Receive

Figure 19-23
www.DataSheet4U.com
Example of master to slave communication
(when 9-clock wait is selected for both master and slave) (1/3)
start condition ~ address

Note To cancel slave wait, write FFH to IICn or set WRELn.

User’s Manual U17566EE5V1UM00 713


Chapter 19 I2C Bus (IIC)

Processing by master device

IICn IICn ← data IICn ← data

ACKDn

STDn L

SPDn L

WTIMn H

ACKEn H

MSTSn H

STTn L

SPTn L

WRELn L

INTIICn

TRCn H Transmit

Transfer lines

SCL0n 8 9 1 2 3 4 5 6 7 8 9 1 2 3

SDA0n D0 D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5

Processing by slave device

IICn IICn ← FFH Note IICn ← FFH Note

ACKDn

STDn L

SPDn L

WTIMn H

ACKEn H

MSTSn L

STTn L

SPTn L

WRELn Note Note

INTIICn

TRCn L Receive

Figure 19-24
www.DataSheet4U.com
Example of master to slave communication
(when 9-clock wait is selected for both master and slave) (2/3)
(b) data

Note To cancel slave wait, write FFH to IICn or set WRELn.

714 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

Processing by master device

IICn IICn ← data IICn ← address

ACKDn

STDn

SPDn

WTIMn H

ACKEn H

MSTSn

STTn

SPTn

WRELn L

INTIICn
(When SPIEn = 1)
TRCn H Transmit

Transfer lines

SCL0n 1 2 3 4 5 6 7 8 9 1 2

SDA0n D7 D6 D5 D4 D3 D2 D1 D0 AD6 AD5


Stop Start
condition condition
Processing by slave device

IICn IICn ← FFH Note IICn ← FFH Note

ACKDn

STDn

SPDn

WTIMn H

ACKEn H

MSTSn L

STTn L

SPTn L

WRELn Note Note

INTIICn
(When SPIEn = 1)
TRCn L Receive

Figure 19-25 Example of master to slave communication


www.DataSheet4U.com
(when 9-clock wait is selected for both master and slave) (3/3)
(c) stop condition

Note To cancel slave wait, write FFH to IICn or set WRELn.

User’s Manual U17566EE5V1UM00 715


Chapter 19 I2C Bus (IIC)

Processing by master device

IICn IICn ← address IICn ← FFH Note

ACKDn

STDn

SPDn

WTIMn H

ACKEn H

MSTSn

STTn

SPTn L

WRELn Note

INTIICn

TRCn

Transfer lines

SCL0n 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6

SDA0n AD6 AD5 AD4 AD3 AD2 AD1 AD0 R D7 D6 D5 D4 D3 D2


Start condition

Processing by slave device

IICn IICn ← data

ACKDn

STDn

SPDn

WTIMn H

ACKEn H

MSTSn L

STTn L

SPTn L

WRELn L

INTIICn

TRCn

Figure 19-26
www.DataSheet4U.com
Example of slave to master communication
(when 9-clock wait is selected for both master and slave) (1/3)
(a) start condition ~ address

Note To cancel master wait, write FFH to IICn or set WRELn.

716 User’s Manual U17566EE5V1UM00


I2C Bus (IIC) Chapter 19

Processing by master device

IICn IICn ← FFH Note IICn ← FFH Note

ACKDn

STDn L

SPDn L

WTIMn H

ACKEn H

MSTSn H

STTn L

SPTn L

WRELn Note Note

INTIICn

TRCn L Receive

Transfer lines

SCL0n 8 9 1 2 3 4 5 6 7 8 9 1 2 3

SDA0n D0 ACK D7 D6 D5 D4 D3 D2 D1 D0 ACK D7 D6 D5

Processing by slave device

IICn IICn ← data IICn ← data

ACKDn

STDn L

SPDn L

WTIMn H

ACKEn H

MSTSn L

STTn L

SPTn L

WRELn L

INTIICn

TRCn H Transmit

Figure 19-27 Example of slave to master communication


www.DataSheet4U.com
(when 9-clock wait is selected for both master and slave) (2/3)
(b) data

Note To cancel master wait, write FFH to IICn or set WRELn.

User’s Manual U17566EE5V1UM00 717


Chapter 19 I2C Bus (IIC)

Processing by master device

IICn IICn ← FFH Note IICn ← address

ACKDn

STDn

SPDn

WTIMn H

ACKEn

MSTSn

STTn

SPTn

WRELn Note

INTIICn
(When SPIEn = 1)
TRCn

Transfer lines

SCL0n 1 2 3 4 5 6 7 8 9 2 1

SDA0n D7D6D5D4D3D2D1D0AD5 N- ACK AD6


Stop Start
condition condition
Processing by slave device

IICn IICn ← data

ACKDn

STDn

SPDn

WTIMn H

ACKEn H

MSTSn L

STTn L

SPTn L

WRELn

INTIICn
(When SPIEn = 1)
TRCn

Figure 19-28 Example of slave to master communication


www.DataSheet4U.com
(when 9-clock wait is selected for both master and slave) (3/3)
(c) stop condition

Note To cancel master wait, write FFH to IICn or set WRELn.

718 User’s Manual U17566EE5V1UM00


Chapter 20 CAN Controller (CAN)

These microcontrollers feature an on-chip n-channel CAN (Controller Area


Network) controller that complies with the CAN protocol as standardized in ISO
11898.

The V850E/Dx3 microcontrollers have following number of channels of the


CAN controller:

µPD70F3427, µPD70F3425,
CAN µPD70F3424, µPD70F3423, µPD70F3426A
µPD70F3422, µPD70F3421
Instances 3 2
Names CAN0 to CAN2 CAN0 to CAN1

Note 1. Throughout this chapter, the individual CAN channels are identified by “n”,
for example CANn, or CnGMCTRL for the CANn global control register.
2. Throughout this chapter, the CAN message buffer registers are identified
by “m” (m = 0 to 31), for example C0MDATA4m for CAN0 message data
byte 4 of message buffer register m.
3. It is recommended to configure the ports used for CAN data transmit
CTXDn to its highest drive strength to Limit2 by PDSCn.PDSCnm = 1 for
CAN baud rates above 200 Kbit/sec.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 719


Chapter 20 CAN Controller (CAN)

20.1 Features

• Compliant with ISO 11898 and tested according to ISO/DIS 16845 (CAN
conformance test)
• Standard frame and extended frame transmission/reception enabled
• Transfer rate: 1 Mbps max. (if CAN clock input ≥ 8 MHz, for 32 channels)
• 32 message buffers per channel
• Receive/transmit history list function
• Automatic block transmission function
• Multi-buffer receive block function
• Mask setting of four patterns is possible for each channel
• Wake-Up capability on CAN receive data pins CRXDn
• Data bit time, communication baud rate and sample point can be controlled
by CAN module bit-rate prescaler register (CnBRP) and bit rate register
(CnBTR)
– As an example the following sample-point configurations can be
configured:
– 66.7%, 70.0%, 75.0%, 80.0%, 81.3%, 85.0%, 87.5%
– Baudrates in the range of 10 kbps up to 1000 kbps can be configured

• Enhanced features:
– Each message buffer can be configured to operate as a transmit or a
receive message buffer
– Transmission priority is controlled by the identifier or by mailbox number
(selectable)
– A transmission request can be aborted by clearing the dedicated
Transmit-Request flag of the concerned message buffer.
– Automatic block transmission operation mode (ABT)
– Time stamp function for CAN channels 0 and 1 in collaboration with timer
Timer G0 and Timer G1 capture channels

www.DataSheet4U.com

720 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

20.1.1 Overview of functions

Table 20-1 presents an overview of the CAN Controller functions.

Table 20-1 Overview of functions

Function Details
Protocol CAN protocol ISO 11898 (standard and extended frame transmission/reception)
Baud rate Maximum 1 Mbps (CAN clock input ≥ 8 MHz)
Data storage Storing messages in the CAN RAM
Number of messages • 32 message buffers per channel
• Each message buffer can be set to be either a transmit message buffer or a
receive message buffer.
Message reception • Unique ID can be set to each message buffer.
• Mask setting of four patterns is possible for each channel.
• A receive completion interrupt is generated each time a message is received
and stored in a message buffer.
• Two or more receive message buffers can be used as a FIFO receive buffer
(multi-buffer receive block function).
• Receive history list function
Message transmission Unique ID can be set to each message buffer.
• Transmit completion interrupt for each message buffer
• Message buffer number 0 to 7 specified as the transmit message buffer can be
set for automatic block transfer. Message transmission interval is programmable
(automatic block transmission function (hereafter referred to as “ABT”)).
• Transmission history list function
Remote frame processing Remote frame processing by transmit message buffer
Time stamp function • The time stamp function can be set for a message reception when a 16-bit timer
is used in combination.
• Time stamp capture trigger can be selected (SOF or EOF in a CAN message
frame can be detected.).
• The time stamp function can be set for a transmit message.
Diagnostic function • Readable error counters
• “Valid protocol operation flag” for verification of bus connections
• Receive-only mode
• Single-shot mode
• CAN protocol error type decoding
• Self-test mode
Release from bus-off state • Forced release from bus-off (by ignoring timing constraint) possible by software.
• No automatic release from bus-off (software must re-enable).
Power save mode • CAN Sleep mode (can be woken up by CAN bus)
• CAN Stop mode (cannot be woken up by CAN bus)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 721


Chapter 20 CAN Controller (CAN)

20.1.2 Configuration

The CAN Controller is composed of the following four blocks.


• NPB interface
This functional block provides an NPB (NEC Peripheral I/O Bus) interface
and means of transmitting and receiving signals between the CAN module
and the host CPU.
• MAC (Memory Access Controller)
This functional block controls access to the CAN protocol layer and to the
CAN RAM within the CAN module.
• CAN protocol layer
This functional block is involved in the operation of the CAN protocol and its
related settings.
• CAN RAM
This is the CAN memory functional block, which is used to store message
IDs, message data, etc.

CPU

Interrupt request
NPB
INTCnTRX
INTCnREC (NEC Peripheral I/O Bus)
INTCnERR
INTCnWUP CAN bus

CTXDn CAN_H
CAN CAN
NPB MCM Protocol
Layer transceiver
interface (Message Control Module) CAN_L
CRXDn

CAN RAM
Message C1MASK1
buffer 0
C1MASK2
Message
buffer 1 C1MASK3
PCLK0
Message C1MASK4
buffer 2
TSOUTCn Message
buffer 3
...

Message
buffer m

CAN module

Figure 20-1 Block diagram of CAN module


www.DataSheet4U.com

722 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

20.2 CAN Protocol

CAN (Controller Area Network) is a high-speed multiplex communication


protocol for real-time communication in automotive applications (class C). CAN
is prescribed by ISO 11898. For details, refer to the ISO 11898 specifications.
The CAN specification is generally divided into two layers: a physical layer and
a data link layer. In turn, the data link layer includes logical link and medium
access control. The composition of these layers is illustrated below.

Higher · Logical link control (LLC) · Acceptance filtering


· Overload report
Data link
layerNote
· Recovery management
· Medium access control (MAC) · Data capsuled/not capsuled
· Frame coding (stuffing/no stuffing)
· Medium access management
· Error detection
· Error report
· Acknowledgement
· Seriated/not seriated
Lower Physical layer Prescription of signal level and bit description

Figure 20-2 Composition of layers

Note CAN Controller specification

20.2.1 Frame format

(1) Standard format frame


• The standard format frame uses 11-bit identifiers, which means that it can
handle up to 2,048 messages.

(2) Extended format frame


• The extended format frame uses 29-bit (11 bits + 18 bits) identifiers, which
increases the number of messages that can be handled to 2,048 × 218
messages.
• An extended format frame is set when “recessive level” (CMOS level of “1”)
is set for both the SRR and IDE bits in the arbitration field.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 723


Chapter 20 CAN Controller (CAN)

20.2.2 Frame types

The following four types of frames are used in the CAN protocol.

Table 20-2 Frame types


Frame Type Description
Data frame Frame used to transmit data
Remote frame Frame used to request a data frame
Error frame Frame used to report error detection
Overload frame Frame used to delay the next data frame or remote frame

(1) Bus value


The bus values are divided into dominant and recessive.
• Dominant level is indicated by logical 0.
• Recessive level is indicated by logical 1.
• When a dominant level and a recessive level are transmitted simultaneously,
the bus value becomes dominant level.

20.2.3 Data frame and remote frame

(1) Data frame


A data frame is composed of seven fields.

Data frame
R
D
<1> <2> <3> <4> <5> <6> <7> <8>

Interframe space
End of frame (EOF)
ACK field
CRC field
Data field
Control field
Arbitration field
Start of frame (SOF)

Figure 20-3 Data frame

Note D: Dominant = 0
www.DataSheet4U.com R: Recessive = 1

724 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(2) Remote frame


A remote frame is composed of six fields.

Remote frame
R
D
<1> <2> <3> <5> <6> <7> <8>

Interframe space
End of frame (EOF)
ACK field
CRC field
Control field
Arbitration field
Start of frame (SOF)

Figure 20-4 Remote frame

Note 1. The data field is not transferred even if the control field’s data length code
is not “0000B”.

2. D: Dominant = 0
R: Recessive = 1

(3) Description of fields

(a) Start of frame (SOF)


The start of frame field is located at the start of a data frame or remote frame.

(Interframe space or bus idle) Start of frame (Arbitration field)

R
D
1 bit

Figure 20-5 Start of frame (SOF)

Note D: Dominant = 0
R: Recessive = 1

• If dominant level is detected in the bus idle state, a hard-synchronization is


performed (the current TQ is assigned to be the SYNC segment).
• If dominant level is sampled at the sample point following such a hard-
synchronization, the bit is assigned to be a SOF. If recessive level is
www.DataSheet4U.com detected, the protocol layer returns to the bus idle state and regards the
preceding dominant pulse as a disturbance only. No error frame is
generated in such case.

User’s Manual U17566EE5V1UM00 725


Chapter 20 CAN Controller (CAN)

(b) Arbitration field


The arbitration field is used to set the priority, data frame/remote frame, and
frame format.

Arbitration field (Control field)


R
D
Identifier RTR IDE r0
(r1)
ID28 · · · · · · · · · · · · · · · · · · · · · · · · · · ID18
(11 bits) (1 bit) (1 bit)

Figure 20-6 Arbitration field (in standard format mode)

Caution 1. ID28 to ID18 are identifiers.


2. An identifier is transmitted MSB first.

Note D: Dominant = 0
R: Recessive = 1

Arbitration field (Control field)


R
D
Identifier SRR IDE Identifier RTR r1 r0

ID28 · · · · · · · · · · · · · · · · · · · ID18 ID17 · · · · · · · · · · · · · · · · · · · · · · ID0


(11 bits) (1 bit) (1 bit) (18 bits) (1 bit)

Figure 20-7 Arbitration field (in extended format mode)

Caution 1. ID28 to ID18 are identifiers.


2. An identifier is transmitted MSB first.

Note D: Dominant = 0
R: Recessive = 1

Table 20-3 RTR frame settings


Frame type RTR bit
Data frame 0 (D)
Remote frame 1 (R)

www.DataSheet4U.com
Table 20-4 Frame format setting (IDE bit) and number of identifier (ID) bits
Frame format SRR bit IDE bit Number of bits
Standard format mode None 0 (D) 11 bits
Extended format mode 1 (R) 1 (R) 29 bits

726 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(c) Control field


The control field sets “DLC” as the number of data bytes in the data field
(DLC = 0 to 8).

(Arbitration field) Control field (Data field)


R
D
RTR r1 r0 DLC3 DLC2 DLC1 DLC0
(IDE)

Figure 20-8 Control field

Note D: Dominant = 0
R: Recessive = 1

In a standard format frame, the control field’s IDE bit is the same as the r1 bit.

Table 20-5 Data length setting


Data length code Data byte count
DLC3 DLC2 DLC1 DLC0
0 0 0 0 0 bytes
0 0 0 1 1 byte
0 0 1 0 2 bytes
0 0 1 1 3 bytes
0 1 0 0 4 bytes
0 1 0 1 5 bytes
0 1 1 0 6 bytes
0 1 1 1 7 bytes
1 0 0 0 8 bytes
8 bytes regardless of the value of
Other than above
DLC3 to DLC0

Caution In the remote frame, there is no data field even if the data length code is not
0000B.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 727


Chapter 20 CAN Controller (CAN)

(d) Data field


The data field contains the amount of data (byte units) set by the control field.
Up to 8 units of data can be set.

(Control field) Data field (CRC field)


R
D
Data 0 Data 7
(8 bits) (8 bits)
MSB → LSB MSB → LSB

Figure 20-9 Data field

Note D: Dominant = 0
R: Recessive = 1

(e) CRC field


The CRC field is a 16-bit field that is used to check for errors in transmit data.

(Data field or control field) CRC field (ACK field)


R
D
CRC sequence

CRC delimiter
(15 bits) (1 bit)

Figure 20-10 CRC field

Note D: Dominant = 0
R: Recessive = 1

• The polynomial P(X) used to generate the 15-bit CRC sequence is


expressed as follows.

P(X) = X15 + X14 + X10 + X8 + X7 + X4 + X3 + 1


• Transmitting node: Transmits the CRC sequence calculated from the
data (before bit stuffing) in the start of frame,
arbitration field, control field, and data field.
• Receiving node: Compares the CRC sequence calculated using
data bits that exclude the stuffing bits in the receive
data with the CRC sequence in the CRC field. If the
two CRC sequences do not match, the node issues
an error frame.
www.DataSheet4U.com

728 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(f) ACK field


The ACK field is used to acknowledge normal reception.

(CRC field) ACK field (End of frame)


R
D
ACK slot ACK delimiter
(1 bit) (1 bit)

Figure 20-11 ACK field

Note D: Dominant = 0
R: Recessive = 1

• If no CRC error is detected, the receiving node sets the ACK slot to the
dominant level.
• The transmitting node outputs two recessive-level bits.

(g) End of frame (EOF)


The end of frame field indicates the end of data frame/remote frame.

(ACK field) End of frame (Interframe space or overload frame)

R
D
(7 bits)

Figure 20-12 End of frame (EOF)

Note D: Dominant = 0
R: Recessive = 1

(h) Interframe space


The interframe space is inserted after a data frame, remote frame, error frame,
or overload frame to separate one frame from the next.
• The bus state differs depending on the error status.
– Error active node
The interframe space consists of a 3-bit intermission field and a bus idle
field.

www.DataSheet4U.com(Frame) Interframe space (Frame)

R
D
Intermission Bus idle
(3 bits) (0 to ∞ bits)

Figure 20-13 Interframe space (error active node)

User’s Manual U17566EE5V1UM00 729


Chapter 20 CAN Controller (CAN)

Note 1. Bus idle: State in which the bus is not used by any node.
2. D: Dominant = 0
R: Recessive = 1

– Error passive node


The interframe space consists of an intermission field, a suspend
transmission field, and a bus idle field.

(Frame) Interframe space (Frame)

R
D Intermission Suspend transmission Bus idle
(3 bits) (8 bits) (0 to ∞ bits)

Figure 20-14 Interframe space (error passive node)

Note 1. Bus idle: State in which the bus is not used by any node.
Suspend transmission: Sequence of 8 recessive-level bits transmitted
from the node in the error passive status.
2. D: Dominant = 0
R: Recessive = 1

Usually, the intermission field is 3 bits. If the transmitting node detects a


dominant level at the third bit of the intermission field, however, it
executes transmission.
• Operation in error status

Table 20-6 Operation in error status


Error status Operation
Error active A node in this status can transmit immediately after a 3-bit
intermission.
Error passive A node in this status can transmit 8 bits after the intermission.

www.DataSheet4U.com

730 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

20.2.4 Error frame

An error frame is output by a node that has detected an error.

Error frame
R
D
(<4>) <1> <2> <3> (<5>)
6 bits 0 to 6 bits 8 bits

Interframe space or overload frame


Error delimiter
Error flag 2
Error flag 1
Error bit

Figure 20-15 Error frame

Note D: Dominant = 0
R: Recessive = 1

Table 20-7 Definition of error frame fields


Bit
No. Name Definition
count
<1> Error flag 1 6 Error active node: Outputs 6 dominant-level bits consecutively.
Error passive node: Outputs 6 recessive-level bits consecutively.
If another node outputs a dominant level while one node is outputting
a passive error flag, the passive error flag is not cleared until the
same level is detected 6 bits in a row.
<2> Error flag 2 0 to 6 Nodes receiving error flag 1 detect bit stuff errors and issues this
error flag.
<3> Error delimiter 8 Outputs 8 recessive-level bits consecutively.
If a dominant level is detected at the 8th bit, an overload frame is
transmitted from the next bit.
<4> Error bit – The bit at which the error was detected.
The error flag is output from the bit next to the error bit.
In the case of a CRC error, this bit is output following the ACK
delimiter.
<5> Interframe space/ – An interframe space or overload frame starts from here.
overload frame

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 731


Chapter 20 CAN Controller (CAN)

20.2.5 Overload frame

An overload frame is transmitted under the following conditions.


• When the receiving node has not completed the reception operation
• If a dominant level is detected at the first two bits during intermission
• If a dominant level is detected at the last bit (7th bit) of the end of frame or at
the last bit (8th bit) of the error delimiter/overload delimiter

Note The CAN is internally fast enough to process all received frames not
generating overload frames.

Overload frame
R
D
(<4>) <1> <2> <3> (<5>)
6 bits 0 to 6 bits 8 bits

Interframe space or overload frame


Overload delimiter
Overload flag
Overload flag
Frame

Figure 20-16 Overload frame

Note D: Dominant = 0
R: Recessive = 1

Table 20-8 Definition of overload frame fields


No Name Bit count Definition
<1> Overload flag 6 Outputs 6 dominant-level bits consecutively.
Overload flag from other node The node that received an overload flag in the interframe
<2> 0 to 6
space outputs an overload flag.
Overload delimiter Outputs 8 recessive-level bits consecutively.
<3> 8 If a dominant level is detected at the 8th bit, an overload
frame is transmitted from the next bit.
Frame Output following an end of frame, error delimiter, or overload
<4> –
delimiter.
Interframe space/overload An interframe space or overload frame starts from here.
<5> –
frame

www.DataSheet4U.com
20.3 Functions

20.3.1 Determining bus priority

(1) When a node starts transmission:


• During bus idle, the node that output data first transmits the data.

732 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(2) When more than one node starts transmission:


• The node that consecutively outputs the dominant level for the longest from
the first bit of the arbitration field has the bus priority (if a dominant level and
a recessive level are simultaneously transmitted, the dominant level is taken
as the bus value).
• The transmitting node compares its output arbitration field and the data level
on the bus.

Table 20-9 Determining bus priority


Level match Continuous transmission
Level mismatch Stops transmission at the bit where mismatch is detected
and starts reception at the following bit

(3) Priority of data frame and remote frame


• When a data frame and a remote frame are on the bus, the data frame has
priority because its RTR bit, the last bit in the arbitration field, carries a
dominant level.

Note If the extended-format data frame and the standard-format remote frame
conflict on the bus (if ID28 to ID18 of both of them are the same), the standard-
format remote frame takes priority.

20.3.2 Bit stuffing

Bit stuffing is used to establish synchronization by appending 1 bit of inverted-


level data if the same level continues for 5 bits, in order to prevent a burst error.

Table 20-10 Bit stuffing


Transmission During the transmission of a data frame or remote frame,
when the same level continues for 5 bits in the data between
the start of frame and the ACK field, 1 inverted-level bit of
data is inserted before the following bit.
Reception During the reception of a data frame or remote frame, when
the same level continues for 5 bits in the data between the
start of frame and the ACK field, reception is continued after
deleting the next bit.

20.3.3 Multi masters

As the bus priority (a node acquiring transmit functions) is determined by the


identifier, any node can be the bus master.
www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 733


Chapter 20 CAN Controller (CAN)

20.3.4 Multi cast

Although there is one transmitting node, two or more nodes can receive the
same data at the same time because the same identifier can be set to two or
more nodes.

20.3.5 CAN sleep mode/CAN stop mode function

The CAN sleep mode/CAN stop mode function puts the CAN Controller in
waiting mode to achieve low power consumption.
The controller is woken up from the CAN sleep mode by bus operation but it is
not woken up from the CAN stop mode by bus operation (the CAN stop mode
is controlled by CPU access).

20.3.6 Error control function

(1) Error types

Table 20-11 Error types


Description of error Detection state
Type Detection Transmission/
Detection method Field/frame
condition reception
Bit error Comparison of the output Mismatch of levels Transmitting/ Bit that is outputting data on
level and level on the bus receiving node the bus at the start of frame to
(except stuff bit) end of frame, error frame and
overload frame.
Stuff Check of the receive data 6 consecutive bits of Receiving node Start of frame to CRC
error at the stuff bit the same output sequence
level
CRC Comparison of the CRC Mismatch of CRC Receiving node CRC field
error sequence generated from
the receive data and the
received CRC sequence
Form Field/frame check of the Detection of fixed Receiving node CRC delimiter
error fixed format format violation ACK field
End of frame
Error frame
Overload frame
ACK Check of the ACK slot by Detection of Transmitting ACK slot
error the transmitting node recessive level in node
ACK slot

(2) Output timing of error frame

Table 20-12
www.DataSheet4U.com Output timing of error frame
Type Output timing
Bit error, stuff error, Error frame output is started at the timing of the bit following
form error, ACK error the detected error.
CEC error Error frame output is started at the timing of the bit following
the ACK delimiter.

734 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(3) Processing in case of error


The transmission node re-transmits the data frame or remote frame after the
error frame. (However, it does not re-transmit the frame in the single-shot
mode.)

(4) Error state

(a) Types of error states


The following three types of error states are defined by the CAN specification:
• Error active
• Error passive
• Bus-off
These types of error states are classified by the values of the TEC7 to TEC0
bits (transmission error counter bits) and the REC6 to REC0 bits (reception
error counter bits) as shown in Table 20-13.
The present error state is indicated by the CAN module information register
(CnINFO).
When each error counter value becomes equal to or greater than the error
warning level (96), the TECS0 or RECS0 bit of the CnINFO register is set to 1.
In this case, the bus state must be tested because it is considered that the bus
has a serious fault. An error counter value of 128 or more indicates an error
passive state and the TECS1 or RECS1 bit of the CnINFO register is set to 1.
• If the value of the transmission error counter is greater than or equal to 256
(actually, the transmission error counter does not indicate a value greater
than or equal to 256), the bus-off state is reached and the BOFF bit of the
CnINFO register is set to 1.
• If only one node is active on the bus at startup (i.e., a particular case such
as when the bus is connected only to the local station), ACK is not returned
even if data is transmitted. Consequently, re-transmission of the error frame
and data is repeated. In the error passive state, however, the transmission
error counter is not incremented and the bus-off state is not reached.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 735


Chapter 20 CAN Controller (CAN)

Table 20-13 Types of error states


Value of error Indication of
Type Operation Operation specific to error state
counter CnINFO register
Error active Transmission 0 to 95 TECS1, TECS0 = 00 Outputs an active error flag (6 consecutive
dominant-level bits) on detection of the error.
Reception 0 to 95 RECS1, RECS0 = 00
Transmission 96 to 127 TECS1, TECS0 = 01
Reception 96 to 127 RECS1, RECS0 = 01
Error passive Transmission 128 to 255 TECS1, TECS0 = 11 Outputs a passive error flag (6 consecutive
recessive-level bits) on detection of the error.
Transmits 8 recessive-level bits, in between
transmissions, following an intermission
(suspend transmission).
Reception 128 or more RECS1, RECS0 = 11
Bus-off Transmission 256 or more BOFF = 1, Communication is not possible.
(not TECS1, TECS0 = 11 Messages are not stored when receiving frames,
indicated) Note however, the following operations of <1>, <2>,
and <3> are done.
<1> TSOUT toggles.
<2> REC is incremented/decremented.
<3> VALID bit is set.
If the CAN module is entered to the initialization
mode and then transition request to any
operation mode is made, and when 11
consecutive recessive-level bits are detected
128 times, the error counter is reset to 0 and
the error active state can be restored.

Note The value of the transmission error counter (TEC) is invalid when the BOFF bit
is set to 1. If an error that increments the value of the transmission error
counter by +8 while the counter value is in a range of 248 to 255, the counter is
not incremented and the bus-off state is assumed.

www.DataSheet4U.com

736 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(b) Error counter


The error counter counts up when an error has occurred, and counts down
upon successful transmission and reception. The error counter is updated
immediately after error detection.
Table 20-14 Error counter
Transmission error counter Reception error counter
State
(TEC7 to TEC0 bits) (REC6 to REC0 bits)
Receiving node detects an error (except bit error No change +1 (when REPS = 0)
in the active error flag or overload flag).
Receiving node detects dominant level following No change +8 (when REPS = 0)
error flag of error frame.
Transmitting node transmits an error flag. +8 No change
[As exceptions, the error counter does not
change in the following cases.]
<1> ACK error is detected in error passive
state and dominant level is not detected
while the passive error flag is being output.
<2> A stuff error is detected in an arbitration
field that transmitted a recessive level as a
stuff bit, but a dominant level is detected.
Bit error detection while active error flag or +8 No change
overload flag is being output (error-active
transmitting node)
Bit error detection while active error flag or No change +8 (REPS bit = 0)
overload flag is being output (error-active
receiving node)
When the node detects 14 consecutive +8 (transmitting) +8
dominant-level bits from the beginning of the (during reception, when
active error flag or overload flag, and then REPS = 0)
subsequently detects 8 consecutive dominant-
level bits.
When the node detects 8 consecutive dominant
levels after a passive error flag
When the transmitting node has completed –1 No change
transmission without error
(±0 if error counter = 0)
When the receiving node has completed No change • –1
reception without error (1 ≤REC6 to REC0 ≤127,
when REPS = 0)
• ±0
(REC6 to REC0 = 0,
when REPS = 0)
• Value of 119 to 127 is set
(when REPS = 1)

(c) Occurrence of bit error in intermission


An overload frame is generated.
www.DataSheet4U.com

Caution If an error occurs, it is controlled according to the contents of the transmission


error counter and reception error counter before the error occurred. The value
of the error counter is incremented after the error flag has been output.

User’s Manual U17566EE5V1UM00 737


Chapter 20 CAN Controller (CAN)

(5) Recovery from bus-off state


When the CAN module is in the bus-off state, the CAN module permanently
sets its output signals (CTXDn) to recessive level.
The CAN module recovers from the bus-off state in the following bus-off
recovery sequence.
1. A request to enter the CAN initialization mode
2. A request to enter a CAN operation mode
(a)Recovery operation through normal recovery sequence
(b)Forced recovery operation that skips recovery sequence

(a) Recovery from bus-off state through normal recovery sequence


The CAN module first issues a request to enter the initialization mode (refer
too timing <1> in Figure 20-17 on page 739). This request will be immediately
acknowledged, and the OPMODE bits of the CnCTRL. register are cleared to
000B. Processing such as analyzing the fault that has caused the bus-off state,
re-defining the CAN module and message buffer using application software, or
stopping the operation of the CAN module can be performed by clearing the
GOM bit to 0.
Next, the module requests to change the mode from the initialization mode to
an operation mode (refer to timing <2> in Figure 20-17 on page 739). This
starts an operation to recover the CAN module from the bus-off state. The
conditions under which the module can recover from the bus-off state are
defined by the CAN protocol ISO 11898, and it is necessary to detect 11
consecutive recessive-level bits 128 times. At this time, the request to change
the mode to an operation mode is held pending until the recovery conditions
are satisfied. When the recovery conditions are satisfied (refer to timing <3> in
Figure 20-17 on page 739), the CAN module can enter the operation mode it
has requested. Until the CAN module enters this operation mode, it stays in the
initialization mode. Completion to be requested operation mode can be
confirmed by reading the OPMODE bits of the CnCTRL register.
During the bus-off period and bus-off recovery sequence, the BOFF bit of the
CnINFO register stays set (to 1). In the bus-off recovery sequence, the
reception error counter (REC[6:0]) counts the number of times 11 consecutive
recessive-level bits have been detected on the bus. Therefore, the recovery
state can be checked by reading REC[6:0].

www.DataSheet4U.com

738 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

Caution In the bus-off recovery sequence, REC[6:0] counts up (+1) each time 11
consecutive recessive-level bits have been detected. Even during the bus-off
period, the CAN module can enter the CAN sleep mode or CAN stop mode. To
start the bus-off recovery sequence, it is necessary to transit to the initialization
mode once. However, when the CAN module is in either CAN sleep mode or
CAN stop mode, transition request to the initialization mode is not accepted,
thus you have to release the CAN sleep mode first. In this case, as soon as the
CAN sleep mode is released, the bus-off recovery sequence starts and no
transition to initialization mode is necessary. If the can module detects a
dominant edge on the CAN bus while in sleep mode even during bus-off, the
sleep mode will be left and the bus-off recovery sequence will start.

TEC > FFH

»error-passive« »bus-off« »bus-off-recovery-sequence« »error-active«

BOFF bit
in CnINFO
register
<1> <2>
OPMODE[2:0]
in CnCTRL ≠ 00H
register
00H ≠ 00H
(user writings)

OPMODE[2:0] <3>
in CnCTRL
≠ 00H 00H ≠ 00H
register
(user readings)

TEC[7:0]
in CnERC 80H ≤ TEC[7:0]
? ?≤ FFH FFH < TEC [7:0] 00H ? ≤ TEC[7:0] < 80H
00H
register

REPS, REC[6:0]
00H ≤? REPS, REC[6:0] ≤ 80H Undefined 00H ≤ REPS, REC[6:0] < 80H
in CnERC
register

Figure 20-17 Recovery from bus-off state through normal recovery sequence

(b) Forced recovery operation that skips bus-off recovery sequence


The CAN module can be forcibly released from the bus-off state, regardless of
the bus state, by skipping the bus-off recovery sequence. Here is the
procedure.
First, the CAN module requests to enter the initialization mode. For the
operation and points to be noted at this time, “Recovery from bus-off state
through normal recovery sequence“ on page 738.
Next, the module requests to enter an operation mode. At the same time, the
CCERC bit of the CnCTRL register must be set to 1.
www.DataSheet4U.com
As a result, the bus-off recovery sequence defined by the CAN protocol ISO
11898 is skipped, and the module immediately enters the operation mode. In
this case, the module is connected to the CAN bus after it has monitored 11
consecutive recessive-level bits. For details, refer to the processing in Figure
20-55 on page 850.

User’s Manual U17566EE5V1UM00 739


Chapter 20 CAN Controller (CAN)

Caution This function is not defined by the CAN protocol ISO 11898. When using this
function, thoroughly evaluate its effect on the network system.

(6) Initializing CAN module error counter register (CnERC) in initialization


mode
If it is necessary to initialize the CAN module error counter register (CnERC)
and CAN module information register (CnINFO) for debugging or evaluating a
program, they can be initialized to the default value by setting the CCERC bit of
the CnCTRL register in the initialization mode. When initialization has been
completed, the CCERC bit is automatically cleared to 0.

Caution 1. This function is enabled only in the initialization mode. Even if the CCERC
bit is set to 1 in a CAN operation mode, the CnERC and CnINFO registers
are not initialized.
2. The CCERC bit can be set at the same time as the request to enter a CAN
operation mode.

www.DataSheet4U.com

740 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

20.3.7 Baud rate control function

(1) Prescaler
The CAN controller has a prescaler that divides the clock (fCAN) supplied to
CAN. This prescaler generates a CAN protocol layer basic system clock (fTQ)
derived from the CAN module system clock (fCANMOD), and divided by 1 to 256
(“CnBRP - CANn module bit rate prescaler register“ on page 772).

(2) Data bit time (8 to 25 time quanta)


One data bit time is defined as shown in Figure 20-18 on page 741.
The CAN Controller sets time segment 1, time segment 2, and
reSynchronization Jump Width (SJW) of data bit time, as shown in Figure 20-18.
Time segment 1 is equivalent to the total of the propagation (prop) segment
and phase segment 1 that are defined by the CAN protocol specification. Time
segment 2 is equivalent to phase segment 2.

Data bit time(DBT)

Sync segment Prop segment Phase segment 1 Phase segment 2

Time segment 1(TSEG1) Time segment 2


(TSEG2)

Sample point (SPT)

Figure 20-18 Segment setting

Table 20-15 Segment setting


Notes on setting to conform to CAN
Segment name Settable range
specification
Time segment 1 (TSEG1) 2TQ to 15TQ -
Time segment 2 (TSEG2) 1TQ to 8TQ IPT of the CAN controller is 0TQ. To conform to the
CAN protocol specification, therefore, a length less
or equal to phase segment 1 must be set here.
This means that the length of time segment 1
minus 1TQ is the settable upper limit of time
segment 2.
Resynchronization Jump 1TQ to 4TQ The length of time segment 1 minus 1TQ or 4 TQ,
Width (SJW) whichever is smaller.

Note 1. IPT: Information Processing Time


2. TQ: Time Quanta
www.DataSheet4U.com Reference: The CAN protocol specification defines the segments constituting
the data bit time as shown in Figure 20-19.

User’s Manual U17566EE5V1UM00 741


Chapter 20 CAN Controller (CAN)

Data bit time(DBT)

Sync segment Prop segment Phase segment 1 Phase segment 2

SJW

Sample point (SPT)

Figure 20-19 Configuration of data bit time defined by CAN specification

Table 20-16 Configuration of data bit time defined by CAN specification


Notes on setting to conform to CAN
Segment name Settable range
specification
Sync segment 1 This segment starts at the edge where the level
(Synchronization segment) changes from recessive to dominant when
hardware synchronization is established.
Prop segment Programmable to 1 to 8 This segment absorbs the delay of the output
or more buffer, CAN bus, and input buffer.
Phase segment 1 Programmable to 1 to 8 The length of this segment is set so that ACK is
returned before the start of phase segment 1.
Phase segment 2 Phase segment 1 or IPT,
whichever greater Time of prop segment ≥ (Delay of output buffer) +
2 × (Delay of CAN bus) + (Delay of input buffer)
This segment compensates for an error of data bit
time.
The longer this segment, the wider the permissible
range but the slower the communication speed.
SJW Programmable from 1TQ to This width sets the upper limit of expansion or
length of segment 1 or 4TQ, contraction of the phase segment during
whichever is smaller resynchronization.

Note IPT: Information Processing Time

www.DataSheet4U.com

742 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(3) Synchronizing data bit


• The receiving node establishes synchronization by a level change on the
bus because it does not have a sync signal.
• The transmitting node transmits data in synchronization with the bit timing of
the transmitting node.

(a) Hardware synchronization


This synchronization is established when the receiving node detects the start
of frame in the interframe space.
• When a falling edge is detected on the bus, that TQ means the sync
segment and the next segment is the prop segment. In this case,
synchronization is established regardless of SJW.

Interframe space Start of frame

CAN bus

Sync Prop Phase Phase


Bit timing
segment segment segment 1 segment 2

Figure 20-20 Adjusting synchronization of data bit

(b) Resynchronization
Synchronization is established again if a level change is detected on the bus
during reception (only if a recessive level was sampled previously).
• The phase error of the edge is given by the relative position of the detected
edge and sync segment.
<Sign of phase error>
0: If the edge is within the sync segment
Positive: If the edge is before the sample point (phase error)
Negative: If the edge is after the sample point (phase error)
If phase error is positive: Phase segment 1 is lengthened by specified
SJW.
If phase error is negative: Phase segment 2 is shortened by specified
SJW.
• The sample point of the data of the receiving node moves relatively due to
the “discrepancy” in the baud rate between the transmitting node and
receiving node.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 743


Chapter 20 CAN Controller (CAN)

If phase error is positive

CAN bus

Sync Prop Phase


Bit timing Phase segment 1
segment segment segment 2

Sample point
If phase error is negative

CAN bus

Sync Prop Phase


Bit timing Phase segment 1
segment segment segment 2

Sample point

Figure 20-21 Resynchronization

20.4 Connection with Target System

The CAN module has to be connected to the CAN bus using an external
transceiver.

CTxDn
CANL
CAN module CRxDn Transceiver
CANH

Figure 20-22 Connection to CAN bus

www.DataSheet4U.com

744 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

20.5 Internal Registers of CAN Controller

20.5.1 CAN module register and message buffer addresses

In this chapter all register and message buffer addresses are defined as
address offsets to different base addresses.
Since all registers are accessed via the programmable peripheral area the
bottom address is defined by the BPC register (refer to “Programmable
peripheral I/O area“ on page 133 or to “Programmable peripheral I/O area
(PPA)“ on page 296).
The addresses given in the following tables are offsets to the programmable
peripheral area base address PBA.
The recommended setting of PBA is 8FFBH. This setting would define the
programmable peripheral area base address
PBA = 03FE C000H

Table 20-17 lists all base addresses used throughout this chapter.

Table 20-17 CAN module base addresses


Base address name Base address of Address Address for BPC =8FFBH
C0RBaseAddr CAN0 registers PBA + 000H 03FE C000H
C0MBaseAddr CAN0 message buffers PBA + 100H 03FE C100H
C1RBaseAddr CAN1 registers PBA + 600H 03FE C600H
C1MBaseAddr CAN1 message buffers PBA + 700H 03FE C700H
C2RBaseAddr CAN2 registers PBA + C00H 03FE CC00H
C2MBaseAddr CAN2 message buffers PBA + D00H 03FE CD00H

In the following <CnRBaseAddr> respectively <CnMBaseAddr> are used for


the base address names for CAN channel n.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 745


Chapter 20 CAN Controller (CAN)

20.5.2 CAN Controller configuration

Table 20-18 List of CAN Controller registers


Item Register Name
CANn global registers CANn global control register (CnGMCTRL)
CANn global clock selection register (CnGMCS)
CANn global automatic block transmission control register (CnGMABT)
CANn global automatic block transmission delay setting register (CnGMABTD)
CANn module registers CANn module mask 1 register (CnMASK1L, CnMASK1H)
CANn module mask 2 register (CnMASK2L, CnMASK2H)
CANn module mask3 register (CnMASK3L, CnMASK3H)
CANn module mask 4 registers (CnMASK4L, CnMASK4H)
CANn module control register (CnCTRL)
CANn module last error information register (CnLEC)
CANn module information register (CnINFO)
CANn module error counter register (CnERC)
CANn module interrupt enable register (CnIE)
CANn module interrupt status register (CnINTS)
CANn module bit rate prescaler register (CnBRP)
CANn module bit rate register (CnBTR)
CANn module last in-pointer register (CnLIPT)
CANn module receive history list register (CnRGPT)
CANn module last out-pointer register (CnLOPT)
CANn module transmit history list register (CnTGPT)
CANn module time stamp register (CnTS)
CANn message buffer CANn message data byte 01 register m (CnMDATA01m)
registers
CANn message data byte 0 register m (CnMDATA0m)
CANn message data byte 1 register m (CnMDATA1m)
CANn message data byte 23 register m (CnMDATA23m)
CANn message data byte 2 register m (CnMDATA2m)
CANn message data byte 3 register m (CnMDATA3m)
CANn message data byte 45 register m (CnMDATA45m)
CANn message data byte 4 register m (CnMDATA4m)
CANn message data byte 5 register m (CnMDATA5m)
CANn message data byte 67 register m (CnMDATA67m)
CANn message data byte 6 register m (CnMDATA6m)
CANn message data byte 7 register m (CnMDATA7m)
CANn message data length register m (CnMDLCm)
www.DataSheet4U.com CANn message configuration register m (CnMCONFm)
CANn message ID register m (CnMIDLm, CnMIDHm)
CANn message control register m (CnMCTRLm)

746 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

20.5.3 CAN registers overview

(1) CANn global and module registers


The following table lists the address offsets to the CANn register base address
CnRBaseAddr.

Table 20-19 CANn global and module registers

Address Access
Register name Symbol R/W After reset
offset 1-bit 8-bit 16-bit
000 H CANn global control register CnGMCTRL R/W – – √ 0000 H
002 H CANn global clock selection register CnGMCS √ 0F H
006 H CANn global automatic block transmission CnGMABT – – √ 0000 H
register
008 H CANn global automatic block transmission CnGMABTD – √ – 00 H
delay register
040 H CANn module mask 1 register CnMASK1L – – √ Undefined
042 H CnMASK1H – – √ Undefined
044 H CANn module mask 2 register CnMASK2L – – √ Undefined
046 H CnMASK2H – – √ Undefined
048 H CANn module mask 3 register CnMASK3L – – √ Undefined
04A H CnMASK3H – – √ Undefined
04C H CANn module mask 4 register CnMASK4L – – √ Undefined
04E H CnMASK4H – – √ Undefined
050 H CANn module control register CnCTRL – – √ 0000 H
052 H CANn module last error code register CnLEC – √ – 00 H
053 H CANn module information register CnINFO R – √ – 00 H
054 H CANn module error counter register CnERC – – √ 0000v
056 H CANn module interrupt enable register CnIE R/W – – √ 0000 H
058 H CANn module interrupt status register CnINTS – – √ 0000 H
05A H CANn module bit-rate prescaler register CnBRP – √ – FF H
05C H CANn module bit-rate register CnBTR – – √ 370F H
05E H CANn module last in-pointer register CnLIPT R – √ – Undefined
060 H CANn module receive history list register CnRGPT R/W – – √ xx02 H
062 H CANn module last out-pointer register CnLOPT R – √ – Undefined
064 H CANn module transmit history list register CnTGPT R/W – – √ xx02 H
066 H CANn module time stamp register CnTS – – √ 0000 H

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 747


Chapter 20 CAN Controller (CAN)

(2) CANn message buffer registers


The addresses in the following table denote the address offsets to the CANn
message buffer base address:
CnMBaseAddr.
Example CAN0, message buffer register m = 14 = EH, byte 6 C0MDATA614 has the
address EH x 20H + 6H + C0MBaseAddr

Note The message buffer register number m in the register symbols has 2 digits, for
example,
COMDATA01m = COMDATA0100 for m = 0.

Table 20-20 CANn message buffer registers


Access
Address offset Register name Symbol R/W After reset
1-bit 8-bit 16-bit
mx20 H + 0 H CANn message data byte 01 register m CnMDATA01m R/W – – √ Undefined
mx20 H + 0 H CANn message data byte 0 register m CnMDATA0m – √ – Undefined
mx20 H + 1 H CANn message data byte 1 register m CnMDATA1m – √ – Undefined
mx20 H + 2 H CANn message data byte 23 register m CnMDATA23m – – √ Undefined
mx20 H + 2 H CANn message data byte 2 register m CnMDATA2m – √ – Undefined
mx20 H + 3 H CANn message data byte 3 register m CnMDATA3m – √ – Undefined
mx20 H + 4 H CANn message data byte 45 register m CnMDATA45m – – √ Undefined
mx20 H + 4 H CANn message data byte 4 register m CnMDATA4m – √ – Undefined
mx20 H + 5 H CANn message data byte 5 register m CnMDATA5m – √ – Undefined
mx20 H + 6 H CANn message data byte 67 register m CnMDATA67m – – √ Undefined
mx20 H + 6 H CANn message data byte 6 register m CnMDATA6m – √ – Undefined
mx20 H + 7 H CANn message data byte 7 register m CnMDATA7m – √ – Undefined
mx20 H + 8 H CANn message data length register m CnMDLCm – √ – 0000 xxxx B
mx20 H + 9 H CANn message configuration register m CnMCONFm – √ – Undefined
mx20 H + A H CANn message identifier register m CnMIDLm – – √ Undefined
mx20 H + C H CnMIDHm – – √ Undefined
mx20 H + E H CANn message control register m CnMCTRLm – – √ 0x00 0000
0000 0000 B

www.DataSheet4U.com

748 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

20.5.4 Register bit configuration

Table 20-21 CAN global register bit configuration


Address
Symbol Bit 7/15 Bit 6/14 Bit 5/13 Bit 4/12 Bit 3/11 Bit 2/10 Bit 1/9 Bit 0/8
offseta
00 H CnGMCTRL (W) 0 0 0 0 0 0 0 Clear GOM
01 H 0 0 0 0 0 0 Set EFSD Set GOM
00 H CnGMCTRL (R) 0 0 0 0 0 0 EFSD GOM
01 H MBON 0 0 0 0 0 0 0
02 H CnGMCS 0 0 0 0 CCP3 CCP2 CCP1 CCP0
06 H CnGMABT (W) 0 0 0 0 0 0 0 Clear
ABTTRG
07 H 0 0 0 0 0 0 Set Set
ABTCLR ABTTRG
06 H CnGMABT (R) 0 0 0 0 0 0 ABTCLR ABTTRG
07 H 0 0 0 0 0 0 0 0
08 H CnGMABTD 0 0 0 0 ABTD3 ABTD2 ABTD1 ABTD0
a)
Base address: <CnRBaseAddr>

Table 20-22 CAN module register bit configuration (1/2)


Address
Symbol Bit 7/15 Bit 6/14 Bit 5/13 Bit 4/12 Bit 3/11 Bit 2/10 Bit 1/9 Bit 0/8
offseta
40 H CnMASK1L CMID7 to CMID0
41 H CMID15 to CMID8
42 H CnMASK1H CMID23 to CMID16
43 H 0 0 0 CMID28 to CMID24
44 H CnMASK2L CMID7 to CMID0
45 H CMID15 to CMID8
46 H CnMASK2H CMID23 to CMID16
47 H 0 0 0 CMID28 to CMID24
48 H CnMASK3L CMID7 to CMID0
49 H CMID15 to CMID8
4A H CnMASK3H CMID23 to CMID16
4B H 0 0 0 CMID28 to CMID24
4C H CnMASK4L CMID7 to CMID0
4D H CMID15 to CMID8
4E H CnMASK4H CMID23 to CMID16
4F H 0 0 0 CMID28 to CMID24
50 H CnCTRL (W) 0 Clear AL Clear Clear Clear Clear Clear Clear
w w w . D a t a S h e e t 4 U . c o m VALID PSMODE1 PSMODE0 OPMODE2 OPMODE1 OPMODE0
51 H Set Set 0 Set Set Set Set Set
CCERC AL PSMODE1 PSMODE0 OPMODE2 OPMODE1 OPMODE0
50 H CnCTRL (R) CCERC AL VALID PS PS OP OP OP
MODE1 MODE0 MODE2 MODE1 MODE0
51 H 0 0 0 0 0 0 RSTAT TSTAT

User’s Manual U17566EE5V1UM00 749


Chapter 20 CAN Controller (CAN)

Table 20-22 CAN module register bit configuration (2/2)


Address
Symbol Bit 7/15 Bit 6/14 Bit 5/13 Bit 4/12 Bit 3/11 Bit 2/10 Bit 1/9 Bit 0/8
offseta
52 H CnLEC (W) 0 0 0 0 0 0 0 0
52 H CnLEC (R) 0 0 0 0 0 LEC2 LEC1 LEC0
53 H CnINFO 0 0 0 BOFF TECS1 TECS0 RECS1 RECS0
54 H CnERC TEC7 to TEC0
55 H REC7 to REC0
56 H CnIE (W) 0 0 Clear Clear Clear Clear Clear Clear
CIE5 CIE4 CIE3 CIE2 CIE1 CIE0
57 H 0 0 Set CIE5 Set CIE4 Set CIE3 Set CIE2 Set CIE1 Set CIE0
56 H CnIE (R) 0 0 CIE5 CIE4 CIE3 CIE2 CIE1 CIE0
57 H 0 0 0 0 0 0 0 0
58 H CnINTS (W) 0 0 Clear Clear Clear Clear Clear Clear
CINTS5 CINTS4 CINTS3 CINTS2 CINTS1 CINTS0
59 H 0 0 0 0 0 0 0 0
58 H CnINTS (R) 0 0 CINTS5 CINTS4 CINTS3 CINTS2 CINTS1 CINTS0
59 H 0 0 0 0 0 0 0 0
5A H CnBRP TQPRS7 to TQPRS0
5C H CnBTR 0 0 0 0 TSEG13 to TSEG10
5D H 0 0 SJW1, SJW0 0 TSEG22 to TSEG20
5E H CnLIPT LIPT7 to LIPT0
60 H CnRGPT (W) 0 0 0 0 0 0 0 Clear
ROVF
61 H 0 0 0 0 0 0 0 0
60 H CnRGPT (R) 0 0 0 0 0 0 RHPM ROVF
61 H RGPT7 to RGPT0
F62 H CnLOPT LOPT7 to LOPT0
64 H CnTGPT (W) 0 0 0 0 0 0 0 Clear
TOVF
65 H 0 0 0 0 0 0 0 0
64 H CnTGPT (R) 0 0 0 0 0 0 THPM TOVF
65 H TGPT7 to TGPT0
66 H CnTS (W) 0 0 0 0 0 Clear Clear Clear
TSLOCK TSSEL TSEN
67 H 0 0 0 0 0 Set Set Set
TSLOCK TSSEL TSEN
66 H CnTS (R) 0 0 0 0 0 TSLOCK TSSEL TSEN
67 H 0 0 0 0 0 0 0 0
68 H to FF H - Access prohibited (reser ved for future use)
a) Base address: <CnRBaseAddr>
www.DataSheet4U.com

750 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

Table 20-23 Message buffer register bit configuration


Address
Symbol Bit 7/15 Bit 6/14 Bit 5/13 Bit 4/12 Bit 3/11 Bit 2/10 Bit 1/9 Bit 0/8
offseta
0H CnMDATA01m Message data (byte 0)
1H Message data (byte 1)
0H CnMDATA0m Message data (byte 0)
1H CnMDATA1m Message data (byte 1)
2H CnMDATA23m Message data (byte 2)
3H Message data (byte 3)
2H CnMDATA2m Message data (byte 2)
3H CnMDATA3m Message data (byte 3)
4H CnMDATA45m Message data (byte 4)
5H Message data (byte 5)
4H CnMDATA4m Message data (byte 4)
5H CnMDATA5m Message data (byte 5)
6H CnMDATA67m Message data (byte 6)
7H Message data (byte 7)
6H CnMDATA6m Message data (byte 6)
7H CnMDATA7m Message data (byte 7)
8H CnMDLCm 0 MDLC3 MDLC2 MDLC1 MDLC0
9H CnMCONFm OWS RTR MT2 MT1 MT0 0 0 MA0
AH CnMIDLm ID7 ID6 ID5 ID4 ID3 ID2 ID1 ID0
BH ID15 ID14 ID13 ID12 ID11 ID10 ID9 ID8
CH CnMIDHm ID23 ID22 ID21 ID20 ID19 ID18 ID17 ID16
DH IDE 0 0 ID28 ID27 ID26 ID25 ID24
EH CnMCTRLm 0 0 0 Clear Clear Clear Clear Clear
(W) MOW IE DN TRQ RDY
FH 0 0 0 0 Set IE 0 Set TRQ Set RDY
EH CnMCTRLm 0 0 0 MOW IE DN TRQ RDY
(R)
FH 0 0 MUC 0 0 0 0 0
a) Base address: <CnMBaseAddr>

Note For calculation of the complete message buffer register addresses refer to
“CAN registers overview“ on page 747.

w w w . D a t a S h e e t 4 U . c o m

User’s Manual U17566EE5V1UM00 751


Chapter 20 CAN Controller (CAN)

20.6 Bit Set/Clear Function

The CAN control registers include registers whose bits can be set or cleared
via the CPU and via the CAN interface. An operation error occurs if the
following registers are written directly. Do not write any values directly via bit
manipulation, read/modify/write, or direct writing of target values.
• CANn global control register (CnGMCTRL)
• CANn global automatic block transmission control register (CnGMABT)
• CANn module control register (CnCTRL)
• CANn module interrupt enable register (CnIE)
• CANn module interrupt status register (CnINTS)
• CANn module receive history list register (CnRGPT)
• CANn module transmit history list register (CnTGPT)
• CANn module time stamp register (CnTS)
• CANn message control register (CnMCTRLm)

All the 16 bits in the above registers can be read via the usual method. Use the
procedure described in Figure 20-23 below to set or clear the lower 8 bits in
these registers.
Setting or clearing of lower 8 bits in the above registers is performed in
combination with the higher 8 bits (refer to the bit status after set/clear
operation is specified in Figure 20-26). Figure 20-23 shows how the values of
set bits or clear bits relate to set/clear/no change operations in the
corresponding register.

www.DataSheet4U.com

752 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

Register’s current value 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 1

Write value 0 0 0 0 1 0 1 1 1 1 0 1 1 0 0 0

set 0 0 0 0 1 0 1 1

clear 1 1 0 1 1 0 0 0

No change

No change
No change
Bit status

Clear

Clear
Clear

Set
Set
Register’s value after
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
write operation

Figure 20-23 Example of bit setting/clearing operations

(1) Bit status after bit setting/clearing operations

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Clear Clear Clear Clear Clear Clear Clear Clear
Set 7 Set 6 Set 5 Set 4 Set 3 Set 2 Set 1 Set 0
7 6 5 4 3 2 1 0

Set 0 ... 7 Clear 0 ... 7 Status of bit n after bit set/clear operation
0 0 No change
0 1 0
1 0 1
1 1 No change

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 753


Chapter 20 CAN Controller (CAN)

20.7 Control Registers

(1) CnGMCTRL - CANn global control register


The CnGMCTRL register is used to control the operation of the CAN module.
Access This register can be read/written in 16-bit units.
Address <CnRBaseAddr> + 000H
Initial Value 0000H. The register is initialized by any reset.

(a) CnGMCTRL read

15 14 13 12 11 10 9 8
MBON 0 0 0 0 0 0 0
7 6 5 4 3 2 1 0
0 0 0 0 0 0 EFSD GOM

Bit enabling access to message buffer register, transmit/receive


MBON
history registers
Write access and read access to the message buffer register and
0
the transmit/receive history list registers is disabled.
Write access and read access to the message buffer register and
1
the transmit/receive history list registers is enabled.

Caution 1. While the MBON bit is cleared (to 0), software access to the message
buffers (CnMDATA0m, CnMDATA1m, CnMDATA01m, CnMDATA2m,
CnMDATA3m, CnMDATA23m, CnMDATA4m, CnMDATA5m, CnMDATA45m,
CnMDATA6m, CnMDATA7m, CnMDATA67m, CnMDLCm, CnMCONFm,
CnMIDLm, CnMIDHm, and CnMCTRLm), or registers related to transmit
history or receive history (CnLOPT, CnTGPT, CnLIPT, and CnRGPT) is
disabled.
2. This bit is read-only. Even if 1 is written to the MBON bit while it is 0, the
value of the MBON bit does not change, and access to the message buffer
registers, or registers related to transmit history or receive history remains
disabled.

Note The MBON bit is cleared (to 0) when the CAN module enters CAN sleep mode/
CAN stop mode, or when the GOM bit is cleared (to 0).
The MBON bit is set (to 1) when the CAN sleep mode/CAN stop mode is
released, or when the GOM bit is set (to 1).

EFSD Bit enabling forced shut down


0 Forced shut down by GOM bit = 0 disabled.
www.DataSheet4U.com 1 Forced shut down by GOM bit = 0 enabled.

Caution 1. To request forced shut down, the GOM bit must be cleared to 0 in a
subsequent, immediately following access after the EFSD bit has been set
to 1. If access to another register (including reading the CnGMCTRL
register) is executed without clearing the GOM bit immediately after the

754 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

EFSD bit has been set to 1, the EFSD bit is forcibly cleared to 0, and the
forced shut down request is invalid.
2. EFSD only works, if no continuous DMA transfer is performed.

GOM Global operation mode bit


0 CAN module is disabled from operating.
1 CAN module is enabled to operate.

Caution The GOM can be cleared only in the initialization mode or immediately after
EFSD bit is set (to 1).

(b) CnGMCTRL write

15 14 13 12 11 10 9 8
Set Set
0 0 0 0 0 0
EFSD GOM
7 6 5 4 3 2 1 0
Clear
0 0 0 0 0 0 0
GOM

Set EFSD EFSD bit setting


0 No change in EFSD bit.
1 EFSD bit set to 1.

Set GOM Clear GOM GOM bit setting


0 1 GOM bit cleared to 0.
1 0 GOM bit set to 1.
Other than above No change in GOM bit.

Caution Set the GOM bit and EFSD bit always separately.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 755


Chapter 20 CAN Controller (CAN)

(2) CnGMCS - CANn global clock selection register


The CnGMCS register is used to select the CAN module system clock.
Access This register can be read/written in 8-bit units.
Address <CnRBaseAddr> + 002H
Initial Value 0FH. The register is initialized by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 CCP3 CCP2 CCP1 CCP0

CCP3 CCP2 CCP1 CCP1 CAN module system clock (fCANMOD)


0 0 0 0 fCAN/1
0 0 0 1 fCAN/2
0 0 1 0 fCAN/3
0 0 1 1 fCAN/4
0 1 0 0 fCAN/5
0 1 0 1 fCAN/6
0 1 1 0 fCAN/7
0 1 1 1 fCAN/8
1 0 0 0 fCAN/9
1 0 0 1 fCAN/10
1 0 1 0 fCAN/11
1 0 1 1 fCAN/12
1 1 0 0 fCAN/13
1 1 0 1 fCAN/14
1 1 1 0 fCAN/15
1 1 1 1 fCAN/16 (default value)

Note fCAN = clock supplied to CAN

www.DataSheet4U.com

756 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(3) CnGMABT - CANn global automatic block transmission control register


The CnGMABT register is used to control the automatic block transmission
(ABT) operation.
Access This register can be read/written in 16-bit units.
Address <CnRBaseAddr> + 006H
Initial Value 0000H. The register is initialized by any reset.

(a) CnGMABT read

15 14 13 12 11 10 9 8
0 0 0 0 0 0 0 0
7 6 5 4 3 2 1 0
0 0 0 0 0 0 ABTCLR ABTTRG

ABTCLR Automatic block transmission engine clear status bit


0 Clearing the automatic transmission engine is completed.
1 The automatic transmission engine is being cleared.

Note 1. Set the ABTCLR bit to 1 while the ABTTRG bit is cleared to 0.
The operation is not guaranteed if the ABTCLR bit is set to 1 while the
ABTTRG bit is set to 1.
2. When the automatic block transmission engine is cleared by setting the
ABTCLR bit to 1, the ABTCLR bit is automatically cleared to 0 as soon as
the requested clearing processing is complete.

ABTTRG Automatic block transmission status bit


0 Automatic block transmission is stopped.
1 Automatic block transmission is under execution.

Caution 1. Do not set the ABTTRG bit (1) in the initialization mode. If the ABTTRG bit is
set in the initialization mode, the operation is not guaranteed after the CAN
module has entered the normal operation mode with ABT.
2. Do not set the ABTTRG bit (1) while the CnCTRL.TSTAT bit is set (1).
Confirm TSTAT = 0 directly in advance before setting ABTTRG bit.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 757


Chapter 20 CAN Controller (CAN)

(b) CnGMABT write

15 14 13 12 11 10 9 8
Set Set
0 0 0 0 0 0
ABTCLR ABTTRG
7 6 5 4 3 2 1 0
Clear
0 0 0 0 0 0 0
ABTTRG

Caution Before changing the normal operation mode with ABT to the initialization
mode, be sure to set the CnGMABT register to the default value (0000H) and
confirm the CnGMABT register is surely initialized to the default value (0000H).

Set ABTCLR Automatic block transmission engine clear request bit


The automatic block transmission engine is in idle status or under
0
operation.
Request to clear the automatic block transmission engine. After the
automatic block transmission engine has been cleared, automatic
1
block transmission is started from message buffer 0 by setting the
ABTTRG bit to 1.

Set ABTTRG Clear ABTTRG Automatic block transmission start bit


0 1 Request to stop automatic block transmission.
1 0 Request to start automatic block transmission.
Other than above No change in ABTTRG bit.

www.DataSheet4U.com

758 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(4) CnGMABTD - CANn global automatic block transmission delay register


The CnGMABTD register is used to set the interval at which the data of the
message buffer assigned to ABT is to be transmitted in the normal operation
mode with ABT.
Access This register can be read/written in 8-bit units.
Address <CnRBaseAddr> + 008H
Initial Value 00H. The register is initialized by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 ABTD3 ABTD2 ABTD1 ABTD0

Data frame interval during automatic


ABTD3 ABTD2 ABTD1 ABTD0
block transmission in DBTa
0 0 0 0 0 DBT (default value)
0 0 0 1 25 DBT
0 0 1 0 26 DBT
0 0 1 1 27 DBT
0 1 0 0 28 DBT
0 1 0 1 29 DBT
0 1 1 0 210 DBT
0 1 1 1 211 DBT
1 0 0 0 212 DBT
Other than above Setting prohibited
a) Unit: Data bit time (DBT)

Caution 1. Do not change the contents of the CnGMABTD register while the ABTTRG
bit is set to 1.
2. The timing at which the ABT message is actually transmitted onto the CAN
bus differs depending on the status of transmission from the other station or
how a request to transmit a message other than an ABT message (message
buffers 8 to 31) is made.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 759


Chapter 20 CAN Controller (CAN)

(5) CnMASKaL, CnMASKaH - CANn module mask control register (a = 1 to 4)


The CnMASKaL and CnMASKaH registers are used to extend the number of
receivable messages into the same message buffer by masking part of the
identifier (ID) comparison of a message and invalidating the ID of the masked
part.

(a) CANn module mask 1 register (CnMASK1L, CnMASK1H)


Access These registers can be read/written in 16-bit units.
Address CnMASK1L: <CnRBaseAddr> + 040H
CnMASK1H: <CnRBaseAddr> + 042H
Initial Value Undefined.
CnMASK1L
15 14 13 12 11 10 9 8
CMID15 CMID14 CMID13 CMID12 CMID11 CMID10 CMID9 CMID8
7 6 5 4 3 2 1 0
CMID7 CMID6 CMID5 CMID4 CMID3 CMID2 CMID1 CMID0

CnMASK1H
15 14 13 12 11 10 9 8
0 0 0 CMID28 CMID27 CMID26 CMID25 CMID24
7 6 5 4 3 2 1 0
CMID23 CMID22 CMID21 CMID20 CMID19 CMID18 CMID17 CMID16

(b) CANn module mask 2 register (CnMASK2L, CnMASK2H)


Access These registers can be read/written in 16-bit units.
Address CnMASK2L: <CnRBaseAddr> + 044H
CnMASK2H: <CnRBaseAddr> + 046H
Initial Value Undefined.
CnMASK2L
15 14 13 12 11 10 9 8
CMID15 CMID14 CMID13 CMID12 CMID11 CMID10 CMID9 CMID8
7 6 5 4 3 2 1 0
CMID7 CMID6 CMID5 CMID4 CMID3 CMID2 CMID1 CMID0

CnMASK2H
15 14 13 12 11 10 9 8
0 0 0 CMID28 CMID27 CMID26 CMID25 CMID24
7 6 5 4 3 2 1 0
CMID23 CMID22 CMID21 CMID20 CMID19 CMID18 CMID17 CMID16
www.DataSheet4U.com

760 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(c) CANn module mask 3 register (CnMASK3L, CnMASK3H)


Access These registers can be read/written in 16-bit units.
Address CnMASK3L: <CnRBaseAddr> + 048H
CnMASK3H: <CnRBaseAddr> + 04AH
Initial Value Undefined.
CnMASK3L
15 14 13 12 11 10 9 8
CMID15 CMID14 CMID13 CMID12 CMID11 CMID10 CMID9 CMID8
7 6 5 4 3 2 1 0
CMID7 CMID6 CMID5 CMID4 CMID3 CMID2 CMID1 CMID0

CnMASK3H
15 14 13 12 11 10 9 8
0 0 0 CMID28 CMID27 CMID26 CMID25 CMID24
7 6 5 4 3 2 1 0
CMID23 CMID22 CMID21 CMID20 CMID19 CMID18 CMID17 CMID16

(d) CANn module mask 4 register (CnMASK4L, CnMASK4H)


Access These registers can be read/written in 16-bit units.
Address CnMASK4L: <CnRBaseAddr> + 04CH
CnMASK4H: <CnRBaseAddr> + 04EH
Initial Value Undefined.
CnMASK4L
15 14 13 12 11 10 9 8
CMID15 CMID14 CMID13 CMID12 CMID11 CMID10 CMID9 CMID8
7 6 5 4 3 2 1 0
CMID7 CMID6 CMID5 CMID4 CMID3 CMID2 CMID1 CMID0

CnMASK4H
15 14 13 12 11 10 9 8
0 0 0 CMID28 CMID27 CMID26 CMID25 CMID24
7 6 5 4 3 2 1 0
CMID23 CMID22 CMID21 CMID20 CMID19 CMID18 CMID17 CMID16

CMID28 to CMID0 Mask pattern setting of ID bit


The ID bits of the message buffer set by the CMID28 to CMID0 bits are compared with the
0
ID bits of the received message frame.
The ID bits of the message buffer set by the CMID28 to CMID0 bits are not compared with
1
www.DataSheet4U.com the ID bits of the received message frame (they are masked).

Note Masking is always defined by an ID length of 29 bits. If a mask is assigned to a


message with a standard ID, the CMID17 to CMID0 bits are ignored.
Therefore, only the CMID28 to CMID18 bits of the received ID are masked.
The same mask can be used for both the standard and extended IDs.

User’s Manual U17566EE5V1UM00 761


Chapter 20 CAN Controller (CAN)

(6) CnCTRL - CANn module control register


The CnCTRL register is used to control the operation mode of the CAN
module.
Access This register can be read/written in 16-bit units.
Address <CnRBaseAddr> + 050H
Initial Value 0000H. The register is initialized by any reset.

(a) CnCTRL read


15 14 13 12 11 10 9 8
0 0 0 0 0 0 RSTAT TSTAT
7 6 5 4 3 2 1 0
CCERC AL VALID PSMODE1 PSMODE0 OPMODE2 OPMODE1 OPMODE0

RSTAT Reception status bit


0 Reception is stopped.
1 Reception is in progress.

Note 1. The RSTAT bit is set to 1 under the following conditions (timing)
• The SOF bit of a receive frame is detected
• On occurrence of arbitration loss during a transmit frame
2. The RSTAT bit is cleared to 0 under the following conditions (timing)
• When a recessive level is detected at the second bit of the interframe
space
• On transition to the initialization mode at the first bit of the interframe
space

TSTAT Transmission status bit


0 Transmission is stopped.
1 Transmission is in progress.

Note 1. The TSTAT bit is set to 1 under the following conditions (timing)
• The SOF bit of a transmit frame is detected
2. The TSTAT bit is cleared to 0 under the following conditions (timing)
• During transition to bus-off state
• On occurrence of arbitration loss in transmit frame
• On detection of recessive level at the second bit of the interframe space
• On transition to the initialization mode at the first bit of the interframe
space

www.DataSheet4U.com

762 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

CCERC Error counter clear bit


The CnERC and CnINFO registers are not cleared in the initialization
0
mode.
The CnERC and CnINFO registers are cleared in the initialization
1
mode.

Note 1. The CCERC bit is used to clear the CnERC and CnINFO registers for re-
initialization or forced recovery from the bus-off state. This bit can be set to
1 only in the initialization mode.
2. When the CnERC and CnINFO registers have been cleared, the CCERC
bit is also cleared to 0 automatically.
3. The CCERC bit can be set to 1 at the same time as a request to change
the initialization mode to an operation mode is made.
4. The CCERC bit is read-only in the CAN sleep mode or CAN stop mode.
5. The receive data may be corrupted in case of setting the CCERC bit to (1)
immediately after entering the INIT mode from self-test mode.

AL Bit to set operation in case of arbitration loss


Re-transmission is not executed in case of an arbitration loss in the
0
single-shot mode.
Re-transmission is executed in case of an arbitration loss in the single-
1
shot mode.

Note The AL bit is valid only in the single-shot mode.

VALID Valid receive message frame detection bit


A valid message frame has not been received since the VALID bit was
0
last cleared to 0.
A valid message frame has been received since the VALID bit was last
1
cleared to 0.

Note 1. Detection of a valid receive message frame is not dependent upon storage
in the receive message buffer (data frame) or transmit message buffer
(remote frame).
2. Clear the VALID bit (0) before changing the initialization mode to an
operation mode.
3. If only two CAN nodes are connected to the CAN bus with one transmitting
a message frame in the normal mode and the other in the receive-only
mode, the VALID bit is not set to 1 before the transmitting node enters the
error passive state, because in receive-only mode no acknowledge is
generated.
4. To clear the VALID bit, set the Clear VALID bit to 1 first and confirm that the
VALID bit is cleared. If it is not cleared, perform clearing processing again.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 763


Chapter 20 CAN Controller (CAN)

PSMODE1 PSMODE0 Power save mode


0 0 No power save mode is selected.
0 1 CAN sleep mode
1 0 Setting prohibited
1 1 CAN stop mode

Caution 1. Transition to and from the CAN stop mode must be made via CAN sleep
mode. A request for direct transition to and from the CAN stop mode is
ignored.
2. The MBON flag of CnGMCTRL must be checked after releasing a power
save mode, prior to access the message buffers again.
3. CAN sleep mode requests are kept pending, until cancelled by software or
entered on appropriate bus condition (bus idle). Software can check the
actual status by reading PSMODE.

OPMODE2 OPMODE1 OPMODE0 Operation mode


No operation mode is selected (CAN module
0 0 0
is in the initialization mode).
0 0 1 Normal operation mode
Normal operation mode with automatic block
0 1 0 transmission function (normal operation
mode with ABT)
0 1 1 Receive-only mode
1 0 0 Single-shot mode
1 0 1 Self-test mode
Other than above Setting prohibited

Caution Transit to initialization mode or power saving modes may take some time. Be
sure to verify the success of mode change by reading the values, before
proceeding.

Note The OPMODE0 to OPMODE2 bits are read-only in the CAN sleep mode or
CAN stop mode.

www.DataSheet4U.com

764 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(b) CnCTRL write


15 14 13 12 11 10 9 8
Set Set Set Set Set Set Set
0
CCERC AL PSMODE1 PSMODE0 OPMODE2 OPMODE1 OPMODE0
7 6 5 4 3 2 1 0
Clear Clear Clear Clear Clear Clear Clear
0
AL VALID PSMODE1 PSMODE0 OPMODE2 OPMODE1 OPMODE0

Set CCERC Setting of CCERC bit


1 CCERC bit is set to 1.
Other than above CCERC bit is not changed.

Set AL Clear AL Setting of AL bit


0 1 AL bit is cleared to 0.
1 0 AL bit is set to 1.
Other than above AL bit is not changed.

Clear VALID Setting of VALID bit


0 VALID bit is not changed.
1 VALID bit is cleared to 0.

Set Clear
Setting of PSMODE0 bit
PSMODE0 PSMODE0
0 1 PSMODE0 bit is cleared to 0.
1 0 PSMODE0 bit is set to 1.
Other than above PSMODE0 bit is not changed.

Set Clear
Setting of PSMODE1 bit
PSMODE1 PSMODE1
0 1 PSMODE1 bit is cleared to 0.
1 0 PSMODE1 bit is set to 1.
Other than above PSMODE1 bit is not changed.

Set Clear
Setting of OPMODE0 bit
OPMODE0 OPMODE0
0 1 OPMODE0 bit is cleared to 0.
1 0 OPMODE0 bit is set to 1.
Other than above OPMODE0 bit is not changed.
www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 765


Chapter 20 CAN Controller (CAN)

Set Clear
Setting of OPMODE1 bit
OPMODE1 OPMODE1
0 1 OPMODE1 bit is cleared to 0.
1 0 OPMODE1 bit is set to 1.
Other than above OPMODE1 bit is not changed.

Set Clear
Setting of OPMODE2 bit
OPMODE2 OPMODE2
0 1 OPMODE2 bit is cleared to 0.
1 0 OPMODE2 bit is set to 1.
Other than above OPMODE2 bit is not changed.

(7) CnLEC - CANn module last error information register


The CnLEC register provides the error information of the CAN protocol.
Access This register can be read/written in 8-bit units.
Address <CnRBaseAddr> + 052H

Initial Value 00H. The register is initialized by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 0 LEC2 LEC1 LEC0

Note 1. The contents of the CnLEC register are not cleared when the CAN module
changes from an operation mode to the initialization mode.
2. If an attempt is made to write a value other than 00H to the CnLEC register
by software, the access is ignored.

LEC2 LEC1 LEC0 Last CAN protocol error information


0 0 0 No error
0 0 1 Stuff error
0 1 0 Form error
0 1 1 ACK error
Bit error. (The CAN module tried to transmit a recessive-level
1 0 0 bit as part of a transmit message (except the arbitration field),
but the value on the CAN bus is a dominant-level bit.)
Bit error. (The CAN module tried to transmit a dominant-level
bit as part of a transmit message, ACK bit, error frame, or
1 0 1
overload frame, but the value on the CAN bus is a recessive-
level bit.)
1 1 0 CRC error
1 1 1 Undefined
www.DataSheet4U.com

766 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(8) CnINFO - CANn module information register


The CnINFO register indicates the status of the CAN module.
Access This register is read-only in 8-bit units.
Address <CnRBaseAddr> + 053H
Initial Value 00H. The register is initialized by any reset.

7 6 5 4 3 2 1 0
0 0 0 BOFF TECS1 TECS0 RECS1 RECS0

BOFF Bus-off state bit


Not bus-off state (transmit error counter ≤255). (The value of the transmit
0
counter is less than 256.)
Bus-off state (transmit error counter > 255). (The value of the transmit
1
counter is 256 or more.)

TECS1 TECS0 Transmission error counter status bit


The value of the transmission error counter is less than that of
0 0
the warning level (< 96).
The value of the transmission error counter is in the range of
0 1
the warning level (96 to 127).
1 0 Undefined
The value of the transmission error counter is in the range of
1 1
the error passive or bus-off status (≥ 128).

RECS1 RECS0 Reception error counter status bit


The value of the reception error counter is less than that of the
0 0
warning level (< 96).
The value of the reception error counter is in the range of the
0 1
warning level (96 to 127).
1 0 Undefined
The value of the reception error counter is in the error passive
1 1
range (≥ 128).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 767


Chapter 20 CAN Controller (CAN)

(9) CnERC - CANn module error counter register


The CnERC register indicates the count value of the transmission/reception
error counter.
Access This register is read-only in 16-bit units.
Address <CnRBaseAddr> + 054H
Initial Value 0000H. The register is initialized by any reset.

15 14 13 12 11 10 9 8
REPS REC6 REC5 REC4 REC3 REC2 REC1 REC0
7 6 5 4 3 2 1 0
TEC7 TEC6 TEC5 TEC4 TEC3 TEC2 TEC1 TEC0

REPS Reception error passive status bit


The reception error counter is not in the error passive range (<
0
128)
1 The reception error counter is in the error passive range (≥ 128)

REC6 to REC0 Reception error counter bit


Number of reception errors. These bits reflect the status of the
0 to 127 reception error counter. The number of errors is defined by the
CAN protocol.

Note REC6 to REC0 of the reception error counter are invalid in the reception error
passive state (CnINFO.RECS[1:0] = 11B).

TEC7 to TEC0 Transmission error counter bit


Number of transmission errors. These bits reflect the status
0 to 255 of the transmission error counter. The number of errors is
defined by the CAN protocol.

Note The TEC7 to TEC0 bits of the transmission error counter are invalid in the bus-
off state (CnINFO.BOFF = 1).

www.DataSheet4U.com

768 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(10) CnIE - CANn module interrupt enable register


The CnIE register is used to enable or disable the interrupts of the CAN
module.
Access This register can be read/written in 16-bit units.
Address <CnRBaseAddr> + 056H
Initial Value 0000H. The register is initialized by any reset.

(a) CnIE read


15 14 13 12 11 10 9 8
0 0 0 0 0 0 0 0
7 6 5 4 3 2 1 0
0 0 CIE5 CIE4 CIE3 CIE2 CIE1 CIE0

CIE5 to CIE0 CAN module interrupt enable bit


Output of the interrupt corresponding to interrupt status register
0
CINTSx is disabled.
Output of the interrupt corresponding to interrupt status register
1
CINTSx is enabled.

(b) CnIE write


15 14 13 12 11 10 9 8
Set Set Set Set Set Set
0 0
CIE5 CIE4 CIE3 CIE2 CIE1 CIE0
7 6 5 4 3 2 1 0
Clear Clear Clear Clear Clear Clear
0 0
CIE5 CIE4 CIE3 CIE2 CIE1 CIE0

Set CIE5 Clear CIE5 Setting of CIE5 bit


0 1 CIE5 bit is cleared to 0.
1 0 CIE5 bit is set to 1.
Other than above CIE5 bit is not changed.

Set CIE4 Clear CIE4 Setting of CIE4 bit


0 1 CIE4 bit is cleared to 0.
1 0 CIE4 bit is set to 1.
Other than above CIE4 bit is not changed.

Set CIE3 Clear CIE3 Setting of CIE3 bit


0 1 CIE3 bit is cleared to 0.
www.DataSheet4U.com 1 0 CIE3 bit is set to 1.
Other than above CIE3 bit is not changed.

User’s Manual U17566EE5V1UM00 769


Chapter 20 CAN Controller (CAN)

Set CIE2 Clear CIE2 Setting of CIE2 bit


0 1 CIE2 bit is cleared to 0.
1 0 CIE2 bit is set to 1.
Other than above CIE2 bit is not changed.

Set CIE1 Clear CIE1 Setting of CIE1 bit


0 1 CIE1 bit is cleared to 0.
1 0 CIE1 bit is set to 1.
Other than above CIE1 bit is not changed.

Set CIE0 Clear CIE0 Setting of CIE0 bit


0 1 CIE0 bit is cleared to 0.
1 0 CIE0 bit is set to 1.
Other than above CIE0 bit is not changed.

www.DataSheet4U.com

770 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(11) CnINTS - CANn module interrupt status register


The CnINTS register indicates the interrupt status of the CAN module.
Access This register can be read/written in 16-bit units.
Address <CnRBaseAddr> + 058H
Initial Value 0000H. The register is initialized by any reset.

(a) CnINTS read


15 14 13 12 11 10 9 8
0 0 0 0 0 0 0 0
7 6 5 4 3 2 1 0
0 0 CINTS5 CINTS4 CINTS3 CINTS2 CINTS1 CINTS0

CINTS5 to CINTS0 CAN interrupt status bit


0 No related interrupt source event is pending.
1 A related interrupt source event is pending.

Interrupt status bit Related interrupt source event


CINTS5 Wakeup interrupt from CAN sleep modea
CINTS4 Arbitration loss interrupt
CINTS3 CAN protocol error interrupt
CINTS2 CAN error status interrupt
Interrupt on completion of reception of valid message frame to
CINTS1
message buffer m
Interrupt on normal completion of transmission of message
CINTS0
frame from message buffer m
a) The CINTS5 bit is set only when the CAN module is woken up from the CAN sleep
mode by a CAN bus operation. The CINTS5 bit is not set when the CAN sleep
mode has been released by software.

(b) CnINTS write


15 14 13 12 11 10 9 8
0 0 0 0 0 0 0 0
7 6 5 4 3 2 1 0
Clear Clear Clear Clear Clear Clear
0 0
CINTS5 CINTS4 CINTS3 CINTS2 CINTS1 CINTS0

Clear
Setting of CINTS5 to CINTS0 bits
CINTS5 to CINTS0
0 CINTS5 to CINTS0 bits are not changed.
1 CINTS5 to CINTS0 bits are cleared to 0.
www.DataSheet4U.com

Caution Please clear the status bit of this register with software when the confirmation
of each status is necessary in the interrupt processing, because these bits are
not cleared automatically.

User’s Manual U17566EE5V1UM00 771


Chapter 20 CAN Controller (CAN)

(12) CnBRP - CANn module bit rate prescaler register


The CnBRP register is used to select the CAN protocol layer basic system
clock (fTQ). The communication baud rate is set to the CnBTR register.

Access This register can be read/written in 8-bit units.


Address <CnRBaseAddr> + 05AH
Initial Value FFH. The register is initialized by any reset.

7 6 5 4 3 2 1 0
TQPRS7 TQPRS6 TQPRS5 TQPRS4 TQPRS3 TQPRS2 TQPRS1 TQPRS0

TQPRS7 to TQPRS0 CAN protocol layer base system clock (fTQ)


0 fCANMOD/1
1 fCANMOD/2
n fCANMOD/(n+1)
: :
255 fCANMOD/256 (default value)

CANn module clock selection register


(CnGMCS)

0 0 0 0 CCP3 CCP2 CCP1 CCP0

fCAN fCANMOD fTQ CANn bit-rate


Prescaler Baud rate generator
register (CnBTR)

TQPRS7 TQPRS6 TQPRS5 TQPRS4 TQPRS3 TQPRS2 TQPRS1 TQPRS0

CANn module bit-rate prescaler register (CnBRP)

Figure 20-24 CAN module clock

Note fCAN: clock supplied to CAN


fCANMOD: CAN module system clock
fTQ: CAN protocol layer basic system clock

Caution The CnBRP register can be write-accessed only in the initialization mode.
www.DataSheet4U.com

772 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(13) CnBTR - CANn module bit rate register


The CnBTR register is used to control the data bit time of the communication
baud rate.
Access This register can be read/written in 16-bit units.
Address <CnRBaseAddr> + 05CH
Initial Value 370FH. The register is initialized by any reset.

15 14 13 12 11 10 9 8
0 0 SJW1 SJW0 0 TSEG22 TSEG21 TSEG20
7 6 5 4 3 2 1 0
0 0 0 0 TSEG13 TSEG12 TSEG11 TSEG10

Data bit time (DBT)

Sync segment Prop segment Phase segment 1 Phase segment 2

Time segment 1 (TSEG1) Time segment 2


(TSEG2)
Sample point (SPT)

Figure 20-25 Data bit time

SJW1 SJW0 Length of synchronization jump width


0 0 1TQ
0 1 2TQ
1 0 3TQ
1 1 4TQ (default value)

TSEG22 TSEG21 TSEG20 Length of time segment 2


0 0 0 1TQ
0 0 1 2TQ
0 1 0 3TQ
0 1 1 4TQ
1 0 0 5TQ
1 0 1 6TQ
1 1 0 7TQ
www.DataSheet4U.com
1 1 1 8TQ (default value)

User’s Manual U17566EE5V1UM00 773


Chapter 20 CAN Controller (CAN)

TSEG13 TSEG12 TSEG11 TSEG10 Length of time segment 1


0 0 0 0 Setting prohibited
0 0 0 1 2TQa
0 0 1 0 3TQa
0 0 1 1 4TQ
0 1 0 0 5TQ
0 1 0 1 6TQ
0 1 1 0 7TQ
0 1 1 1 8TQ
1 0 0 0 9TQ
1 0 0 1 10TQ
1 0 1 0 11TQ
1 0 1 1 12TQ
1 1 0 0 13TQ
1 1 0 1 14TQ
1 1 1 0 15TQ
1 1 1 1 16TQ (default value)
a) This setting must not be made when the CnBRP register = 00H

Note TQ = 1/fTQ (fTQ: CAN protocol layer basic system clock)

(14) CnLIPT - CANn module last in-pointer register


The CnLIPT register indicates the number of the message buffer in which a
data frame or a remote frame was last stored.
Access This register is read-only in 8-bit units.
Address <CnRBaseAddr> + 05EH
Initial Value Undefined.
7 6 5 4 3 2 1 0
LIPT7 LIPT6 LIPT5 LIPT4 LIPT3 LIPT2 LIPT1 LIPT0

LIPT7 to LIPT0 Last in-pointer register (CnLIPT)


When the CnLIPT register is read, the contents of the element
indexed by the last in-pointer (LIPT) of the receive history list are
0 to 31
read. These contents indicate the number of the message buffer in
which a data frame or a remote frame was last stored.

Note The read value of the CnLIPT register is undefined if a data frame or a remote
frame has never been stored in the message buffer. If the RHPM bit of the
www.DataSheet4U.com CnRGPT register is set to 1 after the CAN module has changed from the
initialization mode to an operation mode, therefore, the read value of the
CnLIPT register is undefined.

774 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(15) CnRGPT - CANn module receive history list register


The CnRGPT register is used to read the receive history list.
Access This register can be read/written in 16-bit units.
Address <CnRBaseAddr> + 060H
Initial Value xx02H. The register is initialized by any reset.

(a) CnRGPT read

15 14 13 12 11 10 9 8
RGPT7 RGPT6 RGPT5 RGPT4 RGPT3 RGPT2 RGPT1 RGPT0
7 6 5 4 3 2 1 0
0 0 0 0 0 0 RHPM ROVF

RGPT7
to Receive history list read pointer
RGPT0
When the CnRGPT register is read, the contents of the element indexed
by the receive history list get pointer (RGPT) of the receive history list are
0 to 31
read. These contents indicate the number of the message buffer in which
a data frame or a remote frame has been stored.

RHPMa Receive history list pointer match


The receive history list has at least one message buffer number that has
0
not been read.
The receive history list has no message buffer numbers that have not
1
been read.
a) The read value of the RGPT0 to RGPT7 bits is invalid when the RHPM bit = 1.

ROVFa Receive history list overflow bit


All the message buffer numbers that have not been read are preserved.
All the numbers of the message buffers in which a new data frame or
0
remote frame has been received and stored are recorded to the receive
history list (the receive history list has a vacant element).
At least 23 entries have been stored since the host processor has
serviced the RHL last
time (i.e. read CnRGPT). The first 22 entries are sequentially stored while
the last entry
1 can have been overwritten whenever newly received message is stored
because all buffer
numbers are stored at position LIPT-1 when ROVF bit is set. Thus the
sequence of
receptions can not be recovered completely now.
a) If ROVF is set, RHPM is no longer cleared on message storage, but RHPM is still
www.DataSheet4U.com
set, if all entries of CnRGPT are read by software.

User’s Manual U17566EE5V1UM00 775


Chapter 20 CAN Controller (CAN)

(b) CnRGPT write


15 14 13 12 11 10 9 8
0 0 0 0 0 0 0 0
7 6 5 4 3 2 1 0
Clear
0 0 0 0 0 0 0
ROVF

Clear ROVF Setting of ROVF bit


0 ROVF bit is not changed.
1 ROVF bit is cleared to 0.

(16) CnLOPT - CANn module last out-pointer register


The CnLOPT register indicates the number of the message buffer to which a
data frame or a remote frame was transmitted last.
Access This register is read-only in 8-bit units.
Address <CnRBaseAddr> + 062H

Initial Value Undefined


7 6 5 4 3 2 1 0
LOPT7 LOPT6 LOPT5 LOPT4 LOPT3 LOPT2 LOPT1 LOPT0

LOPT7 to
Last out-pointer of transmit history list (LOPT)
LOPT0
When the CnLOPT register is read, the contents of the element indexed
by the last out-pointer (LOPT) of the receive history list are read. These
0 to 31
contents indicate the number of the message buffer to which a data frame
or a remote frame was transmitted last.

Note The value read from the CnLOPT register is undefined if a data frame or
remote frame has never been transmitted from a message buffer. If the
CnTGPT.THPM bit is set to 1 after the CAN module has changed from the
initialization mode to an operation mode, therefore, the read value of the
CnLOPT register is undefined.

www.DataSheet4U.com

776 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(17) CnTGPT - CANn module transmit history list register


The CnTGPT register is used to read the transmit history list.
Access This register can be read/written in 16-bit units.
Address <CnRBaseAddr> + 064H
Initial Value xx02H. The register is initialized by any reset.

(a) CnTGPT read

15 14 13 12 11 10 9 8
TGPT7 TGPT6 TGPT5 TGPT4 TGPT3 TGPT2 TGPT1 TGPT0
7 6 5 4 3 2 1 0
0 0 0 0 0 0 THPM TOVF

TGPT7 to
Transmit history list read pointer
TGPT0
When the CnTGPT register is read, the contents of the element indexed
by the read pointer (TGPT) of the transmit history list are read. These
0 to 31
contents indicate the number of the message buffer to which a data frame
or a remote frame was transmitted last.

THPMa Transmit history pointer match


The transmit history list has at least one message buffer number that has
0
not been read.
The transmit history list has no message buffer numbers that have not
1
been read.
a) The read value of the TGPT0 to TGPT7 bits is invalid when the THPM bit = 1.

TOVFa Transmit history list overflow bit


All the message buffer numbers that have not been read are preserved.
All the numbers of the message buffers to which a new data frame or
0
remote frame has been transmitted are recorded to the transmit history
list (the transmit history list has a vacant element).
At least 7 entries have been stored since the host processor has serviced
the THL last
time (i.e. read CnTGPT). The first 6 entries are sequentially stored while
the last entry
1 can have been overwritten whenever a message is newly transmitted
because all buffer
numbers are stored at position LOPT-1 when TOVF bit is set. Thus the
sequence of
transmissions can not be recovered completely now.
a)
If TOVF is set, THPM is no longer cleared on message transmission, but THPM is
still set, if all entries of CnTGPT are read by software.
www.DataSheet4U.com

Note Transmission from message buffers 0 to 7 is not recorded to the transmit


history list in the normal operation mode with ABT.

User’s Manual U17566EE5V1UM00 777


Chapter 20 CAN Controller (CAN)

(b) CnTGPT write

15 14 13 12 11 10 9 8
0 0 0 0 0 0 0 0
7 6 5 4 3 2 1 0
Clear
0 0 0 0 0 0 0
TOVF

Clear
Setting of TOVF bit
TOVF
0 TOVF bit is not changed.
1 TOVF bit is cleared to 0.

www.DataSheet4U.com

778 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(18) CnTS - CANn module time stamp register


The CnTS register is used to control the time stamp function.
Access This register can be read/written in 16-bit units.
Address <CnRBaseAddr> + 066H
Initial Value 0000H. The register is initialized by any reset.

(a) CnTS read

15 14 13 12 11 10 9 8
0 0 0 0 0 0 0 0
7 6 5 4 3 2 1 0
0 0 0 0 0 TSLOCK TSSEL TSEN

Note The lock function of the time stamp function must not be used when the CAN
module is in the normal operation mode with ABT.

TSLOCK Time stamp lock function enable bit


Time stamp lock function stopped.
0 The TSOUT signal is toggled each time the selected time stamp capture
event occurs.
Time stamp lock function enabled.
The TSOUT signal is toggled each time the selected time stamp capture
1 event occurs.
However, the TSOUT output signal is locked when a data frame has been
correctly received to message buffer 0a.
a)
The TSEN bit is automatically cleared to 0.

TSSEL Time stamp capture event selection bit


0 The time capture event is SOF.
1 The time stamp capture event is the last bit of EOF.

TSEN TSOUT operation setting bit


0 TSOUT toggle operation is disabled.
1 TSOUT toggle operation is enabled.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 779


Chapter 20 CAN Controller (CAN)

(b) CnTS write

15 14 13 12 11 10 9 8
Set Set Set
0 0 0 0 0
TSLOCK TSSEL TSEN
7 6 5 4 3 2 1 0
Clear Clear Clear
0 0 0 0 0
TSLOCK TSSEL TSEN

Set Clear
Setting of TSLOCK bit
TSLOCK TSLOCK
0 1 TSLOCK bit is cleared to 0.
1 0 TSLOCK bit is set to 1.
Other than above TSLOCK bit is not changed.

Set Clear
Setting of TSSEL bit
TSSEL TSSEL
0 1 TSSEL bit is cleared to 0.
1 0 TSSEL bit is set to 1.
Other than above TSSEL bit is not changed.

Set Clear
Setting of TSEN bit
TSEN TSEN
0 1 TSEN bit is cleared to 0.
1 0 TSEN bit is set to 1.
Other than above TSEN bit is not changed.

www.DataSheet4U.com

780 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(19) CnMDATAxm, CnMDATAzm - CANn message data byte register (x = 0 to 7,


z = 01, 23, 45, 67)
The CnMDATAxm, CnMDATAzm registers are used to store the data of a
transmit/receive message.
Access The CnMDATAzm registers can be read/written in 16-bit units.
The CnMDATAxm registers can be read/written in 8-bit units.
Address Refer to “CAN registers overview“ on page 747.
Initial Value Undefined.

CnMDATA01m
15 14 13 12 11 10 9 8
MDATA0115 MDATA0114 MDATA0113 MDATA0112 MDATA0111 MDATA0110 MDATA019 MDATA018
7 6 5 4 3 2 1 0
MDATA017 MDATA016 MDATA015 MDATA014 MDATA013 MDATA012 MDATA011 MDATA010

CnMDATA0m
7 6 5 4 3 2 1 0
MDATA07 MDATA06 MDATA05 MDATA04 MDATA03 MDATA02 MDATA01 MDATA00

CnMDATA1m
7 6 5 4 3 2 1 0
MDATA17 MDATA16 MDATA15 MDATA14 MDATA13 MDATA12 MDATA11 MDATA1

CnMDATA23m
15 14 13 12 11 10 9 8
MDATA2315 MDATA2314 MDATA2313 MDATA2312 MDATA2311 MDATA2310 MDATA239 MDATA238
7 6 5 4 3 2 1 0
MDATA237 MDATA236 MDATA235 MDATA234 MDATA233 MDATA232 MDATA231 MDATA230

CnMDATA2m
7 6 5 4 3 2 1 0
MDATA27 MDATA26 MDATA25 MDATA24 MDATA23 MDATA22 MDATA21 MDATA20

CnMDATA3m
7 6 5 4 3 2 1 0
MDATA37 MDATA36 MDATA35 MDATA34 MDATA33 MDATA32 MDATA31 MDATA30

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 781


Chapter 20 CAN Controller (CAN)

CnMDATA45m
15 14 13 12 11 10 9 8
MDATA4515 MDATA4514 MDATA4513 MDATA4512 MDATA4511 MDATA4510 MDATA459 MDATA458
7 6 5 4 3 2 1 0
MDATA457 MDATA456 MDATA455 MDATA454 MDATA453 MDATA452 MDATA451 MDATA450

CnMDATA4m
7 6 5 4 3 2 1 0
MDATA47 MDATA46 MDATA45 MDATA44 MDATA43 MDATA42 MDATA41 MDATA40

CnMDATA5m
7 6 5 4 3 2 1 0
MDATA57 MDATA56 MDATA55 MDATA54 MDATA53 MDATA52 MDATA51 MDATA50

CnMDATA67m
15 14 13 12 11 10 9 8
MDATA6715 MDATA6714 MDATA6713 MDATA6712 MDATA6711 MDATA6710 MDATA679 MDATA678
7 6 5 4 3 2 1 0
MDATA677 MDATA676 MDATA675 MDATA674 MDATA673 MDATA672 MDATA671 MDATA670

CnMDATA6m
7 6 5 4 3 2 1 0
MDATA67 MDATA66 MDATA65 MDATA64 MDATA63 MDATA62 MDATA61 MDATA60

CnMDATA7m
7 6 5 4 3 2 1 0
MDATA77 MDATA76 MDATA75 MDATA74 MDATA73 MDATA72 MDATA71 MDATA70

www.DataSheet4U.com

782 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(20) CnMDLCm - CANn message data length register m


The CnMDLCm register is used to set the number of bytes of the data field of a
message buffer.
Access This register can be read/written in 8-bit units.
Address Refer to “CAN registers overview“ on page 747.
Initial Value 0000xxxxB. The register is initialized by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 MDLC3 MDLC2 MDLC1 MDLC0

MDLC3 MDLC2 MDLC1 MDLC0 Data length of transmit/receive message


0 0 0 0 0 bytes
0 0 0 1 1 byte
0 0 1 0 2 bytes
0 0 1 1 3 bytes
0 1 0 0 4 bytes
0 1 0 1 5 bytes
0 1 1 0 6 bytes
0 1 1 1 7 bytes
1 0 0 0 8 bytes
1 0 0 1 Setting prohibited
(If these bits are set during transmission, 8-
1 0 1 0
byte data is transmitted regardless of the set
1 0 1 1 DLC value when a data frame is transmitted.
1 1 0 0 However, the DLC actually transmitted to the
CAN bus is the DLC value set to this
1 1 0 1 register.)Note
1 1 1 0
1 1 1 1

Note The data and DLC value actually transmitted to CAN bus are as follows.

Type of transmit
Length of transmit data DLC transmitted
frame
Data frame Number of bytes specified by DLC MDLC3 to MDLC0
(However, 8 bytes if DLC ≥ 8) bits
Remote frame 0 bytes

Caution 1. Be sure to set bits 7 to 4 to 0000B.


2. Receive data is stored in as many CnMDATAxm register as the number of
www.DataSheet4U.com bytes (however, the upper limit is 8) corresponding to DLC of the received
frame. The CnMDATAxm register in which no data is stored is undefined.

User’s Manual U17566EE5V1UM00 783


Chapter 20 CAN Controller (CAN)

(21) CnMCONFm - CANn message configuration register m


The CnMCONFm register is used to specify the type of the message buffer
and to set a mask.
Access This register can be read/written in 8-bit units.
Address Refer to “CAN registers overview“ on page 747.
Initial Value Undefined.

7 6 5 4 3 2 1 0
OWS RTR MT2 MT1 MT0 0 0 MA0

OWS Overwrite control bit


The message buffer that has already received a data framea is not
0 overwritten by a newly received data frame. The newly received data
frame is discarded.
The message buffer that has already received a data framea is
1
overwritten by a newly received data frame.
a) The “message buffer that has already received a data frame” is a receive message
buffer whose the CnMCTRLm.DN bit has been set to 1.

Note A remote frame is received and stored, regardless of the setting of OWS and
DN. A remote frame that satisfies the other conditions (ID matches, RTR = 0,
TRQ = 0) is always received and stored in the corresponding message buffer
(interrupt generated, DN flag set, MDLC[3:0] updated, and recorded to the
receive history list).

RTR Remote frame request bita


0 Transmit a data frame.
1 Transmit a remote frame.
a) The RTR bit specifies the type of message frame that is transmitted from a mes-
sage buffer defined as a transmit message buffer. Even if a valid remote frame has
been received, the RTR bit of the transmit message buffer that has received the
frame remains cleared to 0. Even if a remote frame whose ID matches has been
received from the CAN bus with the RTR bit of the transmit message buffer set to
1 to transmit a remote frame, that remote frame is not received or stored (interrupt
generated, DN flag set, the MDLC0 to MDLC3 bits updated, and recorded to the
receive history list).

MT2 MT1 MT0 Message buffer type setting bit


0 0 0 Transmit message buffer
0 0 1 Receive message buffer (no mask setting)
0 1 0 Receive message buffer (mask 1 set)
0 1 1 Receive message buffer (mask 2 set)
www.DataSheet4U.com 1 0 0 Receive message buffer (mask 3 set)
1 0 1 Receive message buffer (mask 4 set)
Other than above Setting prohibited

784 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

MA0 Message buffer assignment bit


0 Message buffer not used.
1 Message buffer used.

Caution Be sure to write 0 to bits 2 and 1.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 785


Chapter 20 CAN Controller (CAN)

(22) CnMIDLm, CnMIDHm - CANn message ID register m


The CnMIDLm and CnMIDHm registers are used to set an identifier (ID).
Access These registers can be read/written in 16-bit units.
Address Refer to “CAN registers overview“ on page 747.
Initial Value Undefined.

CnMIDLm
15 14 13 12 11 10 9 8
ID15 ID14 ID13 ID12 ID11 ID10 ID9 ID8
7 6 5 4 3 2 1 0
ID7 ID6 ID5 ID4 ID3 ID2 ID1 ID0

CnMIDHm
15 14 13 12 11 10 9 8
IDE 0 0 ID28 ID27 ID26 ID25 ID24
7 6 5 4 3 2 1 0
ID23 ID22 ID21 ID20 ID19 ID18 ID17 ID16

IDE Format mode specification bit


0 Standard format mode (ID28 to ID18: 11 bits)a
1 Extended format mode (ID28 to ID0: 29 bits)
a)
The ID17 to ID0 bits are not used.

ID28 to ID0 Message ID


ID28 to ID18 Standard ID value of 11 bits (when IDE = 0)
ID28 to ID0 Extended ID value of 29 bits (when IDE = 1)

Caution 1. Be sure to write 0 to bits 14 and 13 of the CnMIDHm register.


2. Be sure to align the ID value according to the given bit positions into this
registers. Note that for standard ID, the ID value must be shifted to fit into
ID28 to ID11 bit positions.

www.DataSheet4U.com

786 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

(23) CnMCTRLm - CANn message control register m


The CnMCTRLm register is used to control the operation of the message
buffer.
Access This register can be read/written in 16-bit units.
Address Refer to “CAN registers overview“ on page 747.
Initial Value 00x0 0000 0000 0000B. The register is initialized by any reset.

(a) CnMCTRLm read

15 14 13 12 11 10 9 8
0 0 MUC 0 0 0 0 0
7 6 5 4 3 2 1 0
0 0 0 MOW IE DN TRQ RDY

MUCa Bit indicating that message buffer data is being updated


The CAN module is not updating the message buffer (reception and
0
storage).
The CAN module is updating the message buffer (reception and
1
storage).
a) The MUC bit is undefined until the first reception and storage is performed.

MOWa Message buffer overwrite status bit


0 The message buffer is not overwritten by a newly received data frame.
1 The message buffer is overwritten by a newly received data frame.
a)
The MOW bit is not set to 1 even if a remote frame is received and stored in the
transmit message buffer with the DN bit = 1.

IE Message buffer interrupt request enable bit


Receive message buffer: Valid message reception completion interrupt
disabled.
0
Transmit message buffer: Normal message transmission completion
interrupt disabled.
Receive message buffer: Valid message reception completion interrupt
enabled.
1
Transmit message buffer: Normal message transmission completion
interrupt enabled.

DN Message buffer data update bit


0 A data frame or remote frame is not stored in the message buffer.
1 A data frame or remote frame is stored in the message buffer.
www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 787


Chapter 20 CAN Controller (CAN)

TRQ Message buffer transmission request bit


No message frame transmitting request that is pending or being
0
transmitted is in the message buffer.
The message buffer is holding transmission of a message frame pending
1
or is transmitting a message frame.

RDY Message buffer ready bit


The message buffer can be written by software. The CAN module cannot
0
write to the message buffer.
Writing the message buffer by software is ignored (except a write access
1 to the RDY, TRQ, DN, and MOW bits). The CAN module can write to the
message buffer.

(b) CnMCTRLm write

15 14 13 12 11 10 9 8
Set Set Set
0 0 0 0 0
IE TRQ RDY
7 6 5 4 3 2 1 0
Clear Clear Clear Clear Clear
0 0 0
MOW IE DN TRQ RDY

Clear MOW Setting of MOW bit


0 MOW bit is not changed.
1 MOW bit is cleared to 0.

Set IE Clear IE Setting of IE bit


0 1 IE bit is cleared to 0.
1 0 IE bit is set to 1.
Other than above IE bit is not changed.

Clear DN Setting of DN bit


1 DN bit is cleared to 0.
0 DN bit is not changed.

Set TRQ Clear TRQ Setting of TRQ bit


www.DataSheet4U.com
0 1 TRQ bit is cleared to 0.
1 0 TRQ bit is set to 1.
Other than above TRQ bit is not changed.

788 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

Set RDY Clear RDY Setting of RDY bit


0 1 RDY bit is cleared to 0.
1 0 RDY bit is set to 1.
Other than above RDY bit is not changed.

Caution 1. Set IE bit and RDY bit always separately.


2. Do not set the DN bit to 1 by software. Be sure to write 0 to bit 10.
3. Do not set the TRQ bit and the RDY bit (1) at the same time. Set the RDY bit
(1) before setting the TRQ bit.
4. Do not clear the RDY bit (0) during message transmission. Follow the
transmission abort process about clearing the RDY bit (0) for redefinition of
the message buffer.
5. Clear again when RDY bit is not cleared even if this bit is cleared.
6. Be sure that RDY is cleared before writing to the other message buffer
registers, by checking the status of the RDY bit.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 789


Chapter 20 CAN Controller (CAN)

20.8 CAN Controller Initialization

20.8.1 Initialization of CAN module

Before CAN module operation is enabled, the CAN module system clock
needs to be determined by setting the CCP[3:0] bits of the CnGMCS register
by software. Do not change the setting of the CAN module system clock after
CAN module operation is enabled.
The CAN module is enabled by setting the GOM bit of the CnGMCTRL
register.
For the procedure of initializing the CAN module, refer to “Operation of CAN
Controller“ on page 829.

20.8.2 Initialization of message buffer

After the CAN module is enabled, the message buffers contain undefined
values. A minimum initialization for all the message buffers, even for those not
used in the application, is necessary before switching the CAN module from
the initialization mode to one of the operation modes.
• Clear the RDY, TRQ, and DN bits of all CnMCTRLm registers to 0.
• Clear the MA0 bit of all CnMCONFm registers to 0.

20.8.3 Redefinition of message buffer

Redefining a message buffer means changing the ID and control information of


the message buffer while a message is being received or transmitted, without
affecting other transmission/reception operations.

(1) To redefine message buffer in initialization mode


Place the CAN module in the initialization mode once and then change the ID
and control information of the message buffer in the initialization mode. After
changing the ID and control information, set the CAN module to an operation
mode.

(2) To redefine message buffer during reception


Perform redefinition as shown in Figure 20-38.

(3) To redefine message buffer during transmission


To rewrite the contents of a transmit message buffer to which a transmission
request has been set, perform transmission abort processing (see
“Transmission abort process except for in normal operation mode with
automatic block transmission (ABT)“ on page 808 and “Transmission abort
process except for ABT transmission in normal operation mode with automatic
www.DataSheet4U.com block transmission (ABT)“ on page 808). Confirm that transmission has been
aborted or completed, and then redefine the message buffer. After redefining
the transmit message buffer, set a transmission request using the procedure
described below. When setting a transmission request to a message buffer that
has been redefined without aborting the transmission in progress, however, the
1-bit wait time is not necessary.

790 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

Redefinition completed

Execute No
transmission?

Yes

Wait for 1 bit of CAN data.

Set TRQ bit


Set TRQ bit = 1
Clear TRQ bit = 0

END

Figure 20-26 Setting transmission request (TRQ) to transmit message buffer after
redefinition

Caution 1. When a message is received, reception filtering is performed in accordance


with the ID and mask set to each receive message buffer. If the procedure in
Figure 20-38 on page 832 is not observed, the contents of the message
buffer after it has been redefined may contradict the result of reception
(result of reception filtering). If this happens, check that the ID and IDE
received first and stored in the message buffer following redefinition are
those stored after the message buffer has been redefined. If no ID and IDE
are stored after redefinition, redefine the message buffer again.
2. When a message is transmitted, the transmission priority is checked in
accordance with the ID, IDE, and RTR bits set to each transmit message
buffer to which a transmission request was set. The transmit message buffer
having the highest priority is selected for transmission. If the procedure in
Figure 20-26 on page 791 is not observed, a message with an ID not having
the highest priority may be transmitted after redefinition.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 791


Chapter 20 CAN Controller (CAN)

20.8.4 Transition from initialization mode to operation mode

The CAN module can be switched to the following operation modes.


• Normal operation mode
• Normal operation mode with ABT
• Receive-only mode
• Single-shot mode
• Self-test mode

OPMODE[2:0] = 00H
and CAN bus is busy.
[Receive-only mode]
OPMODE[2:0]=03H
OPMODE[2:0] = 00H
and CAN bus is busy. OPMODE[2:0] = 00H
and CAN bus is busy.
[Normal operation
mode with ABT] OPMODE[2:0] = 03H [Single-shot mode]
OPMODE[2:0]=02H OPMODE[2:0]=04H
OPMODE[2:0] = 00H
and interframe space
OPMODE[2:0] = 00H
and interframe space
OPMODE[2:0] = 04H

OPMODE[2:0] = 00H OPMODE[2:0] = 02H OPMODE[2:0] = 00H


OPMODE[2:0] = 00H
and CAN bus is busy. and interframe space
OPMODE[2:0] = 00H and CAN bus is busy.
[Normal operation and interframe space
INIT mode OPMODE[2:0] = 05H [Self-test mode]
mode]
OPMODE[2:0] = 00H OPMODE[2:0]=05H
OPMODE[2:0]=01H OPMODE[2:0] = 01H OPMODE[2:0] = 00H
and interframe space

GOM = 1
All CAN modules are
in INIT mode and GOM = 0
EFSD = 1
and GOM = 0

CAN module
channel invalid

RESET released

RESET

Figure 20-27 Transition to operation modes

The transition from the initialization mode to an operation mode is controlled by


the bit string OPMODE[2:0] in the CnCTRL register.
Changing from one operation mode into another requires shifting to the
initialization mode in between. Do not change one operation mode to another
directly; otherwise the operation will not be guaranteed.
Requests for transition from an operation mode to the initialization mode are
held pending when the CAN bus is not in the interframe space (i.e., frame
reception or transmission is in progress), and the CAN module enters the
initialization mode at the first bit in the interframe space (the values of the
OPMODE[2:0] bits are changed to 000B). After issuing a request to change the
mode to the initialization mode, read the OPMODE[2:0] bits until their value
becomes 000B to confirm that the module has entered the initialization mode
(see Figure 20-36 on page 830).

www.DataSheet4U.com

792 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

20.8.5 Resetting error counter CnERC of CAN module

If it is necessary to reset the CAN module error counter CnERC and CAN
module information register CnINFO when re-initialization or forced recovery
from the bus-off status is made, set the CCERC bit of the CnCTRL register to 1
in the initialization mode. When this bit is set to 1, the CnERC and CnINFO
registers are cleared to their default values.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 793


Chapter 20 CAN Controller (CAN)

20.9 Message Reception

20.9.1 Message reception

In all the operation modes, the complete message buffer area is analyzed to
find a suitable buffer to store a newly received message. All message buffers
satisfying the following conditions are included in that evaluation (RX-search
process).
• Used as a message buffer
(MA0 bit of CnMCONFm register set to 1.)
• Set as a receive message buffer
(MT[2:0] bits of CnMCONFm register are set to 001B, 010B, 011B, 100B, or
101B.)

• Ready for reception


(RDY bit of CnMCTRLm register is set to 1.)
When two or more message buffers of the CAN module receive a message,
the message is stored according to the priority explained below. The message
is always stored in the message buffer with the highest priority, not in a
message buffer with a low priority. For example, when an unmasked receive
message buffer and a receive message buffer linked to mask 1 have the same
ID, the received message is not stored in the message buffer linked to mask 1,
even if that message buffer has not received a message and a message has
already been received in the unmasked receive message buffer. In other
words, when a condition has been set in two or more message buffers with
different priorities, the message buffer with the highest priority always stores
the message; the message is not stored in message buffers with a lower
priority. This also applies when the message buffer with the highest priority is
unable to store a message (i.e., when DN = 1 indicating that a message has
already been received, but rewriting is disabled because OWS = 0). In this
case, the message is not actually stored in the candidate message buffer with
the highest priority, but neither is it stored in a message buffer with a lower
priority.

Table 20-24 MBRB priorities


Priority Storing condition if same ID is set
1 (high) Unmasked message buffer DN bit = 0
DN bit = 1 and OWS bit = 1
2 Message buffer linked to mask 1 DN bit = 0
DN bit = 1 and OWS bit = 1
3 Message buffer linked to mask 2 DN bit = 0
DN bit = 1 and OWS bit = 1
4 Message buffer linked to mask 3 DN bit = 0
DN bit = 1 and OWS bit = 1
www.DataSheet4U.com 5 (low) Message buffer linked to mask 4 DN bit = 0
DN bit = 1 and OWS bit = 1

794 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

20.9.2 Receive data read

To keep data consistency when reading CAN message buffers, perform the
data reading according to Figure 20-49 on page 843 to Figure 20-52 on
page 847.
During message reception, the CAN module sets DN of the CnMCTRLm
register two times: at the beginning of the storage process of data to the
message buffer, and again at the end of this storage process. During this
storage process, the MUC bit of the CnMCTRLm register of the message
buffer is set. (Refer to Figure 20-28 on page 795.)
The receive history list is also updated just before the storgage process. In
addition, during storage process (MUC = 1), the RDY bit of the CnMCTRL
register of the message buffer is locked to avoid the coincidental data WR by
CPU. Note the storage process may be disturbed (delayed) when the CPU
accesses the message buffer.

Recessive
SOF

RTR
IDE
R0

ID DLC DATA0-DATA7 CRC ACK EOF IFS


CAN std ID format
Dominant
(1) (11) (1) (1) (1) (4) (0-64) (16) (2) (7)

Message Store
MDATA,MDLC.MIDx- > MBUF

DN

MUC

CINTS1

INTREC1

Operation of the CAN contoroller Set DN & MUC Set DN & clear MUC
at the same time at the same timing

Figure 20-28 DN and MUC bit setting period (for standard ID format)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 795


Chapter 20 CAN Controller (CAN)

20.9.3 Receive history list function

The receive history list (RHL) function records in the receive history list the
number of the receive message buffer in which each data frame or remote
frame was received and stored. The RHL consists of storage elements
equivalent to up to 23 messages, the last in-message pointer (LIPT) with the
corresponding CnLIPT register and the receive history list get pointer (RGPT)
with the corresponding CnRGPT register.
The RHL is undefined immediately after the transition of the CAN module from
the initialization mode to one of the operation modes.
The CnLIPT register holds the contents of the RHL element indicated by the
value of the LIPT pointer minus 1. By reading the CnLIPT register, therefore,
the number of the message buffer that received and stored a data frame or
remote frame first can be checked. The LIPT pointer is utilized as a write
pointer that indicates to what part of the RHL a message buffer number is
recorded. Any time a data frame or remote frame is received and stored, the
corresponding message buffer number is recorded to the RHL element
indicated by the LIPT pointer. Each time recording to the RHL has been
completed, the LIPT pointer is automatically incremented. In this way, the
number of the message buffer that has received and stored a frame will be
recorded chronologically.
The RGPT pointer is utilized as a read pointer that reads a recorded message
buffer number from the RHL. This pointer indicates the first RHL element that
the CPU has not read yet. By reading the CnRGPT register by software, the
number of a message buffer that has received and stored a data frame or
remote frame can be read. Each time a message buffer number is read from
the CnRGPT register, the RGPT pointer is automatically incremented.
If the value of the RGPT pointer matches the value of the LIPT pointer, the
RHPM bit (receive history list pointer match) of the CnRGPT register is set to
1. This indicates that no message buffer number that has not been read
remains in the RHL. If a new message buffer number is recorded, the LIPT
pointer is incremented and because its value no longer matches the value of
the RGPT pointer, the RHPM bit is cleared. In other words, the numbers of the
unread message buffers exist in the RHL.
If the LIPT pointer is incremented and matches the value of the RGPT pointer
minus 1, the ROVF bit (receive history list overflow) of the CnRGPT register is
set to 1. This indicates that the RHL is full of numbers of message buffers that
have not been read. When further message reception and storing occur, the
last recorded message buffer number is overwritten by the number of the
message buffer that received and stored the newly received message. In this
case, after the ROVF bit has been set (1), the recorded message buffer
numbers in the RHL do not completely reflect the chronological order. However
messages itself are not lost and can be located by CPU search in message
buffer memory with the help of the DN-bit.

Caution If the history list is in the overflow condition (ROVF is set), reading the history
list contents is still possible, until the history list is empty (indicated by RHPM
www.DataSheet4U.com flag set). Nevertheless, the history list remains in the overflow condition, until
ROVF is cleared by software. If ROVF is not cleared, the RHPM flag will also
not be updated (cleared) upon a message storage of newly received frame.
This may lead to the situation, that RHPM indicates an empty history list,
although a reception has taken place, while the history list is in the overflow
state (ROVF and RHPM are set).

796 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

As long as the RHL contains 23 or less entries the sequence of occurrence is


maintained. If more receptions occur without reading the RHL by the host
processor, complete sequence of receptions can not be recovered.

Figure 20-29 Receive history list

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 797


Chapter 20 CAN Controller (CAN)

20.9.4 Mask function

For any message buffer, which is used for reception, the assignment to one of
four global reception masks (or no mask) can be selected.
By using the mask function, the message ID comparison can be reduced by
masked bits, herewith allowing the reception of several different IDs into one
buffer.
While the mask function is in effect, an identifier bit that is defined to be 1 by a
mask in the received message is not compared with the corresponding
identifier bit in the message buffer.
However, this comparison is performed for any bit whose value is defined as 0
by the mask.
For example, let us assume that all messages that have a standard-format ID,
in which bits ID27 to ID25 are 0 and bits ID24 and ID22 are 1, are to be stored
in message buffer 14. The procedure for this example is shown below.
1. Identifier to be stored in message buffer
ID28 ID27 ID26 ID25 ID24 ID23 ID22 ID21 ID20 ID19 ID18
x 0 0 0 1 x 1 x x x x

2. Identifier to be configured in message buffer 14 (example)


(Using CnMIDL14 and CnMIDH14 registers)
ID28 ID27 ID26 ID25 ID24 ID23 ID22 ID21 ID20 ID19 ID18
x 0 0 0 1 x 1 x x x x
ID17 ID16 ID15 ID14 ID13 ID12 ID11 ID10 ID9 ID8 ID7
x x x x x x x x x x x
ID6 ID5 ID4 ID3 ID2 ID1 ID0
x x x x x x x

Note 1. ID with the ID27 to ID25 bits cleared to 0 and the ID24 and ID22 bits set to
1 is registered (initialized) to message buffer 14.
2. Message buffer 14 is set as a standard format identifier that is linked to
mask 1 (MT[2:0] of CnMCONF14 register are set to 010B).

Mask setting for CAN module 1 (mask 1) (example)


(Using CAN1 address mask 1 registers L and H (C1MASKL1 and C1MASKH1))

CMID28 CMID27 CMID26 CMID25 CMID24 CMID23 CMID22 CMID21 CMID20 CMID19 CMID18
1 0 0 0 0 1 0 1 1 1 1
CMID17 CMID16 CMID15 CMID14 CMID13 CMID12 CMID11 CMID10 CMID9 CMID8 CMID7
1 1 1 1 1 1 1 1 1 1 1
CMID6 CMID5 CMID4 CMID3 CMID2 CMID1 CMID0
w w w . D a t a S h e e t 4 U . c o m
1 1 1 1 1 1 1

1: Not compared (masked)


0: Compared

798 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

The CMID27 to CMID24 and CMID22 bits are cleared to 0, and the CMID28,
CMID23, and CMID21 to CMID0 bits are set to 1.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 799


Chapter 20 CAN Controller (CAN)

20.9.5 Multi buffer receive block function

The multi buffer receive block (MBRB) function is used to store a block of data
in two or more message buffers sequentially with no CPU interaction, by
setting the same ID to two or more message buffers with the same message
buffer type. These message buffers can be allocated anywhere in the message
buffer memory, they do not even have to follow each other adjacently.
Suppose, for example, the same message buffer type is set to 10 message
buffers, message buffers 10 to 19, and the same ID is set to each message
buffer. If the first message whose ID matches an ID of the message buffers is
received, it is stored in message buffer 10. At this point, the DN bit of message
buffer 10 is set, prohibiting overwriting the message buffer when subsequent
messages are received.
When the next message with a matching ID is received, it is received and
stored in message buffer 11. Each time a message with a matching ID is
received, it is sequentially (in the ascending order) stored in message buffers
12, 13, and so on. Even when a data block consisting of multiple messages is
received, the messages can be stored and received without overwriting the
previously received matching-ID data.
Whether a data block has been received and stored can be checked by setting
the IE bit of the CnMCTRLm register of each message buffer. For example, if a
data block consists of k messages, k message buffers are initialized for
reception of the data block. The IE bit in message buffers 0 to (k-2) is cleared
to 0 (interrupts disabled), and the IE bit in message buffer k-1 is set to 1
(interrupts enabled). In this case, a reception completion interrupt occurs when
a message has been received and stored in message buffer k-1, indicating that
MBRB has become full. Alternatively, by clearing the IE bit of message buffers
0 to (k-3) and setting the IE bit of message buffer k-2, a warning that MBRB is
about to overflow can be issued.
The basic conditions of storing receive data in each message buffer for the
MBRB are the same as the conditions of storing data in a single message
buffer.

Caution 1. MBRB can be configured for each of the same message buffer types.
Therefore, even if a message buffer of another MBRB whose ID matches but
whose message buffer type is different has a vacancy, the received
message is not stored in that message buffer, but instead discarded.
2. MBRB does not have a ring buffer structure. Therefore, after a message is
stored in the message buffer having the highest number in the MBRB
configuration, a newly received message will not be stored in the message
buffer having the lowest message buffer number.
3. MBRB operates based on the reception and storage conditions; there are
no settings dedicated to MBRB, such as function enable bits. By setting the
same message buffer type and ID to two or more message buffers, MBRB is
automatically configured.
4. With MBRB, “matching ID” means “matching ID after mask”. Even if the ID
www.DataSheet4U.com set to each message buffer is not the same, if the ID that is masked by the
mask register matches, it is considered a matching ID and the buffer that
has this ID is treated as the storage destination of a message.
5. The priority between MBRBs is mentioned in the table Table 20-24.

800 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

20.9.6 Remote frame reception

In all the operation modes, when a remote frame is received, the message
buffer that is to store the remote frame is searched from all the message
buffers satisfying the following conditions.
• Used as a message buffer
(MA0 bit of CnMCONFm register set to 1.)
• Set as a transmit message buffer
(MT[2:0] bits in CnMCONFm register set to 000B)
• Ready for reception
(RDY bit of CnMCTRLm register set to 1.)
• Set to transmit message
(RTR bit of CnMCONFm register is cleared to 0.)
• Transmission request is not set.
(TRQ bit of CnMCTRLm register is cleared to 0.)
Upon acceptance of a remote frame, the following actions are executed if the
ID of the received remote frame matches the ID of a message buffer that
satisfies the above conditions.
• The DLC[3:0] bit string in the CnMDLCm register store the received DLC
value.
• The CnMDATA0m to CnMDATA7m registers in the data area are not
updated (data before reception is saved).
• The DN bit of the CnMCTRLm register is set to 1.
• The CINTS1 bit of the CnINTS register is set to 1 (if the IE bit in the
CnMCTRLm register of the message buffer that receives and stores the
frame is set to 1).
• The receive completion interrupt (INTCnREC) is output (if the IE bit of the
message buffer that receives and stores the frame is set to 1 and if the CIE1
bit of the CnIE register is set to 1).
• The message buffer number is recorded in the receive history list.

Caution When a message buffer is searched for receiving and storing a remote frame,
overwrite control by the OWS bit of the CnMCONFm register of the message
buffer and the DN bit of the CnMCTRLm register are not checked. The setting
of OWS is ignored, and DN is set in any case.
If more than one transmit message buffer has the same ID and the ID of the
received remote frame matches that ID, the remote frame is stored in the
transmit message buffer with the lowest message buffer number.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 801


Chapter 20 CAN Controller (CAN)

20.10 Message Transmission

20.10.1 Message transmission

A message buffer with its TRQ bit set to 1 participates in the search for the
most high-prioritized message when the following conditions are fulfilled. This
behavior is valid for all operational modes.
• Used as a message buffer
(MA0 bit of CnMCONFm register set to 1.)
• Set as a transmit message buffer
(MT[2:0] bits of CnMCONFm register set to 000B.)
• Ready for transmission
(RDY bit of CnMCTRLm register set to 1.)
The CAN system is a multi-master communication system. In a system like
this, the priority of message transmission is determined based on message
identifiers (IDs). To facilitate transmission processing by software when there
are several messages awaiting transmission, the CAN module uses hardware
to check the ID of the message with the highest priority and automatically
identifies that message. This eliminates the need for software-based priority
control.
Transmission priority is controlled by the identifier (ID).

Message No. Message waiting to be transmitted


0
1 ID = 120H
2 ID = 229H
3 The CAN module transmits messages in the following sequence.
1. Message 6
4 2. Message 1
5 ID = 223H 3. Message 8
4. Message 5
6 ID = 023H 5. Message 2
7
8 ID = 123H
9

Figure 20-30 Message processing example

After the transmit message search, the transmit message with the highest
priority of the transmit message buffers that have a pending transmission
request (message buffers with the TRQ bit set to 1 in advance) is transmitted.
If a new transmission request is set, the transmit message buffer with the new
transmission request is compared with the transmit message buffer with a
pending transmission request. If the new transmission request has a higher
priority, it is transmitted, unless transmission of a message with a low priority
has already started. If transmission of a message with a low priority has
www.DataSheet4U.com already started, however, the new transmission request is transmitted later. To
solve this priority inversion effect, the software can perform a transmission
abort request for the lower priority message. The highest priority is determined
according to the following rules.

802 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

Priority Conditions Description


1 (high) Value of first 11 bits of ID The message frame with the lowest value represented by the first 11
[ID28 to ID18]: bits of the ID is transmitted first. If the value of an 11-bit standard ID is
equal to or smaller than the first 11 bits of a 29-bit extended ID, the 11-
bit standard ID has a higher priority than a message frame with a 29-bit
extended ID.
2 Frame type A data frame with an 11-bit standard ID (RTR bit is cleared to 0) has a
higher priority than a remote frame with a standard ID and a message
frame with an extended ID.
3 ID type A message frame with a standard ID (IDE bit is cleared to 0) has a
higher priority than a message frame with an extended ID.
4 Value of lower 18 bits of ID If one or more transmission-pending extended ID message frame has
[ID17 to ID0]: equal values in the first 11 bits of the ID and the same frame type (equal
RTR bit values), the message frame with the lowest value in the lower
18 bits of its extended ID is transmitted first.
5 (low) Message buffer number If two or more message buffers request transmission of message
frames with the same ID, the message from the message buffer with the
lowest message buffer number is transmitted first.

Note 1. If the automatic block transmission request bit ABTTRG is set to 1 in the
normal operation mode with ABT, the TRQ bit is set to 1 only for one
message buffer in the ABT message buffer group.

If the ABT mode was triggered by ABTTRG bit (1), one TRQ bit is set to 1
in the ABT area (buffer 0 through 7). Beyond this TRQ bit, the application
can request transmissions (set TRQ bit to 1) for other TX-message buffers
that do not belong to the ABT area. In that case an interval arbitration
process (TX-search) evaluates all TX-message buffers with TRQ bit set to
1 and chooses the message buffer that contains the highest prioritized
identifier for the next transmission. If there are 2 or more identifiers that
have the highest priority (i.e. identical identifiers), the message located at
the lowest message buffer number is transmitted at first.

Upon successful transmission of a message frame, the following


operations are performed.
• The TRQ flag of the corresponding transmit message buffer is
automatically cleared to 0.
• The transmission completion status bit CINTS0 of the CnINTS register
is set to 1 (if the interrupt enable bit (IE) of the corresponding transmit
message buffer is set to 1).
• An interrupt request signal INTCnTRX is output (if the CIE0 bit of the
CnIE register is set to 1 and if the interrupt enable bit (IE) of the
corresponding transmit message buffer is set to 1).
2. When changing the contents of a transmit buffer, the RDY flag of this buffer
must be cleared before updating the buffer contents. As during internal
transfer actions, the RDY flag may be locked temporarily, the status of RDY
must be checked by software, after changing it.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 803


Chapter 20 CAN Controller (CAN)

20.10.2 Transmit history list function

The transmit history list (THL) function records in the transmit history list the
number of the transmit message buffer from which data or remote frames have
been were sent. The THL consists of storage elements equivalent to up to
seven messages, the last out-message pointer (LOPT) with the corresponding
CnLOPT register, and the transmit history list get pointer (TGPT) with the
corresponding CnTGPT register.
The THL is undefined immediately after the transition of the CAN module from
the initialization mode to one of the operation modes.
The CnLOPT register holds the contents of the THL element indicated by the
value of the LOPT pointer minus 1. By reading the CnLOPT register, therefore,
the number of the message buffer that transmitted a data frame or remote
frame first can be checked. The LOPT pointer is utilized as a write pointer that
indicates to what part of the THL a message buffer number is recorded. Any
time a data frame or remote frame is transmitted, the corresponding message
buffer number is recorded to the THL element indicated by the LOPT pointer.
Each time recording to the THL has been completed, the LOPT pointer is
automatically incremented. In this way, the number of the message buffer that
has received and stored a frame will be recorded chronologically.
The TGPT pointer is utilized as a read pointer that reads a recorded message
buffer number from the THL. This pointer indicates the first THL element that
the CPU has not yet read. By reading the CnTGPT register by software, the
number of a message buffer that has completed transmission can be read.
Each time a message buffer number is read from the CnTGPT register, the
TGPT pointer is automatically incremented.
If the value of the TGPT pointer matches the value of the LOPT pointer, the
THPM bit (transmit history list pointer match) of the CnTGPT register is set to
1. This indicates that no message buffer numbers that have not been read
remain in the THL. If a new message buffer number is recorded, the LOPT
pointer is incremented and because its value no longer matches the value of
the TGPT pointer, the THPM bit is cleared. In other words, the numbers of the
unread message buffers exist in the THL.
If the LOPT pointer is incremented and matches the value of the TGPT pointer
minus 1, the TOVF bit (transmit history list overflow) of the CnTGPT register is
set to 1. This indicates that the THL is full of message buffer numbers that
have not been read. If a new message is received and stored, the message
buffer number recorded last is overwritten by the message buffer number that
transmitted its message afterwards. In this case, after the TOVF bit has been
set (1), therefore, the recorded message buffer numbers in the THL do not
completely reflect the chronological order. However the other transmitted
messages can be found by a CPU search applied to all transmit message
buffers unless the CPU has not overwritten a transmit object in one of these
buffers beforehand. In total up to six transmission completions can occur
without overflowing the THL.

www.DataSheet4U.com

804 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

Caution If the history list is in the overflow condition (TOVF is set), reading the history
list contents is still possible, until the history list is empty (indicated by THPM
flag set). Nevertheless, the history list remains in the overflow condition, until
TOVF is cleared by software. If TOVF is not cleared, the THPM flag will also
not be updated (cleared) upon successful transmission of a new message.
This may lead to the situation, that THPM indicates an empty history list,
although a successful transmission has taken place, while the history list is in
the overflow state (TOVF and THPM are set).

Transmit history list (THL) Transmit history list (THL)


7 7
6 Event: 6
5 5 Message buffer 4
- CPU confirms Tx completion
4 of message buffer 6, 9, and 2. 4 Message buffer 3
Last out- 3 Message buffer 7 - Tx completion of message Last out- 3 Message buffer 7
message 2 Message buffer 2 buffer 3, and 4. message 2 Transmit
pointer Message buffer 9 pointer history list
(LOPT) 1 (LOPT) 1
Message buffer 6 get
0 0 pointer
Transmit (TGPT)
history list
get pointer
(TGPT)
Event:
- Message buffer 8, 5, 6, and 10 completes transmission.
- THL is full.
- TOVF is set.

Transmit history list (THL) Transmit history list (THL)


7 Message buffer 5 7 Message buffer 5
Message buffer 8 Event: Message buffer 8
6 6
5 Message buffer 4 - Message buffer11, 13, and 14 5 Message buffer 4
4 Message buffer 3 completes transmission. 4 Message buffer 3
Message buffer 7 - Overflow situation occurs. Message buffer 7
3 3
2 Transmit 2 Transmit
Last out- 1 Message buffer 10 history list Last out- 1 Message buffer 14 history list
message Message buffer 6 get pointer message Message buffer 6 get
0 (TGPT) 0 pointer
pointer pointer
(LOPT) (LOPT) (TGPT)
TOVF = 1 TOVF = 1
LOPT is blocked LOPT is blocked

TOVF = 1 denotes that LOPT equals TGPT - 1 while message buffer number stored to element indicated by LOPT - 1.

Figure 20-31 Transmit history list

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 805


Chapter 20 CAN Controller (CAN)

20.10.3 Automatic block transmission (ABT)

The automatic block transmission (ABT) function is used to transmit two or


more data frames successively with no CPU interaction. The maximum
number of transmit message buffers assigned to the ABT function is eight
(message buffer numbers 0 to 7).
By setting the OPMODE[2:0] bits of the CnCTRL register to 010B, “normal
operation mode with automatic block transmission function” (hereafter referred
to as ABT mode) can be selected.
To issue an ABT transmission request, define the message buffers by software
first. Set the MA0 bit (1) in all the message buffers used for ABT, and define all
the buffers as transmit message buffers by setting the MA[2:0] bits to 000B. Be
sure to set the same ID for the message buffers for ABT even when that ID is
being used for all the message buffers. To use two or more IDs, set the ID of
each message buffer by using the CnMIDLm and CnMIDHm registers. Set the
CnMDLCm and CnMDATA0m to CnMDATA7m registers before issuing a
transmission request for the ABT function.
After initialization of message buffers for ABT is finished, the RDY bit needs to
be set (1). In the ABT mode, the TRQ bit does not have to be manipulated by
software.
After the data for the ABT message buffers has been prepared, set the
ABTTRG bit to 1. Automatic block transmission is then started. When ABT is
started, the TRQ bit in the first message buffer (message buffer 0) is
automatically set to 1. After transmission of the data of message buffer 0 is
finished, the TRQ bit of the next message buffer, message buffer 1, is set
automatically. In this way, transmission is executed successively.
A delay time can be inserted by program in the interval in which the
transmission request (TRQ ) is automatically set while successive
transmission is being executed. The delay time to be inserted is defined by the
CnGMABTD register. The unit of the delay time is DBT (data bit time). DBT
depends on the setting of the CnBRP and CnBTR registers.
Among transmit objects within the ABT-area, the priority of the transmission ID
is not evaluated. The data of message buffers 0 to 7 are sequentially
transmitted. When transmission of the data frame from message buffer 7 has
been completed, the ABTTRG bit is automatically cleared to 0 and the ABT
operation is finished.
If the RDY bit of an ABT message buffer is cleared during ABT, no data frame
is transmitted from that buffer, ABT is stopped, and the ABTTRG bit is cleared.
After that, transmission can be resumed from the message buffer where ABT
stopped, by setting the RDY and ABTTRG bits to 1 by software. To not resume
transmission from the message buffer where ABT stopped, the internal ABT
engine can be reset by setting the ABTCLR bit to 1 while ABT mode is stopped
and the ABTTRG bit is cleared to 0. In this case, transmission is started from
message buffer 0 if the ABTCLR bit is cleared to 0 and then the ABTTRG bit is
set to 1.
An interrupt can be used to check if data frames have been transmitted from all
the message buffers for ABT. To do so, the IE bit of the CnMCTRLm register of
www.DataSheet4U.com
each message buffer except the last message buffer needs to be cleared (0).
If a transmit message buffer other than those used by the ABT function
(message buffers 8 to 31) is assigned to a transmit message buffer, the
message to be transmitted next is determined by the priority of the
transmission ID of the ABT message buffer whose transmission is currently

806 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

held pending and the transmission ID of the message buffers other than those
used by the ABT function.
Transmission of a data frame from an ABT message buffer is not recorded in
the transmit history list (THL).

Caution 1. Set the ABTCLR bit to 1 while the ABTTRG bit is cleared to 0 in order to
resume ABT operation at buffer No.0. If the ABTCLR bit is set to 1 while the
ABTTRG bit is set to 1, the subsequent operation is not guaranteed.
2. If the automatic block transmission engine is cleared by setting the ABTCLR
bit to 1, the ABTCLR bit is automatically cleared immediately after the
processing of the clearing request is completed.
3. Do not set the ABTTRG bit in the initialization mode. If the ABTTRG bit is
set in the initialization mode, the proper operation is not guaranteed after the
mode is changed from the initialization mode to the ABT mode.
4. Do not set the TRQ bit of the ABT message buffers to 1 by software in the
normal operation mode with ABT. Otherwise, the operation is not
guaranteed.
5. The CnGMABTD register is used to set the delay time that is inserted in the
period from completion of the preceding ABT message to setting of the TRQ
bit for the next ABT message when the transmission requests are set in the
order of message numbers for each message for ABT that is successively
transmitted in the ABT mode. The timing at which the messages are actually
transmitted onto the CAN bus varies depending on the status of
transmission from other stations and the status of the setting of the
transmission request for messages other than the ABT messages (message
buffers 8 to 31).
6. If a transmission request is made for a message other than an ABT
message and if no delay time is inserted in the interval in which
transmission requests for ABT are automatically set (CnGMABTD register =
00H), messages other than ABT messages may be transmitted not
depending on their priority compared to the priority of the ABT message.
7. Do not clear the RDY bit to 0 when the ABTTRG bit = 1.
8. If a message is received from another node while normal operation mode
with ABT is active, the TX-message from the ABT-area may be transmitted
with delay of one frame although CnGMABTD register was set up with 00H.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 807


Chapter 20 CAN Controller (CAN)

20.10.4 Transmission abort process

(1) Transmission abort process except for in normal operation mode with
automatic block transmission (ABT)
The user can clear the TRQ bit of the CnMCTRLm register to 0 to abort a
transmission request. The TRQ bit will be cleared immediately if the abort was
successful. Whether the transmission was successfully aborted or not can be
checked using the TSTAT bit of the CnCTRL register and the CnTGPT register,
which indicate the transmission status on the CAN bus (for details, refer to the
processing in Figure 20-45 on page 839).

(2) Transmission abort process except for ABT transmission in normal


operation mode with automatic block transmission (ABT)
The user can clear the ABTTRG bit of the CnGMABT register to 0 to abort a
transmission request. After checking the ABTTRG bit of the CnGMABT
register = 0, clear the TRQ bit of the CnMCTRLm register to 0. The TRQ bit will
be cleared immediately if the abort was successful. Whether the transmission
was successfully aborted or not can be checked using the TSTAT bit of the
CnCTRL register and the CnTGPT register, which indicate the transmission
status on the CAN bus (for details, refer to the processing in Figure 20-46 on
page 840).

(3) Transmission abort process for ABT transmission in normal operation


mode with automatic block transmission (ABT)
To abort ABT that is already started, clear the ABTTRG bit of the CnGMABT
register to 0. In this case, the ABTTRG bit remains 1 if an ABT message is
currently being transmitted and until the transmission is completed
(successfully or not), and is cleared to 0 as soon as transmission is finished.
This aborts ABT.
If the last transmission (before ABT) was successful, the normal operation
mode with ABT is left with the internal ABT pointer pointing to the next
message buffer to be transmitted.
In the case of an erroneous transmission, the position of the internal ABT
pointer depends on the status of the TRQ bit in the last transmitted message
buffer. If the TRQ bit is set to 1 when clearing the ABTTRG bit is requested, the
internal ABT pointer points to the last transmitted message buffer (for details,
refer to the process in Figure 20-47 on page 841). If the TRQ bit is cleared to 0
when clearing the ABTTRG bit is requested, the internal ABT pointer is
incremented (+1) and points to the next message buffer in the ABT area (for
details, refer to the process in Figure 20-48 on page 842).

Caution Be sure to abort ABT by clearing ABTTRG bit to 0. The operation is not
guaranteed if aborting transmission is requested by clearing RDY.

www.DataSheet4U.com

808 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

When the normal operation mode with ABT is resumed after ABT has been
aborted and the ABTTRG bit is set to 1, the next ABT message buffer to be
transmitted can be determined from the following table.

Status of TRQ of
Abort after successful transmission Abort after erroneous transmission
ABT message buffer
Set (1) Next message buffer in the ABT areaa Same message buffer in the ABT area
a
Cleared (0) Next message buffer in the ABT area Next message buffer in the ABT areaa
a)
The above resumption operation can be performed only if a message buffer ready for ABT exists in the ABT
area. For example, an abort request that is issued while ABT of message buffer 7 is in progress is regarded
as completion of ABT, rather than abort, if transmission of message buffer 7 has been successfully completed,
even if the ABTTRG bit is cleared to 0. If the RDY bit in the next message buffer in the ABT area is cleared to
0, the internal ABT pointer is retained, but the resumption operation is not performed even if the ABTTRG bit
is set to 1, and ABT ends immediately.

20.10.5 Remote frame transmission

Remote frames can be transmitted only from transmit message buffers. Set
whether a data frame or remote frame is transmitted via the RTR bit of the
CnMCONFm register. Setting (1) the RTR bit sets remote frame transmission.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 809


Chapter 20 CAN Controller (CAN)

20.11 Power Saving Modes

20.11.1 CAN sleep mode

The CAN sleep mode can be used to set the CAN Controller to stand-by mode
in order to reduce power consumption. The CAN module can enter the CAN
sleep mode from all operation modes. Release of the CAN sleep mode returns
the CAN module to exactly the same operation mode from which the CAN
sleep mode was entered.
In the CAN sleep mode, the CAN module does not transmit messages, even
when transmission requests are issued or pending.

(1) Entering CAN sleep mode


The CPU issues a CAN sleep mode transition request by writing 01B to the
PSMODE[1:0] bits of the CnCTRL register.
This transition request is only acknowledged only under the following
conditions.
3. The CAN module is already in one of the following operation modes
– Normal operation mode
– Normal operation mode with ABT
– Receive-only mode
– Single-shot mode
– Self-test mode
– CAN stop mode in all the above operation modes
4. The CAN bus state is bus idle (the 4th bit in the interframe space is reces-
sive).
If the CAN bus is fixed to dominant, the request for transition to the CAN
sleep mode is held pending.Also the transition from CAN stop mode to
CAN sleep mode is independent of the CAN bus state.
5. No transmission request is pending

Note If a sleep mode request is pending, and at the same time a message is
received in a message box, the sleep mode request is not cancelled, but is
executed right after message storage has been finished. This may result in
AFCAN being in sleep mode, while the CPU would execute the RX interrupt
routine. Therefore, the interrupt routine must check the access to the message
buffers as well as reception history list registers by using the MBON flag, if
sleep mode is used.
If any one of the conditions mentioned above is not met, the CAN module will
operate as follows.
• If the CAN sleep mode is requested from the initialization mode, the CAN
sleep mode transition request is ignored and the CAN module remains in
the initialization mode.

www.DataSheet4U.com • If the CAN bus state is not bus idle (i.e., the CAN bus state is either
transmitting or receiving) when the CAN sleep mode is requested in one of
the operation modes, immediate transition to the CAN sleep mode is not
possible. In this case, the CAN sleep mode transition request has to be held
pending until the CAN bus state becomes bus idle (the 4th bit in the
interframe space is recessive). In the time from the CAN sleep mode
request to successful transition, the PSMODE[1:0] bits remain 00B. When

810 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

the module has entered the CAN sleep mode, the PSMODE[1:0] bits are set
to 01B.

• If a request for transition to the initialization mode and a request for


transition to the CAN sleep mode are made at the same time while the CAN
module is in one of the operation modes, the request for the initialization
mode is enabled. The CAN module enters the initialization mode at a
predetermined timing. At this time, the CAN sleep mode request is not held
pending and is ignored.
• Even when initialization mode and sleep mode are not requested
simultaneously (i.e the first request has not been granted while the second
request is made), the request for initialization has priority over the sleep
mode request. The sleep mode request is cancelled when the initialization
mode is requested. When a pending request for initialization mode is
present, a subsequent request for Sleep mode request is cancelled right at
the point in time where it was submitted.

(2) Status in CAN sleep mode


The CAN module is in the following state after it enters the CAN sleep mode:
• The internal operating clock is stopped and the power consumption is
minimized.
• The function to detect the falling edge of the CAN reception pin (CRXDn)
remains in effect to wake up the CAN module from the CAN bus.
• To wake up the CAN module from the CPU, data can be written to the
PSMODE[1:0] bits of the CAN module control register (CnCTRL), but
nothing can be written to other CAN module registers or bits.
• The CAN module registers can be read, except for the CnLIPT, CnRGPT,
CnLOPT, and CnTGPT registers.
• The CAN message buffer registers cannot be written or read.
• MBON bit of the CAN Global Control register (CnGMCTRL) is cleared.
• A request for transition to the initialization mode is not acknowledged and is
ignored.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 811


Chapter 20 CAN Controller (CAN)

(3) Releasing CAN sleep mode


The CAN sleep mode is released by the following events:
• When the CPU writes 00B to the PSMODE[1:0] bits of the CnCTRL register
• A falling edge at the CAN reception pin (CRXDn) (i.e. the CAN bus level
shifts from recessive to dominant)

Caution Even if the falling edge belongs to the SOF of a receive message, this
message will not be received and stored. If the CPU has turned off the clock
supply to the CAN module while the CAN module was in sleep mode, even
subsequently the CAN sleep mode will not be released and PSMODE [1:0] will
remain 01B unless the clock to the CAN module is supplied again. In addition
to this, the receive message will not be received after that.

After releasing the sleep mode, the CAN module returns to the operation mode
from which the CAN sleep mode was requested and the PSMODE[1:0] bits of
the CnCTRL register must be reset by software to 00B. If the CAN sleep mode
is released by a change in the CAN bus state, the CINTS5 bit of the CnINTS
register is set to 1, regardless of the CIE bit of the CnIE register. After the CAN
module is released from the CAN sleep mode, it participates in the CAN bus
again by automatically detecting 11 consecutive recessive-level bits on the
CAN bus. The user application has to wait until MBON = 1, before accessing
message buffers again.
When a request for transition to the initialization mode is made while the CAN
module is in the CAN sleep mode, that request is ignored; the CAN module
has to be released from sleep mode by software first before entering the
initialization mode.

Caution 1. Be aware that the release of CAN sleep mode by CAN bus event, and thus
the wake up interrupt may happen at any time, even right after requesting
sleep mode, if a CAN bus event occurs.
2. Always reset the PSMODE[1:0] bits to 00B, when waking up from CAN sleep
mode, before accessing any other registers of the CAN module.
3. Always clear the interrupt flag CINTS5, when waking up from CAN sleep
mode.

www.DataSheet4U.com

812 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

20.11.2 CAN stop mode

The CAN stop mode can be used to set the CAN Controller to stand-by mode
to reduce power consumption. The CAN module can enter the CAN stop mode
only from the CAN sleep mode. Release of the CAN stop mode puts the CAN
module in the CAN sleep mode.
The CAN stop mode can only be released (entering CAN sleep mode) by
writing 01B to the PSMODE[1:0] bits of the CnCTRL register and not by a
change in the CAN bus state. No message is transmitted even when
transmission requests are issued or pending.

(1) Entering CAN stop mode


A CAN stop mode transition request is issued by writing 11B to the
PSMODE[1:0] bits of the CnCTRL register.
A CAN stop mode request is only acknowledged when the CAN module is in
the CAN sleep mode. In all other modes, the request is ignored.

Caution To set the CAN module to the CAN stop mode, the module must be in the CAN
sleep mode. To confirm that the module is in the sleep mode, check that the
PSMODE[1:0] bits = 01B, and then request the CAN stop mode. If a bus
change occurs at the CAN reception pin (CRXDn) while this process is being
performed, the CAN sleep mode is automatically released. In this case, the
CAN stop mode transition request cannot be acknowledged.

(2) Status in CAN stop mode


The CAN module is in the following state after it enters the CAN stop mode.
• The internal operating clock is stopped and the power consumption is
minimized.
• To wake up the CAN module from the CPU, data can be written to the
PSMODE[1:0] bits of the CAN module control register (CnCTRL), but
nothing can be written to other CAN module registers or bits.
• The CAN module registers can be read, except for the CnLIPT, CnRGPT,
CnLOPT, and CnTGPT registers.
• The CAN message buffer registers cannot be written or read.
• MBON bit of the CAN Global Control register (CnGMCTRL) is cleared.
• An initialization mode transition request is not acknowledged and is ignored.

(3) Releasing CAN stop mode


The CAN stop mode can only be released by writing 01B to the PSMODE[1:0]
bits of the CnCTRL register. After releasing the CAN stop mode, the CAN
module enters the CAN sleep mode.
When the initialization mode is requested while the CAN module is in the CAN
www.DataSheet4U.com stop mode, that request is ignored; the CPU has to release the stop mode and
subsequently CAN sleep mode before entering the initialization mode. It is
impossible to enter the other operation mode directly from the CAN stop mode
not entering the CAN sleep mode, that request is ignored.

User’s Manual U17566EE5V1UM00 813


Chapter 20 CAN Controller (CAN)

20.11.3 Example of using power saving modes

In some application systems, it may be necessary to place the CPU in a power


saving mode to reduce the power consumption. By using the power saving
mode specific to the CAN module and the power saving mode specific to the
CPU in combination, the CPU can be woken up from the power saving status
by the CAN bus.
Here is an example for using the power saving modes.
• First, put the CAN module in the CAN sleep mode (PSMODE[1:0] = 01B).
Next, put the CPU in the power saving mode. If an edge transition from
recessive to dominant is detected at the CAN reception pin (CRXDn) in this
status, the CINTS5 bit in the CAN module is set to 1. If the CIE5 bit of the
CnCTRL register is set to 1, a wakeup interrupt (INTWUPn) is generated.
• The CAN module is automatically released from CAN sleep mode
(PSMODE = 00B) and returns to normal operation mode.

• The CPU, in response to INTWUPn, can release its own power saving mode
and return to normal operation mode.
To further reduce the power consumption of the CPU, the internal clock
- including that of the CAN module - may be stopped. In this case, the
operating clock supplied to the CAN module is stopped after the CAN
module has been put in CAN sleep mode. Then the CPU enters a power
saving mode in which the clock supplied to the CPU is stopped.
• If an edge transition from recessive to dominant is detected at the CAN
reception pin (CRXDn) in this status, the CAN module can set the CINTS5
bit to 1 and generate the wakeup interrupt (INTWUPn) even if it is not
supplied with the clock.
• The other functions, however, do not operate, because clock supply to the
CAN module is stopped, and the module remains in CAN sleep mode.
• The CPU, in response to INTWUPn
– releases its power saving mode,
– resumes supply of the internal clocks - including the clock to the CAN
module - after the oscillation stabilization time has elapsed, and
– starts instruction execution.
• The CAN module is immediately released from the CAN sleep mode when
clock supply is resumed, and returns to the normal operation mode
(PSMODE = 00B).

www.DataSheet4U.com

814 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

20.12 Interrupt Function

The CAN module provides 6 different interrupt sources.


The occurrence of these interrupt sources is stored in interrupt status
registers. Four separate interrupt request signals are generated from the six
interrupt sources. When an interrupt request signal that corresponds to two or
more interrupt sources is generated, the interrupt sources can be identified by
using an interrupt status register. After an interrupt source has occurred, the
corresponding interrupt status bit must be cleared to 0 by software.

Table 20-25 List of CAN module interrupt sources


Interrupt status bit Interrupt enable bit Interrupt
No. request Interrupt source description
Name Register Name Register signal
Message frame successfully transmitted from
1 CINTS0 CnINTS CIE0a CnIE INTCnTRX
message buffer m
Valid message frame reception in message
2 CINTS1 CnINTS CIE1a CnIE INTCnREC
buffer m
CAN module error state interrupt
3 CINTS2 CnINTS CIE2 CnIE INTCnERR
(Supplement 1)
CAN module protocol error interrupt
4 CINTS3 CnINTS CIE3 CnIE
(Supplement 2)
5 CINTS4 CnINTS CIE4 CnIE CAN module arbitration loss interrupt
CAN module wakeup interrupt from CAN
6 CINTS5 CnINTS CIE5 CnIE INTCnWUP
sleep mode (Supplement 3)
a)
The IE bit (message buffer interrupt enable bit) in the CnMCTRL register of the corresponding message buffer
has to be set to 1 for that message buffer to participate in the interrupt generation process.

Supplements 1. This interrupt is generated when the transmission/reception error counter


is at the warning level, or in the error passive or bus-off state.
2. This interrupt is generated when a stuff error, form error, ACK error, bit
error, or CRC error occurs.
3. This interrupt is generated when the CAN module is woken up from the
CAN sleep mode because a falling edge is detected at the CAN reception
pin (CAN bus transition from recessive to dominant).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 815


Chapter 20 CAN Controller (CAN)

20.13 Diagnosis Functions and Special Operational


Modes

The CAN module provides a receive-only mode, single-shot mode, and self-
test mode to support CAN bus diagnosis functions or the operation of special
CAN communication methods.

20.13.1 Receive-only mode

The receive-only mode is used to monitor receive messages without causing


any interference on the CAN bus and can be used for CAN bus analysis nodes.
For example, this mode can be used for automatic baud-rate detection. The
baud rate in the CAN module is changed until “valid reception” is detected, so
that the baud rates in the module match (“valid reception” means a message
frame has been received in the CAN protocol layer without occurrence of an
error and with an appropriate ACK between nodes connected to the CAN bus).
A valid reception does not require message frames to be stored in a receive
message buffer (data frames) or transmit message buffer (remote frames). The
event of valid reception is indicated by setting the VALID bit of the CnCTRL
register (1).

CAN macro

Tx

Fixed to Rx
the recessive
level

CTXDn CRXDn

Figure 20-32 CAN module terminal connection in receive-only mode

In the receive-only mode, no message frames can be transmitted from the


CAN module to the CAN bus. Transmit requests issued for message buffers
defined as transmit message buffers are held pending.
In the receive-only mode, the CAN transmission pin (CTXDn) in the CAN
www.DataSheet4U.com module is fixed to the recessive level. Therefore, no active error flag can be
transmitted from the CAN module to the CAN bus even when a CAN bus error
is detected while receiving a message frame. Since no transmission can be
issued from the CAN module, the transmission error counter the CnERC.TEC7
to CnERC.TEC0 bits are never updated. Therefore, a CAN module in the
receive-only mode does not enter the bus-off state.

816 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

Furthermore, in the receive-only mode ACK is not returned to the CAN bus in
this mode upon the valid reception of a message frame. Internally, the local
node recognizes that it has transmitted ACK. An overload frame cannot be
transmitted to the CAN bus.

Caution If only two CAN nodes are connected to the CAN bus and one of them is
operating in the receive-only mode, there is no ACK on the CAN bus. Due to
the missing ACK, the transmitting node will transmit an active error flag, and
repeat transmitting a message frame. The transmitting node becomes error
passive after transmitting the message frame 16 times (assuming that the error
counter was 0 in the beginning and no other errors have occurred). After the
message frame for the 17th time is transmitted, the transmitting node
generates a passive error flag. The receiving node in the receive-only mode
detects the first valid message frame at this point, and the VALID bit is set to 1
for the first time.

20.13.2 Single-shot mode

In the single-shot mode, automatic re-transmission as defined in the CAN


protocol is switched off. (According to the CAN protocol, a message frame
transmission that has been aborted by either arbitration loss or error
occurrence has to be repeated without control by software.) All other behavior
of single shot mode is identical to normal operation mode. Features of single
shot mode can not be used in combination with normal mode with ABT.
The single-shot mode disables the re-transmission of an aborted message
frame transmission according to the setting of the AL bit of the CnCTRL
register. When the AL bit is cleared to 0, re-transmission upon arbitration loss
and upon error occurrence is disabled. If the AL bit is set to 1, re-transmission
upon error occurrence is disabled, but re-transmission upon arbitration loss is
enabled. As a consequence, the TRQ bit in a message buffer defined as a
transmit message buffer is cleared to 0 by the following events:
• Successful transmission of the message frame
• Arbitration loss while sending the message frame
• Error occurrence while sending the message frame
The events arbitration loss and error occurrence can be distinguished by
checking the CINTS4 and CINTS3 bits of the CnINTS register respectively,
and the type of the error can be identified by reading the LEC[2:0] bits of the
CnLEC register.
Upon successful transmission of the message frame, the transmit completion
interrupt bit CINTS0 of the CnINTS register is set to 1. If the CIE0 bit of the
CnIE register is set to 1 at this time, an interrupt request signal is output.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 817


Chapter 20 CAN Controller (CAN)

The single-shot mode can be used when emulating time-triggered


communication methods (e.g., TTCAN level 1).

Caution The AL bit is only valid in single-shot mode. It does not influence the operation
of re-transmission upon arbitration loss in the other operation modes.

20.13.3 Self-test mode

In the self-test mode, message frame transmission and message frame


reception can be tested without connecting the CAN node to the CAN bus or
without affecting the CAN bus.
In the self-test mode, the CAN module is completely disconnected from the
CAN bus, but transmission and reception are internally looped back. The CAN
transmission pin (CTXDn) is fixed to the recessive level.
If the falling edge on the CAN reception pin (CRXDn) is detected after the CAN
module has entered the CAN sleep mode from the self-test mode, however,
the module is released from the CAN sleep mode in the same manner as the
other operation modes. To keep the module in the CAN sleep mode, use the
CAN reception pin (CRXDn) as a port pin.

CAN macro

Tx

Rx
Fixed to
the recessive
level

CTXDn CRXDn

Figure 20-33 CAN module terminal connection in self-test mode

www.DataSheet4U.com

818 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

20.13.4 Receive/transmit operation in each operation mode

The following table shows outline of the receive/transmit operation in each


operation mode.

Table 20-26 Outline of the receive/transmit in each operation mode


Transmis- Transmis-
Automatic
sion of Transmis- sion of Store data to
Operation Transmis- block Set of
data/ sion of error/ message
mode sion retry transmis- VALID bit
remote ACK overload buffer
sion (ABT)
frame frame
Initialization
No No No No No No No
mode
Normal
operation Yes Yes Yes Yes No Yes Yes
mode
Normal
operation
Yes Yes Yes Yes Yes Yes Yes
mode with
ABT
Receive
No No No No No Yes Yes
only mode
Single-shot
Yes Yes Yes Noa No Yes Yes
mode
Self-test
Yesb Yesb Yesb Yesb No Yesb Yesb
mode
a) When the arbitration lost occurs, control of re-transmission is possible by the AL bit of CnCTRL register.
b)
Each signals are not generated to outside, but generated into the CAN module.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 819


Chapter 20 CAN Controller (CAN)

20.14 Time Stamp Function

CAN is an asynchronous, serial protocol. All nodes connected to the CAN bus
have a local, autonomous clock. As a consequence, the clocks of the nodes
have no relation (i.e., the clocks are asynchronous and may have different
frequencies).
In some applications, however, a common time base over the network
(= global time base) is needed. In order to build up a global time base, a time
stamp function is used. The essential mechanism of a time stamp function is
the capture of timer values triggered by signals on the CAN bus.

20.14.1 Time stamp function

The CAN Controller supports the capturing of timer values triggered by a


specific frame. An on-chip 16-bit capture timer unit in a microcontroller system
is used in addition to the CAN Controller. The 16-bit capture timer unit captures
the timer value according to a trigger signal (TSOUT) for capturing that is
output when a data frame is received from the CAN Controller. The CPU can
retrieve the time of occurrence of the capture event, i.e., the time stamp of the
message received from the CAN bus, by reading the captured value. The
TSOUT signal can be selected from the following two event sources and is
specified by the TSSEL bit of the CnTS register.
• SOF event (start of frame) (TSSEL = 0)
• EOF event (last bit of end of frame) (TSSEL = 1)
The TSOUT signal is enabled by setting the TSEN bit of the CnTS register to
1.

SOF SOF SOF SOF

TSOUT

Figure 20-34 Timing diagram of capture signal TSOUT

The TSOUT signal toggles its level upon occurrence of the selected event
during data frame reception (in Figure 20-34, the SOF is used as the trigger
event source). To capture a timer value by using the TSOUT signal, the capture
timer unit must detect the capture signal at both the rising edge and falling
edge.
This time stamp function is controlled by the TSLOCK bit of the CnTS register.
When TSLOCK is cleared to 0, the TSOUT signal toggles upon occurrence of
www.DataSheet4U.com the selected event. If TSLOCK is set to 1, the TSOUT signal toggles upon
occurrence of the selected event, but the toggle is stopped as the TSEN bit is
automatically cleared to 0 as soon as the message storing to the message
buffer 0 starts. This suppresses the subsequent toggle occurrence by the
TSOUT signal, so that the time stamp value toggled last (= captured last) can
be saved as the time stamp value of the time at which the data frame was
received in message buffer 0.

820 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

Caution The time stamp function using the TSLOCK bit stops toggle of the TSOUT
signal by receiving a data frame in message buffer 0. Therefore, message
buffer 0 must be set as a receive message buffer. Since a receive message
buffer cannot receive a remote frame, toggle of the TSOUT signal cannot be
stopped by reception of a remote frame. Toggle of the TSOUT signal does not
stop when a data frame is received in a message buffer other than message
buffer 0.
For these reasons, a data frame cannot be received in message buffer 0 when
the CAN module is in the normal operation mode with ABT, because message
buffer 0 must be set as a transmit message buffer. In this operation mode,
therefore, the function to stop toggle of the TSOUT signal by the TSLOCK bit
cannot be used.

20.15 Baud Rate Settings

20.15.1 Baud rate setting conditions

Make sure that the settings are within the range of limit values for ensuring
correct operation of the CAN Controller, as follows.
• 5TQ ≤SPT (sampling point) ≤17 TQ
SPT = TSEG1 + 1
• 8 TQ ≤DBT (data bit time) ≤25 TQ
DBT = TSEG1 + TSEG2 + 1TQ = TSEG2 + SPT
• 1 TQ ≤SJW (synchronization jump width) ≤4TQ
SJW ≤DBT – SPT
• 4 ≤TSEG1 ≤16 [3 ≤Setting value of TSEG1[3:0] ≤15]
• 1 ≤TSEG2 ≤8 [0 ≤Setting value of TSEG2[2:0] ≤7]

Note 1. TQ = 1/fTQ (fTQ: CAN protocol layer basic system clock)


2. TSEG1[3:0] (Bits 3 to 0 of CAN bit rate register (CnBTR))
3. TSEG2[2:0] (Bits 10 to 8 of CAN bit rate register (CnBTR))

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 821


Chapter 20 CAN Controller (CAN)

Table 20-27 shows the combinations of bit rates that satisfy the above
conditions.
Table 20-27 Settable bit rate combinations (1/3)
CnBTR register setting
Valid bit rate setting Sampling
value
point
SYNC PROP PHASE PHASE TSEG1 TSEG2 (unit %)
DBT length
SEGMENT SEGMENT SEGMENT1 SEGMENT2 [3:0] [2:0]
25 1 8 8 8 1111 111 68.0
24 1 7 8 8 1110 111 66.7
24 1 9 7 7 1111 110 70.8
23 1 6 8 8 1101 111 65.2
23 1 8 7 7 1110 110 69.6
23 1 10 6 6 1111 101 73.9
22 1 5 8 8 1100 111 63.6
22 1 7 7 7 1101 110 68.2
22 1 9 6 6 1110 101 72.7
22 1 11 5 5 1111 100 77.3
21 1 4 8 8 1011 111 61.9
21 1 6 7 7 1100 110 66.7
21 1 8 6 6 1101 101 71.4
21 1 10 5 5 1110 100 76.2
21 1 12 4 4 1111 011 81.0
20 1 3 8 8 1010 111 60.0
20 1 5 7 7 1011 110 65.0
20 1 7 6 6 1100 101 70.0
20 1 9 5 5 1101 100 75.0
20 1 11 4 4 1110 011 80.0
20 1 13 3 3 1111 010 85.0
19 1 2 8 8 1001 111 57.9
19 1 4 7 7 1010 110 63.2
19 1 6 6 6 1011 101 68.4
19 1 8 5 5 1100 100 73.7
19 1 10 4 4 1101 011 78.9
19 1 12 3 3 1110 010 84.2
19 1 14 2 2 1111 001 89.5
18 1 1 8 8 1000 111 55.6
18 1 3 7 7 1001 110 61.1
18 1 5 6 6 1010 101 66.7
18 1 7 5 5 1011 100 72.2
www.DataSheet4U.com
18 1 9 4 4 1100 011 77.8
18 1 11 3 3 1101 010 83.3
18 1 13 2 2 1110 001 88.9
18 1 15 1 1 1111 000 94.4
17 1 2 7 7 1000 110 58.8

822 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

Table 20-27 Settable bit rate combinations (2/3)


CnBTR register setting
Valid bit rate setting Sampling
value
point
SYNC PROP PHASE PHASE TSEG1 TSEG2 (unit %)
DBT length
SEGMENT SEGMENT SEGMENT1 SEGMENT2 [3:0] [2:0]
17 1 4 6 6 1001 101 64.7
17 1 6 5 5 1010 100 70.6
17 1 8 4 4 1011 011 76.5
17 1 10 3 3 1100 010 82.4
17 1 12 2 2 1101 001 88.2
17 1 14 1 1 1110 000 94.1
16 1 1 7 7 0111 110 56.3
16 1 3 6 6 1000 101 62.5
16 1 5 5 5 1001 100 68.8
16 1 7 4 4 1010 011 75.0
16 1 9 3 3 1011 010 81.3
16 1 11 2 2 1100 001 87.5
16 1 13 1 1 1101 000 93.8
15 1 2 6 6 0111 101 60.0
15 1 4 5 5 1000 100 66.7
15 1 6 4 4 1001 011 73.3
15 1 8 3 3 1010 010 80.0
15 1 10 2 2 1011 001 86.7
15 1 12 1 1 1100 000 93.3
14 1 1 6 6 0110 101 57.1
14 1 3 5 5 0111 100 64.3
14 1 5 4 4 1000 011 71.4
14 1 7 3 3 1001 010 78.6
14 1 9 2 2 1010 001 85.7
14 1 11 1 1 1011 000 92.9
13 1 2 5 5 0110 100 61.5
13 1 4 4 4 0111 011 69.2
13 1 6 3 3 1000 010 76.9
13 1 8 2 2 1001 001 84.6
13 1 10 1 1 1010 000 92.3
12 1 1 5 5 0101 100 58.3
12 1 3 4 4 0110 011 66.7
12 1 5 3 3 0111 010 75.0

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 823


Chapter 20 CAN Controller (CAN)

Table 20-27 Settable bit rate combinations (3/3)


CnBTR register setting
Valid bit rate setting Sampling
value
point
SYNC PROP PHASE PHASE TSEG1 TSEG2 (unit %)
DBT length
SEGMENT SEGMENT SEGMENT1 SEGMENT2 [3:0] [2:0]
12 1 7 2 2 1000 001 83.3
12 1 9 1 1 1001 000 91.7
11 1 2 4 4 0101 011 63.6
11 1 4 3 3 0110 010 72.7
11 1 6 2 2 0111 001 81.8
11 1 8 1 1 1000 000 90.9
10 1 1 4 4 0100 011 60.0
10 1 3 3 3 0101 010 70.0
10 1 5 2 2 0110 001 80.0
10 1 7 1 1 0111 000 90.0
9 1 2 3 3 0100 010 66.7
9 1 4 2 2 0101 001 77.8
9 1 6 1 1 0110 000 88.9
8 1 1 3 3 0011 010 62.5
8 1 3 2 2 0100 001 75.0
8 1 5 1 1 0101 000 87.5
7a 1 2 2 2 0011 001 71.4
7a 1 4 1 1 0100 000 85.7
a
6 1 1 2 2 0010 001 66.7
6a 1 3 1 1 0011 000 83.3
5a 1 2 1 1 0010 000 80.0
a
4 1 1 1 1 0001 000 75.0
a) Setting with a DBT value of 7 or less is valid only when the value of the CnBRP register is other than 00H.

Caution The values in Table 20-27 do not guarantee the operation of the network
system. Thoroughly check the effect on the network system, taking into
consideration oscillation errors and delays of the CAN bus and CAN
transceiver.

www.DataSheet4U.com

824 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

20.15.2 Representative examples of baud rate settings

Table 20-28 and Table 20-29 show representative examples of baud rate
settings.
Table 20-28 Representative examples of baud rate settings
(fCANMOD = 8 MHz) (1/2)

Division CnBTR register setting


Set baud CnBRP Valid bit rate setting (unit: kbps) Sampling
ratio of value
rate value register set point
CnBRP Length SYNC PROP PHASE PHASE TSEG1 TSEG2
(unit: kbps) value (unit: %)
register of DBT SEGMENT SEGMENT SEGMENT1 SEGMENT2 [3:0] [2:0]
1000 1 00000000 8 1 1 3 3 0011 010 62.5
1000 1 00000000 8 1 3 2 2 0100 001 75.0
1000 1 00000000 8 1 5 1 1 0101 000 87.5
500 1 00000000 16 1 1 7 7 0111 110 56.3
500 1 00000000 16 1 3 6 6 1000 101 62.5
500 1 00000000 16 1 5 5 5 1001 100 68.8
500 1 00000000 16 1 7 4 4 1010 011 75.0
500 1 00000000 16 1 9 3 3 1011 010 81.3
500 1 00000000 16 1 11 2 2 1100 001 87.5
500 1 00000000 16 1 13 1 1 1101 000 93.8
500 2 00000001 8 1 1 3 3 0011 010 62.5
500 2 00000001 8 1 3 2 2 0100 001 75.0
500 2 00000001 8 1 5 1 1 0101 000 87.5
250 2 00000001 16 1 1 7 7 0111 110 56.3
250 2 00000001 16 1 3 6 6 1000 101 62.5
250 2 00000001 16 1 5 5 5 1001 100 68.8
250 2 00000001 16 1 7 4 4 1010 011 75.0
250 2 00000001 16 1 9 3 3 1011 010 81.3
250 2 00000001 16 1 11 2 2 1100 001 87.5
250 2 00000001 16 1 13 1 1 1101 000 93.8
250 4 00000011 8 1 3 2 2 0100 001 75.0
250 4 00000011 8 1 5 1 1 0101 000 87.5
125 4 00000011 16 1 1 7 7 0111 110 56.3
125 4 00000011 16 1 3 6 6 1000 101 62.5
125 4 00000011 16 1 5 5 5 1001 100 68.8
125 4 00000011 16 1 7 4 4 1010 011 75.0
125 4 00000011 16 1 9 3 3 1011 010 81.3
125 4 00000011 16 1 11 2 2 1100 001 87.5
125 4 00000011 16 1 13 1 1 1101 000 93.8
125 8 00000111 8 1 3 2 2 0100 001 75.0
w w w . D a t a S h e e t 4 U . c o m
125 8 00000111 8 1 5 1 1 0101 000 87.5
100 4 00000011 20 1 7 6 6 1100 101 70.0
100 4 00000011 20 1 9 5 5 1101 100 75.0
100 5 00000100 16 1 7 4 4 1010 011 75.0
100 5 00000100 16 1 9 3 3 1011 010 81.3

User’s Manual U17566EE5V1UM00 825


Chapter 20 CAN Controller (CAN)

Table 20-28 Representative examples of baud rate settings


(fCANMOD = 8 MHz) (2/2)

Division CnBTR register setting


Set baud CnBRP Valid bit rate setting (unit: kbps) Sampling
ratio of value
rate value register set point
CnBRP Length SYNC PROP PHASE PHASE TSEG1 TSEG2
(unit: kbps) value (unit: %)
register of DBT SEGMENT SEGMENT SEGMENT1 SEGMENT2 [3:0] [2:0]
100 8 00000111 10 1 3 3 3 0101 010 70.0
100 8 00000111 10 1 5 2 2 0110 001 80.0
100 10 00001001 8 1 3 2 2 0100 001 75.0
100 10 00001001 8 1 5 1 1 0101 000 87.5
83.3 4 00000011 24 1 7 8 8 1110 111 66.7
83.3 4 00000011 24 1 9 7 7 1111 110 70.8
83.3 6 00000101 16 1 5 5 5 1001 100 68.8
83.3 6 00000101 16 1 7 4 4 1010 011 75.0
83.3 6 00000101 16 1 9 3 3 1011 010 81.3
83.3 6 00000101 16 1 11 2 2 1100 001 87.5
83.3 8 00000111 12 1 5 3 3 0111 010 75.0
83.3 8 00000111 12 1 7 2 2 1000 001 83.3
83.3 12 00001011 8 1 3 2 2 0100 001 75.0
83.3 12 00001011 8 1 5 1 1 0101 000 87.5
33.3 10 00001001 24 1 7 8 8 1110 111 66.7
33.3 10 00001001 24 1 9 7 7 1111 110 70.8
33.3 12 00001011 20 1 7 6 6 1100 101 70.0
33.3 12 00001011 20 1 9 5 5 1101 100 75.0
33.3 15 00001110 16 1 7 4 4 1010 011 75.0
33.3 15 00001110 16 1 9 3 3 1011 010 81.3
33.3 16 00001111 15 1 6 4 4 1001 011 73.3
33.3 16 00001111 15 1 8 3 3 1010 010 80.0
33.3 20 00010011 12 1 5 3 3 0111 010 75.0
33.3 20 00010011 12 1 7 2 2 1000 001 83.3
33.3 24 00010111 10 1 3 3 3 0101 010 70.0
33.3 24 00010111 10 1 5 2 2 0110 001 80.0
33.3 30 00011101 8 1 3 2 2 0100 001 75.0
33.3 30 00011101 8 1 5 1 1 0101 000 87.5

Caution The values in Table 20-28 do not guarantee the operation of the network
system. Thoroughly check the effect on the network system, taking into
consideration oscillation errors and delays of the CAN bus and CAN
transceiver.

www.DataSheet4U.com

826 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

Table 20-29 Representative examples of baud rate settings


(fCANMOD = 16 MHz) (1/2)

Division CnBTR register setting


Set baud CnBRP Valid bit rate setting (unit: kbps) Sampling
ratio of value
rate value register set point
CnBRP Length SYNC PROP PHASE PHASE TSEG1 TSEG2
(unit: kbps) value (unit: %)
register of DBT SEGMENT SEGMENT SEGMENT1 SEGMENT2 [3:0] [2:0]
1000 1 00000000 16 1 1 7 7 0111 110 56.3
1000 1 00000000 16 1 3 6 6 1000 101 62.5
1000 1 00000000 16 1 5 5 5 1001 100 68.8
1000 1 00000000 16 1 7 4 4 1010 011 75.0
1000 1 00000000 16 1 9 3 3 1011 010 81.3
1000 1 00000000 16 1 11 2 2 1100 001 87.5
1000 1 00000000 16 1 13 1 1 1101 000 93.8
1000 2 00000001 8 1 3 2 2 0100 001 75.0
1000 2 00000001 8 1 5 1 1 0101 000 87.5
500 2 00000001 16 1 1 7 7 0111 110 56.3
500 2 00000001 16 1 3 6 6 1000 101 62.5
500 2 00000001 16 1 5 5 5 1001 100 68.8
500 2 00000001 16 1 7 4 4 1010 011 75.0
500 2 00000001 16 1 9 3 3 1011 010 81.3
500 2 00000001 16 1 11 2 2 1100 001 87.5
500 2 00000001 16 1 13 1 1 1101 000 93.8
500 4 00000011 8 1 3 2 2 0100 001 75.0
500 4 00000011 8 1 5 1 1 0101 000 87.5
250 4 00000011 16 1 3 6 6 1000 101 62.5
250 4 00000011 16 1 5 5 5 1001 100 68.8
250 4 00000011 16 1 7 4 4 1010 011 75.0
250 4 00000011 16 1 9 3 3 1011 010 81.3
250 4 00000011 16 1 11 2 2 1100 001 87.5
250 8 00000111 8 1 3 2 2 0100 001 75.0
250 8 00000111 8 1 5 1 1 0101 000 87.5
125 8 00000111 16 1 3 6 6 1000 101 62.5
125 8 00000111 16 1 7 4 4 1010 011 75.0
125 8 00000111 16 1 9 3 3 1011 010 81.3
125 8 00000111 16 1 11 2 2 1100 001 87.5
125 16 00001111 8 1 3 2 2 0100 001 75.0
125 16 00001111 8 1 5 1 1 0101 000 87.5
100 8 00000111 20 1 9 5 5 1101 100 75.0
100 8 00000111 20 1 11 4 4 1110 011 80.0
w w w . D100
a t a S 10h e e00001001
t 4 U . c16 o m 1 7 4 4 1010 011 75.0
100 10 00001001 16 1 9 3 3 1011 010 81.3
100 16 00001111 10 1 3 3 3 0101 010 70.0
100 16 00001111 10 1 5 2 2 0110 001 80.0
100 20 00010011 8 1 3 2 2 0100 001 75.0

User’s Manual U17566EE5V1UM00 827


Chapter 20 CAN Controller (CAN)

Table 20-29 Representative examples of baud rate settings


(fCANMOD = 16 MHz) (2/2)

Division CnBTR register setting


Set baud CnBRP Valid bit rate setting (unit: kbps) Sampling
ratio of value
rate value register set point
CnBRP Length SYNC PROP PHASE PHASE TSEG1 TSEG2
(unit: kbps) value (unit: %)
register of DBT SEGMENT SEGMENT SEGMENT1 SEGMENT2 [3:0] [2:0]
83.3 8 00000111 24 1 7 8 8 1110 111 66.7
83.3 8 00000111 24 1 9 7 7 1111 110 70.8
83.3 12 00001011 16 1 7 4 4 1010 011 75.0
83.3 12 00001011 16 1 9 3 3 1011 010 81.3
83.3 12 00001011 16 1 11 2 2 1100 001 87.5
83.3 16 00001111 12 1 5 3 3 0111 010 75.0
83.3 16 00001111 12 1 7 2 2 1000 001 83.3
83.3 24 00010111 8 1 3 2 2 0100 001 75.0
83.3 24 00010111 8 1 5 1 1 0101 000 87.5
33.3 30 00011101 24 1 7 8 8 1110 111 66.7
33.3 30 00011101 24 1 9 7 7 1111 110 70.8
33.3 24 00010111 20 1 9 5 5 1101 100 75.0
33.3 24 00010111 20 1 11 4 4 1110 011 80.0
33.3 30 00011101 16 1 7 4 4 1010 011 75.0
33.3 30 00011101 16 1 9 3 3 1011 010 81.3
33.3 32 00011111 15 1 8 3 3 1010 010 80.0
33.3 32 00011111 15 1 10 2 2 1011 001 86.7
33.3 37 00100100 13 1 6 3 3 1000 010 76.9
33.3 37 00100100 13 1 8 2 2 1001 001 84.6
33.3 40 00100111 12 1 5 3 3 0111 010 75.0
33.3 40 00100111 12 1 7 2 2 1000 001 83.3
33.3 48 00101111 10 1 3 3 3 0101 010 70.0
33.3 48 00101111 10 1 5 2 2 0110 001 80.0
33.3 60 00111011 8 1 3 2 2 0100 001 75.0
33.3 60 00111011 8 1 5 1 1 0101 000 87.5

Caution The values in Table 20-29 do not guarantee the operation of the network
system. Thoroughly check the effect on the network system, taking into
consideration oscillation errors and delays of the CAN bus and CAN
transceiver.

www.DataSheet4U.com

828 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

20.16 Operation of CAN Controller

The processing procedure for showing in this chapter is recommended


processing procedure to operate CAN controller.
Develop the program referring to recommended processing procedure in this
chapter.

START

Set
CnGMCS register.

Set
CnGMCTRL register
(set GOM bit = 1)

Set
CnBRP register,
CnBTR register.

Set
CnIE register.

Set
CnMASK register.

Initialize
message buffers.

Set CnCTRL
register (set OPMODE bit).

END

OPMODE: Normal operation mode, normal operation mode with ABT,


www.DataSheet4U.com
receive-only mode, single-shot mode, self-test mode

Figure 20-35 Initialization

User’s Manual U17566EE5V1UM00 829


Chapter 20 CAN Controller (CAN)

START

Clear
OPMODE

No
INIT mode?

Yes
Set
CnBRP register,
CnBTR register

Set
CnIE register

Set
CnMASK register

Initialize message buffers

CnERC and CnINFO No


register clear?

Yes

Set CCERC bit

Set CnCTRL register


(Set OPMODE)

END

OPMODE: Normal operation mode, normal operation mode with ABT,


receive-only mode, single-shot mode, self-test mode

Figure 20-36 Re-initialization

Caution After setting the CAN module to the initialization mode, avoid setting the
module to another operation mode immediately after. If it is necessary to
immediately set the module to another operation mode, be sure to access
www.DataSheet4U.com
registers other than the CnCTRL and CnGMCTRL registers (e.g., set a
message buffer).

830 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

START

No
RDY = 1?

Yes

Clear RDY bit

No
RDY = 0?

Yes

Set
CnMCONFm register

Set
CnMIDHm register,
CnMIDLm register

No
Transmit message buffer?

Yes

Set
CnMDLCm register

Clear
CnMDATAm register

Set
CnMCTRLm register

Set RDY bit

END

Figure 20-37 Message buffer initialization

www.DataSheet4U.com Caution 1. Before a message buffer is initialized, the RDY bit must be cleared.
2. Make the following settings for message buffers not used by the application.
• Clear the RDY, TRQ, and DN bits of the CnMCTRLm register to 0.
• Clear the MA0 bit of the CnMCONFm register to 0.

User’s Manual U17566EE5V1UM00 831


Chapter 20 CAN Controller (CAN)

Figure 20-38 shows the processing for a receive message buffer (MT[2:0] bits
of CnMCONFm register = 001B to 101B).

START

Clear VALID bit

No
RDY = 1?

Yes

Clear RDY bit

No
RDY = 0?

Yes

RSTAT = 0 or No
VALID = 1? Note1

Yes

Wait for 4 CAN data bits Note2

Set
message buffers

Set RDY bit

END

Note1: Confirm that a message is being received because


RDY bit must be set after a message is completely received.

Note2: Avoid message buffer redefinition during store operation of


message reception by waiting additional 4 CAN data bits.

Figure 20-38 Message buffer redefinition


www.DataSheet4U.com

832 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

Figure 20-39 shows the processing for a transmit message buffer during
transmission (MT[2:0] bits of CnMCONFm register = 000B).

START

Transmit abort process

Clear RDY bit

No
RDY = 0?

Yes

Data frame Remote frame


Data frame or remote frame?

Set CnMDATAxm register


Set CnMDLCm register
Set CnMDLCm register
Set RTR bit of CnMCONFm
Clear RTR bit of CnMCONFm
register
register
Set CnMIDLm and CnMIDHm
Set CnMIDLm and CnMIDHm
registers
registers

Set RDY bit

No
Transmit?

Yes

Wait for 1CAN data bits

Set TRQ bit

END

www.DataSheet4U.com

Figure 20-39 Message buffer redefinition during transmission

User’s Manual U17566EE5V1UM00 833


Chapter 20 CAN Controller (CAN)

Figure 20-40 shows the processing for a transmit message buffer (MT[2:0] bits
of CnMCONFm register = 000B).

START

No
TRQ = 0?

Yes

Clear RDY bit

No
RDY = 0?

Yes

Data frame Remote frame


Data frame or remote frame?

Set CnMDATAxm register


Set CnMDLCm register
Set CnMDLCm register
Set RTR bit of CnMCONFm
Clear RTR bit of CnMCONFm
register
register
Set CnMIDLm and CnMIDHm
Set CnMIDLm and CnMIDHm
registers
registers

Set RDY bit

Set TRQ bit

END

Figure 20-40 Message transmit processing

Caution 1. The TRQ bit should be set after the RDY bit is set.
2. The RDY bit and TRQ bit should not be set at the same time.
www.DataSheet4U.com

834 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

Figure 20-41 shows the processing for a transmit message buffer (MT[2:0] bits
of CnMCONFm register = 000B)

START

No
ABTTRG = 0?

Yes

Clear RDY bit

No
RDY = 0?

Yes
Set CnMDATAxm register
Set CnMDLCm register
Clear RTR bit of CnMCONFm
register
Set CnMIDLm and CnMIDHm
registers

Set RDY bit

No
Set all ABT transmit messages?

Yes

No
TSTAT = 0?

Yes

Set ABTTRG bit

END

Figure 20-41 ABT message transmit processing

Note This processing (normal operation mode with ABT) can only be applied to
message buffers 0 to 7. For message buffers other than the ABT message
www.DataSheet4U.com buffers, see Figure 20-40 on page 834.

Caution The ABTTRG bit should be set to 1 after the TSTAT bit is cleared to 0.
Checking the TSTAT bit and setting the ABTTRG bit to 1 must be processed
consecutively.

User’s Manual U17566EE5V1UM00 835


Chapter 20 CAN Controller (CAN)

START

Transmit completion
interrupt processing

Read CnLOPT register

Clear RDY bit

No
RDY = 0?

Yes

Data frame Remote frame


Data frame or remote frame?

Set CnMDATAxm register


Set CnMDLCm register
Set CnMDLCm register,
Set RTR bit of CnMCONFm
Clear RTR bit of CnMCONFm
register.
register.
Set CnMIDLm and CnMIDHm
Set CnMIDLm and CnMIDHm
registers
registers

Set RDY bit

Set TRQ bit

END

Figure 20-42 Transmission via interrupt (using CnLOPT register)

Caution 1. The TRQ bit should be set after the RDY bit is set.
2. The RDY bit and TRQ bit should not be set at the same time.

Note Also check the MBON flag at the beginning and at the end of the interrupt
www.DataSheet4U.com
routine, in order to check the access to the message buffers as well as TX
history list registers, in case a pending sleep mode had been executed. If
MBON is detected to be cleared at any check, the actions and results of the
processing have to be discarded and processed again, after MBON is set
again.
It is recommended to cancel any sleep mode requests, before processing TX
interrupts.

836 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

START

Transmit completion
interrupt processing

Read CnTGPT register

No
TOVF = 1?

Yes

Clear TOVF bit

Clear RDY bit

No
RDY = 0?

Yes
Data frame
Remote frame
Data frame or remote frame?

Set CnMDATAxm register


Set CnMDLCm register
Set CnMDLCm register
Set RTR bit of CnMCONFm
Clear RTR bit of CnMCONFm
register
register
Set CnMIDLm and CnMIDHm
Set CnMIDLm and CnMIDHm
registers
registers

Set RDY bit

Set TRQ bit

No
THPM = 1?

Yes

END

Figure 20-43 Transmission via interrupt (using CnTGPT register)

Caution 1. The TRQ bit should be set after the RDY bit is set.
2. The RDY bit and TRQ bit should not be set at the same time.

www.DataSheet4U.com Note 1. Also check the MBON flag at the beginning and at the end of the interrupt
routine, in order to check the access to the message buffers as well as TX
history list registers, in case a pending sleep mode had been executed. If
MBON is detected to be cleared at any check, the actions and results of

User’s Manual U17566EE5V1UM00 837


Chapter 20 CAN Controller (CAN)

the processing have to be discarded and processed again, after MBON is


set again.
It is recommended to cancel any sleep mode requests, before processing
TX interrupts.
2. If TOVF was set once, the transmit history list is inconsistent. Consider to
scan all configured transmit buffers for completed transmissions.

START

No
CINTS0 = 1?

Yes

Clear CINTS0 bit

Read CnTGPT register

No
TOVF = 1?

Yes

Clear TOVF bit

Clear RDY bit

No
RDY = 0?

Yes

Data frame Data frame or Remote frame


remote frame?

Set CnMDATAxm register


Set CnMDLCm register Set CnMDLCm register
Clear RTR bit of CnMCONFm Set RTR bit of CnMCONFm
register. Set CnMIDLm and CnMIDHm
Set CnMIDLm and CnMIDHm registers
registers

Set RDY bit

Set TRQ bit

No
THPM = 1?

Yes
END

Figure 20-44 Transmission via software polling


www.DataSheet4U.com

Caution 1. The TRQ bit should be set after the RDY bit is set.
2. The RDY bit and TRQ bit should not be set at the same time.

838 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

Note 1. Also check the MBON flag at the beginning and at the end of the polling
routine, in order to check the access to the message buffers as well as TX
history list registers, in case a pending sleep mode had been executed. If
MBON is detected to be cleared at any check, the actions and results of
the processing have to be discarded and processed again, after MBON is
set again.
2. If TOVF was set once, the transmit history list is inconsistent. Consider to
scan all configured transmit buffers for completed transmissions.

START

Clear TRQ bit

Wait for 11 CAN data bitsNote

No
TSTAT = 0?

Yes

Read CnLOPT register

Message buffer to No
be aborted matches CnLOPT
register?

Yes
Transmit abort request
Transmission successful was successful

END

Figure 20-45 Transmission abort processing (except normal operation mode with
ABT)

Note There is a possibility of starting the transmission without being aborted even if
TRQ bit is cleared, because the transmission request to protocol layer might
already been accepted between 11 bits, total of interframe space (3 bits) and
suspend transmission (8 bits).

Caution 1. Clear the TRQ bit for aborting transmission request, not the RDY bit.
2. Before making a sleep mode transition request, confirm that there is no
transmission request left using this processing.
www.DataSheet4U.com
3. The TSTAT bit can be periodically checked by a user application or can be
checked after the transmit completion interrupt.
4. Do not execute any new transmission request including in the other
message buffers while transmission abort processing is in progress.

User’s Manual U17566EE5V1UM00 839


Chapter 20 CAN Controller (CAN)

START

Clear ABTTRG bit

No
ABTTRG = 0?

Yes

Clear TRQ bit

Wait for 11 CAN data bits

No
TSTAT = 0?

Yes

Read CnLOPT register

Message buffer to No
be aborted matches CnLOPT
register?

Yes
Transmit abort request
Transmission successful was successful

END

Figure 20-46 Transmission abort processing except for ABT transmission (normal
operation mode with ABT)

Caution 1. Clear the TRQ bit for aborting transmission request, not the RDY bit.
2. Before making a sleep mode transition request, confirm that there is no
transmission request left using this processing.
3. The TSTAT bit can be periodically checked by a user application or can be
checked after the transmit completion interrupt.

www.DataSheet4U.com 4. Do not execute any new transmission request including in the other
message buffers while transmission abort processing is in progress.

840 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

Figure 20-47 shows the processing to skip resumption of transmitting a


message that was stopped when transmission of an ABT message buffer was
aborted.

START

No
TSTAT = 0?

Yes

Clear ABTTRG bit

No
ABTTRG = 0?

Yes
Clear TRQ bit of message
buffer whose transmission
was aborted

Transmit abort

No
Transmission start

Yes

Set ABTCLR bit

END

Figure 20-47 Transmission abort processing (normal operation mode with ABT)

Caution 1. Do not set any transmission requests while ABT transmission abort
processing is in progress.
2. Make a CAN sleep mode/CAN stop mode transition request after the
ABTTRG bit is cleared (after ABT mode is aborted) following the procedure
shown in Figure 20-47 or Figure 20-48. When clearing a transmission
request in an area other than the ABT area, follow the procedure shown in
Figure 20-45 on page 839.
www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 841


Chapter 20 CAN Controller (CAN)

Figure 20-48 shows the processing to not skip resumption of transmitting a


message that was stopped when transmission of an ABT message buffer was
aborted.

START

Clear TRQ bit of message buffer


undergoing transmission

Clear ABTTRG bit

No
ABTTRG = 0?

Yes

Transmit abort

Transmission start No
pointer clear?

Yes

Set ABTCLR bit

END

Figure 20-48 ABT transmission request abort processing (normal operation mode
with ABT)

Caution 1. Do not set any transmission requests while ABT transmission abort
processing is in progress.
2. Make a CAN sleep mode/CAN stop mode request after the ABTTRG bit is
cleared (after ABT mode is stopped) following the procedure shown in
Figure 20-47 or Figure 20-48. When clearing a transmission request in an
area other than the ABT area, follow the procedure shown in Figure 20-45
on page 839.

www.DataSheet4U.com

842 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

START

Generation of receive
completion interrupt

Read CnLIPT register

Clear DN bit

Read CnMDATAxm, CnMDLCm,


CnMIDLm, and CnMIDHm
registers

DN = 0
No
AND
MUC = 0 Note

Yes

END

Note Check the MUC and DN bits using one read access.

Figure 20-49 Reception via interrupt (using CnLIPT register)

Note Also check the MBON flag at the beginning and at the end of the interrupt
routine, in order to check the access to the message buffers as well as
reception history list registers, in case a pending sleep mode had been
executed. If MBON is detected to be cleared at any check, the actions and
results of the processing have to be discarded and processed again, after
MBON is set again.
It is recommended to cancel any sleep mode requests, before processing RX
interrupts.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 843


Chapter 20 CAN Controller (CAN)

START

Generation of receive
completion interrupt
A

Read CnRGPT register

No
ROVF = 1?

Yes

Clear ROVF bit

Yes
RHPM = 1?

No
B

Clear DN bit

Read CnMDATAxm, CnMDLCm,


CnMIDLm, CnMIDHm registers

DN = 0 No
AND
MUC = 0 Note 1

Yes

Correct data is read Illegal data is read

END Note 2
A or B

Figure 20-50 Reception via interrupt (using CnRGPT register)

Note 1. Check the MUC and DN bits using one read access.
2. Depending of the processing target of the application, two ways are
possible:
– Way A: The message is not processed within this pass, but with the next
pass, depending on the timing this can happen latest with the next Receive
Interrupt.
Other messages will be processed earlier.
www.DataSheet4U.com – Way B: The message is processed within this pass, the loop waits on this
message.
Other messages will be processed later.

844 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

3. Also check the MBON flag at the beginning and at the end of the interrupt
routine, in order to check the access to the message buffers as well as
reception history list registers, in case a pending sleep mode had been
executed. If MBON is detected to be cleared at any check, the actions and
results of the processing have to be discarded and processed again, after
MBON is set again.
It is recommended to cancel any sleep mode requests, before processing
RX interrupts.
4. If ROVF was set once, the receive history list is inconsistent. Consider to
scan all configured receive buffers for receptions.

START

Generation of receive
completion interrupt

Read CnRGPT register

No
ROVF = 1?

Yes

Clear ROVF bit

Yes
RHPM = 1?

No

Read CnMDATAxm, CnMDLCm,


CnMIDLm, CnMIDHm registers

Clear DN bit

END

Figure 20-51 Reception via interrupt (using CnRGPT register), alternative way

Note 1. Also check the MBON flag at the beginning and at the end of the interrupt
routine, in order to check the access to the message buffers as well as
reception history list registers, in case a pending sleep mode had been
www.DataSheet4U.com executed. If MBON is detected to be cleared at any check, the actions and
results of the processing have to be discarded and processed again, after
MBON is set again.
It is recommended to cancel any sleep mode requests, before processing
RX interrupts.
2. If ROVF was set once, the receive history list is inconsistent. Consider to
scan all configured receive buffers for receptions.

User’s Manual U17566EE5V1UM00 845


Chapter 20 CAN Controller (CAN)

3. This flow will not provide most recently received data for the application.
However, due to less effort on processing, it reduces interrupt load.
4. The overwrite function (CnMCONFm.OWS=1) must not be used with this
flow - data inconsistency could occur.
5. It can be used alternatively to Figure 20-50 on page 844.

www.DataSheet4U.com

846 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

START

No
CINTS1 = 1?

Yes

Clear CINTS1 bit

Read CnRGPT register

No
ROVF = 1?

Yes

Clear ROVF bit

Yes
RHPM = 1?

No

Clear DN bit

Read CnMDATAxm, CnMDLCm,


CnMIDLm, CnMIDHm registers

DN = 0 No
AND
MUC = 0Note

Yes

Correct data is read Illegal data is read

END

Note Check the MUC and DN bits using one read access.

Figure 20-52 Reception via software polling

Note 1. Also check the MBON flag at the beginning and at the end of the polling
routine, in order to check the access to the message buffers as well as
reception history list registers, in case a pending sleep mode had been
executed. If MBON is detected to be cleared at any check, the actions and
results of the processing have to be discarded and processed again, after
www.DataSheet4U.com MBON is set again.
2. If ROVF was set once, the receive history list is inconsistent. Consider to
scan all configured receive buffers for receptions.

User’s Manual U17566EE5V1UM00 847


Chapter 20 CAN Controller (CAN)

START (when PSMODE[1:0] = 00B)

Set PSMODE0 bit

No
PSMODE0 = 1?

Yes

CAN sleep mode

Set PSMODE1 bit

PSMODE1 = 1?
No

Yes Request CAN sleep Yes


mode again?
CAN stop mode
No

END
Clear OPMODE

No
INIT mode?

Yes

Access to registers other than the


CnCTRL and CnGMCTRL registers

Set CnCTRL register


(set OPMODE)

ClearCINTS5
Clear CINTS5bitbit

Figure 20-53 Setting CAN sleep mode/stop mode


www.DataSheet4U.com

Caution To abort transmission before making a request for the CAN sleep mode,
perform processing according to Figure 20-45 on page 839 and Figure 20-47
on page 841.

848 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

START

CAN stop mode

Clear PSMODE1 bit

CAN sleep mode

Releasing CAN sleep mode


by CAN bus activity

Releasing CAN sleep mode


by user Dominant edge on CAN detected

Clear PSMODE0 bit Clear PSMODE0 bit

Clear CINTS5 bit

END

Figure 20-54 Clear CAN sleep/stop mode

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 849


Chapter 20 CAN Controller (CAN)

START

No
BOFF = 1?

Yes

Note
Clear all TRQ bits

Set CnCTRL register


(Clear OPMODE)

Access to registers other than


CnCTRL and CnGMCTRL
registers

No
Forced recovery from bus off?

Yes

Set CnCTRL register


Set CCERC bit
(Set OPMODE)

Set CnCTRL register Wait for recovery


(Set OPMODE) from bus off

END

Note: Clear all TRQ bits when re-initialization of message buffer is executed by clearing
RDY bit before bus-off recovery sequence is started.

OPMODE: Normal operation mode, normal operation mode with ABT,


receive-only mode, single-shot mode, self-test mode

Figure 20-55 Bus-off recovery (except normal operation mode with ABT)

Caution When the transmission from the initialization mode to any operation modes is
requested to execute bus-off recovery sequence again in the bus-off recovery
sequence, reception error counter is cleared.
Therefore it is necessary to detect 11 consecutive recessive-level bits 128
times on the bus again.

www.DataSheet4U.com

850 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

START

No
BOFF = 1?

Yes

Clear ABTTRG bit

Clear all TRQ bits Note

Set CnCTRL register


(Clear OPMODE)

Access to registers other than


CnCTRL and CnGMCTRL
registers

No
Forced recovery from bus off?

Yes

Set CnCTRL register


Set CCERC bit
(Set OPMODE)

Set CnCTRL register Wait for recovery


(Set OPMODE) from bus off

END

Note: Clear all TRQ bits when re-initialization of message buffer is executed by clearing
RDY bit before bus-off recovery sequence is started.

OPMODE: Normal operation mode, normal operation mode with ABT,


receive-only mode, single-shot mode, self-test mode

Figure 20-56 Bus-off recovery (Normal Operation Mode with ABT)

Caution When the transmission from the initialization mode to any operation modes is
requested to execute bus-off recovery sequence again in the bus-off recovery
www.DataSheet4U.com sequence, reception error counter is cleared.
Therefore it is necessary to detect 11 consecutive recessive-level bits 128
times on the bus again.

User’s Manual U17566EE5V1UM00 851


Chapter 20 CAN Controller (CAN)

START

INIT mode

Clear GOM bit

No
GOM = 0?

Yes

Shutdown successful
GOM = 0, EFSD = 0

END

Figure 20-57 Normal shutdown process

www.DataSheet4U.com

852 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

START

Set EFSD bit

Must be a subsequent write

Clear GOM bit

No
GOM = 0?

Yes

Shutdown successful
GOM = 0, EFSD = 0

END

Figure 20-58 Forced shutdown process

Caution Do not read- or write-access any registers by software between setting the
EFSD bit and clearing the GOM bit.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 853


Chapter 20 CAN Controller (CAN)

START

Error interrupt

No
CINTS2 = 1?

Yes

Check CAN module state


(read CnINFO register)

Clear CINTS2 bit

No
CINTS3 = 1?

Yes

Check CAN protocol error state


(read CnLEC register)

Clear CINTS3 bit

No
CINTS4 = 1?

Yes

Clear CINTS4 bit

END

Figure 20-59 Error handling

www.DataSheet4U.com

854 User’s Manual U17566EE5V1UM00


CAN Controller (CAN) Chapter 20

START

Set PSMODE0 bit.


Set PSMODE0 bit = 1
Clear PSMODE0 bit = 0

No
PSMODE0 bit = 1?

Yes Clear CINTS5 bit.


Clear CINTS5 bit = 1

CAN sleep mode


Yes

No
CINTS5 bit = 1?

No
MBON bit = 0?

Yes

Set CPU standby mode.

END

Figure 20-60 Setting CPU stand-by (from CAN sleep mode)

Caution Before the CPU is set in the CPU standby mode, please check if the CAN
sleep mode has been reached.
However, after check of the CAN sleep mode, until the CPU is set in the CPU
standby mode, the CAN sleep mode may be cancelled by wakeup from CAN
bus.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 855


Chapter 20 CAN Controller (CAN)

START

Set PSMODE0 bit.


Set PSMODE0 bit = 1
Clear PSMODE0 bit = 0

No
PSMODE0 bit = 1?
Clear CINTS5 bit.
Clear CINTS5 bit = 1 Yes

CAN sleep mode

Set PSMODE1 bit.


Set PSMODE1 bit = 1
Clear PSMODE1 bit = 0

No
PSMODE1 bit = 1?

Yes

CAN stop mode

No
MBON bit = 0?

Yes

Set CPU standby mode.

END

Figure 20-61 Setting CPU stand-by (from CAN stop mode)

Caution The CAN stop mode can only be released by writing 01B to the PSMODE[1:0]
bit of the CnCTRL register and not by a change in the CAN bus state.

www.DataSheet4U.com

856 User’s Manual U17566EE5V1UM00


Chapter 21 A/D Converter (ADC)

These microcontrollers contain an n-channel 10-bit A/D Converter.

The V850E/Dx3 microcontrollers feature the following number of analog input


channels:

µPD70F3427, µPD70F3426A, µPD70F3423, µPD70F3422,


ADC
µPD70F3425, µPD70F3424 µPD70F3421
Instances 16 12

Throughout this chapter, the individual channels of the A/D Converter are
identified by “n”, for example ADCR0n for the A/D conversion result register of
channel n.

21.1 Functions

The A/D Converter converts analog input signals into digital values.
The A/D Converter has the following features.
• 10-bit resolution
• Successive approximation method
• The following functions are provided as operation modes.
– Continuous select mode
– Continuous scan mode
• The following functions are provided as trigger modes.
– Software trigger mode
– Timer trigger mode
• Power-fail monitor function (conversion result compare function)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 857


Chapter 21 A/D Converter (ADC)

The block diagram of the A/D Converter is shown below.

AVDD
ADA0CE bit AVREF
ADA0CE bit

ANI0 Sample & hold circuit

Ta p selector
ANI1
ANI2

Selector AVSS
ADA0CE bit
Voltage
ANIn comparator

SAR

SPCLK0 (16 MHz)

INTTZ5UV ADCR00
Controller
ADCR01
INTAD

ADCR0n

ADA0M0 ADA0M1 ADA0M2 ADA0S

Internal bus

Figure 21-1 Block diagram of A/D Converter

www.DataSheet4U.com

858 User’s Manual U17566EE5V1UM00


A/D Converter (ADC) Chapter 21

21.2 Configuration

The A/D Converter includes the following hardware.

Table 21-1 Configuration of A/D Converter


Item Configuration
Analog inputs ANI0 to ANIn pins
Registers Successive approximation register (SAR)
A/D conversion result registers ADCR00 to ADCR0n
A/D conversion result registers ADCR0H0 to ADCR0Hn: only higher 8 bits can be
read
Control registers A/D Converter mode registers 0 to 2 (ADA0M0 to ADA0M2)
A/D Converter channel specification register 0 (ADA0S)

Caution It is mandatory to enable the A/D Converter after any reset and to perform a
first conversion within a time period of maximum 1 s after reset release. With
the execution of the first conversion, the A/D Converter circuit is initialized.
The execution of a first conversion is mandatory independently of whether the
A/D Converter is used later on by the user application.

(1) Successive approximation register (SAR)


The SAR register compares the voltage value of the analog input signal with
the voltage tap (compare voltage) value from the series resistor string, and
holds the comparison result starting from the most significant bit (MSB).
When the comparison result has been held down to the least significant bit
(LSB) (i.e., when A/D conversion is complete), the contents of the SAR register
are transferred to the ADCR0n register.

(2) A/D conversion result register n (ADCR0n), A/D conversion result


register Hn (ADCR0Hn)
The ADCR0n register is a 16-bit register that stores the A/D conversion result.
ADCR0n consist of 16 registers and the A/D conversion result is stored in the
10 higher bits of the ADCR0n register corresponding to analog input. (The
lower 6 bits are fixed to 0.)
The ADCR0n register is read-only, in 16-bit units.
When using only the higher 8 bits of the A/D conversion result, the ADCR0Hn
register is read-only, in 8-bit units.

Caution A write operation to the ADA0M0 and ADA0S registers may cause the contents
www.DataSheet4U.com of the ADCR0n register to become undefined. After the conversion, read the
conversion result before writing to the ADA0M0 and ADA0S registers. Correct
conversion results may not be read if a sequence other than the above is used.

User’s Manual U17566EE5V1UM00 859


Chapter 21 A/D Converter (ADC)

(3) Power-fail compare threshold value register (ADA0PFT)


The ADA0PFT register sets a threshold value that is compared with the value
of A/D conversion result register nH (ADCR0Hn). The 8-bit data set to the
ADA0PFT register is compared with the higher 8 bits of the A/D conversion
result register (ADCR0Hn).
This register can be read or written in 8-bit or 1-bit units.
Reset input clears this register to 00H.

(4) Sample & hold circuit


The sample & hold circuit samples each of the analog input signals selected by
the input circuit and sends the sampled data to the voltage comparator. This
circuit also holds the sampled analog input signal voltage during A/D
conversion.

(5) Voltage comparator


The voltage comparator compares a voltage value that has been sampled and
held with the voltage value of the series resistor string.

(6) Series resistor string


This series resistor string is connected between AVREF and AVSS and generates
a voltage for comparison with the analog input signal.

(7) ANIn pins


These are analog input pins for the 16 A/D Converter channels and are used to
input analog signals to be converted into digital signals. Pins other than the
one selected as the analog input by the ADA0S register can be used as input
port pins.

Caution 1. Make sure that the voltages input to the ANIn pins do not exceed the rated
values. In particular if a voltage of AVREF or higher is input to a channel, the
conversion value of that channel becomes undefined, and the conversion
values of the other channels may also be affected.
2. The analog input pins ANIn function also as input port pins. If any of ANIn is
selected and A/D converted, do not execute an input instruction this ports
during conversion. If executed, the conversion resolution may be degraded.

(8) AVREF pin


This is the pin used to input the reference voltage of the A/D Converter. The
signals input to the ANIn pins are converted to digital signals based on the
voltage applied between the AVREF and AVSS pins.

(9) AVSS pin


This is the ground pin of the A/D Converter. Always make the potential at this
pin the same as that at the VSS pin even when the A/D Converter is not used.

www.DataSheet4U.com

860 User’s Manual U17566EE5V1UM00


A/D Converter (ADC) Chapter 21

21.3 ADC Registers

The A/D Converter is controlled by the following registers:


• ADC mode registers 0, 1, 2 (ADA0M0, ADA0M1, ADA0M2)
• ADC channel specification register 0 (ADA0S)
• Power-fail compare mode register (ADA0PFM)
The following registers are also used:
• A/D conversion result register n (ADCR0n)
• A/D conversion result register nH (ADCR0Hn)
• Power-fail compare threshold value register (ADA0PFT)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 861


Chapter 21 A/D Converter (ADC)

(1) ADA0M0 - ADC mode register 0


The ADA0M0 register is an 8-bit register that specifies the operation mode and
controls conversion operations.
Access This register can be read/written in 8-bit or 1-bit units. However, bit 0 is read-
only.
Address FFFF F200H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
ADA0CE 0 ADA0MD1 ADA0MD0 0 0 ADA0TMD ADA0EF
R/W R/W R/W R/W R/W R/W R/W R

Table 21-2 ADA0M0 register contents


Bit position Bit name Function
7 AD0CE A/D conversion control:
0: Stops conversion
1: Starts conversion
5, 4 ADA0MD[1:0] Specification of A/D conversion operation mode
ADA0MD1 ADA0MD0 A/D conversion operation mode
0 0 Continuous select mode
0 1 Continuous scan mode
others Setting prohibited

1 ADA0TMD Trigger mode specification:


0: Software trigger mode
1: Timer trigger mode
0 ADA0EF A/D converter status display:
0: A/D conversion stopped
1: A/D conversion in progress

Caution 1. If ADA0EF bit (bit 0) is written, this is ignored.


2. Changing the ADA0FR3 to ADA0FR0 bits of the ADA0M1 register during
conversion (ADA0CE0 bit = 1) is prohibited.
3. When the A/D Converter is not used, stop the operation by setting the
ADA0CE bit to 0 to reduce the current consumption.

www.DataSheet4U.com

862 User’s Manual U17566EE5V1UM00


A/D Converter (ADC) Chapter 21

(2) ADA0M1 - ADC mode register 1


The ADA0M1 register is an 8-bit register that controls the conversion time
specification.
Access This register can be read/written in 8-bit or 1-bit units.
Address FFFF F201H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
1 0 0 0 ADA0FR3 ADA0FR2 ADA0FR1 ADA0FR0
R/W R/W R/W R/W R/W R/W R/W R/W

Caution 1. The bit 7 must be changed to “1” after reset and must not be changed
afterwards.
2. Be sure to clear bits 5 and 4 to 0.

Table 21-3 ADA0M1 register contents


Bit position Bit name Function
3 to 0 AD0FR[3:0] A/D conversion time settings, see Table 21-4

Table 21-4 Conversion time settings


Divi-
ADA0FR fSPCLK0 = 16 MHz fSPCLK0 = 4 MHz
der Stabilization
conversion sampling conversion sampling timea
3 2 1 0 div
timeb timec timeb timec
0 0 0 0 1 prohibited 7.75 µs 4.13 µs 16/fSPCLK0
0 0 0 1 2 3.88 µs 2.06 µs 15.50 µs 8.25 µs 31/fSPCLK0
0 0 1 0 3 5.81 µs 3.09 µs prohibited 47/fSPCLK0
0 0 1 1 4 7.75 µs 4.13 µs prohibited 50/fSPCLK0
0 1 0 0 5 9.69 µs 5.16 µs prohibited 50/fSPCLK0
0 1 0 1 6 11.63 µs 6.12 µs prohibited 50/fSPCLK0
0 1 1 0 7 13.56 µs 7.22 µs prohibited 50/fSPCLK0
0 1 1 1 8 15.50 µs 8.25 µs prohibited 50/fSPCLK0
1 x x x prohibited
a)
When A/D conversion is started by ADA0M0.ADA0CE = 0 →1 the first sampling of the ANIn input is de-
layed by the given stabilization time. This ensures compliance with the necessary stabilization time.
The stabilization time applies only prior to the first sampling.
b)
The conversion time is calculated by (31 x div) / fSPCLK0.
c) The sampling time is calculated by (16.5 x div) / fSPCLK0.

www.DataSheet4U.com
Note Note that the given times in Table 21-4 do not regard the dithering of the A/D
converter supply clock. Using a dithering supply clock does not impact the A/D
converter’s operation.

User’s Manual U17566EE5V1UM00 863


Chapter 21 A/D Converter (ADC)

(3) ADA0M2 - ADC mode register 2


The ADA0M2 register specifies the hardware trigger mode.
Access This register can be read/written in 8-bit or 1-bit units.
Address FFFF F203H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 0 0 ADA0TMD1 ADA0TMD0
R/W R/W R/W R/W R/W R/W R/W R/W

Caution Be sure to clear bits 7 to 1.

Table 21-5 ADA0M2 register contents


Bit position Bit name Function
1, 0 ADA0TMD[1:0] Specification of hardware trigger mode
ADA0TMD1 ADA0TMD0 Trigger mode
0 0 No trigger
0 1 INTTZ5UV trigger
others Setting prohibited

www.DataSheet4U.com

864 User’s Manual U17566EE5V1UM00


A/D Converter (ADC) Chapter 21

(4) ADA0S - ADC channel specification register 0


The ADA0S register specifies the pin that inputs the analog voltage to be
converted into a digital signal.
Access This register can be read/written in 8-bit or 1-bit units.
Address FFFF F202H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 ADA0S4 ADA0S3 ADA0S2 ADA0S1 ADA0S0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 21-6 ADA0S register contents


Bit position Bit name Function
4 to 0 ADA0S[4:0] A/D converter channel specification:
ADA0S4 ADA0S3 ADA0S2 ADA0S1 ADA0S0 Select mode Scan mode
0 0 0 0 0 ANI0 ANI0
0 0 0 0 1 ANI1 ANI0, ANI1
0 0 0 1 0 ANI2 ANI0 to ANI2
0 0 0 1 1 ANI3 ANI0 to ANI3
0 0 1 0 0 ANI4 ANI0 to ANI4
0 0 1 0 1 ANI5 ANI0 to ANI5
0 0 1 1 0 ANI6 ANI0 to ANI6
0 0 1 1 1 ANI7 ANI0 to ANI7
0 1 0 0 0 ANI8 ANI0 to ANI8
0 1 0 0 1 ANI9 ANI0 to ANI9
0 1 0 1 0 ANI10 ANI0 to ANI10
0 1 0 1 1 ANI11 ANI0 to ANI11
0 1 1 0 0 ANI12 ANI0 to ANI12
0 1 1 0 1 ANI13 ANI0 to ANI13
0 1 1 1 0 ANI14 ANI0 to ANI14
0 1 1 1 1 ANI15 ANI0 to ANI15
Other than above Setting prohibited

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 865


Chapter 21 A/D Converter (ADC)

(5) ADCR0n, ADCR0Hn - ADC conversion result registers


The ADCR0n and ADCR0Hn registers store the A/D conversion results.
Access These registers are read-only, in 16-bit or 8-bit units. However, specify the
ADCR0n register for 16-bit access and the ADCR0Hn register for 8-bit access.
The 10 bits of the conversion result are read from the higher 10 bits of the
ADCR0n register, and 0 is read from the lower 6 bits. The higher 8 bits of the
conversion result are read from the ADCR0Hn register.

Address
ADCR00: FFFF F210H ADCR0H0: FFFF F211H
ADCR01: FFFF F212H ADCR0H1: FFFF F213H
ADCR02: FFFF F214H ADCR0H2: FFFF F215H
ADCR03: FFFF F216H ADCR0H3: FFFF F217H
ADCR04: FFFF F218H ADCR0H4: FFFF F219H
ADCR05: FFFF F21AH ADCR0H5: FFFF F21BH
ADCR06: FFFF F21CH ADCR0H6: FFFF F21DH
ADCR07: FFFF F21EH ADCR0H7: FFFF F21FH
ADCR08: FFFF F220H ADCR0H8: FFFF F221H
ADCR09: FFFF F222H ADCR0H9: FFFF F223H
ADCR010: FFFF F224H ADCR0H10: FFFF F225H
ADCR011: FFFF F226H ADCR0H11: FFFF F227H
ADCR012: FFFF F228H ADCR0H12: FFFF F229H
ADCR013: FFFF F22AH ADCR0H13: FFFF F22BH
ADCR014: FFFF F22CH ADCR0H14: FFFF F22DH
ADCR015: FFFF F22EH ADCR0H15: FFFF F22FH

Initial Value undefined

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ADCR0n AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0 0 0 0 0 0 0
R R R R R R R R R R R R R R R R

7 6 5 4 3 2 1 0
ADCR0Hn AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2
R R R R R R R R

w w w . D a t a S h e e t 4 U . c o m

866 User’s Manual U17566EE5V1UM00


A/D Converter (ADC) Chapter 21

The relationship between the analog voltage input to the analog input pins
(ANI0 to ANI11) and the A/D conversion result (of A/D conversion result
register n (ADCR0n)) is as follows:
V IN
ADCR0 = INT(------------------ • 1024 + 0,5)
AV REF

or
AV REF AV REF
( ADCR0 – 0,5 ) • ------------------ ≤V IN < ( ADCR0 + 0,5 ) • ------------------
1024 1024

INT( ): Function that returns the integer of the value in ( )


VIN: Analog input voltage
AVREF: AVREF pin voltage
ADCR0: Value of A/D conversion result register n (ADCR0n)

Figure 21-2 shows the relationship between the analog input voltage and the
A/D conversion results.

SAR ADCR0n

1,023 FFC0H

1,022 FF80H

A/D conversion results


1,021 FF40H

3 00C0H

2 0080H

1 0040H

0 0000H
1 1 3 2 5 3 2,043 1,022 2,045 1,023 2,047 1
2,048 1,024 2,048 1,024 2,048 1,024 2,048 1,024 2,048 1,024 2,048

Input voltage/AVREF
www.DataSheet4U.com

Figure 21-2 Relationship between analog input voltage and A/D conversion results

User’s Manual U17566EE5V1UM00 867


Chapter 21 A/D Converter (ADC)

(6) ADA0PFM - ADC power-fail compare mode register


The ADA0PFM register is an 8-bit register that sets the power-fail compare
mode.
Access This register can be read/written in 8-bit or 1-bit units.
Address FFFF F204H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
ADA0PFE ADA0PFC0 0 0 0 0 0 0
R/W R/W R/W R/W R/W R/W R/W R/W

Note In continuous select mode the conversion result of ADC channel ANIn,
selected by ADA0S, is observed.
In continuous scan mode the conversion result of ADC channel ANI0 is
observed.
For further details, refer to “Power-fail compare mode“ on page 873.

(7) ADA0PFT - ADC power-fail compare threshold value register


The ADA0PFT register sets the compare value in the power-fail compare
mode.
Access This register can be read/written in 8-bit or 1-bit units.
Address FFFF F204H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
ADA0PFT7 ADA0PFT6 ADA0PFT5 ADA0PFT4 ADA0PFT3 ADA0PFT2 ADA0PFT1 ADA0PFT0
R/W R/W R/W R/W R/W R/W R/W R/W

www.DataSheet4U.com

868 User’s Manual U17566EE5V1UM00


A/D Converter (ADC) Chapter 21

21.4 Operation

21.4.1 Basic operation

1. Set the operation mode, trigger mode, and conversion time for executing A/
D conversion by using the ADA0M0, ADA0M1, ADA0M2, and ADA0S
registers. When the ADA0CE bit of the ADA0M0 register is set, conversion
is started in the software trigger mode and the A/D Converter waits for a
trigger in the external or timer trigger mode.
2. When A/D conversion is started, the voltage input to the selected analog
input channel is sampled by the sample & hold circuit.
3. When the sample & hold circuit samples the input channel for a specific
time, it enters the hold status, and holds the input analog voltage until A/D
conversion is complete.
4. Set bit 9 of the successive approximation register (SAR). The tap selector
selects (1/2) AVREF as the voltage tap of the series resistor string.
5. The voltage difference between the voltage of the series resistor string and
the analog input voltage is compared by the voltage comparator. If the
analog input voltage is higher than (1/2) AVREF, the MSB of the SAR register
remains set. If it is lower than (1/2) AVREF, the MSB is reset.
6. Next, bit 8 of the SAR register is automatically set and the next comparison
is started. Depending on the value of bit 9, to which a result has been
already set, the voltage tap of the series resistor string is selected as
follows:
–Bit 9 = 1: (3/4) AVREF
–Bit 9 = 0: (1/4) AVREF
This voltage tap and the analog input voltage are compared and, depending
on the result, bit 8 is manipulated as follows.
Analog input voltage ≥ Voltage tap: Bit 8 = 1
Analog input voltage ≤Voltage tap: Bit 8 = 0
7. This comparison is continued to bit 0 of the SAR register.
8. When comparison of the 10 bits is complete, the valid digital result is
stored in the SAR register, which is then transferred to and stored in the
ADCR0n register. At the same time, an A/D conversion end interrupt
request signal (INTAD) is generated.

Conversion time
Sampling time

A/D converter
Sampling A/D conversion
operation

SAR Undefined Conversion


result

ADCR0n Conversion
result

INTAD
www.DataSheet4U.com

Figure 21-3 A/D Converter basic operation

User’s Manual U17566EE5V1UM00 869


Chapter 21 A/D Converter (ADC)

21.4.2 Trigger mode

The timing of starting the conversion operation is specified by setting a trigger


mode. The trigger mode includes a software trigger mode and hardware trigger
modes. The hardware trigger modes include timer trigger modes 0 and 1, and
external trigger mode. The ADA0TMD bit of the ADA0M0 register is used to set
the trigger mode. In timer trigger mode set ADA0M2.ADA0TMD[1:0] = 01.

(1) Software trigger mode


When the ADA0CE bit of the ADA0M0 register is set to 1, the signal of the
analog input pin ANIn specified by the ADA0S register is converted. When
conversion is complete, the result is stored in the ADCR0n register. At the
same time, the A/D conversion end interrupt request signal (INTAD) is
generated.
If the operation mode specified by the ADA0MD1 and ADA0MD0 bits of the
ADA0M0 register is the continuous select/scan mode, the next conversion is
started, unless the ADA0CE bit is cleared to 0 after completion of the first
conversion.
When conversion is started, the ADA0EF bit is set to 1 (indicating that
conversion is in progress).
If the ADA0M0, ADA0M2, ADA0S, ADA0PFM, or ADA0PFT register is written
during conversion, the conversion is aborted and started again from the
beginning.

(2) Timer trigger mode


In this mode, converting the signal of the analog input pin ANIn specified by the
ADA0S register is started by the Timer Z underflow interrupt signal.
Make sure to set ADA0M2.ADA0TMD[1:0] = 01B.

When conversion is completed, the result of the conversion is stored in the


ADCR0n register. At the same time, the A/D conversion end interrupt request
signal (INTAD) is generated, and the A/D Converter waits for the trigger again.
When conversion is started, the ADA0EF bit is set to 1 (indicating that
conversion is in progress). While the A/D Converter is waiting for the trigger,
however, the ADA0EF bit is cleared to 0 (indicating that conversion is stopped).
If the valid trigger is input during the conversion operation, the conversion is
aborted and started again from the beginning.
If the ADA0M0, ADA0M2, ADA0S, ADA0PFM, or ADA0PFT register is written
during conversion, the conversion is stopped and the A/D Converter waits for
the trigger again.

www.DataSheet4U.com

870 User’s Manual U17566EE5V1UM00


A/D Converter (ADC) Chapter 21

21.4.3 Operation modes

Two operation modes are available as the modes in which to set the ANIn
pins: continuous select mode and continuous scan mode.
The operation mode is selected by the ADA0MD1 and ADA0MD0 bits of the
ADA0M0 register.

(1) Continuous select mode


In this mode, the voltage of one analog input pin selected by the ADA0S
register is continuously converted into a digital value.
The conversion result is stored in the ADCR0n register corresponding to the
analog input pin. In this mode, an analog input pin corresponds to an ADCR0n
register on a one-to-one basis. Each time A/D conversion is completed, the A/
D conversion end interrupt request signal (INTAD) is generated. After
completion of conversion, the next conversion is started, unless the ADA0CE
bit of the ADA0M0 register is cleared to 0.

ANI1 Data 3 Data 4 Data 5 Data 6


Data 2
Data 1

Data 1 Data 2 Data 3 Data 4 Data 5 Data 6


A/D conversion (ANI1) (ANI1) (ANI1)
(ANI1) (ANI1) (ANI1)

Data 1 Data 2 Data 3 Data 4 Data 5 Data 6


ADCR01 (ANI1) (ANI1) (ANI1) (ANI1) (ANI1)
(ANI1)

INTAD

Conversion start
set ADA0M0.ADA0CE = 1

Figure 21-4 Timing example of continuous select mode operation (ADA0S = 01H)

(2) Continuous scan mode


In this mode, analog input pins are sequentially selected, from the ANI0 pin to
the pin specified by the ADA0S register, and their values are converted into
digital values.
The result of each conversion is stored in the ADCR0n register corresponding
www.DataSheet4U.com to the analog input pin. When conversion of the analog input pin specified by
the ADA0S register is complete, the A/D conversion end interrupt request
signal (INTAD) is generated, and A/D conversion is started again from the
ANI0 pin, unless the ADA0CE bit of the ADA0M0 register is cleared to 0.

User’s Manual U17566EE5V1UM00 871


Chapter 21 A/D Converter (ADC)

(a) Timing example

ANI0

Data 1 Data 5

ANI1 Data 6
Data 2

Data 7
Data 3
ANI2

ANI3
Data 4

Data 1 Data 2 Data 3 Data 4 Data 5 Data 6 Data 7


A/D conversion
(ANI0) (ANI1) (ANI2) (ANI3) (ANI0) (ANI1) (ANI2)

ADCR0n Data 1 Data 2 Data 3 Data 4 Data 5 Data 6


(ANI0) (ANI1) (ANI2) (ANI3) (ANI0) (ANI1)

INTAD

Conversion start
Set ADA0CE bit = 1

(b) Block diagram

Analog input pin


ADCR0n registers

ANI0 ADCR00
ANI1 ADCR01
ANI2 ADCR02
ANI3 A/D converter ADCR03
ANI4 ADCR04
ANI5 ADCR05
. .
. .
. .
.
ANI15 ADCR015

Figure 21-5
www.DataSheet4U.com Timing example of continuous scan mode operation
(ADA0S register = 03H)

872 User’s Manual U17566EE5V1UM00


A/D Converter (ADC) Chapter 21

21.4.4 Power-fail compare mode

The A/D conversion end interrupt request signal (INTAD) can be controlled as
follows by the ADA0PFM and ADA0PFT registers.
• If the power-fail compare mode is disabled (ADA0PFM.ADA0PFE = 0), the
INTAD signal is generated each time conversion is completed.
• If the power-fail compare mode is enabled (ADA0PFM.ADA0PFE = 1) and
ADA0PFM.ADA0PFC = 0, the value of the ADCR0Hn register is compared
with the value of the ADA0PFT register when conversion is completed, and
the INTAD signal is generated only if ADCR0H0 ≥ ADA0PFT.
• If the power-fail compare mode is enabled (ADA0PFM.ADA0PFE = 1) and
ADA0PFM.ADA0PFC = 1, the value of the ADCR0Hn register is compared
with the value of the ADA0PFT register when conversion is completed, and
the INTAD signal is generated only if ADCR0H0 < ADA0PFT.
In the power-fail compare mode, two modes are available as modes in which to
set the ANIn pins: continuous select mode and continuous scan mode.

(1) Continuous select mode


In this mode, the higher 8 bits of conversion result of the ANIn channel in
ADA0CR0Hn, specified by ADA0S, is compared with the value of the
ADA0PFT register.
If the result of power-fail comparison matches the condition set by the
ADA0PFM.ADA0PFC bit, INTAD is generated.
In any case the next conversion is started.

ANIn

A/D Data 1 Data 2 Data 3 Data 4 Data 5 Data 6


conversion

ADCR0n Data 1 Data 2 Data 3 Data 4 Data 5

INTAD
ADA0PFT ADA0PFT ADA0PFT ADA0PFT ADA0PFT ADA0PFT
unmatch unmatch match match unmatch match

Figure 21-6
www.DataSheet4U.com Timing example of continuous select mode operation whit power-fail
comparison

(2) Continuous scan mode


In this mode, the ADC channels starting from ANI0 to the one specified by the
ADA0S register are sequentially converted and the conversion results are
stored in the ADCR0n registers.

User’s Manual U17566EE5V1UM00 873


Chapter 21 A/D Converter (ADC)

Note In continuous scan mode power-fail comparison is performed only on ANI0.


After each conversion of ANI0, the higher 8 bits of conversion result in
ADA0CR0H0 is compared with the value of the ADA0PFT register.
If the result of power-fail comparison matches the condition set by the
ADA0PFM.ADA0PFC bit, INTAD is generated.
In any case conversion of the remaining ADC channels continuous.
Thus it is possible to catch a snapshot of the other analog inputs ANIn in case
of power-fail.

www.DataSheet4U.com

874 User’s Manual U17566EE5V1UM00


A/D Converter (ADC) Chapter 21

(a) Timing example

ANI0

ANI1

ANI2

ANI3

A/D ANI0 ANI1 ANI2 ANI3 ANI0 ANI1


conversion

ADCR0n ANI3 ANI0 ANI1 ANI2 ANI3 ANI0 ANI1

INTAD
ADA0PFT ADA0PFT
unmatch match

(b) Block diagram

Analog input pin ADCR0n registers

ANI0 ADCR00
ANI1 ADCR01
ANI2 ADCR02
ANI3 A/D converter ADCR03
ANI4 ADCR04
ANI5 ADCR05
. .
. .
. .
.
ANI15 ADCR015

Figure 21-7
www.DataSheet4U.com Timing example of continuous scan mode operation with power-fail
comparison (ADA0S = 03H)

User’s Manual U17566EE5V1UM00 875


Chapter 21 A/D Converter (ADC)

21.5 Cautions

(1) When A/D Converter is not used


When the A/D Converter is not used, the power consumption can be reduced
by clearing the ADA0CE bit of the ADA0M0 register to 0.

(2) Input range of ANIn pins


Input the voltage within the specified range to the ANIn pins. If a voltage equal
to or higher than AVREF or equal to or lower than AVSS (even within the range of
the absolute maximum ratings) is input to any of these pins, the conversion
value of that channel is undefined.

(3) Countermeasures against noise


To maintain the 10-bit resolution, the ANIn pins must be effectively protected
from noise. The influence of noise increases as the output impedance of the
analog input source becomes higher. To lower the noise, connecting an
external capacitor as shown in Figure 21-8 is recommended.

Clamp with a diode with a low VF (0.3 V or less)


if noise equal to or higher than AVREF or equal
to or lower than AVSS may be generated.
VDD
AVREF

ANI0 to ANI15

C = 100 to 1,000 pF

AVSS

VSS

Figure 21-8 Processing of analog input pin

(4) Alternate I/O


The analog input pins ANIn function alternately as port pins. When selecting
one of the ANIn pins to execute A/D conversion, do not execute an instruction
to read an input port or write to an output port during conversion as the
conversion resolution may drop.
If a digital pulse is applied to a pin adjacent to the pin whose input signal is
www.DataSheet4U.com being converted, the A/D conversion value may not be as expected due to the
influence of coupling noise. Therefore, do not apply a pulse to a pin adjacent to
the pin undergoing A/D conversion.

876 User’s Manual U17566EE5V1UM00


A/D Converter (ADC) Chapter 21

(5) Interrupt request flag (ADIF)


The interrupt request flag (ADIF) is not cleared even if the contents of the
ADA0S register are changed. If the analog input pin is changed during A/D
conversion, therefore, the result of converting the previously selected analog
input signal may be stored and the conversion end interrupt request flag may
be set immediately before the ADA0S register is rewritten. If the ADIF flag is
read immediately after the ADA0S register is rewritten, the ADIF flag may be
set even though the A/D conversion of the newly selected analog input pin has
not been completed. When A/D conversion is stopped, clear the ADIF flag
before resuming conversion.

ADA0S rewriting ADA0S rewriting ADIF is set, but ANIm


(ANIn conversion start) (ANIm conversion start) conversion does not end

A/D conversion ANIn ANIn ANIm ANIm

ADCR0n ANIn ANIn ANIm ANIm

INTAD

Figure 21-9 Generation timing of A/D conversion end interrupt request

(6) Reading ADCR0n register


When the ADA0M0 to ADA0M2 or ADA0S register is written, the contents of
the ADCR0n register may be undefined. Read the conversion result after
completion of conversion and before writing to the ADA0M0 to ADA0M2 and
ADA0S registers. The correct conversion result may not be read at a timing
different from the above.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 877


Chapter 21 A/D Converter (ADC)

21.6 How to Read A/D Converter Characteristics Table

This section describes the terms related to the A/D Converter.

(1) Resolution
The minimum analog input voltage that can be recognized, i.e., the ratio of an
analog input voltage to 1 bit of digital output is called 1 LSB (least significant
bit). The ratio of 1 LSB to the full scale is expressed as %FSR (full-scale
range). %FSR is the ratio of a range of convertible analog input voltages
expressed as a percentage, and can be expressed as follows, independently of
the resolution.

1%FSR = (Maximum value of convertible analog input voltage –


Minimum value of convertible analog input voltage)/100
= (AVREF – 0)/100
= AVREF/100

When the resolution is 10 bits, 1 LSB is as follows:

1 LSB = 1/210 = 1/1,024


= 0.098%FSR

The accuracy is determined by the overall error, independently of the


resolution.

(2) Overall error


This is the maximum value of the difference between an actually measured
value and a theoretical value. It is a total of zero-scale error, full-scale error,
linearity error, and a combination of these errors.
The overall error in the characteristics table does not include the quantization
error.

1......1

Ideal line
Digital output

Overall error

www.DataSheet4U.com
0......0
0 AVREF
Analog input

Figure 21-10 Overall error

878 User’s Manual U17566EE5V1UM00


A/D Converter (ADC) Chapter 21

(3) Quantization error


This is an error of ±1/2 LSB that inevitably occurs when an analog value is
converted into a digital value. Because the A/D Converter converts analog
input voltages in a range of ±1/2 LSB into the same digital codes, a
quantization error is unavoidable.
This error is not included in the overall error, zero-scale error, full-scale error,
integral linearity error, or differential linearity error in the characteristics table.

1......1

Digital output

1/2 LSB Quantization error


1/2 LSB

0......0
0 AVREF
Analog input

Figure 21-11 Quantization error

(4) Zero-scale error


This is the difference between the actually measured analog input voltage and
its theoretical value when the digital output changes from 0…000 to 0…001
(1/2 LSB).

111
Digital output (lower 3 bits)

Ideal line
100
Zero-scale error
011

010

001

000
−1 0 1 2 3 AVREF
Analog input (LSB)

www.DataSheet4U.com
Figure 21-12 Zero-scale error

User’s Manual U17566EE5V1UM00 879


Chapter 21 A/D Converter (ADC)

(5) Full-scale error


This is the difference between the actually measured analog input voltage and
its theoretical value when the digital output changes from 1…110 to 0…111
(full scale - 3/2 LSB).

Full-scale error

Digital output (lower 3 bits)


111

110

101

100

000
0 AVREF − 3 AVREF − 2 AVREF − 1 AVREF
Analog input (LSB)

Figure 21-13 Full-scale error

(6) Differential linearity error


Ideally, the width to output a specific code is 1 LSB. This error indicates the
difference between the actually measured value and its theoretical value when
a specific code is output.

1......1

Ideal width of 1 LSB


Digital output

Differential
linearity error

0......0
AVREF
Analog input

Figure 21-14 Differential linearity error


www.DataSheet4U.com

880 User’s Manual U17566EE5V1UM00


A/D Converter (ADC) Chapter 21

(7) Integral linearity error


This error indicates the extent to which the conversion characteristics differ
from the ideal linear relationship. It indicates the maximum value of the
difference between the actually measured value and its theoretical value where
the zero-scale error and full-scale error are 0.

1......1

Ideal line

Digital output

Integral
linearity error
0......0
0 AVREF

Analog input

Figure 21-15 Integral linearity error

(8) Conversion time


This is the time required to obtain a digital output after an analog input voltage
has been assigned.
The conversion time in the characteristics table includes the sampling time.

(9) Sampling time


This is the time for which the analog switch is ON to load an analog voltage to
the sample & hold circuit.

Sampling time
Conversion time

Figure 21-16 Sampling time

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 881


Chapter 21 A/D Converter (ADC)

www.DataSheet4U.com

882 User’s Manual U17566EE5V1UM00


Chapter 22 Stepper Motor Controller/Driver
(Stepper-C/D)

The Stepper Motor Controller/Driver module is comprised of six drivers (k = 1


to 6) for external 360° type meters or for bipolar and unipolar stepper motors.
The V850E/Dx3 microcontrollers have following instances of the Stepper Motor
Controller/Driver:

Stepper-C/D All devices


Instances 1

Throughout this chapter, the individual instances of Stepper-C/D are identified


by “n”, for example MCNTCn0, or MCNTCn1 for the timer mode control
registers.

The Stepper Motor Controller/Driver module can be separated into two sub-
modules. Throughout this chapter, the individual sub-modules are identified by
“m” (m = 0, 1).

22.1 Overview

The Stepper Motor Controller/Driver module generates pulse width modulated


(PWM) output signals. Each driver generates up to four output signals.
Features summary The generated output signals have the following features:
• Pulse width of 8 bits precision
• 1-bit addition function enables an average pulse width precision of 1/2 bit,
resulting in a pseudo 9-bit precision
• PWM frequency up to 32 KHz
• automatic PWM phase shift for reducing fluctuation on power supply and for
reducing the susceptibility to electromagnetic interference

22.1.1 Driver overview

A stepper motor is driven by PWM signals. The PWM signals are generated by
comparing the contents of compare registers with the actual value of a free
running up counter.
The Stepper Motor Controller/Driver module can be separated into two sub-
www.DataSheet4U.com modules - each sub-module contains one counter and assigned compare
registers and control registers. In the following, the two sub-modules are called
Stepper Motor Controller/Driver 0 sub-module and Stepper Motor Controller/
Driver 1 sub-module.

User’s Manual U17566EE5V1UM00 883


Chapter 22 Stepper Motor Controller/Driver (Stepper-C/D)

The following figures show the main components of the Stepper Motor
Controller/Driver 0 sub-module (Figure 22-1) and of the Stepper Motor
Controller/Driver 1 sub-module (Figure 22-2).
The Stepper Motor Controller/Driver 0 sub-module is comprised of 4 drivers
(k = 1 to 4), Stepper Motor Controller/Driver 1 sub-module is comprised of 2
drivers (k = 5 to 6). Each Stepper Motor Controller/Driver sub-module includes
a free running up counter (CNTm). The counter is controlled by a timer mode
control register (MCNTCnm).
Each of the six drivers consists of two compare registers, MCMPnk0 and
MCMPnk1, respectively. Their contents define the pulse widths for the sine and
the cosine side of the meters. The MCMPnk0/MCMPnk1 registers comprise a
master-slave register combination. This allows to re-write the master register
while the slave register is currently used for comparison with the counter
CNTm.
The compare control register MCMPCnk defines whether or not enhanced
pulse width precision by one-bit addition is enabled, and it routes the output
signals to the corresponding output pins (SMk1 to SMk4).

SPCLK1
SPCLK1/2
SPCLK1/4
Prescaler

Selector

SPCLK1/8
SPCLK1 OVF
SPCLK1/16 8-bit free-running counter CNT0
(8 MHz) fMC0
SPCLK1/32
SPCLK1/64 S
Output SM11 (sin1+)
SPCLK1/128 Q Control
1-bit add. SM12 (sin1-)
8-bit compare register MCPMn10 R
circuit
S SM13 (cos1+)
Output
Q Control
1-bit add. SM14 (cos1-)
8-bit compare register MCPMn11 R
circuit
S SM21 (sin2+)
Output
Q Control
1-bit add. SM22 (sin2-)
8-bit compare register MCPMn20 R
circuit
S SM23 (cos2+)
Output
Q
1-bit add. Control SM24 (cos2-)
8-bit compare register MCPMn21 R
circuit
S SM31 (sin3+)
Output
Q
1-bit add. Control SM32 (sin3-)
8-bit compare register MCPMn30 R
circuit
S SM33 (cos3+)
Output
Q Control
1-bit add. SM34 (cos3-)
8-bit compare register MCPMn31 R
circuit
S SM41 (sin4+)
Output
Q Control
1-bit add. SM42 (sin4-)
8-bit compare register MCPMn40 R
circuit
S SM43 (cos4+)
Output
1-bit add. Q Control
8-bit compare register MCPMn41 R SM44 (cos4-)
circuit

Figure 22-1 Stepper Motor Controller/Driver 0 block diagram

www.DataSheet4U.com

884 User’s Manual U17566EE5V1UM00


Stepper Motor Controller/Driver (Stepper-C/D) Chapter 22

SPCLK1
SPCLK1/2
SPCLK1/4

Selector
Prescaler
SPCLK1/8 OVF
SPCLK1 8-bit free-running counter CNT1
(8MHz) SPCLK1/16
fMC1
SPCLK1/32
SPCLK1/64
S Output SM51 (sin5+)
SPCLK1/128 Q
1-bit add. Control SM52 (sin5-)
8-bit compare register MCPMn50 R
circuit
S Output SM53 (cos5+)
Q Control
1-bit add. SM54 (cos5-)
8-bit compare register MCPMn51
circuit
R

S Output SM61 (sin6+)


1-bit add.
Q Control
8-bit compare register MCPMn60 R SM62 (sin6-)
circuit
S Output SM63 (cos6+)
Q
1-bit add. Control SM64 (cos6-)
8-bit compare register MCPMn61 R
circuit

Figure 22-2 Stepper Motor Controller/Driver 1 block diagram

The external signals are listed in the following table.

Table 22-1 Stepper Motor Controller/Driver external connections


Signal Active Reset
I/O Pins Function
name level level
driver signal,
SM[1:6]1 O – L SM11 to SM61
sine side (+)
driver signal,
SM[1:6]2 O – L SM12 to SM62
sine side (–)
driver signal,
SM[1:6]3 O – L SM13 to SM63
cosine side (+)
driver signal,
SM[1:6]4 O – L SM14 to SM64
cosine side (–)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 885


Chapter 22 Stepper Motor Controller/Driver (Stepper-C/D)

22.2 Stepper Motor Controller/Driver Registers

The Stepper Motor Controller/Driver is controlled and operated by means of


the following registers:

Table 22-2 Stepper Motor Controller/Driver registers overview


Register name Shortcut Address
Timer mode control registers MCNTCn0 <base>
MCNTCn1 <base> + 14H
Compare registers MCMPnk0 <base> + 2H, 4H, 6H, 8H,
(k = 1 to 6) 16H, 18H
MCMPnk1 <base> + 3H, 5H, 7H, 9H,
(k = 1 to 6) 17H, 19H
MCMPnkHW <base> + 2H, 4H, 6H, 8H,
(k = 1 to 6) 16H, 18H
Compare control registers MCMPCnk <base> + AH, CH, EH,
(k = 1 to 6) 10H, 1AH, 1CH

The base address of the Stepper Motor Controller/Driver is


<base> = FFFF F5C0H.

www.DataSheet4U.com

886 User’s Manual U17566EE5V1UM00


Stepper Motor Controller/Driver (Stepper-C/D) Chapter 22

(1) MCNTCn0, MCNTCn1 - Timer mode control registers


The 8-bit MCNTCnm registers control the operation of the free running up
counters CNTm.
Access These registers can be read/written in 8-bit or 1-bit units.
Address MCNTCn0: <base>
MCNTCn1: <base> + 14H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
a
CAE 0 FULL PCE 0 SMCL2 SMCL1 SMCL0
R/Wb R R/W R/W R R/W R/W R/W
a)
Bit CAE refers only to register MCNTCn0. In register MCNTCn1, this bit is set to 0.
b) In register MCNTCn1, this bit is read only (R)

Table 22-3 MCNTCnm register contents


Bit position Bit name Function
7 CAEa Stepper Motor Controller/Driver control
0: Stepper Motor Controller/Driver operation is disabled.
1: Stepper Motor Controller/Driver operation is enabled.
This bit switches both Stepper Motor Controller/Driver 0 and Stepper Motor
Controller/Driver 1.
5 FULL Sets the count range of the timer counter
0: count range from 01H to FFH
1: count range from 00H to FFH
The initial start value is 00H in both cases. For the impact of this bit on duty factor
and PWM cycle time, see also “Duty Factor“ on page 892.
4 PCE Timer operation control
0: Timer counter is stopped.
1: Timer counter is enabled.
2 to 0 SMCL[2:0] Sets the timer count clock for the timer counter
SMCL2 SMCL1 SMCL0 Selected timer count clock

0 0 0 SPCLK1

0 0 1 SPCLK1 / 2

0 1 0 SPCLK1 / 4

0 1 1 SPCLK1 / 8

1 0 0 SPCLK1 / 16

1 0 1 SPCLK1 / 32

1 1 0 SPCLK1 / 64

1 1 1 SPCLK1 / 128

a)
Bit CAE refers only to register MCNTCn0. In register MCNTCn1, this bit is set to 0.
www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 887


Chapter 22 Stepper Motor Controller/Driver (Stepper-C/D)

Caution In register MCNTCn0, bits 3 and 6 must be 0.


In register MCNTCn1, bits 3, 6 and 7 must be 0.

Power save mode Before entering any power save mode the Stepper-C/D must be shut down in
preparation advance in order to minimize power consumption.
Apply following sequence to shut down the Stepper-C/D:
1. Stop the counter CNT1 by setting MCNTCn1.PCE = 0.
2. Stop the counter CNT0 by setting MCNTCn0.PCE = 0.
3. Disable the Stepper-C/D operation by setting MCNTCn0.CAE = 0.
Note that the MCNTCn0.PCE and MCNTCn0.CAE bits must not be cleared to
0 by a single write instruction. Perform two write instructions as shown above.

(2) MCMPnk0 - Compare registers for sine side (k = 1 to 6)


The 8-bit MCMPnk0 registers hold the values that define the PWM pulse width
for the sine side of the connected meters.
The contents of the registers are continuously compared to the timer counter
value:
• Registers MCMPn10 to MCMPn40 are compared to CNT0.
• Registers MCMPn50 to MCMPn60 are compared to CNT1.
When the register contents match the timer counter contents, a match signal is
generated. Thus a PWM pulse with a pulse width corresponding to the
MCMPnk0 register contents is output to the sine side of the connected meter.
Access These registers can be read/written in 8-bit units.
Address <base> + 2H, 4H, 6H, 8H, 16H, 18H

Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
sine DATA
R/W

Note 1. New data must only be written to registers MCMPnk0 if the corresponding
bit MCMPCnk.TEN = 0.
2. Don't write to the compare register MCMPnk0, until the corresponding bit
MCMPCnk.TEN has been reset to 0 automatically.
3. To enable master-to-slave register copy upon next CNTm overflow set
MCMPCnk.TEN = 1.

www.DataSheet4U.com

888 User’s Manual U17566EE5V1UM00


Stepper Motor Controller/Driver (Stepper-C/D) Chapter 22

(3) MCMPnk1 - Compare registers for cosine side (k = 1 to 6)


The 8-bit MCMPnk1 registers hold the values that define the PWM pulse width
for the cosine side of the connected meters.
The contents of the registers are continuously compared to the timer counter
value:
• Registers MCMPn11 to MCMPn41 are compared to CNT0.
• Registers MCMPn51 to MCMPn61 are compared to CNT1.
When the register contents match the timer counter contents, a match signal is
generated. Thus a PWM pulse with a pulse width corresponding to the
MCMPnk1 register contents is output to the sine side of the connected meter.
Access These registers can be read/written in 8-bit units.
Address <base> + 3H, 5H, 7H, 9H, 17H, 19H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
cosine DATA
R/W

Note 1. New data must only be written to registers MCMPnk1 if the corresponding
bit MCMPCnk.TEN = 0.
2. Don't write to the compare register MCMPnk1, until the corresponding bit
MCMPCnk.TEN has been reset to 0 automatically.
3. To enable master-to-slave register copy upon next CNTm overflow set
MCMPCnk.TEN = 1.

(4) MCMPnkHW - Combined compare registers (k = 1 to 6)


The 16-bit MCPMnkHW registers combine the sine and cosine registers
MCMPnk0 and MCMPnk1. Via these registers it is possible to read or write the
contents of MCMPnk0 and MCMPnk1 in a single instruction.
Access These registers can be read/written in 16-bit units.
Address <base> + 2H, 4H, 6H, 8H, 16H, 18H
Initial Value 0000H. This register is cleared by any reset.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
cosine DATA sine DATA
R/W

Note 1. New data must only be written to registers MCMPnk1 if the corresponding
bit MCMPCnk.TEN = 0.
2. Don't write to the compare register MCMPnk1, until the corresponding bit
MCMPCnk.TEN has been reset to 0 automatically.
www.DataSheet4U.com 3. To enable master-to-slave register copy upon next CNTm overflow set
MCMPCnk.TEN = 1.

User’s Manual U17566EE5V1UM00 889


Chapter 22 Stepper Motor Controller/Driver (Stepper-C/D)

(5) MCMPCnk - Compare control registers (k = 1 to 6)


The 8-bit MCMPCnk registers control the operation of the corresponding
compare registers and the output direction of the PWM pin.
Access These registers can be read/written in 8-bit units.
Address <base> + AH, CH, EH, 10H, 1AH, 1CH
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
a b
AOUT 0 0 TEN ADB1 ADB0 DIR1 DIR0
R/W R/W R R/W R/W R/W R/W R/W
a)
Do not change this bit.
b)
This bit may be written, but writing is ignored.

Table 22-4 MCMPCnk register contents


Bit position Bit name Function
7 AOUT Selects the output pins for sine and cosine signals
0: The PWM signals for sine and cosine side are output to those pins that are
selected by bits DIR0 and DIR1. At all other pins, the output signal is 0 (SMVSS
level).
1: The PWM signal for the sine side is output to pins SMk1 and SMk2. The PWM
signal for the cosine side is output to pins SMk3 and SMk4.
4 TEN Transfer enable control bit
0: MCMPnk0/MCMPnk1 master-to-slave register copy is disabled. New data can
be written to compare registers MCMPnk0 or MCMPnk1.
1: MCMPnk0/MCMPnk1 master-to-slave register copy is enabled. The copy
process will take place when CNT0 or CNT1, respectively, overflows. Don't
write to compare registers MCMPnk0 or MCMPnk1 while MCMPCnk.TEN = 1.
Note: This bit functions as a control bit and status flag. It is automatically reset to
zero upon the next timer counter overflow.
3 ADB1 Sets 1-bit addition function for cosine side
0: no 1-bit addition to PWM signal
1: 1-bit addition to PWM signal
2 ADB0 Sets 1-bit addition function for sine side
0: no 1-bit addition to PWM signal
1: 1-bit addition to PWM signal
1 to 0 DIR[1:0] Selects the output pins for the PWM signals.
Bits DIR1 and DIR0 address the quadrant to be activated by sine and cosine. The
PWM signal is routed to the specific pin with respect to the sin/cos of each
quadrant.
DIR1 DIR0 Selected output pins

0 0 Quadrant 1: SMk1 (sin +), SMk3 (cos +)

0 1 Quadrant 2: SMk1 (sin +), SMk4 (cos –)

1 0 Quadrant 3: SMk2 (sin –), SMk4 (cos –)

1 1 Quadrant 4: SMk2 (sin –), SMk3 (cos +)


www.DataSheet4U.com
At the other output pins, the output level is SMVSS.
Note: These bits are only considered if bit AOUT is set to 0.

890 User’s Manual U17566EE5V1UM00


Stepper Motor Controller/Driver (Stepper-C/D) Chapter 22

22.3 Operation

In the following, the operation of the Stepper Motor Controller/Driver module as


a driver for external meters is described.

22.3.1 Stepper Motor Controller/Driver operation

This section describes the generation of PWM signals of the driver k for driving
external meters. Further, the achievable duty factor is explained and how
advanced precision can be gained by 1-bit addition.

(1) Driving Meters


External meters can be driven both in H-bridge configuration and in half bridge
configuration:
• Driving meters in H-bridge configuration
Deflection of the needle of a meter in H-bridge configuration is determined
by the sine and cosine value of its desired angle. Since the PWM signals do
not inherit a sign, separate signals for positive and negative sine and cosine
values are generated.
The four signals at pins SMk1 to SMk4 of the driver k are:
– sine side, positive (sin +)
– sine side, negative (sin –)
– cosine side, positive (cos +)
– cosine side, negative (cos –)
Two output control circuits select which signal (sign) for sine side and cosine
side is output (bits MCMPCnk.DIR[1:0]). At the remaining two output pins,
the signal is set to low level.
To drive meter k in full bridge mode, set bit MCMPCnk.AOUT to 0.
• Driving meters in half bridge configuration
In this mode, the same signal is sent to both sine pins (SMk1 and SMk2)
and both cosine pins (SMk3 and SMk4), respectively. The setting of output
control bits MCMPCnk.DIR[1:0] is neglected.
To drive meter k in half bridge mode, set bit MCMPCnk.AOUT to 1.

(2) Generation of PWM signals


Bit data corresponding to the length of the PWM pulses has to be written to the
compare registers MCMPnk0 (sine side) and MCMPnk1 (cosine side).
A timer counter is counting up. The rising edge of the PWM pulse is initiated at
the overflow of the counter. The falling edge of the PWM pulse is initiated when
the counter value equals the contents of the compare register.
The absolute pulse length in seconds is defined by the timer count clock (fMC0
and fMC1, respectively). Various cycle times can be set via the timer mode
www.DataSheet4U.com control registers MCNTCn0 and MCNTCn1.

User’s Manual U17566EE5V1UM00 891


Chapter 22 Stepper Motor Controller/Driver (Stepper-C/D)

Instruction When writing data to compare registers, proceed as follows:


1. Confirm that MCMPCnk.TEN = 0.
2. Write 8-bit PWM data to MCMPnk0 and MCMPnk1.
3. Set MCMPCnk.ADB0 and MCMPCnk.ADB1 as desired.
4. Set MCMPCnk.TEN = 1 to start the counting operation.
The data in MCMPnk0/MCMPnk1 will automatically be copied to the
compare slave register when the counter overflows. The new pulse width is
valid immediately.
Bit MCMPCnk.TEN is automatically cleared to 0 by hardware.

(3) Duty Factor


The minimum pulse width that can be generated is zero (output signal is low)
and the maximum pulse width is 255 clock cycles (maximum value of 8-bit
compare registers).
The count range of the timer counter defines the duty factor. It can be set by bit
MCNTCnm.FULL:
• count range 01H to FFH (MCNTCnm.FULL = 0)
Formula for the duty cycle:
PWM duty = MCMPki / 255 with k = 1 to 6 and i = 0, 1
One count cycle is comprised of 255 clock cycles. A PWM signal with
maximum pulse length is a steady high level signal. The duty factor is 100%.
• count range 00H to FFH (MCNTCnm.FULL = 1)
Formula for the duty cycle:
PWM duty = MCMPki / 256 with k = 1 to 6 and i = 0, 1
One count cycle is comprised of 256 clock cycles. A PWM signal with
maximum pulse length is comprised of 255 clock cycles at high level and
one clock cycle at low level. The duty factor is 255/256 *100% = 99.6%.

(4) Advanced precision by 1-bit addition


The precision of the angle of a needle is implicitly defined by the number of bits
of the compare registers MCMPnk0 and MCMPnk1 (8 bit).
If the 1-bit addition circuit is enabled, every second pulse of the PWM signal is
extended by one bit (one clock cycle). In average, a pulse width precision of
1/2 bit (1/2 clock) can be achieved.
The following figures show the timing of PWM output signals with 1-bit addition
disabled and enabled.

Note 1. The PWM pulse is not generated until the first overflow occurs after the
counting operation has been started.
2. The PWM signal is two cycle counts delayed compared to the overflow
signal and the match signal. This is not depicted in the figures.
www.DataSheet4U.com

892 User’s Manual U17566EE5V1UM00


Stepper Motor Controller/Driver (Stepper-C/D) Chapter 22

FFH

MCMPnkm value N

CNTm 00H

OVF (overflow)

Match signal

PWM output

(1) (2) (3) (2) (3) (2) (3) (2)

Figure 22-3 Output timing without 1-bit addition

FFH

N+1
MCMPnkm value N

CNTm 00H

OVF (overflow)

Match signal

PWM output
one bit is added
ADB0 / ADB1

(1) (2) (3) (2) (3) (2) (3) (2)

Figure 22-4 Output timing with 1-bit addition

Sequence 1. Start of counting (MCNTCnm.PCE is set to 1)


2. Generation of overflow signal (start of PWM pulse)
3. Generation of match signal (timer counter CNTm matches compare
register, end of PWM pulse)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 893


Chapter 22 Stepper Motor Controller/Driver (Stepper-C/D)

22.4 Timing

This section starts with the timing of the timer counter and general output
timing behaviour. Then, examples of output signal generation with and without
1-bit addition are presented.

22.4.1 Timer counter

The free running up counter is clocked by the timer count clock selected in
register MCNTCnm.
The counting operation is enabled or disabled by the MCNTCnm.PCE bit.

CLK

CNTm 0H 1H 2H 7H 8H 00H 1H 2H 3H 4H

PCE

Count Start Count Stop Count Start

Figure 22-5 Restart Timing after Count Stop (Count Start—Count Stop—Count Start)

Sequence • Count Start:


– Enable counting operation (MCNTCnm.PCE = 1)
– Timer counter starts with value 00H. Depending on bit MCNTCnm.FULL,
all following counter cycles start with 00H or 01H, respectively.
• Count Stop:
– Disable counting operation (MCNTCnm.PCE = 0)
– Counting is stopped and timer counter is set to 00H.

www.DataSheet4U.com

894 User’s Manual U17566EE5V1UM00


Stepper Motor Controller/Driver (Stepper-C/D) Chapter 22

22.4.2 Automatic PWM phase shift

Simultaneous switching of sine and cosine output could lead to a fluctuation of


the power supply and increase the susceptibility to electromagnetic
interference. To prevent this for drivers 1 to 4, the output signals are
automatically shifted by one timer count clock cycle defined in MCNTCn0.
The same accounts for the output signals of drivers 5 and 6. They are
controlled by the timer count clock defined in MCNTCn1.

CNT0

Driver 1 sin (SM11, SM12)

Driver 1 cos (SM13, SM14)

Driver 2 sin (SM21, SM22)

Driver 2 cos (SM23, SM24)

Driver 3 sin (SM31, SM32)

Driver 3 cos (SM33, SM34)

Driver 4 sin (SM41, SM42)

Driver 4 cos (SM43, SM44)

Figure 22-6 Output timing of signals SM11 to SM44

CNT1

Driver 5 sin (SM51, SM52)

Driver 5 cos (SM53, SM54)

Driver 6 sin (SM61, SM62)

Driver 6 cos (SM63, SM64)

Figure 22-7 Output timing of signals SM51 to SM64


www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 895


Chapter 22 Stepper Motor Controller/Driver (Stepper-C/D)

www.DataSheet4U.com

896 User’s Manual U17566EE5V1UM00


Chapter 23 LCD Controller/Driver (LCD-C/D)

Only the µPD70F3421, µPD70F3422, and µPD70F3423 microcontrollers are


provided with the LCD Controller/Driver.
This LCD Controller/Driver is suitable for LC displays with up to 160 segments.
The supported addressing method of the LCD is multiplex addressing.

23.1 Overview

The LCD Controller/Driver generates the signals that are necessary for driving
an LCD panel.
Features summary The LCD Controller/Driver provides:
• Maximum of 40 segment signal outputs (SEG0 to SEG39)
• 4 common signal outputs (COM0 to COM3)
• Display mode: 1/4 duty (1/3 bias)
• Wide range of selectable frame frequencies
• Edge enhancement

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 897


Chapter 23 LCD Controller/Driver (LCD-C/D)

23.1.1 Description

The following figure shows the main components of the LCD Controller/Driver:

LCD Clock Selection

LCD Frame Frequency Selection LCDCLK

Selector
fLCD0
Prescaler SPCLK7 (125 KHz)
Internal Bus

fLCD0 fLCD0 fLCD0 fLCD0 SPCLK9 (31.25 KHz)


6
9
2 28 27 2
Display
Data Memory fLCD1
Timing Controller Selector

Segment
Data Selector
LCD Drive
Voltage Generator

Segment Driver Common Driver

SEG0 ... ... SEG20 ... ... SEG39 COM0 COM1 COM2 COM3
SEG10 SEG30

Figure 23-1 LCD Controller/Driver block diagram

The pattern that is to be displayed on the LCD panel has to be mapped to bit
data. The bit data is stored in the display control registers SEGREGk
(k = 0 to 39). The LCD Controller/Driver generates the corresponding output
signals for driving the LCD panel.
The update rate of the LC display is determined by the frame frequency. It can
be adjusted via the clock control register LCDC.
The external signals are listed in the following table.

Table 23-1 LCD Controller/Driver external connections


Signal name I/O Pins Function
SEG[0:39] O SEG0 to SEG39 Segment signals
COM[0:3] O COM0 to COM3 Common signals

www.DataSheet4U.com

898 User’s Manual U17566EE5V1UM00


LCD Controller/Driver (LCD-C/D) Chapter 23

23.1.2 LCD panel addressing

Each individual segment of an LCD panel is addressed by a signal pair: a


segment signal and a common signal. The segment becomes visible when the
potential difference of the corresponding common signal and the segment
signal reaches or exceeds the LCD drive voltage VLCD.
Example Figure 23-2 shows how the eight LCD segments of a digit are allocated to
• two segment signals (SEG2n and SEG2n+1, n = 0 to 19)
• four common signals

SEG 2n

COM0 COM1

COM2

COM3

SEG 2n + 1

Figure 23-2 Allocation of segment signals and common signals to LCD segments
(4-time-division)

Every combination of a segment and a common signal addresses a single


element. The middle horizontal bar, for example, becomes visible if the
potential difference of signals SEG2n+1 and COM1 exceeds VLCD.

To display a desired pattern on the LCD panel:


1. Check what combination of segment and common signals form the desired
display pattern.
2. Write bit data with the pattern to be displayed to registers SEGREGk.
The LCD Controller/Driver generates the corresponding segment and common
signals.
See also the “Display Example“ on page 906.
Connections At the LCD panel, the signals are connected as follows:

Table 23-2 Signals and connections of LCD Controller/Driver


Signals Connection at LCD panel
segment signals front surface electrodes
common signals rear surface electrodes

www.DataSheet4U.com
Caution The LCD panel is driven by AC voltage. The performance of the LCD
deteriorates if DC voltage is applied in the common and segment signals. That
means contrast and brightness of the display may decrease. The display may
even be damaged.

User’s Manual U17566EE5V1UM00 899


Chapter 23 LCD Controller/Driver (LCD-C/D)

23.2 LCD-C/D Registers

The LCD Controller/Driver is controlled by means of the following registers:

Table 23-3 LCD Controller/Driver registers overview


Register name Shortcut Address
LCD clock control register LCDC0 FFFF FB00H
LCD mode control register LCDM0 FFFF FB01H
LCD display control registers SEGREG0k, FFFF FB20H to
k= 0 to 39 FFFF FB47H

www.DataSheet4U.com

900 User’s Manual U17566EE5V1UM00


LCD Controller/Driver (LCD-C/D) Chapter 23

(1) LCDC0 - LCD clock control register


The 8-bit LCDC0 register determines the duty cycle frequency fLCD1.

Access This register can be read/written in 8-bit or 1-bit units.


Address FFFF FB00H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 LCDC03 LCDC02 LCDC01 LCDC00
R R R R/W R/W R/W R/W R/W

Table 23-4 LCDC0 register contents


Bit Position Bit Name Function
3 to 2 LCDC0[3:2] Selects the LCD clock
LCDC03 LCDC02 Selected LCD clock (fLCD0)

0 0 LCDCLK

0 1 SPCLK7

1 0 SPCLK9

1 1 reserved

1 to 0 LCDC0[1:0] Selects the duty cycle frequency


LCDC01 LCDC00 Selected duty cycle frequency (fLCD1)

0 0 LCD clock (fLCD0) divided by 26

0 1 LCD clock (fLCD0) divided by 27

1 0 LCD clock (fLCD0) divided by 28

1 1 LCD clock (fLCD0) divided by 29

Caution 1. Bit 4 must always be 0.


2. Changing the root clock source for LCDLCK will also change the Watch
Timer clock WTCLK. For details refer to the “TCC - Watch Timer clock
control register“ on page 163.

Note The frequency of LCDCLK is determined in the Clock Generator.


The root clock for LCDCLK can be selected from the main, sub, or internal
oscillator. It can be identical with the clock source or it can be a fraction thereof.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 901


Chapter 23 LCD Controller/Driver (LCD-C/D)

Possible frame Table 23-5 lists the possible frame frequencies. The values in Table 23-5 are
frequencies only examples. Check “Clock Generator“ on page 139 for details.
Selection of the following LCD clocks is provided:

• LCDC0.LCDC0[3:2] = 00B
LCD clock (fLCD0) = LCDCLK = f0 / d, with
– f0 = root clock for LCDCLK
can be selected from main oscillator ((fMOCLK = 4 MHz), sub oscillator
(fSOCLK = 32.768 KHz), or internal oscillator (fROCLK ~ 240 KHz).
– d = divider
LCDCLK is gained by dividing the root clock by d. Divider d can be
selected from 20 to 27.
For details refer to the “TCC - Watch Timer clock control register“ on
page 163.

• LCDC0.LCDC0[3:2] = 01B
LCD clock (fLCD0) = SPCLK7 = SPCLK0 / 27 = 125 KHz

• LCDC0.LCDC0[3:2] = 10B
LCD clock (fLCD0) = SPCLK9 = SPCLK0 / 29 = 31.25 KHz

Table 23-5 Example settings for frame frequency and duty cycle
Duty cycle Frame
LCDC03 LCDC02 LCDC01 LCDC00 LCD clock (fLCD0)a frequency (fLCD1) frequency
0 1 0 1 SPCLK7 = 125 KHz 977 Hz 244 Hz
0 1 1 0 488 Hz 122 Hz
0 1 1 1 244 Hz 61 Hz
1 0 0 0 SPCLK9 = 31.25 KHz 488 Hz 122 Hz
1 0 0 1 244 Hz 61 Hz
0 0 0 0 LCDCLK = 32.768 KHz 512 Hz 128 Hz
0 0 0 1 (with f0 = fSOCLK and d = 20) 256 Hz 64 Hz
0 0 0 1 LCDCLK ~ 120 KHz ~938 Hz ~234 Hz
0 0 1 0 (with f0 = fROCLK and d = 21) ~469 Hz ~117 Hz
a)
The frequency of the LCD clock (fLCD0) is determined bv the setting of the Clock Generator. For details refer
to the “Clock Generator“ on page 139.

w w w . D a t a S h e e t 4 U . c o m

902 User’s Manual U17566EE5V1UM00


LCD Controller/Driver (LCD-C/D) Chapter 23

(2) LCDM0 - LCD mode control register


The 8-bit LCDM0 register enables/disables the LCD operation, activates edge
enhancement and selects the power supply.
Access This register can be read/written in 8-bit or 1-bit units.
Address FFFF FB01H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
LCDON0 0 0 LIPS0 0 0 0 0
R/W R/W R/W R/W R/W R/W R/W R/W

Table 23-6 LCDM0 register contents


Bit position Bit name Function
7 LCDON0 Enables/disables LCD display
0: Display disabled
No segment of the display is visible. The contents of the SEGREG0k
registers are disregarded. The output is at non-selection level.
1: Display enabled
4 LIPS0 Selects the power supply
0: LCD Controller/Driver is not powered
1: LCD Controller/Driver is powered

Caution Bits 0, 1, 2, 3, 5, 6 must always be 0.

(3) SEGREG0k - LCD display control register (k = 0 to 39)


The 8-bit registers contain the data that is displayed on the LCD. Each register
contains the data for one of the 40 segments.
Access These registers can be read/written in 8-bit or 1-bit units.
Address FFFF FB20H to FFFF FB47H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 DATA
R/W

Table 23-7 SEGREG0k register contents (k = 0 to 39)


Bit position Bit name Function
3 to 0 SEGREG0k[3:0] Status of the LCD segment that is controlled by segment signal k and the
common signal, that corresponds to the bit position.
www.DataSheet4U.com 0: Display off
1: Display on, if corresponding common signal is active

The bits 4 to 7 are ignored. They should be set to zero.

User’s Manual U17566EE5V1UM00 903


Chapter 23 LCD Controller/Driver (LCD-C/D)

23.3 Operation

The following describes the timing of common and segment signals, the
activation of an LCD segment and how edge enhancement can be applied.

23.3.1 Common signals and segment signals

This section describes the timing of common signals and segment signals and
at which conditions an individual LCD segment becomes visible.

(1) Common Signals


Common signals COM0 to COM3 are generated internally. Together with the
segment signals, they define which LCD segment is activated in the current
cycle.
Figure 23-3 shows the common signal wave form for COM0, 1/4 duty (1/3
bias). 1/4 duty means each signal COMn is in selection level for one quarter of
a frame.

V LC0
COM0 V LC1
V LCD
(Divided by 4) V LC2
V SS1

TF = 4 x T

Figure 23-3 Common signal wave form (1/4 duty, 1/3 bias)

• TF = frame cycle time.


TF = 4 x T
T corresponds to the duty cycle frequency fLCD1 and is thus determined by
register LCDC.
• T = duty cycle time.
Each frame cycle TF is comprised of 4 duty cycles (1/4 duty), one duty cycle
for each signal COMn.
Each LCD segment is allocated to one of the common signals. The LCD
segment can only be activated in a duty cycle, in which the common signal is
at selection level.
Figure 23-4 shows the selection and non-selection level of common signals.

Selected Not selected


VLC0
VLC1
Common signal VLCD
VLC2
VSS1
www.DataSheet4U.com
T T

Figure 23-4 Selection level and non-selection level of common signals

T = duty cycle time.

904 User’s Manual U17566EE5V1UM00


LCD Controller/Driver (LCD-C/D) Chapter 23

(2) Segment Signals


Segment signals correspond to the contents of the 40 LCD display control
registers SEGREG0k. Bits 0 to 3 of these registers are read in synchronization
with the common signals COM0 to COM3, this means bit 0 is read in
synchronization with common signal COM0 and so on.
• If the value of the bit is 1 while the common signal is at selection level, the
corresponding segment signal is set to selection level.
• If the value of the bit is 0 while the common signal is at selection level, the
corresponding segment signal is set to non-selection level.
Figure 23-5 shows the selection and non-selection level of segment signals.

VLC0
VLC1
Segment signal VLCD
VLC2
VSS1

T T

Figure 23-5 Selection level and non-selection level of segment signals

T = duty cycle time.

The table below shows the relation of the bits in registers SEGREG0k (k = 0 to
39) with common signals COM0 to COM3 and segment output signals SEG00
to SEG39.

7 6 5 4 3 2 1 0
SEGREG00 → SEG0
0
SEGREG00 → SEG1
1
SEGREG00 → SEG2
2
• • •
• • •
• • •
SEGREG03 → SEG38
8
SEGREG03 → SEG39
9
↑ ↑ ↑ ↑
COM3 COM2 COM1 COM0

www.DataSheet4U.com Each of the bits 0 to 4 represents the status of one LCD segment. Setting the
bit to 1 will make the LCD segment visible.
For example, setting bit SEGREG02[3] to 1 will make the LCD segment visible,
that is controlled by the signal pair SEG2 and COM3.

User’s Manual U17566EE5V1UM00 905


Chapter 23 LCD Controller/Driver (LCD-C/D)

23.3.2 Activation of LCD segments

An LCD segment becomes visible when the potential difference of the


corresponding common signal and segment signal reaches or exceeds the
LCD drive voltage VLCD. This is achieved if common and segment signal are at
their selection levels.
Within one frame cycle TF , each LCD segment can be activated once.
Activation lasts for one duty cycle T. LCD segments corresponding to common
signals COM0 to COM3 are not activated simultaneously, but consecutively.

23.4 Display Example

As a display example, register contents and output signals for a 20-digit LCD
display are presented in this section.

(1) LCD panel


The display pattern of a single digit is given below. Each digit is addressed by
two segment signals and four common signals.

SEG 2n

COM0 COM1

COM2

COM3

SEG 2n + 1

Figure 23-6 4-time-division LCD pattern and electrode connections

Figure 23-7 on page 908 shows the whole LCD panel and its connection to the
segment signals and common signals. The display example is
“123456.78901234567890,” and the register contents of SEGREG0k (k = 0 to
39) correspond to this.
An explanation is given here taking the example of the 6th digit with point: “6.”.
The corresponding segment signals are output to pins SEG28 and SEG29 with
the selection levels at the COM0 to COM3 common signal timings as shown in
the table below:

Table 23-8 Selection and non-selection levels of example


www.DataSheet4U.com
Common signal Segment signal SEG28 Segment signal SEG29
COM0 selected selected
COM1 not selected selected
COM2 selected selected
COM3 selected selected

906 User’s Manual U17566EE5V1UM00


LCD Controller/Driver (LCD-C/D) Chapter 23

From this, it can be seen that 1101B must be prepared in the display control
register SEGREG028 and 1111B must be prepared in SEGREG029.
Examples of the LCD drive waveforms between SEG28 and the COM0 and
COM1 signals are shown in Figure 23-8 on page 909 (for the sake of simplicity,
waveforms for COM2 and COM3 have been omitted).
When SEG28 is at the selection level at the COM0 selection timing, it can be
seen that the +VLCD/–VLCD AC square wave, which is the LCD illumination
(ON) level, is generated.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 907


Chapter 23 LCD Controller/Driver (LCD-C/D)

COM3

Timing strobes
COM2
COM1
COM0

BIT0
BIT1
BIT2
BIT3
SEG0

1
1
1
0
SEGREG000
SEG1

1
0
1
1
SEG2

1
1
1
0
SEG3

1
1
0
0
SEG4

1
1
1
0
SEG5
1
1
1
1
1 SEG6
1
1
0
SEG7
1
0
0
0
SEG8
1
0
1
0 SEG9
1
1
1
1
SEG10
1
0
1
0

SEG11
0 1
1 1
1 0
0 1

SEG12
Timing strobes

SEG13
1
1
0
0

SEG14
1
1
1
0

SEG15
0
1
0
1

SEG16
0 1
0 1 1 1
0 1 1 0
1 0

LCD panel
SEG17
SEG18
0 0

0 0

SEG19
SEG20
1
1
1
0

SEG21
1

1
1
0

SEG22
1
1
1

SEG23
0
1
1

SEG24
1 1
1 1
1 1
1 0

SEG25
SEG26
1
1
1

SEG27
1

1 1 0
1 0 0

1 1 0

SEG28
1 1

SEG29
SEG30
0
1 1
1 0
0 1

SEG31
1

SEG32
1
1
0
1 0

SEG33
1 0
1 1

0 0

SEG34
1

SEG35
0
1
0
0 1

SEG36
1
0
0 1

SEG37
1 1
1 1

0 1

SEG38
0

www.DataSheet4U.com SEG39
SEGREG039
0
0
0
0

Figure 23-7 4-time-division LCD panel connection example

908 User’s Manual U17566EE5V1UM00


LCD Controller/Driver (LCD-C/D) Chapter 23

TF

VLC0
VLC1
COM0
VLC2
VSS1

VLC0
VLC1
COM1
VLC2
VSS1

VLC0
VLC1
COM2
VLC2
VSS1

VLC0
VLC1
COM3
VLC2
VSS1

VLC0
VLC1
SEG28
VLC2
VSS1

+VLCD

+1/3VLCD
COM0-SEG28 0
–1/3VLCD

–VLCD

+VLCD

+1/3VLCD
COM1-SEG28 0
–1/3VLCD

www.DataSheet4U.com –VLCD

Figure 23-8 4-time-division LCD drive waveforms – examples

User’s Manual U17566EE5V1UM00 909


Chapter 23 LCD Controller/Driver (LCD-C/D)

www.DataSheet4U.com

910 User’s Manual U17566EE5V1UM00


Chapter 24 LCD Bus Interface (LCD-I/F)

The LCD Bus Interface connects the internal peripheral bus to an external LCD
controller. It provides an asynchronous 8-bit parallel data bus and two control
lines.
The LCD Bus Interface supports bidirectional communication. You can send
data to and query data from the LCD controller.
Only the µPD70F3424, µPD70F3425, µPD70F3426A and µPD70F3427
microcontrollers are provided with the LCD Bus Interface.

24.1 Overview

The LCD Bus Interface transmits or receives data bytes. Two control lines
specify the read/write timing and the transfer direction.
The LCD Bus Interface suits LCD controllers that feature automatic generation
of display memory addresses. The interface does not generate or interpret
specific signals that may be required by the LCD controller, like address, chip
select, hold, and so on. If necessary, such signals can be provided by general
purpose I/Os.
Features summary The LCD Bus Interface provides:
• Support of two different control signals modes:
– mod80 with separate read and write strobe
– mod68 with read/write signal and data strobe “E” with selectable level
• DMA for read and write operations
• 8/16/32-bit write and read operations
• Programmable transfer speed (100 KHz … 3.2 MHz) through
– selectable clock input
– programmable transfer time
– programmable wait states
• Interrupt generation selectable upon two events
– internal data transfer allowed
– external bus access completed
• Flags that indicate the status of the data register and the progress of data
transfer to or from the LCD controller

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 911


Chapter 24 LCD Bus Interface (LCD-I/F)

Note 1. The programmer has to make sure that the timing requirements of the
external LCD controller are met.
2. For electrical characteristics please refer to the Data Sheet.
3. If the concerned pins are configured as LCD Bus Interface pins change
between input and output is performed automatically by LCD Bus Interface
read and write operations. Refer also to “Port group 9“ on page 86.

24.1.1 Description

Data can be read from and written to the LCD Bus Interface by either involving
the DMA Controller or by directly accessing the interface from the CPU. The
timing of the external bus signals is determined by register settings (WST and
CYC).
The LCD Bus Interface is 8 bits wide. In order to improve performance, the
interface is equipped with a 32-bit register that allows the CPU or DMA to
access the data register with 8-, 16-, or 32-bit data accesses. The interface
automatically generates 1, 2, or 4 consecutive (8-bit) accesses on the external
bus.
The LCD Bus Interface has an internal 32-bit write buffer that allows the next
data to be written to the data register (LBDATA0) while a transfer on the
external bus interface is in progress.
The following figure shows the main components of the LCD Bus Interface.

Internal bus

LBCTL0 LBCYC0 LBWST0 LBDATA0


LBDATAR0

Register set

SPCLK0 (16 MHz) Write


SPCLK1 (8 MHz) Clock Control buffer
SPCLK2 (4 MHz) selector
SPCLK5 (500 KHz)
DBD[7:0]

Timing mod80/ DBWR (R/W)


generator mod68
selector DBRD (E)

INTLCD

Figure 24-1
www.DataSheet4U.com LCD Bus Interface block diagram

As shown in the figure, the result of a read operation is directly available in the
LBDATA0 and LBDATAR0 registers. For data output, the contents of the
LBDATA0 register is copied to the 32-bit write buffer.

912 User’s Manual U17566EE5V1UM00


LCD Bus Interface (LCD-I/F) Chapter 24

The external signals are listed in the following table.

Table 24-1 LCD Bus Interface external connections


Signal Active Reset
I/O Function
name level level
DBWR O L H mod80: Write strobe (WR)
mod68: Read/Write (R/W)
DBRD O La H mod80: Read strobe (RD)
mod68: E strobe (E)
DBD[7:0] I/O L LCD data bus
a) The active level of E in mod68 is controlled by the bit LBCTL0.EL0.

24.1.2 LCD Bus Interface access modes

The LCD Bus Interface can access the external LCD Controller/Driver in two
different modes. The mode is selected by the bit LBCTL0.IMD.
• mod80
The control signals WR (DBWR) and RD (DBRD) are used to control the
external LCD Controller/Driver.
• mod68
The control signals R/W (DBWR) and E (DBRD) are used to control the
external component.
The level of E depends on the setting of the bit LBCTL0.EL0:
– EL0=0: E is active high; data is read/written on the falling edge.
– EL0=1: E is active low; data is read/written on the rising edge.

24.1.3 Access types to the LBDATA0 register

Access to the LBDATA0 register can be performed as:


• Byte access (8-bit)
• Halfword access (16-bit)
• Word access (32-bit)

Note 1. Every access must address the base address of the LBDATA0 register.
Access to the individual bytes within the register is prohibited.
2. Before writing to or reading from the LBDATA0 register or reading the
LBDATAR0 register, always make sure that the busy flag LBCTL0.BYF is
zero.

(1) Write operation


If there is no transfer in progress on the external bus interface, the new data is
immediately transferred to the external LCD controller. If there is a transfer in
progress, the new data is transferred after the current transfer has completed.
www.DataSheet4U.com
One, two or four bytes are transferred through the bus interface, depending on
how LBDATA0 was accessed (byte, halfword, or word).
The write timing on the external bus interface is determined by the number of
wait cycles (LBWST0.WST[4:0]), the cycle time (LBCYC0.CYC[5:0]) and the
selected clock (LBCTL0.LBC00 and LBCTL0.LBC01).

User’s Manual U17566EE5V1UM00 913


Chapter 24 LCD Bus Interface (LCD-I/F)

(2) Read operation


When the CPU or the DMA reads the LBDATA0 register, the read operation on
the LCD Bus Interface is started. If there is a write transfer in progress while
the LBDATA0 register shall be read, the read transfer is stalled and started
after the write transfer has completed.
The value read from the register is the data from the previous transfer.
Therefore, an initial dummy read operation is required to update the register.
As soon as the data of the actual transfer is available in the LBDATA0 register,
the busy flag LBCTL0.BYF0 is cleared and the data can be retrieved with the
next read operation. Successive reads from the LBDATA0 register provide the
desired data.
The read timing on the external bus interface is determined by the number of
wait cycles (LBWST0.WST0[4:0]), the cycle time (LBCYC0.CYC0[5:0]) and the
selected clock (LBCTL0.LBC0 and LBCTL00.LBC01).

(3) Read operation without initiating a bus transfer


Data can be read from the LBDATAR0 register without initiating a new read
transfer via the LCD Bus Interface.
The read access to the LBDATAR0 register is useful when previous read
accesses to the LBDATA0 register have been performed and only the last
transferred data shall be read without starting a new LCD bus transfer.

24.1.4 Interrupt generation

An interrupt is generated on write and read accesses to the LCD Bus Interface.
Depending on the setting of the bit LBCTL0.TCIS0, the interrupt is generated
differently.
Table 24-2 Controlling interrupt generation of the LCD Bus Interface
Access TCIS0 = 0 TCIS0 = 1
Write An interrupt is generated as soon as data is An interrupt is generated as soon as the write
transferred from LBDATA0 to the write buffer. transfer via the bus interface has completed.
Then LBDATA0 is ready to accept next data. The transfer can consist of 1, 2, or 4 bytes
The write buffer is filled whenever the external dependent on the access to LBDATA0.
bus interface is idle (no transfer in progress)
and data is available in LBDATA0.
Read An interrupt is generated as soon as the data is An interrupt is generated as soon as the read
available in the LBDATA0 or LBDATAR0 transfer via the bus interface has completed.
register. The transfer can consist of 1, 2, or 4 bytes
Depending on the read access to LBDATA0 depending on the access to LBDATA0 or
(byte, halfword or word) 1, 2, or 4 bytes are LBDATAR0.
transferred and placed in the LBDATA0 and
LBDATAR0 register. Finally, the interrupt is
generated in order to indicate that new data is
available.

www.DataSheet4U.com

914 User’s Manual U17566EE5V1UM00


LCD Bus Interface (LCD-I/F) Chapter 24

24.2 LCD Bus Interface Registers

The LCD Bus Interface is controlled and operated by means of the following
registers:

Table 24-3 LCD Bus Interface registers overview


Register name Shortcut Address
LCD Bus Interface control register LBCTL0 FFFF FB60H
LCD Bus Interface cycle time register LBCYC0 FFFF FB61H
LCD Bus Interface wait states register LBWST0 FFFF FB62H
LCD Bus Interface data register LBDATA0W FFFF FB70H
LBDATA0
LBDATA0L
LCD Bus Interface data (read) register LBDATAR0W FFFF FB74H
LBDATAR0
LBDATAR0L

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 915


Chapter 24 LCD Bus Interface (LCD-I/F)

(1) LBCTL0 - LCD Bus Interface control register


The 8-bit LBCTL0 register controls the operation of the LCD Bus Interface.
Access This register can be read/written in 8-bit or 1-bit units.
Address FFFF FB60H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
EL0 IMD0 LBC01 LBC00 TCIS0 0 TPF0 BYF0
R/W R/W R/W R/W R/W R R R

Table 24-4 LBCTL0 register contents


Bit position Bit name Function
7 EL0 Level of signal “E” in mod68 mode
0: E is active high; data is read/written on the falling edge.
1: E is active low, data is read/written on the rising edge.
6 IMD0 Mode of external bus interface access
0: mod80 mode - control signals are WR and RD
1: mod68 mode - control signals are E and R/W
5 to 4 LBC0[1:0] Selects the internal clock
LBC01 LBC00 Selected clock

0 0 SPCLK0

0 1 SPCLK1

1 0 SPCLK2

1 1 SPCLK5

3 TCIS0 Select interrupt generation


0: During write access to the bus interface, an interrupt is generated as soon as
data is transferred from LBDATA0 to the write buffer.
During read access from the bus interface, an interrupt is generated as soon as
data is available in the LBDATA0 and LBDATAR0 registers.
That means the interrupt is generated when the “data register busy” flag BYF0
is reset to 0.
1: An interrupt is generated as soon as the read or write transfer via the bus
interface has completed.
That means the interrupt is generated when the “transfer in progress” flag TPF0
is reset to 0.
As for read operations, in both cases the data is available in the data register
LBDATA(R)0 when the interrupt is generated.
1 TPF0 Transfer in progress on external bus interface
0: The external bus interface is idle
1: Data is transferred on the external bus interface
0 BYF0 Data register busy
0: Data can be read or written from/to LBDATA0
Data can be read from LBDATAR0
www.DataSheet4U.com 1: Register LBDATA0 (LBDATAR0) is busy

916 User’s Manual U17566EE5V1UM00


LCD Bus Interface (LCD-I/F) Chapter 24

(2) LBCYC0 - LCD Bus Interface cycle time register


The 8-bit LBCYC0 register determines the cycle time of the LCD Bus Interface.
The cycle time is the duration of one bus access for transferring one byte.
Access This register can be read/written in 8-bit or 1-bit units.
Address FFFF FB61H
Initial Value 02H. This register is initialized by any reset.

7 6 5 4 3 2 1 0
0 0 CYC05 CYC04 CYC03 CYC02 CYC01 CYC00
R R R/W R/W R/W R/W R/W R/W

Table 24-5 LBCYC0 register contents


Bit position Bit name Function
5 to 0 CYC0[5:0] Sets the cycle time of the LCD Bus Interface.
CYC0[5:0] Cycle time

000000B Setting prohibited

000001B Setting prohibited

000010B Cycle time is 2*T

000011B Cycle time is 3*T

... ...

111111B Cycle time is 63*T

Note 1. T is the clock period of the selected SPCLK.


2. Always keep LBCYC0 > 2.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 917


Chapter 24 LCD Bus Interface (LCD-I/F)

(3) LBWST0 - LCD Bus Interface wait state register


The 8-bit LBWST0 register determines the number of wait states of the LCD
Bus Interface. The number of wait states defines the duration of the DBWR
and DBRD signals. This duration must remain below the cycle time.
Access This register can be read/written in 8-bit or 1-bit units.
Address FFFF FB62H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 WST04 WST03 WST02 WST01 WST00
R R R R/W R/W R/W R/W R/W

Table 24-6 LBWST0 register contents


Bit position Bit name Function
4 to 0 WST0[4:0] Sets the number of wait states of the LCD Bus Interface.
WST0[4:0] Wait states

00000b No wait state inserted

00001b 1 wait state

00010b 2 wait states

00011b 3 wait states

... ...

11111b 31 wait states

Note Always keep LBWST0.WST0 < LBCYC0.CYC0 – 2.

www.DataSheet4U.com

918 User’s Manual U17566EE5V1UM00


LCD Bus Interface (LCD-I/F) Chapter 24

(4) LBDATA0 - LCD Bus Interface data register


The 32-bit LBDATA0 register contains the data that is transferred via the LCD
Bus Interface.
Access This register can be read/written in 3 different units under following names:
• LBDATA0W: 32-bit access
• LBDATA0: 16-bit access
• LBDATA0L: 8-bit access
Address FFFF FB70H
Initial Value 0000 0000H. This register is cleared by any reset.

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DATA

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DATA

Table 24-7 LBDATA0W register contents


Bit Position Bit Name Function
31 to 0 DATA[31:0] Data that is written to or read from the LCD Bus Interface

Table 24-8 LBDATA0 register contents


Bit Position Bit Name Function
15 to 0 DATA[15:0] Data that is written to or read from the LCD Bus Interface

Table 24-9 LBDATA0L register contents


Bit Position Bit Name Function
7 to 0 DATA[7:0] Data that is written to or read from the LCD Bus Interface

Access types Depending on the access to this register (byte, halfword or word), a defined
number of transfers via the external bus interface are performed:
• Byte:
The byte is transferred via the bus interface.
• Halfword:
The halfword is split into 2 bytes that are transferred consecutively via the
bus interface.
• Word:
The word is split into 4 bytes that are transferred consecutively via the bus
interface.
www.DataSheet4U.com When the data is split into bytes and transferred consecutively, the byte order
is as follows:

31 24 23 16 15 8 7 0
4th Byte 3rd Byte 2nd Byte 1st Byte

User’s Manual U17566EE5V1UM00 919


Chapter 24 LCD Bus Interface (LCD-I/F)

Write to this register A write operation to this register sets the busy flag LBCTL0.BYF0 immediately.
If there is no LCD bus transfer in progress (LBCTL0.TPF0 = 0), the data is
copied to the write buffer and LBCTL0.BYF0 is cleared.
If there is a transfer going on (LBCTL0.TPF0 = 1), the data is not copied to the
write buffer until the transfer has completed. As soon as the transfer is
complete, the data is copied to the write buffer and LBCTL0.BYF0 is cleared.
A transfer via the LCD Bus Interface starts as soon as the LBDATA0 register is
copied to the write buffer. This is indicated by the interrupt INTLCD that
becomes active, provided that LBCTL0.TCIS0 = 0.
Read from this A read operation from this register initiates a read transfer via the LCD Bus
register Interface. The data that is read from the register is always the data that was
received during the previous transfer from the LCD Bus Interface.

Note 1. Every access must address the base address of the LBDATA0 register.
Access to the individual bytes within the register is prohibited.
2. LBCTL0.BYF0 must be zero when accessing this register.

www.DataSheet4U.com

920 User’s Manual U17566EE5V1UM00


LCD Bus Interface (LCD-I/F) Chapter 24

(5) LBDATAR0 - LCD Bus Interface data register


The LBDATAR0 register is read-only. It contains the data of the last previous
read transfer via the LCD Bus Interface. Reading this register does not start a
new read transfer on the LCD Bus Interface.
Access This register can be read/written in 3 different units under following names:
• LBDATAR0W: 32-bit access
• LBDATAR0: 16-bit access
• LBDATAR0L: 8-bit access
Address FFFF FB74H
Initial Value 0000 0000H. This register is cleared by any reset.

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
DATA

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
DATA

Table 24-10 LBDATAR0W register contents


Bit position Bit name Function
31 to 0 DATA[31:0] Data that was previously read from the LCD Bus Interface

Table 24-11 LBDATAR0 register contents


Bit Position Bit Name Function
15 to 0 DATA[15:0] Data that was previously read from the LCD Bus Interface

Table 24-12 LBDATAR0L register contents


Bit Position Bit Name Function
7 to 0 DATA[7:0] Data that was previously read from the LCD Bus Interface

This register can be read to obtain data that was transferred during a previous
read operation to the LBDATA0 register—without initiating a further LCD bus
transfer.
Reading the LBDATAR0 register does not change the status of the
LBCTL0.BYF0 and LBCTL0.TPF0 flags.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 921


Chapter 24 LCD Bus Interface (LCD-I/F)

24.3 Timing

This section starts with the general timing and then presents examples of
consecutive write and read operations.

24.3.1 Timing dependencies

The following figure shows the general timing when the mod80 mode is used.
It illustrates the effect of the LBCYC0 and LBWST0 register settings. It explains
also the impact of LBCTL0.TCIS on the interrupt generation.

Read or write byte from/to LBDATA register by CPU or DMA next byte

CYC * T
(WST+1) * T
DBWR
DBRD

DBD[7:0]
Data
(WRITE)

DBD[7:0]
Data
(READ)

Internal
interrupt on write on read
(TCIS=0)
(TCIS=1)

Figure 24-2 LCD Bus Interface timing (mod80 mode)

In mod80 mode, DBWR provides the write strobe WR and DBRD the read
strobe RD.

Note 1. T is the clock period of the selected SPCLK.


2. CYC is the chosen number of clock cycles (LBCYC0.CYC0). Always keep
LBCYC0.CYC0 > 2.
3. WST is the chosen number of wait states (LBWST0). Always keep
LBWST0.SWST0 < (LBCYC0.CYC0 – 2).
www.DataSheet4U.com
The only difference in mod68 mode is, that DBWR provides the read/write R/W
strobe and DBRD the E strobe. The active edge of the E strobe is defined by
LBCTL0.EL0.

922 User’s Manual U17566EE5V1UM00


LCD Bus Interface (LCD-I/F) Chapter 24

24.3.2 LCD Bus I/F states during and after accesses

Changing between input and output mode of the LCD bus pins DB[7:0] is done
automatically after they are configured as LCD Bus Interface pins via the port
configuration registers.
After the pins are configured as DB[7:0] they are operating in input mode.
During and after a bus read access DB[7:0] are operating in input mode and
retain this mode also after the read access is completed.
During and after a bus write access DB[7:0] are operating in output mode and
retain this mode also after the write access is completed.

24.3.3 Writing to the LCD bus

This section shows typical sequences of writing words, halfwords and bytes to
the LCD bus.

(1) Writing words


Writing a word transmits four bytes to the external LCD Controller/Driver.

Write word to LBDATA0 register

SPCLK

LBDATA0 Word (consists of Byte0 … Byte3)

internal Word
write buffer

LBCTL0.TPF0

LBCTL0.BYF0

INTLCD
(LBCTL0.TCIS0=0)

INTLCD
(LBCTL0.TCIS0=1)

DBWR

DBRD

DBD[7:0] Byte0 Byte1 Byte2 Byte3

Figure 24-3 Timing (mod80: LBTCTL0.IMD0 = 0): write word, LBWST0.WST0 = 5,


LBCYC0.CYC0 = 8, LBCTL0.TCIS0 = 0

Note The timing diagrams are for functional explanation purposes only without any
relevance to the real hardware implementation.

Sequence 1. A word of LCD data is written to the LBDATA0 register. The internal bus
transfer takes some clocks until the register is updated. Then the busy flag
www.DataSheet4U.com LBCTL0.BYF0 is set until the data is copied to the write buffer.
2. The LBDATA0 register contents is copied to the write buffer. This clears
LBCTL0.BYF0 and causes the interrupt output to become active for one
clock cycle. Transfer on the external bus interface starts with byte 0. The
“transfer in progress” flag LBCTL0.TPF0 is set to indicate that a transfer is
in progress.

User’s Manual U17566EE5V1UM00 923


Chapter 24 LCD Bus Interface (LCD-I/F)

3. All four bytes of the word are transferred back-to-back via the external bus
interface.
4. After the transfer on the external bus interface has been completed, the
LBCTL0.TPF0 is cleared.

(2) Writing halfwords


Writing a halfword transmits two bytes to the external LCD Controller/Driver.

Write 2nd halfword to LBDATA0 register

Write 1st halfword to LBDATA0 register

SPCLK

LBDATA0 1st halfword (consists of byte0 and byte1) 2nd halfword (consists of byte0 and byte1)

internal
1st halfword 2nd halfword
write buffer

LBCTL0.TPF0

LBCTL0.BYF0

INTLCD

DBWR

DBRD
DBD[7:0] Byte0 Byte1 Byte0 Byte1

Figure 24-4 Timing (mod80: LBTCTL0.IMD0 = 0): write consecutive halfwords,


LBWST0.WST0 = 5, LBCYC0.CYC0 = 8, LBCTL0.TCIS0 = 0

Note The timing diagrams are for functional explanation purposes only without any
relevance to the real hardware implementation.

Sequence 1. The first halfword of LCD data is written to the LBDATA0 register. The
internal bus transfer takes some clocks until the interface register is written.
Then the busy flag LBCTL0.BYF0 is set until the data is copied to the write
buffer.
2. The LBDATA0 register contents is copied to the write buffer. This clears
LBCTL0.BYF0 and causes the interrupt output to become active for one
clock cycle. Transfer on the external bus interface starts with byte 0. The
flag LBCTL0.TPF0 is set to indicate that a transfer is in progress.
3. Caused by the interrupt, the DMA writes a second halfword to LBDATA0.
The CPU can write this halfword as well after it has checked the busy flag
LBCTL0.BYF0. The internal bus transfer again takes some clock cycles
until the LBDATA0 register is written and LBCTL0.BYF0 is set.
4. Because the transfer (two bytes) on the external bus interface is still going
on and the LBDATA0 register contents can not be copied to the write buffer
immediately, LBCTL0.BYF0 is set.
www.DataSheet4U.com 5. After the transfer over the external bus interface has been completed, the
write buffer is filled with the contents of LBDATA0. The busy flag
LBCTL0.BYF0 is cleared, and the interrupt output INTLCD becomes active
for one clock cycle.

Filling the write buffer starts a new transfer to the external LCD controller.

924 User’s Manual U17566EE5V1UM00


LCD Bus Interface (LCD-I/F) Chapter 24

(3) Writing bytes


Writing consecutive bytes transmits these bytes to the external LCD controller/
driver.

write 3rd byte to LBDATA0 register

write 2nd byte to LBDATA0 register

write 1st byte to LBDATA0 register

SPCLK

LBDATA0 1st byte 2nd byte 3rd byte

internal 1st byte 2nd byte 3rd byte


write buffer

LBCTL0.TPF0

LBCTL0.BYF0

INTLCD

DBRD(E)
LBCTL.EL=0

DBRD(E)
LBCTL.EL=1

DBWR(R/W)

DBD[7:0] 1st byte 2nd byte 3rd byte

Figure 24-5 Timing (mod68 mode: LBTCTL0.IMD0 = 1): write consecutive bytes,
LBWST0.WST0 = 5, LBCYC0.CYC0 = 8, , LBCTL0.TCIS0 = 0

Note The timing diagrams are for functional explanation purposes only without any
relevance to the real hardware implementation.

Sequence 1. The first byte of LCD data is written to the LBDATA0 register. The internal
bus transfer takes some clocks until the register of the interface is written.
Then the busy flag LBCTL0.BYF0 is set until the data is copied to the write
buffer.
2. The LBDATA0 register contents is copied to the write buffer. This clears
LBCTL0.BYF0 and causes the interrupt output to become active for one
clock cycle. Transfer on the external bus interface is started. The flag
LBCTL0.TPF0 is set to indicate that a transfer is in progress.
3. Caused by the interrupt, the DMA writes a second byte to LBDATA0. The
CPU can write this byte as well after it has checked the busy flag
LBCTL0.BYF0. The internal bus transfer again takes some clock cycles
until the LBDATA0 register is written and LBCTL0.BYF0 is set.
4. Since the transfer (one byte) on the external bus interface is still going on
and the LBDATA0 register contents can not be copied to the write buffer
immediately, the busy flag LBCTL0.BYF0 remains set.
5. After the transfer on the external bus interface has been completed, the
write buffer is filled with the contents of LBDATA0. The busy flag
LBCTL0.BYF0 is cleared and the interrupt output INTLCD becomes active
for one clock cycle.
www.DataSheet4U.com

Filling the write buffer starts a new transfer to the external LCD controller.

User’s Manual U17566EE5V1UM00 925


Chapter 24 LCD Bus Interface (LCD-I/F)

24.3.4 Reading from the LCD bus

You can read from the LCD bus in word, halfword, or byte format. The following
shows typical sequences of reading words and bytes.

(1) Reading words


Reading a word requires the transmission of four bytes.

Dummy read word from LBDATA0 register Read word from LBDATA0 register

SPCLK

LBDATA0 Word (Byte0..Byte3)

LBCTL0.TPF0

LBCTL0.BYF0
INTLCD
(LBCTL0.TCIS0=0)

INTLCD
(LBCTL0.TCIS0=1)

DBWR

DBRD

DBD[7:0] Byte0 Byte1 Byte2 Byte3

sample point

Figure 24-6 Timing (mod80: LBTCTL0.IMD0 = 0): read word, LBWST0.WST0 = 5,


LBCYC0.CYC0 = 8, LBCTL0.TCIS0 = 0 and 1

Note The timing diagrams are for functional explanation purposes only without any
relevance to the real hardware implementation.

Sequence 1. A dummy read to the LBDATA0 register starts the transfer of four bytes
from the external LCD controller. The busy flag LBCTL0.BYF0 is set
immediately. The “transfer in progress” flag LBCTL0.TPF0 is set on the
rising edge of the clock.
The data that is read from LBDATA0 belongs to a previous transfer and
may be ignored.
2. When the last of the four bytes is sampled and the complete word is
available in the LBDATA0 register, the busy flag LBCTL0.BYF0 is cleared.
The LBCTL0.TPF0 flag remains set until the cycle time of the last byte has
elapsed.
3. A following read to the LBDATA0 register provides the LCD controller data
and initiates a new transfer.

www.DataSheet4U.com

926 User’s Manual U17566EE5V1UM00


LCD Bus Interface (LCD-I/F) Chapter 24

(2) Reading bytes


The following figure shows a byte read operation in mod68 mode.

Read 3rd byte from LBDATA0 R register


without initiating a new transfer

Read 2nd byte from LBDATA0 register


st
Read 1 byte from LBDATA0 register
Dummy read byte from LBDATA0 register

SPCLK

LBDATA0 1st Byte 2nd Byte 3rd Byte

LBCTL0.TPF0

LBCTL0.BYF0
INTLCD
DBRD(E)
LBCTL .EL=0

DBRD(E)
LBCTL .EL=1

DBWR(R/W)

DBD[7:0] 1st Byte 2nd Byte 3rd Byte

sample point

Figure 24-7 Timing (mod68: LBTCTL0.IMD0 = 1): read consecutive bytes,


LBWST0.WST0 = 4, LBCYC0.CYC0 = 7, LBCTL0.TCIS0 = 0

Note The timing diagrams are for functional explanation purposes only without any
relevance to the real hardware implementation.

Sequence 1. A dummy read to the LBDATA0 register starts the transfer of one byte from
the external LCD controller. The busy flag LBCTL0.BYF0 is set
immediately. The “transfer in progress” flag LBCTL0.TPF0 is set on the
rising edge of the clock.
The data that is read from LBDATA0 belongs to a previous transfer and
may be ignored.
2. When the data on the LCD Bus Interface is sampled, LBCTL0.BYF0 is
cleared and the data is available in LBDATA0. The interrupt output INTLCD
becomes active for one clock cycle.
3. A new read to LBDATA0 is performed while the previous transfer has not
been finished (cycle time not elapsed). The busy flag LBCTL0.BYF0 is set
immediately, but the new transfer is started after the previous one is
complete. The “transfer in progress flag” LBCTL0.TPF0 remains set.
The data that is read from LBDATA0 is the first LCD data byte.
4. Again, the data that has been sampled is available in LBDATA0 and the
busy flag LBCTL0.BYF0 is cleared.
5. Steps 2 to 4 are repeated until the last byte to be read has been sampled.
6. The last byte is not read from the LBDATA0 register but from LBDATAR0 in
order to avoid a further read transfer on the LCD bus.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 927


Chapter 24 LCD Bus Interface (LCD-I/F)

24.3.5 Write-Read-Write sequence on the LCD bus

Figure 24-8 shows an example when a write access to the LCD bus is
immediately followed by a read access and vice versa. The example is given in
mod80 mode (LBCTL0.IMD0 = 0) with byte transfers.
In mode68 mode (LBCTL0.IMD0 = 1) the timing is equivalent, when the the RD
strobe is considered as the low active E signal (LBCTL0.EL0 = 1)

write W1 read read R1 write W2


LBDATA0L LBDATAL LBDATAR0L LBDATA0L

LBDATA0 W1 R1 W2

LBCTL0.BYF0

LBCTL0.TPF0

WR

RD

DBD[7:0] W1 R1 W2

CYC · T CYC · T CYC · T

Figure 24-8 Timing (mod80: LBTCTL0.IMD0 = 0): byte write-read-write,


LBWST0.WST = 4, LBCYC0.CYC = 7, LBCTL0.TCIS = 0

www.DataSheet4U.com

928 User’s Manual U17566EE5V1UM00


Chapter 25 Sound Generator (SG)

The Sound Generator (SG0) generates an audio-frequency tone signal and a


high-frequency pulse-width modulated (PWM) signal. The duty cycle of the
PWM signal defines the volume.
By default, the two signal components are routed to separate pins. But both
signals can also be combined to generate a composite signal that can be used
to drive a loudspeaker circuit.

25.1 Overview

The Sound Generator consists of a programmable square wave tone generator


and a programmable pulse-width modulator.
The PWM includes an internal automatic logarithmic decrement unit (ALD).
The ALD can be used to reduce the tone volume over time without CPU
intervention.

Features summary Special features of the Sound Generator are:


• Programmable tone frequency (100 Hz to 6 KHz with a minimum step size
of 20 Hz)
• Programmable volume level (9 bit resolution)
• Automatic logarithmic volume decrement function (ALD):
– Volume reduction without CPU interaction
– Programmable sound duration (256 steps)
– Sound duration associated with tone frequency (gong effect)
– Interrupt generation when programmable volume low level is reached
• Wide range of PWM signal frequency (32 KHz to 64 KHz)
• Sound can be stopped or retriggered (even if the ALD is switched on)
• Composite or separated frequency/volume output for external circuitry
variation
• Hardware-optimized update of frequency and volume to avoid audible
artifacts

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 929


Chapter 25 Sound Generator (SG)

25.1.1 Description

The following figure provides a functional block diagram of the Sound


Generator.

SG0CLK = 1
Clear Clear
PCLK0 9-bit S0GFL 9-bit S0GFH
9-bit SG0FH
(16MHz) frequency counter fPWM tone counter
Tone
0 (32 to 64 kHz)

Match
Match
SG0CTL.PWR /2
fTone
& (100 Hz to
SG0FL SG0FL SG0FH 6 kHz)
frequency low register frequency compare buffer tone compare buffer 2 x fTone
Load Load
(200 Hz to
12 kHz)
SG0FH
Tone
SG0CTL.OS
frequency high register
CPU write to
SG0PWM
SG0OF 0

SGO
SG0
fPWM & 1
Match
(32 to 64 kHz)
SG0ITH
interrupt threshold register
S RS-FF SG0OA
SG0A
R Reset fPWM
SG0PWM & (min. 32 kHz)
≤ SG0ITH ? volume compare buffer
Load
Y 0
INTSG0
fDecrement
1
8-bit SG0SDF
1 0 auto-decrement counter

SG0CTL.ALDS
SG0SDF
sound duration register

Auto Logarithmic SG0PWM


Decrement SG0PWM = 0?
volume register Y PWM

Figure 25-1 Sound Generator block diagram

The Sound Generator's input clock SG0CLK is the 16 MHz clock PCLK0.
Tone generator The tone generator consists of two up-counters with compare registers. The
values written to the frequency registers are automatically copied to compare
buffers. The counters are reset to zero when their values match the contents of
the associated compare buffers.
The 9-bit counter SG0FL generates a clock with a frequency between 32 KHz
and 64 KHz. This clock constitutes the PWM frequency.
It is also the input of the second 9-bit counter SG0FH. The resulting tone signal
behind the by-two-divider has a frequency between 100 Hz and 6 KHz and a
50 % duty cycle.
PWM The PWM modulates the duty cycle according to the desired volume. It is
controlled by the volume register SG0PWM. The value written to this register is
automatically copied to the associated volume compare buffer.
The PWM continually compares the value of the counter SG0FL with the
contents of its volume compare buffer.
The RS flipflop of the PWM is set by the pulses generated by the counter
SG0FL. It is reset when the SG0FL counter value matches the contents of the
volume buffer. Thus, the PWM output signal can have a duty cycle between
0 % (null volume) and 100 % (maximum volume).
www.DataSheet4U.com
The PWM frequency is above 32 KHz and hence outside the audible range.
Outputs The Sound Generator is connected to the pins SGO and SGOA. By default, pin
SGO provides the tone signal SG0OF and pin SGOA the PWM signal SG0OA
that holds the volume (“amplitude”) information.
If bit SG0CTL.OS is set, pin SGO provides the composite signal SG0O that
can directly control a speaker circuit.

930 User’s Manual U17566EE5V1UM00


Sound Generator (SG) Chapter 25

25.1.2 Principle of operation

The software-controlled registers SG0FL, SG0FH, and SG0PWM are


equipped with hardware buffers. The Sound Generator operates on these
buffers.
This approach eliminates audible artifacts, because the buffers are only
updated in synchronization with the generated tone waveform.

Note This section provides an overview. For details please refer to “Sound
Generator Operation“ on page 939.

(1) Generation of the tone frequency


The tone frequency is determined by two counters and their associated
compare register values. Two counters are necessary to keep the tone pulse
and the PWM signal synchronized.
The first counter (SG0FL) provides the input to the second (SG0FH) and also
to the PWM. It is used to keep the PWM frequency outside the audio range
(above 30 KHz) and within the signal bandwidth of the external sound system
(usually below 64 KHz). Its match value defines also the 100 % volume level.
The second counter (SG0FH) generates the tone frequency (100 Hz to
6 KHz).

Note If the target values of the counters SG0FL/SG0FH are changed to generate a
different tone frequency, the volume register SG0PWM has to be adjusted to
keep the same volume.

(2) Generation of the volume information


The volume information (the “amplitude” of the audible signal) is provided as a
high-frequency PWM signal. In composite mode, the PWM signal is ANDed
with the tone signal, as illustrated in the following figure.

Tone signal

PWM signal,
duty cycle 66 %

Composite
signal

100%
Analog 66%
audio signal 0%

Figure 25-2 Generation of the composite output signal


www.DataSheet4U.com
After low-pass filtering, the analog signal amplitude corresponds to the duty
cycle of the PWM signal. Low-pass filtering (averaging) is an inherent
characteristic of a loudspeaker system.
The duty cycle can vary between 0 % and 100 %. Its generation is controlled
by the counter register SG0FL and the volume register SG0PWM.

User’s Manual U17566EE5V1UM00 931


Chapter 25 Sound Generator (SG)

When the volume register SG0PWM is cleared, the sound stops immediately.

(3) Automatic fading


The automatic logarithmic decrement function (ALD) provides an automatic
volume reduction without CPU interaction.
In regular intervals (related to the tone frequency, selectable via register
SG0SDF), the ALD divides the present contents of the volume buffer by 32
(truncated) and subtracts the result from the buffer value. The logarithmic
reduction creates the impression of a linear volume reduction in the human
ear.
The initial volume that is defined by the contents of the volume register
SG0PWM remains unchanged.

(4) Interrupt generation


When the ALD is switched on, the Sound Generator generates the interrupt
request INTSG0.
This interrupt signals that the sound volume has decreased to a certain level
(set in register SG0ITH). Because the sound duration depends on the tone
frequency and the contents of the sound duration register SG0SDF, INTSG0
can be used to indicate “sound is low” or “sound has ended”.
This interrupt is generated only once after the start volume level has been
written to SG0PWM.

25.2 Sound Generator Registers

The Sound Generator is controlled by means of the following registers:

Table 25-1 Sound Generator registers overview


Register name Shortcut Address
SG0 frequency low register SG0FL <base>
SG0 frequency high register SG0FH <base> + 2H
SG0 volume register SG0PWM <base> + 4H
SG0 sound duration factor register SG0SDF <base> + 6H
SG0 control register SG0CTL <base> + 7H
SG0 interrupt threshold register SG0ITH <base> + 8H

Table 25-2 Sound Generator register base address


Module Base address
SG0 FFFF F5A0H
www.DataSheet4U.com

932 User’s Manual U17566EE5V1UM00


Sound Generator (SG) Chapter 25

(1) SG0CTL - SG0 control register


The 8-bit SG0CTL register controls the operation of the Sound Generator.
Access This register can be read/written in 8-bit or 1-bit units.
Address <base> + 7H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 PWR 0 0 OS ALDS
R R R R/W R R R/W R/W

Table 25-3 SG0CTL register contents


Bit position Bit name Function
4 PWR Power save mode selection:
0: Clock input switched off (the Sound Generator is disabled and does not
operate).
1: Clock input switched on (the Sound Generator is enabled and ready to use).
1 OS SG0 output mode selection:
0: Selects SGOF and SGOA outputs (frequency and amplitude separated).
1: Selects SGO output (frequency and amplitude mixed).
0 ALDS Automatic logarithmic decrement of volume (ALD) selection:
0: ALD switched off.
1: ALD activated.

Note Change the contents of this register only when the sound is stopped (register
SG0PWM cleared).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 933


Chapter 25 Sound Generator (SG)

(2) SG0FL - SG0 frequency low register


The 16-bit SG0FL register is used to specify the target value for the PWM
frequency. It holds the target value for the 9-bit counter SG0FL.
Access This register is can be read/written in 16-bit units. It cannot be written if bit
SG0CTL.PWR = 0.
The SG0FL register can also be read/written together with the SG0FH register
by 32-bit access via the SG0F register.
Address <base>
Initial Value 0000H. This register is cleared by any reset.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 Counter SG0FL target value
R R R R R R R R/W

For the calculation of the resulting PWM frequency refer to “PWM calculations“
on page 942.

The value written to SG0FL defines also the reference value for the maximum
sound amplitude (100% PWM duty cycle). A 100 % duty cycle (continually
high) will be generated if the SG0PWM value is higher than the SG0FL value.
For details see “PWM calculations“ on page 942).

Note 1. The bits SG0FL[15:9] are not used.


2. The maximum value to be written is 510 (01FEH). This yields a PWM
frequency of 31.3 KHz. The minimum value to be written depends on the
capability of the external circuit. A value of 255 (00FFH) would yield a PWM
frequency of 62.5 KHz.
3. The value read from this register does not necessarily reflect the current
PWM frequency, because this frequency is determined by the frequency
compare buffer value. The buffer might not be updated yet.
For details see “Updating the frequency buffer values“ on page 939.

www.DataSheet4U.com

934 User’s Manual U17566EE5V1UM00


Sound Generator (SG) Chapter 25

(3) SG0FH - SG0 frequency high register


The 16-bit SG0FH register is used to specify the final tone frequency. It holds
the target value for the 9-bit counter SG0FH.
Access This register is can be read/written in 16-bit units. It cannot be written if bit
SG0CTL.PWR = 0.
The SG0FH register can also be read/written together with the SG0FL register
by 32-bit access to the SG0FL register via the SG0F register.
Address <base> + 2H
Initial Value 0000H. This register is cleared by any reset.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 Counter SG0FH target value
R R R R R R R R/W

For the calculation of the resulting tone frequency refer to “Tone frequency
calculation“ on page 940.

Note 1. The bits SG0FH[15:9] are not used.


2. Legal values depend on the contents of register SG0FL which defines the
frequency of the input pulse. For example: If the counter SG0FL generates
a frequency of 32.4 KHz, a value of 161 would generate a tone frequency
of 100 Hz.
3. The value read from this register does not necessarily reflect the current
tone frequency, because this frequency is determined by the frequency
compare buffer value. The buffer might not be updated yet.
For details see “Updating the frequency buffer values“ on page 939.

(4) SG0F - SG0 frequency register


The 32-bit register SG0F combines access to the 16-bit registers SG0FL and
SG0H. This makes it possible to change the values for the PWM and tone
frequency with one write access.
Access This register is can be read/written in 32-bit units. It cannot be written if bit
SG0CTL.PWR = 0.
Address <base>
Initial Value 0000 0000H. This register is cleared by any reset.

31 16 15 0
SG0FH SG0FL

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 935


Chapter 25 Sound Generator (SG)

(5) SG0PWM - SG0 volume register


The 16-bit register SG0PWM is used to specify the sound volume. It holds the
target value for the sound amplitude that is given by the duty cycle of the PWM
signal. When the ALD is switched on, this is the start value.
Access This register is can be read/written in 16-bit units. It cannot be written if bit
SG0CTL.PWR = 0.
Address <base> + 4H
Initial Value 0000H. This register is cleared by any reset.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 Sound volume target value
R R R R R R R R/W

The value written to this register must be considered in conjunction with the
contents of register SG0FL. The register SG0FL specifies the maximum value
of the counter SG0FL.
For the calculation of the resulting duty cycle refer to “PWM calculations“ on
page 942.
The setting takes effect after the SG0PWM buffer has been updated (see
“Updating the volume buffer value“ on page 941).

Note 1. The bits 15:9 are not used.


2. The value read from this register does not necessarily reflect the current
volume, because the value of counter SG0FL is compared with the
contents of the volume buffer. The buffer might not be updated yet or
changed by the ALD function.
3. The value of this register remains unchanged when the ALD is switched
on.
4. The sound stops immediately when this register is cleared.

www.DataSheet4U.com

936 User’s Manual U17566EE5V1UM00


Sound Generator (SG) Chapter 25

(6) SG0SDF - SG0 sound duration factor register


The 8-bit register SG0SDF is used to specify the duration of the sound when
the ALD is switched on. It defines the number of tone signal edges between
two successive volume reductions.
Access This register can be read/written in 8-bit or 1-bit units.
Address <base> + 6H
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
No. of edges between two volume reductions
R/W R/W R/W R/W R/W R/W R/W R/W

The ALD is synchronized with the tone signal. With this register, the ALD is
instructed to reduce the volume at every nth edge (falling or rising) of the tone
signal.
The correspondence between the value written to SG0SDF and n is shown in
the following table.

Table 25-4 ALD cycle rate


SG0SDF value n
0000 0000B 1
0000 0001B 2
... ...
1111 1111B 256

Because both edges are counted, the maximum time between two successive
volume reductions is 128 times the tone period.

Note Change the contents of this register only when the sound is stopped (register
SG0PWM cleared).

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 937


Chapter 25 Sound Generator (SG)

(7) SG0ITH - SG0 interrupt threshold register


The 16-bit register SG0ITH is used to specify the volume level for the interrupt
request INTSG0.
When the ALD is switched on, the sound volume is stepwise reduced. This is
done by reducing the value of the volume buffer. INTSG0 is generated when
the value of the volume buffer is equal to or less than the value written to
SG0ITH.
INTSG0 is never generated when the ALD is switched off.
Access This register is can be read/written in 16-bit units.
Address <base> + 8H
Initial Value 0000H. This register is cleared by any reset.

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 Interrupt threshold value
R R R R R R R R/W

To avoid glitches, the INTSG0 interrupt is only generated at a falling edge of


the tone signal. If the condition is met at a rising edge, the interrupt will be
generated at the next falling edge of the tone signal.

Note 1. The bits 15:9 are not used.


2. Change the contents of this register only when the sound is stopped
(register SG0PWM cleared).

When the ALD is switched on, a write access to the SG0PWM volume register
starts the comparison of the SG0ITH register contents with the volume buffer.
The comparison ends after INTSG0 has been generated.
To revive the comparison, you must first write to SG0PWM. This restarts the
tone.

www.DataSheet4U.com

938 User’s Manual U17566EE5V1UM00


Sound Generator (SG) Chapter 25

25.3 Sound Generator Operation

This section explains the details of the Sound Generator.

25.3.1 Generating the tone

The tone signal is generated by the compare match signal of the SG0FH
counter value with the value of the SG0FH buffer, followed by a by-two-divider.
At each compare match, the counter is reset to zero.
Remember that the SG0FH counter is clocked by the output of the SG0FL
counter.

(1) Updating the frequency buffer values


The values of the frequency buffers can be changed by writing to the
associated frequency registers SG0FL and SG0FH. Both registers can be
written together via SG0F.
Changing the value of the SG0FL (equivalent to SG0F[15:0]) register would
also yield a change of the PWM frequency, i.e. the sound volume. Therefore it
is obligatory to write the correct PWM value to SG0PWM before a new SG0F
value is copied to the frequency buffers.
The SG0F register contents is copied to the buffers when the following
sequence is detected:
1. CPU write access to SG0PWM register occurred.
2. SG0FH counter value and SG0FH buffer value have matched.
This match is equivalent to the next edge (rising or falling) of the tone
signal.
The following figure shows an example (not to scale).

SG0CLK

SG0F
(32 bit) 003B 01AEH 0027 01AEH
(Step 1)
Write
SG0PWM

SG0FH 003BH 0027H


buffer
(Step 2)
SG0FH
compare
match

SG0FH 038H 039H 03AH 03BH 000H 001H


counter

www.DataSheet4U.com
Figure 25-3 Update timing of the frequency buffers

Up to the next match, frequency registers and associated buffers can hold
different values. If a 309 Hz tone is generated, as in the above example, the
time span between writing to the SG0PWM register and updating the buffer
can be up to 3.24 ms.

User’s Manual U17566EE5V1UM00 939


Chapter 25 Sound Generator (SG)

(2) Tone frequency calculation


The tone frequency can be calculated as:
ftone = fSG0CLK / (([SG0FL buffer] + 1) × ([SG0FH buffer] + 1) × 2)
where:
fSG0CLK = frequency of the SG0 input clock
[SG0FL buffer] = contents of the SG0FL buffer
[SG0FH buffer] = contents of the SG0FH buffer

Example If:
– fSG0CLK = 16 MHz
– [SG0FL buffer] = 255 (00FFH) (this yields a PWM frequency of 62.5 KHz)
– [SG0FH buffer] = 32 (0020H)
then:
– ftone = 947 Hz

Note Note that the buffer contents can differ from the contents of the associated
register until the next compare match.

25.3.2 Generating the volume information

The sound volume information is generated by comparing the SG0FL counter


value with the contents of the SG0PWM volume buffer. An RS flipflop is set
when the counter matches the SG0FL buffer and reset when the counter
reaches the value of the volume buffer SG0PWM.

SG0FL buffer value


(when reached, sets the FF)
SG0PWM buffer value
SG0FL (when reached, resets the FF)
counter
value

t
PWM
signal
(RS flip-
flop output)

www.DataSheet4U.com
Figure 25-4 PWM signal generation

The duty cycle of the PWM signal is determined by the difference between the
contents of the SG0FL counter buffer and the contents of the SG0PWM
volume buffer. The larger the difference, the smaller the duty cycle.
The PWM signal is continually high when the value of the volume buffer is
higher than the value of the frequency compare buffer.

940 User’s Manual U17566EE5V1UM00


Sound Generator (SG) Chapter 25

Note To achieve 100 % duty cycle for all PWM frequencies, SGOFL must not be set
to a value above 1FEH.

The PWM signal is continually low when the value of the volume buffer is zero
— the sound has stopped.

(1) Updating the volume buffer value


The value of the volume compare buffer can be changed by writing to the
volume register SG0PWM. It is also changed by the ALD function.
• If the register is cleared by writing 0000H, the register value is copied to the
volume compare buffer with the next rising edge of SG0CLK.
• As a result, the sound stops at the latest after one period of SG0CLK.
• If a non-zero value is written to the register, the buffer is updated with the
next falling or rising edge of the tone frequency (match between SG0FH
counter value and SG0FH buffer value).
When the ALD is switched on (SG0CTL.ALDS = 1) and no write access to the
SG0PWM register occurred, the ALD reduces the contents of the volume
buffer gradually.
If SG0PWM is written between two reductions, the new value takes
precedence over the ALD, and the volume buffer is updated.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 941


Chapter 25 Sound Generator (SG)

(2) PWM calculations


PWM frequency The PWM frequency is generated by the counter SG0FL. It can be calculated
as:
fPWM = fSG0CLK / (([SG0FL buffer] + 1)
where:
fSG0CLK = frequency of the SG0 input clock
[SG0FL buffer] = contents of the SG0FL buffer

Duty cycle The duty cycle of the PWM signal is calculated as follows:
• If [SG0PWM buffer] > [SG0FL buffer]:
Duty cycle = 100 %
• If 0 ≤[SG0PWM buffer] ≤[SG0FL buffer]:
Duty cycle = [SG0PWM buffer] / ([SG0FL buffer] + 1)
where:
[SG0PWM buffer] = contents of SG0PWM buffer
[SG0FL buffer] = contents of SG0FL buffer

Example If [SG0FL] is set to 240 (00F0H), the following table applies:

Table 25-5 Duty cycle calculation example


[SG0PWM] Calculation Duty cycle [%]
01FFH 100
... 100
00F1H 241 / 241 100
00F0H 240 / 241 99.6
00EFH 239 / 241 99.2
... ... ...
0001H 1 / 241 0.41
0000H 0 / 241 0

The table shows, how the contents of register SG0FL affects the achievable
volume resolution.

www.DataSheet4U.com

942 User’s Manual U17566EE5V1UM00


Sound Generator (SG) Chapter 25

(3) Automatic fading


The built-in automatic logarithmic decrement function (ALD) can be used to
reduce the volume gradually to zero without CPU intervention. The logarithmic
decrease matches the sensitivity of the human ear and creates the impression
of a linearly decaying sound.
A sound started with SG0CTL.ALDS = 1 will automatically fade away. The
fading can be stopped by writing to the SG0PWM register.
The speed of the volume reduction is controlled by the sound duration factor
register SG0SDF. Depending on the value written to SG0SDF, a new amplitude
value is calculated at every nth edge (rising or falling) of the tone signal.
The range of n is 1 to 256.
sCThe calculation of the volume reduction uses 13-bit arithmetic and follows
below procedure:
PWM8[0] = SG0PWM;// initial PWM output
OV13[0] = SG0PWM << 5 + 31;// in 13-bit
for (n=1, n< N+1; n++){
NV13[n] = OV13[n-1]-(OV13[n-1]>>5);// decrement in 13-bit
PWM8[n] = NV13[n] >> 5;// new PWM output
}
where:
PWM8[n]: 8-bit PWM output value
OV13[n]: internal old value in 13-bit
NV13[n]: internal new value in 13-bit
N: number of volume reduction
steps

Because the SG0PWM register is not affected, the present volume value
cannot be read from that register.
The sound stops when the volume buffer value becomes zero.
The number of repetitions depends on the start value set in register SG0PWM.
To avoid an initial delay with apparently no effect, the start value shall not
exceed the value of register SG0FL by more than 1.
The total sound duration depends on
• the start value,
• the sound duration factor set in register SG0SDF,
• the tone frequency.

Example The subsequent table shows two examples of the sound duration for minimum
and maximum tone frequency.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 943


Chapter 25 Sound Generator (SG)

The following settings are assumed:


– fSG0CLK = 16 MHz
– [SG0FL] = 332 (this yields a PWM frequency of 48.048 KHz)
– [SG0PWM] = 333 (100 % volume)
– a) [SG0FH] = 3 (this yields a tone frequency of 6.006 KHz)
– b) [SG0FH] = 240 (this yields a tone frequency of 99.69 Hz)

Table 25-6 Sound duration example


Tone Reduced at Reduced at every Reduced at every
...
frequency every tone edge 2nd tone edge 256th tone edge

Sound duration 6006 Hz 0.018 0.035 ... 4.58


[roughly sec] 99.69 Hz 1.08 2.15 ... 275

www.DataSheet4U.com

944 User’s Manual U17566EE5V1UM00


Sound Generator (SG) Chapter 25

25.4 Sound Generator Application Hints

This section provides supplementary programming information.

25.4.1 Initialization

To enable the Sound Generator, set SG0CTL.PWR to 1. This connects the


SG0 to the clock SG0CLK.
Check bit SG0CTL.OS.
When SG0CTL.OS is 0, the signal at pin SGO is a symmetrical square
waveform with the frequency ftone. When SG0CTL.OS is 1, the signal at pin
SGO is composed of the tone signal and PWM pulses.
The frequency data registers SG0FL and SG0FH provide the buffer values for
the counters. The combined value represents the frequency of the tone.

25.4.2 Start and stop sound

The sound is started by writing a non-zero value to the volume register


SG0PWM.
Before starting the sound, all other register settings must be made.
The sound is stopped by writing 0000H to the volume register SG0PWM. The
sound is stopped regardless of the current value of amplitude output or
frequency output. Thus, the sound can be stopped quickly, even if a very low
sound frequency is chosen.
When the ALD is switched on, the sound stops automatically when the
contents of the volume buffer reaches zero.

25.4.3 Change sound volume

The sound volume is changed by writing a new value to register SG0PWM.


The new volume takes effect with the next edge of the tone pulse (rising or
falling).

Note When the ALD is switched on, the current volume value cannot be read from
register SG0PWM.

25.4.4 INTSG0 interrupt

The interrupt INTSG0 is only generated when the ALD is active


(SG0CTL.ALDS = 1). INTSG0 is generated when the value of the volume
www.DataSheet4U.com buffer is equal to or less than the value written to SG0ITH.
This can be used to reconfigure the Sound Generator when a certain volume
level is reached.
The interrupt does not stop the ALD sound.

User’s Manual U17566EE5V1UM00 945


Chapter 25 Sound Generator (SG)

25.4.5 Constant sound volume

A sound started with SG0CTL.ALDS = 0 is output with the volume value


written to SG0PWM. The sound is output continually and does not stop
automatically. It has to be stopped by writing 0000H to the SG0PWM register.

25.4.6 Generate special sounds

To generate special sounds (like blinker clicks etc.), frequency and volume can
be changed simultaneously.
To change the frequency of a sound that has already started:
1. Write to frequency register SG0FL in 32-bit mode (or to SG0FL and
SG0FH separately in 16-bit mode).
2. Write to volume register SG0PWM.

www.DataSheet4U.com

946 User’s Manual U17566EE5V1UM00


Chapter 26 Power Supply Scheme

The microcontroller has general power supply pins for its core, internal
memory and peripherals. These pins are connected to internal voltage
regulators. The microcontroller also has dedicated power supply pins for
certain I/O modules. These pins provide the power for the I/O operations.

26.1 Overview

The following table gives the naming convention of the pins:

Dedicated function VDD or VSS 5 n


<none> CPU core, internal memory and peripherals • VDD: level 5 V instance
Voltage Drain Drain (nominative) number
A A/D Converter, Voltage Comparators
• VSS:
B Standard I/O buffer Voltage for Substrate
and Source
D • µPD70F3421, µPD70F3422,
µPD70F3423:
LCD Controller/Driver driver I/O
• µPD70F3424, µPD70F3425,
µPD70F3426A: LCD Bus interface I/O
• µPD70F3427: D[31:16] ports, includes
LCD Bus interface I/O
SM Stepper Motor Controller/Driver I/O
M • µPD70F3427: external memory I/F pins
(except D[31:16] ports)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 947


Chapter 26 Power Supply Scheme

The following pins belong to the Power Supply Scheme:

Table 26-1 Power supply pins


Connected to
Pin µPD70F3421, µPD70F3422, µPD70F3424, µPD70F3425,
µPD70F3427
µPD70F3423 µPD70F3426A
VDD50 / CPU core
VSS50 Pin pair is connected to voltage regulator 0.
REGC0 Capacitor for voltage regulator 0 for pin pair VDD50 / VSS50.
VDD51 / CPU core
VSS51 Pin pair is connected to voltage regulator 0.
REGC1 Capacitor for voltage regulator 1 for pin pair VDD51 / VSS51
Clock generation circuit and peripherals
VDD52 /
Power-on-clear circuit
VSS52
Pin pair is connected to a voltage regulator 1.
REGC2 Capacitor for voltage regulator 2 for pin pair VDD52 / VSS52
AVDD / A/D Converter (power supply)
AVSS Voltage Comparators
AVREF A/D Converter (reference input level)
BVDD5n /
I/O buffer (n = 0, 1)
BVSS5n
DVDD50 /
LCD Controller/Driver I/O LCD Bus Interface I/O
DVSS50 D[31:16] ports, including LCD
DVDD51 / Bus Interface I/O
– –
DVSS51
SMVDD5n /
Stepper Motor Controller/Driver (n = 0, 1)
SMVSS5n
MVDD5n / External memory I/F, except
– –
MVSS5n D[31:16] (n = 0 to 4)

Note For electrical characteristics refer to the Data Sheet.

www.DataSheet4U.com

948 User’s Manual U17566EE5V1UM00


Power Supply Scheme Chapter 26

26.2 Description

26.2.1 Devices µPD70F3421, µPD70F3422, µPD70F3423

Figure 26-1 gives an overview of the allocation of power supply pins of the
µPD70F3421, µPD70F3422, µPD70F3423 devices. Their functional
assignment is depicted in more detail in Figure 26-2.

Note The diagrams do not show the exact pin location.

DVDD50
BVDD51

DVSS50
BVSS51
LCD-C/D com/seg

VSS51
REGC1

Regulator 1
VDD52 VDD51
REGC2
VSS52

Standard I/O
Regulator 0
ClockGen CPU
Peripherals RAM BVSS50
POC Flash BVDD50

VSS50
ADC REGC0
VC VDD50

Stepper Motor I/O


AVREF
AVDD
AVSS

SMVSS50
SMVDD50

SMVSS51
SMVDD51

BVSS50
BVDD50

Figure 26-1 Power supply pins for µPD70F3421, µPD70F3422, µPD70F3423


SMVDD50
SMVDD51
DVDD50
BVDD50
BVDD51
VDD50

VDD51

VDD52

AVDD

Reg Reg
0 1
REGC0
REGC1
REGC2

Peripherals LCD Stepper Voltage


Core ClockGen I/O LCD I/O LCD I/O Compa- ADC
Buffer Buffer Buffer voltage Motor AVREF
POC generation Buffer rators
VSS50

VSS51

VSS52

BVSS50
BVSS51

DVSS50

SMVSS50
SMVSS51

AVSS

www.DataSheet4U.com
Figure 26-2 Functional assignment of power supply pins (µPD70F3421, µPD70F3422,
µPD70F3423)

User’s Manual U17566EE5V1UM00 949


Chapter 26 Power Supply Scheme

26.2.2 Devices µPD70F3424, µPD70F3425, µPD70F3426A

Figure 26-3 gives an overview of the allocation of power supply pins of the
µPD70F3424, µPD70F3425, µPD70F3426A devices. Their functional
assignment is depicted in more detail in Figure 26-4.

Note The diagrams do not show the exact pin location.

DVDD50
BVDD51

DVSS50
BVSS51
LCD Bus I/F I/O

VSS51
REGC1

Regulator 1
VDD52 VDD51
REGC2
VSS52

Standard I/O
Regulator 0
ClockGen CPU
Peripherals RAM BVSS50
POC Flash BVDD50

VSS50
ADC REGC0
VC VDD50

Stepper Motor I/O


SMVDD51
SMVDD50

SMVSS51
SMVSS50

BVDD50
BVSS50
AVDD
AVSS
AVREF

Figure 26-3 Power supply pins for µPD70F3424, µPD70F3425, µPD70F3426A


SMVDD50
SMVDD51
DVDD50
BVDD50
BVDD51
VDD50

VDD51

VDD52

AVDD

Reg Reg
0 1
REGC0
REGC1
REGC2

Peripherals LCD-I/F Stepper Voltage


Core ClockGen I/O I/O Compa- ADC
Buffer Motor AVREF
POC Buffer Buffer rators
VSS50

VSS51

VSS52

BVSS50
BVSS51

DVSS50

SMVSS50
SMVSS51

AVSS

Figure 26-4 Functional assignment of power supply pins for µPD70F3424,


µPD70F3425, µPD70F3426A
www.DataSheet4U.com

950 User’s Manual U17566EE5V1UM00


Power Supply Scheme Chapter 26

26.2.3 Device µPD70F3427

Figure 26-5 gives an overview of the allocation of power supply pins of the
µPD70F3427 devices. Their functional assignment is depicted in more detail in
Figure 26-6.

Note The diagrams do not show the exact pin location.

DVDD50

MVSS50
MVSS54

MVSS50
MVSS54
DVSS50

to

to
D[31:16]
LCD Bus I/F I/O Ext. Mem. I/F I/O
DVDD51
DVSS51
VSS51
REGC1
BVDD51 VDD51
BVSS51

Regulator 1
VDD52

Standard I/O
Regulator 0
REGC2 ClockGen CPU
VSS52 Peripherals RAM BVSS50
POC Flash BVDD50

VSS50
ADC REGC0
VC VDD50

Stepper Motor I/O

SMVDD51
SMVDD50

SMVSS51
SMVSS50

BVDD50
BVSS50
AVDD
AVSS
AVREF

Figure 26-5 Power supply pins for µPD70F3427


SMVDD50
SMVDD51
DVDD50
BVDD50
BVDD51
VDD50

VDD51

VDD52

AVDD

Reg Reg
0 1
REGC0
REGC1
REGC2

Peripherals LCD Stepper Voltage


Core ClockGen I/O LCD I/O LCD I/O Compa- ADC
Buffer Buffer Buffer voltage Motor AVREF
POC generation Buffer rators
VSS50

VSS51

VSS52

BVSS50
BVSS51

DVSS50

SMVSS50
SMVSS51

AVSS

Figure 26-6 Functional assignment of power supply pins for µPD70F3427

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 951


Chapter 26 Power Supply Scheme

26.3 Voltage regulators

The on-chip voltage regulators generate the voltages for the internal circuitry
(CPU core, clock generation circuit and peripherals), refer to Figure 26-2,
Figure 26-4 and Figure 26-6.
The regulators operate per default in all operation modes (normal operation,
HALT, IDLE, STOP, WATCH, Sub-WATCH, and during RESET).
During power save modes the voltage regulators can be optionally disabled by
setting the STBCTL register (refer to “Control registers for power save modes“
on page 169).

Note To stabilize the output voltage of the regulator, connect a capacitor to the
REGC pin. Refer to the Data Sheet.

www.DataSheet4U.com

952 User’s Manual U17566EE5V1UM00


Chapter 27 Reset

Several system reset functions are provided in order to initialize hardware and
registers.

27.1 Overview

Features summary A reset can be caused by the following events:


• External reset signal RESET
Noise in the external reset signal is eliminated by an analog filter.
• Power-On-Clear (internal signal RESPOC)
• Overflow of the Watchdog Timer (internal signal RESWDT)
• Main or sub-oscillator fails (internal signals RESCMM, RESCMS)
• Software reset (internal signal RESSW)

As output, the reset function provides two internal reset signals:


• SYSRES (system reset)
• SYSRESWDT (Watchdog Timer reset)

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 953


Chapter 27 Reset

27.1.1 General reset performance

The following figure shows the signals involved in the reset function:

Internal bus

RESPOC: RESSTAT = 01H


RESSTAT RESEXT: RESSTAT = 02H

RESPOC

RESET

Reset
RESCMM SYSRES

RESCMS SYSRESWDT

RESWDT

RESSW

Figure 27-1 Reset function signal diagram

All resets are applied asynchronously. That means, resets are not
synchronized to any internal clock. This ensures that the microcontroller can
be kept in reset state even if all internal clocks fail to operate.
The reset function provides two internal reset signals:
• System reset SYSRES
SYSRES is activated by all reset sources.
• Watchdog reset SYSRESWDT
SYSRESWDT is activated by Power-On-Clear and external RESET only.
Both resets provoke different reset behaviour of the Watchdog Timer. For
details refer to the “Watchdog Timer (WDT)“ on page 565.

(1) Variable reset vector


The flash memory devices allow to program the start address of the user’s
program, instead of starting at address 0000 0000H. The variable reset vector
is stored in the extra area of the flash memory and can be written by an
external flash programmer or in self-programming mode.

www.DataSheet4U.com

954 User’s Manual U17566EE5V1UM00


Reset Chapter 27

(2) Hardware status


With each reset function the hardware is initialized (including the watchdog).
When the reset status is released, program execution is started.
The following table describes the status of the clocks during reset and after
reset release. Note that the clock status "operates" does not inevitably mean
that any function using this clock source operates as well. The function may
additionally require to be enabled by other means.

Table 27-1 Hardware status during and after reset


Item During reset After reset
Main oscillator Stops oscillation Stoppeda
Sub oscillator Operates Starts oscillation
Internal oscillator Operates Starts oscillation
The internal oscillator clock is the default clock source
after reset release.
SSCG clock Stops operation Stoppeda
PLL clock Stops operation Stoppeda
CPU system clock (VBCLK) Stops operation Starts oscillation based on the internal oscillator
clock.
CPU Initialized Program execution starts after oscillation stabilization
time.
Watchdog Timer (WDTCLK) Stops operation Starts operation based on internal oscillator clock
Watch Timer (WTCLK) Stops operation Starts operation based on internal oscillator clock
Peripheral clocks Stop operation • PCLK0–2: operating based on internal-osc
• PCLK3-15: stopped
• SPCLK0–2: operating based on internal-osc
• SPCLK3-15: stopped
On-chip peripheral functions Stop operation Depends on availability of peripheral clock and default
status of the peripheral function.
I/O pins All pins are in input port modeb. See chapter “Pin Functions“ on page 27 for a
(port/alternative function pins) description.
a)
The main oscillator is started by the internal firmware. However the application software has to ensure stable
main oscillation before utilizing this clock for any purpose. SSCG and PLL must be started by the application
software. Assure also here that the stabilization time has passed. See chapter “Clock Generator“ on page 139
for details.
b)
The status of the N-Wire debug interface pins DRST (P05), DDI (P52), DDO (P53), DCK (P54), DMS (P55)
after reset depends on the reset value of the OCDM register, and therefore on the reset source. See chapter
“Pin Functions“ on page 27 for details.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 955


Chapter 27 Reset

(3) Register status


With each reset function the registers of the CPU, internal RAM, and on-chip
peripheral I/Os are initialized.
Since after reset the internal firmware is processed, some resources hold a
different value as after reset, when the user’s program is started. After a reset,
make sure to set the registers to the values needed within your program.

Table 27-2 Initial values of CPU and internal RAM after reset
Initial value
On-chip hardware Register name
After Reset At start of user’s program
CPU Program General-purpose register (r0) 0000 0000H 0000 0000H
registers
General-purpose registers Undefined Undefined
(r1 to r31)
Program counter (PC) 0000 0000H Variable reset vector
programmed to flash extra area
System Status save registers during interrupt Undefined Undefined
registers (EIPC, EIPSW)
Status save registers during non- Undefined Undefined
maskable interrupt (NMI)
(FEPC, FEPSW)
Interrupt cause register (ECR) 0000 0000H 0000 0000H
Program status word (PSW) 0000 0020H • 0000 0020H: if no security
flags or variable reset vector
are set
• 0000 0021H: else
Status save registers during CALLT Undefined Undefined
execution (CTPC, CTPSW)
Status save registers during Undefined Undefined
exception/debug trap (DBPC,
DBPSW)
CALLT base pointer (CTBP) Undefined Undefined
Internal RAM After After Power-On-Clear reset the Undefined Undefined
power-on entire RAM contents is undefined.
After If a RESET occurs while writing to a All data in • 03FF 0000H - 03FF 07FFH:
RESET RAM memory block, the contents of previous undefined
that RAM memory block may be state All other data in previous state
corrupted. All other RAM memory or undefined (refer to note
blocks are not affected. below).
Refer also to the note below the
table.
After any Any internal generated reset does All data in • 03FF 0000H - 03FF 07FFH:
other not change the RAM contents. previous undefined
reset state All other data in previous state.
Peripherals Macro internal registers The reset values of the various registers are
given in the chapters of the peripheral
functions
www.DataSheet4U.com

956 User’s Manual U17566EE5V1UM00


Reset Chapter 27

Note In the table above, “Undefined” means either undefined at the time of a
power-on reset, or undefined due to data destruction when the falling edge of
the external RESET signal corrupts an ongoing RAM write access.
The internal RAM of the microcontroller comprises several separate RAM
blocks. In case writing to one RAM block while a reset occurs the contents of
only this RAM block may be corrupted. The other RAM blocks remain
unchanged.

27.1.2 Reset at power-on

The Power-On-Clear circuit (POC) permanently compares the power supply


voltage VDD with an internal reference voltage (VIP). It ensures that the
microcontroller only operates as long as the power supply exceeds a well-
defined limit.
When the power supply voltage falls below the internal reference voltage
(VDD < VIP), the internal reset signal RESPOC is generated.
After Power-On-Clear reset, the RESSTAT register is cleared and the
RESSTAT.RESPOC bit is set (RESSTAT = 01H, refer also to “RESSTAT - Reset
source flag register“ on page 960 for the interaction between Power-On-Clear
and external RESET). The system reset signals SYSRES and SYSRESWDT
are generated.

Note 1. Depending on the supply voltage drop rate it may be required to apply an
external RESET signal additionally in order to avoid microcontroller
operation out of the specified operating conditions. For detailed electrical
characteristics refer to the Data Sheet.
2. POC shares the reference voltage supply with the power regulators.

The following figure shows the timing when a reset is performed at power-on.
The Power-On-Clear function holds the microcontroller in reset state as long
as the power supply voltage does not exceed the threshold level VIP.

Supply voltage
(VDD)

Internal reference
voltage (VIP)

Delay Time

SYSRES
SYSRESWDT

Reset period Reset period Reset period


www.DataSheet4U.com

Figure 27-2 Timing of internal reset signal generation by Power-On-Clear circuit

User’s Manual U17566EE5V1UM00 957


Chapter 27 Reset

27.1.3 External RESET

Reset is performed when a low level signal is applied to the RESET pin.
The reset status is released when the signal applied to the RESET pin
changes from low to high.
After the external RESET is released, the RESSTAT register is cleared and the
RESSTAT.RESEXT bit is set (RESSTAT = 02H, refer also to “RESSTAT - Reset
source flag register“ on page 960 for the interaction between Power-On-Clear
and external RESET). The system reset signals SYSRES and SYSRESWDT
are generated.

The RESET pin incorporates a noise eliminator, which is applied to the reset
signal RESET. To prevent erroneous external reset due to noise, it uses an
analog filter. Even if no clock is active in the controller the external RESET can
keep the controller in reset state.

Note The internal system reset signals SYSRES and SYSRESWDT keep their
active level for at least four system clock cycles after the RESET pin is
released.

The following figure shows the timing when an external reset is performed. It
explains the effect of the noise eliminator. The noise eliminator uses the analog
delay to prevent the generation of an external reset due to noise.
The analog delay is caused by the analog input filter. The filter regards pulses
up to a certain width as noise and suppresses them. For the minimum RESET
pulse width refer to the Data Sheet.

Internal oscillator
(ROCLK)

Main oscillator
(MOCLK)

CPU clock

RESET

Analog delay Analog Analog


(eliminated as noise) delay delay

Internal system
reset signal

www.DataSheet4U.com min. 4 ROCLK cycles

Figure 27-3 External RESET timing

958 User’s Manual U17566EE5V1UM00


Reset Chapter 27

27.1.4 Reset by Watchdog Timer

The Watchdog Timer can be configured to generate a reset if the watchdog


time expires. After watchdog reset, the RESSTAT.RESWDT bit is set. The
system reset signal SYSRES is generated.
After Watchdog Timer overflow, the reset status lasts for a specific time. Then
the reset status is automatically released.

27.1.5 Reset by Clock Monitor

The two Clock Monitors generate a reset when either the main oscillator or the
sub-oscillator fails. After a Clock Monitor reset, the corresponding bit
(RESSTAT.RESCMM or RESSTAT.RESCMS) is set. The system reset signal
SYSRES is generated.
After a Clock Monitor reset, the reset status lasts for a specific time. Then the
reset status is automatically released.

27.1.6 Software reset

Software reset is generated by two consecutive write accesses:


1. Suspend write protection of RESSWT register:
byte write access to register RESCMD (content of the data is not relevant)
2. Generate software reset:
byte write access to register RESSWT (content of the data is not relevant)
These two steps are required in order to prevent an unintentional software
reset.
The registers RESCMD and RESSWT are always read as 00H.
After software reset, the RESSTAT.RESSW bit is set. The system reset signal
SYSRES is generated.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 959


Chapter 27 Reset

27.2 Reset Registers

The reset functions are controlled and operated by means of the following
registers:

Table 27-3 Reset function registers overview


Register name Shortcut Address
Reset source flag register RESSTAT FFFF FF20H
Software reset register RESSWT FFFF FF22H
Software reset enable register RESCMD FFFF FF24H
Reset status register RES FFFF FF26H

(1) RESSTAT - Reset source flag register


The 8-bit RESSTAT register contains information about which type of resets
occurred since the last Power-On-Clear or external RESET or after the last
software clear of the register.
Each following reset condition sets the corresponding flag in the register. For
example, if a Power-On-Clear reset is finished and then a Watchdog Timer
reset occurs, the RESSTAT reads xxx1 0001B.
Access The register can be read/written in 8-bit units.
Address FFFF FF20H
Initial Value Power-On-Clear reset sets this register to 01H.
External RESET sets this register to 02H.

7 6 5 4 3 2 1 0
X X RESSW RESWDT RESCM2 RESCM1 RESEXT RESPOC
R R R/Wa R/Wa R/Wa R/Wa R/Wa R/Wa
a) Any write clears this register, independent of the data written.

Table 27-4 RESSTAT register contents (1/2)


Bit position Bit name Function
5 RESSW Software reset
0: Not generated.
1: Generated.
4 RESWDT Reset by Watchdog Timer
0: Not generated.
1: Generated.
3 RESCM2 Reset by Clock Monitor of sub oscillator
0: Not generated.
www.DataSheet4U.com 1: Generated.

960 User’s Manual U17566EE5V1UM00


Reset Chapter 27

Table 27-4 RESSTAT register contents (2/2)


Bit position Bit name Function
2 RESCM1 Reset by Clock Monitor of main oscillator
0: Not generated.
1: Generated.
1 RESEXT External RESET
0: Not generated.
1: Generated.
0 RESPOC Reset at Power-On-Clear
0: Not generated.
1: Generated.

Note If clearing this register by writing and flag setting (occurrence of reset) conflict,
flag setting takes precedence.

RESPOC and Both Power-On-Clear and external RESET set RESSTAT to different initial
RESEXT states.
• Power-On-Clear reset sets RESSTAT = 01H
• External RESET sets RESSTAT = 02H
Special caution is required if both reset events are active concurrently:
• If the Power-On-Clear reset is longer active than the external RESET:
RESSTAT = 01H. That means RESSTAT indicates only the occurrence of
the Power-On-Clear reset.
• If the external RESET is longer active than the Power-On-Clear reset:
RESSTAT = 02H.That means RESSTAT indicates only the occurrence of the
external RESET.
• If the Power-On-Clear reset and external RESET has been released
simultaneously: RESSTAT = 03H. That means RESSTAT indicate the
occurrence of both reset events.
All other reset events just set their respective bit in RESSTAT and do not
change the others.

(2) RESSWT - Software reset register


Write operation to the 8-bit RESSWT register generates a software reset. The
content of data written to RESSWT is not relevant.
Writing to this register is protected by a special sequence of instructions. To
enable write access to RESSWT, first write to RESCMD. Please refer to “Write
Protected Registers“ on page 135 for details.
The register is always read as 00H.
Access This register can only be written in 8-bit units.
Address FFFF FF22H
w w w . D a t a S h e e t 4 U . c o m
Initial Value 00H

7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0
W W W W W W W W

User’s Manual U17566EE5V1UM00 961


Chapter 27 Reset

(3) RESCMD - Software reset enable register


Immediately after writing data to the 8-bit RESCMD register, write access to
the RESSWT register is enabled. The content of data written to RESCMD
register is not relevant.
The register is always read as 00H.
Access This register can only be written in 8-bit units.
Address FFFF FF24H
Initial Value 00H

7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0
W W W W W W W W

Caution In case a high level programming language is used, make sure that the
compiler translates the two write instructions to RESCMD and RESSWT into
two consecutive assembler “store” instructions.

(4) RES - Reset status register


The 8-bit RES register indicates the status of a write attempt to a register
protected by RESCMD (see also “RESCMD - Software reset enable register“
on page 962).
The register is always read as 00H.

Access This register can be read/written in 8-bit units.


Address FFFF FF26H
Initial Value 00H

7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 RERR
Ra Ra Ra Ra Ra Ra Ra R/W
a) These bits may be written, but write is ignored.

Table 27-5 RES register contents


Bit position Bit name Function
0 RERR Write error status:
0: Write access was successful.
1: Write access failed.
You can clear this register by writing 0 to it. Setting this register to 1 by software is
not possible.

www.DataSheet4U.com
Note RES.RERR is set, if a write access to register RESMD is not directly followed
by a write access to one of the write-protected registers.

962 User’s Manual U17566EE5V1UM00


Chapter 28 Voltage Comparator

The microcontroller has two instances of a Voltage Comparator.

Note Throughout this chapter, the individual instances of the Voltage Comparator
are identified by “n”, for example INTVCn for the generated interrupt signal.

28.1 Overview

The Voltage Comparator compares an external voltage VCMPn at pin VCMPn


and the internal reference voltage VLVI and generates an interrupt if
VCMPn < VLVI.
The comparison is mainly used to identify voltage drops of the external power
supply. The CPU has then the possibility to reduce its own power consumption.
By this it can avoid that its own power supply is dropping below the operating
conditions.
Features summary The Voltage Comparator has the following special features:
• Comparison of an external voltage with the internal reference voltage
• Can be completely switched off (in order to achieve zero stand-by current)
• Shares the reference voltage supply with the power regulators
• Delivers status information to the CPU:
– The compare result can be read by the CPU
– An interrupt can be generated on falling edge, rising edge, or both edges
of external supply voltage
– Each Voltage Comparator generates a separate interrupt INTVCn
• Can operate in STOP mode.

Note For details on the voltage levels refer to the Data Sheet.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 963


Chapter 28 Voltage Comparator

28.1.1 Description

Each Voltage Comparator consists of an operation amplifier and a logic block.


The operation amplifier is connected to the external voltage (VCMPn) with one
input and to an internal reference voltage (VLVI) with the other. It shares the
reference voltage supply with the power regulators. The comparator output is
fed into a logic block that generates the interrupt signal INTVCn and sets or
clears the flag VCSTRn.VCFn. The comparison result is also output to the
VCMPOn pins.
The figure below shows a block diagram of the Voltage Comparator.

VCMPOn

VCMPn +
Logic
Block INTVCn
-
VCMPn

VLVI
VCSTRn.VCFn

Figure 28-1 Voltage Comparator block diagram

28.1.2 Comparison results

Voltage comparison leads to the following results:


• Output signal VCMPOn and flag VCSTRn.VCFn
– VCMPn < VLVI:
The output signal VCMPOn of the Voltage Comparator is low and the
flag VCSTRn.VCFn is cleared.
– VCMPn > VLVI:
The output signal VCMPOn of the Voltage Comparator is high and the
flag VCSTRn.VCFn is set.
• Interrupt signal INTVCn
Depending on the settings of bits VCCTLn.ESn[1:0], the interrupt signal
INTVCn is generated upon one or both of the above transitions of VCMPn.

28.1.3 Stand-by mode

In order to reduce power consumption during STOP mode, the Voltage


Comparator can be set into stand-by mode. This is done by setting
VCCTLn.VCEn = 0.
www.DataSheet4U.com If the Voltage Comparator is set in stand-by mode it assumes that
VCMPn > VLVI (VCSTRn.VCFn = 1 and VCMPOn = high level).

964 User’s Manual U17566EE5V1UM00


Voltage Comparator Chapter 28

28.2 Voltage Comparator Registers

The Voltage Comparator is controlled by means of the following registers:

Table 28-1 Voltage Comparator registers overview


Register name Shortcut Address
Voltage Comparator n control register VCCTLn <base>
Voltage Comparator n status register VCSTRn <base> + 2H

Table 28-2 Base addresses of Voltage Comparator instances


Instance number Base address
0 FFFF FF10H
1 FFFF FF14H

(1) VCCTLn - Voltage Comparator n control register


The 8-bit VCCTLn register controls whether the Voltage Comparator is
operating or is in stand-by mode. Further it specifies whether an interrupt is
generated when VCMPn rises above or falls below VLVI or any at of both
transitions.
Access This register can be read/written in 8-bit or 1-bit units.
Address <base>
Initial Value 00H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
VCEn 0 0 0 0 0 ESn1 ESn0
R/W R R R R R R/W R/W

Table 28-3 VCCTLn register contents


Bit position Bit name Function
7 VCEn Enable Voltage Comparator
0: stand-by (VCSTRn.VCFn = 1, VCMPOn = high level)
1: Operating
1 to 0 ESn[1:0] VCMPOn edge selection for interrupt
ESn1 ESn0 Operation

0 0 falling edge

0 1 rising edge

1 0 reserved

1 1 both edges
www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 965


Chapter 28 Voltage Comparator

Caution If the voltage comparator input level VCMPn is below the reference voltage VLVI
an INTVCn interrupt is generated under both following conditions:
• The comparator is enabled (VCCTLn.VCEn = 0 →1) and falling or both
edges are specified (VCCTLn.VCEn = 00B or 11B).
• The comparator is disabled (VCCTLn.VCEn = 1 →0) and rising or both
edges are specified (VCCTLn.VCEn = 01B or 11B).

(2) VCSTRn - Voltage Comparator n status register


The 8-bit VCSTRn register reflects the result of the voltage comparison.
Access This register is read-only, in 8-bit or 1-bit units.
Address <base> + 2H
Initial Value 01H. This register is cleared by any reset.

7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 VCFn
R R R R R R R R

Table 28-4 VCSTRn register contents


Bit position Bit name Function
0 VCFn Voltage Comparator status flag
0: Input voltage is below reference voltage.
1: Input voltage is above reference voltage.

www.DataSheet4U.com

966 User’s Manual U17566EE5V1UM00


Voltage Comparator Chapter 28

28.3 Timing

The following figure shows the timing of the Voltage Comparator. In this
example, the interrupt INTVCn is generated at the falling edge
(VCCTLn.ESTn[1:0] = 00B) of the comparator’s output signal.

External voltage

Internal reference
voltage

Time

Delay Delay Delay Delay


Delay

VCMPOn

INTVCn

VCSTRn.VCFn

Figure 28-2 Voltage Comparator timing

Note For details on the delay time refer to the Data Sheet.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 967


Chapter 28 Voltage Comparator

www.DataSheet4U.com

968 User’s Manual U17566EE5V1UM00


Chapter 29 On-Chip Debug Unit

The microcontroller includes an on-chip debug unit. By connecting an N-Wire


emulator, on-chip debugging can be executed.

29.1 Functional Outline

29.1.1 Debug functions

(1) Debug interface


Communication with the host machine is established by using the DRST, DCK,
DMS, DDI, and DDO signals via an N-Wire emulator. The communication
specifications of N-Wire are used for the interface.

(2) On-chip debug


On-chip debugging can be executed by preparing wiring and a connector for
on-chip debugging on the target system. An N-Wire emulator is used to
connect the host PC to the on-chip debug unit.

(3) Forced reset function


The microcontroller can be forcibly reset.

(4) Break reset function


The CPU can be started in the debug mode immediately after reset of the CPU
is released.

(5) Forced break function


Execution of the user program can be forcibly aborted.

(6) Hardware break function


Two breakpoints for instruction and data access can be used. The instruction
breakpoint can abort program execution at any address. The access
breakpoint can abort program execution by data access to any address.

(7) Software break function


Up to eight software breakpoints can be set in the internal flash memory area.
The number of software breakpoints that can be set in the RAM area differs
depending on the debugger to be used.
The software breakpoints utilize the “DBTRAP” ROM correction function. Thus
following software breakpoints can be set:
• 8 breakpoints in the VFB flash memory address range
• 8 breakpoints in the VSB flash memory address range (µPD70F3426A
www.DataSheet4U.com only)

User’s Manual U17566EE5V1UM00 969


Chapter 29 On-Chip Debug Unit

(8) Debug monitor function


A memory space for debugging that is different from the user memory space is
used during debugging (background monitor mode). The user program can be
executed starting from any address.
While execution of the user program is aborted, the user resources (such as
memory and I/O) can be read and written, and the user program can be
downloaded.

(9) Mask function


Each of the following signals can be masked. That means these signals will not
be effective during debugging.
The correspondence with the mask functions of the debugger (ID850NWC) for
the N-Wire emulator (IE-V850E1-CD-NW) of NEC Electronics is shown below.

– NMI0 mask function: NMI pin


– NMIWDT mask function: Watchdog Timer interrupt NMIWDT
– Reset mask function: all reset sources

(10) Timer function


The execution time of the user program can be measured.

(11) Peripheral macro operation/stop selection function during break


Depending on the debugger to be used, certain peripheral macros can be
configured to continue or to stop operation upon a breakpoint hit.
• Functions that are always stopped during break
– Watchdog Timer
• Functions that can operate or be stopped during break (however, each
function cannot be selected individually)
– A/D Converter
– All timers P
– All timers Z
– Timer Y
– Watch Timer
• Peripheral functions that continue operating during break (functions that
cannot be stopped)
– Peripheral functions other than above

(12) Function during power saving modes


When the device is set into a power saving mode, debug operation is not
possible. When exiting the power save mode, the on-chip debug unit continues
operation.
The N-Wire interface is still accessible during power saving modes:
• N-Wire emulator can get status information from the on-chip debug unit.
• Stop mode can be released by the N-Wire emulator.
www.DataSheet4U.com

970 User’s Manual U17566EE5V1UM00


On-Chip Debug Unit Chapter 29

29.1.2 Security function

This microcontroller has a N-Wire security function, that demands the user to
input an ID code upon start of the debugger. The ID code is compared to a
predefined ID code, written in advance to the internal flash memory by an
external flash programmer. This function prevents unauthorized persons to
operate the microcontroller in N-Wire debug mode and to read the internal
flash memory area.
The ID code in the internal flash memory can be written by an external flash
programmer or in self-programming mode.
ID code Be sure to write an ID code when writing a program to the internal flash
memory.
The area of the ID code is 10 bytes wide and in the range of addresses
0000 0070H to 0000 0079H.
The ID code when the memory is erased is shown below.
Address ID code
0000 0079H FFH
0000 0078H FFH
0000 0077H FFH
0000 0076H FFH
0000 0075H FFH
0000 0074H FFH
0000 0073H FFH
0000 0072H FFH
0000 0071H FFH
0000 0070H FFH

Security bit Bit 7 of address 0000 0079H enables or disables use of the N-Wire emulator.
• Bit 7 of address 0000 0079H
0: disabled N-Wire emulator cannot connect to the on-chip debug unit.
1: enabled N-Wire emulator can connect to the on-chip debug unit if the
10-byte ID code input matches the ID code stored in the flash
memory
The security bit can be modified by an external flash programmer or in self-
programming mode.
After reset the entire ID code area is set to FFH. This means that
• N-Wire debugging is generally enabled
• the ID code is FFH for all ID code bytes
Consequently controller access is possible without any restriction.

www.DataSheet4U.com
Caution If access via the N-Wire interface should be disabled "block erase disabled"
should be configured as well. Otherwise the flash memory blocks containing
the ID code could be erased and N-Wire access could be enabled.

User’s Manual U17566EE5V1UM00 971


Chapter 29 On-Chip Debug Unit

Security disable The entire ID code, i.e. also the security bit 7 of address 0000 0079H, can be
made temporarily ineffective by software. This is achieved by setting the
control bit RSUDISC.DIS = 1. Setting RSUDISC.DIS = 1 does not change the
security bit. Thus after a Power-On-Clear reset the N-Wire security is effective
again.
The N-Wire security function can not be suspended when the microcontroller
is operating in N-Wire debug mode.

(1) RSUDISC- N-Wire security disable control register


The 8-bit RSUDISC register is used to temporarily disable the N-Wire security
function.
Access This register can be read/written in 8-bit or 1-bit units.
Writing to this register is protected by a special sequence of instructions.
Please refer to “RSUDISCP - RSUDISC write protection register“ on page 973
for details.
Address FFFF F9E0H.
Initial Value 00H. This register is cleared by Power-On-Clear reset.

7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 DIS
R R R R R R R R/W

Table 29-1 RSUDISC register contents


Bit position Bit name Function
0 DIS N-Wire security function disable:
0: N-Wire security function enabled.
1: N-Wire security function disabled.

RSUDISC.DIS can not be changed, while the microcontroller is operating in


N-Wire debug mode, i.e. while the concerned ports are operating as N-Wire
debug pins (OCDM.OCDM0 = 1).
Thus proceed as follows to
• enable N-Wire debugging (from status OCDM.OCDM0 = 0):
– set RSUDISC.DIS = 1 (disable N-Wire security)
– set OCDM.OCDM0 = 1 (ports are N-Wire pins)
• disable N-Wire debugging (from status OCDM.OCDM0 = 1):
– set OCDM.OCDM0 = 0 (ports are not N-Wire pins)
– set RSUDISC.DIS = 0 (ensable N-Wire security)

www.DataSheet4U.com

972 User’s Manual U17566EE5V1UM00


On-Chip Debug Unit Chapter 29

(2) RSUDISCP - RSUDISC write protection register


The 8-bit RSUDISCP register protects the register RSUDISC from inadvertent
write access.
After data has been written to the RSUDISCP register, the first write access to
register RSUDISC is valid. All subsequent write accesses are ignored. Thus,
the value of RSUDISC can only be rewritten in a specified sequence, and
illegal write access is inhibited.
Access This register can only be written in 8-bit units.
Address FFFF FCA4H
Initial Value The contents of this register is undefined.
7 6 5 4 3 2 1 0
X X X X X X X X
W W W W W W W W

After writing to the RSUDISCP register, you are permitted to write once to
RSUDISC. The write access to RSUDISC must happen with the immediately
following instruction.

w w w . D a t a S h e e t 4 U . c o m

User’s Manual U17566EE5V1UM00 973


Chapter 29 On-Chip Debug Unit

29.2 Controlling the N-Wire Interface

The N-Wire interface pins DRST, DDI, DDO, DCK, DMS are shared with port
functions, see Table 29-2. During debugging the respective device pins are
forced into the N-Wire interface mode and port functions are not available.
Note that N-Wire debugging must be generally permitted by the security bit in
the ID code region (*0x0000 0079[bit7] = 1) of the flash memory.
An internal pull-down resistor - detachable by software - is provided at the
DRST pin to keep the N-Wire interface in reset, if no debugger is connected.

Table 29-2 N-Wire interface pins


N-Wire function
GPIO
Pin Direction Description
P05 DRST Input N-Wire RCU reset
P52 DDI Input N-Wire debug data in
P53 DDO Output N-Wire debug data out
P54 DCK Input N-Wire interface clock
P55 DMS Input N-Wire mode

(1) OCDM - On-chip debug mode register


The OCDM0 control bit in the OCDM register determines the function of these
device pins.
The register can be read or written in 8-bit and 1-bit units.
Address FFFF F9FCH

7 6 5 4 3 2 1 0
Bit name 0 0 0 0 0 0 0 OCDM0
Reset value 0 0 0 0 0 0 0 0/1a
a) Reset value depends on reset source (see below)

OCDM0 Usage of N-Wire pins


0 Pins used as port/alternative function pins
1 Pins used as N-Wire interface pins

The reset value of OCDM.OCDM0 depends on the reset source.

(2) Power-On-Clear RESPOC


RESPOC (Power-On-Clear) reset sets OCDM.OCDM0 = 0, i.e. the pins are
defined as port pins. The debugger can not communicate with the controller
and the N-Wire debug circuit is disabled. The first CPU instructions after
www.DataSheet4U.com RESPOC can not be controlled by the debugger. The application software
must set OCDM.OCDM0 = 1 in order to enable the N-Wire interface and allow
debugger access to the on-chip debug unit.
During and after POC reset (OCDM.OCDM0 = 0) pins P05, P52…P55 are
configured as input ports.

974 User’s Manual U17566EE5V1UM00


On-Chip Debug Unit Chapter 29

(3) External RESET


External reset by the RESET pin sets OCDM.OCDM0 = 1, i.e. the pins are
defined as N-Wire interface pins. If connected the debugger can communicate
with the on-chip debug unit and take over CPU control.
During and after RESET the pins P05, P52…P55 are configured as follows:
• DRST, DDI, DCK, DMS are inputs.
• DDO is output, but in high impedance state as long as DRST = 0.

(4) Other resets


Resets from all other reset sources do not affect the pins P05, P52...P55.
An internal pull-down resistor is provided for the pin P05/DRST. During and
after any reset the resistor is connected to P05/DRST, ensuring that the
N-Wire interface is kept in reset state, if no debugger is connected. The
internal pull-down resistor is connected by reset from any source and can be
disconnected via the port configuration register bit PFC0.PDC05.
The DRST signal depicts the N-Wire interface reset signal. If DRST = 0 the
on-chip debug unit is kept in reset state and does not impact normal controller
operation. DRST is driven by the debugger, if one is connected. The debugger
may start communication with the controller by setting DRST = 1.

Caution If no external RESET signal is available, the user software must activate the
N-Wire interface pins by setting OCMD.OCDM0 = 1.
Otherwise debugging via N-Wire is not possible.

Pin configuration • In N-Wire debug mode the configuration of the N-Wire interface pins can not
be changed by the pin configuration registers. The registers contents can be
changed but will have no effect on the pin configuration.
• In N-Wire debug mode the output current limiting function of the DDO pin is
disabled. By this means the port pin provides maximum driver capability in
order to maximize the transmission data rate to the N-Wire debugger. Note
that the settings of the port registers are not affected.

Note This chapter describes the N-Wire interface control only. An additional security
function decides, if the debugger access to the microcontroller is granted or
not. Please refer to “Code Protection and Security“ on page 393.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 975


Chapter 29 On-Chip Debug Unit

29.3 N-Wire Enabling Methods

29.3.1 Starting normal operation after RESET and RESPOC

For “normal operation” it has to be assured that the pins P05, P52…P55 are
available as port pins after either reset event. Therefore the software has to
perform OCDM.OCDM0 = 0 to make the pins available as port pins after
RESET.
Note that after any external reset via the RESET pin OCDM.OCDM0 is set to
"1" and the pins P05, P52…P55 are not available as application function pins
until the software sets OCDM.OCDM0 = 0.

RESET

“1”
RESPOC
Application software
“0” sets OCDM.OCDM0=0
OCDM0

P05/DRST XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXX

reset normal operation reset normal operation

Figure 29-1 Start without N-Wire activation

29.3.2 Starting debugger after RESET and RESPOC

The software has to set OCDM.OCDM0 = 1 for enabling the N-Wire interface
also upon a RESPOC event. Afterwards the debugger may start to establish
communication with the controller by setting the DRST pin to high level and to
take control over the CPU.
On start of the debugger the entire controller is reset, i.e. all registers are set to
their default states and the CPU's program counter is set to the reset vector
0000 0000H respectively to the variable reset vector.

Note After RESPOC the controller is operating without debugger control. Thus all
CPU instructions until the software performs OCDM.OCDM0 = 1 can not be
debugged. To restart the user’s program from beginning under the debugger’s
control apply an external RESET after the debugger has started, as shown in
Figure 29-2. This will cause the program to restart. However the status of the
www.DataSheet4U.com
controller might not be the same as immediately after RESPOC, since the
internal RAM may have already been initialized, when the external RESET is
applied.

976 User’s Manual U17566EE5V1UM00


On-Chip Debug Unit Chapter 29

RESET

Application software “1”


RESPOC sets OCDM.OCDM0=1

“0”
OCDM0
Debugger starts
PC = 0
P05/DRST XXXXXXXXXXXXXX

reset normal operation Debug

Figure 29-2 Start with N-Wire activation

29.3.3 N-Wire activation by RESET pin

The N-Wire interface can also be activated after power up by keeping RESET
active for at least 2 sec after RESPOC release. By this OCDM.OCDM0 is set
to "1", thus the N-Wire interface is enabled.
With this method the user's program does not need to perform
OCDM.OCDM0 = 1.

RESET

“1”
RESPOC

“0”
OCDM0 Debugger starts
PC = 0

P05/DRST XXXXXXXXX

reset normal operation debug

>= 2000ms

Figure 29-3 N-Wire activation by RESET pin

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 977


Chapter 29 On-Chip Debug Unit

29.4 Connection to N-Wire Emulator

To connect the N-Wire emulator, a connector for emulator connection and a


connection circuit must be mounted on the target system.
As a connector example the KEL connector is described in more detail. Other
connectors, like for instance MICTOR connector (product name: 2-767004-2,
Tyco Electronics AMP K.K.), are available as well. For the mechanical and
electrical specification of these connectors refer to user’s manual of the
emulator to be used.

29.4.1 KEL connector

KEL connector product names:


• 8830E-026-170S (KEL): straight type
• 8830E-026-170L (KEL): right-angle type

Figure 29-4 Connection to N-Wire emulator (NEC Electronics IE-V850E1-CD-NW:


N-Wire Card)

www.DataSheet4U.com

978 User’s Manual U17566EE5V1UM00


On-Chip Debug Unit Chapter 29

(1) Pin configuration


Figure 29-5 shows the pin configuration of the connector for emulator
connection (target system side), and Table 29-3 on page 980 shows the pin
functions.

Figure 29-5 Pin configuration of connector for emulator connection (target system
side)

Caution Evaluate the dimensions of the connector when actually mounting the
connector on the target board.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 979


Chapter 29 On-Chip Debug Unit

(2) Pin functions


The following table shows the pin functions of the connector for emulator
connection (target system side). “I/O” indicates the direction viewed from the
device.

Table 29-3 Pin functions of connector for emulator connection (target system side)
Pin no. Pin name I/O Pin function
A1 (Reserved 1) – (Connect to GND)
A2 (Reserved 2) – (Connect to GND)
A3 (Reserved 3) – (Connect to GND)
A4 (Reserved 4) – (Connect to GND)
A5 (Reserved 5) – (Connect to GND)
A6 (Reserved 6) – (Connect to GND)
A7 DDI Input Data input for N-Wire interface
A8 DCK Input Clock input for N-Wire interface
A9 DMS Input Transfer mode select input for N-Wire interface
A10 DDO Output Data output for N-Wire interface
A11 DRST Input On-chip debug unit reset input
A12 RESET Input Reset input. (In a system that uses only POC reset and not pin
reset, some emulators input an external reset signal as shown in
Figure 29-6 on page 981 to set the OCDM0 bit to 1.)
A13 FLMD0a Input Control signal for flash download (flash memory versions only)

B1 GND – –
B2 GND – –
B3 GND – –
B4 GND – –
B5 GND – –
B6 GND – –
B7 GND – –
B8 GND – –
B9 GND – –
B10 GND – –
B11 (Reserved 8) – (Connect to GND)
B12 (Reserved 9) – (Connect to GND)
B13 VDD – 5 V input (for monitoring power supply to target)
a)
The FLMD0 signal is not required, if the N-Wire debugger serves the FLMD0 signal internally by using the
SELFEN register to enable flash self-programming (refer to “Flash Self-Programming“ on page 275). Howev-
er the FLMD0 signal may be connected.

www.DataSheet4U.com Caution 1. The connection of the pins not supported by the microcontroller is
dependent upon the emulator to be used.
2. The pattern of the target board must satisfy the following conditions.
• The pattern length must be 100 mm or less.
• The clock signal must be shielded by GND.

980 User’s Manual U17566EE5V1UM00


On-Chip Debug Unit Chapter 29

(3) Example of recommended circuit


An example of the recommended circuit of the connector for emulator
connection (target system side) is shown below.

5V
V850E/Dx3 KEL connector
8830E-026-170S
5V
A1 B13
(Reserved 1) VDDNote 3
A2 B1
(Reserved 2) GND
A3 B2
(Reserved 3) GND
A4 B3
(Reserved 4) GND
A5 B4
(Reserved 5) GND
A6 B5
(Reserved 6) GND
B6
GND
Note 1 A7 B7
DDI DDI GND
Note 2 A8 B8
DCK DCK GND
Note 1 A9 B9
DMS DMS GND
Note 1 A10 B10
DDO DDO GND
Note 1 A11
DRST DRST
B11
(Reserved 8)
Notes 1, 5 A13 B12
FLMD0 FLMD0 (Reserved 9)

Note 4 A12
RESET RESET

Figure 29-6 Example of recommended emulator connection circuit

Note 1. The pattern length must be 100 mm or less.


2. Shield the DCK signal by enclosing it with GND.
3. This pin is used to detect power to the target board. Connect the voltage of
the N-Wire interface to this pin.
4. In a system that uses only POC reset and not pin reset, some emulators
input an external reset signal as shown in Figure 29-6 to set the
OCDM.OCDM0 bit to 1.
5. The FLMD0 signal is not required, but may be connected.

Caution The N-Wire emulator may not support a 5 V interface and may require a level
shifter. Refer to the user’s manual of the emulator to be used.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 981


Chapter 29 On-Chip Debug Unit

29.5 Restrictions and Cautions on On-Chip Debug


Function

• Do not mount a device that was used for debugging on a mass-produced


product (this is because the flash memory was rewritten during debugging
and the number of rewrites of the flash memory cannot be guaranteed).
• If a reset signal (reset input from the target system or reset by an internal
reset source) is input during RUN (program execution), the break function
may malfunction.
• Even if reset is masked by using a mask function, the I/O buffer (port pin,
etc.) is reset when a pin reset signal is input.
• With a debugger that can set software breakpoints in the internal flash
memory, the breakpoints temporarily become invalid when pin reset or
internal reset is effected. The breakpoints become valid again if a break
such as a hardware break or forced break is executed. Until then, no
software break occurs.
• The RESET signal input is masked during a break.
• The POC reset operation cannot be emulated.
• The on-chip debugging unit uses the exception vector address 60H for
software breakpoint (DBTRAP, refer to “Interrupt Controller (INTC)“ on
page 201). Thus the debugger takes over control when one of the following
exceptions occur:
– debug trap (DBTRAP)
– illegal opcode detection (ILGOP)
– ROM Correction
The debugger executes its own exception handler. Therefore, the user's
exception handler at address 60H will not be executed.
• The maximum input clock DCK of the N-Wire debugger interface is limited to
10 MHz. Thus on-chip debugging is not possible in case that the input clock
DCK is set to above 10 MHz.
Implement all of the following measures:
– While debugging with any N-Wire based emulator, limit the maximum
input clock of DCK to 10 MHz.
– Consult the latest tool documentation in order to verify that no On-Chip
Debugger option is configured in your environment that will configure a
higher DCK input clock than 10 MHz.
– Set the following environment variable: IE850_JCNDREGINIT = 320

Special hint for 850Eserv:


Above mentioned configuration can be achieved by setting the On-Chip
Debugger emulator option: ”-2m”.
Never set the On-Chip Debugger emulator option ”-dck20”, since it would
configure a DCK input clock of 20 MHz.
• Execution stop of firmware at user breakpoint
www.DataSheet4U.com
If during program execution a reset occurs (either from any internal reset
source or from the external RESET pin), the On-Chip Debugger may stop at
the address of a previously configured S/W or H/W breakpoint during the
execution of the firmware start-up code. In this case, the following error
message may be output:
"Couldn’t read flash memory at xxx 0xc25 user system error (mask rom
>area)"

982 User’s Manual U17566EE5V1UM00


On-Chip Debug Unit Chapter 29

To avoid this situation do not set any kind of breakpoint (neither S/W nor H/
W breakpoint) within any of the following address ranges:
– 0000H to 000FH
– 06D0H to 2B23H
Special hint:
Reserve the address range 06D0H to 2B23H for constant data placement. In
case using NEC’s directive files, which are part of the device file package,
this is the default assignment. If the program requires less constant data
than that address space offers, modify the linker directive file in a way, that
program code does not start before the address 2B24H.

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 983


Chapter 29 On-Chip Debug Unit

www.DataSheet4U.com

984 User’s Manual U17566EE5V1UM00


Appendix A Registers Access Times

This chapter provides formulas to calculate the access time to registers, which
are accessed via the peripheral I/O areas.
All accesses to the peripheral I/O areas are passed over to the NPB bus via
the VSB - NPB bus bridge BBR. Read and write access times to registers via
the NPB depend on the register, the system clock VBCLK and the setting of
the VSWC register.
The CPU operation during an access to a register via the NPB depends also
on the kind of peripheral I/O area:
• Fixed peripheral I/O area
During a read or write access the CPU operation stops until the access via
the NPB is completed.
• Programmable peripheral I/O area
During a read access the CPU operation stops until the read access via the
NPB is completed.
During a write access the CPU operation continues operation, provided any
preceded NPB access is already finished. If a preceded NPB access is still
ongoing the CPU stops until this access is finished and the NPB is cleared.

The following formulas are given to calculate the access times Ta, when the
CPU reads from or writes to special function registers via the NPB bus.
The access time depends
• on the CPU system clock frequency fVBCLK
• on the setting of the internal peripheral function wait control register VSWC,
which determines the address set up wait SUWL = VSWC.SUWL and data
wait VSWL = VSWC.VSWL (refer to “VSWC - Internal peripheral function
wait control register“ on page 303 for the correct values for a certain CPU
system clock VBCLK)
• for some registers on the clock frequency applied to the module

Note “ru[...]” in the formulas mean “round up” the calculated value of the term in
squared brackets.

All formulas calculate the maximum access time.

CPU access For calculating the access times for CPU accesses 1 VBLCK period time 1/
fVBCLK has to be added to the results of the formulas.

DMA access For accesses of the DMA Controller the given formulas calculate the exact
www.DataSheet4U.com
values.

User’s Manual U17566EE5V1UM00 985


Appendix A Registers Access Times

A.1 Timer P

Register TPnCCR0, TPnCCR1


Access R
⎧ VBCLK f ⎫ 1
- + 1 ⋅ ( 2 + VSWL ) ⎬ ⋅ ------------------
Formula T a = ⎨ SUWL + VSWL + 3 + ru ---------------------------------------------------------
⎩ ( 2 + VSWL ) ⋅ f PCLK0 f ⎭ VBCLK

Access W
⎧ VBCLK5⋅ f ⎫ 1
- + 1 ⋅ ( 2 + VSWL ) ⎬ ⋅ ------------------
Formula T a = ⎨ SUWL + VSWL + 3 + ru ---------------------------------------------------------
⎩ ( 2 + VSWL ) ⋅ f PCLK0 f ⎭ VBCLK

Register TPnCNT
Access R
⎧ VBCLK f ⎫ 1
- + 1 ⋅ ( 2 + VSWL ) ⎬ ⋅ ------------------
Formula T a = ⎨ SUWL + VSWL + 3 + ru ---------------------------------------------------------
⎩ ( 2 + VSWL ) ⋅ f PCLK0 f ⎭ VBCLK

Access W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

Register all other


Access R/W (no write access during timer operation)
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

www.DataSheet4U.com

986 User’s Manual U17566EE5V1UM00


Registers Access Times Appendix A

A.2 Timer Z

Register TZnCNT0
Access R
·
1 4, 5
Formula T a = ( SUWL + 3 ⋅ VSWL + 6 ) ⋅ ------------------ + ------------------
f VBCLK f PCLK2

Register TZnCNT1
Access R
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

Register TZnR
Access R
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

Access W
1 4, 5
Formula T a = ( SUWL + 3 ⋅ VSWL + 6 ) ⋅ ------------------ + ------------------
f VBCLK f PCLK2

Register TZnCTL
Access R/W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 987


Appendix A Registers Access Times

A.3 Timer Y

Register TYnCNT0
Access R
1 1
Formula T a = ( SUWL + 3 ⋅ VSWL + 6 ) ⋅ ------------------ + ---------------------
f VBCLK f SPCLK1

Register TYnCNT1
Access R
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

Register TYnR
Access R
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

Access W
1 1
Formula T a = ( SUWL + 3 ⋅ VSWL + 6 ) ⋅ ------------------ + ---------------------
f VBCLK f SPCLK1

Register TYnCTL
Access R/W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

www.DataSheet4U.com

988 User’s Manual U17566EE5V1UM00


Registers Access Times Appendix A

A.4 Timer G

Register TMGn0, TMGn1


Access R
⎧ VBCLK f 1⎫
- + 1 ⋅ ( 2 + VSWL ) ⎬ ⋅ ------------------
Formula T a = ⎨ SUWL + VSWL + 3 + ru ------------------------------------------------------------
⎩ ( 2 + VSWL ) ⋅ f SPCLK0 f ⎭ VBCLK

Access W (no write access during timer operation)


1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

Register GCCn[5:0]
Access R
⎧ VBCLK f 1⎫
- + 1 ⋅ ( 2 + VSWL ) ⎬ ⋅ ------------------
Formula T a = ⎨ SUWL + VSWL + 3 + ru ------------------------------------------------------------
⎩ ( 2 + VSWL ) ⋅ f SPCLK0 f ⎭ VBCLK

Access W (for GCCn0 and GCCn5 no write access during timer operation)
Formula • for multiple write within 7 SPCLK0 periods
⎧ fVBCLK ⎫ 1
Ta = ⎨ SUWL + VSWL + 3 + ru ------------------------------------------------------------- + 1 ⋅ ( 2 + VSWL ) ⎬ ⋅ ------------------
⎩ ( 2 + VSWL ) ⋅ f SPCLK0 f
⎭ VBCLK

• for single write within 7 SPCLK0 periods


1
T a = ( SUWL + VSWL + 3 ) ⋅ ------------------
fVBCLK

Register all other


Access R/W (no write access during timer operation)
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 989


Appendix A Registers Access Times

A.5 Watch Timer

Register WTnCNT1
Access R
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

Register WTnR
Access R
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

Access W
1
Formula T a = ( SUWL + 3 ⋅ VSWL + 7 ) ⋅ ------------------
f VBCLK

Register CR00
Access Read-Modify-Write
1
Formula T a = ( SUWL + 3 ⋅ VSWL + 7 ) ⋅ ------------------
f VBCLK

Register all other


Access R/W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

A.6 Watch Calibration Timer

Register CR01
Access R/W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

Access Read-Modify-Write
1
Formula T a = ( SUWL + 3 ⋅ VSWL + 7 ) ⋅ ------------------
f VBCLK

www.DataSheet4U.com Register all other


Access R/W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

990 User’s Manual U17566EE5V1UM00


Registers Access Times Appendix A

A.7 Watchdog Timer

Register all
Access R/W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

A.8 Asynchronous Serial Interface (UARTA)

Register all
Access R/W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

A.9 Clocked Serial Interface (CSIB)

Register all
Access R/W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

A.10 I2C Bus

Register IICSn
Access R
1
Formula T a = ( SUWL + 3 ⋅ VSWL + 7 ) ⋅ ------------------
f VBCLK

Register all other


www.DataSheet4U.com
Access R/W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

User’s Manual U17566EE5V1UM00 991


Appendix A Registers Access Times

A.11 CAN Controller

Register CnMDATA[7:0]m
Access R
Formula fVBCLK
⎧ ------------------------+1 ⎫
⎪ f CANMOD ⎪ 1
T a = ⎨ SUWL + VSWL + 3 + ru 4 ⋅ ---------------------------------- ⋅ ( 2 + VSWL ) ⎬ ⋅ ------------------
⎪ 2 + VSWL f
⎪ VBCLK
⎩ ⎭

Access 8-bit Write


Formula fVBCLK
⎧ ------------------------+1 ⎫
⎪ f CANMOD ⎪ 1
T a = ⎨ SUWL + VSWL + 3 + ru 5 ⋅ ---------------------------------- ⋅ ( 2 + VSWL ) ⎬ ⋅ ------------------
⎪ 2 + VSWL ⎪ f VBCLK
⎩ ⎭

Access 16-bit Write


Formula fVBCLK
⎧ ------------------------+1 ⎫
⎪ f CANMOD ⎪ 1
T a = ⎨ SUWL + VSWL + 3 + ru 3 ⋅ ---------------------------------
- ⋅ ( 2 + VSWL ) ⎬ ⋅ ------------------
⎪ 2 + VSWL f
⎪ VBCLK
⎩ ⎭

Register CnRGPT, CnTGPT, CnLIPT, CnLOPT


Access R
Formula fVBCLK
⎧ ------------------------+1 ⎫
⎪ f CANMOD ⎪ 1
T a = ⎨ SUWL + VSWL + 3 + ru 4 ⋅ ---------------------------------
- ⋅ ( 2 + VSWL ) ⎬ ⋅ ------------------
⎪ 2 + VSWL f
⎪ VBCLK
⎩ ⎭

Register all other


Access R/W
Formula fVBCLK
⎧ ------------------------+1 ⎫
⎪ f CANMOD ⎪ 1
T a = ⎨ SUWL + VSWL + 3 + ru 2 ⋅ ---------------------------------- ⋅ ( 2 + VSWL ) ⎬ ⋅ ------------------
⎪ 2 + VSWL f
⎪ VBCLK
⎩ ⎭

www.DataSheet4U.com

992 User’s Manual U17566EE5V1UM00


Registers Access Times Appendix A

A.12 A/D Converter

Register ADAM0[2:0], ADACR0n


Access R
⎧ VBCLK2⋅ f ⎫ 1
- + 1 ⋅ ( 2 + VSWL ) ⎬ ⋅ ------------------
Formula T a = ⎨ SUWL + VSWL + 3 + ru ------------------------------------------------------------
⎩ ( 2 + VSWL ) ⋅ f SPCLK0 f ⎭ VBCLK

Access W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

Register all other


Access R/W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

A.13 Stepper Motor Controller/Driver

Register MCNTCn[1:0], MCMPCnk


Access R
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

Access W
⎧ VBCLK2⋅ f ⎫ 1
- + 1 ⋅ ( 2 + VSWL ) ⎬ ⋅ ------------------
Formula T a = ⎨ SUWL + VSWL + 3 + ru ------------------------------------------------------------
⎩ ( 2 + VSWL ) ⋅ f SPCLK1 f ⎭ VBCLK

Register all other


Access R/W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

A.14 LCD Controller/Driver

www.DataSheet4U.com Register all


Access R/W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

User’s Manual U17566EE5V1UM00 993


Appendix A Registers Access Times

A.15 LCD Bus Interface

Register all
Access R/W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

www.DataSheet4U.com

994 User’s Manual U17566EE5V1UM00


Registers Access Times Appendix A

A.16 Sound Generator

Register SG0FL, SG0FH, SG0PWM


Access R
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

Access W
1 2
Formula T a = ( SUWL + 3 ⋅ VSWL + 6 ) ⋅ ------------------ + ------------------
f VBCLK f PCLK0

Register all other


Access R/W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

A.17 Clock Generator

Register CGSTAT
Access R
1
Formula T a = ( SUWL + 3 ⋅ VSWL + 7 ) ⋅ ------------------
f VBCLK

Access W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

Register all other


Access R/W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

A.18 All other Registers

www.DataSheet4U.com Register all


Access R/W
1
Formula Ta = ( SUWL + VSWL + 3 ) ⋅ ------------------
f VBCLK

User’s Manual U17566EE5V1UM00 995


Appendix A Registers Access Times

www.DataSheet4U.com

996 User’s Manual U17566EE5V1UM00


Appendix B Special Function Registers

The following tables list all registers that are accessed via the NPB (NEC
peripheral bus). The registers are called “special function registers” (SFR).
Table B-1 lists all CAN special function registers. The addresses are given as
offsets to programmable peripheral base address (refer to “CAN module
register and message buffer addresses“ on page 745.
The tables list all registers and do not distinguish between the different
derivatives.

B.1 CAN Registers

The CAN registers are accessible via the programmable peripheral area.
Table B-1 CAN special function registers (1/4)
Address Initial
Register name Shortcut 1 8 16 32
offset value
0x000 CAN0 Global Macro Control register C0GMCTRL - - R/W - 0x0000
0x000 CAN0 Global Macro Control register low byte C0GMCTRLL R/W R/W - - 0x00
0x001 CAN0 Global Macro Control register high byte C0GMCTRLH R/W R/W - - 0x00
0x002 CAN0 Global Macro Clock Selection register C0GMCS R/W R/W - - 0x0F
0x006 CAN0 Global Macro Automatic Block Transmission C0GMABT 0x0000
- - R/W -
register
0x006 CAN0 Global Macro Automatic Block Transmission C0GMABTL 0x00
R/W R/W - -
register low byte
0x007 CAN0 Global Macro Automatic Block Transmission C0GMABTH 0x00
R/W R/W - -
register high byte
0x008 CAN0 Global Macro Automatic Block Transmission C0GMABTD 0x00
R/W R/W - -
Delay register
0x040 CAN0 Module Mask 1 register lower half word C0MASK1L - - R/W - undefined
0x042 CAN0 Module Mask 1 register upper half word C0MASK1H - - R/W - undefined
0x044 CAN0 Module Mask 2 register lower half word C0MASK2L - - R/W - undefined
0x046 CAN0 Module Mask 2 register upper half word C0MASK2H - - R/W - undefined
0x048 CAN0 Module Mask 3 register lower half word C0MASK3L - - R/W - undefined
0x04A CAN0 Module Mask 3 register upper half word C0MASK3H - - R/W - undefined
0x04C CAN0 Module Mask 4 register lower half word C0MASK4L - - R/W - undefined
0x04E CAN0 Module Mask 4 register upper half word C0MASK4H - - R/W - undefined
www.DataSheet4U.com
0x050 CAN0 Module Control register C0CTRL - - R/W - 0x0000
0x052 CAN0 Module Last Error Code register C0LEC R/W R/W - - 0x00
0x053 CAN0 Module Information register C0INFO R R - - 0x00
0x054 CAN0 Module Error Counter C0ERC - - R/W - 0x0000
0x056 CAN0 Module Interrupt Enable register C0IE - - R/W - 0x0000

User’s Manual U17566EE5V1UM00 997


Appendix B Special Function Registers

Table B-1 CAN special function registers (2/4)


Address Initial
Register name Shortcut 1 8 16 32
offset value
0x056 CAN0 Module Interrupt Enable register low byte C0IEL R/W R/W - - 0x00
0x057 CAN0 Module Interrupt Enable register high byte C0IEH R/W R/W - - 0x00
0x058 CAN0 Module Interrupt Status register C0INTS - - R/W - 0x0000
0x058 CAN0 Module Interrupt Status register low byte C0INTSL R/W R/W - - 0x00
0x05A CAN0 Module Bit-Rate Prescaler register C0BRP R/W R/W - - 0xFF
0x05C CAN0 Bit Rate register C0BTR - - R/W - 0x370F
0x05E CAN0 Module Last In-Pointer register C0LIPT - R/W - - undefined
0x060 CAN0 Module Receive History List Get Pointer C0RGPT 0x??02
- - R/W -
register (undefined)
0x060 CAN0 Module Receive History List Get Pointer C0RGPTL 0x02
R/W R/W - -
register low byte
0x062 CAN0 Module Last Out-Pointer register C0LOPT - R - - undefined
0x064 CAN0 Module Transmit History List Get Pointer C0TGPT 0x??02
- - R/W -
register (undefined)
0x064 CAN0 Module Transmit History List Get Pointer C0TGPTL 0x02
R/W R/W - -
register low byte
0x066 CAN0 Module Time Stamp register C0TS - - R/W - 0x0000
0x066 CAN0 Module Time Stamp register low byte C0TSL R/W R/W - - 0x00
0x067 CAN0 Module Time Stamp register high byte C0TSH R/W R/W - - 0x00
0x100 to CAN0 Message Buffer registers, see Table 20-20 on page 748.
0x4EF
0x600 CAN1 Global Macro Control register C1GMCTRL - - R/W - 0x0000
0x600 CAN1 Global Macro Control register low byte C1GMCTRLL R/W R/W - - 0x00
0x601 CAN1 Global Macro Control register high byte C1GMCTRLH R/W R/W - - 0x00
0x602 CAN1 Global Macro Clock Selection register C1GMCS R/W R/W - - 0x0F
0x606 CAN1 Global Macro Automatic Block Transmission C1GMABT 0x0000
- - R/W -
register
0x606 CAN1 Global Macro Automatic Block Transmission C1GMABTL 0x00
R/W R/W - -
register low byte
0x607 CAN1 Global Macro Automatic Block Transmission C1GMABTH 0x00
R/W R/W - -
register high byte
0x608 CAN1 Global Macro Automatic Block Transmission C1GMABTD 0x00
R/W R/W - -
Delay register
0x640 CAN1 Module Mask 1 register lower half word C1MASK1L - - R/W - undefined
0x642 CAN1 Module Mask 1 register upper half word C1MASK1H - - R/W - undefined
0x644 CAN1 Module Mask 2 register lower half word C1MASK2L - - R/W - undefined
0x646 CAN1 Module Mask 2 register upper half word C1MASK2H - - R/W - undefined
0x648 CAN1 Module Mask 3 register lower half word C1MASK3L - - R/W - undefined
0x64A
www.DataSheet4U.com CAN1 Module Mask 3 register upper half word C1MASK3H - - R/W - undefined
0x64C CAN1 Module Mask 4 register lower half word C1MASK4L - - R/W - undefined
0x64E CAN1 Module Mask 4 register upper half word C1MASK4H - - R/W - undefined
0x650 CAN1 Module Control register C1CTRL - - R/W - 0x0000
0x652 CAN1 Module Last Error Code register C1LEC R/W R/W - - 0x00
0x653 CAN1 Module Information register C1INFO R R - - 0x00

998 User’s Manual U17566EE5V1UM00


Special Function Registers Appendix B

Table B-1 CAN special function registers (3/4)


Address Initial
Register name Shortcut 1 8 16 32
offset value
0x654 CAN1 Module Error Counter C1ERC - - R/W - 0x0000
0x656 CAN1 Module Interrupt Enable register C1IE - - R/W - 0x0000
0x656 CAN1 Module Interrupt Enable register low byte C1IEL R/W R/W - - 0x00
0x657 CAN1 Module Interrupt Enable register high byte C1IEH R/W R/W - - 0x00
0x658 CAN1 Module Interrupt Status register C1INTS - - R/W - 0x0000
0x658 CAN1 Module Interrupt Status register low byte C1INTSL R/W R/W - - 0x00
0x65A CAN1 Module Bit-Rate Prescaler register C1BRP R/W R/W - - 0xFF
0x65C CAN1 Bit Rate register C1BTR - - R/W - 0x370F
0x65E CAN1 Module Last In-Pointer register C1LIPT - R/W - - undefined
0x660 CAN1 Module Receive History List Get Pointer C1RGPT 0x??02
- - R/W -
register (undefined)
0x660 CAN1 Module Receive History List Get Pointer C1RGPTL 0x02
R/W R/W - -
register low byte
0x662 CAN1 Module Last Out-Pointer register C1LOPT - R - - undefined
0x664 CAN1 Module Transmit History List Get Pointer C1TGPT 0x??02
- - R/W -
register (undefined)
0x664 CAN1 Module Transmit History List Get Pointer C1TGPTL 0x02
R/W R/W - -
register low byte
0x666 CAN1 Module Time Stamp register C1TS - - R/W - 0x0000
0x666 CAN1 Module Time Stamp register low byte C1TSL R/W R/W - - 0x00
0x667 CAN1 Module Time Stamp register high byte C1TSH R/W R/W - - 0x00
0x700 to CAN1 Message Buffer registers, see Table 20-20 on page 748.
0xAEF
0xC00 CAN2 Global Macro Control register C2GMCTRL - - R/W - 0x0000
0xC00 CAN2 Global Macro Control register low byte C2GMCTRLL R/W R/W - - 0x00
0xC01 CAN2 Global Macro Control register high byte C2GMCTRLH R/W R/W - - 0x00
0xC02 CAN2 Global Macro Clock Selection register C2GMCS R/W R/W - - 0x0F
0xC06 CAN2 Global Macro Automatic Block Transmission C2GMABT 0x0000
- - R/W -
register
0xC06 CAN2 Global Macro Automatic Block Transmission C2GMABTL 0x00
R/W R/W - -
register low byte
0xC07 CAN2 Global Macro Automatic Block Transmission C2GMABTH 0x00
R/W R/W - -
register high byte
0xC08 CAN2 Global Macro Automatic Block Transmission C2GMABTD 0x00
R/W R/W - -
Delay register
0xC40 CAN2 Module Mask 1 register lower half word C2MASK1L - - R/W - undefined
0xC42 CAN2 Module Mask 1 register upper half word C2MASK1H - - R/W - undefined
0xC44 CAN2 Module Mask 2 register lower half word C2MASK2L - - R/W - undefined
0xC46
www.DataSheet4U.com CAN2 Module Mask 2 register upper half word C2MASK2H - - R/W - undefined
0xC48 CAN2 Module Mask 3 register lower half word C2MASK3L - - R/W - undefined
0xC4A CAN2 Module Mask 3 register upper half word C2MASK3H - - R/W - undefined
0xC4C CAN2 Module Mask 4 register lower half word C2MASK4L - - R/W - undefined
0xC4E CAN2 Module Mask 4 register upper half word C2MASK4H - - R/W - undefined
0xC50 CAN2 Module Control register C2CTRL - - R/W - 0x0000

User’s Manual U17566EE5V1UM00 999


Appendix B Special Function Registers

Table B-1 CAN special function registers (4/4)


Address Initial
Register name Shortcut 1 8 16 32
offset value
0xC52 CAN2 Module Last Error Code register C2LEC R/W R/W - - 0x00
0xC53 CAN2 Module Information register C2INFO R R - - 0x00
0xC54 CAN2 Module Error Counter C2ERC - - R/W - 0x0000
0xC56 CAN2 Module Interrupt Enable register C2IE - - R/W - 0x0000
0xC56 CAN2 Module Interrupt Enable register low byte C2IEL R/W R/W - - 0x00
0xC57 CAN2 Module Interrupt Enable register high byte C2IEH R/W R/W - - 0x00
0xC58 CAN2 Module Interrupt Status register C2INTS - - R/W - 0x0000
0xC58 CAN2 Module Interrupt Status register low byte C2INTSL R/W R/W - - 0x00
0xC5A CAN2 Module Bit-Rate Prescaler register C2BRP R/W R/W - - 0xFF
0xC5C CAN2 Bit Rate register C2BTR - - R/W - 0x370F
0xC5E CAN2 Module Last In-Pointer register C2LIPT - R/W - - undefined
0xC60 CAN2 Module Receive History List Get Pointer C2RGPT 0x??02
- - R/W -
register (undefined)
0xC60 CAN2 Module Receive History List Get Pointer C2RGPTL 0x02
R/W R/W - -
register low byte
0xC62 CAN2 Module Last Out-Pointer register C2LOPT - R - - undefined
0xC64 CAN2 Module Transmit History List Get Pointer C2TGPT 0x??02
- - R/W -
register (undefined)
0xC64 CAN2 Module Transmit History List Get Pointer C2TGPTL 0x02
R/W R/W - -
register low byte
0xC66 CAN2 Module Time Stamp register C2TS - - R/W - 0x0000
0xC66 CAN2 Module Time Stamp register low byte C2TSL R/W R/W - - 0x00
0xC67 CAN2 Module Time Stamp register high byte C2TSH R/W R/W - - 0x00
0xD00 to CAN2 Message Buffer registers, see Table 20-20 on page 748
0x10EF

www.DataSheet4U.com

1000 User’s Manual U17566EE5V1UM00


Special Function Registers Appendix B

B.2 Other Special Function Registers

Table B-2 Other special function registers (1/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFF060 CPU: Chip Area Select Control register 0 CSC0 - - R/W - 0x2C11
0xFFFFF062 CPU: Chip Area Select Control register 1 CSC1 - - R/W - 0x2C11
0xFFFFF064 CPU: Peripheral Area Select Control register BPC - - R/W - 0x0000
0xFFFFF068 CPU: Endian Configuration register BEC - - R/W - 0x0000
0xFFFFF06E CPU: VPB Strobe Wait Control register VSWC R/W R/W - - 0x77
0xFFFFF080 DMA source address register 0L DSAL0 - - R/W - undefined
0xFFFFF082 DMA source address register 0H DSAH0 - - R/W - undefined
0xFFFFF084 DMA destination address register 0L DDAL0 - - R/W - undefined
0xFFFFF086 DMA destination address register 0H DDAH0 - - R/W - undefined
0xFFFFF088 DMA source address register 1L DSAL1 - - R/W - undefined
0xFFFFF08A DMA source address register 1H DSAH1 - - R/W - undefined
0xFFFFF08C DMA destination address register 1L DDAL1 - - R/W - undefined
0xFFFFF08E DMA destination address register 1H DDAH1 - - R/W - undefined
0xFFFFF090 DMA source address register 2L DSAL2 - - R/W - undefined
0xFFFFF092 DMA source address register 2H DSAH2 - - R/W - undefined
0xFFFFF094 DMA destination address register 2L DDAL2 - - R/W - undefined
0xFFFFF096 DMA destination address register 2H DDAH2 - - R/W - undefined
0xFFFFF098 DMA source address register 3L DSAL3 - - R/W - undefined
0xFFFFF09A DMA source address register 3H DSAH3 - - R/W - undefined
0xFFFFF09C DMA destination address register 3L DDAL3 - - R/W - undefined
0xFFFFF09E DMA destination address register 3H DDAH3 - - R/W - undefined
0xFFFFF0C0 DMA transfer count register 0 DBC0 - - R/W - undefined
0xFFFFF0C2 DMA transfer count register 1 DBC1 - - R/W - undefined
0xFFFFF0C4 DMA transfer count register 2 DBC2 - - R/W - undefined
0xFFFFF0C6 DMA transfer count register 3 DBC3 - - R/W - undefined
0xFFFFF0D0 DMA addressing control register 0 DADC0 - - R/W - 0x0000
0xFFFFF0D2 DMA addressing control register 1 DADC1 - - R/W - 0x0000
0xFFFFF0D4 DMA addressing control register 2 DADC2 - - R/W - 0x0000
0xFFFFF0D6 DMA addressing control register 3 DADC3 - - R/W - 0x0000
0xFFFFF0E0 DMA channel control register 0 DCHC0 R/W R/W - - 0x00
0xFFFFF0E2 DMA channel control register 1 DCHC1 R/W R/W - - 0x00
0xFFFFF0E4 DMA channel control register 2 DCHC2 R/W R/W - - 0x00
0xFFFFF0E6 DMA channel control register 3 DCHC3 R/W R/W - - 0x00
0xFFFFF0F2 DMA restart register DRST R/W R/W - - 0x00
www.DataSheet4U.com
0xFFFFF100 Interrupt Mask register 0 IMR0 - - R/W - 0xFFFF
0xFFFFF100 Interrupt Mask register 0L IMR0L R/W R/W - - 0xFF
0xFFFFF101 Interrupt Mask register 0H IMR0H R/W R/W - - 0xFF
0xFFFFF102 Interrupt Mask register 1 IMR1 - - R/W - 0xFFFF
0xFFFFF102 Interrupt Mask register 1L IMR1L R/W R/W - - 0xFF

User’s Manual U17566EE5V1UM00 1001


Appendix B Special Function Registers

Table B-2 Other special function registers (2/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFF103 Interrupt Mask register 1H IMR1H R/W R/W - - 0xFF
0xFFFFF104 Interrupt Mask register 2 IMR2 - - R/W - 0xFFFF
0xFFFFF104 Interrupt Mask register 2L IMR2L R/W R/W - - 0xFF
0xFFFFF105 Interrupt Mask register 2H IMR2H R/W R/W - - 0xFF
0xFFFFF106 Interrupt Mask register 3 IMR3 - - R/W - 0xFFFF
0xFFFFF106 Interrupt Mask register 3L IMR3L R/W R/W - - 0xFF
0xFFFFF107 Interrupt Mask register 3H IMR3H R/W R/W - - 0xFF
0xFFFFF108 Interrupt Mask register 4 IMR4 - - R/W - 0xFFFF
0xFFFFF108 Interrupt Mask register 4L IMR4L R/W R/W - - 0xFF
0xFFFFF109 Interrupt Mask register 4H IMR4H R/W R/W - - 0xFF
0xFFFFF10A Interrupt Mask register 5 IMR5 - - R/W - 0xFFFF
0xFFFFF10A Interrupt Mask register 5L IMR5L R/W R/W - - 0xFF
0xFFFFF10B Interrupt Mask register 5H IMR5H R/W R/W - - 0xFF
0xFFFFF10C Interrupt Mask register 6 IMR6 - - R/W - 0xFFFF
0xFFFFF10C Interrupt Mask register 6L IMR6H R/W R/W - - 0xFF
0xFFFFF10D Interrupt Mask register 6H IMR6L R/W R/W - - 0xFF
0xFFFFF110 Interrupt control register of INTVC0 VC0IC R/W R/W - - 0x47
0xFFFFF112 Interrupt control register of INTVC1 VC1IC R/W R/W - - 0x47
0xFFFFF114 Interrupt control register of INTWT0UV WT0UVIC R/W R/W - - 0x47
0xFFFFF116 Interrupt control register of INTWT1UV WT1UVIC R/W R/W - - 0x47
0xFFFFF11A Interrupt control register of INTTM01 TM01IC R/W R/W - - 0x47
0xFFFFF11C Interrupt control register of INTP0 P0IC R/W R/W - - 0x47
0xFFFFF11E Interrupt control register of INTP1 P1IC R/W R/W - - 0x47
0xFFFFF120 Interrupt control register of INTP2 P2IC R/W R/W - - 0x47
0xFFFFF122 Interrupt control register of INTP3 P3IC R/W R/W - - 0x47
0xFFFFF124 Interrupt control register of INTP4 P4IC R/W R/W - - 0x47
0xFFFFF126 Interrupt control register of INTP5 P5IC R/W R/W - - 0x47
0xFFFFF128 Interrupt control register of INTP6 P6IC R/W R/W - - 0x47
0xFFFFF12A Interrupt control register of INTTZ0UV TZ0UVIC R/W R/W - - 0x47
0xFFFFF12C Interrupt control register of INTTZ1UV TZ1UVIC R/W R/W - - 0x47
0xFFFFF12E Interrupt control register of INTTZ2UV TZ2UVIC R/W R/W - - 0x47
0xFFFFF130 Interrupt control register of INTTZ3UV TZ3UVIC R/W R/W - - 0x47
0xFFFFF132 Interrupt control register of INTTZ4UV TZ4UVIC R/W R/W - - 0x47
0xFFFFF134 Interrupt control register of INTTZ5UV TZ5UVIC R/W R/W - - 0x47
0xFFFFF136 Interrupt control register of INTTP0OV TP0OVIC R/W R/W - - 0x47
0xFFFFF138 Interrupt control register of INTTP0CC0 TP0CC0IC R/W R/W - - 0x47
www.DataSheet4U.com
0xFFFFF13A Interrupt control register of INTTP0CC1 TP0CC1IC R/W R/W - - 0x47
0xFFFFF13C Interrupt control register of INTTP1OV TP1OVIC R/W R/W - - 0x47
0xFFFFF13E Interrupt control register of INTTP1CC0 TP1CC0IC R/W R/W - - 0x47
0xFFFFF140 Interrupt control register of INTTP1CC1 TP1CC1IC R/W R/W - - 0x47
0xFFFFF142 Interrupt control register of INTTP2OV TP2OVIC R/W R/W - - 0x47

1002 User’s Manual U17566EE5V1UM00


Special Function Registers Appendix B

Table B-2 Other special function registers (3/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFF144 Interrupt control register of INTTP2CC0 TP2CC0IC R/W R/W - - 0x47
0xFFFFF146 Interrupt control register of INTTP2CC1 TP2CC1IC R/W R/W - - 0x47
0xFFFFF148 Interrupt control register of INTTP3OV TP3OVIC R/W R/W - - 0x47
0xFFFFF14A Interrupt control register of INTTP3CC0 TP3CC0IC R/W R/W - - 0x47
0xFFFFF14C Interrupt control register of INTTP3CC1 TP3CC1IC R/W R/W - - 0x47
0xFFFFF14E Interrupt control register of INTTG0OV0 TG0OV0IC R/W R/W - - 0x47
0xFFFFF150 Interrupt control register of INTTG0OV1 TG0OV1IC R/W R/W - - 0x47
0xFFFFF152 Interrupt control register of INTTG0CC0 TG0CC0IC R/W R/W - - 0x47
0xFFFFF154 Interrupt control register of INTTG0CC1 TG0CC1IC R/W R/W - - 0x47
0xFFFFF156 Interrupt control register of INTTG0CC2 TG0CC2IC R/W R/W - - 0x47
0xFFFFF158 Interrupt control register of INTTG0CC3 TG0CC3IC R/W R/W - - 0x47
0xFFFFF15A Interrupt control register of INTTG0CC4 TG0CC4IC R/W R/W - - 0x47
0xFFFFF15C Interrupt control register of INTTG0CC5 TG0CC5IC R/W R/W - - 0x47
0xFFFFF15E Interrupt control register of INTTG1OV0 TG1OV0IC R/W R/W - - 0x47
0xFFFFF160 Interrupt control register of INTTG1OV1 TG1OV1IC R/W R/W - - 0x47
0xFFFFF162 Interrupt control register of INTTG1CC0 TG1CC0IC R/W R/W - - 0x47
0xFFFFF164 Interrupt control register of INTTG1CC1 TG1CC1IC R/W R/W - - 0x47
0xFFFFF166 Interrupt control register of INTTG1CC2 TG1CC2IC R/W R/W - - 0x47
0xFFFFF168 Interrupt control register of INTTG1CC3 TG1CC3IC R/W R/W - - 0x47
0xFFFFF16A Interrupt control register of INTTG1CC4 TG1CC4IC R/W R/W - - 0x47
0xFFFFF16C Interrupt control register of INTTG1CC5 TG1CC5IC R/W R/W - - 0x47
0xFFFFF16E Interrupt control register of INTTY0UV0 TY0UV0IC R/W R/W - - 0x47
0xFFFFF170 Interrupt control register of INTTY0UV1 TY0UV1IC R/W R/W - - 0x47
0xFFFFF172 Interrupt control register of INTAD ADIC R/W R/W - - 0x47
0xFFFFF174 Interrupt control register of INTC0ERR C0ERRIC R/W R/W - - 0x47
0xFFFFF176 Interrupt control register of INTC0WUP C0WUPIC R/W R/W - - 0x47
0xFFFFF178 Interrupt control register of INTC0REC C0RECIC R/W R/W - - 0x47
0xFFFFF17A Interrupt control register of INTC0TRX C0TRXIC R/W R/W - - 0x47
0xFFFFF17C Interrupt control register of INTCB0RE CB0REIC R/W R/W - - 0x47
0xFFFFF17E Interrupt control register of INTCB0R CB0RIC R/W R/W - - 0x47
0xFFFFF180 Interrupt control register of INTCB0T CB0TIC R/W R/W - - 0x47
0xFFFFF182 Interrupt control register of INTUA0RE UA0REIC R/W R/W - - 0x47
0xFFFFF184 Interrupt control register of INTUA0R UA0RIC R/W R/W - - 0x47
0xFFFFF186 Interrupt control register of INTUA0T UA0TIC R/W R/W - - 0x47
0xFFFFF188 Interrupt control register of INTUA1RE UA1REIC R/W R/W - - 0x47
0xFFFFF18A Interrupt control register of INTUA1R UA1RIC R/W R/W - - 0x47
www.DataSheet4U.com
0xFFFFF18C Interrupt control register of INTUA1T UA1TIC R/W R/W - - 0x47
0xFFFFF18E Interrupt control register of INTIIC0 IIC0IC R/W R/W - - 0x47
0xFFFFF190 Interrupt control register of INTIIC1 IIC1IC R/W R/W - - 0x47
0xFFFFF192 Interrupt control register of INTSG0 SG0IC R/W R/W - - 0x47
0xFFFFF194 Interrupt control register of INTDMA0 DMA0IC R/W R/W - - 0x47

User’s Manual U17566EE5V1UM00 1003


Appendix B Special Function Registers

Table B-2 Other special function registers (4/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFF196 Interrupt control register of INTDMA1 DMA1IC R/W R/W - - 0x47
0xFFFFF198 Interrupt control register of INTDMA2 DMA2IC R/W R/W - - 0x47
0xFFFFF19A Interrupt control register of INTDMA3 DMA3IC R/W R/W - - 0x47
0xFFFFF19C Interrupt control register of INTSW0 SW0IC R/W R/W - - 0x47
0xFFFFF19E Interrupt control register of INTSW1 SW11IC R/W R/W - - 0x47
0xFFFFF1A0 Interrupt control register of INTP7 P7IC R/W R/W - - 0x47
0xFFFFF1A2 Interrupt control register of INTC1ERR C1ERRIC R/W R/W - - 0x47
0xFFFFF1A4 Interrupt control register of INTC1WUP C1WUPIC R/W R/W - - 0x47
0xFFFFF1A6 Interrupt control register of INTC1REC C1RECIC R/W R/W - - 0x47
0xFFFFF1A8 Interrupt control register of INTC1TRX C1TRXIC R/W R/W - - 0x47
0xFFFFF1AA Interrupt control register of INTTZ6UV TZ6UVIC R/W R/W - - 0x47
0xFFFFF1AC Interrupt control register of INTTZ7UV TZ7UVIC R/W R/W - - 0x47
0xFFFFF1AE Interrupt control register of INTTZ8UV TZ8UVIC R/W R/W - - 0x47
0xFFFFF1B0 Interrupt control register of INTTZ9UV TZ9UVIC R/W R/W - - 0x47
0xFFFFF1B2 Interrupt control register of INTTG2OV0 TG2OV0IC R/W R/W - - 0x47
0xFFFFF1B4 Interrupt control register of INTTG2OV1 TG2OV1IC R/W R/W - - 0x47
0xFFFFF1B6 Interrupt control register of INTTG2CC0 TG2CC0IC R/W R/W - - 0x47
0xFFFFF1B8 Interrupt control register of INTTG2CC1 TG2CC1IC R/W R/W - - 0x47
0xFFFFF1BA Interrupt control register of INTTG2CC2 TG2CC2IC R/W R/W - - 0x47
0xFFFFF1BC Interrupt control register of INTTG2CC3 TG2CC3IC R/W R/W - - 0x47
0xFFFFF1BE Interrupt control register of INTTG2CC4 TG2CC4IC R/W R/W - - 0x47
0xFFFFF1C0 Interrupt control register of INTTG2CC5 TG2CC5IC R/W R/W - - 0x47
0xFFFFF1C2 Interrupt control register of INTCB1RE CB1REIC R/W R/W - - 0x47
0xFFFFF1C4 Interrupt control register of INTCB1R CB1RIC R/W R/W - - 0x47
0xFFFFF1C6 Interrupt control register of INTCB1T CB1TIC R/W R/W - - 0x47
0xFFFFF1C8 Interrupt control register of INTCB2RE CB2REIC R/W R/W - - 0x47
0xFFFFF1CA Interrupt control register of INTCB2R CB2RIC R/W R/W - - 0x47
0xFFFFF1CC Interrupt control register of INTCB2T CB2TIC R/W R/W - - 0x47
0xFFFFF1CE Interrupt control register of INTLCD LCDIC R/W R/W - - 0x47
0xFFFFF1D0 Interrupt control register of INTC2ERR C2ERRIC R/W R/W - - 0x47
0xFFFFF1D2 Interrupt control register of INTC2WUP C2WUPIC R/W R/W - - 0x47
0xFFFFF1D4 Interrupt control register of INTC2REC C2RECIC R/W R/W - - 0x47
0xFFFFF1D6 Interrupt control register of INTC2TRX C2TRXIC R/W R/W - - 0x47
0xFFFFF1FA In-service Priority register ISPR R R - - 0x00
0xFFFFF1FC Command register PRCMD - W - - undefined
0xFFFFF1FE Power Save Control register PSC R/W R/W - - 0x00
www.DataSheet4U.com
0xFFFFF200 ADC mode register 0 ADA0M0 R/W R/W - - 0x00
0xFFFFF201 ADC mode register 1 ADA0M1 R/W R/W - - 0x00
0xFFFFF202 ADC channel select register ADA0S R/W R/W - - 0x00
0xFFFFF203 ADC mode register 2 ADA0M2 R/W R/W - - 0x00
0xFFFFF204 ADC power fail comparison mode register ADA0PFM R/W R/W - - 0x00

1004 User’s Manual U17566EE5V1UM00


Special Function Registers Appendix B

Table B-2 Other special function registers (5/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFF205 ADC power fail threshold register ADA0PFT R/W R/W - - 0x00
0xFFFFF210 ADC result register channel 0 ADCR00 - - R - undefined
0xFFFFF211 ADC result register high byte channel 0 ADCR0H0 R R - - undefined
0xFFFFF212 ADC result register channel 1 ADCR01 - - R - undefined
0xFFFFF213 ADC result register high byte channel 1 ADCR0H1 R R - - undefined
0xFFFFF214 ADC result register channel 2 ADCR02 - - R - undefined
0xFFFFF215 ADC result register high byte channel 2 ADCR0H2 R R - - undefined
0xFFFFF216 ADC result register channel 3 ADCR03 - - R - undefined
0xFFFFF217 ADC result register high byte channel 3 ADCR0H3 R R - - undefined
0xFFFFF218 ADC result register channel 4 ADCR04 - - R - undefined
0xFFFFF219 ADC result register high byte channel 4 ADCR0H4 R R - - undefined
0xFFFFF21A ADC result register channel 5 ADCR05 - - R - undefined
0xFFFFF21B ADC result register high byte channel 5 ADCR0H5 R R - - undefined
0xFFFFF21C ADC result register channel 6 ADCR06 - - R - undefined
0xFFFFF21D ADC result register high byte channel 6 ADCR0H6 R R - - undefined
0xFFFFF21E ADC result register channel 7 ADCR07 - - R - undefined
0xFFFFF21F ADC result register high byte channel 7 ADCR0H7 R R - - undefined
0xFFFFF220 ADC result register channel 8 ADCR08 - - R - undefined
0xFFFFF221 ADC result register high byte channel 8 ADCRH08 R R - - undefined
0xFFFFF222 ADC result register channel 9 ADCR09 - - R - undefined
0xFFFFF223 ADC result register high byte channel 9 ADCR0H9 R R - - undefined
0xFFFFF224 ADC result register channel 10 ADCR010 - - R - undefined
0xFFFFF225 ADC result register high byte channel 10 ADCR0H10 R R - - undefined
0xFFFFF226 ADC result register channel 11 ADCR011 - - R - undefined
0xFFFFF227 ADC result register high byte channel 11 ADCR0H11 R R - - undefined
0xFFFFF228 ADC result register channel 12 ADCR012 - - R - undefined
0xFFFFF229 ADC result register high byte channel 12 ADCR0H12 R R - - undefined
0xFFFFF22A ADC result register channel 13 ADCR013 - - R - undefined
0xFFFFF22B ADC result register high byte channel 13 ADCR0H13 R R - - undefined
0xFFFFF22C ADC result register channel 14 ADCR014 - - R - undefined
0xFFFFF22D ADC result register high byte channel 14 ADCR0H14 R R - - undefined
0xFFFFF22E ADC result register channel 15 ADCR015 - - R - undefined
0xFFFFF22F ADC result register high byte channel 15 ADCR0H15 R R - - undefined
0xFFFFF300 Port Drive strength control register P0 PDSC0 R/W R/W - - 0x00
0xFFFFF302 Port Drive strength control register P1 PDSC1 R/W R/W - - 0x00
0xFFFFF304 Port Drive strength control register P2 PDSC2 R/W R/W - - 0x00
www.DataSheet4U.com
0xFFFFF306 Port Drive strength control register P3 PDSC3 R/W R/W - - 0x00
0xFFFFF308 Port Drive strength control register P4 PDSC4 R/W R/W - - 0x00
0xFFFFF30A Port Drive strength control register P5 PDSC5 R/W R/W - - 0x00
0xFFFFF30C Port Drive strength control register P6 PDSC6 R/W R/W - - 0x00
0xFFFFF310 Port Drive strength control register P8 PDSC8 R/W R/W - - 0x00

User’s Manual U17566EE5V1UM00 1005


Appendix B Special Function Registers

Table B-2 Other special function registers (6/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFF312 Port Drive strength control register P9 PDSC9 R/W R/W - - 0x00
0xFFFFF314 Port Drive strength control register P10 PDSC10 R/W R/W - - 0x00
0xFFFFF344 Port LCD control register P2 PLCDC2 R/W R/W - - 0x00
0xFFFFF346 Port LCD control register P3 PLCDC3 R/W R/W - - 0x00
0xFFFFF348 Port LCD control register P4 PLCDC4 R/W R/W - - 0x00
0xFFFFF34C Port LCD control register port 6 PLCDC6 R/W R/W - - 0x00
0xFFFFF350 Port LCD control register port 8 PLCDC8 R/W R/W - - 0x00
0xFFFFF352 Port LCD control register port 9 PLCDC9 R/W R/W - - 0x00
0xFFFFF354 Port LCD control register port 10 PLCDC10 R/W R/W - - 0x00
0xFFFFF360 Port open drain control register P0 PODC0 R/W R/W - - 0x00
0xFFFFF362 Port open drain control register P1 PODC1 R/W R/W - - 0x00
0xFFFFF364 Port open drain control register P2 PODC2 R/W R/W - - 0x00
0xFFFFF366 Port open drain control register P3 PODC3 R/W R/W - - 0x00
0xFFFFF368 Port open drain control register P4 PODC4 R/W R/W - - 0x00
0xFFFFF36A Port open drain control register P5 PODC5 R/W R/W - - 0x00
0xFFFFF36C Port open drain control register P6 PODC6 R/W R/W - - 0x00
0xFFFFF370 Port open drain control register P8 PODC8 R/W R/W - - 0x00
0xFFFFF372 Port open drain control register P9 PODC9 R/W R/W - - 0x00
0xFFFFF374 Port open drain control register P10 PODC10 R/W R/W - - 0x00
0xFFFFF376 Port open drain control register P11 PODC11 R/W R/W - - 0x00
0xFFFFF378 Port open drain control register P12 PODC12 R/W R/W - - 0x00
0xFFFFF37A Port open drain control register P13 PODC13 R/W R/W - - 0x00
0xFFFFF380 Port input characteristic control register P0 PICC0 R/W R/W - - 0xFF
0xFFFFF382 Port input characteristic control register P1 PICC1 R/W R/W - - 0xFF
0xFFFFF384 Port input characteristic control register P2 PICC2 R/W R/W - - 0xFF
0xFFFFF386 Port input characteristic control register P3 PICC3 R/W R/W - - 0xFF
0xFFFFF388 Port input characteristic control register P4 PICC4 R/W R/W - - 0xFF
0xFFFFF38A Port input characteristic control register P5 PICC5 R/W R/W - - 0xFF
0xFFFFF38C Port input characteristic control register P6 PICC6 R/W R/W - - 0xFF
0xFFFFF390 Port input characteristic control register P8 PICC8 R/W R/W - - 0xFF
0xFFFFF392 Port input characteristic control register P9 PICC9 R/W R/W - - 0xFF
0xFFFFF394 Port input characteristic control register P10 PICC10 R/W R/W - - 0xFF
0xFFFFF396 Port input characteristic control register P11 PICC11 R/W R/W - - 0xFF
0xFFFFF398 Port input characteristic control register P12 PICC12 R/W R/W - - 0xFF
0xFFFFF39A Port input characteristic control register P13 PICC13 R/W R/W - - 0xFF
0xFFFFF3A0 Port input level control register P0 PILC0 R/W R/W - - 0x00
www.DataSheet4U.com
0xFFFFF3A2 Port input level control register P1 PILC1 R/W R/W - - 0x00
0xFFFFF3A4 Port input level control register P2 PILC2 R/W R/W - - 0x00
0xFFFFF3A6 Port input level control register P3 PILC3 R/W R/W - - 0x00
0xFFFFF3A8 Port input level control register P4 PILC4 R/W R/W - - 0x00
0xFFFFF3AA Port input level control register P5 PILC5 R/W R/W - - 0x00

1006 User’s Manual U17566EE5V1UM00


Special Function Registers Appendix B

Table B-2 Other special function registers (7/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFF3AC Port input level control register P6 PILC6 R/W R/W - - 0x00
0xFFFFF3AE Port input level control register P7 PILC7 - - R/W - 0x0000
0xFFFFF3AE Port input level control register P7 low byte PILC7L R/W R/W - - 0x00
0xFFFFF3AF Port input level control register P7 high byte PILC7H R/W R/W - - 0x00
0xFFFFF3B0 Port input level control register P8 PILC8 R/W R/W - - 0x00
0xFFFFF3B2 Port input level control register P9 PILC9 R/W R/W - - 0x00
0xFFFFF3B4 Port input level control register P10 PILC10 R/W R/W - - 0x00
0xFFFFF3B6 Port input level control register P11 PILC11 R/W R/W - - 0x00
0xFFFFF3B8 Port input level control register P12 PILC12 R/W R/W - - 0x00
0xFFFFF3BA Port input level control register P13 PILC13 R/W R/W - - 0x00
0xFFFFF3C0 Port pin read register P0 PPR0 R R - - 0x00
0xFFFFF3C2 Port pin read register P1 PPR1 R R - - 0x00
0xFFFFF3C4 Port pin read register P2 PPR2 R R - - 0x00
0xFFFFF3C6 Port pin read register P3 PPR3 R R - - 0x00
0xFFFFF3C8 Port pin read register P4 PPR4 R R - - 0x00
0xFFFFF3CA Port pin read register P5 PPR5 R R - - 0x00
0xFFFFF3CC Port pin read register P6 PPR6 R R - - 0x00
0xFFFFF3D0 Port pin read register P8 PPR8 R R - - 0x00
0xFFFFF3D2 Port pin read register P9 PPR9 R R - - 0x00
0xFFFFF3D4 Port pin read register P10 PPR10 R R - - 0x00
0xFFFFF3D6 Port pin read register P11 PPR11 R R - - 0x00
0xFFFFF3D8 Port pin read register P12 PPR12 R R - - 0x00
0xFFFFF3DA Port pin read register P13 PPR13 R R - - 0x00
0xFFFFF3DC Port pin read register P14 PPR14 R R - - 0x00
0xFFFFF3E0 Port read control register P0 PRC0 R/W R/W - - 0x00
0xFFFFF3E2 Port read control register P1 PRC1 R/W R/W - - 0x00
0xFFFFF3E4 Port read control register P2 PRC2 R/W R/W - - 0x00
0xFFFFF3E6 Port read control register P3 PRC3 R/W R/W - - 0x00
0xFFFFF3E8 Port read control register P4 PRC4 R/W R/W - - 0x00
0xFFFFF3EA Port read control register P5 PRC5 R/W R/W - - 0x00
0xFFFFF3EC Port read control register P6 PRC6 R/W R/W - - 0x00
0xFFFFF3F0 Port read control register P8 PRC8 R/W R/W - - 0x00
0xFFFFF3F2 Port read control register P9 PRC9 R/W R/W - - 0x00
0xFFFFF3F4 Port read control register P10 PRC10 R/W R/W - - 0x00
0xFFFFF3F6 Port read control register P11 PRC11 R/W R/W - - 0x00
0xFFFFF3F8 Port read control register P12 PRC12 R/W R/W - - 0x00
www.DataSheet4U.com
0xFFFFF3FA Port read control register P13 PRC13 R/W R/W - - 0x00
0xFFFFF3FC Port read control register P14 PRC14 R/W R/W - - 0x00
0xFFFFF400 Port register port 0 P0 R/W R/W - - 0x00
0xFFFFF402 Port register port 1 P1 R/W R/W - - 0x00
0xFFFFF404 Port register port 2 P2 R/W R/W - - 0x00

User’s Manual U17566EE5V1UM00 1007


Appendix B Special Function Registers

Table B-2 Other special function registers (8/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFF406 Port register port 3 P3 R/W R/W - - 0x00
0xFFFFF408 Port register port 4 P4 R/W R/W - - 0x00
0xFFFFF40A Port register port 5 P5 R/W R/W - - 0x00
0xFFFFF40C Port register port 6 P6 R/W R/W - - 0x00
0xFFFFF40E Port register port 7 P7 - - R/W - 0x0000
0xFFFFF40E Port register port 7 low byte P7L R/W R/W - - 0x00
0xFFFFF40F Port register port 7 high byte P7H R/W R/W - - 0x00
0xFFFFF410 Port register port 8 P8 R/W R/W - - 0x00
0xFFFFF412 Port register port 9 P9 R/W R/W - - 0x00
0xFFFFF414 Port register port 10 P10 R/W R/W - - 0x00
0xFFFFF416 Port register port 11 P11 R/W R/W - - 0x00
0xFFFFF418 Port register port 12 P12 R/W R/W - - 0x00
0xFFFFF41A Port register port 13 P13 R/W R/W - - 0x00
0xFFFFF41C Port register port 14 P14 R/W R/W - - 0x00
0xFFFFF420 Port mode register port 0 PM0 R/W R/W - - 0xFF
0xFFFFF422 Port mode register port 1 PM1 R/W R/W - - 0xFF
0xFFFFF424 Port mode register port 2 PM2 R/W R/W - - 0xFF
0xFFFFF426 Port mode register port 3 PM3 R/W R/W - - 0xFF
0xFFFFF428 Port mode register port 4 PM4 R/W R/W - - 0xFF
0xFFFFF42A Port mode register port 5 PM5 R/W R/W - - 0xFF
0xFFFFF42C Port mode register port 6 PM6 R/W R/W - - 0xFF
0xFFFFF430 Port mode register port 8 PM8 R/W R/W - - 0xFF
0xFFFFF432 Port mode register port 9 PM9 R/W R/W - - 0xFF
0xFFFFF434 Port mode register port 10 PM10 R/W R/W - - 0xFF
0xFFFFF436 Port mode register port 11 PM11 R/W R/W - - 0xFF
0xFFFFF438 Port mode register port 12 PM12 R/W R/W - - 0xFF
0xFFFFF43A Port mode register port 13 PM13 R/W R/W - - 0xFF
0xFFFFF43C Port mode register port 14 PM14 R/W R/W - - 0xFF
0xFFFFF440 Port mode control register port 0 PMC0 R/W R/W - - 0x00
0xFFFFF442 Port mode control register port 1 PMC1 R/W R/W - - 0x00
0xFFFFF444 Port mode control register port 2 PMC2 R/W R/W - - 0x00
0xFFFFF446 Port mode control register port 3 PMC3 R/W R/W - - 0x00
0xFFFFF448 Port mode control register port 4 PMC4 R/W R/W - - 0x00
0xFFFFF44A Port mode control register port 5 PMC5 R/W R/W - - 0x00
0xFFFFF44C Port mode control register port 6 PMC6 R/W R/W - - 0x00
0xFFFFF44E Port mode control register port 7 PMC7 - - R/W - 0x0000
www.DataSheet4U.com
0xFFFFF44E Port mode control register port 7 low byte PMC7L R/W R/W - - 0x00
0xFFFFF44F Port mode control register port 7 high byte PMC7H R/W R/W - - 0x00
0xFFFFF450 Port mode control register port 8 PMC8 R/W R/W - - 0x00
0xFFFFF452 Port mode control register port 9 PMC9 R/W R/W - - 0x00
0xFFFFF454 Port mode control register port 10 PMC10 R/W R/W - - 0x00

1008 User’s Manual U17566EE5V1UM00


Special Function Registers Appendix B

Table B-2 Other special function registers (9/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFF456 Port mode control register port 11 PMC11 R/W R/W - - 0x00
0xFFFFF458 Port mode control register port 12 PMC12 R/W R/W - - 0x00
0xFFFFF45A Port mode control register port 13 PMC13 R/W R/W - - 0x00
0xFFFFF45C Port mode control register port 14 PMC14 R/W R/W - - 0x00
0xFFFFF460 Port function control register port 0 PFC0 R/W R/W - - 0x20
0xFFFFF462 Port function control register port 1 PFC1 R/W R/W - - 0x00
0xFFFFF464 Port function control register port 2 PFC2 R/W R/W - - 0x00
0xFFFFF466 Port function control register port 3 PFC3 R/W R/W - - 0x00
0xFFFFF46A Port function control register port 5 PFC5 R/W R/W - - 0x00
0xFFFFF46C Port function control register port 6 PFC6 R/W R/W - - 0x00
0xFFFFF470 Port function control register port 8 PFC8 R/W R/W - - 0x00
0xFFFFF472 Port function control register port 9 PFC9 R/W R/W - - 0x00
0xFFFFF474 Port function control register port 10 PFC10 R/W R/W - - 0x00
0xFFFFF476 Port function control register port 11 PFC11 R/W R/W - - 0x00
0xFFFFF47A Port function control register port 13 PFC13 R/W R/W - - 0x00
0xFFFFF480 Bus cycle type configuration register 0 BCT0 - - R/W - 0x0000
0xFFFFF482 Bus cycle type configuration register 1 BCT1 - - R/W - 0x0000
0xFFFFF484 Data wait control register 0 DWC0 - - R/W - 0x7777
0xFFFFF486 Data wait control register 1 DWC1 - - R/W - 0x7777
0xFFFFF488 Bus cycle control register BCC - - R/W - 0xFFFF
0xFFFFF48A Address setting wait control register ASC - - R/W - 0xFFFF
0xFFFFF48E Local bus size control register LBS - - R/W - 0xAAAA
0xFFFFF498 Bus mode control register BMC R/W - - - 0x00
0xFFFFF49A Page ROM control register PRC - - R/W - 0x7000
0xFFFFF560 Synchronized counter read register WT0 WT0CNT0 - - R - 0x0000
0xFFFFF562 Non-synchronized counter read register WT0 WT0CNT1 - - R - 0x0000
0xFFFFF564 Counter reload register WT0 WT0R - - R/W - 0x0000
0xFFFFF566 Control register WT0 WT0CTL R/W R/W - - 0x00
0xFFFFF570 Synchronized counter read register WT1 WT1CNT0 - - R - 0x0000
0xFFFFF572 Non-synchronized counter read register WT1 WT1CNT1 - - R - 0x0000
0xFFFFF574 Counter reload register WT1 WT1R - - R/W - 0x0000
0xFFFFF576 Control register WT1 WT1CTL R/W R/W - - 0x00
0xFFFFF580 Synchronized counter 0 read register TMY0 TY0CNT00 - - R - 0x0000
0xFFFFF582 Non-synchronized counter 0 read register TMY0 TY0CNT01 - - R - 0x0000
0xFFFFF584 Synchronized counter 1 read register TMY0 TY0CNT10 - - R - 0x0000
0xFFFFF586 Non-synchronized counter 1 read register TMY0 TY0CNT11 - - R - 0x0000
www.DataSheet4U.com
0xFFFFF588 Counter 0 reload register TMY0 TY0R0 - - R/W - 0x0000
0xFFFFF58A Counter 1 reload register TMY0 TY0R1 - - R/W - 0x0000
0xFFFFF58C I/O control register TMY0 TY0IOC R/W R/W - - 0x00
0xFFFFF58D Control register 0 TMY0 TY0CTL R/W R/W - - 0x00
0xFFFFF590 Watchdog timer Frequency select register WDCS R/W R/W - - 0x07

User’s Manual U17566EE5V1UM00 1009


Appendix B Special Function Registers

Table B-2 Other special function registers (10/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFF592 Watchdog timer security register WCMD R/W R/W - - undefined
0xFFFFF594 Watchdog timer mode register WDTM R/W R/W - - 0x00
0xFFFFF596 Watchdog timer error register WPHS R/W R/W - - 0x00
0xFFFFF5A0 SG0 Frequency register SG0F - - - R/W 0x00000000
0xFFFFF5A0 SG0 Frequency register low SG0FL - - R/W - 0x0000
0xFFFFF5A2 SG0 Frequency register high SG0FH - - R/W - 0x0000
0xFFFFF5A4 SG0 Amplitude register SG0PWM - - R/W - 0x0000
0xFFFFF5A6 SG0 Duration factor register SG0SDF R/W R/W - - 0x00
0xFFFFF5A7 SG0 Control register SG0CTL R/W R/W - - 0x00
0xFFFFF5A8 SG0 Interrupt threshold register SG0ITH - - R/W - 0x0000
0xFFFFF5C0 Timer Mode Control register 0 MCNTC00 R/W R/W - - 0x00
0xFFFFF5C2 Compare register 1HW MCMP01HW - - R/W - 0x0000
0xFFFFF5C2 Compare register 10 MCMP010 - R/W - - 0x00
0xFFFFF5C3 Compare register 11 MCMP011 - R/W - - 0x00
0xFFFFF5C4 Compare register 2HW MCMP02HW - - R/W - 0x0000
0xFFFFF5C4 Compare register 20 MCMP020 - R/W - - 0x00
0xFFFFF5C5 Compare register 21 MCMP021 - R/W - - 0x00
0xFFFFF5C6 Compare register 3HW MCMP03HW - - R/W - 0x0000
0xFFFFF5C6 Compare register 30 MCMP030 - R/W - - 0x00
0xFFFFF5C7 Compare register 31 MCMP031 - R/W - - 0x00
0xFFFFF5C8 Compare register 4HW MCMP04HW - - R/W - 0x0000
0xFFFFF5C8 Compare register 40 MCMP040 - R/W - - 0x00
0xFFFFF5C9 Compare register 41 MCMP041 - R/W - - 0x00
0xFFFFF5CA Compare Control register 1 MCMPC01 R/W R/W - - 0x00
0xFFFFF5CC Compare Control register 2 MCMPC02 R/W R/W - - 0x00
0xFFFFF5CE Compare Control register 3 MCMPC03 R/W R/W - - 0x00
0xFFFFF5D0 Compare Control register 4 MCMPC04 R/W R/W - - 0x00
0xFFFFF5D4 Timer Mode Control register 1 MCNTC01 R/W R/W - - 0x00
0xFFFFF5D6 Compare register 5HW MCMP05HW - - R/W - 0x0000
0xFFFFF5D6 Compare register 50 MCMP050 - R/W - - 0x00
0xFFFFF5D7 Compare register 51 MCMP051 - R/W - - 0x00
0xFFFFF5D8 Compare register 6HW MCMP06HW - - R/W - 0x0000
0xFFFFF5D8 Compare register 60 MCMP060 - R/W - - 0x00
0xFFFFF5D9 Compare register 61 MCMP061 - R/W - - 0x00
0xFFFFF5DA Compare Control register 5 MCMPC05 R/W R/W - - 0x00
0xFFFFF5DC Compare Control register 6 MCMPC06 R/W R/W - - 0x00
www.DataSheet4U.com
0xFFFFF5E4 TM00 16-bit capture/compare register 0 CR001 - - R/W - 0x0000
0xFFFFF5E6 TM00 Control register TMC00 R/W R/W - - 0x00
0xFFFFF5E7 TM00 Prescaler mode register PRM00 R/W R/W - - 0x00
0xFFFFF5E8 TM00 Capture/Compare Control register CRC00 R/W R/W - - 0x00
0xFFFFF600 TMZ0 Synchronized counter read register TZ0CNT0 - - R - 0x0000

1010 User’s Manual U17566EE5V1UM00


Special Function Registers Appendix B

Table B-2 Other special function registers (11/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFF602 TMZ0 non-synchronized counter read register TZ0CNT1 - - R - 0x0000
0xFFFFF604 TMZ0 counter reload register TZ0R - - R/W - 0x0000
0xFFFFF606 TMZ0 control register TZ0CTL R/W R/W - - 0x00
0xFFFFF608 TMZ1 Synchronized counter read register TZ1CNT0 - - R - 0x0000
0xFFFFF60A TMZ1 non-synchronized counter read register TZ1CNT1 - - R - 0x0000
0xFFFFF60C TMZ1 counter reload register TZ1R - - R/W - 0x0000
0xFFFFF60E TMZ1 control register TZ1CTL R/W R/W - - 0x00
0xFFFFF610 TMZ2 Synchronized counter read register TZ2CNT0 - - R - 0x0000
0xFFFFF612 TMZ2 non-synchronized counter read register TZ2CNT1 - - R - 0x0000
0xFFFFF614 TMZ2 counter reload register TZ2R - - R/W - 0x0000
0xFFFFF616 TMZ2 control register TZ2CTL R/W R/W - - 0x00
0xFFFFF618 TMZ3 Synchronized counter read register TZ3CNT0 - - R - 0x0000
0xFFFFF61A TMZ3 non-synchronized counter read register TZ3CNT1 - - R - 0x0000
0xFFFFF61C TMZ3 counter reload register TZ3R - - R/W - 0x0000
0xFFFFF61E TMZ3 control register TZ3CTL R/W R/W - - 0x00
0xFFFFF620 TMZ4 Synchronized counter read register TZ4CNT0 - - R - 0x0000
0xFFFFF622 TMZ4 non-synchronized counter read register TZ4CNT1 - - R - 0x0000
0xFFFFF624 TMZ4 counter reload register TZ4R - - R/W - 0x0000
0xFFFFF626 TMZ4 control register TZ4CTL R/W R/W - - 0x00
0xFFFFF628 TMZ5 Synchronized counter read register TZ5CNT0 - - R - 0x0000
0xFFFFF62A TMZ5 non-synchronized counter read register TZ5CNT1 - - R - 0x0000
0xFFFFF62C TMZ5 counter reload register TZ5R - - R/W - 0x0000
0xFFFFF62E TMZ5 control register TZ5CTL R/W R/W - - 0x00
0xFFFFF630 TMZ6 Synchronized counter read register TZ6CNT0 - - R - 0x0000
0xFFFFF632 TMZ6 non-synchronized counter read register TZ6CNT1 - - R - 0x0000
0xFFFFF634 TMZ6 counter reload register TZ6R - - R/W - 0x0000
0xFFFFF636 TMZ6 control register TZ6CTL R/W R/W - - 0x00
0xFFFFF638 TMZ7 Synchronized counter read register TZ7CNT0 - - R - 0x0000
0xFFFFF63A TMZ7 non-synchronized counter read register TZ7CNT1 - - R - 0x0000
0xFFFFF63C TMZ7 counter reload register TZ7R - - R/W - 0x0000
0xFFFFF63E TMZ7 control register TZ7CTL R/W R/W - - 0x00
0xFFFFF640 TMZ8 Synchronized counter read register TZ8CNT0 - - R - 0x0000
0xFFFFF642 TMZ8 non-synchronized counter read register TZ8CNT1 - - R - 0x0000
0xFFFFF644 TMZ8 counter reload register TZ8R - - R/W - 0x0000
0xFFFFF646 TMZ8 control register TZ8CTL R/W R/W - - 0x00
0xFFFFF648 TMZ9 Synchronized counter read register TZ9CNT0 - - R - 0x0000
www.DataSheet4U.com
0xFFFFF64A TMZ9 non-synchronized counter read register TZ9CNT1 - - R - 0x0000
0xFFFFF64C TMZ9 counter reload register TZ9R - - R/W - 0x0000
0xFFFFF64E TMZ9 control register TZ9CTL R/W R/W - - 0x00
0xFFFFF660 TMP0 timer control register 0 TP0CTL0 R/W R/W - - 0x00
0xFFFFF661 TMP0 timer control register 1 TP0CTL1 R/W R/W - - 0x00

User’s Manual U17566EE5V1UM00 1011


Appendix B Special Function Registers

Table B-2 Other special function registers (12/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFF662 TMP0 timer-specific I/O control register 0 TP0IOC0 R/W R/W - - 0x00
0xFFFFF663 TMP0 timer-specific I/O control register 1 TP0IOC1 R/W R/W - - 0x00
0xFFFFF664 TMP0 timer-specific I/O control register 2 TP0IOC2 R/W R/W - - 0x00
0xFFFFF665 TMP0 option register TP0OPT0 R/W R/W - - 0x00
0xFFFFF666 TMP0 capture/compare register 0 TP0CCR0 - - R/W - 0x0000
0xFFFFF668 TMP0 capture/compare register 1 TP0CCR1 - - R/W - 0x0000
0xFFFFF66A TMP0 count register TP0CNT - - R - 0x0000
0xFFFFF670 TMP1 timer control register 0 TP1CTL0 R/W R/W - - 0x00
0xFFFFF671 TMP1 timer control register 1 TP1CTL1 R/W R/W - - 0x00
0xFFFFF672 TMP1 timer-specific I/O control register 0 TP1IOC0 R/W R/W - - 0x00
0xFFFFF673 TMP1 timer-specific I/O control register 1 TP1IOC1 R/W R/W - - 0x00
0xFFFFF674 TMP1 timer-specific I/O control register 2 TP1IOC2 R/W R/W - - 0x00
0xFFFFF675 TMP1 option register TP1OPT0 R/W R/W - - 0x00
0xFFFFF676 TMP1 capture/compare register 0 TP1CCR0 - - R/W - 0x0000
0xFFFFF678 TMP1 capture/compare register 1 TP1CCR1 - - R/W - 0x0000
0xFFFFF67A TMP1 count register TP1CNT - - R - 0x0000
0xFFFFF680 TMP2 timer control register 0 TP2CTL0 R/W R/W - - 0x00
0xFFFFF681 TMP2 timer control register 1 TP2CTL1 R/W R/W - - 0x00
0xFFFFF682 TMP2 timer-specific I/O control register 0 TP2IOC0 R/W R/W - - 0x00
0xFFFFF683 TMP2 timer-specific I/O control register 1 TP2IOC1 R/W R/W - - 0x00
0xFFFFF684 TMP2 timer-specific I/O control register 2 TP2IOC2 R/W R/W - - 0x00
0xFFFFF685 TMP2 option register TP2OPT0 R/W R/W - - 0x00
0xFFFFF686 TMP2 capture/compare register 0 TP2CCR0 - - R/W - 0x0000
0xFFFFF688 TMP2 capture/compare register 1 TP2CCR1 - - R/W - 0x0000
0xFFFFF68A TMP2 count register TP2CNT - - R - 0x0000
0xFFFFF690 TMP3 timer control register 0 TP3CTL0 R/W R/W - - 0x00
0xFFFFF691 TMP3 timer control register 1 TP3CTL1 R/W R/W - - 0x00
0xFFFFF692 TMP3 timer-specific I/O control register 0 TP3IOC0 R/W R/W - - 0x00
0xFFFFF693 TMP3 timer-specific I/O control register 1 TP3IOC1 R/W R/W - - 0x00
0xFFFFF694 TMP3 timer-specific I/O control register 2 TP3IOC2 R/W R/W - - 0x00
0xFFFFF695 TMP3 option register TP3OPT0 R/W R/W - - 0x00
0xFFFFF696 TMP3 capture/compare register 0 TP3CCR0 - - R/W - 0x0000
0xFFFFF698 TMP3 capture/compare register 1 TP3CCR1 - - R/W - 0x0000
0xFFFFF69A TMP3 count register TP3CNT - - R - 0x0000
0xFFFFF6A0 Timer mode register TMG 0 TMGM0 - - R/W - 0x0000
0xFFFFF6A0 Timer mode register TMG 0 low byte TMGM0L R/W R/W - - 0x00
www.DataSheet4U.com
0xFFFFF6A1 Timer mode register TMG 0 high byte TMGM0H R/W R/W - - 0x00
0xFFFFF6A2 Channel mode register TMG 0 TMGCM0 - - R/W - 0x0000
0xFFFFF6A2 Channel mode register TMG 0 low byte TMGCM0L R/W R/W - - 0x00
0xFFFFF6A3 Channel mode register TMG 0 high byte TMGCM0H R/W R/W - - 0x00
0xFFFFF6A4 Output control register TMG 0 OCTLG0 - - R/W - 0x4444

1012 User’s Manual U17566EE5V1UM00


Special Function Registers Appendix B

Table B-2 Other special function registers (13/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFF6A4 Output control register TMG 0 low byte OCTLG0L R/W R/W - - 0x44
0xFFFFF6A5 Output control register TMG 0 high byte OCTLG0H R/W R/W - - 0x44
0xFFFFF6A6 Time base status register TMG 0 TMGST0 R R - - 0x00
0xFFFFF6A8 Timer count register 0 TMG 0 TMG00 - - R - 0x0000
0xFFFFF6AA Timer count register 1 TMG 0 TMG01 - - R - 0x0000
0xFFFFF6AC Capture / Compare register 0 TMG 0 GCC00 - - R/W - 0x0000
0xFFFFF6AE Capture / Compare register 1 TMG 0 GCC01 - - R/W - 0x0000
0xFFFFF6B0 Capture / Compare register 2 TMG 0 GCC02 - - R/W - 0x0000
0xFFFFF6B2 Capture / Compare register 3 TMG 0 GCC03 - - R/W - 0x0000
0xFFFFF6B4 Capture / Compare register 4 TMG 0 GCC04 - - R/W - 0x0000
0xFFFFF6B6 Capture / Compare register 5 TMG 0 GCC05 - - R/W - 0x0000
0xFFFFF6C0 Timer mode register TMG 1 TMGM1 - - R/W - 0x0000
0xFFFFF6C0 Timer mode register TMG 1 low byte TMGM1L R/W R/W - - 0x00
0xFFFFF6C1 Timer mode register TMG 1 high byte TMGM1H R/W R/W - - 0x00
0xFFFFF6C2 Channel mode register TMG 1 TMGCM1 - - R/W - 0x0000
0xFFFFF6C2 Channel mode register TMG 1 low byte TMGCM1L R/W R/W - - 0x00
0xFFFFF6C3 Channel mode register TMG 1 high byte TMGCM1H R/W R/W - - 0x00
0xFFFFF6C4 Output control register TMG 1 OCTLG1 - - R/W - 0x4444
0xFFFFF6C4 Output control register TMG 1 low byte OCTLG1L R/W R/W - - 0x44
0xFFFFF6C5 Output control register TMG 1 high byte OCTLG1H R/W R/W - - 0x44
0xFFFFF6C6 Time base status TMG 1 TMGST1 R R - - 0x00
0xFFFFF6C8 Timer count register 0 TMG 1 TMG10 - - R - 0x0000
0xFFFFF6CA Timer count register 1 TMG 1 TMG11 - - R - 0x0000
0xFFFFF6CC Capture / Compare register 0 TMG 1 GCC10 - - R/W - 0x0000
0xFFFFF6CE Capture / Compare register 1 TMG 1 GCC11 - - R/W - 0x0000
0xFFFFF6D0 Capture / Compare register 2 TMG 1 GCC12 - - R/W - 0x0000
0xFFFFF6D2 Capture / Compare register 3 TMG 1 GCC13 - - R/W - 0x0000
0xFFFFF6D4 Capture / Compare register 4 TMG 1 GCC14 - - R/W - 0x0000
0xFFFFF6D6 Capture / Compare register 5 TMG 1 GCC15 - - R/W - 0x0000
0xFFFFF6E0 Timer mode register TMG 2 TMGM2 - - R/W - 0x0000
0xFFFFF6E0 Timer mode register TMG 2 low byte TMGM2L R/W R/W - - 0x00
0xFFFFF6E1 Timer mode register TMG 2 high byte TMGM2H R/W R/W - - 0x00
0xFFFFF6E2 Channel mode register TMG 2 TMGCM2 - - R/W - 0x0000
0xFFFFF6E2 Channel mode register TMG 2 low byte TMGCM2L R/W R/W - - 0x00
0xFFFFF6E3 Channel mode register TMG 2 high byte TMGCM2H R/W R/W - - 0x00
0xFFFFF6E4 Output control register TMG 2 OCTLG2 - - R/W - 0x4444
www.DataSheet4U.com
0xFFFFF6E4 Output control register TMG 2 low byte OCTLG2L R/W R/W - - 0x44
0xFFFFF6E5 Output control register TMG 2 high byte OCTLG2H R/W R/W - - 0x44
0xFFFFF6E6 Time base status TMG 2 TMGST2 R R - - 0x00
0xFFFFF6E8 Timer count register 0 TMG 2 TMG20 - - R - 0x0000
0xFFFFF6EA Timer count register 1 TMG 2 TMG21 - - R - 0x0000

User’s Manual U17566EE5V1UM00 1013


Appendix B Special Function Registers

Table B-2 Other special function registers (14/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFF6EC Capture / Compare register 0 TMG 2 GCC20 - - R/W - 0x0000
0xFFFFF6EE Capture / Compare register 1 TMG 2 GCC21 - - R/W - 0x0000
0xFFFFF6F0 Capture / Compare register 2 TMG 2 GCC22 - - R/W - 0x0000
0xFFFFF6F2 Capture / Compare register 3 TMG 2 GCC23 - - R/W - 0x0000
0xFFFFF6F4 Capture / Compare register 4 TMG 2 GCC24 - - R/W - 0x0000
0xFFFFF6F6 Capture / Compare register 5 TMG 2 GCC25 - - R/W - 0x0000
0xFFFFF700 Interrupt mode register 0 INTM0 R/W R/W - - 0x00
0xFFFFF702 Interrupt mode register 1 INTM1 R/W R/W - - 0x00
0xFFFFF704 Interrupt mode register 2 INTM2 R/W R/W - - 0x00
0xFFFFF706 Interrupt mode register 3 INTM3 R/W R/W - - 0x00
0xFFFFF710 Digital filter enable register 0 DFEN0 - - R/W - 0x0000
0xFFFFF710 Digital filter enable register 0 low byte DFEN0L R/W R/W - - 0x00
0xFFFFF711 Digital filter enable register 0 high byte DFEN0H R/W R/W - - 0x00
0xFFFFF712 Digital filter enable register 1 DFEN1 - - R/W - 0x0000
0xFFFFF712 Digital filter enable register 1 low byte DFEN1L R/W R/W - - 0x00
0xFFFFF713 Digital filter enable register 1 high byte DFEN1H R/W R/W - - 0x00
0xFFFFF71A Sub oscillator clock monitor control register CLMCS R/W R/W - - 0x00
0xFFFFF720 Peripheral Function Select register 0 PFSR0 R/W R/W - - 0x01
0xFFFFF726 Peripheral Function Select register 3 PFSR3 R/W R/W - - 0x01
0xFFFFF800 Protection register PHCMD - R/W - - undefined
0xFFFFF802 Peripheral status PHS R/W R/W - - 0x00
0xFFFFF820 Power Save Mode PSM R/W R/W - - 0x08/0x00
0xFFFFF822 Clock Control CKC - R/W - - 0x00
0xFFFFF824 Clock Generator Status CGSTAT - R - - 0x0D
0xFFFFF826 Watch Dog Clock Control WCC - R/W - - 0x00
0xFFFFF828 Processor Clock Control PCC - R/W - - 0x10
0xFFFFF82A Frequency Modulation Control SCFMC R/W R/W - - 0x00
0xFFFFF82C Frequency Control 0 SCFC0 R/W R/W - - 0x52
0xFFFFF82E Frequency Control 1 SCFC1 R/W R/W - - 0xEB
0xFFFFF830 SSCG Postscaler Control SCPS R/W R/W - - 0x21
0xFFFFF832 SPCLK Control SCC R/W R/W - - 0x00
0xFFFFF834 FOUTCLK Control FCC R/W R/W - - 0x00
0xFFFFF836 Watch Timer Clock Control TCC R/W R/W - - 0x00
0xFFFFF838 IIC Clock Control ICC R/W R/W - - 0x00
0xFFFFF83C Set Default Clock SDC - R/W - - 0x00
0xFFFFF840 VFB flash/ROM correction address register 0 CORAD0 - - - R/W 0x00000000
www.DataSheet4U.com
0xFFFFF840 VFB flash/ROM correction address register 0L CORAD0L - - R/W - 0x0000
0xFFFFF842 VFB flash/ROM correction address register 0H CORAD0H - - R/W - 0x0000
0xFFFFF844 VFB flash/ROM correction address register 1 CORAD1 - - - R/W 0x00000000
0xFFFFF844 VFB flash/ROM correction address register 1L CORAD1L - - R/W - 0x0000
0xFFFFF846 VFB flash/ROM correction address register 1H CORAD1H - - R/W - 0x0000

1014 User’s Manual U17566EE5V1UM00


Special Function Registers Appendix B

Table B-2 Other special function registers (15/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFF848 VFB flash/ROM correction address register 2 CORAD2 - - - R/W 0x00000000
0xFFFFF848 VFB flash/ROM correction address register 2L CORAD2L - - R/W - 0x0000
0xFFFFF84A VFB flash/ROM correction address register 2H CORAD2H - - R/W - 0x0000
0xFFFFF84C VFB flash/ROM correction address register 3 CORAD3 - - - R/W 0x00000000
0xFFFFF84C VFB flash/ROM correction address register 3L CORAD3L - - R/W - 0x0000
0xFFFFF84E VFB flash/ROM correction address register 3H CORAD3H - - R/W - 0x0000
0xFFFFF850 VFB flash/ROM correction address register 4 CORAD4 - - - R/W 0x00000000
0xFFFFF850 VFB flash/ROM correction address register 4L CORAD4L - - R/W - 0x0000
0xFFFFF852 VFB flash/ROM correction address register 4H CORAD4H - - R/W - 0x0000
0xFFFFF854 VFB flash/ROM correction address register 5 CORAD5 - - - R/W 0x00000000
0xFFFFF854 VFB flash/ROM correction address register 5L CORAD5L - - R/W - 0x0000
0xFFFFF856 VFB flash/ROM correction address register 5H CORAD5H - - R/W - 0x0000
0xFFFFF858 VFB flash/ROM correction address register 6 CORAD6 - - - R/W 0x00000000
0xFFFFF858 VFB flash/ROM correction address register 6L CORAD6L - - R/W - 0x0000
0xFFFFF85A VFB flash/ROM correction address register 6H CORAD6H - - R/W - 0x0000
0xFFFFF85C VFB flash/ROM correction address register 7 CORAD7 - - - R/W 0x00000000
0xFFFFF85C VFB flash/ROM correction address register 7L CORAD7L - - R/W - 0x0000
0xFFFFF85E VFB flash/ROM correction address register 7L CORAD7H - - R/W - 0x0000
0xFFFFF870 Main oscillator clock monitor mode register CLMM R/W R/W - - 0x00
0xFFFFF878 Sub oscillator clock monitor mode register CLMS R/W R/W - - 0x00
0xFFFFF880 VFB flash/ROM correction control register CORCN - R/W - - 0x0000
0xFFFFF8A0 VSB flash correction address register 0 COR2AD0 - - - R/W 0x00000000
0xFFFFF8A0 VSB flash correction address register 0L COR2AD0L - - R/W - 0x0000
0xFFFFF8A2 VSB flash correction address register 0H COR2AD0H - - R/W - 0x0000
0xFFFFF8A4 VSB flash correction address register 1 COR2AD1 - - - R/W 0x00000000
0xFFFFF8A4 VSB flash correction address register 1L COR2AD1L - - R/W - 0x0000
0xFFFFF8A6 VSB flash correction address register 1H COR2AD1H - - R/W - 0x0000
0xFFFFF8A8 VSB flash correction address register 2 COR2AD2 - - - R/W 0x00000000
0xFFFFF8A8 VSB flash correction address register 2L COR2AD2L - - R/W - 0x0000
0xFFFFF8AA VSB flash correction address register 2H COR2AD2H - - R/W - 0x0000
0xFFFFF8AC VSB flash correction address register 3 COR2AD3 - - - R/W 0x00000000
0xFFFFF8AC VSB flash correction address register 3L COR2AD3L - - R/W - 0x0000
0xFFFFF8AE VSB flash correction address register 3H COR2AD3H - - R/W - 0x0000
0xFFFFF8B0 VSB flash correction address register 4 COR2AD4 - - - R/W 0x00000000
0xFFFFF8B0 VSB flash correction address register 4L COR2AD4L - - R/W - 0x0000
0xFFFFF8B2 VSB flash correction address register 4H COR2AD4H - - R/W - 0x0000
www.DataSheet4U.com
0xFFFFF8B4 VSB flash correction address register 5 COR2AD5 - - - R/W 0x00000000
0xFFFFF8B4 VSB flash correction address register 5L COR2AD5L - - R/W - 0x0000
0xFFFFF8B6 VSB flash correction address register 5H COR2AD5H - - R/W - 0x0000
0xFFFFF8B8 VSB flash correction address register 6 COR2AD6 - - - R/W 0x00000000
0xFFFFF8B8 VSB flash correction address register 6L COR2AD6L - - R/W - 0x0000

User’s Manual U17566EE5V1UM00 1015


Appendix B Special Function Registers

Table B-2 Other special function registers (16/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFF8BA VSB flash correction address register 6H COR2AD6H - - R/W - 0x0000
0xFFFFF8BC VSB flash correction address register 7 COR2AD7 - - - R/W 0x00000000
0xFFFFF8BC VSB flash correction address register 7L COR2AD7L - - R/W - 0x0000
0xFFFFF8BE VSB flash correction address register 7L COR2AD7H - - R/W - 0x0000
0xFFFFF900 VFB flash/ROM correction control register 0 CORCTL0 - R/W - - 0x00
0xFFFFF901 VFB flash/ROM correction control register 1 CORCTL1 - R/W - - 0x00
0xFFFFF910 VFB flash/ROM correction address register 0L CORADR0L - - R/W - 0x0000
0xFFFFF910 VFB flash/ROM correction address register 0LL CORADR0LL - R/W - - 0x00
0xFFFFF911 VFB flash/ROM correction address register 0LH CORADR0LH - R/W - - 0x00
0xFFFFF912 VFB flash/ROM correction address register 0H CORADR0H - - R/W - 0x0000
0xFFFFF912 VFB flash/ROM correction address register 0HL CORADR0HL - R/W - - 0x00
0xFFFFF913 VFB flash/ROM correction address register 0HH CORADR0HH - R/W - - 0x00
0xFFFFF914 VFB flash/ROM correction address register 1L CORADR1L - - R/W - 0x0000
0xFFFFF914 VFB flash/ROM correction address register 1LL CORADR1LL - R/W - - 0x00
0xFFFFF915 VFB flash/ROM correction address register 1LH CORADR1LH - R/W - - 0x00
0xFFFFF916 VFB flash/ROM correction address register 1H CORADR1H - - R/W - 0x0000
0xFFFFF916 VFB flash/ROM correction address register 1HL CORADR1HL - R/W - - 0x00
0xFFFFF917 VFB flash/ROM correction address register 1HH CORADR1HH - R/W - - 0x00
0xFFFFF918 VFB flash/ROM correction address register 2L CORADR2L - - R/W - 0x0000
0xFFFFF918 VFB flash/ROM correction address register 2LL CORADR2LL - R/W - - 0x00
0xFFFFF919 VFB flash/ROM correction address register 2LH CORADR2LH - R/W - - 0x00
0xFFFFF91A VFB flash/ROM correction address register 2H CORADR2H - - R/W - 0x0000
0xFFFFF91A VFB flash/ROM correction address register 2HL CORADR2HL - R/W - - 0x00
0xFFFFF91B VFB flash/ROM correction address register 2HH CORADR2HH - R/W - - 0x00
0xFFFFF91C VFB flash/ROM correction address register 3L CORADR3L - - R/W - 0x0000
0xFFFFF91C VFB flash/ROM correction address register 3LL CORADR3LL - R/W - - 0x00
0xFFFFF91D VFB flash/ROM correction address register 3LH CORADR3LH - R/W - - 0x00
0xFFFFF91E VFB flash/ROM correction address register 3H CORADR3H - - R/W - 0x0000
0xFFFFF91E VFB flash/ROM correction address register 3HL CORADR3HL - R/W - - 0x00
0xFFFFF91F VFB flash/ROM correction address register 3HH CORADR3HH - R/W - - 0x00
0xFFFFF920 VFB flash/ROM correction address register 4L CORADR4L - - R/W - 0x0000
0xFFFFF920 VFB flash/ROM correction address register 4LL CORADR4LL - R/W - - 0x00
0xFFFFF921 VFB flash/ROM correction address register 4LH CORADR4LH - R/W - - 0x00
0xFFFFF922 VFB flash/ROM correction address register 4H CORADR4H - - R/W - 0x0000
0xFFFFF922 VFB flash/ROM correction address register 4HL CORADR4HL - R/W - - 0x00
0xFFFFF923 VFB flash/ROM correction address register 4HH CORADR4HH - R/W - - 0x00
www.DataSheet4U.com
0xFFFFF924 VFB flash/ROM correction address register 5L CORADR5L - - R/W - 0x0000
0xFFFFF924 VFB flash/ROM correction address register 5LL CORADR5LL - R/W - - 0x00
0xFFFFF925 VFB flash/ROM correction address register 5LH CORADR5LH - R/W - - 0x00
0xFFFFF926 VFB flash/ROM correction address register 5H CORADR5H - - R/W - 0x0000
0xFFFFF926 VFB flash/ROM correction address register 5HL CORADR5HL - R/W - - 0x00

1016 User’s Manual U17566EE5V1UM00


Special Function Registers Appendix B

Table B-2 Other special function registers (17/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFF927 VFB flash/ROM correction address register 5HH CORADR5HH - R/W - - 0x00
0xFFFFF930 VFB flash/ROM correction value register 0L CORVAL0L - - R/W - 0x0000
0xFFFFF932 VFB flash/ROM correction value register 0H CORVAL0H - - R/W - 0x0000
0xFFFFF934 VFB flash/ROM correction value register 1L CORVAL1L - - R/W - 0x0000
0xFFFFF936 VFB flash/ROM correction value register 1H CORVAL1H - - R/W - 0x0000
0xFFFFF938 VFB flash/ROM correction value register 2L CORVAL2L - - R/W - 0x0000
0xFFFFF93A VFB flash/ROM correction value register 2H CORVAL2H - - R/W - 0x0000
0xFFFFF93C VFB flash/ROM correction value register 3L CORVAL3L - - R/W - 0x0000
0xFFFFF93E VFB flash/ROM correction value register 3H CORVAL3H - - R/W - 0x0000
0xFFFFF940 VFB flash/ROM correction value register 4L CORVAL4L - - R/W - 0x0000
0xFFFFF942 VFB flash/ROM correction value register 4H CORVAL4H - - R/W - 0x0000
0xFFFFF944 VFB flash/ROM correction value register 5L CORVAL5L - - R/W - 0x0000
0xFFFFF946 VFB flash/ROM correction value register 5H CORVAL5H - - R/W - 0x0000
0xFFFFF9D0 VSB flash correction control register COR2CN - R/W - - 0x00
0xFFFFF9FC On Chip Debug Mode register OCDM R/W R/W - - 0x00/0x01
0xFFFFFA00 UARTA0 Control register 0 UA0CTL0 R/W R/W - - 0x10
0xFFFFFA01 UARTA0 Control register 1 UA0CTL1 R/W R/W - - 0x00
0xFFFFFA02 UARTA0 Control register 2 UA0CTL2 R/W R/W - - 0xFF
0xFFFFFA03 UARTA0 Option register UA0OPT0 R/W R/W - - 0x14
0xFFFFFA04 UARTA0 Status register UA0STR R/W R/W - - 0x00
0xFFFFFA06 UARTA0 Reception data register UA0RX - R - - 0xFF
0xFFFFFA07 UARTA0 Transfer data register UA0TX R/W R/W - - 0xFF
0xFFFFFA10 UARTA1 Control register 0 UA1CTL0 R/W R/W - - 0x10
0xFFFFFA11 UARTA1 Control register 1 UA1CTL1 R/W R/W - - 0x00
0xFFFFFA12 UARTA1 Control register 2 UA1CTL2 R/W R/W - - 0xFF
0xFFFFFA13 UARTA1 Option register UA1OPT0 R/W R/W - - 0x14
0xFFFFFA14 UARTA1 Status register UA1STR R/W R/W - - 0x00
0xFFFFFA16 UARTA1 Reception data register UA1RX - R - - 0xFF
0xFFFFFA17 UARTA1 Transfer data register UA1TX R/W R/W - - 0xFF
0xFFFFFB00 LCD clock control LCDC0 R/W R/W - - 0x00
0xFFFFFB01 LCD display mode control LCDM0 R/W R/W - - 0x00
0xFFFFFB20 LCD RAM data SEGREG000 R/W R/W - - 0x00
0xFFFFFB20 LCD RAM data SEGREG020 R/W R/W - - 0x00
0xFFFFFB21 LCD RAM data SEGREG001 R/W R/W - - 0x00
0xFFFFFB21 LCD RAM data SEGREG021 R/W R/W - - 0x00
0xFFFFFB22 LCD RAM data SEGREG002 R/W R/W - - 0x00
www.DataSheet4U.com
0xFFFFFB22 LCD RAM data SEGREG022 R/W R/W - - 0x00
0xFFFFFB23 LCD RAM data SEGREG003 R/W R/W - - 0x00
0xFFFFFB23 LCD RAM data SEGREG023 R/W R/W - - 0x00
0xFFFFFB24 LCD RAM data SEGREG004 R/W R/W - - 0x00
0xFFFFFB24 LCD RAM data SEGREG024 R/W R/W - - 0x00

User’s Manual U17566EE5V1UM00 1017


Appendix B Special Function Registers

Table B-2 Other special function registers (18/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFFB25 LCD RAM data SEGREG005 R/W R/W - - 0x00
0xFFFFFB25 LCD RAM data SEGREG025 R/W R/W - - 0x00
0xFFFFFB26 LCD RAM data SEGREG006 R/W R/W - - 0x00
0xFFFFFB26 LCD RAM data SEGREG026 R/W R/W - - 0x00
0xFFFFFB27 LCD RAM data SEGREG007 R/W R/W - - 0x00
0xFFFFFB27 LCD RAM data SEGREG027 R/W R/W - - 0x00
0xFFFFFB28 LCD RAM data SEGREG008 R/W R/W - - 0x00
0xFFFFFB28 LCD RAM data SEGREG028 R/W R/W - - 0x00
0xFFFFFB29 LCD RAM data SEGREG009 R/W R/W - - 0x00
0xFFFFFB29 LCD RAM data SEGREG029 R/W R/W - - 0x00
0xFFFFFB30 LCD RAM data SEGREG010 R/W R/W - - 0x00
0xFFFFFB30 LCD RAM data SEGREG030 R/W R/W - - 0x00
0xFFFFFB31 LCD RAM data SEGREG011 R/W R/W - - 0x00
0xFFFFFB31 LCD RAM data SEGREG031 R/W R/W - - 0x00
0xFFFFFB32 LCD RAM data SEGREG012 R/W R/W - - 0x00
0xFFFFFB33 LCD RAM data SEGREG013 R/W R/W - - 0x00
0xFFFFFB34 LCD RAM data SEGREG014 R/W R/W - - 0x00
0xFFFFFB35 LCD RAM data SEGREG015 R/W R/W - - 0x00
0xFFFFFB36 LCD RAM data SEGREG016 R/W R/W - - 0x00
0xFFFFFB37 LCD RAM data SEGREG017 R/W R/W - - 0x00
0xFFFFFB38 LCD RAM data SEGREG018 R/W R/W - - 0x00
0xFFFFFB39 LCD RAM data SEGREG019 R/W R/W - - 0x00
0xFFFFFB40 LCD RAM data SEGREG032 R/W R/W - - 0x00
0xFFFFFB41 LCD RAM data SEGREG033 R/W R/W - - 0x00
0xFFFFFB42 LCD RAM data SEGREG034 R/W R/W - - 0x00
0xFFFFFB43 LCD RAM data SEGREG035 R/W R/W - - 0x00
0xFFFFFB44 LCD RAM data SEGREG036 R/W R/W - - 0x00
0xFFFFFB45 LCD RAM data SEGREG037 R/W R/W - - 0x00
0xFFFFFB46 LCD RAM data SEGREG038 R/W R/W - - 0x00
0xFFFFFB47 LCD RAM data SEGREG039 R/W R/W - - 0x00
0xFFFFFB60 LCD Bus Interface Control LBCTL0 R/W R/W - - 0x00
0xFFFFFB61 LCD Bus Interface Cycle Time LBCYC0 R/W R/W - - 0x02
0xFFFFFB62 LCD Bus Interface Wait States LBWST0 R/W R/W - - 0x00
0xFFFFFB70 LCD Bus Interface Data LBDATA0W - - - R/W 0x00000000
0xFFFFFB70 LCD Bus Interface Data LBDATA0 - - R/W - 0x0000
0xFFFFFB70 LCD Bus Interface Data LBDATA0L - R/W - - 0x00
www.DataSheet4U.com
0xFFFFFB74 LCD Bus Interface Data LBDATAR0W - - - R 0x00000000
0xFFFFFB74 LCD Bus Interface Data LBDATAR0 - - R - 0x0000
0xFFFFFB74 LCD Bus Interface Data LBDATAR0L - R - - 0x00
0xFFFFFCA0 Self-programming enable control register SELFEN R/W R/W - - 0x00
0xFFFFFCA2 Stand-by control register STBCTL R/W R/W 0x00

1018 User’s Manual U17566EE5V1UM00


Special Function Registers Appendix B

Table B-2 Other special function registers (19/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFFCA8 Self-programming enable protection register SELFENP - W - - undefined
0xFFFFFCAA Stand-by control protection register STBCTLP - W undefined
0xFFFFFCB0 CLMM write protection register PRCMDCMM - W - - undefined
0xFFFFFCB2 CLMS write protection register PRCMDCMS - W - - undefined
0xFFFFFD00 CSIB0 control register 0 CB0CTL0 R/W R/W - - 0x01
0xFFFFFD01 CSIB0 control register 1 CB0CTL1 R/W R/W - - 0x00
0xFFFFFD02 CSIB0 control register 2 CB0CTL2 - R/W - - 0x00
0xFFFFFD03 CSIB0 status register CB0STR R/W R/W - - 0x00
0xFFFFFD04 CSIB0 received data register CB0RX0 - - R - 0x0000
0xFFFFFD04 CSIB0 received data register low byte CB0RX0L - R - - 0x00
0xFFFFFD06 CSIB0 send data register CB0TX0 - - R/W - 0x0000
0xFFFFFD06 CSIB0 send data register low byte CB0TX0L - R/W - - 0x00
0xFFFFFD10 CSIB1 control register 0 CB1CTL0 R/W R/W - - 0x01
0xFFFFFD11 CSIB1 control register 1 CB1CTL1 R/W R/W - - 0x00
0xFFFFFD12 CSIB1 control register 2 CB1CTL2 - R/W - - 0x00
0xFFFFFD13 CSIB1 status register CB1STR R/W R/W - - 0x00
0xFFFFFD14 CSIB1 received data register CB1RX0 - - R - 0x0000
0xFFFFFD14 CSIB1 received data register low byte CB1RX0L - R - - 0x00
0xFFFFFD16 CSIB1 send data register CB1TX0 - - R/W - 0x0000
0xFFFFFD16 CSIB1 send data register low byte CB1TX0L - R/W - - 0x00
0xFFFFFD20 CSIB2 control register 0 CB2CTL0 R/W R/W - - 0x01
0xFFFFFD21 CSIB2 control register 1 CB2CTL1 R/W R/W - - 0x00
0xFFFFFD22 CSIB2 control register 2 CB2CTL2 - R/W - - 0x00
0xFFFFFD23 CSIB2 status register CB2STR R/W R/W - - 0x00
0xFFFFFD24 CSIB2 received data register CB2RX0 - - R - 0x0000
0xFFFFFD24 CSIB2 received data register low byte CB2RX0L - R - - 0x00
0xFFFFFD26 CSIB2 send data register CB2TX0 - - R/W - 0x0000
0xFFFFFD26 CSIB2 send data register low byte CB2TX0L - R/W - - 0x00
0xFFFFFD80 IIC0 shift register IIC0 - R/W - - 0x00
0xFFFFFD82 IIC0 control register IICC0 R/W R/W - - 0x00
0xFFFFFD83 IIC0 Slave address register SVA0 - R/W - - 0x00
0xFFFFFD84 IIC0 combined IICCL0 and IICX0 register IICCL0IICX0 - - R/W - 0x0000
0xFFFFFD84 IIC0 clock selection register IICCL0 R/W R/W - - 0x00
0xFFFFFD85 IIC0 function expansion register IICX0 R/W R/W - - 0x00
0xFFFFFD86 IIC0 state register IICS0 R R - - 0x00
0xFFFFFD87 IIC0 state register (for emulation only) IICSE0 R R - - 0x00
www.DataSheet4U.com
0xFFFFFD8A IIC0 flag register IICF0 R/W R/W - - 0x00
0xFFFFFD90 IIC1 shift register IIC1 - R/W - - 0x00
0xFFFFFD92 IIC1 control register IICC1 R/W R/W - - 0x00
0xFFFFFD93 IIC1 Slave address register SVA1 - R/W - - 0x00
0xFFFFFD94 IIC1 combined IICCL0 and IICX0 register IICCL1IICX1 - - R/W - 0x0000

User’s Manual U17566EE5V1UM00 1019


Appendix B Special Function Registers

Table B-2 Other special function registers (20/20)


Initial
Address Register name Shortcut 1 8 16 32
value
0xFFFFFD94 IIC1 clock selection register IICCL1 R/W R/W - - 0x00
0xFFFFFD95 IIC1 function expansion register IICX1 R/W R/W - - 0x00
0xFFFFFD96 IIC1 state register IICS1 R R - - 0x00
0xFFFFFD97 IIC1 state register (for emulation only) IICSE1 R R - - 0x00
0xFFFFFD9A IIC1 flag register IICF1 R/W R/W - - 0x00
0xFFFFFDA0 Clock selection register odd prescaler 0 OCKS0 R/W R/W - - 0x00
0xFFFFFDB0 Clock selection register odd prescaler 1 OCKS1 R/W R/W - - 0x00
0xFFFFFDC0 Pre-scalar mode register PRSM0 R/W R/W - - 0x00
0xFFFFFDC1 Pre-scalar compare register PRSCM0 R/W R/W - - 0x00
0xFFFFFDE0 Pre-scalar mode register PRSM1 R/W R/W - - 0x00
0xFFFFFDE1 Pre-scalar compare register PRSCM1 R/W R/W - - 0x00
0xFFFFFDF0 Pre-scalar mode register PRSM2 R/W R/W - - 0x00
0xFFFFFDF1 Pre-scalar compare register PRSCM2 R/W R/W - - 0x00
0xFFFFFE00 DMA trigger source select register 0 DTFR0 R/W R/W - - 0x00
0xFFFFFE02 DMA trigger source select register 1 DTFR1 R/W R/W - - 0x00
0xFFFFFE04 DMA trigger source select register 2 DTFR2 R/W R/W - - 0x00
0xFFFFFE06 DMA trigger source select register 3 DTFR3 R/W R/W - - 0x00
0xFFFFFF00 Read delay control register RDDLY R/W R/W - - 0x00
0xFFFFFF10 Voltage Comparator 0 Control VCCTL0 R/W R/W - - 0x00
0xFFFFFF12 Voltage Comparator 0 Status VCSTR0 R/W R/W - - 0x01
0xFFFFFF14 Voltage Comparator 1 Control VCCTL1 R/W R/W - - 0x00
0xFFFFFF16 Voltage Comparator 1 Status VCSTR1 R/W R/W - - 0x01
0xFFFFFF20 Reset Source Flag register RESSTAT R/W R/W - - 0x02/0x01
0xFFFFFF22 Software reset register RESSWT W W - - 0x00
0xFFFFFF24 Software reset enable register RESCMD W W - - 0x00
0xFFFFFF26 Reset status register RES - R/W - - 0x00

www.DataSheet4U.com

1020 User’s Manual U17566EE5V1UM00


Revision History
This revision list shows all functional changes of this document U17566EE5V1UM00 compared to the
previous manual version U17566EE4V0UM00 (date published 5/6/09) and U17566EE5V0UM00 (date
published 6/10/09)

Revison history compared to U17566EE4V0UM00


Chapter Page Description
3rd CAN channel (CAN2) added for µPD70F3421, µPD70F3422, µPD70F3423,
1 18
µPD70F3424, µPD70F3425, µPD70F3427
1 18 3rd TMG channel (TMG2) added for µPD70F3421, µPD70F3422, and µPD70F3423
3rd CAN channel (CAN2) added for µPD70F3421, µPD70F3422, µPD70F3423,
1 20
µPD70F3424, µPD70F3425, µPD70F3427
block diagram of V850E/DJ3 updated and corrected:- CAN 2 added- TMG2 inputs
1 21
corrected to TIG20 to TIG25
1 22 Note for TMG2 removed from table
1 22 Note for CAN2 channel added to table
1 23 block diagram of V850E/DL3 updated:- CAN2 added
2 35 description of 16-bit access for PMn registers removed
2 40 description of 16-bit access for PPRn registers removed
2 42 description of 16-bit access for PILCn registers added
2 55 alternative output CTXD2 added to P16
2 55 alternative input CRXD2 added to P17
2 55 alternative outputs TOG21 to TOG24 added to P34 to P37
2 55 alternative inputs TIG21 to TIG24 added to P34 to P37
2 56 alternative input TIG20 added to P60
2 56 alternative output TOG21 added to P61
2 56 alternative input TIG21 added to P61
2 56 alternative input TIG25 added to P62
2 56 alternative output TOG24 added to P63
2 56 alternative input TIG24 added to P63
2 56 alternative output TOG22 added to P66
2 56 alternative input TIG22 added to P66
2 56 alternative output TOG23 added to P67
2 56 alternative input TIG23 added to P67
2 57 alternative outputs TOG21 to TOG24 added to P110 to P113
2 58 alternative output CTXD2 added to P16
2 58 alternative input CRXD2 added to P17
alternative input CRXD2 added to list of µPD70F3421, µPD70F3422, µPD70F3423,
2 62
µPD70F3424, µPD70F3425, and µPD70F3427
www.DataSheet4U.com
alternative output CTXD2 added to list of µPD70F3421, µPD70F3422, µPD70F3423,
2 62
µPD70F3424, µPD70F3425, and µPD70F3427
alternative inputs TIG20 to TIG25 added to list of µPD70F3421, µPD70F3422, and
2 66
µPD70F3423
alternative outputs TOG21 to TOG24 added to list of µPD70F3421, µPD70F3422, and
2 66
µPD70F3423

User’s Manual U17566EE5V1UM00 1021


Revison history compared to U17566EE4V0UM00
Chapter Page Description
2 71 alternative output CTXD2 added to P16
2 71 alternative input CRXD2 added to P17
2 71 PFC1 register added
2 75 PFC34 to PFC37 bits available on all devices
2 81 PFC61, PFC63, PFC66 and PFC67 bits available on all devices
2 91 PFC111 to PFC113 bits available on all devices
2 91 PFC111 to PFC113 bits available on all devices
TIG20 to TIG25, TOG21 to TOG24, CRXD2, CTXD2 added to pin overview of of
2 110
µPD70F3421, µPD70F3422, µPD70F3423
CRXD2, CTXD2 added to pin overview of of µPD70F3424, µPD70F3425,
2 111
µPD70F3426A
2 112 CRXD2, CTXD2 added to pin overview of µPD70F3427
TMG2 interrupts (INTTG2OV0, INTTG2OV1, INTTG2CC0, INTTG2CC1,
5 217 INTTG2CC2, INTTG2CC3, INTTG2CC4, INTTG2CC5) added to interrupt/exeception
source list of µPD70F3421, µPD70F3422, µPD70F3423
CAN2 interrupts (INT2ERR, INTC2WUP, INTC2REC, INTC2TRX) added to interrupt/
5 217
exeception source list of µPD70F3421, µPD70F3422, µPD70F3423
TMG2 interrupts (INTTG2OV0, INTTG2OV1, INTTG2CC0, INTTG2CC1,
5 221 INTTG2CC2, INTTG2CC3, INTTG2CC4, INTTG2CC5) added to interrupt/exeception
source list of µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427
CAN2 interrupts (INT2ERR, INTC2WUP, INTC2REC, INTC2TRX) added to interrupt/
5 221
exeception source list of µPD70F3424, µPD70F3425, µPD70F3426A, µPD70F3427
CAN2 interrupt control registers (C2ERRIC, C2WUPIC, C2RECIC, C2TRXIC) added
5 249
to tabel of addresses and bits of interrupt control registers
mask bits TG2OV0MK, TG2OV1MK, TG2CC0MK to TG2CC5MK added to IMR5
5 253
register of µPD70F3421, µPD70F3422, µPD70F3423
7 292 VSB RAM memory size corrected to 24 KB
7 292 end address of VSB RAM adress range corrected to 00605FFFH
9 380 CORADDRn corrected to CORADRn
9 381 CORADDRn corrected to CORADRn
9 382 description of COR3CTL0 register removed
9 383 description of COR3CTL1 register removed
9 384 description of COR3ADRnL registers removed
9 385 description of COR3ADRnH registers removed
9 386 description of COR3VALnL registers removed
9 386 description of COR3VALnH registers removed
13 493 TMG2 added for µPD70F3421, µPD70F3422, and µPD70F3423
flow chart of CSIB single transmission/reception corrected:
18 632 - "INTCBnT bit = 1?" replaced by "INTCBnR generated"?
- checking of CBnTSF bit removed
www.DataSheet4U.com flow chart of CSIB single reception corrected:
18 633
- "INTCBnR bit = 1?" replaced by "INTCBnR generated"?
flow chart of CSIB single transmission/reception corrected:
18 634
- "INTCBnR bit = 1?" replaced by "INTCBnR generated"?

1022 User’s Manual U17566EE5V1UM00


Revison history compared to U17566EE4V0UM00
Chapter Page Description
flow chart of CSIB continuous transmission corrected:
18 635 - "INTCBnT bit = 1?" replaced by "INTCBnT generated"?
- "CBnTSF bit = 1?" replaced by "CBnTSF bit = 0"
18 636 flow chart of continuous reception replaced
18 637 flow chart of continuous transmission/reception replaced
3rd CAN channel (CAN2) added for µPD70F3427, µPD70F3425, µPD70F3424,
20 719
µPD70F3423, µPD70F3422, µPD70F3421
20 745 CAN2 added to CAN module base addresses table
25 935 unused bits in SG0FH register corrected to [15:9]
B 997 initial values added to list of CAN special function registers
B 999 CAN2 registers added to list of CAN special function registers
B 1001 initial values added to list of other special function registers
B 1002 IMR6, IMR6L, IMR6H registers register added to list of other special function registers
B 1004 C2ERRIC register added to list of other special function registers
B 1004 C2WUPIC register added to list of other special function registers
B 1004 C2RECIC register added to list of other special function registers
B 1004 C2TRXIC register added to list of other special function registers
B 1007 PILC7 register access corrected to 16-bit access
B 1007 PILC7L register added to list of other special function registers
B 1007 PILC7H register added to list of other special function registers
B 1008 P14 register added to list of other special function registers
B 1008 PMC7 register access corrected to 16-bit access
B 1008 PMC7L register added to list of other special function registers
B 1008 PMC7H register added to list of other special function registers
B 1009 PFC0 register added to list of other special function registers
B 1009 PFC1register added to list of other special function registers
B 1009 PFC2 register added to list of other special function registers
B 1017 COR2CN register added to list of other special function registers

Revison history compared to U17566EE5V0UM00


Chapter Page Description
limitation of LCD bus I/F pins (DBD[7:0]) to "µPD70F3424, µPD70F3425,
2 86
µPD70F3426A, µPD70F3427 only" removed
SIB2, SOB2 and SCK2 removed from port P80 to P82 (pin no. 97 to 95) in pin
2 110
overview of µPD70F3421, µPD70F3422, µPD70F3423
SIB2, SOB2 and SCK2 added to port P94 to P96 (pin no. 111 to 113) in pin overview
2 111
of µPD70F3424, µPD70F3425, µPD70F3426A
www.DataSheet4U.com set up of the SSCG post clock divider after start of SSCG removed from start-up
4 145
guideline (SSCG post clock divider setting only permitted when SSCG is off)
sub chapter of SSCG control registers corrected (mistakenly inserted twice; former
4 155
sub chapter 4.2.2 removed)
9 392 empty sub chapter 9.4 removed

User’s Manual U17566EE5V1UM00 1023


www.DataSheet4U.com

1024 User’s Manual U17566EE5V1UM00


Index B
Baud rate generator
Numerics CSIB 638
16-bit data busses UARTA 599
Access to 342 BCC 315
8-bit data busses BCTn 311
Access to 336 BCU (Bus Control Unit) 289
BCU registers 301
A BEC 309
A/D conversion result register Hn BMC 316
(ADCR0Hn) 859, 866
Boundary operation conditions 298
A/D conversion result register n (ADCR0n) 859,
BPC 301
866
Bus and memory control 289
A/D Converter 857
Registers 300
Basic operation 869
Bus cycle configuration register (BCTn) 311
Cautions 876
Bus cycle control register (BCC) 315
Configuration 859
Bus mode control register (BMC) 316
Control registers 861
How to read A/D Converter characteristics C
table 878
CALLT base pointer (CTBP) 124
Operation mode 871
CAN (Controller area network) 719
Power-fail compare mode 873
CAN Controller 719
Trigger mode 870
Baud rate settings 821
Access to
Bit set/clear function 752
16-bit data busses 342
Configuration 722
8-bit data busses 336
Connection with target system 744
External devices (initialization) 299
Control registers 754
ADA0M0 862
Diagnosis functions 816
ADA0M1 863
Functions 732
ADA0M2 864
Initialization 790
ADA0PFM 868
Internal registers 745
ADA0PFT 860, 868
Interrupt function 815
ADA0S 865
Message reception 794
ADC channel specification register 0
Message transmission 802
(ADA0S) 865
Operation 829
ADC mode register 0 (ADA0M0) 862
Overview of functions 721
ADC mode register 1 (ADA0M1) 863
Power saving modes 810
ADC mode register 2 (ADA0M2) 864
Register access type 747
ADCR0Hn 859, 866
Register bit configuration 749
ADCR0n 859, 866
Special operational modes 816
Address setup wait control register (ASC) 313
Time stamp function 820
Address space 126
Transition from initialization mode to opera-
CPU 126
tion mode 792
Images 126
CAN protocol 723
Physical 126
www.DataSheet4U.com CANn global automatic block transmission control
ADIC 239 register (CnGMABT) 757
Analog filtered inputs 104 CANn global automatic block transmission delay
ASC 313 register (CnGMABTD) 759
Asynchronous Serial Interface CANn global clock selection register
see UARTA (CnGMCS) 756
Automatic PWM phase shift 895 CANn global control register (CnGMCTRL) 754

User’s Manual U17566EE5V1UM00 1025


Index

CANn message configuration register m CLMS write protection register


(CnMCONFm) 784 (PRCMDCMS) 177
CANn message control register m Clock Generator 139
(CnMCTRLm) 787 Default setup 197
CANn message data byte register Operation 196
(CnMDATAxm) 781 Registers 146
CANn message data length register m Start conditions 144
(CnMDLCm) 783
Clock Generator control register (CKC) 148
CANn message ID register m (CnMIDLm,
Clock Generator registers 146
CnMIDHm) 786
General 148
CANn module bit rate prescaler register
(CnBRP) 772 Peripheral clock 161
CANn module bit rate register (CnBTR) 773 SSCG control 155
CANn module control register (CnCTRL) 762 Clock Generator status register (CGSTAT) 149
CANn module error counter register Clock monitors 142
(CnERC) 768 Operation 198
CANn module information register (CnINFO) 767 Registers 175
CANn module interrupt enable register Clock output FOUTCLK 196
(CnIE) 769 Clocked Serial Interface
CANn module interrupt status register see CSIB
(CnINTS) 771 Clocks
CANn module last error information register CPU 141
(CnLEC) 766 Peripheral 141
CANn module last in-pointer register Special clocks 142
(CnLIPT) 774
CnBRP 772
CANn module last out-pointer register
CnBTR 773
(CnLOPT) 776
CnCTRL 762
CANn module mask control register (CnMASKaL,
CnMASKaH) 760 CnERC 768
CANn module receive history list register CnERRIC 239
(CnRGPT) 775 CnGMABT 757
CANn module time stamp register (CnTS) 779 CnGMABTD 759
CANn module transmit history list register CnGMCS 756
(CnTGPT) 777 CnGMCTRL 754
CBnCTL0 612 CnIE 769
CBnCTL1 614 CnINFO 767
CBnCTL2 616 CnINTS 771
CBnREIC 239 CnLEC 766
CBnRIC 239 CnLIPT 774
CBnRX 619 CnLOPT 776
CBnSTR 618 CnMASKaH 760
CBnTIC 239 CnMASKaL 760
CBnTX 619 CnMCONFm 784
CGSTAT 149 CnMCTRLm 787
Chip area select control registers (CSCn) 305 CnMDATAxm 781
Chip select signals 292 CnMDLCm 783
www.DataSheet4U.com
CKC 148 CnMIDHm 786
CLMCS 178 CnMIDLm 786
CLMM 175 CnRECIC 239
CLMM write protection register CnRGPT 775
(PRCMDCMM) 176 CnTGPT 777
CLMS 177 CnTRXIC 239

1026 User’s Manual U17566EE5V1UM00


Index

CnTS 779 D
CnWUPIC 239 DADCn 358
Combined compare control registers Data access order 336
(MCMPnkHW) 889 Data address space
Command protection register (PHCMD) 150 Recommended use 134
Command register (PRCMD) 173, 267 Data busses
Common signals (LCD Controller/Driver) 904 Access order 336
Compare control registers (MCMPCnk) 890 Data space 128
Compare registers for cosine side Data wait control registers (DWCn) 314
(MCMPnk1) 889
DBCn 357
Compare registers for sine side (MCMPnk0) 888
DBPC 119, 261, 262, 263, 264
Control registers for peripheral clocks 161
DBPSW 122, 261, 262, 263, 264
COR2ADn 392
DCHCn 360
COR2CN 390
DDAHn 355
CORADn 391
DDALn 356
CORADRnH 384
Debug Function (on-chip)
CORADRnL 383
Restrictions and Cautions 982
CORCN 390
Debug function (on-chip) 969
CORCTL0 382
Code protection 393
CORCTL1 382
Debug Trap 263
CORVALnH 386
Default clock setting 194
CORVALnL 385
DFEN0 106
CPU
DFEN1 107
Address space 126
Digital filter enable register (DFEN0) 106
Clocks 141
Digital filter enable register (DFEN1) 107
Core 16
Digitally filtered inputs 104
Functions 113
DMA (direct memory access) 349
Operation after power save mode
DMA Addressing Control Registers n
release 193
(DADCn) 358
Register set 115
DMA Channel Control Registers n (DCHCn) 360
CR001 561
DMA Controller 349
CRC0 560
Automatic restart function 366
CS 292
Channel priorities 368
CSCn 305
Control registers 353
CSIB
Forcible interruption 368
Baud rate generator 638
Forcible termination 369
Control registers 611
Transfer completion 371
Operation 620
Transfer mode 371
Operation flow 632
Transfer object 367
Output pins 631
Transfer start factors 368
CSIB (Clocked Serial Interface) 609
Transfer type 367
CSIB transmit data register (CBnTX) 619
DMA destination address registers Hn
CSIBn control register 0 (CBnCTL0) 612 (DDAHn) 355
CSIBn control register 1 (CBnCTL1) 614 DMA destination address registers Ln
CSIBn control register 2 (CBnCTL2) 616
www.DataSheet4U.com (DDALn) 356
CSIBn receive data register (CBnRX) 619 DMA Functions 349
CSIBn status register (CBnSTR) 618 DMA Restart Register (DRST) 361
CTBP 124 DMA source address registers Hn (DSAHn) 353
CTPC 119 DMA source address registers Ln (DSALn) 354
CTPSW 122 DMA Transfer Count Registers n (DBCn) 357

User’s Manual U17566EE5V1UM00 1027


Index

DMA Trigger Source Select Register n FOUTCLK control register (FCC) 166
(DTFRn) 362
DMAnIC 239 G
DRST 361 GCCn0 503
DSAHn 353 GCCn5 503
DSALn 354 GCCnm 504
DTFRn 362 General purpose registers (r0 to r31) 117
Duty factor (pulse width modulation) 892 Global pointer (GP) 115, 117
DWCn 314
H
E HALT Mode 181
ECR 123
I
EIPC 119, 232, 234, 238, 259, 260, 264, 265
I2C bus 645
EIPSW 122, 232, 234, 238, 259, 260, 264, 265
Acknowledge signal 672
Element pointer (EP) 115, 117
Address match detection method 696
Endian configuration register (BEC) 309
Arbitration 698
Endian format 322
Cautions 705
Exception status flag (EP) 261
Communication operations 706
Exception trap 261
Control registers 654
External bus properties 297
Definitions and control methods 669
Bus access 298
Error detection 696
Bus priority order 297
Extension code 697
Bus width 297
Interrupt request signal (INTIICn) generation
External devices
timing and wait control 695
Initialization for access 299
Interrupt request signals (INTIICn) 677
Interface timing 324
Pin configuration 669
External interrupt configuration registers
Stop condition 674
(INTMn) 257
Timing of data communication 712
External memory area 131
Transfer direction specification 672
External reset 958
Wait signal 675
F Wakeup function 699
FCC 166 ICC 168
FEPC 119, 226, 229, 230 ID code 971
FEPSW 122, 226, 229, 230 IDLE mode 182
Fixed peripheral I/O area 295 Idle pins
Flash area 130, 131 Recommended connection 109
Flash memory 269 Idle state insertion (access to external
Address assignment 271 devices) 324
Checksum 396 IIC clock control register (ICC) 168
ID-field 396 IIC clock select registers (IICCLn) 664
Protection 393 IIC control registers (IICCn) 655
Self-programming 275 IIC division clock select registers (OCKSn) 665
Flash programmer 279 IIC flag registers (IICFn) 662
Communication mode 280 IIC function expansion registers (IICX0n) 665
www.DataSheet4U.com IIC shift registers (IICn) 668
Pin connection 283
Programming method 285 IIC status registers (IICSn) 659
Flash programming IICCLn 664
Mode 126 IICCn 655
via N-Wire 278 IICFn 662
with flash programmer 279 IICn 668

1028 User’s Manual U17566EE5V1UM00


Index

IICnIC 239 LCD Bus Interface 911


IICSn 659 Access modes 913
IICX0n 665 Interrupt generation 914
Illegal opcode Registers 915
Definition 261 Timing 922
Images in address space 126 LCD Bus Interface control register (LBCTL) 916
IMRn 252 LCD Bus Interface cycle time register
Initialization for access to external devices 299 (LBCYC) 917
In-service priority register (ISPR) 255, 267 LCD Bus Interface data register (LBDATA) 919
Instruction set 16 LCD Bus Interface data register (LBDATAR) 921
INT70IC 239 LCD Bus Interface wait state register
INT71IC 239 (LBWST) 918
INTC (Interrupt Controller) 201 LCD clock control register (LCDC0) 901
Internal oscillator LCD Controller/Driver 897
Operation after power save mode 196 Common signals 904
Internal peripheral function wait control register Registers 900
(VSWC) 303 Segment signals 905
Internal RAM area 130 LCD display control register (SEGREG0k) 903
Internal VFB flash and ROM area 130 LCD mode control register (LCDM0) 903
Internal VSB flash area 131 LCDC0 901
Internal VSB RAM area 131 LCDIC 239
Interrupt LCDM0 903
Maskable 232 Link pointer (LP) 115, 117
Non-maskable 226 Local bus size configuration register (LBS) 312
Processing (multiple interrupts) 264
M
Response time 266
Main oscillator clock monitor register
Interrupt control register (PlCn) 267
(CLMM) 175
Interrupt Controller 201
Maskable interrupt status flag (ID) 255
Debug trap 263
Maskable interrupts 232
Edge and level detection configuration 257
Maskable Interrupts Control Register (xxIC) 239
Exception trap 261
MCMPCnk 890
Periods in which interrupts are not
MCMPnk0 888
acknowledged 267
MCMPnk1 889
Software exception 259
MCMPnkHW 889
Interrupt mask registers IMRn 252
MCNTCn0 887
Interrupt/exception source register (ECR) 123
MCNTCn1 887
INTMn 257
MEMC (Memory Controller) 289
ISPR 255, 267
Memory 130
L Access configuration 322
LBCTL 916 Areas 130
LBCYC 917 Banks 292
LBDATA 919 Controller registers 311
LBDATA register
N
Access types 913
www.DataSheet4U.com Noise elimination
LBDATAR 921
Pin input 104
LBS 312
Timer G 529
LBWST 918
Non-maskable interrupts 226
LCD
Normal operation mode 125
Activation of segments 906
N-Wire
Panel addressing 899

User’s Manual U17566EE5V1UM00 1029


Index

Code protection 393 PHCMD 150


Connection to emulator 978 PHS 151
Controlling the interface 974 Physical address space 126
emulator 969 PICCn 41
Enabling methods 976 PILCn 42
Flash programming 278 Pin functions 27
ID code 971 After reset/in stand-by modes 108
Security disabling 972 Unused pins 109
Security function 971 PLCDCn 37
N-Wire security disable control register PMCn 36
(RSUDIS) 972 PMn 35
Pn 39
O
PnIC 239
OCDM 38
POC (Power-On Clear) 957
OCKSn 665
PODCn 43
OCTLGn 501
Port drive strength control register (PDSCn) 41
OCTLGnH 501
Port function control register (PFCn) 36
OCTLGnL 501
Port groups 28
On-chip debug mode register (OCDM) 38
Configuration 54
Operation modes 125
Configuration registers 33
Flash programming mode 126
Port input characteristic control register
Normal operation mode 125 (PICCn) 41
Port input level control register (PILCn) 42
P
Port LCD control register (PLCDCn) 37
Package pins assignment 110
Port mode control register (PMCn) 36
Page ROM
Port mode register (PMn) 35
Access timing 331
Port open drain control register (PODCn) 43
Controller 320
Port pin read register (PPRn) 40
Page ROM configuration register (PRC) 318
Port read control register (PRCn) 40
Page ROM Controller 320
Port register (Pn) 39
PC 119
Power save control register (PSC) 172
PC saving registers 119
Power save mode control register (PSM) 169
PCC 152
Power Save Modes 179
PDSCn 41
Power save modes 143
Peripheral area selection control register
(BPC) 301 Activation 191
Peripheral clocks 141 Control registers 169
Control registers 161 CPU operation after release 193
Peripheral function select register (PFSR0) 45 Description 179
Peripheral function select register (PFSR1) 46 Power Supply Scheme 947
Peripheral function select register (PFSR2) 47 Power-fail compare mode register
(ADA0PFM) 868
Peripheral function select register (PFSR3) 48
Power-fail compare threshold value register
Peripheral I/O area 295
(ADA0PFT) 860, 868
fixed 295
Power-on Clear
programmable 133, 296
www.DataSheet4U.com Reset 957
Peripheral status register (PHS) 151
PPA (programmable peripheral I/O area) 296
PFCn 36
PPRn 40
PFSR0 45
PRC 318
PFSR1 46
PRCMD 173, 267
PFSR2 47
PRCMDCMM 176
PFSR3 48

1030 User’s Manual U17566EE5V1UM00


Index

PRCMDCMS 177 ROM correction control registers


PRCn 40 COR2CN 390
Prescaler compare registers (PRSCMn) 639 CORCN 390
Prescaler mode registers (PRSMn) 639 CORCTL0 382
PRM0 559 CORCTL1 382
Processor clock control register (PCC) 152 ROM Correction Function 375
Program counter (PC) 119 DBTRAP operation and program flow 388
Program space 128 ROM correction value registers
Program status word (PSW) 120 CORVALnH 386
Programmable peripheral I/O area 133, 296 CORVALnL 385
PRSCMn 639 ROMC (ROM controller) 292
PRSMn 639 RSUDIS write protection register (RSUDIS) 973
PSC 172 RSUDISC 972
PSM 169 RSUDISCP 973
PSW 120
PSW saving registers 122 S
PWM (pulse width modulation) 448 SAR 859
PWM phase shift (automatic) 895 Saturated operation instructions 121
SCC 165
R SCFC0 156
RAM area 130, 131 SCFC1 157
RDDLY 317 SCFMC 158
Read delay control register (RDDLY) 317 SCPS 160
regID (system register number) 118 SDC 154
Reload register Segment signals (LCD Controller/Driver) 905
Timer Y (TYnRm) 539 SEGREG0k 903
Timer Z (TZnR) 489 SELFEN 275, 276
Watch Timer (WTnR) 553 SELFENP 275, 276
Reset 953 Self-programming enable control register
At power-on 957 (SELFEN) 275, 276
By clock monitor 959 Self-programming enable protection register
By software 959 (SELFENP) 275, 276
By Watchdog Timer 959 Set default clock register (SDC) 154
External reset 958 SFR (special function register) 997
Hardware status after reset 955 SG0 control register (SG0CTL) 933
Register status after reset 956 SG0 frequency high register (SG0FH) 935
Registers 960 SG0 frequency low register (SG0FL) 934
Variable vector 396 SG0 interrupt threshold register (SG0ITH) 938
Reset source flag register (RESSTAT) 960 SG0 sound duration factor register
(SG0SDF) 937
RESSTAT 960
SG0 volume register (SG0PWM) 936
RESSWT 961
SG0CTL 933
ROM area 130
SG0FH 935
ROM correction
SG0FL 934
Data Replacement 376
SG0IC 239
DBTRAP 387
www.DataSheet4U.com
SG0ITH 938
ROM correction address registers
SG0PWM 936
COR2ADn 392
SG0SDF 937
CORADn 391
Slave address registers (SVAn) 668
CORADRnH 384
Software exception 259
CORADRnL 383
Software reset register (RESSWT) 961

User’s Manual U17566EE5V1UM00 1031


Index

Sound Generator 929 Operation in Free-Run Mode 507


Application hints 945 Output Delay Operation 505
Operation 939 Precautions 530
Registers 932 Timer G capture/compare registers with external
SPCLK control register (SCC) 165 PWW-output function (GCCnm) 504
Special clocks 142 Timer Gn 16-bit counter registers (TMGn0,
Special function registers (list) 997 TMGn1) 502
SSCG control registers 155 Timer Gn capture/compare registers (GCCn0,
GCCn5) 503
SSCG frequency control register 0 (SCFC0) 156
Timer Gn channel mode register (TMGCMn/TM-
SSCG frequency control register 1 (SCFC1) 157
GCMnL/TMGCMnH) 500
SSCG frequency modulation control register
Timer Gn mode register (TMGMn/TMGMnL/
(SCFMC) 158
TMGMnH) 498
SSCG post scaler control register (SCPS) 160
Timer Gn output control register (OCTLGn/OC-
Stack pointer (SP) 115, 117 TLGnL/OCTLGnH) 501
Stand-by Timer mode control registers (MCNTCn0,
Control 142 MCNTCn1) 887
Mode of Voltage Comparator 964 Timer Y 533
Stand-by control protection register Output timing calculations 541
(STBCTLP) 174 Registers 535
Stand-by control register (STBCTL) 174 Timing 540
STBCTL 174 Timer Z 483
STBCTLP 174 Registers 485
Stepper Motor Controller/Driver 883 Timer Z timing 490
Operation 891 Steady operation 490
Registers 886 Timer start and stop 491
STOP mode 185 Timer/Event Counter P 397
Sub oscillator Configuration 398
Operation after power save mode 196 External event count mode 421
Sub oscillator clock monitor control register External trigger pulse output mode 430
(CLMCS) 178
Free-running timer mode 457
Sub oscillator clock monitor register (CLMS) 177
Interval timer mode 412
Sub-chapter "Default clock generator setup"
One-shot pulse output mode 441
added 197
Operation 412
Sub-WATCH mode 184
Pulse width measurement mode 474
Successive approximation register (SAR) 859
PWM output mode 448
SVAn 668
Timer output operations 480
System register set 118
TM0 561
T TM01IC 239
TCC 163 TMC0 558
Test pointer (TP) 115 TMG (Timer G) 494
Text pointer (TP) 117 TMGCMn 500
TGnCCmIC 239 TMGCMnH 500
TGnOV0IC 239 TMGCMnL 500
TGnOV1IC 239 TMGMn 498
www.DataSheet4U.com TMGMnH 498
Time base status register (TMGSTn) 502
Timer G 493 TMGMnL 498
Basic Operation 506 TMGn0 502
Control registers 497 TMGn1 502
Edge Noise Elimination 529 TMGSTn 502
Match and Clear Mode 518 TMP (Timer/event counter P) 397

1032 User’s Manual U17566EE5V1UM00


Index

TMPn capture/compare register 0 UAnCTL2 601


(TPnCCR0) 408 UAnOPT0 581
TMPn capture/compare register 1 UAnREIC 239
(TPnCCR1) 410 UAnRIC 239
TMPn control register 0 (TPnCTL0) 402 UAnRX 584
TMPn control register 1 (TPnCTL1) 403 UAnSTR 582
TMPn counter read buffer register (TPnCNT) 411 UAnTIC 239
TMPn I/O control register 0 (TPnIOC0) 404 UAnTX 584
TMPn I/O control register 1 (TPnIOC1) 405 UARTA
TMPn I/O control register 2 (TPnIOC2) 406 Cautions 606
TMPn option register 0 (TPnOPT0) 407 Dedicated baud rate generator 599
TMY (Timer Y) 533 Interrupt Request Signals 585
TMY I/O control register (TYnIOC) 537 Operation 586
TMY non-synchronized counter registers UARTAn control register 0 (UAnCTL0) 579
(TYnCNTm1) 538
UARTAn control register 1 (UAnCTL1) 600
TMY synchronized counter registers
UARTAn control register 2 (UAnCTL2) 601
(TYnCNTm0) 537
UARTAn option control register 0
TMY timer control register (TYnCTL) 536
(UAnOPT0) 581
TMZ (Timer Z) 483
UARTAn receive data register (UAnRX) 584
TMZn non-synchronized counter register
UARTAn receive shift register 577
(TZnCNT1) 488
UARTAn status register (UAnSTR) 582
TMZn synchronized counter register
(TZnCNT0) 487 UARTAn transmit data register (UAnTX) 584
TMZn timer control register (TZnCTL) 486 UARTAn transmit shift register 577
TPnCC0IC 239
V
TPnCC1IC 239
VCCTLn 965
TPnCCR0 408
VCnIC 239
TPnCCR1 410
VCSTRn 966
TPnCNT 411
Voltage Comparator 963
TPnCTL0 402
Registers 965
TPnCTL1 403
Voltage Comparator n control register
TPnIOC0 404 (VCCTLn) 965
TPnIOC1 405 Voltage Comparator n status register
TPnIOC2 406 (VCSTRn) 966
TPnOPT0 407 Voltage regulators 952
TPnOVIC 239 VSWC 303
TY0CCnIC 239
TYnCNTm0 537 W
TYnCNTm1 538 Wait functions (access to external devices) 322
TYnCTL 536 Watch Calibration Timer
TYnIOC 537 Operation 549, 562
TYnRm 539 Registers 557
TZnCNT0 487 WATCH mode 183
TZnCNT1 488 Watch Timer 545
TZnCTL 486 Operation control (WT0) 548
www.DataSheet4U.com Operation of WT1 548
TZnR 489
TZnUVIC 239 Registers 550
Watch Timer clock control register (TCC) 163
U Watch Timer operation 554
UAnCTL0 579 Start-Up 555
UAnCTL1 600 Steady operation 554

User’s Manual U17566EE5V1UM00 1033


Index

Watchdog Timer 565


Clock 567
Registers 569
Watchdog Timer clock control register
(WCC) 161
Watchdog Timer clock selection register
(WDCS) 570
Watchdog Timer command protection register
(WCMD) 573
Watchdog Timer command status register
(WPHS) 574
Watchdog Timer mode register (WDTM) 572
WCC 161
WCMD 573
WCT (Watch Calibration Timer) 545
WCT capture / compare control register
(CRC0) 560
WCT capture / compare register 1 (CR001) 561
WCT mode control register (TMC0) 558
WCT prescaler mode register (PRM0) 559
WCT timer / counter read register (TM0) 561
WDCS 570
WDTM 572
WPHS 574
Write protected registers 135
WT (Watch Timer) 545
WT0 (Watch Timer 0) 545
WT1 (Watch Timer 1) 545
WTn non-synchronized counter read register
(WTnCNT1) 552
WTn synchronized counter register
(WTnCNT0) 551
WTn timer control register (WTnCTL) 550
WTnCNT0 551
WTnCNT1 552
WTnCTL 550
WTnR 553
WTnUVIC 239

Z
Zero register 115, 117

www.DataSheet4U.com

1034 User’s Manual U17566EE5V1UM00


Index

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 1035


Index

www.DataSheet4U.com

1036 User’s Manual U17566EE5V1UM00


Index

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 1037


Index

www.DataSheet4U.com

1038 User’s Manual U17566EE5V1UM00


Index

www.DataSheet4U.com

User’s Manual U17566EE5V1UM00 1039


Index

www.DataSheet4U.com

1040 User’s Manual U17566EE5V1UM00

You might also like